Merge JDK-8200758-branch
authorherrick
Tue, 24 Sep 2019 15:19:35 -0400
branchJDK-8200758-branch
changeset 58307 aebc7040a250
parent 58306 42c7f9800e30 (current diff)
parent 58300 c3b93d6603f5 (diff)
child 58345 dc4ea94feb52
Merge
src/hotspot/os/linux/gc/z/zVirtualMemory_linux.cpp
src/hotspot/share/gc/z/zUtils.cpp
src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointBlob.cpp
src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointBlob.hpp
src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSetWriter.hpp
src/hotspot/share/oops/access.cpp
src/java.base/macosx/native/libjli/java_md_macosx.m
src/java.base/share/native/libjava/ObjectInputStream.c
src/java.base/share/native/libjava/ObjectOutputStream.c
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/inlining/PolymorphicInliningTest.java
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotClassInitializationPlugin.java
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/NormalizeCompareNode.java
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/JLModule.java
src/jdk.jcmd/linux/classes/sun/tools/ProcessHelper.java
--- a/.hgtags	Tue Sep 24 14:12:08 2019 -0400
+++ b/.hgtags	Tue Sep 24 15:19:35 2019 -0400
@@ -586,3 +586,5 @@
 8570f22b9b6ac6bec673899b582150865696e425 jdk-14+12
 fbbe6672ae15deaf350a9e935290a36f57ba9c25 jdk-14+13
 cddef3bde924f3ff4f17f3d369280cf69d0450e5 jdk-14+14
+9c250a7600e12bdb1e611835250af3204d4aa152 jdk-13-ga
+778fc2dcbdaa8981e07e929a2cacef979c72261e jdk-14+15
--- a/doc/testing.html	Tue Sep 24 14:12:08 2019 -0400
+++ b/doc/testing.html	Tue Sep 24 15:19:35 2019 -0400
@@ -5,7 +5,7 @@
   <meta name="generator" content="pandoc" />
   <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
   <title>Testing the JDK</title>
-  <style type="text/css">
+  <style>
       code{white-space: pre-wrap;}
       span.smallcaps{font-variant: small-caps;}
       span.underline{text-decoration: underline;}
@@ -21,9 +21,9 @@
 <header id="title-block-header">
 <h1 class="title">Testing the JDK</h1>
 </header>
-<nav id="TOC">
+<nav id="TOC" role="doc-toc">
 <ul>
-<li><a href="#using-make-test-the-run-test-framework">Using &quot;make test&quot; (the run-test framework)</a><ul>
+<li><a href="#using-make-test-the-run-test-framework">Using "make test" (the run-test framework)</a><ul>
 <li><a href="#configuration">Configuration</a></li>
 </ul></li>
 <li><a href="#test-selection">Test selection</a><ul>
@@ -42,10 +42,11 @@
 <li><a href="#notes-for-specific-tests">Notes for Specific Tests</a><ul>
 <li><a href="#docker-tests">Docker Tests</a></li>
 <li><a href="#non-us-locale">Non-US locale</a></li>
+<li><a href="#pkcs11-tests">PKCS11 Tests</a></li>
 </ul></li>
 </ul>
 </nav>
-<h2 id="using-make-test-the-run-test-framework">Using &quot;make test&quot; (the run-test framework)</h2>
+<h2 id="using-make-test-the-run-test-framework">Using "make test" (the run-test framework)</h2>
 <p>This new way of running tests is developer-centric. It assumes that you have built a JDK locally and want to test it. Running common test targets is simple, and more complex ad-hoc combination of tests is possible. The user interface is forgiving, and clearly report errors it cannot resolve.</p>
 <p>The main target <code>test</code> uses the jdk-image as the tested product. There is also an alternate target <code>exploded-test</code> that uses the exploded image instead. Not all tests will run successfully on the exploded image, but using this target can greatly improve rebuild times for certain workflows.</p>
 <p>Previously, <code>make test</code> was used to invoke an old system for running tests, and <code>make run-test</code> was used for the new test framework. For backward compatibility with scripts and muscle memory, <code>run-test</code> (and variants like <code>exploded-run-test</code> or <code>run-test-tier1</code>) are kept as aliases.</p>
@@ -63,7 +64,7 @@
 <p>To be able to run microbenchmarks, <code>configure</code> needs to know where to find the JMH dependency. Use <code>--with-jmh=&lt;path to JMH jars&gt;</code> to point to a directory containing the core JMH and transitive dependencies. The recommended dependencies can be retrieved by running <code>sh make/devkit/createJMHBundle.sh</code>, after which <code>--with-jmh=build/jmh/jars</code> should work.</p>
 <h2 id="test-selection">Test selection</h2>
 <p>All functionality is available using the <code>test</code> make target. In this use case, the test or tests to be executed is controlled using the <code>TEST</code> variable. To speed up subsequent test runs with no source code changes, <code>test-only</code> can be used instead, which do not depend on the source and test image build.</p>
-<p>For some common top-level tests, direct make targets have been generated. This includes all JTReg test groups, the hotspot gtest, and custom tests (if present). This means that <code>make test-tier1</code> is equivalent to <code>make test TEST=&quot;tier1&quot;</code>, but the latter is more tab-completion friendly. For more complex test runs, the <code>test TEST=&quot;x&quot;</code> solution needs to be used.</p>
+<p>For some common top-level tests, direct make targets have been generated. This includes all JTReg test groups, the hotspot gtest, and custom tests (if present). This means that <code>make test-tier1</code> is equivalent to <code>make test TEST="tier1"</code>, but the latter is more tab-completion friendly. For more complex test runs, the <code>test TEST="x"</code> solution needs to be used.</p>
 <p>The test specifications given in <code>TEST</code> is parsed into fully qualified test descriptors, which clearly and unambigously show which tests will be run. As an example, <code>:tier1</code> will expand to <code>jtreg:$(TOPDIR)/test/hotspot/jtreg:tier1 jtreg:$(TOPDIR)/test/jdk:tier1 jtreg:$(TOPDIR)/test/langtools:tier1 jtreg:$(TOPDIR)/test/nashorn:tier1 jtreg:$(TOPDIR)/test/jaxp:tier1</code>. You can always submit a list of fully qualified test descriptors in the <code>TEST</code> variable if you want to shortcut the parser.</p>
 <h3 id="jtreg">JTReg</h3>
 <p>JTReg tests can be selected either by picking a JTReg test group, or a selection of files or directories containing JTReg tests.</p>
@@ -103,8 +104,8 @@
 <p>Additional work data is stored in <code>build/$BUILD/test-support/$TEST_ID</code>. For some frameworks, this directory might contain information that is useful in determining the cause of a failed test.</p>
 <h2 id="test-suite-control">Test suite control</h2>
 <p>It is possible to control various aspects of the test suites using make control variables.</p>
-<p>These variables use a keyword=value approach to allow multiple values to be set. So, for instance, <code>JTREG=&quot;JOBS=1;TIMEOUT_FACTOR=8&quot;</code> will set the JTReg concurrency level to 1 and the timeout factor to 8. This is equivalent to setting <code>JTREG_JOBS=1 JTREG_TIMEOUT_FACTOR=8</code>, but using the keyword format means that the <code>JTREG</code> variable is parsed and verified for correctness, so <code>JTREG=&quot;TMIEOUT_FACTOR=8&quot;</code> would give an error, while <code>JTREG_TMIEOUT_FACTOR=8</code> would just pass unnoticed.</p>
-<p>To separate multiple keyword=value pairs, use <code>;</code> (semicolon). Since the shell normally eats <code>;</code>, the recommended usage is to write the assignment inside qoutes, e.g. <code>JTREG=&quot;...;...&quot;</code>. This will also make sure spaces are preserved, as in <code>JTREG=&quot;VM_OPTIONS=-XshowSettings -Xlog:gc+ref=debug&quot;</code>.</p>
+<p>These variables use a keyword=value approach to allow multiple values to be set. So, for instance, <code>JTREG="JOBS=1;TIMEOUT_FACTOR=8"</code> will set the JTReg concurrency level to 1 and the timeout factor to 8. This is equivalent to setting <code>JTREG_JOBS=1 JTREG_TIMEOUT_FACTOR=8</code>, but using the keyword format means that the <code>JTREG</code> variable is parsed and verified for correctness, so <code>JTREG="TMIEOUT_FACTOR=8"</code> would give an error, while <code>JTREG_TMIEOUT_FACTOR=8</code> would just pass unnoticed.</p>
+<p>To separate multiple keyword=value pairs, use <code>;</code> (semicolon). Since the shell normally eats <code>;</code>, the recommended usage is to write the assignment inside qoutes, e.g. <code>JTREG="...;..."</code>. This will also make sure spaces are preserved, as in <code>JTREG="VM_OPTIONS=-XshowSettings -Xlog:gc+ref=debug"</code>.</p>
 <p>(Other ways are possible, e.g. using backslash: <code>JTREG=JOBS=1\;TIMEOUT_FACTOR=8</code>. Also, as a special technique, the string <code>%20</code> will be replaced with space for certain options, e.g. <code>JTREG=VM_OPTIONS=-XshowSettings%20-Xlog:gc+ref=debug</code>. This can be useful if you have layers of scripts and have trouble getting proper quoting of command line arguments through.)</p>
 <p>As far as possible, the names of the keywords have been standardized between test suites.</p>
 <h3 id="general-keywords-test_opts">General keywords (TEST_OPTS)</h3>
@@ -159,7 +160,7 @@
 <p>Set to <code>true</code> or <code>false</code>. If <code>true</code>, JTReg will use <code>-match:</code> option, otherwise <code>-exclude:</code> will be used. Default is <code>false</code>.</p>
 <h4 id="options">OPTIONS</h4>
 <p>Additional options to the JTReg test framework.</p>
-<p>Use <code>JTREG=&quot;OPTIONS=--help all&quot;</code> to see all available JTReg options.</p>
+<p>Use <code>JTREG="OPTIONS=--help all"</code> to see all available JTReg options.</p>
 <h4 id="java_options-1">JAVA_OPTIONS</h4>
 <p>Additional Java options to JTReg (<code>-javaoption</code>).</p>
 <h4 id="vm_options-1">VM_OPTIONS</h4>
@@ -172,7 +173,7 @@
 <p>Default is 1. Set to -1 to repeat indefinitely. This can be especially useful combined with <code>OPTIONS=--gtest_break_on_failure</code> to reproduce an intermittent problem.</p>
 <h4 id="options-1">OPTIONS</h4>
 <p>Additional options to the Gtest test framework.</p>
-<p>Use <code>GTEST=&quot;OPTIONS=--help&quot;</code> to see all available Gtest options.</p>
+<p>Use <code>GTEST="OPTIONS=--help"</code> to see all available Gtest options.</p>
 <h4 id="aot_modules-2">AOT_MODULES</h4>
 <p>Generate AOT modules before testing for the specified module, or set of modules. If multiple modules are specified, they should be separated by space (or, to help avoid quoting issues, the special value <code>%20</code>).</p>
 <h3 id="microbenchmark-keywords">Microbenchmark keywords</h3>
@@ -199,8 +200,12 @@
 <p>To run these tests correctly, additional parameters for the correct docker image are required on Ubuntu 18.04 by using <code>JAVA_OPTIONS</code>.</p>
 <pre><code>$ make test TEST=&quot;jtreg:test/hotspot/jtreg/containers/docker&quot; JTREG=&quot;JAVA_OPTIONS=-Djdk.test.docker.image.name=ubuntu -Djdk.test.docker.image.version=latest&quot;</code></pre>
 <h3 id="non-us-locale">Non-US locale</h3>
-<p>If your locale is non-US, some tests are likely to fail. To work around this you can set the locale to US. On Unix platforms simply setting <code>LANG=&quot;en_US&quot;</code> in the environment before running tests should work. On Windows, setting <code>JTREG=&quot;VM_OPTIONS=-Duser.language=en -Duser.country=US&quot;</code> helps for most, but not all test cases. For example:</p>
+<p>If your locale is non-US, some tests are likely to fail. To work around this you can set the locale to US. On Unix platforms simply setting <code>LANG="en_US"</code> in the environment before running tests should work. On Windows, setting <code>JTREG="VM_OPTIONS=-Duser.language=en -Duser.country=US"</code> helps for most, but not all test cases. For example:</p>
 <pre><code>$ export LANG=&quot;en_US&quot; &amp;&amp; make test TEST=...
 $ make test JTREG=&quot;VM_OPTIONS=-Duser.language=en -Duser.country=US&quot; TEST=...</code></pre>
+<h3 id="pkcs11-tests">PKCS11 Tests</h3>
+<p>It is highly recommended to use the latest NSS version when running PKCS11 tests. Improper NSS version may lead to unexpected failures which are hard to diagnose. For example, sun/security/pkcs11/Secmod/AddTrustedCert.java may fail on Ubuntu 18.04 with the default NSS version in the system. To run these tests correctly, the system property <code>test.nss.lib.paths</code> is required on Ubuntu 18.04 to specify the alternative NSS lib directories. For example:</p>
+<pre><code>$ make test TEST=&quot;jtreg:sun/security/pkcs11/Secmod/AddTrustedCert.java&quot; JTREG=&quot;JAVA_OPTIONS=-Dtest.nss.lib.paths=/path/to/your/latest/NSS-libs&quot;</code></pre>
+<p>For more notes about the PKCS11 tests, please refer to test/jdk/sun/security/pkcs11/README.</p>
 </body>
 </html>
--- a/doc/testing.md	Tue Sep 24 14:12:08 2019 -0400
+++ b/doc/testing.md	Tue Sep 24 15:19:35 2019 -0400
@@ -407,6 +407,20 @@
     $ export LANG="en_US" && make test TEST=...
     $ make test JTREG="VM_OPTIONS=-Duser.language=en -Duser.country=US" TEST=...
 
+### PKCS11 Tests
+
+It is highly recommended to use the latest NSS version when running PKCS11 tests.
+Improper NSS version may lead to unexpected failures which are hard to diagnose.
+For example, sun/security/pkcs11/Secmod/AddTrustedCert.java may fail on Ubuntu
+18.04 with the default NSS version in the system.
+To run these tests correctly, the system property `test.nss.lib.paths` is required
+on Ubuntu 18.04 to specify the alternative NSS lib directories.
+For example:
+
+    $ make test TEST="jtreg:sun/security/pkcs11/Secmod/AddTrustedCert.java" JTREG="JAVA_OPTIONS=-Dtest.nss.lib.paths=/path/to/your/latest/NSS-libs"
+
+For more notes about the PKCS11 tests, please refer to test/jdk/sun/security/pkcs11/README.
+
 ---
 # Override some definitions in the global css file that are not optimal for
 # this document.
--- a/make/Main.gmk	Tue Sep 24 14:12:08 2019 -0400
+++ b/make/Main.gmk	Tue Sep 24 15:19:35 2019 -0400
@@ -707,6 +707,8 @@
   $(foreach m, $(JAVA_MODULES), \
       $(eval $m-java: $(addsuffix -java, $(filter $(JAVA_MODULES), \
       $(call FindDepsForModule,$m)))))
+  # Declare dependencies between the module meta targets
+  $(foreach m, $(ALL_MODULES), $(eval $m: $(call FindDepsForModule,$m)))
 
   # Declare dependencies between <module>-rmic to <module>-java
   $(foreach m, $(RMIC_MODULES), $(eval $m-rmic: $m-java))
--- a/make/autoconf/basics.m4	Tue Sep 24 14:12:08 2019 -0400
+++ b/make/autoconf/basics.m4	Tue Sep 24 15:19:35 2019 -0400
@@ -205,6 +205,32 @@
   fi
 ])
 
+################################################################################
+# This will make a path absolute. Assumes it's already a unix path. Also
+# resolves ~ to homedir.
+AC_DEFUN([BASIC_ABSOLUTE_PATH],
+[
+  if test "x[$]$1" != x; then
+    new_path="[$]$1"
+
+    if [ [[ "$new_path" = ~* ]] ]; then
+      # Use eval to expand a potential ~
+      eval new_path="$new_path"
+      if test ! -f "$new_path" && test ! -d "$new_path"; then
+        AC_MSG_ERROR([The new_path of $1, which resolves as "$new_path", is not found.])
+      fi
+    fi
+
+    if test -d "$new_path"; then
+      $1="`cd "$new_path"; $THEPWDCMD -L`"
+    else
+      dir="`$DIRNAME "$new_path"`"
+      base="`$BASENAME "$new_path"`"
+      $1="`cd "$dir"; $THEPWDCMD -L`/$base"
+    fi
+  fi
+])
+
 ###############################################################################
 # This will make sure the given variable points to a full and proper
 # path. This means:
@@ -217,7 +243,6 @@
 AC_DEFUN([BASIC_FIXUP_PATH],
 [
   # Only process if variable expands to non-empty
-
   if test "x[$]$1" != x; then
     if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
       BASIC_FIXUP_PATH_CYGWIN($1)
@@ -234,19 +259,8 @@
         AC_MSG_ERROR([Spaces are not allowed in this path.])
       fi
 
-      # Use eval to expand a potential ~
-      eval path="$path"
-      if test ! -f "$path" && test ! -d "$path"; then
-        AC_MSG_ERROR([The path of $1, which resolves as "$path", is not found.])
-      fi
-
-      if test -d "$path"; then
-        $1="`cd "$path"; $THEPWDCMD -L`"
-      else
-        dir="`$DIRNAME "$path"`"
-        base="`$BASENAME "$path"`"
-        $1="`cd "$dir"; $THEPWDCMD -L`/$base"
-      fi
+      BASIC_ABSOLUTE_PATH(path)
+      $1="$path"
     fi
   fi
 ])
--- a/make/autoconf/basics_windows.m4	Tue Sep 24 14:12:08 2019 -0400
+++ b/make/autoconf/basics_windows.m4	Tue Sep 24 15:19:35 2019 -0400
@@ -148,6 +148,8 @@
   path="[$]$1"
   new_path=`$CYGPATH -u "$path"`
 
+  BASIC_ABSOLUTE_PATH(new_path)
+
   # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
   # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
   # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
@@ -181,6 +183,8 @@
     new_path=`cmd //c echo $path`
   fi
 
+  BASIC_ABSOLUTE_PATH(new_path)
+
   BASIC_MAKE_WINDOWS_SPACE_SAFE_MSYS([$new_path])
   BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(new_path)
   if test "x$path" != "x$new_path"; then
@@ -199,6 +203,8 @@
   new_path="[$]$1"
   BASIC_WINDOWS_REWRITE_AS_UNIX_PATH([new_path])
 
+  BASIC_ABSOLUTE_PATH(new_path)
+
   # Call helper function which possibly converts this using DOS-style short mode.
   # If so, the updated path is stored in $new_path.
   BASIC_MAKE_WINDOWS_SPACE_SAFE_WSL([$new_path])
--- a/make/autoconf/buildjdk-spec.gmk.in	Tue Sep 24 14:12:08 2019 -0400
+++ b/make/autoconf/buildjdk-spec.gmk.in	Tue Sep 24 15:19:35 2019 -0400
@@ -91,7 +91,7 @@
 # Save speed and disk space by not enabling debug symbols for the buildjdk
 ENABLE_DEBUG_SYMBOLS := false
 
-# Control wether Hotspot builds gtest tests
+# Control whether Hotspot builds gtest tests
 BUILD_GTEST := false
 
 JVM_VARIANTS := server
--- a/make/autoconf/spec.gmk.in	Tue Sep 24 14:12:08 2019 -0400
+++ b/make/autoconf/spec.gmk.in	Tue Sep 24 15:19:35 2019 -0400
@@ -286,7 +286,7 @@
 VALID_JVM_FEATURES := @VALID_JVM_FEATURES@
 VALID_JVM_VARIANTS := @VALID_JVM_VARIANTS@
 
-# Control wether Hotspot builds gtest tests
+# Control whether Hotspot builds gtest tests
 BUILD_GTEST := @BUILD_GTEST@
 
 # Allow overriding the default hotspot library path
--- a/make/autoconf/toolchain_windows.m4	Tue Sep 24 14:12:08 2019 -0400
+++ b/make/autoconf/toolchain_windows.m4	Tue Sep 24 15:19:35 2019 -0400
@@ -808,7 +808,7 @@
   if test "x$USE_UCRT" = "xtrue"; then
     AC_MSG_CHECKING([for UCRT DLL dir])
     if test "x$with_ucrt_dll_dir" != x; then
-      if test -z "$(ls -d $with_ucrt_dll_dir/*.dll 2> /dev/null)"; then
+      if test -z "$(ls -d "$with_ucrt_dll_dir/"*.dll 2> /dev/null)"; then
         AC_MSG_RESULT([no])
         AC_MSG_ERROR([Could not find any dlls in $with_ucrt_dll_dir])
       else
--- a/make/common/TestFilesCompilation.gmk	Tue Sep 24 14:12:08 2019 -0400
+++ b/make/common/TestFilesCompilation.gmk	Tue Sep 24 15:19:35 2019 -0400
@@ -62,7 +62,7 @@
     $1_OUTPUT_SUBDIR := lib
     $1_BASE_CFLAGS := $(CFLAGS_JDKLIB)
     $1_BASE_CXXFLAGS := $(CXXFLAGS_JDKLIB)
-    $1_LDFLAGS := $(LDFLAGS_JDKLIB) $(call SET_SHARED_LIBRARY_ORIGIN)
+    $1_LDFLAGS := $(LDFLAGS_JDKLIB) $$(call SET_SHARED_LIBRARY_ORIGIN)
     $1_COMPILATION_TYPE := LIBRARY
   else ifeq ($$($1_TYPE), PROGRAM)
     $1_PREFIX = exe
--- a/make/data/tzdata/VERSION	Tue Sep 24 14:12:08 2019 -0400
+++ b/make/data/tzdata/VERSION	Tue Sep 24 15:19:35 2019 -0400
@@ -21,4 +21,4 @@
 # or visit www.oracle.com if you need additional information or have any
 # questions.
 #
-tzdata2019b
+tzdata2019c
--- a/make/data/tzdata/asia	Tue Sep 24 14:12:08 2019 -0400
+++ b/make/data/tzdata/asia	Tue Sep 24 15:19:35 2019 -0400
@@ -31,7 +31,7 @@
 # tz@iana.org for general use in the future).  For more, please see
 # the file CONTRIBUTING in the tz distribution.
 
-# From Paul Eggert (2018-06-19):
+# From Paul Eggert (2019-07-11):
 #
 # Unless otherwise specified, the source for data through 1990 is:
 # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition),
@@ -70,13 +70,13 @@
 #	7:00 WIB	west Indonesia (Waktu Indonesia Barat)
 #	8:00 WITA	central Indonesia (Waktu Indonesia Tengah)
 #	8:00 CST	China
-#	8:00 PST  PDT*	Philippine Standard Time
+#	8:00 HKT  HKST	Hong Kong (HKWT* for Winter Time in late 1941)
+#	8:00 PST  PDT*	Philippines
 #	8:30 KST  KDT	Korea when at +0830
 #	9:00 WIT	east Indonesia (Waktu Indonesia Timur)
 #	9:00 JST  JDT	Japan
 #	9:00 KST  KDT	Korea when at +09
-#	9:30 ACST	Australian Central Standard Time
-# *I invented the abbreviation PDT; see "Philippines" below.
+# *I invented the abbreviations HKWT and PDT; see below.
 # Otherwise, these tables typically use numeric abbreviations like +03
 # and +0330 for integer hour and minute UT offsets.  Although earlier
 # editions invented alphabetic time zone abbreviations for every
@@ -676,6 +676,15 @@
 # * 1941-09-30, Hong Kong Daily Press, Winter Time Warning.
 #   https://i.imgur.com/dge4kFJ.png
 
+# From Paul Eggert (2019-07-11):
+# "Hong Kong winter time" is considered to be daylight saving.
+# "Hong Kong had adopted daylight saving on June 15 as a wartime measure,
+# clocks moving forward one hour until October 1, when they would be put back
+# by just half an hour for 'Hong Kong Winter time', so that daylight saving
+# operated year round." -- Low Z. The longest day: when wartime Hong Kong
+# introduced daylight saving. South China Morning Post. 2019-06-28.
+# https://www.scmp.com/magazines/post-magazine/short-reads/article/3016281/longest-day-when-wartime-hong-kong-introduced
+
 # From P Chan (2018-12-31):
 # * According to the Hong Kong Daylight-Saving Regulations, 1941, the
 #   1941 spring-forward transition was at 03:00.
@@ -777,7 +786,7 @@
 Zone	Asia/Hong_Kong	7:36:42 -	LMT	1904 Oct 30  0:36:42
 			8:00	-	HKT	1941 Jun 15  3:00
 			8:00	1:00	HKST	1941 Oct  1  4:00
-			8:30	-	HKT	1941 Dec 25
+			8:00	0:30	HKWT	1941 Dec 25
 			9:00	-	JST	1945 Nov 18  2:00
 			8:00	HK	HK%sT
 
@@ -2442,7 +2451,7 @@
 Zone	Asia/Seoul	8:27:52	-	LMT	1908 Apr  1
 			8:30	-	KST	1912 Jan  1
 			9:00	-	JST	1945 Sep  8
-			9:00	-	KST	1954 Mar 21
+			9:00	ROK	K%sT	1954 Mar 21
 			8:30	ROK	K%sT	1961 Aug 10
 			9:00	ROK	K%sT
 Zone	Asia/Pyongyang	8:23:00 -	LMT	1908 Apr  1
@@ -3627,7 +3636,7 @@
 # and in South Vietnam in particular (after 1954):
 # To 07:00 on 1911-05-01.
 # To 08:00 on 1942-12-31 at 23:00.
-# To 09:00 in 1945-03-14 at 23:00.
+# To 09:00 on 1945-03-14 at 23:00.
 # To 07:00 on 1945-09-02 in Vietnam.
 # To 08:00 on 1947-04-01 in French-controlled Indochina.
 # To 07:00 on 1955-07-01 in South Vietnam.
--- a/make/data/tzdata/australasia	Tue Sep 24 14:12:08 2019 -0400
+++ b/make/data/tzdata/australasia	Tue Sep 24 15:19:35 2019 -0400
@@ -390,13 +390,18 @@
 # From Raymond Kumar (2018-07-13):
 # http://www.fijitimes.com/government-approves-2018-daylight-saving/
 # ... The daylight saving period will end at 3am on Sunday January 13, 2019.
-#
-# From Paul Eggert (2018-07-15):
-# For now, guess DST from 02:00 the first Sunday in November to 03:00
-# the first Sunday on or after January 13.  January transitions reportedly
+
+# From Paul Eggert (2019-08-06):
+# Today Raymond Kumar reported the Government of Fiji Gazette Supplement No. 27
+# (2019-08-02) said that Fiji observes DST "commencing at 2.00 am on
+# Sunday, 10 November 2019 and ending at 3.00 am on Sunday, 12 January 2020."
+# For now, guess DST from 02:00 the second Sunday in November to 03:00
+# the first Sunday on or after January 12.  January transitions reportedly
 # depend on when school terms start.  Although the guess is ad hoc, it matches
-# transitions since late 2014 and seems more likely to match future
-# practice than guessing no DST.
+# transitions planned this year and seems more likely to match future practice
+# than guessing no DST.
+# From Michael Deckers (2019-08-06):
+# https://www.laws.gov.fj/LawsAsMade/downloadfile/848
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Fiji	1998	1999	-	Nov	Sun>=1	2:00	1:00	-
@@ -407,8 +412,9 @@
 Rule	Fiji	2011	only	-	Mar	Sun>=1	3:00	0	-
 Rule	Fiji	2012	2013	-	Jan	Sun>=18	3:00	0	-
 Rule	Fiji	2014	only	-	Jan	Sun>=18	2:00	0	-
-Rule	Fiji	2014	max	-	Nov	Sun>=1	2:00	1:00	-
-Rule	Fiji	2015	max	-	Jan	Sun>=13	3:00	0	-
+Rule	Fiji	2014	2018	-	Nov	Sun>=1	2:00	1:00	-
+Rule	Fiji	2015	max	-	Jan	Sun>=12	3:00	0	-
+Rule	Fiji	2019	max	-	Nov	Sun>=8	2:00	1:00	-
 # Zone	NAME		STDOFF	RULES	FORMAT	[UNTIL]
 Zone	Pacific/Fiji	11:55:44 -	LMT	1915 Oct 26 # Suva
 			12:00	Fiji	+12/+13
@@ -627,10 +633,11 @@
 # Zone	NAME		STDOFF	RULES	FORMAT	[UNTIL]
 Zone	Pacific/Norfolk	11:11:52 -	LMT	1901 # Kingston
 			11:12	-	+1112	1951
-			11:30	-	+1130	1974 Oct 27 02:00
-			11:30	1:00	+1230	1975 Mar  2 02:00
-			11:30	-	+1130	2015 Oct  4 02:00
-			11:00	-	+11
+			11:30	-	+1130	1974 Oct 27 02:00s
+			11:30	1:00	+1230	1975 Mar  2 02:00s
+			11:30	-	+1130	2015 Oct  4 02:00s
+			11:00	-	+11	2019 Jul
+			11:00	AN	+11/+12
 
 # Palau (Belau)
 # Zone	NAME		STDOFF	RULES	FORMAT	[UNTIL]
@@ -1898,12 +1905,21 @@
 # ... at 12.30 am (by legal time in New South Wales) on 4 October 2015.
 # http://www.norfolkisland.gov.nf/nia/MediaRelease/Media%20Release%20Norfolk%20Island%20Standard%20Time%20Change.pdf
 
-# From Paul Eggert (2015-09-23):
+# From Paul Eggert (2019-08-28):
 # Transitions before 2015 are from timeanddate.com, which consulted
 # the Norfolk Island Museum and the Australian Bureau of Meteorology's
 # Norfolk Island station, and found no record of Norfolk observing DST
 # other than in 1974/5.  See:
 # https://www.timeanddate.com/time/australia/norfolk-island.html
+# However, disagree with timeanddate about the 1975-03-02 transition;
+# timeanddate has 02:00 but 02:00s corresponds to what the NSW law said
+# (thanks to Michael Deckers).
+
+# Norfolk started observing Australian DST in spring 2019.
+# From Kyle Czech (2019-08-13):
+# https://www.legislation.gov.au/Details/F2018L01702
+# From Michael Deckers (2019-08-14):
+# https://www.legislation.gov.au/Details/F2019C00010
 
 # Palau
 # See commentary for Micronesia.
--- a/make/data/tzdata/europe	Tue Sep 24 14:12:08 2019 -0400
+++ b/make/data/tzdata/europe	Tue Sep 24 15:19:35 2019 -0400
@@ -844,11 +844,16 @@
 # Shanks & Pottenger give 02:00, the BEV 00:00.  Go with the BEV,
 # and guess 02:00 for 1945-04-12.
 
+# From Alois Triendl (2019-07-22):
+# In 1946 the end of DST was on Monday, 7 October 1946, at 3:00 am.
+# Shanks had this right.  Source: Die Weltpresse, 5. Oktober 1946, page 5.
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Austria	1920	only	-	Apr	 5	2:00s	1:00	S
 Rule	Austria	1920	only	-	Sep	13	2:00s	0	-
 Rule	Austria	1946	only	-	Apr	14	2:00s	1:00	S
-Rule	Austria	1946	1948	-	Oct	Sun>=1	2:00s	0	-
+Rule	Austria	1946	only	-	Oct	 7	2:00s	0	-
+Rule	Austria	1947	1948	-	Oct	Sun>=1	2:00s	0	-
 Rule	Austria	1947	only	-	Apr	 6	2:00s	1:00	S
 Rule	Austria	1948	only	-	Apr	18	2:00s	1:00	S
 Rule	Austria	1980	only	-	Apr	 6	0:00	1:00	S
@@ -898,15 +903,35 @@
 
 # Belgium
 #
-# From Paul Eggert (1997-07-02):
+# From Michael Deckers (2019-08-25):
+# The exposition in the web page
+# https://www.bestor.be/wiki/index.php/Voyager_dans_le_temps._L%E2%80%99introduction_de_la_norme_de_Greenwich_en_Belgique
+# gives several contemporary sources from which one can conclude that
+# the switch in Europe/Brussels on 1892-05-01 was from 00:17:30 to 00:00:00.
+#
+# From Paul Eggert (2019-08-28):
+# This quote helps explain the late-1914 situation:
+#   In early November 1914, the Germans imposed the time zone used in central
+#   Europe and forced the inhabitants to set their watches and public clocks
+#   sixty minutes ahead.  Many were reluctant to accept "German time" and
+#   continued to use "Belgian time" among themselves.  Reflecting the spirit of
+#   resistance that arose in the population, a song made fun of this change....
+# The song ended:
+#   Putting your clock forward
+#   Will but hasten the happy hour
+#   When we kick out the Boches!
+# See: Pluvinage G. Brussels on German time. Cahiers Bruxellois -
+# Brusselse Cahiers. 2014;XLVI(1E):15-38.
+# https://www.cairn.info/revue-cahiers-bruxellois-2014-1E-page-15.htm
+#
+# Entries from 1914 through 1917 are taken from "De tijd in België"
+# <https://www.astro.oma.be/GENERAL/INFO/nli001a.html>.
 # Entries from 1918 through 1991 are taken from:
 #	Annuaire de L'Observatoire Royal de Belgique,
 #	Avenue Circulaire, 3, B-1180 BRUXELLES, CLVIIe année, 1991
 #	(Imprimerie HAYEZ, s.p.r.l., Rue Fin, 4, 1080 BRUXELLES, MCMXC),
 #	pp 8-9.
-# LMT before 1892 was 0:17:30, according to the official journal of Belgium:
-#	Moniteur Belge, Samedi 30 Avril 1892, N.121.
-# Thanks to Pascal Delmoitie for these references.
+# Thanks to Pascal Delmoitie for the 1918/1991 references.
 # The 1918 rules are listed for completeness; they apply to unoccupied Belgium.
 # Assume Brussels switched to WET in 1918 when the armistice took effect.
 #
@@ -951,7 +976,7 @@
 Rule	Belgium	1946	only	-	Oct	 7	 2:00s	0	-
 # Zone	NAME		STDOFF	RULES	FORMAT	[UNTIL]
 Zone	Europe/Brussels	0:17:30 -	LMT	1880
-			0:17:30	-	BMT	1892 May  1 12:00  # Brussels MT
+			0:17:30	-	BMT	1892 May  1 00:17:30
 			0:00	-	WET	1914 Nov  8
 			1:00	-	CET	1916 May  1  0:00
 			1:00	C-Eur	CE%sT	1918 Nov 11 11:00u
@@ -1650,6 +1675,13 @@
 # advanced to sixty minutes later starting at hour two on 1944-04-02; ...
 # Starting at hour three on the date 1944-09-17 standard time will be resumed.
 #
+# From Alois Triendl (2019-07-02):
+# I spent 6 Euros to buy two archive copies of Il Messaggero, a Roman paper,
+# for 1 and 2 April 1944.  The edition of 2 April has this note: "Tonight at 2
+# am, put forward the clock by one hour.  Remember that in the night between
+# today and Monday the 'ora legale' will come in force again."  That makes it
+# clear that in Rome the change was on Monday, 3 April 1944 at 2 am.
+#
 # From Paul Eggert (2016-10-27):
 # Go with INRiM for DST rules, except as corrected by Inglis for 1944
 # for the Kingdom of Italy.  This is consistent with Renzo Baldini.
@@ -1797,15 +1829,10 @@
 # From Paul Eggert (2013-09-09):
 # Shanks & Pottenger say Vaduz is like Zurich.
 
-# From Alois Treindl (2013-09-18):
-# http://www.eliechtensteinensia.li/LIJ/1978/1938-1978/1941.pdf
-# ... confirms on p. 6 that Liechtenstein followed Switzerland in 1941 and 1942.
-# I ... translate only the last two paragraphs:
-#    ... during second world war, in the years 1941 and 1942, Liechtenstein
-#    introduced daylight saving time, adapting to Switzerland.  From 1943 on
-#    central European time was in force throughout the year.
-#    From a report of the duke's government to the high council,
-#    regarding the introduction of a time law, of 31 May 1977.
+# From Alois Treindl (2019-07-04):
+# I was able to access the online archive of the Vaduz paper Vaterland ...
+# I could confirm from the paper that Liechtenstein did in fact follow
+# the same DST in 1941 and 1942 as Switzerland did.
 
 Link Europe/Zurich Europe/Vaduz
 
@@ -2513,6 +2540,12 @@
 # Europe/Kaliningrad covers...
 # 39	RU-KGD	Kaliningrad Oblast
 
+# From Paul Eggert (2019-07-25):
+# Although Shanks lists 1945-01-01 as the date for transition from
+# +01/+02 to +02/+03, more likely this is a placeholder.  Guess that
+# the transition occurred at 1945-04-10 00:00, which is about when
+# Königsberg surrendered to Soviet troops.  (Thanks to Alois Triendl.)
+
 # From Paul Eggert (2016-03-18):
 # The 1989 transition is from USSR act No. 227 (1989-03-14).
 
@@ -2529,8 +2562,8 @@
 # Moscow on 1991-11-03, switched to Moscow-1 on 1992-01-19.
 
 Zone Europe/Kaliningrad	 1:22:00 -	LMT	1893 Apr
-			 1:00	C-Eur	CE%sT	1945
-			 2:00	Poland	CE%sT	1946
+			 1:00	C-Eur	CE%sT	1945 Apr 10
+			 2:00	Poland	EE%sT	1946 Apr  7
 			 3:00	Russia	MSK/MSD	1989 Mar 26  2:00s
 			 2:00	Russia	EE%sT	2011 Mar 27  2:00s
 			 3:00	-	+03	2014 Oct 26  2:00s
@@ -3673,20 +3706,75 @@
 
 # Turkey
 
+# From Alois Treindl (2019-08-12):
+# http://www.astrolojidergisi.com/yazsaati.htm has researched the time zone
+# history of Turkey, based on newspaper archives and official documents.
+# From Paul Eggert (2019-08-28):
+# That source (Oya Vulaş, "Türkiye'de Yaz Saati Uygulamaları")
+# is used for 1940/1972, where it seems more reliable than our other
+# sources.
+
+# From Kıvanç Yazan (2019-08-12):
+# http://www.resmigazete.gov.tr/arsiv/14539.pdf#page=24
+# 1973-06-03 01:00 -> 02:00, 1973-11-04 02:00 -> 01:00
+#
+# http://www.resmigazete.gov.tr/arsiv/14829.pdf#page=1
+# 1974-03-31 02:00 -> 03:00, 1974-11-03 02:00 -> 01:00
+#
+# http://www.resmigazete.gov.tr/arsiv/15161.pdf#page=1
+# 1975-03-22 02:00 -> 03:00, 1975-11-02 02:00 -> 01:00
+#
+# http://www.resmigazete.gov.tr/arsiv/15535_1.pdf#page=1
+# 1976-03-21 02:00 -> 03:00, 1976-10-31 02:00 -> 01:00
+#
+# http://www.resmigazete.gov.tr/arsiv/15778.pdf#page=5
+# 1977-04-03 02:00 -> 03:00, 1977-10-16 02:00 -> 01:00,
+# 1978-04-02 02:00 -> 03:00 (not applied, see below)
+# 1978-10-15 02:00 -> 01:00 (not applied, see below)
+# 1979-04-01 02:00 -> 03:00 (not applied, see below)
+# 1979-10-14 02:00 -> 01:00 (not applied, see below)
+#
+# http://www.resmigazete.gov.tr/arsiv/16245.pdf#page=17
+# This cancels the previous decision, and repeats it only for 1978.
+# 1978-04-02 02:00 -> 03:00, 1978-10-15 02:00 -> 01:00
+# (not applied due to standard TZ change below)
+#
+# http://www.resmigazete.gov.tr/arsiv/16331.pdf#page=3
+# This decision changes the default longitude for Turkish time zone from 30
+# degrees East to 45 degrees East.  This means a standard TZ change, from +2
+# to +3.  This is published & applied on 1978-06-29.  At that time, Turkey was
+# already on summer time (already on 45E).  Hence, this new law just meant an
+# "continuous summer time".  Note that this was reversed in a few years.
+#
+# http://www.resmigazete.gov.tr/arsiv/18119_1.pdf#page=1
+# 1983-07-31 02:00 -> 03:00 (note that this jumps TZ to +4)
+# 1983-10-02 02:00 -> 01:00 (back to +3)
+#
+# http://www.resmigazete.gov.tr/arsiv/18561.pdf (page 1 and 34)
+# At this time, Turkey is still on +3 with no spring-forward on early
+# 1984.  This decision is published on 10/31/1984.  Page 1 declares
+# the decision of reverting the "default longitude change".  So the
+# standard time should go back to +3 (30E).  And page 34 explains when
+# that will happen: 1984-11-01 02:00 -> 01:00.  You can think of this
+# as "end of continuous summer time, change of standard time zone".
+#
+# http://www.resmigazete.gov.tr/arsiv/18713.pdf#page=1
+# 1985-04-20 01:00 -> 02:00, 1985-09-28 02:00 -> 01:00
+
 # From Kıvanç Yazan (2016-09-25):
 # 1) For 1986-2006, DST started at 01:00 local and ended at 02:00 local, with
 #    no exceptions.
 # 2) 1994's lastSun was overridden with Mar 20 ...
 # Here are official papers:
-# http://www.resmigazete.gov.tr/arsiv/19032.pdf  - page 2 for 1986
-# http://www.resmigazete.gov.tr/arsiv/19400.pdf  - page 4 for 1987
-# http://www.resmigazete.gov.tr/arsiv/19752.pdf  - page 15 for 1988
-# http://www.resmigazete.gov.tr/arsiv/20102.pdf  - page 6 for 1989
-# http://www.resmigazete.gov.tr/arsiv/20464.pdf  - page 1 for 1990 - 1992
-# http://www.resmigazete.gov.tr/arsiv/21531.pdf  - page 15 for 1993 - 1995
-# http://www.resmigazete.gov.tr/arsiv/21879.pdf  - page 1 for overriding 1994
-# http://www.resmigazete.gov.tr/arsiv/22588.pdf  - page 1 for 1996, 1997
-# http://www.resmigazete.gov.tr/arsiv/23286.pdf  - page 10 for 1998 - 2000
+# http://www.resmigazete.gov.tr/arsiv/19032.pdf#page=2 for 1986
+# http://www.resmigazete.gov.tr/arsiv/19400.pdf#page=4 for 1987
+# http://www.resmigazete.gov.tr/arsiv/19752.pdf#page=15 for 1988
+# http://www.resmigazete.gov.tr/arsiv/20102.pdf#page=6 for 1989
+# http://www.resmigazete.gov.tr/arsiv/20464.pdf#page=1 for 1990 - 1992
+# http://www.resmigazete.gov.tr/arsiv/21531.pdf#page=15 for 1993 - 1995
+# http://www.resmigazete.gov.tr/arsiv/21879.pdf#page=1 for overriding 1994
+# http://www.resmigazete.gov.tr/arsiv/22588.pdf#page=1 for 1996, 1997
+# http://www.resmigazete.gov.tr/arsiv/23286.pdf#page=10 for 1998 - 2000
 # http://www.resmigazete.gov.tr/eskiler/2001/03/20010324.htm#2  - for 2001
 # http://www.resmigazete.gov.tr/eskiler/2002/03/20020316.htm#2  - for 2002-2006
 # From Paul Eggert (2016-09-25):
@@ -3770,46 +3858,36 @@
 Rule	Turkey	1924	only	-	May	13	0:00	1:00	S
 Rule	Turkey	1924	1925	-	Oct	 1	0:00	0	-
 Rule	Turkey	1925	only	-	May	 1	0:00	1:00	S
-Rule	Turkey	1940	only	-	Jun	30	0:00	1:00	S
-Rule	Turkey	1940	only	-	Oct	 5	0:00	0	-
+Rule	Turkey	1940	only	-	Jul	 1	0:00	1:00	S
+Rule	Turkey	1940	only	-	Oct	 6	0:00	0	-
 Rule	Turkey	1940	only	-	Dec	 1	0:00	1:00	S
 Rule	Turkey	1941	only	-	Sep	21	0:00	0	-
 Rule	Turkey	1942	only	-	Apr	 1	0:00	1:00	S
-# Whitman omits the next two transition and gives 1945 Oct 1;
-# go with Shanks & Pottenger.
-Rule	Turkey	1942	only	-	Nov	 1	0:00	0	-
-Rule	Turkey	1945	only	-	Apr	 2	0:00	1:00	S
 Rule	Turkey	1945	only	-	Oct	 8	0:00	0	-
 Rule	Turkey	1946	only	-	Jun	 1	0:00	1:00	S
 Rule	Turkey	1946	only	-	Oct	 1	0:00	0	-
 Rule	Turkey	1947	1948	-	Apr	Sun>=16	0:00	1:00	S
-Rule	Turkey	1947	1950	-	Oct	Sun>=2	0:00	0	-
+Rule	Turkey	1947	1951	-	Oct	Sun>=2	0:00	0	-
 Rule	Turkey	1949	only	-	Apr	10	0:00	1:00	S
-Rule	Turkey	1950	only	-	Apr	19	0:00	1:00	S
+Rule	Turkey	1950	only	-	Apr	16	0:00	1:00	S
 Rule	Turkey	1951	only	-	Apr	22	0:00	1:00	S
-Rule	Turkey	1951	only	-	Oct	 8	0:00	0	-
+# DST for 15 months; unusual but we'll let it pass.
 Rule	Turkey	1962	only	-	Jul	15	0:00	1:00	S
-Rule	Turkey	1962	only	-	Oct	 8	0:00	0	-
+Rule	Turkey	1963	only	-	Oct	30	0:00	0	-
 Rule	Turkey	1964	only	-	May	15	0:00	1:00	S
 Rule	Turkey	1964	only	-	Oct	 1	0:00	0	-
-Rule	Turkey	1970	1972	-	May	Sun>=2	0:00	1:00	S
-Rule	Turkey	1970	1972	-	Oct	Sun>=2	0:00	0	-
 Rule	Turkey	1973	only	-	Jun	 3	1:00	1:00	S
-Rule	Turkey	1973	only	-	Nov	 4	3:00	0	-
+Rule	Turkey	1973	1976	-	Oct	Sun>=31	2:00	0	-
 Rule	Turkey	1974	only	-	Mar	31	2:00	1:00	S
-Rule	Turkey	1974	only	-	Nov	 3	5:00	0	-
-Rule	Turkey	1975	only	-	Mar	30	0:00	1:00	S
-Rule	Turkey	1975	1976	-	Oct	lastSun	0:00	0	-
-Rule	Turkey	1976	only	-	Jun	 1	0:00	1:00	S
-Rule	Turkey	1977	1978	-	Apr	Sun>=1	0:00	1:00	S
-Rule	Turkey	1977	only	-	Oct	16	0:00	0	-
-Rule	Turkey	1979	1980	-	Apr	Sun>=1	3:00	1:00	S
-Rule	Turkey	1979	1982	-	Oct	Mon>=11	0:00	0	-
-Rule	Turkey	1981	1982	-	Mar	lastSun	3:00	1:00	S
-Rule	Turkey	1983	only	-	Jul	31	0:00	1:00	S
-Rule	Turkey	1983	only	-	Oct	 2	0:00	0	-
-Rule	Turkey	1985	only	-	Apr	20	0:00	1:00	S
-Rule	Turkey	1985	only	-	Sep	28	0:00	0	-
+Rule	Turkey	1975	only	-	Mar	22	2:00	1:00	S
+Rule	Turkey	1976	only	-	Mar	21	2:00	1:00	S
+Rule	Turkey	1977	1978	-	Apr	Sun>=1	2:00	1:00	S
+Rule	Turkey	1977	1978	-	Oct	Sun>=15	2:00	0	-
+Rule	Turkey	1978	only	-	Jun	29	0:00	0	-
+Rule	Turkey	1983	only	-	Jul	31	2:00	1:00	S
+Rule	Turkey	1983	only	-	Oct	 2	2:00	0	-
+Rule	Turkey	1985	only	-	Apr	20	1:00s	1:00	S
+Rule	Turkey	1985	only	-	Sep	28	1:00s	0	-
 Rule	Turkey	1986	1993	-	Mar	lastSun	1:00s	1:00	S
 Rule	Turkey	1986	1995	-	Sep	lastSun	1:00s	0	-
 Rule	Turkey	1994	only	-	Mar	20	1:00s	1:00	S
@@ -3818,8 +3896,8 @@
 # Zone	NAME		STDOFF	RULES	FORMAT	[UNTIL]
 Zone	Europe/Istanbul	1:55:52 -	LMT	1880
 			1:56:56	-	IMT	1910 Oct # Istanbul Mean Time?
-			2:00	Turkey	EE%sT	1978 Oct 15
-			3:00	Turkey	+03/+04	1985 Apr 20
+			2:00	Turkey	EE%sT	1978 Jun 29
+			3:00	Turkey	+03/+04	1984 Nov  1  2:00
 			2:00	Turkey	EE%sT	2007
 			2:00	EU	EE%sT	2011 Mar 27  1:00u
 			2:00	-	EET	2011 Mar 28  1:00u
--- a/make/data/tzdata/leapseconds	Tue Sep 24 14:12:08 2019 -0400
+++ b/make/data/tzdata/leapseconds	Tue Sep 24 15:19:35 2019 -0400
@@ -26,36 +26,39 @@
 # This file is in the public domain.
 
 # This file is generated automatically from the data in the public-domain
-# leap-seconds.list file, which can be copied from
+# NIST format leap-seconds.list file, which can be copied from
 # <ftp://ftp.nist.gov/pub/time/leap-seconds.list>
-# or <ftp://ftp.boulder.nist.gov/pub/time/leap-seconds.list>
-# or <ftp://tycho.usno.navy.mil/pub/ntp/leap-seconds.list>.
+# or <ftp://ftp.boulder.nist.gov/pub/time/leap-seconds.list>.
 # For more about leap-seconds.list, please see
 # The NTP Timescale and Leap Seconds
 # <https://www.eecis.udel.edu/~mills/leap.html>.
 
-# The International Earth Rotation and Reference Systems Service
+# The rules for leap seconds are specified in Annex 1 (Time scales) of:
+# Standard-frequency and time-signal emissions.
+# International Telecommunication Union - Radiocommunication Sector
+# (ITU-R) Recommendation TF.460-6 (02/2002)
+# <https://www.itu.int/rec/R-REC-TF.460-6-200202-I/>.
+# The International Earth Rotation and Reference Systems Service (IERS)
 # periodically uses leap seconds to keep UTC to within 0.9 s of UT1
-# (which measures the true angular orientation of the earth in space)
+# (a proxy for Earth's angle in space as measured by astronomers)
 # and publishes leap second data in a copyrighted file
 # <https://hpiers.obspm.fr/iers/bul/bulc/Leap_Second.dat>.
 # See: Levine J. Coordinated Universal Time and the leap second.
 # URSI Radio Sci Bull. 2016;89(4):30-6. doi:10.23919/URSIRSB.2016.7909995
 # <https://ieeexplore.ieee.org/document/7909995>.
 
-# There were no leap seconds before 1972, because the official mechanism
-# accounting for the discrepancy between atomic time and the earth's rotation
-# did not exist.  The first ("1 Jan 1972") data line in leap-seconds.list
+# There were no leap seconds before 1972, as no official mechanism
+# accounted for the discrepancy between atomic time (TAI) and the earth's
+# rotation.  The first ("1 Jan 1972") data line in leap-seconds.list
 # does not denote a leap second; it denotes the start of the current definition
 # of UTC.
 
-# The correction (+ or -) is made at the given time, so lines
-# will typically look like:
-#	Leap	YEAR	MON	DAY	23:59:60	+	R/S
-# or
-#	Leap	YEAR	MON	DAY	23:59:59	-	R/S
-
-# If the leap second is Rolling (R) the given time is local time (unused here).
+# All leap-seconds are Stationary (S) at the given UTC time.
+# The correction (+ or -) is made at the given time, so in the unlikely
+# event of a negative leap second, a line would look like this:
+# Leap	YEAR	MON	DAY	23:59:59	-	S
+# Typical lines look like this:
+# Leap	YEAR	MON	DAY	23:59:60	+	S
 Leap	1972	Jun	30	23:59:60	+	S
 Leap	1972	Dec	31	23:59:60	+	S
 Leap	1973	Dec	31	23:59:60	+	S
@@ -85,8 +88,8 @@
 Leap	2016	Dec	31	23:59:60	+	S
 
 # POSIX timestamps for the data in this file:
-#updated 1467936000
-#expires 1577491200
+#updated 1467936000 (2016-07-08 00:00:00 UTC)
+#expires 1593302400 (2020-06-28 00:00:00 UTC)
 
-#	Updated through IERS Bulletin C57
-#	File expires on:  28 December 2019
+#	Updated through IERS Bulletin C58
+#	File expires on:  28 June 2020
--- a/make/data/tzdata/northamerica	Tue Sep 24 14:12:08 2019 -0400
+++ b/make/data/tzdata/northamerica	Tue Sep 24 15:19:35 2019 -0400
@@ -429,6 +429,31 @@
 # From Paul Eggert (2015-12-25):
 # Assume this practice predates 1970, so Fort Pierre can use America/Chicago.
 
+# From Paul Eggert (2015-04-06):
+# In 1950s Nashville a public clock had dueling faces, one for conservatives
+# and the other for liberals; the two sides didn't agree about the time of day.
+# I haven't found a photo of this clock, nor have I tracked down the TIME
+# magazine report cited below, but here's the story as told by the late
+# American journalist John Seigenthaler, who was there:
+#
+# "The two [newspaper] owners held strongly contrasting political and
+# ideological views.  Evans was a New South liberal, Stahlman an Old South
+# conservative, and their two papers frequently clashed editorially, often on
+# the same day....  In the 1950s as the state legislature was grappling with
+# the question of whether to approve daylight saving time for the entire state,
+# TIME magazine reported:
+#
+# "'The Nashville Banner and The Nashville Tennessean rarely agree on anything
+# but the time of day - and last week they couldn't agree on that.'
+#
+# "It was all too true. The clock on the front of the building had two faces -
+# The Tennessean side of the building facing west, the other, east.  When it
+# was high noon Banner time, it was 11 a.m. Tennessean time."
+#
+# Seigenthaler J. For 100 years, Tennessean had it covered.
+# The Tennessean 2007-05-11, republished 2015-04-06.
+# https://www.tennessean.com/story/insider/extras/2015/04/06/archives-seigenthaler-for-100-years-the-tennessean-had-it-covered/25348545/
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
 Rule	Chicago	1920	only	-	Jun	13	2:00	1:00	D
 Rule	Chicago	1920	1921	-	Oct	lastSun	2:00	0	S
@@ -968,21 +993,21 @@
 			-5:00	US	E%sT
 #
 # Perry County, Indiana, switched from eastern to central time in April 2006.
+# From Alois Triendl (2019-07-09):
+# The Indianapolis News, Friday 27 October 1967 states that Perry County
+# returned to CST.  It went again to EST on 27 April 1969, as documented by the
+# Indianapolis star of Saturday 26 April.
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
-Rule Perry	1946	only	-	Apr	lastSun	2:00	1:00	D
-Rule Perry	1946	only	-	Sep	lastSun	2:00	0	S
-Rule Perry	1953	1954	-	Apr	lastSun	2:00	1:00	D
-Rule Perry	1953	1959	-	Sep	lastSun	2:00	0	S
 Rule Perry	1955	only	-	May	 1	0:00	1:00	D
+Rule Perry	1955	1960	-	Sep	lastSun	2:00	0	S
 Rule Perry	1956	1963	-	Apr	lastSun	2:00	1:00	D
-Rule Perry	1960	only	-	Oct	lastSun	2:00	0	S
-Rule Perry	1961	only	-	Sep	lastSun	2:00	0	S
-Rule Perry	1962	1963	-	Oct	lastSun	2:00	0	S
+Rule Perry	1961	1963	-	Oct	lastSun	2:00	0	S
 # Zone	NAME		STDOFF	RULES	FORMAT	[UNTIL]
 Zone America/Indiana/Tell_City -5:47:03 - LMT	1883 Nov 18 12:12:57
 			-6:00	US	C%sT	1946
 			-6:00 Perry	C%sT	1964 Apr 26  2:00
-			-5:00	-	EST	1969
+			-5:00	-	EST	1967 Oct 29  2:00
+			-6:00	US	C%sT	1969 Apr 27  2:00
 			-5:00	US	E%sT	1971
 			-5:00	-	EST	2006 Apr  2  2:00
 			-6:00	US	C%sT
@@ -1058,16 +1083,27 @@
 # clear how this matched civil time in Louisville, so for now continue
 # to assume Louisville switched at noon new local time, like New York.
 #
+# From Michael Deckers (2019-08-06):
+# From the contemporary source given by Alois Treindl,
+# the switch in Louisville on 1946-04-28 was on 00:01
+# From Paul Eggert (2019-08-26):
+# That source was the Louisville Courier-Journal, 1946-04-27, p 4.
+# Shanks gives 02:00 for all 20th-century transition times in Louisville.
+# Evidently this is wrong for spring 1946.  Although also likely wrong
+# for other dates, we have no data.
+#
 # Part of Kentucky left its clocks alone in 1974.
 # This also includes Clark, Floyd, and Harrison counties in Indiana.
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
 Rule Louisville	1921	only	-	May	1	2:00	1:00	D
 Rule Louisville	1921	only	-	Sep	1	2:00	0	S
-Rule Louisville	1941	1961	-	Apr	lastSun	2:00	1:00	D
+Rule Louisville	1941	only	-	Apr	lastSun	2:00	1:00	D
 Rule Louisville	1941	only	-	Sep	lastSun	2:00	0	S
+Rule Louisville	1946	only	-	Apr	lastSun	0:01	1:00	D
 Rule Louisville	1946	only	-	Jun	2	2:00	0	S
+Rule Louisville	1950	1961	-	Apr	lastSun	2:00	1:00	D
 Rule Louisville	1950	1955	-	Sep	lastSun	2:00	0	S
-Rule Louisville	1956	1960	-	Oct	lastSun	2:00	0	S
+Rule Louisville	1956	1961	-	Oct	lastSun	2:00	0	S
 # Zone	NAME		STDOFF	RULES	FORMAT	[UNTIL]
 Zone America/Kentucky/Louisville -5:43:02 -	LMT	1883 Nov 18 12:16:58
 			-6:00	US	C%sT	1921
@@ -1157,18 +1193,19 @@
 # one hour in 1914."  This change is not in Shanks.  We have no more
 # info, so omit this for now.
 #
-# From Paul Eggert (2017-07-26):
-# Although Shanks says Detroit observed DST in 1967 from 06-14 00:01
-# until 10-29 00:01, I now see multiple reports that this is incorrect.
-# For example, according to a 50-year anniversary report about the 1967
-# Detroit riots and a major-league doubleheader on 1967-07-23, "By the time
-# the last fly ball of the doubleheader settled into the glove of leftfielder
-# Lenny Green, it was after 7 p.m.  Detroit did not observe daylight saving
-# time, so light was already starting to fail.  Twilight was made even deeper
-# by billowing columns of smoke that ascended in an unbroken wall north of the
-# ballpark."  See: Dow B. Detroit '67: As violence unfolded, Tigers played two
-# at home vs. Yankees. Detroit Free Press 2017-07-23.
-# https://www.freep.com/story/sports/mlb/tigers/2017/07/23/detroit-tigers-1967-riot-new-york-yankees/499951001/
+# From Paul Eggert (2019-07-06):
+# Due to a complicated set of legal maneuvers, in 1967 Michigan did
+# not start daylight saving time when the rest of the US did.
+# Instead, it began DST on Jun 14 at 00:01.  This was big news:
+# the Detroit Free Press reported it at the top of Page 1 on
+# 1967-06-14, in an article "State Adjusting to Switch to Fast Time"
+# by Gary Blonston, above an article about Thurgood Marshall's
+# confirmation to the US Supreme Court.  Although Shanks says Detroit
+# observed DST until 1967-10-29 00:01, that time of day seems to be
+# incorrect, as the Free Press later said DST ended in Michigan at the
+# same time as the rest of the US.  Also, although Shanks reports no DST in
+# Detroit in 1968, it did observe DST that year; in the November 1968
+# election Michigan voters narrowly repealed DST, effective 1969.
 #
 # Most of Michigan observed DST from 1973 on, but was a bit late in 1975.
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
@@ -1179,7 +1216,9 @@
 			-6:00	-	CST	1915 May 15  2:00
 			-5:00	-	EST	1942
 			-5:00	US	E%sT	1946
-			-5:00	Detroit	E%sT	1973
+			-5:00	Detroit	E%sT	1967 Jun 14  0:01
+			-5:00	US	E%sT	1969
+			-5:00	-	EST	1973
 			-5:00	US	E%sT	1975
 			-5:00	-	EST	1975 Apr 27  2:00
 			-5:00	US	E%sT
@@ -1228,6 +1267,12 @@
 #
 # Other sources occasionally used include:
 #
+#	Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94
+#	<https://www.jstor.org/stable/1774359>.
+#
+#	Pearce C. The Great Daylight Saving Time Controversy.
+#	Australian Ebook Publisher. 2017. ISBN 978-1-925516-96-8.
+#
 #	Edward W. Whitman, World Time Differences,
 #	Whitman Publishing Co, 2 Niagara Av, Ealing, London (undated),
 #	which I found in the UCLA library.
@@ -1236,9 +1281,6 @@
 #	<http://cs.ucla.edu/~eggert/The-Waste-of-Daylight-19th.pdf>
 #	[PDF] (1914-03)
 #
-#	Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94
-#	<https://www.jstor.org/stable/1774359>.
-#
 # See the 'europe' file for Greenland.
 
 # Canada
@@ -1880,9 +1922,8 @@
 # Willett (1914-03) notes that DST "has been in operation ... in the
 # City of Moose Jaw, Saskatchewan, for one year."
 
-# From Paul Eggert (2019-04-26):
-# Chris Pearce's book "The Great Daylight Saving Time Controversy" (2017)
-# says that Regina observed DST in 1914-1917.  No dates and times,
+# From Paul Eggert (2019-07-25):
+# Pearce's book says Regina observed DST in 1914-1917.  No dates and times,
 # unfortunately.  It also says that in 1914 Saskatoon observed DST
 # from 1 June to 6 July, and that DST was also tried out in Davidson,
 # Melfort, and Prince Albert.
@@ -1962,6 +2003,19 @@
 
 # Alberta
 
+# From Alois Triendl (2019-07-19):
+# There was no DST in Alberta in 1967... Calgary Herald, 29 April 1967.
+# 1969, no DST, from Edmonton Journal 18 April 1969
+#
+# From Paul Eggert (2019-07-25):
+# Pearce's book says that Alberta's 1948 Daylight Saving Act required
+# Mountain Standard Time without DST, and that "anyone who broke that law
+# could be fined up to $25 and costs".  There seems to be no record of
+# anybody paying the fine.  The law was not changed until an August 1971
+# plebiscite reinstituted DST in 1972.  This story is also mentioned in:
+# Boyer JP. Forcing Choice: The Risky Reward of Referendums. Dundum. 2017.
+# ISBN 978-1459739123.
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Edm	1918	1919	-	Apr	Sun>=8	2:00	1:00	D
 Rule	Edm	1918	only	-	Oct	27	2:00	0	S
@@ -1974,10 +2028,6 @@
 Rule	Edm	1945	only	-	Sep	lastSun	2:00	0	S
 Rule	Edm	1947	only	-	Apr	lastSun	2:00	1:00	D
 Rule	Edm	1947	only	-	Sep	lastSun	2:00	0	S
-Rule	Edm	1967	only	-	Apr	lastSun	2:00	1:00	D
-Rule	Edm	1967	only	-	Oct	lastSun	2:00	0	S
-Rule	Edm	1969	only	-	Apr	lastSun	2:00	1:00	D
-Rule	Edm	1969	only	-	Oct	lastSun	2:00	0	S
 Rule	Edm	1972	1986	-	Apr	lastSun	2:00	1:00	D
 Rule	Edm	1972	2006	-	Oct	lastSun	2:00	0	S
 # Zone	NAME		STDOFF	RULES	FORMAT	[UNTIL]
@@ -2060,8 +2110,20 @@
 # been on MST (-0700) like Dawson Creek since it advanced its clocks on
 # 2015-03-08.
 #
-# From Paul Eggert (2015-09-23):
+# From Paul Eggert (2019-07-25):
 # Shanks says Fort Nelson did not observe DST in 1946, unlike Vancouver.
+# Alois Triendl confirmed this on 07-22, citing the 1946-04-27 Vancouver Daily
+# Province.  He also cited the 1946-09-28 Victoria Daily Times, which said
+# that Vancouver, Victoria, etc. "change at midnight Saturday"; for now,
+# guess they meant 02:00 Sunday since 02:00 was common practice in Vancouver.
+#
+# Early Vancouver, Volume Four, by Major J.S. Matthews, V.D., 2011 edition
+# says that a 1922 plebiscite adopted DST, but a 1923 plebiscite rejected it.
+# http://former.vancouver.ca/ctyclerk/archives/digitized/EarlyVan/SearchEarlyVan/Vol4pdf/MatthewsEarlyVancouverVol4_DaylightSavings.pdf
+# A catalog entry for a newspaper clipping seems to indicate that Vancouver
+# observed DST in 1941 from 07-07 through 09-27; see
+# https://searcharchives.vancouver.ca/daylight-saving-1918-starts-again-july-7-1941-start-d-s-sept-27-end-of-d-s-1941
+# We have no further details, so omit them for now.
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Vanc	1918	only	-	Apr	14	2:00	1:00	D
@@ -2070,7 +2132,7 @@
 Rule	Vanc	1945	only	-	Aug	14	23:00u	1:00	P # Peace
 Rule	Vanc	1945	only	-	Sep	30	2:00	0	S
 Rule	Vanc	1946	1986	-	Apr	lastSun	2:00	1:00	D
-Rule	Vanc	1946	only	-	Oct	13	2:00	0	S
+Rule	Vanc	1946	only	-	Sep	29	2:00	0	S
 Rule	Vanc	1947	1961	-	Sep	lastSun	2:00	0	S
 Rule	Vanc	1962	2006	-	Oct	lastSun	2:00	0	S
 # Zone	NAME		STDOFF	RULES	FORMAT	[UNTIL]
--- a/make/data/tzdata/southamerica	Tue Sep 24 14:12:08 2019 -0400
+++ b/make/data/tzdata/southamerica	Tue Sep 24 15:19:35 2019 -0400
@@ -1253,14 +1253,8 @@
 # From Juan Correa (2016-12-04):
 # Magallanes region ... will keep DST (UTC -3) all year round....
 # http://www.soychile.cl/Santiago/Sociedad/2016/12/04/433428/Bachelet-firmo-el-decreto-para-establecer-un-horario-unico-para-la-Region-de-Magallanes.aspx
-#
 # From Deborah Goldsmith (2017-01-19):
 # http://www.diariooficial.interior.gob.cl/publicaciones/2017/01/17/41660/01/1169626.pdf
-# From Paul Eggert (2017-01-19):
-# The above says the Magallanes change expires 2019-05-11 at 24:00,
-# so in theory, they will revert to -04/-03 after that, which means
-# they will switch from -03 to -04 one hour after Santiago does that day.
-# For now, assume that they will not revert.
 
 # From Juan Correa (2018-08-13):
 # As of moments ago, the Ministry of Energy in Chile has announced the new
@@ -1281,6 +1275,11 @@
 # So we extend the new rules on Saturdays at 24:00 mainland time indefinitely.
 # From Juan Correa (2019-02-04):
 # http://www.diariooficial.interior.gob.cl/publicaciones/2018/11/23/42212/01/1498738.pdf
+# From Paul Eggert (2019-09-01):
+# The above says the Magallanes exception expires 2022-04-02 at 24:00,
+# so in theory, they will revert to -04/-03 after that.
+# For now, assume that they will not revert,
+# since they have extended the expiration date once already.
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Chile	1927	1931	-	Sep	 1	0:00	1:00	-
--- a/make/test/JtregGraalUnit.gmk	Tue Sep 24 14:12:08 2019 -0400
+++ b/make/test/JtregGraalUnit.gmk	Tue Sep 24 15:19:35 2019 -0400
@@ -115,6 +115,7 @@
           BIN := $(COMPILE_OUTPUTDIR)/jdk.vm.compiler.tests, \
           CLASSPATH := $(TEST_COMPILE_CP), \
           ADD_JAVAC_FLAGS := $(TEST_JAVAC_FLAGS), \
+          COPY := .input, \
       ))
 
       TARGETS_BUILD += $(BUILD_VM_COMPILER_TESTS)
@@ -142,6 +143,7 @@
       $(eval $(call SetupJarArchive, BUILD_VM_COMPILER_TESTS_JAR, \
           DEPENDENCIES := $(BUILD_VM_COMPILER_TESTS) $(BUILD_VM_COMPILER_TESTS_SET2), \
           SRCS := $(COMPILE_OUTPUTDIR)/jdk.vm.compiler.tests, \
+          SUFFIXES:=.class .input, \
           JAR := $(COMPILE_OUTPUTDIR)/jdk.vm.compiler.tests.jar, \
       ))
 
--- a/src/hotspot/cpu/aarch64/c1_FrameMap_aarch64.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/cpu/aarch64/c1_FrameMap_aarch64.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2019, 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.
  *
@@ -45,7 +45,7 @@
       Register reg2 = r_2->as_Register();
       assert(reg2 == reg, "must be same register");
       opr = as_long_opr(reg);
-    } else if (type == T_OBJECT || type == T_ARRAY) {
+    } else if (is_reference_type(type)) {
       opr = as_oop_opr(reg);
     } else if (type == T_METADATA) {
       opr = as_metadata_opr(reg);
--- a/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -728,7 +728,7 @@
     move_regs(src->as_register(), dest->as_register());
 
   } else if (dest->is_double_cpu()) {
-    if (src->type() == T_OBJECT || src->type() == T_ARRAY) {
+    if (is_reference_type(src->type())) {
       // Surprising to me but we can see move of a long to t_object
       __ verify_oop(src->as_register());
       move_regs(src->as_register(), dest->as_register_lo());
@@ -756,7 +756,7 @@
 
 void LIR_Assembler::reg2stack(LIR_Opr src, LIR_Opr dest, BasicType type, bool pop_fpu_stack) {
   if (src->is_single_cpu()) {
-    if (type == T_ARRAY || type == T_OBJECT) {
+    if (is_reference_type(type)) {
       __ str(src->as_register(), frame_map()->address_for_slot(dest->single_stack_ix()));
       __ verify_oop(src->as_register());
     } else if (type == T_METADATA || type == T_DOUBLE) {
@@ -794,7 +794,7 @@
     return;
   }
 
-  if (type == T_ARRAY || type == T_OBJECT) {
+  if (is_reference_type(type)) {
     __ verify_oop(src->as_register());
 
     if (UseCompressedOops && !wide) {
@@ -869,7 +869,7 @@
   assert(dest->is_register(), "should not call otherwise");
 
   if (dest->is_single_cpu()) {
-    if (type == T_ARRAY || type == T_OBJECT) {
+    if (is_reference_type(type)) {
       __ ldr(dest->as_register(), frame_map()->address_for_slot(src->single_stack_ix()));
       __ verify_oop(dest->as_register());
     } else if (type == T_METADATA) {
@@ -1019,7 +1019,7 @@
       ShouldNotReachHere();
   }
 
-  if (type == T_ARRAY || type == T_OBJECT) {
+  if (is_reference_type(type)) {
     if (UseCompressedOops && !wide) {
       __ decode_heap_oop(dest->as_register());
     }
@@ -1227,8 +1227,8 @@
   __ uxtw(len, len);
 
   if (UseSlowPath ||
-      (!UseFastNewObjectArray && (op->type() == T_OBJECT || op->type() == T_ARRAY)) ||
-      (!UseFastNewTypeArray   && (op->type() != T_OBJECT && op->type() != T_ARRAY))) {
+      (!UseFastNewObjectArray && is_reference_type(op->type())) ||
+      (!UseFastNewTypeArray   && !is_reference_type(op->type()))) {
     __ b(*op->stub()->entry());
   } else {
     Register tmp1 = op->tmp1()->as_register();
@@ -1948,10 +1948,10 @@
     if (opr2->is_single_cpu()) {
       // cpu register - cpu register
       Register reg2 = opr2->as_register();
-      if (opr1->type() == T_OBJECT || opr1->type() == T_ARRAY) {
+      if (is_reference_type(opr1->type())) {
         __ cmpoop(reg1, reg2);
       } else {
-        assert(opr2->type() != T_OBJECT && opr2->type() != T_ARRAY, "cmp int, oop?");
+        assert(!is_reference_type(opr2->type()), "cmp int, oop?");
         __ cmpw(reg1, reg2);
       }
       return;
@@ -2243,7 +2243,7 @@
   CodeStub* stub = op->stub();
   int flags = op->flags();
   BasicType basic_type = default_type != NULL ? default_type->element_type()->basic_type() : T_ILLEGAL;
-  if (basic_type == T_ARRAY) basic_type = T_OBJECT;
+  if (is_reference_type(basic_type)) basic_type = T_OBJECT;
 
   // if we don't know anything, just go through the generic arraycopy
   if (default_type == NULL // || basic_type == T_OBJECT
@@ -3131,7 +3131,7 @@
 void LIR_Assembler::atomic_op(LIR_Code code, LIR_Opr src, LIR_Opr data, LIR_Opr dest, LIR_Opr tmp_op) {
   Address addr = as_Address(src->as_address_ptr());
   BasicType type = src->type();
-  bool is_oop = type == T_OBJECT || type == T_ARRAY;
+  bool is_oop = is_reference_type(type);
 
   void (MacroAssembler::* add)(Register prev, RegisterOrConstant incr, Register addr);
   void (MacroAssembler::* xchg)(Register prev, Register newv, Register addr);
--- a/src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -733,7 +733,7 @@
   new_value.load_item();
   cmp_value.load_item();
   LIR_Opr result = new_register(T_INT);
-  if (type == T_OBJECT || type == T_ARRAY) {
+  if (is_reference_type(type)) {
     __ cas_obj(addr, cmp_value.result(), new_value.result(), new_register(T_INT), new_register(T_INT), result);
   } else if (type == T_INT) {
     __ cas_int(addr->as_address_ptr()->base(), cmp_value.result(), new_value.result(), ill, ill);
@@ -748,7 +748,7 @@
 }
 
 LIR_Opr LIRGenerator::atomic_xchg(BasicType type, LIR_Opr addr, LIRItem& value) {
-  bool is_oop = type == T_OBJECT || type == T_ARRAY;
+  bool is_oop = is_reference_type(type);
   LIR_Opr result = new_register(type);
   value.load_item();
   assert(type == T_INT || is_oop LP64_ONLY( || type == T_LONG ), "unexpected type");
--- a/src/hotspot/cpu/aarch64/gc/g1/g1BarrierSetAssembler_aarch64.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/cpu/aarch64/gc/g1/g1BarrierSetAssembler_aarch64.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -251,7 +251,7 @@
 
 void G1BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
                                     Register dst, Address src, Register tmp1, Register tmp_thread) {
-  bool on_oop = type == T_OBJECT || type == T_ARRAY;
+  bool on_oop = is_reference_type(type);
   bool on_weak = (decorators & ON_WEAK_OOP_REF) != 0;
   bool on_phantom = (decorators & ON_PHANTOM_OOP_REF) != 0;
   bool on_reference = on_weak || on_phantom;
--- a/src/hotspot/cpu/aarch64/gc/shared/modRefBarrierSetAssembler_aarch64.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/cpu/aarch64/gc/shared/modRefBarrierSetAssembler_aarch64.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,7 +46,7 @@
 
 void ModRefBarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
                                          Address dst, Register val, Register tmp1, Register tmp2) {
-  if (type == T_OBJECT || type == T_ARRAY) {
+  if (is_reference_type(type)) {
     oop_store_at(masm, decorators, type, dst, val, tmp1, tmp2);
   } else {
     BarrierSetAssembler::store_at(masm, decorators, type, dst, val, tmp1, tmp2);
--- a/src/hotspot/cpu/aarch64/gc/shenandoah/c1/shenandoahBarrierSetC1_aarch64.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/cpu/aarch64/gc/shenandoah/c1/shenandoahBarrierSetC1_aarch64.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Red Hat, Inc. All rights reserved.
+ * Copyright (c) 2018, 2019, Red Hat, Inc. All rights reserved.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
@@ -94,12 +94,12 @@
     value_opr = storeval_barrier(access.gen(), value_opr, access.access_emit_info(), access.decorators());
   }
 
-  assert(type == T_INT || type == T_OBJECT || type == T_ARRAY LP64_ONLY( || type == T_LONG ), "unexpected type");
+  assert(type == T_INT || is_reference_type(type) LP64_ONLY( || type == T_LONG ), "unexpected type");
   LIR_Opr tmp = gen->new_register(T_INT);
   __ xchg(access.resolved_addr(), value_opr, result, tmp);
 
   if (access.is_oop()) {
-    result = load_reference_barrier(access.gen(), result);
+    result = load_reference_barrier(access.gen(), result, LIR_OprFact::addressConst(0));
     LIR_Opr tmp = gen->new_register(type);
     __ move(result, tmp);
     result = tmp;
--- a/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -47,7 +47,7 @@
                                                        Register src, Register dst, Register count, RegSet saved_regs) {
   if (is_oop) {
     bool dest_uninitialized = (decorators & IS_DEST_UNINITIALIZED) != 0;
-    if (ShenandoahSATBBarrier && !dest_uninitialized) {
+    if ((ShenandoahSATBBarrier && !dest_uninitialized) || ShenandoahLoadRefBarrier) {
 
       Label done;
 
@@ -57,27 +57,27 @@
       // Is marking active?
       Address gc_state(rthread, in_bytes(ShenandoahThreadLocalData::gc_state_offset()));
       __ ldrb(rscratch1, gc_state);
-      __ tbz(rscratch1, ShenandoahHeap::MARKING_BITPOS, done);
+      if (dest_uninitialized) {
+        __ tbz(rscratch2, ShenandoahHeap::HAS_FORWARDED_BITPOS, done);
+      } else {
+        __ mov(rscratch2, ShenandoahHeap::HAS_FORWARDED | ShenandoahHeap::MARKING);
+        __ tst(rscratch1, rscratch2);
+        __ br(Assembler::EQ, done);
+      }
 
       __ push(saved_regs, sp);
-      if (count == c_rarg0) {
-        if (dst == c_rarg1) {
-          // exactly backwards!!
-          __ mov(rscratch1, c_rarg0);
-          __ mov(c_rarg0, c_rarg1);
-          __ mov(c_rarg1, rscratch1);
+      if (UseCompressedOops) {
+        if (dest_uninitialized) {
+          __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::write_ref_array_pre_duinit_narrow_oop_entry), src, dst, count);
         } else {
-          __ mov(c_rarg1, count);
-          __ mov(c_rarg0, dst);
+          __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::write_ref_array_pre_narrow_oop_entry), src, dst, count);
         }
       } else {
-        __ mov(c_rarg0, dst);
-        __ mov(c_rarg1, count);
-      }
-      if (UseCompressedOops) {
-        __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::write_ref_array_pre_narrow_oop_entry), 2);
-      } else {
-        __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::write_ref_array_pre_oop_entry), 2);
+        if (dest_uninitialized) {
+          __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::write_ref_array_pre_duinit_oop_entry), src, dst, count);
+        } else {
+          __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::write_ref_array_pre_oop_entry), src, dst, count);
+        }
       }
       __ pop(saved_regs, sp);
       __ bind(done);
@@ -85,31 +85,6 @@
   }
 }
 
-void ShenandoahBarrierSetAssembler::arraycopy_epilogue(MacroAssembler* masm, DecoratorSet decorators, bool is_oop,
-                                                       Register start, Register count, Register scratch, RegSet saved_regs) {
-  if (is_oop) {
-      Label done;
-
-      // Avoid calling runtime if count == 0
-      __ cbz(count, done);
-
-      // Is updating references?
-      Address gc_state(rthread, in_bytes(ShenandoahThreadLocalData::gc_state_offset()));
-      __ ldrb(rscratch1, gc_state);
-      __ tbz(rscratch1, ShenandoahHeap::UPDATEREFS_BITPOS, done);
-
-    __ push(saved_regs, sp);
-    assert_different_registers(start, count, scratch);
-    assert_different_registers(c_rarg0, count);
-    __ mov(c_rarg0, start);
-    __ mov(c_rarg1, count);
-    __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::write_ref_array_post_entry), 2);
-    __ pop(saved_regs, sp);
-
-    __ bind(done);
-  }
-}
-
 void ShenandoahBarrierSetAssembler::shenandoah_write_barrier_pre(MacroAssembler* masm,
                                                                  Register obj,
                                                                  Register pre_val,
@@ -342,7 +317,7 @@
 
 void ShenandoahBarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
                                             Register dst, Address src, Register tmp1, Register tmp_thread) {
-  bool on_oop = type == T_OBJECT || type == T_ARRAY;
+  bool on_oop = is_reference_type(type);
   bool not_in_heap = (decorators & IN_NATIVE) != 0;
   bool on_weak = (decorators & ON_WEAK_OOP_REF) != 0;
   bool on_phantom = (decorators & ON_PHANTOM_OOP_REF) != 0;
@@ -377,7 +352,7 @@
 
 void ShenandoahBarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
                                              Address dst, Register val, Register tmp1, Register tmp2) {
-  bool on_oop = type == T_OBJECT || type == T_ARRAY;
+  bool on_oop = is_reference_type(type);
   if (!on_oop) {
     BarrierSetAssembler::store_at(masm, decorators, type, dst, val, tmp1, tmp2);
     return;
@@ -526,6 +501,7 @@
 
   Register obj = stub->obj()->as_register();
   Register res = stub->result()->as_register();
+  Register addr = stub->addr()->as_register_lo();
   Register tmp1 = stub->tmp1()->as_register();
   Register tmp2 = stub->tmp2()->as_register();
 
@@ -558,6 +534,7 @@
 
   __ bind(slow_path);
   ce->store_parameter(res, 0);
+  ce->store_parameter(addr, 1);
   __ far_call(RuntimeAddress(bs->load_reference_barrier_rt_code_blob()->code_begin()));
 
   __ b(*stub->continuation());
@@ -619,7 +596,12 @@
 
   __ push_call_clobbered_registers();
   __ load_parameter(0, r0);
-  __ mov(lr, CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier));
+  __ load_parameter(1, r1);
+  if (UseCompressedOops) {
+    __ mov(lr, CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier_fixup_narrow));
+  } else {
+    __ mov(lr, CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier_fixup));
+  }
   __ blr(lr);
   __ mov(rscratch1, r0);
   __ pop_call_clobbered_registers();
--- a/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -76,8 +76,6 @@
 
   virtual void arraycopy_prologue(MacroAssembler* masm, DecoratorSet decorators, bool is_oop,
                                   Register src, Register dst, Register count, RegSet saved_regs);
-  virtual void arraycopy_epilogue(MacroAssembler* masm, DecoratorSet decorators, bool is_oop,
-                                  Register start, Register count, Register tmp, RegSet saved_regs);
   virtual void load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
                        Register dst, Address src, Register tmp1, Register tmp_thread);
   virtual void store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
--- a/src/hotspot/cpu/aarch64/gc/z/zBarrierSetAssembler_aarch64.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/cpu/aarch64/gc/z/zBarrierSetAssembler_aarch64.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -127,7 +127,7 @@
                                         Register tmp1,
                                         Register tmp2) {
   // Verify value
-  if (type == T_OBJECT || type == T_ARRAY) {
+  if (is_reference_type(type)) {
     // Note that src could be noreg, which means we
     // are storing null and can skip verification.
     if (val != noreg) {
--- a/src/hotspot/cpu/aarch64/gc/z/zGlobals_aarch64.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/cpu/aarch64/gc/z/zGlobals_aarch64.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -135,26 +135,6 @@
 //  * 63-48 Fixed (16-bits, always zero)
 //
 
-uintptr_t ZPlatformAddressSpaceStart() {
-  const uintptr_t first_heap_view_address = (uintptr_t)1 << (ZPlatformAddressMetadataShift() + 0);
-  const size_t min_address_offset = 0;
-  return first_heap_view_address + min_address_offset;
-}
-
-uintptr_t ZPlatformAddressSpaceEnd() {
-  const uintptr_t last_heap_view_address = (uintptr_t)1 << (ZPlatformAddressMetadataShift() + 2);
-  const size_t max_address_offset = (size_t)1 << ZPlatformAddressOffsetBits();
-  return last_heap_view_address + max_address_offset;
-}
-
-uintptr_t ZPlatformAddressReservedStart() {
-  return ZPlatformAddressSpaceStart();
-}
-
-uintptr_t ZPlatformAddressReservedEnd() {
-  return ZPlatformAddressSpaceEnd();
-}
-
 uintptr_t ZPlatformAddressBase() {
   return 0;
 }
--- a/src/hotspot/cpu/aarch64/gc/z/zGlobals_aarch64.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/cpu/aarch64/gc/z/zGlobals_aarch64.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -40,10 +40,6 @@
 const size_t ZPlatformNMethodDisarmedOffset = 4;
 const size_t ZPlatformCacheLineSize         = 64;
 
-uintptr_t    ZPlatformAddressSpaceStart();
-uintptr_t    ZPlatformAddressSpaceEnd();
-uintptr_t    ZPlatformAddressReservedStart();
-uintptr_t    ZPlatformAddressReservedEnd();
 uintptr_t    ZPlatformAddressBase();
 size_t       ZPlatformAddressOffsetBits();
 size_t       ZPlatformAddressMetadataShift();
--- a/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1952,7 +1952,7 @@
   __ reset_last_Java_frame(false);
 
   // Unbox oop result, e.g. JNIHandles::resolve result.
-  if (ret_type == T_OBJECT || ret_type == T_ARRAY) {
+  if (is_reference_type(ret_type)) {
     __ resolve_jobject(r0, rthread, rscratch2);
   }
 
--- a/src/hotspot/cpu/sparc/c1_FrameMap_sparc.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/cpu/sparc/c1_FrameMap_sparc.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,7 +51,7 @@
     }
     if (r_2->is_Register() && (type == T_LONG || type == T_DOUBLE)) {
       opr = as_long_opr(reg);
-    } else if (type == T_OBJECT || type == T_ARRAY) {
+    } else if (is_reference_type(type)) {
       opr = as_oop_opr(reg);
     } else if (type == T_METADATA) {
       opr = as_metadata_opr(reg);
--- a/src/hotspot/cpu/sparc/c1_LIRAssembler_sparc.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/cpu/sparc/c1_LIRAssembler_sparc.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -107,8 +107,8 @@
       }
 
       if (UseCompressedOops) {
-        if (dst->is_address() && !dst->is_stack() && (dst->type() == T_OBJECT || dst->type() == T_ARRAY)) return false;
-        if (src->is_address() && !src->is_stack() && (src->type() == T_OBJECT || src->type() == T_ARRAY)) return false;
+        if (dst->is_address() && !dst->is_stack() && is_reference_type(dst->type())) return false;
+        if (src->is_address() && !src->is_stack() && is_reference_type(src->type())) return false;
       }
 
       if (UseCompressedClassPointers) {
@@ -728,7 +728,7 @@
     __ set(offset, O7);
     store_offset = store(from_reg, base, O7, type, wide);
   } else {
-    if (type == T_ARRAY || type == T_OBJECT) {
+    if (is_reference_type(type)) {
       __ verify_oop(from_reg->as_register());
     }
     store_offset = code_offset();
@@ -789,7 +789,7 @@
 
 
 int LIR_Assembler::store(LIR_Opr from_reg, Register base, Register disp, BasicType type, bool wide) {
-  if (type == T_ARRAY || type == T_OBJECT) {
+  if (is_reference_type(type)) {
     __ verify_oop(from_reg->as_register());
   }
   int store_offset = code_offset();
@@ -889,7 +889,7 @@
         }
       default      : ShouldNotReachHere();
     }
-    if (type == T_ARRAY || type == T_OBJECT) {
+    if (is_reference_type(type)) {
       __ verify_oop(to_reg->as_register());
     }
   }
@@ -924,7 +924,7 @@
       break;
     default      : ShouldNotReachHere();
   }
-  if (type == T_ARRAY || type == T_OBJECT) {
+  if (is_reference_type(type)) {
     __ verify_oop(to_reg->as_register());
   }
   return load_offset;
@@ -1359,7 +1359,7 @@
   } else {
     ShouldNotReachHere();
   }
-  if (to_reg->type() == T_OBJECT || to_reg->type() == T_ARRAY) {
+  if (is_reference_type(to_reg->type())) {
     __ verify_oop(to_reg->as_register());
   }
 }
@@ -2295,8 +2295,8 @@
 
   __ signx(op->len()->as_register());
   if (UseSlowPath ||
-      (!UseFastNewObjectArray && (op->type() == T_OBJECT || op->type() == T_ARRAY)) ||
-      (!UseFastNewTypeArray   && (op->type() != T_OBJECT && op->type() != T_ARRAY))) {
+      (!UseFastNewObjectArray && is_reference_type(op->type())) ||
+      (!UseFastNewTypeArray   && !is_reference_type(op->type()))) {
     __ br(Assembler::always, false, Assembler::pt, *op->stub()->entry());
     __ delayed()->nop();
   } else {
--- a/src/hotspot/cpu/sparc/c1_LIRGenerator_sparc.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/cpu/sparc/c1_LIRGenerator_sparc.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -568,7 +568,7 @@
   LIR_Opr t2 = FrameMap::G3_opr;
   cmp_value.load_item();
   new_value.load_item();
-  if (type == T_OBJECT || type == T_ARRAY) {
+  if (is_reference_type(type)) {
     __ cas_obj(addr->as_address_ptr()->base(), cmp_value.result(), new_value.result(), t1, t2);
   } else if (type == T_INT) {
     __ cas_int(addr->as_address_ptr()->base(), cmp_value.result(), new_value.result(), t1, t2);
@@ -583,7 +583,7 @@
 }
 
 LIR_Opr LIRGenerator::atomic_xchg(BasicType type, LIR_Opr addr, LIRItem& value) {
-  bool is_obj = type == T_OBJECT || type == T_ARRAY;
+  bool is_obj = is_reference_type(type);
   LIR_Opr result = new_register(type);
   LIR_Opr tmp = LIR_OprFact::illegalOpr;
 
--- a/src/hotspot/cpu/sparc/gc/g1/g1BarrierSetAssembler_sparc.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/cpu/sparc/gc/g1/g1BarrierSetAssembler_sparc.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -450,7 +450,7 @@
 
 void G1BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
                                     Address src, Register dst, Register tmp) {
-  bool on_oop = type == T_OBJECT || type == T_ARRAY;
+  bool on_oop = is_reference_type(type);
   bool on_weak = (decorators & ON_WEAK_OOP_REF) != 0;
   bool on_phantom = (decorators & ON_PHANTOM_OOP_REF) != 0;
   bool on_reference = on_weak || on_phantom;
--- a/src/hotspot/cpu/sparc/gc/shared/modRefBarrierSetAssembler_sparc.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/cpu/sparc/gc/shared/modRefBarrierSetAssembler_sparc.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -58,7 +58,7 @@
 
 void ModRefBarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
                                          Register val, Address dst, Register tmp) {
-  if (type == T_OBJECT || type == T_ARRAY) {
+  if (is_reference_type(type)) {
     oop_store_at(masm, decorators, type, val, dst, tmp);
   } else {
     BarrierSetAssembler::store_at(masm, decorators, type, val, dst, tmp);
--- a/src/hotspot/cpu/sparc/sharedRuntime_sparc.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/cpu/sparc/sharedRuntime_sparc.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -561,7 +561,7 @@
 
     if (r_1->is_Register()) {
       Register r = r_1->as_Register()->after_restore();
-      if (sig_bt[i] == T_OBJECT || sig_bt[i] == T_ARRAY) {
+      if (is_reference_type(sig_bt[i])) {
         store_c2i_object(r, base, st_off);
       } else if (sig_bt[i] == T_LONG || sig_bt[i] == T_DOUBLE) {
         store_c2i_long(r, base, st_off, r_2->is_stack());
@@ -1637,8 +1637,7 @@
   Register temp_reg = G5_method;  // not part of any compiled calling seq
   if (VerifyOops) {
     for (int i = 0; i < method->size_of_parameters(); i++) {
-      if (sig_bt[i] == T_OBJECT ||
-          sig_bt[i] == T_ARRAY) {
+      if (is_reference_type(sig_bt[i])) {
         VMReg r = regs[i].first();
         assert(r->is_valid(), "bad oop arg");
         if (r->is_stack()) {
@@ -2507,7 +2506,7 @@
   __ reset_last_Java_frame();
 
   // Unbox oop result, e.g. JNIHandles::resolve value in I0.
-  if (ret_type == T_OBJECT || ret_type == T_ARRAY) {
+  if (is_reference_type(ret_type)) {
     __ resolve_jobject(I0, G3_scratch);
   }
 
--- a/src/hotspot/cpu/x86/c1_FrameMap_x86.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/cpu/x86/c1_FrameMap_x86.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@
 #else
       opr = as_long_opr(reg2, reg);
 #endif // _LP64
-    } else if (type == T_OBJECT || type == T_ARRAY) {
+    } else if (is_reference_type(type)) {
       opr = as_oop_opr(reg);
     } else if (type == T_METADATA) {
       opr = as_metadata_opr(reg);
--- a/src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -861,7 +861,7 @@
 
   } else if (dest->is_double_cpu()) {
 #ifdef _LP64
-    if (src->type() == T_OBJECT || src->type() == T_ARRAY) {
+    if (is_reference_type(src->type())) {
       // Surprising to me but we can see move of a long to t_object
       __ verify_oop(src->as_register());
       move_regs(src->as_register(), dest->as_register_lo());
@@ -932,7 +932,7 @@
 
   if (src->is_single_cpu()) {
     Address dst = frame_map()->address_for_slot(dest->single_stack_ix());
-    if (type == T_OBJECT || type == T_ARRAY) {
+    if (is_reference_type(type)) {
       __ verify_oop(src->as_register());
       __ movptr (dst, src->as_register());
     } else if (type == T_METADATA) {
@@ -978,7 +978,7 @@
   PatchingStub* patch = NULL;
   Register compressed_src = rscratch1;
 
-  if (type == T_ARRAY || type == T_OBJECT) {
+  if (is_reference_type(type)) {
     __ verify_oop(src->as_register());
 #ifdef _LP64
     if (UseCompressedOops && !wide) {
@@ -1113,7 +1113,7 @@
   assert(dest->is_register(), "should not call otherwise");
 
   if (dest->is_single_cpu()) {
-    if (type == T_ARRAY || type == T_OBJECT) {
+    if (is_reference_type(type)) {
       __ movptr(dest->as_register(), frame_map()->address_for_slot(src->single_stack_ix()));
       __ verify_oop(dest->as_register());
     } else if (type == T_METADATA) {
@@ -1154,7 +1154,7 @@
 
 void LIR_Assembler::stack2stack(LIR_Opr src, LIR_Opr dest, BasicType type) {
   if (src->is_single_stack()) {
-    if (type == T_OBJECT || type == T_ARRAY) {
+    if (is_reference_type(type)) {
       __ pushptr(frame_map()->address_for_slot(src ->single_stack_ix()));
       __ popptr (frame_map()->address_for_slot(dest->single_stack_ix()));
     } else {
@@ -1355,7 +1355,7 @@
     patching_epilog(patch, patch_code, addr->base()->as_register(), info);
   }
 
-  if (type == T_ARRAY || type == T_OBJECT) {
+  if (is_reference_type(type)) {
 #ifdef _LP64
     if (UseCompressedOops && !wide) {
       __ decode_heap_oop(dest->as_register());
@@ -1593,8 +1593,8 @@
   LP64_ONLY( __ movslq(len, len); )
 
   if (UseSlowPath ||
-      (!UseFastNewObjectArray && (op->type() == T_OBJECT || op->type() == T_ARRAY)) ||
-      (!UseFastNewTypeArray   && (op->type() != T_OBJECT && op->type() != T_ARRAY))) {
+      (!UseFastNewObjectArray && is_reference_type(op->type())) ||
+      (!UseFastNewTypeArray   && !is_reference_type(op->type()))) {
     __ jmp(*op->stub()->entry());
   } else {
     Register tmp1 = op->tmp1()->as_register();
@@ -2510,7 +2510,7 @@
     } else {
 #ifdef _LP64
       Register r_lo;
-      if (right->type() == T_OBJECT || right->type() == T_ARRAY) {
+      if (is_reference_type(right->type())) {
         r_lo = right->as_register();
       } else {
         r_lo = right->as_register_lo();
@@ -2623,15 +2623,15 @@
     Register reg1 = opr1->as_register();
     if (opr2->is_single_cpu()) {
       // cpu register - cpu register
-      if (opr1->type() == T_OBJECT || opr1->type() == T_ARRAY) {
+      if (is_reference_type(opr1->type())) {
         __ cmpoop(reg1, opr2->as_register());
       } else {
-        assert(opr2->type() != T_OBJECT && opr2->type() != T_ARRAY, "cmp int, oop?");
+        assert(!is_reference_type(opr2->type()), "cmp int, oop?");
         __ cmpl(reg1, opr2->as_register());
       }
     } else if (opr2->is_stack()) {
       // cpu register - stack
-      if (opr1->type() == T_OBJECT || opr1->type() == T_ARRAY) {
+      if (is_reference_type(opr1->type())) {
         __ cmpoop(reg1, frame_map()->address_for_slot(opr2->single_stack_ix()));
       } else {
         __ cmpl(reg1, frame_map()->address_for_slot(opr2->single_stack_ix()));
@@ -2641,7 +2641,7 @@
       LIR_Const* c = opr2->as_constant_ptr();
       if (c->type() == T_INT) {
         __ cmpl(reg1, c->as_jint());
-      } else if (c->type() == T_OBJECT || c->type() == T_ARRAY) {
+      } else if (is_reference_type(c->type())) {
         // In 64bit oops are single register
         jobject o = c->as_jobject();
         if (o == NULL) {
@@ -2741,7 +2741,7 @@
   } else if (opr1->is_address() && opr2->is_constant()) {
     LIR_Const* c = opr2->as_constant_ptr();
 #ifdef _LP64
-    if (c->type() == T_OBJECT || c->type() == T_ARRAY) {
+    if (is_reference_type(c->type())) {
       assert(condition == lir_cond_equal || condition == lir_cond_notEqual, "need to reverse");
       __ movoop(rscratch1, c->as_jobject());
     }
@@ -2753,7 +2753,7 @@
     LIR_Address* addr = opr1->as_address_ptr();
     if (c->type() == T_INT) {
       __ cmpl(as_Address(addr), c->as_jint());
-    } else if (c->type() == T_OBJECT || c->type() == T_ARRAY) {
+    } else if (is_reference_type(c->type())) {
 #ifdef _LP64
       // %%% Make this explode if addr isn't reachable until we figure out a
       // better strategy by giving noreg as the temp for as_Address
@@ -3052,7 +3052,7 @@
   CodeStub* stub = op->stub();
   int flags = op->flags();
   BasicType basic_type = default_type != NULL ? default_type->element_type()->basic_type() : T_ILLEGAL;
-  if (basic_type == T_ARRAY) basic_type = T_OBJECT;
+  if (is_reference_type(basic_type)) basic_type = T_OBJECT;
 
   // if we don't know anything, just go through the generic arraycopy
   if (default_type == NULL) {
--- a/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -671,7 +671,7 @@
 
 LIR_Opr LIRGenerator::atomic_cmpxchg(BasicType type, LIR_Opr addr, LIRItem& cmp_value, LIRItem& new_value) {
   LIR_Opr ill = LIR_OprFact::illegalOpr;  // for convenience
-  if (type == T_OBJECT || type == T_ARRAY) {
+  if (is_reference_type(type)) {
     cmp_value.load_item_force(FrameMap::rax_oop_opr);
     new_value.load_item();
     __ cas_obj(addr->as_address_ptr()->base(), cmp_value.result(), new_value.result(), ill, ill);
@@ -693,7 +693,7 @@
 }
 
 LIR_Opr LIRGenerator::atomic_xchg(BasicType type, LIR_Opr addr, LIRItem& value) {
-  bool is_oop = type == T_OBJECT || type == T_ARRAY;
+  bool is_oop = is_reference_type(type);
   LIR_Opr result = new_register(type);
   value.load_item();
   // Because we want a 2-arg form of xchg and xadd
--- a/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -118,7 +118,7 @@
 
 void G1BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
                                     Register dst, Address src, Register tmp1, Register tmp_thread) {
-  bool on_oop = type == T_OBJECT || type == T_ARRAY;
+  bool on_oop = is_reference_type(type);
   bool on_weak = (decorators & ON_WEAK_OOP_REF) != 0;
   bool on_phantom = (decorators & ON_PHANTOM_OOP_REF) != 0;
   bool on_reference = on_weak || on_phantom;
--- a/src/hotspot/cpu/x86/gc/shared/modRefBarrierSetAssembler_x86.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/cpu/x86/gc/shared/modRefBarrierSetAssembler_x86.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
   bool disjoint = (decorators & ARRAYCOPY_DISJOINT) != 0;
   bool obj_int = type == T_OBJECT LP64_ONLY(&& UseCompressedOops);
 
-  if (type == T_OBJECT || type == T_ARRAY) {
+  if (is_reference_type(type)) {
 #ifdef _LP64
     if (!checkcast) {
       if (!obj_int) {
@@ -61,7 +61,7 @@
   bool obj_int = type == T_OBJECT LP64_ONLY(&& UseCompressedOops);
   Register tmp = rax;
 
-  if (type == T_OBJECT || type == T_ARRAY) {
+  if (is_reference_type(type)) {
 #ifdef _LP64
     if (!checkcast) {
       if (!obj_int) {
@@ -85,7 +85,7 @@
 
 void ModRefBarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
                                          Address dst, Register val, Register tmp1, Register tmp2) {
-  if (type == T_OBJECT || type == T_ARRAY) {
+  if (is_reference_type(type)) {
     oop_store_at(masm, decorators, type, dst, val, tmp1, tmp2);
   } else {
     BarrierSetAssembler::store_at(masm, decorators, type, dst, val, tmp1, tmp2);
--- a/src/hotspot/cpu/x86/gc/shenandoah/c1/shenandoahBarrierSetC1_x86.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/cpu/x86/gc/shenandoah/c1/shenandoahBarrierSetC1_x86.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Red Hat, Inc. All rights reserved.
+ * Copyright (c) 2018, 2019, Red Hat, Inc. All rights reserved.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
@@ -106,11 +106,11 @@
   // Because we want a 2-arg form of xchg and xadd
   __ move(value_opr, result);
 
-  assert(type == T_INT || type == T_OBJECT || type == T_ARRAY LP64_ONLY( || type == T_LONG ), "unexpected type");
+  assert(type == T_INT || is_reference_type(type) LP64_ONLY( || type == T_LONG ), "unexpected type");
   __ xchg(access.resolved_addr(), result, result, LIR_OprFact::illegalOpr);
 
   if (access.is_oop()) {
-    result = load_reference_barrier(access.gen(), result);
+    result = load_reference_barrier(access.gen(), result, LIR_OprFact::addressConst(0));
     LIR_Opr tmp = gen->new_register(type);
     __ move(result, tmp);
     result = tmp;
--- a/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -47,35 +47,28 @@
 void ShenandoahBarrierSetAssembler::arraycopy_prologue(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
                                                        Register src, Register dst, Register count) {
 
-  bool checkcast = (decorators & ARRAYCOPY_CHECKCAST) != 0;
-  bool disjoint = (decorators & ARRAYCOPY_DISJOINT) != 0;
-  bool obj_int = type == T_OBJECT LP64_ONLY(&& UseCompressedOops);
   bool dest_uninitialized = (decorators & IS_DEST_UNINITIALIZED) != 0;
 
-  if (type == T_OBJECT || type == T_ARRAY) {
+  if (is_reference_type(type)) {
+
+    if ((ShenandoahSATBBarrier && !dest_uninitialized) || ShenandoahLoadRefBarrier) {
 #ifdef _LP64
-    if (!checkcast) {
-      if (!obj_int) {
-        // Save count for barrier
-        __ movptr(r11, count);
-      } else if (disjoint) {
-        // Save dst in r11 in the disjoint case
-        __ movq(r11, dst);
+      Register thread = r15_thread;
+#else
+      Register thread = rax;
+      if (thread == src || thread == dst || thread == count) {
+        thread = rbx;
       }
-    }
-#else
-    if (disjoint) {
-      __ mov(rdx, dst);          // save 'to'
-    }
-#endif
-
-    if (ShenandoahSATBBarrier && !dest_uninitialized) {
-      Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread);
-      assert_different_registers(dst, count, thread); // we don't care about src here?
-#ifndef _LP64
+      if (thread == src || thread == dst || thread == count) {
+        thread = rcx;
+      }
+      if (thread == src || thread == dst || thread == count) {
+        thread = rdx;
+      }
       __ push(thread);
       __ get_thread(thread);
 #endif
+      assert_different_registers(src, dst, count, thread);
 
       Label done;
       // Short-circuit if count == 0.
@@ -84,32 +77,33 @@
 
       // Avoid runtime call when not marking.
       Address gc_state(thread, in_bytes(ShenandoahThreadLocalData::gc_state_offset()));
-      __ testb(gc_state, ShenandoahHeap::MARKING);
+      int flags = ShenandoahHeap::HAS_FORWARDED;
+      if (!dest_uninitialized) {
+        flags |= ShenandoahHeap::MARKING;
+      }
+      __ testb(gc_state, flags);
       __ jcc(Assembler::zero, done);
 
       __ pusha();                      // push registers
 #ifdef _LP64
-      if (count == c_rarg0) {
-        if (dst == c_rarg1) {
-          // exactly backwards!!
-          __ xchgptr(c_rarg1, c_rarg0);
+      assert(src == rdi, "expected");
+      assert(dst == rsi, "expected");
+      assert(count == rdx, "expected");
+      if (UseCompressedOops) {
+        if (dest_uninitialized) {
+          __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::write_ref_array_pre_duinit_narrow_oop_entry), src, dst, count);
         } else {
-          __ movptr(c_rarg1, count);
-          __ movptr(c_rarg0, dst);
+          __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::write_ref_array_pre_narrow_oop_entry), src, dst, count);
         }
-      } else {
-        __ movptr(c_rarg0, dst);
-        __ movptr(c_rarg1, count);
+      } else
+#endif
+      {
+        if (dest_uninitialized) {
+          __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::write_ref_array_pre_duinit_oop_entry), src, dst, count);
+        } else {
+          __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::write_ref_array_pre_oop_entry), src, dst, count);
+        }
       }
-      if (UseCompressedOops) {
-        __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::write_ref_array_pre_narrow_oop_entry), 2);
-      } else {
-        __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::write_ref_array_pre_oop_entry), 2);
-      }
-#else
-      __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::write_ref_array_pre_oop_entry),
-                      dst, count);
-#endif
       __ popa();
       __ bind(done);
       NOT_LP64(__ pop(thread);)
@@ -118,73 +112,6 @@
 
 }
 
-void ShenandoahBarrierSetAssembler::arraycopy_epilogue(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
-                                                       Register src, Register dst, Register count) {
-  bool checkcast = (decorators & ARRAYCOPY_CHECKCAST) != 0;
-  bool disjoint = (decorators & ARRAYCOPY_DISJOINT) != 0;
-  bool obj_int = type == T_OBJECT LP64_ONLY(&& UseCompressedOops);
-  Register tmp = rax;
-
-  if (type == T_OBJECT || type == T_ARRAY) {
-#ifdef _LP64
-    if (!checkcast) {
-      if (!obj_int) {
-        // Save count for barrier
-        count = r11;
-      } else if (disjoint && obj_int) {
-        // Use the saved dst in the disjoint case
-        dst = r11;
-      }
-    } else {
-      tmp = rscratch1;
-    }
-#else
-    if (disjoint) {
-      __ mov(dst, rdx); // restore 'to'
-    }
-#endif
-
-    Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread);
-    assert_different_registers(dst, thread); // do we care about src at all here?
-
-#ifndef _LP64
-    __ push(thread);
-    __ get_thread(thread);
-#endif
-
-    // Short-circuit if count == 0.
-    Label done;
-    __ testptr(count, count);
-    __ jcc(Assembler::zero, done);
-
-    // Skip runtime call if no forwarded objects.
-    Address gc_state(thread, in_bytes(ShenandoahThreadLocalData::gc_state_offset()));
-    __ testb(gc_state, ShenandoahHeap::UPDATEREFS);
-    __ jcc(Assembler::zero, done);
-
-    __ pusha();             // push registers (overkill)
-#ifdef _LP64
-    if (c_rarg0 == count) { // On win64 c_rarg0 == rcx
-      assert_different_registers(c_rarg1, dst);
-      __ mov(c_rarg1, count);
-      __ mov(c_rarg0, dst);
-    } else {
-      assert_different_registers(c_rarg0, count);
-      __ mov(c_rarg0, dst);
-      __ mov(c_rarg1, count);
-    }
-    __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::write_ref_array_post_entry), 2);
-#else
-    __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::write_ref_array_post_entry),
-                    dst, count);
-#endif
-    __ popa();
-
-    __ bind(done);
-    NOT_LP64(__ pop(thread);)
-  }
-}
-
 void ShenandoahBarrierSetAssembler::shenandoah_write_barrier_pre(MacroAssembler* masm,
                                                                  Register obj,
                                                                  Register pre_val,
@@ -534,22 +461,18 @@
 
 void ShenandoahBarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
              Register dst, Address src, Register tmp1, Register tmp_thread) {
-  bool on_oop = type == T_OBJECT || type == T_ARRAY;
+  bool on_oop = is_reference_type(type);
   bool on_weak = (decorators & ON_WEAK_OOP_REF) != 0;
   bool on_phantom = (decorators & ON_PHANTOM_OOP_REF) != 0;
   bool not_in_heap = (decorators & IN_NATIVE) != 0;
   bool on_reference = on_weak || on_phantom;
-  bool keep_alive = (decorators & AS_NO_KEEPALIVE) == 0;
+  bool is_traversal_mode = ShenandoahHeap::heap()->is_traversal_mode();
+  bool keep_alive = ((decorators & AS_NO_KEEPALIVE) == 0) || is_traversal_mode;
 
   BarrierSetAssembler::load_at(masm, decorators, type, dst, src, tmp1, tmp_thread);
   if (on_oop) {
-    if (not_in_heap) {
-      if (ShenandoahHeap::heap()->is_traversal_mode()) {
-        load_reference_barrier(masm, dst);
-        keep_alive = true;
-      } else {
-        load_reference_barrier_native(masm, dst);
-      }
+    if (not_in_heap && !is_traversal_mode) {
+      load_reference_barrier_native(masm, dst);
     } else {
       load_reference_barrier(masm, dst);
     }
@@ -574,7 +497,7 @@
 void ShenandoahBarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
               Address dst, Register val, Register tmp1, Register tmp2) {
 
-  bool on_oop = type == T_OBJECT || type == T_ARRAY;
+  bool on_oop = is_reference_type(type);
   bool in_heap = (decorators & IN_HEAP) != 0;
   bool as_normal = (decorators & AS_NORMAL) != 0;
   if (on_oop && in_heap) {
@@ -788,8 +711,10 @@
 
   Register obj = stub->obj()->as_register();
   Register res = stub->result()->as_register();
+  Register addr = stub->addr()->as_register();
   Register tmp1 = stub->tmp1()->as_register();
   Register tmp2 = stub->tmp2()->as_register();
+  assert_different_registers(obj, res, addr, tmp1, tmp2);
 
   Label slow_path;
 
@@ -818,29 +743,9 @@
 #endif
   __ jcc(Assembler::zero, *stub->continuation());
 
-  // Test if object is resolved.
-  __ movptr(tmp1, Address(res, oopDesc::mark_offset_in_bytes()));
-  // Test if both lowest bits are set. We trick it by negating the bits
-  // then test for both bits clear.
-  __ notptr(tmp1);
-#ifdef _LP64
-  __ testb(tmp1, markWord::marked_value);
-#else
-  // On x86_32, C1 register allocator can give us the register without 8-bit support.
-  // Do the full-register access and test to avoid compilation failures.
-  __ testptr(tmp1, markWord::marked_value);
-#endif
-  __ jccb(Assembler::notZero, slow_path);
-  // Clear both lower bits. It's still inverted, so set them, and then invert back.
-  __ orptr(tmp1, markWord::marked_value);
-  __ notptr(tmp1);
-  // At this point, tmp1 contains the decoded forwarding pointer.
-  __ mov(res, tmp1);
-
-  __ jmp(*stub->continuation());
-
   __ bind(slow_path);
   ce->store_parameter(res, 0);
+  ce->store_parameter(addr, 1);
   __ call(RuntimeAddress(bs->load_reference_barrier_rt_code_blob()->code_begin()));
 
   __ jmp(*stub->continuation());
@@ -911,8 +816,21 @@
   // arg0 : object to be resolved
 
   __ save_live_registers_no_oop_map(true);
-  __ load_parameter(0, LP64_ONLY(c_rarg0) NOT_LP64(rax));
-  __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier), LP64_ONLY(c_rarg0) NOT_LP64(rax));
+
+#ifdef _LP64
+  __ load_parameter(0, c_rarg0);
+  __ load_parameter(1, c_rarg1);
+  if (UseCompressedOops) {
+    __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier_fixup_narrow), c_rarg0, c_rarg1);
+  } else {
+    __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier_fixup), c_rarg0, c_rarg1);
+  }
+#else
+  __ load_parameter(0, rax);
+  __ load_parameter(1, rbx);
+  __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier_fixup), rax, rbx);
+#endif
+
   __ restore_live_registers_except_rax(true);
 
   __ epilogue();
--- a/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -83,8 +83,6 @@
                    bool exchange, Register tmp1, Register tmp2);
   virtual void arraycopy_prologue(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
                                   Register src, Register dst, Register count);
-  virtual void arraycopy_epilogue(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
-                                  Register src, Register dst, Register count);
   virtual void load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
                        Register dst, Address src, Register tmp1, Register tmp_thread);
   virtual void store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
--- a/src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -198,7 +198,7 @@
   BLOCK_COMMENT("ZBarrierSetAssembler::store_at {");
 
   // Verify oop store
-  if (type == T_OBJECT || type == T_ARRAY) {
+  if (is_reference_type(type)) {
     // Note that src could be noreg, which means we
     // are storing null and can skip verification.
     if (src != noreg) {
--- a/src/hotspot/cpu/x86/gc/z/zGlobals_x86.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/cpu/x86/gc/z/zGlobals_x86.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -135,26 +135,6 @@
 //  * 63-48 Fixed (16-bits, always zero)
 //
 
-uintptr_t ZPlatformAddressSpaceStart() {
-  const uintptr_t first_heap_view_address = (uintptr_t)1 << (ZPlatformAddressMetadataShift() + 0);
-  const size_t min_address_offset = 0;
-  return first_heap_view_address + min_address_offset;
-}
-
-uintptr_t ZPlatformAddressSpaceEnd() {
-  const uintptr_t last_heap_view_address = (uintptr_t)1 << (ZPlatformAddressMetadataShift() + 2);
-  const size_t max_address_offset = (size_t)1 << ZPlatformAddressOffsetBits();
-  return last_heap_view_address + max_address_offset;
-}
-
-uintptr_t ZPlatformAddressReservedStart() {
-  return ZPlatformAddressSpaceStart();
-}
-
-uintptr_t ZPlatformAddressReservedEnd() {
-  return ZPlatformAddressSpaceEnd();
-}
-
 uintptr_t ZPlatformAddressBase() {
   return 0;
 }
--- a/src/hotspot/cpu/x86/gc/z/zGlobals_x86.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/cpu/x86/gc/z/zGlobals_x86.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -40,10 +40,6 @@
 const size_t ZPlatformNMethodDisarmedOffset = 4;
 const size_t ZPlatformCacheLineSize         = 64;
 
-uintptr_t    ZPlatformAddressSpaceStart();
-uintptr_t    ZPlatformAddressSpaceEnd();
-uintptr_t    ZPlatformAddressReservedStart();
-uintptr_t    ZPlatformAddressReservedEnd();
 uintptr_t    ZPlatformAddressBase();
 size_t       ZPlatformAddressOffsetBits();
 size_t       ZPlatformAddressMetadataShift();
--- a/src/hotspot/cpu/x86/sharedRuntime_x86_32.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/cpu/x86/sharedRuntime_x86_32.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1416,8 +1416,7 @@
   Register temp_reg = rbx;  // not part of any compiled calling seq
   if (VerifyOops) {
     for (int i = 0; i < method->size_of_parameters(); i++) {
-      if (sig_bt[i] == T_OBJECT ||
-          sig_bt[i] == T_ARRAY) {
+      if (is_reference_type(sig_bt[i])) {
         VMReg r = regs[i].first();
         assert(r->is_valid(), "bad oop arg");
         if (r->is_stack()) {
@@ -2218,7 +2217,7 @@
   __ reset_last_Java_frame(thread, false);
 
   // Unbox oop result, e.g. JNIHandles::resolve value.
-  if (ret_type == T_OBJECT || ret_type == T_ARRAY) {
+  if (is_reference_type(ret_type)) {
     __ resolve_jobject(rax /* value */,
                        thread /* thread */,
                        rcx /* tmp */);
--- a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1816,8 +1816,7 @@
   Register temp_reg = rbx;  // not part of any compiled calling seq
   if (VerifyOops) {
     for (int i = 0; i < method->size_of_parameters(); i++) {
-      if (sig_bt[i] == T_OBJECT ||
-          sig_bt[i] == T_ARRAY) {
+      if (is_reference_type(sig_bt[i])) {
         VMReg r = regs[i].first();
         assert(r->is_valid(), "bad oop arg");
         if (r->is_stack()) {
@@ -2717,7 +2716,7 @@
   __ reset_last_Java_frame(false);
 
   // Unbox oop result, e.g. JNIHandles::resolve value.
-  if (ret_type == T_OBJECT || ret_type == T_ARRAY) {
+  if (is_reference_type(ret_type)) {
     __ resolve_jobject(rax /* value */,
                        r15_thread /* thread */,
                        rcx /* tmp */);
--- a/src/hotspot/os/aix/libodm_aix.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/os/aix/libodm_aix.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2015, 2015 SAP SE. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019 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
@@ -59,7 +59,7 @@
 void odmWrapper::clean_data() { if (_data) { free(_data); _data = NULL; } }
 
 
-int odmWrapper::class_offset(char *field, bool is_aix_5)
+int odmWrapper::class_offset(const char *field, bool is_aix_5)
 {
   assert(has_class(), "initialization");
   for (int i = 0; i < odm_class()->nelem; i++) {
--- a/src/hotspot/os/aix/libodm_aix.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/os/aix/libodm_aix.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2015, 2015 SAP SE. All rights reserved.
+ * Copyright (c) 2015, 2019 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
@@ -68,13 +68,15 @@
 
  public:
   // Make sure everything gets initialized and cleaned up properly.
-  explicit odmWrapper(char* odm_class_name, char* odm_path = NULL) : _odm_class((CLASS_SYMBOL)-1),
+  explicit odmWrapper(const char* odm_class_name, const char* odm_path = NULL) : _odm_class((CLASS_SYMBOL)-1),
                                                                      _data(NULL), _initialized(false) {
     if (!odm_loaded()) { return; }
     _initialized = ((*_odm_initialize)() != -1);
     if (_initialized) {
-      if (odm_path) { (*_odm_set_path)(odm_path); }
-      _odm_class = (*_odm_mount_class)(odm_class_name);
+      // should we free what odm_set_path returns, man page suggests it
+      // see https://www.ibm.com/support/knowledgecenter/en/ssw_aix_71/o_bostechref/odm_set_path.html
+      if (odm_path) { (*_odm_set_path)((char*)odm_path); }
+      _odm_class = (*_odm_mount_class)((char*)odm_class_name);
     }
   }
   ~odmWrapper() {
@@ -83,12 +85,12 @@
 
   CLASS_SYMBOL odm_class() { return _odm_class; }
   bool has_class() { return odm_class() != (CLASS_SYMBOL)-1; }
-  int class_offset(char *field, bool is_aix_5);
+  int class_offset(const char *field, bool is_aix_5);
   char* data() { return _data; }
 
-  char* retrieve_obj(char* name = NULL) {
+  char* retrieve_obj(const char* name = NULL) {
     clean_data();
-    char *cnp = (char*)(void*)(*_odm_get_obj)(odm_class(), name, NULL, (name == NULL) ? ODM_NEXT : ODM_FIRST);
+    char *cnp = (char*)(void*)(*_odm_get_obj)(odm_class(), (char*) name, NULL, (name == NULL) ? ODM_NEXT : ODM_FIRST);
     if (cnp != (char*)-1) { _data = cnp; }
     return data();
   }
--- a/src/hotspot/os/aix/os_aix.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/os/aix/os_aix.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -4228,7 +4228,7 @@
 // Unlike system(), this function can be called from signal handler. It
 // doesn't block SIGINT et al.
 int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
-  char * argv[4] = {"sh", "-c", cmd, NULL};
+  char* argv[4] = { (char*)"sh", (char*)"-c", cmd, NULL};
 
   pid_t pid = fork();
 
--- a/src/hotspot/os/aix/os_perf_aix.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/os/aix/os_perf_aix.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -445,9 +445,6 @@
 bool CPUPerformanceInterface::CPUPerformance::initialize() {
   size_t array_entry_count = _counters.nProcs + 1;
   _counters.cpus = NEW_C_HEAP_ARRAY(CPUPerfTicks, array_entry_count, mtInternal);
-  if (NULL == _counters.cpus) {
-    return false;
-  }
   memset(_counters.cpus, 0, array_entry_count * sizeof(*_counters.cpus));
 
   // For the CPU load total
@@ -535,7 +532,7 @@
 
 bool CPUPerformanceInterface::initialize() {
   _impl = new CPUPerformanceInterface::CPUPerformance();
-  return NULL == _impl ? false : _impl->initialize();
+  return _impl->initialize();
 }
 
 CPUPerformanceInterface::~CPUPerformanceInterface() {
@@ -688,19 +685,17 @@
     }
     if (size > 0) {
       cmdline = NEW_C_HEAP_ARRAY(char, size + 1, mtInternal);
-      if (cmdline != NULL) {
-        cmdline[0] = '\0';
-        if (fseek(fp, 0, SEEK_SET) == 0) {
-          if (fread(cmdline, 1, size, fp) == size) {
-            // the file has the arguments separated by '\0',
-            // so we translate '\0' to ' '
-            for (size_t i = 0; i < size; i++) {
-              if (cmdline[i] == '\0') {
-                cmdline[i] = ' ';
-              }
+      cmdline[0] = '\0';
+      if (fseek(fp, 0, SEEK_SET) == 0) {
+        if (fread(cmdline, 1, size, fp) == size) {
+          // the file has the arguments separated by '\0',
+          // so we translate '\0' to ' '
+          for (size_t i = 0; i < size; i++) {
+            if (cmdline[i] == '\0') {
+              cmdline[i] = ' ';
             }
-            cmdline[size] = '\0';
           }
+          cmdline[size] = '\0';
         }
       }
     }
@@ -790,7 +785,7 @@
 
 bool SystemProcessInterface::SystemProcesses::initialize() {
   _iterator = new SystemProcessInterface::SystemProcesses::ProcessIterator();
-  return NULL == _iterator ? false : _iterator->initialize();
+  return _iterator->initialize();
 }
 
 SystemProcessInterface::SystemProcesses::~SystemProcesses() {
@@ -837,7 +832,7 @@
 
 bool SystemProcessInterface::initialize() {
   _impl = new SystemProcessInterface::SystemProcesses();
-  return NULL == _impl ? false : _impl->initialize();
+  return _impl->initialize();
 }
 
 SystemProcessInterface::~SystemProcessInterface() {
@@ -852,15 +847,11 @@
 
 bool CPUInformationInterface::initialize() {
   _cpu_info = new CPUInformation();
-  if (NULL == _cpu_info) {
-    return false;
-  }
   _cpu_info->set_number_of_hardware_threads(VM_Version_Ext::number_of_threads());
   _cpu_info->set_number_of_cores(VM_Version_Ext::number_of_cores());
   _cpu_info->set_number_of_sockets(VM_Version_Ext::number_of_sockets());
   _cpu_info->set_cpu_name(VM_Version_Ext::cpu_name());
   _cpu_info->set_cpu_description(VM_Version_Ext::cpu_description());
-
   return true;
 }
 
@@ -928,7 +919,7 @@
 
 bool NetworkPerformanceInterface::initialize() {
   _impl = new NetworkPerformanceInterface::NetworkPerformance();
-  return _impl != NULL && _impl->initialize();
+  return _impl->initialize();
 }
 
 int NetworkPerformanceInterface::network_utilization(NetworkInterface** network_interfaces) const {
--- a/src/hotspot/os/bsd/os_bsd.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/os/bsd/os_bsd.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -136,8 +136,6 @@
 static sigset_t check_signal_done;
 static bool check_signals = true;
 
-static pid_t _initial_pid = 0;
-
 // Signal number used to suspend/resume a thread
 
 // do not use any signal number less than SIGSEGV, see 4355769
@@ -1124,24 +1122,7 @@
 }
 
 int os::current_process_id() {
-
-  // Under the old bsd thread library, bsd gives each thread
-  // its own process id. Because of this each thread will return
-  // a different pid if this method were to return the result
-  // of getpid(2). Bsd provides no api that returns the pid
-  // of the launcher thread for the vm. This implementation
-  // returns a unique pid, the pid of the launcher thread
-  // that starts the vm 'process'.
-
-  // Under the NPTL, getpid() returns the same pid as the
-  // launcher thread rather than a unique pid per thread.
-  // Use gettid() if you want the old pre NPTL behaviour.
-
-  // if you are looking for the result of a call to getpid() that
-  // returns a unique pid for the calling thread, then look at the
-  // OSThread::thread_id() method in osThread_bsd.hpp file
-
-  return (int)(_initial_pid ? _initial_pid : getpid());
+  return (int)(getpid());
 }
 
 // DLL functions
@@ -3087,16 +3068,6 @@
 void os::init(void) {
   char dummy;   // used to get a guess on initial stack address
 
-  // With BsdThreads the JavaMain thread pid (primordial thread)
-  // is different than the pid of the java launcher thread.
-  // So, on Bsd, the launcher thread pid is passed to the VM
-  // via the sun.java.launcher.pid property.
-  // Use this property instead of getpid() if it was correctly passed.
-  // See bug 6351349.
-  pid_t java_launcher_pid = (pid_t) Arguments::sun_java_launcher_pid();
-
-  _initial_pid = (java_launcher_pid > 0) ? java_launcher_pid : getpid();
-
   clock_tics_per_sec = CLK_TCK;
 
   init_random(1234567);
--- a/src/hotspot/os/bsd/os_perf_bsd.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/os/bsd/os_perf_bsd.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -234,7 +234,7 @@
 
 bool CPUPerformanceInterface::initialize() {
   _impl = new CPUPerformanceInterface::CPUPerformance();
-  return _impl != NULL && _impl->initialize();
+  return _impl->initialize();
 }
 
 CPUPerformanceInterface::~CPUPerformanceInterface() {
@@ -355,7 +355,7 @@
 
 bool SystemProcessInterface::initialize() {
   _impl = new SystemProcessInterface::SystemProcesses();
-  return _impl != NULL && _impl->initialize();
+  return _impl->initialize();
 }
 
 SystemProcessInterface::~SystemProcessInterface() {
@@ -370,16 +370,11 @@
 
 bool CPUInformationInterface::initialize() {
   _cpu_info = new CPUInformation();
-
-  if (NULL == _cpu_info) {
-    return false;
-  }
   _cpu_info->set_number_of_hardware_threads(VM_Version_Ext::number_of_threads());
   _cpu_info->set_number_of_cores(VM_Version_Ext::number_of_cores());
   _cpu_info->set_number_of_sockets(VM_Version_Ext::number_of_sockets());
   _cpu_info->set_cpu_name(VM_Version_Ext::cpu_name());
   _cpu_info->set_cpu_description(VM_Version_Ext::cpu_description());
-
   return true;
 }
 
@@ -483,7 +478,7 @@
 
 bool NetworkPerformanceInterface::initialize() {
   _impl = new NetworkPerformanceInterface::NetworkPerformance();
-  return _impl != NULL && _impl->initialize();
+  return _impl->initialize();
 }
 
 int NetworkPerformanceInterface::network_utilization(NetworkInterface** network_interfaces) const {
--- a/src/hotspot/os/linux/gc/z/zVirtualMemory_linux.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-#include "precompiled.hpp"
-#include "gc/z/zVirtualMemory.hpp"
-#include "logging/log.hpp"
-
-#include <sys/mman.h>
-#include <sys/types.h>
-
-bool ZVirtualMemoryManager::reserve(uintptr_t start, size_t size) {
-  // Reserve address space
-  const uintptr_t actual_start = (uintptr_t)mmap((void*)start, size, PROT_NONE,
-                                                 MAP_ANONYMOUS|MAP_PRIVATE|MAP_NORESERVE, -1, 0);
-  if (actual_start != start) {
-    log_error(gc)("Failed to reserve address space for Java heap");
-    return false;
-  }
-
-  return true;
-}
--- a/src/hotspot/os/linux/os_perf_linux.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/os/linux/os_perf_linux.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -505,9 +505,6 @@
 bool CPUPerformanceInterface::CPUPerformance::initialize() {
   size_t array_entry_count = _counters.nProcs + 1;
   _counters.cpus = NEW_C_HEAP_ARRAY(os::Linux::CPUPerfTicks, array_entry_count, mtInternal);
-  if (NULL == _counters.cpus) {
-    return false;
-  }
   memset(_counters.cpus, 0, array_entry_count * sizeof(*_counters.cpus));
 
   // For the CPU load total
@@ -595,7 +592,7 @@
 
 bool CPUPerformanceInterface::initialize() {
   _impl = new CPUPerformanceInterface::CPUPerformance();
-  return NULL == _impl ? false : _impl->initialize();
+  return _impl->initialize();
 }
 
 CPUPerformanceInterface::~CPUPerformanceInterface() {
@@ -748,19 +745,17 @@
     }
     if (size > 0) {
       cmdline = NEW_C_HEAP_ARRAY(char, size + 1, mtInternal);
-      if (cmdline != NULL) {
-        cmdline[0] = '\0';
-        if (fseek(fp, 0, SEEK_SET) == 0) {
-          if (fread(cmdline, 1, size, fp) == size) {
-            // the file has the arguments separated by '\0',
-            // so we translate '\0' to ' '
-            for (size_t i = 0; i < size; i++) {
-              if (cmdline[i] == '\0') {
-                cmdline[i] = ' ';
-              }
+      cmdline[0] = '\0';
+      if (fseek(fp, 0, SEEK_SET) == 0) {
+        if (fread(cmdline, 1, size, fp) == size) {
+          // the file has the arguments separated by '\0',
+          // so we translate '\0' to ' '
+          for (size_t i = 0; i < size; i++) {
+            if (cmdline[i] == '\0') {
+              cmdline[i] = ' ';
             }
-            cmdline[size] = '\0';
           }
+          cmdline[size] = '\0';
         }
       }
     }
@@ -854,7 +849,7 @@
 
 bool SystemProcessInterface::SystemProcesses::initialize() {
   _iterator = new SystemProcessInterface::SystemProcesses::ProcessIterator();
-  return NULL == _iterator ? false : _iterator->initialize();
+  return _iterator->initialize();
 }
 
 SystemProcessInterface::SystemProcesses::~SystemProcesses() {
@@ -901,7 +896,7 @@
 
 bool SystemProcessInterface::initialize() {
   _impl = new SystemProcessInterface::SystemProcesses();
-  return NULL == _impl ? false : _impl->initialize();
+  return _impl->initialize();
 }
 
 SystemProcessInterface::~SystemProcessInterface() {
@@ -916,15 +911,11 @@
 
 bool CPUInformationInterface::initialize() {
   _cpu_info = new CPUInformation();
-  if (NULL == _cpu_info) {
-    return false;
-  }
   _cpu_info->set_number_of_hardware_threads(VM_Version_Ext::number_of_threads());
   _cpu_info->set_number_of_cores(VM_Version_Ext::number_of_cores());
   _cpu_info->set_number_of_sockets(VM_Version_Ext::number_of_sockets());
   _cpu_info->set_cpu_name(VM_Version_Ext::cpu_name());
   _cpu_info->set_cpu_description(VM_Version_Ext::cpu_description());
-
   return true;
 }
 
@@ -1038,7 +1029,7 @@
 
 bool NetworkPerformanceInterface::initialize() {
   _impl = new NetworkPerformanceInterface::NetworkPerformance();
-  return _impl != NULL && _impl->initialize();
+  return _impl->initialize();
 }
 
 int NetworkPerformanceInterface::network_utilization(NetworkInterface** network_interfaces) const {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/os/posix/gc/z/zUtils_posix.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 "gc/z/zUtils.hpp"
+#include "utilities/debug.hpp"
+
+#include <stdlib.h>
+
+uintptr_t ZUtils::alloc_aligned(size_t alignment, size_t size) {
+  void* res = NULL;
+
+  if (posix_memalign(&res, alignment, size) != 0) {
+    fatal("posix_memalign() failed");
+  }
+
+  memset(res, 0, size);
+
+  return (uintptr_t)res;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/os/posix/gc/z/zVirtualMemory_posix.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 "gc/z/zAddress.inline.hpp"
+#include "gc/z/zVirtualMemory.hpp"
+#include "logging/log.hpp"
+
+#include <sys/mman.h>
+#include <sys/types.h>
+
+static void unmap(uintptr_t start, size_t size) {
+  const int res = munmap((void*)start, size);
+  assert(res == 0, "Failed to unmap memory");
+}
+
+static bool map(uintptr_t start, size_t size) {
+  const void* const res = mmap((void*)start, size, PROT_NONE, MAP_ANONYMOUS|MAP_PRIVATE|MAP_NORESERVE, -1, 0);
+  if (res == MAP_FAILED) {
+    // Failed to reserve memory
+    return false;
+  }
+
+  if ((uintptr_t)res != start) {
+    // Failed to reserve memory at the requested address
+    unmap(start, size);
+    return false;
+  }
+
+  // Success
+  return true;
+}
+
+bool ZVirtualMemoryManager::reserve_platform(uintptr_t start, size_t size) {
+  // Reserve address views
+  const uintptr_t marked0 = ZAddress::marked0(start);
+  const uintptr_t marked1 = ZAddress::marked1(start);
+  const uintptr_t remapped = ZAddress::remapped(start);
+
+  if (!map(marked0, size)) {
+    return false;
+  }
+
+  if (!map(marked1, size)) {
+    unmap(marked0, size);
+    return false;
+  }
+
+  if (!map(remapped, size)) {
+    unmap(marked0, size);
+    unmap(marked1, size);
+    return false;
+  }
+
+  // Register address views with native memory tracker
+  nmt_reserve(marked0, size);
+  nmt_reserve(marked1, size);
+  nmt_reserve(remapped, size);
+
+  return true;
+}
--- a/src/hotspot/os/posix/os_posix.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/os/posix/os_posix.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -640,61 +640,6 @@
   return;
 }
 
-////////////////////////////////////////////////////////////////////////////////
-// interrupt support
-
-void os::interrupt(Thread* thread) {
-  debug_only(Thread::check_for_dangling_thread_pointer(thread);)
-  assert(thread->is_Java_thread(), "invariant");
-  JavaThread* jt = (JavaThread*) thread;
-  OSThread* osthread = thread->osthread();
-
-  if (!osthread->interrupted()) {
-    osthread->set_interrupted(true);
-    // More than one thread can get here with the same value of osthread,
-    // resulting in multiple notifications.  We do, however, want the store
-    // to interrupted() to be visible to other threads before we execute unpark().
-    OrderAccess::fence();
-    ParkEvent * const slp = jt->_SleepEvent ;
-    if (slp != NULL) slp->unpark() ;
-  }
-
-  // For JSR166. Unpark even if interrupt status already was set
-  jt->parker()->unpark();
-
-  ParkEvent * ev = thread->_ParkEvent ;
-  if (ev != NULL) ev->unpark() ;
-}
-
-bool os::is_interrupted(Thread* thread, bool clear_interrupted) {
-  debug_only(Thread::check_for_dangling_thread_pointer(thread);)
-
-  OSThread* osthread = thread->osthread();
-
-  bool interrupted = osthread->interrupted();
-
-  // NOTE that since there is no "lock" around the interrupt and
-  // is_interrupted operations, there is the possibility that the
-  // interrupted flag (in osThread) will be "false" but that the
-  // low-level events will be in the signaled state. This is
-  // intentional. The effect of this is that Object.wait() and
-  // LockSupport.park() will appear to have a spurious wakeup, which
-  // is allowed and not harmful, and the possibility is so rare that
-  // it is not worth the added complexity to add yet another lock.
-  // For the sleep event an explicit reset is performed on entry
-  // to JavaThread::sleep, so there is no early return. It has also been
-  // recommended not to put the interrupted flag into the "event"
-  // structure because it hides the issue.
-  if (interrupted && clear_interrupted) {
-    osthread->set_interrupted(false);
-    // consider thread->_SleepEvent->reset() ... optional optimization
-  }
-
-  return interrupted;
-}
-
-
-
 static const struct {
   int sig; const char* name;
 }
@@ -2107,7 +2052,7 @@
 
   // Optional optimization -- avoid state transitions if there's
   // an interrupt pending.
-  if (Thread::is_interrupted(thread, false)) {
+  if (jt->is_interrupted(false)) {
     return;
   }
 
@@ -2130,7 +2075,7 @@
 
   // Don't wait if cannot get lock since interference arises from
   // unparking. Also re-check interrupt before trying wait.
-  if (Thread::is_interrupted(thread, false) ||
+  if (jt->is_interrupted(false) ||
       pthread_mutex_trylock(_mutex) != 0) {
     return;
   }
--- a/src/hotspot/os/solaris/os_perf_solaris.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/os/solaris/os_perf_solaris.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -302,9 +302,6 @@
   // Data structure(s) for saving CPU load (one per CPU)
   size_t array_entry_count = _counters.nProcs;
   _counters.jvmTicks = NEW_C_HEAP_ARRAY(CPUPerfTicks, array_entry_count, mtInternal);
-  if (NULL == _counters.jvmTicks) {
-    return false;
-  }
   memset(_counters.jvmTicks, 0, array_entry_count * sizeof(*_counters.jvmTicks));
 
   // Get kstat cpu_stat counters for every CPU
@@ -432,7 +429,7 @@
 
 bool CPUPerformanceInterface::initialize() {
   _impl = new CPUPerformanceInterface::CPUPerformance();
-  return _impl != NULL && _impl->initialize();
+  return _impl->initialize();
 }
 
 CPUPerformanceInterface::~CPUPerformanceInterface(void) {
@@ -574,10 +571,8 @@
     if (path_substring != NULL) {
       int len = path_substring - psinfo_data.pr_psargs;
       exe_path = NEW_C_HEAP_ARRAY(char, len+1, mtInternal);
-      if (exe_path != NULL) {
-        jio_snprintf(exe_path, len, "%s", psinfo_data.pr_psargs);
-        exe_path[len] = '\0';
-      }
+      jio_snprintf(exe_path, len, "%s", psinfo_data.pr_psargs);
+      exe_path[len] = '\0';
     }
   }
 
@@ -642,7 +637,7 @@
 
 bool SystemProcessInterface::SystemProcesses::initialize() {
   _iterator = new SystemProcessInterface::SystemProcesses::ProcessIterator();
-  return _iterator != NULL && _iterator->initialize();
+  return _iterator->initialize();
 }
 
 SystemProcessInterface::SystemProcesses::~SystemProcesses() {
@@ -689,7 +684,7 @@
 
 bool SystemProcessInterface::initialize() {
   _impl = new SystemProcessInterface::SystemProcesses();
-  return _impl != NULL && _impl->initialize();
+  return _impl->initialize();
 
 }
 
@@ -705,9 +700,6 @@
 
 bool CPUInformationInterface::initialize() {
   _cpu_info = new CPUInformation();
-  if (_cpu_info == NULL) {
-    return false;
-  }
   _cpu_info->set_number_of_hardware_threads(VM_Version_Ext::number_of_threads());
   _cpu_info->set_number_of_cores(VM_Version_Ext::number_of_cores());
   _cpu_info->set_number_of_sockets(VM_Version_Ext::number_of_sockets());
@@ -820,7 +812,7 @@
 
 bool NetworkPerformanceInterface::initialize() {
   _impl = new NetworkPerformanceInterface::NetworkPerformance();
-  return _impl != NULL && _impl->initialize();
+  return _impl->initialize();
 }
 
 int NetworkPerformanceInterface::network_utilization(NetworkInterface** network_interfaces) const {
--- a/src/hotspot/os/solaris/os_solaris.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/os/solaris/os_solaris.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -5063,7 +5063,7 @@
   Thread* thread = Thread::current();
   assert(thread->is_Java_thread(), "Must be JavaThread");
   JavaThread *jt = (JavaThread *)thread;
-  if (Thread::is_interrupted(thread, false)) {
+  if (jt->is_interrupted(false)) {
     return;
   }
 
@@ -5088,7 +5088,7 @@
 
   // Don't wait if cannot get lock since interference arises from
   // unblocking.  Also. check interrupt before trying wait
-  if (Thread::is_interrupted(thread, false) ||
+  if (jt->is_interrupted(false) ||
       os::Solaris::mutex_trylock(_mutex) != 0) {
     return;
   }
--- a/src/hotspot/os/windows/osThread_windows.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/os/windows/osThread_windows.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,12 +23,9 @@
  */
 
 // no precompiled headers
-#include "runtime/handles.inline.hpp"
-#include "runtime/mutexLocker.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/os.hpp"
 #include "runtime/osThread.hpp"
-#include "runtime/safepoint.hpp"
-#include "runtime/vmThread.hpp"
 
 void OSThread::pd_initialize() {
   set_thread_handle(NULL);
@@ -36,8 +33,34 @@
   set_interrupt_event(NULL);
 }
 
-// TODO: this is not well encapsulated; creation and deletion of the
-// interrupt_event are done in os_win32.cpp, create_thread and
-// free_thread. Should follow pattern of Linux/Solaris code here.
 void OSThread::pd_destroy() {
+  if (_interrupt_event != NULL) {
+    CloseHandle(_interrupt_event);
+  }
 }
+
+// We need to specialize these to interact with the _interrupt_event.
+
+volatile bool OSThread::interrupted() {
+  return _interrupted != 0 &&
+    (WaitForSingleObject(_interrupt_event, 0) == WAIT_OBJECT_0);
+}
+
+void OSThread::set_interrupted(bool z) {
+  if (z) {
+    _interrupted = 1;
+    // More than one thread can get here with the same value of osthread,
+    // resulting in multiple notifications.  We do, however, want the store
+    // to interrupted() to be visible to other threads before we post
+    // the interrupt event.
+    OrderAccess::release();
+    SetEvent(_interrupt_event);
+  }
+  else {
+    // We should only ever clear the interrupt if we are in fact interrupted,
+    // and this can only be done by the current thread on itself.
+    assert(_interrupted == 1, "invariant for clearing interrupt state");
+    _interrupted = 0;
+    ResetEvent(_interrupt_event);
+  }
+}
--- a/src/hotspot/os/windows/osThread_windows.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/os/windows/osThread_windows.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -32,7 +32,8 @@
  private:
   // Win32-specific thread information
   HANDLE _thread_handle;        // Win32 thread handle
-  HANDLE _interrupt_event;      // Event signalled on thread interrupt
+  HANDLE _interrupt_event;      // Event signalled on thread interrupt for use by
+                                // Process.waitFor().
   ThreadState _last_state;
 
  public:
@@ -42,6 +43,11 @@
   void set_thread_handle(HANDLE handle)            { _thread_handle = handle; }
   HANDLE interrupt_event() const                   { return _interrupt_event; }
   void set_interrupt_event(HANDLE interrupt_event) { _interrupt_event = interrupt_event; }
+  // These are specialized on Windows to interact with the _interrupt_event.
+  // Also note that Windows does not skip these calls if we are interrupted - see
+  // LibraryCallKit::inline_native_isInterrupted
+  volatile bool interrupted();
+  void set_interrupted(bool z);
 
 #ifndef PRODUCT
   // Used for debugging, return a unique integer for each thread.
@@ -54,7 +60,6 @@
     return false;
   }
 #endif // ASSERT
-  bool is_try_mutex_enter()                        { return false; }
 
   // This is a temporary fix for the thread states during
   // suspend/resume until we throw away OSThread completely.
--- a/src/hotspot/os/windows/os_perf_windows.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/os/windows/os_perf_windows.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -194,34 +194,27 @@
   return open_query(&query->query);
 }
 
-static int allocate_counters(MultiCounterQueryP query, size_t nofCounters) {
+static void allocate_counters(MultiCounterQueryP query, size_t nofCounters) {
   assert(query != NULL, "invariant");
   assert(!query->initialized, "invariant");
   assert(0 == query->noOfCounters, "invariant");
   assert(query->counters == NULL, "invariant");
   query->counters = NEW_C_HEAP_ARRAY(HCOUNTER, nofCounters, mtInternal);
-  if (query->counters == NULL) {
-    return OS_ERR;
-  }
   memset(query->counters, 0, nofCounters * sizeof(HCOUNTER));
   query->noOfCounters = (int)nofCounters;
-  return OS_OK;
 }
 
-static int allocate_counters(MultiCounterQuerySetP query_set, size_t nofCounters) {
+static void allocate_counters(MultiCounterQuerySetP query_set, size_t nofCounters) {
   assert(query_set != NULL, "invariant");
   assert(!query_set->initialized, "invariant");
   for (int i = 0; i < query_set->size; ++i) {
-    if (allocate_counters(&query_set->queries[i], nofCounters) != OS_OK) {
-      return OS_ERR;
-    }
+    allocate_counters(&query_set->queries[i], nofCounters);
   }
-  return OS_OK;
 }
 
-static int allocate_counters(ProcessQueryP process_query, size_t nofCounters) {
+static void allocate_counters(ProcessQueryP process_query, size_t nofCounters) {
   assert(process_query != NULL, "invariant");
-  return allocate_counters(&process_query->set, nofCounters);
+  allocate_counters(&process_query->set, nofCounters);
 }
 
 static void deallocate_counters(MultiCounterQueryP query) {
@@ -600,7 +593,7 @@
 static const char* copy_string_to_c_heap(const char* string) {
   assert(string != NULL, "invariant");
   const size_t len = strlen(string);
-  char* const cheap_allocated_string = NEW_C_HEAP_ARRAY(char, len + 1, mtInternal);
+  char* const cheap_allocated_string = NEW_C_HEAP_ARRAY_RETURN_NULL(char, len + 1, mtInternal);
   if (NULL == cheap_allocated_string) {
     return NULL;
   }
@@ -849,9 +842,7 @@
   const int logical_cpu_count = number_of_logical_cpus();
   assert(logical_cpu_count >= os::processor_count(), "invariant");
   // we also add another counter for instance "_Total"
-  if (allocate_counters(cpu_query, logical_cpu_count + 1) != OS_OK) {
-    return OS_ERR;
-  }
+  allocate_counters(cpu_query, logical_cpu_count + 1);
   assert(cpu_query->noOfCounters == logical_cpu_count + 1, "invariant");
   return initialize_cpu_query_counters(cpu_query, pdh_counter_idx);
 }
@@ -1017,9 +1008,7 @@
   if (_process_cpu_load == NULL) {
     return true;
   }
-  if (allocate_counters(_process_cpu_load, 2) != OS_OK) {
-    return true;
-  }
+  allocate_counters(_process_cpu_load, 2);
   if (initialize_process_counter(_process_cpu_load, 0, PDH_PROCESSOR_TIME_IDX) != OS_OK) {
     return true;
   }
@@ -1057,7 +1046,7 @@
 
 bool CPUPerformanceInterface::initialize() {
   _impl = new CPUPerformanceInterface::CPUPerformance();
-  return _impl != NULL && _impl->initialize();
+  return _impl->initialize();
 }
 
 CPUPerformanceInterface::~CPUPerformanceInterface() {
@@ -1263,7 +1252,7 @@
 
 bool SystemProcessInterface::SystemProcesses::initialize() {
   _iterator = new SystemProcessInterface::SystemProcesses::ProcessIterator();
-  return _iterator != NULL && _iterator->initialize();
+  return _iterator->initialize();
 }
 
 SystemProcessInterface::SystemProcesses::~SystemProcesses() {
@@ -1318,7 +1307,7 @@
 
 bool SystemProcessInterface::initialize() {
   _impl = new SystemProcessInterface::SystemProcesses();
-  return _impl != NULL && _impl->initialize();
+  return _impl->initialize();
 }
 
 SystemProcessInterface::~SystemProcessInterface() {
@@ -1333,9 +1322,6 @@
 
 bool CPUInformationInterface::initialize() {
   _cpu_info = new CPUInformation();
-  if (NULL == _cpu_info) {
-    return false;
-  }
   _cpu_info->set_number_of_hardware_threads(VM_Version_Ext::number_of_threads());
   _cpu_info->set_number_of_cores(VM_Version_Ext::number_of_cores());
   _cpu_info->set_number_of_sockets(VM_Version_Ext::number_of_sockets());
@@ -1431,7 +1417,7 @@
 
 bool NetworkPerformanceInterface::initialize() {
   _impl = new NetworkPerformanceInterface::NetworkPerformance();
-  return _impl != NULL && _impl->initialize();
+  return _impl->initialize();
 }
 
 int NetworkPerformanceInterface::network_utilization(NetworkInterface** network_interfaces) const {
--- a/src/hotspot/os/windows/os_windows.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/os/windows/os_windows.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -224,18 +224,12 @@
     }
 
     home_path = NEW_C_HEAP_ARRAY(char, strlen(home_dir) + 1, mtInternal);
-    if (home_path == NULL) {
-      return;
-    }
     strcpy(home_path, home_dir);
     Arguments::set_java_home(home_path);
     FREE_C_HEAP_ARRAY(char, home_path);
 
     dll_path = NEW_C_HEAP_ARRAY(char, strlen(home_dir) + strlen(bin) + 1,
                                 mtInternal);
-    if (dll_path == NULL) {
-      return;
-    }
     strcpy(dll_path, home_dir);
     strcat(dll_path, bin);
     Arguments::set_dll_dir(dll_path);
@@ -612,7 +606,9 @@
     return false;
   }
   osthread->set_interrupt_event(interrupt_event);
-  osthread->set_interrupted(false);
+  // We don't call set_interrupted(false) as it will trip the assert in there
+  // as we are not operating on the current thread. We don't need to call it
+  // because the initial state is already correct.
 
   thread->set_osthread(osthread);
 
@@ -684,7 +680,6 @@
 
   if (thread_handle == NULL) {
     // Need to clean up stuff we've allocated so far
-    CloseHandle(osthread->interrupt_event());
     thread->set_osthread(NULL);
     delete osthread;
     return false;
@@ -714,7 +709,6 @@
          "os::free_thread but not current thread");
 
   CloseHandle(osthread->thread_handle());
-  CloseHandle(osthread->interrupt_event());
   delete osthread;
 }
 
@@ -3485,7 +3479,6 @@
 }
 
 
-
 // Short sleep, direct OS call.
 //
 // ms = 0, means allow others (if any) to run.
@@ -3593,49 +3586,6 @@
   return OS_OK;
 }
 
-void os::interrupt(Thread* thread) {
-  debug_only(Thread::check_for_dangling_thread_pointer(thread);)
-  assert(thread->is_Java_thread(), "invariant");
-  JavaThread* jt = (JavaThread*) thread;
-  OSThread* osthread = thread->osthread();
-  osthread->set_interrupted(true);
-  // More than one thread can get here with the same value of osthread,
-  // resulting in multiple notifications.  We do, however, want the store
-  // to interrupted() to be visible to other threads before we post
-  // the interrupt event.
-  OrderAccess::release();
-  SetEvent(osthread->interrupt_event());
-  // For JSR166:  unpark after setting status
-  jt->parker()->unpark();
-
-  ParkEvent * ev = thread->_ParkEvent;
-  if (ev != NULL) ev->unpark();
-
-  ev = jt->_SleepEvent;
-  if (ev != NULL) ev->unpark();
-}
-
-
-bool os::is_interrupted(Thread* thread, bool clear_interrupted) {
-  debug_only(Thread::check_for_dangling_thread_pointer(thread);)
-
-  OSThread* osthread = thread->osthread();
-  // There is no synchronization between the setting of the interrupt
-  // and it being cleared here. It is critical - see 6535709 - that
-  // we only clear the interrupt state, and reset the interrupt event,
-  // if we are going to report that we were indeed interrupted - else
-  // an interrupt can be "lost", leading to spurious wakeups or lost wakeups
-  // depending on the timing. By checking thread interrupt event to see
-  // if the thread gets real interrupt thus prevent spurious wakeup.
-  bool interrupted = osthread->interrupted() && (WaitForSingleObject(osthread->interrupt_event(), 0) == WAIT_OBJECT_0);
-  if (interrupted && clear_interrupted) {
-    osthread->set_interrupted(false);
-    ResetEvent(osthread->interrupt_event());
-  } // Otherwise leave the interrupted state alone
-
-  return interrupted;
-}
-
 // GetCurrentThreadId() returns DWORD
 intx os::current_thread_id()  { return GetCurrentThreadId(); }
 
@@ -5346,7 +5296,7 @@
   JavaThread* thread = JavaThread::current();
 
   // Don't wait if interrupted or already triggered
-  if (Thread::is_interrupted(thread, false) ||
+  if (thread->is_interrupted(false) ||
       WaitForSingleObject(_ParkEvent, 0) == WAIT_OBJECT_0) {
     ResetEvent(_ParkEvent);
     return;
--- a/src/hotspot/share/aot/aotCodeHeap.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/aot/aotCodeHeap.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -38,6 +38,7 @@
 #include "memory/universe.hpp"
 #include "oops/compressedOops.hpp"
 #include "oops/method.inline.hpp"
+#include "runtime/deoptimization.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/os.hpp"
 #include "runtime/safepointVerifiers.hpp"
@@ -351,7 +352,10 @@
 #ifdef TIERED
     mh->set_aot_code(aot);
 #endif
-    Method::set_code(mh, aot);
+    {
+      MutexLocker pl(CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
+      Method::set_code(mh, aot);
+    }
     if (PrintAOT || (PrintCompilation && PrintAOT)) {
       PauseNoSafepointVerifier pnsv(&nsv); // aot code is registered already
       aot->print_on(tty, NULL);
@@ -397,9 +401,6 @@
     int len = Bytes::get_Java_u2((address)stub_name);
     stub_name += 2;
     char* full_name = NEW_C_HEAP_ARRAY(char, len+5, mtCode);
-    if (full_name == NULL) { // No memory?
-      break;
-    }
     memcpy(full_name, "AOT ", 4);
     memcpy(full_name+4, stub_name, len);
     full_name[len+4] = 0;
@@ -731,8 +732,7 @@
     }
   }
   if (marked > 0) {
-    VM_Deoptimize op;
-    VMThread::execute(&op);
+    Deoptimization::deoptimize_all_marked();
   }
 }
 
--- a/src/hotspot/share/aot/aotCompiledMethod.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/aot/aotCompiledMethod.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -165,7 +165,7 @@
 
   {
     // Enter critical section.  Does not block for safepoint.
-    MutexLocker pl(Patching_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker pl(CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
 
     if (*_state_adr == new_state) {
       // another thread already performed this transition so nothing
@@ -188,12 +188,10 @@
 #endif
 
     // Remove AOTCompiledMethod from method.
-    if (method() != NULL && (method()->code() == this ||
-                             method()->from_compiled_entry() == verified_entry_point())) {
-      HandleMark hm;
-      method()->clear_code(false /* already owns Patching_lock */);
+    if (method() != NULL) {
+      method()->unlink_code(this);
     }
-  } // leave critical region under Patching_lock
+  } // leave critical region under CompiledMethod_lock
 
 
   if (TraceCreateZombies) {
@@ -208,7 +206,6 @@
 #ifdef TIERED
 bool AOTCompiledMethod::make_entrant() {
   assert(!method()->is_old(), "reviving evolved method!");
-  assert(*_state_adr != not_entrant, "%s", method()->has_aot_code() ? "has_aot_code() not cleared" : "caller didn't check has_aot_code()");
 
   // Make sure the method is not flushed in case of a safepoint in code below.
   methodHandle the_method(method());
@@ -216,9 +213,9 @@
 
   {
     // Enter critical section.  Does not block for safepoint.
-    MutexLocker pl(Patching_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker pl(CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
 
-    if (*_state_adr == in_use) {
+    if (*_state_adr == in_use || *_state_adr == not_entrant) {
       // another thread already performed this transition so nothing
       // to do, but return false to indicate this.
       return false;
@@ -230,7 +227,7 @@
 
     // Log the transition once
     log_state_change();
-  } // leave critical region under Patching_lock
+  } // leave critical region under CompiledMethod_lock
 
 
   if (TraceCreateZombies) {
--- a/src/hotspot/share/aot/aotLoader.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/aot/aotLoader.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -151,17 +151,15 @@
     if (AOTLibrary != NULL) {
       const int len = (int)strlen(AOTLibrary);
       char* cp  = NEW_C_HEAP_ARRAY(char, len+1, mtCode);
-      if (cp != NULL) { // No memory?
-        memcpy(cp, AOTLibrary, len);
-        cp[len] = '\0';
-        char* end = cp + len;
-        while (cp < end) {
-          const char* name = cp;
-          while ((*cp) != '\0' && (*cp) != '\n' && (*cp) != ',' && (*cp) != pathSep) cp++;
-          cp[0] = '\0';  // Terminate name
-          cp++;
-          load_library(name, true);
-        }
+      memcpy(cp, AOTLibrary, len);
+      cp[len] = '\0';
+      char* end = cp + len;
+      while (cp < end) {
+        const char* name = cp;
+        while ((*cp) != '\0' && (*cp) != '\n' && (*cp) != ',' && (*cp) != pathSep) cp++;
+        cp[0] = '\0';  // Terminate name
+        cp++;
+        load_library(name, true);
       }
     }
 
--- a/src/hotspot/share/asm/codeBuffer.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/asm/codeBuffer.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1104,7 +1104,7 @@
 // Convenience for add_comment.
 CodeString* CodeStrings::find_last(intptr_t offset) const {
   CodeString* a = _strings_last;
-  while (a != NULL && !a->is_comment() && a->offset() > offset) {
+  while (a != NULL && !(a->is_comment() && a->offset() == offset)) {
     a = a->_prev;
   }
   return a;
--- a/src/hotspot/share/c1/c1_GraphBuilder.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/c1/c1_GraphBuilder.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -3168,7 +3168,7 @@
     ciType* type = sig->type_at(i);
     BasicType basic_type = type->basic_type();
     // don't allow T_ARRAY to propagate into locals types
-    if (basic_type == T_ARRAY) basic_type = T_OBJECT;
+    if (is_reference_type(basic_type)) basic_type = T_OBJECT;
     ValueType* vt = as_ValueType(basic_type);
     state->store_local(idx, new Local(type, vt, idx, false));
     idx += type->size();
--- a/src/hotspot/share/c1/c1_LIRGenerator.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/c1/c1_LIRGenerator.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1546,7 +1546,7 @@
   assert(x->is_pinned(),"");
   bool needs_range_check = x->compute_needs_range_check();
   bool use_length = x->length() != NULL;
-  bool obj_store = x->elt_type() == T_ARRAY || x->elt_type() == T_OBJECT;
+  bool obj_store = is_reference_type(x->elt_type());
   bool needs_store_check = obj_store && (x->value()->as_Constant() == NULL ||
                                          !get_jobject_constant(x->value())->is_null_object() ||
                                          x->should_profile());
@@ -2163,7 +2163,7 @@
   if (type == T_BOOLEAN) {
     decorators |= C1_MASK_BOOLEAN;
   }
-  if (type == T_ARRAY || type == T_OBJECT) {
+  if (is_reference_type(type)) {
     decorators |= ON_UNKNOWN_OOP_REF;
   }
 
@@ -2190,7 +2190,7 @@
   set_no_result(x);
 
   DecoratorSet decorators = IN_HEAP | C1_UNSAFE_ACCESS;
-  if (type == T_ARRAY || type == T_OBJECT) {
+  if (is_reference_type(type)) {
     decorators |= ON_UNKNOWN_OOP_REF;
   }
   if (x->is_volatile()) {
@@ -2207,7 +2207,7 @@
 
   DecoratorSet decorators = IN_HEAP | C1_UNSAFE_ACCESS | MO_SEQ_CST;
 
-  if (type == T_ARRAY || type == T_OBJECT) {
+  if (is_reference_type(type)) {
     decorators |= ON_UNKNOWN_OOP_REF;
   }
 
@@ -2600,7 +2600,7 @@
         LIR_Opr src = args->at(i);
         assert(!src->is_illegal(), "check");
         BasicType t = src->type();
-        if (t == T_OBJECT || t == T_ARRAY) {
+        if (is_reference_type(t)) {
           intptr_t profiled_k = parameters->type(j);
           Local* local = x->state()->local_at(java_index)->as_Local();
           ciKlass* exact = profile_type(md, md->byte_offset_of_slot(parameters_type_data, ParametersTypeData::type_offset(0)),
--- a/src/hotspot/share/c1/c1_Optimizer.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/c1/c1_Optimizer.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -868,7 +868,7 @@
       if (field->is_constant()) {
         ciConstant field_val = field->constant_value();
         BasicType field_type = field_val.basic_type();
-        if (field_type == T_OBJECT || field_type == T_ARRAY) {
+        if (is_reference_type(field_type)) {
           ciObject* obj_val = field_val.as_object();
           if (!obj_val->is_null_object()) {
             if (PrintNullCheckElimination) {
--- a/src/hotspot/share/ci/bcEscapeAnalyzer.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/ci/bcEscapeAnalyzer.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -859,7 +859,7 @@
           if (s.cur_bc() != Bytecodes::_getstatic) {
             set_method_escape(state.apop());
           }
-          if (field_type == T_OBJECT || field_type == T_ARRAY) {
+          if (is_reference_type(field_type)) {
             state.apush(unknown_obj);
           } else if (type2size[field_type] == 1) {
             state.spush();
@@ -873,7 +873,7 @@
         { bool will_link;
           ciField* field = s.get_field(will_link);
           BasicType field_type = field->type()->basic_type();
-          if (field_type == T_OBJECT || field_type == T_ARRAY) {
+          if (is_reference_type(field_type)) {
             set_global_escape(state.apop());
           } else if (type2size[field_type] == 1) {
             state.spop();
--- a/src/hotspot/share/ci/ciArray.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/ci/ciArray.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,7 +37,7 @@
 // This class represents an arrayOop in the HotSpot virtual
 // machine.
 static BasicType fixup_element_type(BasicType bt) {
-  if (bt == T_ARRAY)    return T_OBJECT;
+  if (is_reference_type(bt))  return T_OBJECT;
   if (bt == T_BOOLEAN)  return T_BYTE;
   return bt;
 }
--- a/src/hotspot/share/ci/ciConstant.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/ci/ciConstant.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -56,12 +56,12 @@
   case T_DOUBLE:
     tty->print("%lf", _value._double);
     break;
-  case T_OBJECT:
-  case T_ARRAY:
-    _value._object->print();
-    break;
   default:
-    tty->print("ILLEGAL");
+    if (is_reference_type(basic_type())) {
+      _value._object->print();
+    } else {
+      tty->print("ILLEGAL");
+    }
     break;
   }
   tty->print(">");
--- a/src/hotspot/share/ci/ciConstant.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/ci/ciConstant.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -106,7 +106,7 @@
     return _value._double;
   }
   ciObject* as_object() const {
-    assert(basic_type() == T_OBJECT || basic_type() == T_ARRAY, "wrong type");
+    assert(is_reference_type(basic_type()), "wrong type");
     return _value._object;
   }
 
--- a/src/hotspot/share/ci/ciEnv.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/ci/ciEnv.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -539,7 +539,7 @@
     // Calculate accessibility the hard way.
     if (!k->is_loaded()) {
       is_accessible = false;
-    } else if (!oopDesc::equals(k->loader(), accessor->loader()) &&
+    } else if (k->loader() != accessor->loader() &&
                get_klass_by_name_impl(accessor, cpool, k->name(), true) == NULL) {
       // Loaded only remotely.  Not linked yet.
       is_accessible = false;
@@ -590,7 +590,7 @@
     index = cpool->object_to_cp_index(cache_index);
     oop obj = cpool->resolved_references()->obj_at(cache_index);
     if (obj != NULL) {
-      if (oopDesc::equals(obj, Universe::the_null_sentinel())) {
+      if (obj == Universe::the_null_sentinel()) {
         return ciConstant(T_OBJECT, get_object(NULL));
       }
       BasicType bt = T_OBJECT;
@@ -1072,7 +1072,10 @@
                     task()->comp_level(), method_name);
         }
         // Allow the code to be executed
-        method->set_code(method, nm);
+        MutexLocker ml(CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
+        if (nm->make_in_use()) {
+          method->set_code(method, nm);
+        }
       } else {
         LogTarget(Info, nmethod, install) lt;
         if (lt.is_enabled()) {
@@ -1081,9 +1084,11 @@
           lt.print("Installing osr method (%d) %s @ %d",
                     task()->comp_level(), method_name, entry_bci);
         }
-        method->method_holder()->add_osr_nmethod(nm);
+        MutexLocker ml(CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
+        if (nm->make_in_use()) {
+          method->method_holder()->add_osr_nmethod(nm);
+        }
       }
-      nm->make_in_use();
     }
   }  // safepoints are allowed again
 
--- a/src/hotspot/share/ci/ciField.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/ci/ciField.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -90,7 +90,7 @@
 
   // If the field is a pointer type, get the klass of the
   // field.
-  if (field_type == T_OBJECT || field_type == T_ARRAY) {
+  if (is_reference_type(field_type)) {
     bool ignore;
     // This is not really a class reference; the index always refers to the
     // field's type signature, as a symbol.  Linkage checks do not apply.
@@ -199,7 +199,7 @@
 
   // If the field is a pointer type, get the klass of the
   // field.
-  if (field_type == T_OBJECT || field_type == T_ARRAY) {
+  if (is_reference_type(field_type)) {
     _type = NULL;  // must call compute_type on first access
   } else {
     _type = ciType::make(field_type);
--- a/src/hotspot/share/ci/ciMethod.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/ci/ciMethod.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1454,8 +1454,8 @@
 // ------------------------------------------------------------------
 
 static BasicType erase_to_word_type(BasicType bt) {
-  if (is_subword_type(bt)) return T_INT;
-  if (bt == T_ARRAY)       return T_OBJECT;
+  if (is_subword_type(bt))   return T_INT;
+  if (is_reference_type(bt)) return T_OBJECT;
   return bt;
 }
 
--- a/src/hotspot/share/ci/ciObjectFactory.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/ci/ciObjectFactory.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -149,7 +149,8 @@
 
   for (int i = T_BOOLEAN; i <= T_CONFLICT; i++) {
     BasicType t = (BasicType)i;
-    if (type2name(t) != NULL && t != T_OBJECT && t != T_ARRAY && t != T_NARROWOOP && t != T_NARROWKLASS) {
+    if (type2name(t) != NULL && !is_reference_type(t) &&
+        t != T_NARROWOOP && t != T_NARROWKLASS) {
       ciType::_basic_types[t] = new (_arena) ciType(t);
       init_ident_of(ciType::_basic_types[t]);
     }
@@ -250,7 +251,7 @@
   // into the cache.
   Handle keyHandle(Thread::current(), key);
   ciObject* new_object = create_new_object(keyHandle());
-  assert(oopDesc::equals(keyHandle(), new_object->get_oop()), "must be properly recorded");
+  assert(keyHandle() == new_object->get_oop(), "must be properly recorded");
   init_ident_of(new_object);
   assert(Universe::heap()->is_in(new_object->get_oop()), "must be");
 
@@ -469,8 +470,8 @@
   for (int i=0; i<_unloaded_klasses->length(); i++) {
     ciKlass* entry = _unloaded_klasses->at(i);
     if (entry->name()->equals(name) &&
-        oopDesc::equals(entry->loader(), loader) &&
-        oopDesc::equals(entry->protection_domain(), domain)) {
+        entry->loader() == loader &&
+        entry->protection_domain() == domain) {
       // We've found a match.
       return entry;
     }
--- a/src/hotspot/share/ci/ciObjectFactory.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/ci/ciObjectFactory.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -74,7 +74,7 @@
   ciMetadata* create_new_metadata(Metadata* o);
 
   static bool is_equal(NonPermObject* p, oop key) {
-    return oopDesc::equals(p->object()->get_oop(), key);
+    return p->object()->get_oop() == key;
   }
 
   NonPermObject* &find_non_perm(oop key);
--- a/src/hotspot/share/ci/ciType.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/ci/ciType.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +35,7 @@
 
 // ciType
 //
-// This class represents either a class (T_OBJECT), array (T_ARRAY),
-// or one of the primitive types such as T_INT.
+// This class represents a Java reference or primitive type.
 
 // ------------------------------------------------------------------
 // ciType::ciType
--- a/src/hotspot/share/ci/ciType.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/ci/ciType.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -29,8 +29,8 @@
 
 // ciType
 //
-// This class represents either a class (T_OBJECT), array (T_ARRAY),
-// or one of the primitive types such as T_INT.
+// This class represents a Java reference or primitive type.
+
 class ciType : public ciMetadata {
   CI_PACKAGE_ACCESS
   friend class ciKlass;
@@ -67,7 +67,7 @@
   ciKlass*  box_klass();
 
   // Returns true if this is not a klass or array (i.e., not a reference type).
-  bool is_primitive_type() const            { return basic_type() != T_OBJECT && basic_type() != T_ARRAY; }
+  bool is_primitive_type() const            { return !is_reference_type(basic_type()); }
   int size() const                          { return type2size[basic_type()]; }
   bool is_void() const                      { return basic_type() == T_VOID; }
   bool is_one_word() const                  { return size() == 1; }
--- a/src/hotspot/share/ci/ciTypeFlow.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/ci/ciTypeFlow.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -729,7 +729,7 @@
     outer()->record_failure("ldc did not link");
     return;
   }
-  if (basic_type == T_OBJECT || basic_type == T_ARRAY) {
+  if (is_reference_type(basic_type)) {
     ciObject* obj = con.as_object();
     if (obj->is_null_object()) {
       push_null();
--- a/src/hotspot/share/classfile/bytecodeAssembler.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/classfile/bytecodeAssembler.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -187,9 +187,11 @@
     case T_FLOAT:   fload(index); break;
     case T_DOUBLE:  dload(index); break;
     case T_LONG:    lload(index); break;
-    case T_OBJECT:
-    case T_ARRAY:   aload(index); break;
     default:
+      if (is_reference_type(bt)) {
+                    aload(index);
+                    break;
+      }
       ShouldNotReachHere();
   }
 }
@@ -254,10 +256,12 @@
     case T_FLOAT:   freturn(); break;
     case T_DOUBLE:  dreturn(); break;
     case T_LONG:    lreturn(); break;
-    case T_OBJECT:
-    case T_ARRAY:   areturn(); break;
     case T_VOID:    _return(); break;
     default:
+      if (is_reference_type(bt)) {
+                    areturn();
+                    break;
+      }
       ShouldNotReachHere();
   }
 }
--- a/src/hotspot/share/classfile/classFileParser.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/classfile/classFileParser.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -3552,16 +3552,16 @@
       cfs->skip_u1(attribute_length, CHECK);
     }
   }
-  _annotations = assemble_annotations(runtime_visible_annotations,
-                                      runtime_visible_annotations_length,
-                                      runtime_invisible_annotations,
-                                      runtime_invisible_annotations_length,
-                                      CHECK);
-  _type_annotations = assemble_annotations(runtime_visible_type_annotations,
-                                           runtime_visible_type_annotations_length,
-                                           runtime_invisible_type_annotations,
-                                           runtime_invisible_type_annotations_length,
-                                           CHECK);
+  _class_annotations = assemble_annotations(runtime_visible_annotations,
+                                            runtime_visible_annotations_length,
+                                            runtime_invisible_annotations,
+                                            runtime_invisible_annotations_length,
+                                            CHECK);
+  _class_type_annotations = assemble_annotations(runtime_visible_type_annotations,
+                                                 runtime_visible_type_annotations_length,
+                                                 runtime_invisible_type_annotations,
+                                                 runtime_invisible_type_annotations_length,
+                                                 CHECK);
 
   if (parsed_innerclasses_attribute || parsed_enclosingmethod_attribute) {
     const u2 num_of_classes = parse_classfile_inner_classes_attribute(
@@ -3615,8 +3615,8 @@
 // Create the Annotations object that will
 // hold the annotations array for the Klass.
 void ClassFileParser::create_combined_annotations(TRAPS) {
-    if (_annotations == NULL &&
-        _type_annotations == NULL &&
+    if (_class_annotations == NULL &&
+        _class_type_annotations == NULL &&
         _fields_annotations == NULL &&
         _fields_type_annotations == NULL) {
       // Don't create the Annotations object unnecessarily.
@@ -3624,8 +3624,8 @@
     }
 
     Annotations* const annotations = Annotations::allocate(_loader_data, CHECK);
-    annotations->set_class_annotations(_annotations);
-    annotations->set_class_type_annotations(_type_annotations);
+    annotations->set_class_annotations(_class_annotations);
+    annotations->set_class_type_annotations(_class_type_annotations);
     annotations->set_fields_annotations(_fields_annotations);
     annotations->set_fields_type_annotations(_fields_type_annotations);
 
@@ -3635,8 +3635,8 @@
 
     // The annotations arrays below has been transfered the
     // _combined_annotations so these fields can now be cleared.
-    _annotations             = NULL;
-    _type_annotations        = NULL;
+    _class_annotations       = NULL;
+    _class_type_annotations  = NULL;
     _fields_annotations      = NULL;
     _fields_type_annotations = NULL;
 }
@@ -5790,8 +5790,8 @@
   _local_interfaces(NULL),
   _transitive_interfaces(NULL),
   _combined_annotations(NULL),
-  _annotations(NULL),
-  _type_annotations(NULL),
+  _class_annotations(NULL),
+  _class_type_annotations(NULL),
   _fields_annotations(NULL),
   _fields_type_annotations(NULL),
   _klass(NULL),
@@ -5895,7 +5895,7 @@
   _nest_members = NULL;
   _local_interfaces = NULL;
   _combined_annotations = NULL;
-  _annotations = _type_annotations = NULL;
+  _class_annotations = _class_type_annotations = NULL;
   _fields_annotations = _fields_type_annotations = NULL;
 }
 
@@ -5937,15 +5937,15 @@
 
     // If the _combined_annotations pointer is non-NULL,
     // then the other annotations fields should have been cleared.
-    assert(_annotations             == NULL, "Should have been cleared");
-    assert(_type_annotations        == NULL, "Should have been cleared");
+    assert(_class_annotations       == NULL, "Should have been cleared");
+    assert(_class_type_annotations  == NULL, "Should have been cleared");
     assert(_fields_annotations      == NULL, "Should have been cleared");
     assert(_fields_type_annotations == NULL, "Should have been cleared");
   } else {
     // If the annotations arrays were not installed into the Annotations object,
     // then they have to be deallocated explicitly.
-    MetadataFactory::free_array<u1>(_loader_data, _annotations);
-    MetadataFactory::free_array<u1>(_loader_data, _type_annotations);
+    MetadataFactory::free_array<u1>(_loader_data, _class_annotations);
+    MetadataFactory::free_array<u1>(_loader_data, _class_type_annotations);
     Annotations::free_contents(_loader_data, _fields_annotations);
     Annotations::free_contents(_loader_data, _fields_type_annotations);
   }
--- a/src/hotspot/share/classfile/classFileParser.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/classfile/classFileParser.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -101,8 +101,8 @@
   Array<InstanceKlass*>* _local_interfaces;
   Array<InstanceKlass*>* _transitive_interfaces;
   Annotations* _combined_annotations;
-  AnnotationArray* _annotations;
-  AnnotationArray* _type_annotations;
+  AnnotationArray* _class_annotations;
+  AnnotationArray* _class_type_annotations;
   Array<AnnotationArray*>* _fields_annotations;
   Array<AnnotationArray*>* _fields_type_annotations;
   InstanceKlass* _klass;  // InstanceKlass* once created.
--- a/src/hotspot/share/classfile/classLoaderData.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/classfile/classLoaderData.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -232,7 +232,7 @@
   VerifyContainsOopClosure(oop target) : _target(target), _found(false) {}
 
   void do_oop(oop* p) {
-    if (p != NULL && oopDesc::equals(NativeAccess<AS_NO_KEEPALIVE>::oop_load(p), _target)) {
+    if (p != NULL && NativeAccess<AS_NO_KEEPALIVE>::oop_load(p) == _target) {
       _found = true;
     }
   }
@@ -433,7 +433,7 @@
 
     // Just return if this dependency is to a class with the same or a parent
     // class_loader.
-    if (oopDesc::equals(from, to) || java_lang_ClassLoader::isAncestor(from, to)) {
+    if (from == to || java_lang_ClassLoader::isAncestor(from, to)) {
       return; // this class loader is in the parent list, no need to add it.
     }
   }
--- a/src/hotspot/share/classfile/classLoaderDataGraph.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/classfile/classLoaderDataGraph.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -285,17 +285,27 @@
   }
 }
 
-// Closure for locking and iterating through classes.
-LockedClassesDo::LockedClassesDo(classes_do_func_t f) : _function(f) {
-  ClassLoaderDataGraph_lock->lock();
+// Closure for locking and iterating through classes. Only lock outside of safepoint.
+LockedClassesDo::LockedClassesDo(classes_do_func_t f) : _function(f),
+  _do_lock(!SafepointSynchronize::is_at_safepoint()) {
+  if (_do_lock) {
+    ClassLoaderDataGraph_lock->lock();
+  }
 }
 
-LockedClassesDo::LockedClassesDo() : _function(NULL) {
+LockedClassesDo::LockedClassesDo() : _function(NULL),
+  _do_lock(!SafepointSynchronize::is_at_safepoint()) {
   // callers provide their own do_klass
-  ClassLoaderDataGraph_lock->lock();
+  if (_do_lock) {
+    ClassLoaderDataGraph_lock->lock();
+  }
 }
 
-LockedClassesDo::~LockedClassesDo() { ClassLoaderDataGraph_lock->unlock(); }
+LockedClassesDo::~LockedClassesDo() {
+  if (_do_lock) {
+    ClassLoaderDataGraph_lock->unlock();
+  }
+}
 
 
 // Iterating over the CLDG needs to be locked because
--- a/src/hotspot/share/classfile/classLoaderDataGraph.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/classfile/classLoaderDataGraph.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -156,6 +156,7 @@
 class LockedClassesDo : public KlassClosure {
   typedef void (*classes_do_func_t)(Klass*);
   classes_do_func_t _function;
+  bool _do_lock;
 public:
   LockedClassesDo();  // For callers who provide their own do_klass
   LockedClassesDo(classes_do_func_t function);
--- a/src/hotspot/share/classfile/classLoaderStats.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/classfile/classLoaderStats.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -98,7 +98,7 @@
 class ClassLoaderStatsClosure : public CLDClosure {
 protected:
   static bool oop_equals(oop const& s1, oop const& s2) {
-    return oopDesc::equals(s1, s2);
+    return s1 == s2;
   }
 
   static unsigned oop_hash(oop const& s1) {
--- a/src/hotspot/share/classfile/dictionary.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/classfile/dictionary.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -153,13 +153,13 @@
   // a Dictionary entry, which can be moved if the Dictionary is resized.
   MutexLocker ml(ProtectionDomainSet_lock, Mutex::_no_safepoint_check_flag);
 #ifdef ASSERT
-  if (oopDesc::equals(protection_domain, instance_klass()->protection_domain())) {
+  if (protection_domain == instance_klass()->protection_domain()) {
     // Ensure this doesn't show up in the pd_set (invariant)
     bool in_pd_set = false;
     for (ProtectionDomainEntry* current = pd_set();
                                 current != NULL;
                                 current = current->next()) {
-      if (oopDesc::equals(current->object_no_keepalive(), protection_domain)) {
+      if (current->object_no_keepalive() == protection_domain) {
         in_pd_set = true;
         break;
       }
@@ -171,7 +171,7 @@
   }
 #endif /* ASSERT */
 
-  if (oopDesc::equals(protection_domain, instance_klass()->protection_domain())) {
+  if (protection_domain == instance_klass()->protection_domain()) {
     // Succeeds trivially
     return true;
   }
@@ -179,7 +179,7 @@
   for (ProtectionDomainEntry* current = pd_set();
                               current != NULL;
                               current = current->next()) {
-    if (oopDesc::equals(current->object_no_keepalive(), protection_domain)) return true;
+    if (current->object_no_keepalive() == protection_domain) return true;
   }
   return false;
 }
--- a/src/hotspot/share/classfile/javaClasses.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/classfile/javaClasses.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -878,7 +878,7 @@
   } else {
     assert(Universe::is_module_initialized() ||
            (ModuleEntryTable::javabase_defined() &&
-            (oopDesc::equals(module(), ModuleEntryTable::javabase_moduleEntry()->module()))),
+            (module() == ModuleEntryTable::javabase_moduleEntry()->module())),
            "Incorrect java.lang.Module specification while creating mirror");
     set_module(mirror(), module());
   }
@@ -955,7 +955,7 @@
     }
 
     // set the classLoader field in the java_lang_Class instance
-    assert(oopDesc::equals(class_loader(), k->class_loader()), "should be same");
+    assert(class_loader() == k->class_loader(), "should be same");
     set_class_loader(mirror(), class_loader());
 
     // Setup indirection from klass->mirror
@@ -1510,9 +1510,9 @@
     // Note: create_basic_type_mirror above initializes ak to a non-null value.
     type = ArrayKlass::cast(ak)->element_type();
   } else {
-    assert(oopDesc::equals(java_class, Universe::void_mirror()), "only valid non-array primitive");
+    assert(java_class == Universe::void_mirror(), "only valid non-array primitive");
   }
-  assert(oopDesc::equals(Universe::java_mirror(type), java_class), "must be consistent");
+  assert(Universe::java_mirror(type) == java_class, "must be consistent");
   return type;
 }
 
@@ -3712,14 +3712,14 @@
 }
 
 bool java_lang_invoke_MethodType::equals(oop mt1, oop mt2) {
-  if (oopDesc::equals(mt1, mt2))
+  if (mt1 == mt2)
     return true;
-  if (!oopDesc::equals(rtype(mt1), rtype(mt2)))
+  if (rtype(mt1) != rtype(mt2))
     return false;
   if (ptype_count(mt1) != ptype_count(mt2))
     return false;
   for (int i = ptype_count(mt1) - 1; i >= 0; i--) {
-    if (!oopDesc::equals(ptype(mt1, i), ptype(mt2, i)))
+    if (ptype(mt1, i) != ptype(mt2, i))
       return false;
   }
   return true;
@@ -3933,7 +3933,7 @@
   // This loop taken verbatim from ClassLoader.java:
   do {
     acl = parent(acl);
-    if (oopDesc::equals(cl, acl)) {
+    if (cl == acl) {
       return true;
     }
     assert(++loop_count > 0, "loop_count overflow");
@@ -3963,7 +3963,7 @@
 
   oop cl = SystemDictionary::java_system_loader();
   while(cl != NULL) {
-    if (oopDesc::equals(cl, loader)) return true;
+    if (cl == loader) return true;
     cl = parent(cl);
   }
   return false;
--- a/src/hotspot/share/classfile/javaClasses.inline.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/classfile/javaClasses.inline.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -52,7 +52,7 @@
 
 // Accessors
 bool java_lang_String::value_equals(typeArrayOop str_value1, typeArrayOop str_value2) {
-  return (oopDesc::equals(str_value1, str_value2) ||
+  return ((str_value1 == str_value2) ||
           (str_value1->length() == str_value2->length() &&
            (!memcmp(str_value1->base(T_BYTE),
                     str_value2->base(T_BYTE),
--- a/src/hotspot/share/classfile/modules.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/classfile/modules.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -306,7 +306,7 @@
 
   oop loader = java_lang_Module::loader(module_handle());
   // Make sure loader is not the jdk.internal.reflect.DelegatingClassLoader.
-  if (!oopDesc::equals(loader, java_lang_ClassLoader::non_reflection_class_loader(loader))) {
+  if (loader != java_lang_ClassLoader::non_reflection_class_loader(loader)) {
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
               "Class loader is an invalid delegating class loader");
   }
--- a/src/hotspot/share/classfile/protectionDomainCache.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/classfile/protectionDomainCache.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -160,7 +160,7 @@
 ProtectionDomainCacheEntry* ProtectionDomainCacheTable::find_entry(int index, Handle protection_domain) {
   assert_locked_or_safepoint(SystemDictionary_lock);
   for (ProtectionDomainCacheEntry* e = bucket(index); e != NULL; e = e->next()) {
-    if (oopDesc::equals(e->object_no_keepalive(), protection_domain())) {
+    if (e->object_no_keepalive() == protection_domain()) {
       return e;
     }
   }
--- a/src/hotspot/share/classfile/systemDictionary.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/classfile/systemDictionary.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -177,7 +177,7 @@
     return false;
   }
   return (class_loader->klass() == SystemDictionary::jdk_internal_loader_ClassLoaders_AppClassLoader_klass() ||
-         oopDesc::equals(class_loader, _java_system_loader));
+         class_loader == _java_system_loader);
 }
 
 // Returns true if the passed class loader is the platform class loader.
@@ -393,7 +393,7 @@
     if ((childk != NULL ) && (is_superclass) &&
         ((quicksuperk = childk->java_super()) != NULL) &&
          ((quicksuperk->name() == super_name) &&
-            (oopDesc::equals(quicksuperk->class_loader(), class_loader())))) {
+            (quicksuperk->class_loader() == class_loader()))) {
            return quicksuperk;
     } else {
       PlaceholderEntry* probe = placeholders()->get_entry(p_index, p_hash, child_name, loader_data);
@@ -542,7 +542,7 @@
   bool calledholdinglock
       = ObjectSynchronizer::current_thread_holds_lock((JavaThread*)THREAD, lockObject);
   assert(calledholdinglock,"must hold lock for notify");
-  assert((!oopDesc::equals(lockObject(), _system_loader_lock_obj) && !is_parallelCapable(lockObject)), "unexpected double_lock_wait");
+  assert((lockObject() != _system_loader_lock_obj && !is_parallelCapable(lockObject)), "unexpected double_lock_wait");
   ObjectSynchronizer::notifyall(lockObject, THREAD);
   intptr_t recursions =  ObjectSynchronizer::complete_exit(lockObject, THREAD);
   SystemDictionary_lock->wait();
@@ -850,7 +850,7 @@
       // If everything was OK (no exceptions, no null return value), and
       // class_loader is NOT the defining loader, do a little more bookkeeping.
       if (!HAS_PENDING_EXCEPTION && k != NULL &&
-        !oopDesc::equals(k->class_loader(), class_loader())) {
+        k->class_loader() != class_loader()) {
 
         check_constraints(d_hash, k, class_loader, false, THREAD);
 
@@ -1003,7 +1003,7 @@
   if (unsafe_anonymous_host != NULL) {
     // Create a new CLD for an unsafe anonymous class, that uses the same class loader
     // as the unsafe_anonymous_host
-    guarantee(oopDesc::equals(unsafe_anonymous_host->class_loader(), class_loader()), "should be the same");
+    guarantee(unsafe_anonymous_host->class_loader() == class_loader(), "should be the same");
     loader_data = ClassLoaderData::unsafe_anonymous_class_loader_data(class_loader);
   } else {
     loader_data = ClassLoaderData::class_loader_data(class_loader());
@@ -1268,116 +1268,116 @@
                                                    Handle protection_domain,
                                                    const ClassFileStream *cfs,
                                                    TRAPS) {
-
-  if (ik != NULL) {
-    Symbol* class_name = ik->name();
-
-    bool visible = is_shared_class_visible(
-                            class_name, ik, class_loader, CHECK_NULL);
-    if (!visible) {
-      return NULL;
-    }
-
-    // Resolve the superclass and interfaces. They must be the same
-    // as in dump time, because the layout of <ik> depends on
-    // the specific layout of ik->super() and ik->local_interfaces().
-    //
-    // If unexpected superclass or interfaces are found, we cannot
-    // load <ik> from the shared archive.
+  assert(ik != NULL, "sanity");
+  assert(!ik->is_unshareable_info_restored(), "shared class can be loaded only once");
+  Symbol* class_name = ik->name();
 
-    if (ik->super() != NULL) {
-      Symbol*  cn = ik->super()->name();
-      Klass *s = resolve_super_or_fail(class_name, cn,
-                                       class_loader, protection_domain, true, CHECK_NULL);
-      if (s != ik->super()) {
-        // The dynamically resolved super class is not the same as the one we used during dump time,
-        // so we cannot use ik.
-        return NULL;
-      } else {
-        assert(s->is_shared(), "must be");
-      }
-    }
+  bool visible = is_shared_class_visible(
+                          class_name, ik, class_loader, CHECK_NULL);
+  if (!visible) {
+    return NULL;
+  }
 
-    Array<InstanceKlass*>* interfaces = ik->local_interfaces();
-    int num_interfaces = interfaces->length();
-    for (int index = 0; index < num_interfaces; index++) {
-      InstanceKlass* k = interfaces->at(index);
-      Symbol* name  = k->name();
-      Klass* i = resolve_super_or_fail(class_name, name, class_loader, protection_domain, false, CHECK_NULL);
-      if (k != i) {
-        // The dynamically resolved interface class is not the same as the one we used during dump time,
-        // so we cannot use ik.
-        return NULL;
-      } else {
-        assert(i->is_shared(), "must be");
-      }
-    }
-
-    InstanceKlass* new_ik = KlassFactory::check_shared_class_file_load_hook(
-        ik, class_name, class_loader, protection_domain, cfs, CHECK_NULL);
-    if (new_ik != NULL) {
-      // The class is changed by CFLH. Return the new class. The shared class is
-      // not used.
-      return new_ik;
-    }
+  // Resolve the superclass and interfaces. They must be the same
+  // as in dump time, because the layout of <ik> depends on
+  // the specific layout of ik->super() and ik->local_interfaces().
+  //
+  // If unexpected superclass or interfaces are found, we cannot
+  // load <ik> from the shared archive.
 
-    // Adjust methods to recover missing data.  They need addresses for
-    // interpreter entry points and their default native method address
-    // must be reset.
-
-    // Updating methods must be done under a lock so multiple
-    // threads don't update these in parallel
-    //
-    // Shared classes are all currently loaded by either the bootstrap or
-    // internal parallel class loaders, so this will never cause a deadlock
-    // on a custom class loader lock.
-
-    ClassLoaderData* loader_data = ClassLoaderData::class_loader_data(class_loader());
-    {
-      HandleMark hm(THREAD);
-      Handle lockObject = compute_loader_lock_object(class_loader, THREAD);
-      check_loader_lock_contention(lockObject, THREAD);
-      ObjectLocker ol(lockObject, THREAD, true);
-      // prohibited package check assumes all classes loaded from archive call
-      // restore_unshareable_info which calls ik->set_package()
-      ik->restore_unshareable_info(loader_data, protection_domain, CHECK_NULL);
+  if (ik->super() != NULL) {
+    Symbol*  cn = ik->super()->name();
+    Klass *s = resolve_super_or_fail(class_name, cn,
+                                     class_loader, protection_domain, true, CHECK_NULL);
+    if (s != ik->super()) {
+      // The dynamically resolved super class is not the same as the one we used during dump time,
+      // so we cannot use ik.
+      return NULL;
+    } else {
+      assert(s->is_shared(), "must be");
     }
-
-    ik->print_class_load_logging(loader_data, NULL, NULL);
+  }
 
-    // For boot loader, ensure that GetSystemPackage knows that a class in this
-    // package was loaded.
-    if (class_loader.is_null()) {
-      int path_index = ik->shared_classpath_index();
-      ResourceMark rm;
-      ClassLoader::add_package(ik->name()->as_C_string(), path_index, THREAD);
-    }
-
-    if (DumpLoadedClassList != NULL && classlist_file->is_open()) {
-      // Only dump the classes that can be stored into CDS archive
-      if (SystemDictionaryShared::is_sharing_possible(loader_data)) {
-        ResourceMark rm(THREAD);
-        classlist_file->print_cr("%s", ik->name()->as_C_string());
-        classlist_file->flush();
-      }
-    }
-
-    // notify a class loaded from shared object
-    ClassLoadingService::notify_class_loaded(ik, true /* shared class */);
-
-    ik->set_has_passed_fingerprint_check(false);
-    if (UseAOT && ik->supers_have_passed_fingerprint_checks()) {
-      uint64_t aot_fp = AOTLoader::get_saved_fingerprint(ik);
-      uint64_t cds_fp = ik->get_stored_fingerprint();
-      if (aot_fp != 0 && aot_fp == cds_fp) {
-        // This class matches with a class saved in an AOT library
-        ik->set_has_passed_fingerprint_check(true);
-      } else {
-        ResourceMark rm;
-        log_info(class, fingerprint)("%s :  expected = " PTR64_FORMAT " actual = " PTR64_FORMAT, ik->external_name(), aot_fp, cds_fp);
-      }
+  Array<InstanceKlass*>* interfaces = ik->local_interfaces();
+  int num_interfaces = interfaces->length();
+  for (int index = 0; index < num_interfaces; index++) {
+    InstanceKlass* k = interfaces->at(index);
+    Symbol* name  = k->name();
+    Klass* i = resolve_super_or_fail(class_name, name, class_loader, protection_domain, false, CHECK_NULL);
+    if (k != i) {
+      // The dynamically resolved interface class is not the same as the one we used during dump time,
+      // so we cannot use ik.
+      return NULL;
+    } else {
+      assert(i->is_shared(), "must be");
     }
   }
+
+  InstanceKlass* new_ik = KlassFactory::check_shared_class_file_load_hook(
+      ik, class_name, class_loader, protection_domain, cfs, CHECK_NULL);
+  if (new_ik != NULL) {
+    // The class is changed by CFLH. Return the new class. The shared class is
+    // not used.
+    return new_ik;
+  }
+
+  // Adjust methods to recover missing data.  They need addresses for
+  // interpreter entry points and their default native method address
+  // must be reset.
+
+  // Updating methods must be done under a lock so multiple
+  // threads don't update these in parallel
+  //
+  // Shared classes are all currently loaded by either the bootstrap or
+  // internal parallel class loaders, so this will never cause a deadlock
+  // on a custom class loader lock.
+
+  ClassLoaderData* loader_data = ClassLoaderData::class_loader_data(class_loader());
+  {
+    HandleMark hm(THREAD);
+    Handle lockObject = compute_loader_lock_object(class_loader, THREAD);
+    check_loader_lock_contention(lockObject, THREAD);
+    ObjectLocker ol(lockObject, THREAD, true);
+    // prohibited package check assumes all classes loaded from archive call
+    // restore_unshareable_info which calls ik->set_package()
+    ik->restore_unshareable_info(loader_data, protection_domain, CHECK_NULL);
+  }
+
+  ik->print_class_load_logging(loader_data, NULL, NULL);
+
+  // For boot loader, ensure that GetSystemPackage knows that a class in this
+  // package was loaded.
+  if (class_loader.is_null()) {
+    int path_index = ik->shared_classpath_index();
+    ResourceMark rm;
+    ClassLoader::add_package(ik->name()->as_C_string(), path_index, THREAD);
+  }
+
+  if (DumpLoadedClassList != NULL && classlist_file->is_open()) {
+    // Only dump the classes that can be stored into CDS archive
+    if (SystemDictionaryShared::is_sharing_possible(loader_data)) {
+      ResourceMark rm(THREAD);
+      classlist_file->print_cr("%s", ik->name()->as_C_string());
+      classlist_file->flush();
+    }
+  }
+
+  // notify a class loaded from shared object
+  ClassLoadingService::notify_class_loaded(ik, true /* shared class */);
+
+  ik->set_has_passed_fingerprint_check(false);
+  if (UseAOT && ik->supers_have_passed_fingerprint_checks()) {
+    uint64_t aot_fp = AOTLoader::get_saved_fingerprint(ik);
+    uint64_t cds_fp = ik->get_stored_fingerprint();
+    if (aot_fp != 0 && aot_fp == cds_fp) {
+      // This class matches with a class saved in an AOT library
+      ik->set_has_passed_fingerprint_check(true);
+    } else {
+      ResourceMark rm;
+      log_info(class, fingerprint)("%s :  expected = " PTR64_FORMAT " actual = " PTR64_FORMAT, ik->external_name(), aot_fp, cds_fp);
+    }
+  }
+
   return ik;
 }
 #endif // INCLUDE_CDS
@@ -1729,7 +1729,7 @@
       == ObjectSynchronizer::owner_other) {
     // contention will likely happen, so increment the corresponding
     // contention counter.
-    if (oopDesc::equals(loader_lock(), _system_loader_lock_obj)) {
+    if (loader_lock() == _system_loader_lock_obj) {
       ClassLoader::sync_systemLoaderLockContentionRate()->inc();
     } else {
       ClassLoader::sync_nonSystemLoaderLockContentionRate()->inc();
@@ -2150,7 +2150,7 @@
       // cleared if revocation occurs too often for this type
       // NOTE that we must only do this when the class is initally
       // defined, not each time it is referenced from a new class loader
-      if (oopDesc::equals(k->class_loader(), class_loader())) {
+      if (k->class_loader() == class_loader()) {
         k->set_prototype_header(markWord::biased_locking_prototype());
       }
     }
@@ -2343,7 +2343,7 @@
                                                Handle loader1, Handle loader2,
                                                bool is_method, TRAPS)  {
   // Nothing to do if loaders are the same.
-  if (oopDesc::equals(loader1(), loader2())) {
+  if (loader1() == loader2()) {
     return NULL;
   }
 
--- a/src/hotspot/share/code/codeCache.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/code/codeCache.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1143,28 +1143,17 @@
 
   // At least one nmethod has been marked for deoptimization
 
-  // All this already happens inside a VM_Operation, so we'll do all the work here.
-  // Stuff copied from VM_Deoptimize and modified slightly.
-
-  // We do not want any GCs to happen while we are in the middle of this VM operation
-  ResourceMark rm;
-  DeoptimizationMarker dm;
-
-  // Deoptimize all activations depending on marked nmethods
-  Deoptimization::deoptimize_dependents();
-
-  // Make the dependent methods not entrant
-  make_marked_nmethods_not_entrant();
+  Deoptimization::deoptimize_all_marked();
 }
 #endif // INCLUDE_JVMTI
 
-// Deoptimize all methods
+// Mark methods for deopt (if safe or possible).
 void CodeCache::mark_all_nmethods_for_deoptimization() {
   MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   CompiledMethodIterator iter(CompiledMethodIterator::only_alive_and_not_unloading);
   while(iter.next()) {
     CompiledMethod* nm = iter.method();
-    if (!nm->method()->is_method_handle_intrinsic()) {
+    if (!nm->is_native_method()) {
       nm->mark_for_deoptimization();
     }
   }
@@ -1192,7 +1181,7 @@
   CompiledMethodIterator iter(CompiledMethodIterator::only_alive_and_not_unloading);
   while(iter.next()) {
     CompiledMethod* nm = iter.method();
-    if (nm->is_marked_for_deoptimization() && !nm->is_not_entrant()) {
+    if (nm->is_marked_for_deoptimization()) {
       nm->make_not_entrant();
     }
   }
@@ -1204,17 +1193,12 @@
 
   if (number_of_nmethods_with_dependencies() == 0) return;
 
-  // CodeCache can only be updated by a thread_in_VM and they will all be
-  // stopped during the safepoint so CodeCache will be safe to update without
-  // holding the CodeCache_lock.
-
   KlassDepChange changes(dependee);
 
   // Compute the dependent nmethods
   if (mark_for_deoptimization(changes) > 0) {
     // At least one nmethod has been marked for deoptimization
-    VM_Deoptimize op;
-    VMThread::execute(&op);
+    Deoptimization::deoptimize_all_marked();
   }
 }
 
@@ -1223,26 +1207,9 @@
   // --- Compile_lock is not held. However we are at a safepoint.
   assert_locked_or_safepoint(Compile_lock);
 
-  // CodeCache can only be updated by a thread_in_VM and they will all be
-  // stopped dring the safepoint so CodeCache will be safe to update without
-  // holding the CodeCache_lock.
-
   // Compute the dependent nmethods
   if (mark_for_deoptimization(m_h()) > 0) {
-    // At least one nmethod has been marked for deoptimization
-
-    // All this already happens inside a VM_Operation, so we'll do all the work here.
-    // Stuff copied from VM_Deoptimize and modified slightly.
-
-    // We do not want any GCs to happen while we are in the middle of this VM operation
-    ResourceMark rm;
-    DeoptimizationMarker dm;
-
-    // Deoptimize all activations depending on marked nmethods
-    Deoptimization::deoptimize_dependents();
-
-    // Make the dependent methods not entrant
-    make_marked_nmethods_not_entrant();
+    Deoptimization::deoptimize_all_marked();
   }
 }
 
--- a/src/hotspot/share/code/compiledMethod.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/code/compiledMethod.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -104,6 +104,13 @@
 }
 
 //-----------------------------------------------------------------------------
+void CompiledMethod::mark_for_deoptimization(bool inc_recompile_counts) {
+  MutexLocker ml(CompiledMethod_lock->owned_by_self() ? NULL : CompiledMethod_lock,
+                 Mutex::_no_safepoint_check_flag);
+  _mark_for_deoptimization_status = (inc_recompile_counts ? deoptimize : deoptimize_noupdate);
+}
+
+//-----------------------------------------------------------------------------
 
 ExceptionCache* CompiledMethod::exception_cache_acquire() const {
   return OrderAccess::load_acquire(&_exception_cache);
--- a/src/hotspot/share/code/compiledMethod.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/code/compiledMethod.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -244,10 +244,9 @@
   bool is_at_poll_return(address pc);
   bool is_at_poll_or_poll_return(address pc);
 
-  bool  is_marked_for_deoptimization() const      { return _mark_for_deoptimization_status != not_marked; }
-  void  mark_for_deoptimization(bool inc_recompile_counts = true) {
-    _mark_for_deoptimization_status = (inc_recompile_counts ? deoptimize : deoptimize_noupdate);
-  }
+  bool  is_marked_for_deoptimization() const { return _mark_for_deoptimization_status != not_marked; }
+  void  mark_for_deoptimization(bool inc_recompile_counts = true);
+
   bool update_recompile_counts() const {
     // Update recompile counts when either the update is explicitly requested (deoptimize)
     // or the nmethod is not marked for deoptimization at all (not_marked).
--- a/src/hotspot/share/code/dependencies.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/code/dependencies.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1813,12 +1813,12 @@
 
   if (changes == NULL) {
     // Validate all CallSites
-    if (!oopDesc::equals(java_lang_invoke_CallSite::target(call_site), method_handle))
+    if (java_lang_invoke_CallSite::target(call_site) != method_handle)
       return call_site->klass();  // assertion failed
   } else {
     // Validate the given CallSite
-    if (oopDesc::equals(call_site, changes->call_site()) && !oopDesc::equals(java_lang_invoke_CallSite::target(call_site), changes->method_handle())) {
-      assert(!oopDesc::equals(method_handle, changes->method_handle()), "must be");
+    if (call_site == changes->call_site() && java_lang_invoke_CallSite::target(call_site) != changes->method_handle()) {
+      assert(method_handle != changes->method_handle(), "must be");
       return call_site->klass();  // assertion failed
     }
   }
--- a/src/hotspot/share/code/nmethod.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/code/nmethod.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -50,6 +50,7 @@
 #include "oops/oop.inline.hpp"
 #include "prims/jvmtiImpl.hpp"
 #include "runtime/atomic.hpp"
+#include "runtime/deoptimization.hpp"
 #include "runtime/flags/flagSetting.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/handles.inline.hpp"
@@ -476,7 +477,6 @@
     debug_only(nm->verify();) // might block
 
     nm->log_new_nmethod();
-    nm->make_in_use();
   }
   return nm;
 }
@@ -1138,6 +1138,11 @@
 
 bool nmethod::try_transition(int new_state_int) {
   signed char new_state = new_state_int;
+#ifdef DEBUG
+  if (new_state != unloaded) {
+    assert_lock_strong(CompiledMethod_lock);
+  }
+#endif
   for (;;) {
     signed char old_state = Atomic::load(&_state);
     if (old_state >= new_state) {
@@ -1193,11 +1198,7 @@
   // have the Method* live here, in case we unload the nmethod because
   // it is pointing to some oop (other than the Method*) being unloaded.
   if (_method != NULL) {
-    // OSR methods point to the Method*, but the Method* does not
-    // point back!
-    if (_method->code() == this) {
-      _method->clear_code(); // Break a cycle
-    }
+    _method->unlink_code(this);
   }
 
   // Make the class unloaded - i.e., change state and notify sweeper
@@ -1281,16 +1282,9 @@
   }
 }
 
-void nmethod::unlink_from_method(bool acquire_lock) {
-  // We need to check if both the _code and _from_compiled_code_entry_point
-  // refer to this nmethod because there is a race in setting these two fields
-  // in Method* as seen in bugid 4947125.
-  // If the vep() points to the zombie nmethod, the memory for the nmethod
-  // could be flushed and the compiler and vtable stubs could still call
-  // through it.
-  if (method() != NULL && (method()->code() == this ||
-                           method()->from_compiled_entry() == verified_entry_point())) {
-    method()->clear_code(acquire_lock);
+void nmethod::unlink_from_method() {
+  if (method() != NULL) {
+    method()->unlink_code(this);
   }
 }
 
@@ -1317,24 +1311,24 @@
 
   // during patching, depending on the nmethod state we must notify the GC that
   // code has been unloaded, unregistering it. We cannot do this right while
-  // holding the Patching_lock because we need to use the CodeCache_lock. This
+  // holding the CompiledMethod_lock because we need to use the CodeCache_lock. This
   // would be prone to deadlocks.
   // This flag is used to remember whether we need to later lock and unregister.
   bool nmethod_needs_unregister = false;
 
+  // invalidate osr nmethod before acquiring the patching lock since
+  // they both acquire leaf locks and we don't want a deadlock.
+  // This logic is equivalent to the logic below for patching the
+  // verified entry point of regular methods. We check that the
+  // nmethod is in use to ensure that it is invalidated only once.
+  if (is_osr_method() && is_in_use()) {
+    // this effectively makes the osr nmethod not entrant
+    invalidate_osr_method();
+  }
+
   {
-    // invalidate osr nmethod before acquiring the patching lock since
-    // they both acquire leaf locks and we don't want a deadlock.
-    // This logic is equivalent to the logic below for patching the
-    // verified entry point of regular methods. We check that the
-    // nmethod is in use to ensure that it is invalidated only once.
-    if (is_osr_method() && is_in_use()) {
-      // this effectively makes the osr nmethod not entrant
-      invalidate_osr_method();
-    }
-
     // Enter critical section.  Does not block for safepoint.
-    MutexLocker pl(Patching_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(CompiledMethod_lock->owned_by_self() ? NULL : CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
 
     if (Atomic::load(&_state) >= state) {
       // another thread already performed this transition so nothing
@@ -1389,8 +1383,9 @@
     log_state_change();
 
     // Remove nmethod from method.
-    unlink_from_method(false /* already owns Patching_lock */);
-  } // leave critical region under Patching_lock
+    unlink_from_method();
+
+  } // leave critical region under CompiledMethod_lock
 
 #if INCLUDE_JVMCI
   // Invalidate can't occur while holding the Patching lock
--- a/src/hotspot/share/code/nmethod.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/code/nmethod.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -119,7 +119,7 @@
   // used by jvmti to track if an unload event has been posted for this nmethod.
   bool _unload_reported;
 
-  // Protected by Patching_lock
+  // Protected by CompiledMethod_lock
   volatile signed char _state;               // {not_installed, in_use, not_entrant, zombie, unloaded}
 
 #ifdef ASSERT
@@ -357,7 +357,9 @@
   void set_rtm_state(RTMState state)              { _rtm_state = state; }
 #endif
 
-  void make_in_use()                              { _state = in_use; }
+  bool make_in_use() {
+    return try_transition(in_use);
+  }
   // Make the nmethod non entrant. The nmethod will continue to be
   // alive.  It is used when an uncommon trap happens.  Returns true
   // if this thread changed the state of the nmethod or false if
@@ -390,7 +392,7 @@
 
   int   comp_level() const                        { return _comp_level; }
 
-  void unlink_from_method(bool acquire_lock);
+  void unlink_from_method();
 
   // Support for oops in scopes and relocs:
   // Note: index 0 is reserved for null.
--- a/src/hotspot/share/compiler/compileBroker.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/compiler/compileBroker.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -316,7 +316,7 @@
   // We only allow the last compiler thread of each type to get removed.
   jobject last_compiler = c1 ? CompileBroker::compiler1_object(compiler_count - 1)
                              : CompileBroker::compiler2_object(compiler_count - 1);
-  if (oopDesc::equals(ct->threadObj(), JNIHandles::resolve_non_null(last_compiler))) {
+  if (ct->threadObj() == JNIHandles::resolve_non_null(last_compiler)) {
     if (do_it) {
       assert_locked_or_safepoint(CompileThread_lock); // Update must be consistent.
       compiler->set_num_compiler_threads(compiler_count - 1);
@@ -557,8 +557,14 @@
 }
 
 void CompileQueue::print_tty() {
-  ttyLocker ttyl;
-  print(tty);
+  ResourceMark rm;
+  stringStream ss;
+  // Dump the compile queue into a buffer before locking the tty
+  print(&ss);
+  {
+    ttyLocker ttyl;
+    tty->print("%s", ss.as_string());
+  }
 }
 
 CompilerCounters::CompilerCounters() {
@@ -1687,7 +1693,7 @@
   int compiler_number = 0;
   bool found = false;
   for (; compiler_number < count; compiler_number++) {
-    if (oopDesc::equals(JNIHandles::resolve_non_null(compiler_objects[compiler_number]), compiler_obj)) {
+    if (JNIHandles::resolve_non_null(compiler_objects[compiler_number]) == compiler_obj) {
       found = true;
       break;
     }
--- a/src/hotspot/share/gc/cms/cmsHeap.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/cms/cmsHeap.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -135,10 +135,6 @@
   bool should_do_concurrent_full_gc(GCCause::Cause cause);
 
   void collect_mostly_concurrent(GCCause::Cause cause);
-
-  // CMS forwards some non-heap value into the mark oop to reserve oops during
-  // promotion, so we can't assert about obj alignment or that the forwardee is in heap
-  virtual void check_oop_location(void* addr) const {}
 };
 
 #endif // SHARE_GC_CMS_CMSHEAP_HPP
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -132,7 +132,7 @@
   RedirtyLoggedCardTableEntryClosure(G1CollectedHeap* g1h) : G1CardTableEntryClosure(),
     _num_dirtied(0), _g1h(g1h), _g1_ct(g1h->card_table()) { }
 
-  void do_card_ptr(CardValue* card_ptr, uint worker_i) {
+  void do_card_ptr(CardValue* card_ptr, uint worker_id) {
     HeapRegion* hr = region_for_card(card_ptr);
 
     // Should only dirty cards in regions that won't be freed.
@@ -1938,8 +1938,8 @@
   return _hrm->total_free_bytes();
 }
 
-void G1CollectedHeap::iterate_hcc_closure(G1CardTableEntryClosure* cl, uint worker_i) {
-  _hot_card_cache->drain(cl, worker_i);
+void G1CollectedHeap::iterate_hcc_closure(G1CardTableEntryClosure* cl, uint worker_id) {
+  _hot_card_cache->drain(cl, worker_id);
 }
 
 // Computes the sum of the storage used by the various regions.
@@ -2377,7 +2377,8 @@
 void G1CollectedHeap::print_regions_on(outputStream* st) const {
   st->print_cr("Heap Regions: E=young(eden), S=young(survivor), O=old, "
                "HS=humongous(starts), HC=humongous(continues), "
-               "CS=collection set, F=free, A=archive, "
+               "CS=collection set, F=free, "
+               "OA=open archive, CA=closed archive, "
                "TAMS=top-at-mark-start (previous, next)");
   PrintRegionClosure blk(st);
   heap_region_iterate(&blk);
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -991,7 +991,7 @@
   void scrub_rem_set();
 
   // Apply the given closure on all cards in the Hot Card Cache, emptying it.
-  void iterate_hcc_closure(G1CardTableEntryClosure* cl, uint worker_i);
+  void iterate_hcc_closure(G1CardTableEntryClosure* cl, uint worker_id);
 
   // The shared block offset table array.
   G1BlockOffsetTable* bot() const { return _bot; }
--- a/src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -198,10 +198,10 @@
 
 static Thresholds calc_thresholds(size_t green_zone,
                                   size_t yellow_zone,
-                                  uint worker_i) {
+                                  uint worker_id) {
   double yellow_size = yellow_zone - green_zone;
   double step = yellow_size / G1ConcurrentRefine::max_num_threads();
-  if (worker_i == 0) {
+  if (worker_id == 0) {
     // Potentially activate worker 0 more aggressively, to keep
     // available buffers near green_zone value.  When yellow_size is
     // large we don't want to allow a full step to accumulate before
@@ -209,8 +209,8 @@
     // than green_zone buffers to be processed during scanning.
     step = MIN2(step, ParallelGCThreads / 2.0);
   }
-  size_t activate_offset = static_cast<size_t>(ceil(step * (worker_i + 1)));
-  size_t deactivate_offset = static_cast<size_t>(floor(step * worker_i));
+  size_t activate_offset = static_cast<size_t>(ceil(step * (worker_id + 1)));
+  size_t deactivate_offset = static_cast<size_t>(floor(step * worker_id));
   return Thresholds(green_zone + activate_offset,
                     green_zone + deactivate_offset);
 }
--- a/src/hotspot/share/gc/g1/g1DirtyCardQueue.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/g1/g1DirtyCardQueue.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -158,7 +158,7 @@
   // Stops processing a buffer if SuspendibleThreadSet::should_yield(),
   // returning the incompletely processed buffer to the completed buffer
   // list, for later processing of the remainder.
-  bool refine_completed_buffer_concurrently(uint worker_i, size_t stop_at);
+  bool refine_completed_buffer_concurrently(uint worker_id, size_t stop_at);
 
   // If a full collection is happening, reset partial logs, and release
   // completed ones: the full collection will make them all irrelevant.
--- a/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -62,8 +62,7 @@
   _gc_par_phases[JVMTIRoots] = new WorkerDataArray<double>(max_gc_threads, "JVMTI Roots (ms):");
   AOT_ONLY(_gc_par_phases[AOTCodeRoots] = new WorkerDataArray<double>(max_gc_threads, "AOT Root Scan (ms):");)
   _gc_par_phases[CMRefRoots] = new WorkerDataArray<double>(max_gc_threads, "CM RefProcessor Roots (ms):");
-  _gc_par_phases[WaitForStrongCLD] = new WorkerDataArray<double>(max_gc_threads, "Wait For Strong CLD (ms):");
-  _gc_par_phases[WeakCLDRoots] = new WorkerDataArray<double>(max_gc_threads, "Weak CLD Roots (ms):");
+  _gc_par_phases[WaitForStrongRoots] = new WorkerDataArray<double>(max_gc_threads, "Wait For Strong Roots (ms):");
 
   _gc_par_phases[MergeER] = new WorkerDataArray<double>(max_gc_threads, "Eager Reclaim (ms):");
 
@@ -273,37 +272,37 @@
 #undef ASSERT_PHASE_UNINITIALIZED
 
 // record the time a phase took in seconds
-void G1GCPhaseTimes::record_time_secs(GCParPhases phase, uint worker_i, double secs) {
-  _gc_par_phases[phase]->set(worker_i, secs);
+void G1GCPhaseTimes::record_time_secs(GCParPhases phase, uint worker_id, double secs) {
+  _gc_par_phases[phase]->set(worker_id, secs);
 }
 
 // add a number of seconds to a phase
-void G1GCPhaseTimes::add_time_secs(GCParPhases phase, uint worker_i, double secs) {
-  _gc_par_phases[phase]->add(worker_i, secs);
+void G1GCPhaseTimes::add_time_secs(GCParPhases phase, uint worker_id, double secs) {
+  _gc_par_phases[phase]->add(worker_id, secs);
 }
 
-void G1GCPhaseTimes::record_or_add_time_secs(GCParPhases phase, uint worker_i, double secs) {
-  if (_gc_par_phases[phase]->get(worker_i) == _gc_par_phases[phase]->uninitialized()) {
-    record_time_secs(phase, worker_i, secs);
+void G1GCPhaseTimes::record_or_add_time_secs(GCParPhases phase, uint worker_id, double secs) {
+  if (_gc_par_phases[phase]->get(worker_id) == _gc_par_phases[phase]->uninitialized()) {
+    record_time_secs(phase, worker_id, secs);
   } else {
-    add_time_secs(phase, worker_i, secs);
+    add_time_secs(phase, worker_id, secs);
   }
 }
 
-double G1GCPhaseTimes::get_time_secs(GCParPhases phase, uint worker_i) {
-  return _gc_par_phases[phase]->get(worker_i);
+double G1GCPhaseTimes::get_time_secs(GCParPhases phase, uint worker_id) {
+  return _gc_par_phases[phase]->get(worker_id);
 }
 
-void G1GCPhaseTimes::record_thread_work_item(GCParPhases phase, uint worker_i, size_t count, uint index) {
-  _gc_par_phases[phase]->set_thread_work_item(worker_i, count, index);
+void G1GCPhaseTimes::record_thread_work_item(GCParPhases phase, uint worker_id, size_t count, uint index) {
+  _gc_par_phases[phase]->set_thread_work_item(worker_id, count, index);
 }
 
-void G1GCPhaseTimes::record_or_add_thread_work_item(GCParPhases phase, uint worker_i, size_t count, uint index) {
-  _gc_par_phases[phase]->set_or_add_thread_work_item(worker_i, count, index);
+void G1GCPhaseTimes::record_or_add_thread_work_item(GCParPhases phase, uint worker_id, size_t count, uint index) {
+  _gc_par_phases[phase]->set_or_add_thread_work_item(worker_id, count, index);
 }
 
-size_t G1GCPhaseTimes::get_thread_work_item(GCParPhases phase, uint worker_i, uint index) {
-  return _gc_par_phases[phase]->get_thread_work_item(worker_i, index);
+size_t G1GCPhaseTimes::get_thread_work_item(GCParPhases phase, uint worker_id, uint index) {
+  return _gc_par_phases[phase]->get_thread_work_item(worker_id, index);
 }
 
 // return the average time for a phase in milliseconds
@@ -567,8 +566,7 @@
       "JVMTIRoots",
       AOT_ONLY("AOTCodeRoots" COMMA)
       "CMRefRoots",
-      "WaitForStrongCLD",
-      "WeakCLDRoots",
+      "WaitForStrongRoots",
       "MergeER",
       "MergeRS",
       "OptMergeRS",
--- a/src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -57,8 +57,7 @@
     JVMTIRoots,
     AOT_ONLY(AOTCodeRoots COMMA)
     CMRefRoots,
-    WaitForStrongCLD,
-    WeakCLDRoots,
+    WaitForStrongRoots,
     MergeER,
     MergeRS,
     OptMergeRS,
@@ -84,7 +83,7 @@
   };
 
   static const GCParPhases ExtRootScanSubPhasesFirst = ThreadRoots;
-  static const GCParPhases ExtRootScanSubPhasesLast = WeakCLDRoots;
+  static const GCParPhases ExtRootScanSubPhasesLast = WaitForStrongRoots;
 
   enum GCMergeRSWorkTimes {
     MergeRSMergedSparse,
@@ -251,20 +250,20 @@
   static const char* phase_name(GCParPhases phase);
 
   // record the time a phase took in seconds
-  void record_time_secs(GCParPhases phase, uint worker_i, double secs);
+  void record_time_secs(GCParPhases phase, uint worker_id, double secs);
 
   // add a number of seconds to a phase
-  void add_time_secs(GCParPhases phase, uint worker_i, double secs);
+  void add_time_secs(GCParPhases phase, uint worker_id, double secs);
 
-  void record_or_add_time_secs(GCParPhases phase, uint worker_i, double secs);
+  void record_or_add_time_secs(GCParPhases phase, uint worker_id, double secs);
 
-  double get_time_secs(GCParPhases phase, uint worker_i);
+  double get_time_secs(GCParPhases phase, uint worker_id);
 
-  void record_thread_work_item(GCParPhases phase, uint worker_i, size_t count, uint index = 0);
+  void record_thread_work_item(GCParPhases phase, uint worker_id, size_t count, uint index = 0);
 
-  void record_or_add_thread_work_item(GCParPhases phase, uint worker_i, size_t count, uint index = 0);
+  void record_or_add_thread_work_item(GCParPhases phase, uint worker_id, size_t count, uint index = 0);
 
-  size_t get_thread_work_item(GCParPhases phase, uint worker_i, uint index = 0);
+  size_t get_thread_work_item(GCParPhases phase, uint worker_id, uint index = 0);
 
   // return the average time for a phase in milliseconds
   double average_time_ms(GCParPhases phase);
--- a/src/hotspot/share/gc/g1/g1HotCardCache.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/g1/g1HotCardCache.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -84,7 +84,7 @@
   return (previous_ptr == current_ptr) ? previous_ptr : card_ptr;
 }
 
-void G1HotCardCache::drain(G1CardTableEntryClosure* cl, uint worker_i) {
+void G1HotCardCache::drain(G1CardTableEntryClosure* cl, uint worker_id) {
   assert(default_use_cache(), "Drain only necessary if we use the hot card cache.");
 
   assert(_hot_cache != NULL, "Logic");
@@ -99,7 +99,7 @@
     for (size_t i = start_idx; i < end_idx; i++) {
       CardValue* card_ptr = _hot_cache[i];
       if (card_ptr != NULL) {
-        cl->do_card_ptr(card_ptr, worker_i);
+        cl->do_card_ptr(card_ptr, worker_id);
       } else {
         break;
       }
--- a/src/hotspot/share/gc/g1/g1HotCardCache.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/g1/g1HotCardCache.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -113,7 +113,7 @@
 
   // Refine the cards that have delayed as a result of
   // being in the cache.
-  void drain(G1CardTableEntryClosure* cl, uint worker_i);
+  void drain(G1CardTableEntryClosure* cl, uint worker_id);
 
   // Set up for parallel processing of the cards in the hot cache
   void reset_hot_cache_claimed_index() {
--- a/src/hotspot/share/gc/g1/g1OopClosures.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/g1/g1OopClosures.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -43,16 +43,14 @@
 
 void G1CLDScanClosure::do_cld(ClassLoaderData* cld) {
   // If the class loader data has not been dirtied we know that there's
-  // no references into  the young gen and we can skip it.
+  // no references into the young gen and we can skip it.
   if (!_process_only_dirty || cld->has_modified_oops()) {
 
     // Tell the closure that this class loader data is the CLD to scavenge
     // and is the one to dirty if oops are left pointing into the young gen.
     _closure->set_scanned_cld(cld);
-
-    // Clean the cld since we're going to scavenge all the metadata.
-    // Clear modified oops only if this cld is claimed.
-    cld->oops_do(_closure, _claim, /*clear_modified_oops*/true);
+    // Clean modified oops since we're going to scavenge all the metadata.
+    cld->oops_do(_closure, ClassLoaderData::_claim_none, true /*clear_modified_oops*/);
 
     _closure->set_scanned_cld(NULL);
 
--- a/src/hotspot/share/gc/g1/g1OopClosures.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/g1/g1OopClosures.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -175,12 +175,10 @@
 class G1CLDScanClosure : public CLDClosure {
   G1ParCopyHelper* _closure;
   bool             _process_only_dirty;
-  int              _claim;
   int              _count;
 public:
-  G1CLDScanClosure(G1ParCopyHelper* closure,
-                   bool process_only_dirty, int claim_value)
-  : _closure(closure), _process_only_dirty(process_only_dirty), _claim(claim_value), _count(0) {}
+  G1CLDScanClosure(G1ParCopyHelper* closure, bool process_only_dirty)
+  : _closure(closure), _process_only_dirty(process_only_dirty), _count(0) {}
   void do_cld(ClassLoaderData* cld);
 };
 
@@ -211,12 +209,12 @@
 
 class G1ConcurrentRefineOopClosure: public BasicOopIterateClosure {
   G1CollectedHeap* _g1h;
-  uint _worker_i;
+  uint _worker_id;
 
 public:
-  G1ConcurrentRefineOopClosure(G1CollectedHeap* g1h, uint worker_i) :
+  G1ConcurrentRefineOopClosure(G1CollectedHeap* g1h, uint worker_id) :
     _g1h(g1h),
-    _worker_i(worker_i) {
+    _worker_id(worker_id) {
   }
 
   virtual ReferenceIterationMode reference_iteration_mode() { return DO_FIELDS; }
--- a/src/hotspot/share/gc/g1/g1OopClosures.inline.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/g1/g1OopClosures.inline.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -38,6 +38,7 @@
 #include "oops/oopsHierarchy.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/prefetch.inline.hpp"
+#include "utilities/align.hpp"
 
 template <class T>
 inline void G1ScanClosureBase::prefetch_and_push(T* p, const oop obj) {
@@ -115,7 +116,8 @@
   G1CollectedHeap* g1h = G1CollectedHeap::heap();
   // can't do because of races
   // assert(oopDesc::is_oop_or_null(obj), "expected an oop");
-  g1h->check_oop_location(obj);
+  assert(is_object_aligned(obj), "oop must be aligned");
+  assert(g1h->is_in_reserved(obj), "oop must be in reserved");
 
   HeapRegion* from = g1h->heap_region_containing(p);
 
@@ -154,7 +156,7 @@
 
   assert(to_rem_set != NULL, "Need per-region 'into' remsets.");
   if (to_rem_set->is_tracked()) {
-    to_rem_set->add_reference(p, _worker_i);
+    to_rem_set->add_reference(p, _worker_id);
   }
 }
 
--- a/src/hotspot/share/gc/g1/g1RemSet.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/g1/g1RemSet.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -830,7 +830,7 @@
 
     G1ScanCardClosure scan_cl(G1CollectedHeap::heap(), _pss);
     G1ScanRSForOptionalClosure cl(G1CollectedHeap::heap(), &scan_cl);
-    _opt_refs_scanned += opt_rem_set_list->oops_do(&cl, _pss->closures()->raw_strong_oops());
+    _opt_refs_scanned += opt_rem_set_list->oops_do(&cl, _pss->closures()->strong_oops());
     _opt_refs_memory_used += opt_rem_set_list->used_memory();
 
     event.commit(GCId::current(), _worker_id, G1GCPhaseTimes::phase_name(_scan_phase));
@@ -839,14 +839,14 @@
 public:
   G1ScanCollectionSetRegionClosure(G1RemSetScanState* scan_state,
                                    G1ParScanThreadState* pss,
-                                   uint worker_i,
+                                   uint worker_id,
                                    G1GCPhaseTimes::GCParPhases scan_phase,
                                    G1GCPhaseTimes::GCParPhases code_roots_phase) :
     _pss(pss),
     _scan_state(scan_state),
     _scan_phase(scan_phase),
     _code_roots_phase(code_roots_phase),
-    _worker_id(worker_i),
+    _worker_id(worker_id),
     _opt_refs_scanned(0),
     _opt_refs_memory_used(0),
     _strong_code_root_scan_time(),
@@ -1061,7 +1061,7 @@
       _scan_state(scan_state), _ct(g1h->card_table()), _cards_dirty(0), _cards_skipped(0)
     {}
 
-    void do_card_ptr(CardValue* card_ptr, uint worker_i) {
+    void do_card_ptr(CardValue* card_ptr, uint worker_id) {
       // The only time we care about recording cards that
       // contain references that point into the collection set
       // is during RSet updating within an evacuation pause.
@@ -1263,7 +1263,7 @@
 }
 
 void G1RemSet::refine_card_concurrently(CardValue* card_ptr,
-                                        uint worker_i) {
+                                        uint worker_id) {
   assert(!_g1h->is_gc_active(), "Only call concurrently");
 
   // Construct the region representing the card.
@@ -1375,7 +1375,7 @@
   MemRegion dirty_region(start, MIN2(scan_limit, end));
   assert(!dirty_region.is_empty(), "sanity");
 
-  G1ConcurrentRefineOopClosure conc_refine_cl(_g1h, worker_i);
+  G1ConcurrentRefineOopClosure conc_refine_cl(_g1h, worker_id);
   if (r->oops_on_memregion_seq_iterate_careful<false>(dirty_region, &conc_refine_cl) != NULL) {
     _num_conc_refined_cards++; // Unsynchronized update, only used for logging.
     return;
--- a/src/hotspot/share/gc/g1/g1RemSet.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/g1/g1RemSet.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -117,7 +117,7 @@
   // Refine the card corresponding to "card_ptr". Safe to be called concurrently
   // to the mutator.
   void refine_card_concurrently(CardValue* card_ptr,
-                                uint worker_i);
+                                uint worker_id);
 
   // Print accumulated summary info from the start of the VM.
   void print_summary_info();
--- a/src/hotspot/share/gc/g1/g1RootClosures.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/g1/g1RootClosures.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -35,20 +35,17 @@
   G1EvacuationClosures(G1CollectedHeap* g1h,
                        G1ParScanThreadState* pss,
                        bool in_young_gc) :
-      _closures(g1h, pss, in_young_gc, /* cld_claim */ ClassLoaderData::_claim_none) {}
+      _closures(g1h, pss, in_young_gc) {}
 
   OopClosure* weak_oops()   { return &_closures._oops; }
   OopClosure* strong_oops() { return &_closures._oops; }
 
   CLDClosure* weak_clds()             { return &_closures._clds; }
   CLDClosure* strong_clds()           { return &_closures._clds; }
-  CLDClosure* second_pass_weak_clds() { return NULL; }
 
   CodeBlobClosure* strong_codeblobs()      { return &_closures._codeblobs; }
   CodeBlobClosure* weak_codeblobs()        { return &_closures._codeblobs; }
 
-  OopClosure* raw_strong_oops() { return &_closures._oops; }
-
   bool trace_metadata()         { return false; }
 };
 
@@ -60,38 +57,21 @@
   G1SharedClosures<G1MarkFromRoot> _strong;
   G1SharedClosures<MarkWeak>       _weak;
 
-  // Filter method to help with returning the appropriate closures
-  // depending on the class template parameter.
-  template <G1Mark Mark, typename T>
-  T* null_if(T* t) {
-    if (Mark == MarkWeak) {
-      return NULL;
-    }
-    return t;
-  }
-
 public:
   G1InitialMarkClosures(G1CollectedHeap* g1h,
                         G1ParScanThreadState* pss) :
-      _strong(g1h, pss, /* process_only_dirty_klasses */ false, /* cld_claim */ ClassLoaderData::_claim_strong),
-      _weak(g1h, pss,   /* process_only_dirty_klasses */ false, /* cld_claim */ ClassLoaderData::_claim_strong) {}
+      _strong(g1h, pss, /* process_only_dirty_klasses */ false),
+      _weak(g1h, pss,   /* process_only_dirty_klasses */ false) {}
 
   OopClosure* weak_oops()   { return &_weak._oops; }
   OopClosure* strong_oops() { return &_strong._oops; }
 
-  // If MarkWeak is G1MarkPromotedFromRoot then the weak CLDs must be processed in a second pass.
-  CLDClosure* weak_clds()             { return null_if<G1MarkPromotedFromRoot>(&_weak._clds); }
+  CLDClosure* weak_clds()             { return &_weak._clds; }
   CLDClosure* strong_clds()           { return &_strong._clds; }
 
-  // If MarkWeak is G1MarkFromRoot then all CLDs are processed by the weak and strong variants
-  // return a NULL closure for the following specialized versions in that case.
-  CLDClosure* second_pass_weak_clds() { return null_if<G1MarkFromRoot>(&_weak._clds); }
-
   CodeBlobClosure* strong_codeblobs()      { return &_strong._codeblobs; }
   CodeBlobClosure* weak_codeblobs()        { return &_weak._codeblobs; }
 
-  OopClosure* raw_strong_oops() { return &_strong._oops; }
-
   // If we are not marking all weak roots then we are tracing
   // which metadata is alive.
   bool trace_metadata()         { return MarkWeak == G1MarkPromotedFromRoot; }
--- a/src/hotspot/share/gc/g1/g1RootClosures.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/g1/g1RootClosures.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -49,13 +49,6 @@
 
 class G1EvacuationRootClosures : public G1RootClosures {
 public:
-  // Applied to the weakly reachable CLDs when all strongly reachable
-  // CLDs are guaranteed to have been processed.
-  virtual CLDClosure* second_pass_weak_clds() = 0;
-
-  // Get a raw oop closure for processing oops, bypassing the flushing above.
-  virtual OopClosure* raw_strong_oops() = 0;
-
   // Applied to code blobs treated as weak roots.
   virtual CodeBlobClosure* weak_codeblobs() = 0;
 
--- a/src/hotspot/share/gc/g1/g1RootProcessor.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/g1/g1RootProcessor.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -45,7 +45,7 @@
 #include "services/management.hpp"
 #include "utilities/macros.hpp"
 
-void G1RootProcessor::worker_has_discovered_all_strong_classes() {
+void G1RootProcessor::worker_has_discovered_all_strong_nmethods() {
   assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading");
 
   uint new_value = (uint)Atomic::add(1, &_n_workers_discovered_strong_classes);
@@ -56,7 +56,7 @@
   }
 }
 
-void G1RootProcessor::wait_until_all_strong_classes_discovered() {
+void G1RootProcessor::wait_until_all_strong_nmethods_discovered() {
   assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading");
 
   if ((uint)_n_workers_discovered_strong_classes != n_workers()) {
@@ -71,28 +71,22 @@
     _g1h(g1h),
     _process_strong_tasks(G1RP_PS_NumElements),
     _srs(n_workers),
-    _lock(Mutex::leaf, "G1 Root Scanning barrier lock", false, Monitor::_safepoint_check_never),
+    _lock(Mutex::leaf, "G1 Root Scan barrier lock", false, Monitor::_safepoint_check_never),
     _n_workers_discovered_strong_classes(0) {}
 
-void G1RootProcessor::evacuate_roots(G1ParScanThreadState* pss, uint worker_i) {
+void G1RootProcessor::evacuate_roots(G1ParScanThreadState* pss, uint worker_id) {
   G1GCPhaseTimes* phase_times = _g1h->phase_times();
 
-  G1EvacPhaseTimesTracker timer(phase_times, pss, G1GCPhaseTimes::ExtRootScan, worker_i);
+  G1EvacPhaseTimesTracker timer(phase_times, pss, G1GCPhaseTimes::ExtRootScan, worker_id);
 
   G1EvacuationRootClosures* closures = pss->closures();
-  process_java_roots(closures, phase_times, worker_i);
+  process_java_roots(closures, phase_times, worker_id, closures->trace_metadata() /* notify_claimed_nmethods_done */);
 
-  // This is the point where this worker thread will not find more strong CLDs/nmethods.
-  // Report this so G1 can synchronize the strong and weak CLDs/nmethods processing.
-  if (closures->trace_metadata()) {
-    worker_has_discovered_all_strong_classes();
-  }
-
-  process_vm_roots(closures, phase_times, worker_i);
+  process_vm_roots(closures, phase_times, worker_id);
 
   {
     // Now the CM ref_processor roots.
-    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::CMRefRoots, worker_i);
+    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::CMRefRoots, worker_id);
     if (_process_strong_tasks.try_claim_task(G1RP_PS_refProcessor_oops_do)) {
       // We need to treat the discovered reference lists of the
       // concurrent mark ref processor as roots and keep entries
@@ -103,21 +97,9 @@
   }
 
   if (closures->trace_metadata()) {
-    {
-      G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::WaitForStrongCLD, worker_i);
-      // Barrier to make sure all workers passed
-      // the strong CLD and strong nmethods phases.
-      wait_until_all_strong_classes_discovered();
-    }
-
-    // Now take the complement of the strong CLDs.
-    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::WeakCLDRoots, worker_i);
-    assert(closures->second_pass_weak_clds() != NULL, "Should be non-null if we are tracing metadata.");
-    ClassLoaderDataGraph::roots_cld_do(NULL, closures->second_pass_weak_clds());
-  } else {
-    phase_times->record_time_secs(G1GCPhaseTimes::WaitForStrongCLD, worker_i, 0.0);
-    phase_times->record_time_secs(G1GCPhaseTimes::WeakCLDRoots, worker_i, 0.0);
-    assert(closures->second_pass_weak_clds() == NULL, "Should be null if not tracing metadata.");
+    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::WaitForStrongRoots, worker_id);
+    // Wait to make sure all workers passed the strong nmethods phase.
+    wait_until_all_strong_nmethods_discovered();
   }
 
   _process_strong_tasks.all_tasks_completed(n_workers());
@@ -189,61 +171,81 @@
 
 void G1RootProcessor::process_java_roots(G1RootClosures* closures,
                                          G1GCPhaseTimes* phase_times,
-                                         uint worker_i) {
-  // Iterating over the CLDG and the Threads are done early to allow us to
-  // first process the strong CLDs and nmethods and then, after a barrier,
-  // let the thread process the weak CLDs and nmethods.
+                                         uint worker_id,
+                                         bool notify_claimed_nmethods_done) {
+  // We need to make make sure that the "strong" nmethods are processed first
+  // using the strong closure. Only after that we process the weakly reachable
+  // nmethods.
+  // We need to strictly separate the strong and weak nmethod processing because
+  // any processing claims that nmethod, i.e. will not be iterated again.
+  // Which means if an nmethod is processed first and claimed, the strong processing
+  // will not happen, and the oops reachable by that nmethod will not be marked
+  // properly.
+  //
+  // That is why we process strong nmethods first, synchronize all threads via a
+  // barrier, and only then allow weak processing. To minimize the wait time at
+  // that barrier we do the strong nmethod processing first, and immediately after-
+  // wards indicate that that thread is done. Hopefully other root processing after
+  // nmethod processing is enough so there is no need to wait.
+  //
+  // This is only required in the concurrent start pause with class unloading enabled.
   {
-    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::CLDGRoots, worker_i);
-    if (_process_strong_tasks.try_claim_task(G1RP_PS_ClassLoaderDataGraph_oops_do)) {
-      ClassLoaderDataGraph::roots_cld_do(closures->strong_clds(), closures->weak_clds());
-    }
-  }
-
-  {
-    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ThreadRoots, worker_i);
+    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ThreadRoots, worker_id);
     bool is_par = n_workers() > 1;
     Threads::possibly_parallel_oops_do(is_par,
                                        closures->strong_oops(),
                                        closures->strong_codeblobs());
   }
+
+  // This is the point where this worker thread will not find more strong nmethods.
+  // Report this so G1 can synchronize the strong and weak CLDs/nmethods processing.
+  if (notify_claimed_nmethods_done) {
+    worker_has_discovered_all_strong_nmethods();
+  }
+
+  {
+    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::CLDGRoots, worker_id);
+    if (_process_strong_tasks.try_claim_task(G1RP_PS_ClassLoaderDataGraph_oops_do)) {
+      ClassLoaderDataGraph::roots_cld_do(closures->strong_clds(), closures->weak_clds());
+    }
+  }
 }
 
 void G1RootProcessor::process_vm_roots(G1RootClosures* closures,
                                        G1GCPhaseTimes* phase_times,
-                                       uint worker_i) {
+                                       uint worker_id) {
   OopClosure* strong_roots = closures->strong_oops();
 
   {
-    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::UniverseRoots, worker_i);
+    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::UniverseRoots, worker_id);
     if (_process_strong_tasks.try_claim_task(G1RP_PS_Universe_oops_do)) {
       Universe::oops_do(strong_roots);
     }
   }
 
   {
-    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::JNIRoots, worker_i);
+    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::JNIRoots, worker_id);
     if (_process_strong_tasks.try_claim_task(G1RP_PS_JNIHandles_oops_do)) {
       JNIHandles::oops_do(strong_roots);
     }
   }
 
   {
-    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ObjectSynchronizerRoots, worker_i);
+    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ObjectSynchronizerRoots, worker_id);
     if (_process_strong_tasks.try_claim_task(G1RP_PS_ObjectSynchronizer_oops_do)) {
       ObjectSynchronizer::oops_do(strong_roots);
     }
   }
 
   {
-    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ManagementRoots, worker_i);
+    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ManagementRoots, worker_id);
     if (_process_strong_tasks.try_claim_task(G1RP_PS_Management_oops_do)) {
       Management::oops_do(strong_roots);
     }
   }
 
   {
-    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::JVMTIRoots, worker_i);
+    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::JVMTIRoots, worker_id);
     if (_process_strong_tasks.try_claim_task(G1RP_PS_jvmti_oops_do)) {
       JvmtiExport::oops_do(strong_roots);
     }
@@ -251,7 +253,7 @@
 
 #if INCLUDE_AOT
   if (UseAOT) {
-    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::AOTCodeRoots, worker_i);
+    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::AOTCodeRoots, worker_id);
     if (_process_strong_tasks.try_claim_task(G1RP_PS_aot_oops_do)) {
         AOTLoader::oops_do(strong_roots);
     }
@@ -259,7 +261,7 @@
 #endif
 
   {
-    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::SystemDictionaryRoots, worker_i);
+    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::SystemDictionaryRoots, worker_id);
     if (_process_strong_tasks.try_claim_task(G1RP_PS_SystemDictionary_oops_do)) {
       SystemDictionary::oops_do(strong_roots);
     }
@@ -268,7 +270,7 @@
 
 void G1RootProcessor::process_code_cache_roots(CodeBlobClosure* code_closure,
                                                G1GCPhaseTimes* phase_times,
-                                               uint worker_i) {
+                                               uint worker_id) {
   if (_process_strong_tasks.try_claim_task(G1RP_PS_CodeCache_oops_do)) {
     CodeCache::blobs_do(code_closure);
   }
--- a/src/hotspot/share/gc/g1/g1RootProcessor.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/g1/g1RootProcessor.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -69,20 +69,21 @@
     G1RP_PS_NumElements
   };
 
-  void worker_has_discovered_all_strong_classes();
-  void wait_until_all_strong_classes_discovered();
+  void worker_has_discovered_all_strong_nmethods();
+  void wait_until_all_strong_nmethods_discovered();
 
   void process_java_roots(G1RootClosures* closures,
                           G1GCPhaseTimes* phase_times,
-                          uint worker_i);
+                          uint worker_id,
+                          bool notify_claimed_nmethods_done = false);
 
   void process_vm_roots(G1RootClosures* closures,
                         G1GCPhaseTimes* phase_times,
-                        uint worker_i);
+                        uint worker_id);
 
   void process_code_cache_roots(CodeBlobClosure* code_closure,
                                 G1GCPhaseTimes* phase_times,
-                                uint worker_i);
+                                uint worker_id);
 
 public:
   G1RootProcessor(G1CollectedHeap* g1h, uint n_workers);
--- a/src/hotspot/share/gc/g1/g1SharedClosures.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/g1/g1SharedClosures.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -39,9 +39,9 @@
   G1CLDScanClosure                _clds;
   G1CodeBlobClosure               _codeblobs;
 
-  G1SharedClosures(G1CollectedHeap* g1h, G1ParScanThreadState* pss, bool process_only_dirty, int cld_claim) :
+  G1SharedClosures(G1CollectedHeap* g1h, G1ParScanThreadState* pss, bool process_only_dirty) :
     _oops(g1h, pss),
     _oops_in_cld(g1h, pss),
-    _clds(&_oops_in_cld, process_only_dirty, cld_claim),
+    _clds(&_oops_in_cld, process_only_dirty),
     _codeblobs(&_oops) {}
 };
--- a/src/hotspot/share/gc/serial/markSweep.inline.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/serial/markSweep.inline.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -32,6 +32,7 @@
 #include "oops/access.inline.hpp"
 #include "oops/compressedOops.inline.hpp"
 #include "oops/oop.inline.hpp"
+#include "utilities/align.hpp"
 #include "utilities/stack.inline.hpp"
 
 inline void MarkSweep::mark_object(oop obj) {
@@ -87,7 +88,7 @@
            "should be forwarded");
 
     if (new_obj != NULL) {
-      DEBUG_ONLY(Universe::heap()->check_oop_location((HeapWord*)new_obj);)
+      assert(is_object_aligned(new_obj), "oop must be aligned");
       RawAccess<IS_NOT_NULL>::oop_store(p, new_obj);
     }
   }
--- a/src/hotspot/share/gc/shared/barrierSet.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shared/barrierSet.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -144,10 +144,6 @@
 
   virtual void make_parsable(JavaThread* thread) {}
 
-#ifdef CHECK_UNHANDLED_OOPS
-  virtual bool oop_equals_operator_allowed() { return true; }
-#endif
-
 public:
   // Print a description of the memory for the barrier set
   virtual void print_on(outputStream* st) const = 0;
@@ -318,10 +314,6 @@
     static oop resolve(oop obj) {
       return Raw::resolve(obj);
     }
-
-    static bool equals(oop o1, oop o2) {
-      return Raw::equals(o1, o2);
-    }
   };
 };
 
--- a/src/hotspot/share/gc/shared/c1/barrierSetC1.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shared/c1/barrierSetC1.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -100,7 +100,7 @@
   BasicType type() const                 { return _type; }
   LIR_Opr resolved_addr() const          { return _resolved_addr; }
   void set_resolved_addr(LIR_Opr addr)   { _resolved_addr = addr; }
-  bool is_oop() const                    { return _type == T_ARRAY || _type == T_OBJECT; }
+  bool is_oop() const                    { return is_reference_type(_type); }
   DecoratorSet decorators() const        { return _decorators; }
   void clear_decorators(DecoratorSet ds) { _decorators &= ~ds; }
   bool is_raw() const                    { return (_decorators & AS_RAW) != 0; }
--- a/src/hotspot/share/gc/shared/c2/barrierSetC2.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shared/c2/barrierSetC2.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -30,6 +30,7 @@
 #include "opto/idealKit.hpp"
 #include "opto/macro.hpp"
 #include "opto/narrowptrnode.hpp"
+#include "opto/runtime.hpp"
 #include "utilities/macros.hpp"
 
 // By default this is a no-op.
@@ -794,7 +795,29 @@
   return fast_oop;
 }
 
-void BarrierSetC2::clone_barrier_at_expansion(ArrayCopyNode* ac, Node* call, PhaseIterGVN& igvn) const {
-  // no barrier
-  igvn.replace_node(ac, call);
+#define XTOP LP64_ONLY(COMMA phase->top())
+
+void BarrierSetC2::clone_at_expansion(PhaseMacroExpand* phase, ArrayCopyNode* ac) const {
+  Node* ctrl = ac->in(TypeFunc::Control);
+  Node* mem = ac->in(TypeFunc::Memory);
+  Node* src = ac->in(ArrayCopyNode::Src);
+  Node* src_offset = ac->in(ArrayCopyNode::SrcPos);
+  Node* dest = ac->in(ArrayCopyNode::Dest);
+  Node* dest_offset = ac->in(ArrayCopyNode::DestPos);
+  Node* length = ac->in(ArrayCopyNode::Length);
+
+  assert (src_offset == NULL && dest_offset == NULL, "for clone offsets should be null");
+
+  const char* copyfunc_name = "arraycopy";
+  address     copyfunc_addr =
+          phase->basictype2arraycopy(T_LONG, NULL, NULL,
+                              true, copyfunc_name, true);
+
+  const TypePtr* raw_adr_type = TypeRawPtr::BOTTOM;
+  const TypeFunc* call_type = OptoRuntime::fast_arraycopy_Type();
+
+  Node* call = phase->make_leaf_call(ctrl, mem, call_type, copyfunc_addr, copyfunc_name, raw_adr_type, src, dest, length XTOP);
+  phase->transform_later(call);
+
+  phase->igvn().replace_node(ac, call);
 }
--- a/src/hotspot/share/gc/shared/c2/barrierSetC2.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shared/c2/barrierSetC2.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -120,7 +120,7 @@
   Node* base() const              { return _base; }
   C2AccessValuePtr& addr() const  { return _addr; }
   BasicType type() const          { return _type; }
-  bool is_oop() const             { return _type == T_OBJECT || _type == T_ARRAY; }
+  bool is_oop() const             { return is_reference_type(_type); }
   bool is_raw() const             { return (_decorators & AS_RAW) != 0; }
   Node* raw_access() const        { return _raw_access; }
 
@@ -261,7 +261,7 @@
   };
 
   virtual bool array_copy_requires_gc_barriers(bool tightly_coupled_alloc, BasicType type, bool is_clone, ArrayCopyPhase phase) const { return false; }
-  virtual void clone_barrier_at_expansion(ArrayCopyNode* ac, Node* call, PhaseIterGVN& igvn) const;
+  virtual void clone_at_expansion(PhaseMacroExpand* phase, ArrayCopyNode* ac) const;
 
   // Support for GC barriers emitted during parsing
   virtual bool has_load_barriers() const { return false; }
--- a/src/hotspot/share/gc/shared/c2/cardTableBarrierSetC2.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shared/c2/cardTableBarrierSetC2.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -187,6 +187,6 @@
 }
 
 bool CardTableBarrierSetC2::array_copy_requires_gc_barriers(bool tightly_coupled_alloc, BasicType type, bool is_clone, ArrayCopyPhase phase) const {
-  bool is_oop = type == T_OBJECT || type == T_ARRAY;
+  bool is_oop = is_reference_type(type);
   return is_oop && (!tightly_coupled_alloc || !use_ReduceInitialCardMarks());
 }
--- a/src/hotspot/share/gc/shared/collectedHeap.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shared/collectedHeap.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -174,7 +174,7 @@
 }
 
 bool CollectedHeap::is_oop(oop object) const {
-  if (!check_obj_alignment(object)) {
+  if (!is_object_aligned(object)) {
     return false;
   }
 
@@ -343,11 +343,6 @@
 }
 #endif // PRODUCT
 
-void CollectedHeap::check_oop_location(void* addr) const {
-  assert(check_obj_alignment(addr), "address is not aligned");
-  assert(_reserved.contains(addr),  "address is not in reserved heap");
-}
-
 size_t CollectedHeap::max_tlab_size() const {
   // TLABs can't be bigger than we can fill with a int[Integer.MAX_VALUE].
   // This restriction could be removed by enabling filling with multiple arrays.
@@ -376,8 +371,6 @@
 {
   assert(words >= min_fill_size(), "too small to fill");
   assert(is_object_aligned(words), "unaligned size");
-  DEBUG_ONLY(Universe::heap()->check_oop_location(start);)
-  DEBUG_ONLY(Universe::heap()->check_oop_location(start + words - MinObjAlignment);)
 }
 
 void CollectedHeap::zap_filler_array(HeapWord* start, size_t words, bool zap)
--- a/src/hotspot/share/gc/shared/collectedHeap.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shared/collectedHeap.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -233,11 +233,6 @@
 
   DEBUG_ONLY(bool is_in_or_null(const void* p) const { return p == NULL || is_in(p); })
 
-  // This function verifies that "addr" is a valid oop location, w.r.t. heap
-  // datastructures such as bitmaps and virtual memory address. It does *not*
-  // check if the location is within committed heap memory.
-  virtual void check_oop_location(void* addr) const;
-
   virtual uint32_t hash_oop(oop obj) const;
 
   void set_gc_cause(GCCause::Cause v) {
--- a/src/hotspot/share/gc/shared/memAllocator.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shared/memAllocator.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -171,9 +171,8 @@
   // This is a VM policy failure, so how do we exhaustively test it?
   assert(!_thread->has_pending_exception(),
          "shouldn't be allocating with pending exception");
-  // Allocation of an oop can always invoke a safepoint,
-  // hence, the true argument.
-  _thread->check_for_valid_safepoint_state(true);
+  // Allocation of an oop can always invoke a safepoint.
+  _thread->check_for_valid_safepoint_state();
 }
 #endif
 
--- a/src/hotspot/share/gc/shared/referenceProcessor.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shared/referenceProcessor.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -282,7 +282,7 @@
 
   // First _prev_next ref actually points into DiscoveredList (gross).
   oop new_next;
-  if (oopDesc::equals_raw(_next_discovered, _current_discovered)) {
+  if (_next_discovered == _current_discovered) {
     // At the end of the list, we should make _prev point to itself.
     // If _ref is the first ref, then _prev_next will be in the DiscoveredList,
     // and _prev will be NULL.
@@ -472,7 +472,7 @@
 ReferenceProcessor::clear_discovered_references(DiscoveredList& refs_list) {
   oop obj = NULL;
   oop next = refs_list.head();
-  while (!oopDesc::equals_raw(next, obj)) {
+  while (next != obj) {
     obj = next;
     next = java_lang_ref_Reference::discovered(obj);
     java_lang_ref_Reference::set_discovered_raw(obj, NULL);
@@ -744,7 +744,7 @@
         ref_lists[to_idx].inc_length(refs_to_move);
 
         // Remove the chain from the from list.
-        if (oopDesc::equals_raw(move_tail, new_head)) {
+        if (move_tail == new_head) {
           // We found the end of the from list.
           ref_lists[from_idx].set_head(NULL);
         } else {
--- a/src/hotspot/share/gc/shared/referenceProcessor.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shared/referenceProcessor.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -143,13 +143,13 @@
   inline size_t removed() const { return _removed; }
 
   inline void move_to_next() {
-    if (oopDesc::equals_raw(_current_discovered, _next_discovered)) {
+    if (_current_discovered == _next_discovered) {
       // End of the list.
       _current_discovered = NULL;
     } else {
       _current_discovered = _next_discovered;
     }
-    assert(!oopDesc::equals_raw(_current_discovered, _first_seen), "cyclic ref_list found");
+    assert(_current_discovered != _first_seen, "cyclic ref_list found");
     _processed++;
   }
 };
--- a/src/hotspot/share/gc/shared/stringdedup/stringDedupTable.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shared/stringdedup/stringDedupTable.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -363,7 +363,7 @@
   }
 
   typeArrayOop existing_value = lookup_or_add(value, latin1, hash);
-  if (oopDesc::equals_raw(existing_value, value)) {
+  if (existing_value == value) {
     // Same value, already known
     stat->inc_known();
     return;
--- a/src/hotspot/share/gc/shenandoah/c1/shenandoahBarrierSetC1.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/c1/shenandoahBarrierSetC1.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -105,19 +105,21 @@
   __ branch_destination(slow->continuation());
 }
 
-LIR_Opr ShenandoahBarrierSetC1::load_reference_barrier(LIRGenerator* gen, LIR_Opr obj) {
+LIR_Opr ShenandoahBarrierSetC1::load_reference_barrier(LIRGenerator* gen, LIR_Opr obj, LIR_Opr addr) {
   if (ShenandoahLoadRefBarrier) {
-    return load_reference_barrier_impl(gen, obj);
+    return load_reference_barrier_impl(gen, obj, addr);
   } else {
     return obj;
   }
 }
 
-LIR_Opr ShenandoahBarrierSetC1::load_reference_barrier_impl(LIRGenerator* gen, LIR_Opr obj) {
+LIR_Opr ShenandoahBarrierSetC1::load_reference_barrier_impl(LIRGenerator* gen, LIR_Opr obj, LIR_Opr addr) {
   assert(ShenandoahLoadRefBarrier, "Should be enabled");
 
   obj = ensure_in_register(gen, obj);
   assert(obj->is_register(), "must be a register at this point");
+  addr = ensure_in_register(gen, addr);
+  assert(addr->is_register(), "must be a register at this point");
   LIR_Opr result = gen->result_register_for(obj->value_type());
   __ move(obj, result);
   LIR_Opr tmp1 = gen->new_register(T_OBJECT);
@@ -146,7 +148,7 @@
   }
   __ cmp(lir_cond_notEqual, flag_val, LIR_OprFact::intConst(0));
 
-  CodeStub* slow = new ShenandoahLoadReferenceBarrierStub(obj, result, tmp1, tmp2);
+  CodeStub* slow = new ShenandoahLoadReferenceBarrierStub(obj, addr, result, tmp1, tmp2);
   __ branch(lir_cond_notEqual, T_INT, slow);
   __ branch_destination(slow->continuation());
 
@@ -155,10 +157,18 @@
 
 LIR_Opr ShenandoahBarrierSetC1::ensure_in_register(LIRGenerator* gen, LIR_Opr obj) {
   if (!obj->is_register()) {
-    LIR_Opr obj_reg = gen->new_register(T_OBJECT);
+    LIR_Opr obj_reg;
     if (obj->is_constant()) {
+      obj_reg = gen->new_register(T_OBJECT);
       __ move(obj, obj_reg);
     } else {
+#ifdef AARCH64
+      // AArch64 expects double-size register.
+      obj_reg = gen->new_pointer_register();
+#else
+      // x86 expects single-size register.
+      obj_reg = gen->new_register(T_OBJECT);
+#endif
       __ leal(obj, obj_reg);
     }
     obj = obj_reg;
@@ -184,6 +194,14 @@
   BarrierSetC1::store_at_resolved(access, value);
 }
 
+LIR_Opr ShenandoahBarrierSetC1::resolve_address(LIRAccess& access, bool resolve_in_register) {
+  // We must resolve in register when patching. This is to avoid
+  // having a patch area in the load barrier stub, since the call
+  // into the runtime to patch will not have the proper oop map.
+  const bool patch_before_barrier = access.is_oop() && (access.decorators() & C1_NEEDS_PATCHING) != 0;
+  return BarrierSetC1::resolve_address(access, resolve_in_register || patch_before_barrier);
+}
+
 void ShenandoahBarrierSetC1::load_at_resolved(LIRAccess& access, LIR_Opr result) {
   if (!access.is_oop()) {
     BarrierSetC1::load_at_resolved(access, result);
@@ -210,7 +228,7 @@
   if (ShenandoahLoadRefBarrier) {
     LIR_Opr tmp = gen->new_register(T_OBJECT);
     BarrierSetC1::load_at_resolved(access, tmp);
-    tmp = load_reference_barrier(access.gen(), tmp);
+    tmp = load_reference_barrier(access.gen(), tmp, access.resolved_addr());
     __ move(tmp, result);
   } else {
     BarrierSetC1::load_at_resolved(access, result);
--- a/src/hotspot/share/gc/shenandoah/c1/shenandoahBarrierSetC1.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/c1/shenandoahBarrierSetC1.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -89,21 +89,24 @@
   friend class ShenandoahBarrierSetC1;
 private:
   LIR_Opr _obj;
+  LIR_Opr _addr;
   LIR_Opr _result;
   LIR_Opr _tmp1;
   LIR_Opr _tmp2;
 
 public:
-  ShenandoahLoadReferenceBarrierStub(LIR_Opr obj, LIR_Opr result, LIR_Opr tmp1, LIR_Opr tmp2) :
-    _obj(obj), _result(result), _tmp1(tmp1), _tmp2(tmp2)
+  ShenandoahLoadReferenceBarrierStub(LIR_Opr obj, LIR_Opr addr, LIR_Opr result, LIR_Opr tmp1, LIR_Opr tmp2) :
+    _obj(obj), _addr(addr), _result(result), _tmp1(tmp1), _tmp2(tmp2)
   {
     assert(_obj->is_register(), "should be register");
+    assert(_addr->is_register(), "should be register");
     assert(_result->is_register(), "should be register");
     assert(_tmp1->is_register(), "should be register");
     assert(_tmp2->is_register(), "should be register");
   }
 
   LIR_Opr obj() const { return _obj; }
+  LIR_Opr addr() const { return _addr; }
   LIR_Opr result() const { return _result; }
   LIR_Opr tmp1() const { return _tmp1; }
   LIR_Opr tmp2() const { return _tmp2; }
@@ -112,6 +115,9 @@
   virtual void visit(LIR_OpVisitState* visitor) {
     visitor->do_slow_case();
     visitor->do_input(_obj);
+    visitor->do_temp(_obj);
+    visitor->do_input(_addr);
+    visitor->do_temp(_addr);
     visitor->do_temp(_result);
     visitor->do_temp(_tmp1);
     visitor->do_temp(_tmp2);
@@ -186,10 +192,10 @@
 
   void pre_barrier(LIRGenerator* gen, CodeEmitInfo* info, DecoratorSet decorators, LIR_Opr addr_opr, LIR_Opr pre_val);
 
-  LIR_Opr load_reference_barrier(LIRGenerator* gen, LIR_Opr obj);
+  LIR_Opr load_reference_barrier(LIRGenerator* gen, LIR_Opr obj, LIR_Opr addr);
   LIR_Opr storeval_barrier(LIRGenerator* gen, LIR_Opr obj, CodeEmitInfo* info, DecoratorSet decorators);
 
-  LIR_Opr load_reference_barrier_impl(LIRGenerator* gen, LIR_Opr obj);
+  LIR_Opr load_reference_barrier_impl(LIRGenerator* gen, LIR_Opr obj, LIR_Opr addr);
 
   LIR_Opr ensure_in_register(LIRGenerator* gen, LIR_Opr obj);
 
@@ -209,6 +215,7 @@
 protected:
 
   virtual void store_at_resolved(LIRAccess& access, LIR_Opr value);
+  virtual LIR_Opr resolve_address(LIRAccess& access, bool resolve_in_register);
   virtual void load_at_resolved(LIRAccess& access, LIR_Opr result);
 
   virtual LIR_Opr atomic_cmpxchg_at_resolved(LIRAccess& access, LIRItem& cmp_value, LIRItem& new_value);
--- a/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -461,9 +461,11 @@
 }
 
 const TypeFunc* ShenandoahBarrierSetC2::shenandoah_clone_barrier_Type() {
-  const Type **fields = TypeTuple::fields(1);
-  fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // original field value
-  const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+1, fields);
+  const Type **fields = TypeTuple::fields(3);
+  fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // src
+  fields[TypeFunc::Parms+1] = TypeInstPtr::NOTNULL; // dst
+  fields[TypeFunc::Parms+2] = TypeInt::INT; // length
+  const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+3, fields);
 
   // create result type (range)
   fields = TypeTuple::fields(0);
@@ -473,9 +475,11 @@
 }
 
 const TypeFunc* ShenandoahBarrierSetC2::shenandoah_load_reference_barrier_Type() {
-  const Type **fields = TypeTuple::fields(1);
+  const Type **fields = TypeTuple::fields(2);
   fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // original field value
-  const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+1, fields);
+  fields[TypeFunc::Parms+1] = TypeRawPtr::BOTTOM;   // original load address
+
+  const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields);
 
   // create result type (range)
   fields = TypeTuple::fields(1);
@@ -705,11 +709,6 @@
   return result;
 }
 
-void ShenandoahBarrierSetC2::clone(GraphKit* kit, Node* src, Node* dst, Node* size, bool is_array) const {
-  assert(!src->is_AddP(), "unexpected input");
-  BarrierSetC2::clone(kit, src, dst, size, is_array);
-}
-
 // Support for GC barriers emitted during parsing
 bool ShenandoahBarrierSetC2::is_gc_barrier_node(Node* node) const {
   if (node->Opcode() == Op_ShenandoahLoadReferenceBarrier) return true;
@@ -755,7 +754,7 @@
 }
 
 bool ShenandoahBarrierSetC2::array_copy_requires_gc_barriers(bool tightly_coupled_alloc, BasicType type, bool is_clone, ArrayCopyPhase phase) const {
-  bool is_oop = type == T_OBJECT || type == T_ARRAY;
+  bool is_oop = is_reference_type(type);
   if (!is_oop) {
     return false;
   }
@@ -771,9 +770,8 @@
   return true;
 }
 
-bool ShenandoahBarrierSetC2::clone_needs_postbarrier(ArrayCopyNode *ac, PhaseIterGVN& igvn) {
-  Node* src = ac->in(ArrayCopyNode::Src);
-  const TypeOopPtr* src_type = igvn.type(src)->is_oopptr();
+bool ShenandoahBarrierSetC2::clone_needs_barrier(Node* src, PhaseGVN& gvn) {
+  const TypeOopPtr* src_type = gvn.type(src)->is_oopptr();
   if (src_type->isa_instptr() != NULL) {
     ciInstanceKlass* ik = src_type->klass()->as_instance_klass();
     if ((src_type->klass_is_exact() || (!ik->is_interface() && !ik->has_subklass())) && !ik->has_injected_fields()) {
@@ -781,7 +779,7 @@
         return true;
       } else {
         if (!src_type->klass_is_exact()) {
-          igvn.C->dependencies()->assert_leaf_type(ik);
+          Compile::current()->dependencies()->assert_leaf_type(ik);
         }
       }
     } else {
@@ -789,7 +787,7 @@
         }
   } else if (src_type->isa_aryptr()) {
     BasicType src_elem  = src_type->klass()->as_array_klass()->element_type()->basic_type();
-    if (src_elem == T_OBJECT || src_elem == T_ARRAY) {
+    if (is_reference_type(src_elem)) {
       return true;
     }
   } else {
@@ -798,42 +796,29 @@
   return false;
 }
 
-void ShenandoahBarrierSetC2::clone_barrier_at_expansion(ArrayCopyNode* ac, Node* call, PhaseIterGVN& igvn) const {
-  assert(ac->is_clonebasic(), "no other kind of arraycopy here");
+#define XTOP LP64_ONLY(COMMA phase->top())
 
-  if (!clone_needs_postbarrier(ac, igvn)) {
-    BarrierSetC2::clone_barrier_at_expansion(ac, call, igvn);
-    return;
-  }
-
-  const TypePtr* raw_adr_type = TypeRawPtr::BOTTOM;
-  Node* c = new ProjNode(call,TypeFunc::Control);
-  c = igvn.transform(c);
-  Node* m = new ProjNode(call, TypeFunc::Memory);
-  m = igvn.transform(m);
-
+void ShenandoahBarrierSetC2::clone_at_expansion(PhaseMacroExpand* phase, ArrayCopyNode* ac) const {
+  Node* ctrl = ac->in(TypeFunc::Control);
+  Node* mem = ac->in(TypeFunc::Memory);
+  Node* src = ac->in(ArrayCopyNode::Src);
+  Node* src_offset = ac->in(ArrayCopyNode::SrcPos);
   Node* dest = ac->in(ArrayCopyNode::Dest);
-  assert(dest->is_AddP(), "bad input");
-  Node* barrier_call = new CallLeafNode(ShenandoahBarrierSetC2::shenandoah_clone_barrier_Type(),
-                                        CAST_FROM_FN_PTR(address, ShenandoahRuntime::shenandoah_clone_barrier),
-                                        "shenandoah_clone_barrier", raw_adr_type);
-  barrier_call->init_req(TypeFunc::Control, c);
-  barrier_call->init_req(TypeFunc::I_O    , igvn.C->top());
-  barrier_call->init_req(TypeFunc::Memory , m);
-  barrier_call->init_req(TypeFunc::ReturnAdr, igvn.C->top());
-  barrier_call->init_req(TypeFunc::FramePtr, igvn.C->top());
-  barrier_call->init_req(TypeFunc::Parms+0, dest->in(AddPNode::Base));
-
-  barrier_call = igvn.transform(barrier_call);
-  c = new ProjNode(barrier_call,TypeFunc::Control);
-  c = igvn.transform(c);
-  m = new ProjNode(barrier_call, TypeFunc::Memory);
-  m = igvn.transform(m);
-
-  Node* out_c = ac->proj_out(TypeFunc::Control);
-  Node* out_m = ac->proj_out(TypeFunc::Memory);
-  igvn.replace_node(out_c, c);
-  igvn.replace_node(out_m, m);
+  Node* dest_offset = ac->in(ArrayCopyNode::DestPos);
+  Node* length = ac->in(ArrayCopyNode::Length);
+  assert (src_offset == NULL && dest_offset == NULL, "for clone offsets should be null");
+  if (ShenandoahCloneBarrier && clone_needs_barrier(src, phase->igvn())) {
+    Node* call = phase->make_leaf_call(ctrl, mem,
+                    ShenandoahBarrierSetC2::shenandoah_clone_barrier_Type(),
+                    CAST_FROM_FN_PTR(address, ShenandoahRuntime::shenandoah_clone_barrier),
+                    "shenandoah_clone",
+                    TypeRawPtr::BOTTOM,
+                    src, dest, length);
+    call = phase->transform_later(call);
+    phase->igvn().replace_node(ac, call);
+  } else {
+    BarrierSetC2::clone_at_expansion(phase, ac);
+  }
 }
 
 
--- a/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -78,7 +78,7 @@
   void insert_pre_barrier(GraphKit* kit, Node* base_oop, Node* offset,
                           Node* pre_val, bool need_mem_bar) const;
 
-  static bool clone_needs_postbarrier(ArrayCopyNode *ac, PhaseIterGVN& igvn);
+  static bool clone_needs_barrier(Node* src, PhaseGVN& gvn);
 
 protected:
   virtual Node* load_at_resolved(C2Access& access, const Type* val_type) const;
@@ -106,11 +106,10 @@
   virtual bool has_load_barriers() const { return true; }
 
   // This is the entry-point for the backend to perform accesses through the Access API.
-  virtual void clone(GraphKit* kit, Node* src, Node* dst, Node* size, bool is_array) const;
+  virtual void clone_at_expansion(PhaseMacroExpand* phase, ArrayCopyNode* ac) const;
 
   // These are general helper methods used by C2
   virtual bool array_copy_requires_gc_barriers(bool tightly_coupled_alloc, BasicType type, bool is_clone, ArrayCopyPhase phase) const;
-  virtual void clone_barrier_at_expansion(ArrayCopyNode* ac, Node* call, PhaseIterGVN& igvn) const;
 
   // Support for GC barriers emitted during parsing
   virtual bool is_gc_barrier_node(Node* node) const;
--- a/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1016,7 +1016,7 @@
   phase->register_control(ctrl, loop, in_cset_fast_test_iff);
 }
 
-void ShenandoahBarrierC2Support::call_lrb_stub(Node*& ctrl, Node*& val, Node*& result_mem, Node* raw_mem, bool is_native, PhaseIdealLoop* phase) {
+void ShenandoahBarrierC2Support::call_lrb_stub(Node*& ctrl, Node*& val, Node* load_addr, Node*& result_mem, Node* raw_mem, bool is_native, PhaseIdealLoop* phase) {
   IdealLoopTree*loop = phase->get_loop(ctrl);
   const TypePtr* obj_type = phase->igvn().type(val)->is_oopptr()->cast_to_nonconst();
 
@@ -1027,16 +1027,22 @@
   mm->set_memory_at(Compile::AliasIdxRaw, raw_mem);
   phase->register_new_node(mm, ctrl);
 
+  address target = LP64_ONLY(UseCompressedOops) NOT_LP64(false) ?
+          CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier_fixup_narrow) :
+          CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier_fixup);
+
   address calladdr = is_native ? CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier_native)
-                               : CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier);
+                               : target;
   const char* name = is_native ? "oop_load_from_native_barrier" : "load_reference_barrier";
   Node* call = new CallLeafNode(ShenandoahBarrierSetC2::shenandoah_load_reference_barrier_Type(), calladdr, name, TypeRawPtr::BOTTOM);
+
   call->init_req(TypeFunc::Control, ctrl);
   call->init_req(TypeFunc::I_O, phase->C->top());
   call->init_req(TypeFunc::Memory, mm);
   call->init_req(TypeFunc::FramePtr, phase->C->top());
   call->init_req(TypeFunc::ReturnAdr, phase->C->top());
   call->init_req(TypeFunc::Parms, val);
+  call->init_req(TypeFunc::Parms+1, load_addr);
   phase->register_control(call, loop, ctrl);
   ctrl = new ProjNode(call, TypeFunc::Control);
   phase->register_control(ctrl, loop, call);
@@ -1401,7 +1407,7 @@
     assert(val->bottom_type()->make_oopptr(), "need oop");
     assert(val->bottom_type()->make_oopptr()->const_oop() == NULL, "expect non-constant");
 
-    enum { _heap_stable = 1, _not_cset, _fwded, _evac_path, _null_path, PATH_LIMIT };
+    enum { _heap_stable = 1, _not_cset, _evac_path, _null_path, PATH_LIMIT };
     Node* region = new RegionNode(PATH_LIMIT);
     Node* val_phi = new PhiNode(region, uncasted_val->bottom_type()->is_oopptr());
     Node* raw_mem_phi = PhiNode::make(region, raw_mem, Type::MEMORY, TypeRawPtr::BOTTOM);
@@ -1451,49 +1457,44 @@
       IfNode* iff = unc_ctrl->in(0)->as_If();
       phase->igvn().replace_input_of(iff, 1, phase->igvn().intcon(1));
     }
-    Node* addr = new AddPNode(new_val, uncasted_val, phase->igvn().MakeConX(oopDesc::mark_offset_in_bytes()));
-    phase->register_new_node(addr, ctrl);
-    assert(new_val->bottom_type()->isa_oopptr(), "what else?");
-    Node* markword = new LoadXNode(ctrl, raw_mem, addr, TypeRawPtr::BOTTOM, TypeX_X, MemNode::unordered);
-    phase->register_new_node(markword, ctrl);
-
-    // Test if object is forwarded. This is the case if lowest two bits are set.
-    Node* masked = new AndXNode(markword, phase->igvn().MakeConX(markWord::lock_mask_in_place));
-    phase->register_new_node(masked, ctrl);
-    Node* cmp = new CmpXNode(masked, phase->igvn().MakeConX(markWord::marked_value));
-    phase->register_new_node(cmp, ctrl);
-
-    // Only branch to LRB stub if object is not forwarded; otherwise reply with fwd ptr
-    Node* bol = new BoolNode(cmp, BoolTest::eq); // Equals 3 means it's forwarded
-    phase->register_new_node(bol, ctrl);
-
-    IfNode* iff = new IfNode(ctrl, bol, PROB_LIKELY(0.999), COUNT_UNKNOWN);
-    phase->register_control(iff, loop, ctrl);
-    Node* if_fwd = new IfTrueNode(iff);
-    phase->register_control(if_fwd, loop, iff);
-    Node* if_not_fwd = new IfFalseNode(iff);
-    phase->register_control(if_not_fwd, loop, iff);
-
-    // Decode forward pointer: since we already have the lowest bits, we can just subtract them
-    // from the mark word without the need for large immediate mask.
-    Node* masked2 = new SubXNode(markword, masked);
-    phase->register_new_node(masked2, if_fwd);
-    Node* fwdraw = new CastX2PNode(masked2);
-    fwdraw->init_req(0, if_fwd);
-    phase->register_new_node(fwdraw, if_fwd);
-    Node* fwd = new CheckCastPPNode(NULL, fwdraw, val->bottom_type());
-    phase->register_new_node(fwd, if_fwd);
-
-    // Wire up not-equal-path in slots 3.
-    region->init_req(_fwded, if_fwd);
-    val_phi->init_req(_fwded, fwd);
-    raw_mem_phi->init_req(_fwded, raw_mem);
 
     // Call lrb-stub and wire up that path in slots 4
     Node* result_mem = NULL;
-    ctrl = if_not_fwd;
-    fwd = new_val;
-    call_lrb_stub(ctrl, fwd, result_mem, raw_mem, lrb->is_native(), phase);
+
+    Node* fwd = new_val;
+    Node* addr;
+    if (ShenandoahSelfFixing) {
+      VectorSet visited(Thread::current()->resource_area());
+      addr = get_load_addr(phase, visited, lrb);
+    } else {
+      addr = phase->igvn().zerocon(T_OBJECT);
+    }
+    if (addr->Opcode() == Op_AddP) {
+      Node* orig_base = addr->in(AddPNode::Base);
+      Node* base = new CheckCastPPNode(ctrl, orig_base, orig_base->bottom_type(), true);
+      phase->register_new_node(base, ctrl);
+      if (addr->in(AddPNode::Base) == addr->in((AddPNode::Address))) {
+        // Field access
+        addr = addr->clone();
+        addr->set_req(AddPNode::Base, base);
+        addr->set_req(AddPNode::Address, base);
+        phase->register_new_node(addr, ctrl);
+      } else {
+        Node* addr2 = addr->in(AddPNode::Address);
+        if (addr2->Opcode() == Op_AddP && addr2->in(AddPNode::Base) == addr2->in(AddPNode::Address) &&
+              addr2->in(AddPNode::Base) == orig_base) {
+          addr2 = addr2->clone();
+          addr2->set_req(AddPNode::Base, base);
+          addr2->set_req(AddPNode::Address, base);
+          phase->register_new_node(addr2, ctrl);
+          addr = addr->clone();
+          addr->set_req(AddPNode::Base, base);
+          addr->set_req(AddPNode::Address, addr2);
+          phase->register_new_node(addr, ctrl);
+        }
+      }
+    }
+    call_lrb_stub(ctrl, fwd, addr, result_mem, raw_mem, lrb->is_native(), phase);
     region->init_req(_evac_path, ctrl);
     val_phi->init_req(_evac_path, fwd);
     raw_mem_phi->init_req(_evac_path, result_mem);
@@ -1696,6 +1697,74 @@
 
 }
 
+Node* ShenandoahBarrierC2Support::get_load_addr(PhaseIdealLoop* phase, VectorSet& visited, Node* in) {
+  if (visited.test_set(in->_idx)) {
+    return NULL;
+  }
+  switch (in->Opcode()) {
+    case Op_Proj:
+      return get_load_addr(phase, visited, in->in(0));
+    case Op_CastPP:
+    case Op_CheckCastPP:
+    case Op_DecodeN:
+    case Op_EncodeP:
+      return get_load_addr(phase, visited, in->in(1));
+    case Op_LoadN:
+    case Op_LoadP:
+      return in->in(MemNode::Address);
+    case Op_CompareAndExchangeN:
+    case Op_CompareAndExchangeP:
+    case Op_GetAndSetN:
+    case Op_GetAndSetP:
+    case Op_ShenandoahCompareAndExchangeP:
+    case Op_ShenandoahCompareAndExchangeN:
+      // Those instructions would just have stored a different
+      // value into the field. No use to attempt to fix it at this point.
+      return phase->igvn().zerocon(T_OBJECT);
+    case Op_CMoveP:
+    case Op_CMoveN: {
+      Node* t = get_load_addr(phase, visited, in->in(CMoveNode::IfTrue));
+      Node* f = get_load_addr(phase, visited, in->in(CMoveNode::IfFalse));
+      // Handle unambiguous cases: single address reported on both branches.
+      if (t != NULL && f == NULL) return t;
+      if (t == NULL && f != NULL) return f;
+      if (t != NULL && t == f)    return t;
+      // Ambiguity.
+      return phase->igvn().zerocon(T_OBJECT);
+    }
+    case Op_Phi: {
+      Node* addr = NULL;
+      for (uint i = 1; i < in->req(); i++) {
+        Node* addr1 = get_load_addr(phase, visited, in->in(i));
+        if (addr == NULL) {
+          addr = addr1;
+        }
+        if (addr != addr1) {
+          return phase->igvn().zerocon(T_OBJECT);
+        }
+      }
+      return addr;
+    }
+    case Op_ShenandoahLoadReferenceBarrier:
+      return get_load_addr(phase, visited, in->in(ShenandoahLoadReferenceBarrierNode::ValueIn));
+    case Op_ShenandoahEnqueueBarrier:
+      return get_load_addr(phase, visited, in->in(1));
+    case Op_CallDynamicJava:
+    case Op_CallLeaf:
+    case Op_CallStaticJava:
+    case Op_ConN:
+    case Op_ConP:
+    case Op_Parm:
+      return phase->igvn().zerocon(T_OBJECT);
+    default:
+#ifdef ASSERT
+      fatal("Unknown node in get_load_addr: %s", NodeClassNames[in->Opcode()]);
+#endif
+      return phase->igvn().zerocon(T_OBJECT);
+  }
+
+}
+
 void ShenandoahBarrierC2Support::move_heap_stable_test_out_of_loop(IfNode* iff, PhaseIdealLoop* phase) {
   IdealLoopTree *loop = phase->get_loop(iff);
   Node* loop_head = loop->_head;
--- a/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -60,7 +60,7 @@
   static void test_null(Node*& ctrl, Node* val, Node*& null_ctrl, PhaseIdealLoop* phase);
   static void test_heap_stable(Node*& ctrl, Node* raw_mem, Node*& heap_stable_ctrl,
                                PhaseIdealLoop* phase);
-  static void call_lrb_stub(Node*& ctrl, Node*& val, Node*& result_mem, Node* raw_mem, bool is_native, PhaseIdealLoop* phase);
+  static void call_lrb_stub(Node*& ctrl, Node*& val, Node* load_addr, Node*& result_mem, Node* raw_mem, bool is_native, PhaseIdealLoop* phase);
   static Node* clone_null_check(Node*& c, Node* val, Node* unc_ctrl, PhaseIdealLoop* phase);
   static void fix_null_check(Node* unc, Node* unc_ctrl, Node* new_unc_ctrl, Unique_Node_List& uses,
                              PhaseIdealLoop* phase);
@@ -71,6 +71,7 @@
   static void fix_ctrl(Node* barrier, Node* region, const MemoryGraphFixer& fixer, Unique_Node_List& uses, Unique_Node_List& uses_to_ignore, uint last, PhaseIdealLoop* phase);
   static IfNode* find_unswitching_candidate(const IdealLoopTree *loop, PhaseIdealLoop* phase);
 
+  static Node* get_load_addr(PhaseIdealLoop* phase, VectorSet& visited, Node* lrb);
 public:
   static bool is_dominator(Node* d_c, Node* n_c, Node* d, Node* n, PhaseIdealLoop* phase);
   static bool is_dominator_same_ctrl(Node* c, Node* d, Node* n, PhaseIdealLoop* phase);
--- a/src/hotspot/share/gc/shenandoah/shenandoahAsserts.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahAsserts.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -142,7 +142,7 @@
   if (level >= _safe_oop) {
     oop fwd = (oop) ShenandoahForwarding::get_forwardee_raw_unchecked(obj);
     msg.append("Forwardee:\n");
-    if (!oopDesc::equals_raw(obj, fwd)) {
+    if (obj != fwd) {
       if (level >= _safe_oop_fwd) {
         print_obj(msg, fwd);
       } else {
@@ -157,7 +157,7 @@
   if (level >= _safe_oop_fwd) {
     oop fwd = (oop) ShenandoahForwarding::get_forwardee_raw_unchecked(obj);
     oop fwd2 = (oop) ShenandoahForwarding::get_forwardee_raw_unchecked(fwd);
-    if (!oopDesc::equals_raw(fwd, fwd2)) {
+    if (fwd != fwd2) {
       msg.append("Second forwardee:\n");
       print_obj_safe(msg, fwd2);
       msg.append("\n");
@@ -203,7 +203,7 @@
 
   oop fwd = oop(ShenandoahForwarding::get_forwardee_raw_unchecked(obj));
 
-  if (!oopDesc::equals_raw(obj, fwd)) {
+  if (obj != fwd) {
     // When Full GC moves the objects, we cannot trust fwdptrs. If we got here, it means something
     // tries fwdptr manipulation when Full GC is running. The only exception is using the fwdptr
     // that still points to the object itself.
@@ -235,7 +235,7 @@
 
     // Step 4. Check for multiple forwardings
     oop fwd2 = oop(ShenandoahForwarding::get_forwardee_raw_unchecked(fwd));
-    if (!oopDesc::equals_raw(fwd, fwd2)) {
+    if (fwd != fwd2) {
       print_failure(_safe_all, obj, interior_loc, NULL, "Shenandoah assert_correct failed",
                     "Multiple forwardings",
                     file, line);
@@ -278,7 +278,7 @@
   assert_correct(interior_loc, obj, file, line);
   oop fwd = oop(ShenandoahForwarding::get_forwardee_raw_unchecked(obj));
 
-  if (oopDesc::equals_raw(obj, fwd)) {
+  if (obj == fwd) {
     print_failure(_safe_all, obj, interior_loc, NULL, "Shenandoah assert_forwarded failed",
                   "Object should be forwarded",
                   file, line);
@@ -289,7 +289,7 @@
   assert_correct(interior_loc, obj, file, line);
   oop fwd = oop(ShenandoahForwarding::get_forwardee_raw_unchecked(obj));
 
-  if (!oopDesc::equals_raw(obj, fwd)) {
+  if (obj != fwd) {
     print_failure(_safe_all, obj, interior_loc, NULL, "Shenandoah assert_not_forwarded failed",
                   "Object should not be forwarded",
                   file, line);
--- a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -41,33 +41,6 @@
 class ShenandoahBarrierSetC1;
 class ShenandoahBarrierSetC2;
 
-template <bool STOREVAL_EVAC_BARRIER>
-class ShenandoahUpdateRefsForOopClosure: public BasicOopIterateClosure {
-private:
-  ShenandoahHeap* _heap;
-  ShenandoahBarrierSet* _bs;
-
-  template <class T>
-  inline void do_oop_work(T* p) {
-    oop o;
-    if (STOREVAL_EVAC_BARRIER) {
-      o = _heap->evac_update_with_forwarded(p);
-      if (!CompressedOops::is_null(o)) {
-        _bs->enqueue(o);
-      }
-    } else {
-      _heap->maybe_update_with_forwarded(p);
-    }
-  }
-public:
-  ShenandoahUpdateRefsForOopClosure() : _heap(ShenandoahHeap::heap()), _bs(ShenandoahBarrierSet::barrier_set()) {
-    assert(UseShenandoahGC && ShenandoahCloneBarrier, "should be enabled");
-  }
-
-  virtual void do_oop(oop* p)       { do_oop_work(p); }
-  virtual void do_oop(narrowOop* p) { do_oop_work(p); }
-};
-
 ShenandoahBarrierSet::ShenandoahBarrierSet(ShenandoahHeap* heap) :
   BarrierSet(make_barrier_set_assembler<ShenandoahBarrierSetAssembler>(),
              make_barrier_set_c1<ShenandoahBarrierSetC1>(),
@@ -97,73 +70,6 @@
   return true;
 }
 
-template <class T, bool STOREVAL_EVAC_BARRIER>
-void ShenandoahBarrierSet::write_ref_array_loop(HeapWord* start, size_t count) {
-  assert(UseShenandoahGC && ShenandoahCloneBarrier, "should be enabled");
-  ShenandoahUpdateRefsForOopClosure<STOREVAL_EVAC_BARRIER> cl;
-  T* dst = (T*) start;
-  for (size_t i = 0; i < count; i++) {
-    cl.do_oop(dst++);
-  }
-}
-
-void ShenandoahBarrierSet::write_ref_array(HeapWord* start, size_t count) {
-  assert(_heap->is_update_refs_in_progress(), "should not be here otherwise");
-  assert(count > 0, "Should have been filtered before");
-
-  if (_heap->is_concurrent_traversal_in_progress()) {
-    ShenandoahEvacOOMScope oom_evac_scope;
-    if (UseCompressedOops) {
-      write_ref_array_loop<narrowOop, /* evac = */ true>(start, count);
-    } else {
-      write_ref_array_loop<oop,       /* evac = */ true>(start, count);
-    }
-  } else {
-    if (UseCompressedOops) {
-      write_ref_array_loop<narrowOop, /* evac = */ false>(start, count);
-    } else {
-      write_ref_array_loop<oop,       /* evac = */ false>(start, count);
-    }
-  }
-}
-
-template <class T>
-void ShenandoahBarrierSet::write_ref_array_pre_work(T* dst, size_t count) {
-  shenandoah_assert_not_in_cset_loc_except(dst, _heap->cancelled_gc());
-  assert(ShenandoahThreadLocalData::satb_mark_queue(Thread::current()).is_active(), "Shouldn't be here otherwise");
-  assert(ShenandoahSATBBarrier, "Shouldn't be here otherwise");
-  assert(count > 0, "Should have been filtered before");
-
-  Thread* thread = Thread::current();
-  ShenandoahMarkingContext* ctx = _heap->marking_context();
-  bool has_forwarded = _heap->has_forwarded_objects();
-  T* elem_ptr = dst;
-  for (size_t i = 0; i < count; i++, elem_ptr++) {
-    T heap_oop = RawAccess<>::oop_load(elem_ptr);
-    if (!CompressedOops::is_null(heap_oop)) {
-      oop obj = CompressedOops::decode_not_null(heap_oop);
-      if (has_forwarded) {
-        obj = resolve_forwarded_not_null(obj);
-      }
-      if (!ctx->is_marked(obj)) {
-        ShenandoahThreadLocalData::satb_mark_queue(thread).enqueue_known_active(obj);
-      }
-    }
-  }
-}
-
-void ShenandoahBarrierSet::write_ref_array_pre(oop* dst, size_t count, bool dest_uninitialized) {
-  if (! dest_uninitialized) {
-    write_ref_array_pre_work(dst, count);
-  }
-}
-
-void ShenandoahBarrierSet::write_ref_array_pre(narrowOop* dst, size_t count, bool dest_uninitialized) {
-  if (! dest_uninitialized) {
-    write_ref_array_pre_work(dst, count);
-  }
-}
-
 template <class T>
 inline void ShenandoahBarrierSet::inline_write_ref_field_pre(T* field, oop new_val) {
   shenandoah_assert_not_in_cset_loc_except(field, _heap->cancelled_gc());
@@ -194,27 +100,6 @@
   shenandoah_assert_not_in_cset_except    (v, o, o == NULL || _heap->cancelled_gc() || !_heap->is_concurrent_mark_in_progress());
 }
 
-void ShenandoahBarrierSet::write_region(MemRegion mr) {
-  if (!ShenandoahCloneBarrier) return;
-  if (!_heap->is_update_refs_in_progress()) return;
-
-  // This is called for cloning an object (see jvm.cpp) after the clone
-  // has been made. We are not interested in any 'previous value' because
-  // it would be NULL in any case. But we *are* interested in any oop*
-  // that potentially need to be updated.
-
-  oop obj = oop(mr.start());
-  shenandoah_assert_correct(NULL, obj);
-  if (_heap->is_concurrent_traversal_in_progress()) {
-    ShenandoahEvacOOMScope oom_evac_scope;
-    ShenandoahUpdateRefsForOopClosure</* evac = */ true> cl;
-    obj->oop_iterate(&cl);
-  } else {
-    ShenandoahUpdateRefsForOopClosure</* evac = */ false> cl;
-    obj->oop_iterate(&cl);
-  }
-}
-
 oop ShenandoahBarrierSet::load_reference_barrier_not_null(oop obj) {
   if (ShenandoahLoadRefBarrier && _heap->has_forwarded_objects()) {
     return load_reference_barrier_impl(obj);
@@ -231,14 +116,24 @@
   }
 }
 
+oop ShenandoahBarrierSet::load_reference_barrier_mutator(oop obj, oop* load_addr) {
+  return load_reference_barrier_mutator_work(obj, load_addr);
+}
 
-oop ShenandoahBarrierSet::load_reference_barrier_mutator(oop obj) {
+oop ShenandoahBarrierSet::load_reference_barrier_mutator(oop obj, narrowOop* load_addr) {
+  return load_reference_barrier_mutator_work(obj, load_addr);
+}
+
+template <class T>
+oop ShenandoahBarrierSet::load_reference_barrier_mutator_work(oop obj, T* load_addr) {
   assert(ShenandoahLoadRefBarrier, "should be enabled");
-  assert(_heap->is_gc_in_progress_mask(ShenandoahHeap::EVACUATION | ShenandoahHeap::TRAVERSAL), "evac should be in progress");
-  shenandoah_assert_in_cset(NULL, obj);
+  shenandoah_assert_in_cset(load_addr, obj);
 
   oop fwd = resolve_forwarded_not_null(obj);
-  if (oopDesc::equals_raw(obj, fwd)) {
+  if (obj == fwd) {
+    assert(_heap->is_gc_in_progress_mask(ShenandoahHeap::EVACUATION | ShenandoahHeap::TRAVERSAL),
+           "evac should be in progress");
+
     ShenandoahEvacOOMScope oom_evac_scope;
 
     Thread* thread = Thread::current();
@@ -267,15 +162,21 @@
       size_t count = 0;
       while ((cur < r->top()) && ctx->is_marked(oop(cur)) && (count++ < max)) {
         oop cur_oop = oop(cur);
-        if (oopDesc::equals_raw(cur_oop, resolve_forwarded_not_null(cur_oop))) {
+        if (cur_oop == resolve_forwarded_not_null(cur_oop)) {
           _heap->evacuate_object(cur_oop, thread);
         }
         cur = cur + cur_oop->size();
       }
     }
 
-    return res_oop;
+    fwd = res_oop;
   }
+
+  if (load_addr != NULL && fwd != obj) {
+    // Since we are here and we know the load address, update the reference.
+    ShenandoahHeap::cas_oop(fwd, load_addr, obj);
+  }
+
   return fwd;
 }
 
@@ -286,7 +187,7 @@
     oop fwd = resolve_forwarded_not_null(obj);
     if (evac_in_progress &&
         _heap->in_collection_set(obj) &&
-        oopDesc::equals_raw(obj, fwd)) {
+        obj == fwd) {
       Thread *t = Thread::current();
       if (t->is_GC_task_thread()) {
         return _heap->evacuate_object(obj, t);
@@ -365,9 +266,19 @@
     return NULL;
   }
 
-  if (_heap->is_evacuation_in_progress() &&
-      !_heap->complete_marking_context()->is_marked(obj)) {
-    return NULL;
+  ShenandoahMarkingContext* const marking_context = _heap->marking_context();
+
+  if (_heap->is_evacuation_in_progress()) {
+    // Normal GC
+    if (!marking_context->is_marked(obj)) {
+      return NULL;
+    }
+  } else if (_heap->is_concurrent_traversal_in_progress()) {
+    // Traversal GC
+    if (marking_context->is_complete() &&
+        !marking_context->is_marked(resolve_forwarded_not_null(obj))) {
+      return NULL;
+    }
   }
 
   return load_reference_barrier_not_null(obj);
--- a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -63,14 +63,14 @@
 
   bool is_aligned(HeapWord* hw);
 
-  void write_ref_array(HeapWord* start, size_t count);
+  template <class T> void
+  write_ref_array_pre_work(T* src, T* dst, size_t count, bool dest_uninitialized);
 
-  template <class T> void
-  write_ref_array_pre_work(T* dst, size_t count);
-
-  void write_ref_array_pre(oop* dst, size_t count, bool dest_uninitialized);
-
-  void write_ref_array_pre(narrowOop* dst, size_t count, bool dest_uninitialized);
+  inline void arraycopy_pre(oop* src, oop* dst, size_t count);
+  inline void arraycopy_pre(narrowOop* src, narrowOop* dst, size_t count);
+  inline void arraycopy_update(oop* src, size_t count);
+  inline void arraycopy_update(narrowOop* src, size_t count);
+  inline void clone_barrier(oop src);
 
   // We export this to make it available in cases where the static
   // type of the barrier set is known.  Note that it is non-virtual.
@@ -82,7 +82,6 @@
   void write_ref_field_pre_work(void* field, oop new_val);
 
   void write_ref_field_work(void* v, oop o, bool release = false);
-  void write_region(MemRegion mr);
 
   oop oop_load_from_native_barrier(oop obj);
 
@@ -98,14 +97,23 @@
   void keep_alive_barrier(oop obj);
 
   oop load_reference_barrier(oop obj);
-  oop load_reference_barrier_mutator(oop obj);
   oop load_reference_barrier_not_null(oop obj);
 
+  oop load_reference_barrier_mutator(oop obj, oop* load_addr);
+  oop load_reference_barrier_mutator(oop obj, narrowOop* load_addr);
+
+  template <class T>
+  oop load_reference_barrier_mutator_work(oop obj, T* load_addr);
+
   void enqueue(oop obj);
 
 private:
-  template <class T, bool STOREVAL_WRITE_BARRIER>
-  void write_ref_array_loop(HeapWord* start, size_t count);
+  template <class T>
+  inline void arraycopy_pre_work(T* src, T* dst, size_t count);
+  template <class T, bool HAS_FWD, bool EVAC, bool ENQUEUE>
+  inline void arraycopy_work(T* src, size_t count);
+  template <class T>
+  inline void arraycopy_update_impl(T* src, size_t count);
 
   oop load_reference_barrier_impl(oop obj);
 
@@ -118,24 +126,6 @@
     }
   }
 
-  template <typename T>
-  bool arraycopy_loop_1(T* src, T* dst, size_t length, Klass* bound,
-                        bool checkcast, bool satb, bool disjoint, ShenandoahBarrierSet::ArrayCopyStoreValMode storeval_mode);
-
-  template <typename T, bool CHECKCAST>
-  bool arraycopy_loop_2(T* src, T* dst, size_t length, Klass* bound,
-                        bool satb, bool disjoint, ShenandoahBarrierSet::ArrayCopyStoreValMode storeval_mode);
-
-  template <typename T, bool CHECKCAST, bool SATB>
-  bool arraycopy_loop_3(T* src, T* dst, size_t length, Klass* bound,
-                        bool disjoint, ShenandoahBarrierSet::ArrayCopyStoreValMode storeval_mode);
-
-  template <typename T, bool CHECKCAST, bool SATB, ShenandoahBarrierSet::ArrayCopyStoreValMode STOREVAL_MODE>
-  bool arraycopy_loop(T* src, T* dst, size_t length, Klass* bound, bool disjoint);
-
-  template <typename T, bool CHECKCAST, bool SATB, ShenandoahBarrierSet::ArrayCopyStoreValMode STOREVAL_MODE>
-  bool arraycopy_element(T* cur_src, T* cur_dst, Klass* bound, Thread* const thread, ShenandoahMarkingContext* const ctx);
-
 public:
   // Callbacks for runtime accesses.
   template <DecoratorSet decorators, typename BarrierSetT = ShenandoahBarrierSet>
--- a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -27,11 +27,14 @@
 #include "gc/shared/barrierSet.hpp"
 #include "gc/shenandoah/shenandoahAsserts.hpp"
 #include "gc/shenandoah/shenandoahBarrierSet.hpp"
+#include "gc/shenandoah/shenandoahCollectionSet.inline.hpp"
 #include "gc/shenandoah/shenandoahForwarding.inline.hpp"
 #include "gc/shenandoah/shenandoahHeap.inline.hpp"
 #include "gc/shenandoah/shenandoahHeapRegion.hpp"
 #include "gc/shenandoah/shenandoahMarkingContext.inline.hpp"
 #include "gc/shenandoah/shenandoahThreadLocalData.hpp"
+#include "memory/iterator.inline.hpp"
+#include "oops/oop.inline.hpp"
 
 inline oop ShenandoahBarrierSet::resolve_forwarded_not_null(oop p) {
   return ShenandoahForwarding::get_forwardee(p);
@@ -103,7 +106,7 @@
     compare_value = expected;
     res = Raw::oop_atomic_cmpxchg(new_value, addr, compare_value);
     expected = res;
-  } while ((! oopDesc::equals_raw(compare_value, expected)) && oopDesc::equals_raw(resolve_forwarded(compare_value), resolve_forwarded(expected)));
+  } while ((compare_value != expected) && (resolve_forwarded(compare_value) == resolve_forwarded(expected)));
   if (res != NULL) {
     return ShenandoahBarrierSet::barrier_set()->load_reference_barrier_not_null(res);
   } else {
@@ -118,7 +121,7 @@
   oop result = oop_atomic_cmpxchg_not_in_heap(new_value, addr, compare_value);
   const bool keep_alive = (decorators & AS_NO_KEEPALIVE) == 0;
   if (keep_alive && ShenandoahSATBBarrier && !CompressedOops::is_null(result) &&
-      oopDesc::equals_raw(result, compare_value) &&
+      (result == compare_value) &&
       ShenandoahHeap::heap()->is_concurrent_mark_in_progress()) {
     ShenandoahBarrierSet::barrier_set()->enqueue(result);
   }
@@ -179,158 +182,13 @@
   return result;
 }
 
-template <typename T>
-bool ShenandoahBarrierSet::arraycopy_loop_1(T* src, T* dst, size_t length, Klass* bound,
-                                            bool checkcast, bool satb, bool disjoint,
-                                            ShenandoahBarrierSet::ArrayCopyStoreValMode storeval_mode) {
-  if (checkcast) {
-    return arraycopy_loop_2<T, true>(src, dst, length, bound, satb, disjoint, storeval_mode);
-  } else {
-    return arraycopy_loop_2<T, false>(src, dst, length, bound, satb, disjoint, storeval_mode);
-  }
-}
-
-template <typename T, bool CHECKCAST>
-bool ShenandoahBarrierSet::arraycopy_loop_2(T* src, T* dst, size_t length, Klass* bound,
-                                            bool satb, bool disjoint,
-                                            ShenandoahBarrierSet::ArrayCopyStoreValMode storeval_mode) {
-  if (satb) {
-    return arraycopy_loop_3<T, CHECKCAST, true>(src, dst, length, bound, disjoint, storeval_mode);
-  } else {
-    return arraycopy_loop_3<T, CHECKCAST, false>(src, dst, length, bound, disjoint, storeval_mode);
-  }
-}
-
-template <typename T, bool CHECKCAST, bool SATB>
-bool ShenandoahBarrierSet::arraycopy_loop_3(T* src, T* dst, size_t length, Klass* bound, bool disjoint,
-                                            ShenandoahBarrierSet::ArrayCopyStoreValMode storeval_mode) {
-  switch (storeval_mode) {
-    case NONE:
-      return arraycopy_loop<T, CHECKCAST, SATB, NONE>(src, dst, length, bound, disjoint);
-    case RESOLVE_BARRIER:
-      return arraycopy_loop<T, CHECKCAST, SATB, RESOLVE_BARRIER>(src, dst, length, bound, disjoint);
-    case EVAC_BARRIER:
-      return arraycopy_loop<T, CHECKCAST, SATB, EVAC_BARRIER>(src, dst, length, bound, disjoint);
-    default:
-      ShouldNotReachHere();
-      return true; // happy compiler
-  }
-}
-
-template <typename T, bool CHECKCAST, bool SATB, ShenandoahBarrierSet::ArrayCopyStoreValMode STOREVAL_MODE>
-bool ShenandoahBarrierSet::arraycopy_loop(T* src, T* dst, size_t length, Klass* bound, bool disjoint) {
-  Thread* thread = Thread::current();
-  ShenandoahMarkingContext* ctx = _heap->marking_context();
-  ShenandoahEvacOOMScope oom_evac_scope;
-
-  // We need to handle four cases:
-  //
-  // a) src < dst, conjoint, can only copy backward only
-  //   [...src...]
-  //         [...dst...]
-  //
-  // b) src < dst, disjoint, can only copy forward, because types may mismatch
-  //   [...src...]
-  //              [...dst...]
-  //
-  // c) src > dst, conjoint, can copy forward only
-  //         [...src...]
-  //   [...dst...]
-  //
-  // d) src > dst, disjoint, can only copy forward, because types may mismatch
-  //              [...src...]
-  //   [...dst...]
-  //
-  if (src > dst || disjoint) {
-    // copy forward:
-    T* cur_src = src;
-    T* cur_dst = dst;
-    T* src_end = src + length;
-    for (; cur_src < src_end; cur_src++, cur_dst++) {
-      if (!arraycopy_element<T, CHECKCAST, SATB, STOREVAL_MODE>(cur_src, cur_dst, bound, thread, ctx)) {
-        return false;
-      }
-    }
-  } else {
-    // copy backward:
-    T* cur_src = src + length - 1;
-    T* cur_dst = dst + length - 1;
-    for (; cur_src >= src; cur_src--, cur_dst--) {
-      if (!arraycopy_element<T, CHECKCAST, SATB, STOREVAL_MODE>(cur_src, cur_dst, bound, thread, ctx)) {
-        return false;
-      }
-    }
-  }
-  return true;
-}
-
-template <typename T, bool CHECKCAST, bool SATB, ShenandoahBarrierSet::ArrayCopyStoreValMode STOREVAL_MODE>
-bool ShenandoahBarrierSet::arraycopy_element(T* cur_src, T* cur_dst, Klass* bound, Thread* const thread, ShenandoahMarkingContext* const ctx) {
-  T o = RawAccess<>::oop_load(cur_src);
-
-  if (SATB) {
-    assert(ShenandoahThreadLocalData::satb_mark_queue(thread).is_active(), "Shouldn't be here otherwise");
-    T prev = RawAccess<>::oop_load(cur_dst);
-    if (!CompressedOops::is_null(prev)) {
-      oop prev_obj = CompressedOops::decode_not_null(prev);
-      switch (STOREVAL_MODE) {
-      case NONE:
-        break;
-      case RESOLVE_BARRIER:
-      case EVAC_BARRIER:
-        // The evac-barrier case cannot really happen. It's traversal-only and traversal
-        // doesn't currently use SATB. And even if it did, it would not be fatal to just do the normal resolve here.
-        prev_obj = ShenandoahBarrierSet::resolve_forwarded_not_null(prev_obj);
-      }
-      if (!ctx->is_marked(prev_obj)) {
-        ShenandoahThreadLocalData::satb_mark_queue(thread).enqueue_known_active(prev_obj);
-      }
-    }
-  }
-
-  if (!CompressedOops::is_null(o)) {
-    oop obj = CompressedOops::decode_not_null(o);
-
-    if (CHECKCAST) {
-      assert(bound != NULL, "need element klass for checkcast");
-      if (!oopDesc::is_instanceof_or_null(obj, bound)) {
-        return false;
-      }
-    }
-
-    switch (STOREVAL_MODE) {
-    case NONE:
-      break;
-    case RESOLVE_BARRIER:
-      obj = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
-      break;
-    case EVAC_BARRIER:
-      if (_heap->in_collection_set(obj)) {
-        oop forw = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
-        if (oopDesc::equals_raw(forw, obj)) {
-          forw = _heap->evacuate_object(forw, thread);
-        }
-        obj = forw;
-      }
-      enqueue(obj);
-      break;
-    default:
-      ShouldNotReachHere();
-    }
-
-    RawAccess<IS_NOT_NULL>::oop_store(cur_dst, obj);
-  } else {
-    // Store null.
-    RawAccess<>::oop_store(cur_dst, o);
-  }
-  return true;
-}
-
 // Clone barrier support
 template <DecoratorSet decorators, typename BarrierSetT>
 void ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::clone_in_heap(oop src, oop dst, size_t size) {
+  if (ShenandoahCloneBarrier) {
+    ShenandoahBarrierSet::barrier_set()->clone_barrier(src);
+  }
   Raw::clone(src, dst, size);
-  ShenandoahBarrierSet::barrier_set()->write_region(MemRegion((HeapWord*) dst, size));
 }
 
 template <DecoratorSet decorators, typename BarrierSetT>
@@ -338,36 +196,144 @@
 bool ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_arraycopy_in_heap(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) {
-  ShenandoahHeap* heap = ShenandoahHeap::heap();
-  bool satb = ShenandoahSATBBarrier && heap->is_concurrent_mark_in_progress();
-  bool checkcast = HasDecorator<decorators, ARRAYCOPY_CHECKCAST>::value;
-  bool disjoint = HasDecorator<decorators, ARRAYCOPY_DISJOINT>::value;
-  ArrayCopyStoreValMode storeval_mode;
-  if (heap->has_forwarded_objects()) {
-    if (heap->is_concurrent_traversal_in_progress()) {
-      storeval_mode = EVAC_BARRIER;
-    } else if (heap->is_update_refs_in_progress()) {
-      storeval_mode = RESOLVE_BARRIER;
+  ShenandoahBarrierSet* bs = ShenandoahBarrierSet::barrier_set();
+  bs->arraycopy_pre(arrayOopDesc::obj_offset_to_raw(src_obj, src_offset_in_bytes, src_raw),
+                    arrayOopDesc::obj_offset_to_raw(dst_obj, dst_offset_in_bytes, dst_raw),
+                    length);
+  return Raw::oop_arraycopy_in_heap(src_obj, src_offset_in_bytes, src_raw, dst_obj, dst_offset_in_bytes, dst_raw, length);
+}
+
+template <class T, bool HAS_FWD, bool EVAC, bool ENQUEUE>
+void ShenandoahBarrierSet::arraycopy_work(T* src, size_t count) {
+  Thread* thread = Thread::current();
+  SATBMarkQueue& queue = ShenandoahThreadLocalData::satb_mark_queue(thread);
+  ShenandoahMarkingContext* ctx = _heap->marking_context();
+  const ShenandoahCollectionSet* const cset = _heap->collection_set();
+  T* end = src + count;
+  for (T* elem_ptr = src; elem_ptr < end; elem_ptr++) {
+    T o = RawAccess<>::oop_load(elem_ptr);
+    if (!CompressedOops::is_null(o)) {
+      oop obj = CompressedOops::decode_not_null(o);
+      if (HAS_FWD && cset->is_in((HeapWord *) obj)) {
+        assert(_heap->has_forwarded_objects(), "only get here with forwarded objects");
+        oop fwd = resolve_forwarded_not_null(obj);
+        if (EVAC && obj == fwd) {
+          fwd = _heap->evacuate_object(obj, thread);
+        }
+        assert(obj != fwd || _heap->cancelled_gc(), "must be forwarded");
+        oop witness = ShenandoahHeap::cas_oop(fwd, elem_ptr, o);
+        obj = fwd;
+      }
+      if (ENQUEUE && !ctx->is_marked(obj)) {
+        queue.enqueue_known_active(obj);
+      }
+    }
+  }
+}
+
+template <class T>
+void ShenandoahBarrierSet::arraycopy_pre_work(T* src, T* dst, size_t count) {
+  if (_heap->is_concurrent_mark_in_progress()) {
+    if (_heap->has_forwarded_objects()) {
+      arraycopy_work<T, true, false, true>(dst, count);
     } else {
-      assert(heap->is_idle() || heap->is_evacuation_in_progress(), "must not have anything in progress");
-      storeval_mode = NONE; // E.g. during evac or outside cycle
+      arraycopy_work<T, false, false, true>(dst, count);
     }
-  } else {
-    assert(heap->is_stable() || heap->is_concurrent_mark_in_progress(), "must not have anything in progress");
-    storeval_mode = NONE;
   }
 
-  if (!satb && !checkcast && storeval_mode == NONE) {
-    // Short-circuit to bulk copy.
-    return Raw::oop_arraycopy(src_obj, src_offset_in_bytes, src_raw, dst_obj, dst_offset_in_bytes, dst_raw, length);
+  arraycopy_update_impl(src, count);
+}
+
+void ShenandoahBarrierSet::arraycopy_pre(oop* src, oop* dst, size_t count) {
+  arraycopy_pre_work(src, dst, count);
+}
+
+void ShenandoahBarrierSet::arraycopy_pre(narrowOop* src, narrowOop* dst, size_t count) {
+  arraycopy_pre_work(src, dst, count);
+}
+
+template <class T>
+void ShenandoahBarrierSet::arraycopy_update_impl(T* src, size_t count) {
+  if (_heap->is_evacuation_in_progress()) {
+    ShenandoahEvacOOMScope oom_evac;
+    arraycopy_work<T, true, true, false>(src, count);
+  } else if (_heap->is_concurrent_traversal_in_progress()){
+    ShenandoahEvacOOMScope oom_evac;
+    arraycopy_work<T, true, true, true>(src, count);
+  } else if (_heap->has_forwarded_objects()) {
+    arraycopy_work<T, true, false, false>(src, count);
+  }
+}
+
+void ShenandoahBarrierSet::arraycopy_update(oop* src, size_t count) {
+  arraycopy_update_impl(src, count);
+}
+
+void ShenandoahBarrierSet::arraycopy_update(narrowOop* src, size_t count) {
+  arraycopy_update_impl(src, count);
+}
+
+template <bool EVAC, bool ENQUEUE>
+class ShenandoahUpdateRefsForOopClosure: public BasicOopIterateClosure {
+private:
+  ShenandoahHeap* const _heap;
+  ShenandoahBarrierSet* const _bs;
+  const ShenandoahCollectionSet* const _cset;
+  Thread* const _thread;
+
+  template <class T>
+  inline void do_oop_work(T* p) {
+    T o = RawAccess<>::oop_load(p);
+    if (!CompressedOops::is_null(o)) {
+      oop obj = CompressedOops::decode_not_null(o);
+      if (_cset->is_in((HeapWord *)obj)) {
+        oop fwd = _bs->resolve_forwarded_not_null(obj);
+        if (EVAC && obj == fwd) {
+          fwd = _heap->evacuate_object(obj, _thread);
+        }
+        if (ENQUEUE) {
+          _bs->enqueue(fwd);
+        }
+        assert(obj != fwd || _heap->cancelled_gc(), "must be forwarded");
+        ShenandoahHeap::cas_oop(fwd, p, o);
+      }
+
+    }
+  }
+public:
+  ShenandoahUpdateRefsForOopClosure() :
+          _heap(ShenandoahHeap::heap()),
+          _bs(ShenandoahBarrierSet::barrier_set()),
+          _cset(_heap->collection_set()),
+          _thread(Thread::current()) {
   }
 
-  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);
+  virtual void do_oop(oop* p)       { do_oop_work(p); }
+  virtual void do_oop(narrowOop* p) { do_oop_work(p); }
+};
+
+void ShenandoahBarrierSet::clone_barrier(oop obj) {
+  assert(ShenandoahCloneBarrier, "only get here with clone barriers enabled");
+  if (!_heap->has_forwarded_objects()) return;
+
+  // This is called for cloning an object (see jvm.cpp) after the clone
+  // has been made. We are not interested in any 'previous value' because
+  // it would be NULL in any case. But we *are* interested in any oop*
+  // that potentially need to be updated.
 
-  Klass* bound = objArrayOop(dst_obj)->element_klass();
-  ShenandoahBarrierSet* bs = ShenandoahBarrierSet::barrier_set();
-  return bs->arraycopy_loop_1(src_raw, dst_raw, length, bound, checkcast, satb, disjoint, storeval_mode);
+  shenandoah_assert_correct(NULL, obj);
+  if (_heap->is_evacuation_in_progress()) {
+    ShenandoahEvacOOMScope evac_scope;
+    ShenandoahUpdateRefsForOopClosure</* evac = */ true, /* enqueue */ false> cl;
+    obj->oop_iterate(&cl);
+  } else if (_heap->is_concurrent_traversal_in_progress()) {
+    ShenandoahEvacOOMScope evac_scope;
+    ShenandoahUpdateRefsForOopClosure</* evac = */ true, /* enqueue */ true> cl;
+    obj->oop_iterate(&cl);
+  } else {
+    ShenandoahUpdateRefsForOopClosure</* evac = */ false, /* enqueue */ false> cl;
+    obj->oop_iterate(&cl);
+  }
 }
 
 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHBARRIERSET_INLINE_HPP
--- a/src/hotspot/share/gc/shenandoah/shenandoahClosures.inline.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahClosures.inline.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -92,7 +92,7 @@
     if (_heap->in_collection_set(obj)) {
       shenandoah_assert_marked(p, obj);
       oop resolved = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
-      if (oopDesc::equals_raw(resolved, obj)) {
+      if (resolved == obj) {
         resolved = _heap->evacuate_object(obj, _thread);
       }
       RawAccess<IS_NOT_NULL>::oop_store(p, resolved);
@@ -119,7 +119,7 @@
     if (_heap->in_collection_set(obj)) {
       shenandoah_assert_marked(p, obj);
       oop resolved = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
-      if (oopDesc::equals_raw(resolved, obj)) {
+      if (resolved == obj) {
         resolved = _heap->evacuate_object(obj, _thread);
       }
 
--- a/src/hotspot/share/gc/shenandoah/shenandoahCodeRoots.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahCodeRoots.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -316,7 +316,11 @@
     oop *loc = _oops[c];
     assert(_nm->code_contains((address) loc) || _nm->oops_contains(loc), "nmethod should contain the oop*");
     oop o = RawAccess<>::oop_load(loc);
-    shenandoah_assert_correct_except(loc, o, o == NULL || heap->is_full_gc_move_in_progress());
+    shenandoah_assert_correct_except(loc, o,
+             o == NULL ||
+             heap->is_full_gc_move_in_progress() ||
+             (VMThread::vm_operation() != NULL) && (VMThread::vm_operation()->type() == VM_Operation::VMOp_HeapWalkOperation)
+    );
   }
 }
 
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1225,7 +1225,22 @@
     T o = RawAccess<>::oop_load(p);
     if (!CompressedOops::is_null(o)) {
       oop obj = CompressedOops::decode_not_null(o);
-      obj = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
+      oop fwd = (oop) ShenandoahForwarding::get_forwardee_raw_unchecked(obj);
+      if (fwd == NULL) {
+        // There is an odd interaction with VM_HeapWalkOperation, see jvmtiTagMap.cpp.
+        //
+        // That operation walks the reachable objects on its own, storing the marking
+        // wavefront in the object marks. When it is done, it calls the CollectedHeap
+        // to iterate over all objects to clean up the mess. When it reaches here,
+        // the Shenandoah fwdptr resolution code encounters the marked objects with
+        // NULL forwardee. Trying to act on that would crash the VM. Or fail the
+        // asserts, should we go for resolve_forwarded_pointer(obj).
+        //
+        // Therefore, we have to dodge it by doing the raw access to forwardee, and
+        // assuming the object had no forwardee, if that thing is NULL.
+      } else {
+        obj = fwd;
+      }
       assert(oopDesc::is_oop(obj), "must be a valid oop");
       if (!_bitmap->is_marked((HeapWord*) obj)) {
         _bitmap->mark((HeapWord*) obj);
@@ -1281,7 +1296,10 @@
   ShenandoahHeapIterationRootScanner rp;
   ObjectIterateScanRootClosure oops(&_aux_bit_map, &oop_stack);
 
-  if (unload_classes()) {
+  // If we are unloading classes right now, we should not touch weak roots,
+  // on the off-chance we would evacuate them and make them live accidentally.
+  // In other cases, we have to scan all roots.
+  if (is_evacuation_in_progress() && unload_classes()) {
     rp.strong_roots_do(&oops);
   } else {
     rp.roots_do(&oops);
@@ -1920,7 +1938,7 @@
     else if (prev == CANCELLED) return false;
     assert(ShenandoahSuspendibleWorkers, "should not get here when not using suspendible workers");
     assert(prev == NOT_CANCELLED, "must be NOT_CANCELLED");
-    {
+    if (Thread::current()->is_Java_thread()) {
       // We need to provide a safepoint here, otherwise we might
       // spin forever if a SP is pending.
       ThreadBlockInVM sp(JavaThread::current());
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -707,6 +707,7 @@
 
   static inline oop cas_oop(oop n, narrowOop* addr, oop c);
   static inline oop cas_oop(oop n, oop* addr, oop c);
+  static inline oop cas_oop(oop n, narrowOop* addr, narrowOop c);
 
   void trash_humongous_region_at(ShenandoahHeapRegion *r);
 
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -113,11 +113,11 @@
     oop heap_oop = CompressedOops::decode_not_null(o);
     if (in_collection_set(heap_oop)) {
       oop forwarded_oop = ShenandoahBarrierSet::resolve_forwarded_not_null(heap_oop);
-      if (oopDesc::equals_raw(forwarded_oop, heap_oop)) {
+      if (forwarded_oop == heap_oop) {
         forwarded_oop = evacuate_object(heap_oop, Thread::current());
       }
       oop prev = cas_oop(forwarded_oop, p, heap_oop);
-      if (oopDesc::equals_raw(prev, heap_oop)) {
+      if (prev == heap_oop) {
         return forwarded_oop;
       } else {
         return NULL;
@@ -133,6 +133,11 @@
   return (oop) Atomic::cmpxchg(n, addr, c);
 }
 
+inline oop ShenandoahHeap::cas_oop(oop n, narrowOop* addr, narrowOop c) {
+  narrowOop val = CompressedOops::encode(n);
+  return CompressedOops::decode((narrowOop) Atomic::cmpxchg(val, addr, c));
+}
+
 inline oop ShenandoahHeap::cas_oop(oop n, narrowOop* addr, oop c) {
   narrowOop cmp = CompressedOops::encode(c);
   narrowOop val = CompressedOops::encode(n);
@@ -146,7 +151,7 @@
 
   if (in_collection_set(heap_oop)) {
     oop forwarded_oop = ShenandoahBarrierSet::resolve_forwarded_not_null(heap_oop);
-    if (oopDesc::equals_raw(forwarded_oop, heap_oop)) {
+    if (forwarded_oop == heap_oop) {
       // E.g. during evacuation.
       return forwarded_oop;
     }
@@ -159,7 +164,7 @@
     // reference be updated later.
     oop witness = cas_oop(forwarded_oop, p, heap_oop);
 
-    if (!oopDesc::equals_raw(witness, heap_oop)) {
+    if (witness != heap_oop) {
       // CAS failed, someone had beat us to it. Normally, we would return the failure witness,
       // because that would be the proper write of to-space object, enforced by strong barriers.
       // However, there is a corner case with arraycopy. It can happen that a Java thread
@@ -279,7 +284,7 @@
   // Try to install the new forwarding pointer.
   oop copy_val = oop(copy);
   oop result = ShenandoahForwarding::try_update_forwardee(p, copy_val);
-  if (oopDesc::equals_raw(result, copy_val)) {
+  if (result == copy_val) {
     // Successfully evacuated. Our copy is now the public one!
     shenandoah_assert_correct(NULL, copy_val);
     return copy_val;
--- a/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -223,6 +223,7 @@
    CLDToOopClosure clds(oops, ClassLoaderData::_claim_none);
    MarkingCodeBlobClosure code(oops, !CodeBlobToOopClosure::FixRelocations);
    ShenandoahParallelOopsDoThreadClosure tc_cl(oops, &code, NULL);
+   AlwaysTrueClosure always_true;
    ResourceMark rm;
 
    _serial_roots.oops_do(oops, 0);
@@ -230,6 +231,10 @@
    _cld_roots.cld_do(&clds, 0);
    _thread_roots.threads_do(&tc_cl, 0);
    _code_roots.code_blobs_do(&code, 0);
+
+   _serial_weak_roots.weak_oops_do(oops, 0);
+   _weak_roots.oops_do<OopClosure>(oops, 0);
+   _dedup_roots.oops_do(&always_true, oops, 0);
  }
 
  void ShenandoahHeapIterationRootScanner::strong_roots_do(OopClosure* oops) {
--- a/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -254,6 +254,9 @@
   ShenandoahVMRoots<false /*concurrent*/>                  _vm_roots;
   ShenandoahClassLoaderDataRoots<false /*concurrent*/, true /*single threaded*/>
                                                            _cld_roots;
+  ShenandoahSerialWeakRoots                                _serial_weak_roots;
+  ShenandoahWeakRoots<false /*concurrent*/>                _weak_roots;
+  ShenandoahStringDedupRoots                               _dedup_roots;
   ShenandoahCodeCacheRoots<ShenandoahAllCodeRootsIterator> _code_roots;
 
 public:
--- a/src/hotspot/share/gc/shenandoah/shenandoahRuntime.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahRuntime.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -22,25 +22,30 @@
  */
 
 #include "precompiled.hpp"
-#include "gc/shenandoah/shenandoahBarrierSet.hpp"
+#include "gc/shenandoah/shenandoahBarrierSet.inline.hpp"
 #include "gc/shenandoah/shenandoahRuntime.hpp"
 #include "gc/shenandoah/shenandoahThreadLocalData.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
 #include "oops/oop.inline.hpp"
 
-void ShenandoahRuntime::write_ref_array_pre_oop_entry(oop* dst, size_t length) {
+void ShenandoahRuntime::write_ref_array_pre_oop_entry(oop* src, oop* dst, size_t length) {
   ShenandoahBarrierSet *bs = ShenandoahBarrierSet::barrier_set();
-  bs->write_ref_array_pre(dst, length, false);
+  bs->arraycopy_pre(src, dst, length);
 }
 
-void ShenandoahRuntime::write_ref_array_pre_narrow_oop_entry(narrowOop* dst, size_t length) {
+void ShenandoahRuntime::write_ref_array_pre_narrow_oop_entry(narrowOop* src, narrowOop* dst, size_t length) {
   ShenandoahBarrierSet *bs = ShenandoahBarrierSet::barrier_set();
-  bs->write_ref_array_pre(dst, length, false);
+  bs->arraycopy_pre(src, dst, length);
 }
 
-void ShenandoahRuntime::write_ref_array_post_entry(HeapWord* dst, size_t length) {
+void ShenandoahRuntime::write_ref_array_pre_duinit_oop_entry(oop* src, oop* dst, size_t length) {
   ShenandoahBarrierSet *bs = ShenandoahBarrierSet::barrier_set();
-  bs->ShenandoahBarrierSet::write_ref_array(dst, length);
+  bs->arraycopy_update(src, length);
+}
+
+void ShenandoahRuntime::write_ref_array_pre_duinit_narrow_oop_entry(narrowOop* src, narrowOop* dst, size_t length) {
+  ShenandoahBarrierSet *bs = ShenandoahBarrierSet::barrier_set();
+  bs->arraycopy_update(src, length);
 }
 
 // Shenandoah pre write barrier slowpath
@@ -55,15 +60,27 @@
   ShenandoahThreadLocalData::satb_mark_queue(thread).enqueue_known_active(orig);
 JRT_END
 
-JRT_LEAF(oopDesc*, ShenandoahRuntime::load_reference_barrier(oopDesc * src))
-  oop result = ShenandoahBarrierSet::barrier_set()->load_reference_barrier_mutator(src);
-  return (oopDesc*) result;
+JRT_LEAF(oopDesc*, ShenandoahRuntime::load_reference_barrier(oopDesc* src))
+  return ShenandoahBarrierSet::barrier_set()->load_reference_barrier_mutator(src, (oop*)NULL);
+JRT_END
+
+JRT_LEAF(oopDesc*, ShenandoahRuntime::load_reference_barrier_fixup(oopDesc* src, oop* load_addr))
+  return ShenandoahBarrierSet::barrier_set()->load_reference_barrier_mutator(src, load_addr);
+JRT_END
+
+JRT_LEAF(oopDesc*, ShenandoahRuntime::load_reference_barrier_fixup_narrow(oopDesc* src, narrowOop* load_addr))
+  return ShenandoahBarrierSet::barrier_set()->load_reference_barrier_mutator(src, load_addr);
 JRT_END
 
 // Shenandoah clone barrier: makes sure that references point to to-space
 // in cloned objects.
-JRT_LEAF(void, ShenandoahRuntime::shenandoah_clone_barrier(oopDesc* obj))
-  ShenandoahBarrierSet::barrier_set()->write_region(MemRegion((HeapWord*) obj, obj->size()));
+JRT_LEAF(void, ShenandoahRuntime::shenandoah_clone_barrier(oopDesc* s, oopDesc* d, size_t length))
+  oop src = oop(s);
+  oop dst = oop(d);
+  shenandoah_assert_correct(NULL, src);
+  shenandoah_assert_correct(NULL, dst);
+  ShenandoahBarrierSet::barrier_set()->clone_barrier(src);
+  RawAccessBarrier<IS_NOT_NULL>::clone(src, dst, length);
 JRT_END
 
 JRT_LEAF(oopDesc*, ShenandoahRuntime::load_reference_barrier_native(oopDesc * src))
--- a/src/hotspot/share/gc/shenandoah/shenandoahRuntime.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahRuntime.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -32,15 +32,19 @@
 
 class ShenandoahRuntime : public AllStatic {
 public:
-  static void write_ref_array_pre_oop_entry(oop* dst, size_t length);
-  static void write_ref_array_pre_narrow_oop_entry(narrowOop* dst, size_t length);
-  static void write_ref_array_post_entry(HeapWord* dst, size_t length);
+  static void write_ref_array_pre_oop_entry(oop* src, oop* dst, size_t length);
+  static void write_ref_array_pre_narrow_oop_entry(narrowOop* src, narrowOop* dst, size_t length);
+  static void write_ref_array_pre_duinit_oop_entry(oop* src, oop* dst, size_t length);
+  static void write_ref_array_pre_duinit_narrow_oop_entry(narrowOop* src, narrowOop* dst, size_t length);
   static void write_ref_field_pre_entry(oopDesc* orig, JavaThread* thread);
 
-  static oopDesc* load_reference_barrier(oopDesc *src);
-  static oopDesc* load_reference_barrier_native(oopDesc *src);
+  static oopDesc* load_reference_barrier(oopDesc* src);
+  static oopDesc* load_reference_barrier_fixup(oopDesc* src, oop* load_addr);
+  static oopDesc* load_reference_barrier_fixup_narrow(oopDesc* src, narrowOop* load_addr);
 
-  static void shenandoah_clone_barrier(oopDesc* obj);
+  static oopDesc* load_reference_barrier_native(oopDesc* src);
+
+  static void shenandoah_clone_barrier(oopDesc* s, oopDesc* d, size_t length);
 };
 
 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHRUNTIME_HPP
--- a/src/hotspot/share/gc/shenandoah/shenandoahTaskqueue.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahTaskqueue.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -141,11 +141,11 @@
 
 public:
   ObjArrayChunkedTask(oop o = NULL) {
-    assert(oopDesc::equals_raw(decode_oop(encode_oop(o)), o), "oop can be encoded: " PTR_FORMAT, p2i(o));
+    assert(decode_oop(encode_oop(o)) ==  o, "oop can be encoded: " PTR_FORMAT, p2i(o));
     _obj = encode_oop(o);
   }
   ObjArrayChunkedTask(oop o, int chunk, int pow) {
-    assert(oopDesc::equals_raw(decode_oop(encode_oop(o)), o), "oop can be encoded: " PTR_FORMAT, p2i(o));
+    assert(decode_oop(encode_oop(o)) == o, "oop can be encoded: " PTR_FORMAT, p2i(o));
     assert(decode_chunk(encode_chunk(chunk)) == chunk, "chunk can be encoded: %d", chunk);
     assert(decode_pow(encode_pow(pow)) == pow, "pow can be encoded: %d", pow);
     _obj = encode_oop(o) | encode_chunk(chunk) | encode_pow(pow);
--- a/src/hotspot/share/gc/shenandoah/shenandoahTraversalGC.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahTraversalGC.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -594,11 +594,6 @@
   }
 
   if (!_heap->cancelled_gc()) {
-    fixup_roots();
-    _heap->parallel_cleaning(false);
-  }
-
-  if (!_heap->cancelled_gc()) {
     assert(_task_queues->is_empty(), "queues must be empty after traversal GC");
     TASKQUEUE_STATS_ONLY(_task_queues->print_taskqueue_stats());
     TASKQUEUE_STATS_ONLY(_task_queues->reset_taskqueue_stats());
@@ -606,6 +601,9 @@
     // No more marking expected
     _heap->mark_complete_marking_context();
 
+    fixup_roots();
+    _heap->parallel_cleaning(false);
+
     // Resize metaspace
     MetaspaceGC::compute_new_size();
 
@@ -672,7 +670,7 @@
     if (!CompressedOops::is_null(o)) {
       oop obj = CompressedOops::decode_not_null(o);
       oop forw = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
-      if (!oopDesc::equals_raw(obj, forw)) {
+      if (obj != forw) {
         RawAccess<IS_NOT_NULL>::oop_store(p, forw);
       }
     }
--- a/src/hotspot/share/gc/shenandoah/shenandoahTraversalGC.inline.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahTraversalGC.inline.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -42,14 +42,14 @@
     oop obj = CompressedOops::decode_not_null(o);
     if (DEGEN) {
       oop forw = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
-      if (!oopDesc::equals_raw(obj, forw)) {
+      if (obj != forw) {
         // Update reference.
         RawAccess<IS_NOT_NULL>::oop_store(p, forw);
       }
       obj = forw;
     } else if (_heap->in_collection_set(obj)) {
       oop forw = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
-      if (oopDesc::equals_raw(obj, forw)) {
+      if (obj == forw) {
         forw = _heap->evacuate_object(obj, thread);
       }
       shenandoah_assert_forwarded_except(p, obj, _heap->cancelled_gc());
--- a/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -35,6 +35,7 @@
 #include "memory/iterator.inline.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/compressedOops.inline.hpp"
+#include "utilities/align.hpp"
 
 // Avoid name collision on verify_oop (defined in macroAssembler_arm.hpp)
 #ifdef verify_oop
@@ -98,7 +99,7 @@
 
     check(ShenandoahAsserts::_safe_unknown, obj, _heap->is_in(obj),
               "oop must be in heap");
-    check(ShenandoahAsserts::_safe_unknown, obj, check_obj_alignment(obj),
+    check(ShenandoahAsserts::_safe_unknown, obj, is_object_aligned(obj),
               "oop must be aligned");
 
     ShenandoahHeapRegion *obj_reg = _heap->heap_region_containing(obj);
@@ -153,12 +154,12 @@
 
     ShenandoahHeapRegion* fwd_reg = NULL;
 
-    if (!oopDesc::equals_raw(obj, fwd)) {
+    if (obj != fwd) {
       check(ShenandoahAsserts::_safe_oop, obj, _heap->is_in(fwd),
              "Forwardee must be in heap");
       check(ShenandoahAsserts::_safe_oop, obj, !CompressedOops::is_null(fwd),
              "Forwardee is set");
-      check(ShenandoahAsserts::_safe_oop, obj, check_obj_alignment(fwd),
+      check(ShenandoahAsserts::_safe_oop, obj, is_object_aligned(fwd),
              "Forwardee must be aligned");
 
       // Do this before touching fwd->size()
@@ -183,7 +184,7 @@
              "Forwardee end should be within the region");
 
       oop fwd2 = (oop) ShenandoahForwarding::get_forwardee_raw_unchecked(fwd);
-      check(ShenandoahAsserts::_safe_oop, obj, oopDesc::equals_raw(fwd, fwd2),
+      check(ShenandoahAsserts::_safe_oop, obj, (fwd == fwd2),
              "Double forwarding");
     } else {
       fwd_reg = obj_reg;
@@ -212,12 +213,12 @@
         // skip
         break;
       case ShenandoahVerifier::_verify_forwarded_none: {
-        check(ShenandoahAsserts::_safe_all, obj, oopDesc::equals_raw(obj, fwd),
+        check(ShenandoahAsserts::_safe_all, obj, (obj == fwd),
                "Should not be forwarded");
         break;
       }
       case ShenandoahVerifier::_verify_forwarded_allow: {
-        if (!oopDesc::equals_raw(obj, fwd)) {
+        if (obj != fwd) {
           check(ShenandoahAsserts::_safe_all, obj, obj_reg != fwd_reg,
                  "Forwardee should be in another region");
         }
@@ -237,7 +238,7 @@
         break;
       case ShenandoahVerifier::_verify_cset_forwarded:
         if (_heap->in_collection_set(obj)) {
-          check(ShenandoahAsserts::_safe_all, obj, !oopDesc::equals_raw(obj, fwd),
+          check(ShenandoahAsserts::_safe_all, obj, (obj != fwd),
                  "Object in collection set, should have forwardee");
         }
         break;
@@ -952,7 +953,7 @@
     if (!CompressedOops::is_null(o)) {
       oop obj = CompressedOops::decode_not_null(o);
       oop fwd = (oop) ShenandoahForwarding::get_forwardee_raw_unchecked(obj);
-      if (!oopDesc::equals_raw(obj, fwd)) {
+      if (obj != fwd) {
         ShenandoahAsserts::print_failure(ShenandoahAsserts::_safe_all, obj, p, NULL,
                                          "Verify Roots", "Should not be forwarded", __FILE__, __LINE__);
       }
@@ -984,7 +985,7 @@
       }
 
       oop fwd = (oop) ShenandoahForwarding::get_forwardee_raw_unchecked(obj);
-      if (!oopDesc::equals_raw(obj, fwd)) {
+      if (obj != fwd) {
         ShenandoahAsserts::print_failure(ShenandoahAsserts::_safe_all, obj, p, NULL,
                 "Verify Roots In To-Space", "Should not be forwarded", __FILE__, __LINE__);
       }
--- a/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -391,5 +391,10 @@
                                                                             \
   experimental(bool, ShenandoahLoopOptsAfterExpansion, true,                \
           "Attempt more loop opts after barrier expansion")                 \
+                                                                            \
+  diagnostic(bool, ShenandoahSelfFixing, true,                              \
+          "Fix references with load reference barrier. Disabling this "     \
+          "might degrade performance.")                                     \
+
 
 #endif // SHARE_GC_SHENANDOAH_SHENANDOAH_GLOBALS_HPP
--- a/src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -660,7 +660,7 @@
 }
 
 bool ZBarrierSetC2::array_copy_requires_gc_barriers(bool tightly_coupled_alloc, BasicType type, bool is_clone, ArrayCopyPhase phase) const {
-  return type == T_OBJECT || type == T_ARRAY;
+  return is_reference_type(type);
 }
 
 bool ZBarrierSetC2::final_graph_reshaping(Compile* compile, Node* n, uint opcode) const {
@@ -1367,7 +1367,7 @@
         LoadStoreNode* lsn = n->as_LoadStore();
         if (lsn->has_barrier()) {
           BasicType bt = lsn->in(MemNode::Address)->bottom_type()->basic_type();
-          assert ((bt == T_OBJECT || bt == T_ARRAY), "Sanity test");
+          assert (is_reference_type(bt), "Sanity test");
           insert_barrier_before_unsafe(phase, lsn);
         }
       }
--- a/src/hotspot/share/gc/z/vmStructs_z.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/vmStructs_z.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -104,8 +104,7 @@
   declare_constant(ZAddressOffsetShift)                                                              \
   declare_constant(ZAddressOffsetBits)                                                               \
   declare_constant(ZAddressOffsetMask)                                                               \
-  declare_constant(ZAddressOffsetMax)                                                                \
-  declare_constant(ZAddressSpaceStart)
+  declare_constant(ZAddressOffsetMax)
 
 #define VM_TYPES_ZGC(declare_type, declare_toplevel_type, declare_integer_type)                      \
   declare_toplevel_type(ZGlobalsForVMStructs)                                                        \
--- a/src/hotspot/share/gc/z/zAddress.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zAddress.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -32,14 +32,6 @@
 }
 
 void ZAddress::initialize() {
-  ZAddressSpaceStart = ZPlatformAddressSpaceStart();
-  ZAddressSpaceEnd = ZPlatformAddressSpaceEnd();
-  ZAddressSpaceSize = ZAddressSpaceEnd - ZAddressSpaceStart;
-
-  ZAddressReservedStart = ZPlatformAddressReservedStart();
-  ZAddressReservedEnd = ZPlatformAddressReservedEnd();
-  ZAddressReservedSize = ZAddressReservedEnd - ZAddressReservedStart;
-
   ZAddressBase = ZPlatformAddressBase();
 
   ZAddressOffsetBits = ZPlatformAddressOffsetBits();
--- a/src/hotspot/share/gc/z/zAttachedArray.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zAttachedArray.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -29,7 +29,7 @@
 template <typename ObjectT, typename ArrayT>
 class ZAttachedArray {
 private:
-  const uint32_t _length;
+  const size_t _length;
 
   static size_t object_size();
 
@@ -39,7 +39,7 @@
 
   ZAttachedArray(size_t length);
 
-  uint32_t length() const;
+  size_t length() const;
   ArrayT* operator()(const ObjectT* obj) const;
 };
 
--- a/src/hotspot/share/gc/z/zAttachedArray.inline.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zAttachedArray.inline.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -51,7 +51,7 @@
     _length(length) {}
 
 template <typename ObjectT, typename ArrayT>
-inline uint32_t ZAttachedArray<ObjectT, ArrayT>::length() const {
+inline size_t ZAttachedArray<ObjectT, ArrayT>::length() const {
   return _length;
 }
 
--- a/src/hotspot/share/gc/z/zBarrierSet.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zBarrierSet.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -66,7 +66,7 @@
   assert((decorators & AS_NO_KEEPALIVE) == 0, "Unexpected decorator");
   //assert((decorators & ON_UNKNOWN_OOP_REF) == 0, "Unexpected decorator");
 
-  if (type == T_OBJECT || type == T_ARRAY) {
+  if (is_reference_type(type)) {
     assert((decorators & (IN_HEAP | IN_NATIVE)) != 0, "Where is reference?");
     // Barrier needed even when IN_NATIVE, to allow concurrent scanning.
     return true;
--- a/src/hotspot/share/gc/z/zBarrierSetNMethod.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zBarrierSetNMethod.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,7 +45,7 @@
     // We don't need to take the lock when unlinking nmethods from
     // the Method, because it is only concurrently unlinked by
     // the entry barrier, which acquires the per nmethod lock.
-    nm->unlink_from_method(false /* acquire_lock */);
+    nm->unlink_from_method();
 
     // We can end up calling nmethods that are unloading
     // since we clear compiled ICs lazily. Returning false
--- a/src/hotspot/share/gc/z/zCPU.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zCPU.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -33,8 +33,8 @@
 #define ZCPU_UNKNOWN_SELF     (Thread*)-2;
 
 PaddedEnd<ZCPU::ZCPUAffinity>* ZCPU::_affinity = NULL;
-__thread Thread*  ZCPU::_self                  = ZCPU_UNKNOWN_SELF;
-__thread uint32_t ZCPU::_cpu                   = 0;
+THREAD_LOCAL Thread*           ZCPU::_self     = ZCPU_UNKNOWN_SELF;
+THREAD_LOCAL uint32_t          ZCPU::_cpu      = 0;
 
 void ZCPU::initialize() {
   assert(_affinity == NULL, "Already initialized");
--- a/src/hotspot/share/gc/z/zCPU.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zCPU.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -26,6 +26,7 @@
 
 #include "memory/allocation.hpp"
 #include "memory/padded.hpp"
+#include "utilities/globalDefinitions.hpp"
 
 class Thread;
 
@@ -36,8 +37,8 @@
   };
 
   static PaddedEnd<ZCPUAffinity>* _affinity;
-  static __thread Thread*         _self;
-  static __thread uint32_t        _cpu;
+  static THREAD_LOCAL Thread*     _self;
+  static THREAD_LOCAL uint32_t    _cpu;
 
 public:
   static void initialize();
--- a/src/hotspot/share/gc/z/zCollectedHeap.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zCollectedHeap.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -23,18 +23,19 @@
 
 #include "precompiled.hpp"
 #include "gc/shared/gcHeapSummary.hpp"
-#include "gc/shared/locationPrinter.hpp"
 #include "gc/shared/suspendibleThreadSet.hpp"
 #include "gc/z/zCollectedHeap.hpp"
 #include "gc/z/zGlobals.hpp"
 #include "gc/z/zHeap.inline.hpp"
 #include "gc/z/zNMethod.hpp"
 #include "gc/z/zObjArrayAllocator.hpp"
+#include "gc/z/zOop.inline.hpp"
 #include "gc/z/zServiceability.hpp"
 #include "gc/z/zStat.hpp"
 #include "gc/z/zUtils.inline.hpp"
 #include "memory/universe.hpp"
 #include "runtime/mutexLocker.hpp"
+#include "utilities/align.hpp"
 
 ZCollectedHeap* ZCollectedHeap::heap() {
   CollectedHeap* heap = Universe::heap();
@@ -67,8 +68,7 @@
     return JNI_ENOMEM;
   }
 
-  Universe::calculate_verify_data((HeapWord*)ZAddressReservedStart,
-                                  (HeapWord*)ZAddressReservedEnd);
+  Universe::calculate_verify_data((HeapWord*)0, (HeapWord*)UINTPTR_MAX);
 
   return JNI_OK;
 }
@@ -115,7 +115,7 @@
 }
 
 uint32_t ZCollectedHeap::hash_oop(oop obj) const {
-  return _heap.hash_oop(obj);
+  return _heap.hash_oop(ZOop::to_address(obj));
 }
 
 HeapWord* ZCollectedHeap::allocate_new_tlab(size_t min_size, size_t requested_size, size_t* actual_size) {
@@ -284,12 +284,7 @@
 }
 
 VirtualSpaceSummary ZCollectedHeap::create_heap_space_summary() {
-  const size_t capacity_in_words = capacity() / HeapWordSize;
-  const size_t max_capacity_in_words = max_capacity() / HeapWordSize;
-  HeapWord* const heap_start = (HeapWord*)ZAddressReservedStart;
-  return VirtualSpaceSummary(heap_start,
-                             heap_start + capacity_in_words,
-                             heap_start + max_capacity_in_words);
+  return VirtualSpaceSummary((HeapWord*)0, (HeapWord*)capacity(), (HeapWord*)max_capacity());
 }
 
 void ZCollectedHeap::safepoint_synchronize_begin() {
@@ -311,10 +306,6 @@
 void ZCollectedHeap::print_on_error(outputStream* st) const {
   CollectedHeap::print_on_error(st);
 
-  st->print_cr("Address Space");
-  st->print_cr( "     Start:             " PTR_FORMAT, ZAddressSpaceStart);
-  st->print_cr( "     End:               " PTR_FORMAT, ZAddressSpaceEnd);
-  st->print_cr( "     Size:              " SIZE_FORMAT_W(-15) " (" PTR_FORMAT ")", ZAddressSpaceSize, ZAddressSpaceSize);
   st->print_cr( "Heap");
   st->print_cr( "     GlobalPhase:       %u", ZGlobalPhase);
   st->print_cr( "     GlobalSeqNum:      %u", ZGlobalSeqNum);
@@ -351,13 +342,7 @@
 }
 
 bool ZCollectedHeap::print_location(outputStream* st, void* addr) const {
-  if (LocationPrinter::is_valid_obj(addr)) {
-    st->print(INTPTR_FORMAT " is a %s oop: ", p2i(addr),
-              ZAddress::is_good(reinterpret_cast<uintptr_t>(addr)) ? "good" : "bad");
-    cast_to_oop(addr)->print_on(st);
-    return true;
-  }
-  return false;
+  return _heap.print_location(st, (uintptr_t)addr);
 }
 
 void ZCollectedHeap::verify(VerifyOption option /* ignored */) {
@@ -365,13 +350,5 @@
 }
 
 bool ZCollectedHeap::is_oop(oop object) const {
-  return CollectedHeap::is_oop(object) && _heap.is_oop(object);
+  return _heap.is_oop(ZOop::to_address(object));
 }
-
-void ZCollectedHeap::check_oop_location(void* addr) const {
-  assert(check_obj_alignment(addr), "address is not aligned");
-
-  const uintptr_t addr_int = reinterpret_cast<uintptr_t>(addr);
-  assert(addr_int >= ZAddressSpaceStart, "address is outside of the heap");
-  assert(addr_int < ZAddressSpaceEnd,    "address is outside of the heap");
-}
--- a/src/hotspot/share/gc/z/zCollectedHeap.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zCollectedHeap.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -126,7 +126,6 @@
   virtual void prepare_for_verify();
   virtual void verify(VerifyOption option /* ignored */);
   virtual bool is_oop(oop object) const;
-  virtual void check_oop_location(void* addr) const;
 };
 
 #endif // SHARE_GC_Z_ZCOLLECTEDHEAP_HPP
--- a/src/hotspot/share/gc/z/zDebug.gdb	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zDebug.gdb	Tue Sep 24 15:19:35 2019 -0400
@@ -126,10 +126,6 @@
 
 # Print heap information
 define zph
-    printf "Address Space\n"
-    printf "     Start:             0x%llx\n", ZAddressSpaceStart
-    printf "     End:               0x%llx\n", ZAddressSpaceEnd
-    printf "     Size:              %-15llu (0x%llx)\n", ZAddressSpaceSize, ZAddressSpaceSize
     printf "Heap\n"
     printf "     GlobalPhase:       %u\n", ZGlobalPhase
     printf "     GlobalSeqNum:      %u\n", ZGlobalSeqNum
--- a/src/hotspot/share/gc/z/zForwarding.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zForwarding.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -34,7 +34,7 @@
   // The table is sized to have a load factor of 50%, i.e. sized to have
   // double the number of entries actually inserted.
   assert(page->live_objects() > 0, "Invalid value");
-  const uint32_t nentries = ZUtils::round_up_power_of_2(page->live_objects() * 2);
+  const size_t nentries = ZUtils::round_up_power_of_2(page->live_objects() * 2);
   return ::new (AttachedArray::alloc(nentries)) ZForwarding(page, nentries);
 }
 
@@ -42,7 +42,7 @@
   AttachedArray::free(forwarding);
 }
 
-ZForwarding::ZForwarding(ZPage* page, uint32_t nentries) :
+ZForwarding::ZForwarding(ZPage* page, size_t nentries) :
     _virtual(page->virtual_memory()),
     _object_alignment_shift(page->object_alignment_shift()),
     _entries(nentries),
@@ -54,7 +54,7 @@
   guarantee(_refcount > 0, "Invalid refcount");
   guarantee(_page != NULL, "Invalid page");
 
-  uint32_t live_objects = 0;
+  size_t live_objects = 0;
 
   for (ZForwardingCursor i = 0; i < _entries.length(); i++) {
     const ZForwardingEntry entry = at(&i);
--- a/src/hotspot/share/gc/z/zForwarding.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zForwarding.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -30,7 +30,7 @@
 
 class ZPage;
 
-typedef uint32_t ZForwardingCursor;
+typedef size_t ZForwardingCursor;
 
 class ZForwarding {
   friend class VMStructs;
@@ -54,7 +54,7 @@
   ZForwardingEntry first(uintptr_t from_index, ZForwardingCursor* cursor) const;
   ZForwardingEntry next(ZForwardingCursor* cursor) const;
 
-  ZForwarding(ZPage* page, uint32_t nentries);
+  ZForwarding(ZPage* page, size_t nentries);
 
 public:
   static ZForwarding* create(ZPage* page);
--- a/src/hotspot/share/gc/z/zForwarding.inline.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zForwarding.inline.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -99,14 +99,14 @@
 }
 
 inline ZForwardingEntry ZForwarding::first(uintptr_t from_index, ZForwardingCursor* cursor) const {
-  const uint32_t mask = _entries.length() - 1;
-  const uint32_t hash = ZHash::uint32_to_uint32((uint32_t)from_index);
+  const size_t mask = _entries.length() - 1;
+  const size_t hash = ZHash::uint32_to_uint32((uint32_t)from_index);
   *cursor = hash & mask;
   return at(cursor);
 }
 
 inline ZForwardingEntry ZForwarding::next(ZForwardingCursor* cursor) const {
-  const uint32_t mask = _entries.length() - 1;
+  const size_t mask = _entries.length() - 1;
   *cursor = (*cursor + 1) & mask;
   return at(cursor);
 }
--- a/src/hotspot/share/gc/z/zForwardingEntry.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zForwardingEntry.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -46,7 +46,7 @@
 //
 
 class ZForwardingEntry {
-  friend struct PrimitiveConversions;
+  friend class PrimitiveConversions;
 
 private:
   typedef ZBitField<uint64_t, bool,   0,   1> field_populated;
--- a/src/hotspot/share/gc/z/zGlobals.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zGlobals.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -48,11 +48,3 @@
 uintptr_t ZAddressMetadataMarked1;
 uintptr_t ZAddressMetadataRemapped;
 uintptr_t ZAddressMetadataFinalizable;
-
-uintptr_t ZAddressSpaceStart;
-uintptr_t ZAddressSpaceEnd;
-size_t    ZAddressSpaceSize;
-
-uintptr_t ZAddressReservedStart;
-uintptr_t ZAddressReservedEnd;
-size_t    ZAddressReservedSize;
--- a/src/hotspot/share/gc/z/zGlobals.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zGlobals.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -112,16 +112,6 @@
 extern uintptr_t  ZAddressMetadataRemapped;
 extern uintptr_t  ZAddressMetadataFinalizable;
 
-// Address space start/end/size
-extern uintptr_t  ZAddressSpaceStart;
-extern uintptr_t  ZAddressSpaceEnd;
-extern size_t     ZAddressSpaceSize;
-
-// Reserved space start/end
-extern uintptr_t  ZAddressReservedStart;
-extern uintptr_t  ZAddressReservedEnd;
-extern size_t     ZAddressReservedSize;
-
 // NMethod entry barrier
 const size_t      ZNMethodDisarmedOffset        = ZPlatformNMethodDisarmedOffset;
 
--- a/src/hotspot/share/gc/z/zHeap.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zHeap.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -22,35 +22,26 @@
  */
 
 #include "precompiled.hpp"
-#include "gc/shared/gcArguments.hpp"
-#include "gc/shared/oopStorage.hpp"
-#include "gc/z/zAddress.hpp"
+#include "gc/shared/locationPrinter.hpp"
+#include "gc/z/zAddress.inline.hpp"
 #include "gc/z/zGlobals.hpp"
 #include "gc/z/zHeap.inline.hpp"
 #include "gc/z/zHeapIterator.hpp"
-#include "gc/z/zList.inline.hpp"
-#include "gc/z/zLock.inline.hpp"
 #include "gc/z/zMark.inline.hpp"
-#include "gc/z/zOopClosures.inline.hpp"
 #include "gc/z/zPage.inline.hpp"
 #include "gc/z/zPageTable.inline.hpp"
 #include "gc/z/zRelocationSet.inline.hpp"
+#include "gc/z/zRelocationSetSelector.hpp"
 #include "gc/z/zResurrection.hpp"
-#include "gc/z/zRootsIterator.hpp"
 #include "gc/z/zStat.hpp"
-#include "gc/z/zTask.hpp"
 #include "gc/z/zThread.hpp"
-#include "gc/z/zTracer.inline.hpp"
 #include "gc/z/zVerify.hpp"
-#include "gc/z/zVirtualMemory.inline.hpp"
 #include "gc/z/zWorkers.inline.hpp"
 #include "logging/log.hpp"
+#include "memory/iterator.hpp"
 #include "memory/resourceArea.hpp"
-#include "oops/oop.inline.hpp"
-#include "runtime/arguments.hpp"
 #include "runtime/safepoint.hpp"
 #include "runtime/thread.hpp"
-#include "utilities/align.hpp"
 #include "utilities/debug.hpp"
 
 static const ZStatSampler ZSamplerHeapUsedBeforeMark("Memory", "Heap Used Before Mark", ZStatUnitBytes);
@@ -179,7 +170,7 @@
 
 bool ZHeap::is_in(uintptr_t addr) const {
   // An address is considered to be "in the heap" if it points into
-  // the allocated part of a pages, regardless of which heap view is
+  // the allocated part of a page, regardless of which heap view is
   // used. Note that an address with the finalizable metadata bit set
   // is not pointing into a heap view, and therefore not considered
   // to be "in the heap".
@@ -512,6 +503,16 @@
   st->cr();
 }
 
+bool ZHeap::print_location(outputStream* st, uintptr_t addr) const {
+  if (LocationPrinter::is_valid_obj((void*)addr)) {
+    st->print(PTR_FORMAT " is a %s oop: ", addr, ZAddress::is_good(addr) ? "good" : "bad");
+    ZOop::from_address(addr)->print_on(st);
+    return true;
+  }
+
+  return false;
+}
+
 void ZHeap::verify() {
   // Heap verification can only be done between mark end and
   // relocate start. This is the only window where all oop are
--- a/src/hotspot/share/gc/z/zHeap.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zHeap.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -24,12 +24,8 @@
 #ifndef SHARE_GC_Z_ZHEAP_HPP
 #define SHARE_GC_Z_ZHEAP_HPP
 
-#include "gc/shared/gcTimer.hpp"
 #include "gc/z/zAllocationFlags.hpp"
-#include "gc/z/zArray.hpp"
 #include "gc/z/zForwardingTable.hpp"
-#include "gc/z/zList.hpp"
-#include "gc/z/zLock.hpp"
 #include "gc/z/zMark.hpp"
 #include "gc/z/zObjectAllocator.hpp"
 #include "gc/z/zPage.hpp"
@@ -38,13 +34,10 @@
 #include "gc/z/zReferenceProcessor.hpp"
 #include "gc/z/zRelocate.hpp"
 #include "gc/z/zRelocationSet.hpp"
-#include "gc/z/zRelocationSetSelector.hpp"
-#include "gc/z/zRootsIterator.hpp"
 #include "gc/z/zWeakRootsProcessor.hpp"
 #include "gc/z/zServiceability.hpp"
 #include "gc/z/zUnload.hpp"
 #include "gc/z/zWorkers.hpp"
-#include "memory/allocation.hpp"
 
 class ZHeap {
   friend class VMStructs;
@@ -105,7 +98,7 @@
   size_t unsafe_max_tlab_alloc() const;
 
   bool is_in(uintptr_t addr) const;
-  uint32_t hash_oop(oop obj) const;
+  uint32_t hash_oop(uintptr_t addr) const;
 
   // Workers
   uint nconcurrent_worker_threads() const;
@@ -168,9 +161,10 @@
   // Printing
   void print_on(outputStream* st) const;
   void print_extended_on(outputStream* st) const;
+  bool print_location(outputStream* st, uintptr_t addr) const;
 
   // Verification
-  bool is_oop(oop object) const;
+  bool is_oop(uintptr_t addr) const;
   void verify();
 };
 
--- a/src/hotspot/share/gc/z/zHeap.inline.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zHeap.inline.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -33,7 +33,6 @@
 #include "gc/z/zOop.inline.hpp"
 #include "gc/z/zPage.inline.hpp"
 #include "gc/z/zPageTable.inline.hpp"
-#include "gc/z/zUtils.inline.hpp"
 #include "utilities/debug.hpp"
 
 inline ZHeap* ZHeap::heap() {
@@ -45,8 +44,8 @@
   return &_reference_processor;
 }
 
-inline uint32_t ZHeap::hash_oop(oop obj) const {
-  const uintptr_t offset = ZAddress::offset(ZOop::to_address(obj));
+inline uint32_t ZHeap::hash_oop(uintptr_t addr) const {
+  const uintptr_t offset = ZAddress::offset(addr);
   return ZHash::address_to_uint32(offset);
 }
 
@@ -134,12 +133,8 @@
   _page_allocator.check_out_of_memory();
 }
 
-inline bool ZHeap::is_oop(oop object) const {
-  // Verify that we have a good address. Note that ZAddress::is_good()
-  // would not be a strong enough verification, since it only verifies
-  // that the metadata bits are good.
-  const uintptr_t addr = ZOop::to_address(object);
-  return ZAddress::good(addr) == addr;
+inline bool ZHeap::is_oop(uintptr_t addr) const {
+  return ZAddress::is_good(addr) && is_object_aligned(addr) && is_in(addr);
 }
 
 #endif // SHARE_GC_Z_ZHEAP_INLINE_HPP
--- a/src/hotspot/share/gc/z/zLock.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zLock.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,16 +25,13 @@
 #define SHARE_GC_Z_ZLOCK_HPP
 
 #include "memory/allocation.hpp"
-#include <pthread.h>
+#include "runtime/os.hpp"
 
 class ZLock {
 private:
-  pthread_mutex_t _lock;
+  os::PlatformMutex _lock;
 
 public:
-  ZLock();
-  ~ZLock();
-
   void lock();
   bool try_lock();
   void unlock();
--- a/src/hotspot/share/gc/z/zLock.inline.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zLock.inline.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,27 +26,20 @@
 
 #include "gc/z/zLock.hpp"
 #include "runtime/atomic.hpp"
+#include "runtime/os.inline.hpp"
 #include "runtime/thread.hpp"
 #include "utilities/debug.hpp"
 
-inline ZLock::ZLock() {
-  pthread_mutex_init(&_lock, NULL);
-}
-
-inline ZLock::~ZLock() {
-  pthread_mutex_destroy(&_lock);
-}
-
 inline void ZLock::lock() {
-  pthread_mutex_lock(&_lock);
+  _lock.lock();
 }
 
 inline bool ZLock::try_lock() {
-  return pthread_mutex_trylock(&_lock) == 0;
+  return _lock.try_lock();
 }
 
 inline void ZLock::unlock() {
-  pthread_mutex_unlock(&_lock);
+  _lock.unlock();
 }
 
 inline ZReentrantLock::ZReentrantLock() :
--- a/src/hotspot/share/gc/z/zNMethod.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zNMethod.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -266,10 +266,11 @@
     // handshake separating unlink and purge.
     nm->flush_dependencies(false /* delete_immediately */);
 
-    // We don't need to take the lock when unlinking nmethods from
+    // unlink_from_method will take the CompiledMethod_lock.
+    // In this case we don't strictly need it when unlinking nmethods from
     // the Method, because it is only concurrently unlinked by
     // the entry barrier, which acquires the per nmethod lock.
-    nm->unlink_from_method(false /* acquire_lock */);
+    nm->unlink_from_method();
 
     if (nm->is_osr_method()) {
       // Invalidate the osr nmethod before the handshake. The nmethod
--- a/src/hotspot/share/gc/z/zNMethodData.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zNMethodData.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -45,7 +45,7 @@
     _has_non_immediates(has_non_immediates) {
   // Save all immediate oops
   for (size_t i = 0; i < immediates_count(); i++) {
-    immediates_begin()[i] = immediates.at(i);
+    immediates_begin()[i] = immediates.at(int(i));
   }
 }
 
--- a/src/hotspot/share/gc/z/zNUMA.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zNUMA.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -21,6 +21,7 @@
  * questions.
  */
 
+#include "precompiled.hpp"
 #include "gc/z/zNUMA.hpp"
 #include "logging/log.hpp"
 #include "runtime/os.hpp"
--- a/src/hotspot/share/gc/z/zPageAllocator.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zPageAllocator.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -94,7 +94,7 @@
                                size_t max_capacity,
                                size_t max_reserve) :
     _lock(),
-    _virtual(),
+    _virtual(max_capacity),
     _physical(),
     _cache(),
     _min_capacity(min_capacity),
--- a/src/hotspot/share/gc/z/zRelocate.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zRelocate.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -126,7 +126,7 @@
   // Relocation contention
   ZStatInc(ZCounterRelocationContention);
   log_trace(gc)("Relocation contention, thread: " PTR_FORMAT " (%s), forwarding: " PTR_FORMAT
-                ", entry: " UINT32_FORMAT ", oop: " PTR_FORMAT ", size: " SIZE_FORMAT,
+                ", entry: " SIZE_FORMAT ", oop: " PTR_FORMAT ", size: " SIZE_FORMAT,
                 ZThread::id(), ZThread::name(), p2i(forwarding), cursor, from_good, size);
 
   // Try undo allocation
--- a/src/hotspot/share/gc/z/zStat.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zStat.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -354,12 +354,11 @@
 
 void ZStatValue::initialize() {
   // Finalize and align CPU offset
-  _cpu_offset = align_up(_cpu_offset, ZCacheLineSize);
+  _cpu_offset = align_up(_cpu_offset, (uint32_t)ZCacheLineSize);
 
   // Allocation aligned memory
   const size_t size = _cpu_offset * ZCPU::count();
   _base = ZUtils::alloc_aligned(ZCacheLineSize, size);
-  memset((void*)_base, 0, size);
 }
 
 const char* ZStatValue::group() const {
@@ -755,7 +754,7 @@
 //
 // Stat timer
 //
-__thread uint32_t ZStatTimerDisable::_active = 0;
+THREAD_LOCAL uint32_t ZStatTimerDisable::_active = 0;
 
 //
 // Stat sample/inc
--- a/src/hotspot/share/gc/z/zStat.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zStat.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -29,6 +29,7 @@
 #include "gc/z/zMetronome.hpp"
 #include "logging/logHandle.hpp"
 #include "memory/allocation.hpp"
+#include "utilities/globalDefinitions.hpp"
 #include "utilities/numberSeq.hpp"
 #include "utilities/ticks.hpp"
 
@@ -271,7 +272,7 @@
 //
 class ZStatTimerDisable : public StackObj {
 private:
-  static __thread uint32_t _active;
+  static THREAD_LOCAL uint32_t _active;
 
 public:
   ZStatTimerDisable() {
--- a/src/hotspot/share/gc/z/zThread.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zThread.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -26,13 +26,13 @@
 #include "runtime/thread.hpp"
 #include "utilities/debug.hpp"
 
-__thread bool      ZThread::_initialized;
-__thread uintptr_t ZThread::_id;
-__thread bool      ZThread::_is_vm;
-__thread bool      ZThread::_is_java;
-__thread bool      ZThread::_is_worker;
-__thread bool      ZThread::_is_runtime_worker;
-__thread uint      ZThread::_worker_id;
+THREAD_LOCAL bool      ZThread::_initialized;
+THREAD_LOCAL uintptr_t ZThread::_id;
+THREAD_LOCAL bool      ZThread::_is_vm;
+THREAD_LOCAL bool      ZThread::_is_java;
+THREAD_LOCAL bool      ZThread::_is_worker;
+THREAD_LOCAL bool      ZThread::_is_runtime_worker;
+THREAD_LOCAL uint      ZThread::_worker_id;
 
 void ZThread::initialize() {
   assert(!_initialized, "Already initialized");
--- a/src/hotspot/share/gc/z/zThread.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zThread.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -25,6 +25,7 @@
 #define SHARE_GC_Z_ZTHREAD_HPP
 
 #include "memory/allocation.hpp"
+#include "utilities/globalDefinitions.hpp"
 #include "utilities/debug.hpp"
 
 class ZThread : public AllStatic {
@@ -33,13 +34,13 @@
   friend class ZRuntimeWorkersInitializeTask;
 
 private:
-  static __thread bool      _initialized;
-  static __thread uintptr_t _id;
-  static __thread bool      _is_vm;
-  static __thread bool      _is_java;
-  static __thread bool      _is_worker;
-  static __thread bool      _is_runtime_worker;
-  static __thread uint      _worker_id;
+  static THREAD_LOCAL bool      _initialized;
+  static THREAD_LOCAL uintptr_t _id;
+  static THREAD_LOCAL bool      _is_vm;
+  static THREAD_LOCAL bool      _is_java;
+  static THREAD_LOCAL bool      _is_worker;
+  static THREAD_LOCAL bool      _is_runtime_worker;
+  static THREAD_LOCAL uint      _worker_id;
 
   static void initialize();
 
--- a/src/hotspot/share/gc/z/zUncommitter.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zUncommitter.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -36,7 +36,7 @@
 
 bool ZUncommitter::idle(uint64_t timeout) {
   // Idle for at least one second
-  const uint64_t expires = os::elapsedTime() + MAX2(timeout, 1ul);
+  const uint64_t expires = os::elapsedTime() + MAX2<uint64_t>(timeout, 1);
 
   for (;;) {
     // We might wake up spuriously from wait, so always recalculate
--- a/src/hotspot/share/gc/z/zUtils.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-#include "precompiled.hpp"
-#include "gc/z/zUtils.inline.hpp"
-#include "utilities/debug.hpp"
-
-#include <stdlib.h>
-
-uintptr_t ZUtils::alloc_aligned(size_t alignment, size_t size) {
-  void* res = NULL;
-
-  if (posix_memalign(&res, alignment, size) != 0) {
-    fatal("posix_memalign() failed");
-  }
-
-  memset(res, 0, size);
-
-  return (uintptr_t)res;
-}
--- a/src/hotspot/share/gc/z/zVirtualMemory.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zVirtualMemory.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -27,28 +27,39 @@
 #include "logging/log.hpp"
 #include "services/memTracker.hpp"
 
-ZVirtualMemoryManager::ZVirtualMemoryManager() :
+ZVirtualMemoryManager::ZVirtualMemoryManager(size_t max_capacity) :
     _manager(),
     _initialized(false) {
 
-  log_info(gc, init)("Address Space: " PTR_FORMAT " - " PTR_FORMAT " (" SIZE_FORMAT "T)",
-                     ZAddressSpaceStart, ZAddressSpaceEnd, ZAddressSpaceSize / K / G);
+  log_info(gc, init)("Address Space: " SIZE_FORMAT "T", ZAddressOffsetMax / K / G);
 
   // Reserve address space
-  if (!reserve(ZAddressSpaceStart, ZAddressSpaceSize)) {
+  if (reserve(0, ZAddressOffsetMax) < max_capacity) {
+    log_error(gc)("Failed to reserve address space for Java heap");
     return;
   }
 
-  // Make the complete address view free
-  _manager.free(0, ZAddressOffsetMax);
-
-  // Register address space with native memory tracker
-  nmt_reserve(ZAddressSpaceStart, ZAddressSpaceSize);
-
   // Successfully initialized
   _initialized = true;
 }
 
+size_t ZVirtualMemoryManager::reserve(uintptr_t start, size_t size) {
+  if (size < ZGranuleSize) {
+    // Too small
+    return 0;
+  }
+
+  if (!reserve_platform(start, size)) {
+    const size_t half = size / 2;
+    return reserve(start, half) + reserve(start + half, half);
+  }
+
+  // Make the address range free
+  _manager.free(start, size);
+
+  return size;
+}
+
 void ZVirtualMemoryManager::nmt_reserve(uintptr_t start, size_t size) {
   MemTracker::record_virtual_memory_reserve((void*)start, size, CALLER_PC);
   MemTracker::record_virtual_memory_type((void*)start, mtJavaHeap);
--- a/src/hotspot/share/gc/z/zVirtualMemory.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/gc/z/zVirtualMemory.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -50,11 +50,12 @@
   ZMemoryManager _manager;
   bool           _initialized;
 
-  bool reserve(uintptr_t start, size_t size);
+  bool reserve_platform(uintptr_t start, size_t size);
+  size_t reserve(uintptr_t start, size_t size);
   void nmt_reserve(uintptr_t start, size_t size);
 
 public:
-  ZVirtualMemoryManager();
+  ZVirtualMemoryManager(size_t max_capacity);
 
   bool is_initialized() const;
 
--- a/src/hotspot/share/interpreter/bytecodeInterpreter.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/interpreter/bytecodeInterpreter.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -2436,7 +2436,7 @@
                   handle_exception);
           result = THREAD->vm_result();
         }
-        if (oopDesc::equals(result, Universe::the_null_sentinel()))
+        if (result == Universe::the_null_sentinel())
           result = NULL;
 
         VERIFY_OOP(result);
--- a/src/hotspot/share/interpreter/bytecodeTracer.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/interpreter/bytecodeTracer.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -449,7 +449,7 @@
     case Bytecodes::_newarray: {
         BasicType atype = (BasicType)get_index_u1();
         const char* str = type2name(atype);
-        if (str == NULL || atype == T_OBJECT || atype == T_ARRAY) {
+        if (str == NULL || is_reference_type(atype)) {
           assert(false, "Unidentified basic type");
         }
         st->print_cr(" %s", str);
--- a/src/hotspot/share/interpreter/interpreterRuntime.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/interpreter/interpreterRuntime.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -206,7 +206,7 @@
     if (rindex >= 0) {
       oop coop = m->constants()->resolved_references()->obj_at(rindex);
       oop roop = (result == NULL ? Universe::the_null_sentinel() : result);
-      assert(oopDesc::equals(roop, coop), "expected result for assembly code");
+      assert(roop == coop, "expected result for assembly code");
     }
   }
 #endif
--- a/src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -44,7 +44,6 @@
 #include "memory/allocation.inline.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/array.hpp"
-#include "oops/constantPool.hpp"
 #include "oops/instanceKlass.hpp"
 #include "oops/method.hpp"
 #include "prims/jvmtiRedefineClasses.hpp"
@@ -1522,7 +1521,7 @@
     assert(new_method != NULL, "invariant");
     assert(new_method->name() == old_method->name(), "invariant");
     assert(new_method->signature() == old_method->signature(), "invariant");
-    *new_method->trace_flags_addr() = old_method->trace_flags();
+    new_method->set_trace_flags(old_method->trace_flags());
     assert(new_method->trace_flags() == old_method->trace_flags(), "invariant");
   }
 }
--- a/src/hotspot/share/jfr/jfr.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/jfr.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -84,7 +84,9 @@
 }
 
 void Jfr::weak_oops_do(BoolObjectClosure* is_alive, OopClosure* f) {
-  LeakProfiler::oops_do(is_alive, f);
+  if (LeakProfiler::is_running()) {
+    LeakProfiler::oops_do(is_alive, f);
+  }
 }
 
 bool Jfr::on_flight_recorder_option(const JavaVMOption** option, char* delimiter) {
--- a/src/hotspot/share/jfr/leakprofiler/chains/edgeStore.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/leakprofiler/chains/edgeStore.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -55,18 +55,23 @@
   return !_edges->has_entries();
 }
 
-void EdgeStore::assign_id(EdgeEntry* entry) {
+void EdgeStore::on_link(EdgeEntry* entry) {
   assert(entry != NULL, "invariant");
   assert(entry->id() == 0, "invariant");
   entry->set_id(++_edge_id_counter);
 }
 
-bool EdgeStore::equals(const Edge& query, uintptr_t hash, const EdgeEntry* entry) {
+bool EdgeStore::on_equals(uintptr_t hash, const EdgeEntry* entry) {
   assert(entry != NULL, "invariant");
   assert(entry->hash() == hash, "invariant");
   return true;
 }
 
+void EdgeStore::on_unlink(EdgeEntry* entry) {
+  assert(entry != NULL, "invariant");
+  // nothing
+}
+
 #ifdef ASSERT
 bool EdgeStore::contains(const oop* reference) const {
   return get(reference) != NULL;
@@ -75,22 +80,21 @@
 
 StoredEdge* EdgeStore::get(const oop* reference) const {
   assert(reference != NULL, "invariant");
-  const StoredEdge e(NULL, reference);
-  EdgeEntry* const entry = _edges->lookup_only(e, (uintptr_t)reference);
+  EdgeEntry* const entry = _edges->lookup_only((uintptr_t)reference);
   return entry != NULL ? entry->literal_addr() : NULL;
 }
 
 StoredEdge* EdgeStore::put(const oop* reference) {
   assert(reference != NULL, "invariant");
   const StoredEdge e(NULL, reference);
-  assert(NULL == _edges->lookup_only(e, (uintptr_t)reference), "invariant");
-  EdgeEntry& entry = _edges->put(e, (uintptr_t)reference);
+  assert(NULL == _edges->lookup_only((uintptr_t)reference), "invariant");
+  EdgeEntry& entry = _edges->put((uintptr_t)reference, e);
   return entry.literal_addr();
 }
 
 traceid EdgeStore::get_id(const Edge* edge) const {
   assert(edge != NULL, "invariant");
-  EdgeEntry* const entry = _edges->lookup_only(*edge, (uintptr_t)edge->reference());
+  EdgeEntry* const entry = _edges->lookup_only((uintptr_t)edge->reference());
   assert(entry != NULL, "invariant");
   return entry->id();
 }
--- a/src/hotspot/share/jfr/leakprofiler/chains/edgeStore.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/leakprofiler/chains/edgeStore.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -58,7 +58,7 @@
 };
 
 class EdgeStore : public CHeapObj<mtTracing> {
-  typedef HashTableHost<StoredEdge, traceid, Entry, EdgeStore> EdgeHashTable;
+  typedef HashTableHost<StoredEdge, traceid, JfrHashtableEntry, EdgeStore> EdgeHashTable;
   typedef EdgeHashTable::HashEntry EdgeEntry;
   template <typename,
             typename,
@@ -74,8 +74,9 @@
   EdgeHashTable* _edges;
 
   // Hash table callbacks
-  void assign_id(EdgeEntry* entry);
-  bool equals(const Edge& query, uintptr_t hash, const EdgeEntry* entry);
+  void on_link(EdgeEntry* entry);
+  bool on_equals(uintptr_t hash, const EdgeEntry* entry);
+  void on_unlink(EdgeEntry* entry);
 
   StoredEdge* get(const oop* reference) const;
   StoredEdge* put(const oop* reference);
--- a/src/hotspot/share/jfr/leakprofiler/chains/pathToGcRootsOperation.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/leakprofiler/chains/pathToGcRootsOperation.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -43,7 +43,6 @@
 #include "jfr/leakprofiler/utilities/granularTimer.hpp"
 #include "logging/log.hpp"
 #include "memory/universe.hpp"
-#include "oops/markWord.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/safepoint.hpp"
 #include "utilities/globalDefinitions.hpp"
@@ -101,7 +100,7 @@
   // Save the original markWord for the potential leak objects,
   // to be restored on function exit
   ObjectSampleMarker marker;
-  if (ObjectSampleCheckpoint::mark(_sampler, marker, _emit_all) == 0) {
+  if (ObjectSampleCheckpoint::save_mark_words(_sampler, marker, _emit_all) == 0) {
     // no valid samples to process
     return;
   }
--- a/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -24,10 +24,6 @@
 
 #include "precompiled.hpp"
 #include "jfr/jfrEvents.hpp"
-#include "jfr/recorder/jfrRecorder.hpp"
-#include "jfr/recorder/checkpoint/jfrCheckpointWriter.hpp"
-#include "jfr/recorder/checkpoint/types/traceid/jfrTraceId.inline.hpp"
-#include "jfr/recorder/stacktrace/jfrStackTraceRepository.hpp"
 #include "jfr/leakprofiler/chains/edgeStore.hpp"
 #include "jfr/leakprofiler/chains/objectSampleMarker.hpp"
 #include "jfr/leakprofiler/checkpoint/objectSampleCheckpoint.hpp"
@@ -35,14 +31,101 @@
 #include "jfr/leakprofiler/leakProfiler.hpp"
 #include "jfr/leakprofiler/sampling/objectSample.hpp"
 #include "jfr/leakprofiler/sampling/objectSampler.hpp"
-#include "jfr/leakprofiler/utilities/rootType.hpp"
-#include "jfr/metadata/jfrSerializer.hpp"
-#include "runtime/interfaceSupport.inline.hpp"
-#include "runtime/mutexLocker.hpp"
-#include "runtime/thread.inline.hpp"
+#include "jfr/recorder/checkpoint/jfrCheckpointWriter.hpp"
+#include "jfr/recorder/checkpoint/types/traceid/jfrTraceId.inline.hpp"
+#include "jfr/recorder/service/jfrOptionSet.hpp"
+#include "jfr/recorder/stacktrace/jfrStackTraceRepository.hpp"
+#include "jfr/utilities/jfrHashtable.hpp"
+#include "jfr/utilities/jfrTypes.hpp"
+#include "runtime/safepoint.hpp"
+#include "runtime/thread.hpp"
+#include "utilities/growableArray.hpp"
+
+static bool predicate(GrowableArray<traceid>* set, traceid id) {
+  assert(set != NULL, "invariant");
+  bool found = false;
+  set->find_sorted<traceid, compare_traceid>(id, found);
+  return found;
+}
+
+static bool mutable_predicate(GrowableArray<traceid>* set, traceid id) {
+  assert(set != NULL, "invariant");
+  bool found = false;
+  const int location = set->find_sorted<traceid, compare_traceid>(id, found);
+  if (!found) {
+    set->insert_before(location, id);
+  }
+  return found;
+}
+
+static bool add(GrowableArray<traceid>* set, traceid id) {
+  assert(set != NULL, "invariant");
+  return mutable_predicate(set, id);
+}
+
+const int initial_array_size = 64;
+
+template <typename T>
+static GrowableArray<T>* c_heap_allocate_array(int size = initial_array_size) {
+  return new (ResourceObj::C_HEAP, mtTracing) GrowableArray<T>(size, true, mtTracing);
+}
+
+static GrowableArray<traceid>* unloaded_thread_id_set = NULL;
 
-template <typename SampleProcessor>
-static void do_samples(ObjectSample* sample, const ObjectSample* const end, SampleProcessor& processor) {
+class ThreadIdExclusiveAccess : public StackObj {
+ private:
+  static Semaphore _mutex_semaphore;
+ public:
+  ThreadIdExclusiveAccess() { _mutex_semaphore.wait(); }
+  ~ThreadIdExclusiveAccess() { _mutex_semaphore.signal(); }
+};
+
+Semaphore ThreadIdExclusiveAccess::_mutex_semaphore(1);
+
+static bool has_thread_exited(traceid tid) {
+  assert(tid != 0, "invariant");
+  return unloaded_thread_id_set != NULL && predicate(unloaded_thread_id_set, tid);
+}
+
+static void add_to_unloaded_thread_set(traceid tid) {
+  ThreadIdExclusiveAccess lock;
+  if (unloaded_thread_id_set == NULL) {
+    unloaded_thread_id_set = c_heap_allocate_array<traceid>();
+  }
+  add(unloaded_thread_id_set, tid);
+}
+
+void ObjectSampleCheckpoint::on_thread_exit(JavaThread* jt) {
+  assert(jt != NULL, "invariant");
+  if (LeakProfiler::is_running()) {
+    add_to_unloaded_thread_set(jt->jfr_thread_local()->thread_id());
+  }
+}
+
+// Track the set of unloaded klasses during a chunk / epoch.
+// Methods in stacktraces belonging to unloaded klasses must not be accessed.
+static GrowableArray<traceid>* unloaded_klass_set = NULL;
+
+static void add_to_unloaded_klass_set(traceid klass_id) {
+  if (unloaded_klass_set == NULL) {
+    unloaded_klass_set = c_heap_allocate_array<traceid>();
+  }
+  unloaded_klass_set->append(klass_id);
+}
+
+static void sort_unloaded_klass_set() {
+  if (unloaded_klass_set != NULL && unloaded_klass_set->length() > 1) {
+    unloaded_klass_set->sort(sort_traceid);
+  }
+}
+
+void ObjectSampleCheckpoint::on_klass_unload(const Klass* k) {
+  assert(k != NULL, "invariant");
+  add_to_unloaded_klass_set(TRACE_ID(k));
+}
+
+template <typename Processor>
+static void do_samples(ObjectSample* sample, const ObjectSample* end, Processor& processor) {
   assert(sample != NULL, "invariant");
   while (sample != end) {
     processor.sample_do(sample);
@@ -50,244 +133,339 @@
   }
 }
 
-class RootSystemType : public JfrSerializer {
- public:
-  void serialize(JfrCheckpointWriter& writer) {
-    const u4 nof_root_systems = OldObjectRoot::_number_of_systems;
-    writer.write_count(nof_root_systems);
-    for (u4 i = 0; i < nof_root_systems; ++i) {
-      writer.write_key(i);
-      writer.write(OldObjectRoot::system_description((OldObjectRoot::System)i));
-    }
-  }
-};
+template <typename Processor>
+static void iterate_samples(Processor& processor, bool all = false) {
+  ObjectSampler* const sampler = ObjectSampler::sampler();
+  assert(sampler != NULL, "invariant");
+  ObjectSample* const last = sampler->last();
+  assert(last != NULL, "invariant");
+  do_samples(last, all ? NULL : sampler->last_resolved(), processor);
+}
 
-class RootType : public JfrSerializer {
+class SampleMarker {
+ private:
+  ObjectSampleMarker& _marker;
+  jlong _last_sweep;
+  int _count;
  public:
-  void serialize(JfrCheckpointWriter& writer) {
-    const u4 nof_root_types = OldObjectRoot::_number_of_types;
-    writer.write_count(nof_root_types);
-    for (u4 i = 0; i < nof_root_types; ++i) {
-      writer.write_key(i);
-      writer.write(OldObjectRoot::type_description((OldObjectRoot::Type)i));
-    }
-  }
-};
-
-class CheckpointInstall {
- private:
-  const JfrCheckpointBlobHandle& _cp;
- public:
-  CheckpointInstall(const JfrCheckpointBlobHandle& cp) : _cp(cp) {}
+  SampleMarker(ObjectSampleMarker& marker, jlong last_sweep) : _marker(marker), _last_sweep(last_sweep), _count(0) {}
   void sample_do(ObjectSample* sample) {
-    assert(sample != NULL, "invariant");
-    if (!sample->is_dead()) {
-      sample->set_klass_checkpoint(_cp);
+    if (sample->is_alive_and_older_than(_last_sweep)) {
+      _marker.mark(sample->object());
+      ++_count;
     }
   }
-};
-
-class CheckpointWrite {
- private:
-  JfrCheckpointWriter& _writer;
-  const jlong _last_sweep;
- public:
-  CheckpointWrite(JfrCheckpointWriter& writer, jlong last_sweep) : _writer(writer), _last_sweep(last_sweep) {}
-  void sample_do(ObjectSample* sample) {
-    assert(sample != NULL, "invariant");
-    if (sample->is_alive_and_older_than(_last_sweep)) {
-      if (sample->has_thread_checkpoint()) {
-        const JfrCheckpointBlobHandle& thread_cp = sample->thread_checkpoint();
-        thread_cp->exclusive_write(_writer);
-      }
-      if (sample->has_klass_checkpoint()) {
-        const JfrCheckpointBlobHandle& klass_cp = sample->klass_checkpoint();
-        klass_cp->exclusive_write(_writer);
-      }
-    }
-  }
-};
-
-class CheckpointStateReset {
- private:
-  const jlong _last_sweep;
- public:
-  CheckpointStateReset(jlong last_sweep) : _last_sweep(last_sweep) {}
-  void sample_do(ObjectSample* sample) {
-    assert(sample != NULL, "invariant");
-    if (sample->is_alive_and_older_than(_last_sweep)) {
-      if (sample->has_thread_checkpoint()) {
-        const JfrCheckpointBlobHandle& thread_cp = sample->thread_checkpoint();
-        thread_cp->reset_write_state();
-      }
-      if (sample->has_klass_checkpoint()) {
-        const JfrCheckpointBlobHandle& klass_cp = sample->klass_checkpoint();
-        klass_cp->reset_write_state();
-      }
-    }
-  }
-};
-
-class StackTraceWrite {
- private:
-  JfrStackTraceRepository& _stack_trace_repo;
-  JfrCheckpointWriter& _writer;
-  int _count;
- public:
-  StackTraceWrite(JfrStackTraceRepository& stack_trace_repo, JfrCheckpointWriter& writer) :
-    _stack_trace_repo(stack_trace_repo), _writer(writer), _count(0) {
-    JfrStacktrace_lock->lock_without_safepoint_check();
-  }
-  ~StackTraceWrite() {
-    assert(JfrStacktrace_lock->owned_by_self(), "invariant");
-    JfrStacktrace_lock->unlock();
-  }
-
-  void sample_do(ObjectSample* sample) {
-    assert(sample != NULL, "invariant");
-    if (!sample->is_dead()) {
-      if (sample->has_stack_trace()) {
-        JfrTraceId::use(sample->klass(), true);
-        _stack_trace_repo.write(_writer, sample->stack_trace_id(), sample->stack_trace_hash());
-        ++_count;
-      }
-    }
-  }
-
   int count() const {
     return _count;
   }
 };
 
-class SampleMark {
+int ObjectSampleCheckpoint::save_mark_words(const ObjectSampler* sampler, ObjectSampleMarker& marker, bool emit_all) {
+  assert(sampler != NULL, "invariant");
+  if (sampler->last() == NULL) {
+    return 0;
+  }
+  SampleMarker sample_marker(marker, emit_all ? max_jlong : sampler->last_sweep().value());
+  iterate_samples(sample_marker, true);
+  return sample_marker.count();
+}
+
+class BlobCache {
+  typedef HashTableHost<JfrBlobHandle, traceid, JfrHashtableEntry, BlobCache> BlobTable;
+  typedef BlobTable::HashEntry BlobEntry;
  private:
-  ObjectSampleMarker& _marker;
-  jlong _last_sweep;
-  int _count;
+  BlobTable _table;
+  traceid _lookup_id;
  public:
-  SampleMark(ObjectSampleMarker& marker, jlong last_sweep) : _marker(marker),
-                                                             _last_sweep(last_sweep),
-                                                             _count(0) {}
+  BlobCache(size_t size) : _table(this, size), _lookup_id(0) {}
+  JfrBlobHandle get(const ObjectSample* sample);
+  void put(const ObjectSample* sample, const JfrBlobHandle& blob);
+  // Hash table callbacks
+  void on_link(const BlobEntry* entry) const;
+  bool on_equals(uintptr_t hash, const BlobEntry* entry) const;
+  void on_unlink(BlobEntry* entry) const;
+};
+
+JfrBlobHandle BlobCache::get(const ObjectSample* sample) {
+  assert(sample != NULL, "invariant");
+  _lookup_id = sample->stack_trace_id();
+  assert(_lookup_id != 0, "invariant");
+  BlobEntry* const entry = _table.lookup_only(sample->stack_trace_hash());
+  return entry != NULL ? entry->literal() : JfrBlobHandle();
+}
+
+void BlobCache::put(const ObjectSample* sample, const JfrBlobHandle& blob) {
+  assert(sample != NULL, "invariant");
+  assert(_table.lookup_only(sample->stack_trace_hash()) == NULL, "invariant");
+  _lookup_id = sample->stack_trace_id();
+  assert(_lookup_id != 0, "invariant");
+  _table.put(sample->stack_trace_hash(), blob);
+}
+
+inline void BlobCache::on_link(const BlobEntry* entry) const {
+  assert(entry != NULL, "invariant");
+  assert(entry->id() == 0, "invariant");
+  entry->set_id(_lookup_id);
+}
+
+inline bool BlobCache::on_equals(uintptr_t hash, const BlobEntry* entry) const {
+  assert(entry != NULL, "invariant");
+  assert(entry->hash() == hash, "invariant");
+  return entry->id() == _lookup_id;
+}
+
+inline void BlobCache::on_unlink(BlobEntry* entry) const {
+  assert(entry != NULL, "invariant");
+}
+
+static GrowableArray<traceid>* id_set = NULL;
+
+static void prepare_for_resolution() {
+  id_set = new GrowableArray<traceid>(JfrOptionSet::old_object_queue_size());
+  sort_unloaded_klass_set();
+}
+
+static bool stack_trace_precondition(const ObjectSample* sample) {
+  assert(sample != NULL, "invariant");
+  return sample->has_stack_trace_id() && !sample->is_dead();
+}
+
+class StackTraceBlobInstaller {
+ private:
+  const JfrStackTraceRepository& _stack_trace_repo;
+  BlobCache _cache;
+  const JfrStackTrace* resolve(const ObjectSample* sample);
+  void install(ObjectSample* sample);
+ public:
+  StackTraceBlobInstaller(const JfrStackTraceRepository& stack_trace_repo);
   void sample_do(ObjectSample* sample) {
-    assert(sample != NULL, "invariant");
-    if (sample->is_alive_and_older_than(_last_sweep)) {
-      _marker.mark(sample->object());
-      ++_count;
+    if (stack_trace_precondition(sample)) {
+      install(sample);
     }
   }
-
-  int count() const {
-    return _count;
-  }
 };
 
-void ObjectSampleCheckpoint::install(JfrCheckpointWriter& writer, bool class_unload, bool type_set) {
-  if (!writer.has_data()) {
+StackTraceBlobInstaller::StackTraceBlobInstaller(const JfrStackTraceRepository& stack_trace_repo) :
+  _stack_trace_repo(stack_trace_repo), _cache(JfrOptionSet::old_object_queue_size()) {
+  prepare_for_resolution();
+}
+
+const JfrStackTrace* StackTraceBlobInstaller::resolve(const ObjectSample* sample) {
+  return _stack_trace_repo.lookup(sample->stack_trace_hash(), sample->stack_trace_id());
+}
+
+#ifdef ASSERT
+static void validate_stack_trace(const ObjectSample* sample, const JfrStackTrace* stack_trace) {
+  assert(!sample->has_stacktrace(), "invariant");
+  assert(stack_trace != NULL, "invariant");
+  assert(stack_trace->hash() == sample->stack_trace_hash(), "invariant");
+  assert(stack_trace->id() == sample->stack_trace_id(), "invariant");
+}
+#endif
+
+void StackTraceBlobInstaller::install(ObjectSample* sample) {
+  JfrBlobHandle blob = _cache.get(sample);
+  if (blob.valid()) {
+    sample->set_stacktrace(blob);
     return;
   }
-
-  assert(writer.has_data(), "invariant");
-  const JfrCheckpointBlobHandle h_cp = writer.checkpoint_blob();
-  CheckpointInstall install(h_cp);
-
-  // Class unload implies a safepoint.
-  // Not class unload implies the object sampler is locked, because it was claimed exclusively earlier.
-  // Therefore: direct access the object sampler instance is safe.
-  ObjectSampler* const object_sampler = ObjectSampler::sampler();
-  assert(object_sampler != NULL, "invariant");
+  const JfrStackTrace* const stack_trace = resolve(sample);
+  DEBUG_ONLY(validate_stack_trace(sample, stack_trace));
+  JfrCheckpointWriter writer(false, true, Thread::current());
+  writer.write_type(TYPE_STACKTRACE);
+  writer.write_count(1);
+  ObjectSampleCheckpoint::write_stacktrace(stack_trace, writer);
+  blob = writer.move();
+  _cache.put(sample, blob);
+  sample->set_stacktrace(blob);
+}
 
-  ObjectSample* const last = const_cast<ObjectSample*>(object_sampler->last());
-  const ObjectSample* const last_resolved = object_sampler->last_resolved();
-
-  // install only to new samples since last resolved checkpoint
-  if (last != last_resolved) {
-    do_samples(last, last_resolved, install);
-    if (class_unload) {
-      return;
-    }
-    if (type_set) {
-      object_sampler->set_last_resolved(last);
-    }
+static void install_stack_traces(const ObjectSampler* sampler, JfrStackTraceRepository& stack_trace_repo) {
+  assert(sampler != NULL, "invariant");
+  const ObjectSample* const last = sampler->last();
+  if (last != sampler->last_resolved()) {
+    StackTraceBlobInstaller installer(stack_trace_repo);
+    iterate_samples(installer);
   }
 }
 
-void ObjectSampleCheckpoint::write(ObjectSampler* sampler, EdgeStore* edge_store, bool emit_all, Thread* thread) {
+// caller needs ResourceMark
+void ObjectSampleCheckpoint::on_rotation(const ObjectSampler* sampler, JfrStackTraceRepository& stack_trace_repo) {
+  assert(sampler != NULL, "invariant");
+  assert(LeakProfiler::is_running(), "invariant");
+  install_stack_traces(sampler, stack_trace_repo);
+}
+
+static traceid get_klass_id(traceid method_id) {
+  assert(method_id != 0, "invariant");
+  return method_id >> TRACE_ID_SHIFT;
+}
+
+static bool is_klass_unloaded(traceid method_id) {
+  return unloaded_klass_set != NULL && predicate(unloaded_klass_set, get_klass_id(method_id));
+}
+
+static bool is_processed(traceid id) {
+  assert(id != 0, "invariant");
+  assert(id_set != NULL, "invariant");
+  return mutable_predicate(id_set, id);
+}
+
+void ObjectSampleCheckpoint::add_to_leakp_set(const Method* method, traceid method_id) {
+  if (is_processed(method_id) || is_klass_unloaded(method_id)) {
+    return;
+  }
+  JfrTraceId::set_leakp(method);
+}
+
+void ObjectSampleCheckpoint::write_stacktrace(const JfrStackTrace* trace, JfrCheckpointWriter& writer) {
+  assert(trace != NULL, "invariant");
+  // JfrStackTrace
+  writer.write(trace->id());
+  writer.write((u1)!trace->_reached_root);
+  writer.write(trace->_nr_of_frames);
+  // JfrStackFrames
+  for (u4 i = 0; i < trace->_nr_of_frames; ++i) {
+    const JfrStackFrame& frame = trace->_frames[i];
+    frame.write(writer);
+    add_to_leakp_set(frame._method, frame._methodid);
+  }
+}
+
+static void write_blob(const JfrBlobHandle& blob, JfrCheckpointWriter& writer, bool reset) {
+  if (reset) {
+    blob->reset_write_state();
+    return;
+  }
+  blob->exclusive_write(writer);
+}
+
+static void write_type_set_blob(const ObjectSample* sample, JfrCheckpointWriter& writer, bool reset) {
+  if (sample->has_type_set()) {
+    write_blob(sample->type_set(), writer, reset);
+  }
+}
+
+static void write_thread_blob(const ObjectSample* sample, JfrCheckpointWriter& writer, bool reset) {
+  assert(sample->has_thread(), "invariant");
+  if (has_thread_exited(sample->thread_id())) {
+    write_blob(sample->thread(), writer, reset);
+  }
+}
+
+static void write_stacktrace_blob(const ObjectSample* sample, JfrCheckpointWriter& writer, bool reset) {
+  if (sample->has_stacktrace()) {
+    write_blob(sample->stacktrace(), writer, reset);
+  }
+}
+
+static void write_blobs(const ObjectSample* sample, JfrCheckpointWriter& writer, bool reset) {
+  assert(sample != NULL, "invariant");
+  write_stacktrace_blob(sample, writer, reset);
+  write_thread_blob(sample, writer, reset);
+  write_type_set_blob(sample, writer, reset);
+}
+
+class BlobWriter {
+ private:
+  const ObjectSampler* _sampler;
+  JfrCheckpointWriter& _writer;
+  const jlong _last_sweep;
+  bool _reset;
+ public:
+  BlobWriter(const ObjectSampler* sampler, JfrCheckpointWriter& writer, jlong last_sweep) :
+    _sampler(sampler), _writer(writer), _last_sweep(last_sweep), _reset(false)  {}
+  void sample_do(ObjectSample* sample) {
+    if (sample->is_alive_and_older_than(_last_sweep)) {
+      write_blobs(sample, _writer, _reset);
+    }
+  }
+  void set_reset() {
+    _reset = true;
+  }
+};
+
+static void write_sample_blobs(const ObjectSampler* sampler, bool emit_all, Thread* thread) {
+  // sample set is predicated on time of last sweep
+  const jlong last_sweep = emit_all ? max_jlong : sampler->last_sweep().value();
+  JfrCheckpointWriter writer(false, false, thread);
+  BlobWriter cbw(sampler, writer, last_sweep);
+  iterate_samples(cbw, true);
+  // reset blob write states
+  cbw.set_reset();
+  iterate_samples(cbw, true);
+}
+
+void ObjectSampleCheckpoint::write(const ObjectSampler* sampler, EdgeStore* edge_store, bool emit_all, Thread* thread) {
   assert(sampler != NULL, "invariant");
   assert(edge_store != NULL, "invariant");
   assert(thread != NULL, "invariant");
-
-  static bool types_registered = false;
-  if (!types_registered) {
-    JfrSerializer::register_serializer(TYPE_OLDOBJECTROOTSYSTEM, false, true, new RootSystemType());
-    JfrSerializer::register_serializer(TYPE_OLDOBJECTROOTTYPE, false, true, new RootType());
-    types_registered = true;
-  }
-
-  const jlong last_sweep = emit_all ? max_jlong : sampler->last_sweep().value();
-  ObjectSample* const last = const_cast<ObjectSample*>(sampler->last());
-  {
-    JfrCheckpointWriter writer(false, false, thread);
-    CheckpointWrite checkpoint_write(writer, last_sweep);
-    do_samples(last, NULL, checkpoint_write);
-  }
-
-  CheckpointStateReset state_reset(last_sweep);
-  do_samples(last, NULL, state_reset);
-
+  write_sample_blobs(sampler, emit_all, thread);
+  // write reference chains
   if (!edge_store->is_empty()) {
-    // java object and chain representations
     JfrCheckpointWriter writer(false, true, thread);
     ObjectSampleWriter osw(writer, edge_store);
     edge_store->iterate(osw);
   }
 }
 
-int ObjectSampleCheckpoint::mark(ObjectSampler* object_sampler, ObjectSampleMarker& marker, bool emit_all) {
-  assert(object_sampler != NULL, "invariant");
-  ObjectSample* const last = const_cast<ObjectSample*>(object_sampler->last());
-  if (last == NULL) {
-    return 0;
+static void clear_unloaded_klass_set() {
+  if (unloaded_klass_set != NULL && unloaded_klass_set->is_nonempty()) {
+    unloaded_klass_set->clear();
   }
-  const jlong last_sweep = emit_all ? max_jlong : object_sampler->last_sweep().value();
-  SampleMark mark(marker, last_sweep);
-  do_samples(last, NULL, mark);
-  return mark.count();
+}
+
+// A linked list of saved type set blobs for the epoch.
+// The link consist of a reference counted handle.
+static JfrBlobHandle saved_type_set_blobs;
+
+static void release_state_for_previous_epoch() {
+  // decrements the reference count and the list is reinitialized
+  saved_type_set_blobs = JfrBlobHandle();
+  clear_unloaded_klass_set();
 }
 
-WriteObjectSampleStacktrace::WriteObjectSampleStacktrace(ObjectSampler* sampler, JfrStackTraceRepository& repo) :
-  _sampler(sampler), _stack_trace_repo(repo) {}
-
-bool WriteObjectSampleStacktrace::process() {
-  assert(LeakProfiler::is_running(), "invariant");
-  assert(_sampler != NULL, "invariant");
+class BlobInstaller {
+ public:
+  ~BlobInstaller() {
+    release_state_for_previous_epoch();
+  }
+  void sample_do(ObjectSample* sample) {
+    if (!sample->is_dead()) {
+      sample->set_type_set(saved_type_set_blobs);
+    }
+  }
+};
 
-  ObjectSample* const last = const_cast<ObjectSample*>(_sampler->last());
-  const ObjectSample* const last_resolved = _sampler->last_resolved();
-  if (last == last_resolved) {
-    return true;
-  }
-
-  JfrCheckpointWriter writer(false, true, Thread::current());
-  const JfrCheckpointContext ctx = writer.context();
-
-  writer.write_type(TYPE_STACKTRACE);
-  const jlong count_offset = writer.reserve(sizeof(u4));
+static void install_type_set_blobs() {
+  BlobInstaller installer;
+  iterate_samples(installer);
+}
 
-  int count = 0;
-  {
-    StackTraceWrite stack_trace_write(_stack_trace_repo, writer); // JfrStacktrace_lock
-    do_samples(last, last_resolved, stack_trace_write);
-    count = stack_trace_write.count();
+static void save_type_set_blob(JfrCheckpointWriter& writer, bool copy = false) {
+  assert(writer.has_data(), "invariant");
+  const JfrBlobHandle blob = copy ? writer.copy() : writer.move();
+  if (saved_type_set_blobs.valid()) {
+    saved_type_set_blobs->set_next(blob);
+  } else {
+    saved_type_set_blobs = blob;
   }
-  if (count == 0) {
-    writer.set_context(ctx);
-    return true;
+}
+
+void ObjectSampleCheckpoint::on_type_set(JfrCheckpointWriter& writer) {
+  assert(LeakProfiler::is_running(), "invariant");
+  const ObjectSample* last = ObjectSampler::sampler()->last();
+  if (writer.has_data() && last != NULL) {
+    save_type_set_blob(writer);
+    install_type_set_blobs();
+    ObjectSampler::sampler()->set_last_resolved(last);
   }
-  assert(count > 0, "invariant");
-  writer.write_count((u4)count, count_offset);
-  JfrStackTraceRepository::write_metadata(writer);
+}
 
-  // install the stacktrace checkpoint information to the candidates
-  ObjectSampleCheckpoint::install(writer, false, false);
-  return true;
+void ObjectSampleCheckpoint::on_type_set_unload(JfrCheckpointWriter& writer) {
+  assert(SafepointSynchronize::is_at_safepoint(), "invariant");
+  assert(LeakProfiler::is_running(), "invariant");
+  if (writer.has_data() && ObjectSampler::sampler()->last() != NULL) {
+    save_type_set_blob(writer, true);
+  }
 }
--- a/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -26,27 +26,35 @@
 #define SHARE_JFR_LEAKPROFILER_CHECKPOINT_OBJECTSAMPLECHECKPOINT_HPP
 
 #include "memory/allocation.hpp"
+#include "jfr/utilities/jfrTypes.hpp"
 
 class EdgeStore;
+class JavaThread;
 class JfrCheckpointWriter;
+class JfrStackTrace;
 class JfrStackTraceRepository;
+class Klass;
+class Method;
+class ObjectSample;
 class ObjectSampleMarker;
 class ObjectSampler;
+class Thread;
 
 class ObjectSampleCheckpoint : AllStatic {
+  friend class EventEmitter;
+  friend class PathToGcRootsOperation;
+  friend class StackTraceBlobInstaller;
+ private:
+  static void add_to_leakp_set(const Method* method, traceid method_id);
+  static int save_mark_words(const ObjectSampler* sampler, ObjectSampleMarker& marker, bool emit_all);
+  static void write_stacktrace(const JfrStackTrace* trace, JfrCheckpointWriter& writer);
+  static void write(const ObjectSampler* sampler, EdgeStore* edge_store, bool emit_all, Thread* thread);
  public:
-  static void install(JfrCheckpointWriter& writer, bool class_unload, bool type_set);
-  static void write(ObjectSampler* sampler, EdgeStore* edge_store, bool emit_all, Thread* thread);
-  static int mark(ObjectSampler* sampler, ObjectSampleMarker& marker, bool emit_all);
-};
-
-class WriteObjectSampleStacktrace : public StackObj {
- private:
-  ObjectSampler* const _sampler;
-  JfrStackTraceRepository& _stack_trace_repo;
- public:
-  WriteObjectSampleStacktrace(ObjectSampler* sampler, JfrStackTraceRepository& repo);
-  bool process();
+  static void on_klass_unload(const Klass* k);
+  static void on_type_set(JfrCheckpointWriter& writer);
+  static void on_type_set_unload(JfrCheckpointWriter& writer);
+  static void on_thread_exit(JavaThread* jt);
+  static void on_rotation(const ObjectSampler* sampler, JfrStackTraceRepository& repo);
 };
 
 #endif // SHARE_JFR_LEAKPROFILER_CHECKPOINT_OBJECTSAMPLECHECKPOINT_HPP
--- a/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleWriter.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleWriter.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -33,8 +33,8 @@
 #include "jfr/leakprofiler/sampling/objectSampler.hpp"
 #include "jfr/leakprofiler/utilities/rootType.hpp"
 #include "jfr/leakprofiler/utilities/unifiedOop.hpp"
-#include "jfr/recorder/checkpoint/types/jfrTypeSetUtils.hpp"
-#include "jfr/recorder/checkpoint/types/jfrTypeSetWriter.hpp"
+#include "jfr/metadata/jfrSerializer.hpp"
+#include "jfr/writers/jfrTypeWriterHost.hpp"
 #include "oops/oop.inline.hpp"
 #include "oops/symbol.hpp"
 #include "utilities/growableArray.hpp"
@@ -137,30 +137,33 @@
             typename,
             size_t>
   friend class HashTableHost;
-  typedef HashTableHost<const ObjectSampleFieldInfo*, traceid, Entry, FieldTable, 109> FieldInfoTable;
+  typedef HashTableHost<const ObjectSampleFieldInfo*, traceid, JfrHashtableEntry, FieldTable, 109> FieldInfoTable;
  public:
   typedef FieldInfoTable::HashEntry FieldInfoEntry;
 
  private:
   static traceid _field_id_counter;
   FieldInfoTable* _table;
+  const ObjectSampleFieldInfo* _lookup;
 
-  void assign_id(FieldInfoEntry* entry) {
+  void on_link(FieldInfoEntry* entry) {
     assert(entry != NULL, "invariant");
     entry->set_id(++_field_id_counter);
   }
 
-  bool equals(const ObjectSampleFieldInfo* query, uintptr_t hash, const FieldInfoEntry* entry) {
+  bool on_equals(uintptr_t hash, const FieldInfoEntry* entry) {
     assert(hash == entry->hash(), "invariant");
-    assert(query != NULL, "invariant");
-    const ObjectSampleFieldInfo* stored = entry->literal();
-    assert(stored != NULL, "invariant");
-    assert(stored->_field_name_symbol->identity_hash() == query->_field_name_symbol->identity_hash(), "invariant");
-    return stored->_field_modifiers == query->_field_modifiers;
+    assert(_lookup != NULL, "invariant");
+    return entry->literal()->_field_modifiers == _lookup->_field_modifiers;
+  }
+
+  void on_unlink(FieldInfoEntry* entry) {
+    assert(entry != NULL, "invariant");
+    // nothing
   }
 
  public:
-  FieldTable() : _table(new FieldInfoTable(this)) {}
+  FieldTable() : _table(new FieldInfoTable(this)), _lookup(NULL) {}
   ~FieldTable() {
     assert(_table != NULL, "invariant");
     delete _table;
@@ -168,8 +171,8 @@
 
   traceid store(const ObjectSampleFieldInfo* field_info) {
     assert(field_info != NULL, "invariant");
-    const FieldInfoEntry& entry =_table->lookup_put(field_info,
-                                                    field_info->_field_name_symbol->identity_hash());
+    _lookup = field_info;
+    const FieldInfoEntry& entry = _table->lookup_put(field_info->_field_name_symbol->identity_hash(), field_info);
     return entry.id();
   }
 
@@ -196,7 +199,7 @@
 static FieldTable* field_infos = NULL;
 static RootDescriptionInfo* root_infos = NULL;
 
-int __write_sample_info__(JfrCheckpointWriter* writer, JfrArtifactSet* unused, const void* si) {
+int __write_sample_info__(JfrCheckpointWriter* writer, const void* si) {
   assert(writer != NULL, "invariant");
   assert(si != NULL, "invariant");
   const OldObjectSampleInfo* const oosi = (const OldObjectSampleInfo*)si;
@@ -211,17 +214,17 @@
   return 1;
 }
 
-typedef JfrArtifactWriterImplHost<const OldObjectSampleInfo*, __write_sample_info__> SampleWriterImpl;
-typedef JfrArtifactWriterHost<SampleWriterImpl, TYPE_OLDOBJECT> SampleWriter;
+typedef JfrTypeWriterImplHost<const OldObjectSampleInfo*, __write_sample_info__> SampleWriterImpl;
+typedef JfrTypeWriterHost<SampleWriterImpl, TYPE_OLDOBJECT> SampleWriter;
 
 static void write_sample_infos(JfrCheckpointWriter& writer) {
   if (sample_infos != NULL) {
-    SampleWriter sw(&writer, NULL, false);
+    SampleWriter sw(&writer);
     sample_infos->iterate(sw);
   }
 }
 
-int __write_reference_info__(JfrCheckpointWriter* writer, JfrArtifactSet* unused, const void* ri) {
+int __write_reference_info__(JfrCheckpointWriter* writer, const void* ri) {
   assert(writer != NULL, "invariant");
   assert(ri != NULL, "invariant");
   const ReferenceInfo* const ref_info = (const ReferenceInfo*)ri;
@@ -233,17 +236,17 @@
   return 1;
 }
 
-typedef JfrArtifactWriterImplHost<const ReferenceInfo*, __write_reference_info__> ReferenceWriterImpl;
-typedef JfrArtifactWriterHost<ReferenceWriterImpl, TYPE_REFERENCE> ReferenceWriter;
+typedef JfrTypeWriterImplHost<const ReferenceInfo*, __write_reference_info__> ReferenceWriterImpl;
+typedef JfrTypeWriterHost<ReferenceWriterImpl, TYPE_REFERENCE> ReferenceWriter;
 
 static void write_reference_infos(JfrCheckpointWriter& writer) {
   if (ref_infos != NULL) {
-    ReferenceWriter rw(&writer, NULL, false);
+    ReferenceWriter rw(&writer);
     ref_infos->iterate(rw);
   }
 }
 
-int __write_array_info__(JfrCheckpointWriter* writer, JfrArtifactSet* unused, const void* ai) {
+int __write_array_info__(JfrCheckpointWriter* writer, const void* ai) {
   assert(writer != NULL, "invariant");
   assert(ai != NULL, "invariant");
   const ObjectSampleArrayInfo* const osai = (const ObjectSampleArrayInfo*)ai;
@@ -270,17 +273,17 @@
   return array_infos->store(osai);
 }
 
-typedef JfrArtifactWriterImplHost<const ObjectSampleArrayInfo*, __write_array_info__> ArrayWriterImpl;
-typedef JfrArtifactWriterHost<ArrayWriterImpl, TYPE_OLDOBJECTARRAY> ArrayWriter;
+typedef JfrTypeWriterImplHost<const ObjectSampleArrayInfo*, __write_array_info__> ArrayWriterImpl;
+typedef JfrTypeWriterHost<ArrayWriterImpl, TYPE_OLDOBJECTARRAY> ArrayWriter;
 
 static void write_array_infos(JfrCheckpointWriter& writer) {
   if (array_infos != NULL) {
-    ArrayWriter aw(&writer, NULL, false);
+    ArrayWriter aw(&writer);
     array_infos->iterate(aw);
   }
 }
 
-int __write_field_info__(JfrCheckpointWriter* writer, JfrArtifactSet* unused, const void* fi) {
+int __write_field_info__(JfrCheckpointWriter* writer, const void* fi) {
   assert(writer != NULL, "invariant");
   assert(fi != NULL, "invariant");
   const FieldTable::FieldInfoEntry* field_info_entry = (const FieldTable::FieldInfoEntry*)fi;
@@ -314,12 +317,12 @@
   return field_infos->store(osfi);
 }
 
-typedef JfrArtifactWriterImplHost<const FieldTable::FieldInfoEntry*, __write_field_info__> FieldWriterImpl;
-typedef JfrArtifactWriterHost<FieldWriterImpl, TYPE_OLDOBJECTFIELD> FieldWriter;
+typedef JfrTypeWriterImplHost<const FieldTable::FieldInfoEntry*, __write_field_info__> FieldWriterImpl;
+typedef JfrTypeWriterHost<FieldWriterImpl, TYPE_OLDOBJECTFIELD> FieldWriter;
 
 static void write_field_infos(JfrCheckpointWriter& writer) {
   if (field_infos != NULL) {
-    FieldWriter fw(&writer, NULL, false);
+    FieldWriter fw(&writer);
     field_infos->iterate(fw);
   }
 }
@@ -339,7 +342,7 @@
   return description.description();
 }
 
-int __write_root_description_info__(JfrCheckpointWriter* writer, JfrArtifactSet* unused, const void* di) {
+int __write_root_description_info__(JfrCheckpointWriter* writer, const void* di) {
   assert(writer != NULL, "invariant");
   assert(di != NULL, "invariant");
   const ObjectSampleRootDescriptionInfo* const osdi = (const ObjectSampleRootDescriptionInfo*)di;
@@ -366,8 +369,8 @@
   return root_infos->store(oodi);
 }
 
-typedef JfrArtifactWriterImplHost<const ObjectSampleRootDescriptionInfo*, __write_root_description_info__> RootDescriptionWriterImpl;
-typedef JfrArtifactWriterHost<RootDescriptionWriterImpl, TYPE_OLDOBJECTGCROOT> RootDescriptionWriter;
+typedef JfrTypeWriterImplHost<const ObjectSampleRootDescriptionInfo*, __write_root_description_info__> RootDescriptionWriterImpl;
+typedef JfrTypeWriterHost<RootDescriptionWriterImpl, TYPE_OLDOBJECTGCROOT> RootDescriptionWriter;
 
 
 int _edge_reference_compare_(uintptr_t lhs, uintptr_t rhs) {
@@ -513,7 +516,7 @@
     RootResolutionSet rrs(root_infos);
     RootResolver::resolve(rrs);
     // write roots
-    RootDescriptionWriter rw(&writer, NULL, false);
+    RootDescriptionWriter rw(&writer);
     root_infos->iterate(rw);
   }
 }
@@ -576,11 +579,45 @@
   }
 }
 
+class RootSystemType : public JfrSerializer {
+ public:
+  void serialize(JfrCheckpointWriter& writer) {
+    const u4 nof_root_systems = OldObjectRoot::_number_of_systems;
+    writer.write_count(nof_root_systems);
+    for (u4 i = 0; i < nof_root_systems; ++i) {
+      writer.write_key(i);
+      writer.write(OldObjectRoot::system_description((OldObjectRoot::System)i));
+    }
+  }
+};
+
+class RootType : public JfrSerializer {
+ public:
+  void serialize(JfrCheckpointWriter& writer) {
+    const u4 nof_root_types = OldObjectRoot::_number_of_types;
+    writer.write_count(nof_root_types);
+    for (u4 i = 0; i < nof_root_types; ++i) {
+      writer.write_key(i);
+      writer.write(OldObjectRoot::type_description((OldObjectRoot::Type)i));
+    }
+  }
+};
+
+static void register_serializers() {
+  static bool is_registered = false;
+  if (!is_registered) {
+    JfrSerializer::register_serializer(TYPE_OLDOBJECTROOTSYSTEM, false, true, new RootSystemType());
+    JfrSerializer::register_serializer(TYPE_OLDOBJECTROOTTYPE, false, true, new RootType());
+    is_registered = true;
+  }
+}
+
 ObjectSampleWriter::ObjectSampleWriter(JfrCheckpointWriter& writer, EdgeStore* store) :
   _writer(writer),
   _store(store) {
   assert(store != NULL, "invariant");
   assert(!store->is_empty(), "invariant");
+  register_serializers();
   sample_infos = NULL;
   ref_infos = NULL;
   array_infos = NULL;
--- a/src/hotspot/share/jfr/leakprofiler/checkpoint/rootResolver.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/leakprofiler/checkpoint/rootResolver.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -32,7 +32,6 @@
 #include "memory/iterator.hpp"
 #include "memory/universe.hpp"
 #include "oops/klass.hpp"
-#include "oops/markWord.hpp"
 #include "oops/oop.hpp"
 #include "prims/jvmtiThreadState.hpp"
 #include "runtime/frame.inline.hpp"
--- a/src/hotspot/share/jfr/leakprofiler/sampling/objectSample.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/leakprofiler/sampling/objectSample.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -25,13 +25,14 @@
 #ifndef SHARE_JFR_LEAKPROFILER_SAMPLING_OBJECTSAMPLE_HPP
 #define SHARE_JFR_LEAKPROFILER_SAMPLING_OBJECTSAMPLE_HPP
 
-#include "jfr/recorder/checkpoint/jfrCheckpointBlob.hpp"
 #include "jfr/utilities/jfrAllocation.hpp"
+#include "jfr/utilities/jfrBlob.hpp"
 #include "jfr/utilities/jfrTime.hpp"
 #include "jfr/utilities/jfrTypes.hpp"
 #include "memory/allocation.hpp"
 #include "oops/oop.hpp"
 #include "utilities/ticks.hpp"
+
 /*
  * Handle for diagnosing Java memory leaks.
  *
@@ -44,8 +45,9 @@
  private:
   ObjectSample* _next;
   ObjectSample* _previous;
-  JfrCheckpointBlobHandle _thread_cp;
-  JfrCheckpointBlobHandle _klass_cp;
+  JfrBlobHandle _stacktrace;
+  JfrBlobHandle _thread;
+  JfrBlobHandle _type_set;
   oop _object;
   Ticks _allocation_time;
   traceid _stack_trace_id;
@@ -62,17 +64,14 @@
   }
 
   void release_references() {
-    if (_thread_cp.valid()) {
-      _thread_cp.~JfrCheckpointBlobHandle();
-    }
-    if (_klass_cp.valid()) {
-      _klass_cp.~JfrCheckpointBlobHandle();
-    }
+    _stacktrace.~JfrBlobHandle();
+    _thread.~JfrBlobHandle();
+    _type_set.~JfrBlobHandle();
   }
 
   void reset() {
     set_stack_trace_id(0);
-    set_stack_trace_hash(0),
+    set_stack_trace_hash(0);
     release_references();
     _dead = false;
   }
@@ -80,8 +79,9 @@
  public:
   ObjectSample() : _next(NULL),
                    _previous(NULL),
-                   _thread_cp(),
-                   _klass_cp(),
+                   _stacktrace(),
+                   _thread(),
+                   _type_set(),
                    _object(NULL),
                    _allocation_time(),
                    _stack_trace_id(0),
@@ -174,7 +174,7 @@
     return _heap_used_at_last_gc;
   }
 
-  bool has_stack_trace() const {
+  bool has_stack_trace_id() const {
     return stack_trace_id() != 0;
   }
 
@@ -194,10 +194,6 @@
     _stack_trace_hash = hash;
   }
 
-  bool has_thread() const {
-    return _thread_id != 0;
-  }
-
   traceid thread_id() const {
     return _thread_id;
   }
@@ -211,37 +207,51 @@
       _allocation_time.ft_value() : _allocation_time.value()) < time_stamp;
   }
 
-  const JfrCheckpointBlobHandle& thread_checkpoint() const {
-    return _thread_cp;
+  const JfrBlobHandle& stacktrace() const {
+    return _stacktrace;
   }
 
-  bool has_thread_checkpoint() const {
-    return _thread_cp.valid();
+  bool has_stacktrace() const {
+    return _stacktrace.valid();
   }
 
-  // JfrCheckpointBlobHandle assignment operator
+  // JfrBlobHandle assignment operator
   // maintains proper reference counting
-  void set_thread_checkpoint(const JfrCheckpointBlobHandle& ref) {
-    if (_thread_cp != ref) {
-      _thread_cp = ref;
+  void set_stacktrace(const JfrBlobHandle& ref) {
+    if (_stacktrace != ref) {
+      _stacktrace = ref;
     }
   }
 
-  const JfrCheckpointBlobHandle& klass_checkpoint() const {
-    return _klass_cp;
+  const JfrBlobHandle& thread() const {
+    return _thread;
   }
 
-  bool has_klass_checkpoint() const {
-    return _klass_cp.valid();
+  bool has_thread() const {
+    return _thread.valid();
+  }
+
+  void set_thread(const JfrBlobHandle& ref) {
+    if (_thread != ref) {
+      _thread = ref;
+    }
   }
 
-  void set_klass_checkpoint(const JfrCheckpointBlobHandle& ref) {
-    if (_klass_cp != ref) {
-      if (_klass_cp.valid()) {
-        _klass_cp->set_next(ref);
+  const JfrBlobHandle& type_set() const {
+    return _type_set;
+  }
+
+  bool has_type_set() const {
+    return _type_set.valid();
+  }
+
+  void set_type_set(const JfrBlobHandle& ref) {
+    if (_type_set != ref) {
+      if (_type_set.valid()) {
+        _type_set->set_next(ref);
         return;
       }
-      _klass_cp = ref;
+      _type_set = ref;
     }
   }
 };
--- a/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -110,63 +110,42 @@
   }
   const JfrThreadLocal* const tl = thread->jfr_thread_local();
   assert(tl != NULL, "invariant");
-  if (!tl->has_thread_checkpoint()) {
-    JfrCheckpointManager::create_thread_checkpoint(thread);
+  if (!tl->has_thread_blob()) {
+    JfrCheckpointManager::create_thread_blob(thread);
   }
-  assert(tl->has_thread_checkpoint(), "invariant");
+  assert(tl->has_thread_blob(), "invariant");
   return tl->thread_id();
 }
 
-// Populates the thread local stack frames, but does not add them
-// to the stacktrace repository (...yet, see stacktrace_id() below)
-//
-void ObjectSampler::fill_stacktrace(JfrStackTrace* stacktrace, JavaThread* thread) {
-  assert(stacktrace != NULL, "invariant");
+static void record_stacktrace(JavaThread* thread) {
   assert(thread != NULL, "invariant");
   if (JfrEventSetting::has_stacktrace(EventOldObjectSample::eventId)) {
-    JfrStackTraceRepository::fill_stacktrace_for(thread, stacktrace, 0);
+    JfrStackTraceRepository::record_and_cache(thread);
   }
 }
 
-// We were successful in acquiring the try lock and have been selected for adding a sample.
-// Go ahead with installing our previously taken stacktrace into the stacktrace repository.
-//
-traceid ObjectSampler::stacktrace_id(const JfrStackTrace* stacktrace, JavaThread* thread) {
-  assert(stacktrace != NULL, "invariant");
-  assert(stacktrace->hash() != 0, "invariant");
-  const traceid stacktrace_id = JfrStackTraceRepository::add(stacktrace, thread);
-  thread->jfr_thread_local()->set_cached_stack_trace_id(stacktrace_id, stacktrace->hash());
-  return stacktrace_id;
-}
-
 void ObjectSampler::sample(HeapWord* obj, size_t allocated, JavaThread* thread) {
   assert(thread != NULL, "invariant");
   assert(is_created(), "invariant");
-
   const traceid thread_id = get_thread_id(thread);
   if (thread_id == 0) {
     return;
   }
-
-  const JfrThreadLocal* const tl = thread->jfr_thread_local();
-  JfrStackTrace stacktrace(tl->stackframes(), tl->stackdepth());
-  fill_stacktrace(&stacktrace, thread);
-
+  record_stacktrace(thread);
   // try enter critical section
   JfrTryLock tryLock(&_lock);
   if (!tryLock.has_lock()) {
     log_trace(jfr, oldobject, sampling)("Skipping old object sample due to lock contention");
     return;
   }
-
-  instance().add(obj, allocated, thread_id, &stacktrace, thread);
+  instance().add(obj, allocated, thread_id, thread);
 }
 
-void ObjectSampler::add(HeapWord* obj, size_t allocated, traceid thread_id, JfrStackTrace* stacktrace, JavaThread* thread) {
-  assert(stacktrace != NULL, "invariant");
+void ObjectSampler::add(HeapWord* obj, size_t allocated, traceid thread_id, JavaThread* thread) {
+  assert(obj != NULL, "invariant");
   assert(thread_id != 0, "invariant");
   assert(thread != NULL, "invariant");
-  assert(thread->jfr_thread_local()->has_thread_checkpoint(), "invariant");
+  assert(thread->jfr_thread_local()->has_thread_blob(), "invariant");
 
   if (_dead_samples) {
     scavenge();
@@ -190,11 +169,13 @@
 
   assert(sample != NULL, "invariant");
   sample->set_thread_id(thread_id);
-  sample->set_thread_checkpoint(thread->jfr_thread_local()->thread_checkpoint());
+
+  const JfrThreadLocal* const tl = thread->jfr_thread_local();
+  sample->set_thread(tl->thread_blob());
 
-  const unsigned int stacktrace_hash = stacktrace->hash();
+  const unsigned int stacktrace_hash = tl->cached_stack_trace_hash();
   if (stacktrace_hash != 0) {
-    sample->set_stack_trace_id(stacktrace_id(stacktrace, thread));
+    sample->set_stack_trace_id(tl->cached_stack_trace_id());
     sample->set_stack_trace_hash(stacktrace_hash);
   }
 
@@ -253,7 +234,7 @@
   sampler._last_sweep = JfrTicks::now();
 }
 
-const ObjectSample* ObjectSampler::last() const {
+ObjectSample* ObjectSampler::last() const {
   return _list->last();
 }
 
--- a/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -31,25 +31,19 @@
 typedef u8 traceid;
 
 class BoolObjectClosure;
-class JfrStackTrace;
+class JavaThread;
 class OopClosure;
 class ObjectSample;
-class ObjectSampler;
 class SampleList;
 class SamplePriorityQueue;
-class Thread;
 
 // Class reponsible for holding samples and
 // making sure the samples are evenly distributed as
 // new entries are added and removed.
 class ObjectSampler : public CHeapObj<mtTracing> {
-  friend class EventEmitter;
-  friend class JfrRecorderService;
   friend class LeakProfiler;
   friend class StartOperation;
   friend class StopOperation;
-  friend class ObjectSampleCheckpoint;
-  friend class WriteObjectSampleStacktrace;
  private:
   SamplePriorityQueue* _priority_queue;
   SampleList* _list;
@@ -64,20 +58,11 @@
   ~ObjectSampler();
   static bool create(size_t size);
   static bool is_created();
-  static ObjectSampler* sampler();
   static void destroy();
 
-  // For operations that require exclusive access (non-safepoint)
-  static ObjectSampler* acquire();
-  static void release();
-
-  // Stacktrace
-  static void fill_stacktrace(JfrStackTrace* stacktrace, JavaThread* thread);
-  traceid stacktrace_id(const JfrStackTrace* stacktrace, JavaThread* thread);
-
   // Sampling
   static void sample(HeapWord* object, size_t size, JavaThread* thread);
-  void add(HeapWord* object, size_t size, traceid thread_id, JfrStackTrace* stacktrace, JavaThread* thread);
+  void add(HeapWord* object, size_t size, traceid thread_id, JavaThread* thread);
   void scavenge();
   void remove_dead(ObjectSample* sample);
 
@@ -87,8 +72,15 @@
   const ObjectSample* item_at(int index) const;
   ObjectSample* item_at(int index);
   int item_count() const;
+
+ public:
+  static ObjectSampler* sampler();
+  // For operations that require exclusive access (non-safepoint)
+  static ObjectSampler* acquire();
+  static void release();
+
   const ObjectSample* first() const;
-  const ObjectSample* last() const;
+  ObjectSample* last() const;
   const ObjectSample* last_resolved() const;
   void set_last_resolved(const ObjectSample* sample);
   const JfrTicks& last_sweep() const;
--- a/src/hotspot/share/jfr/leakprofiler/sampling/sampleList.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/leakprofiler/sampling/sampleList.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -50,12 +50,12 @@
   SampleList(size_t limit, size_t cache_size = 0);
   ~SampleList();
 
-  void set_last_resolved(const ObjectSample* sample);
   ObjectSample* get();
+  ObjectSample* first() const;
   ObjectSample* last() const;
-  ObjectSample* first() const;
+  const ObjectSample* last_resolved() const;
+  void set_last_resolved(const ObjectSample* sample);
   void release(ObjectSample* sample);
-  const ObjectSample* last_resolved() const;
   ObjectSample* reuse(ObjectSample* sample);
   bool is_full() const;
   size_t count() const;
--- a/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointBlob.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
- * 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.
- *
- */
-
-#include "precompiled.hpp"
-#include "jfr/recorder/checkpoint/jfrCheckpointBlob.hpp"
-#include "jfr/recorder/checkpoint/jfrCheckpointWriter.hpp"
-
-JfrCheckpointBlob::JfrCheckpointBlob(const u1* checkpoint, size_t size) :
-  _checkpoint(JfrCHeapObj::new_array<u1>(size)),
-  _size(size),
-  _next(),
-  _written(false) {
-  assert(checkpoint != NULL, "invariant");
-  assert(_checkpoint != NULL, "invariant");
-  memcpy(const_cast<u1*>(_checkpoint), checkpoint, size);
-}
-
-JfrCheckpointBlob::~JfrCheckpointBlob() {
-  JfrCHeapObj::free(const_cast<u1*>(_checkpoint), _size);
-}
-
-const JfrCheckpointBlobHandle& JfrCheckpointBlob::next() const {
-  return _next;
-}
-
-void JfrCheckpointBlob::write_this(JfrCheckpointWriter& writer) const {
-  writer.bytes(_checkpoint, _size);
-}
-
-void JfrCheckpointBlob::exclusive_write(JfrCheckpointWriter& writer) const {
-  if (!_written) {
-    write_this(writer);
-    _written = true;
-  }
-  if (_next.valid()) {
-    _next->exclusive_write(writer);
-  }
-}
-
-void JfrCheckpointBlob::write(JfrCheckpointWriter& writer) const {
-  write_this(writer);
-  if (_next.valid()) {
-    _next->write(writer);
-  }
-}
-
-void JfrCheckpointBlob::reset_write_state() const {
-  if (_written) {
-    _written = false;
-  }
-  if (_next.valid()) {
-    _next->reset_write_state();
-  }
-}
-
-void JfrCheckpointBlob::set_next(const JfrCheckpointBlobHandle& ref) {
-  if (_next == ref) {
-    return;
-  }
-  assert(_next != ref, "invariant");
-  if (_next.valid()) {
-    _next->set_next(ref);
-    return;
-  }
-  _next = ref;
-}
-
-JfrCheckpointBlobHandle JfrCheckpointBlob::make(const u1* checkpoint, size_t size) {
-  const JfrCheckpointBlob* cp_blob = new JfrCheckpointBlob(checkpoint, size);
-  assert(cp_blob != NULL, "invariant");
-  return JfrCheckpointBlobReference::make(cp_blob);
-}
--- a/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointBlob.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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_JFR_RECORDER_CHECKPOINT_JFRCHECKPOINTBLOB_HPP
-#define SHARE_JFR_RECORDER_CHECKPOINT_JFRCHECKPOINTBLOB_HPP
-
-#include "jfr/utilities/jfrAllocation.hpp"
-#include "jfr/utilities/jfrRefCountPointer.hpp"
-
-class JfrCheckpointBlob;
-class JfrCheckpointWriter;
-
-typedef RefCountPointer<JfrCheckpointBlob, MultiThreadedRefCounter> JfrCheckpointBlobReference;
-typedef RefCountHandle<JfrCheckpointBlobReference> JfrCheckpointBlobHandle;
-
-class JfrCheckpointBlob : public JfrCHeapObj {
-  template <typename, typename>
-  friend class RefCountPointer;
- private:
-  const u1* _checkpoint;
-  const size_t _size;
-  JfrCheckpointBlobHandle _next;
-  mutable bool _written;
-
-  JfrCheckpointBlob(const u1* checkpoint, size_t size);
-  ~JfrCheckpointBlob();
-  const JfrCheckpointBlobHandle& next() const;
-  void write_this(JfrCheckpointWriter& writer) const;
-
- public:
-  void write(JfrCheckpointWriter& writer) const;
-  void exclusive_write(JfrCheckpointWriter& writer) const;
-  void reset_write_state() const;
-  void set_next(const JfrCheckpointBlobHandle& ref);
-  static JfrCheckpointBlobHandle make(const u1* checkpoint, size_t size);
-};
-
-#endif // SHARE_JFR_RECORDER_CHECKPOINT_JFRCHECKPOINTBLOB_HPP
--- a/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -37,6 +37,7 @@
 #include "jfr/utilities/jfrTypes.hpp"
 #include "logging/log.hpp"
 #include "memory/resourceArea.hpp"
+#include "runtime/handles.inline.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/orderAccess.hpp"
 #include "runtime/os.inline.hpp"
@@ -87,22 +88,18 @@
 static const size_t checkpoint_buffer_cache_count = 2;
 static const size_t checkpoint_buffer_size = 512 * K;
 
-static JfrCheckpointMspace* create_mspace(size_t buffer_size, size_t limit, size_t cache_count, JfrCheckpointManager* system) {
-  JfrCheckpointMspace* mspace = new JfrCheckpointMspace(buffer_size, limit, cache_count, system);
-  if (mspace != NULL) {
-    mspace->initialize();
-  }
-  return mspace;
+static JfrCheckpointMspace* allocate_mspace(size_t size, size_t limit, size_t cache_count, JfrCheckpointManager* mgr) {
+  return create_mspace<JfrCheckpointMspace, JfrCheckpointManager>(size, limit, cache_count, mgr);
 }
 
 bool JfrCheckpointManager::initialize() {
   assert(_free_list_mspace == NULL, "invariant");
-  _free_list_mspace = create_mspace(checkpoint_buffer_size, unlimited_mspace_size, checkpoint_buffer_cache_count, this);
+  _free_list_mspace = allocate_mspace(checkpoint_buffer_size, unlimited_mspace_size, checkpoint_buffer_cache_count, this);
   if (_free_list_mspace == NULL) {
     return false;
   }
   assert(_epoch_transition_mspace == NULL, "invariant");
-  _epoch_transition_mspace = create_mspace(checkpoint_buffer_size, unlimited_mspace_size, checkpoint_buffer_cache_count, this);
+  _epoch_transition_mspace = allocate_mspace(checkpoint_buffer_size, unlimited_mspace_size, checkpoint_buffer_cache_count, this);
   if (_epoch_transition_mspace == NULL) {
     return false;
   }
@@ -114,22 +111,6 @@
   return JfrTypeManager::initialize();
 }
 
-bool JfrCheckpointManager::use_epoch_transition_mspace(const Thread* thread) const {
-  return _service_thread != thread && OrderAccess::load_acquire(&_checkpoint_epoch_state) != JfrTraceIdEpoch::epoch();
-}
-
-void JfrCheckpointManager::synchronize_epoch() {
-  assert(_checkpoint_epoch_state != JfrTraceIdEpoch::epoch(), "invariant");
-  OrderAccess::storestore();
-  _checkpoint_epoch_state = JfrTraceIdEpoch::epoch();
-}
-
-void JfrCheckpointManager::shift_epoch() {
-  debug_only(const u1 current_epoch = JfrTraceIdEpoch::current();)
-  JfrTraceIdEpoch::shift_epoch();
-  assert(current_epoch != JfrTraceIdEpoch::current(), "invariant");
-}
-
 void JfrCheckpointManager::register_service_thread(const Thread* thread) {
   _service_thread = thread;
 }
@@ -151,7 +132,6 @@
 }
 
 #ifdef ASSERT
-
 bool JfrCheckpointManager::is_locked() const {
   return _lock->owned_by_self();
 }
@@ -167,7 +147,6 @@
   assert(buffer->lease(), "invariant");
   assert(buffer->acquired_by_self(), "invariant");
 }
-
 #endif // ASSERT
 
 static BufferPtr lease_free(size_t size, JfrCheckpointMspace* mspace, size_t retry_count, Thread* thread) {
@@ -185,6 +164,10 @@
   return buffer;
 }
 
+bool JfrCheckpointManager::use_epoch_transition_mspace(const Thread* thread) const {
+  return _service_thread != thread && OrderAccess::load_acquire(&_checkpoint_epoch_state) != JfrTraceIdEpoch::epoch();
+}
+
 static const size_t lease_retry = 10;
 
 BufferPtr JfrCheckpointManager::lease_buffer(Thread* thread, size_t size /* 0 */) {
@@ -256,33 +239,33 @@
   return read_data<juint>(data + types_offset);
 }
 
-static void write_checkpoint_header(JfrChunkWriter& cw, intptr_t offset_prev_cp_event, const u1* data) {
+static void write_checkpoint_header(JfrChunkWriter& cw, int64_t offset_prev_cp_event, const u1* data) {
   cw.reserve(sizeof(u4));
-  cw.write((u8)EVENT_CHECKPOINT);
+  cw.write<u8>(EVENT_CHECKPOINT);
   cw.write(starttime(data));
   cw.write(duration(data));
-  cw.write((jlong)offset_prev_cp_event);
+  cw.write(offset_prev_cp_event);
   cw.write(is_flushpoint(data));
   cw.write(number_of_types(data));
 }
 
 static void write_checkpoint_content(JfrChunkWriter& cw, const u1* data, size_t size) {
   assert(data != NULL, "invariant");
-  cw.write_unbuffered(data + payload_offset, size);
+  cw.write_unbuffered(data + payload_offset, size - sizeof(JfrCheckpointEntry));
 }
 
 static size_t write_checkpoint_event(JfrChunkWriter& cw, const u1* data) {
   assert(data != NULL, "invariant");
-  const intptr_t previous_checkpoint_event = cw.previous_checkpoint_offset();
-  const intptr_t event_begin = cw.current_offset();
-  const intptr_t offset_to_previous_checkpoint_event = 0 == previous_checkpoint_event ? 0 : previous_checkpoint_event - event_begin;
-  const jlong total_checkpoint_size = total_size(data);
-  write_checkpoint_header(cw, offset_to_previous_checkpoint_event, data);
-  write_checkpoint_content(cw, data, total_checkpoint_size - sizeof(JfrCheckpointEntry));
-  const jlong checkpoint_event_size = cw.current_offset() - event_begin;
-  cw.write_padded_at_offset<u4>(checkpoint_event_size, event_begin);
-  cw.set_previous_checkpoint_offset(event_begin);
-  return (size_t)total_checkpoint_size;
+  const int64_t event_begin = cw.current_offset();
+  const int64_t last_checkpoint_event = cw.last_checkpoint_offset();
+  const int64_t delta = last_checkpoint_event == 0 ? 0 : last_checkpoint_event - event_begin;
+  const int64_t checkpoint_size = total_size(data);
+  write_checkpoint_header(cw, delta, data);
+  write_checkpoint_content(cw, data, checkpoint_size);
+  const int64_t event_size = cw.current_offset() - event_begin;
+  cw.write_padded_at_offset<u4>(event_size, event_begin);
+  cw.set_last_checkpoint_offset(event_begin);
+  return (size_t)checkpoint_size;
 }
 
 static size_t write_checkpoints(JfrChunkWriter& cw, const u1* data, size_t size) {
@@ -290,14 +273,14 @@
   assert(data != NULL, "invariant");
   assert(size > 0, "invariant");
   const u1* const limit = data + size;
-  const u1* next_entry = data;
+  const u1* next = data;
   size_t processed = 0;
-  while (next_entry < limit) {
-    const size_t checkpoint_size = write_checkpoint_event(cw, next_entry);
+  while (next < limit) {
+    const size_t checkpoint_size = write_checkpoint_event(cw, next);
     processed += checkpoint_size;
-    next_entry += checkpoint_size;
+    next += checkpoint_size;
   }
-  assert(next_entry == limit, "invariant");
+  assert(next == limit, "invariant");
   return processed;
 }
 
@@ -331,6 +314,12 @@
   return wo.processed();
 }
 
+void JfrCheckpointManager::synchronize_epoch() {
+  assert(_checkpoint_epoch_state != JfrTraceIdEpoch::epoch(), "invariant");
+  OrderAccess::storestore();
+  _checkpoint_epoch_state = JfrTraceIdEpoch::epoch();
+}
+
 size_t JfrCheckpointManager::write() {
   const size_t processed = write_mspace<MutexedWriteOp, CompositeOperation>(_free_list_mspace, _chunkwriter);
   synchronize_epoch();
@@ -372,10 +361,16 @@
   JfrTypeManager::write_type_set_for_unloaded_classes();
 }
 
-void JfrCheckpointManager::create_thread_checkpoint(JavaThread* jt) {
-  JfrTypeManager::create_thread_checkpoint(jt);
+void JfrCheckpointManager::create_thread_blob(JavaThread* jt) {
+  JfrTypeManager::create_thread_blob(jt);
 }
 
 void JfrCheckpointManager::write_thread_checkpoint(JavaThread* jt) {
   JfrTypeManager::write_thread_checkpoint(jt);
 }
+
+void JfrCheckpointManager::shift_epoch() {
+  debug_only(const u1 current_epoch = JfrTraceIdEpoch::current();)
+  JfrTraceIdEpoch::shift_epoch();
+  assert(current_epoch != JfrTraceIdEpoch::current(), "invariant");
+}
--- a/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -92,7 +92,7 @@
  public:
   void register_service_thread(const Thread* t);
   static void write_type_set_for_unloaded_classes();
-  static void create_thread_checkpoint(JavaThread* jt);
+  static void create_thread_blob(JavaThread* jt);
   static void write_thread_checkpoint(JavaThread* jt);
 
   friend class JfrRecorder;
--- a/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointWriter.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointWriter.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
 #include "precompiled.hpp"
 #include "jfr/recorder/checkpoint/jfrCheckpointManager.hpp"
 #include "jfr/recorder/checkpoint/jfrCheckpointWriter.hpp"
+#include "jfr/utilities/jfrBlob.hpp"
 #include "jfr/writers/jfrBigEndianWriter.hpp"
 
 JfrCheckpointFlush::JfrCheckpointFlush(Type* old, size_t used, size_t requested, Thread* t) :
@@ -126,7 +127,7 @@
   write_padded_at_offset(nof_entries, offset);
 }
 
-const u1* JfrCheckpointWriter::session_data(size_t* size, const JfrCheckpointContext* ctx /* 0 */) {
+const u1* JfrCheckpointWriter::session_data(size_t* size, bool move /* false */, const JfrCheckpointContext* ctx /* 0 */) {
   assert(this->is_acquired(), "wrong state!");
   if (!this->is_valid()) {
     *size = 0;
@@ -140,8 +141,10 @@
   *size = this->used_size();
   assert(this->start_pos() + *size == this->current_pos(), "invariant");
   write_checkpoint_header(const_cast<u1*>(this->start_pos()), this->used_offset(), _time, is_flushpoint(), count());
-  this->seek(_offset + (_header ? sizeof(JfrCheckpointEntry) : 0));
-  set_count(0);
+  _header = false; // the header was just written
+  if (move) {
+    this->seek(_offset);
+  }
   return this->start_pos();
 }
 
@@ -160,26 +163,19 @@
   return this->used_size() > sizeof(JfrCheckpointEntry);
 }
 
-JfrCheckpointBlobHandle JfrCheckpointWriter::checkpoint_blob() {
+JfrBlobHandle JfrCheckpointWriter::copy(const JfrCheckpointContext* ctx /* 0 */) {
   size_t size = 0;
-  const u1* data = session_data(&size);
-  return JfrCheckpointBlob::make(data, size);
+  const u1* data = session_data(&size, false, ctx);
+  return JfrBlob::make(data, size);
 }
 
-JfrCheckpointBlobHandle JfrCheckpointWriter::copy(const JfrCheckpointContext* ctx /* 0 */) {
-  if (ctx == NULL) {
-    return checkpoint_blob();
-  }
+JfrBlobHandle JfrCheckpointWriter::move(const JfrCheckpointContext* ctx /* 0 */) {
   size_t size = 0;
-  const u1* data = session_data(&size, ctx);
-  return JfrCheckpointBlob::make(data, size);
-}
-
-JfrCheckpointBlobHandle JfrCheckpointWriter::move(const JfrCheckpointContext* ctx /* 0 */) {
-  JfrCheckpointBlobHandle data = copy(ctx);
+  const u1* data = session_data(&size, true, ctx);
+  JfrBlobHandle blob = JfrBlob::make(data, size);
   if (ctx != NULL) {
     const_cast<JfrCheckpointContext*>(ctx)->count = 0;
     set_context(*ctx);
   }
-  return data;
+  return blob;
 }
--- a/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointWriter.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointWriter.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -25,8 +25,8 @@
 #ifndef SHARE_JFR_RECORDER_CHECKPOINT_JFRCHECKPOINTWRITER_HPP
 #define SHARE_JFR_RECORDER_CHECKPOINT_JFRCHECKPOINTWRITER_HPP
 
-#include "jfr/recorder/checkpoint/jfrCheckpointBlob.hpp"
 #include "jfr/recorder/storage/jfrBuffer.hpp"
+#include "jfr/utilities/jfrBlob.hpp"
 #include "jfr/utilities/jfrTime.hpp"
 #include "jfr/utilities/jfrTypes.hpp"
 #include "jfr/writers/jfrEventWriterHost.inline.hpp"
@@ -67,9 +67,8 @@
   void increment();
   void set_flushpoint(bool flushpoint);
   bool is_flushpoint() const;
-  const u1* session_data(size_t* size, const JfrCheckpointContext* ctx = NULL);
+  const u1* session_data(size_t* size, bool move = false, const JfrCheckpointContext* ctx = NULL);
   void release();
-
  public:
   JfrCheckpointWriter(bool flushpoint, bool header, Thread* thread);
   ~JfrCheckpointWriter();
@@ -80,9 +79,8 @@
   const JfrCheckpointContext context() const;
   void set_context(const JfrCheckpointContext ctx);
   bool has_data() const;
-  JfrCheckpointBlobHandle checkpoint_blob();
-  JfrCheckpointBlobHandle copy(const JfrCheckpointContext* ctx = NULL);
-  JfrCheckpointBlobHandle move(const JfrCheckpointContext* ctx = NULL);
+  JfrBlobHandle copy(const JfrCheckpointContext* ctx = NULL);
+  JfrBlobHandle move(const JfrCheckpointContext* ctx = NULL);
 };
 
 #endif // SHARE_JFR_RECORDER_CHECKPOINT_JFRCHECKPOINTWRITER_HPP
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -30,7 +30,6 @@
 #include "gc/shared/gcName.hpp"
 #include "gc/shared/gcTrace.hpp"
 #include "gc/shared/gcWhen.hpp"
-#include "jfr/leakprofiler/checkpoint/objectSampleCheckpoint.hpp"
 #include "jfr/leakprofiler/leakProfiler.hpp"
 #include "jfr/recorder/checkpoint/jfrCheckpointManager.hpp"
 #include "jfr/recorder/checkpoint/types/jfrType.hpp"
@@ -274,34 +273,26 @@
 
 class TypeSetSerialization {
  private:
+  JfrCheckpointWriter* _leakp_writer;
   bool _class_unload;
  public:
-  explicit TypeSetSerialization(bool class_unload) : _class_unload(class_unload) {}
-  void write(JfrCheckpointWriter& writer, JfrCheckpointWriter* leakp_writer) {
-    JfrTypeSet::serialize(&writer, leakp_writer, _class_unload);
+  TypeSetSerialization(bool class_unload, JfrCheckpointWriter* leakp_writer = NULL) :
+    _leakp_writer(leakp_writer), _class_unload(class_unload) {}
+  void write(JfrCheckpointWriter& writer) {
+    JfrTypeSet::serialize(&writer, _leakp_writer, _class_unload);
   }
 };
 
 void ClassUnloadTypeSet::serialize(JfrCheckpointWriter& writer) {
   TypeSetSerialization type_set(true);
-  if (LeakProfiler::is_running()) {
-    JfrCheckpointWriter leakp_writer(false, true, Thread::current());
-    type_set.write(writer, &leakp_writer);
-    ObjectSampleCheckpoint::install(leakp_writer, true, true);
-    return;
-  }
-  type_set.write(writer, NULL);
+  type_set.write(writer);
 };
 
+TypeSet::TypeSet(JfrCheckpointWriter* leakp_writer) : _leakp_writer(leakp_writer) {}
+
 void TypeSet::serialize(JfrCheckpointWriter& writer) {
-  TypeSetSerialization type_set(false);
-  if (LeakProfiler::is_running()) {
-    JfrCheckpointWriter leakp_writer(false, true, Thread::current());
-    type_set.write(writer, &leakp_writer);
-    ObjectSampleCheckpoint::install(leakp_writer, false, true);
-    return;
-  }
-  type_set.write(writer, NULL);
+  TypeSetSerialization type_set(false, _leakp_writer);
+  type_set.write(writer);
 };
 
 void ThreadStateConstant::serialize(JfrCheckpointWriter& writer) {
@@ -312,7 +303,6 @@
   assert(_thread != NULL, "invariant");
   assert(_thread == Thread::current(), "invariant");
   assert(_thread->is_Java_thread(), "invariant");
-  assert(!_thread->jfr_thread_local()->has_thread_checkpoint(), "invariant");
   ResourceMark rm(_thread);
   const oop threadObj = _thread->threadObj();
   assert(threadObj != NULL, "invariant");
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -108,7 +108,10 @@
 };
 
 class TypeSet : public JfrSerializer {
+ private:
+  JfrCheckpointWriter* _leakp_writer;
  public:
+  explicit TypeSet(JfrCheckpointWriter* leakp_writer = NULL);
   void serialize(JfrCheckpointWriter& writer);
 };
 
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeManager.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeManager.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -23,12 +23,17 @@
  */
 
 #include "precompiled.hpp"
+#include "jfr/jfr.hpp"
+#include "jfr/leakprofiler/leakProfiler.hpp"
+#include "jfr/leakprofiler/checkpoint/objectSampleCheckpoint.hpp"
 #include "jfr/metadata/jfrSerializer.hpp"
 #include "jfr/recorder/checkpoint/jfrCheckpointWriter.hpp"
 #include "jfr/recorder/checkpoint/types/jfrType.hpp"
 #include "jfr/recorder/checkpoint/types/jfrTypeManager.hpp"
 #include "jfr/utilities/jfrDoublyLinkedList.hpp"
 #include "jfr/utilities/jfrIterator.hpp"
+#include "memory/resourceArea.hpp"
+#include "runtime/handles.inline.hpp"
 #include "runtime/safepoint.hpp"
 #include "runtime/thread.inline.hpp"
 #include "utilities/exceptions.hpp"
@@ -39,7 +44,7 @@
   JfrSerializerRegistration* _next;
   JfrSerializerRegistration* _prev;
   JfrSerializer* _serializer;
-  mutable JfrCheckpointBlobHandle _cache;
+  mutable JfrBlobHandle _cache;
   JfrTypeId _id;
   bool _permit_cache;
 
@@ -148,45 +153,59 @@
 }
 
 void JfrTypeManager::write_type_set() {
-  // can safepoint here because of Module_lock
-  MutexLocker cld_lock(SafepointSynchronize::is_at_safepoint() ? NULL : ClassLoaderDataGraph_lock);
-  MutexLocker lock(SafepointSynchronize::is_at_safepoint() ? NULL : Module_lock);
-
-  JfrCheckpointWriter writer(true, true, Thread::current());
-  TypeSet set;
+  assert(!SafepointSynchronize::is_at_safepoint(), "invariant");
+  // can safepoint here
+  MutexLocker cld_lock(ClassLoaderDataGraph_lock);
+  MutexLocker module_lock(Module_lock);
+  if (!LeakProfiler::is_running()) {
+    JfrCheckpointWriter writer(true, true, Thread::current());
+    TypeSet set;
+    set.serialize(writer);
+    return;
+  }
+  JfrCheckpointWriter leakp_writer(false, true, Thread::current());
+  JfrCheckpointWriter writer(false, true, Thread::current());
+  TypeSet set(&leakp_writer);
   set.serialize(writer);
+  ObjectSampleCheckpoint::on_type_set(leakp_writer);
 }
 
 void JfrTypeManager::write_type_set_for_unloaded_classes() {
   assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
   JfrCheckpointWriter writer(false, true, Thread::current());
+  const JfrCheckpointContext ctx = writer.context();
   ClassUnloadTypeSet class_unload_set;
   class_unload_set.serialize(writer);
+  if (LeakProfiler::is_running()) {
+    ObjectSampleCheckpoint::on_type_set_unload(writer);
+  }
+  if (!Jfr::is_recording()) {
+    // discard anything written
+    writer.set_context(ctx);
+  }
 }
 
-void JfrTypeManager::create_thread_checkpoint(JavaThread* jt) {
+void JfrTypeManager::create_thread_blob(JavaThread* jt) {
   assert(jt != NULL, "invariant");
+  ResourceMark rm(jt);
+  HandleMark hm(jt);
   JfrThreadConstant type_thread(jt);
   JfrCheckpointWriter writer(false, true, jt);
   writer.write_type(TYPE_THREAD);
   type_thread.serialize(writer);
   // create and install a checkpoint blob
-  jt->jfr_thread_local()->set_thread_checkpoint(writer.checkpoint_blob());
-  assert(jt->jfr_thread_local()->has_thread_checkpoint(), "invariant");
+  jt->jfr_thread_local()->set_thread_blob(writer.move());
+  assert(jt->jfr_thread_local()->has_thread_blob(), "invariant");
 }
 
 void JfrTypeManager::write_thread_checkpoint(JavaThread* jt) {
   assert(jt != NULL, "JavaThread is NULL!");
   ResourceMark rm(jt);
-  if (jt->jfr_thread_local()->has_thread_checkpoint()) {
-    JfrCheckpointWriter writer(false, false, jt);
-    jt->jfr_thread_local()->thread_checkpoint()->write(writer);
-  } else {
-    JfrThreadConstant type_thread(jt);
-    JfrCheckpointWriter writer(false, true, jt);
-    writer.write_type(TYPE_THREAD);
-    type_thread.serialize(writer);
-  }
+  HandleMark hm(jt);
+  JfrThreadConstant type_thread(jt);
+  JfrCheckpointWriter writer(false, true, jt);
+  writer.write_type(TYPE_THREAD);
+  type_thread.serialize(writer);
 }
 
 #ifdef ASSERT
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeManager.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeManager.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -37,7 +37,7 @@
   static void write_safepoint_types(JfrCheckpointWriter& writer);
   static void write_type_set();
   static void write_type_set_for_unloaded_classes();
-  static void create_thread_checkpoint(JavaThread* jt);
+  static void create_thread_blob(JavaThread* jt);
   static void write_thread_checkpoint(JavaThread* jt);
 };
 
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,32 +28,22 @@
 #include "classfile/moduleEntry.hpp"
 #include "classfile/packageEntry.hpp"
 #include "classfile/symbolTable.hpp"
-#include "classfile/systemDictionary.hpp"
 #include "jfr/jfr.hpp"
 #include "jfr/jni/jfrGetAllEventClasses.hpp"
-#include "jfr/recorder/checkpoint/jfrCheckpointWriter.hpp"
+#include "jfr/leakprofiler/checkpoint/objectSampleCheckpoint.hpp"
 #include "jfr/recorder/checkpoint/types/jfrTypeSet.hpp"
 #include "jfr/recorder/checkpoint/types/jfrTypeSetUtils.hpp"
-#include "jfr/recorder/checkpoint/types/jfrTypeSetWriter.hpp"
 #include "jfr/recorder/checkpoint/types/traceid/jfrTraceId.inline.hpp"
-#include "jfr/recorder/storage/jfrBuffer.hpp"
 #include "jfr/utilities/jfrHashtable.hpp"
 #include "jfr/utilities/jfrTypes.hpp"
+#include "jfr/writers/jfrTypeWriterHost.hpp"
 #include "memory/iterator.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/instanceKlass.hpp"
 #include "oops/objArrayKlass.hpp"
 #include "oops/oop.inline.hpp"
-#include "memory/resourceArea.hpp"
 #include "utilities/accessFlags.hpp"
 
-// incremented on each checkpoint
-static u8 checkpoint_id = 0;
-
-// creates a unique id by combining a checkpoint relative symbol id (2^24)
-// with the current checkpoint id (2^40)
-#define CREATE_SYMBOL_ID(sym_id) (((u8)((checkpoint_id << 24) | sym_id)))
-
 typedef const Klass* KlassPtr;
 typedef const PackageEntry* PkgPtr;
 typedef const ModuleEntry* ModPtr;
@@ -63,57 +53,112 @@
 typedef const JfrSymbolId::SymbolEntry* SymbolEntryPtr;
 typedef const JfrSymbolId::CStringEntry* CStringEntryPtr;
 
-static traceid module_id(PkgPtr pkg) {
-  assert(pkg != NULL, "invariant");
-  ModPtr module_entry = pkg->module();
-  return module_entry != NULL && module_entry->is_named() ? TRACE_ID(module_entry) : 0;
+static JfrCheckpointWriter* _writer = NULL;
+static JfrCheckpointWriter* _leakp_writer = NULL;
+static JfrArtifactSet* _artifacts = NULL;
+static JfrArtifactClosure* _subsystem_callback = NULL;
+static bool _class_unload = false;
+static bool _flushpoint = false;
+
+// incremented on each rotation
+static u8 checkpoint_id = 1;
+
+// creates a unique id by combining a checkpoint relative symbol id (2^24)
+// with the current checkpoint id (2^40)
+#define CREATE_SYMBOL_ID(sym_id) (((u8)((checkpoint_id << 24) | sym_id)))
+
+static traceid create_symbol_id(traceid artifact_id) {
+  return artifact_id != 0 ? CREATE_SYMBOL_ID(artifact_id) : 0;
+}
+
+static bool current_epoch() {
+  return _class_unload;
 }
 
-static traceid package_id(KlassPtr klass) {
-  assert(klass != NULL, "invariant");
-  PkgPtr pkg_entry = klass->package();
-  return pkg_entry == NULL ? 0 : TRACE_ID(pkg_entry);
+static bool previous_epoch() {
+  return !current_epoch();
+}
+
+static bool is_complete() {
+  return !_artifacts->has_klass_entries() && current_epoch();
+}
+
+static traceid mark_symbol(KlassPtr klass, bool leakp) {
+  return klass != NULL ? create_symbol_id(_artifacts->mark(klass, leakp)) : 0;
 }
 
-static traceid cld_id(CldPtr cld) {
-  assert(cld != NULL, "invariant");
-  return cld->is_unsafe_anonymous() ? 0 : TRACE_ID(cld);
+static traceid mark_symbol(Symbol* symbol, bool leakp) {
+  return symbol != NULL ? create_symbol_id(_artifacts->mark(symbol, leakp)) : 0;
+}
+
+static traceid get_bootstrap_name(bool leakp) {
+  return create_symbol_id(_artifacts->bootstrap_name(leakp));
+}
+
+template <typename T>
+static traceid artifact_id(const T* ptr) {
+  assert(ptr != NULL, "invariant");
+  return TRACE_ID(ptr);
 }
 
-static void tag_leakp_klass_artifacts(KlassPtr k, bool class_unload) {
-  assert(k != NULL, "invariant");
-  PkgPtr pkg = k->package();
-  if (pkg != NULL) {
-    tag_leakp_artifact(pkg, class_unload);
-    ModPtr module = pkg->module();
-    if (module != NULL) {
-      tag_leakp_artifact(module, class_unload);
-    }
+static traceid package_id(KlassPtr klass, bool leakp) {
+  assert(klass != NULL, "invariant");
+  PkgPtr pkg_entry = klass->package();
+  if (pkg_entry == NULL) {
+    return 0;
+  }
+  if (leakp) {
+    SET_LEAKP(pkg_entry);
   }
-  CldPtr cld = k->class_loader_data();
-  assert(cld != NULL, "invariant");
-  if (!cld->is_unsafe_anonymous()) {
-    tag_leakp_artifact(cld, class_unload);
+  // package implicitly tagged already
+  return artifact_id(pkg_entry);
+}
+
+static traceid module_id(PkgPtr pkg, bool leakp) {
+  assert(pkg != NULL, "invariant");
+  ModPtr module_entry = pkg->module();
+  if (module_entry == NULL || !module_entry->is_named()) {
+    return 0;
   }
+  if (leakp) {
+    SET_LEAKP(module_entry);
+  } else {
+    SET_TRANSIENT(module_entry);
+  }
+  return artifact_id(module_entry);
 }
 
-class TagLeakpKlassArtifact {
-  bool _class_unload;
- public:
-  TagLeakpKlassArtifact(bool class_unload) : _class_unload(class_unload) {}
-  bool operator()(KlassPtr klass) {
-    if (_class_unload) {
-      if (LEAKP_USED_THIS_EPOCH(klass)) {
-        tag_leakp_klass_artifacts(klass, _class_unload);
-      }
-    } else {
-      if (LEAKP_USED_PREV_EPOCH(klass)) {
-        tag_leakp_klass_artifacts(klass, _class_unload);
-      }
-    }
-    return true;
+static traceid method_id(KlassPtr klass, MethodPtr method) {
+  assert(klass != NULL, "invariant");
+  assert(method != NULL, "invariant");
+  return METHOD_ID(klass, method);
+}
+
+static traceid cld_id(CldPtr cld, bool leakp) {
+  assert(cld != NULL, "invariant");
+  if (cld->is_unsafe_anonymous()) {
+    return 0;
+  }
+  if (leakp) {
+    SET_LEAKP(cld);
+  } else {
+    SET_TRANSIENT(cld);
   }
-};
+  return artifact_id(cld);
+}
+
+template <typename T>
+static s4 get_flags(const T* ptr) {
+  assert(ptr != NULL, "invariant");
+  return ptr->access_flags().get_flags();
+}
+
+template <typename T>
+static void set_serialized(const T* ptr) {
+  assert(ptr != NULL, "invariant");
+  SET_SERIALIZED(ptr);
+  assert(IS_SERIALIZED(ptr), "invariant");
+}
 
 /*
  * In C++03, functions used as template parameters must have external linkage;
@@ -123,11 +168,10 @@
  * The weird naming is an effort to decrease the risk of name clashes.
  */
 
-int write__artifact__klass(JfrCheckpointWriter* writer, JfrArtifactSet* artifacts, const void* k) {
+static int write_klass(JfrCheckpointWriter* writer, KlassPtr klass, bool leakp) {
   assert(writer != NULL, "invariant");
-  assert(artifacts != NULL, "invariant");
-  assert(k != NULL, "invariant");
-  KlassPtr klass = (KlassPtr)k;
+  assert(_artifacts != NULL, "invariant");
+  assert(klass != NULL, "invariant");
   traceid pkg_id = 0;
   KlassPtr theklass = klass;
   if (theklass->is_objArray_klass()) {
@@ -135,445 +179,167 @@
     theklass = obj_arr_klass->bottom_klass();
   }
   if (theklass->is_instance_klass()) {
-    pkg_id = package_id(theklass);
+    pkg_id = package_id(theklass, leakp);
   } else {
     assert(theklass->is_typeArray_klass(), "invariant");
   }
-  const traceid symbol_id = artifacts->mark(klass);
-  assert(symbol_id > 0, "need to have an address for symbol!");
-  writer->write(TRACE_ID(klass));
-  writer->write(cld_id(klass->class_loader_data()));
-  writer->write((traceid)CREATE_SYMBOL_ID(symbol_id));
+  writer->write(artifact_id(klass));
+  writer->write(cld_id(klass->class_loader_data(), leakp));
+  writer->write(mark_symbol(klass, leakp));
   writer->write(pkg_id);
-  writer->write((s4)klass->access_flags().get_flags());
+  writer->write(get_flags(klass));
   return 1;
 }
 
-typedef LeakPredicate<KlassPtr> LeakKlassPredicate;
-typedef JfrPredicatedArtifactWriterImplHost<KlassPtr, LeakKlassPredicate, write__artifact__klass> LeakKlassWriterImpl;
-typedef JfrArtifactWriterHost<LeakKlassWriterImpl, TYPE_CLASS> LeakKlassWriter;
-typedef JfrArtifactWriterImplHost<KlassPtr, write__artifact__klass> KlassWriterImpl;
-typedef JfrArtifactWriterHost<KlassWriterImpl, TYPE_CLASS> KlassWriter;
+int write__klass(JfrCheckpointWriter* writer, const void* k) {
+  assert(k != NULL, "invariant");
+  KlassPtr klass = (KlassPtr)k;
+  set_serialized(klass);
+  return write_klass(writer, klass, false);
+}
+
+int write__klass__leakp(JfrCheckpointWriter* writer, const void* k) {
+  assert(k != NULL, "invariant");
+  KlassPtr klass = (KlassPtr)k;
+  return write_klass(writer, klass, true);
+}
+
+static void do_implied(Klass* klass) {
+  assert(klass != NULL, "invariant");
+  if (klass->is_subclass_of(SystemDictionary::ClassLoader_klass()) || klass == SystemDictionary::Object_klass()) {
+    if (_leakp_writer != NULL) {
+      SET_LEAKP(klass);
+    }
+    _subsystem_callback->do_artifact(klass);
+  }
+}
 
-int write__artifact__method(JfrCheckpointWriter* writer, JfrArtifactSet* artifacts, const void* m) {
-  assert(writer != NULL, "invariant");
-  assert(artifacts != NULL, "invariant");
-  assert(m != NULL, "invariant");
-  MethodPtr method = (MethodPtr)m;
-  const traceid method_name_symbol_id = artifacts->mark(method->name());
-  assert(method_name_symbol_id > 0, "invariant");
-  const traceid method_sig_symbol_id = artifacts->mark(method->signature());
-  assert(method_sig_symbol_id > 0, "invariant");
-  KlassPtr klass = method->method_holder();
+static void do_unloaded_klass(Klass* klass) {
+  assert(klass != NULL, "invariant");
+  assert(_subsystem_callback != NULL, "invariant");
+  if (IS_JDK_JFR_EVENT_SUBKLASS(klass)) {
+    JfrEventClasses::increment_unloaded_event_class();
+  }
+  if (USED_THIS_EPOCH(klass)) {
+    ObjectSampleCheckpoint::on_klass_unload(klass);
+    _subsystem_callback->do_artifact(klass);
+    return;
+  }
+  do_implied(klass);
+}
+
+static void do_klass(Klass* klass) {
   assert(klass != NULL, "invariant");
-  assert(METHOD_USED_ANY_EPOCH(klass), "invariant");
-  writer->write((u8)METHOD_ID(klass, method));
-  writer->write((u8)TRACE_ID(klass));
-  writer->write((u8)CREATE_SYMBOL_ID(method_name_symbol_id));
-  writer->write((u8)CREATE_SYMBOL_ID(method_sig_symbol_id));
-  writer->write((u2)method->access_flags().get_flags());
-  writer->write(const_cast<Method*>(method)->is_hidden() ? (u1)1 : (u1)0);
-  return 1;
+  assert(_subsystem_callback != NULL, "invariant");
+  if (current_epoch()) {
+    if (USED_THIS_EPOCH(klass)) {
+      _subsystem_callback->do_artifact(klass);
+      return;
+    }
+  } else {
+    if (USED_PREV_EPOCH(klass)) {
+      _subsystem_callback->do_artifact(klass);
+      return;
+    }
+  }
+  do_implied(klass);
+}
+
+static void do_klasses() {
+  if (_class_unload) {
+    ClassLoaderDataGraph::classes_unloading_do(&do_unloaded_klass);
+    return;
+  }
+  ClassLoaderDataGraph::classes_do(&do_klass);
 }
 
-typedef JfrArtifactWriterImplHost<MethodPtr, write__artifact__method> MethodWriterImplTarget;
-typedef JfrArtifactWriterHost<MethodWriterImplTarget, TYPE_METHOD> MethodWriterImpl;
+typedef SerializePredicate<KlassPtr> KlassPredicate;
+typedef JfrPredicatedTypeWriterImplHost<KlassPtr, KlassPredicate, write__klass> KlassWriterImpl;
+typedef JfrTypeWriterHost<KlassWriterImpl, TYPE_CLASS> KlassWriter;
+typedef CompositeFunctor<KlassPtr, KlassWriter, KlassArtifactRegistrator> KlassWriterRegistration;
+typedef JfrArtifactCallbackHost<KlassPtr, KlassWriterRegistration> KlassCallback;
+
+typedef LeakPredicate<KlassPtr> LeakKlassPredicate;
+typedef JfrPredicatedTypeWriterImplHost<KlassPtr, LeakKlassPredicate, write__klass__leakp> LeakKlassWriterImpl;
+typedef JfrTypeWriterHost<LeakKlassWriterImpl, TYPE_CLASS> LeakKlassWriter;
+
+typedef CompositeFunctor<KlassPtr, LeakKlassWriter, KlassWriter> CompositeKlassWriter;
+typedef CompositeFunctor<KlassPtr, CompositeKlassWriter, KlassArtifactRegistrator> CompositeKlassWriterRegistration;
+typedef JfrArtifactCallbackHost<KlassPtr, CompositeKlassWriterRegistration> CompositeKlassCallback;
 
-int write__artifact__package(JfrCheckpointWriter* writer, JfrArtifactSet* artifacts, const void* p) {
+static bool write_klasses() {
+  assert(!_artifacts->has_klass_entries(), "invariant");
+  assert(_writer != NULL, "invariant");
+  KlassArtifactRegistrator reg(_artifacts);
+  KlassWriter kw(_writer, _class_unload);
+  KlassWriterRegistration kwr(&kw, &reg);
+  if (_leakp_writer == NULL) {
+    KlassCallback callback(&kwr);
+    _subsystem_callback = &callback;
+    do_klasses();
+  } else {
+    LeakKlassWriter lkw(_leakp_writer, _artifacts, _class_unload);
+    CompositeKlassWriter ckw(&lkw, &kw);
+    CompositeKlassWriterRegistration ckwr(&ckw, &reg);
+    CompositeKlassCallback callback(&ckwr);
+    _subsystem_callback = &callback;
+    do_klasses();
+  }
+  if (is_complete()) {
+    return false;
+  }
+  _artifacts->tally(kw);
+  return true;
+}
+
+template <typename T>
+static void do_previous_epoch_artifact(JfrArtifactClosure* callback, T* value) {
+  assert(callback != NULL, "invariant");
+  assert(value != NULL, "invariant");
+  if (USED_PREV_EPOCH(value)) {
+    callback->do_artifact(value);
+    assert(IS_NOT_SERIALIZED(value), "invariant");
+    return;
+  }
+  if (IS_SERIALIZED(value)) {
+    CLEAR_SERIALIZED(value);
+  }
+  assert(IS_NOT_SERIALIZED(value), "invariant");
+}
+
+static int write_package(JfrCheckpointWriter* writer, PkgPtr pkg, bool leakp) {
   assert(writer != NULL, "invariant");
-  assert(artifacts != NULL, "invariant");
-  assert(p != NULL, "invariant");
-  PkgPtr pkg = (PkgPtr)p;
-  Symbol* const pkg_name = pkg->name();
-  const traceid package_name_symbol_id = pkg_name != NULL ? artifacts->mark(pkg_name) : 0;
-  assert(package_name_symbol_id > 0, "invariant");
-  writer->write((traceid)TRACE_ID(pkg));
-  writer->write((traceid)CREATE_SYMBOL_ID(package_name_symbol_id));
-  writer->write(module_id(pkg));
+  assert(_artifacts != NULL, "invariant");
+  assert(pkg != NULL, "invariant");
+  writer->write(artifact_id(pkg));
+  writer->write(mark_symbol(pkg->name(), leakp));
+  writer->write(module_id(pkg, leakp));
   writer->write((bool)pkg->is_exported());
   return 1;
 }
 
-typedef LeakPredicate<PkgPtr> LeakPackagePredicate;
-int _compare_pkg_ptr_(PkgPtr const& lhs, PkgPtr const& rhs) { return lhs > rhs ? 1 : (lhs < rhs) ? -1 : 0; }
-typedef UniquePredicate<PkgPtr, _compare_pkg_ptr_> PackagePredicate;
-typedef JfrPredicatedArtifactWriterImplHost<PkgPtr, LeakPackagePredicate, write__artifact__package> LeakPackageWriterImpl;
-typedef JfrPredicatedArtifactWriterImplHost<PkgPtr, PackagePredicate, write__artifact__package> PackageWriterImpl;
-typedef JfrArtifactWriterHost<LeakPackageWriterImpl, TYPE_PACKAGE> LeakPackageWriter;
-typedef JfrArtifactWriterHost<PackageWriterImpl, TYPE_PACKAGE> PackageWriter;
-
-int write__artifact__module(JfrCheckpointWriter* writer, JfrArtifactSet* artifacts, const void* m) {
-  assert( m != NULL, "invariant");
-  ModPtr entry = (ModPtr)m;
-  Symbol* const module_name = entry->name();
-  const traceid module_name_symbol_id = module_name != NULL ? artifacts->mark(module_name) : 0;
-  Symbol* const module_version = entry->version();
-  const traceid module_version_symbol_id = module_version != NULL ? artifacts->mark(module_version) : 0;
-  Symbol* const module_location = entry->location();
-  const traceid module_location_symbol_id = module_location != NULL ? artifacts->mark(module_location) : 0;
-  writer->write((traceid)TRACE_ID(entry));
-  writer->write(module_name_symbol_id == 0 ? (traceid)0 : (traceid)CREATE_SYMBOL_ID(module_name_symbol_id));
-  writer->write(module_version_symbol_id == 0 ? (traceid)0 : (traceid)CREATE_SYMBOL_ID(module_version_symbol_id));
-  writer->write(module_location_symbol_id == 0 ? (traceid)0 : (traceid)CREATE_SYMBOL_ID(module_location_symbol_id));
-  writer->write(cld_id(entry->loader_data()));
-  return 1;
-}
-
-typedef LeakPredicate<ModPtr> LeakModulePredicate;
-int _compare_mod_ptr_(ModPtr const& lhs, ModPtr const& rhs) { return lhs > rhs ? 1 : (lhs < rhs) ? -1 : 0; }
-typedef UniquePredicate<ModPtr, _compare_mod_ptr_> ModulePredicate;
-typedef JfrPredicatedArtifactWriterImplHost<ModPtr, LeakModulePredicate, write__artifact__module> LeakModuleWriterImpl;
-typedef JfrPredicatedArtifactWriterImplHost<ModPtr, ModulePredicate, write__artifact__module> ModuleWriterImpl;
-typedef JfrArtifactWriterHost<LeakModuleWriterImpl, TYPE_MODULE> LeakModuleWriter;
-typedef JfrArtifactWriterHost<ModuleWriterImpl, TYPE_MODULE> ModuleWriter;
-
-int write__artifact__classloader(JfrCheckpointWriter* writer, JfrArtifactSet* artifacts, const void* c) {
-  assert(c != NULL, "invariant");
-  CldPtr cld = (CldPtr)c;
-  assert(!cld->is_unsafe_anonymous(), "invariant");
-  const traceid cld_id = TRACE_ID(cld);
-  // class loader type
-  const Klass* class_loader_klass = cld->class_loader_klass();
-  if (class_loader_klass == NULL) {
-    // (primordial) boot class loader
-    writer->write(cld_id); // class loader instance id
-    writer->write((traceid)0);  // class loader type id (absence of)
-    writer->write((traceid)CREATE_SYMBOL_ID(1)); // 1 maps to synthetic name -> "bootstrap"
-  } else {
-    Symbol* symbol_name = cld->name();
-    const traceid symbol_name_id = symbol_name != NULL ? artifacts->mark(symbol_name) : 0;
-    writer->write(cld_id); // class loader instance id
-    writer->write(TRACE_ID(class_loader_klass)); // class loader type id
-    writer->write(symbol_name_id == 0 ? (traceid)0 :
-      (traceid)CREATE_SYMBOL_ID(symbol_name_id)); // class loader instance name
-  }
-  return 1;
-}
-
-typedef LeakPredicate<CldPtr> LeakCldPredicate;
-int _compare_cld_ptr_(CldPtr const& lhs, CldPtr const& rhs) { return lhs > rhs ? 1 : (lhs < rhs) ? -1 : 0; }
-typedef UniquePredicate<CldPtr, _compare_cld_ptr_> CldPredicate;
-typedef JfrPredicatedArtifactWriterImplHost<CldPtr, LeakCldPredicate, write__artifact__classloader> LeakCldWriterImpl;
-typedef JfrPredicatedArtifactWriterImplHost<CldPtr, CldPredicate, write__artifact__classloader> CldWriterImpl;
-typedef JfrArtifactWriterHost<LeakCldWriterImpl, TYPE_CLASSLOADER> LeakCldWriter;
-typedef JfrArtifactWriterHost<CldWriterImpl, TYPE_CLASSLOADER> CldWriter;
-
-typedef const JfrSymbolId::SymbolEntry* SymbolEntryPtr;
-
-static int write__artifact__symbol__entry__(JfrCheckpointWriter* writer,
-                                            SymbolEntryPtr entry) {
-  assert(writer != NULL, "invariant");
-  assert(entry != NULL, "invariant");
-  ResourceMark rm;
-  writer->write(CREATE_SYMBOL_ID(entry->id()));
-  writer->write(entry->value()->as_C_string());
-  return 1;
-}
-
-int write__artifact__symbol__entry(JfrCheckpointWriter* writer, JfrArtifactSet* artifacts, const void* e) {
-  assert(e != NULL, "invariant");
-  return write__artifact__symbol__entry__(writer, (SymbolEntryPtr)e);
-}
-
-typedef JfrArtifactWriterImplHost<SymbolEntryPtr, write__artifact__symbol__entry> SymbolEntryWriterImpl;
-typedef JfrArtifactWriterHost<SymbolEntryWriterImpl, TYPE_SYMBOL> SymbolEntryWriter;
-
-typedef const JfrSymbolId::CStringEntry* CStringEntryPtr;
-
-static int write__artifact__cstring__entry__(JfrCheckpointWriter* writer, CStringEntryPtr entry) {
-  assert(writer != NULL, "invariant");
-  assert(entry != NULL, "invariant");
-  writer->write(CREATE_SYMBOL_ID(entry->id()));
-  writer->write(entry->value());
-  return 1;
-}
-
-int write__artifact__cstring__entry(JfrCheckpointWriter* writer, JfrArtifactSet* artifacts, const void* e) {
-  assert(e != NULL, "invariant");
-  return write__artifact__cstring__entry__(writer, (CStringEntryPtr)e);
-}
-
-typedef JfrArtifactWriterImplHost<CStringEntryPtr, write__artifact__cstring__entry> CStringEntryWriterImpl;
-typedef JfrArtifactWriterHost<CStringEntryWriterImpl, TYPE_SYMBOL> CStringEntryWriter;
-
-int write__artifact__klass__symbol(JfrCheckpointWriter* writer, JfrArtifactSet* artifacts, const void* k) {
-  assert(writer != NULL, "invariant");
-  assert(artifacts != NULL, "invaiant");
-  assert(k != NULL, "invariant");
-  const InstanceKlass* const ik = (const InstanceKlass*)k;
-  if (ik->is_unsafe_anonymous()) {
-    CStringEntryPtr entry =
-      artifacts->map_cstring(JfrSymbolId::unsafe_anonymous_klass_name_hash_code(ik));
-    assert(entry != NULL, "invariant");
-    return write__artifact__cstring__entry__(writer, entry);
-  }
-
-  SymbolEntryPtr entry = artifacts->map_symbol(JfrSymbolId::regular_klass_name_hash_code(ik));
-  return write__artifact__symbol__entry__(writer, entry);
-}
-
-int _compare_traceid_(const traceid& lhs, const traceid& rhs) {
-  return lhs > rhs ? 1 : (lhs < rhs) ? -1 : 0;
+int write__package(JfrCheckpointWriter* writer, const void* p) {
+  assert(p != NULL, "invariant");
+  PkgPtr pkg = (PkgPtr)p;
+  set_serialized(pkg);
+  return write_package(writer, pkg, false);
 }
 
-template <template <typename> class Predicate>
-class KlassSymbolWriterImpl {
- private:
-  JfrCheckpointWriter* _writer;
-  JfrArtifactSet* _artifacts;
-  Predicate<KlassPtr> _predicate;
-  MethodUsedPredicate<true> _method_used_predicate;
-  MethodFlagPredicate _method_flag_predicate;
-  UniquePredicate<traceid, _compare_traceid_> _unique_predicate;
-
-  int klass_symbols(KlassPtr klass);
-  int package_symbols(PkgPtr pkg);
-  int module_symbols(ModPtr module);
-  int class_loader_symbols(CldPtr cld);
-  int method_symbols(KlassPtr klass);
-
- public:
-  typedef KlassPtr Type;
-  KlassSymbolWriterImpl(JfrCheckpointWriter* writer,
-                        JfrArtifactSet* artifacts,
-                        bool class_unload) : _writer(writer),
-                                             _artifacts(artifacts),
-                                             _predicate(class_unload),
-                                             _method_used_predicate(class_unload),
-                                             _method_flag_predicate(class_unload),
-                                             _unique_predicate(class_unload) {}
-
-  int operator()(KlassPtr klass) {
-    assert(klass != NULL, "invariant");
-    int count = 0;
-    if (_predicate(klass)) {
-      count += klass_symbols(klass);
-      PkgPtr pkg = klass->package();
-      if (pkg != NULL) {
-        count += package_symbols(pkg);
-        ModPtr module = pkg->module();
-        if (module != NULL && module->is_named()) {
-          count += module_symbols(module);
-        }
-      }
-      CldPtr cld = klass->class_loader_data();
-      assert(cld != NULL, "invariant");
-      if (!cld->is_unsafe_anonymous()) {
-        count += class_loader_symbols(cld);
-      }
-      if (_method_used_predicate(klass)) {
-        count += method_symbols(klass);
-      }
-    }
-    return count;
-  }
-};
-
-template <template <typename> class Predicate>
-int KlassSymbolWriterImpl<Predicate>::klass_symbols(KlassPtr klass) {
-  assert(klass != NULL, "invariant");
-  assert(_predicate(klass), "invariant");
-  const InstanceKlass* const ik = (const InstanceKlass*)klass;
-  if (ik->is_unsafe_anonymous()) {
-    CStringEntryPtr entry =
-      this->_artifacts->map_cstring(JfrSymbolId::unsafe_anonymous_klass_name_hash_code(ik));
-    assert(entry != NULL, "invariant");
-    return _unique_predicate(entry->id()) ? write__artifact__cstring__entry__(this->_writer, entry) : 0;
-  }
-  SymbolEntryPtr entry = this->_artifacts->map_symbol(ik->name());
-  assert(entry != NULL, "invariant");
-  return _unique_predicate(entry->id()) ? write__artifact__symbol__entry__(this->_writer, entry) : 0;
-}
-
-template <template <typename> class Predicate>
-int KlassSymbolWriterImpl<Predicate>::package_symbols(PkgPtr pkg) {
-  assert(pkg != NULL, "invariant");
-  SymbolPtr pkg_name = pkg->name();
-  assert(pkg_name != NULL, "invariant");
-  SymbolEntryPtr package_symbol = this->_artifacts->map_symbol(pkg_name);
-  assert(package_symbol != NULL, "invariant");
-  return _unique_predicate(package_symbol->id()) ?
-    write__artifact__symbol__entry__(this->_writer, package_symbol) : 0;
-}
-
-template <template <typename> class Predicate>
-int KlassSymbolWriterImpl<Predicate>::module_symbols(ModPtr module) {
-  assert(module != NULL, "invariant");
-  assert(module->is_named(), "invariant");
-  int count = 0;
-  SymbolPtr sym = module->name();
-  SymbolEntryPtr entry = NULL;
-  if (sym != NULL) {
-    entry = this->_artifacts->map_symbol(sym);
-    assert(entry != NULL, "invariant");
-    if (_unique_predicate(entry->id())) {
-      count += write__artifact__symbol__entry__(this->_writer, entry);
-    }
-  }
-  sym = module->version();
-  if (sym != NULL) {
-    entry = this->_artifacts->map_symbol(sym);
-    assert(entry != NULL, "invariant");
-    if (_unique_predicate(entry->id())) {
-      count += write__artifact__symbol__entry__(this->_writer, entry);
-    }
-  }
-  sym = module->location();
-  if (sym != NULL) {
-    entry = this->_artifacts->map_symbol(sym);
-    assert(entry != NULL, "invariant");
-    if (_unique_predicate(entry->id())) {
-      count += write__artifact__symbol__entry__(this->_writer, entry);
-    }
-  }
-  return count;
+int write__package__leakp(JfrCheckpointWriter* writer, const void* p) {
+  assert(p != NULL, "invariant");
+  PkgPtr pkg = (PkgPtr)p;
+  CLEAR_LEAKP(pkg);
+  return write_package(writer, pkg, true);
 }
 
-template <template <typename> class Predicate>
-int KlassSymbolWriterImpl<Predicate>::class_loader_symbols(CldPtr cld) {
-  assert(cld != NULL, "invariant");
-  assert(!cld->is_unsafe_anonymous(), "invariant");
-  int count = 0;
-  // class loader type
-  const Klass* class_loader_klass = cld->class_loader_klass();
-  if (class_loader_klass == NULL) {
-    // (primordial) boot class loader
-    CStringEntryPtr entry = this->_artifacts->map_cstring(0);
-    assert(entry != NULL, "invariant");
-    assert(strncmp(entry->literal(),
-      BOOTSTRAP_LOADER_NAME,
-      BOOTSTRAP_LOADER_NAME_LEN) == 0, "invariant");
-    if (_unique_predicate(entry->id())) {
-      count += write__artifact__cstring__entry__(this->_writer, entry);
-    }
-  } else {
-    const Symbol* class_loader_name = cld->name();
-    if (class_loader_name != NULL) {
-      SymbolEntryPtr entry = this->_artifacts->map_symbol(class_loader_name);
-      assert(entry != NULL, "invariant");
-      if (_unique_predicate(entry->id())) {
-        count += write__artifact__symbol__entry__(this->_writer, entry);
-      }
-    }
-  }
-  return count;
-}
-
-template <template <typename> class Predicate>
-int KlassSymbolWriterImpl<Predicate>::method_symbols(KlassPtr klass) {
-  assert(_predicate(klass), "invariant");
-  assert(_method_used_predicate(klass), "invariant");
-  assert(METHOD_AND_CLASS_USED_ANY_EPOCH(klass), "invariant");
-  int count = 0;
-  const InstanceKlass* const ik = InstanceKlass::cast(klass);
-  const int len = ik->methods()->length();
-  for (int i = 0; i < len; ++i) {
-    MethodPtr method = ik->methods()->at(i);
-    if (_method_flag_predicate(method)) {
-      SymbolEntryPtr entry = this->_artifacts->map_symbol(method->name());
-      assert(entry != NULL, "invariant");
-      if (_unique_predicate(entry->id())) {
-        count += write__artifact__symbol__entry__(this->_writer, entry);
-      }
-      entry = this->_artifacts->map_symbol(method->signature());
-      assert(entry != NULL, "invariant");
-      if (_unique_predicate(entry->id())) {
-        count += write__artifact__symbol__entry__(this->_writer, entry);
-      }
-    }
-  }
-  return count;
+static void do_package(PackageEntry* entry) {
+  do_previous_epoch_artifact(_subsystem_callback, entry);
 }
 
-typedef KlassSymbolWriterImpl<LeakPredicate> LeakKlassSymbolWriterImpl;
-typedef JfrArtifactWriterHost<LeakKlassSymbolWriterImpl, TYPE_SYMBOL> LeakKlassSymbolWriter;
-
-class ClearKlassAndMethods {
- private:
-  ClearArtifact<KlassPtr> _clear_klass_tag_bits;
-  ClearArtifact<MethodPtr> _clear_method_flag;
-  MethodUsedPredicate<false> _method_used_predicate;
-
- public:
-  ClearKlassAndMethods(bool class_unload) : _clear_klass_tag_bits(class_unload),
-                                            _clear_method_flag(class_unload),
-                                            _method_used_predicate(class_unload) {}
-  bool operator()(KlassPtr klass) {
-    if (_method_used_predicate(klass)) {
-      const InstanceKlass* ik = InstanceKlass::cast(klass);
-      const int len = ik->methods()->length();
-      for (int i = 0; i < len; ++i) {
-        MethodPtr method = ik->methods()->at(i);
-        _clear_method_flag(method);
-      }
-    }
-    _clear_klass_tag_bits(klass);
-    return true;
-  }
-};
-
-typedef CompositeFunctor<KlassPtr,
-                         TagLeakpKlassArtifact,
-                         LeakKlassWriter> LeakpKlassArtifactTagging;
-
-typedef CompositeFunctor<KlassPtr,
-                         LeakpKlassArtifactTagging,
-                         KlassWriter> CompositeKlassWriter;
-
-typedef CompositeFunctor<KlassPtr,
-                         CompositeKlassWriter,
-                         KlassArtifactRegistrator> CompositeKlassWriterRegistration;
-
-typedef CompositeFunctor<KlassPtr,
-                         KlassWriter,
-                         KlassArtifactRegistrator> KlassWriterRegistration;
-
-typedef JfrArtifactCallbackHost<KlassPtr, KlassWriterRegistration> KlassCallback;
-typedef JfrArtifactCallbackHost<KlassPtr, CompositeKlassWriterRegistration> CompositeKlassCallback;
-
-/*
- * Composite operation
- *
- * TagLeakpKlassArtifact ->
- *   LeakpPredicate ->
- *     LeakpKlassWriter ->
- *       KlassPredicate ->
- *         KlassWriter ->
- *           KlassWriterRegistration
- */
-void JfrTypeSet::write_klass_constants(JfrCheckpointWriter* writer, JfrCheckpointWriter* leakp_writer) {
-  assert(!_artifacts->has_klass_entries(), "invariant");
-  KlassArtifactRegistrator reg(_artifacts);
-  KlassWriter kw(writer, _artifacts, _class_unload);
-  KlassWriterRegistration kwr(&kw, &reg);
-  if (leakp_writer == NULL) {
-    KlassCallback callback(&kwr);
-    _subsystem_callback = &callback;
-    do_klasses();
-    return;
-  }
-  TagLeakpKlassArtifact tagging(_class_unload);
-  LeakKlassWriter lkw(leakp_writer, _artifacts, _class_unload);
-  LeakpKlassArtifactTagging lpkat(&tagging, &lkw);
-  CompositeKlassWriter ckw(&lpkat, &kw);
-  CompositeKlassWriterRegistration ckwr(&ckw, &reg);
-  CompositeKlassCallback callback(&ckwr);
-  _subsystem_callback = &callback;
-  do_klasses();
+static void do_packages() {
+  ClassLoaderDataGraph::packages_do(&do_package);
 }
 
-typedef CompositeFunctor<PkgPtr,
-                         PackageWriter,
-                         ClearArtifact<PkgPtr> > PackageWriterWithClear;
-
-typedef CompositeFunctor<PkgPtr,
-                         LeakPackageWriter,
-                         PackageWriter> CompositePackageWriter;
-
-typedef CompositeFunctor<PkgPtr,
-                         CompositePackageWriter,
-                         ClearArtifact<PkgPtr> > CompositePackageWriterWithClear;
-
 class PackageFieldSelector {
  public:
   typedef PkgPtr TypePtr;
@@ -583,60 +349,86 @@
   }
 };
 
-typedef KlassToFieldEnvelope<PackageFieldSelector,
-                             PackageWriterWithClear> KlassPackageWriterWithClear;
+typedef SerializePredicate<PkgPtr> PackagePredicate;
+typedef JfrPredicatedTypeWriterImplHost<PkgPtr, PackagePredicate, write__package> PackageWriterImpl;
+typedef JfrTypeWriterHost<PackageWriterImpl, TYPE_PACKAGE> PackageWriter;
+typedef CompositeFunctor<PkgPtr, PackageWriter, ClearArtifact<PkgPtr> > PackageWriterWithClear;
+typedef KlassToFieldEnvelope<PackageFieldSelector, PackageWriter> KlassPackageWriter;
+typedef JfrArtifactCallbackHost<PkgPtr, PackageWriterWithClear> PackageCallback;
 
-typedef KlassToFieldEnvelope<PackageFieldSelector,
-                             CompositePackageWriterWithClear> KlassCompositePackageWriterWithClear;
+typedef LeakPredicate<PkgPtr> LeakPackagePredicate;
+typedef JfrPredicatedTypeWriterImplHost<PkgPtr, LeakPackagePredicate, write__package__leakp> LeakPackageWriterImpl;
+typedef JfrTypeWriterHost<LeakPackageWriterImpl, TYPE_PACKAGE> LeakPackageWriter;
 
-typedef JfrArtifactCallbackHost<PkgPtr, PackageWriterWithClear> PackageCallback;
+typedef CompositeFunctor<PkgPtr, LeakPackageWriter, PackageWriter> CompositePackageWriter;
+typedef KlassToFieldEnvelope<PackageFieldSelector, CompositePackageWriter> KlassCompositePackageWriter;
+typedef KlassToFieldEnvelope<PackageFieldSelector, PackageWriterWithClear> KlassPackageWriterWithClear;
+typedef CompositeFunctor<PkgPtr, CompositePackageWriter, ClearArtifact<PkgPtr> > CompositePackageWriterWithClear;
 typedef JfrArtifactCallbackHost<PkgPtr, CompositePackageWriterWithClear> CompositePackageCallback;
 
-/*
- * Composite operation
- *
- * LeakpPackageWriter ->
- *   PackageWriter ->
- *     ClearArtifact<PackageEntry>
- *
- */
-void JfrTypeSet::write_package_constants(JfrCheckpointWriter* writer, JfrCheckpointWriter* leakp_writer) {
-  assert(_artifacts->has_klass_entries(), "invariant");
-  ClearArtifact<PkgPtr> clear(_class_unload);
-  PackageWriter pw(writer, _artifacts, _class_unload);
-  if (leakp_writer == NULL) {
+static void write_packages() {
+  assert(_writer != NULL, "invariant");
+  PackageWriter pw(_writer, _class_unload);
+  KlassPackageWriter kpw(&pw);
+  if (current_epoch()) {
+    _artifacts->iterate_klasses(kpw);
+    _artifacts->tally(pw);
+    return;
+  }
+  assert(previous_epoch(), "invariant");
+  if (_leakp_writer == NULL) {
+    _artifacts->iterate_klasses(kpw);
+    ClearArtifact<PkgPtr> clear;
     PackageWriterWithClear pwwc(&pw, &clear);
-    KlassPackageWriterWithClear kpwwc(&pwwc);
-    _artifacts->iterate_klasses(kpwwc);
     PackageCallback callback(&pwwc);
     _subsystem_callback = &callback;
     do_packages();
-    return;
+  } else {
+    LeakPackageWriter lpw(_leakp_writer, _class_unload);
+    CompositePackageWriter cpw(&lpw, &pw);
+    KlassCompositePackageWriter kcpw(&cpw);
+    _artifacts->iterate_klasses(kcpw);
+    ClearArtifact<PkgPtr> clear;
+    CompositePackageWriterWithClear cpwwc(&cpw, &clear);
+    CompositePackageCallback callback(&cpwwc);
+    _subsystem_callback = &callback;
+    do_packages();
   }
-  LeakPackageWriter lpw(leakp_writer, _artifacts, _class_unload);
-  CompositePackageWriter cpw(&lpw, &pw);
-  CompositePackageWriterWithClear cpwwc(&cpw, &clear);
-  KlassCompositePackageWriterWithClear ckpw(&cpwwc);
-  _artifacts->iterate_klasses(ckpw);
-  CompositePackageCallback callback(&cpwwc);
-  _subsystem_callback = &callback;
-  do_packages();
+  _artifacts->tally(pw);
 }
 
-typedef CompositeFunctor<ModPtr,
-                         ModuleWriter,
-                         ClearArtifact<ModPtr> > ModuleWriterWithClear;
+static int write_module(JfrCheckpointWriter* writer, ModPtr mod, bool leakp) {
+  assert(mod != NULL, "invariant");
+  assert(_artifacts != NULL, "invariant");
+  writer->write(artifact_id(mod));
+  writer->write(mark_symbol(mod->name(), leakp));
+  writer->write(mark_symbol(mod->version(), leakp));
+  writer->write(mark_symbol(mod->location(), leakp));
+  writer->write(cld_id(mod->loader_data(), leakp));
+  return 1;
+}
 
-typedef CompositeFunctor<ModPtr,
-                         LeakModuleWriter,
-                         ModuleWriter> CompositeModuleWriter;
+int write__module(JfrCheckpointWriter* writer, const void* m) {
+  assert(m != NULL, "invariant");
+  ModPtr mod = (ModPtr)m;
+  set_serialized(mod);
+  return write_module(writer, mod, false);
+}
 
-typedef CompositeFunctor<ModPtr,
-                         CompositeModuleWriter,
-                         ClearArtifact<ModPtr> > CompositeModuleWriterWithClear;
+int write__module__leakp(JfrCheckpointWriter* writer, const void* m) {
+  assert(m != NULL, "invariant");
+  ModPtr mod = (ModPtr)m;
+  CLEAR_LEAKP(mod);
+  return write_module(writer, mod, true);
+}
 
-typedef JfrArtifactCallbackHost<ModPtr, ModuleWriterWithClear> ModuleCallback;
-typedef JfrArtifactCallbackHost<ModPtr, CompositeModuleWriterWithClear> CompositeModuleCallback;
+static void do_module(ModuleEntry* entry) {
+  do_previous_epoch_artifact(_subsystem_callback, entry);
+}
+
+static void do_modules() {
+  ClassLoaderDataGraph::modules_do(&do_module);
+}
 
 class ModuleFieldSelector {
  public:
@@ -648,47 +440,88 @@
   }
 };
 
-typedef KlassToFieldEnvelope<ModuleFieldSelector,
-                             ModuleWriterWithClear> KlassModuleWriterWithClear;
+typedef SerializePredicate<ModPtr> ModulePredicate;
+typedef JfrPredicatedTypeWriterImplHost<ModPtr, ModulePredicate, write__module> ModuleWriterImpl;
+typedef JfrTypeWriterHost<ModuleWriterImpl, TYPE_MODULE> ModuleWriter;
+typedef CompositeFunctor<ModPtr, ModuleWriter, ClearArtifact<ModPtr> > ModuleWriterWithClear;
+typedef JfrArtifactCallbackHost<ModPtr, ModuleWriterWithClear> ModuleCallback;
+typedef KlassToFieldEnvelope<ModuleFieldSelector, ModuleWriter> KlassModuleWriter;
 
-typedef KlassToFieldEnvelope<ModuleFieldSelector,
-                             CompositeModuleWriterWithClear> KlassCompositeModuleWriterWithClear;
+typedef LeakPredicate<ModPtr> LeakModulePredicate;
+typedef JfrPredicatedTypeWriterImplHost<ModPtr, LeakModulePredicate, write__module__leakp> LeakModuleWriterImpl;
+typedef JfrTypeWriterHost<LeakModuleWriterImpl, TYPE_MODULE> LeakModuleWriter;
 
-/*
- * Composite operation
- *
- * LeakpModuleWriter ->
- *   ModuleWriter ->
- *     ClearArtifact<ModuleEntry>
- */
-void JfrTypeSet::write_module_constants(JfrCheckpointWriter* writer, JfrCheckpointWriter* leakp_writer) {
-  assert(_artifacts->has_klass_entries(), "invariant");
-  ClearArtifact<ModPtr> clear(_class_unload);
-  ModuleWriter mw(writer, _artifacts, _class_unload);
-  if (leakp_writer == NULL) {
+typedef CompositeFunctor<ModPtr, LeakModuleWriter, ModuleWriter> CompositeModuleWriter;
+typedef KlassToFieldEnvelope<ModuleFieldSelector, CompositeModuleWriter> KlassCompositeModuleWriter;
+typedef CompositeFunctor<ModPtr, CompositeModuleWriter, ClearArtifact<ModPtr> > CompositeModuleWriterWithClear;
+typedef JfrArtifactCallbackHost<ModPtr, CompositeModuleWriterWithClear> CompositeModuleCallback;
+
+static void write_modules() {
+  assert(_writer != NULL, "invariant");
+  ModuleWriter mw(_writer, _class_unload);
+  KlassModuleWriter kmw(&mw);
+  if (current_epoch()) {
+    _artifacts->iterate_klasses(kmw);
+    _artifacts->tally(mw);
+    return;
+  }
+  assert(previous_epoch(), "invariant");
+  if (_leakp_writer == NULL) {
+    _artifacts->iterate_klasses(kmw);
+    ClearArtifact<ModPtr> clear;
     ModuleWriterWithClear mwwc(&mw, &clear);
-    KlassModuleWriterWithClear kmwwc(&mwwc);
-    _artifacts->iterate_klasses(kmwwc);
     ModuleCallback callback(&mwwc);
     _subsystem_callback = &callback;
     do_modules();
-    return;
+  } else {
+    LeakModuleWriter lmw(_leakp_writer, _class_unload);
+    CompositeModuleWriter cmw(&lmw, &mw);
+    KlassCompositeModuleWriter kcpw(&cmw);
+    _artifacts->iterate_klasses(kcpw);
+    ClearArtifact<ModPtr> clear;
+    CompositeModuleWriterWithClear cmwwc(&cmw, &clear);
+    CompositeModuleCallback callback(&cmwwc);
+    _subsystem_callback = &callback;
+    do_modules();
   }
-  LeakModuleWriter lmw(leakp_writer, _artifacts, _class_unload);
-  CompositeModuleWriter cmw(&lmw, &mw);
-  CompositeModuleWriterWithClear cmwwc(&cmw, &clear);
-  KlassCompositeModuleWriterWithClear kmwwc(&cmwwc);
-  _artifacts->iterate_klasses(kmwwc);
-  CompositeModuleCallback callback(&cmwwc);
-  _subsystem_callback = &callback;
-  do_modules();
+  _artifacts->tally(mw);
 }
 
-typedef CompositeFunctor<CldPtr, CldWriter, ClearArtifact<CldPtr> > CldWriterWithClear;
-typedef CompositeFunctor<CldPtr, LeakCldWriter, CldWriter> CompositeCldWriter;
-typedef CompositeFunctor<CldPtr, CompositeCldWriter, ClearArtifact<CldPtr> > CompositeCldWriterWithClear;
-typedef JfrArtifactCallbackHost<CldPtr, CldWriterWithClear> CldCallback;
-typedef JfrArtifactCallbackHost<CldPtr, CompositeCldWriterWithClear> CompositeCldCallback;
+static int write_classloader(JfrCheckpointWriter* writer, CldPtr cld, bool leakp) {
+  assert(cld != NULL, "invariant");
+  assert(!cld->is_unsafe_anonymous(), "invariant");
+  // class loader type
+  const Klass* class_loader_klass = cld->class_loader_klass();
+  if (class_loader_klass == NULL) {
+    // (primordial) boot class loader
+    writer->write(artifact_id(cld)); // class loader instance id
+    writer->write((traceid)0);  // class loader type id (absence of)
+    writer->write(get_bootstrap_name(leakp)); // maps to synthetic name -> "bootstrap"
+  } else {
+    writer->write(artifact_id(cld)); // class loader instance id
+    writer->write(artifact_id(class_loader_klass)); // class loader type id
+    writer->write(mark_symbol(cld->name(), leakp)); // class loader instance name
+  }
+  return 1;
+}
+
+int write__classloader(JfrCheckpointWriter* writer, const void* c) {
+  assert(c != NULL, "invariant");
+  CldPtr cld = (CldPtr)c;
+  set_serialized(cld);
+  return write_classloader(writer, cld, false);
+}
+
+int write__classloader__leakp(JfrCheckpointWriter* writer, const void* c) {
+  assert(c != NULL, "invariant");
+  CldPtr cld = (CldPtr)c;
+  CLEAR_LEAKP(cld);
+  return write_classloader(writer, cld, true);
+}
+
+static void do_class_loader_data(ClassLoaderData* cld) {
+  do_previous_epoch_artifact(_subsystem_callback, cld);
+}
 
 class CldFieldSelector {
  public:
@@ -700,289 +533,328 @@
   }
 };
 
-typedef KlassToFieldEnvelope<CldFieldSelector, CldWriterWithClear> KlassCldWriterWithClear;
-typedef KlassToFieldEnvelope<CldFieldSelector, CompositeCldWriterWithClear> KlassCompositeCldWriterWithClear;
+class CLDCallback : public CLDClosure {
+ public:
+  CLDCallback() {}
+  void do_cld(ClassLoaderData* cld) {
+    assert(cld != NULL, "invariant");
+    if (cld->is_unsafe_anonymous()) {
+      return;
+    }
+    do_class_loader_data(cld);
+  }
+};
+
+static void do_class_loaders() {
+  CLDCallback cld_cb;
+  ClassLoaderDataGraph::loaded_cld_do(&cld_cb);
+}
+
+typedef SerializePredicate<CldPtr> CldPredicate;
+typedef JfrPredicatedTypeWriterImplHost<CldPtr, CldPredicate, write__classloader> CldWriterImpl;
+typedef JfrTypeWriterHost<CldWriterImpl, TYPE_CLASSLOADER> CldWriter;
+typedef CompositeFunctor<CldPtr, CldWriter, ClearArtifact<CldPtr> > CldWriterWithClear;
+typedef JfrArtifactCallbackHost<CldPtr, CldWriterWithClear> CldCallback;
+typedef KlassToFieldEnvelope<CldFieldSelector, CldWriter> KlassCldWriter;
 
-/*
- * Composite operation
- *
- * LeakpClassLoaderWriter ->
- *   ClassLoaderWriter ->
- *     ClearArtifact<ClassLoaderData>
- */
-void JfrTypeSet::write_class_loader_constants(JfrCheckpointWriter* writer, JfrCheckpointWriter* leakp_writer) {
-  assert(_artifacts->has_klass_entries(), "invariant");
-  ClearArtifact<CldPtr> clear(_class_unload);
-  CldWriter cldw(writer, _artifacts, _class_unload);
-  if (leakp_writer == NULL) {
+typedef LeakPredicate<CldPtr> LeakCldPredicate;
+typedef JfrPredicatedTypeWriterImplHost<CldPtr, LeakCldPredicate, write__classloader__leakp> LeakCldWriterImpl;
+typedef JfrTypeWriterHost<LeakCldWriterImpl, TYPE_CLASSLOADER> LeakCldWriter;
+
+typedef CompositeFunctor<CldPtr, LeakCldWriter, CldWriter> CompositeCldWriter;
+typedef KlassToFieldEnvelope<CldFieldSelector, CompositeCldWriter> KlassCompositeCldWriter;
+typedef CompositeFunctor<CldPtr, CompositeCldWriter, ClearArtifact<CldPtr> > CompositeCldWriterWithClear;
+typedef JfrArtifactCallbackHost<CldPtr, CompositeCldWriterWithClear> CompositeCldCallback;
+
+static void write_classloaders() {
+  assert(_writer != NULL, "invariant");
+  CldWriter cldw(_writer, _class_unload);
+  KlassCldWriter kcw(&cldw);
+  if (current_epoch()) {
+    _artifacts->iterate_klasses(kcw);
+    _artifacts->tally(cldw);
+    return;
+  }
+  assert(previous_epoch(), "invariant");
+  if (_leakp_writer == NULL) {
+    _artifacts->iterate_klasses(kcw);
+    ClearArtifact<CldPtr> clear;
     CldWriterWithClear cldwwc(&cldw, &clear);
-    KlassCldWriterWithClear kcldwwc(&cldwwc);
-    _artifacts->iterate_klasses(kcldwwc);
     CldCallback callback(&cldwwc);
     _subsystem_callback = &callback;
     do_class_loaders();
-    return;
+  } else {
+    LeakCldWriter lcldw(_leakp_writer, _class_unload);
+    CompositeCldWriter ccldw(&lcldw, &cldw);
+    KlassCompositeCldWriter kccldw(&ccldw);
+    _artifacts->iterate_klasses(kccldw);
+    ClearArtifact<CldPtr> clear;
+    CompositeCldWriterWithClear ccldwwc(&ccldw, &clear);
+    CompositeCldCallback callback(&ccldwwc);
+    _subsystem_callback = &callback;
+    do_class_loaders();
   }
-  LeakCldWriter lcldw(leakp_writer, _artifacts, _class_unload);
-  CompositeCldWriter ccldw(&lcldw, &cldw);
-  CompositeCldWriterWithClear ccldwwc(&ccldw, &clear);
-  KlassCompositeCldWriterWithClear kcclwwc(&ccldwwc);
-  _artifacts->iterate_klasses(kcclwwc);
-  CompositeCldCallback callback(&ccldwwc);
-  _subsystem_callback = &callback;
-  do_class_loaders();
+  _artifacts->tally(cldw);
+}
+
+static u1 get_visibility(MethodPtr method) {
+  assert(method != NULL, "invariant");
+  return const_cast<Method*>(method)->is_hidden() ? (u1)1 : (u1)0;
+}
+
+template <>
+void set_serialized<Method>(MethodPtr method) {
+  assert(method != NULL, "invariant");
+  SET_METHOD_SERIALIZED(method);
+  assert(IS_METHOD_SERIALIZED(method), "invariant");
 }
 
-template <bool predicate_bool, typename MethodFunctor>
+static int write_method(JfrCheckpointWriter* writer, MethodPtr method, bool leakp) {
+  assert(writer != NULL, "invariant");
+  assert(method != NULL, "invariant");
+  assert(_artifacts != NULL, "invariant");
+  KlassPtr klass = method->method_holder();
+  assert(klass != NULL, "invariant");
+  writer->write(method_id(klass, method));
+  writer->write(artifact_id(klass));
+  writer->write(mark_symbol(method->name(), leakp));
+  writer->write(mark_symbol(method->signature(), leakp));
+  writer->write((u2)get_flags(method));
+  writer->write(get_visibility(method));
+  return 1;
+}
+
+int write__method(JfrCheckpointWriter* writer, const void* m) {
+  assert(m != NULL, "invariant");
+  MethodPtr method = (MethodPtr)m;
+  set_serialized(method);
+  return write_method(writer, method, false);
+}
+
+int write__method__leakp(JfrCheckpointWriter* writer, const void* m) {
+  assert(m != NULL, "invariant");
+  MethodPtr method = (MethodPtr)m;
+  return write_method(writer, method, true);
+}
+
+template <typename MethodCallback, typename KlassCallback, bool leakp>
 class MethodIteratorHost {
  private:
-  MethodFunctor _method_functor;
-  MethodUsedPredicate<predicate_bool> _method_used_predicate;
-  MethodFlagPredicate _method_flag_predicate;
-
+  MethodCallback _method_cb;
+  KlassCallback _klass_cb;
+  MethodUsedPredicate<leakp> _method_used_predicate;
+  MethodFlagPredicate<leakp> _method_flag_predicate;
  public:
   MethodIteratorHost(JfrCheckpointWriter* writer,
-                     JfrArtifactSet* artifacts,
-                     bool class_unload,
+                     bool current_epoch = false,
+                     bool class_unload = false,
                      bool skip_header = false) :
-    _method_functor(writer, artifacts, class_unload, skip_header),
-    _method_used_predicate(class_unload),
-    _method_flag_predicate(class_unload) {}
+    _method_cb(writer, class_unload, skip_header),
+    _klass_cb(writer, class_unload, skip_header),
+    _method_used_predicate(current_epoch),
+    _method_flag_predicate(current_epoch) {}
 
   bool operator()(KlassPtr klass) {
     if (_method_used_predicate(klass)) {
-      assert(METHOD_AND_CLASS_USED_ANY_EPOCH(klass), "invariant");
-      const InstanceKlass* ik = InstanceKlass::cast(klass);
+      const InstanceKlass* const ik = InstanceKlass::cast(klass);
       const int len = ik->methods()->length();
       for (int i = 0; i < len; ++i) {
         MethodPtr method = ik->methods()->at(i);
         if (_method_flag_predicate(method)) {
-          _method_functor(method);
+          _method_cb(method);
         }
       }
     }
-    return true;
+    return _klass_cb(klass);
   }
 
-  int count() const { return _method_functor.count(); }
-  void add(int count) { _method_functor.add(count); }
+  int count() const { return _method_cb.count(); }
+  void add(int count) { _method_cb.add(count); }
 };
 
-typedef MethodIteratorHost<true /*leakp */,  MethodWriterImpl> LeakMethodWriter;
-typedef MethodIteratorHost<false, MethodWriterImpl> MethodWriter;
-typedef CompositeFunctor<KlassPtr, LeakMethodWriter, MethodWriter> CompositeMethodWriter;
-
-/*
- * Composite operation
- *
- * LeakpMethodWriter ->
- *   MethodWriter
- */
-void JfrTypeSet::write_method_constants(JfrCheckpointWriter* writer, JfrCheckpointWriter* leakp_writer) {
-  assert(_artifacts->has_klass_entries(), "invariant");
-  MethodWriter mw(writer, _artifacts, _class_unload);
-  if (leakp_writer == NULL) {
-    _artifacts->iterate_klasses(mw);
-    return;
-  }
-  LeakMethodWriter lpmw(leakp_writer, _artifacts, _class_unload);
-  CompositeMethodWriter cmw(&lpmw, &mw);
-  _artifacts->iterate_klasses(cmw);
-}
-static void write_symbols_leakp(JfrCheckpointWriter* leakp_writer, JfrArtifactSet* artifacts, bool class_unload) {
-  assert(leakp_writer != NULL, "invariant");
-  assert(artifacts != NULL, "invariant");
-  LeakKlassSymbolWriter lpksw(leakp_writer, artifacts, class_unload);
-  artifacts->iterate_klasses(lpksw);
-}
-static void write_symbols(JfrCheckpointWriter* writer, JfrCheckpointWriter* leakp_writer, JfrArtifactSet* artifacts, bool class_unload) {
-  assert(writer != NULL, "invariant");
-  assert(artifacts != NULL, "invariant");
-  if (leakp_writer != NULL) {
-    write_symbols_leakp(leakp_writer, artifacts, class_unload);
-  }
-  // iterate all registered symbols
-  SymbolEntryWriter symbol_writer(writer, artifacts, class_unload);
-  artifacts->iterate_symbols(symbol_writer);
-  CStringEntryWriter cstring_writer(writer, artifacts, class_unload, true); // skip header
-  artifacts->iterate_cstrings(cstring_writer);
-  symbol_writer.add(cstring_writer.count());
-}
-
-bool JfrTypeSet::_class_unload = false;
-JfrArtifactSet* JfrTypeSet::_artifacts = NULL;
-JfrArtifactClosure* JfrTypeSet::_subsystem_callback = NULL;
-
-void JfrTypeSet::write_symbol_constants(JfrCheckpointWriter* writer, JfrCheckpointWriter* leakp_writer) {
-  assert(writer != NULL, "invariant");
-  assert(_artifacts->has_klass_entries(), "invariant");
-  write_symbols(writer, leakp_writer, _artifacts, _class_unload);
-}
-
-void JfrTypeSet::do_unloaded_klass(Klass* klass) {
-  assert(klass != NULL, "invariant");
-  assert(_subsystem_callback != NULL, "invariant");
-  if (IS_JDK_JFR_EVENT_SUBKLASS(klass)) {
-    JfrEventClasses::increment_unloaded_event_class();
-  }
-  if (USED_THIS_EPOCH(klass)) { // includes leakp subset
-    _subsystem_callback->do_artifact(klass);
-    return;
-  }
-  if (klass->is_subclass_of(SystemDictionary::ClassLoader_klass()) || klass == SystemDictionary::Object_klass()) {
-    SET_LEAKP_USED_THIS_EPOCH(klass); // tag leakp "safe byte" for subset inclusion
-    _subsystem_callback->do_artifact(klass);
-  }
-}
-
-void JfrTypeSet::do_klass(Klass* klass) {
-  assert(klass != NULL, "invariant");
-  assert(_subsystem_callback != NULL, "invariant");
-  if (USED_PREV_EPOCH(klass)) { // includes leakp subset
-    _subsystem_callback->do_artifact(klass);
-    return;
-  }
-  if (klass->is_subclass_of(SystemDictionary::ClassLoader_klass()) || klass == SystemDictionary::Object_klass()) {
-    SET_LEAKP_USED_PREV_EPOCH(klass); // tag leakp "safe byte" for subset inclusion
-    _subsystem_callback->do_artifact(klass);
-  }
-}
-
-void JfrTypeSet::do_klasses() {
-  if (_class_unload) {
-    ClassLoaderDataGraph::classes_unloading_do(&do_unloaded_klass);
-    return;
-  }
-  ClassLoaderDataGraph::classes_do(&do_klass);
-}
-
-void JfrTypeSet::do_unloaded_package(PackageEntry* entry) {
-  assert(entry != NULL, "invariant");
-  assert(_subsystem_callback != NULL, "invariant");
-  if (ANY_USED_THIS_EPOCH(entry)) { // includes leakp subset
-    _subsystem_callback->do_artifact(entry);
-  }
-}
-
-void JfrTypeSet::do_package(PackageEntry* entry) {
-  assert(_subsystem_callback != NULL, "invariant");
-  if (ANY_USED_PREV_EPOCH(entry)) { // includes leakp subset
-    _subsystem_callback->do_artifact(entry);
-  }
-}
-
-void JfrTypeSet::do_packages() {
-  if (_class_unload) {
-    ClassLoaderDataGraph::packages_unloading_do(&do_unloaded_package);
-    return;
-  }
-  ClassLoaderDataGraph::packages_do(&do_package);
-}
-void JfrTypeSet::do_unloaded_module(ModuleEntry* entry) {
-  assert(entry != NULL, "invariant");
-  assert(_subsystem_callback != NULL, "invariant");
-  if (ANY_USED_THIS_EPOCH(entry)) { // includes leakp subset
-    _subsystem_callback->do_artifact(entry);
-  }
-}
-
-void JfrTypeSet::do_module(ModuleEntry* entry) {
-  assert(_subsystem_callback != NULL, "invariant");
-  if (ANY_USED_PREV_EPOCH(entry)) { // includes leakp subset
-    _subsystem_callback->do_artifact(entry);
-  }
-}
-
-void JfrTypeSet::do_modules() {
-  if (_class_unload) {
-    ClassLoaderDataGraph::modules_unloading_do(&do_unloaded_module);
-    return;
-  }
-  ClassLoaderDataGraph::modules_do(&do_module);
-}
-
-void JfrTypeSet::do_unloaded_class_loader_data(ClassLoaderData* cld) {
-  assert(_subsystem_callback != NULL, "invariant");
-  if (ANY_USED_THIS_EPOCH(cld)) { // includes leakp subset
-    _subsystem_callback->do_artifact(cld);
-  }
-}
-
-void JfrTypeSet::do_class_loader_data(ClassLoaderData* cld) {
-  assert(_subsystem_callback != NULL, "invariant");
-  if (ANY_USED_PREV_EPOCH(cld)) { // includes leakp subset
-    _subsystem_callback->do_artifact(cld);
-  }
-}
-
-class CLDCallback : public CLDClosure {
- private:
-  bool _class_unload;
+template <typename T, template <typename> class Impl>
+class Wrapper {
+  Impl<T> _t;
  public:
-  CLDCallback(bool class_unload) : _class_unload(class_unload) {}
-  void do_cld(ClassLoaderData* cld) {
-     assert(cld != NULL, "invariant");
-    if (cld->is_unsafe_anonymous()) {
-      return;
-    }
-    if (_class_unload) {
-      JfrTypeSet::do_unloaded_class_loader_data(cld);
-      return;
-    }
-    JfrTypeSet::do_class_loader_data(cld);
+  Wrapper(JfrCheckpointWriter*, bool, bool) : _t() {}
+  bool operator()(T const& value) {
+    return _t(value);
   }
 };
 
-void JfrTypeSet::do_class_loaders() {
-  CLDCallback cld_cb(_class_unload);
-  if (_class_unload) {
-    ClassLoaderDataGraph::cld_unloading_do(&cld_cb);
-    return;
+typedef SerializePredicate<MethodPtr> MethodPredicate;
+typedef JfrPredicatedTypeWriterImplHost<MethodPtr, MethodPredicate, write__method> MethodWriterImplTarget;
+typedef Wrapper<KlassPtr, Stub> KlassCallbackStub;
+typedef JfrTypeWriterHost<MethodWriterImplTarget, TYPE_METHOD> MethodWriterImpl;
+typedef MethodIteratorHost<MethodWriterImpl, KlassCallbackStub, false> MethodWriter;
+
+typedef LeakPredicate<MethodPtr> LeakMethodPredicate;
+typedef JfrPredicatedTypeWriterImplHost<MethodPtr, LeakMethodPredicate, write__method__leakp> LeakMethodWriterImplTarget;
+typedef JfrTypeWriterHost<LeakMethodWriterImplTarget, TYPE_METHOD> LeakMethodWriterImpl;
+typedef MethodIteratorHost<LeakMethodWriterImpl, KlassCallbackStub, true> LeakMethodWriter;
+typedef CompositeFunctor<KlassPtr, LeakMethodWriter, MethodWriter> CompositeMethodWriter;
+
+static void write_methods() {
+  assert(_writer != NULL, "invariant");
+  MethodWriter mw(_writer, current_epoch(), _class_unload);
+  if (_leakp_writer == NULL) {
+    _artifacts->iterate_klasses(mw);
+  } else {
+    LeakMethodWriter lpmw(_leakp_writer, current_epoch(), _class_unload);
+    CompositeMethodWriter cmw(&lpmw, &mw);
+    _artifacts->iterate_klasses(cmw);
   }
-  ClassLoaderDataGraph::loaded_cld_do(&cld_cb);
+  _artifacts->tally(mw);
+}
+
+template <>
+void set_serialized<JfrSymbolId::SymbolEntry>(SymbolEntryPtr ptr) {
+  assert(ptr != NULL, "invariant");
+  ptr->set_serialized();
+  assert(ptr->is_serialized(), "invariant");
+}
+
+template <>
+void set_serialized<JfrSymbolId::CStringEntry>(CStringEntryPtr ptr) {
+  assert(ptr != NULL, "invariant");
+  ptr->set_serialized();
+  assert(ptr->is_serialized(), "invariant");
+}
+
+static int write_symbol(JfrCheckpointWriter* writer, SymbolEntryPtr entry, bool leakp) {
+  assert(writer != NULL, "invariant");
+  assert(entry != NULL, "invariant");
+  ResourceMark rm;
+  writer->write(create_symbol_id(entry->id()));
+  writer->write(entry->value()->as_C_string());
+  return 1;
+}
+
+int write__symbol(JfrCheckpointWriter* writer, const void* e) {
+  assert(e != NULL, "invariant");
+  SymbolEntryPtr entry = (SymbolEntryPtr)e;
+  set_serialized(entry);
+  return write_symbol(writer, entry, false);
+}
+
+int write__symbol__leakp(JfrCheckpointWriter* writer, const void* e) {
+  assert(e != NULL, "invariant");
+  SymbolEntryPtr entry = (SymbolEntryPtr)e;
+  return write_symbol(writer, entry, true);
+}
+
+static int write_cstring(JfrCheckpointWriter* writer, CStringEntryPtr entry, bool leakp) {
+  assert(writer != NULL, "invariant");
+  assert(entry != NULL, "invariant");
+  writer->write(create_symbol_id(entry->id()));
+  writer->write(entry->value());
+  return 1;
+}
+
+int write__cstring(JfrCheckpointWriter* writer, const void* e) {
+  assert(e != NULL, "invariant");
+  CStringEntryPtr entry = (CStringEntryPtr)e;
+  set_serialized(entry);
+  return write_cstring(writer, entry, false);
 }
 
-static void clear_artifacts(JfrArtifactSet* artifacts,
-                            bool class_unload) {
-  assert(artifacts != NULL, "invariant");
-  assert(artifacts->has_klass_entries(), "invariant");
+int write__cstring__leakp(JfrCheckpointWriter* writer, const void* e) {
+  assert(e != NULL, "invariant");
+  CStringEntryPtr entry = (CStringEntryPtr)e;
+  return write_cstring(writer, entry, true);
+}
+
+typedef SymbolPredicate<SymbolEntryPtr, false> SymPredicate;
+typedef JfrPredicatedTypeWriterImplHost<SymbolEntryPtr, SymPredicate, write__symbol> SymbolEntryWriterImpl;
+typedef JfrTypeWriterHost<SymbolEntryWriterImpl, TYPE_SYMBOL> SymbolEntryWriter;
+typedef SymbolPredicate<CStringEntryPtr, false> CStringPredicate;
+typedef JfrPredicatedTypeWriterImplHost<CStringEntryPtr, CStringPredicate, write__cstring> CStringEntryWriterImpl;
+typedef JfrTypeWriterHost<CStringEntryWriterImpl, TYPE_SYMBOL> CStringEntryWriter;
+
+typedef SymbolPredicate<SymbolEntryPtr, true> LeakSymPredicate;
+typedef JfrPredicatedTypeWriterImplHost<SymbolEntryPtr, LeakSymPredicate, write__symbol__leakp> LeakSymbolEntryWriterImpl;
+typedef JfrTypeWriterHost<LeakSymbolEntryWriterImpl, TYPE_SYMBOL> LeakSymbolEntryWriter;
+typedef CompositeFunctor<SymbolEntryPtr, LeakSymbolEntryWriter, SymbolEntryWriter> CompositeSymbolWriter;
+typedef SymbolPredicate<CStringEntryPtr, true> LeakCStringPredicate;
+typedef JfrPredicatedTypeWriterImplHost<CStringEntryPtr, LeakCStringPredicate, write__cstring__leakp> LeakCStringEntryWriterImpl;
+typedef JfrTypeWriterHost<LeakCStringEntryWriterImpl, TYPE_SYMBOL> LeakCStringEntryWriter;
+typedef CompositeFunctor<CStringEntryPtr, LeakCStringEntryWriter, CStringEntryWriter> CompositeCStringWriter;
+
+static void write_symbols_with_leakp() {
+  assert(_leakp_writer != NULL, "invariant");
+  SymbolEntryWriter sw(_writer, _class_unload);
+  LeakSymbolEntryWriter lsw(_leakp_writer, _class_unload);
+  CompositeSymbolWriter csw(&lsw, &sw);
+  _artifacts->iterate_symbols(csw);
+  CStringEntryWriter ccsw(_writer, _class_unload, true); // skip header
+  LeakCStringEntryWriter lccsw(_leakp_writer, _class_unload, true); // skip header
+  CompositeCStringWriter cccsw(&lccsw, &ccsw);
+  _artifacts->iterate_cstrings(cccsw);
+  sw.add(ccsw.count());
+  lsw.add(lccsw.count());
+  _artifacts->tally(sw);
+}
 
-  // untag
-  ClearKlassAndMethods clear(class_unload);
-  artifacts->iterate_klasses(clear);
-  artifacts->clear();
+static void write_symbols() {
+  assert(_writer != NULL, "invariant");
+  if (_leakp_writer != NULL) {
+    write_symbols_with_leakp();
+    return;
+  }
+  SymbolEntryWriter sw(_writer, _class_unload);
+  _artifacts->iterate_symbols(sw);
+  CStringEntryWriter csw(_writer, _class_unload, true); // skip header
+  _artifacts->iterate_cstrings(csw);
+  sw.add(csw.count());
+  _artifacts->tally(sw);
+}
+
+typedef Wrapper<KlassPtr, ClearArtifact> ClearKlassBits;
+typedef Wrapper<MethodPtr, ClearArtifact> ClearMethodFlag;
+typedef MethodIteratorHost<ClearMethodFlag, ClearKlassBits, false> ClearKlassAndMethods;
+
+static size_t teardown() {
+  assert(_artifacts != NULL, "invariant");
+  const size_t total_count = _artifacts->total_count();
+  if (previous_epoch()) {
+    assert(_writer != NULL, "invariant");
+    ClearKlassAndMethods clear(_writer);
+    _artifacts->iterate_klasses(clear);
+    _artifacts->clear();
+    ++checkpoint_id;
+  }
+  return total_count;
+}
+
+static void setup(JfrCheckpointWriter* writer, JfrCheckpointWriter* leakp_writer, bool class_unload) {
+  _writer = writer;
+  _leakp_writer = leakp_writer;
+  _class_unload = class_unload;
+  if (_artifacts == NULL) {
+    _artifacts = new JfrArtifactSet(class_unload);
+  } else {
+    _artifacts->initialize(class_unload);
+  }
+  assert(_artifacts != NULL, "invariant");
+  assert(!_artifacts->has_klass_entries(), "invariant");
 }
 
 /**
  * Write all "tagged" (in-use) constant artifacts and their dependencies.
  */
-void JfrTypeSet::serialize(JfrCheckpointWriter* writer, JfrCheckpointWriter* leakp_writer, bool class_unload) {
+size_t JfrTypeSet::serialize(JfrCheckpointWriter* writer, JfrCheckpointWriter* leakp_writer, bool class_unload) {
   assert(writer != NULL, "invariant");
   ResourceMark rm;
-  // initialization begin
-  _class_unload = class_unload;
-  ++checkpoint_id;
-  if (_artifacts == NULL) {
-    _artifacts = new JfrArtifactSet(class_unload);
-    _subsystem_callback = NULL;
-  } else {
-    _artifacts->initialize(class_unload);
-    _subsystem_callback = NULL;
-  }
-  assert(_artifacts != NULL, "invariant");
-  assert(!_artifacts->has_klass_entries(), "invariant");
-  assert(_subsystem_callback == NULL, "invariant");
-  // initialization complete
-
+  setup(writer, leakp_writer, class_unload);
   // write order is important because an individual write step
   // might tag an artifact to be written in a subsequent step
-  write_klass_constants(writer, leakp_writer);
-  if (_artifacts->has_klass_entries()) {
-    write_package_constants(writer, leakp_writer);
-    write_module_constants(writer, leakp_writer);
-    write_class_loader_constants(writer, leakp_writer);
-    write_method_constants(writer, leakp_writer);
-    write_symbol_constants(writer, leakp_writer);
-    clear_artifacts(_artifacts, class_unload);
+  if (!write_klasses()) {
+    return 0;
   }
+  write_packages();
+  write_modules();
+  write_classloaders();
+  write_methods();
+  write_symbols();
+  return teardown();
 }
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -27,47 +27,11 @@
 
 #include "jfr/utilities/jfrAllocation.hpp"
 
-class ClassLoaderData;
-class JfrArtifactClosure;
-class JfrArtifactSet;
 class JfrCheckpointWriter;
-class Klass;
-
-class ModuleEntry;
-class PackageEntry;
 
 class JfrTypeSet : AllStatic {
-  friend class CLDCallback;
-  friend class JfrTypeManager;
-  friend class TypeSetSerialization;
- private:
-  static JfrArtifactSet* _artifacts;
-  static JfrArtifactClosure* _subsystem_callback;
-  static bool _class_unload;
-
-  static void do_klass(Klass* k);
-  static void do_unloaded_klass(Klass* k);
-  static void do_klasses();
-
-  static void do_package(PackageEntry* entry);
-  static void do_unloaded_package(PackageEntry* entry);
-  static void do_packages();
-
-  static void do_module(ModuleEntry* entry);
-  static void do_unloaded_module(ModuleEntry* entry);
-  static void do_modules();
-
-  static void do_class_loader_data(ClassLoaderData* cld);
-  static void do_unloaded_class_loader_data(ClassLoaderData* cld);
-  static void do_class_loaders();
-
-  static void write_klass_constants(JfrCheckpointWriter* writer, JfrCheckpointWriter* leakp_writer);
-  static void write_package_constants(JfrCheckpointWriter* writer, JfrCheckpointWriter* leakp_writer);
-  static void write_module_constants(JfrCheckpointWriter* writer, JfrCheckpointWriter* leakp_writer);
-  static void write_class_loader_constants(JfrCheckpointWriter* writer, JfrCheckpointWriter* leakp_writer);
-  static void write_method_constants(JfrCheckpointWriter* writer, JfrCheckpointWriter* leakp_writer);
-  static void write_symbol_constants(JfrCheckpointWriter* writer, JfrCheckpointWriter* leakp_writer);
-  static void serialize(JfrCheckpointWriter* writer, JfrCheckpointWriter* leakp_writer, bool class_unload);
+ public:
+  static size_t serialize(JfrCheckpointWriter* writer, JfrCheckpointWriter* leakp_writer, bool class_unload);
 };
 
 #endif // SHARE_JFR_RECORDER_CHECKPOINT_TYPES_JFRTYPESET_HPP
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSetUtils.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSetUtils.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,15 +28,28 @@
 #include "oops/oop.inline.hpp"
 #include "oops/symbol.hpp"
 
-JfrSymbolId::JfrSymbolId() : _sym_table(new SymbolTable(this)), _cstring_table(new CStringTable(this)), _symbol_id_counter(0) {
+static JfrSymbolId::CStringEntry* bootstrap = NULL;
+
+JfrSymbolId::JfrSymbolId() :
+  _sym_table(new SymbolTable(this)),
+  _cstring_table(new CStringTable(this)),
+  _sym_list(NULL),
+  _cstring_list(NULL),
+  _symbol_id_counter(1),
+  _class_unload(false) {
   assert(_sym_table != NULL, "invariant");
   assert(_cstring_table != NULL, "invariant");
-  initialize();
+  bootstrap = new CStringEntry(0, (const char*)&BOOTSTRAP_LOADER_NAME);
+  assert(bootstrap != NULL, "invariant");
+  bootstrap->set_id(1);
+  _cstring_list = bootstrap;
 }
 
-void JfrSymbolId::initialize() {
+JfrSymbolId::~JfrSymbolId() {
   clear();
-  assert(_symbol_id_counter == 0, "invariant");
+  delete _sym_table;
+  delete _cstring_table;
+  delete bootstrap;
 }
 
 void JfrSymbolId::clear() {
@@ -51,106 +64,115 @@
     _cstring_table->clear_entries();
   }
   assert(!_cstring_table->has_entries(), "invariant");
-  _symbol_id_counter = 0;
-}
 
-JfrSymbolId::~JfrSymbolId() {
-  delete _sym_table;
-  delete _cstring_table;
+  _sym_list = NULL;
+  _cstring_list = NULL;
+  _symbol_id_counter = 1;
+
+  assert(bootstrap != NULL, "invariant");
+  bootstrap->reset();
+  _cstring_list = bootstrap;
 }
 
-traceid JfrSymbolId::mark_unsafe_anonymous_klass_name(const Klass* k) {
-  assert(k != NULL, "invariant");
-  assert(k->is_instance_klass(), "invariant");
-  assert(is_unsafe_anonymous_klass(k), "invariant");
-
-  uintptr_t anonymous_symbol_hash_code = 0;
-  const char* const anonymous_symbol =
-    create_unsafe_anonymous_klass_symbol((const InstanceKlass*)k, anonymous_symbol_hash_code);
-
-  if (anonymous_symbol == NULL) {
-    return 0;
-  }
-
-  assert(anonymous_symbol_hash_code != 0, "invariant");
-  traceid symbol_id = mark(anonymous_symbol, anonymous_symbol_hash_code);
-  assert(mark(anonymous_symbol, anonymous_symbol_hash_code) == symbol_id, "invariant");
-  return symbol_id;
+void JfrSymbolId::set_class_unload(bool class_unload) {
+  _class_unload = class_unload;
 }
 
-const JfrSymbolId::SymbolEntry* JfrSymbolId::map_symbol(const Symbol* symbol) const {
-  return _sym_table->lookup_only(symbol, (uintptr_t)const_cast<Symbol*>(symbol)->identity_hash());
-}
-
-const JfrSymbolId::SymbolEntry* JfrSymbolId::map_symbol(uintptr_t hash) const {
-  return _sym_table->lookup_only(NULL, hash);
+void JfrSymbolId::on_link(const SymbolEntry* entry) {
+  assert(entry != NULL, "invariant");
+  const_cast<Symbol*>(entry->literal())->increment_refcount();
+  assert(entry->id() == 0, "invariant");
+  entry->set_id(++_symbol_id_counter);
+  entry->set_list_next(_sym_list);
+  _sym_list = entry;
 }
 
-const JfrSymbolId::CStringEntry* JfrSymbolId::map_cstring(uintptr_t hash) const {
-  return _cstring_table->lookup_only(NULL, hash);
-}
-
-void JfrSymbolId::assign_id(SymbolEntry* entry) {
-  assert(entry != NULL, "invariant");
-  assert(entry->id() == 0, "invariant");
-  entry->set_id(++_symbol_id_counter);
-}
-
-bool JfrSymbolId::equals(const Symbol* query, uintptr_t hash, const SymbolEntry* entry) {
+bool JfrSymbolId::on_equals(uintptr_t hash, const SymbolEntry* entry) {
   // query might be NULL
   assert(entry != NULL, "invariant");
   assert(entry->hash() == hash, "invariant");
   return true;
 }
 
-void JfrSymbolId::assign_id(CStringEntry* entry) {
+void JfrSymbolId::on_unlink(const SymbolEntry* entry) {
+  assert(entry != NULL, "invariant");
+  const_cast<Symbol*>(entry->literal())->decrement_refcount();
+}
+
+void JfrSymbolId::on_link(const CStringEntry* entry) {
   assert(entry != NULL, "invariant");
   assert(entry->id() == 0, "invariant");
   entry->set_id(++_symbol_id_counter);
+  entry->set_list_next(_cstring_list);
+  _cstring_list = entry;
 }
 
-bool JfrSymbolId::equals(const char* query, uintptr_t hash, const CStringEntry* entry) {
-  // query might be NULL
+bool JfrSymbolId::on_equals(uintptr_t hash, const CStringEntry* entry) {
   assert(entry != NULL, "invariant");
   assert(entry->hash() == hash, "invariant");
   return true;
 }
 
-traceid JfrSymbolId::mark(const Klass* k) {
-  assert(k != NULL, "invariant");
-  traceid symbol_id = 0;
-  if (is_unsafe_anonymous_klass(k)) {
-    symbol_id = mark_unsafe_anonymous_klass_name(k);
+void JfrSymbolId::on_unlink(const CStringEntry* entry) {
+  assert(entry != NULL, "invariant");
+  JfrCHeapObj::free(const_cast<char*>(entry->literal()), strlen(entry->literal() + 1));
+}
+
+traceid JfrSymbolId::bootstrap_name(bool leakp) {
+  assert(bootstrap != NULL, "invariant");
+  if (leakp) {
+    bootstrap->set_leakp();
   }
-  if (0 == symbol_id) {
-    const Symbol* const sym = k->name();
-    if (sym != NULL) {
-      symbol_id = mark(sym);
-    }
-  }
-  assert(symbol_id > 0, "a symbol handler must mark the symbol for writing");
-  return symbol_id;
+  return 1;
+}
+
+traceid JfrSymbolId::mark(const Symbol* symbol, bool leakp) {
+  assert(symbol != NULL, "invariant");
+  return mark((uintptr_t)symbol->identity_hash(), symbol, leakp);
 }
 
-traceid JfrSymbolId::mark(const Symbol* symbol) {
-  assert(symbol != NULL, "invariant");
-  return mark(symbol, (uintptr_t)const_cast<Symbol*>(symbol)->identity_hash());
-}
+static unsigned int last_symbol_hash = 0;
+static traceid last_symbol_id = 0;
 
-traceid JfrSymbolId::mark(const Symbol* data, uintptr_t hash) {
+traceid JfrSymbolId::mark(uintptr_t hash, const Symbol* data, bool leakp) {
   assert(data != NULL, "invariant");
   assert(_sym_table != NULL, "invariant");
-  return _sym_table->id(data, hash);
+  if (hash == last_symbol_hash) {
+    assert(last_symbol_id != 0, "invariant");
+    return last_symbol_id;
+  }
+  const SymbolEntry& entry = _sym_table->lookup_put(hash, data);
+  if (_class_unload) {
+    entry.set_unloading();
+  }
+  if (leakp) {
+    entry.set_leakp();
+  }
+  last_symbol_hash = hash;
+  last_symbol_id = entry.id();
+  return last_symbol_id;
 }
 
-traceid JfrSymbolId::mark(const char* str, uintptr_t hash) {
+static unsigned int last_cstring_hash = 0;
+static traceid last_cstring_id = 0;
+
+traceid JfrSymbolId::mark(uintptr_t hash, const char* str, bool leakp) {
   assert(str != NULL, "invariant");
-  return _cstring_table->id(str, hash);
-}
-
-bool JfrSymbolId::is_unsafe_anonymous_klass(const Klass* k) {
-  assert(k != NULL, "invariant");
-  return k->is_instance_klass() && ((const InstanceKlass*)k)->is_unsafe_anonymous();
+  assert(_cstring_table != NULL, "invariant");
+  if (hash == last_cstring_hash) {
+    assert(last_cstring_id != 0, "invariant");
+    return last_cstring_id;
+  }
+  const CStringEntry& entry = _cstring_table->lookup_put(hash, str);
+  if (_class_unload) {
+    entry.set_unloading();
+  }
+  if (leakp) {
+    entry.set_leakp();
+  }
+  last_cstring_hash = hash;
+  last_cstring_id = entry.id();
+  return last_cstring_id;
 }
 
 /*
@@ -161,7 +183,7 @@
 * caller needs ResourceMark
 */
 
-uintptr_t JfrSymbolId::unsafe_anonymous_klass_name_hash_code(const InstanceKlass* ik) {
+uintptr_t JfrSymbolId::unsafe_anonymous_klass_name_hash(const InstanceKlass* ik) {
   assert(ik != NULL, "invariant");
   assert(ik->is_unsafe_anonymous(), "invariant");
   const oop mirror = ik->java_mirror_no_keepalive();
@@ -169,19 +191,18 @@
   return (uintptr_t)mirror->identity_hash();
 }
 
-const char* JfrSymbolId::create_unsafe_anonymous_klass_symbol(const InstanceKlass* ik, uintptr_t& hashcode) {
+static const char* create_unsafe_anonymous_klass_symbol(const InstanceKlass* ik, uintptr_t hash) {
   assert(ik != NULL, "invariant");
   assert(ik->is_unsafe_anonymous(), "invariant");
-  assert(0 == hashcode, "invariant");
+  assert(hash != 0, "invariant");
   char* anonymous_symbol = NULL;
   const oop mirror = ik->java_mirror_no_keepalive();
   assert(mirror != NULL, "invariant");
   char hash_buf[40];
-  hashcode = unsafe_anonymous_klass_name_hash_code(ik);
-  sprintf(hash_buf, "/" UINTX_FORMAT, hashcode);
+  sprintf(hash_buf, "/" UINTX_FORMAT, hash);
   const size_t hash_len = strlen(hash_buf);
   const size_t result_len = ik->name()->utf8_length();
-  anonymous_symbol = NEW_RESOURCE_ARRAY(char, result_len + hash_len + 1);
+  anonymous_symbol = JfrCHeapObj::new_array<char>(result_len + hash_len + 1);
   ik->name()->as_klass_external_name(anonymous_symbol, (int)result_len + 1);
   assert(strlen(anonymous_symbol) == result_len, "invariant");
   strcpy(anonymous_symbol + result_len, hash_buf);
@@ -189,70 +210,102 @@
   return anonymous_symbol;
 }
 
-uintptr_t JfrSymbolId::regular_klass_name_hash_code(const Klass* k) {
+bool JfrSymbolId::is_unsafe_anonymous_klass(const Klass* k) {
   assert(k != NULL, "invariant");
-  const Symbol* const sym = k->name();
-  assert(sym != NULL, "invariant");
-  return (uintptr_t)const_cast<Symbol*>(sym)->identity_hash();
+  return k->is_instance_klass() && ((const InstanceKlass*)k)->is_unsafe_anonymous();
+}
+
+static unsigned int last_anonymous_hash = 0;
+static traceid last_anonymous_id = 0;
+
+traceid JfrSymbolId::mark_unsafe_anonymous_klass_name(const InstanceKlass* ik, bool leakp) {
+  assert(ik != NULL, "invariant");
+  assert(ik->is_unsafe_anonymous(), "invariant");
+  const uintptr_t hash = unsafe_anonymous_klass_name_hash(ik);
+  if (hash == last_anonymous_hash) {
+    assert(last_anonymous_id != 0, "invariant");
+    return last_anonymous_id;
+  }
+  last_anonymous_hash = hash;
+  const CStringEntry* const entry = _cstring_table->lookup_only(hash);
+  last_anonymous_id = entry != NULL ? entry->id() : mark(hash, create_unsafe_anonymous_klass_symbol(ik, hash), leakp);
+  return last_anonymous_id;
+}
+
+traceid JfrSymbolId::mark(const Klass* k, bool leakp) {
+  assert(k != NULL, "invariant");
+  traceid symbol_id = 0;
+  if (is_unsafe_anonymous_klass(k)) {
+    assert(k->is_instance_klass(), "invariant");
+    symbol_id = mark_unsafe_anonymous_klass_name((const InstanceKlass*)k, leakp);
+  }
+  if (0 == symbol_id) {
+    Symbol* const sym = k->name();
+    if (sym != NULL) {
+      symbol_id = mark(sym, leakp);
+    }
+  }
+  assert(symbol_id > 0, "a symbol handler must mark the symbol for writing");
+  return symbol_id;
+}
+
+static void reset_symbol_caches() {
+  last_anonymous_hash = 0;
+  last_symbol_hash = 0;
+  last_cstring_hash = 0;
 }
 
 JfrArtifactSet::JfrArtifactSet(bool class_unload) : _symbol_id(new JfrSymbolId()),
-                                                    _klass_list(NULL),
-                                                    _class_unload(class_unload) {
+                                                     _klass_list(NULL),
+                                                     _total_count(0) {
   initialize(class_unload);
   assert(_klass_list != NULL, "invariant");
 }
 
 static const size_t initial_class_list_size = 200;
+
 void JfrArtifactSet::initialize(bool class_unload) {
   assert(_symbol_id != NULL, "invariant");
-  _symbol_id->initialize();
-  assert(!_symbol_id->has_entries(), "invariant");
-  _symbol_id->mark(BOOTSTRAP_LOADER_NAME, 0); // pre-load "bootstrap"
-  _class_unload = class_unload;
+  _symbol_id->set_class_unload(class_unload);
+  _total_count = 0;
   // resource allocation
   _klass_list = new GrowableArray<const Klass*>(initial_class_list_size, false, mtTracing);
 }
 
 JfrArtifactSet::~JfrArtifactSet() {
   clear();
+  delete _symbol_id;
 }
 
 void JfrArtifactSet::clear() {
+  reset_symbol_caches();
   _symbol_id->clear();
   // _klass_list will be cleared by a ResourceMark
 }
 
-traceid JfrArtifactSet::mark_unsafe_anonymous_klass_name(const Klass* klass) {
-  return _symbol_id->mark_unsafe_anonymous_klass_name(klass);
+traceid JfrArtifactSet::bootstrap_name(bool leakp) {
+  return _symbol_id->bootstrap_name(leakp);
 }
 
-traceid JfrArtifactSet::mark(const Symbol* sym, uintptr_t hash) {
-  return _symbol_id->mark(sym, hash);
-}
-
-traceid JfrArtifactSet::mark(const Klass* klass) {
-  return _symbol_id->mark(klass);
+traceid JfrArtifactSet::mark_unsafe_anonymous_klass_name(const Klass* klass, bool leakp) {
+  assert(klass->is_instance_klass(), "invariant");
+  return _symbol_id->mark_unsafe_anonymous_klass_name((const InstanceKlass*)klass, leakp);
 }
 
-traceid JfrArtifactSet::mark(const Symbol* symbol) {
-  return _symbol_id->mark(symbol);
-}
-
-traceid JfrArtifactSet::mark(const char* const str, uintptr_t hash) {
-  return _symbol_id->mark(str, hash);
+traceid JfrArtifactSet::mark(uintptr_t hash, const Symbol* sym, bool leakp) {
+  return _symbol_id->mark(hash, sym, leakp);
 }
 
-const JfrSymbolId::SymbolEntry* JfrArtifactSet::map_symbol(const Symbol* symbol) const {
-  return _symbol_id->map_symbol(symbol);
+traceid JfrArtifactSet::mark(const Klass* klass, bool leakp) {
+  return _symbol_id->mark(klass, leakp);
 }
 
-const JfrSymbolId::SymbolEntry* JfrArtifactSet::map_symbol(uintptr_t hash) const {
-  return _symbol_id->map_symbol(hash);
+traceid JfrArtifactSet::mark(const Symbol* symbol, bool leakp) {
+  return _symbol_id->mark(symbol, leakp);
 }
 
-const JfrSymbolId::CStringEntry* JfrArtifactSet::map_cstring(uintptr_t hash) const {
-  return _symbol_id->map_cstring(hash);
+traceid JfrArtifactSet::mark(uintptr_t hash, const char* const str, bool leakp) {
+  return _symbol_id->mark(hash, str, leakp);
 }
 
 bool JfrArtifactSet::has_klass_entries() const {
@@ -269,3 +322,7 @@
   assert(_klass_list->find(k) == -1, "invariant");
   _klass_list->append(k);
 }
+
+size_t JfrArtifactSet::total_count() const {
+  return _total_count;
+}
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSetUtils.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSetUtils.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -76,223 +76,203 @@
 };
 
 template <typename T>
-void tag_leakp_artifact(T const& value, bool class_unload) {
-  assert(value != NULL, "invariant");
-  if (class_unload) {
-    SET_LEAKP_USED_THIS_EPOCH(value);
-    assert(LEAKP_USED_THIS_EPOCH(value), "invariant");
-  } else {
-    SET_LEAKP_USED_PREV_EPOCH(value);
-    assert(LEAKP_USED_PREV_EPOCH(value), "invariant");
-  }
-}
-
-template <typename T>
-class LeakpClearArtifact {
-  bool _class_unload;
+class ClearArtifact {
  public:
-  LeakpClearArtifact(bool class_unload) : _class_unload(class_unload) {}
   bool operator()(T const& value) {
-    if (_class_unload) {
-      if (LEAKP_USED_THIS_EPOCH(value)) {
-        LEAKP_UNUSE_THIS_EPOCH(value);
-      }
-    } else {
-      if (LEAKP_USED_PREV_EPOCH(value)) {
-        LEAKP_UNUSE_PREV_EPOCH(value);
-      }
-    }
-    return true;
-  }
-};
-
-template <typename T>
-class ClearArtifact {
-  bool _class_unload;
- public:
-  ClearArtifact(bool class_unload) : _class_unload(class_unload) {}
-  bool operator()(T const& value) {
-    if (_class_unload) {
-      if (LEAKP_USED_THIS_EPOCH(value)) {
-        LEAKP_UNUSE_THIS_EPOCH(value);
-      }
-      if (USED_THIS_EPOCH(value)) {
-        UNUSE_THIS_EPOCH(value);
-      }
-      if (METHOD_USED_THIS_EPOCH(value)) {
-        UNUSE_METHOD_THIS_EPOCH(value);
-      }
-    } else {
-      if (LEAKP_USED_PREV_EPOCH(value)) {
-        LEAKP_UNUSE_PREV_EPOCH(value);
-      }
-      if (USED_PREV_EPOCH(value)) {
-        UNUSE_PREV_EPOCH(value);
-      }
-      if (METHOD_USED_PREV_EPOCH(value)) {
-        UNUSE_METHOD_PREV_EPOCH(value);
-      }
-    }
+    CLEAR_METHOD_AND_CLASS_PREV_EPOCH(value);
+    CLEAR_SERIALIZED(value);
+    assert(IS_NOT_SERIALIZED(value), "invariant");
     return true;
   }
 };
 
 template <>
 class ClearArtifact<const Method*> {
+ public:
+  bool operator()(const Method* method) {
+    assert(METHOD_FLAG_USED_PREV_EPOCH(method), "invariant");
+    CLEAR_METHOD_FLAG_USED_PREV_EPOCH(method);
+    CLEAR_METHOD_SERIALIZED(method);
+    assert(METHOD_NOT_SERIALIZED(method), "invariant");
+    return true;
+  }
+};
+
+template <typename T>
+class Stub {
+ public:
+  bool operator()(T const& value) { return true; }
+};
+
+template <typename T>
+class SerializePredicate {
+  bool _class_unload;
+ public:
+  SerializePredicate(bool class_unload) : _class_unload(class_unload) {}
+  bool operator()(T const& value) {
+    assert(value != NULL, "invariant");
+    return _class_unload ? true : IS_NOT_SERIALIZED(value);
+  }
+};
+
+template <>
+class SerializePredicate<const Method*> {
   bool _class_unload;
  public:
-  ClearArtifact(bool class_unload) : _class_unload(class_unload) {}
+  SerializePredicate(bool class_unload) : _class_unload(class_unload) {}
   bool operator()(const Method* method) {
+    assert(method != NULL, "invariant");
+    return _class_unload ? true : METHOD_NOT_SERIALIZED(method);
+  }
+};
+
+template <typename T, bool leakp>
+class SymbolPredicate {
+  bool _class_unload;
+ public:
+  SymbolPredicate(bool class_unload) : _class_unload(class_unload) {}
+  bool operator()(T const& value) {
+    assert(value != NULL, "invariant");
     if (_class_unload) {
-      if (METHOD_FLAG_USED_THIS_EPOCH(method)) {
-        CLEAR_METHOD_FLAG_USED_THIS_EPOCH(method);
-      }
-    } else {
-      if (METHOD_FLAG_USED_PREV_EPOCH(method)) {
-        CLEAR_METHOD_FLAG_USED_PREV_EPOCH(method);
-      }
+      return leakp ? value->is_leakp() : value->is_unloading();
+    }
+    return leakp ? value->is_leakp() : !value->is_serialized();
+  }
+};
+
+template <bool leakp>
+class MethodUsedPredicate {
+  bool _current_epoch;
+public:
+  MethodUsedPredicate(bool current_epoch) : _current_epoch(current_epoch) {}
+  bool operator()(const Klass* klass) {
+    if (_current_epoch) {
+      return leakp ? IS_LEAKP(klass) : METHOD_USED_THIS_EPOCH(klass);
     }
-    return true;
+    return  leakp ? IS_LEAKP(klass) : METHOD_USED_PREV_EPOCH(klass);
+  }
+};
+
+template <bool leakp>
+class MethodFlagPredicate {
+  bool _current_epoch;
+ public:
+  MethodFlagPredicate(bool current_epoch) : _current_epoch(current_epoch) {}
+  bool operator()(const Method* method) {
+    if (_current_epoch) {
+      return leakp ? IS_METHOD_LEAKP_USED(method) : METHOD_FLAG_USED_THIS_EPOCH(method);
+    }
+    return leakp ? IS_METHOD_LEAKP_USED(method) : METHOD_FLAG_USED_PREV_EPOCH(method);
   }
 };
 
 template <typename T>
 class LeakPredicate {
-  bool _class_unload;
  public:
-  LeakPredicate(bool class_unload) : _class_unload(class_unload) {}
+  LeakPredicate(bool class_unload) {}
   bool operator()(T const& value) {
-    return _class_unload ? LEAKP_USED_THIS_EPOCH(value) : LEAKP_USED_PREV_EPOCH(value);
+    return IS_LEAKP(value);
   }
 };
 
-template <typename T>
-class UsedPredicate {
-  bool _class_unload;
+template <>
+class LeakPredicate<const Method*> {
  public:
-  UsedPredicate(bool class_unload) : _class_unload(class_unload) {}
-  bool operator()(T const& value) {
-    return _class_unload ? USED_THIS_EPOCH(value) : USED_PREV_EPOCH(value);
+  LeakPredicate(bool class_unload) {}
+  bool operator()(const Method* method) {
+    assert(method != NULL, "invariant");
+    return IS_METHOD_LEAKP_USED(method);
   }
 };
 
-template <typename T, int compare(const T&, const T&)>
-class UniquePredicate {
- private:
-  GrowableArray<T> _seen;
+template <typename T, typename IdType>
+class ListEntry : public JfrHashtableEntry<T, IdType> {
  public:
-  UniquePredicate(bool) : _seen() {}
-  bool operator()(T const& value) {
-    bool not_unique;
-    _seen.template find_sorted<T, compare>(value, not_unique);
-    if (not_unique) {
-      return false;
-    }
-    _seen.template insert_sorted<compare>(value);
-    return true;
+  ListEntry(uintptr_t hash, const T& data) : JfrHashtableEntry<T, IdType>(hash, data),
+    _list_next(NULL), _serialized(false), _unloading(false), _leakp(false) {}
+  const ListEntry<T, IdType>* list_next() const { return _list_next; }
+  void reset() const {
+    _list_next = NULL; _serialized = false; _unloading = false; _leakp = false;
   }
-};
-
-class MethodFlagPredicate {
-  bool _class_unload;
- public:
-  MethodFlagPredicate(bool class_unload) : _class_unload(class_unload) {}
-  bool operator()(const Method* method) {
-    return _class_unload ? METHOD_FLAG_USED_THIS_EPOCH(method) : METHOD_FLAG_USED_PREV_EPOCH(method);
-  }
-};
-
-template <bool leakp>
-class MethodUsedPredicate {
-  bool _class_unload;
- public:
-  MethodUsedPredicate(bool class_unload) : _class_unload(class_unload) {}
-  bool operator()(const Klass* klass) {
-    assert(ANY_USED(klass), "invariant");
-    if (_class_unload) {
-      return leakp ? LEAKP_METHOD_USED_THIS_EPOCH(klass) : METHOD_USED_THIS_EPOCH(klass);
-    }
-    return leakp ? LEAKP_METHOD_USED_PREV_EPOCH(klass) : METHOD_USED_PREV_EPOCH(klass);
-  }
+  void set_list_next(const ListEntry<T, IdType>* next) const { _list_next = next; }
+  bool is_serialized() const { return _serialized; }
+  void set_serialized() const { _serialized = true; }
+  bool is_unloading() const { return _unloading; }
+  void set_unloading() const { _unloading = true; }
+  bool is_leakp() const { return _leakp; }
+  void set_leakp() const { _leakp = true; }
+ private:
+  mutable const ListEntry<T, IdType>* _list_next;
+  mutable bool _serialized;
+  mutable bool _unloading;
+  mutable bool _leakp;
 };
 
 class JfrSymbolId : public JfrCHeapObj {
   template <typename, typename, template<typename, typename> class, typename, size_t>
   friend class HashTableHost;
-  typedef HashTableHost<const Symbol*, traceid, Entry, JfrSymbolId> SymbolTable;
-  typedef HashTableHost<const char*, traceid, Entry, JfrSymbolId> CStringTable;
+  typedef HashTableHost<const Symbol*, traceid, ListEntry, JfrSymbolId> SymbolTable;
+  typedef HashTableHost<const char*, traceid, ListEntry, JfrSymbolId> CStringTable;
+  friend class JfrArtifactSet;
  public:
   typedef SymbolTable::HashEntry SymbolEntry;
   typedef CStringTable::HashEntry CStringEntry;
  private:
   SymbolTable* _sym_table;
   CStringTable* _cstring_table;
+  const SymbolEntry* _sym_list;
+  const CStringEntry* _cstring_list;
   traceid _symbol_id_counter;
+  bool _class_unload;
 
   // hashtable(s) callbacks
-  void assign_id(SymbolEntry* entry);
-  bool equals(const Symbol* query, uintptr_t hash, const SymbolEntry* entry);
-  void assign_id(CStringEntry* entry);
-  bool equals(const char* query, uintptr_t hash, const CStringEntry* entry);
+  void on_link(const SymbolEntry* entry);
+  bool on_equals(uintptr_t hash, const SymbolEntry* entry);
+  void on_unlink(const SymbolEntry* entry);
+  void on_link(const CStringEntry* entry);
+  bool on_equals(uintptr_t hash, const CStringEntry* entry);
+  void on_unlink(const CStringEntry* entry);
+
+  template <typename Functor, typename T>
+  void iterate(Functor& functor, const T* list) {
+    const T* symbol = list;
+    while (symbol != NULL) {
+      const T* next = symbol->list_next();
+      functor(symbol);
+      symbol = next;
+    }
+  }
+
+  traceid mark_unsafe_anonymous_klass_name(const InstanceKlass* k, bool leakp);
+  bool is_unsafe_anonymous_klass(const Klass* k);
+  uintptr_t unsafe_anonymous_klass_name_hash(const InstanceKlass* ik);
 
  public:
-  static bool is_unsafe_anonymous_klass(const Klass* k);
-  static const char* create_unsafe_anonymous_klass_symbol(const InstanceKlass* ik, uintptr_t& hashcode);
-  static uintptr_t unsafe_anonymous_klass_name_hash_code(const InstanceKlass* ik);
-  static uintptr_t regular_klass_name_hash_code(const Klass* k);
-
   JfrSymbolId();
   ~JfrSymbolId();
 
-  void initialize();
   void clear();
-
-  traceid mark_unsafe_anonymous_klass_name(const Klass* k);
-  traceid mark(const Symbol* sym, uintptr_t hash);
-  traceid mark(const Klass* k);
-  traceid mark(const Symbol* symbol);
-  traceid mark(const char* str, uintptr_t hash);
+  void set_class_unload(bool class_unload);
 
-  const SymbolEntry* map_symbol(const Symbol* symbol) const;
-  const SymbolEntry* map_symbol(uintptr_t hash) const;
-  const CStringEntry* map_cstring(uintptr_t hash) const;
+  traceid mark(uintptr_t hash, const Symbol* sym, bool leakp);
+  traceid mark(const Klass* k, bool leakp);
+  traceid mark(const Symbol* symbol, bool leakp);
+  traceid mark(uintptr_t hash, const char* str, bool leakp);
+  traceid bootstrap_name(bool leakp);
 
-  template <typename T>
-  void symbol(T& functor, const Klass* k) {
-    if (is_unsafe_anonymous_klass(k)) {
-      return;
-    }
-    functor(map_symbol(regular_klass_name_hash_code(k)));
+  template <typename Functor>
+  void iterate_symbols(Functor& functor) {
+    iterate(functor, _sym_list);
   }
 
-  template <typename T>
-  void symbol(T& functor, const Method* method) {
-    assert(method != NULL, "invariant");
-    functor(map_symbol((uintptr_t)method->name()->identity_hash()));
-    functor(map_symbol((uintptr_t)method->signature()->identity_hash()));
-  }
-
-  template <typename T>
-  void cstring(T& functor, const Klass* k) {
-    if (!is_unsafe_anonymous_klass(k)) {
-      return;
-    }
-    functor(map_cstring(unsafe_anonymous_klass_name_hash_code((const InstanceKlass*)k)));
-  }
-
-  template <typename T>
-  void iterate_symbols(T& functor) {
-    _sym_table->iterate_entry(functor);
-  }
-
-  template <typename T>
-  void iterate_cstrings(T& functor) {
-    _cstring_table->iterate_entry(functor);
+  template <typename Functor>
+  void iterate_cstrings(Functor& functor) {
+    iterate(functor, _cstring_list);
   }
 
   bool has_entries() const { return has_symbol_entries() || has_cstring_entries(); }
-  bool has_symbol_entries() const { return _sym_table->has_entries(); }
-  bool has_cstring_entries() const { return _cstring_table->has_entries(); }
+  bool has_symbol_entries() const { return _sym_list != NULL; }
+  bool has_cstring_entries() const { return _cstring_list != NULL; }
 };
 
 /**
@@ -313,7 +293,7 @@
  private:
   JfrSymbolId* _symbol_id;
   GrowableArray<const Klass*>* _klass_list;
-  bool _class_unload;
+  size_t _total_count;
 
  public:
   JfrArtifactSet(bool class_unload);
@@ -323,11 +303,13 @@
   void initialize(bool class_unload);
   void clear();
 
-  traceid mark(const Symbol* sym, uintptr_t hash);
-  traceid mark(const Klass* klass);
-  traceid mark(const Symbol* symbol);
-  traceid mark(const char* const str, uintptr_t hash);
-  traceid mark_unsafe_anonymous_klass_name(const Klass* klass);
+
+  traceid mark(uintptr_t hash, const Symbol* sym, bool leakp);
+  traceid mark(const Klass* klass, bool leakp);
+  traceid mark(const Symbol* symbol, bool leakp);
+  traceid mark(uintptr_t hash, const char* const str, bool leakp);
+  traceid mark_unsafe_anonymous_klass_name(const Klass* klass, bool leakp);
+  traceid bootstrap_name(bool leakp);
 
   const JfrSymbolId::SymbolEntry* map_symbol(const Symbol* symbol) const;
   const JfrSymbolId::SymbolEntry* map_symbol(uintptr_t hash) const;
@@ -335,6 +317,7 @@
 
   bool has_klass_entries() const;
   int entries() const;
+  size_t total_count() const;
   void register_klass(const Klass* k);
 
   template <typename Functor>
@@ -355,6 +338,12 @@
   void iterate_cstrings(T& functor) {
     _symbol_id->iterate_cstrings(functor);
   }
+
+  template <typename Writer>
+  void tally(Writer& writer) {
+    _total_count += writer.count();
+  }
+
 };
 
 class KlassArtifactRegistrator {
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSetWriter.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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_JFR_RECORDER_CHECKPOINT_TYPES_JFRTYPESETWRITER_HPP
-#define SHARE_JFR_RECORDER_CHECKPOINT_TYPES_JFRTYPESETWRITER_HPP
-
-#include "jfr/recorder/checkpoint/jfrCheckpointWriter.hpp"
-#include "jfr/utilities/jfrTypes.hpp"
-#include "memory/allocation.hpp"
-
-template <typename WriterImpl, u4 ID>
-class JfrArtifactWriterHost : public StackObj {
- private:
-  WriterImpl _impl;
-  JfrCheckpointWriter* _writer;
-  JfrCheckpointContext _ctx;
-  int64_t _count_offset;
-  int _count;
-  bool _skip_header;
- public:
-  JfrArtifactWriterHost(JfrCheckpointWriter* writer,
-                        JfrArtifactSet* artifacts,
-                        bool class_unload,
-                        bool skip_header = false) : _impl(writer, artifacts, class_unload),
-                                                    _writer(writer),
-                                                    _ctx(writer->context()),
-                                                    _count(0),
-                                                    _skip_header(skip_header) {
-    assert(_writer != NULL, "invariant");
-    if (!_skip_header) {
-      _writer->write_type((JfrTypeId)ID);
-      _count_offset = _writer->reserve(sizeof(u4)); // Don't know how many yet
-    }
-  }
-
-  ~JfrArtifactWriterHost() {
-    if (_count == 0) {
-      // nothing written, restore context for rewind
-      _writer->set_context(_ctx);
-      return;
-    }
-    assert(_count > 0, "invariant");
-    if (!_skip_header) {
-      _writer->write_count(_count, _count_offset);
-    }
-  }
-
-  bool operator()(typename WriterImpl::Type const & value) {
-    this->_count += _impl(value);
-    return true;
-  }
-
-  int count() const   { return _count; }
-  void add(int count) { _count += count; }
-};
-
-typedef int(*artifact_write_operation)(JfrCheckpointWriter*, JfrArtifactSet*, const void*);
-
-template <typename T, artifact_write_operation op>
-class JfrArtifactWriterImplHost {
- private:
-  JfrCheckpointWriter* _writer;
-  JfrArtifactSet* _artifacts;
-  bool _class_unload;
- public:
-  typedef T Type;
-  JfrArtifactWriterImplHost(JfrCheckpointWriter* writer, JfrArtifactSet* artifacts, bool class_unload) :
-    _writer(writer), _artifacts(artifacts), _class_unload(class_unload) {}
-  int operator()(T const& value) {
-    return op(this->_writer, this->_artifacts, value);
-  }
-};
-
-template <typename T, typename Predicate, artifact_write_operation op>
-class JfrPredicatedArtifactWriterImplHost : public JfrArtifactWriterImplHost<T, op> {
- private:
-  Predicate _predicate;
-  typedef JfrArtifactWriterImplHost<T, op> Parent;
- public:
-  JfrPredicatedArtifactWriterImplHost(JfrCheckpointWriter* writer, JfrArtifactSet* artifacts, bool class_unload) :
-    Parent(writer, artifacts, class_unload), _predicate(class_unload) {}
-  int operator()(T const& value) {
-    return _predicate(value) ? Parent::operator()(value) : 0;
-  }
-};
-
-#endif // SHARE_JFR_RECORDER_CHECKPOINT_TYPES_JFRTYPESETWRITER_HPP
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceId.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceId.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -159,7 +159,7 @@
   // This mechanism will retain the event specific flags
   // in the archive, allowing for event flag restoration
   // when renewing the traceid on klass revival.
-  k->set_trace_id(EVENT_FLAGS_MASK(k));
+  k->set_trace_id(EVENT_KLASS_MASK(k));
 }
 
 // used by CDS / APPCDS as part of "restore_unshareable_info"
@@ -181,12 +181,12 @@
   return get(java_lang_Class::as_Klass(my_oop));
 }
 
-traceid JfrTraceId::use(jclass jc, bool leakp /* false */) {
+traceid JfrTraceId::use(jclass jc) {
   assert(jc != NULL, "invariant");
   assert(((JavaThread*)Thread::current())->thread_state() == _thread_in_vm, "invariant");
   const oop my_oop = JNIHandles::resolve(jc);
   assert(my_oop != NULL, "invariant");
-  return use(java_lang_Class::as_Klass(my_oop), leakp);
+  return use(java_lang_Class::as_Klass(my_oop));
 }
 
 bool JfrTraceId::in_visible_set(const jclass jc) {
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceId.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceId.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -90,12 +90,16 @@
   static traceid get(const Thread* thread);
 
   // tag construct as used, returns pre-tagged traceid
-  static traceid use(const Klass* klass, bool leakp = false);
-  static traceid use(jclass jc, bool leakp = false);
-  static traceid use(const Method* method, bool leakp = false);
-  static traceid use(const ModuleEntry* module, bool leakp = false);
-  static traceid use(const PackageEntry* package, bool leakp = false);
-  static traceid use(const ClassLoaderData* cld, bool leakp = false);
+  static traceid use(const Klass* klass);
+  static traceid use(jclass jc);
+  static traceid use(const Method* method);
+  static traceid use(const Klass* klass, const Method* method);
+  static traceid use(const ModuleEntry* module);
+  static traceid use(const PackageEntry* package);
+  static traceid use(const ClassLoaderData* cld);
+
+  // leak profiler
+  static void set_leakp(const Method* method);
 
   static void remove(const Klass* klass);
   static void restore(const Klass* klass);
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceId.inline.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceId.inline.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -28,8 +28,11 @@
 #include "classfile/classLoaderData.hpp"
 #include "classfile/moduleEntry.hpp"
 #include "classfile/packageEntry.hpp"
+#include "jfr/recorder/checkpoint/types/traceid/jfrTraceId.hpp"
+#include "jfr/recorder/checkpoint/types/traceid/jfrTraceIdBits.inline.hpp"
+#include "jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.hpp"
 #include "jfr/recorder/checkpoint/types/traceid/jfrTraceIdMacros.hpp"
-#include "jfr/recorder/checkpoint/types/traceid/jfrTraceId.hpp"
+#include "jfr/support/jfrKlassExtension.hpp"
 #include "oops/arrayKlass.hpp"
 #include "oops/klass.hpp"
 #include "oops/instanceKlass.hpp"
@@ -38,21 +41,11 @@
 #include "utilities/debug.hpp"
 
 template <typename T>
-inline traceid set_used_and_get(const T* type, bool leakp) {
+inline traceid set_used_and_get(const T* type) {
   assert(type != NULL, "invariant");
-  if (leakp) {
-    SET_LEAKP_USED_THIS_EPOCH(type);
-    assert(LEAKP_USED_THIS_EPOCH(type), "invariant");
-  }
   SET_USED_THIS_EPOCH(type);
   assert(USED_THIS_EPOCH(type), "invariant");
-  return TRACE_ID_MASKED_PTR(type);
-}
-
-template <typename T>
-inline traceid set_used_and_get_shifted(const T* type, bool leakp) {
-  assert(type != NULL, "invariant");
-  return set_used_and_get(type, leakp) >> TRACE_ID_SHIFT;
+  return TRACE_ID(type);
 }
 
 inline traceid JfrTraceId::get(const Klass* klass) {
@@ -65,38 +58,49 @@
   return TRACE_ID_RAW(t->jfr_thread_local());
 }
 
-inline traceid JfrTraceId::use(const Klass* klass, bool leakp /* false */) {
+inline traceid JfrTraceId::use(const Klass* klass) {
   assert(klass != NULL, "invariant");
-  return set_used_and_get_shifted(klass, leakp);
+  return set_used_and_get(klass);
 }
 
-inline traceid JfrTraceId::use(const Method* method, bool leakp /* false */) {
+inline traceid JfrTraceId::use(const Method* method) {
+  assert(method != NULL, "invariant");
+  return use(method->method_holder(), method);
+}
+
+inline traceid JfrTraceId::use(const Klass* klass, const Method* method) {
+  assert(klass != NULL, "invariant");
   assert(method != NULL, "invariant");
   SET_METHOD_FLAG_USED_THIS_EPOCH(method);
-  const Klass* const klass = method->method_holder();
-  assert(klass != NULL, "invariant");
-  if (leakp) {
-    SET_LEAKP_USED_THIS_EPOCH(klass);
-    assert(LEAKP_USED_THIS_EPOCH(klass), "invariant");
-  }
+
   SET_METHOD_AND_CLASS_USED_THIS_EPOCH(klass);
   assert(METHOD_AND_CLASS_USED_THIS_EPOCH(klass), "invariant");
   return (METHOD_ID(klass, method));
 }
 
-inline traceid JfrTraceId::use(const ModuleEntry* module, bool leakp /* false */) {
+inline traceid JfrTraceId::use(const ModuleEntry* module) {
   assert(module != NULL, "invariant");
-  return set_used_and_get_shifted(module, leakp);
+  return set_used_and_get(module);
+}
+
+inline traceid JfrTraceId::use(const PackageEntry* package) {
+  assert(package != NULL, "invariant");
+  return set_used_and_get(package);
 }
 
-inline traceid JfrTraceId::use(const PackageEntry* package, bool leakp /* false */) {
-  assert(package != NULL, "invariant");
-  return set_used_and_get_shifted(package, leakp);
+inline traceid JfrTraceId::use(const ClassLoaderData* cld) {
+  assert(cld != NULL, "invariant");
+  return cld->is_unsafe_anonymous() ? 0 : set_used_and_get(cld);
 }
 
-inline traceid JfrTraceId::use(const ClassLoaderData* cld, bool leakp /* false */) {
-  assert(cld != NULL, "invariant");
-  return cld->is_unsafe_anonymous() ? 0 : set_used_and_get_shifted(cld, leakp);
+inline void JfrTraceId::set_leakp(const Method* method) {
+  assert(method != NULL, "invariant");
+  const Klass* const klass = method->method_holder();
+  assert(klass != NULL, "invariant");
+  assert(METHOD_AND_CLASS_USED_THIS_EPOCH(klass), "invariant");
+  assert(METHOD_FLAG_USED_THIS_EPOCH(method), "invariant");
+  SET_LEAKP(klass);
+  SET_METHOD_LEAKP(method);
 }
 
 inline bool JfrTraceId::in_visible_set(const Klass* klass) {
@@ -112,7 +116,7 @@
 
 inline void JfrTraceId::tag_as_jdk_jfr_event(const Klass* klass) {
   assert(klass != NULL, "invariant");
-  SET_TAG(klass, JDK_JFR_EVENT_KLASS);
+  SET_JDK_JFR_EVENT_KLASS(klass);
   assert(IS_JDK_JFR_EVENT_KLASS(klass), "invariant");
 }
 
@@ -124,7 +128,7 @@
 inline void JfrTraceId::tag_as_jdk_jfr_event_sub(const Klass* k) {
   assert(k != NULL, "invariant");
   if (IS_NOT_AN_EVENT_SUB_KLASS(k)) {
-    SET_TAG(k, JDK_JFR_EVENT_SUBKLASS);
+    SET_JDK_JFR_EVENT_SUBKLASS(k);
   }
   assert(IS_JDK_JFR_EVENT_SUBKLASS(k), "invariant");
 }
@@ -145,7 +149,7 @@
 
 inline void JfrTraceId::tag_as_event_host(const Klass* k) {
   assert(k != NULL, "invariant");
-  SET_TAG(k, EVENT_HOST_KLASS);
+  SET_EVENT_HOST_KLASS(k);
   assert(IS_EVENT_HOST_KLASS(k), "invariant");
 }
 
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdBits.inline.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdBits.inline.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -27,20 +27,22 @@
 
 #include "jfr/utilities/jfrTypes.hpp"
 #include "runtime/atomic.hpp"
+#include "runtime/orderAccess.hpp"
 #include "utilities/macros.hpp"
 
 #ifdef VM_LITTLE_ENDIAN
 static const int low_offset = 0;
-static const int leakp_offset = low_offset + 1;
+static const int meta_offset = low_offset + 1;
 #else
 static const int low_offset = 7;
-static const int leakp_offset = low_offset - 1;
+static const int meta_offset = low_offset - 1;
 #endif
 
 inline void set_bits(jbyte bits, jbyte* const dest) {
   assert(dest != NULL, "invariant");
   if (bits != (*dest & bits)) {
     *dest |= bits;
+    OrderAccess::storestore();
   }
 }
 
@@ -92,16 +94,28 @@
   set_mask(mask, ((jbyte*)dest) + low_offset);
 }
 
-inline void set_leakp_traceid_bits(jbyte bits, traceid* dest) {
-  set_bits(bits, ((jbyte*)dest) + leakp_offset);
+inline void set_meta_bits(jbyte bits, jbyte* const dest) {
+  assert(dest != NULL, "invariant");
+  *dest |= bits;
+}
+
+inline void set_traceid_meta_bits(jbyte bits, traceid* dest) {
+  set_meta_bits(bits, ((jbyte*)dest) + meta_offset);
 }
 
-inline void set_leakp_traceid_bits_cas(jbyte bits, traceid* dest) {
-  set_bits_cas(bits, ((jbyte*)dest) + leakp_offset);
+inline void set_meta_mask(jbyte mask, jbyte* const dest) {
+  assert(dest != NULL, "invariant");
+  *dest &= mask;
 }
 
-inline void set_leakp_traceid_mask(jbyte mask, traceid* dest) {
-  set_mask(mask, ((jbyte*)dest) + leakp_offset);
+inline void set_traceid_meta_mask(jbyte mask, traceid* dest) {
+  set_meta_mask(mask, ((jbyte*)dest) + meta_offset);
+}
+
+// only used by a single thread with no visibility requirements
+inline void clear_meta_bits(jbyte bits, jbyte* const dest) {
+  assert(dest != NULL, "invariant");
+  *dest ^= bits;
 }
 
 #endif // SHARE_JFR_RECORDER_CHECKPOINT_TYPES_TRACEID_JFRTRACEIDBITS_INLINE_HPP
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -32,12 +32,8 @@
 #define METHOD_USED_BIT (USED_BIT << 2)
 #define EPOCH_1_SHIFT 0
 #define EPOCH_2_SHIFT 1
-#define LEAKP_SHIFT 8
-
 #define USED_EPOCH_1_BIT (USED_BIT << EPOCH_1_SHIFT)
 #define USED_EPOCH_2_BIT (USED_BIT << EPOCH_2_SHIFT)
-#define LEAKP_USED_EPOCH_1_BIT (USED_EPOCH_1_BIT << LEAKP_SHIFT)
-#define LEAKP_USED_EPOCH_2_BIT (USED_EPOCH_2_BIT << LEAKP_SHIFT)
 #define METHOD_USED_EPOCH_1_BIT (METHOD_USED_BIT << EPOCH_1_SHIFT)
 #define METHOD_USED_EPOCH_2_BIT (METHOD_USED_BIT << EPOCH_2_SHIFT)
 #define METHOD_AND_CLASS_IN_USE_BITS (METHOD_USED_BIT | USED_BIT)
@@ -75,14 +71,6 @@
     return _epoch_state ? USED_EPOCH_1_BIT : USED_EPOCH_2_BIT;
   }
 
-  static traceid leakp_in_use_this_epoch_bit() {
-    return _epoch_state ? LEAKP_USED_EPOCH_2_BIT : LEAKP_USED_EPOCH_1_BIT;
-  }
-
-  static traceid leakp_in_use_prev_epoch_bit() {
-    return _epoch_state ? LEAKP_USED_EPOCH_1_BIT : LEAKP_USED_EPOCH_2_BIT;
-  }
-
   static traceid method_in_use_this_epoch_bit() {
     return _epoch_state ? METHOD_USED_EPOCH_2_BIT : METHOD_USED_EPOCH_1_BIT;
   }
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdMacros.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdMacros.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -25,163 +25,117 @@
 #ifndef SHARE_JFR_RECORDER_CHECKPOINT_TYPES_TRACEID_JFRTRACEIDMACROS_HPP
 #define SHARE_JFR_RECORDER_CHECKPOINT_TYPES_TRACEID_JFRTRACEIDMACROS_HPP
 
-#include "jfr/recorder/checkpoint/types/traceid/jfrTraceIdBits.inline.hpp"
-#include "jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.hpp"
-#include "jfr/support/jfrKlassExtension.hpp"
-#include "utilities/globalDefinitions.hpp"
-
 /**
  *
  * If a traceid is used, depending on epoch, either the first or the second bit is tagged.
  * If a class member (method) is used, either the third or fourth bit is tagged.
  * Which bit to set is a function of the epoch. This allows for concurrent tagging.
  *
- * LeakProfiler subsystem gets its own byte and uses the same tagging scheme but is shifted up 8.
- *
- * We also tag the individual method by using the TraceFlag field,
+ * We also tag individual methods by using the _trace_flags field,
  * (see jfr/support/jfrTraceIdExtension.hpp for details)
  *
  */
 
-// these are defined in jfr/support/jfrKlassExtension.hpp
+// the following are defined in jfr/support/jfrKlassExtension.hpp
 //
-// #define JDK_JFR_EVENT_SUBKLASS  16
-// #define JDK_JFR_EVENT_KLASS     32
-// #define EVENT_HOST_KLASS        64
-
-#define IS_JDK_JFR_EVENT_SUBKLASS(ptr) (((ptr)->trace_id() & (JDK_JFR_EVENT_SUBKLASS)) != 0)
+// #define JDK_JFR_EVENT_SUBKLASS                 16
+// #define JDK_JFR_EVENT_KLASS                    32
+// #define EVENT_HOST_KLASS                       64
 
-#define ANY_USED_BITS (USED_EPOCH_2_BIT         | \
-                       USED_EPOCH_1_BIT         | \
-                       METHOD_USED_EPOCH_2_BIT  | \
-                       METHOD_USED_EPOCH_1_BIT  | \
-                       LEAKP_USED_EPOCH_2_BIT   | \
-                       LEAKP_USED_EPOCH_1_BIT)
-
-#define TRACE_ID_META_BITS (EVENT_HOST_KLASS | JDK_JFR_EVENT_KLASS | JDK_JFR_EVENT_SUBKLASS | ANY_USED_BITS)
-
-#define ANY_EVENT                       (EVENT_HOST_KLASS | JDK_JFR_EVENT_KLASS | JDK_JFR_EVENT_SUBKLASS)
-#define IS_JDK_JFR_EVENT_KLASS(ptr)     (((ptr)->trace_id() & JDK_JFR_EVENT_KLASS) != 0)
-#define IS_EVENT_HOST_KLASS(ptr)        (((ptr)->trace_id() & EVENT_HOST_KLASS) != 0)
-#define IS_NOT_AN_EVENT_KLASS(ptr)      (!IS_EVENT_KLASS(ptr))
-#define IS_NOT_AN_EVENT_SUB_KLASS(ptr)  (!IS_JDK_JFR_EVENT_SUBKLASS(ptr))
-#define IS_NOT_JDK_JFR_EVENT_KLASS(ptr) (!IS_JDK_JFR_EVENT_KLASS(ptr))
-#define EVENT_FLAGS_MASK(ptr)           (((ptr)->trace_id() & ANY_EVENT) != 0)
-#define UNEVENT(ptr)                    ((ptr)->set_trace_id(((ptr)->trace_id()) & ~ANY_EVENT))
-
-#define TRACE_ID_SHIFT 16
+// static bits
+#define META_SHIFT                                8
+#define LEAKP_META_BIT                            USED_BIT
+#define LEAKP_BIT                                 (LEAKP_META_BIT << META_SHIFT)
+#define TRANSIENT_META_BIT                        (USED_BIT << 1)
+#define TRANSIENT_BIT                             (TRANSIENT_META_BIT << META_SHIFT)
+#define SERIALIZED_META_BIT                       (USED_BIT << 2)
+#define SERIALIZED_BIT                            (SERIALIZED_META_BIT << META_SHIFT)
+#define TRACE_ID_SHIFT                            16
+#define METHOD_ID_NUM_MASK                        ((1 << TRACE_ID_SHIFT) - 1)
+#define META_BITS                                 (SERIALIZED_BIT | TRANSIENT_BIT | LEAKP_BIT)
+#define EVENT_BITS                                (EVENT_HOST_KLASS | JDK_JFR_EVENT_KLASS | JDK_JFR_EVENT_SUBKLASS)
+#define USED_BITS                                 (METHOD_USED_EPOCH_2_BIT | METHOD_USED_EPOCH_1_BIT | USED_EPOCH_2_BIT | USED_EPOCH_1_BIT)
+#define ALL_BITS                                  (META_BITS | EVENT_BITS | USED_BITS)
+#define ALL_BITS_MASK                             (~(ALL_BITS))
 
-#define TRACE_ID_MASKED(id)             (id & ~TRACE_ID_META_BITS)
-#define TRACE_ID_VALUE(id)              (TRACE_ID_MASKED(id) >> TRACE_ID_SHIFT)
-#define TRACE_ID_MASKED_PTR(ptr)        (TRACE_ID_MASKED((ptr)->trace_id()))
-#define TRACE_ID_RAW(ptr)               ((ptr)->trace_id())
-#define TRACE_ID(ptr)                   (TRACE_ID_MASKED_PTR(ptr) >> TRACE_ID_SHIFT)
-#define METHOD_ID(kls, meth)            (TRACE_ID_MASKED_PTR(kls) | (meth)->method_idnum())
-#define SET_TAG(ptr, tag)               (set_traceid_bits(tag, (ptr)->trace_id_addr()))
-#define SET_LEAKP_TAG(ptr, tag)         (set_leakp_traceid_bits(tag, (ptr)->trace_id_addr()))
-#define SET_TAG_CAS(ptr, tag)           (set_traceid_bits_cas(tag, (ptr)->trace_id_addr()))
-#define SET_LEAKP_TAG_CAS(ptr, tag)     (set_leakp_traceid_bits_cas(tag, (ptr)->trace_id_addr()))
-
-#define IN_USE_THIS_EPOCH_BIT           (JfrTraceIdEpoch::in_use_this_epoch_bit())
-#define IN_USE_PREV_EPOCH_BIT           (JfrTraceIdEpoch::in_use_prev_epoch_bit())
-#define LEAKP_IN_USE_THIS_EPOCH_BIT     (JfrTraceIdEpoch::leakp_in_use_this_epoch_bit())
-#define LEAKP_IN_USE_PREV_EPOCH_BIT     (JfrTraceIdEpoch::leakp_in_use_prev_epoch_bit())
+// epoch relative bits
+#define IN_USE_THIS_EPOCH_BIT                     (JfrTraceIdEpoch::in_use_this_epoch_bit())
+#define IN_USE_PREV_EPOCH_BIT                     (JfrTraceIdEpoch::in_use_prev_epoch_bit())
+#define METHOD_IN_USE_THIS_EPOCH_BIT              (JfrTraceIdEpoch::method_in_use_this_epoch_bit())
+#define METHOD_IN_USE_PREV_EPOCH_BIT              (JfrTraceIdEpoch::method_in_use_prev_epoch_bit())
+#define METHOD_AND_CLASS_IN_USE_THIS_EPOCH_BITS   (JfrTraceIdEpoch::method_and_class_in_use_this_epoch_bits())
+#define METHOD_AND_CLASS_IN_USE_PREV_EPOCH_BITS   (JfrTraceIdEpoch::method_and_class_in_use_prev_epoch_bits())
+#define METHOD_FLAG_IN_USE_THIS_EPOCH_BIT         ((jbyte)IN_USE_THIS_EPOCH_BIT)
+#define METHOD_FLAG_IN_USE_PREV_EPOCH_BIT         ((jbyte)IN_USE_PREV_EPOCH_BIT)
 
-#define METHOD_IN_USE_THIS_EPOCH_BIT    (JfrTraceIdEpoch::method_in_use_this_epoch_bit())
-#define METHOD_IN_USE_PREV_EPOCH_BIT    (JfrTraceIdEpoch::method_in_use_prev_epoch_bit())
-#define METHOD_AND_CLASS_IN_USE_THIS_EPOCH_BITS (JfrTraceIdEpoch::method_and_class_in_use_this_epoch_bits())
-#define METHOD_AND_CLASS_IN_USE_PREV_EPOCH_BITS (JfrTraceIdEpoch::method_and_class_in_use_prev_epoch_bits())
-
-#define UNUSE_THIS_EPOCH_MASK           (~(IN_USE_THIS_EPOCH_BIT))
-#define UNUSE_PREV_EPOCH_MASK           (~(IN_USE_PREV_EPOCH_BIT))
-#define LEAKP_UNUSE_THIS_EPOCH_MASK     UNUSE_THIS_EPOCH_MASK
-#define LEAKP_UNUSE_PREV_EPOCH_MASK     UNUSE_PREV_EPOCH_MASK
-
-#define UNUSE_METHOD_THIS_EPOCH_MASK    (~(METHOD_IN_USE_THIS_EPOCH_BIT))
-#define UNUSE_METHOD_PREV_EPOCH_MASK    (~(METHOD_IN_USE_PREV_EPOCH_BIT))
-#define LEAKP_UNUSE_METHOD_THIS_EPOCH_MASK (~(UNUSE_METHOD_THIS_EPOCH_MASK))
-#define LEAKP_UNUSE_METHOD_PREV_EPOCH_MASK (~UNUSE_METHOD_PREV_EPOCH_MASK))
-
-#define UNUSE_METHOD_AND_CLASS_THIS_EPOCH_MASK (~(METHOD_IN_USE_THIS_EPOCH_BIT | IN_USE_THIS_EPOCH_BIT))
-#define UNUSE_METHOD_AND_CLASS_PREV_EPOCH_MASK (~(METHOD_IN_USE_PREV_EPOCH_BIT | IN_USE_PREV_EPOCH_BIT))
-
-#define SET_USED_THIS_EPOCH(ptr)        (SET_TAG(ptr, IN_USE_THIS_EPOCH_BIT))
-#define SET_USED_PREV_EPOCH(ptr)        (SET_TAG_CAS(ptr, IN_USE_PREV_EPOCH_BIT))
-#define SET_LEAKP_USED_THIS_EPOCH(ptr)  (SET_LEAKP_TAG(ptr, IN_USE_THIS_EPOCH_BIT))
-#define SET_LEAKP_USED_PREV_EPOCH(ptr)  (SET_LEAKP_TAG_CAS(ptr, IN_USE_PREV_EPOCH_BIT))
-#define SET_METHOD_AND_CLASS_USED_THIS_EPOCH(kls) (SET_TAG(kls, METHOD_AND_CLASS_IN_USE_THIS_EPOCH_BITS))
+// operators
+#define TRACE_ID_RAW(ptr)                         ((ptr)->trace_id())
+#define TRACE_ID(ptr)                             (TRACE_ID_RAW(ptr) >> TRACE_ID_SHIFT)
+#define TRACE_ID_MASKED(ptr)                      (TRACE_ID_RAW(ptr) & ALL_BITS_MASK)
+#define TRACE_ID_PREDICATE(ptr, bits)             ((TRACE_ID_RAW(ptr) & bits) != 0)
+#define TRACE_ID_TAG(ptr, bits)                   (set_traceid_bits(bits, (ptr)->trace_id_addr()))
+#define TRACE_ID_TAG_CAS(ptr, bits)               (set_traceid_bits_cas(bits, (ptr)->trace_id_addr()))
+#define TRACE_ID_CLEAR(ptr, bits)                 (set_traceid_mask(bits, (ptr)->trace_id_addr()))
+#define TRACE_ID_META_TAG(ptr, bits)              (set_traceid_meta_bits(bits, (ptr)->trace_id_addr()))
+#define TRACE_ID_META_CLEAR(ptr, bits)            (set_traceid_meta_mask(bits, (ptr)->trace_id_addr()))
+#define METHOD_ID(kls, method)                    (TRACE_ID_MASKED(kls) | (method)->orig_method_idnum())
+#define METHOD_FLAG_PREDICATE(method, bits)       ((method)->is_trace_flag_set(bits))
+#define METHOD_FLAG_TAG(method, bits)             (set_bits(bits, (method)->trace_flags_addr()))
+#define METHOD_META_TAG(method, bits)             (set_meta_bits(bits, (method)->trace_meta_addr()))
+#define METHOD_FLAG_CLEAR(method, bits)           (clear_bits_cas(bits, (method)->trace_flags_addr()))
+#define METHOD_META_CLEAR(method, bits)           (set_meta_mask(bits, (method)->trace_meta_addr()))
 
-#define USED_THIS_EPOCH(ptr)            (((ptr)->trace_id() & IN_USE_THIS_EPOCH_BIT) != 0)
-#define NOT_USED_THIS_EPOCH(ptr)        (!USED_THIS_EPOCH(ptr))
-#define USED_PREV_EPOCH(ptr)            (((ptr)->trace_id() & IN_USE_PREV_EPOCH_BIT) != 0)
-#define NOT_USED_PREV_EPOCH(ptr)        (!USED_PREV_EPOCH(ptr))
-#define USED_ANY_EPOCH(ptr)             (((ptr)->trace_id() & (USED_EPOCH_2_BIT | USED_EPOCH_1_BIT)) != 0)
-#define NOT_USED_ANY_EPOCH(ptr)         (!USED_ANY_EPOCH(ptr))
-
-#define LEAKP_USED_THIS_EPOCH(ptr)      (((ptr)->trace_id() & LEAKP_IN_USE_THIS_EPOCH_BIT) != 0)
-#define LEAKP_NOT_USED_THIS_EPOCH(ptr)  (!LEAKP_USED_THIS_EPOCH(ptr))
-#define LEAKP_USED_PREV_EPOCH(ptr)      (((ptr)->trace_id() & LEAKP_IN_USE_PREV_EPOCH_BIT) != 0)
-#define LEAKP_NOT_USED_PREV_EPOCH(ptr)  (!LEAKP_USED_PREV_EPOCH(ptr))
-#define LEAKP_USED_ANY_EPOCH(ptr)       (((ptr)->trace_id() & (LEAKP_USED_EPOCH_2_BIT | LEAKP_USED_EPOCH_1_BIT)) != 0)
-#define LEAKP_NOT_USED_ANY_EPOCH(ptr)   (!LEAKP_USED_ANY_EPOCH(ptr))
+// predicates
+#define USED_THIS_EPOCH(ptr)                      (TRACE_ID_PREDICATE(ptr, (TRANSIENT_BIT | IN_USE_THIS_EPOCH_BIT)))
+#define NOT_USED_THIS_EPOCH(ptr)                  (!(USED_THIS_EPOCH(ptr)))
+#define USED_PREV_EPOCH(ptr)                      (TRACE_ID_PREDICATE(ptr, (TRANSIENT_BIT | IN_USE_PREV_EPOCH_BIT)))
+#define USED_ANY_EPOCH(ptr)                       (TRACE_ID_PREDICATE(ptr, (TRANSIENT_BIT | USED_EPOCH_2_BIT | USED_EPOCH_1_BIT)))
+#define METHOD_USED_THIS_EPOCH(kls)               (TRACE_ID_PREDICATE(kls, (METHOD_IN_USE_THIS_EPOCH_BIT)))
+#define METHOD_NOT_USED_THIS_EPOCH(kls)           (!(METHOD_USED_THIS_EPOCH(kls)))
+#define METHOD_USED_PREV_EPOCH(kls)               (TRACE_ID_PREDICATE(kls, (METHOD_IN_USE_PREV_EPOCH_BIT)))
+#define METHOD_USED_ANY_EPOCH(kls)                (TRACE_ID_PREDICATE(kls, (METHOD_IN_USE_PREV_EPOCH_BIT | METHOD_IN_USE_THIS_EPOCH_BIT)))
+#define METHOD_AND_CLASS_USED_THIS_EPOCH(kls)     (TRACE_ID_PREDICATE(kls, (METHOD_AND_CLASS_IN_USE_THIS_EPOCH_BITS)))
+#define METHOD_AND_CLASS_USED_PREV_EPOCH(kls)     (TRACE_ID_PREDICATE(kls, (METHOD_AND_CLASS_IN_USE_PREV_EPOCH_BITS)))
+#define METHOD_AND_CLASS_USED_ANY_EPOCH(kls)      (METHOD_USED_ANY_EPOCH(kls) && USED_ANY_EPOCH(kls))
+#define METHOD_FLAG_USED_THIS_EPOCH(method)       (METHOD_FLAG_PREDICATE(method, (METHOD_FLAG_IN_USE_THIS_EPOCH_BIT)))
+#define METHOD_FLAG_NOT_USED_THIS_EPOCH(method)   (!(METHOD_FLAG_USED_THIS_EPOCH(method)))
+#define METHOD_FLAG_USED_PREV_EPOCH(method)       (METHOD_FLAG_PREDICATE(method, (METHOD_FLAG_IN_USE_PREV_EPOCH_BIT)))
 
-#define ANY_USED_THIS_EPOCH(ptr)        (((ptr)->trace_id() & (LEAKP_IN_USE_THIS_EPOCH_BIT | IN_USE_THIS_EPOCH_BIT)) != 0)
-#define ANY_NOT_USED_THIS_EPOCH(ptr)    (!ANY_USED_THIS_EPOCH(ptr))
-#define ANY_USED_PREV_EPOCH(ptr)        (((ptr)->trace_id() & (LEAKP_IN_USE_PREV_EPOCH_BIT | IN_USE_PREV_EPOCH_BIT)) != 0)
-#define ANY_NOT_USED_PREV_EPOCH(ptr)    (!ANY_USED_PREV_EPOCH(ptr))
-
-#define METHOD_USED_THIS_EPOCH(kls)     (((kls)->trace_id() & METHOD_IN_USE_THIS_EPOCH_BIT) != 0)
-#define METHOD_NOT_USED_THIS_EPOCH(kls) (!METHOD_USED_THIS_EPOCH(kls))
-#define METHOD_USED_PREV_EPOCH(kls)     (((kls)->trace_id() & METHOD_IN_USE_PREV_EPOCH_BIT) != 0)
-#define METHOD_NOT_USED_PREV_EPOCH(kls) (!METHOD_USED_PREV_EPOCH(kls))
-#define METHOD_USED_ANY_EPOCH(kls)      (((kls)->trace_id() & (METHOD_IN_USE_PREV_EPOCH_BIT | METHOD_IN_USE_THIS_EPOCH_BIT)) != 0)
-
-#define METHOD_NOT_USED_ANY_EPOCH(kls)  (!METHOD_USED_ANY_EPOCH(kls))
-
-#define METHOD_AND_CLASS_USED_THIS_EPOCH(kls) ((((kls)->trace_id() & METHOD_AND_CLASS_IN_USE_THIS_EPOCH_BITS) == \
-                                                                     METHOD_AND_CLASS_IN_USE_THIS_EPOCH_BITS) != 0)
-
-#define METHOD_AND_CLASS_USED_PREV_EPOCH(kls) ((((kls)->trace_id() & METHOD_AND_CLASS_IN_USE_PREV_EPOCH_BITS) == \
-                                                                     METHOD_AND_CLASS_IN_USE_PREV_EPOCH_BITS) != 0)
-
-#define METHOD_AND_CLASS_USED_ANY_EPOCH(kls)     ((METHOD_USED_ANY_EPOCH(kls) && USED_ANY_EPOCH(kls)) != 0)
-#define METHOD_AND_CLASS_NOT_USED_ANY_EPOCH(kls) (!METHOD_AND_CLASS_USED_ANY_EPOCH(kls))
+// setters
+#define SET_USED_THIS_EPOCH(ptr)                  (TRACE_ID_TAG(ptr, IN_USE_THIS_EPOCH_BIT))
+#define SET_METHOD_AND_CLASS_USED_THIS_EPOCH(kls) (TRACE_ID_TAG(kls, METHOD_AND_CLASS_IN_USE_THIS_EPOCH_BITS))
+#define SET_METHOD_FLAG_USED_THIS_EPOCH(method)   (METHOD_FLAG_TAG(method, METHOD_FLAG_IN_USE_THIS_EPOCH_BIT))
+#define CLEAR_METHOD_AND_CLASS_PREV_EPOCH_MASK    (~(METHOD_IN_USE_PREV_EPOCH_BIT | IN_USE_PREV_EPOCH_BIT))
+#define CLEAR_METHOD_AND_CLASS_PREV_EPOCH(kls)    (TRACE_ID_CLEAR(kls, CLEAR_METHOD_AND_CLASS_PREV_EPOCH_MASK))
+#define CLEAR_METHOD_FLAG_USED_PREV_EPOCH(method) (METHOD_FLAG_CLEAR(method, METHOD_FLAG_IN_USE_PREV_EPOCH_BIT))
 
-#define LEAKP_METHOD_IN_USE_THIS_EPOCH  (LEAKP_IN_USE_THIS_EPOCH_BIT | METHOD_IN_USE_THIS_EPOCH_BIT)
-#define LEAKP_METHOD_IN_USE_PREV_EPOCH  (LEAKP_IN_USE_PREV_EPOCH_BIT | METHOD_IN_USE_PREV_EPOCH_BIT)
-#define LEAKP_METHOD_USED_THIS_EPOCH(ptr)  ((((ptr)->trace_id() & LEAKP_METHOD_IN_USE_THIS_EPOCH) == \
-                                                                  LEAKP_METHOD_IN_USE_THIS_EPOCH) != 0)
-#define LEAKP_METHOD_NOT_USED_THIS_EPOCH(kls) (!LEAKP_METHOD_USED_THIS_EPOCH(kls))
-#define LEAKP_METHOD_USED_PREV_EPOCH(ptr)  ((((ptr)->trace_id() & LEAKP_METHOD_IN_USE_PREV_EPOCH) == \
-                                                                  LEAKP_METHOD_IN_USE_PREV_EPOCH) != 0)
-#define LEAKP_METHOD_NOT_USED_PREV_EPOCH(kls) (!LEAKP_METHOD_USED_PREV_EPOCH(kls))
-
-#define UNUSE_THIS_EPOCH(ptr)           (set_traceid_mask(UNUSE_THIS_EPOCH_MASK, (ptr)->trace_id_addr()))
-#define UNUSE_PREV_EPOCH(ptr)           (set_traceid_mask(UNUSE_PREV_EPOCH_MASK, (ptr)->trace_id_addr()))
-#define UNUSE_METHOD_THIS_EPOCH(kls)    (set_traceid_mask(UNUSE_METHOD_THIS_EPOCH_MASK, (kls)->trace_id_addr()))
-#define UNUSE_METHOD_PREV_EPOCH(kls)    (set_traceid_mask(UNUSE_METHOD_PREV_EPOCH_MASK, (kls)->trace_id_addr()))
+// types
+#define IS_JDK_JFR_EVENT_KLASS(kls)               (TRACE_ID_PREDICATE(kls, JDK_JFR_EVENT_KLASS))
+#define IS_JDK_JFR_EVENT_SUBKLASS(kls)            (TRACE_ID_PREDICATE(kls, JDK_JFR_EVENT_SUBKLASS))
+#define IS_NOT_AN_EVENT_SUB_KLASS(kls)            (!(IS_JDK_JFR_EVENT_SUBKLASS(kls)))
+#define IS_EVENT_HOST_KLASS(kls)                  (TRACE_ID_PREDICATE(kls, EVENT_HOST_KLASS))
+#define SET_JDK_JFR_EVENT_KLASS(kls)              (TRACE_ID_TAG(kls, JDK_JFR_EVENT_KLASS))
+#define SET_JDK_JFR_EVENT_SUBKLASS(kls)           (TRACE_ID_TAG(kls, JDK_JFR_EVENT_SUBKLASS))
+#define SET_EVENT_HOST_KLASS(kls)                 (TRACE_ID_TAG(kls, EVENT_HOST_KLASS))
+#define EVENT_KLASS_MASK(kls)                     (TRACE_ID_RAW(kls) & EVENT_BITS)
 
-#define LEAKP_UNUSE_THIS_EPOCH(ptr)     (set_leakp_traceid_mask(UNUSE_THIS_EPOCH_MASK, (ptr)->trace_id_addr()))
-#define LEAKP_UNUSE_PREV_EPOCH(ptr)     (set_leakp_traceid_mask(UNUSE_PREV_EPOCH_MASK, (ptr)->trace_id_addr()))
-#define LEAKP_UNUSE_METHOD_THIS_EPOCH(kls) (set_leakp_traceid_mask(UNUSE_METHOD_THIS_EPOCH_MASK, (kls)->trace_id_addr()))
-#define LEAKP_UNUSE_METHOD_PREV_EPOCH(kls) (set_leakp_traceid_mask(UNUSE_METHOD_PREV_EPOCH_MASK, (kls)->trace_id_addr()))
-
-#define ANY_USED(ptr)                   (((ptr)->trace_id() & ANY_USED_BITS) != 0)
-#define ANY_NOT_USED(ptr)               (!ANY_USED(ptr))
-
-#define UNUSE_METHOD_AND_CLASS_THIS_EPOCH(kls) (set_traceid_mask(UNUSE_METHOD_AND_CLASS_THIS_EPOCH_MASK, (kls)->trace_id_addr()))
-#define LEAKP_UNUSE_METHOD_AND_CLASS_THIS_EPOCH(kls) (set_leakp_traceid_mask(UNUSE_METHOD_AND_CLASS_THIS_EPOCH_MASK, (kls)->trace_id_addr()))
-#define UNUSE_METHOD_AND_CLASS_PREV_EPOCH(kls) (set_traceid_mask(UNUSE_METHOD_AND_CLASS_PREV_EPOCH_MASK, (kls)->trace_id_addr()))
-#define LEAKP_UNUSE_METHODS_AND_CLASS_PREV_EPOCH(kls) (set_leakp_traceid_mask(UNUSE_METHOD_AND_CLASS_PREV_EPOCH_MASK, (kls)->trace_id_addr()))
-
-#define METHOD_FLAG_USED_THIS_EPOCH(m)       ((m)->is_trace_flag_set((jbyte)JfrTraceIdEpoch::in_use_this_epoch_bit()))
-#define METHOD_FLAG_NOT_USED_THIS_EPOCH(m)   (!METHOD_FLAG_USED_THIS_EPOCH(m))
-#define SET_METHOD_FLAG_USED_THIS_EPOCH(m)   ((m)->set_trace_flag((jbyte)JfrTraceIdEpoch::in_use_this_epoch_bit()))
-#define METHOD_FLAG_USED_PREV_EPOCH(m)       ((m)->is_trace_flag_set((jbyte)JfrTraceIdEpoch::in_use_prev_epoch_bit()))
-#define METHOD_FLAG_NOT_USED_PREV_EPOCH(m)   (!METHOD_FLAG_USED_PREV_EPOCH(m))
-#define METHOD_FLAG_USED_ANY_EPOCH(m)        ((METHOD_FLAG_USED_THIS_EPOCH(m) || METHOD_FLAG_USED_PREV_EPOCH(m)) != 0)
-#define METHOD_FLAG_NOT_USED_ANY_EPOCH(m)    ((METHOD_FLAG_NOT_USED_THIS_EPOCH(m) && METHOD_FLAG_NOT_USED_PREV_EPOCH(m)) != 0)
-#define CLEAR_METHOD_FLAG_USED_THIS_EPOCH(m) (clear_bits_cas((jbyte)JfrTraceIdEpoch::in_use_this_epoch_bit(), (m)->trace_flags_addr()))
-#define CLEAR_METHOD_FLAG_USED_PREV_EPOCH(m) (clear_bits_cas((jbyte)JfrTraceIdEpoch::in_use_prev_epoch_bit(), (m)->trace_flags_addr()))
+// meta
+#define META_MASK                                 (~(SERIALIZED_META_BIT | TRANSIENT_META_BIT | LEAKP_META_BIT))
+#define SET_LEAKP(ptr)                            (TRACE_ID_META_TAG(ptr, LEAKP_META_BIT))
+#define IS_LEAKP(ptr)                             (TRACE_ID_PREDICATE(ptr, LEAKP_BIT))
+#define SET_TRANSIENT(ptr)                        (TRACE_ID_META_TAG(ptr, TRANSIENT_META_BIT))
+#define IS_SERIALIZED(ptr)                        (TRACE_ID_PREDICATE(ptr, SERIALIZED_BIT))
+#define IS_NOT_SERIALIZED(ptr)                    (!(IS_SERIALIZED(ptr)))
+#define SHOULD_TAG(ptr)                           (NOT_USED_THIS_EPOCH(ptr))
+#define SHOULD_TAG_KLASS_METHOD(ptr)              (METHOD_NOT_USED_THIS_EPOCH(ptr))
+#define SET_SERIALIZED(ptr)                       (TRACE_ID_META_TAG(ptr, SERIALIZED_META_BIT))
+#define CLEAR_SERIALIZED(ptr)                     (TRACE_ID_META_CLEAR(ptr, META_MASK))
+#define IS_METHOD_SERIALIZED(method)              (METHOD_FLAG_PREDICATE(method, SERIALIZED_BIT))
+#define IS_METHOD_LEAKP_USED(method)              (METHOD_FLAG_PREDICATE(method, LEAKP_BIT))
+#define METHOD_NOT_SERIALIZED(method)             (!(IS_METHOD_SERIALIZED(method)))
+#define SET_METHOD_LEAKP(method)                  (METHOD_META_TAG(method, LEAKP_META_BIT))
+#define SET_METHOD_SERIALIZED(method)             (METHOD_META_TAG(method, SERIALIZED_META_BIT))
+#define CLEAR_METHOD_SERIALIZED(method)           (METHOD_META_CLEAR(method, META_MASK))
+#define CLEAR_LEAKP(ptr)                          (TRACE_ID_META_CLEAR(ptr, (~(LEAKP_META_BIT))))
 
 #endif // SHARE_JFR_RECORDER_CHECKPOINT_TYPES_TRACEID_JFRTRACEIDMACROS_HPP
--- a/src/hotspot/share/jfr/recorder/repository/jfrChunkState.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/recorder/repository/jfrChunkState.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -39,7 +39,7 @@
   _start_nanos(0),
   _previous_start_ticks(0),
   _previous_start_nanos(0),
-  _previous_checkpoint_offset(0) {}
+  _last_checkpoint_offset(0) {}
 
 JfrChunkState::~JfrChunkState() {
   reset();
@@ -50,15 +50,15 @@
     JfrCHeapObj::free(_path, strlen(_path) + 1);
     _path = NULL;
   }
-  set_previous_checkpoint_offset(0);
+  set_last_checkpoint_offset(0);
 }
 
-void JfrChunkState::set_previous_checkpoint_offset(int64_t offset) {
-  _previous_checkpoint_offset = offset;
+void JfrChunkState::set_last_checkpoint_offset(int64_t offset) {
+  _last_checkpoint_offset = offset;
 }
 
-int64_t JfrChunkState::previous_checkpoint_offset() const {
-  return _previous_checkpoint_offset;
+int64_t JfrChunkState::last_checkpoint_offset() const {
+  return _last_checkpoint_offset;
 }
 
 int64_t JfrChunkState::previous_start_ticks() const {
--- a/src/hotspot/share/jfr/recorder/repository/jfrChunkState.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/recorder/repository/jfrChunkState.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -36,7 +36,7 @@
   int64_t _start_nanos;
   int64_t _previous_start_ticks;
   int64_t _previous_start_nanos;
-  int64_t _previous_checkpoint_offset;
+  int64_t _last_checkpoint_offset;
 
   void update_start_ticks();
   void update_start_nanos();
@@ -46,8 +46,8 @@
   JfrChunkState();
   ~JfrChunkState();
   void reset();
-  int64_t previous_checkpoint_offset() const;
-  void set_previous_checkpoint_offset(int64_t offset);
+  int64_t last_checkpoint_offset() const;
+  void set_last_checkpoint_offset(int64_t offset);
   int64_t previous_start_ticks() const;
   int64_t previous_start_nanos() const;
   int64_t last_chunk_duration() const;
--- a/src/hotspot/share/jfr/recorder/repository/jfrChunkWriter.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/recorder/repository/jfrChunkWriter.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -86,7 +86,7 @@
   // Chunk size
   this->write_be_at_offset(size_written(), CHUNK_SIZE_OFFSET);
   // initial checkpoint event offset
-  this->write_be_at_offset(_chunkstate->previous_checkpoint_offset(), CHUNK_SIZE_OFFSET + (1 * FILEHEADER_SLOT_SIZE));
+  this->write_be_at_offset(_chunkstate->last_checkpoint_offset(), CHUNK_SIZE_OFFSET + (1 * FILEHEADER_SLOT_SIZE));
   // metadata event offset
   this->write_be_at_offset(metadata_offset, CHUNK_SIZE_OFFSET + (2 * FILEHEADER_SLOT_SIZE));
   // start of chunk in nanos since epoch
@@ -105,12 +105,12 @@
   return this->is_valid() ? this->current_offset() : 0;
 }
 
-int64_t JfrChunkWriter::previous_checkpoint_offset() const {
-  return _chunkstate->previous_checkpoint_offset();
+int64_t JfrChunkWriter::last_checkpoint_offset() const {
+  return _chunkstate->last_checkpoint_offset();
 }
 
-void JfrChunkWriter::set_previous_checkpoint_offset(int64_t offset) {
-  _chunkstate->set_previous_checkpoint_offset(offset);
+void JfrChunkWriter::set_last_checkpoint_offset(int64_t offset) {
+  _chunkstate->set_last_checkpoint_offset(offset);
 }
 
 void JfrChunkWriter::time_stamp_chunk_now() {
--- a/src/hotspot/share/jfr/recorder/repository/jfrChunkWriter.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/recorder/repository/jfrChunkWriter.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -49,8 +49,8 @@
   JfrChunkWriter();
   bool initialize();
   int64_t size_written() const;
-  int64_t previous_checkpoint_offset() const;
-  void set_previous_checkpoint_offset(int64_t offset);
+  int64_t last_checkpoint_offset() const;
+  void set_last_checkpoint_offset(int64_t offset);
   void time_stamp_chunk_now();
 };
 
--- a/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -133,13 +133,13 @@
 };
 
 static int64_t write_checkpoint_event_prologue(JfrChunkWriter& cw, u8 type_id) {
-  const int64_t prev_cp_offset = cw.previous_checkpoint_offset();
-  const int64_t prev_cp_relative_offset = 0 == prev_cp_offset ? 0 : prev_cp_offset - cw.current_offset();
+  const int64_t last_cp_offset = cw.last_checkpoint_offset();
+  const int64_t delta_to_last_checkpoint = 0 == last_cp_offset ? 0 : last_cp_offset - cw.current_offset();
   cw.reserve(sizeof(u4));
   cw.write<u8>(EVENT_CHECKPOINT);
   cw.write(JfrTicks::now());
-  cw.write((int64_t)0);
-  cw.write(prev_cp_relative_offset); // write previous checkpoint offset delta
+  cw.write((int64_t)0); // duration
+  cw.write(delta_to_last_checkpoint);
   cw.write<bool>(false); // flushpoint
   cw.write((u4)1); // nof types in this checkpoint
   cw.write(type_id);
@@ -178,7 +178,7 @@
     _cw.write_padded_at_offset<u4>(number_of_elements, num_elements_offset);
     _cw.write_padded_at_offset<u4>((u4)_cw.current_offset() - current_cp_offset, current_cp_offset);
     // update writer with last checkpoint position
-    _cw.set_previous_checkpoint_offset(current_cp_offset);
+    _cw.set_last_checkpoint_offset(current_cp_offset);
     return true;
   }
 };
@@ -317,19 +317,16 @@
     vm_error = true;
     prepare_for_vm_error_rotation();
   }
+  if (!_storage.control().to_disk()) {
+    in_memory_rotation();
+  } else if (vm_error) {
+    vm_error_rotation();
+  } else {
+    chunk_rotation();
+  }
   if (msgs & (MSGBIT(MSG_STOP))) {
     stop();
   }
-  // action determined by chunkwriter state
-  if (!_chunkwriter.is_valid()) {
-    in_memory_rotation();
-    return;
-  }
-  if (vm_error) {
-    vm_error_rotation();
-    return;
-  }
-  chunk_rotation();
 }
 
 void JfrRecorderService::prepare_for_vm_error_rotation() {
@@ -400,12 +397,6 @@
   WriteStackTraceCheckpoint write_stack_trace_checkpoint(chunkwriter, TYPE_STACKTRACE, write_stacktrace_repo);
   write_stack_trace_checkpoint.process();
 }
-
-static void write_object_sample_stacktrace(ObjectSampler* sampler, JfrStackTraceRepository& stack_trace_repository) {
-  WriteObjectSampleStacktrace object_sample_stacktrace(sampler, stack_trace_repository);
-  object_sample_stacktrace.process();
-}
-
 static void write_stringpool_checkpoint(JfrStringPool& string_pool, JfrChunkWriter& chunkwriter) {
   WriteStringPool write_string_pool(string_pool);
   WriteStringPoolCheckpoint write_string_pool_checkpoint(chunkwriter, TYPE_STRING, write_string_pool);
@@ -440,9 +431,7 @@
   if (LeakProfiler::is_running()) {
     // Exclusive access to the object sampler instance.
     // The sampler is released (unlocked) later in post_safepoint_write.
-    ObjectSampler* const sampler = ObjectSampler::acquire();
-    assert(sampler != NULL, "invariant");
-    write_object_sample_stacktrace(sampler, _stack_trace_repository);
+    ObjectSampleCheckpoint::on_rotation(ObjectSampler::acquire(), _stack_trace_repository);
   }
   _storage.write();
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTrace.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,263 @@
+/*
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 "jfr/recorder/checkpoint/jfrCheckpointWriter.hpp"
+#include "jfr/recorder/checkpoint/types/traceid/jfrTraceId.inline.hpp"
+#include "jfr/recorder/repository/jfrChunkWriter.hpp"
+#include "jfr/recorder/stacktrace/jfrStackTrace.hpp"
+#include "memory/allocation.inline.hpp"
+#include "runtime/vframe.inline.hpp"
+
+static void copy_frames(JfrStackFrame** lhs_frames, u4 length, const JfrStackFrame* rhs_frames) {
+  assert(lhs_frames != NULL, "invariant");
+  assert(rhs_frames != NULL, "invariant");
+  if (length > 0) {
+    *lhs_frames = NEW_C_HEAP_ARRAY(JfrStackFrame, length, mtTracing);
+    memcpy(*lhs_frames, rhs_frames, length * sizeof(JfrStackFrame));
+  }
+}
+
+JfrStackFrame::JfrStackFrame(const traceid& id, int bci, int type, const Method* method) :
+  _method(method), _methodid(id), _line(0), _bci(bci), _type(type) {}
+
+JfrStackFrame::JfrStackFrame(const traceid& id, int bci, int type, int lineno) :
+  _method(NULL), _methodid(id), _line(lineno), _bci(bci), _type(type) {}
+
+JfrStackTrace::JfrStackTrace(JfrStackFrame* frames, u4 max_frames) :
+  _next(NULL),
+  _frames(frames),
+  _id(0),
+  _hash(0),
+  _nr_of_frames(0),
+  _max_frames(max_frames),
+  _frames_ownership(false),
+  _reached_root(false),
+  _lineno(false),
+  _written(false) {}
+
+JfrStackTrace::JfrStackTrace(traceid id, const JfrStackTrace& trace, const JfrStackTrace* next) :
+  _next(next),
+  _frames(NULL),
+  _id(id),
+  _hash(trace._hash),
+  _nr_of_frames(trace._nr_of_frames),
+  _max_frames(trace._max_frames),
+  _frames_ownership(true),
+  _reached_root(trace._reached_root),
+  _lineno(trace._lineno),
+  _written(false) {
+  copy_frames(&_frames, trace._nr_of_frames, trace._frames);
+}
+
+JfrStackTrace::~JfrStackTrace() {
+  if (_frames_ownership) {
+    FREE_C_HEAP_ARRAY(JfrStackFrame, _frames);
+  }
+}
+
+template <typename Writer>
+static void write_stacktrace(Writer& w, traceid id, bool reached_root, u4 nr_of_frames, const JfrStackFrame* frames) {
+  w.write((u8)id);
+  w.write((u1)!reached_root);
+  w.write(nr_of_frames);
+  for (u4 i = 0; i < nr_of_frames; ++i) {
+    frames[i].write(w);
+  }
+}
+
+void JfrStackTrace::write(JfrChunkWriter& sw) const {
+  assert(!_written, "invariant");
+  write_stacktrace(sw, _id, _reached_root, _nr_of_frames, _frames);
+  _written = true;
+}
+
+void JfrStackTrace::write(JfrCheckpointWriter& cpw) const {
+  write_stacktrace(cpw, _id, _reached_root, _nr_of_frames, _frames);
+}
+
+bool JfrStackFrame::equals(const JfrStackFrame& rhs) const {
+  return _methodid == rhs._methodid && _bci == rhs._bci && _type == rhs._type;
+}
+
+bool JfrStackTrace::equals(const JfrStackTrace& rhs) const {
+  if (_reached_root != rhs._reached_root || _nr_of_frames != rhs._nr_of_frames || _hash != rhs._hash) {
+    return false;
+  }
+  for (u4 i = 0; i < _nr_of_frames; ++i) {
+    if (!_frames[i].equals(rhs._frames[i])) {
+      return false;
+    }
+  }
+  return true;
+}
+
+template <typename Writer>
+static void write_frame(Writer& w, traceid methodid, int line, int bci, u1 type) {
+  w.write((u8)methodid);
+  w.write((u4)line);
+  w.write((u4)bci);
+  w.write((u8)type);
+}
+
+void JfrStackFrame::write(JfrChunkWriter& cw) const {
+  write_frame(cw, _methodid, _line, _bci, _type);
+}
+
+void JfrStackFrame::write(JfrCheckpointWriter& cpw) const {
+  write_frame(cpw, _methodid, _line, _bci, _type);
+}
+
+class vframeStreamSamples : public vframeStreamCommon {
+ public:
+  // constructor that starts with sender of frame fr (top_frame)
+  vframeStreamSamples(JavaThread *jt, frame fr, bool stop_at_java_call_stub) : vframeStreamCommon(jt) {
+    _stop_at_java_call_stub = stop_at_java_call_stub;
+    _frame = fr;
+
+    // We must always have a valid frame to start filling
+    bool filled_in = fill_from_frame();
+    assert(filled_in, "invariant");
+  }
+  void samples_next();
+  void stop() {}
+};
+
+// Solaris SPARC Compiler1 needs an additional check on the grandparent
+// of the top_frame when the parent of the top_frame is interpreted and
+// the grandparent is compiled. However, in this method we do not know
+// the relationship of the current _frame relative to the top_frame so
+// we implement a more broad sanity check. When the previous callee is
+// interpreted and the current sender is compiled, we verify that the
+// current sender is also walkable. If it is not walkable, then we mark
+// the current vframeStream as at the end.
+void vframeStreamSamples::samples_next() {
+  // handle frames with inlining
+  if (_mode == compiled_mode &&
+    vframeStreamCommon::fill_in_compiled_inlined_sender()) {
+    return;
+  }
+
+  // handle general case
+  u4 loop_count = 0;
+  u4 loop_max = MAX_STACK_DEPTH * 2;
+  do {
+    loop_count++;
+    // By the time we get here we should never see unsafe but better safe then segv'd
+    if (loop_count > loop_max || !_frame.safe_for_sender(_thread)) {
+      _mode = at_end_mode;
+      return;
+    }
+    _frame = _frame.sender(&_reg_map);
+  } while (!fill_from_frame());
+}
+
+bool JfrStackTrace::record_thread(JavaThread& thread, frame& frame) {
+  vframeStreamSamples st(&thread, frame, false);
+  u4 count = 0;
+  _reached_root = true;
+
+  while (!st.at_end()) {
+    if (count >= _max_frames) {
+      _reached_root = false;
+      break;
+    }
+    const Method* method = st.method();
+    if (!Method::is_valid_method(method)) {
+      // we throw away everything we've gathered in this sample since
+      // none of it is safe
+      return false;
+    }
+    const traceid mid = JfrTraceId::use(method);
+    int type = st.is_interpreted_frame() ? JfrStackFrame::FRAME_INTERPRETER : JfrStackFrame::FRAME_JIT;
+    int bci = 0;
+    if (method->is_native()) {
+      type = JfrStackFrame::FRAME_NATIVE;
+    } else {
+      bci = st.bci();
+    }
+    const int lineno = method->line_number_from_bci(bci);
+    // Can we determine if it's inlined?
+    _hash = (_hash << 2) + (unsigned int)(((size_t)mid >> 2) + (bci << 4) + type);
+    _frames[count] = JfrStackFrame(mid, bci, type, method);
+    st.samples_next();
+    count++;
+  }
+
+  _lineno = true;
+  _nr_of_frames = count;
+  return true;
+}
+
+void JfrStackFrame::resolve_lineno() const {
+  assert(_method, "no method pointer");
+  assert(_line == 0, "already have linenumber");
+  _line = _method->line_number_from_bci(_bci);
+}
+
+void JfrStackTrace::resolve_linenos() const {
+  for (unsigned int i = 0; i < _nr_of_frames; i++) {
+    _frames[i].resolve_lineno();
+  }
+  _lineno = true;
+}
+
+bool JfrStackTrace::record_safe(JavaThread* thread, int skip) {
+  assert(thread == Thread::current(), "Thread stack needs to be walkable");
+  vframeStream vfs(thread);
+  u4 count = 0;
+  _reached_root = true;
+  for (int i = 0; i < skip; i++) {
+    if (vfs.at_end()) {
+      break;
+    }
+    vfs.next();
+  }
+
+  while (!vfs.at_end()) {
+    if (count >= _max_frames) {
+      _reached_root = false;
+      break;
+    }
+    const Method* method = vfs.method();
+    const traceid mid = JfrTraceId::use(method);
+    int type = vfs.is_interpreted_frame() ? JfrStackFrame::FRAME_INTERPRETER : JfrStackFrame::FRAME_JIT;
+    int bci = 0;
+    if (method->is_native()) {
+      type = JfrStackFrame::FRAME_NATIVE;
+    }
+    else {
+      bci = vfs.bci();
+    }
+    // Can we determine if it's inlined?
+    _hash = (_hash << 2) + (unsigned int)(((size_t)mid >> 2) + (bci << 4) + type);
+    _frames[count] = JfrStackFrame(mid, bci, type, method);
+    vfs.next();
+    count++;
+  }
+
+  _nr_of_frames = count;
+  return true;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTrace.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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_JFR_RECORDER_STACKTRACE_JFRSTACKTRACE_HPP
+#define SHARE_JFR_RECORDER_STACKTRACE_JFRSTACKTRACE_HPP
+
+#include "jfr/utilities/jfrAllocation.hpp"
+#include "jfr/utilities/jfrTypes.hpp"
+
+class frame;
+class JavaThread;
+class JfrCheckpointWriter;
+class JfrChunkWriter;
+class Method;
+
+class JfrStackFrame {
+  friend class ObjectSampleCheckpoint;
+ private:
+  const Method* _method;
+  traceid _methodid;
+  mutable int _line;
+  int _bci;
+  u1 _type;
+
+ public:
+  JfrStackFrame(const traceid& id, int bci, int type, const Method* method);
+  JfrStackFrame(const traceid& id, int bci, int type, int lineno);
+
+  bool equals(const JfrStackFrame& rhs) const;
+  void write(JfrChunkWriter& cw) const;
+  void write(JfrCheckpointWriter& cpw) const;
+  void resolve_lineno() const;
+
+  enum {
+    FRAME_INTERPRETER = 0,
+    FRAME_JIT,
+    FRAME_INLINE,
+    FRAME_NATIVE,
+    NUM_FRAME_TYPES
+  };
+};
+
+class JfrStackTrace : public JfrCHeapObj {
+  friend class JfrNativeSamplerCallback;
+  friend class JfrStackTraceRepository;
+  friend class ObjectSampleCheckpoint;
+  friend class ObjectSampler;
+  friend class OSThreadSampler;
+  friend class StackTraceResolver;
+ private:
+  const JfrStackTrace* _next;
+  JfrStackFrame* _frames;
+  traceid _id;
+  unsigned int _hash;
+  u4 _nr_of_frames;
+  u4 _max_frames;
+  bool _frames_ownership;
+  bool _reached_root;
+  mutable bool _lineno;
+  mutable bool _written;
+
+  const JfrStackTrace* next() const { return _next; }
+
+  bool should_write() const { return !_written; }
+  void write(JfrChunkWriter& cw) const;
+  void write(JfrCheckpointWriter& cpw) const;
+  bool equals(const JfrStackTrace& rhs) const;
+
+  void set_id(traceid id) { _id = id; }
+  void set_nr_of_frames(u4 nr_of_frames) { _nr_of_frames = nr_of_frames; }
+  void set_hash(unsigned int hash) { _hash = hash; }
+  void set_reached_root(bool reached_root) { _reached_root = reached_root; }
+  void resolve_linenos() const;
+
+  bool record_thread(JavaThread& thread, frame& frame);
+  bool record_safe(JavaThread* thread, int skip);
+
+  bool have_lineno() const { return _lineno; }
+  bool full_stacktrace() const { return _reached_root; }
+
+  JfrStackTrace(traceid id, const JfrStackTrace& trace, const JfrStackTrace* next);
+  JfrStackTrace(JfrStackFrame* frames, u4 max_frames);
+  ~JfrStackTrace();
+
+ public:
+  unsigned int hash() const { return _hash; }
+  traceid id() const { return _id; }
+};
+
+#endif // SHARE_JFR_RECORDER_STACKTRACE_JFRSTACKTRACE_HPP
--- a/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -24,66 +24,18 @@
 
 #include "precompiled.hpp"
 #include "jfr/metadata/jfrSerializer.hpp"
-#include "jfr/recorder/checkpoint/types/traceid/jfrTraceId.inline.hpp"
+#include "jfr/recorder/checkpoint/jfrCheckpointWriter.hpp"
 #include "jfr/recorder/repository/jfrChunkWriter.hpp"
-#include "jfr/recorder/service/jfrOptionSet.hpp"
 #include "jfr/recorder/stacktrace/jfrStackTraceRepository.hpp"
-#include "jfr/utilities/jfrTypes.hpp"
-#include "memory/allocation.inline.hpp"
+#include "jfr/support/jfrThreadLocal.hpp"
 #include "runtime/mutexLocker.hpp"
-#include "runtime/os.inline.hpp"
-#include "runtime/safepoint.hpp"
-#include "runtime/task.hpp"
-#include "runtime/vframe.inline.hpp"
-
-class vframeStreamSamples : public vframeStreamCommon {
- public:
-  // constructor that starts with sender of frame fr (top_frame)
-  vframeStreamSamples(JavaThread *jt, frame fr, bool stop_at_java_call_stub);
-  void samples_next();
-  void stop() {}
-};
-
-vframeStreamSamples::vframeStreamSamples(JavaThread *jt, frame fr, bool stop_at_java_call_stub) : vframeStreamCommon(jt) {
-  _stop_at_java_call_stub = stop_at_java_call_stub;
-  _frame = fr;
-
-  // We must always have a valid frame to start filling
-  bool filled_in = fill_from_frame();
-  assert(filled_in, "invariant");
-}
-
-// Solaris SPARC Compiler1 needs an additional check on the grandparent
-// of the top_frame when the parent of the top_frame is interpreted and
-// the grandparent is compiled. However, in this method we do not know
-// the relationship of the current _frame relative to the top_frame so
-// we implement a more broad sanity check. When the previous callee is
-// interpreted and the current sender is compiled, we verify that the
-// current sender is also walkable. If it is not walkable, then we mark
-// the current vframeStream as at the end.
-void vframeStreamSamples::samples_next() {
-  // handle frames with inlining
-  if (_mode == compiled_mode &&
-      vframeStreamCommon::fill_in_compiled_inlined_sender()) {
-    return;
-  }
-
-  // handle general case
-  u4 loop_count = 0;
-  u4 loop_max = MAX_STACK_DEPTH * 2;
-  do {
-    loop_count++;
-    // By the time we get here we should never see unsafe but better safe then segv'd
-    if (loop_count > loop_max || !_frame.safe_for_sender(_thread)) {
-      _mode = at_end_mode;
-      return;
-    }
-    _frame = _frame.sender(&_reg_map);
-  } while (!fill_from_frame());
-}
 
 static JfrStackTraceRepository* _instance = NULL;
 
+JfrStackTraceRepository::JfrStackTraceRepository() : _next_id(0), _entries(0) {
+  memset(_table, 0, sizeof(_table));
+}
+
 JfrStackTraceRepository& JfrStackTraceRepository::instance() {
   return *_instance;
 }
@@ -94,15 +46,6 @@
   return _instance;
 }
 
-void JfrStackTraceRepository::destroy() {
-  assert(_instance != NULL, "invarinat");
-  delete _instance;
-  _instance = NULL;
-}
-
-JfrStackTraceRepository::JfrStackTraceRepository() : _next_id(0), _entries(0) {
-  memset(_table, 0, sizeof(_table));
-}
 class JfrFrameType : public JfrSerializer {
  public:
   void serialize(JfrCheckpointWriter& writer) {
@@ -122,100 +65,10 @@
   return JfrSerializer::register_serializer(TYPE_FRAMETYPE, false, true, new JfrFrameType());
 }
 
-size_t JfrStackTraceRepository::clear() {
-  MutexLocker lock(JfrStacktrace_lock, Mutex::_no_safepoint_check_flag);
-  if (_entries == 0) {
-    return 0;
-  }
-  for (u4 i = 0; i < TABLE_SIZE; ++i) {
-    JfrStackTraceRepository::StackTrace* stacktrace = _table[i];
-    while (stacktrace != NULL) {
-      JfrStackTraceRepository::StackTrace* next = stacktrace->next();
-      delete stacktrace;
-      stacktrace = next;
-    }
-  }
-  memset(_table, 0, sizeof(_table));
-  const size_t processed = _entries;
-  _entries = 0;
-  return processed;
-}
-
-traceid JfrStackTraceRepository::add_trace(const JfrStackTrace& stacktrace) {
-  MutexLocker lock(JfrStacktrace_lock, Mutex::_no_safepoint_check_flag);
-  const size_t index = stacktrace._hash % TABLE_SIZE;
-  const StackTrace* table_entry = _table[index];
-
-  while (table_entry != NULL) {
-    if (table_entry->equals(stacktrace)) {
-      return table_entry->id();
-    }
-    table_entry = table_entry->next();
-  }
-
-  if (!stacktrace.have_lineno()) {
-    return 0;
-  }
-
-  traceid id = ++_next_id;
-  _table[index] = new StackTrace(id, stacktrace, _table[index]);
-  ++_entries;
-  return id;
-}
-
-traceid JfrStackTraceRepository::add(const JfrStackTrace& stacktrace) {
-  traceid tid = instance().add_trace(stacktrace);
-  if (tid == 0) {
-    stacktrace.resolve_linenos();
-    tid = instance().add_trace(stacktrace);
-  }
-  assert(tid != 0, "invariant");
-  return tid;
-}
-
-traceid JfrStackTraceRepository::record(Thread* thread, int skip /* 0 */) {
-  assert(thread == Thread::current(), "invariant");
-  JfrThreadLocal* const tl = thread->jfr_thread_local();
-  assert(tl != NULL, "invariant");
-  if (tl->has_cached_stack_trace()) {
-    return tl->cached_stack_trace_id();
-  }
-  if (!thread->is_Java_thread() || thread->is_hidden_from_external_view()) {
-    return 0;
-  }
-  JfrStackFrame* frames = tl->stackframes();
-  if (frames == NULL) {
-    // pending oom
-    return 0;
-  }
-  assert(frames != NULL, "invariant");
-  assert(tl->stackframes() == frames, "invariant");
-  return instance().record_for((JavaThread*)thread, skip,frames, tl->stackdepth());
-}
-
-traceid JfrStackTraceRepository::record_for(JavaThread* thread, int skip, JfrStackFrame *frames, u4 max_frames) {
-  JfrStackTrace stacktrace(frames, max_frames);
-  return stacktrace.record_safe(thread, skip) ? add(stacktrace) : 0;
-}
-
-traceid JfrStackTraceRepository::add(const JfrStackTrace* stacktrace, JavaThread* thread) {
-  assert(stacktrace != NULL, "invariant");
-  assert(thread != NULL, "invariant");
-  assert(stacktrace->hash() != 0, "invariant");
-  return add(*stacktrace);
-}
-
-bool JfrStackTraceRepository::fill_stacktrace_for(JavaThread* thread, JfrStackTrace* stacktrace, int skip) {
-  assert(thread == Thread::current(), "invariant");
-  assert(stacktrace != NULL, "invariant");
-  JfrThreadLocal* const tl = thread->jfr_thread_local();
-  assert(tl != NULL, "invariant");
-  const unsigned int cached_stacktrace_hash = tl->cached_stack_trace_hash();
-  if (cached_stacktrace_hash != 0) {
-    stacktrace->set_hash(cached_stacktrace_hash);
-    return true;
-  }
-  return stacktrace->record_safe(thread, skip, true);
+void JfrStackTraceRepository::destroy() {
+  assert(_instance != NULL, "invarinat");
+  delete _instance;
+  _instance = NULL;
 }
 
 size_t JfrStackTraceRepository::write_impl(JfrChunkWriter& sw, bool clear) {
@@ -223,9 +76,9 @@
   assert(_entries > 0, "invariant");
   int count = 0;
   for (u4 i = 0; i < TABLE_SIZE; ++i) {
-    JfrStackTraceRepository::StackTrace* stacktrace = _table[i];
+    JfrStackTrace* stacktrace = _table[i];
     while (stacktrace != NULL) {
-      JfrStackTraceRepository::StackTrace* next = stacktrace->next();
+      JfrStackTrace* next = const_cast<JfrStackTrace*>(stacktrace->next());
       if (stacktrace->should_write()) {
         stacktrace->write(sw);
         ++count;
@@ -249,7 +102,7 @@
 
 traceid JfrStackTraceRepository::write(JfrCheckpointWriter& writer, traceid id, unsigned int hash) {
   assert(JfrStacktrace_lock->owned_by_self(), "invariant");
-  const StackTrace* const trace = resolve_entry(hash, id);
+  const JfrStackTrace* const trace = lookup(hash, id);
   assert(trace != NULL, "invariant");
   assert(trace->hash() == hash, "invariant");
   assert(trace->id() == id, "invariant");
@@ -257,82 +110,105 @@
   return id;
 }
 
-JfrStackTraceRepository::StackTrace::StackTrace(traceid id, const JfrStackTrace& trace, JfrStackTraceRepository::StackTrace* next) :
-  _next(next),
-  _frames(NULL),
-  _id(id),
-  _nr_of_frames(trace._nr_of_frames),
-  _hash(trace._hash),
-  _reached_root(trace._reached_root),
-  _written(false) {
-  if (_nr_of_frames > 0) {
-    _frames = NEW_C_HEAP_ARRAY(JfrStackFrame, _nr_of_frames, mtTracing);
-    memcpy(_frames, trace._frames, _nr_of_frames * sizeof(JfrStackFrame));
+void JfrStackTraceRepository::write_metadata(JfrCheckpointWriter& writer) {
+  JfrFrameType fct;
+  writer.write_type(TYPE_FRAMETYPE);
+  fct.serialize(writer);
+}
+
+size_t JfrStackTraceRepository::clear() {
+  MutexLocker lock(JfrStacktrace_lock, Mutex::_no_safepoint_check_flag);
+  if (_entries == 0) {
+    return 0;
+  }
+  for (u4 i = 0; i < TABLE_SIZE; ++i) {
+    JfrStackTrace* stacktrace = _table[i];
+    while (stacktrace != NULL) {
+      JfrStackTrace* next = const_cast<JfrStackTrace*>(stacktrace->next());
+      delete stacktrace;
+      stacktrace = next;
+    }
+  }
+  memset(_table, 0, sizeof(_table));
+  const size_t processed = _entries;
+  _entries = 0;
+  return processed;
+}
+
+traceid JfrStackTraceRepository::record(Thread* thread, int skip /* 0 */) {
+  assert(thread == Thread::current(), "invariant");
+  JfrThreadLocal* const tl = thread->jfr_thread_local();
+  assert(tl != NULL, "invariant");
+  if (tl->has_cached_stack_trace()) {
+    return tl->cached_stack_trace_id();
+  }
+  if (!thread->is_Java_thread() || thread->is_hidden_from_external_view()) {
+    return 0;
+  }
+  JfrStackFrame* frames = tl->stackframes();
+  if (frames == NULL) {
+    // pending oom
+    return 0;
+  }
+  assert(frames != NULL, "invariant");
+  assert(tl->stackframes() == frames, "invariant");
+  return instance().record_for((JavaThread*)thread, skip, frames, tl->stackdepth());
+}
+
+traceid JfrStackTraceRepository::record_for(JavaThread* thread, int skip, JfrStackFrame *frames, u4 max_frames) {
+  JfrStackTrace stacktrace(frames, max_frames);
+  return stacktrace.record_safe(thread, skip) ? add(stacktrace) : 0;
+}
+
+traceid JfrStackTraceRepository::add(const JfrStackTrace& stacktrace) {
+  traceid tid = instance().add_trace(stacktrace);
+  if (tid == 0) {
+    stacktrace.resolve_linenos();
+    tid = instance().add_trace(stacktrace);
+  }
+  assert(tid != 0, "invariant");
+  return tid;
+}
+
+void JfrStackTraceRepository::record_and_cache(JavaThread* thread, int skip /* 0 */) {
+  assert(thread != NULL, "invariant");
+  JfrThreadLocal* const tl = thread->jfr_thread_local();
+  assert(tl != NULL, "invariant");
+  assert(!tl->has_cached_stack_trace(), "invariant");
+  JfrStackTrace stacktrace(tl->stackframes(), tl->stackdepth());
+  stacktrace.record_safe(thread, skip);
+  const unsigned int hash = stacktrace.hash();
+  if (hash != 0) {
+    tl->set_cached_stack_trace_id(instance().add(stacktrace), hash);
   }
 }
 
-JfrStackTraceRepository::StackTrace::~StackTrace() {
-  FREE_C_HEAP_ARRAY(JfrStackFrame, _frames);
-}
-
-bool JfrStackTraceRepository::StackTrace::equals(const JfrStackTrace& rhs) const {
-  if (_reached_root != rhs._reached_root || _nr_of_frames != rhs._nr_of_frames || _hash != rhs._hash) {
-    return false;
-  }
-  for (u4 i = 0; i < _nr_of_frames; ++i) {
-    if (!_frames[i].equals(rhs._frames[i])) {
-      return false;
-    }
-  }
-  return true;
-}
-
-template <typename Writer>
-static void write_stacktrace(Writer& w, traceid id, bool reached_root, u4 nr_of_frames, const JfrStackFrame* frames) {
-  w.write((u8)id);
-  w.write((u1)!reached_root);
-  w.write(nr_of_frames);
-  for (u4 i = 0; i < nr_of_frames; ++i) {
-    frames[i].write(w);
-  }
-}
+traceid JfrStackTraceRepository::add_trace(const JfrStackTrace& stacktrace) {
+  MutexLocker lock(JfrStacktrace_lock, Mutex::_no_safepoint_check_flag);
+  const size_t index = stacktrace._hash % TABLE_SIZE;
+  const JfrStackTrace* table_entry = _table[index];
 
-void JfrStackTraceRepository::StackTrace::write(JfrChunkWriter& sw) const {
-  assert(!_written, "invariant");
-  write_stacktrace(sw, _id, _reached_root, _nr_of_frames, _frames);
-  _written = true;
-}
-
-void JfrStackTraceRepository::StackTrace::write(JfrCheckpointWriter& cpw) const {
-  write_stacktrace(cpw, _id, _reached_root, _nr_of_frames, _frames);
-}
-
-// JfrStackFrame
+  while (table_entry != NULL) {
+    if (table_entry->equals(stacktrace)) {
+      return table_entry->id();
+    }
+    table_entry = table_entry->next();
+  }
 
-bool JfrStackFrame::equals(const JfrStackFrame& rhs) const {
-  return _methodid == rhs._methodid && _bci == rhs._bci && _type == rhs._type;
-}
+  if (!stacktrace.have_lineno()) {
+    return 0;
+  }
 
-template <typename Writer>
-static void write_frame(Writer& w, traceid methodid, int line, int bci, u1 type) {
-  w.write((u8)methodid);
-  w.write((u4)line);
-  w.write((u4)bci);
-  w.write((u8)type);
-}
-
-void JfrStackFrame::write(JfrChunkWriter& cw) const {
-  write_frame(cw, _methodid, _line, _bci, _type);
-}
-
-void JfrStackFrame::write(JfrCheckpointWriter& cpw) const {
-  write_frame(cpw, _methodid, _line, _bci, _type);
+  traceid id = ++_next_id;
+  _table[index] = new JfrStackTrace(id, stacktrace, _table[index]);
+  ++_entries;
+  return id;
 }
 
 // invariant is that the entry to be resolved actually exists in the table
-const JfrStackTraceRepository::StackTrace* JfrStackTraceRepository::resolve_entry(unsigned int hash, traceid id) const {
+const JfrStackTrace* JfrStackTraceRepository::lookup(unsigned int hash, traceid id) const {
   const size_t index = (hash % TABLE_SIZE);
-  const StackTrace* trace = _table[index];
+  const JfrStackTrace* trace = _table[index];
   while (trace != NULL && trace->id() != id) {
     trace = trace->next();
   }
@@ -341,102 +217,3 @@
   assert(trace->id() == id, "invariant");
   return trace;
 }
-
-void JfrStackFrame::resolve_lineno() const {
-  assert(_method, "no method pointer");
-  assert(_line == 0, "already have linenumber");
-  _line = _method->line_number_from_bci(_bci);
-  _method = NULL;
-}
-
-void JfrStackTrace::set_frame(u4 frame_pos, JfrStackFrame& frame) {
-  assert(frame_pos < _max_frames, "illegal frame_pos");
-  _frames[frame_pos] = frame;
-}
-
-void JfrStackTrace::resolve_linenos() const {
-  for(unsigned int i = 0; i < _nr_of_frames; i++) {
-    _frames[i].resolve_lineno();
-  }
-  _lineno = true;
-}
-
-bool JfrStackTrace::record_safe(JavaThread* thread, int skip, bool leakp /* false */) {
-  assert(thread == Thread::current(), "Thread stack needs to be walkable");
-  vframeStream vfs(thread);
-  u4 count = 0;
-  _reached_root = true;
-  for(int i = 0; i < skip; i++) {
-    if (vfs.at_end()) {
-      break;
-    }
-    vfs.next();
-  }
-
-  while (!vfs.at_end()) {
-    if (count >= _max_frames) {
-      _reached_root = false;
-      break;
-    }
-    const Method* method = vfs.method();
-    const traceid mid = JfrTraceId::use(method, leakp);
-    int type = vfs.is_interpreted_frame() ? JfrStackFrame::FRAME_INTERPRETER : JfrStackFrame::FRAME_JIT;
-    int bci = 0;
-    if (method->is_native()) {
-      type = JfrStackFrame::FRAME_NATIVE;
-    } else {
-      bci = vfs.bci();
-    }
-    // Can we determine if it's inlined?
-    _hash = (_hash << 2) + (unsigned int)(((size_t)mid >> 2) + (bci << 4) + type);
-    _frames[count] = JfrStackFrame(mid, bci, type, method);
-    vfs.next();
-    count++;
-  }
-
-  _nr_of_frames = count;
-  return true;
-}
-
-bool JfrStackTrace::record_thread(JavaThread& thread, frame& frame) {
-  vframeStreamSamples st(&thread, frame, false);
-  u4 count = 0;
-  _reached_root = true;
-
-  while (!st.at_end()) {
-    if (count >= _max_frames) {
-      _reached_root = false;
-      break;
-    }
-    const Method* method = st.method();
-    if (!Method::is_valid_method(method)) {
-      // we throw away everything we've gathered in this sample since
-      // none of it is safe
-      return false;
-    }
-    const traceid mid = JfrTraceId::use(method);
-    int type = st.is_interpreted_frame() ? JfrStackFrame::FRAME_INTERPRETER : JfrStackFrame::FRAME_JIT;
-    int bci = 0;
-    if (method->is_native()) {
-      type = JfrStackFrame::FRAME_NATIVE;
-    } else {
-      bci = st.bci();
-    }
-    const int lineno = method->line_number_from_bci(bci);
-    // Can we determine if it's inlined?
-    _hash = (_hash << 2) + (unsigned int)(((size_t)mid >> 2) + (bci << 4) + type);
-    _frames[count] = JfrStackFrame(mid, bci, type, lineno);
-    st.samples_next();
-    count++;
-  }
-
-  _lineno = true;
-  _nr_of_frames = count;
-  return true;
-}
-
-void JfrStackTraceRepository::write_metadata(JfrCheckpointWriter& writer) {
-  JfrFrameType fct;
-  writer.write_type(TYPE_FRAMETYPE);
-  fct.serialize(writer);
-}
--- a/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTraceRepository.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTraceRepository.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -25,133 +25,49 @@
 #ifndef SHARE_JFR_RECORDER_STACKTRACE_JFRSTACKTRACEREPOSITORY_HPP
 #define SHARE_JFR_RECORDER_STACKTRACE_JFRSTACKTRACEREPOSITORY_HPP
 
+#include "jfr/recorder/stacktrace/jfrStackTrace.hpp"
 #include "jfr/utilities/jfrAllocation.hpp"
 #include "jfr/utilities/jfrTypes.hpp"
 
-class frame;
 class JavaThread;
 class JfrCheckpointWriter;
 class JfrChunkWriter;
-class Method;
-
-class JfrStackFrame {
- private:
-  mutable const Method* _method;
-  traceid _methodid;
-  mutable int _line;
-  int _bci;
-  u1 _type;
-
- public:
-  enum {
-    FRAME_INTERPRETER = 0,
-    FRAME_JIT,
-    FRAME_INLINE,
-    FRAME_NATIVE,
-    NUM_FRAME_TYPES
-  };
-
-  JfrStackFrame(const traceid& id, int bci, int type, const Method* method) :
-    _method(method), _methodid(id), _line(0), _bci(bci), _type(type) {}
-  JfrStackFrame(const traceid& id, int bci, int type, int lineno) :
-    _method(NULL), _methodid(id), _line(lineno), _bci(bci), _type(type) {}
-  bool equals(const JfrStackFrame& rhs) const;
-  void write(JfrChunkWriter& cw) const;
-  void write(JfrCheckpointWriter& cpw) const;
-  void resolve_lineno() const;
-};
-
-class JfrStackTrace : public StackObj {
-  friend class JfrStackTraceRepository;
- private:
-  JfrStackFrame* _frames;
-  traceid _id;
-  u4 _nr_of_frames;
-  unsigned int _hash;
-  const u4 _max_frames;
-  bool _reached_root;
-  mutable bool _lineno;
-
- public:
-  JfrStackTrace(JfrStackFrame* frames, u4 max_frames) : _frames(frames),
-                                                        _id(0),
-                                                        _nr_of_frames(0),
-                                                        _hash(0),
-                                                        _max_frames(max_frames),
-                                                        _reached_root(false),
-                                                        _lineno(false) {}
-  bool record_thread(JavaThread& thread, frame& frame);
-  bool record_safe(JavaThread* thread, int skip, bool leakp = false);
-  void resolve_linenos() const;
-  void set_nr_of_frames(u4 nr_of_frames) { _nr_of_frames = nr_of_frames; }
-  void set_hash(unsigned int hash) { _hash = hash; }
-  unsigned int hash() const { return _hash; }
-  void set_frame(u4 frame_pos, JfrStackFrame& frame);
-  void set_reached_root(bool reached_root) { _reached_root = reached_root; }
-  bool full_stacktrace() const { return _reached_root; }
-  bool have_lineno() const { return _lineno; }
-};
 
 class JfrStackTraceRepository : public JfrCHeapObj {
   friend class JfrRecorder;
   friend class JfrRecorderService;
+  friend class JfrThreadSampleClosure;
+  friend class ObjectSampleCheckpoint;
   friend class ObjectSampler;
-  friend class WriteObjectSampleStacktrace;
-
-  class StackTrace : public JfrCHeapObj {
-    friend class JfrStackTrace;
-    friend class JfrStackTraceRepository;
-   private:
-    StackTrace* _next;
-    JfrStackFrame* _frames;
-    const traceid _id;
-    u4 _nr_of_frames;
-    unsigned int _hash;
-    bool _reached_root;
-    mutable bool _written;
-
-    unsigned int hash() const { return _hash; }
-    bool should_write() const { return !_written; }
-
-   public:
-    StackTrace(traceid id, const JfrStackTrace& trace, StackTrace* next);
-    ~StackTrace();
-    traceid id() const { return _id; }
-    StackTrace* next() const { return _next; }
-    void write(JfrChunkWriter& cw) const;
-    void write(JfrCheckpointWriter& cpw) const;
-    bool equals(const JfrStackTrace& rhs) const;
-  };
+  friend class StackTraceBlobInstaller;
+  friend class WriteStackTraceRepository;
 
  private:
   static const u4 TABLE_SIZE = 2053;
-  StackTrace* _table[TABLE_SIZE];
+  JfrStackTrace* _table[TABLE_SIZE];
   traceid _next_id;
   u4 _entries;
 
-  traceid add_trace(const JfrStackTrace& stacktrace);
-  static traceid add(const JfrStackTrace* stacktrace, JavaThread* thread);
-  traceid record_for(JavaThread* thread, int skip, JfrStackFrame* frames, u4 max_frames);
-
-  size_t write_impl(JfrChunkWriter& cw, bool clear);
-  const StackTrace* resolve_entry(unsigned int hash, traceid id) const;
-  static void write_metadata(JfrCheckpointWriter& cpw);
-
-  static bool fill_stacktrace_for(JavaThread* thread, JfrStackTrace* stacktrace, int skip);
-
   JfrStackTraceRepository();
+  static JfrStackTraceRepository& instance();
   static JfrStackTraceRepository* create();
   bool initialize();
   static void destroy();
 
-  static JfrStackTraceRepository& instance();
-
- public:
-  static traceid add(const JfrStackTrace& stacktrace);
-  static traceid record(Thread* thread, int skip = 0);
+  size_t write_impl(JfrChunkWriter& cw, bool clear);
+  static void write_metadata(JfrCheckpointWriter& cpw);
   traceid write(JfrCheckpointWriter& cpw, traceid id, unsigned int hash);
   size_t write(JfrChunkWriter& cw, bool clear);
   size_t clear();
+
+  traceid add_trace(const JfrStackTrace& stacktrace);
+  static traceid add(const JfrStackTrace& stacktrace);
+  traceid record_for(JavaThread* thread, int skip, JfrStackFrame* frames, u4 max_frames);
+  const JfrStackTrace* lookup(unsigned int hash, traceid id) const;
+
+ public:
+  static traceid record(Thread* thread, int skip = 0);
+  static void record_and_cache(JavaThread* thread, int skip = 0);
 };
 
 #endif // SHARE_JFR_RECORDER_STACKTRACE_JFRSTACKTRACEREPOSITORY_HPP
--- a/src/hotspot/share/jfr/recorder/storage/jfrMemorySpace.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/recorder/storage/jfrMemorySpace.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -27,10 +27,6 @@
 #include "jfr/utilities/jfrAllocation.hpp"
 #include "jfr/utilities/jfrDoublyLinkedList.hpp"
 #include "jfr/utilities/jfrIterator.hpp"
-#include "jfr/utilities/jfrTypes.hpp"
-#include "runtime/os.hpp"
-#include "utilities/globalDefinitions.hpp"
-#include "utilities/macros.hpp"
 
 template <typename T, template <typename> class RetrievalType, typename Callback>
 class JfrMemorySpace : public JfrCHeapObj {
@@ -107,62 +103,4 @@
   debug_only(bool in_free_list(const Type* t) const { return _free.in_list(t); })
 };
 
-// allocations are even multiples of the mspace min size
-inline u8 align_allocation_size(u8 requested_size, size_t min_elem_size) {
-  assert((int)min_elem_size % os::vm_page_size() == 0, "invariant");
-  u8 alloc_size_bytes = min_elem_size;
-  while (requested_size > alloc_size_bytes) {
-    alloc_size_bytes <<= 1;
-  }
-  assert((int)alloc_size_bytes % os::vm_page_size() == 0, "invariant");
-  return alloc_size_bytes;
-}
-
-template <typename T, template <typename> class RetrievalType, typename Callback>
-T* JfrMemorySpace<T, RetrievalType, Callback>::allocate(size_t size) {
-  const u8 aligned_size_bytes = align_allocation_size(size, _min_elem_size);
-  void* const allocation = JfrCHeapObj::new_array<u1>(aligned_size_bytes + sizeof(T));
-  if (allocation == NULL) {
-    return NULL;
-  }
-  T* const t = new (allocation) T;
-  assert(t != NULL, "invariant");
-  if (!t->initialize(sizeof(T), aligned_size_bytes)) {
-    JfrCHeapObj::free(t, aligned_size_bytes + sizeof(T));
-    return NULL;
-  }
-  return t;
-}
-
-template <typename T, template <typename> class RetrievalType, typename Callback>
-void JfrMemorySpace<T, RetrievalType, Callback>::deallocate(T* t) {
-  assert(t != NULL, "invariant");
-  assert(!_free.in_list(t), "invariant");
-  assert(!_full.in_list(t), "invariant");
-  assert(t != NULL, "invariant");
-  JfrCHeapObj::free(t, t->total_size());
-}
-
-template <typename Mspace>
-class MspaceLock {
- private:
-  Mspace* _mspace;
- public:
-  MspaceLock(Mspace* mspace) : _mspace(mspace) { _mspace->lock(); }
-  ~MspaceLock() { _mspace->unlock(); }
-};
-
-template <typename Mspace>
-class ReleaseOp : public StackObj {
- private:
-  Mspace* _mspace;
-  Thread* _thread;
-  bool _release_full;
- public:
-  typedef typename Mspace::Type Type;
-  ReleaseOp(Mspace* mspace, Thread* thread, bool release_full = true) : _mspace(mspace), _thread(thread), _release_full(release_full) {}
-  bool process(Type* t);
-  size_t processed() const { return 0; }
-};
-
 #endif // SHARE_JFR_RECORDER_STORAGE_JFRMEMORYSPACE_HPP
--- a/src/hotspot/share/jfr/recorder/storage/jfrMemorySpace.inline.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/recorder/storage/jfrMemorySpace.inline.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -26,6 +26,7 @@
 #define SHARE_JFR_RECORDER_STORAGE_JFRMEMORYSPACE_INLINE_HPP
 
 #include "jfr/recorder/storage/jfrMemorySpace.hpp"
+#include "runtime/os.hpp"
 
 template <typename T, template <typename> class RetrievalType, typename Callback>
 JfrMemorySpace<T, RetrievalType, Callback>::
@@ -69,6 +70,42 @@
   return true;
 }
 
+// allocations are even multiples of the mspace min size
+static inline size_t align_allocation_size(size_t requested_size, size_t min_elem_size) {
+  assert((int)min_elem_size % os::vm_page_size() == 0, "invariant");
+  u8 alloc_size_bytes = min_elem_size;
+  while (requested_size > alloc_size_bytes) {
+    alloc_size_bytes <<= 1;
+  }
+  assert((int)alloc_size_bytes % os::vm_page_size() == 0, "invariant");
+  return (size_t)alloc_size_bytes;
+}
+
+template <typename T, template <typename> class RetrievalType, typename Callback>
+inline T* JfrMemorySpace<T, RetrievalType, Callback>::allocate(size_t size) {
+  const size_t aligned_size_bytes = align_allocation_size(size, _min_elem_size);
+  void* const allocation = JfrCHeapObj::new_array<u1>(aligned_size_bytes + sizeof(T));
+  if (allocation == NULL) {
+    return NULL;
+  }
+  T* const t = new (allocation) T;
+  assert(t != NULL, "invariant");
+  if (!t->initialize(sizeof(T), aligned_size_bytes)) {
+    JfrCHeapObj::free(t, aligned_size_bytes + sizeof(T));
+    return NULL;
+  }
+  return t;
+}
+
+template <typename T, template <typename> class RetrievalType, typename Callback>
+inline void JfrMemorySpace<T, RetrievalType, Callback>::deallocate(T* t) {
+  assert(t != NULL, "invariant");
+  assert(!_free.in_list(t), "invariant");
+  assert(!_full.in_list(t), "invariant");
+  assert(t != NULL, "invariant");
+  JfrCHeapObj::free(t, t->total_size());
+}
+
 template <typename T, template <typename> class RetrievalType, typename Callback>
 inline void JfrMemorySpace<T, RetrievalType, Callback>::release_full(T* t) {
   assert(is_locked(), "invariant");
@@ -122,6 +159,15 @@
   }
 }
 
+template <typename Mspace, typename Callback>
+static inline Mspace* create_mspace(size_t buffer_size, size_t limit, size_t cache_count, Callback* cb) {
+  Mspace* const mspace = new Mspace(buffer_size, limit, cache_count, cb);
+  if (mspace != NULL) {
+    mspace->initialize();
+  }
+  return mspace;
+}
+
 template <typename Mspace>
 inline size_t size_adjustment(size_t size, Mspace* mspace) {
   assert(mspace != NULL, "invariant");
@@ -174,6 +220,15 @@
 }
 
 template <typename Mspace>
+class MspaceLock {
+ private:
+  Mspace* _mspace;
+ public:
+  MspaceLock(Mspace* mspace) : _mspace(mspace) { _mspace->lock(); }
+  ~MspaceLock() { _mspace->unlock(); }
+};
+
+template <typename Mspace>
 inline typename Mspace::Type* mspace_allocate_transient_to_full(size_t size, Mspace* mspace, Thread* thread) {
   typename Mspace::Type* const t = mspace_allocate_transient(size, mspace, thread);
   if (t == NULL) return NULL;
@@ -344,6 +399,20 @@
 }
 
 template <typename Mspace>
+class ReleaseOp : public StackObj {
+ private:
+  Mspace* _mspace;
+  Thread* _thread;
+  bool _release_full;
+ public:
+  typedef typename Mspace::Type Type;
+  ReleaseOp(Mspace* mspace, Thread* thread, bool release_full = true) :
+    _mspace(mspace), _thread(thread), _release_full(release_full) {}
+  bool process(Type* t);
+  size_t processed() const { return 0; }
+};
+
+template <typename Mspace>
 inline bool ReleaseOp<Mspace>::process(typename Mspace::Type* t) {
   assert(t != NULL, "invariant");
   // assumes some means of exclusive access to t
--- a/src/hotspot/share/jfr/support/jfrKlassExtension.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/support/jfrKlassExtension.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -36,6 +36,7 @@
 #define JDK_JFR_EVENT_SUBKLASS 16
 #define JDK_JFR_EVENT_KLASS    32
 #define EVENT_HOST_KLASS       64
+#define EVENT_RESERVED         128
 #define IS_EVENT_KLASS(ptr) (((ptr)->trace_id() & (JDK_JFR_EVENT_KLASS | JDK_JFR_EVENT_SUBKLASS)) != 0)
 #define ON_KLASS_CREATION(k, p, t) if (IS_EVENT_KLASS(k)) JfrEventClassTransformer::on_klass_creation(k, p, t)
 
--- a/src/hotspot/share/jfr/support/jfrThreadLocal.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/support/jfrThreadLocal.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -25,13 +25,13 @@
 #include "precompiled.hpp"
 #include "jfr/jfrEvents.hpp"
 #include "jfr/jni/jfrJavaSupport.hpp"
+#include "jfr/leakprofiler/checkpoint/objectSampleCheckpoint.hpp"
 #include "jfr/periodic/jfrThreadCPULoadEvent.hpp"
 #include "jfr/recorder/jfrRecorder.hpp"
 #include "jfr/recorder/checkpoint/jfrCheckpointManager.hpp"
 #include "jfr/recorder/checkpoint/types/traceid/jfrTraceId.inline.hpp"
 #include "jfr/recorder/service/jfrOptionSet.hpp"
 #include "jfr/recorder/storage/jfrStorage.hpp"
-#include "jfr/recorder/stacktrace/jfrStackTraceRepository.hpp"
 #include "jfr/support/jfrThreadLocal.hpp"
 #include "memory/allocation.inline.hpp"
 #include "runtime/os.hpp"
@@ -46,7 +46,7 @@
   _shelved_buffer(NULL),
   _stackframes(NULL),
   _trace_id(JfrTraceId::assign_thread_id()),
-  _thread_cp(),
+  _thread(),
   _data_lost(0),
   _stack_trace_id(max_julong),
   _user_time(0),
@@ -62,17 +62,17 @@
   return _data_lost;
 }
 
-bool JfrThreadLocal::has_thread_checkpoint() const {
-  return _thread_cp.valid();
+bool JfrThreadLocal::has_thread_blob() const {
+  return _thread.valid();
 }
 
-void JfrThreadLocal::set_thread_checkpoint(const JfrCheckpointBlobHandle& ref) {
-  assert(!_thread_cp.valid(), "invariant");
-  _thread_cp = ref;
+void JfrThreadLocal::set_thread_blob(const JfrBlobHandle& ref) {
+  assert(!_thread.valid(), "invariant");
+  _thread = ref;
 }
 
-const JfrCheckpointBlobHandle& JfrThreadLocal::thread_checkpoint() const {
-  return _thread_cp;
+const JfrBlobHandle& JfrThreadLocal::thread_blob() const {
+  return _thread;
 }
 
 static void send_java_thread_start_event(JavaThread* jt) {
@@ -95,10 +95,12 @@
   assert(jt != NULL, "invariant");
   assert(Thread::current() == jt, "invariant");
   assert(jt->jfr_thread_local()->trace_id() == id, "invariant");
-  EventThreadEnd event;
-  event.set_thread(id);
-  event.commit();
-  JfrThreadCPULoadEvent::send_event_for_thread(jt);
+  if (JfrRecorder::is_recording()) {
+    EventThreadEnd event;
+    event.set_thread(id);
+    event.commit();
+    JfrThreadCPULoadEvent::send_event_for_thread(jt);
+  }
 }
 
 void JfrThreadLocal::release(JfrThreadLocal* tl, Thread* t) {
@@ -125,10 +127,10 @@
   assert(t != NULL, "invariant");
   JfrThreadLocal * const tl = t->jfr_thread_local();
   assert(!tl->is_dead(), "invariant");
-  if (JfrRecorder::is_recording()) {
-    if (t->is_Java_thread()) {
-      send_java_thread_end_events(tl->thread_id(), (JavaThread*)t);
-    }
+  if (t->is_Java_thread()) {
+    JavaThread* const jt = (JavaThread*)t;
+    ObjectSampleCheckpoint::on_thread_exit(jt);
+    send_java_thread_end_events(tl->thread_id(), jt);
   }
   release(tl, Thread::current()); // because it could be that Thread::current() != t
 }
--- a/src/hotspot/share/jfr/support/jfrThreadLocal.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/support/jfrThreadLocal.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -25,7 +25,7 @@
 #ifndef SHARE_JFR_SUPPORT_JFRTHREADLOCAL_HPP
 #define SHARE_JFR_SUPPORT_JFRTHREADLOCAL_HPP
 
-#include "jfr/recorder/checkpoint/jfrCheckpointBlob.hpp"
+#include "jfr/utilities/jfrBlob.hpp"
 #include "jfr/utilities/jfrTypes.hpp"
 
 class JavaThread;
@@ -41,7 +41,7 @@
   JfrBuffer* _shelved_buffer;
   mutable JfrStackFrame* _stackframes;
   mutable traceid _trace_id;
-  JfrCheckpointBlobHandle _thread_cp;
+  JfrBlobHandle _thread;
   u8 _data_lost;
   traceid _stack_trace_id;
   jlong _user_time;
@@ -207,9 +207,9 @@
     return _dead;
   }
 
-  bool has_thread_checkpoint() const;
-  void set_thread_checkpoint(const JfrCheckpointBlobHandle& handle);
-  const JfrCheckpointBlobHandle& thread_checkpoint() const;
+  bool has_thread_blob() const;
+  void set_thread_blob(const JfrBlobHandle& handle);
+  const JfrBlobHandle& thread_blob() const;
 
   static void on_start(Thread* t);
   static void on_exit(Thread* t);
--- a/src/hotspot/share/jfr/support/jfrTraceIdExtension.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/support/jfrTraceIdExtension.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -26,6 +26,7 @@
 #define SHARE_JFR_SUPPORT_JFRTRACEIDEXTENSION_HPP
 
 #include "jfr/recorder/checkpoint/types/traceid/jfrTraceId.hpp"
+#include "utilities/macros.hpp"
 
 #define DEFINE_TRACE_ID_FIELD mutable traceid _trace_id
 
@@ -43,39 +44,55 @@
 
 class JfrTraceFlag {
  private:
-  mutable jbyte _flags;
+  mutable jshort _flags;
  public:
   JfrTraceFlag() : _flags(0) {}
-  explicit JfrTraceFlag(jbyte flags) : _flags(flags) {}
-  void set_flag(jbyte flag) const {
-    _flags |= flag;
-  }
-  void clear_flag(jbyte flag) const {
-    _flags &= (~flag);
-  }
-  jbyte flags() const { return _flags; }
-  bool is_set(jbyte flag) const {
+  bool is_set(jshort flag) const {
     return (_flags & flag) != 0;
   }
-  jbyte* const flags_addr() const {
-    return &_flags;
+
+  jshort flags() const {
+    return _flags;
+  }
+
+  void set_flags(jshort flags) const {
+    _flags = flags;
+  }
+
+  jbyte* flags_addr() const {
+#ifdef VM_LITTLE_ENDIAN
+    return (jbyte*)&_flags;
+#else
+    return ((jbyte*)&_flags) + 1;
+#endif
+  }
+
+  jbyte* meta_addr() const {
+#ifdef VM_LITTLE_ENDIAN
+    return (jbyte*)(&_flags) + 1;
+#else
+    return (jbyte*)&_flags;
+#endif
   }
 };
 
 #define DEFINE_TRACE_FLAG mutable JfrTraceFlag _trace_flags
 
 #define DEFINE_TRACE_FLAG_ACCESSOR                 \
-  void set_trace_flag(jbyte flag) const {          \
-    _trace_flags.set_flag(flag);                   \
+  bool is_trace_flag_set(jshort flag) const {      \
+    return _trace_flags.is_set(flag);              \
   }                                                \
-  jbyte trace_flags() const {                      \
+  jshort trace_flags() const {                     \
     return _trace_flags.flags();                   \
   }                                                \
-  bool is_trace_flag_set(jbyte flag) const {       \
-    return _trace_flags.is_set(flag);              \
+  void set_trace_flags(jshort flags) const {       \
+    _trace_flags.set_flags(flags);                 \
   }                                                \
-  jbyte* const trace_flags_addr() const {          \
+  jbyte* trace_flags_addr() const {                \
     return _trace_flags.flags_addr();              \
+  }                                                \
+  jbyte* trace_meta_addr() const {                 \
+    return _trace_flags.meta_addr();               \
   }
 
 #endif // SHARE_JFR_SUPPORT_JFRTRACEIDEXTENSION_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/jfr/utilities/jfrBlob.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 "jfr/utilities/jfrBlob.hpp"
+
+JfrBlob::JfrBlob(const u1* checkpoint, size_t size) :
+  _data(JfrCHeapObj::new_array<u1>(size)),
+  _next(),
+  _size(size),
+  _written(false) {
+  assert(_data != NULL, "invariant");
+  memcpy(const_cast<u1*>(_data), checkpoint, size);
+}
+
+JfrBlob::~JfrBlob() {
+  JfrCHeapObj::free(const_cast<u1*>(_data), _size);
+}
+
+void JfrBlob::reset_write_state() const {
+  if (!_written) {
+    return;
+  }
+  _written = false;
+  if (_next.valid()) {
+    _next->reset_write_state();
+  }
+}
+
+void JfrBlob::set_next(const JfrBlobHandle& ref) {
+  if (_next == ref) {
+    return;
+  }
+  assert(_next != ref, "invariant");
+  if (_next.valid()) {
+    _next->set_next(ref);
+    return;
+  }
+  _next = ref;
+}
+
+JfrBlobHandle JfrBlob::make(const u1* data, size_t size) {
+  const JfrBlob* const blob = new JfrBlob(data, size);
+  assert(blob != NULL, "invariant");
+  return JfrBlobReference::make(blob);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/jfr/utilities/jfrBlob.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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_JFR_UTILITIES_JFRBLOB_HPP
+#define SHARE_JFR_UTILITIES_JFRBLOB_HPP
+
+#include "jfr/utilities/jfrAllocation.hpp"
+#include "jfr/utilities/jfrRefCountPointer.hpp"
+
+class JfrBlob;
+typedef RefCountPointer<JfrBlob, MultiThreadedRefCounter> JfrBlobReference;
+typedef RefCountHandle<JfrBlobReference> JfrBlobHandle;
+
+class JfrBlob : public JfrCHeapObj {
+  template <typename, typename>
+  friend class RefCountPointer;
+ private:
+  const u1* const _data;
+  JfrBlobHandle _next;
+  const size_t _size;
+  mutable bool _written;
+
+  JfrBlob(const u1* data, size_t size);
+  ~JfrBlob();
+
+ public:
+  void set_next(const JfrBlobHandle& ref);
+  void reset_write_state() const;
+  static JfrBlobHandle make(const u1* data, size_t size);
+  template <typename Writer>
+  void write(Writer& writer) const {
+    writer.bytes(_data, _size);
+    if (_next.valid()) {
+      _next->write(writer);
+    }
+  }
+  template <typename Writer>
+  void exclusive_write(Writer& writer) const {
+    if (_written) {
+      return;
+    }
+    writer.bytes(_data, _size);
+    _written = true;
+    if (_next.valid()) {
+      _next->exclusive_write(writer);
+    }
+  }
+};
+
+#endif // SHARE_JFR_UTILITIES_JFRBLOB_HPP
--- a/src/hotspot/share/jfr/utilities/jfrHashtable.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/utilities/jfrHashtable.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -25,13 +25,13 @@
 #ifndef SHARE_JFR_UTILITIES_JFRHASHTABLE_HPP
 #define SHARE_JFR_UTILITIES_JFRHASHTABLE_HPP
 
-#include "memory/allocation.inline.hpp"
+#include "jfr/utilities/jfrAllocation.hpp"
 #include "runtime/orderAccess.hpp"
 #include "utilities/debug.hpp"
 #include "utilities/macros.hpp"
 
 template <typename T>
-class JfrBasicHashtableEntry {
+class JfrBasicHashtableEntry : public JfrCHeapObj {
  private:
   typedef JfrBasicHashtableEntry<T> Entry;
   Entry* _next;
@@ -39,8 +39,8 @@
   uintptr_t _hash;
 
  public:
+  JfrBasicHashtableEntry(uintptr_t hash, const T& data) : _next(NULL), _literal(data), _hash(hash) {}
   uintptr_t hash() const { return _hash; }
-  void set_hash(uintptr_t hash) { _hash = hash; }
   T literal() const { return _literal; }
   T* literal_addr() { return &_literal; }
   void set_literal(T s) { _literal = s; }
@@ -93,7 +93,6 @@
   }
   void free_buckets() {
     FREE_C_HEAP_ARRAY(Bucket, _buckets);
-    _buckets = NULL;
   }
   TableEntry* bucket(size_t i) { return _buckets[i].get_entry();}
   TableEntry** bucket_addr(size_t i) { return _buckets[i].entry_addr(); }
@@ -108,18 +107,18 @@
 };
 
 template <typename IdType, typename Entry, typename T>
-class AscendingId : public CHeapObj<mtTracing>  {
+class AscendingId : public JfrCHeapObj  {
  private:
   IdType _id;
  public:
   AscendingId() : _id(0) {}
   // callbacks
-  void assign_id(Entry* entry) {
+  void on_link(Entry* entry) {
     assert(entry != NULL, "invariant");
     assert(entry->id() == 0, "invariant");
     entry->set_id(++_id);
   }
-  bool equals(const T& data, uintptr_t hash, const Entry* entry) {
+  bool on_equals(uintptr_t hash, const Entry* entry) {
     assert(entry->hash() == hash, "invariant");
     return true;
   }
@@ -127,18 +126,16 @@
 
 // IdType must be scalar
 template <typename T, typename IdType>
-class Entry : public JfrBasicHashtableEntry<T> {
+class JfrHashtableEntry : public JfrBasicHashtableEntry<T> {
  public:
+  JfrHashtableEntry(uintptr_t hash, const T& data) : JfrBasicHashtableEntry<T>(hash, data), _id(0) {}
   typedef IdType ID;
-  void init() { _id = 0; }
   ID id() const { return _id; }
-  void set_id(ID id) { _id = id; }
-  void set_value(const T& value) { this->set_literal(value); }
-  T& value() const { return *const_cast<Entry*>(this)->literal_addr();}
-  const T* value_addr() const { return const_cast<Entry*>(this)->literal_addr(); }
-
+  void set_id(ID id) const { _id = id; }
+  T& value() const { return *const_cast<JfrHashtableEntry*>(this)->literal_addr();}
+  const T* value_addr() const { return const_cast<JfrHashtableEntry*>(this)->literal_addr(); }
  private:
-  ID _id;
+  mutable ID _id;
 };
 
 template <typename T, typename IdType, template <typename, typename> class Entry,
@@ -147,29 +144,28 @@
 class HashTableHost : public JfrBasicHashtable<T> {
  public:
   typedef Entry<T, IdType> HashEntry;
-  HashTableHost() : _callback(new Callback()) {}
-  HashTableHost(Callback* cb) : JfrBasicHashtable<T>(TABLE_SIZE, sizeof(HashEntry)), _callback(cb) {}
+  HashTableHost(size_t size = 0) : JfrBasicHashtable<T>(size == 0 ? TABLE_SIZE : size, sizeof(HashEntry)), _callback(new Callback()) {}
+  HashTableHost(Callback* cb, size_t size = 0) : JfrBasicHashtable<T>(size == 0 ? TABLE_SIZE : size, sizeof(HashEntry)), _callback(cb) {}
   ~HashTableHost() {
     this->clear_entries();
     this->free_buckets();
   }
 
   // direct insert assumes non-existing entry
-  HashEntry& put(const T& data, uintptr_t hash);
+  HashEntry& put(uintptr_t hash, const T& data);
 
   // lookup entry, will put if not found
-  HashEntry& lookup_put(const T& data, uintptr_t hash) {
-    HashEntry* entry = lookup_only(data, hash);
-    return entry == NULL ? put(data, hash) : *entry;
+  HashEntry& lookup_put(uintptr_t hash, const T& data) {
+    HashEntry* entry = lookup_only(hash);
+    return entry == NULL ? put(hash, data) : *entry;
   }
 
-  // read-only lookup
-  HashEntry* lookup_only(const T& query, uintptr_t hash);
+  HashEntry* lookup_only(uintptr_t hash);
 
   // id retrieval
-  IdType id(const T& data, uintptr_t hash) {
+  IdType id(uintptr_t hash, const T& data) {
     assert(data != NULL, "invariant");
-    const HashEntry& entry = lookup_put(data, hash);
+    const HashEntry& entry = lookup_put(hash, data);
     assert(entry.id() > 0, "invariant");
     return entry.id();
   }
@@ -188,34 +184,35 @@
   void free_entry(HashEntry* entry) {
     assert(entry != NULL, "invariant");
     JfrBasicHashtable<T>::unlink_entry(entry);
-    FREE_C_HEAP_ARRAY(char, entry);
+    _callback->on_unlink(entry);
+    delete entry;
   }
 
  private:
   Callback* _callback;
   size_t index_for(uintptr_t hash) { return this->hash_to_index(hash); }
-  HashEntry* new_entry(const T& data, uintptr_t hash);
+  HashEntry* new_entry(uintptr_t hash, const T& data);
   void add_entry(size_t index, HashEntry* new_entry) {
     assert(new_entry != NULL, "invariant");
-    _callback->assign_id(new_entry);
+    _callback->on_link(new_entry);
     assert(new_entry->id() > 0, "invariant");
     JfrBasicHashtable<T>::add_entry(index, new_entry);
   }
 };
 
 template <typename T, typename IdType, template <typename, typename> class Entry, typename Callback, size_t TABLE_SIZE>
-Entry<T, IdType>& HashTableHost<T, IdType, Entry, Callback, TABLE_SIZE>::put(const T& data, uintptr_t hash) {
-  assert(lookup_only(data, hash) == NULL, "use lookup_put()");
-  HashEntry* const entry = new_entry(data, hash);
+Entry<T, IdType>& HashTableHost<T, IdType, Entry, Callback, TABLE_SIZE>::put(uintptr_t hash, const T& data) {
+  assert(lookup_only(hash) == NULL, "use lookup_put()");
+  HashEntry* const entry = new_entry(hash, data);
   add_entry(index_for(hash), entry);
   return *entry;
 }
 
 template <typename T, typename IdType, template <typename, typename> class Entry, typename Callback, size_t TABLE_SIZE>
-Entry<T, IdType>* HashTableHost<T, IdType, Entry, Callback, TABLE_SIZE>::lookup_only(const T& query, uintptr_t hash) {
+Entry<T, IdType>* HashTableHost<T, IdType, Entry, Callback, TABLE_SIZE>::lookup_only(uintptr_t hash) {
   HashEntry* entry = (HashEntry*)this->bucket(index_for(hash));
   while (entry != NULL) {
-    if (entry->hash() == hash && _callback->equals(query, hash, entry)) {
+    if (entry->hash() == hash && _callback->on_equals(hash, entry)) {
       return entry;
     }
     entry = (HashEntry*)entry->next();
@@ -267,13 +264,10 @@
 }
 
 template <typename T, typename IdType, template <typename, typename> class Entry, typename Callback, size_t TABLE_SIZE>
-Entry<T, IdType>* HashTableHost<T, IdType, Entry, Callback, TABLE_SIZE>::new_entry(const T& data, uintptr_t hash) {
+Entry<T, IdType>* HashTableHost<T, IdType, Entry, Callback, TABLE_SIZE>::new_entry(uintptr_t hash, const T& data) {
   assert(sizeof(HashEntry) == this->entry_size(), "invariant");
-  HashEntry* const entry = (HashEntry*) NEW_C_HEAP_ARRAY2(char, this->entry_size(), mtTracing, CURRENT_PC);
-  entry->init();
-  entry->set_hash(hash);
-  entry->set_value(data);
-  entry->set_next(NULL);
+  HashEntry* const entry = new HashEntry(hash, data);
+  assert(entry != NULL, "invariant");
   assert(0 == entry->id(), "invariant");
   return entry;
 }
--- a/src/hotspot/share/jfr/utilities/jfrTypes.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/utilities/jfrTypes.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -26,8 +26,6 @@
 #define SHARE_JFR_UTILITIES_JFRTYPES_HPP
 
 #include "jfrfiles/jfrEventIds.hpp"
-#include "memory/allocation.hpp"
-#include "utilities/globalDefinitions.hpp"
 
 typedef u8 traceid;
 typedef int fio_fd;
@@ -37,6 +35,14 @@
 const u4 MIN_STACK_DEPTH = 1;
 const u4 MAX_STACK_DEPTH = 2048;
 
+inline int compare_traceid(const traceid& lhs, const traceid& rhs) {
+  return lhs > rhs ? 1 : (lhs < rhs) ? -1 : 0;
+}
+
+inline int sort_traceid(traceid* lhs, traceid* rhs) {
+  return compare_traceid(*lhs, *rhs);
+}
+
 enum EventStartTime {
   UNTIMED,
   TIMED
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/jfr/writers/jfrTypeWriterHost.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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_JFR_WRITERS_JFRTYPEWRITERHOST_HPP
+#define SHARE_JFR_WRITERS_JFRTYPEWRITERHOST_HPP
+
+#include "jfr/recorder/checkpoint/jfrCheckpointWriter.hpp"
+#include "jfr/utilities/jfrTypes.hpp"
+#include "memory/allocation.hpp"
+
+template <typename WriterImpl, u4 ID>
+class JfrTypeWriterHost : public StackObj {
+ private:
+  WriterImpl _impl;
+  JfrCheckpointWriter* _writer;
+  JfrCheckpointContext _ctx;
+  int64_t _count_offset;
+  int _count;
+  bool _skip_header;
+ public:
+  JfrTypeWriterHost(JfrCheckpointWriter* writer,
+                    bool class_unload = false,
+                    bool skip_header = false) : _impl(writer, class_unload),
+                                                _writer(writer),
+                                                _ctx(writer->context()),
+                                                _count(0),
+                                                _skip_header(skip_header) {
+    assert(_writer != NULL, "invariant");
+    if (!_skip_header) {
+      _writer->write_type((JfrTypeId)ID);
+      _count_offset = _writer->reserve(sizeof(u4)); // Don't know how many yet
+    }
+  }
+
+  ~JfrTypeWriterHost() {
+    if (_count == 0) {
+      // nothing written, restore context for rewind
+      _writer->set_context(_ctx);
+      return;
+    }
+    assert(_count > 0, "invariant");
+    if (!_skip_header) {
+      _writer->write_count(_count, _count_offset);
+    }
+  }
+
+  bool operator()(typename WriterImpl::Type const & value) {
+    this->_count += _impl(value);
+    return true;
+  }
+
+  int count() const   { return _count; }
+  void add(int count) { _count += count; }
+};
+
+typedef int(*type_write_operation)(JfrCheckpointWriter*, const void*);
+
+template <typename T, type_write_operation op>
+class JfrTypeWriterImplHost {
+ private:
+  JfrCheckpointWriter* _writer;
+ public:
+  typedef T Type;
+  JfrTypeWriterImplHost(JfrCheckpointWriter* writer, bool class_unload = false) : _writer(writer) {}
+  int operator()(T const& value) {
+    return op(this->_writer, value);
+  }
+};
+
+template <typename T, typename Predicate, type_write_operation op>
+class JfrPredicatedTypeWriterImplHost : public JfrTypeWriterImplHost<T, op> {
+ private:
+  Predicate _predicate;
+  typedef JfrTypeWriterImplHost<T, op> Parent;
+ public:
+  JfrPredicatedTypeWriterImplHost(JfrCheckpointWriter* writer, bool class_unload = false) :
+    Parent(writer), _predicate(class_unload) {}
+  int operator()(T const& value) {
+    return _predicate(value) ? Parent::operator()(value) : 0;
+  }
+};
+
+#endif // SHARE_JFR_WRITERS_JFRTYPEWRITERHOST_HPP
--- a/src/hotspot/share/jfr/writers/jfrWriterHost.inline.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jfr/writers/jfrWriterHost.inline.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -170,7 +170,7 @@
   }
   if (this->available_size() < requested + size_safety_cushion) {
     if (!this->accommodate(this->used_size(), requested + size_safety_cushion)) {
-      this->cancel();
+      assert(!this->is_valid(), "invariant");
       return NULL;
     }
   }
--- a/src/hotspot/share/jvmci/jvmciCompiler.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jvmci/jvmciCompiler.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -123,7 +123,7 @@
     if (excludeModules.not_null()) {
       ModuleEntry* moduleEntry = method->method_holder()->module();
       for (int i = 0; i < excludeModules->length(); i++) {
-        if (oopDesc::equals(excludeModules->obj_at(i), moduleEntry->module())) {
+        if (excludeModules->obj_at(i) == moduleEntry->module()) {
           return true;
         }
       }
--- a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1034,7 +1034,7 @@
 
   if (jap.get_ret_type() == T_VOID) {
     return NULL;
-  } else if (jap.get_ret_type() == T_OBJECT || jap.get_ret_type() == T_ARRAY) {
+  } else if (is_reference_type(jap.get_ret_type())) {
     return JNIHandles::make_local((oop) result.get_jobject());
   } else {
     jvalue *value = (jvalue *) result.get_value_addr();
@@ -1149,8 +1149,8 @@
   return (jint) JVMCICounterSize;
 C2V_END
 
-C2V_VMENTRY_0(jboolean, setCountersSize, (JNIEnv* env, jobject, jint new_size))
-  return JavaThread::resize_all_jvmci_counters(new_size);
+C2V_VMENTRY(void, setCountersSize, (JNIEnv* env, jobject, jint new_size))
+  JavaThread::resize_all_jvmci_counters(new_size);
 C2V_END
 
 C2V_VMENTRY_0(jint, allocateCompileId, (JNIEnv* env, jobject, jobject jvmci_method, int entry_bci))
@@ -2696,7 +2696,7 @@
   {CC "readUncompressedOop",                          CC "(J)" OBJECTCONSTANT,                                                              FN_PTR(readUncompressedOop)},
   {CC "collectCounters",                              CC "()[J",                                                                            FN_PTR(collectCounters)},
   {CC "getCountersSize",                              CC "()I",                                                                             FN_PTR(getCountersSize)},
-  {CC "setCountersSize",                              CC "(I)Z",                                                                            FN_PTR(setCountersSize)},
+  {CC "setCountersSize",                              CC "(I)V",                                                                            FN_PTR(setCountersSize)},
   {CC "allocateCompileId",                            CC "(" HS_RESOLVED_METHOD "I)I",                                                      FN_PTR(allocateCompileId)},
   {CC "isMature",                                     CC "(" METASPACE_METHOD_DATA ")Z",                                                    FN_PTR(isMature)},
   {CC "hasCompiledCodeForOSR",                        CC "(" HS_RESOLVED_METHOD "II)Z",                                                     FN_PTR(hasCompiledCodeForOSR)},
--- a/src/hotspot/share/jvmci/jvmciEnv.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jvmci/jvmciEnv.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -31,6 +31,7 @@
 #include "memory/universe.hpp"
 #include "oops/objArrayKlass.hpp"
 #include "oops/typeArrayOop.inline.hpp"
+#include "runtime/deoptimization.hpp"
 #include "runtime/jniHandles.inline.hpp"
 #include "runtime/javaCalls.hpp"
 #include "jvmci/jniAccessMark.inline.hpp"
@@ -1491,8 +1492,7 @@
     // Invalidating the HotSpotNmethod means we want the nmethod
     // to be deoptimized.
     nm->mark_for_deoptimization();
-    VM_Deoptimize op;
-    VMThread::execute(&op);
+    Deoptimization::deoptimize_all_marked();
   }
 
   // A HotSpotNmethod instance can only reference a single nmethod
--- a/src/hotspot/share/jvmci/jvmciRuntime.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/jvmci/jvmciRuntime.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -631,7 +631,7 @@
     // The other thread may exit during this process, which is ok so return false.
     return JNI_FALSE;
   } else {
-    return (jint) Thread::is_interrupted(receiverThread, clear_interrupted != 0);
+    return (jint) receiverThread->is_interrupted(clear_interrupted != 0);
   }
 JRT_END
 
@@ -1520,7 +1520,10 @@
                         comp_level, method_name, nm->entry_point());
             }
             // Allow the code to be executed
-            method->set_code(method, nm);
+            MutexLocker ml(CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
+            if (nm->make_in_use()) {
+              method->set_code(method, nm);
+            }
           } else {
             LogTarget(Info, nmethod, install) lt;
             if (lt.is_enabled()) {
@@ -1529,12 +1532,14 @@
               lt.print("Installing osr method (%d) %s @ %d",
                         comp_level, method_name, entry_bci);
             }
-            InstanceKlass::cast(method->method_holder())->add_osr_nmethod(nm);
+            MutexLocker ml(CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
+            if (nm->make_in_use()) {
+              InstanceKlass::cast(method->method_holder())->add_osr_nmethod(nm);
+            }
           }
         } else {
           assert(!nmethod_mirror.is_hotspot() || data->get_nmethod_mirror(nm, /* phantom_ref */ false) == HotSpotJVMCI::resolve(nmethod_mirror), "must be");
         }
-        nm->make_in_use();
       }
       result = nm != NULL ? JVMCI::ok :JVMCI::cache_full;
     }
--- a/src/hotspot/share/memory/dynamicArchive.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/memory/dynamicArchive.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -470,7 +470,8 @@
   void sort_methods(InstanceKlass* ik) const;
   void set_symbols_permanent();
   void relocate_buffer_to_target();
-  void write_archive(char* read_only_tables_start);
+  void write_archive(char* serialized_data_start);
+  void write_regions(FileMapInfo* dynamic_info);
 
   void init_first_dump_space(address reserved_bottom) {
     address first_space_base = reserved_bottom;
@@ -595,7 +596,7 @@
 
     verify_estimate_size(_estimated_metsapceobj_bytes, "MetaspaceObjs");
 
-    char* read_only_tables_start;
+    char* serialized_data_start;
     {
       set_symbols_permanent();
 
@@ -608,7 +609,7 @@
       SymbolTable::write_to_archive(false);
       SystemDictionaryShared::write_to_archive(false);
 
-      read_only_tables_start = ro_space->top();
+      serialized_data_start = ro_space->top();
       WriteClosure wc(ro_space);
       SymbolTable::serialize_shared_table_header(&wc, false);
       SystemDictionaryShared::serialize_dictionary_headers(&wc, false);
@@ -634,7 +635,7 @@
       relocate_buffer_to_target();
     }
 
-    write_archive(read_only_tables_start);
+    write_archive(serialized_data_start);
 
     assert(_num_dump_regions_used == _total_dump_regions, "must be");
     verify_universe("After CDS dynamic dump");
@@ -911,9 +912,7 @@
  _header->relocate_shared_path_table(table);
 }
 
-static void write_archive_info(FileMapInfo* dynamic_info, DynamicArchiveHeader *header) {
-  dynamic_info->write_header();
-  dynamic_info->align_file_position();
+void DynamicArchiveBuilder::write_regions(FileMapInfo* dynamic_info) {
   dynamic_info->write_region(MetaspaceShared::rw,
                              MetaspaceShared::read_write_dump_space()->base(),
                              MetaspaceShared::read_write_dump_space()->used(),
@@ -928,28 +927,23 @@
                              /*read_only=*/false,/*allow_exec=*/true);
 }
 
-void DynamicArchiveBuilder::write_archive(char* read_only_tables_start) {
+void DynamicArchiveBuilder::write_archive(char* serialized_data_start) {
   int num_klasses = _klasses->length();
   int num_symbols = _symbols->length();
 
-  _header->set_read_only_tables_start(to_target(read_only_tables_start));
+  _header->set_serialized_data_start(to_target(serialized_data_start));
 
   FileMapInfo* dynamic_info = FileMapInfo::dynamic_info();
   assert(dynamic_info != NULL, "Sanity");
 
-  // Populate the file offsets, region crcs, etc. No data is written out.
-  write_archive_info(dynamic_info, _header);
-
-  // the header will no longer change. Compute its crc.
-  dynamic_info->set_header_crc(dynamic_info->compute_header_crc());
-
   // Now write the archived data including the file offsets.
   const char* archive_name = Arguments::GetSharedDynamicArchivePath();
   dynamic_info->open_for_write(archive_name);
-  write_archive_info(dynamic_info, _header);
+  write_regions(dynamic_info);
+  dynamic_info->set_header_crc(dynamic_info->compute_header_crc());
+  dynamic_info->write_header();
   dynamic_info->close();
 
-
   address base = to_target(_alloc_bottom);
   address top  = address(current_dump_space()->top()) + _buffer_to_target_delta;
   size_t file_size = pointer_delta(top, base, sizeof(char));
@@ -1108,7 +1102,7 @@
     return NULL;
   }
 
-  intptr_t* buffer = (intptr_t*)_dynamic_header->read_only_tables_start();
+  intptr_t* buffer = (intptr_t*)_dynamic_header->serialized_data_start();
   ReadClosure rc(&buffer);
   SymbolTable::serialize_shared_table_header(&rc, false);
   SystemDictionaryShared::serialize_dictionary_headers(&rc, false);
--- a/src/hotspot/share/memory/filemap.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/memory/filemap.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1033,6 +1033,11 @@
   return true;
 }
 
+void FileMapInfo::seek_to_position(size_t pos) {
+  if (lseek(_fd, (long)pos, SEEK_SET) < 0) {
+    fail_stop("Unable to seek to position " SIZE_FORMAT, pos);
+  }
+}
 
 // Read the FileMapInfo information from the file.
 bool FileMapInfo::open_for_read(const char* path) {
@@ -1088,14 +1093,26 @@
               os::strerror(errno));
   }
   _fd = fd;
-  _file_offset = 0;
   _file_open = true;
+
+  // Seek past the header. We will write the header after all regions are written
+  // and their CRCs computed.
+  size_t header_bytes = header()->header_size();
+  if (header()->magic() == CDS_DYNAMIC_ARCHIVE_MAGIC) {
+    header_bytes += strlen(Arguments::GetSharedArchivePath()) + 1;
+  }
+
+  header_bytes = align_up(header_bytes, os::vm_allocation_granularity());
+  _file_offset = header_bytes;
+  seek_to_position(_file_offset);
 }
 
 
 // Write the header to the file, seek to the next allocation boundary.
 
 void FileMapInfo::write_header() {
+  _file_offset = 0;
+  seek_to_position(_file_offset);
   char* base_archive_name = NULL;
   if (header()->magic() == CDS_DYNAMIC_ARCHIVE_MAGIC) {
     base_archive_name = (char*)Arguments::GetSharedArchivePath();
@@ -1108,7 +1125,6 @@
   if (base_archive_name != NULL) {
     write_bytes(base_archive_name, header()->base_archive_name_size());
   }
-  align_file_position();
 }
 
 void FileMapRegion::init(bool is_heap_region, char* base, size_t size, bool read_only,
@@ -1132,9 +1148,6 @@
   _crc = crc;
 }
 
-// Dump region to file.
-// This is called twice for each region during archiving, once before
-// the archive file is open (_file_open is false) and once after.
 void FileMapInfo::write_region(int region, char* base, size_t size,
                                bool read_only, bool allow_exec) {
   assert(DumpSharedSpaces || DynamicDumpSharedSpaces, "Dump time only");
@@ -1146,14 +1159,10 @@
     target_base = DynamicArchive::buffer_to_target(base);
   }
 
-  if (_file_open) {
-    guarantee(si->file_offset() == _file_offset, "file offset mismatch.");
-    log_info(cds)("Shared file region %d: " SIZE_FORMAT_HEX_W(08)
-                  " bytes, addr " INTPTR_FORMAT " file offset " SIZE_FORMAT_HEX_W(08),
-                  region, size, p2i(target_base), _file_offset);
-  } else {
-    si->set_file_offset(_file_offset);
-  }
+  si->set_file_offset(_file_offset);
+  log_info(cds)("Shared file region %d: " SIZE_FORMAT_HEX_W(08)
+                " bytes, addr " INTPTR_FORMAT " file offset " SIZE_FORMAT_HEX_W(08),
+                region, size, p2i(target_base), _file_offset);
 
   int crc = ClassLoader::crc32(0, base, (jint)size);
   si->init(HeapShared::is_heap_region(region), target_base, size, read_only, allow_exec, crc);
@@ -1196,8 +1205,7 @@
 //             +-- gap
 size_t FileMapInfo::write_archive_heap_regions(GrowableArray<MemRegion> *heap_mem,
                                                GrowableArray<ArchiveHeapOopmapInfo> *oopmaps,
-                                               int first_region_id, int max_num_regions,
-                                               bool print_log) {
+                                               int first_region_id, int max_num_regions) {
   assert(max_num_regions <= 2, "Only support maximum 2 memory regions");
 
   int arr_len = heap_mem == NULL ? 0 : heap_mem->length();
@@ -1221,10 +1229,8 @@
       total_size += size;
     }
 
-    if (print_log) {
-      log_info(cds)("Archive heap region %d " INTPTR_FORMAT " - " INTPTR_FORMAT " = " SIZE_FORMAT_W(8) " bytes",
-                    i, p2i(start), p2i(start + size), size);
-    }
+    log_info(cds)("Archive heap region %d " INTPTR_FORMAT " - " INTPTR_FORMAT " = " SIZE_FORMAT_W(8) " bytes",
+                  i, p2i(start), p2i(start + size), size);
     write_region(i, start, size, false, false);
     if (size > 0) {
       space_at(i)->init_oopmap(oopmaps->at(arr_idx)._oopmap,
@@ -1237,14 +1243,13 @@
 // Dump bytes to file -- at the current file position.
 
 void FileMapInfo::write_bytes(const void* buffer, size_t nbytes) {
-  if (_file_open) {
-    size_t n = os::write(_fd, buffer, (unsigned int)nbytes);
-    if (n != nbytes) {
-      // If the shared archive is corrupted, close it and remove it.
-      close();
-      remove(_full_path);
-      fail_stop("Unable to write to shared archive file.");
-    }
+  assert(_file_open, "must be");
+  size_t n = os::write(_fd, buffer, (unsigned int)nbytes);
+  if (n != nbytes) {
+    // If the shared archive is corrupted, close it and remove it.
+    close();
+    remove(_full_path);
+    fail_stop("Unable to write to shared archive file.");
   }
   _file_offset += nbytes;
 }
@@ -1257,20 +1262,17 @@
 // Align file position to an allocation unit boundary.
 
 void FileMapInfo::align_file_position() {
+  assert(_file_open, "must be");
   size_t new_file_offset = align_up(_file_offset,
-                                         os::vm_allocation_granularity());
+                                    os::vm_allocation_granularity());
   if (new_file_offset != _file_offset) {
     _file_offset = new_file_offset;
-    if (_file_open) {
-      // Seek one byte back from the target and write a byte to insure
-      // that the written file is the correct length.
-      _file_offset -= 1;
-      if (lseek(_fd, (long)_file_offset, SEEK_SET) < 0) {
-        fail_stop("Unable to seek.");
-      }
-      char zero = 0;
-      write_bytes(&zero, 1);
-    }
+    // Seek one byte back from the target and write a byte to insure
+    // that the written file is the correct length.
+    _file_offset -= 1;
+    seek_to_position(_file_offset);
+    char zero = 0;
+    write_bytes(&zero, 1);
   }
 }
 
--- a/src/hotspot/share/memory/filemap.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/memory/filemap.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -179,10 +179,8 @@
   CompressedOops::Mode _narrow_oop_mode; // compressed oop encoding mode
   int     _narrow_klass_shift;      // save narrow klass base and shift
   address _narrow_klass_base;
-
-
   char*   _misc_data_patching_start;
-  char*   _read_only_tables_start;
+  char*   _serialized_data_start;  // Data accessed using {ReadClosure,WriteClosure}::serialize()
   address _i2i_entry_code_buffers;
   size_t  _i2i_entry_code_buffers_size;
   size_t  _core_spaces_size;        // number of bytes allocated by the core spaces
@@ -238,7 +236,7 @@
   int narrow_klass_shift()                 const { return _narrow_klass_shift; }
   address narrow_klass_base()              const { return _narrow_klass_base; }
   char* misc_data_patching_start()         const { return _misc_data_patching_start; }
-  char* read_only_tables_start()           const { return _read_only_tables_start; }
+  char* serialized_data_start()            const { return _serialized_data_start; }
   address i2i_entry_code_buffers()         const { return _i2i_entry_code_buffers; }
   size_t i2i_entry_code_buffers_size()     const { return _i2i_entry_code_buffers_size; }
   size_t core_spaces_size()                const { return _core_spaces_size; }
@@ -259,7 +257,7 @@
   void set_core_spaces_size(size_t s)            { _core_spaces_size = s; }
   void set_has_platform_or_app_classes(bool v)   { _has_platform_or_app_classes = v; }
   void set_misc_data_patching_start(char* p)     { _misc_data_patching_start = p; }
-  void set_read_only_tables_start(char* p)       { _read_only_tables_start   = p; }
+  void set_serialized_data_start(char* p)        { _serialized_data_start   = p; }
   void set_base_archive_name_size(size_t s)      { _base_archive_name_size = s; }
   void set_base_archive_is_default(bool b)       { _base_archive_is_default = b; }
   void set_header_size(size_t s)                 { _header_size = s; }
@@ -360,8 +358,8 @@
 
   char* misc_data_patching_start()            const { return header()->misc_data_patching_start(); }
   void  set_misc_data_patching_start(char* p) const { header()->set_misc_data_patching_start(p); }
-  char* read_only_tables_start()              const { return header()->read_only_tables_start(); }
-  void  set_read_only_tables_start(char* p)   const { header()->set_read_only_tables_start(p); }
+  char* serialized_data_start()               const { return header()->serialized_data_start(); }
+  void  set_serialized_data_start(char* p)    const { header()->set_serialized_data_start(p); }
 
   bool  is_file_position_aligned() const;
   void  align_file_position();
@@ -412,8 +410,7 @@
                      bool read_only, bool allow_exec);
   size_t write_archive_heap_regions(GrowableArray<MemRegion> *heap_mem,
                                     GrowableArray<ArchiveHeapOopmapInfo> *oopmaps,
-                                    int first_region_id, int max_num_regions,
-                                    bool print_log);
+                                    int first_region_id, int max_num_regions);
   void  write_bytes(const void* buffer, size_t count);
   void  write_bytes_aligned(const void* buffer, size_t count);
   size_t  read_bytes(void* buffer, size_t count);
@@ -479,6 +476,7 @@
   char* region_addr(int idx);
 
  private:
+  void  seek_to_position(size_t pos);
   char* skip_first_path_entry(const char* path) NOT_CDS_RETURN_(NULL);
   int   num_paths(const char* path) NOT_CDS_RETURN_(0);
   GrowableArray<const char*>* create_path_array(const char* path) NOT_CDS_RETURN_(NULL);
--- a/src/hotspot/share/memory/heapShared.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/memory/heapShared.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -583,7 +583,7 @@
   for (JavaFieldStream fs(k); !fs.done(); fs.next()) {
     if (!fs.access_flags().is_static()) {
       BasicType ft = fs.field_descriptor().field_type();
-      if (!fs.access_flags().is_final() && (ft == T_ARRAY || ft == T_OBJECT)) {
+      if (!fs.access_flags().is_final() && is_reference_type(ft)) {
         ResourceMark rm(THREAD);
         log_warning(cds, heap)(
           "Please check reference field in %s instance in closed archive heap region: %s %s",
@@ -871,7 +871,7 @@
   virtual void do_field(fieldDescriptor* fd) {
     if (fd->name() == _field_name) {
       assert(!_found, "fields cannot be overloaded");
-      assert(fd->field_type() == T_OBJECT || fd->field_type() == T_ARRAY, "can archive only obj or array fields");
+      assert(is_reference_type(fd->field_type()), "can archive only fields that are references");
       _found = true;
       _offset = fd->offset();
     }
--- a/src/hotspot/share/memory/heapShared.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/memory/heapShared.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -125,7 +125,7 @@
   static bool _archive_heap_region_fixed;
 
   static bool oop_equals(oop const& p1, oop const& p2) {
-    return oopDesc::equals(p1, p2);
+    return p1 == p2;
   }
   static unsigned oop_hash(oop const& p);
 
--- a/src/hotspot/share/memory/heapShared.inline.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/memory/heapShared.inline.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -27,6 +27,7 @@
 
 #include "oops/compressedOops.inline.hpp"
 #include "memory/heapShared.hpp"
+#include "utilities/align.hpp"
 #if INCLUDE_G1GC
 #include "gc/g1/g1Allocator.inline.hpp"
 #endif
@@ -40,7 +41,7 @@
 inline oop HeapShared::decode_from_archive(narrowOop v) {
   assert(!CompressedOops::is_null(v), "narrow oop value can never be zero");
   oop result = (oop)(void*)((uintptr_t)_narrow_oop_base + ((uintptr_t)v << _narrow_oop_shift));
-  assert(check_obj_alignment(result), "address not aligned: " INTPTR_FORMAT, p2i((void*) result));
+  assert(is_object_aligned(result), "address not aligned: " INTPTR_FORMAT, p2i((void*) result));
   return result;
 }
 
--- a/src/hotspot/share/memory/metaspaceShared.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/memory/metaspaceShared.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1137,7 +1137,9 @@
 
   VMOp_Type type() const { return VMOp_PopulateDumpSharedSpace; }
   void doit();   // outline because gdb sucks
-  static void write_region(FileMapInfo* mapinfo, int region, DumpRegion* space, bool read_only,  bool allow_exec);
+  static void write_region(FileMapInfo* mapinfo, int region_idx, DumpRegion* dump_region, bool read_only,  bool allow_exec) {
+    mapinfo->write_region(region_idx, dump_region->base(), dump_region->used(), read_only, allow_exec);
+  }
   bool allow_nested_vm_operations() const { return true; }
 }; // class VM_PopulateDumpSharedSpace
 
@@ -1406,11 +1408,6 @@
 SortedSymbolClosure* ArchiveCompactor::_ssc;
 ArchiveCompactor::RelocationTable* ArchiveCompactor::_new_loc_table;
 
-void VM_PopulateDumpSharedSpace::write_region(FileMapInfo* mapinfo, int region_idx,
-                                              DumpRegion* dump_region, bool read_only,  bool allow_exec) {
-  mapinfo->write_region(region_idx, dump_region->base(), dump_region->used(), read_only, allow_exec);
-}
-
 void VM_PopulateDumpSharedSpace::dump_symbols() {
   tty->print_cr("Dumping symbol table ...");
 
@@ -1430,12 +1427,11 @@
 
   SystemDictionaryShared::write_to_archive();
 
-  char* start = _ro_region.top();
-
   size_t vtptrs_bytes = _num_cloned_vtable_kinds * sizeof(intptr_t*);
   _cloned_cpp_vtptrs = (intptr_t**)_ro_region.allocate(vtptrs_bytes, sizeof(intptr_t*));
 
   // Write the other data to the output array.
+  char* start = _ro_region.top();
   WriteClosure wc(&_ro_region);
   MetaspaceShared::serialize(&wc);
 
@@ -1518,7 +1514,7 @@
 
   ArchiveCompactor::relocate_well_known_klasses();
 
-  char* read_only_tables_start = dump_read_only_tables();
+  char* serialized_data_start = dump_read_only_tables();
   _ro_region.pack(&_md_region);
 
   char* vtbl_list = _md_region.top();
@@ -1543,47 +1539,33 @@
 
   FileMapInfo* mapinfo = new FileMapInfo(true);
   mapinfo->populate_header(os::vm_allocation_granularity());
-  mapinfo->set_read_only_tables_start(read_only_tables_start);
+  mapinfo->set_serialized_data_start(serialized_data_start);
   mapinfo->set_misc_data_patching_start(vtbl_list);
   mapinfo->set_i2i_entry_code_buffers(MetaspaceShared::i2i_entry_code_buffers(),
-                                          MetaspaceShared::i2i_entry_code_buffers_size());
+                                      MetaspaceShared::i2i_entry_code_buffers_size());
   mapinfo->set_core_spaces_size(core_spaces_size);
+  mapinfo->open_for_write();
 
-  for (int pass=1; pass<=2; pass++) {
-    bool print_archive_log = (pass==1);
-    if (pass == 1) {
-      // The first pass doesn't actually write the data to disk. All it
-      // does is to update the fields in the mapinfo->_header.
-    } else {
-      // After the first pass, the contents of mapinfo->_header are finalized,
-      // so we can compute the header's CRC, and write the contents of the header
-      // and the regions into disk.
-      mapinfo->open_for_write();
-      mapinfo->set_header_crc(mapinfo->compute_header_crc());
-    }
-    mapinfo->write_header();
+  // NOTE: md contains the trampoline code for method entries, which are patched at run time,
+  // so it needs to be read/write.
+  write_region(mapinfo, MetaspaceShared::mc, &_mc_region, /*read_only=*/false,/*allow_exec=*/true);
+  write_region(mapinfo, MetaspaceShared::rw, &_rw_region, /*read_only=*/false,/*allow_exec=*/false);
+  write_region(mapinfo, MetaspaceShared::ro, &_ro_region, /*read_only=*/true, /*allow_exec=*/false);
+  write_region(mapinfo, MetaspaceShared::md, &_md_region, /*read_only=*/false,/*allow_exec=*/false);
 
-    // NOTE: md contains the trampoline code for method entries, which are patched at run time,
-    // so it needs to be read/write.
-    write_region(mapinfo, MetaspaceShared::mc, &_mc_region, /*read_only=*/false,/*allow_exec=*/true);
-    write_region(mapinfo, MetaspaceShared::rw, &_rw_region, /*read_only=*/false,/*allow_exec=*/false);
-    write_region(mapinfo, MetaspaceShared::ro, &_ro_region, /*read_only=*/true, /*allow_exec=*/false);
-    write_region(mapinfo, MetaspaceShared::md, &_md_region, /*read_only=*/false,/*allow_exec=*/false);
-
-    _total_closed_archive_region_size = mapinfo->write_archive_heap_regions(
+  _total_closed_archive_region_size = mapinfo->write_archive_heap_regions(
                                         _closed_archive_heap_regions,
                                         _closed_archive_heap_oopmaps,
                                         MetaspaceShared::first_closed_archive_heap_region,
-                                        MetaspaceShared::max_closed_archive_heap_region,
-                                        print_archive_log);
-    _total_open_archive_region_size = mapinfo->write_archive_heap_regions(
+                                        MetaspaceShared::max_closed_archive_heap_region);
+  _total_open_archive_region_size = mapinfo->write_archive_heap_regions(
                                         _open_archive_heap_regions,
                                         _open_archive_heap_oopmaps,
                                         MetaspaceShared::first_open_archive_heap_region,
-                                        MetaspaceShared::max_open_archive_heap_region,
-                                        print_archive_log);
-  }
+                                        MetaspaceShared::max_open_archive_heap_region);
 
+  mapinfo->set_header_crc(mapinfo->compute_header_crc());
+  mapinfo->write_header();
   mapinfo->close();
 
   // Restore the vtable in case we invoke any virtual methods.
@@ -2050,14 +2032,9 @@
   char* buffer = mapinfo->misc_data_patching_start();
   clone_cpp_vtables((intptr_t*)buffer);
 
-  // The rest of the data is now stored in the RW region
-  buffer = mapinfo->read_only_tables_start();
-
-  // Skip over _cloned_cpp_vtptrs;
-  buffer += _num_cloned_vtable_kinds * sizeof(intptr_t*);
-
   // Verify various attributes of the archive, plus initialize the
   // shared string/symbol tables
+  buffer = mapinfo->serialized_data_start();
   intptr_t* array = (intptr_t*)buffer;
   ReadClosure rc(&array);
   serialize(&rc);
--- a/src/hotspot/share/memory/universe.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/memory/universe.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -571,13 +571,13 @@
   // preallocated errors with backtrace have been consumed. Also need to avoid
   // a potential loop which could happen if an out of memory occurs when attempting
   // to allocate the backtrace.
-  return ((!oopDesc::equals(throwable(), Universe::_out_of_memory_error_java_heap)) &&
-          (!oopDesc::equals(throwable(), Universe::_out_of_memory_error_metaspace))  &&
-          (!oopDesc::equals(throwable(), Universe::_out_of_memory_error_class_metaspace))  &&
-          (!oopDesc::equals(throwable(), Universe::_out_of_memory_error_array_size)) &&
-          (!oopDesc::equals(throwable(), Universe::_out_of_memory_error_gc_overhead_limit)) &&
-          (!oopDesc::equals(throwable(), Universe::_out_of_memory_error_realloc_objects)) &&
-          (!oopDesc::equals(throwable(), Universe::_out_of_memory_error_retry)));
+  return ((throwable() != Universe::_out_of_memory_error_java_heap) &&
+          (throwable() != Universe::_out_of_memory_error_metaspace)  &&
+          (throwable() != Universe::_out_of_memory_error_class_metaspace)  &&
+          (throwable() != Universe::_out_of_memory_error_array_size) &&
+          (throwable() != Universe::_out_of_memory_error_gc_overhead_limit) &&
+          (throwable() != Universe::_out_of_memory_error_realloc_objects) &&
+          (throwable() != Universe::_out_of_memory_error_retry));
 }
 
 
--- a/src/hotspot/share/oops/access.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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 "oops/access.inline.hpp"
-#include "oops/accessDecorators.hpp"
-
-// This macro allows instantiating selected accesses to be usable from the
-// access.hpp file, to break dependencies to the access.inline.hpp file.
-#define INSTANTIATE_HPP_ACCESS(decorators, T, barrier_type)  \
-  template struct RuntimeDispatch<DecoratorFixup<decorators>::value, T, barrier_type>
-
-namespace AccessInternal {
-  INSTANTIATE_HPP_ACCESS(DECORATORS_NONE, oop, BARRIER_EQUALS);
-}
--- a/src/hotspot/share/oops/access.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/oops/access.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -58,7 +58,6 @@
 // * arraycopy: Copy data from one heap array to another heap array. The ArrayAccess class has convenience functions for this.
 // * clone: Clone the contents of an object to a newly allocated object.
 // * resolve: Resolve a stable to-space invariant oop that is guaranteed not to relocate its payload until a subsequent thread transition.
-// * equals: Object equality, e.g. when different copies of the same objects are in use (from-space vs. to-space)
 //
 // == IMPLEMENTATION ==
 // Each access goes through the following steps in a template pipeline.
@@ -275,11 +274,6 @@
     verify_decorators<DECORATORS_NONE>();
     return AccessInternal::resolve<decorators>(obj);
   }
-
-  static bool equals(oop o1, oop o2) {
-    verify_decorators<AS_RAW>();
-    return AccessInternal::equals<decorators>(o1, o2);
-  }
 };
 
 // Helper for performing raw accesses (knows only of memory ordering
--- a/src/hotspot/share/oops/access.inline.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/oops/access.inline.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -206,13 +206,6 @@
     }
   };
 
-  template <class GCBarrierType, DecoratorSet decorators>
-  struct PostRuntimeDispatch<GCBarrierType, BARRIER_EQUALS, decorators>: public AllStatic {
-    static bool access_barrier(oop o1, oop o2) {
-      return GCBarrierType::equals(o1, o2);
-    }
-  };
-
   // Resolving accessors with barriers from the barrier set happens in two steps.
   // 1. Expand paths with runtime-decorators, e.g. is UseCompressedOops on or off.
   // 2. Expand paths for each BarrierSet available in the system.
@@ -367,13 +360,6 @@
     _resolve_func = function;
     return function(obj);
   }
-
-  template <DecoratorSet decorators, typename T>
-  bool RuntimeDispatch<decorators, T, BARRIER_EQUALS>::equals_init(oop o1, oop o2) {
-    func_t function = BarrierResolver<decorators, func_t, BARRIER_EQUALS>::resolve_barrier();
-    _equals_func = function;
-    return function(o1, o2);
-  }
 }
 
 #endif // SHARE_OOPS_ACCESS_INLINE_HPP
--- a/src/hotspot/share/oops/accessBackend.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/oops/accessBackend.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -64,8 +64,7 @@
     BARRIER_ATOMIC_XCHG_AT,
     BARRIER_ARRAYCOPY,
     BARRIER_CLONE,
-    BARRIER_RESOLVE,
-    BARRIER_EQUALS
+    BARRIER_RESOLVE
   };
 
   template <DecoratorSet decorators, typename T>
@@ -116,7 +115,6 @@
                                      size_t length);
     typedef void (*clone_func_t)(oop src, oop dst, size_t size);
     typedef oop (*resolve_func_t)(oop obj);
-    typedef bool (*equals_func_t)(oop o1, oop o2);
   };
 
   template <DecoratorSet decorators>
@@ -144,7 +142,6 @@
   ACCESS_GENERATE_ACCESS_FUNCTION(BARRIER_ARRAYCOPY, arraycopy_func_t);
   ACCESS_GENERATE_ACCESS_FUNCTION(BARRIER_CLONE, clone_func_t);
   ACCESS_GENERATE_ACCESS_FUNCTION(BARRIER_RESOLVE, resolve_func_t);
-  ACCESS_GENERATE_ACCESS_FUNCTION(BARRIER_EQUALS, equals_func_t);
 #undef ACCESS_GENERATE_ACCESS_FUNCTION
 
   template <DecoratorSet decorators, typename T, BarrierType barrier_type>
@@ -410,8 +407,6 @@
   static void clone(oop src, oop dst, size_t size);
 
   static oop resolve(oop obj) { return obj; }
-
-  static bool equals(oop o1, oop o2) { return (void*)o1 == (void*)o2; }
 };
 
 // Below is the implementation of the first 4 steps of the template pipeline:
@@ -605,18 +600,6 @@
     }
   };
 
-  template <DecoratorSet decorators, typename T>
-  struct RuntimeDispatch<decorators, T, BARRIER_EQUALS>: AllStatic {
-    typedef typename AccessFunction<decorators, T, BARRIER_EQUALS>::type func_t;
-    static func_t _equals_func;
-
-    static bool equals_init(oop o1, oop o2);
-
-    static inline bool equals(oop o1, oop o2) {
-      return _equals_func(o1, o2);
-    }
-  };
-
   // Initialize the function pointers to point to the resolving function.
   template <DecoratorSet decorators, typename T>
   typename AccessFunction<decorators, T, BARRIER_STORE>::type
@@ -662,10 +645,6 @@
   typename AccessFunction<decorators, T, BARRIER_RESOLVE>::type
   RuntimeDispatch<decorators, T, BARRIER_RESOLVE>::_resolve_func = &resolve_init;
 
-  template <DecoratorSet decorators, typename T>
-  typename AccessFunction<decorators, T, BARRIER_EQUALS>::type
-  RuntimeDispatch<decorators, T, BARRIER_EQUALS>::_equals_func = &equals_init;
-
   // Step 3: Pre-runtime dispatching.
   // The PreRuntimeDispatch class is responsible for filtering the barrier strength
   // decorators. That is, for AS_RAW, it hardwires the accesses without a runtime
@@ -996,21 +975,6 @@
     resolve(oop obj) {
       return RuntimeDispatch<decorators, oop, BARRIER_RESOLVE>::resolve(obj);
     }
-
-    template <DecoratorSet decorators>
-    inline static typename EnableIf<
-      HasDecorator<decorators, AS_RAW>::value || HasDecorator<decorators, INTERNAL_BT_TO_SPACE_INVARIANT>::value, bool>::type
-    equals(oop o1, oop o2) {
-      typedef RawAccessBarrier<decorators & RAW_DECORATOR_MASK> Raw;
-      return Raw::equals(o1, o2);
-    }
-
-    template <DecoratorSet decorators>
-    inline static typename EnableIf<
-      !HasDecorator<decorators, AS_RAW>::value && !HasDecorator<decorators, INTERNAL_BT_TO_SPACE_INVARIANT>::value, bool>::type
-    equals(oop o1, oop o2) {
-      return RuntimeDispatch<decorators, oop, BARRIER_EQUALS>::equals(o1, o2);
-    }
   };
 
   // Step 2: Reduce types.
@@ -1309,12 +1273,6 @@
     return PreRuntimeDispatch::resolve<expanded_decorators>(obj);
   }
 
-  template <DecoratorSet decorators>
-  inline bool equals(oop o1, oop o2) {
-    const DecoratorSet expanded_decorators = DecoratorFixup<decorators>::value;
-    return PreRuntimeDispatch::equals<expanded_decorators>(o1, o2);
-  }
-
   // Infer the type that should be returned from an Access::oop_load.
   template <typename P, DecoratorSet decorators>
   class OopLoadProxy: public StackObj {
--- a/src/hotspot/share/oops/compressedOops.inline.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/oops/compressedOops.inline.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,7 @@
 #include "memory/universe.hpp"
 #include "oops/compressedOops.hpp"
 #include "oops/oop.hpp"
+#include "utilities/align.hpp"
 
 // Functions for encoding and decoding compressed oops.
 // If the oops are compressed, the type passed to these overloaded functions
@@ -47,7 +48,7 @@
 inline oop CompressedOops::decode_not_null(narrowOop v) {
   assert(!is_null(v), "narrow oop value can never be zero");
   oop result = decode_raw(v);
-  assert(check_obj_alignment(result), "address not aligned: " INTPTR_FORMAT, p2i((void*) result));
+  assert(is_object_aligned(result), "address not aligned: " INTPTR_FORMAT, p2i((void*) result));
   return result;
 }
 
@@ -57,12 +58,13 @@
 
 inline narrowOop CompressedOops::encode_not_null(oop v) {
   assert(!is_null(v), "oop value can never be zero");
-  DEBUG_ONLY(Universe::heap()->check_oop_location(v);)
+  assert(is_object_aligned(v), "address not aligned: " PTR_FORMAT, p2i((void*)v));
+  assert(is_in(v), "address not in heap range: " PTR_FORMAT, p2i((void*)v));
   uint64_t  pd = (uint64_t)(pointer_delta((void*)v, (void*)base(), 1));
   assert(OopEncodingHeapMax > pd, "change encoding max if new encoding");
   uint64_t result = pd >> shift();
   assert((result & CONST64(0xffffffff00000000)) == 0, "narrow oop overflow");
-  assert(oopDesc::equals_raw(decode(result), v), "reversibility");
+  assert(decode(result) == v, "reversibility");
   return (narrowOop)result;
 }
 
--- a/src/hotspot/share/oops/constantPool.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/oops/constantPool.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -556,7 +556,8 @@
     Handle h_loader (thread, loader);
     Klass* k = SystemDictionary::find(name, h_loader, h_prot, thread);
 
-    if (k != NULL) {
+    // Avoid constant pool verification at a safepoint, which takes the Module_lock.
+    if (k != NULL && !SafepointSynchronize::is_at_safepoint()) {
       // Make sure that resolving is legal
       EXCEPTION_MARK;
       // return NULL if verification fails
@@ -866,7 +867,7 @@
   if (cache_index >= 0) {
     result_oop = this_cp->resolved_references()->obj_at(cache_index);
     if (result_oop != NULL) {
-      if (oopDesc::equals(result_oop, Universe::the_null_sentinel())) {
+      if (result_oop == Universe::the_null_sentinel()) {
         DEBUG_ONLY(int temp_index = (index >= 0 ? index : this_cp->object_to_cp_index(cache_index)));
         assert(this_cp->tag_at(temp_index).is_dynamic_constant(), "only condy uses the null sentinel");
         result_oop = NULL;
@@ -1096,12 +1097,12 @@
     } else {
       // Return the winning thread's result.  This can be different than
       // the result here for MethodHandles.
-      if (oopDesc::equals(old_result, Universe::the_null_sentinel()))
+      if (old_result == Universe::the_null_sentinel())
         old_result = NULL;
       return old_result;
     }
   } else {
-    assert(!oopDesc::equals(result_oop, Universe::the_null_sentinel()), "");
+    assert(result_oop != Universe::the_null_sentinel(), "");
     return result_oop;
   }
 }
@@ -1154,7 +1155,7 @@
 oop ConstantPool::string_at_impl(const constantPoolHandle& this_cp, int which, int obj_index, TRAPS) {
   // If the string has already been interned, this entry will be non-null
   oop str = this_cp->resolved_references()->obj_at(obj_index);
-  assert(!oopDesc::equals(str, Universe::the_null_sentinel()), "");
+  assert(str != Universe::the_null_sentinel(), "");
   if (str != NULL) return str;
   Symbol* sym = this_cp->unresolved_string_at(which);
   str = StringTable::intern(sym, CHECK_(NULL));
--- a/src/hotspot/share/oops/instanceKlass.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/oops/instanceKlass.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -2717,7 +2717,7 @@
   // and package entries. Both must be the same. This rule
   // applies even to classes that are defined in the unnamed
   // package, they still must have the same class loader.
-  if (oopDesc::equals(classloader1, classloader2) && (classpkg1 == classpkg2)) {
+  if ((classloader1 == classloader2) && (classpkg1 == classpkg2)) {
     return true;
   }
 
@@ -2728,7 +2728,7 @@
 // and classname information is enough to determine a class's package
 bool InstanceKlass::is_same_class_package(oop other_class_loader,
                                           const Symbol* other_class_name) const {
-  if (!oopDesc::equals(class_loader(), other_class_loader)) {
+  if (class_loader() != other_class_loader) {
     return false;
   }
   if (name()->fast_compare(other_class_name) == 0) {
@@ -2973,6 +2973,7 @@
 
 // On-stack replacement stuff
 void InstanceKlass::add_osr_nmethod(nmethod* n) {
+  assert_lock_strong(CompiledMethod_lock);
 #ifndef PRODUCT
   if (TieredCompilation) {
       nmethod * prev = lookup_osr_nmethod(n->method(), n->osr_entry_bci(), n->comp_level(), true);
@@ -2982,8 +2983,6 @@
 #endif
   // only one compilation can be active
   {
-    // This is a short non-blocking critical region, so the no safepoint check is ok.
-    MutexLocker ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
     assert(n->is_osr_method(), "wrong kind of nmethod");
     n->set_osr_link(osr_nmethods_head());
     set_osr_nmethods_head(n);
@@ -3008,7 +3007,8 @@
 // Remove osr nmethod from the list. Return true if found and removed.
 bool InstanceKlass::remove_osr_nmethod(nmethod* n) {
   // This is a short non-blocking critical region, so the no safepoint check is ok.
-  MutexLocker ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(CompiledMethod_lock->owned_by_self() ? NULL : CompiledMethod_lock
+                 , Mutex::_no_safepoint_check_flag);
   assert(n->is_osr_method(), "wrong kind of nmethod");
   nmethod* last = NULL;
   nmethod* cur  = osr_nmethods_head();
@@ -3051,8 +3051,8 @@
 }
 
 int InstanceKlass::mark_osr_nmethods(const Method* m) {
-  // This is a short non-blocking critical region, so the no safepoint check is ok.
-  MutexLocker ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(CompiledMethod_lock->owned_by_self() ? NULL : CompiledMethod_lock,
+                 Mutex::_no_safepoint_check_flag);
   nmethod* osr = osr_nmethods_head();
   int found = 0;
   while (osr != NULL) {
@@ -3067,8 +3067,8 @@
 }
 
 nmethod* InstanceKlass::lookup_osr_nmethod(const Method* m, int bci, int comp_level, bool match_level) const {
-  // This is a short non-blocking critical region, so the no safepoint check is ok.
-  MutexLocker ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(CompiledMethod_lock->owned_by_self() ? NULL : CompiledMethod_lock,
+                 Mutex::_no_safepoint_check_flag);
   nmethod* osr = osr_nmethods_head();
   nmethod* best = NULL;
   while (osr != NULL) {
--- a/src/hotspot/share/oops/klass.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/oops/klass.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -524,6 +524,18 @@
   virtual void remove_java_mirror();
   virtual void restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS);
 
+  bool is_unshareable_info_restored() const {
+    assert(is_shared(), "use this for shared classes only");
+    if (has_raw_archived_mirror()) {
+      // _java_mirror is not a valid OopHandle but rather an encoded reference in the shared heap
+      return false;
+    } else if (_java_mirror.ptr_raw() == NULL) {
+      return false;
+    } else {
+      return true;
+    }
+  }
+
  public:
   // subclass accessor (here for convenience; undefined for non-klass objects)
   virtual bool is_leaf_class() const { fatal("not a class"); return false; }
--- a/src/hotspot/share/oops/klassVtable.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/oops/klassVtable.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -491,7 +491,7 @@
           // to link to the first super, and we get all the others.
           Handle super_loader(THREAD, super_klass->class_loader());
 
-          if (!oopDesc::equals(target_loader(), super_loader())) {
+          if (target_loader() != super_loader()) {
             ResourceMark rm(THREAD);
             Symbol* failed_type_symbol =
               SystemDictionary::check_signature_loaders(signature, target_loader,
@@ -1237,7 +1237,7 @@
       // if checkconstraints requested
       if (checkconstraints) {
         Handle method_holder_loader (THREAD, target->method_holder()->class_loader());
-        if (!oopDesc::equals(method_holder_loader(), interface_loader())) {
+        if (method_holder_loader() != interface_loader()) {
           ResourceMark rm(THREAD);
           Symbol* failed_type_symbol =
             SystemDictionary::check_signature_loaders(m->signature(),
--- a/src/hotspot/share/oops/method.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/oops/method.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -103,7 +103,7 @@
   // Fix and bury in Method*
   set_interpreter_entry(NULL); // sets i2i entry and from_int
   set_adapter_entry(NULL);
-  clear_code(false /* don't need a lock */); // from_c/from_i get set to c2i/i2i
+  Method::clear_code(); // from_c/from_i get set to c2i/i2i
 
   if (access_flags.is_native()) {
     clear_native_function();
@@ -825,7 +825,7 @@
   set_native_function(
     SharedRuntime::native_method_throw_unsatisfied_link_error_entry(),
     !native_bind_event_is_interesting);
-  clear_code();
+  this->unlink_code();
 }
 
 
@@ -941,8 +941,7 @@
 }
 
 // Revert to using the interpreter and clear out the nmethod
-void Method::clear_code(bool acquire_lock /* = true */) {
-  MutexLocker pl(acquire_lock ? Patching_lock : NULL, Mutex::_no_safepoint_check_flag);
+void Method::clear_code() {
   // this may be NULL if c2i adapters have not been made yet
   // Only should happen at allocate time.
   if (adapter() == NULL) {
@@ -956,6 +955,25 @@
   _code = NULL;
 }
 
+void Method::unlink_code(CompiledMethod *compare) {
+  MutexLocker ml(CompiledMethod_lock->owned_by_self() ? NULL : CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
+  // We need to check if either the _code or _from_compiled_code_entry_point
+  // refer to this nmethod because there is a race in setting these two fields
+  // in Method* as seen in bugid 4947125.
+  // If the vep() points to the zombie nmethod, the memory for the nmethod
+  // could be flushed and the compiler and vtable stubs could still call
+  // through it.
+  if (code() == compare ||
+      from_compiled_entry() == compare->verified_entry_point()) {
+    clear_code();
+  }
+}
+
+void Method::unlink_code() {
+  MutexLocker ml(CompiledMethod_lock->owned_by_self() ? NULL : CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
+  clear_code();
+}
+
 #if INCLUDE_CDS
 // Called by class data sharing to remove any entry points (which are not shared)
 void Method::unlink_method() {
@@ -1182,7 +1200,7 @@
 
 // Install compiled code.  Instantly it can execute.
 void Method::set_code(const methodHandle& mh, CompiledMethod *code) {
-  MutexLocker pl(Patching_lock, Mutex::_no_safepoint_check_flag);
+  assert_lock_strong(CompiledMethod_lock);
   assert( code, "use clear_code to remove code" );
   assert( mh->check_code(), "" );
 
--- a/src/hotspot/share/oops/method.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/oops/method.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -463,7 +463,17 @@
   address verified_code_entry();
   bool check_code() const;      // Not inline to avoid circular ref
   CompiledMethod* volatile code() const;
-  void clear_code(bool acquire_lock = true);    // Clear out any compiled code
+
+  // Locks CompiledMethod_lock if not held.
+  void unlink_code(CompiledMethod *compare);
+  // Locks CompiledMethod_lock if not held.
+  void unlink_code();
+
+private:
+  // Either called with CompiledMethod_lock held or from constructor.
+  void clear_code();
+
+public:
   static void set_code(const methodHandle& mh, CompiledMethod* code);
   void set_adapter_entry(AdapterHandlerEntry* adapter) {
     constMethod()->set_adapter_entry(adapter);
@@ -593,7 +603,7 @@
   void compute_size_of_parameters(Thread *thread); // word size of parameters (receiver if any + arguments)
   Symbol* klass_name() const;                    // returns the name of the method holder
   BasicType result_type() const;                 // type of the method result
-  bool is_returning_oop() const                  { BasicType r = result_type(); return (r == T_OBJECT || r == T_ARRAY); }
+  bool is_returning_oop() const                  { BasicType r = result_type(); return is_reference_type(r); }
   bool is_returning_fp() const                   { BasicType r = result_type(); return (r == T_FLOAT || r == T_DOUBLE); }
 
   // Checked exceptions thrown by this method (resolved to mirrors)
--- a/src/hotspot/share/oops/methodData.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/oops/methodData.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -216,7 +216,7 @@
     args_cell = TypeStackSlotEntries::compute_cell_count(inv.signature(), false, TypeProfileArgsLimit);
   }
   int ret_cell = 0;
-  if (MethodData::profile_return_for_invoke(m, bci) && (inv.result_type() == T_OBJECT || inv.result_type() == T_ARRAY)) {
+  if (MethodData::profile_return_for_invoke(m, bci) && is_reference_type(inv.result_type())) {
     ret_cell = ReturnTypeEntry::static_cell_count();
   }
   int header_cell = 0;
@@ -289,7 +289,7 @@
   }
 
   if (has_return()) {
-    assert(inv.result_type() == T_OBJECT || inv.result_type() == T_ARRAY, "room for a ret type but doesn't return obj?");
+    assert(is_reference_type(inv.result_type()), "room for a ret type but doesn't return obj?");
     _ret.post_initialize();
   }
 }
@@ -310,7 +310,7 @@
   }
 
   if (has_return()) {
-    assert(inv.result_type() == T_OBJECT || inv.result_type() == T_ARRAY, "room for a ret type but doesn't return obj?");
+    assert(is_reference_type(inv.result_type()), "room for a ret type but doesn't return obj?");
     _ret.post_initialize();
   }
 }
--- a/src/hotspot/share/oops/objArrayKlass.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/oops/objArrayKlass.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -212,7 +212,7 @@
 // Either oop or narrowOop depending on UseCompressedOops.
 void ObjArrayKlass::do_copy(arrayOop s, size_t src_offset,
                             arrayOop d, size_t dst_offset, int length, TRAPS) {
-  if (oopDesc::equals(s, d)) {
+  if (s == d) {
     // since source and destination are equal we do not need conversion checks.
     assert(length > 0, "sanity check");
     ArrayAccess<>::oop_arraycopy(s, src_offset, d, dst_offset, length);
--- a/src/hotspot/share/oops/oop.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/oops/oop.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -209,7 +209,6 @@
 
 #ifdef ASSERT
 void oopDesc::verify_forwardee(oop forwardee) {
-  Universe::heap()->check_oop_location(forwardee);
 #if INCLUDE_CDS_JAVA_HEAP
   assert(!HeapShared::is_archived_object(forwardee) && !HeapShared::is_archived_object(this),
          "forwarding archive object");
--- a/src/hotspot/share/oops/oop.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/oops/oop.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -150,10 +150,6 @@
     }
   }
 
-  inline static bool equals(oop o1, oop o2) { return Access<>::equals(o1, o2); }
-
-  inline static bool equals_raw(oop o1, oop o2) { return RawAccess<>::equals(o1, o2); }
-
   // Access to fields in a instanceOop through these methods.
   template <DecoratorSet decorator>
   oop obj_field_access(int offset) const;
--- a/src/hotspot/share/oops/oopsHierarchy.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/oops/oopsHierarchy.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -23,9 +23,6 @@
  */
 
 #include "precompiled.hpp"
-#include "gc/shared/barrierSet.hpp"
-#include "gc/shared/collectedHeap.hpp"
-#include "gc/shared/collectedHeap.inline.hpp"
 #include "memory/universe.hpp"
 #include "oops/oopsHierarchy.hpp"
 #include "runtime/thread.inline.hpp"
@@ -56,14 +53,4 @@
   }
 }
 
-bool oop::operator==(const oop o) const {
-  assert(BarrierSet::barrier_set()->oop_equals_operator_allowed(), "Not allowed");
-  return obj() == o.obj();
-}
-
-bool oop::operator!=(const volatile oop o) const {
-  assert(BarrierSet::barrier_set()->oop_equals_operator_allowed(), "Not allowed");
-  return obj() != o.obj();
-}
-
 #endif // CHECK_UNHANDLED_OOPS
--- a/src/hotspot/share/oops/oopsHierarchy.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/oops/oopsHierarchy.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -100,9 +100,9 @@
 
   // General access
   oopDesc*  operator->() const        { return obj(); }
-  bool operator==(const oop o) const;
+  bool operator==(const oop o) const  { return obj() == o.obj(); }
   bool operator==(void *p) const      { return obj() == p; }
-  bool operator!=(const volatile oop o) const;
+  bool operator!=(const volatile oop o) const { return obj() != o.obj(); }
   bool operator!=(void *p) const      { return obj() != p; }
 
   // Assignment
@@ -190,10 +190,6 @@
   return (T)(CHECK_UNHANDLED_OOPS_ONLY((void*))o);
 }
 
-inline bool check_obj_alignment(void* ptr) {
-  return (uintptr_t(ptr) & MinObjAlignmentInBytesMask) == 0;
-}
-
 // The metadata hierarchy is separate from the oop hierarchy
 
 //      class MetaspaceObj
--- a/src/hotspot/share/opto/arraycopynode.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/opto/arraycopynode.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -268,8 +268,8 @@
 
     BasicType src_elem  = ary_src->klass()->as_array_klass()->element_type()->basic_type();
     BasicType dest_elem = ary_dest->klass()->as_array_klass()->element_type()->basic_type();
-    if (src_elem  == T_ARRAY)  src_elem  = T_OBJECT;
-    if (dest_elem == T_ARRAY)  dest_elem = T_OBJECT;
+    if (is_reference_type(src_elem))   src_elem  = T_OBJECT;
+    if (is_reference_type(dest_elem))  dest_elem = T_OBJECT;
 
     if (src_elem != dest_elem || dest_elem == T_VOID) {
       // We don't know if arguments are arrays of the same type
@@ -328,7 +328,7 @@
 
     assert(phase->type(src->in(AddPNode::Offset))->is_intptr_t()->get_con() == phase->type(dest->in(AddPNode::Offset))->is_intptr_t()->get_con(), "same start offset?");
     BasicType elem = ary_src->klass()->as_array_klass()->element_type()->basic_type();
-    if (elem == T_ARRAY)  elem = T_OBJECT;
+    if (is_reference_type(elem))  elem = T_OBJECT;
 
     BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
     if (bs->array_copy_requires_gc_barriers(true, elem, true, BarrierSetC2::Optimization)) {
--- a/src/hotspot/share/opto/block.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/opto/block.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -317,7 +317,7 @@
   uint find_node( const Node *n ) const;
   // Find and remove n from block list
   void find_remove( const Node *n );
-  // Check wether the node is in the block.
+  // Check whether the node is in the block.
   bool contains (const Node *n) const;
 
   // Return the empty status of a block
--- a/src/hotspot/share/opto/c2_globals.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/opto/c2_globals.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -510,7 +510,7 @@
           "Sets max value cached by the java.lang.Integer autobox cache")   \
           range(0, max_jint)                                                \
                                                                             \
-  experimental(bool, AggressiveUnboxing, true,                              \
+  diagnostic(bool, AggressiveUnboxing, true,                                \
           "Control optimizations for aggressive boxing elimination")        \
                                                                             \
   develop(bool, TracePostallocExpand, false, "Trace expanding nodes after"  \
--- a/src/hotspot/share/opto/doCall.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/opto/doCall.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -702,8 +702,8 @@
         } else if (rt == T_INT || is_subword_type(rt)) {
           // Nothing.  These cases are handled in lambda form bytecode.
           assert(ct == T_INT || is_subword_type(ct), "must match: rt=%s, ct=%s", type2name(rt), type2name(ct));
-        } else if (rt == T_OBJECT || rt == T_ARRAY) {
-          assert(ct == T_OBJECT || ct == T_ARRAY, "rt=%s, ct=%s", type2name(rt), type2name(ct));
+        } else if (is_reference_type(rt)) {
+          assert(is_reference_type(ct), "rt=%s, ct=%s", type2name(rt), type2name(ct));
           if (ctype->is_loaded()) {
             const TypeOopPtr* arg_type = TypeOopPtr::make_from_klass(rtype->as_klass());
             const Type*       sig_type = TypeOopPtr::make_from_klass(ctype->as_klass());
@@ -750,7 +750,7 @@
       set_bci(iter().cur_bci()); // put it back
     }
     BasicType ct = ctype->basic_type();
-    if (ct == T_OBJECT || ct == T_ARRAY) {
+    if (is_reference_type(ct)) {
       record_profiled_return_for_speculation();
     }
   }
--- a/src/hotspot/share/opto/escape.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/opto/escape.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -2113,7 +2113,8 @@
       }
     }
   }
-  return (bt == T_OBJECT || bt == T_NARROWOOP || bt == T_ARRAY);
+  // Note: T_NARROWOOP is not classed as a real reference type
+  return (is_reference_type(bt) || bt == T_NARROWOOP);
 }
 
 // Returns unique pointed java object or NULL.
--- a/src/hotspot/share/opto/graphKit.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/opto/graphKit.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -2276,7 +2276,7 @@
   int skip = Bytecodes::has_receiver(bc) ? 1 : 0;
   for (int j = skip, i = 0; j < nargs && i < TypeProfileArgsLimit; j++) {
     const Type *targ = tf->domain()->field_at(j + TypeFunc::Parms);
-    if (targ->basic_type() == T_OBJECT || targ->basic_type() == T_ARRAY) {
+    if (is_reference_type(targ->basic_type())) {
       ProfilePtrKind ptr_kind = ProfileMaybeNull;
       ciKlass* better_type = NULL;
       if (method()->argument_profiled_type(bci(), i, better_type, ptr_kind)) {
--- a/src/hotspot/share/opto/library_call.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/opto/library_call.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -2382,7 +2382,7 @@
   guarantee( is_store || kind != Release, "Release accesses can be produced only for stores");
   assert(type != T_OBJECT || !unaligned, "unaligned access not supported with object type");
 
-  if (type == T_OBJECT || type == T_ARRAY) {
+  if (is_reference_type(type)) {
     decorators |= ON_UNKNOWN_OOP_REF;
   }
 
@@ -2730,7 +2730,7 @@
   Compile::AliasType* alias_type = C->alias_type(adr_type);
   BasicType bt = alias_type->basic_type();
   if (bt != T_ILLEGAL &&
-      ((bt == T_OBJECT || bt == T_ARRAY) != (type == T_OBJECT))) {
+      (is_reference_type(bt) != (type == T_OBJECT))) {
     // Don't intrinsify mismatched object accesses.
     return false;
   }
@@ -2767,7 +2767,7 @@
 
   int alias_idx = C->get_alias_index(adr_type);
 
-  if (type == T_OBJECT || type == T_ARRAY) {
+  if (is_reference_type(type)) {
     decorators |= IN_HEAP | ON_UNKNOWN_OOP_REF;
 
     // Transformation of a value which could be NULL pointer (CastPP #NULL)
@@ -4817,8 +4817,8 @@
   if (has_src && has_dest && can_emit_guards) {
     BasicType src_elem  = top_src->klass()->as_array_klass()->element_type()->basic_type();
     BasicType dest_elem = top_dest->klass()->as_array_klass()->element_type()->basic_type();
-    if (src_elem  == T_ARRAY)  src_elem  = T_OBJECT;
-    if (dest_elem == T_ARRAY)  dest_elem = T_OBJECT;
+    if (is_reference_type(src_elem))   src_elem  = T_OBJECT;
+    if (is_reference_type(dest_elem))  dest_elem = T_OBJECT;
 
     if (src_elem == dest_elem && src_elem == T_OBJECT) {
       // If both arrays are object arrays then having the exact types
--- a/src/hotspot/share/opto/loopopts.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/opto/loopopts.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1718,7 +1718,7 @@
 #ifdef ASSERT
     if (loop->_head->as_Loop()->is_strip_mined() && outer_loop->is_member(use_loop) && !loop->is_member(use_loop) && old_new[use->_idx] == NULL) {
       Node* sfpt = loop->_head->as_CountedLoop()->outer_safepoint();
-      assert(mode == ControlAroundStripMined && use == sfpt, "missed a node");
+      assert(mode == ControlAroundStripMined && (use == sfpt || !use->is_reachable_from_root()), "missed a node");
     }
 #endif
     if (!loop->is_member(use_loop) && !outer_loop->is_member(use_loop) && (!old->is_CFG() || !use->is_CFG())) {
--- a/src/hotspot/share/opto/macro.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/opto/macro.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -791,7 +791,7 @@
 
       const Type *field_type;
       // The next code is taken from Parse::do_get_xxx().
-      if (basic_elem_type == T_OBJECT || basic_elem_type == T_ARRAY) {
+      if (is_reference_type(basic_elem_type)) {
         if (!elem_type->is_loaded()) {
           field_type = TypeInstPtr::BOTTOM;
         } else if (field != NULL && field->is_static_constant()) {
--- a/src/hotspot/share/opto/macro.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/opto/macro.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -63,6 +63,22 @@
   Node* make_store(Node* ctl, Node* mem, Node* base, int offset,
                    Node* value, BasicType bt);
 
+  Node* make_leaf_call(Node* ctrl, Node* mem,
+                       const TypeFunc* call_type, address call_addr,
+                       const char* call_name,
+                       const TypePtr* adr_type,
+                       Node* parm0 = NULL, Node* parm1 = NULL,
+                       Node* parm2 = NULL, Node* parm3 = NULL,
+                       Node* parm4 = NULL, Node* parm5 = NULL,
+                       Node* parm6 = NULL, Node* parm7 = NULL);
+
+  address basictype2arraycopy(BasicType t,
+                              Node* src_offset,
+                              Node* dest_offset,
+                              bool disjoint_bases,
+                              const char* &name,
+                              bool dest_uninitialized);
+
 private:
   // projections extracted from a call node
   ProjNode *_fallthroughproj;
@@ -103,14 +119,6 @@
   void insert_mem_bar(Node** ctrl, Node** mem, int opcode, Node* precedent = NULL);
   Node* array_element_address(Node* ary, Node* idx, BasicType elembt);
   Node* ConvI2L(Node* offset);
-  Node* make_leaf_call(Node* ctrl, Node* mem,
-                       const TypeFunc* call_type, address call_addr,
-                       const char* call_name,
-                       const TypePtr* adr_type,
-                       Node* parm0 = NULL, Node* parm1 = NULL,
-                       Node* parm2 = NULL, Node* parm3 = NULL,
-                       Node* parm4 = NULL, Node* parm5 = NULL,
-                       Node* parm6 = NULL, Node* parm7 = NULL);
 
   // helper methods modeled after LibraryCallKit for array copy
   Node* generate_guard(Node** ctrl, Node* test, RegionNode* region, float true_prob);
@@ -121,12 +129,6 @@
   // More helper methods for array copy
   Node* generate_nonpositive_guard(Node** ctrl, Node* index, bool never_negative);
   void finish_arraycopy_call(Node* call, Node** ctrl, MergeMemNode** mem, const TypePtr* adr_type);
-  address basictype2arraycopy(BasicType t,
-                              Node* src_offset,
-                              Node* dest_offset,
-                              bool disjoint_bases,
-                              const char* &name,
-                              bool dest_uninitialized);
   Node* generate_arraycopy(ArrayCopyNode *ac,
                            AllocateArrayNode* alloc,
                            Node** ctrl, MergeMemNode* mem, Node** io,
--- a/src/hotspot/share/opto/macroArrayCopy.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/opto/macroArrayCopy.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1093,22 +1093,8 @@
   MergeMemNode* merge_mem = NULL;
 
   if (ac->is_clonebasic()) {
-    assert (src_offset == NULL && dest_offset == NULL, "for clone offsets should be null");
-    Node* mem = ac->in(TypeFunc::Memory);
-    const char* copyfunc_name = "arraycopy";
-    address     copyfunc_addr =
-      basictype2arraycopy(T_LONG, NULL, NULL,
-                          true, copyfunc_name, true);
-
-    const TypePtr* raw_adr_type = TypeRawPtr::BOTTOM;
-    const TypeFunc* call_type = OptoRuntime::fast_arraycopy_Type();
-
-    Node* call = make_leaf_call(ctrl, mem, call_type, copyfunc_addr, copyfunc_name, raw_adr_type, src, dest, length XTOP);
-    transform_later(call);
-
     BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
-    bs->clone_barrier_at_expansion(ac, call, _igvn);
-
+    bs->clone_at_expansion(this, ac);
     return;
   } else if (ac->is_copyof() || ac->is_copyofrange() || ac->is_cloneoop()) {
     Node* mem = ac->in(TypeFunc::Memory);
@@ -1163,8 +1149,8 @@
   if (top_src != NULL && top_src->klass() != NULL) {
     src_elem = top_src->klass()->as_array_klass()->element_type()->basic_type();
   }
-  if (src_elem  == T_ARRAY)  src_elem  = T_OBJECT;
-  if (dest_elem == T_ARRAY)  dest_elem = T_OBJECT;
+  if (is_reference_type(src_elem))  src_elem  = T_OBJECT;
+  if (is_reference_type(dest_elem)) dest_elem = T_OBJECT;
 
   if (ac->is_arraycopy_validated() &&
       dest_elem != T_CONFLICT &&
--- a/src/hotspot/share/opto/node.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/opto/node.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -704,9 +704,26 @@
   dump();
   return true;
 }
+
+bool Node::is_reachable_from_root() const {
+  ResourceMark rm;
+  Unique_Node_List wq;
+  wq.push((Node*)this);
+  RootNode* root = Compile::current()->root();
+  for (uint i = 0; i < wq.size(); i++) {
+    Node* m = wq.at(i);
+    if (m == root) {
+      return true;
+    }
+    for (DUIterator_Fast jmax, j = m->fast_outs(jmax); j < jmax; j++) {
+      Node* u = m->fast_out(j);
+      wq.push(u);
+    }
+  }
+  return false;
+}
 #endif
 
-
 //------------------------------is_unreachable---------------------------------
 bool Node::is_unreachable(PhaseIterGVN &igvn) const {
   assert(!is_Mach(), "doesn't work with MachNodes");
--- a/src/hotspot/share/opto/node.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/opto/node.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -394,6 +394,7 @@
 #ifdef ASSERT
   bool is_dead() const;
 #define is_not_dead(n) ((n) == NULL || !VerifyIterativeGVN || !((n)->is_dead()))
+  bool is_reachable_from_root() const;
 #endif
   // Check whether node has become unreachable
   bool is_unreachable(PhaseIterGVN &igvn) const;
--- a/src/hotspot/share/opto/parse3.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/opto/parse3.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -139,7 +139,7 @@
   DecoratorSet decorators = IN_HEAP;
   decorators |= is_vol ? MO_SEQ_CST : MO_UNORDERED;
 
-  bool is_obj = bt == T_OBJECT || bt == T_ARRAY;
+  bool is_obj = is_reference_type(bt);
 
   if (is_obj) {
     if (!field->type()->is_loaded()) {
@@ -210,7 +210,7 @@
   DecoratorSet decorators = IN_HEAP;
   decorators |= is_vol ? MO_SEQ_CST : MO_UNORDERED;
 
-  bool is_obj = bt == T_OBJECT || bt == T_ARRAY;
+  bool is_obj = is_reference_type(bt);
 
   // Store the value.
   const Type* field_type;
--- a/src/hotspot/share/opto/type.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/opto/type.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -3004,15 +3004,13 @@
           ciField* field = k->get_field_by_offset(_offset, true);
           assert(field != NULL, "missing field");
           BasicType basic_elem_type = field->layout_type();
-          _is_ptr_to_narrowoop = UseCompressedOops && (basic_elem_type == T_OBJECT ||
-                                                       basic_elem_type == T_ARRAY);
+          _is_ptr_to_narrowoop = UseCompressedOops && is_reference_type(basic_elem_type);
         } else {
           // Instance fields which contains a compressed oop references.
           field = ik->get_field_by_offset(_offset, false);
           if (field != NULL) {
             BasicType basic_elem_type = field->layout_type();
-            _is_ptr_to_narrowoop = UseCompressedOops && (basic_elem_type == T_OBJECT ||
-                                                         basic_elem_type == T_ARRAY);
+            _is_ptr_to_narrowoop = UseCompressedOops && is_reference_type(basic_elem_type);
           } else if (klass()->equals(ciEnv::current()->Object_klass())) {
             // Compile::find_alias_type() cast exactness on all types to verify
             // that it does not affect alias type.
--- a/src/hotspot/share/prims/jni.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/prims/jni.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -568,7 +568,7 @@
   oop super_mirror = JNIHandles::resolve_non_null(super);
   if (java_lang_Class::is_primitive(sub_mirror) ||
       java_lang_Class::is_primitive(super_mirror)) {
-    jboolean ret = oopDesc::equals(sub_mirror, super_mirror);
+    jboolean ret = (sub_mirror == super_mirror);
 
     HOTSPOT_JNI_ISASSIGNABLEFROM_RETURN(ret);
     return ret;
@@ -1104,7 +1104,7 @@
   JavaCalls::call(result, method, &java_args, CHECK);
 
   // Convert result
-  if (result->get_type() == T_OBJECT || result->get_type() == T_ARRAY) {
+  if (is_reference_type(result->get_type())) {
     result->set_jobject(JNIHandles::make_local(env, (oop) result->get_jobject()));
   }
 }
@@ -1167,7 +1167,7 @@
   JavaCalls::call(result, method, &java_args, CHECK);
 
   // Convert result
-  if (result->get_type() == T_OBJECT || result->get_type() == T_ARRAY) {
+  if (is_reference_type(result->get_type())) {
     result->set_jobject(JNIHandles::make_local(env, (oop) result->get_jobject()));
   }
 }
--- a/src/hotspot/share/prims/jvm.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/prims/jvm.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -773,7 +773,7 @@
   JVMWrapper("JVM_FindPrimitiveClass");
   oop mirror = NULL;
   BasicType t = name2type(utf);
-  if (t != T_ILLEGAL && t != T_OBJECT && t != T_ARRAY) {
+  if (t != T_ILLEGAL && !is_reference_type(t)) {
     mirror = Universe::java_mirror(t);
   }
   if (mirror == NULL) {
@@ -1257,7 +1257,7 @@
       protection_domain = method->method_holder()->protection_domain();
     }
 
-    if ((!oopDesc::equals(previous_protection_domain, protection_domain)) && (protection_domain != NULL)) {
+    if ((previous_protection_domain != protection_domain) && (protection_domain != NULL)) {
       local_array->push(protection_domain);
       previous_protection_domain = protection_domain;
     }
@@ -2974,7 +2974,7 @@
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "timeout value is negative");
   }
 
-  if (Thread::is_interrupted (THREAD, true) && !HAS_PENDING_EXCEPTION) {
+  if (thread->is_interrupted(true) && !HAS_PENDING_EXCEPTION) {
     THROW_MSG(vmSymbols::java_lang_InterruptedException(), "sleep interrupted");
   }
 
@@ -3071,7 +3071,7 @@
   bool is_alive = tlh.cv_internal_thread_to_JavaThread(jthread, &receiver, NULL);
   if (is_alive) {
     // jthread refers to a live JavaThread.
-    Thread::interrupt(receiver);
+    receiver->interrupt();
   }
 JVM_END
 
@@ -3084,7 +3084,7 @@
   bool is_alive = tlh.cv_internal_thread_to_JavaThread(jthread, &receiver, NULL);
   if (is_alive) {
     // jthread refers to a live JavaThread.
-    return (jboolean) Thread::is_interrupted(receiver, clear_interrupted != 0);
+    return (jboolean) receiver->is_interrupted(clear_interrupted != 0);
   } else {
     return JNI_FALSE;
   }
--- a/src/hotspot/share/prims/jvmtiEnv.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/prims/jvmtiEnv.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1101,7 +1101,7 @@
     return err;
   }
 
-  Thread::interrupt(java_thread);
+  java_thread->interrupt();
 
   return JVMTI_ERROR_NONE;
 } /* end InterruptThread */
@@ -3411,7 +3411,7 @@
 #endif /* PROPER_TRANSITIONS */
   } else {
     if (thread->is_Named_thread()) {
-      r = rmonitor->raw_wait(millis, true, thread);
+      r = rmonitor->raw_wait(millis, false, thread);
     } else {
       ShouldNotReachHere();
     }
--- a/src/hotspot/share/prims/jvmtiEventController.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/prims/jvmtiEventController.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -32,6 +32,7 @@
 #include "prims/jvmtiExport.hpp"
 #include "prims/jvmtiImpl.hpp"
 #include "prims/jvmtiThreadState.inline.hpp"
+#include "runtime/deoptimization.hpp"
 #include "runtime/frame.hpp"
 #include "runtime/thread.inline.hpp"
 #include "runtime/threadSMR.hpp"
@@ -239,8 +240,7 @@
       }
     }
     if (num_marked > 0) {
-      VM_Deoptimize op;
-      VMThread::execute(&op);
+      Deoptimization::deoptimize_all_marked();
     }
   }
 }
--- a/src/hotspot/share/prims/jvmtiExport.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/prims/jvmtiExport.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1589,7 +1589,7 @@
     if (!exception_exit) {
       oop oop_result;
       BasicType type = current_frame.interpreter_frame_result(&oop_result, &value);
-      if (type == T_OBJECT || type == T_ARRAY) {
+      if (is_reference_type(type)) {
         result = Handle(thread, oop_result);
       }
     }
--- a/src/hotspot/share/prims/jvmtiRawMonitor.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/prims/jvmtiRawMonitor.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -373,8 +373,12 @@
   OrderAccess::fence() ;
 
   // check interrupt event
-  if (interruptible && Thread::is_interrupted(THREAD, true)) {
-    return OM_INTERRUPTED;
+  if (interruptible) {
+    assert(THREAD->is_Java_thread(), "Only JavaThreads can be interruptible");
+    JavaThread* jt = (JavaThread*) THREAD;
+    if (jt->is_interrupted(true)) {
+      return OM_INTERRUPTED;
+    }
   }
 
   intptr_t save = _recursions ;
@@ -401,8 +405,11 @@
   }
   guarantee (THREAD == _owner, "invariant") ;
 
-  if (interruptible && Thread::is_interrupted(THREAD, true)) {
-    return OM_INTERRUPTED;
+  if (interruptible) {
+    JavaThread* jt = (JavaThread*) THREAD;
+    if (jt->is_interrupted(true)) {
+      return OM_INTERRUPTED;
+    }
   }
   return OM_OK ;
 }
--- a/src/hotspot/share/prims/jvmtiTagMap.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/prims/jvmtiTagMap.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -105,7 +105,7 @@
   }
 
   inline bool equals(oop object) {
-    return oopDesc::equals(object, object_peek());
+    return object == object_peek();
   }
 
   inline JvmtiTagHashmapEntry* next() const        { return _next; }
--- a/src/hotspot/share/prims/methodHandles.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/prims/methodHandles.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -42,6 +42,7 @@
 #include "oops/typeArrayOop.inline.hpp"
 #include "prims/methodHandles.hpp"
 #include "runtime/compilationPolicy.hpp"
+#include "runtime/deoptimization.hpp"
 #include "runtime/fieldDescriptor.inline.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
@@ -572,7 +573,7 @@
     if (is_subword_type(bt)) {
       bsig = vmSymbols::int_signature();
     } else {
-      assert(bt == T_OBJECT || bt == T_ARRAY, "is_basic_type_signature was false");
+      assert(is_reference_type(bt), "is_basic_type_signature was false");
       bsig = vmSymbols::object_signature();
     }
   } else {
@@ -591,7 +592,7 @@
       if (arg_pos == keep_arg_pos) {
         buffer.write((char*) ss.raw_bytes(),
                      (int)   ss.raw_length());
-      } else if (bt == T_OBJECT || bt == T_ARRAY) {
+      } else if (is_reference_type(bt)) {
         buffer.write(OBJ_SIG, OBJ_SIG_LEN);
       } else {
         if (is_subword_type(bt))
@@ -1003,7 +1004,7 @@
         if (!java_lang_invoke_MemberName::is_instance(result()))
           return -99;  // caller bug!
         oop saved = MethodHandles::init_field_MemberName(result, st.field_descriptor());
-        if (!oopDesc::equals(saved, result()))
+        if (saved != result())
           results->obj_at_put(rfill-1, saved);  // show saved instance to user
       } else if (++overflow >= overflow_limit) {
         match_flags = 0; break; // got tired of looking at overflow
@@ -1055,7 +1056,7 @@
           return -99;  // caller bug!
         CallInfo info(m, NULL, CHECK_0);
         oop saved = MethodHandles::init_method_MemberName(result, info);
-        if (!oopDesc::equals(saved, result()))
+        if (saved != result())
           results->obj_at_put(rfill-1, saved);  // show saved instance to user
       } else if (++overflow >= overflow_limit) {
         match_flags = 0; break; // got tired of looking at overflow
@@ -1109,8 +1110,7 @@
   }
   if (marked > 0) {
     // At least one nmethod has been marked for deoptimization.
-    VM_Deoptimize op;
-    VMThread::execute(&op);
+    Deoptimization::deoptimize_all_marked();
   }
 }
 
@@ -1506,8 +1506,7 @@
     }
     if (marked > 0) {
       // At least one nmethod has been marked for deoptimization
-      VM_Deoptimize op;
-      VMThread::execute(&op);
+      Deoptimization::deoptimize_all_marked();
     }
   }
 }
--- a/src/hotspot/share/prims/stackwalk.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/prims/stackwalk.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -50,7 +50,7 @@
 bool BaseFrameStream::check_magic(objArrayHandle frames_array) {
   oop   m1 = frames_array->obj_at(magic_pos);
   jlong m2 = _anchor;
-  if (oopDesc::equals(m1, _thread->threadObj()) && m2 == address_value())  return true;
+  if (m1 == _thread->threadObj() && m2 == address_value())  return true;
   return false;
 }
 
@@ -81,7 +81,7 @@
 {
   assert(thread != NULL && thread->is_Java_thread(), "");
   oop m1 = frames_array->obj_at(magic_pos);
-  if (!oopDesc::equals(m1, thread->threadObj())) return NULL;
+  if (m1 != thread->threadObj()) return NULL;
   if (magic == 0L)                    return NULL;
   BaseFrameStream* stream = (BaseFrameStream*) (intptr_t) magic;
   if (!stream->is_valid_in(thread, frames_array))   return NULL;
--- a/src/hotspot/share/prims/unsafe.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/prims/unsafe.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -669,7 +669,7 @@
     ClassLoader::unsafe_defineClassCallCounter()->inc();
   }
 
-  body = NEW_C_HEAP_ARRAY(jbyte, length, mtInternal);
+  body = NEW_C_HEAP_ARRAY_RETURN_NULL(jbyte, length, mtInternal);
   if (body == NULL) {
     throw_new(env, "java/lang/OutOfMemoryError");
     return 0;
@@ -685,7 +685,7 @@
     int unicode_len = env->GetStringLength(name);
 
     if (len >= sizeof(buf)) {
-      utfName = NEW_C_HEAP_ARRAY(char, len + 1, mtInternal);
+      utfName = NEW_C_HEAP_ARRAY_RETURN_NULL(char, len + 1, mtInternal);
       if (utfName == NULL) {
         throw_new(env, "java/lang/OutOfMemoryError");
         goto free_body;
@@ -790,7 +790,7 @@
 
   int class_bytes_length = (int) length;
 
-  u1* class_bytes = NEW_C_HEAP_ARRAY(u1, length, mtInternal);
+  u1* class_bytes = NEW_C_HEAP_ARRAY_RETURN_NULL(u1, length, mtInternal);
   if (class_bytes == NULL) {
     THROW_0(vmSymbols::java_lang_OutOfMemoryError());
   }
@@ -935,7 +935,7 @@
   oop p = JNIHandles::resolve(obj);
   assert_field_offset_sane(p, offset);
   oop ret = HeapAccess<ON_UNKNOWN_OOP_REF>::oop_atomic_cmpxchg_at(x, p, (ptrdiff_t)offset, e);
-  return oopDesc::equals(ret, e);
+  return ret == e;
 } UNSAFE_END
 
 UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSetInt(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jint e, jint x)) {
--- a/src/hotspot/share/prims/whitebox.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/prims/whitebox.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -820,10 +820,8 @@
 WB_END
 
 WB_ENTRY(void, WB_DeoptimizeAll(JNIEnv* env, jobject o))
-  MutexLocker mu(Compile_lock);
   CodeCache::mark_all_nmethods_for_deoptimization();
-  VM_Deoptimize op;
-  VMThread::execute(&op);
+  Deoptimization::deoptimize_all_marked();
 WB_END
 
 WB_ENTRY(jint, WB_DeoptimizeMethod(JNIEnv* env, jobject o, jobject method, jboolean is_osr))
@@ -840,8 +838,7 @@
   }
   result += CodeCache::mark_for_deoptimization(mh());
   if (result > 0) {
-    VM_Deoptimize op;
-    VMThread::execute(&op);
+    Deoptimization::deoptimize_all_marked();
   }
   return result;
 WB_END
--- a/src/hotspot/share/runtime/arguments.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/runtime/arguments.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -82,7 +82,6 @@
 bool   Arguments::_xdebug_mode                  = false;
 const char*  Arguments::_java_vendor_url_bug    = DEFAULT_VENDOR_URL_BUG;
 const char*  Arguments::_sun_java_launcher      = DEFAULT_JAVA_LAUNCHER;
-int    Arguments::_sun_java_launcher_pid        = -1;
 bool   Arguments::_sun_java_launcher_is_altjvm  = false;
 
 // These parameters are reset in method parse_vm_init_args()
@@ -361,8 +360,7 @@
 
 // Process java launcher properties.
 void Arguments::process_sun_java_launcher_properties(JavaVMInitArgs* args) {
-  // See if sun.java.launcher, sun.java.launcher.is_altjvm or
-  // sun.java.launcher.pid is defined.
+  // See if sun.java.launcher or sun.java.launcher.is_altjvm is defined.
   // Must do this before setting up other system properties,
   // as some of them may depend on launcher type.
   for (int index = 0; index < args->nOptions; index++) {
@@ -379,10 +377,6 @@
       }
       continue;
     }
-    if (match_option(option, "-Dsun.java.launcher.pid=", &tail)) {
-      _sun_java_launcher_pid = atoi(tail);
-      continue;
-    }
   }
 }
 
@@ -539,6 +533,7 @@
   { "FlightRecorder",               JDK_Version::jdk(13), JDK_Version::undefined(), JDK_Version::undefined() },
   { "FieldsAllocationStyle",        JDK_Version::jdk(14), JDK_Version::jdk(15), JDK_Version::jdk(16) },
   { "CompactFields",                JDK_Version::jdk(14), JDK_Version::jdk(15), JDK_Version::jdk(16) },
+  { "MonitorBound",                 JDK_Version::jdk(14), JDK_Version::jdk(15), JDK_Version::jdk(16) },
 
   // --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in:
   { "DefaultMaxRAMFraction",        JDK_Version::jdk(8),  JDK_Version::undefined(), JDK_Version::undefined() },
@@ -1410,10 +1405,9 @@
   if (strcmp(key, "java.compiler") == 0) {
     process_java_compiler_argument(value);
     // Record value in Arguments, but let it get passed to Java.
-  } else if (strcmp(key, "sun.java.launcher.is_altjvm") == 0 ||
-             strcmp(key, "sun.java.launcher.pid") == 0) {
-    // sun.java.launcher.is_altjvm and sun.java.launcher.pid property are
-    // private and are processed in process_sun_java_launcher_properties();
+  } else if (strcmp(key, "sun.java.launcher.is_altjvm") == 0) {
+    // sun.java.launcher.is_altjvm property is
+    // private and is processed in process_sun_java_launcher_properties();
     // the sun.java.launcher property is passed on to the java application
   } else if (strcmp(key, "sun.boot.library.path") == 0) {
     // append is true, writable is true, internal is false
@@ -3478,10 +3472,8 @@
   size_t file_sep_len = strlen(os::file_separator());
   const size_t len = jvm_path_len + file_sep_len + 20;
   default_archive_path = NEW_C_HEAP_ARRAY(char, len, mtArguments);
-  if (default_archive_path != NULL) {
-    jio_snprintf(default_archive_path, len, "%s%sclasses.jsa",
-      jvm_path, os::file_separator());
-  }
+  jio_snprintf(default_archive_path, len, "%s%sclasses.jsa",
+               jvm_path, os::file_separator());
   return default_archive_path;
 }
 
--- a/src/hotspot/share/runtime/arguments.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/runtime/arguments.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -322,9 +322,6 @@
   // java launcher
   static const char* _sun_java_launcher;
 
-  // sun.java.launcher.pid, private property
-  static int    _sun_java_launcher_pid;
-
   // was this VM created via the -XXaltjvm=<path> option
   static bool   _sun_java_launcher_is_altjvm;
 
@@ -548,8 +545,6 @@
   static bool created_by_java_launcher();
   // -Dsun.java.launcher.is_altjvm
   static bool sun_java_launcher_is_altjvm();
-  // -Dsun.java.launcher.pid
-  static int sun_java_launcher_pid()        { return _sun_java_launcher_pid; }
 
   // -Xrun
   static AgentLibrary* libraries()          { return _libraryList.first(); }
--- a/src/hotspot/share/runtime/biasedLocking.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/runtime/biasedLocking.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -257,7 +257,7 @@
   BasicLock* highest_lock = NULL;
   for (int i = 0; i < cached_monitor_info->length(); i++) {
     MonitorInfo* mon_info = cached_monitor_info->at(i);
-    if (oopDesc::equals(mon_info->owner(), obj)) {
+    if (mon_info->owner() == obj) {
       log_trace(biasedlocking)("   mon_info->owner (" PTR_FORMAT ") == obj (" PTR_FORMAT ")",
                                p2i((void *) mon_info->owner()),
                                p2i((void *) obj));
@@ -693,7 +693,7 @@
   BasicLock* highest_lock = NULL;
   for (int i = 0; i < cached_monitor_info->length(); i++) {
     MonitorInfo* mon_info = cached_monitor_info->at(i);
-    if (oopDesc::equals(mon_info->owner(), obj)) {
+    if (mon_info->owner() == obj) {
       log_trace(biasedlocking)("   mon_info->owner (" PTR_FORMAT ") == obj (" PTR_FORMAT ")",
                                p2i(mon_info->owner()),
                                p2i(obj));
@@ -726,6 +726,29 @@
   assert(!obj->mark().has_bias_pattern(), "must not be biased");
 }
 
+void BiasedLocking::revoke_own_lock(Handle obj, TRAPS) {
+  assert(THREAD->is_Java_thread(), "must be called by a JavaThread");
+  JavaThread* thread = (JavaThread*)THREAD;
+
+  markWord mark = obj->mark();
+
+  if (!mark.has_bias_pattern()) {
+    return;
+  }
+
+  Klass *k = obj->klass();
+  assert(mark.biased_locker() == thread &&
+         k->prototype_header().bias_epoch() == mark.bias_epoch(), "Revoke failed, unhandled biased lock state");
+  ResourceMark rm;
+  log_info(biasedlocking)("Revoking bias by walking my own stack:");
+  EventBiasedLockSelfRevocation event;
+  BiasedLocking::walk_stack_and_revoke(obj(), (JavaThread*) thread);
+  thread->set_cached_monitor_info(NULL);
+  assert(!obj->mark().has_bias_pattern(), "invariant");
+  if (event.should_commit()) {
+    post_self_revocation_event(&event, k);
+  }
+}
 
 void BiasedLocking::revoke(Handle obj, TRAPS) {
   assert(!SafepointSynchronize::is_at_safepoint(), "must not be called while at safepoint");
@@ -864,23 +887,6 @@
 }
 
 
-void BiasedLocking::revoke_at_safepoint(GrowableArray<Handle>* objs) {
-  assert(SafepointSynchronize::is_at_safepoint(), "must only be called while at safepoint");
-  int len = objs->length();
-  for (int i = 0; i < len; i++) {
-    oop obj = (objs->at(i))();
-    HeuristicsResult heuristics = update_heuristics(obj);
-    if (heuristics == HR_SINGLE_REVOKE) {
-      single_revoke_at_safepoint(obj, false, NULL, NULL);
-    } else if ((heuristics == HR_BULK_REBIAS) ||
-               (heuristics == HR_BULK_REVOKE)) {
-      bulk_revoke_at_safepoint(obj, (heuristics == HR_BULK_REBIAS), NULL);
-    }
-  }
-  clean_up_cached_monitor_info();
-}
-
-
 void BiasedLocking::preserve_marks() {
   if (!UseBiasedLocking)
     return;
--- a/src/hotspot/share/runtime/biasedLocking.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/runtime/biasedLocking.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -190,12 +190,14 @@
   // This should be called by JavaThreads to revoke the bias of an object
   static void revoke(Handle obj, TRAPS);
 
+  // This must only be called by a JavaThread to revoke the bias of an owned object.
+  static void revoke_own_lock(Handle obj, TRAPS);
+
   static void revoke_at_safepoint(Handle obj);
 
   // These are used by deoptimization to ensure that monitors on the stack
   // can be migrated
   static void revoke(GrowableArray<Handle>* objs, JavaThread *biaser);
-  static void revoke_at_safepoint(GrowableArray<Handle>* objs);
 
   static void print_counters() { _counters.print(); }
   static BiasedLockingCounters* counters() { return &_counters; }
--- a/src/hotspot/share/runtime/deoptimization.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/runtime/deoptimization.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -157,6 +157,92 @@
   return fetch_unroll_info_helper(thread, exec_mode);
 JRT_END
 
+#if COMPILER2_OR_JVMCI
+static bool eliminate_allocations(JavaThread* thread, int exec_mode, CompiledMethod* compiled_method,
+                                  frame& deoptee, RegisterMap& map, GrowableArray<compiledVFrame*>* chunk) {
+  bool realloc_failures = false;
+  assert (chunk->at(0)->scope() != NULL,"expect only compiled java frames");
+
+  GrowableArray<ScopeValue*>* objects = chunk->at(0)->scope()->objects();
+
+  // The flag return_oop() indicates call sites which return oop
+  // in compiled code. Such sites include java method calls,
+  // runtime calls (for example, used to allocate new objects/arrays
+  // on slow code path) and any other calls generated in compiled code.
+  // It is not guaranteed that we can get such information here only
+  // by analyzing bytecode in deoptimized frames. This is why this flag
+  // is set during method compilation (see Compile::Process_OopMap_Node()).
+  // If the previous frame was popped or if we are dispatching an exception,
+  // we don't have an oop result.
+  bool save_oop_result = chunk->at(0)->scope()->return_oop() && !thread->popframe_forcing_deopt_reexecution() && (exec_mode == Deoptimization::Unpack_deopt);
+  Handle return_value;
+  if (save_oop_result) {
+    // Reallocation may trigger GC. If deoptimization happened on return from
+    // call which returns oop we need to save it since it is not in oopmap.
+    oop result = deoptee.saved_oop_result(&map);
+    assert(oopDesc::is_oop_or_null(result), "must be oop");
+    return_value = Handle(thread, result);
+    assert(Universe::heap()->is_in_or_null(result), "must be heap pointer");
+    if (TraceDeoptimization) {
+      ttyLocker ttyl;
+      tty->print_cr("SAVED OOP RESULT " INTPTR_FORMAT " in thread " INTPTR_FORMAT, p2i(result), p2i(thread));
+    }
+  }
+  if (objects != NULL) {
+    JRT_BLOCK
+      realloc_failures = Deoptimization::realloc_objects(thread, &deoptee, &map, objects, THREAD);
+    JRT_END
+    bool skip_internal = (compiled_method != NULL) && !compiled_method->is_compiled_by_jvmci();
+    Deoptimization::reassign_fields(&deoptee, &map, objects, realloc_failures, skip_internal);
+#ifndef PRODUCT
+    if (TraceDeoptimization) {
+      ttyLocker ttyl;
+      tty->print_cr("REALLOC OBJECTS in thread " INTPTR_FORMAT, p2i(thread));
+      Deoptimization::print_objects(objects, realloc_failures);
+    }
+#endif
+  }
+  if (save_oop_result) {
+    // Restore result.
+    deoptee.set_saved_oop_result(&map, return_value());
+  }
+  return realloc_failures;
+}
+
+static void eliminate_locks(JavaThread* thread, GrowableArray<compiledVFrame*>* chunk, bool realloc_failures) {
+#ifndef PRODUCT
+  bool first = true;
+#endif
+  for (int i = 0; i < chunk->length(); i++) {
+    compiledVFrame* cvf = chunk->at(i);
+    assert (cvf->scope() != NULL,"expect only compiled java frames");
+    GrowableArray<MonitorInfo*>* monitors = cvf->monitors();
+    if (monitors->is_nonempty()) {
+      Deoptimization::relock_objects(monitors, thread, realloc_failures);
+#ifndef PRODUCT
+      if (PrintDeoptimizationDetails) {
+        ttyLocker ttyl;
+        for (int j = 0; j < monitors->length(); j++) {
+          MonitorInfo* mi = monitors->at(j);
+          if (mi->eliminated()) {
+            if (first) {
+              first = false;
+              tty->print_cr("RELOCK OBJECTS in thread " INTPTR_FORMAT, p2i(thread));
+            }
+            if (mi->owner_is_scalar_replaced()) {
+              Klass* k = java_lang_Class::as_Klass(mi->owner_klass());
+              tty->print_cr("     failed reallocation for klass %s", k->external_name());
+            } else {
+              tty->print_cr("     object <" INTPTR_FORMAT "> locked", p2i(mi->owner()));
+            }
+          }
+        }
+      }
+#endif // !PRODUCT
+    }
+  }
+}
+#endif // COMPILER2_OR_JVMCI
 
 // This is factored, since it is both called from a JRT_LEAF (deoptimization) and a JRT_ENTRY (uncommon_trap)
 Deoptimization::UnrollBlock* Deoptimization::fetch_unroll_info_helper(JavaThread* thread, int exec_mode) {
@@ -201,95 +287,33 @@
   bool realloc_failures = false;
 
 #if COMPILER2_OR_JVMCI
+#if INCLUDE_JVMCI
+  bool jvmci_enabled = true;
+#else
+  bool jvmci_enabled = false;
+#endif
+
   // Reallocate the non-escaping objects and restore their fields. Then
   // relock objects if synchronization on them was eliminated.
-#if !INCLUDE_JVMCI
-  if (DoEscapeAnalysis || EliminateNestedLocks) {
-    if (EliminateAllocations) {
-#endif // INCLUDE_JVMCI
-      assert (chunk->at(0)->scope() != NULL,"expect only compiled java frames");
-      GrowableArray<ScopeValue*>* objects = chunk->at(0)->scope()->objects();
+  if (jvmci_enabled || ((DoEscapeAnalysis || EliminateNestedLocks) && EliminateAllocations)) {
+    realloc_failures = eliminate_allocations(thread, exec_mode, cm, deoptee, map, chunk);
+  }
+#endif // COMPILER2_OR_JVMCI
+
+  // Revoke biases, done with in java state.
+  // No safepoints allowed after this
+  revoke_from_deopt_handler(thread, deoptee, &map);
 
-      // The flag return_oop() indicates call sites which return oop
-      // in compiled code. Such sites include java method calls,
-      // runtime calls (for example, used to allocate new objects/arrays
-      // on slow code path) and any other calls generated in compiled code.
-      // It is not guaranteed that we can get such information here only
-      // by analyzing bytecode in deoptimized frames. This is why this flag
-      // is set during method compilation (see Compile::Process_OopMap_Node()).
-      // If the previous frame was popped or if we are dispatching an exception,
-      // we don't have an oop result.
-      bool save_oop_result = chunk->at(0)->scope()->return_oop() && !thread->popframe_forcing_deopt_reexecution() && (exec_mode == Unpack_deopt);
-      Handle return_value;
-      if (save_oop_result) {
-        // Reallocation may trigger GC. If deoptimization happened on return from
-        // call which returns oop we need to save it since it is not in oopmap.
-        oop result = deoptee.saved_oop_result(&map);
-        assert(oopDesc::is_oop_or_null(result), "must be oop");
-        return_value = Handle(thread, result);
-        assert(Universe::heap()->is_in_or_null(result), "must be heap pointer");
-        if (TraceDeoptimization) {
-          ttyLocker ttyl;
-          tty->print_cr("SAVED OOP RESULT " INTPTR_FORMAT " in thread " INTPTR_FORMAT, p2i(result), p2i(thread));
-        }
-      }
-      if (objects != NULL) {
-        JRT_BLOCK
-          realloc_failures = realloc_objects(thread, &deoptee, &map, objects, THREAD);
-        JRT_END
-        bool skip_internal = (cm != NULL) && !cm->is_compiled_by_jvmci();
-        reassign_fields(&deoptee, &map, objects, realloc_failures, skip_internal);
-#ifndef PRODUCT
-        if (TraceDeoptimization) {
-          ttyLocker ttyl;
-          tty->print_cr("REALLOC OBJECTS in thread " INTPTR_FORMAT, p2i(thread));
-          print_objects(objects, realloc_failures);
-        }
-#endif
-      }
-      if (save_oop_result) {
-        // Restore result.
-        deoptee.set_saved_oop_result(&map, return_value());
-      }
-#if !INCLUDE_JVMCI
-    }
-    if (EliminateLocks) {
-#endif // INCLUDE_JVMCI
-#ifndef PRODUCT
-      bool first = true;
-#endif
-      for (int i = 0; i < chunk->length(); i++) {
-        compiledVFrame* cvf = chunk->at(i);
-        assert (cvf->scope() != NULL,"expect only compiled java frames");
-        GrowableArray<MonitorInfo*>* monitors = cvf->monitors();
-        if (monitors->is_nonempty()) {
-          relock_objects(monitors, thread, realloc_failures);
-#ifndef PRODUCT
-          if (PrintDeoptimizationDetails) {
-            ttyLocker ttyl;
-            for (int j = 0; j < monitors->length(); j++) {
-              MonitorInfo* mi = monitors->at(j);
-              if (mi->eliminated()) {
-                if (first) {
-                  first = false;
-                  tty->print_cr("RELOCK OBJECTS in thread " INTPTR_FORMAT, p2i(thread));
-                }
-                if (mi->owner_is_scalar_replaced()) {
-                  Klass* k = java_lang_Class::as_Klass(mi->owner_klass());
-                  tty->print_cr("     failed reallocation for klass %s", k->external_name());
-                } else {
-                  tty->print_cr("     object <" INTPTR_FORMAT "> locked", p2i(mi->owner()));
-                }
-              }
-            }
-          }
-#endif // !PRODUCT
-        }
-      }
-#if !INCLUDE_JVMCI
-    }
+  // Ensure that no safepoint is taken after pointers have been stored
+  // in fields of rematerialized objects.  If a safepoint occurs from here on
+  // out the java state residing in the vframeArray will be missed.
+  // Locks may be rebaised in a safepoint.
+  NoSafepointVerifier no_safepoint;
+
+#if COMPILER2_OR_JVMCI
+  if (jvmci_enabled || ((DoEscapeAnalysis || EliminateNestedLocks) && EliminateLocks)) {
+    eliminate_locks(thread, chunk, realloc_failures);
   }
-#endif // INCLUDE_JVMCI
 #endif // COMPILER2_OR_JVMCI
 
   ScopeDesc* trap_scope = chunk->at(0)->scope();
@@ -305,11 +329,6 @@
     guarantee(exceptionObject() != NULL, "exception oop can not be null");
   }
 
-  // Ensure that no safepoint is taken after pointers have been stored
-  // in fields of rematerialized objects.  If a safepoint occurs from here on
-  // out the java state residing in the vframeArray will be missed.
-  NoSafepointVerifier no_safepoint;
-
   vframeArray* array = create_vframeArray(thread, deoptee, &map, chunk, realloc_failures);
 #if COMPILER2_OR_JVMCI
   if (realloc_failures) {
@@ -779,10 +798,33 @@
   return bt;
 JRT_END
 
+class DeoptimizeMarkedTC : public ThreadClosure {
+ public:
+  virtual void do_thread(Thread* thread) {
+    assert(thread->is_Java_thread(), "must be");
+    JavaThread* jt = (JavaThread*)thread;
+    jt->deoptimize_marked_methods();
+  }
+};
 
-int Deoptimization::deoptimize_dependents() {
-  Threads::deoptimized_wrt_marked_nmethods();
-  return 0;
+void Deoptimization::deoptimize_all_marked() {
+  ResourceMark rm;
+  DeoptimizationMarker dm;
+
+  if (SafepointSynchronize::is_at_safepoint()) {
+    DeoptimizeMarkedTC deopt;
+    // Make the dependent methods not entrant
+    CodeCache::make_marked_nmethods_not_entrant();
+    Threads::java_threads_do(&deopt);
+  } else {
+    // Make the dependent methods not entrant
+    {
+      MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+      CodeCache::make_marked_nmethods_not_entrant();
+    }
+    DeoptimizeMarkedTC deopt;
+    Handshake::execute(&deopt);
+  }
 }
 
 Deoptimization::DeoptAction Deoptimization::_unloaded_action
@@ -1397,14 +1439,7 @@
   }
 }
 
-
-void Deoptimization::revoke_biases_of_monitors(JavaThread* thread, frame fr, RegisterMap* map) {
-  if (!UseBiasedLocking) {
-    return;
-  }
-
-  GrowableArray<Handle>* objects_to_revoke = new GrowableArray<Handle>();
-
+static void get_monitors_from_stack(GrowableArray<Handle>* objects_to_revoke, JavaThread* thread, frame fr, RegisterMap* map) {
   // Unfortunately we don't have a RegisterMap available in most of
   // the places we want to call this routine so we need to walk the
   // stack again to update the register map.
@@ -1428,11 +1463,20 @@
     cvf = compiledVFrame::cast(cvf->sender());
   }
   collect_monitors(cvf, objects_to_revoke);
+}
 
-  if (SafepointSynchronize::is_at_safepoint()) {
-    BiasedLocking::revoke_at_safepoint(objects_to_revoke);
-  } else {
-    BiasedLocking::revoke(objects_to_revoke, thread);
+void Deoptimization::revoke_from_deopt_handler(JavaThread* thread, frame fr, RegisterMap* map) {
+  if (!UseBiasedLocking) {
+    return;
+  }
+  GrowableArray<Handle>* objects_to_revoke = new GrowableArray<Handle>();
+  get_monitors_from_stack(objects_to_revoke, thread, fr, map);
+
+  int len = objects_to_revoke->length();
+  for (int i = 0; i < len; i++) {
+    oop obj = (objects_to_revoke->at(i))();
+    BiasedLocking::revoke_own_lock(objects_to_revoke->at(i), thread);
+    assert(!obj->mark().has_bias_pattern(), "biases should be revoked by now");
   }
 }
 
@@ -1464,10 +1508,6 @@
   fr.deoptimize(thread);
 }
 
-void Deoptimization::deoptimize(JavaThread* thread, frame fr, RegisterMap *map) {
-  deoptimize(thread, fr, map, Reason_constraint);
-}
-
 void Deoptimization::deoptimize(JavaThread* thread, frame fr, RegisterMap *map, DeoptReason reason) {
   // Deoptimize only if the frame comes from compile code.
   // Do not deoptimize the frame which is already patched
@@ -1477,11 +1517,7 @@
   }
   ResourceMark rm;
   DeoptimizationMarker dm;
-  if (UseBiasedLocking) {
-    revoke_biases_of_monitors(thread, fr, map);
-  }
   deoptimize_single_frame(thread, fr, reason);
-
 }
 
 #if INCLUDE_JVMCI
@@ -1642,9 +1678,6 @@
   {
     ResourceMark rm;
 
-    // Revoke biases of any monitors in the frame to ensure we can migrate them
-    revoke_biases_of_monitors(thread, fr, &reg_map);
-
     DeoptReason reason = trap_request_reason(trap_request);
     DeoptAction action = trap_request_action(trap_request);
 #if INCLUDE_JVMCI
--- a/src/hotspot/share/runtime/deoptimization.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/runtime/deoptimization.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -137,13 +137,19 @@
     Unpack_LIMIT                = 4
   };
 
+  static void deoptimize_all_marked();
+
+ private:
   // Checks all compiled methods. Invalid methods are deleted and
   // corresponding activations are deoptimized.
   static int deoptimize_dependents();
 
+  // Revoke biased locks at deopt.
+  static void revoke_from_deopt_handler(JavaThread* thread, frame fr, RegisterMap* map);
+
+ public:
   // Deoptimizes a frame lazily. nmethod gets patched deopt happens on return to the frame
-  static void deoptimize(JavaThread* thread, frame fr, RegisterMap *reg_map);
-  static void deoptimize(JavaThread* thread, frame fr, RegisterMap *reg_map, DeoptReason reason);
+  static void deoptimize(JavaThread* thread, frame fr, RegisterMap *reg_map, DeoptReason reason = Reason_constraint);
 
 #if INCLUDE_JVMCI
   static address deoptimize_for_missing_exception_handler(CompiledMethod* cm);
@@ -154,12 +160,8 @@
   // Does the actual work for deoptimizing a single frame
   static void deoptimize_single_frame(JavaThread* thread, frame fr, DeoptReason reason);
 
-  // Helper function to revoke biases of all monitors in frame if UseBiasedLocking
-  // is enabled
-  static void revoke_biases_of_monitors(JavaThread* thread, frame fr, RegisterMap* map);
-
 #if COMPILER2_OR_JVMCI
-JVMCI_ONLY(public:)
+ public:
 
   // Support for restoring non-escaping objects
   static bool realloc_objects(JavaThread* thread, frame* fr, RegisterMap* reg_map, GrowableArray<ScopeValue*>* objects, TRAPS);
--- a/src/hotspot/share/runtime/fieldDescriptor.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/runtime/fieldDescriptor.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -212,7 +212,7 @@
   // Print a hint as to the underlying integer representation. This can be wrong for
   // pointers on an LP64 machine
 #ifdef _LP64
-  if ((ft == T_OBJECT || ft == T_ARRAY) && UseCompressedOops) {
+  if (is_reference_type(ft) && UseCompressedOops) {
     st->print(" (%x)", obj->int_field(offset()));
   }
   else // <- intended
--- a/src/hotspot/share/runtime/frame.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/runtime/frame.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -723,7 +723,7 @@
 
   void set(int size, BasicType type) {
     _offset -= size;
-    if (type == T_OBJECT || type == T_ARRAY) oop_offset_do();
+    if (is_reference_type(type)) oop_offset_do();
   }
 
   void oop_offset_do() {
@@ -776,7 +776,7 @@
 
   void set(int size, BasicType type) {
     assert (_offset >= 0, "illegal offset");
-    if (type == T_OBJECT || type == T_ARRAY) oop_at_offset_do(_offset);
+    if (is_reference_type(type)) oop_at_offset_do(_offset);
     _offset -= size;
   }
 
@@ -927,7 +927,7 @@
   VMRegPair*      _regs;        // VMReg list of arguments
 
   void set(int size, BasicType type) {
-    if (type == T_OBJECT || type == T_ARRAY) handle_oop_offset();
+    if (is_reference_type(type)) handle_oop_offset();
     _offset += size;
   }
 
--- a/src/hotspot/share/runtime/globals.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/runtime/globals.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -713,7 +713,7 @@
           "Use LWP-based instead of libthread-based synchronization "       \
           "(SPARC only)")                                                   \
                                                                             \
-  product(intx, MonitorBound, 0, "Bound Monitor population")                \
+  product(intx, MonitorBound, 0, "(Deprecated) Bound Monitor population")   \
           range(0, max_jint)                                                \
                                                                             \
   experimental(intx, MonitorUsedDeflationThreshold, 90,                     \
--- a/src/hotspot/share/runtime/handles.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/runtime/handles.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -79,8 +79,8 @@
   oop     operator () () const                   { return obj(); }
   oop     operator -> () const                   { return non_null_obj(); }
 
-  bool operator == (oop o) const                 { return oopDesc::equals(obj(), o); }
-  bool operator == (const Handle& h) const       { return oopDesc::equals(obj(), h.obj()); }
+  bool operator == (oop o) const                 { return obj() == o; }
+  bool operator == (const Handle& h) const       { return obj() == h.obj(); }
 
   // Null checks
   bool    is_null() const                        { return _handle == NULL; }
--- a/src/hotspot/share/runtime/javaCalls.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/runtime/javaCalls.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -390,7 +390,7 @@
   // Figure out if the result value is an oop or not (Note: This is a different value
   // than result_type. result_type will be T_INT of oops. (it is about size)
   BasicType result_type = runtime_type_from(result);
-  bool oop_result_flag = (result->get_type() == T_OBJECT || result->get_type() == T_ARRAY);
+  bool oop_result_flag = is_reference_type(result->get_type());
 
   // Find receiver
   Handle receiver = (!method->is_static()) ? args->receiver() : Handle();
@@ -619,7 +619,7 @@
   guarantee(method->size_of_parameters() == size_of_parameters(), "wrong no. of arguments pushed");
 
   // Treat T_OBJECT and T_ARRAY as the same
-  if (return_type == T_ARRAY) return_type = T_OBJECT;
+  if (is_reference_type(return_type)) return_type = T_OBJECT;
 
   // Check that oop information is correct
   Symbol* signature = method->signature();
--- a/src/hotspot/share/runtime/jniHandles.inline.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/runtime/jniHandles.inline.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -84,7 +84,7 @@
 inline bool JNIHandles::is_same_object(jobject handle1, jobject handle2) {
   oop obj1 = resolve_no_keepalive(handle1);
   oop obj2 = resolve_no_keepalive(handle2);
-  return oopDesc::equals(obj1, obj2);
+  return obj1 == obj2;
 }
 
 inline oop JNIHandles::resolve_non_null(jobject handle) {
--- a/src/hotspot/share/runtime/mutex.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/runtime/mutex.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -33,24 +33,46 @@
 #include "utilities/macros.hpp"
 
 #ifdef ASSERT
-void Mutex::check_safepoint_state(Thread* thread, bool do_safepoint_check) {
+void Mutex::check_block_state(Thread* thread) {
+  if (!_allow_vm_block && thread->is_VM_thread()) {
+    // JavaThreads are checked to make sure that they do not hold _allow_vm_block locks during operations
+    // that could safepoint.  Make sure the vm thread never uses locks with _allow_vm_block == false.
+    fatal("VM thread could block on lock that may be held by a JavaThread during safepoint: %s", name());
+  }
+
+  assert(!os::ThreadCrashProtection::is_crash_protected(thread),
+         "locking not allowed when crash protection is set");
+}
+
+void Mutex::check_safepoint_state(Thread* thread) {
+  check_block_state(thread);
+
   // If the JavaThread checks for safepoint, verify that the lock wasn't created with safepoint_check_never.
-  SafepointCheckRequired not_allowed = do_safepoint_check ?  Mutex::_safepoint_check_never :
-                                                             Mutex::_safepoint_check_always;
-  assert(!thread->is_active_Java_thread() || _safepoint_check_required != not_allowed,
+  if (thread->is_active_Java_thread()) {
+    assert(_safepoint_check_required != _safepoint_check_never,
+           "This lock should %s have a safepoint check for Java threads: %s",
+           _safepoint_check_required ? "always" : "never", name());
+
+    // Also check NoSafepointVerifier, and thread state is _thread_in_vm
+    thread->check_for_valid_safepoint_state();
+  } else {
+    // If initialized with safepoint_check_never, a NonJavaThread should never ask to safepoint check either.
+    assert(_safepoint_check_required != _safepoint_check_never,
+           "NonJavaThread should not check for safepoint");
+  }
+}
+
+void Mutex::check_no_safepoint_state(Thread* thread) {
+  check_block_state(thread);
+  assert(!thread->is_active_Java_thread() || _safepoint_check_required != _safepoint_check_always,
          "This lock should %s have a safepoint check for Java threads: %s",
          _safepoint_check_required ? "always" : "never", name());
-
-  // If defined with safepoint_check_never, a NonJavaThread should never ask to safepoint check either.
-  assert(thread->is_Java_thread() || !do_safepoint_check || _safepoint_check_required != Mutex::_safepoint_check_never,
-         "NonJavaThread should not check for safepoint");
 }
 #endif // ASSERT
 
-void Mutex::lock(Thread * self) {
-  check_safepoint_state(self, true);
+void Mutex::lock(Thread* self) {
+  check_safepoint_state(self);
 
-  DEBUG_ONLY(check_prelock_state(self, true));
   assert(_owner != self, "invariant");
 
   Mutex* in_flight_mutex = NULL;
@@ -60,7 +82,6 @@
     // The lock is contended
 
   #ifdef ASSERT
-    check_block_state(self);
     if (retry_cnt++ > 3) {
       log_trace(vmmutex)("JavaThread " INTPTR_FORMAT " on %d attempt trying to acquire vmmutex %s", p2i(self), retry_cnt, _name);
     }
@@ -98,7 +119,7 @@
 // in the wrong way this can lead to a deadlock with the safepoint code.
 
 void Mutex::lock_without_safepoint_check(Thread * self) {
-  check_safepoint_state(self, false);
+  check_no_safepoint_state(self);
   assert(_owner != self, "invariant");
   _lock.lock();
   assert_owner(NULL);
@@ -114,8 +135,9 @@
 
 bool Mutex::try_lock() {
   Thread * const self = Thread::current();
-  DEBUG_ONLY(check_prelock_state(self, false);)
-
+  // Some safepoint_check_always locks use try_lock, so cannot check
+  // safepoint state, but can check blocking state.
+  check_block_state(self);
   if (_lock.try_lock()) {
     assert_owner(NULL);
     set_owner(self);
@@ -160,7 +182,6 @@
 
 bool Monitor::wait_without_safepoint_check(long timeout) {
   Thread* const self = Thread::current();
-  check_safepoint_state(self, false);
 
   // timeout is in milliseconds - with zero meaning never timeout
   assert(timeout >= 0, "negative timeout");
@@ -171,6 +192,9 @@
   // conceptually set the owner to NULL in anticipation of
   // abdicating the lock in wait
   set_owner(NULL);
+  // Check safepoint state after resetting owner and possible NSV.
+  check_no_safepoint_state(self);
+
   int wait_status = _lock.wait(timeout);
   set_owner(self);
   return wait_status != 0;          // return true IFF timeout
@@ -178,7 +202,6 @@
 
 bool Monitor::wait(long timeout, bool as_suspend_equivalent) {
   Thread* const self = Thread::current();
-  check_safepoint_state(self, true);
 
   // timeout is in milliseconds - with zero meaning never timeout
   assert(timeout >= 0, "negative timeout");
@@ -193,6 +216,8 @@
   // conceptually set the owner to NULL in anticipation of
   // abdicating the lock in wait
   set_owner(NULL);
+  // Check safepoint state after resetting owner and possible NSV.
+  check_safepoint_state(self);
   JavaThread *jt = (JavaThread *)self;
   Mutex* in_flight_mutex = NULL;
 
@@ -255,7 +280,7 @@
   _rank            = Rank;
   _safepoint_check_required = safepoint_check_required;
 
-  assert(_safepoint_check_required != Mutex::_safepoint_check_sometimes || is_sometimes_ok(name),
+  assert(_safepoint_check_required != _safepoint_check_sometimes || is_sometimes_ok(name),
          "Lock has _safepoint_check_sometimes %s", name);
 #endif
 }
@@ -278,15 +303,27 @@
 // Non-product code
 
 #ifndef PRODUCT
+const char* print_safepoint_check(Mutex::SafepointCheckRequired safepoint_check) {
+  switch (safepoint_check) {
+  case Mutex::_safepoint_check_never:     return "safepoint_check_never";
+  case Mutex::_safepoint_check_sometimes: return "safepoint_check_sometimes";
+  case Mutex::_safepoint_check_always:    return "safepoint_check_always";
+  default: return "";
+  }
+}
+
 void Mutex::print_on(outputStream* st) const {
-  st->print_cr("Mutex: [" PTR_FORMAT "] %s - owner: " PTR_FORMAT,
-               p2i(this), _name, p2i(_owner));
+  st->print("Mutex: [" PTR_FORMAT "] %s - owner: " PTR_FORMAT,
+            p2i(this), _name, p2i(_owner));
+  if (_allow_vm_block) {
+    st->print("%s", " allow_vm_block");
+  }
+  st->print(" %s", print_safepoint_check(_safepoint_check_required));
+  st->cr();
 }
 #endif
 
-#ifndef PRODUCT
 #ifdef ASSERT
-
 void Mutex::assert_owner(Thread * expected) {
   const char* msg = "invalid owner";
   if (expected == NULL) {
@@ -340,7 +377,6 @@
   return res;
 }
 
-
 bool Mutex::contains(Mutex* locks, Mutex* lock) {
   for (; locks != NULL; locks = locks->next()) {
     if (locks == lock) {
@@ -349,7 +385,27 @@
   }
   return false;
 }
-#endif
+
+// NSV implied with locking allow_vm_block or !safepoint_check locks.
+void Mutex::no_safepoint_verifier(Thread* thread, bool enable) {
+  // Threads_lock is special, since the safepoint synchronization will not start before this is
+  // acquired. Hence, a JavaThread cannot be holding it at a safepoint. So is VMOperationRequest_lock,
+  // since it is used to transfer control between JavaThreads and the VMThread
+  // Do not *exclude* any locks unless you are absolutely sure it is correct. Ask someone else first!
+  if ((_allow_vm_block &&
+       this != Threads_lock &&
+       this != Compile_lock &&           // Temporary: should not be necessary when we get separate compilation
+       this != tty_lock &&               // The tty_lock is released for the safepoint.
+       this != VMOperationRequest_lock &&
+       this != VMOperationQueue_lock) ||
+       rank() == Mutex::special) {
+    if (enable) {
+      thread->_no_safepoint_count++;
+    } else {
+      thread->_no_safepoint_count--;
+    }
+  }
+}
 
 // Called immediately after lock acquisition or release as a diagnostic
 // to track the lock-set of the thread and test for rank violations that
@@ -376,7 +432,6 @@
 
     // link "this" into the owned locks list
 
-#ifdef ASSERT  // Thread::_owned_locks is under the same ifdef
     Mutex* locks = get_least_ranked_lock(new_owner->owned_locks());
     // Mutex::set_owner_implementation is a friend of Thread
 
@@ -401,20 +456,21 @@
 
     this->_next = new_owner->_owned_locks;
     new_owner->_owned_locks = this;
-#endif
+
+    // NSV implied with locking allow_vm_block flag.
+    no_safepoint_verifier(new_owner, true);
 
   } else {
     // the thread is releasing this lock
 
     Thread* old_owner = _owner;
-    DEBUG_ONLY(_last_owner = old_owner;)
+    _last_owner = old_owner;
 
     assert(old_owner != NULL, "removing the owner thread of an unowned mutex");
     assert(old_owner == Thread::current(), "removing the owner thread of an unowned mutex");
 
     _owner = NULL; // set the owner
 
-#ifdef ASSERT
     Mutex* locks = old_owner->owned_locks();
 
     // remove "this" from the owned locks list
@@ -434,33 +490,9 @@
       prev->_next = _next;
     }
     _next = NULL;
-#endif
+
+    // ~NSV implied with locking allow_vm_block flag.
+    no_safepoint_verifier(old_owner, false);
   }
 }
-
-
-// Factored out common sanity checks for locking mutex'es. Used by lock() and try_lock()
-void Mutex::check_prelock_state(Thread *thread, bool safepoint_check) {
-  if (safepoint_check) {
-    assert((!thread->is_active_Java_thread() || ((JavaThread *)thread)->thread_state() == _thread_in_vm)
-           || rank() == Mutex::special, "wrong thread state for using locks");
-    if (thread->is_VM_thread() && !allow_vm_block()) {
-      fatal("VM thread using lock %s (not allowed to block on)", name());
-    }
-    DEBUG_ONLY(if (rank() != Mutex::special) \
-               thread->check_for_valid_safepoint_state(false);)
-  }
-  assert(!os::ThreadCrashProtection::is_crash_protected(thread),
-         "locking not allowed when crash protection is set");
-}
-
-void Mutex::check_block_state(Thread *thread) {
-  if (!_allow_vm_block && thread->is_VM_thread()) {
-    warning("VM thread blocked on lock");
-    print();
-    BREAKPOINT;
-  }
-  assert(_owner != thread, "deadlock: blocking on mutex owned by current thread");
-}
-
-#endif // PRODUCT
+#endif // ASSERT
--- a/src/hotspot/share/runtime/mutex.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/runtime/mutex.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -64,7 +64,7 @@
        event,
        access         = event          +   1,
        tty            = access         +   2,
-       special        = tty            +   1,
+       special        = tty            +   2,
        suspend_resume = special        +   1,
        oopstorage     = suspend_resume +   2,
        leaf           = oopstorage     +   2,
@@ -81,21 +81,22 @@
   char _name[MUTEX_NAME_LEN];            // Name of mutex/monitor
 
   // Debugging fields for naming, deadlock detection, etc. (some only used in debug mode)
-#ifndef PRODUCT
-  bool      _allow_vm_block;
-  DEBUG_ONLY(int _rank;)                 // rank (to avoid/detect potential deadlocks)
-  DEBUG_ONLY(Mutex* _next;)              // Used by a Thread to link up owned locks
-  DEBUG_ONLY(Thread* _last_owner;)       // the last thread to own the lock
-  DEBUG_ONLY(static bool contains(Mutex* locks, Mutex* lock);)
-  DEBUG_ONLY(static Mutex* get_least_ranked_lock(Mutex* locks);)
-  DEBUG_ONLY(Mutex* get_least_ranked_lock_besides_this(Mutex* locks);)
-#endif
+#ifdef ASSERT
+  bool    _allow_vm_block;
+  int     _rank;                 // rank (to avoid/detect potential deadlocks)
+  Mutex*  _next;                 // Used by a Thread to link up owned locks
+  Thread* _last_owner;           // the last thread to own the lock
+  static bool contains(Mutex* locks, Mutex* lock);
+  static Mutex* get_least_ranked_lock(Mutex* locks);
+  Mutex* get_least_ranked_lock_besides_this(Mutex* locks);
+#endif  // ASSERT
 
-  void set_owner_implementation(Thread* owner)                        PRODUCT_RETURN;
-  void check_prelock_state     (Thread* thread, bool safepoint_check) PRODUCT_RETURN;
-  void check_block_state       (Thread* thread)                       PRODUCT_RETURN;
-  void check_safepoint_state   (Thread* thread, bool safepoint_check) NOT_DEBUG_RETURN;
+  void set_owner_implementation(Thread* owner)                        NOT_DEBUG({ _owner = owner;});
+  void check_block_state       (Thread* thread)                       NOT_DEBUG_RETURN;
+  void check_safepoint_state   (Thread* thread)                       NOT_DEBUG_RETURN;
+  void check_no_safepoint_state(Thread* thread)                       NOT_DEBUG_RETURN;
   void assert_owner            (Thread* expected)                     NOT_DEBUG_RETURN;
+  void no_safepoint_verifier   (Thread* thread, bool enable)          NOT_DEBUG_RETURN;
 
  public:
   enum {
@@ -171,21 +172,16 @@
   #ifndef PRODUCT
     void print_on(outputStream* st) const;
     void print() const                      { print_on(::tty); }
-    DEBUG_ONLY(int    rank() const          { return _rank; })
-    bool   allow_vm_block()                 { return _allow_vm_block; }
-
-    DEBUG_ONLY(Mutex *next()  const         { return _next; })
-    DEBUG_ONLY(void   set_next(Mutex *next) { _next = next; })
   #endif
+  #ifdef ASSERT
+    int    rank() const          { return _rank; }
+    bool   allow_vm_block()      { return _allow_vm_block; }
 
-  void set_owner(Thread* owner) {
-  #ifndef PRODUCT
-    set_owner_implementation(owner);
-    DEBUG_ONLY(void verify_mutex(Thread* thr);)
-  #else
-    _owner = owner;
-  #endif
-  }
+    Mutex *next()  const         { return _next; }
+    void   set_next(Mutex *next) { _next = next; }
+  #endif // ASSERT
+
+  void set_owner(Thread* owner)             { set_owner_implementation(owner); }
 };
 
 class Monitor : public Mutex {
--- a/src/hotspot/share/runtime/mutexLocker.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/runtime/mutexLocker.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -39,6 +39,7 @@
 // Consider using GCC's __read_mostly.
 
 Mutex*   Patching_lock                = NULL;
+Mutex*   CompiledMethod_lock          = NULL;
 Monitor* SystemDictionary_lock        = NULL;
 Mutex*   ProtectionDomainSet_lock     = NULL;
 Mutex*   SharedDictionary_lock        = NULL;
@@ -93,7 +94,6 @@
 Monitor* Notify_lock                  = NULL;
 Mutex*   ProfilePrint_lock            = NULL;
 Mutex*   ExceptionCache_lock          = NULL;
-Mutex*   OsrList_lock                 = NULL;
 Mutex*   NMethodSweeperStats_lock     = NULL;
 #ifndef PRODUCT
 Mutex*   FullGCALot_lock              = NULL;
@@ -230,16 +230,17 @@
   def(OopMapCacheAlloc_lock        , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always); // used for oop_map_cache allocation.
 
   def(MetaspaceExpand_lock         , PaddedMutex  , leaf-1,      true,  Monitor::_safepoint_check_never);
-  def(ClassLoaderDataGraph_lock    , PaddedMutex  , nonleaf,     true,  Monitor::_safepoint_check_always);
+  def(ClassLoaderDataGraph_lock    , PaddedMutex  , nonleaf,     false, Monitor::_safepoint_check_always);
 
   def(Patching_lock                , PaddedMutex  , special,     true,  Monitor::_safepoint_check_never);      // used for safepointing and code patching.
+  def(CompiledMethod_lock          , PaddedMutex  , special-1,   true,  Monitor::_safepoint_check_never);
   def(Service_lock                 , PaddedMonitor, special,     true,  Monitor::_safepoint_check_never);      // used for service thread operations
   def(JmethodIdCreation_lock       , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always); // used for creating jmethodIDs.
 
   def(SystemDictionary_lock        , PaddedMonitor, leaf,        true,  Monitor::_safepoint_check_always);
   def(ProtectionDomainSet_lock     , PaddedMutex  , leaf-1,      true,  Monitor::_safepoint_check_never);
   def(SharedDictionary_lock        , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always);
-  def(Module_lock                  , PaddedMutex  , leaf+2,      true,  Monitor::_safepoint_check_always);
+  def(Module_lock                  , PaddedMutex  , leaf+2,      false, Monitor::_safepoint_check_always);
   def(InlineCacheBuffer_lock       , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_never);
   def(VMStatistic_lock             , PaddedMutex  , leaf,        false, Monitor::_safepoint_check_always);
   def(ExpandHeap_lock              , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always); // Used during compilation by VM thread
@@ -248,7 +249,6 @@
   def(SymbolArena_lock             , PaddedMutex  , leaf+2,      true,  Monitor::_safepoint_check_never);
   def(ProfilePrint_lock            , PaddedMutex  , leaf,        false, Monitor::_safepoint_check_always); // serial profile printing
   def(ExceptionCache_lock          , PaddedMutex  , leaf,        false, Monitor::_safepoint_check_always); // serial profile printing
-  def(OsrList_lock                 , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_never);
   def(Debug1_lock                  , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_never);
 #ifndef PRODUCT
   def(FullGCALot_lock              , PaddedMutex  , leaf,        false, Monitor::_safepoint_check_always); // a lock to make FullGCALot MT safe
@@ -291,7 +291,7 @@
   def(MethodData_lock              , PaddedMutex  , nonleaf+3,   false, Monitor::_safepoint_check_always);
   def(TouchedMethodLog_lock        , PaddedMutex  , nonleaf+3,   false, Monitor::_safepoint_check_always);
 
-  def(MethodCompileQueue_lock      , PaddedMonitor, nonleaf+4,   true,  Monitor::_safepoint_check_always);
+  def(MethodCompileQueue_lock      , PaddedMonitor, nonleaf+4,   false, Monitor::_safepoint_check_always);
   def(Debug2_lock                  , PaddedMutex  , nonleaf+4,   true,  Monitor::_safepoint_check_never);
   def(Debug3_lock                  , PaddedMutex  , nonleaf+4,   true,  Monitor::_safepoint_check_never);
   def(CompileThread_lock           , PaddedMonitor, nonleaf+5,   false, Monitor::_safepoint_check_always);
@@ -316,7 +316,7 @@
 
   def(CodeHeapStateAnalytics_lock  , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_never);
   def(NMethodSweeperStats_lock     , PaddedMutex  , special,     true,  Monitor::_safepoint_check_never);
-  def(ThreadsSMRDelete_lock        , PaddedMonitor, special,     false, Monitor::_safepoint_check_never);
+  def(ThreadsSMRDelete_lock        , PaddedMonitor, special,     true,  Monitor::_safepoint_check_never);
   def(SharedDecoder_lock           , PaddedMutex  , native,      false, Monitor::_safepoint_check_never);
   def(DCmdFactory_lock             , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_never);
 #if INCLUDE_NMT
--- a/src/hotspot/share/runtime/mutexLocker.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/runtime/mutexLocker.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -32,6 +32,7 @@
 // Mutexes used in the VM.
 
 extern Mutex*   Patching_lock;                   // a lock used to guard code patching of compiled code
+extern Mutex*   CompiledMethod_lock;             // a lock used to guard a compiled method and OSR queues
 extern Monitor* SystemDictionary_lock;           // a lock on the system dictionary
 extern Mutex*   ProtectionDomainSet_lock;        // a lock on the pd_set list in the system dictionary
 extern Mutex*   SharedDictionary_lock;           // a lock on the CDS shared dictionary
@@ -90,7 +91,6 @@
 extern Monitor* Notify_lock;                     // a lock used to synchronize the start-up of the vm
 extern Mutex*   ProfilePrint_lock;               // a lock used to serialize the printing of profiles
 extern Mutex*   ExceptionCache_lock;             // a lock used to synchronize exception cache updates
-extern Mutex*   OsrList_lock;                    // a lock used to serialize access to OSR queues
 extern Mutex*   NMethodSweeperStats_lock;        // a lock used to serialize access to sweeper statistics
 
 #ifndef PRODUCT
@@ -149,6 +149,8 @@
 extern Monitor* JVMCI_lock;                      // Monitor to control initialization of JVMCI
 #endif
 
+extern Mutex* tty_lock;                          // lock to synchronize output.
+
 // A MutexLocker provides mutual exclusion with respect to a given mutex
 // for the scope which contains the locker.  The lock is an OS lock, not
 // an object lock, and the two do not interoperate.  Do not use Mutex-based
--- a/src/hotspot/share/runtime/objectMonitor.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/runtime/objectMonitor.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1205,7 +1205,7 @@
   EventJavaMonitorWait event;
 
   // check for a pending interrupt
-  if (interruptible && Thread::is_interrupted(Self, true) && !HAS_PENDING_EXCEPTION) {
+  if (interruptible && jt->is_interrupted(true) && !HAS_PENDING_EXCEPTION) {
     // post monitor waited event.  Note that this is past-tense, we are done waiting.
     if (JvmtiExport::should_post_monitor_waited()) {
       // Note: 'false' parameter is passed here because the
@@ -1275,7 +1275,7 @@
       // Thread is in thread_blocked state and oop access is unsafe.
       jt->set_suspend_equivalent();
 
-      if (interruptible && (Thread::is_interrupted(THREAD, false) || HAS_PENDING_EXCEPTION)) {
+      if (interruptible && (jt->is_interrupted(false) || HAS_PENDING_EXCEPTION)) {
         // Intentionally empty
       } else if (node._notified == 0) {
         if (millis <= 0) {
@@ -1401,7 +1401,7 @@
   if (!WasNotified) {
     // no, it could be timeout or Thread.interrupt() or both
     // check for interrupt event, otherwise it is timeout
-    if (interruptible && Thread::is_interrupted(Self, true) && !HAS_PENDING_EXCEPTION) {
+    if (interruptible && jt->is_interrupted(true) && !HAS_PENDING_EXCEPTION) {
       THROW(vmSymbols::java_lang_InterruptedException());
     }
   }
--- a/src/hotspot/share/runtime/os.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/runtime/os.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1224,9 +1224,6 @@
     }
 
     char* formatted_path = NEW_C_HEAP_ARRAY(char, formatted_path_len + 1, mtInternal);
-    if (formatted_path == NULL) {
-        return NULL;
-    }
 
     // Create boot classpath from format, substituting separator chars and
     // java home directory.
@@ -1330,9 +1327,6 @@
   }
   const char psepchar = *os::path_separator();
   char* inpath = NEW_C_HEAP_ARRAY(char, strlen(path) + 1, mtInternal);
-  if (inpath == NULL) {
-    return NULL;
-  }
   strcpy(inpath, path);
   size_t count = 1;
   char* p = strchr(inpath, psepchar);
@@ -1357,13 +1351,7 @@
                                     "sun.boot.library.path, to identify potential sources for this path.");
     }
     // allocate the string and add terminator storage
-    char* s  = NEW_C_HEAP_ARRAY_RETURN_NULL(char, len + 1, mtInternal);
-
-    if (s == NULL) {
-      // release allocated storage before returning null
-      free_array_of_char_arrays(opath, i++);
-      return NULL;
-    }
+    char* s = NEW_C_HEAP_ARRAY(char, len + 1, mtInternal);
     strncpy(s, p, len);
     s[len] = '\0';
     opath[i] = s;
--- a/src/hotspot/share/runtime/os.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/runtime/os.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -480,9 +480,6 @@
   static OSReturn set_priority(Thread* thread, ThreadPriority priority);
   static OSReturn get_priority(const Thread* const thread, ThreadPriority& priority);
 
-  static void interrupt(Thread* thread);
-  static bool is_interrupted(Thread* thread, bool clear_interrupted);
-
   static int pd_self_suspend_thread(Thread* thread);
 
   static ExtendedPC fetch_frame_from_context(const void* ucVoid, intptr_t** sp, intptr_t** fp);
--- a/src/hotspot/share/runtime/osThread.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/runtime/osThread.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -30,7 +30,7 @@
   pd_initialize();
   set_start_proc(start_proc);
   set_start_parm(start_parm);
-  set_interrupted(false);
+  _interrupted = 0;
 }
 
 OSThread::~OSThread() {
--- a/src/hotspot/share/runtime/osThread.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/runtime/osThread.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -82,10 +82,11 @@
   void set_start_proc(OSThreadStartFunc start_proc) { _start_proc = start_proc; }
   void* start_parm() const                          { return _start_parm; }
   void set_start_parm(void* start_parm)             { _start_parm = start_parm; }
-
+  // These are specialized on Windows.
+#ifndef _WINDOWS
   volatile bool interrupted() const                 { return _interrupted != 0; }
   void set_interrupted(bool z)                      { _interrupted = z ? 1 : 0; }
-
+#endif
   // Printing
   void print_on(outputStream* st) const;
   void print() const;
--- a/src/hotspot/share/runtime/reflection.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/runtime/reflection.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -92,7 +92,7 @@
   if (type == T_VOID) {
     return NULL;
   }
-  if (type == T_OBJECT || type == T_ARRAY) {
+  if (is_reference_type(type)) {
     // regular objects are not boxed
     return (oop) value->l;
   }
@@ -756,7 +756,7 @@
                                      TRAPS) {
 
 
-  if (T_OBJECT == ss->type() || T_ARRAY == ss->type()) {
+  if (is_reference_type(ss->type())) {
     Symbol* name = ss->as_symbol();
     oop loader = method->method_holder()->class_loader();
     oop protection_domain = method->method_holder()->protection_domain();
--- a/src/hotspot/share/runtime/sharedRuntime.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/runtime/sharedRuntime.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -2902,7 +2902,12 @@
       nm = SharedRuntime::generate_native_wrapper(&_masm, method, compile_id, sig_bt, regs, ret_type, critical_entry);
 
       if (nm != NULL) {
-        method->set_code(method, nm);
+        {
+          MutexLocker pl(CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
+          if (nm->make_in_use()) {
+            method->set_code(method, nm);
+          }
+        }
 
         DirectiveSet* directive = DirectivesStack::getDefaultDirective(CompileBroker::compiler(CompLevel_simple));
         if (directive->PrintAssemblyOption) {
--- a/src/hotspot/share/runtime/synchronizer.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/runtime/synchronizer.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -171,7 +171,7 @@
 
   if (mark.has_monitor()) {
     ObjectMonitor* const mon = mark.monitor();
-    assert(oopDesc::equals((oop) mon->object(), obj), "invariant");
+    assert(mon->object() == obj, "invariant");
     if (mon->owner() != self) return false;  // slow-path for IMS exception
 
     if (mon->first_waiter() != NULL) {
@@ -215,7 +215,7 @@
 
   if (mark.has_monitor()) {
     ObjectMonitor* const m = mark.monitor();
-    assert(oopDesc::equals((oop) m->object(), obj), "invariant");
+    assert(m->object() == obj, "invariant");
     Thread* const owner = (Thread *) m->_owner;
 
     // Lock contention and Transactional Lock Elision (TLE) diagnostics
@@ -419,7 +419,7 @@
 ObjectLocker::ObjectLocker(Handle obj, Thread* thread, bool do_lock) {
   _dolock = do_lock;
   _thread = thread;
-  _thread->check_for_valid_safepoint_state(false);
+  _thread->check_for_valid_safepoint_state();
   _obj = obj;
 
   if (_dolock) {
@@ -1301,7 +1301,7 @@
       ObjectMonitor* inf = mark.monitor();
       markWord dmw = inf->header();
       assert(dmw.is_neutral(), "invariant: header=" INTPTR_FORMAT, dmw.value());
-      assert(oopDesc::equals((oop) inf->object(), object), "invariant");
+      assert(inf->object() == object, "invariant");
       assert(ObjectSynchronizer::verify_objmon_isinpool(inf), "monitor is invalid");
       return inf;
     }
--- a/src/hotspot/share/runtime/thread.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/runtime/thread.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -166,7 +166,7 @@
 
 #ifndef USE_LIBRARY_BASED_TLS_ONLY
 // Current thread is maintained as a thread-local variable
-THREAD_LOCAL_DECL Thread* Thread::_thr_current = NULL;
+THREAD_LOCAL Thread* Thread::_thr_current = NULL;
 #endif
 
 // ======= Thread ========
@@ -856,19 +856,6 @@
   return true;
 }
 
-void Thread::interrupt(Thread* thread) {
-  debug_only(check_for_dangling_thread_pointer(thread);)
-  os::interrupt(thread);
-}
-
-bool Thread::is_interrupted(Thread* thread, bool clear_interrupted) {
-  debug_only(check_for_dangling_thread_pointer(thread);)
-  // Note:  If clear_interrupted==false, this simply fetches and
-  // returns the value of the field osthread()->interrupted().
-  return os::is_interrupted(thread, clear_interrupted);
-}
-
-
 // GC Support
 bool Thread::claim_par_threads_do(uintx claim_token) {
   uintx token = _threads_do_token;
@@ -986,6 +973,7 @@
   if (!is_Java_thread()) return;
 
   if (_no_safepoint_count > 0) {
+    print_owned_locks();
     fatal("Possible safepoint reached by thread that does not allow it");
   }
 #ifdef CHECK_UNHANDLED_OOPS
@@ -994,37 +982,18 @@
 #endif // CHECK_UNHANDLED_OOPS
 }
 
-// The flag: potential_vm_operation notifies if this particular safepoint state could potentially
-// invoke the vm-thread (e.g., an oop allocation). In that case, we also have to make sure that
-// no locks which allow_vm_block's are held
-void Thread::check_for_valid_safepoint_state(bool potential_vm_operation) {
+void Thread::check_for_valid_safepoint_state() {
   if (!is_Java_thread()) return;
 
+  // Check NoSafepointVerifier, which is implied by locks taken that can be
+  // shared with the VM thread.  This makes sure that no locks with allow_vm_block
+  // are held.
   check_possible_safepoint();
 
   if (((JavaThread*)this)->thread_state() != _thread_in_vm) {
     fatal("LEAF method calling lock?");
   }
 
-  if (potential_vm_operation && !Universe::is_bootstrapping()) {
-    // Make sure we do not hold any locks that the VM thread also uses.
-    // This could potentially lead to deadlocks
-    for (Mutex* cur = _owned_locks; cur; cur = cur->next()) {
-      // Threads_lock is special, since the safepoint synchronization will not start before this is
-      // acquired. Hence, a JavaThread cannot be holding it at a safepoint. So is VMOperationRequest_lock,
-      // since it is used to transfer control between JavaThreads and the VMThread
-      // Do not *exclude* any locks unless you are absolutely sure it is correct. Ask someone else first!
-      if ((cur->allow_vm_block() &&
-           cur != Threads_lock &&
-           cur != Compile_lock &&               // Temporary: should not be necessary when we get separate compilation
-           cur != VMOperationRequest_lock &&
-           cur != VMOperationQueue_lock) ||
-           cur->rank() == Mutex::special) {
-        fatal("Thread holding lock at safepoint that vm can block on: %s", cur->name());
-      }
-    }
-  }
-
   if (GCALotAtAllSafepoints) {
     // We could enter a safepoint here and thus have a gc
     InterfaceSupport::check_gc_alot();
@@ -1566,9 +1535,6 @@
 // Attempt to enlarge the array for per thread counters.
 jlong* resize_counters_array(jlong* old_counters, int current_size, int new_size) {
   jlong* new_counters = NEW_C_HEAP_ARRAY(jlong, new_size, mtJVMCI);
-  if (new_counters == NULL) {
-    return NULL;
-  }
   if (old_counters == NULL) {
     old_counters = new_counters;
     memset(old_counters, 0, sizeof(jlong) * new_size);
@@ -1585,54 +1551,34 @@
 }
 
 // Attempt to enlarge the array for per thread counters.
-bool JavaThread::resize_counters(int current_size, int new_size) {
-  jlong* new_counters = resize_counters_array(_jvmci_counters, current_size, new_size);
-  if (new_counters == NULL) {
-    return false;
-  } else {
-    _jvmci_counters = new_counters;
-    return true;
-  }
+void JavaThread::resize_counters(int current_size, int new_size) {
+  _jvmci_counters = resize_counters_array(_jvmci_counters, current_size, new_size);
 }
 
 class VM_JVMCIResizeCounters : public VM_Operation {
  private:
   int _new_size;
-  bool _failed;
 
  public:
-  VM_JVMCIResizeCounters(int new_size) : _new_size(new_size), _failed(false) { }
+  VM_JVMCIResizeCounters(int new_size) : _new_size(new_size) { }
   VMOp_Type type()                  const        { return VMOp_JVMCIResizeCounters; }
   bool allow_nested_vm_operations() const        { return true; }
   void doit() {
     // Resize the old thread counters array
     jlong* new_counters = resize_counters_array(JavaThread::_jvmci_old_thread_counters, JVMCICounterSize, _new_size);
-    if (new_counters == NULL) {
-      _failed = true;
-      return;
-    } else {
-      JavaThread::_jvmci_old_thread_counters = new_counters;
-    }
+    JavaThread::_jvmci_old_thread_counters = new_counters;
 
     // Now resize each threads array
     for (JavaThreadIteratorWithHandle jtiwh; JavaThread *tp = jtiwh.next(); ) {
-      if (!tp->resize_counters(JVMCICounterSize, _new_size)) {
-        _failed = true;
-        break;
-      }
+      tp->resize_counters(JVMCICounterSize, _new_size);
     }
-    if (!_failed) {
-      JVMCICounterSize = _new_size;
-    }
-  }
-
-  bool failed() { return _failed; }
+    JVMCICounterSize = _new_size;
+  }
 };
 
-bool JavaThread::resize_all_jvmci_counters(int new_size) {
+void JavaThread::resize_all_jvmci_counters(int new_size) {
   VM_JVMCIResizeCounters op(new_size);
   VMThread::execute(&op);
-  return !op.failed();
 }
 
 #endif // INCLUDE_JVMCI
@@ -1726,6 +1672,56 @@
   assert(deferred_card_mark().is_empty(), "Default MemRegion ctor");
 }
 
+
+// interrupt support
+
+void JavaThread::interrupt() {
+  debug_only(check_for_dangling_thread_pointer(this);)
+
+  if (!osthread()->interrupted()) {
+    osthread()->set_interrupted(true);
+    // More than one thread can get here with the same value of osthread,
+    // resulting in multiple notifications.  We do, however, want the store
+    // to interrupted() to be visible to other threads before we execute unpark().
+    OrderAccess::fence();
+
+    // For JavaThread::sleep. Historically we only unpark if changing to the interrupted
+    // state, in contrast to the other events below. Not clear exactly why.
+    _SleepEvent->unpark();
+  }
+
+  // For JSR166. Unpark even if interrupt status already was set.
+  parker()->unpark();
+
+  // For ObjectMonitor and JvmtiRawMonitor
+  _ParkEvent->unpark();
+}
+
+
+bool JavaThread::is_interrupted(bool clear_interrupted) {
+  debug_only(check_for_dangling_thread_pointer(this);)
+  bool interrupted = osthread()->interrupted();
+
+  // NOTE that since there is no "lock" around the interrupt and
+  // is_interrupted operations, there is the possibility that the
+  // interrupted flag (in osThread) will be "false" but that the
+  // low-level events will be in the signaled state. This is
+  // intentional. The effect of this is that Object.wait() and
+  // LockSupport.park() will appear to have a spurious wakeup, which
+  // is allowed and not harmful, and the possibility is so rare that
+  // it is not worth the added complexity to add yet another lock.
+  // For the sleep event an explicit reset is performed on entry
+  // to JavaThread::sleep, so there is no early return. It has also been
+  // recommended not to put the interrupted flag into the "event"
+  // structure because it hides the issue.
+  if (interrupted && clear_interrupted) {
+    osthread()->set_interrupted(false);
+    // consider thread->_SleepEvent->reset() ... optional optimization
+  }
+
+  return interrupted;
+}
+
 bool JavaThread::reguard_stack(address cur_sp) {
   if (_stack_guard_state != stack_guard_yellow_reserved_disabled
       && _stack_guard_state != stack_guard_reserved_disabled) {
@@ -1766,7 +1762,10 @@
 void JavaThread::block_if_vm_exited() {
   if (_terminated == _vm_exited) {
     // _vm_exited is set at safepoint, and Threads_lock is never released
-    // we will block here forever
+    // we will block here forever.
+    // Here we can be doing a jump from a safe state to an unsafe state without
+    // proper transition, but it happens after the final safepoint has begun.
+    set_thread_state(_thread_in_vm);
     Threads_lock->lock();
     ShouldNotReachHere();
   }
@@ -2370,8 +2369,8 @@
   }
 
 
-  // Interrupt thread so it will wake up from a potential wait()
-  Thread::interrupt(this);
+  // Interrupt thread so it will wake up from a potential wait()/sleep()/park()
+  this->interrupt();
 }
 
 // External suspension mechanism.
@@ -2857,7 +2856,7 @@
 #endif // PRODUCT
 
 
-void JavaThread::deoptimized_wrt_marked_nmethods() {
+void JavaThread::deoptimize_marked_methods() {
   if (!has_last_Java_frame()) return;
   // BiasedLocking needs an updated RegisterMap for the revoke monitors pass
   StackFrameStream fst(this, UseBiasedLocking);
@@ -2868,7 +2867,6 @@
   }
 }
 
-
 // If the caller is a NamedThread, then remember, in the current scope,
 // the given JavaThread in its _processed_thread field.
 class RememberProcessedThread: public StackObj {
@@ -3361,7 +3359,7 @@
 
   for (;;) {
     // interruption has precedence over timing out
-    if (os::is_interrupted(this, true)) {
+    if (this->is_interrupted(true)) {
       return false;
     }
 
@@ -3389,7 +3387,7 @@
       // time moving backwards, should only happen if no monotonic clock
       // not a guarantee() because JVM should not abort on kernel/glibc bugs
       assert(!os::supports_monotonic_clock(),
-             "unexpected time moving backwards detected in os::sleep()");
+             "unexpected time moving backwards detected in JavaThread::sleep()");
     } else {
       millis -= (newtime - prevtime) / NANOSECS_PER_MILLISEC;
     }
@@ -4601,13 +4599,6 @@
   threads_do(&handles_closure);
 }
 
-void Threads::deoptimized_wrt_marked_nmethods() {
-  ALL_JAVA_THREADS(p) {
-    p->deoptimized_wrt_marked_nmethods();
-  }
-}
-
-
 // Get count Java threads that are waiting to enter the specified monitor.
 GrowableArray<JavaThread*>* Threads::get_pending_threads(ThreadsList * t_list,
                                                          int count,
@@ -4963,65 +4954,6 @@
   }
 }
 
-void Thread::muxAcquireW(volatile intptr_t * Lock, ParkEvent * ev) {
-  intptr_t w = Atomic::cmpxchg(LOCKBIT, Lock, (intptr_t)0);
-  if (w == 0) return;
-  if ((w & LOCKBIT) == 0 && Atomic::cmpxchg(w|LOCKBIT, Lock, w) == w) {
-    return;
-  }
-
-  ParkEvent * ReleaseAfter = NULL;
-  if (ev == NULL) {
-    ev = ReleaseAfter = ParkEvent::Allocate(NULL);
-  }
-  assert((intptr_t(ev) & LOCKBIT) == 0, "invariant");
-  for (;;) {
-    guarantee(ev->OnList == 0, "invariant");
-    int its = (os::is_MP() ? 100 : 0) + 1;
-
-    // Optional spin phase: spin-then-park strategy
-    while (--its >= 0) {
-      w = *Lock;
-      if ((w & LOCKBIT) == 0 && Atomic::cmpxchg(w|LOCKBIT, Lock, w) == w) {
-        if (ReleaseAfter != NULL) {
-          ParkEvent::Release(ReleaseAfter);
-        }
-        return;
-      }
-    }
-
-    ev->reset();
-    ev->OnList = intptr_t(Lock);
-    // The following fence() isn't _strictly necessary as the subsequent
-    // CAS() both serializes execution and ratifies the fetched *Lock value.
-    OrderAccess::fence();
-    for (;;) {
-      w = *Lock;
-      if ((w & LOCKBIT) == 0) {
-        if (Atomic::cmpxchg(w|LOCKBIT, Lock, w) == w) {
-          ev->OnList = 0;
-          // We call ::Release while holding the outer lock, thus
-          // artificially lengthening the critical section.
-          // Consider deferring the ::Release() until the subsequent unlock(),
-          // after we've dropped the outer lock.
-          if (ReleaseAfter != NULL) {
-            ParkEvent::Release(ReleaseAfter);
-          }
-          return;
-        }
-        continue;      // Interference -- *Lock changed -- Just retry
-      }
-      assert(w & LOCKBIT, "invariant");
-      ev->ListNext = (ParkEvent *) (w & ~LOCKBIT);
-      if (Atomic::cmpxchg(intptr_t(ev)|LOCKBIT, Lock, w) == w) break;
-    }
-
-    while (ev->OnList != 0) {
-      ev->park();
-    }
-  }
-}
-
 // Release() must extract a successor from the list and then wake that thread.
 // It can "pop" the front of the list or use a detach-modify-reattach (DMR) scheme
 // similar to that used by ParkEvent::Allocate() and ::Release().  DMR-based
--- a/src/hotspot/share/runtime/thread.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/runtime/thread.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -142,7 +142,7 @@
 
 #ifndef USE_LIBRARY_BASED_TLS_ONLY
   // Current thread is maintained as a thread-local variable
-  static THREAD_LOCAL_DECL Thread* _thr_current;
+  static THREAD_LOCAL Thread* _thr_current;
 #endif
 
   // Thread local data area available to the GC. The internal
@@ -514,8 +514,6 @@
   static void set_priority(Thread* thread, ThreadPriority priority);
   static ThreadPriority get_priority(const Thread* const thread);
   static void start(Thread* thread);
-  static void interrupt(Thread* thr);
-  static bool is_interrupted(Thread* thr, bool clear_interrupted);
 
   void set_native_thread_name(const char *name) {
     assert(Thread::current() == this, "set_native_thread_name can only be called on the current thread");
@@ -755,7 +753,7 @@
 
   // These functions check conditions on a JavaThread before possibly going to a safepoint,
   // including NoSafepointVerifier.
-  void check_for_valid_safepoint_state(bool potential_vm_operation) NOT_DEBUG_RETURN;
+  void check_for_valid_safepoint_state() NOT_DEBUG_RETURN;
   void check_possible_safepoint() NOT_DEBUG_RETURN;
 
  private:
@@ -804,7 +802,6 @@
   static void SpinAcquire(volatile int * Lock, const char * Name);
   static void SpinRelease(volatile int * Lock);
   static void muxAcquire(volatile intptr_t * Lock, const char * Name);
-  static void muxAcquireW(volatile intptr_t * Lock, ParkEvent * ev);
   static void muxRelease(volatile intptr_t * Lock);
 };
 
@@ -1146,10 +1143,8 @@
  public:
   static jlong* _jvmci_old_thread_counters;
   static void collect_counters(jlong* array, int length);
-
-  bool resize_counters(int current_size, int new_size);
-
-  static bool resize_all_jvmci_counters(int new_size);
+  void resize_counters(int current_size, int new_size);
+  static void resize_all_jvmci_counters(int new_size);
 
  private:
 #endif // INCLUDE_JVMCI
@@ -1888,7 +1883,7 @@
   void deoptimize();
   void make_zombies();
 
-  void deoptimized_wrt_marked_nmethods();
+  void deoptimize_marked_methods();
 
  public:
   // Returns the running thread as a JavaThread
@@ -2055,9 +2050,14 @@
   InstanceKlass* _class_to_be_initialized;
 
   // java.lang.Thread.sleep support
+  ParkEvent * _SleepEvent;
 public:
-  ParkEvent * _SleepEvent;
   bool sleep(jlong millis);
+
+  // java.lang.Thread interruption support
+  void interrupt();
+  bool is_interrupted(bool clear_interrupted);
+
 };
 
 // Inline implementation of JavaThread::current
--- a/src/hotspot/share/runtime/tieredThresholdPolicy.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/runtime/tieredThresholdPolicy.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -445,6 +445,7 @@
         if (mh->has_compiled_code()) {
           mh->code()->make_not_entrant();
         }
+        MutexLocker pl(CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
         Method::set_code(mh, mh->aot_code());
       }
     }
--- a/src/hotspot/share/runtime/vframe.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/runtime/vframe.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -135,7 +135,7 @@
     //
     // Skip the monitor that the thread is blocked to enter or waiting on
     //
-    if (!found_first_monitor && (oopDesc::equals(obj, pending_obj) || oopDesc::equals(obj, waiting_obj))) {
+    if (!found_first_monitor && (obj == pending_obj || obj == waiting_obj)) {
       continue;
     }
     found_first_monitor = true;
--- a/src/hotspot/share/runtime/vmOperations.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/runtime/vmOperations.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -115,18 +115,6 @@
   }
 }
 
-void VM_Deoptimize::doit() {
-  // We do not want any GCs to happen while we are in the middle of this VM operation
-  ResourceMark rm;
-  DeoptimizationMarker dm;
-
-  // Deoptimize all activations depending on marked nmethods
-  Deoptimization::deoptimize_dependents();
-
-  // Make the dependent methods not entrant
-  CodeCache::make_marked_nmethods_not_entrant();
-}
-
 void VM_MarkActiveNMethods::doit() {
   NMethodSweeper::mark_active_nmethods();
 }
--- a/src/hotspot/share/runtime/vmOperations.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/runtime/vmOperations.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -49,7 +49,6 @@
   template(ClearICs)                              \
   template(ForceSafepoint)                        \
   template(ForceAsyncSafepoint)                   \
-  template(Deoptimize)                            \
   template(DeoptimizeFrame)                       \
   template(DeoptimizeAll)                         \
   template(ZombieAll)                             \
@@ -318,14 +317,6 @@
   VM_GTestExecuteAtSafepoint() {}
 };
 
-class VM_Deoptimize: public VM_Operation {
- public:
-  VM_Deoptimize() {}
-  VMOp_Type type() const                        { return VMOp_Deoptimize; }
-  void doit();
-  bool allow_nested_vm_operations() const        { return true; }
-};
-
 class VM_MarkActiveNMethods: public VM_Operation {
  public:
   VM_MarkActiveNMethods() {}
--- a/src/hotspot/share/runtime/vmThread.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/runtime/vmThread.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -556,6 +556,7 @@
           _cur_vm_operation = safepoint_ops;
           if (_cur_vm_operation != NULL) {
             do {
+              EventMark em("Executing coalesced safepoint VM operation: %s", _cur_vm_operation->name());
               log_debug(vmthread)("Evaluating coalesced safepoint VM operation: %s", _cur_vm_operation->name());
               // evaluate_operation deletes the op object so we have
               // to grab the next op now
@@ -668,7 +669,7 @@
     bool concurrent = op->evaluate_concurrently();
     // only blocking VM operations need to verify the caller's safepoint state:
     if (!concurrent) {
-      t->check_for_valid_safepoint_state(true);
+      t->check_for_valid_safepoint_state();
     }
 
     // New request from Java thread, evaluate prologue
--- a/src/hotspot/share/services/dtraceAttacher.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/services/dtraceAttacher.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,23 +33,6 @@
 
 #ifdef SOLARIS
 
-class VM_DeoptimizeTheWorld : public VM_Operation {
- public:
-  VMOp_Type type() const {
-    return VMOp_DeoptimizeTheWorld;
-  }
-  void doit() {
-    CodeCache::mark_all_nmethods_for_deoptimization();
-    ResourceMark rm;
-    DeoptimizationMarker dm;
-    // Deoptimize all activations depending on marked methods
-    Deoptimization::deoptimize_dependents();
-
-    // Mark the dependent methods non entrant
-    CodeCache::make_marked_nmethods_not_entrant();
-  }
-};
-
 static void set_bool_flag(const char* name, bool value) {
   JVMFlag* flag = JVMFlag::find_flag(name);
   JVMFlag::boolAtPut(flag, &value, JVMFlag::ATTACH_ON_DEMAND);
@@ -74,8 +57,8 @@
 
   if (changed) {
     // one or more flags changed, need to deoptimize
-    VM_DeoptimizeTheWorld op;
-    VMThread::execute(&op);
+    CodeCache::mark_all_nmethods_for_deoptimization();
+    Deoptimization::deoptimize_all_marked();
   }
 }
 
@@ -97,8 +80,8 @@
   }
   if (changed) {
     // one or more flags changed, need to deoptimize
-    VM_DeoptimizeTheWorld op;
-    VMThread::execute(&op);
+    CodeCache::mark_all_nmethods_for_deoptimization();
+    Deoptimization::deoptimize_all_marked();
   }
 }
 
--- a/src/hotspot/share/services/memoryManager.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/services/memoryManager.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -70,7 +70,7 @@
 
   int add_pool(MemoryPool* pool);
 
-  bool is_manager(instanceHandle mh)     { return oopDesc::equals(mh(), _memory_mgr_obj); }
+  bool is_manager(instanceHandle mh)     { return mh() == _memory_mgr_obj; }
 
   virtual instanceOop get_memory_manager_instance(TRAPS);
   virtual bool is_gc_memory_manager()    { return false; }
--- a/src/hotspot/share/services/memoryPool.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/services/memoryPool.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -95,7 +95,7 @@
   // max size could be changed
   virtual size_t max_size()    const       { return _max_size; }
 
-  bool is_pool(instanceHandle pool) { return oopDesc::equals(pool(), _memory_pool_obj); }
+  bool is_pool(instanceHandle pool) { return pool() == _memory_pool_obj; }
 
   bool available_for_allocation()   { return _available_for_allocation; }
   bool set_available_for_allocation(bool value) {
--- a/src/hotspot/share/services/threadService.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/services/threadService.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -680,7 +680,7 @@
     for (int j = 0; j < len; j++) {
       oop monitor = locked_monitors->at(j);
       assert(monitor != NULL, "must be a Java object");
-      if (oopDesc::equals(monitor, object)) {
+      if (monitor == object) {
         found = true;
         break;
       }
--- a/src/hotspot/share/utilities/concurrentHashTable.inline.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/utilities/concurrentHashTable.inline.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -999,8 +999,8 @@
 {
   _stats_rate = TableRateStatistics();
   _resize_lock =
-    new Mutex(Mutex::leaf, "ConcurrentHashTable", false,
-              Monitor::_safepoint_check_never);
+    new Mutex(Mutex::leaf, "ConcurrentHashTable", true,
+              Mutex::_safepoint_check_never);
   _table = new InternalTable(log2size);
   assert(log2size_limit >= log2size, "bad ergo");
   _size_limit_reached = _table->_log2_size == _log2_size_limit;
--- a/src/hotspot/share/utilities/events.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/utilities/events.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -100,7 +100,7 @@
 
  public:
   EventLogBase<T>(const char* name, const char* handle, int length = LogEventsBufferEntries):
-    _mutex(Mutex::event, name, false, Monitor::_safepoint_check_never),
+    _mutex(Mutex::event, name, true, Mutex::_safepoint_check_never),
     _name(name),
     _handle(handle),
     _length(length),
--- a/src/hotspot/share/utilities/exceptions.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/utilities/exceptions.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -435,9 +435,9 @@
 volatile int Exceptions::_out_of_memory_error_class_metaspace_errors = 0;
 
 void Exceptions::count_out_of_memory_exceptions(Handle exception) {
-  if (oopDesc::equals(exception(), Universe::out_of_memory_error_metaspace())) {
+  if (exception() == Universe::out_of_memory_error_metaspace()) {
      Atomic::inc(&_out_of_memory_error_metaspace_errors);
-  } else if (oopDesc::equals(exception(), Universe::out_of_memory_error_class_metaspace())) {
+  } else if (exception() == Universe::out_of_memory_error_class_metaspace()) {
      Atomic::inc(&_out_of_memory_error_class_metaspace_errors);
   } else {
      // everything else reported as java heap OOM
--- a/src/hotspot/share/utilities/globalDefinitions_gcc.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/utilities/globalDefinitions_gcc.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -254,9 +254,7 @@
 #define JLONG_FORMAT_W(width) "%" #width "ld"
 #endif // _LP64 && __APPLE__
 
-#ifndef USE_LIBRARY_BASED_TLS_ONLY
-#define THREAD_LOCAL_DECL __thread
-#endif
+#define THREAD_LOCAL __thread
 
 // Inlining support
 #define NOINLINE     __attribute__ ((noinline))
--- a/src/hotspot/share/utilities/globalDefinitions_solstudio.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/utilities/globalDefinitions_solstudio.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -245,9 +245,7 @@
 
 #define offset_of(klass,field) offsetof(klass,field)
 
-#ifndef USE_LIBRARY_BASED_TLS_ONLY
-#define THREAD_LOCAL_DECL __thread
-#endif
+#define THREAD_LOCAL __thread
 
 // Inlining support
 #define NOINLINE
--- a/src/hotspot/share/utilities/globalDefinitions_visCPP.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/utilities/globalDefinitions_visCPP.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -153,9 +153,7 @@
 
 #define offset_of(klass,field) offsetof(klass,field)
 
-#ifndef USE_LIBRARY_BASED_TLS_ONLY
-#define THREAD_LOCAL_DECL __declspec( thread )
-#endif
+#define THREAD_LOCAL __declspec(thread)
 
 // Inlining support
 // MSVC has '__declspec(noinline)' but according to the official documentation
--- a/src/hotspot/share/utilities/globalDefinitions_xlc.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/utilities/globalDefinitions_xlc.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -130,10 +130,6 @@
 // AIX 5.3 has buggy __thread support. (see JDK-8176442).
 #define USE_LIBRARY_BASED_TLS_ONLY 1
 
-#ifndef USE_LIBRARY_BASED_TLS_ONLY
-#define THREAD_LOCAL_DECL __thread
-#endif
-
 // Inlining support
 //
 // Be aware that for function/method declarations, xlC only supports the following
--- a/src/hotspot/share/utilities/growableArray.hpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/utilities/growableArray.hpp	Tue Sep 24 15:19:35 2019 -0400
@@ -218,15 +218,6 @@
 
   void print();
 
-  inline static bool safe_equals(oop obj1, oop obj2) {
-    return oopDesc::equals(obj1, obj2);
-  }
-
-  template <class X>
-  inline static bool safe_equals(X i1, X i2) {
-    return i1 == i2;
-  }
-
   int append(const E& elem) {
     check_nesting();
     if (_len == _max) grow(_len);
@@ -311,7 +302,7 @@
 
   bool contains(const E& elem) const {
     for (int i = 0; i < _len; i++) {
-      if (safe_equals(_data[i], elem)) return true;
+      if (_data[i] == elem) return true;
     }
     return false;
   }
--- a/src/hotspot/share/utilities/ostream.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/hotspot/share/utilities/ostream.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -99,13 +99,14 @@
     result_len = strlen(result);
     if (add_cr && result_len >= buflen)  result_len = buflen-1;  // truncate
   } else {
-    int written = os::vsnprintf(buffer, buflen, format, ap);
-    assert(written >= 0, "vsnprintf encoding error");
+    int required_len = os::vsnprintf(buffer, buflen, format, ap);
+    assert(required_len >= 0, "vsnprintf encoding error");
     result = buffer;
-    if ((size_t)written < buflen) {
-      result_len = written;
+    if ((size_t)required_len < buflen) {
+      result_len = required_len;
     } else {
-      DEBUG_ONLY(warning("increase O_BUFLEN in ostream.hpp -- output truncated");)
+      DEBUG_ONLY(warning("outputStream::do_vsnprintf output truncated -- buffer length is %d bytes but %d bytes are needed.",
+                         add_cr ? (int)buflen + 1 : (int)buflen, add_cr ? required_len + 2 : required_len + 1);)
       result_len = buflen - 1;
     }
   }
--- a/src/java.base/aix/native/libjli/java_md_aix.c	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/aix/native/libjli/java_md_aix.c	Tue Sep 24 15:19:35 2019 -0400
@@ -39,8 +39,7 @@
     memset((void *)info, 0, sizeof(Dl_info));
     for (;;) {
         if (addr >= p->ldinfo_textorg &&
-            addr < (((char*)p->ldinfo_textorg) + p->ldinfo_textsize))
-        {
+            addr < p->ldinfo_textorg + p->ldinfo_textsize) {
             info->dli_fname = p->ldinfo_filename;
             return 1;
         }
--- a/src/java.base/macosx/classes/sun/nio/ch/KQueueSelectorProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/macosx/classes/sun/nio/ch/KQueueSelectorProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
 
 import java.io.IOException;
 import java.nio.channels.spi.AbstractSelector;
+import java.nio.channels.*;
 
 public class KQueueSelectorProvider
     extends SelectorProviderImpl
@@ -34,4 +35,8 @@
     public AbstractSelector openSelector() throws IOException {
         return new KQueueSelectorImpl(this);
     }
+
+    public Channel inheritedChannel() throws IOException {
+        return InheritedChannel.getChannel();
+    }
 }
--- a/src/java.base/macosx/classes/sun/nio/fs/BsdFileStore.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/macosx/classes/sun/nio/fs/BsdFileStore.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -62,22 +62,14 @@
         }
 
         // step 2: find mount point
-        UnixPath parent = path.getParent();
-        while (parent != null) {
-            UnixFileAttributes attrs = null;
-            try {
-                attrs = UnixFileAttributes.get(parent, true);
-            } catch (UnixException x) {
-                x.rethrowAsIOException(parent);
-            }
-            if (attrs.dev() != dev())
-                break;
-            path = parent;
-            parent = parent.getParent();
+        byte[] dir = null;
+        try {
+            dir = BsdNativeDispatcher.getmntonname(path);
+        } catch (UnixException x) {
+            x.rethrowAsIOException(path);
         }
 
         // step 3: lookup mounted file systems
-        byte[] dir = path.asByteArray();
         for (UnixMountEntry entry: fs.getMountEntries()) {
             if (Arrays.equals(dir, entry.dir()))
                 return entry;
--- a/src/java.base/macosx/classes/sun/nio/fs/BsdNativeDispatcher.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/macosx/classes/sun/nio/fs/BsdNativeDispatcher.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,20 @@
     */
     static native void endfsstat(long iter) throws UnixException;
 
+    /**
+     * int statfs(const char *path, struct statfs *buf);
+     * returns buf->f_mntonname (directory on which mounted)
+     */
+    static byte[] getmntonname(UnixPath path) throws UnixException {
+        NativeBuffer pathBuffer = copyToNativeBuffer(path);
+        try {
+            return getmntonname0(pathBuffer.address());
+        } finally {
+            pathBuffer.release();
+        }
+    }
+    static native byte[] getmntonname0(long pathAddress) throws UnixException;
+
     // initialize field IDs
     private static native void initIDs();
 
--- a/src/java.base/macosx/native/libjli/java_md_macosx.m	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/macosx/native/libjli/java_md_macosx.m	Tue Sep 24 15:19:35 2019 -0400
@@ -757,10 +757,6 @@
     return rslt;
 }
 
-void SetJavaLauncherPlatformProps() {
-   /* Linux only */
-}
-
 static JavaVM* jvmInstance = NULL;
 static jboolean sameThread = JNI_FALSE; /* start VM in current thread */
 
--- a/src/java.base/macosx/native/libnio/fs/BsdNativeDispatcher.c	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/macosx/native/libnio/fs/BsdNativeDispatcher.c	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -203,3 +203,24 @@
         free(iter);
     }
 }
+
+JNIEXPORT jbyteArray JNICALL
+Java_sun_nio_fs_BsdNativeDispatcher_getmntonname0(JNIEnv *env, jclass this,
+    jlong pathAddress)
+{
+    struct statfs buf;
+    const char* path = (const char*)jlong_to_ptr(pathAddress);
+
+    if (statfs(path, &buf) != 0) {
+        throwUnixException(env, errno);
+    }
+
+    jsize len = strlen(buf.f_mntonname);
+    jbyteArray mntonname = (*env)->NewByteArray(env, len);
+    if (mntonname != NULL) {
+        (*env)->SetByteArrayRegion(env, mntonname, 0, len,
+            (jbyte*)buf.f_mntonname);
+    }
+
+    return mntonname;
+}
--- a/src/java.base/share/classes/java/io/BufferedInputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/BufferedInputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -29,20 +29,20 @@
 import jdk.internal.util.ArraysSupport;
 
 /**
- * A <code>BufferedInputStream</code> adds
+ * A {@code BufferedInputStream} adds
  * functionality to another input stream-namely,
  * the ability to buffer the input and to
- * support the <code>mark</code> and <code>reset</code>
- * methods. When  the <code>BufferedInputStream</code>
+ * support the {@code mark} and {@code reset}
+ * methods. When  the {@code BufferedInputStream}
  * is created, an internal buffer array is
  * created. As bytes  from the stream are read
  * or skipped, the internal buffer is refilled
  * as necessary  from the contained input stream,
- * many bytes at a time. The <code>mark</code>
+ * many bytes at a time. The {@code mark}
  * operation  remembers a point in the input
- * stream and the <code>reset</code> operation
+ * stream and the {@code reset} operation
  * causes all the  bytes read since the most
- * recent <code>mark</code> operation to be
+ * recent {@code mark} operation to be
  * reread before new bytes are  taken from
  * the contained input stream.
  *
@@ -81,23 +81,23 @@
      * The index one greater than the index of the last valid byte in
      * the buffer.
      * This value is always
-     * in the range <code>0</code> through <code>buf.length</code>;
-     * elements <code>buf[0]</code>  through <code>buf[count-1]
-     * </code>contain buffered input data obtained
+     * in the range {@code 0} through {@code buf.length};
+     * elements {@code buf[0]} through {@code buf[count-1]}
+     * contain buffered input data obtained
      * from the underlying  input stream.
      */
     protected int count;
 
     /**
      * The current position in the buffer. This is the index of the next
-     * character to be read from the <code>buf</code> array.
+     * character to be read from the {@code buf} array.
      * <p>
-     * This value is always in the range <code>0</code>
-     * through <code>count</code>. If it is less
-     * than <code>count</code>, then  <code>buf[pos]</code>
+     * This value is always in the range {@code 0}
+     * through {@code count}. If it is less
+     * than {@code count}, then  {@code buf[pos]}
      * is the next byte to be supplied as input;
-     * if it is equal to <code>count</code>, then
-     * the  next <code>read</code> or <code>skip</code>
+     * if it is equal to {@code count}, then
+     * the  next {@code read} or {@code skip}
      * operation will require more bytes to be
      * read from the contained  input stream.
      *
@@ -106,28 +106,28 @@
     protected int pos;
 
     /**
-     * The value of the <code>pos</code> field at the time the last
-     * <code>mark</code> method was called.
+     * The value of the {@code pos} field at the time the last
+     * {@code mark} method was called.
      * <p>
      * This value is always
-     * in the range <code>-1</code> through <code>pos</code>.
+     * in the range {@code -1} through {@code pos}.
      * If there is no marked position in  the input
-     * stream, this field is <code>-1</code>. If
+     * stream, this field is {@code -1}. If
      * there is a marked position in the input
-     * stream,  then <code>buf[markpos]</code>
+     * stream,  then {@code buf[markpos]}
      * is the first byte to be supplied as input
-     * after a <code>reset</code> operation. If
-     * <code>markpos</code> is not <code>-1</code>,
-     * then all bytes from positions <code>buf[markpos]</code>
-     * through  <code>buf[pos-1]</code> must remain
+     * after a {@code reset} operation. If
+     * {@code markpos} is not {@code -1},
+     * then all bytes from positions {@code buf[markpos]}
+     * through  {@code buf[pos-1]} must remain
      * in the buffer array (though they may be
      * moved to  another place in the buffer array,
      * with suitable adjustments to the values
-     * of <code>count</code>,  <code>pos</code>,
-     * and <code>markpos</code>); they may not
+     * of {@code count},  {@code pos},
+     * and {@code markpos}); they may not
      * be discarded unless and until the difference
-     * between <code>pos</code> and <code>markpos</code>
-     * exceeds <code>marklimit</code>.
+     * between {@code pos} and {@code markpos}
+     * exceeds {@code marklimit}.
      *
      * @see     java.io.BufferedInputStream#mark(int)
      * @see     java.io.BufferedInputStream#pos
@@ -136,12 +136,12 @@
 
     /**
      * The maximum read ahead allowed after a call to the
-     * <code>mark</code> method before subsequent calls to the
-     * <code>reset</code> method fail.
-     * Whenever the difference between <code>pos</code>
-     * and <code>markpos</code> exceeds <code>marklimit</code>,
+     * {@code mark} method before subsequent calls to the
+     * {@code reset} method fail.
+     * Whenever the difference between {@code pos}
+     * and {@code markpos} exceeds {@code marklimit},
      * then the  mark may be dropped by setting
-     * <code>markpos</code> to <code>-1</code>.
+     * {@code markpos} to {@code -1}.
      *
      * @see     java.io.BufferedInputStream#mark(int)
      * @see     java.io.BufferedInputStream#reset()
@@ -171,10 +171,10 @@
     }
 
     /**
-     * Creates a <code>BufferedInputStream</code>
+     * Creates a {@code BufferedInputStream}
      * and saves its  argument, the input stream
-     * <code>in</code>, for later use. An internal
-     * buffer array is created and  stored in <code>buf</code>.
+     * {@code in}, for later use. An internal
+     * buffer array is created and  stored in {@code buf}.
      *
      * @param   in   the underlying input stream.
      */
@@ -183,16 +183,16 @@
     }
 
     /**
-     * Creates a <code>BufferedInputStream</code>
+     * Creates a {@code BufferedInputStream}
      * with the specified buffer size,
      * and saves its  argument, the input stream
-     * <code>in</code>, for later use.  An internal
-     * buffer array of length  <code>size</code>
-     * is created and stored in <code>buf</code>.
+     * {@code in}, for later use.  An internal
+     * buffer array of length  {@code size}
+     * is created and stored in {@code buf}.
      *
      * @param   in     the underlying input stream.
      * @param   size   the buffer size.
-     * @exception IllegalArgumentException if {@code size <= 0}.
+     * @throws  IllegalArgumentException if {@code size <= 0}.
      */
     public BufferedInputStream(InputStream in, int size) {
         super(in);
@@ -249,12 +249,12 @@
 
     /**
      * See
-     * the general contract of the <code>read</code>
-     * method of <code>InputStream</code>.
+     * the general contract of the {@code read}
+     * method of {@code InputStream}.
      *
-     * @return     the next byte of data, or <code>-1</code> if the end of the
+     * @return     the next byte of data, or {@code -1} if the end of the
      *             stream is reached.
-     * @exception  IOException  if this input stream has been closed by
+     * @throws     IOException  if this input stream has been closed by
      *                          invoking its {@link #close()} method,
      *                          or an I/O error occurs.
      * @see        java.io.FilterInputStream#in
@@ -300,21 +300,21 @@
      * <code>{@link InputStream#read(byte[], int, int) read}</code> method of
      * the <code>{@link InputStream}</code> class.  As an additional
      * convenience, it attempts to read as many bytes as possible by repeatedly
-     * invoking the <code>read</code> method of the underlying stream.  This
-     * iterated <code>read</code> continues until one of the following
+     * invoking the {@code read} method of the underlying stream.  This
+     * iterated {@code read} continues until one of the following
      * conditions becomes true: <ul>
      *
      *   <li> The specified number of bytes have been read,
      *
-     *   <li> The <code>read</code> method of the underlying stream returns
-     *   <code>-1</code>, indicating end-of-file, or
+     *   <li> The {@code read} method of the underlying stream returns
+     *   {@code -1}, indicating end-of-file, or
      *
-     *   <li> The <code>available</code> method of the underlying stream
+     *   <li> The {@code available} method of the underlying stream
      *   returns zero, indicating that further input requests would block.
      *
-     * </ul> If the first <code>read</code> on the underlying stream returns
-     * <code>-1</code> to indicate end-of-file then this method returns
-     * <code>-1</code>.  Otherwise this method returns the number of bytes
+     * </ul> If the first {@code read} on the underlying stream returns
+     * {@code -1} to indicate end-of-file then this method returns
+     * {@code -1}.  Otherwise this method returns the number of bytes
      * actually read.
      *
      * <p> Subclasses of this class are encouraged, but not required, to
@@ -323,9 +323,9 @@
      * @param      b     destination buffer.
      * @param      off   offset at which to start storing bytes.
      * @param      len   maximum number of bytes to read.
-     * @return     the number of bytes read, or <code>-1</code> if the end of
+     * @return     the number of bytes read, or {@code -1} if the end of
      *             the stream has been reached.
-     * @exception  IOException  if this input stream has been closed by
+     * @throws     IOException  if this input stream has been closed by
      *                          invoking its {@link #close()} method,
      *                          or an I/O error occurs.
      */
@@ -355,8 +355,8 @@
     }
 
     /**
-     * See the general contract of the <code>skip</code>
-     * method of <code>InputStream</code>.
+     * See the general contract of the {@code skip}
+     * method of {@code InputStream}.
      *
      * @throws IOException  if this input stream has been closed by
      *                      invoking its {@link #close()} method,
@@ -400,7 +400,7 @@
      *
      * @return     an estimate of the number of bytes that can be read (or skipped
      *             over) from this input stream without blocking.
-     * @exception  IOException  if this input stream has been closed by
+     * @throws     IOException  if this input stream has been closed by
      *                          invoking its {@link #close()} method,
      *                          or an I/O error occurs.
      */
@@ -413,8 +413,8 @@
     }
 
     /**
-     * See the general contract of the <code>mark</code>
-     * method of <code>InputStream</code>.
+     * See the general contract of the {@code mark}
+     * method of {@code InputStream}.
      *
      * @param   readlimit   the maximum limit of bytes that can be read before
      *                      the mark position becomes invalid.
@@ -426,16 +426,16 @@
     }
 
     /**
-     * See the general contract of the <code>reset</code>
-     * method of <code>InputStream</code>.
+     * See the general contract of the {@code reset}
+     * method of {@code InputStream}.
      * <p>
-     * If <code>markpos</code> is <code>-1</code>
+     * If {@code markpos} is {@code -1}
      * (no mark has been set or the mark has been
-     * invalidated), an <code>IOException</code>
-     * is thrown. Otherwise, <code>pos</code> is
-     * set equal to <code>markpos</code>.
+     * invalidated), an {@code IOException}
+     * is thrown. Otherwise, {@code pos} is
+     * set equal to {@code markpos}.
      *
-     * @exception  IOException  if this stream has not been marked or,
+     * @throws     IOException  if this stream has not been marked or,
      *                  if the mark has been invalidated, or the stream
      *                  has been closed by invoking its {@link #close()}
      *                  method, or an I/O error occurs.
@@ -449,13 +449,13 @@
     }
 
     /**
-     * Tests if this input stream supports the <code>mark</code>
-     * and <code>reset</code> methods. The <code>markSupported</code>
-     * method of <code>BufferedInputStream</code> returns
-     * <code>true</code>.
+     * Tests if this input stream supports the {@code mark}
+     * and {@code reset} methods. The {@code markSupported}
+     * method of {@code BufferedInputStream} returns
+     * {@code true}.
      *
-     * @return  a <code>boolean</code> indicating if this stream type supports
-     *          the <code>mark</code> and <code>reset</code> methods.
+     * @return  a {@code boolean} indicating if this stream type supports
+     *          the {@code mark} and {@code reset} methods.
      * @see     java.io.InputStream#mark(int)
      * @see     java.io.InputStream#reset()
      */
@@ -470,7 +470,7 @@
      * or skip() invocations will throw an IOException.
      * Closing a previously closed stream has no effect.
      *
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public void close() throws IOException {
         byte[] buffer;
--- a/src/java.base/share/classes/java/io/BufferedOutputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/BufferedOutputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -65,7 +65,7 @@
      *
      * @param   out    the underlying output stream.
      * @param   size   the buffer size.
-     * @exception IllegalArgumentException if size &lt;= 0.
+     * @throws  IllegalArgumentException if size &lt;= 0.
      */
     public BufferedOutputStream(OutputStream out, int size) {
         super(out);
@@ -87,7 +87,7 @@
      * Writes the specified byte to this buffered output stream.
      *
      * @param      b   the byte to be written.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     @Override
     public synchronized void write(int b) throws IOException {
@@ -98,20 +98,20 @@
     }
 
     /**
-     * Writes <code>len</code> bytes from the specified byte array
-     * starting at offset <code>off</code> to this buffered output stream.
+     * Writes {@code len} bytes from the specified byte array
+     * starting at offset {@code off} to this buffered output stream.
      *
      * <p> Ordinarily this method stores bytes from the given array into this
      * stream's buffer, flushing the buffer to the underlying output stream as
      * needed.  If the requested length is at least as large as this stream's
      * buffer, however, then this method will flush the buffer and write the
      * bytes directly to the underlying output stream.  Thus redundant
-     * <code>BufferedOutputStream</code>s will not copy data unnecessarily.
+     * {@code BufferedOutputStream}s will not copy data unnecessarily.
      *
      * @param      b     the data.
      * @param      off   the start offset in the data.
      * @param      len   the number of bytes to write.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     @Override
     public synchronized void write(byte b[], int off, int len) throws IOException {
@@ -134,7 +134,7 @@
      * Flushes this buffered output stream. This forces any buffered
      * output bytes to be written out to the underlying output stream.
      *
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.FilterOutputStream#out
      */
     @Override
--- a/src/java.base/share/classes/java/io/BufferedReader.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/BufferedReader.java	Tue Sep 24 15:19:35 2019 -0400
@@ -95,7 +95,7 @@
      * @param  in   A Reader
      * @param  sz   Input-buffer size
      *
-     * @exception  IllegalArgumentException  If {@code sz <= 0}
+     * @throws IllegalArgumentException  If {@code sz <= 0}
      */
     public BufferedReader(Reader in, int sz) {
         super(in);
@@ -172,7 +172,7 @@
      * @return The character read, as an integer in the range
      *         0 to 65535 ({@code 0x00-0xffff}), or -1 if the
      *         end of the stream has been reached
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IOException  If an I/O error occurs
      */
     public int read() throws IOException {
         synchronized (lock) {
@@ -235,22 +235,22 @@
      * <code>{@link Reader#read(char[], int, int) read}</code> method of the
      * <code>{@link Reader}</code> class.  As an additional convenience, it
      * attempts to read as many characters as possible by repeatedly invoking
-     * the <code>read</code> method of the underlying stream.  This iterated
-     * <code>read</code> continues until one of the following conditions becomes
+     * the {@code read} method of the underlying stream.  This iterated
+     * {@code read} continues until one of the following conditions becomes
      * true: <ul>
      *
      *   <li> The specified number of characters have been read,
      *
-     *   <li> The <code>read</code> method of the underlying stream returns
-     *   <code>-1</code>, indicating end-of-file, or
+     *   <li> The {@code read} method of the underlying stream returns
+     *   {@code -1}, indicating end-of-file, or
      *
-     *   <li> The <code>ready</code> method of the underlying stream
-     *   returns <code>false</code>, indicating that further input requests
+     *   <li> The {@code ready} method of the underlying stream
+     *   returns {@code false}, indicating that further input requests
      *   would block.
      *
-     * </ul> If the first <code>read</code> on the underlying stream returns
-     * <code>-1</code> to indicate end-of-file then this method returns
-     * <code>-1</code>.  Otherwise this method returns the number of characters
+     * </ul> If the first {@code read} on the underlying stream returns
+     * {@code -1} to indicate end-of-file then this method returns
+     * {@code -1}.  Otherwise this method returns the number of characters
      * actually read.
      *
      * <p> Subclasses of this class are encouraged, but not required, to
@@ -261,7 +261,7 @@
      * however, the buffer is empty, the mark is not valid, and the requested
      * length is at least as large as the buffer, then this method will read
      * characters directly from the underlying stream into the given array.
-     * Thus redundant <code>BufferedReader</code>s will not copy data
+     * Thus redundant {@code BufferedReader}s will not copy data
      * unnecessarily.
      *
      * @param      cbuf  Destination buffer
@@ -271,8 +271,8 @@
      * @return     The number of characters read, or -1 if the end of the
      *             stream has been reached
      *
-     * @exception  IOException  If an I/O error occurs
-     * @exception  IndexOutOfBoundsException {@inheritDoc}
+     * @throws     IOException  If an I/O error occurs
+     * @throws     IndexOutOfBoundsException {@inheritDoc}
      */
     public int read(char cbuf[], int off, int len) throws IOException {
         synchronized (lock) {
@@ -311,7 +311,7 @@
      *
      * @see        java.io.LineNumberReader#readLine()
      *
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IOException  If an I/O error occurs
      */
     String readLine(boolean ignoreLF, boolean[] term) throws IOException {
         StringBuffer s = null;
@@ -388,7 +388,7 @@
      *             any line-termination characters, or null if the end of the
      *             stream has been reached without reading any characters
      *
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IOException  If an I/O error occurs
      *
      * @see java.nio.file.Files#readAllLines
      */
@@ -403,8 +403,8 @@
      *
      * @return    The number of characters actually skipped
      *
-     * @exception  IllegalArgumentException  If <code>n</code> is negative.
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IllegalArgumentException  If {@code n} is negative.
+     * @throws     IOException  If an I/O error occurs
      */
     public long skip(long n) throws IOException {
         if (n < 0L) {
@@ -444,7 +444,7 @@
      * stream is ready if the buffer is not empty, or if the underlying
      * character stream is ready.
      *
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IOException  If an I/O error occurs
      */
     public boolean ready() throws IOException {
         synchronized (lock) {
@@ -491,8 +491,8 @@
      *                         whose size is no smaller than limit.
      *                         Therefore large values should be used with care.
      *
-     * @exception  IllegalArgumentException  If {@code readAheadLimit < 0}
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IllegalArgumentException  If {@code readAheadLimit < 0}
+     * @throws     IOException  If an I/O error occurs
      */
     public void mark(int readAheadLimit) throws IOException {
         if (readAheadLimit < 0) {
@@ -509,7 +509,7 @@
     /**
      * Resets the stream to the most recent mark.
      *
-     * @exception  IOException  If the stream has never been marked,
+     * @throws     IOException  If the stream has never been marked,
      *                          or if the mark has been invalidated
      */
     public void reset() throws IOException {
--- a/src/java.base/share/classes/java/io/BufferedWriter.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/BufferedWriter.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -89,7 +89,7 @@
      * @param  out  A Writer
      * @param  sz   Output-buffer size, a positive integer
      *
-     * @exception  IllegalArgumentException  If {@code sz <= 0}
+     * @throws     IllegalArgumentException  If {@code sz <= 0}
      */
     public BufferedWriter(Writer out, int sz) {
         super(out);
@@ -125,7 +125,7 @@
     /**
      * Writes a single character.
      *
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IOException  If an I/O error occurs
      */
     public void write(int c) throws IOException {
         synchronized (lock) {
@@ -240,7 +240,7 @@
      * system property {@code line.separator}, and is not necessarily a single
      * newline ('\n') character.
      *
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IOException  If an I/O error occurs
      */
     public void newLine() throws IOException {
         write(System.lineSeparator());
@@ -249,7 +249,7 @@
     /**
      * Flushes the stream.
      *
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IOException  If an I/O error occurs
      */
     public void flush() throws IOException {
         synchronized (lock) {
--- a/src/java.base/share/classes/java/io/CharArrayReader.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/CharArrayReader.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -95,7 +95,7 @@
     /**
      * Reads a single character.
      *
-     * @exception   IOException  If an I/O error occurs
+     * @throws      IOException  If an I/O error occurs
      */
     public int read() throws IOException {
         synchronized (lock) {
@@ -109,14 +109,14 @@
 
     /**
      * Reads characters into a portion of an array.
-     * @param b  Destination buffer
-     * @param off  Offset at which to start storing characters
-     * @param len   Maximum number of characters to read
+     * @param   b  Destination buffer
+     * @param   off  Offset at which to start storing characters
+     * @param   len   Maximum number of characters to read
      * @return  The actual number of characters read, or -1 if
      *          the end of the stream has been reached
      *
-     * @exception   IOException  If an I/O error occurs
-     * @exception   IndexOutOfBoundsException {@inheritDoc}
+     * @throws  IOException  If an I/O error occurs
+     * @throws  IndexOutOfBoundsException {@inheritDoc}
      */
     public int read(char b[], int off, int len) throws IOException {
         synchronized (lock) {
@@ -148,14 +148,14 @@
     /**
      * Skips characters.  Returns the number of characters that were skipped.
      *
-     * <p>The <code>n</code> parameter may be negative, even though the
-     * <code>skip</code> method of the {@link Reader} superclass throws
-     * an exception in this case. If <code>n</code> is negative, then
-     * this method does nothing and returns <code>0</code>.
+     * <p>The {@code n} parameter may be negative, even though the
+     * {@code skip} method of the {@link Reader} superclass throws
+     * an exception in this case. If {@code n} is negative, then
+     * this method does nothing and returns {@code 0}.
      *
-     * @param n The number of characters to skip
-     * @return       The number of characters actually skipped
-     * @exception  IOException If the stream is closed, or an I/O error occurs
+     * @param      n The number of characters to skip
+     * @return     The number of characters actually skipped
+     * @throws     IOException If the stream is closed, or an I/O error occurs
      */
     public long skip(long n) throws IOException {
         synchronized (lock) {
@@ -177,7 +177,7 @@
      * Tells whether this stream is ready to be read.  Character-array readers
      * are always ready to be read.
      *
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IOException  If an I/O error occurs
      */
     public boolean ready() throws IOException {
         synchronized (lock) {
@@ -203,7 +203,7 @@
      *                         there is no actual limit; hence this argument is
      *                         ignored.
      *
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IOException  If an I/O error occurs
      */
     public void mark(int readAheadLimit) throws IOException {
         synchronized (lock) {
@@ -216,7 +216,7 @@
      * Resets the stream to the most recent mark, or to the beginning if it has
      * never been marked.
      *
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IOException  If an I/O error occurs
      */
     public void reset() throws IOException {
         synchronized (lock) {
--- a/src/java.base/share/classes/java/io/CharArrayWriter.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/CharArrayWriter.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -61,8 +61,8 @@
     /**
      * Creates a new CharArrayWriter with the specified initial size.
      *
-     * @param initialSize  an int specifying the initial buffer size.
-     * @exception IllegalArgumentException if initialSize is negative
+     * @param  initialSize  an int specifying the initial buffer size.
+     * @throws IllegalArgumentException if initialSize is negative
      */
     public CharArrayWriter(int initialSize) {
         if (initialSize < 0) {
--- a/src/java.base/share/classes/java/io/DataInput.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/DataInput.java	Tue Sep 24 15:19:35 2019 -0400
@@ -268,7 +268,7 @@
      *
      * @param      n   the number of bytes to be skipped.
      * @return     the number of bytes actually skipped.
-     * @exception  IOException   if an I/O error occurs.
+     * @throws     IOException   if an I/O error occurs.
      */
     int skipBytes(int n) throws IOException;
 
@@ -281,9 +281,9 @@
      * method of interface {@code DataOutput}.
      *
      * @return     the {@code boolean} value read.
-     * @exception  EOFException  if this stream reaches the end before reading
+     * @throws     EOFException  if this stream reaches the end before reading
      *               all the bytes.
-     * @exception  IOException   if an I/O error occurs.
+     * @throws     IOException   if an I/O error occurs.
      */
     boolean readBoolean() throws IOException;
 
@@ -297,9 +297,9 @@
      * method of interface {@code DataOutput}.
      *
      * @return     the 8-bit value read.
-     * @exception  EOFException  if this stream reaches the end before reading
+     * @throws     EOFException  if this stream reaches the end before reading
      *               all the bytes.
-     * @exception  IOException   if an I/O error occurs.
+     * @throws     IOException   if an I/O error occurs.
      */
     byte readByte() throws IOException;
 
@@ -317,9 +317,9 @@
      * {@code 0} through {@code 255}.
      *
      * @return     the unsigned 8-bit value read.
-     * @exception  EOFException  if this stream reaches the end before reading
+     * @throws     EOFException  if this stream reaches the end before reading
      *               all the bytes.
-     * @exception  IOException   if an I/O error occurs.
+     * @throws     IOException   if an I/O error occurs.
      */
     int readUnsignedByte() throws IOException;
 
@@ -338,9 +338,9 @@
      * interface {@code DataOutput}.
      *
      * @return     the 16-bit value read.
-     * @exception  EOFException  if this stream reaches the end before reading
+     * @throws     EOFException  if this stream reaches the end before reading
      *               all the bytes.
-     * @exception  IOException   if an I/O error occurs.
+     * @throws     IOException   if an I/O error occurs.
      */
     short readShort() throws IOException;
 
@@ -361,9 +361,9 @@
      * {@code 0} through {@code 65535}.
      *
      * @return     the unsigned 16-bit value read.
-     * @exception  EOFException  if this stream reaches the end before reading
+     * @throws     EOFException  if this stream reaches the end before reading
      *               all the bytes.
-     * @exception  IOException   if an I/O error occurs.
+     * @throws     IOException   if an I/O error occurs.
      */
     int readUnsignedShort() throws IOException;
 
@@ -381,9 +381,9 @@
      * {@code DataOutput}.
      *
      * @return     the {@code char} value read.
-     * @exception  EOFException  if this stream reaches the end before reading
+     * @throws     EOFException  if this stream reaches the end before reading
      *               all the bytes.
-     * @exception  IOException   if an I/O error occurs.
+     * @throws     IOException   if an I/O error occurs.
      */
     char readChar() throws IOException;
 
@@ -400,9 +400,9 @@
      * method of interface {@code DataOutput}.
      *
      * @return     the {@code int} value read.
-     * @exception  EOFException  if this stream reaches the end before reading
+     * @throws     EOFException  if this stream reaches the end before reading
      *               all the bytes.
-     * @exception  IOException   if an I/O error occurs.
+     * @throws     IOException   if an I/O error occurs.
      */
     int readInt() throws IOException;
 
@@ -427,9 +427,9 @@
      * method of interface {@code DataOutput}.
      *
      * @return     the {@code long} value read.
-     * @exception  EOFException  if this stream reaches the end before reading
+     * @throws     EOFException  if this stream reaches the end before reading
      *               all the bytes.
-     * @exception  IOException   if an I/O error occurs.
+     * @throws     IOException   if an I/O error occurs.
      */
     long readLong() throws IOException;
 
@@ -447,9 +447,9 @@
      * method of interface {@code DataOutput}.
      *
      * @return     the {@code float} value read.
-     * @exception  EOFException  if this stream reaches the end before reading
+     * @throws     EOFException  if this stream reaches the end before reading
      *               all the bytes.
-     * @exception  IOException   if an I/O error occurs.
+     * @throws     IOException   if an I/O error occurs.
      */
     float readFloat() throws IOException;
 
@@ -467,9 +467,9 @@
      * method of interface {@code DataOutput}.
      *
      * @return     the {@code double} value read.
-     * @exception  EOFException  if this stream reaches the end before reading
+     * @throws     EOFException  if this stream reaches the end before reading
      *               all the bytes.
-     * @exception  IOException   if an I/O error occurs.
+     * @throws     IOException   if an I/O error occurs.
      */
     double readDouble() throws IOException;
 
@@ -510,7 +510,7 @@
      * @return the next line of text from the input stream,
      *         or {@code null} if the end of file is
      *         encountered before a byte can be read.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws IOException  if an I/O error occurs.
      */
     String readLine() throws IOException;
 
@@ -593,10 +593,10 @@
      * may be used to write data that is suitable
      * for reading by this method.
      * @return     a Unicode string.
-     * @exception  EOFException            if this stream reaches the end
+     * @throws     EOFException            if this stream reaches the end
      *               before reading all the bytes.
-     * @exception  IOException             if an I/O error occurs.
-     * @exception  UTFDataFormatException  if the bytes do not represent a
+     * @throws     IOException             if an I/O error occurs.
+     * @throws     UTFDataFormatException  if the bytes do not represent a
      *               valid modified UTF-8 encoding of a string.
      */
     String readUTF() throws IOException;
--- a/src/java.base/share/classes/java/io/DataInputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/DataInputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -60,39 +60,39 @@
 
     /**
      * Reads some number of bytes from the contained input stream and
-     * stores them into the buffer array <code>b</code>. The number of
+     * stores them into the buffer array {@code b}. The number of
      * bytes actually read is returned as an integer. This method blocks
      * until input data is available, end of file is detected, or an
      * exception is thrown.
      *
-     * <p>If <code>b</code> is null, a <code>NullPointerException</code> is
-     * thrown. If the length of <code>b</code> is zero, then no bytes are
-     * read and <code>0</code> is returned; otherwise, there is an attempt
+     * <p>If {@code b} is null, a {@code NullPointerException} is
+     * thrown. If the length of {@code b} is zero, then no bytes are
+     * read and {@code 0} is returned; otherwise, there is an attempt
      * to read at least one byte. If no byte is available because the
-     * stream is at end of file, the value <code>-1</code> is returned;
-     * otherwise, at least one byte is read and stored into <code>b</code>.
+     * stream is at end of file, the value {@code -1} is returned;
+     * otherwise, at least one byte is read and stored into {@code b}.
      *
-     * <p>The first byte read is stored into element <code>b[0]</code>, the
-     * next one into <code>b[1]</code>, and so on. The number of bytes read
-     * is, at most, equal to the length of <code>b</code>. Let <code>k</code>
+     * <p>The first byte read is stored into element {@code b[0]}, the
+     * next one into {@code b[1]}, and so on. The number of bytes read
+     * is, at most, equal to the length of {@code b}. Let {@code k}
      * be the number of bytes actually read; these bytes will be stored in
-     * elements <code>b[0]</code> through <code>b[k-1]</code>, leaving
-     * elements <code>b[k]</code> through <code>b[b.length-1]</code>
+     * elements {@code b[0]} through {@code b[k-1]}, leaving
+     * elements {@code b[k]} through {@code b[b.length-1]}
      * unaffected.
      *
-     * <p>The <code>read(b)</code> method has the same effect as:
+     * <p>The {@code read(b)} method has the same effect as:
      * <blockquote><pre>
      * read(b, 0, b.length)
      * </pre></blockquote>
      *
      * @param      b   the buffer into which the data is read.
      * @return     the total number of bytes read into the buffer, or
-     *             <code>-1</code> if there is no more data because the end
+     *             {@code -1} if there is no more data because the end
      *             of the stream has been reached.
-     * @exception  IOException if the first byte cannot be read for any reason
-     * other than end of file, the stream has been closed and the underlying
-     * input stream does not support reading after close, or another I/O
-     * error occurs.
+     * @throws     IOException if the first byte cannot be read for any reason
+     *             other than end of file, the stream has been closed and the underlying
+     *             input stream does not support reading after close, or another I/O
+     *             error occurs.
      * @see        java.io.FilterInputStream#in
      * @see        java.io.InputStream#read(byte[], int, int)
      */
@@ -101,47 +101,47 @@
     }
 
     /**
-     * Reads up to <code>len</code> bytes of data from the contained
+     * Reads up to {@code len} bytes of data from the contained
      * input stream into an array of bytes.  An attempt is made to read
-     * as many as <code>len</code> bytes, but a smaller number may be read,
+     * as many as {@code len} bytes, but a smaller number may be read,
      * possibly zero. The number of bytes actually read is returned as an
      * integer.
      *
      * <p> This method blocks until input data is available, end of file is
      * detected, or an exception is thrown.
      *
-     * <p> If <code>len</code> is zero, then no bytes are read and
-     * <code>0</code> is returned; otherwise, there is an attempt to read at
+     * <p> If {@code len} is zero, then no bytes are read and
+     * {@code 0} is returned; otherwise, there is an attempt to read at
      * least one byte. If no byte is available because the stream is at end of
-     * file, the value <code>-1</code> is returned; otherwise, at least one
-     * byte is read and stored into <code>b</code>.
+     * file, the value {@code -1} is returned; otherwise, at least one
+     * byte is read and stored into {@code b}.
      *
-     * <p> The first byte read is stored into element <code>b[off]</code>, the
-     * next one into <code>b[off+1]</code>, and so on. The number of bytes read
-     * is, at most, equal to <code>len</code>. Let <i>k</i> be the number of
+     * <p> The first byte read is stored into element {@code b[off]}, the
+     * next one into {@code b[off+1]}, and so on. The number of bytes read
+     * is, at most, equal to {@code len}. Let <i>k</i> be the number of
      * bytes actually read; these bytes will be stored in elements
-     * <code>b[off]</code> through <code>b[off+</code><i>k</i><code>-1]</code>,
-     * leaving elements <code>b[off+</code><i>k</i><code>]</code> through
-     * <code>b[off+len-1]</code> unaffected.
+     * {@code b[off]} through {@code b[off+}<i>k</i>{@code -1]},
+     * leaving elements {@code b[off+}<i>k</i>{@code ]} through
+     * {@code b[off+len-1]} unaffected.
      *
-     * <p> In every case, elements <code>b[0]</code> through
-     * <code>b[off]</code> and elements <code>b[off+len]</code> through
-     * <code>b[b.length-1]</code> are unaffected.
+     * <p> In every case, elements {@code b[0]} through
+     * {@code b[off]} and elements {@code b[off+len]} through
+     * {@code b[b.length-1]} are unaffected.
      *
      * @param      b     the buffer into which the data is read.
-     * @param off the start offset in the destination array <code>b</code>
+     * @param      off the start offset in the destination array {@code b}
      * @param      len   the maximum number of bytes read.
      * @return     the total number of bytes read into the buffer, or
-     *             <code>-1</code> if there is no more data because the end
+     *             {@code -1} if there is no more data because the end
      *             of the stream has been reached.
-     * @exception  NullPointerException If <code>b</code> is <code>null</code>.
-     * @exception  IndexOutOfBoundsException If <code>off</code> is negative,
-     * <code>len</code> is negative, or <code>len</code> is greater than
-     * <code>b.length - off</code>
-     * @exception  IOException if the first byte cannot be read for any reason
-     * other than end of file, the stream has been closed and the underlying
-     * input stream does not support reading after close, or another I/O
-     * error occurs.
+     * @throws     NullPointerException If {@code b} is {@code null}.
+     * @throws     IndexOutOfBoundsException If {@code off} is negative,
+     *             {@code len} is negative, or {@code len} is greater than
+     *             {@code b.length - off}
+     * @throws     IOException if the first byte cannot be read for any reason
+     *             other than end of file, the stream has been closed and the underlying
+     *             input stream does not support reading after close, or another I/O
+     *             error occurs.
      * @see        java.io.FilterInputStream#in
      * @see        java.io.InputStream#read(byte[], int, int)
      */
@@ -181,13 +181,13 @@
      * @param      b     the buffer into which the data is read.
      * @param      off   the start offset in the data array {@code b}.
      * @param      len   the number of bytes to read.
-     * @exception  NullPointerException if {@code b} is {@code null}.
-     * @exception  IndexOutOfBoundsException if {@code off} is negative,
+     * @throws     NullPointerException if {@code b} is {@code null}.
+     * @throws     IndexOutOfBoundsException if {@code off} is negative,
      *             {@code len} is negative, or {@code len} is greater than
      *             {@code b.length - off}.
-     * @exception  EOFException  if this input stream reaches the end before
+     * @throws     EOFException  if this input stream reaches the end before
      *             reading all the bytes.
-     * @exception  IOException   the stream has been closed and the contained
+     * @throws     IOException   the stream has been closed and the contained
      *             input stream does not support reading after close, or
      *             another I/O error occurs.
      * @see        java.io.FilterInputStream#in
@@ -205,15 +205,15 @@
     }
 
     /**
-     * See the general contract of the <code>skipBytes</code>
-     * method of <code>DataInput</code>.
+     * See the general contract of the {@code skipBytes}
+     * method of {@code DataInput}.
      * <p>
      * Bytes for this operation are read from the contained
      * input stream.
      *
      * @param      n   the number of bytes to be skipped.
      * @return     the actual number of bytes skipped.
-     * @exception  IOException  if the contained input stream does not support
+     * @throws     IOException  if the contained input stream does not support
      *             seek, or the stream has been closed and
      *             the contained input stream does not support
      *             reading after close, or another I/O error occurs.
@@ -230,15 +230,15 @@
     }
 
     /**
-     * See the general contract of the <code>readBoolean</code>
-     * method of <code>DataInput</code>.
+     * See the general contract of the {@code readBoolean}
+     * method of {@code DataInput}.
      * <p>
      * Bytes for this operation are read from the contained
      * input stream.
      *
-     * @return     the <code>boolean</code> value read.
-     * @exception  EOFException  if this input stream has reached the end.
-     * @exception  IOException   the stream has been closed and the contained
+     * @return     the {@code boolean} value read.
+     * @throws     EOFException  if this input stream has reached the end.
+     * @throws     IOException   the stream has been closed and the contained
      *             input stream does not support reading after close, or
      *             another I/O error occurs.
      * @see        java.io.FilterInputStream#in
@@ -251,17 +251,17 @@
     }
 
     /**
-     * See the general contract of the <code>readByte</code>
-     * method of <code>DataInput</code>.
+     * See the general contract of the {@code readByte}
+     * method of {@code DataInput}.
      * <p>
      * Bytes
      * for this operation are read from the contained
      * input stream.
      *
      * @return     the next byte of this input stream as a signed 8-bit
-     *             <code>byte</code>.
-     * @exception  EOFException  if this input stream has reached the end.
-     * @exception  IOException   the stream has been closed and the contained
+     *             {@code byte}.
+     * @throws     EOFException  if this input stream has reached the end.
+     * @throws     IOException   the stream has been closed and the contained
      *             input stream does not support reading after close, or
      *             another I/O error occurs.
      * @see        java.io.FilterInputStream#in
@@ -274,8 +274,8 @@
     }
 
     /**
-     * See the general contract of the <code>readUnsignedByte</code>
-     * method of <code>DataInput</code>.
+     * See the general contract of the {@code readUnsignedByte}
+     * method of {@code DataInput}.
      * <p>
      * Bytes
      * for this operation are read from the contained
@@ -283,8 +283,8 @@
      *
      * @return     the next byte of this input stream, interpreted as an
      *             unsigned 8-bit number.
-     * @exception  EOFException  if this input stream has reached the end.
-     * @exception  IOException   the stream has been closed and the contained
+     * @throws     EOFException  if this input stream has reached the end.
+     * @throws     IOException   the stream has been closed and the contained
      *             input stream does not support reading after close, or
      *             another I/O error occurs.
      * @see         java.io.FilterInputStream#in
@@ -297,8 +297,8 @@
     }
 
     /**
-     * See the general contract of the <code>readShort</code>
-     * method of <code>DataInput</code>.
+     * See the general contract of the {@code readShort}
+     * method of {@code DataInput}.
      * <p>
      * Bytes
      * for this operation are read from the contained
@@ -306,9 +306,9 @@
      *
      * @return     the next two bytes of this input stream, interpreted as a
      *             signed 16-bit number.
-     * @exception  EOFException  if this input stream reaches the end before
+     * @throws     EOFException  if this input stream reaches the end before
      *               reading two bytes.
-     * @exception  IOException   the stream has been closed and the contained
+     * @throws     IOException   the stream has been closed and the contained
      *             input stream does not support reading after close, or
      *             another I/O error occurs.
      * @see        java.io.FilterInputStream#in
@@ -322,8 +322,8 @@
     }
 
     /**
-     * See the general contract of the <code>readUnsignedShort</code>
-     * method of <code>DataInput</code>.
+     * See the general contract of the {@code readUnsignedShort}
+     * method of {@code DataInput}.
      * <p>
      * Bytes
      * for this operation are read from the contained
@@ -331,9 +331,9 @@
      *
      * @return     the next two bytes of this input stream, interpreted as an
      *             unsigned 16-bit integer.
-     * @exception  EOFException  if this input stream reaches the end before
+     * @throws     EOFException  if this input stream reaches the end before
      *             reading two bytes.
-     * @exception  IOException   the stream has been closed and the contained
+     * @throws     IOException   the stream has been closed and the contained
      *             input stream does not support reading after close, or
      *             another I/O error occurs.
      * @see        java.io.FilterInputStream#in
@@ -347,18 +347,18 @@
     }
 
     /**
-     * See the general contract of the <code>readChar</code>
-     * method of <code>DataInput</code>.
+     * See the general contract of the {@code readChar}
+     * method of {@code DataInput}.
      * <p>
      * Bytes
      * for this operation are read from the contained
      * input stream.
      *
      * @return     the next two bytes of this input stream, interpreted as a
-     *             <code>char</code>.
-     * @exception  EOFException  if this input stream reaches the end before
+     *             {@code char}.
+     * @throws     EOFException  if this input stream reaches the end before
      *               reading two bytes.
-     * @exception  IOException   the stream has been closed and the contained
+     * @throws     IOException   the stream has been closed and the contained
      *             input stream does not support reading after close, or
      *             another I/O error occurs.
      * @see        java.io.FilterInputStream#in
@@ -372,18 +372,18 @@
     }
 
     /**
-     * See the general contract of the <code>readInt</code>
-     * method of <code>DataInput</code>.
+     * See the general contract of the {@code readInt}
+     * method of {@code DataInput}.
      * <p>
      * Bytes
      * for this operation are read from the contained
      * input stream.
      *
      * @return     the next four bytes of this input stream, interpreted as an
-     *             <code>int</code>.
-     * @exception  EOFException  if this input stream reaches the end before
+     *             {@code int}.
+     * @throws     EOFException  if this input stream reaches the end before
      *               reading four bytes.
-     * @exception  IOException   the stream has been closed and the contained
+     * @throws     IOException   the stream has been closed and the contained
      *             input stream does not support reading after close, or
      *             another I/O error occurs.
      * @see        java.io.FilterInputStream#in
@@ -401,18 +401,18 @@
     private byte readBuffer[] = new byte[8];
 
     /**
-     * See the general contract of the <code>readLong</code>
-     * method of <code>DataInput</code>.
+     * See the general contract of the {@code readLong}
+     * method of {@code DataInput}.
      * <p>
      * Bytes
      * for this operation are read from the contained
      * input stream.
      *
      * @return     the next eight bytes of this input stream, interpreted as a
-     *             <code>long</code>.
-     * @exception  EOFException  if this input stream reaches the end before
+     *             {@code long}.
+     * @throws     EOFException  if this input stream reaches the end before
      *               reading eight bytes.
-     * @exception  IOException   the stream has been closed and the contained
+     * @throws     IOException   the stream has been closed and the contained
      *             input stream does not support reading after close, or
      *             another I/O error occurs.
      * @see        java.io.FilterInputStream#in
@@ -430,18 +430,18 @@
     }
 
     /**
-     * See the general contract of the <code>readFloat</code>
-     * method of <code>DataInput</code>.
+     * See the general contract of the {@code readFloat}
+     * method of {@code DataInput}.
      * <p>
      * Bytes
      * for this operation are read from the contained
      * input stream.
      *
      * @return     the next four bytes of this input stream, interpreted as a
-     *             <code>float</code>.
-     * @exception  EOFException  if this input stream reaches the end before
+     *             {@code float}.
+     * @throws     EOFException  if this input stream reaches the end before
      *               reading four bytes.
-     * @exception  IOException   the stream has been closed and the contained
+     * @throws     IOException   the stream has been closed and the contained
      *             input stream does not support reading after close, or
      *             another I/O error occurs.
      * @see        java.io.DataInputStream#readInt()
@@ -452,18 +452,18 @@
     }
 
     /**
-     * See the general contract of the <code>readDouble</code>
-     * method of <code>DataInput</code>.
+     * See the general contract of the {@code readDouble}
+     * method of {@code DataInput}.
      * <p>
      * Bytes
      * for this operation are read from the contained
      * input stream.
      *
      * @return     the next eight bytes of this input stream, interpreted as a
-     *             <code>double</code>.
-     * @exception  EOFException  if this input stream reaches the end before
+     *             {@code double}.
+     * @throws     EOFException  if this input stream reaches the end before
      *               reading eight bytes.
-     * @exception  IOException   the stream has been closed and the contained
+     * @throws     IOException   the stream has been closed and the contained
      *             input stream does not support reading after close, or
      *             another I/O error occurs.
      * @see        java.io.DataInputStream#readLong()
@@ -476,8 +476,8 @@
     private char lineBuffer[];
 
     /**
-     * See the general contract of the <code>readLine</code>
-     * method of <code>DataInput</code>.
+     * See the general contract of the {@code readLine}
+     * method of {@code DataInput}.
      * <p>
      * Bytes
      * for this operation are read from the contained
@@ -485,9 +485,9 @@
      *
      * @deprecated This method does not properly convert bytes to characters.
      * As of JDK&nbsp;1.1, the preferred way to read lines of text is via the
-     * <code>BufferedReader.readLine()</code> method.  Programs that use the
-     * <code>DataInputStream</code> class to read lines can be converted to use
-     * the <code>BufferedReader</code> class by replacing code of the form:
+     * {@code BufferedReader.readLine()} method.  Programs that use the
+     * {@code DataInputStream} class to read lines can be converted to use
+     * the {@code BufferedReader} class by replacing code of the form:
      * <blockquote><pre>
      *     DataInputStream d =&nbsp;new&nbsp;DataInputStream(in);
      * </pre></blockquote>
@@ -498,7 +498,7 @@
      * </pre></blockquote>
      *
      * @return     the next line of text from this input stream.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.BufferedReader#readLine()
      * @see        java.io.FilterInputStream#in
      */
@@ -548,20 +548,20 @@
     }
 
     /**
-     * See the general contract of the <code>readUTF</code>
-     * method of <code>DataInput</code>.
+     * See the general contract of the {@code readUTF}
+     * method of {@code DataInput}.
      * <p>
      * Bytes
      * for this operation are read from the contained
      * input stream.
      *
      * @return     a Unicode string.
-     * @exception  EOFException  if this input stream reaches the end before
+     * @throws     EOFException  if this input stream reaches the end before
      *               reading all the bytes.
-     * @exception  IOException   the stream has been closed and the contained
+     * @throws     IOException   the stream has been closed and the contained
      *             input stream does not support reading after close, or
      *             another I/O error occurs.
-     * @exception  UTFDataFormatException if the bytes do not represent a valid
+     * @throws     UTFDataFormatException if the bytes do not represent a valid
      *             modified UTF-8 encoding of a string.
      * @see        java.io.DataInputStream#readUTF(java.io.DataInput)
      */
@@ -571,22 +571,22 @@
 
     /**
      * Reads from the
-     * stream <code>in</code> a representation
+     * stream {@code in} a representation
      * of a Unicode  character string encoded in
      * <a href="DataInput.html#modified-utf-8">modified UTF-8</a> format;
-     * this string of characters is then returned as a <code>String</code>.
+     * this string of characters is then returned as a {@code String}.
      * The details of the modified UTF-8 representation
-     * are  exactly the same as for the <code>readUTF</code>
-     * method of <code>DataInput</code>.
+     * are  exactly the same as for the {@code readUTF}
+     * method of {@code DataInput}.
      *
      * @param      in   a data input stream.
      * @return     a Unicode string.
-     * @exception  EOFException            if the input stream reaches the end
+     * @throws     EOFException            if the input stream reaches the end
      *               before all the bytes.
-     * @exception  IOException   the stream has been closed and the contained
+     * @throws     IOException   the stream has been closed and the contained
      *             input stream does not support reading after close, or
      *             another I/O error occurs.
-     * @exception  UTFDataFormatException  if the bytes do not represent a
+     * @throws     UTFDataFormatException  if the bytes do not represent a
      *               valid modified UTF-8 encoding of a Unicode string.
      * @see        java.io.DataInputStream#readUnsignedShort()
      */
--- a/src/java.base/share/classes/java/io/DataOutput.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/DataOutput.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,12 +26,12 @@
 package java.io;
 
 /**
- * The <code>DataOutput</code> interface provides
+ * The {@code DataOutput} interface provides
  * for converting data from any of the Java
  * primitive types to a series of bytes and
  * writing these bytes to a binary stream.
  * There is  also a facility for converting
- * a <code>String</code> into
+ * a {@code String} into
  * <a href="DataInput.html#modified-utf-8">modified UTF-8</a>
  * format and writing the resulting series
  * of bytes.
@@ -39,7 +39,7 @@
  * For all the methods in this interface that
  * write bytes, it is generally true that if
  * a byte cannot be written for any reason,
- * an <code>IOException</code> is thrown.
+ * an {@code IOException} is thrown.
  *
  * @author  Frank Yellin
  * @see     java.io.DataInput
@@ -50,8 +50,8 @@
 interface DataOutput {
     /**
      * Writes to the output stream the eight
-     * low-order bits of the argument <code>b</code>.
-     * The 24 high-order  bits of <code>b</code>
+     * low-order bits of the argument {@code b}.
+     * The 24 high-order  bits of {@code b}
      * are ignored.
      *
      * @param      b   the byte to be written.
@@ -60,14 +60,14 @@
     void write(int b) throws IOException;
 
     /**
-     * Writes to the output stream all the bytes in array <code>b</code>.
-     * If <code>b</code> is <code>null</code>,
-     * a <code>NullPointerException</code> is thrown.
-     * If <code>b.length</code> is zero, then
+     * Writes to the output stream all the bytes in array {@code b}.
+     * If {@code b} is {@code null},
+     * a {@code NullPointerException} is thrown.
+     * If {@code b.length} is zero, then
      * no bytes are written. Otherwise, the byte
-     * <code>b[0]</code> is written first, then
-     * <code>b[1]</code>, and so on; the last byte
-     * written is <code>b[b.length-1]</code>.
+     * {@code b[0]} is written first, then
+     * {@code b[1]}, and so on; the last byte
+     * written is {@code b[b.length-1]}.
      *
      * @param      b   the data.
      * @throws     IOException  if an I/O error occurs.
@@ -75,19 +75,19 @@
     void write(byte b[]) throws IOException;
 
     /**
-     * Writes <code>len</code> bytes from array
-     * <code>b</code>, in order,  to
-     * the output stream.  If <code>b</code>
-     * is <code>null</code>, a <code>NullPointerException</code>
-     * is thrown.  If <code>off</code> is negative,
-     * or <code>len</code> is negative, or <code>off+len</code>
+     * Writes {@code len} bytes from array
+     * {@code b}, in order,  to
+     * the output stream.  If {@code b}
+     * is {@code null}, a {@code NullPointerException}
+     * is thrown.  If {@code off} is negative,
+     * or {@code len} is negative, or {@code off+len}
      * is greater than the length of the array
-     * <code>b</code>, then an <code>IndexOutOfBoundsException</code>
-     * is thrown.  If <code>len</code> is zero,
+     * {@code b}, then an {@code IndexOutOfBoundsException}
+     * is thrown.  If {@code len} is zero,
      * then no bytes are written. Otherwise, the
-     * byte <code>b[off]</code> is written first,
-     * then <code>b[off+1]</code>, and so on; the
-     * last byte written is <code>b[off+len-1]</code>.
+     * byte {@code b[off]} is written first,
+     * then {@code b[off+1]}, and so on; the
+     * last byte written is {@code b[off+len-1]}.
      *
      * @param      b     the data.
      * @param      off   the start offset in the data.
@@ -97,16 +97,16 @@
     void write(byte b[], int off, int len) throws IOException;
 
     /**
-     * Writes a <code>boolean</code> value to this output stream.
-     * If the argument <code>v</code>
-     * is <code>true</code>, the value <code>(byte)1</code>
-     * is written; if <code>v</code> is <code>false</code>,
-     * the  value <code>(byte)0</code> is written.
+     * Writes a {@code boolean} value to this output stream.
+     * If the argument {@code v}
+     * is {@code true}, the value {@code (byte)1}
+     * is written; if {@code v} is {@code false},
+     * the  value {@code (byte)0} is written.
      * The byte written by this method may
-     * be read by the <code>readBoolean</code>
-     * method of interface <code>DataInput</code>,
-     * which will then return a <code>boolean</code>
-     * equal to <code>v</code>.
+     * be read by the {@code readBoolean}
+     * method of interface {@code DataInput},
+     * which will then return a {@code boolean}
+     * equal to {@code v}.
      *
      * @param      v   the boolean to be written.
      * @throws     IOException  if an I/O error occurs.
@@ -115,15 +115,15 @@
 
     /**
      * Writes to the output stream the eight low-
-     * order bits of the argument <code>v</code>.
-     * The 24 high-order bits of <code>v</code>
-     * are ignored. (This means  that <code>writeByte</code>
-     * does exactly the same thing as <code>write</code>
+     * order bits of the argument {@code v}.
+     * The 24 high-order bits of {@code v}
+     * are ignored. (This means  that {@code writeByte}
+     * does exactly the same thing as {@code write}
      * for an integer argument.) The byte written
-     * by this method may be read by the <code>readByte</code>
-     * method of interface <code>DataInput</code>,
-     * which will then return a <code>byte</code>
-     * equal to <code>(byte)v</code>.
+     * by this method may be read by the {@code readByte}
+     * method of interface {@code DataInput},
+     * which will then return a {@code byte}
+     * equal to {@code (byte)v}.
      *
      * @param      v   the byte value to be written.
      * @throws     IOException  if an I/O error occurs.
@@ -140,18 +140,18 @@
      * (byte)(0xff & v)
      * }</pre> <p>
      * The bytes written by this method may be
-     * read by the <code>readShort</code> method
-     * of interface <code>DataInput</code> , which
-     * will then return a <code>short</code> equal
-     * to <code>(short)v</code>.
+     * read by the {@code readShort} method
+     * of interface {@code DataInput} , which
+     * will then return a {@code short} equal
+     * to {@code (short)v}.
      *
-     * @param      v   the <code>short</code> value to be written.
+     * @param      v   the {@code short} value to be written.
      * @throws     IOException  if an I/O error occurs.
      */
     void writeShort(int v) throws IOException;
 
     /**
-     * Writes a <code>char</code> value, which
+     * Writes a {@code char} value, which
      * is comprised of two bytes, to the
      * output stream.
      * The byte values to be written, in the  order
@@ -161,18 +161,18 @@
      * (byte)(0xff & v)
      * }</pre><p>
      * The bytes written by this method may be
-     * read by the <code>readChar</code> method
-     * of interface <code>DataInput</code> , which
-     * will then return a <code>char</code> equal
-     * to <code>(char)v</code>.
+     * read by the {@code readChar} method
+     * of interface {@code DataInput} , which
+     * will then return a {@code char} equal
+     * to {@code (char)v}.
      *
-     * @param      v   the <code>char</code> value to be written.
+     * @param      v   the {@code char} value to be written.
      * @throws     IOException  if an I/O error occurs.
      */
     void writeChar(int v) throws IOException;
 
     /**
-     * Writes an <code>int</code> value, which is
+     * Writes an {@code int} value, which is
      * comprised of four bytes, to the output stream.
      * The byte values to be written, in the  order
      * shown, are:
@@ -183,17 +183,17 @@
      * (byte)(0xff & v)
      * }</pre><p>
      * The bytes written by this method may be read
-     * by the <code>readInt</code> method of interface
-     * <code>DataInput</code> , which will then
-     * return an <code>int</code> equal to <code>v</code>.
+     * by the {@code readInt} method of interface
+     * {@code DataInput} , which will then
+     * return an {@code int} equal to {@code v}.
      *
-     * @param      v   the <code>int</code> value to be written.
+     * @param      v   the {@code int} value to be written.
      * @throws     IOException  if an I/O error occurs.
      */
     void writeInt(int v) throws IOException;
 
     /**
-     * Writes a <code>long</code> value, which is
+     * Writes a {@code long} value, which is
      * comprised of eight bytes, to the output stream.
      * The byte values to be written, in the  order
      * shown, are:
@@ -208,50 +208,50 @@
      * (byte)(0xff & v)
      * }</pre><p>
      * The bytes written by this method may be
-     * read by the <code>readLong</code> method
-     * of interface <code>DataInput</code> , which
-     * will then return a <code>long</code> equal
-     * to <code>v</code>.
+     * read by the {@code readLong} method
+     * of interface {@code DataInput} , which
+     * will then return a {@code long} equal
+     * to {@code v}.
      *
-     * @param      v   the <code>long</code> value to be written.
+     * @param      v   the {@code long} value to be written.
      * @throws     IOException  if an I/O error occurs.
      */
     void writeLong(long v) throws IOException;
 
     /**
-     * Writes a <code>float</code> value,
+     * Writes a {@code float} value,
      * which is comprised of four bytes, to the output stream.
      * It does this as if it first converts this
-     * <code>float</code> value to an <code>int</code>
-     * in exactly the manner of the <code>Float.floatToIntBits</code>
-     * method  and then writes the <code>int</code>
-     * value in exactly the manner of the  <code>writeInt</code>
+     * {@code float} value to an {@code int}
+     * in exactly the manner of the {@code Float.floatToIntBits}
+     * method  and then writes the {@code int}
+     * value in exactly the manner of the  {@code writeInt}
      * method.  The bytes written by this method
-     * may be read by the <code>readFloat</code>
-     * method of interface <code>DataInput</code>,
-     * which will then return a <code>float</code>
-     * equal to <code>v</code>.
+     * may be read by the {@code readFloat}
+     * method of interface {@code DataInput},
+     * which will then return a {@code float}
+     * equal to {@code v}.
      *
-     * @param      v   the <code>float</code> value to be written.
+     * @param      v   the {@code float} value to be written.
      * @throws     IOException  if an I/O error occurs.
      */
     void writeFloat(float v) throws IOException;
 
     /**
-     * Writes a <code>double</code> value,
+     * Writes a {@code double} value,
      * which is comprised of eight bytes, to the output stream.
      * It does this as if it first converts this
-     * <code>double</code> value to a <code>long</code>
-     * in exactly the manner of the <code>Double.doubleToLongBits</code>
-     * method  and then writes the <code>long</code>
-     * value in exactly the manner of the  <code>writeLong</code>
+     * {@code double} value to a {@code long}
+     * in exactly the manner of the {@code Double.doubleToLongBits}
+     * method  and then writes the {@code long}
+     * value in exactly the manner of the  {@code writeLong}
      * method. The bytes written by this method
-     * may be read by the <code>readDouble</code>
-     * method of interface <code>DataInput</code>,
-     * which will then return a <code>double</code>
-     * equal to <code>v</code>.
+     * may be read by the {@code readDouble}
+     * method of interface {@code DataInput},
+     * which will then return a {@code double}
+     * equal to {@code v}.
      *
-     * @param      v   the <code>double</code> value to be written.
+     * @param      v   the {@code double} value to be written.
      * @throws     IOException  if an I/O error occurs.
      */
     void writeDouble(double v) throws IOException;
@@ -259,17 +259,17 @@
     /**
      * Writes a string to the output stream.
      * For every character in the string
-     * <code>s</code>,  taken in order, one byte
+     * {@code s},  taken in order, one byte
      * is written to the output stream.  If
-     * <code>s</code> is <code>null</code>, a <code>NullPointerException</code>
-     * is thrown.<p>  If <code>s.length</code>
+     * {@code s} is {@code null}, a {@code NullPointerException}
+     * is thrown.<p>  If {@code s.length}
      * is zero, then no bytes are written. Otherwise,
-     * the character <code>s[0]</code> is written
-     * first, then <code>s[1]</code>, and so on;
-     * the last character written is <code>s[s.length-1]</code>.
+     * the character {@code s[0]} is written
+     * first, then {@code s[1]}, and so on;
+     * the last character written is {@code s[s.length-1]}.
      * For each character, one byte is written,
      * the low-order byte, in exactly the manner
-     * of the <code>writeByte</code> method . The
+     * of the {@code writeByte} method . The
      * high-order eight bits of each character
      * in the string are ignored.
      *
@@ -279,19 +279,19 @@
     void writeBytes(String s) throws IOException;
 
     /**
-     * Writes every character in the string <code>s</code>,
+     * Writes every character in the string {@code s},
      * to the output stream, in order,
-     * two bytes per character. If <code>s</code>
-     * is <code>null</code>, a <code>NullPointerException</code>
-     * is thrown.  If <code>s.length</code>
+     * two bytes per character. If {@code s}
+     * is {@code null}, a {@code NullPointerException}
+     * is thrown.  If {@code s.length}
      * is zero, then no characters are written.
-     * Otherwise, the character <code>s[0]</code>
-     * is written first, then <code>s[1]</code>,
+     * Otherwise, the character {@code s[0]}
+     * is written first, then {@code s[1]},
      * and so on; the last character written is
-     * <code>s[s.length-1]</code>. For each character,
+     * {@code s[s.length-1]}. For each character,
      * two bytes are actually written, high-order
      * byte first, in exactly the manner of the
-     * <code>writeChar</code> method.
+     * {@code writeChar} method.
      *
      * @param      s   the string value to be written.
      * @throws     IOException  if an I/O error occurs.
@@ -304,19 +304,19 @@
      * by the
      * <a href="DataInput.html#modified-utf-8">modified UTF-8</a>
      * representation
-     * of  every character in the string <code>s</code>.
-     * If <code>s</code> is <code>null</code>,
-     * a <code>NullPointerException</code> is thrown.
-     * Each character in the string <code>s</code>
+     * of  every character in the string {@code s}.
+     * If {@code s} is {@code null},
+     * a {@code NullPointerException} is thrown.
+     * Each character in the string {@code s}
      * is converted to a group of one, two, or
      * three bytes, depending on the value of the
      * character.<p>
-     * If a character <code>c</code>
+     * If a character {@code c}
      * is in the range <code>&#92;u0001</code> through
      * <code>&#92;u007f</code>, it is represented
      * by one byte:
      * <pre>(byte)c </pre>  <p>
-     * If a character <code>c</code> is <code>&#92;u0000</code>
+     * If a character {@code c} is <code>&#92;u0000</code>
      * or is in the range <code>&#92;u0080</code>
      * through <code>&#92;u07ff</code>, then it is
      * represented by two bytes, to be written
@@ -324,8 +324,8 @@
      * (byte)(0xc0 | (0x1f & (c >> 6)))
      * (byte)(0x80 | (0x3f & c))
      * }</pre> <p> If a character
-     * <code>c</code> is in the range <code>&#92;u0800</code>
-     * through <code>uffff</code>, then it is
+     * {@code c} is in the range <code>&#92;u0800</code>
+     * through {@code uffff}, then it is
      * represented by three bytes, to be written
      * in the order shown: <pre>{@code
      * (byte)(0xe0 | (0x0f & (c >> 12)))
@@ -333,19 +333,19 @@
      * (byte)(0x80 | (0x3f & c))
      * }</pre>  <p> First,
      * the total number of bytes needed to represent
-     * all the characters of <code>s</code> is
+     * all the characters of {@code s} is
      * calculated. If this number is larger than
-     * <code>65535</code>, then a <code>UTFDataFormatException</code>
+     * {@code 65535}, then a {@code UTFDataFormatException}
      * is thrown. Otherwise, this length is written
      * to the output stream in exactly the manner
-     * of the <code>writeShort</code> method;
+     * of the {@code writeShort} method;
      * after this, the one-, two-, or three-byte
      * representation of each character in the
-     * string <code>s</code> is written.<p>  The
+     * string {@code s} is written.<p>  The
      * bytes written by this method may be read
-     * by the <code>readUTF</code> method of interface
-     * <code>DataInput</code> , which will then
-     * return a <code>String</code> equal to <code>s</code>.
+     * by the {@code readUTF} method of interface
+     * {@code DataInput} , which will then
+     * return a {@code String} equal to {@code s}.
      *
      * @param      s   the string value to be written.
      * @throws     IOException  if an I/O error occurs.
--- a/src/java.base/share/classes/java/io/DataOutputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/DataOutputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -49,7 +49,7 @@
 
     /**
      * Creates a new data output stream to write data to the specified
-     * underlying output stream. The counter <code>written</code> is
+     * underlying output stream. The counter {@code written} is
      * set to zero.
      *
      * @param   out   the underlying output stream, to be saved for later
@@ -74,14 +74,14 @@
 
     /**
      * Writes the specified byte (the low eight bits of the argument
-     * <code>b</code>) to the underlying output stream. If no exception
-     * is thrown, the counter <code>written</code> is incremented by
-     * <code>1</code>.
+     * {@code b}) to the underlying output stream. If no exception
+     * is thrown, the counter {@code written} is incremented by
+     * {@code 1}.
      * <p>
-     * Implements the <code>write</code> method of <code>OutputStream</code>.
+     * Implements the {@code write} method of {@code OutputStream}.
      *
-     * @param      b   the <code>byte</code> to be written.
-     * @exception  IOException  if an I/O error occurs.
+     * @param      b   the {@code byte} to be written.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.FilterOutputStream#out
      */
     public synchronized void write(int b) throws IOException {
@@ -90,15 +90,15 @@
     }
 
     /**
-     * Writes <code>len</code> bytes from the specified byte array
-     * starting at offset <code>off</code> to the underlying output stream.
-     * If no exception is thrown, the counter <code>written</code> is
-     * incremented by <code>len</code>.
+     * Writes {@code len} bytes from the specified byte array
+     * starting at offset {@code off} to the underlying output stream.
+     * If no exception is thrown, the counter {@code written} is
+     * incremented by {@code len}.
      *
      * @param      b     the data.
      * @param      off   the start offset in the data.
      * @param      len   the number of bytes to write.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.FilterOutputStream#out
      */
     public synchronized void write(byte b[], int off, int len)
@@ -112,10 +112,10 @@
      * Flushes this data output stream. This forces any buffered output
      * bytes to be written out to the stream.
      * <p>
-     * The <code>flush</code> method of <code>DataOutputStream</code>
-     * calls the <code>flush</code> method of its underlying output stream.
+     * The {@code flush} method of {@code DataOutputStream}
+     * calls the {@code flush} method of its underlying output stream.
      *
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.FilterOutputStream#out
      * @see        java.io.OutputStream#flush()
      */
@@ -124,15 +124,15 @@
     }
 
     /**
-     * Writes a <code>boolean</code> to the underlying output stream as
-     * a 1-byte value. The value <code>true</code> is written out as the
-     * value <code>(byte)1</code>; the value <code>false</code> is
-     * written out as the value <code>(byte)0</code>. If no exception is
-     * thrown, the counter <code>written</code> is incremented by
-     * <code>1</code>.
+     * Writes a {@code boolean} to the underlying output stream as
+     * a 1-byte value. The value {@code true} is written out as the
+     * value {@code (byte)1}; the value {@code false} is
+     * written out as the value {@code (byte)0}. If no exception is
+     * thrown, the counter {@code written} is incremented by
+     * {@code 1}.
      *
-     * @param      v   a <code>boolean</code> value to be written.
-     * @exception  IOException  if an I/O error occurs.
+     * @param      v   a {@code boolean} value to be written.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.FilterOutputStream#out
      */
     public final void writeBoolean(boolean v) throws IOException {
@@ -141,12 +141,12 @@
     }
 
     /**
-     * Writes out a <code>byte</code> to the underlying output stream as
+     * Writes out a {@code byte} to the underlying output stream as
      * a 1-byte value. If no exception is thrown, the counter
-     * <code>written</code> is incremented by <code>1</code>.
+     * {@code written} is incremented by {@code 1}.
      *
-     * @param      v   a <code>byte</code> value to be written.
-     * @exception  IOException  if an I/O error occurs.
+     * @param      v   a {@code byte} value to be written.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.FilterOutputStream#out
      */
     public final void writeByte(int v) throws IOException {
@@ -155,12 +155,12 @@
     }
 
     /**
-     * Writes a <code>short</code> to the underlying output stream as two
+     * Writes a {@code short} to the underlying output stream as two
      * bytes, high byte first. If no exception is thrown, the counter
-     * <code>written</code> is incremented by <code>2</code>.
+     * {@code written} is incremented by {@code 2}.
      *
-     * @param      v   a <code>short</code> to be written.
-     * @exception  IOException  if an I/O error occurs.
+     * @param      v   a {@code short} to be written.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.FilterOutputStream#out
      */
     public final void writeShort(int v) throws IOException {
@@ -170,12 +170,12 @@
     }
 
     /**
-     * Writes a <code>char</code> to the underlying output stream as a
+     * Writes a {@code char} to the underlying output stream as a
      * 2-byte value, high byte first. If no exception is thrown, the
-     * counter <code>written</code> is incremented by <code>2</code>.
+     * counter {@code written} is incremented by {@code 2}.
      *
-     * @param      v   a <code>char</code> value to be written.
-     * @exception  IOException  if an I/O error occurs.
+     * @param      v   a {@code char} value to be written.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.FilterOutputStream#out
      */
     public final void writeChar(int v) throws IOException {
@@ -185,12 +185,12 @@
     }
 
     /**
-     * Writes an <code>int</code> to the underlying output stream as four
+     * Writes an {@code int} to the underlying output stream as four
      * bytes, high byte first. If no exception is thrown, the counter
-     * <code>written</code> is incremented by <code>4</code>.
+     * {@code written} is incremented by {@code 4}.
      *
-     * @param      v   an <code>int</code> to be written.
-     * @exception  IOException  if an I/O error occurs.
+     * @param      v   an {@code int} to be written.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.FilterOutputStream#out
      */
     public final void writeInt(int v) throws IOException {
@@ -204,12 +204,12 @@
     private byte writeBuffer[] = new byte[8];
 
     /**
-     * Writes a <code>long</code> to the underlying output stream as eight
+     * Writes a {@code long} to the underlying output stream as eight
      * bytes, high byte first. In no exception is thrown, the counter
-     * <code>written</code> is incremented by <code>8</code>.
+     * {@code written} is incremented by {@code 8}.
      *
-     * @param      v   a <code>long</code> to be written.
-     * @exception  IOException  if an I/O error occurs.
+     * @param      v   a {@code long} to be written.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.FilterOutputStream#out
      */
     public final void writeLong(long v) throws IOException {
@@ -226,15 +226,15 @@
     }
 
     /**
-     * Converts the float argument to an <code>int</code> using the
-     * <code>floatToIntBits</code> method in class <code>Float</code>,
-     * and then writes that <code>int</code> value to the underlying
+     * Converts the float argument to an {@code int} using the
+     * {@code floatToIntBits} method in class {@code Float},
+     * and then writes that {@code int} value to the underlying
      * output stream as a 4-byte quantity, high byte first. If no
-     * exception is thrown, the counter <code>written</code> is
-     * incremented by <code>4</code>.
+     * exception is thrown, the counter {@code written} is
+     * incremented by {@code 4}.
      *
-     * @param      v   a <code>float</code> value to be written.
-     * @exception  IOException  if an I/O error occurs.
+     * @param      v   a {@code float} value to be written.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.FilterOutputStream#out
      * @see        java.lang.Float#floatToIntBits(float)
      */
@@ -243,15 +243,15 @@
     }
 
     /**
-     * Converts the double argument to a <code>long</code> using the
-     * <code>doubleToLongBits</code> method in class <code>Double</code>,
-     * and then writes that <code>long</code> value to the underlying
+     * Converts the double argument to a {@code long} using the
+     * {@code doubleToLongBits} method in class {@code Double},
+     * and then writes that {@code long} value to the underlying
      * output stream as an 8-byte quantity, high byte first. If no
-     * exception is thrown, the counter <code>written</code> is
-     * incremented by <code>8</code>.
+     * exception is thrown, the counter {@code written} is
+     * incremented by {@code 8}.
      *
-     * @param      v   a <code>double</code> value to be written.
-     * @exception  IOException  if an I/O error occurs.
+     * @param      v   a {@code double} value to be written.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.FilterOutputStream#out
      * @see        java.lang.Double#doubleToLongBits(double)
      */
@@ -263,11 +263,11 @@
      * Writes out the string to the underlying output stream as a
      * sequence of bytes. Each character in the string is written out, in
      * sequence, by discarding its high eight bits. If no exception is
-     * thrown, the counter <code>written</code> is incremented by the
-     * length of <code>s</code>.
+     * thrown, the counter {@code written} is incremented by the
+     * length of {@code s}.
      *
      * @param      s   a string of bytes to be written.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.FilterOutputStream#out
      */
     public final void writeBytes(String s) throws IOException {
@@ -281,12 +281,12 @@
     /**
      * Writes a string to the underlying output stream as a sequence of
      * characters. Each character is written to the data output stream as
-     * if by the <code>writeChar</code> method. If no exception is
-     * thrown, the counter <code>written</code> is incremented by twice
-     * the length of <code>s</code>.
+     * if by the {@code writeChar} method. If no exception is
+     * thrown, the counter {@code written} is incremented by twice
+     * the length of {@code s}.
      *
-     * @param      s   a <code>String</code> value to be written.
-     * @exception  IOException  if an I/O error occurs.
+     * @param      s   a {@code String} value to be written.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.DataOutputStream#writeChar(int)
      * @see        java.io.FilterOutputStream#out
      */
@@ -306,15 +306,15 @@
      * encoding in a machine-independent manner.
      * <p>
      * First, two bytes are written to the output stream as if by the
-     * <code>writeShort</code> method giving the number of bytes to
+     * {@code writeShort} method giving the number of bytes to
      * follow. This value is the number of bytes actually written out,
      * not the length of the string. Following the length, each character
      * of the string is output, in sequence, using the modified UTF-8 encoding
      * for the character. If no exception is thrown, the counter
-     * <code>written</code> is incremented by the total number of
+     * {@code written} is incremented by the total number of
      * bytes written to the output stream. This will be at least two
-     * plus the length of <code>str</code>, and at most two plus
-     * thrice the length of <code>str</code>.
+     * plus the length of {@code str}, and at most two plus
+     * thrice the length of {@code str}.
      *
      * @param      str   a string to be written.
      * @throws     UTFDataFormatException  if the modified UTF-8 encoding of
@@ -331,15 +331,15 @@
      * <a href="DataInput.html#modified-utf-8">modified UTF-8</a>
      * encoding in a machine-independent manner.
      * <p>
-     * First, two bytes are written to out as if by the <code>writeShort</code>
+     * First, two bytes are written to out as if by the {@code writeShort}
      * method giving the number of bytes to follow. This value is the number of
      * bytes actually written out, not the length of the string. Following the
      * length, each character of the string is output, in sequence, using the
      * modified UTF-8 encoding for the character. If no exception is thrown, the
-     * counter <code>written</code> is incremented by the total number of
+     * counter {@code written} is incremented by the total number of
      * bytes written to the output stream. This will be at least two
-     * plus the length of <code>str</code>, and at most two plus
-     * thrice the length of <code>str</code>.
+     * plus the length of {@code str}, and at most two plus
+     * thrice the length of {@code str}.
      *
      * @param      str   a string to be written.
      * @param      out   destination to write to
@@ -410,11 +410,11 @@
     }
 
     /**
-     * Returns the current value of the counter <code>written</code>,
+     * Returns the current value of the counter {@code written},
      * the number of bytes written to this data output stream so far.
      * If the counter overflows, it will be wrapped to Integer.MAX_VALUE.
      *
-     * @return  the value of the <code>written</code> field.
+     * @return  the value of the {@code written} field.
      * @see     java.io.DataOutputStream#written
      */
     public final int size() {
--- a/src/java.base/share/classes/java/io/EOFException.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/EOFException.java	Tue Sep 24 15:19:35 2019 -0400
@@ -44,7 +44,7 @@
     private static final long serialVersionUID = 6433858223774886977L;
 
     /**
-     * Constructs an <code>EOFException</code> with <code>null</code>
+     * Constructs an {@code EOFException} with {@code null}
      * as its error detail message.
      */
     public EOFException() {
@@ -52,10 +52,10 @@
     }
 
     /**
-     * Constructs an <code>EOFException</code> with the specified detail
-     * message. The string <code>s</code> may later be retrieved by the
+     * Constructs an {@code EOFException} with the specified detail
+     * message. The string {@code s} may later be retrieved by the
      * <code>{@link java.lang.Throwable#getMessage}</code> method of class
-     * <code>java.lang.Throwable</code>.
+     * {@code java.lang.Throwable}.
      *
      * @param   s   the detail message.
      */
--- a/src/java.base/share/classes/java/io/Externalizable.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/Externalizable.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -76,8 +76,8 @@
      *             relate the element to a public/protected field and/or
      *             method of this Externalizable class.
      *
-     * @param out the stream to write the object to
-     * @exception IOException Includes any I/O exceptions that may occur
+     * @param     out the stream to write the object to
+     * @throws    IOException Includes any I/O exceptions that may occur
      */
     void writeExternal(ObjectOutput out) throws IOException;
 
@@ -88,10 +88,10 @@
      * readExternal method must read the values in the same sequence
      * and with the same types as were written by writeExternal.
      *
-     * @param in the stream to read data from in order to restore the object
-     * @exception IOException if I/O errors occur
-     * @exception ClassNotFoundException If the class for an object being
-     *              restored cannot be found.
+     * @param     in the stream to read data from in order to restore the object
+     * @throws    IOException if I/O errors occur
+     * @throws    ClassNotFoundException If the class for an object being
+     *            restored cannot be found.
      */
     void readExternal(ObjectInput in) throws IOException, ClassNotFoundException;
 }
--- a/src/java.base/share/classes/java/io/File.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/File.java	Tue Sep 24 15:19:35 2019 -0400
@@ -46,8 +46,8 @@
  *
  * <ol>
  * <li> An optional system-dependent <em>prefix</em> string,
- *      such as a disk-drive specifier, <code>"/"</code>&nbsp;for the UNIX root
- *      directory, or <code>"\\\\"</code>&nbsp;for a Microsoft Windows UNC pathname, and
+ *      such as a disk-drive specifier, {@code "/"}&nbsp;for the UNIX root
+ *      directory, or {@code "\\\\"}&nbsp;for a Microsoft Windows UNC pathname, and
  * <li> A sequence of zero or more string <em>names</em>.
  * </ol>
  *
@@ -61,7 +61,7 @@
  * inherently system-dependent.  When an abstract pathname is converted into a
  * pathname string, each name is separated from the next by a single copy of
  * the default <em>separator character</em>.  The default name-separator
- * character is defined by the system property <code>file.separator</code>, and
+ * character is defined by the system property {@code file.separator}, and
  * is made available in the public static fields {@link
  * #separator} and {@link #separatorChar} of this class.
  * When a pathname string is converted into an abstract pathname, the names
@@ -73,9 +73,9 @@
  * that no other information is required in order to locate the file that it
  * denotes.  A relative pathname, in contrast, must be interpreted in terms of
  * information taken from some other pathname.  By default the classes in the
- * <code>java.io</code> package always resolve relative pathnames against the
+ * {@code java.io} package always resolve relative pathnames against the
  * current user directory.  This directory is named by the system property
- * <code>user.dir</code>, and is typically the directory in which the Java
+ * {@code user.dir}, and is typically the directory in which the Java
  * virtual machine was invoked.
  *
  * <p> The <em>parent</em> of an abstract pathname may be obtained by invoking
@@ -94,14 +94,14 @@
  * <ul>
  *
  * <li> For UNIX platforms, the prefix of an absolute pathname is always
- * <code>"/"</code>.  Relative pathnames have no prefix.  The abstract pathname
- * denoting the root directory has the prefix <code>"/"</code> and an empty
+ * {@code "/"}.  Relative pathnames have no prefix.  The abstract pathname
+ * denoting the root directory has the prefix {@code "/"} and an empty
  * name sequence.
  *
  * <li> For Microsoft Windows platforms, the prefix of a pathname that contains a drive
- * specifier consists of the drive letter followed by <code>":"</code> and
- * possibly followed by <code>"\\"</code> if the pathname is absolute.  The
- * prefix of a UNC pathname is <code>"\\\\"</code>; the hostname and the share
+ * specifier consists of the drive letter followed by {@code ":"} and
+ * possibly followed by {@code "\\"} if the pathname is absolute.  The
+ * prefix of a UNC pathname is {@code "\\\\"}; the hostname and the share
  * name are the first two names in the name sequence.  A relative pathname that
  * does not specify a drive has no prefix.
  *
@@ -124,8 +124,8 @@
  * may apply to all other users.  The access permissions on an object may
  * cause some methods in this class to fail.
  *
- * <p> Instances of the <code>File</code> class are immutable; that is, once
- * created, the abstract pathname represented by a <code>File</code> object
+ * <p> Instances of the {@code File} class are immutable; that is, once
+ * created, the abstract pathname represented by a {@code File} object
  * will never change.
  *
  * <h2>Interoperability with {@code java.nio.file} package</h2>
@@ -208,8 +208,8 @@
     /**
      * The system-dependent default name-separator character.  This field is
      * initialized to contain the first character of the value of the system
-     * property <code>file.separator</code>.  On UNIX systems the value of this
-     * field is <code>'/'</code>; on Microsoft Windows systems it is <code>'\\'</code>.
+     * property {@code file.separator}.  On UNIX systems the value of this
+     * field is {@code '/'}; on Microsoft Windows systems it is {@code '\\'}.
      *
      * @see     java.lang.System#getProperty(java.lang.String)
      */
@@ -225,10 +225,10 @@
     /**
      * The system-dependent path-separator character.  This field is
      * initialized to contain the first character of the value of the system
-     * property <code>path.separator</code>.  This character is used to
+     * property {@code path.separator}.  This character is used to
      * separate filenames in a sequence of files given as a <em>path list</em>.
-     * On UNIX systems, this character is <code>':'</code>; on Microsoft Windows systems it
-     * is <code>';'</code>.
+     * On UNIX systems, this character is {@code ':'}; on Microsoft Windows systems it
+     * is {@code ';'}.
      *
      * @see     java.lang.System#getProperty(java.lang.String)
      */
@@ -265,13 +265,13 @@
     }
 
     /**
-     * Creates a new <code>File</code> instance by converting the given
+     * Creates a new {@code File} instance by converting the given
      * pathname string into an abstract pathname.  If the given string is
      * the empty string, then the result is the empty abstract pathname.
      *
      * @param   pathname  A pathname string
      * @throws  NullPointerException
-     *          If the <code>pathname</code> argument is <code>null</code>
+     *          If the {@code pathname} argument is {@code null}
      */
     public File(String pathname) {
         if (pathname == null) {
@@ -289,21 +289,21 @@
        compatibility with the original behavior of this class. */
 
     /**
-     * Creates a new <code>File</code> instance from a parent pathname string
+     * Creates a new {@code File} instance from a parent pathname string
      * and a child pathname string.
      *
-     * <p> If <code>parent</code> is <code>null</code> then the new
-     * <code>File</code> instance is created as if by invoking the
-     * single-argument <code>File</code> constructor on the given
-     * <code>child</code> pathname string.
+     * <p> If {@code parent} is {@code null} then the new
+     * {@code File} instance is created as if by invoking the
+     * single-argument {@code File} constructor on the given
+     * {@code child} pathname string.
      *
-     * <p> Otherwise the <code>parent</code> pathname string is taken to denote
-     * a directory, and the <code>child</code> pathname string is taken to
-     * denote either a directory or a file.  If the <code>child</code> pathname
+     * <p> Otherwise the {@code parent} pathname string is taken to denote
+     * a directory, and the {@code child} pathname string is taken to
+     * denote either a directory or a file.  If the {@code child} pathname
      * string is absolute then it is converted into a relative pathname in a
-     * system-dependent way.  If <code>parent</code> is the empty string then
-     * the new <code>File</code> instance is created by converting
-     * <code>child</code> into an abstract pathname and resolving the result
+     * system-dependent way.  If {@code parent} is the empty string then
+     * the new {@code File} instance is created by converting
+     * {@code child} into an abstract pathname and resolving the result
      * against a system-dependent default directory.  Otherwise each pathname
      * string is converted into an abstract pathname and the child abstract
      * pathname is resolved against the parent.
@@ -311,7 +311,7 @@
      * @param   parent  The parent pathname string
      * @param   child   The child pathname string
      * @throws  NullPointerException
-     *          If <code>child</code> is <code>null</code>
+     *          If {@code child} is {@code null}
      */
     public File(String parent, String child) {
         if (child == null) {
@@ -332,21 +332,21 @@
     }
 
     /**
-     * Creates a new <code>File</code> instance from a parent abstract
+     * Creates a new {@code File} instance from a parent abstract
      * pathname and a child pathname string.
      *
-     * <p> If <code>parent</code> is <code>null</code> then the new
-     * <code>File</code> instance is created as if by invoking the
-     * single-argument <code>File</code> constructor on the given
-     * <code>child</code> pathname string.
+     * <p> If {@code parent} is {@code null} then the new
+     * {@code File} instance is created as if by invoking the
+     * single-argument {@code File} constructor on the given
+     * {@code child} pathname string.
      *
-     * <p> Otherwise the <code>parent</code> abstract pathname is taken to
-     * denote a directory, and the <code>child</code> pathname string is taken
-     * to denote either a directory or a file.  If the <code>child</code>
+     * <p> Otherwise the {@code parent} abstract pathname is taken to
+     * denote a directory, and the {@code child} pathname string is taken
+     * to denote either a directory or a file.  If the {@code child}
      * pathname string is absolute then it is converted into a relative
-     * pathname in a system-dependent way.  If <code>parent</code> is the empty
-     * abstract pathname then the new <code>File</code> instance is created by
-     * converting <code>child</code> into an abstract pathname and resolving
+     * pathname in a system-dependent way.  If {@code parent} is the empty
+     * abstract pathname then the new {@code File} instance is created by
+     * converting {@code child} into an abstract pathname and resolving
      * the result against a system-dependent default directory.  Otherwise each
      * pathname string is converted into an abstract pathname and the child
      * abstract pathname is resolved against the parent.
@@ -354,7 +354,7 @@
      * @param   parent  The parent abstract pathname
      * @param   child   The child pathname string
      * @throws  NullPointerException
-     *          If <code>child</code> is <code>null</code>
+     *          If {@code child} is {@code null}
      */
     public File(File parent, String child) {
         if (child == null) {
@@ -460,7 +460,7 @@
 
     /**
      * Returns the pathname string of this abstract pathname's parent, or
-     * <code>null</code> if this pathname does not name a parent directory.
+     * {@code null} if this pathname does not name a parent directory.
      *
      * <p> The <em>parent</em> of an abstract pathname consists of the
      * pathname's prefix, if any, and each name in the pathname's name
@@ -468,7 +468,7 @@
      * the pathname does not name a parent directory.
      *
      * @return  The pathname string of the parent directory named by this
-     *          abstract pathname, or <code>null</code> if this pathname
+     *          abstract pathname, or {@code null} if this pathname
      *          does not name a parent
      */
     public String getParent() {
@@ -483,7 +483,7 @@
 
     /**
      * Returns the abstract pathname of this abstract pathname's parent,
-     * or <code>null</code> if this pathname does not name a parent
+     * or {@code null} if this pathname does not name a parent
      * directory.
      *
      * <p> The <em>parent</em> of an abstract pathname consists of the
@@ -492,7 +492,7 @@
      * the pathname does not name a parent directory.
      *
      * @return  The abstract pathname of the parent directory named by this
-     *          abstract pathname, or <code>null</code> if this pathname
+     *          abstract pathname, or {@code null} if this pathname
      *          does not name a parent
      *
      * @since 1.2
@@ -520,12 +520,12 @@
     /**
      * Tests whether this abstract pathname is absolute.  The definition of
      * absolute pathname is system dependent.  On UNIX systems, a pathname is
-     * absolute if its prefix is <code>"/"</code>.  On Microsoft Windows systems, a
+     * absolute if its prefix is {@code "/"}.  On Microsoft Windows systems, a
      * pathname is absolute if its prefix is a drive specifier followed by
-     * <code>"\\"</code>, or if its prefix is <code>"\\\\"</code>.
+     * {@code "\\"}, or if its prefix is {@code "\\\\"}.
      *
-     * @return  <code>true</code> if this abstract pathname is absolute,
-     *          <code>false</code> otherwise
+     * @return  {@code true} if this abstract pathname is absolute,
+     *          {@code false} otherwise
      */
     public boolean isAbsolute() {
         return fs.isAbsolute(this);
@@ -538,7 +538,7 @@
      * string is simply returned as if by the {@link #getPath}
      * method.  If this abstract pathname is the empty abstract pathname then
      * the pathname string of the current user directory, which is named by the
-     * system property <code>user.dir</code>, is returned.  Otherwise this
+     * system property {@code user.dir}, is returned.  Otherwise this
      * pathname is resolved in a system-dependent way.  On UNIX systems, a
      * relative pathname is made absolute by resolving it against the current
      * user directory.  On Microsoft Windows systems, a relative pathname is made absolute
@@ -658,7 +658,7 @@
     }
 
     /**
-     * Converts this abstract pathname into a <code>file:</code> URL.  The
+     * Converts this abstract pathname into a {@code file:} URL.  The
      * exact form of the URL is system-dependent.  If it can be determined that
      * the file denoted by this abstract pathname is a directory, then the
      * resulting URL will end with a slash.
@@ -751,9 +751,9 @@
      * files that are marked as unreadable. Consequently this method may return
      * {@code true} even though the file does not have read permissions.
      *
-     * @return  <code>true</code> if and only if the file specified by this
+     * @return  {@code true} if and only if the file specified by this
      *          abstract pathname exists <em>and</em> can be read by the
-     *          application; <code>false</code> otherwise
+     *          application; {@code false} otherwise
      *
      * @throws  SecurityException
      *          If a security manager exists and its {@link
@@ -778,10 +778,10 @@
      * files that are marked read-only. Consequently this method may return
      * {@code true} even though the file is marked read-only.
      *
-     * @return  <code>true</code> if and only if the file system actually
+     * @return  {@code true} if and only if the file system actually
      *          contains a file denoted by this abstract pathname <em>and</em>
      *          the application is allowed to write to the file;
-     *          <code>false</code> otherwise.
+     *          {@code false} otherwise.
      *
      * @throws  SecurityException
      *          If a security manager exists and its {@link
@@ -803,8 +803,8 @@
      * Tests whether the file or directory denoted by this abstract pathname
      * exists.
      *
-     * @return  <code>true</code> if and only if the file or directory denoted
-     *          by this abstract pathname exists; <code>false</code> otherwise
+     * @return  {@code true} if and only if the file or directory denoted
+     *          by this abstract pathname exists; {@code false} otherwise
      *
      * @throws  SecurityException
      *          If a security manager exists and its {@link
@@ -832,9 +832,9 @@
      * java.nio.file.Files#readAttributes(Path,Class,LinkOption[])
      * Files.readAttributes} method may be used.
      *
-     * @return <code>true</code> if and only if the file denoted by this
+     * @return {@code true} if and only if the file denoted by this
      *          abstract pathname exists <em>and</em> is a directory;
-     *          <code>false</code> otherwise
+     *          {@code false} otherwise
      *
      * @throws  SecurityException
      *          If a security manager exists and its {@link
@@ -865,9 +865,9 @@
      * java.nio.file.Files#readAttributes(Path,Class,LinkOption[])
      * Files.readAttributes} method may be used.
      *
-     * @return  <code>true</code> if and only if the file denoted by this
+     * @return  {@code true} if and only if the file denoted by this
      *          abstract pathname exists <em>and</em> is a normal file;
-     *          <code>false</code> otherwise
+     *          {@code false} otherwise
      *
      * @throws  SecurityException
      *          If a security manager exists and its {@link
@@ -889,10 +889,10 @@
      * Tests whether the file named by this abstract pathname is a hidden
      * file.  The exact definition of <em>hidden</em> is system-dependent.  On
      * UNIX systems, a file is considered to be hidden if its name begins with
-     * a period character (<code>'.'</code>).  On Microsoft Windows systems, a file is
+     * a period character ({@code '.'}).  On Microsoft Windows systems, a file is
      * considered to be hidden if it has been marked as such in the filesystem.
      *
-     * @return  <code>true</code> if and only if the file denoted by this
+     * @return  {@code true} if and only if the file denoted by this
      *          abstract pathname is hidden according to the conventions of the
      *          underlying platform
      *
@@ -934,9 +934,9 @@
      * {@link java.nio.file.Files#getLastModifiedTime(Path,LinkOption[])
      * Files.getLastModifiedTime} method may be used instead.
      *
-     * @return  A <code>long</code> value representing the time the file was
+     * @return  A {@code long} value representing the time the file was
      *          last modified, measured in milliseconds since the epoch
-     *          (00:00:00 GMT, January 1, 1970), or <code>0L</code> if the
+     *          (00:00:00 GMT, January 1, 1970), or {@code 0L} if the
      *          file does not exist or if an I/O error occurs.  The value may
      *          be negative indicating the number of milliseconds before the
      *          epoch
@@ -968,8 +968,8 @@
      * Files.readAttributes} method may be used.
      *
      * @return  The length, in bytes, of the file denoted by this abstract
-     *          pathname, or <code>0L</code> if the file does not exist.  Some
-     *          operating systems may return <code>0L</code> for pathnames
+     *          pathname, or {@code 0L} if the file does not exist.  Some
+     *          operating systems may return {@code 0L} for pathnames
      *          denoting system-dependent entities such as devices or pipes.
      *
      * @throws  SecurityException
@@ -1003,8 +1003,8 @@
      * {@link java.nio.channels.FileLock FileLock}
      * facility should be used instead.
      *
-     * @return  <code>true</code> if the named file does not exist and was
-     *          successfully created; <code>false</code> if the named file
+     * @return  {@code true} if the named file does not exist and was
+     *          successfully created; {@code false} if the named file
      *          already exists
      *
      * @throws  IOException
@@ -1036,8 +1036,8 @@
      * when a file cannot be deleted. This is useful for error reporting and to
      * diagnose why a file cannot be deleted.
      *
-     * @return  <code>true</code> if and only if the file or directory is
-     *          successfully deleted; <code>false</code> otherwise
+     * @return  {@code true} if and only if the file or directory is
+     *          successfully deleted; {@code false} otherwise
      *
      * @throws  SecurityException
      *          If a security manager exists and its {@link
@@ -1311,8 +1311,8 @@
     /**
      * Creates the directory named by this abstract pathname.
      *
-     * @return  <code>true</code> if and only if the directory was
-     *          created; <code>false</code> otherwise
+     * @return  {@code true} if and only if the directory was
+     *          created; {@code false} otherwise
      *
      * @throws  SecurityException
      *          If a security manager exists and its {@link
@@ -1336,8 +1336,8 @@
      * operation fails it may have succeeded in creating some of the necessary
      * parent directories.
      *
-     * @return  <code>true</code> if and only if the directory was created,
-     *          along with all necessary parent directories; <code>false</code>
+     * @return  {@code true} if and only if the directory was created,
+     *          along with all necessary parent directories; {@code false}
      *          otherwise
      *
      * @throws  SecurityException
@@ -1385,8 +1385,8 @@
      *
      * @param  dest  The new abstract pathname for the named file
      *
-     * @return  <code>true</code> if and only if the renaming succeeded;
-     *          <code>false</code> otherwise
+     * @return  {@code true} if and only if the renaming succeeded;
+     *          {@code false} otherwise
      *
      * @throws  SecurityException
      *          If a security manager exists and its {@link
@@ -1394,7 +1394,7 @@
      *          method denies write access to either the old or new pathnames
      *
      * @throws  NullPointerException
-     *          If parameter <code>dest</code> is <code>null</code>
+     *          If parameter {@code dest} is {@code null}
      */
     public boolean renameTo(File dest) {
         if (dest == null) {
@@ -1420,13 +1420,13 @@
      * the supported precision.  If the operation succeeds and no intervening
      * operations on the file take place, then the next invocation of the
      * {@link #lastModified} method will return the (possibly
-     * truncated) <code>time</code> argument that was passed to this method.
+     * truncated) {@code time} argument that was passed to this method.
      *
      * @param  time  The new last-modified time, measured in milliseconds since
      *               the epoch (00:00:00 GMT, January 1, 1970)
      *
-     * @return <code>true</code> if and only if the operation succeeded;
-     *          <code>false</code> otherwise
+     * @return {@code true} if and only if the operation succeeded;
+     *          {@code false} otherwise
      *
      * @throws  IllegalArgumentException  If the argument is negative
      *
@@ -1458,8 +1458,8 @@
      * files that are marked read-only. Whether or not a read-only file or
      * directory may be deleted depends upon the underlying system.
      *
-     * @return <code>true</code> if and only if the operation succeeded;
-     *          <code>false</code> otherwise
+     * @return {@code true} if and only if the operation succeeded;
+     *          {@code false} otherwise
      *
      * @throws  SecurityException
      *          If a security manager exists and its {@link
@@ -1490,17 +1490,17 @@
      * manipulation of file permissions is required.
      *
      * @param   writable
-     *          If <code>true</code>, sets the access permission to allow write
-     *          operations; if <code>false</code> to disallow write operations
+     *          If {@code true}, sets the access permission to allow write
+     *          operations; if {@code false} to disallow write operations
      *
      * @param   ownerOnly
-     *          If <code>true</code>, the write permission applies only to the
+     *          If {@code true}, the write permission applies only to the
      *          owner's write permission; otherwise, it applies to everybody.  If
      *          the underlying file system can not distinguish the owner's write
      *          permission from that of others, then the permission will apply to
      *          everybody, regardless of this value.
      *
-     * @return  <code>true</code> if and only if the operation succeeded. The
+     * @return  {@code true} if and only if the operation succeeded. The
      *          operation will fail if the user does not have permission to change
      *          the access permissions of this abstract pathname.
      *
@@ -1536,10 +1536,10 @@
      * }</pre>
      *
      * @param   writable
-     *          If <code>true</code>, sets the access permission to allow write
-     *          operations; if <code>false</code> to disallow write operations
+     *          If {@code true}, sets the access permission to allow write
+     *          operations; if {@code false} to disallow write operations
      *
-     * @return  <code>true</code> if and only if the operation succeeded.  The
+     * @return  {@code true} if and only if the operation succeeded.  The
      *          operation will fail if the user does not have permission to
      *          change the access permissions of this abstract pathname.
      *
@@ -1565,20 +1565,20 @@
      * manipulation of file permissions is required.
      *
      * @param   readable
-     *          If <code>true</code>, sets the access permission to allow read
-     *          operations; if <code>false</code> to disallow read operations
+     *          If {@code true}, sets the access permission to allow read
+     *          operations; if {@code false} to disallow read operations
      *
      * @param   ownerOnly
-     *          If <code>true</code>, the read permission applies only to the
+     *          If {@code true}, the read permission applies only to the
      *          owner's read permission; otherwise, it applies to everybody.  If
      *          the underlying file system can not distinguish the owner's read
      *          permission from that of others, then the permission will apply to
      *          everybody, regardless of this value.
      *
-     * @return  <code>true</code> if and only if the operation succeeded.  The
+     * @return  {@code true} if and only if the operation succeeded.  The
      *          operation will fail if the user does not have permission to
      *          change the access permissions of this abstract pathname.  If
-     *          <code>readable</code> is <code>false</code> and the underlying
+     *          {@code readable} is {@code false} and the underlying
      *          file system does not implement a read permission, then the
      *          operation will fail.
      *
@@ -1614,13 +1614,13 @@
      * }</pre>
      *
      * @param  readable
-     *          If <code>true</code>, sets the access permission to allow read
-     *          operations; if <code>false</code> to disallow read operations
+     *          If {@code true}, sets the access permission to allow read
+     *          operations; if {@code false} to disallow read operations
      *
-     * @return  <code>true</code> if and only if the operation succeeded.  The
+     * @return  {@code true} if and only if the operation succeeded.  The
      *          operation will fail if the user does not have permission to
      *          change the access permissions of this abstract pathname.  If
-     *          <code>readable</code> is <code>false</code> and the underlying
+     *          {@code readable} is {@code false} and the underlying
      *          file system does not implement a read permission, then the
      *          operation will fail.
      *
@@ -1646,20 +1646,20 @@
      * manipulation of file permissions is required.
      *
      * @param   executable
-     *          If <code>true</code>, sets the access permission to allow execute
-     *          operations; if <code>false</code> to disallow execute operations
+     *          If {@code true}, sets the access permission to allow execute
+     *          operations; if {@code false} to disallow execute operations
      *
      * @param   ownerOnly
-     *          If <code>true</code>, the execute permission applies only to the
+     *          If {@code true}, the execute permission applies only to the
      *          owner's execute permission; otherwise, it applies to everybody.
      *          If the underlying file system can not distinguish the owner's
      *          execute permission from that of others, then the permission will
      *          apply to everybody, regardless of this value.
      *
-     * @return  <code>true</code> if and only if the operation succeeded.  The
+     * @return  {@code true} if and only if the operation succeeded.  The
      *          operation will fail if the user does not have permission to
      *          change the access permissions of this abstract pathname.  If
-     *          <code>executable</code> is <code>false</code> and the underlying
+     *          {@code executable} is {@code false} and the underlying
      *          file system does not implement an execute permission, then the
      *          operation will fail.
      *
@@ -1695,13 +1695,13 @@
      * }</pre>
      *
      * @param   executable
-     *          If <code>true</code>, sets the access permission to allow execute
-     *          operations; if <code>false</code> to disallow execute operations
+     *          If {@code true}, sets the access permission to allow execute
+     *          operations; if {@code false} to disallow execute operations
      *
-     * @return   <code>true</code> if and only if the operation succeeded.  The
+     * @return   {@code true} if and only if the operation succeeded.  The
      *           operation will fail if the user does not have permission to
      *           change the access permissions of this abstract pathname.  If
-     *           <code>executable</code> is <code>false</code> and the underlying
+     *           {@code executable} is {@code false} and the underlying
      *           file system does not implement an execute permission, then the
      *           operation will fail.
      *
@@ -1723,7 +1723,7 @@
      * files that are not marked executable. Consequently this method may return
      * {@code true} even though the file does not have execute permissions.
      *
-     * @return  <code>true</code> if and only if the abstract pathname exists
+     * @return  {@code true} if and only if the abstract pathname exists
      *          <em>and</em> the application is allowed to execute the file
      *
      * @throws  SecurityException
@@ -2007,28 +2007,28 @@
      * for a file created by this method to be deleted automatically, use the
      * {@link #deleteOnExit} method.
      *
-     * <p> The <code>prefix</code> argument must be at least three characters
+     * <p> The {@code prefix} argument must be at least three characters
      * long.  It is recommended that the prefix be a short, meaningful string
-     * such as <code>"hjb"</code> or <code>"mail"</code>.  The
-     * <code>suffix</code> argument may be <code>null</code>, in which case the
-     * suffix <code>".tmp"</code> will be used.
+     * such as {@code "hjb"} or {@code "mail"}.  The
+     * {@code suffix} argument may be {@code null}, in which case the
+     * suffix {@code ".tmp"} will be used.
      *
      * <p> To create the new file, the prefix and the suffix may first be
      * adjusted to fit the limitations of the underlying platform.  If the
      * prefix is too long then it will be truncated, but its first three
      * characters will always be preserved.  If the suffix is too long then it
      * too will be truncated, but if it begins with a period character
-     * (<code>'.'</code>) then the period and the first three characters
+     * ({@code '.'}) then the period and the first three characters
      * following it will always be preserved.  Once these adjustments have been
      * made the name of the new file will be generated by concatenating the
      * prefix, five or more internally-generated characters, and the suffix.
      *
-     * <p> If the <code>directory</code> argument is <code>null</code> then the
+     * <p> If the {@code directory} argument is {@code null} then the
      * system-dependent default temporary-file directory will be used.  The
      * default temporary-file directory is specified by the system property
-     * <code>java.io.tmpdir</code>.  On UNIX systems the default value of this
-     * property is typically <code>"/tmp"</code> or <code>"/var/tmp"</code>; on
-     * Microsoft Windows systems it is typically <code>"C:\\WINNT\\TEMP"</code>.  A different
+     * {@code java.io.tmpdir}.  On UNIX systems the default value of this
+     * property is typically {@code "/tmp"} or {@code "/var/tmp"}; on
+     * Microsoft Windows systems it is typically {@code "C:\\WINNT\\TEMP"}.  A different
      * value may be given to this system property when the Java virtual machine
      * is invoked, but programmatic changes to this property are not guaranteed
      * to have any effect upon the temporary directory used by this method.
@@ -2037,17 +2037,17 @@
      *                    name; must be at least three characters long
      *
      * @param  suffix     The suffix string to be used in generating the file's
-     *                    name; may be <code>null</code>, in which case the
-     *                    suffix <code>".tmp"</code> will be used
+     *                    name; may be {@code null}, in which case the
+     *                    suffix {@code ".tmp"} will be used
      *
      * @param  directory  The directory in which the file is to be created, or
-     *                    <code>null</code> if the default temporary-file
+     *                    {@code null} if the default temporary-file
      *                    directory is to be used
      *
      * @return  An abstract pathname denoting a newly-created empty file
      *
      * @throws  IllegalArgumentException
-     *          If the <code>prefix</code> argument contains fewer than three
+     *          If the {@code prefix} argument contains fewer than three
      *          characters
      *
      * @throws  IOException  If a file could not be created
@@ -2113,13 +2113,13 @@
      *                    name; must be at least three characters long
      *
      * @param  suffix     The suffix string to be used in generating the file's
-     *                    name; may be <code>null</code>, in which case the
-     *                    suffix <code>".tmp"</code> will be used
+     *                    name; may be {@code null}, in which case the
+     *                    suffix {@code ".tmp"} will be used
      *
      * @return  An abstract pathname denoting a newly-created empty file
      *
      * @throws  IllegalArgumentException
-     *          If the <code>prefix</code> argument contains fewer than three
+     *          If the {@code prefix} argument contains fewer than three
      *          characters
      *
      * @throws  IOException  If a file could not be created
@@ -2163,8 +2163,8 @@
 
     /**
      * Tests this abstract pathname for equality with the given object.
-     * Returns <code>true</code> if and only if the argument is not
-     * <code>null</code> and is an abstract pathname that denotes the same file
+     * Returns {@code true} if and only if the argument is not
+     * {@code null} and is an abstract pathname that denotes the same file
      * or directory as this abstract pathname.  Whether or not two abstract
      * pathnames are equal depends upon the underlying system.  On UNIX
      * systems, alphabetic case is significant in comparing pathnames; on Microsoft Windows
@@ -2172,8 +2172,8 @@
      *
      * @param   obj   The object to be compared with this abstract pathname
      *
-     * @return  <code>true</code> if and only if the objects are the same;
-     *          <code>false</code> otherwise
+     * @return  {@code true} if and only if the objects are the same;
+     *          {@code false} otherwise
      */
     public boolean equals(Object obj) {
         if ((obj != null) && (obj instanceof File)) {
@@ -2188,10 +2188,10 @@
      * of their hash codes.  On UNIX systems, the hash code of an abstract
      * pathname is equal to the exclusive <em>or</em> of the hash code
      * of its pathname string and the decimal value
-     * <code>1234321</code>.  On Microsoft Windows systems, the hash
+     * {@code 1234321}.  On Microsoft Windows systems, the hash
      * code is equal to the exclusive <em>or</em> of the hash code of
      * its pathname string converted to lower case and the decimal
-     * value <code>1234321</code>.  Locale is not taken into account on
+     * value {@code 1234321}.  Locale is not taken into account on
      * lowercasing the pathname string.
      *
      * @return  A hash code for this abstract pathname
--- a/src/java.base/share/classes/java/io/FileDescriptor.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/FileDescriptor.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -199,7 +199,7 @@
      * be flushed into the FileDescriptor (for example, by invoking
      * OutputStream.flush) before that data will be affected by sync.
      *
-     * @exception SyncFailedException
+     * @throws    SyncFailedException
      *        Thrown when the buffers cannot be flushed,
      *        or because the system cannot guarantee that all the
      *        buffers have been synchronized with physical media.
--- a/src/java.base/share/classes/java/io/FileFilter.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/FileFilter.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,7 @@
      * included in a pathname list.
      *
      * @param  pathname  The abstract pathname to be tested
-     * @return  <code>true</code> if and only if <code>pathname</code>
+     * @return  {@code true} if and only if {@code pathname}
      *          should be included
      */
     boolean accept(File pathname);
--- a/src/java.base/share/classes/java/io/FileInputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/FileInputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,13 +30,13 @@
 
 
 /**
- * A <code>FileInputStream</code> obtains input bytes
+ * A {@code FileInputStream} obtains input bytes
  * from a file in a file system. What files
  * are  available depends on the host environment.
  *
- * <p><code>FileInputStream</code> is meant for reading streams of raw bytes
+ * <p>{@code FileInputStream} is meant for reading streams of raw bytes
  * such as image data. For reading streams of characters, consider using
- * <code>FileReader</code>.
+ * {@code FileReader}.
  *
  * @apiNote
  * To release resources used by this stream {@link #close} should be called
@@ -80,30 +80,30 @@
     private volatile boolean closed;
 
     /**
-     * Creates a <code>FileInputStream</code> by
+     * Creates a {@code FileInputStream} by
      * opening a connection to an actual file,
-     * the file named by the path name <code>name</code>
-     * in the file system.  A new <code>FileDescriptor</code>
+     * the file named by the path name {@code name}
+     * in the file system.  A new {@code FileDescriptor}
      * object is created to represent this file
      * connection.
      * <p>
      * First, if there is a security
-     * manager, its <code>checkRead</code> method
-     * is called with the <code>name</code> argument
+     * manager, its {@code checkRead} method
+     * is called with the {@code name} argument
      * as its argument.
      * <p>
      * If the named file does not exist, is a directory rather than a regular
      * file, or for some other reason cannot be opened for reading then a
-     * <code>FileNotFoundException</code> is thrown.
+     * {@code FileNotFoundException} is thrown.
      *
      * @param      name   the system-dependent file name.
-     * @exception  FileNotFoundException  if the file does not exist,
-     *                   is a directory rather than a regular file,
-     *                   or for some other reason cannot be opened for
-     *                   reading.
-     * @exception  SecurityException      if a security manager exists and its
-     *               <code>checkRead</code> method denies read access
-     *               to the file.
+     * @throws     FileNotFoundException  if the file does not exist,
+     *             is a directory rather than a regular file,
+     *             or for some other reason cannot be opened for
+     *             reading.
+     * @throws     SecurityException      if a security manager exists and its
+     *             {@code checkRead} method denies read access
+     *             to the file.
      * @see        java.lang.SecurityManager#checkRead(java.lang.String)
      */
     public FileInputStream(String name) throws FileNotFoundException {
@@ -111,29 +111,29 @@
     }
 
     /**
-     * Creates a <code>FileInputStream</code> by
+     * Creates a {@code FileInputStream} by
      * opening a connection to an actual file,
-     * the file named by the <code>File</code>
-     * object <code>file</code> in the file system.
-     * A new <code>FileDescriptor</code> object
+     * the file named by the {@code File}
+     * object {@code file} in the file system.
+     * A new {@code FileDescriptor} object
      * is created to represent this file connection.
      * <p>
      * First, if there is a security manager,
-     * its <code>checkRead</code> method  is called
-     * with the path represented by the <code>file</code>
+     * its {@code checkRead} method  is called
+     * with the path represented by the {@code file}
      * argument as its argument.
      * <p>
      * If the named file does not exist, is a directory rather than a regular
      * file, or for some other reason cannot be opened for reading then a
-     * <code>FileNotFoundException</code> is thrown.
+     * {@code FileNotFoundException} is thrown.
      *
      * @param      file   the file to be opened for reading.
-     * @exception  FileNotFoundException  if the file does not exist,
-     *                   is a directory rather than a regular file,
-     *                   or for some other reason cannot be opened for
-     *                   reading.
-     * @exception  SecurityException      if a security manager exists and its
-     *               <code>checkRead</code> method denies read access to the file.
+     * @throws     FileNotFoundException  if the file does not exist,
+     *             is a directory rather than a regular file,
+     *             or for some other reason cannot be opened for
+     *             reading.
+     * @throws     SecurityException      if a security manager exists and its
+     *             {@code checkRead} method denies read access to the file.
      * @see        java.io.File#getPath()
      * @see        java.lang.SecurityManager#checkRead(java.lang.String)
      */
@@ -157,27 +157,27 @@
     }
 
     /**
-     * Creates a <code>FileInputStream</code> by using the file descriptor
-     * <code>fdObj</code>, which represents an existing connection to an
+     * Creates a {@code FileInputStream} by using the file descriptor
+     * {@code fdObj}, which represents an existing connection to an
      * actual file in the file system.
      * <p>
-     * If there is a security manager, its <code>checkRead</code> method is
-     * called with the file descriptor <code>fdObj</code> as its argument to
+     * If there is a security manager, its {@code checkRead} method is
+     * called with the file descriptor {@code fdObj} as its argument to
      * see if it's ok to read the file descriptor. If read access is denied
-     * to the file descriptor a <code>SecurityException</code> is thrown.
+     * to the file descriptor a {@code SecurityException} is thrown.
      * <p>
-     * If <code>fdObj</code> is null then a <code>NullPointerException</code>
+     * If {@code fdObj} is null then a {@code NullPointerException}
      * is thrown.
      * <p>
-     * This constructor does not throw an exception if <code>fdObj</code>
+     * This constructor does not throw an exception if {@code fdObj}
      * is {@link java.io.FileDescriptor#valid() invalid}.
      * However, if the methods are invoked on the resulting stream to attempt
-     * I/O on the stream, an <code>IOException</code> is thrown.
+     * I/O on the stream, an {@code IOException} is thrown.
      *
      * @param      fdObj   the file descriptor to be opened for reading.
      * @throws     SecurityException      if a security manager exists and its
-     *                 <code>checkRead</code> method denies read access to the
-     *                 file descriptor.
+     *             {@code checkRead} method denies read access to the
+     *             file descriptor.
      * @see        SecurityManager#checkRead(java.io.FileDescriptor)
      */
     public FileInputStream(FileDescriptor fdObj) {
@@ -217,9 +217,9 @@
      * Reads a byte of data from this input stream. This method blocks
      * if no input is yet available.
      *
-     * @return     the next byte of data, or <code>-1</code> if the end of the
+     * @return     the next byte of data, or {@code -1} if the end of the
      *             file is reached.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public int read() throws IOException {
         return read0();
@@ -229,59 +229,59 @@
 
     /**
      * Reads a subarray as a sequence of bytes.
-     * @param b the data to be written
-     * @param off the start offset in the data
-     * @param len the number of bytes that are written
-     * @exception IOException If an I/O error has occurred.
+     * @param     b the data to be written
+     * @param     off the start offset in the data
+     * @param     len the number of bytes that are written
+     * @throws    IOException If an I/O error has occurred.
      */
     private native int readBytes(byte b[], int off, int len) throws IOException;
 
     /**
-     * Reads up to <code>b.length</code> bytes of data from this input
+     * Reads up to {@code b.length} bytes of data from this input
      * stream into an array of bytes. This method blocks until some input
      * is available.
      *
      * @param      b   the buffer into which the data is read.
      * @return     the total number of bytes read into the buffer, or
-     *             <code>-1</code> if there is no more data because the end of
+     *             {@code -1} if there is no more data because the end of
      *             the file has been reached.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public int read(byte b[]) throws IOException {
         return readBytes(b, 0, b.length);
     }
 
     /**
-     * Reads up to <code>len</code> bytes of data from this input stream
-     * into an array of bytes. If <code>len</code> is not zero, the method
+     * Reads up to {@code len} bytes of data from this input stream
+     * into an array of bytes. If {@code len} is not zero, the method
      * blocks until some input is available; otherwise, no
-     * bytes are read and <code>0</code> is returned.
+     * bytes are read and {@code 0} is returned.
      *
      * @param      b     the buffer into which the data is read.
-     * @param      off   the start offset in the destination array <code>b</code>
+     * @param      off   the start offset in the destination array {@code b}
      * @param      len   the maximum number of bytes read.
      * @return     the total number of bytes read into the buffer, or
-     *             <code>-1</code> if there is no more data because the end of
+     *             {@code -1} if there is no more data because the end of
      *             the file has been reached.
-     * @exception  NullPointerException If <code>b</code> is <code>null</code>.
-     * @exception  IndexOutOfBoundsException If <code>off</code> is negative,
-     * <code>len</code> is negative, or <code>len</code> is greater than
-     * <code>b.length - off</code>
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     NullPointerException If {@code b} is {@code null}.
+     * @throws     IndexOutOfBoundsException If {@code off} is negative,
+     *             {@code len} is negative, or {@code len} is greater than
+     *             {@code b.length - off}
+     * @throws     IOException  if an I/O error occurs.
      */
     public int read(byte b[], int off, int len) throws IOException {
         return readBytes(b, off, len);
     }
 
     /**
-     * Skips over and discards <code>n</code> bytes of data from the
+     * Skips over and discards {@code n} bytes of data from the
      * input stream.
      *
-     * <p>The <code>skip</code> method may, for a variety of
+     * <p>The {@code skip} method may, for a variety of
      * reasons, end up skipping over some smaller number of bytes,
-     * possibly <code>0</code>. If <code>n</code> is negative, the method
+     * possibly {@code 0}. If {@code n} is negative, the method
      * will try to skip backwards. In case the backing file does not support
-     * backward skip at its current position, an <code>IOException</code> is
+     * backward skip at its current position, an {@code IOException} is
      * thrown. The actual number of bytes skipped is returned. If it skips
      * forwards, it returns a positive value. If it skips backwards, it
      * returns a negative value.
@@ -294,7 +294,7 @@
      *
      * @param      n   the number of bytes to be skipped.
      * @return     the actual number of bytes skipped.
-     * @exception  IOException  if n is negative, if the stream does not
+     * @throws     IOException  if n is negative, if the stream does not
      *             support seek, or if an I/O error occurs.
      */
     public long skip(long n) throws IOException {
@@ -317,7 +317,7 @@
      *
      * @return     an estimate of the number of remaining bytes that can be read
      *             (or skipped over) from this input stream without blocking.
-     * @exception  IOException  if this file input stream has been closed by calling
+     * @throws     IOException  if this file input stream has been closed by calling
      *             {@code close} or an I/O error occurs.
      */
     public int available() throws IOException {
@@ -341,7 +341,7 @@
      * If cleanup of native resources is needed, other mechanisms such as
      * {@linkplain java.lang.ref.Cleaner} should be used.
      *
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      *
      * @revised 1.4
      * @spec JSR-51
@@ -372,13 +372,13 @@
     }
 
     /**
-     * Returns the <code>FileDescriptor</code>
+     * Returns the {@code FileDescriptor}
      * object  that represents the connection to
      * the actual file in the file system being
-     * used by this <code>FileInputStream</code>.
+     * used by this {@code FileInputStream}.
      *
      * @return     the file descriptor object associated with this stream.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.FileDescriptor
      */
     public final FileDescriptor getFD() throws IOException {
--- a/src/java.base/share/classes/java/io/FileNotFoundException.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/FileNotFoundException.java	Tue Sep 24 15:19:35 2019 -0400
@@ -45,19 +45,19 @@
     private static final long serialVersionUID = -897856973823710492L;
 
     /**
-     * Constructs a <code>FileNotFoundException</code> with
-     * <code>null</code> as its error detail message.
+     * Constructs a {@code FileNotFoundException} with
+     * {@code null} as its error detail message.
      */
     public FileNotFoundException() {
         super();
     }
 
     /**
-     * Constructs a <code>FileNotFoundException</code> with the
-     * specified detail message. The string <code>s</code> can be
+     * Constructs a {@code FileNotFoundException} with the
+     * specified detail message. The string {@code s} can be
      * retrieved later by the
      * <code>{@link java.lang.Throwable#getMessage}</code>
-     * method of class <code>java.lang.Throwable</code>.
+     * method of class {@code java.lang.Throwable}.
      *
      * @param   s   the detail message.
      */
@@ -66,9 +66,9 @@
     }
 
     /**
-     * Constructs a <code>FileNotFoundException</code> with a detail message
+     * Constructs a {@code FileNotFoundException} with a detail message
      * consisting of the given pathname string followed by the given reason
-     * string.  If the <code>reason</code> argument is <code>null</code> then
+     * string.  If the {@code reason} argument is {@code null} then
      * it will be omitted.  This private constructor is invoked only by native
      * I/O methods.
      *
--- a/src/java.base/share/classes/java/io/FileOutputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/FileOutputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,16 +33,16 @@
 
 /**
  * A file output stream is an output stream for writing data to a
- * <code>File</code> or to a <code>FileDescriptor</code>. Whether or not
+ * {@code File} or to a {@code FileDescriptor}. Whether or not
  * a file is available or may be created depends upon the underlying
  * platform.  Some platforms, in particular, allow a file to be opened
  * for writing by only one {@code FileOutputStream} (or other
  * file-writing object) at a time.  In such situations the constructors in
  * this class will fail if the file involved is already open.
  *
- * <p><code>FileOutputStream</code> is meant for writing streams of raw bytes
+ * <p>{@code FileOutputStream} is meant for writing streams of raw bytes
  * such as image data. For writing streams of characters, consider using
- * <code>FileWriter</code>.
+ * {@code FileWriter}.
  *
  * @apiNote
  * To release resources used by this stream {@link #close} should be called
@@ -97,26 +97,26 @@
 
     /**
      * Creates a file output stream to write to the file with the
-     * specified name. A new <code>FileDescriptor</code> object is
+     * specified name. A new {@code FileDescriptor} object is
      * created to represent this file connection.
      * <p>
-     * First, if there is a security manager, its <code>checkWrite</code>
-     * method is called with <code>name</code> as its argument.
+     * First, if there is a security manager, its {@code checkWrite}
+     * method is called with {@code name} as its argument.
      * <p>
      * If the file exists but is a directory rather than a regular file, does
      * not exist but cannot be created, or cannot be opened for any other
-     * reason then a <code>FileNotFoundException</code> is thrown.
+     * reason then a {@code FileNotFoundException} is thrown.
      *
      * @implSpec Invoking this constructor with the parameter {@code name} is
      * equivalent to invoking {@link #FileOutputStream(String,boolean)
      * new FileOutputStream(name, false)}.
      *
      * @param      name   the system-dependent filename
-     * @exception  FileNotFoundException  if the file exists but is a directory
+     * @throws     FileNotFoundException  if the file exists but is a directory
      *                   rather than a regular file, does not exist but cannot
      *                   be created, or cannot be opened for any other reason
-     * @exception  SecurityException  if a security manager exists and its
-     *               <code>checkWrite</code> method denies write access
+     * @throws     SecurityException  if a security manager exists and its
+     *               {@code checkWrite} method denies write access
      *               to the file.
      * @see        java.lang.SecurityManager#checkWrite(java.lang.String)
      */
@@ -126,26 +126,26 @@
 
     /**
      * Creates a file output stream to write to the file with the specified
-     * name.  If the second argument is <code>true</code>, then
+     * name.  If the second argument is {@code true}, then
      * bytes will be written to the end of the file rather than the beginning.
-     * A new <code>FileDescriptor</code> object is created to represent this
+     * A new {@code FileDescriptor} object is created to represent this
      * file connection.
      * <p>
-     * First, if there is a security manager, its <code>checkWrite</code>
-     * method is called with <code>name</code> as its argument.
+     * First, if there is a security manager, its {@code checkWrite}
+     * method is called with {@code name} as its argument.
      * <p>
      * If the file exists but is a directory rather than a regular file, does
      * not exist but cannot be created, or cannot be opened for any other
-     * reason then a <code>FileNotFoundException</code> is thrown.
+     * reason then a {@code FileNotFoundException} is thrown.
      *
      * @param     name        the system-dependent file name
-     * @param     append      if <code>true</code>, then bytes will be written
+     * @param     append      if {@code true}, then bytes will be written
      *                   to the end of the file rather than the beginning
-     * @exception  FileNotFoundException  if the file exists but is a directory
+     * @throws     FileNotFoundException  if the file exists but is a directory
      *                   rather than a regular file, does not exist but cannot
      *                   be created, or cannot be opened for any other reason.
-     * @exception  SecurityException  if a security manager exists and its
-     *               <code>checkWrite</code> method denies write access
+     * @throws     SecurityException  if a security manager exists and its
+     *               {@code checkWrite} method denies write access
      *               to the file.
      * @see        java.lang.SecurityManager#checkWrite(java.lang.String)
      * @since     1.1
@@ -158,24 +158,24 @@
 
     /**
      * Creates a file output stream to write to the file represented by
-     * the specified <code>File</code> object. A new
-     * <code>FileDescriptor</code> object is created to represent this
+     * the specified {@code File} object. A new
+     * {@code FileDescriptor} object is created to represent this
      * file connection.
      * <p>
-     * First, if there is a security manager, its <code>checkWrite</code>
-     * method is called with the path represented by the <code>file</code>
+     * First, if there is a security manager, its {@code checkWrite}
+     * method is called with the path represented by the {@code file}
      * argument as its argument.
      * <p>
      * If the file exists but is a directory rather than a regular file, does
      * not exist but cannot be created, or cannot be opened for any other
-     * reason then a <code>FileNotFoundException</code> is thrown.
+     * reason then a {@code FileNotFoundException} is thrown.
      *
      * @param      file               the file to be opened for writing.
-     * @exception  FileNotFoundException  if the file exists but is a directory
+     * @throws     FileNotFoundException  if the file exists but is a directory
      *                   rather than a regular file, does not exist but cannot
      *                   be created, or cannot be opened for any other reason
-     * @exception  SecurityException  if a security manager exists and its
-     *               <code>checkWrite</code> method denies write access
+     * @throws     SecurityException  if a security manager exists and its
+     *               {@code checkWrite} method denies write access
      *               to the file.
      * @see        java.io.File#getPath()
      * @see        java.lang.SecurityException
@@ -187,27 +187,27 @@
 
     /**
      * Creates a file output stream to write to the file represented by
-     * the specified <code>File</code> object. If the second argument is
-     * <code>true</code>, then bytes will be written to the end of the file
-     * rather than the beginning. A new <code>FileDescriptor</code> object is
+     * the specified {@code File} object. If the second argument is
+     * {@code true}, then bytes will be written to the end of the file
+     * rather than the beginning. A new {@code FileDescriptor} object is
      * created to represent this file connection.
      * <p>
-     * First, if there is a security manager, its <code>checkWrite</code>
-     * method is called with the path represented by the <code>file</code>
+     * First, if there is a security manager, its {@code checkWrite}
+     * method is called with the path represented by the {@code file}
      * argument as its argument.
      * <p>
      * If the file exists but is a directory rather than a regular file, does
      * not exist but cannot be created, or cannot be opened for any other
-     * reason then a <code>FileNotFoundException</code> is thrown.
+     * reason then a {@code FileNotFoundException} is thrown.
      *
      * @param      file               the file to be opened for writing.
-     * @param     append      if <code>true</code>, then bytes will be written
+     * @param     append      if {@code true}, then bytes will be written
      *                   to the end of the file rather than the beginning
-     * @exception  FileNotFoundException  if the file exists but is a directory
+     * @throws     FileNotFoundException  if the file exists but is a directory
      *                   rather than a regular file, does not exist but cannot
      *                   be created, or cannot be opened for any other reason
-     * @exception  SecurityException  if a security manager exists and its
-     *               <code>checkWrite</code> method denies write access
+     * @throws     SecurityException  if a security manager exists and its
+     *               {@code checkWrite} method denies write access
      *               to the file.
      * @see        java.io.File#getPath()
      * @see        java.lang.SecurityException
@@ -241,21 +241,21 @@
      * descriptor, which represents an existing connection to an actual
      * file in the file system.
      * <p>
-     * First, if there is a security manager, its <code>checkWrite</code>
-     * method is called with the file descriptor <code>fdObj</code>
+     * First, if there is a security manager, its {@code checkWrite}
+     * method is called with the file descriptor {@code fdObj}
      * argument as its argument.
      * <p>
-     * If <code>fdObj</code> is null then a <code>NullPointerException</code>
+     * If {@code fdObj} is null then a {@code NullPointerException}
      * is thrown.
      * <p>
-     * This constructor does not throw an exception if <code>fdObj</code>
+     * This constructor does not throw an exception if {@code fdObj}
      * is {@link java.io.FileDescriptor#valid() invalid}.
      * However, if the methods are invoked on the resulting stream to attempt
-     * I/O on the stream, an <code>IOException</code> is thrown.
+     * I/O on the stream, an {@code IOException} is thrown.
      *
      * @param      fdObj   the file descriptor to be opened for writing
-     * @exception  SecurityException  if a security manager exists and its
-     *               <code>checkWrite</code> method denies
+     * @throws     SecurityException  if a security manager exists and its
+     *               {@code checkWrite} method denies
      *               write access to the file descriptor
      * @see        java.lang.SecurityManager#checkWrite(java.io.FileDescriptor)
      */
@@ -303,10 +303,10 @@
 
     /**
      * Writes the specified byte to this file output stream. Implements
-     * the <code>write</code> method of <code>OutputStream</code>.
+     * the {@code write} method of {@code OutputStream}.
      *
      * @param      b   the byte to be written.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public void write(int b) throws IOException {
         write(b, fdAccess.getAppend(fd));
@@ -319,30 +319,30 @@
      * @param len the number of bytes that are written
      * @param append {@code true} to first advance the position to the
      *     end of file
-     * @exception IOException If an I/O error has occurred.
+     * @throws    IOException If an I/O error has occurred.
      */
     private native void writeBytes(byte b[], int off, int len, boolean append)
         throws IOException;
 
     /**
-     * Writes <code>b.length</code> bytes from the specified byte array
+     * Writes {@code b.length} bytes from the specified byte array
      * to this file output stream.
      *
      * @param      b   the data.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public void write(byte b[]) throws IOException {
         writeBytes(b, 0, b.length, fdAccess.getAppend(fd));
     }
 
     /**
-     * Writes <code>len</code> bytes from the specified byte array
-     * starting at offset <code>off</code> to this file output stream.
+     * Writes {@code len} bytes from the specified byte array
+     * starting at offset {@code off} to this file output stream.
      *
      * @param      b     the data.
      * @param      off   the start offset in the data.
      * @param      len   the number of bytes to write.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public void write(byte b[], int off, int len) throws IOException {
         writeBytes(b, off, len, fdAccess.getAppend(fd));
@@ -364,7 +364,7 @@
      * If cleanup of native resources is needed, other mechanisms such as
      * {@linkplain java.lang.ref.Cleaner} should be used.
      *
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      *
      * @revised 1.4
      * @spec JSR-51
@@ -397,11 +397,11 @@
     /**
      * Returns the file descriptor associated with this stream.
      *
-     * @return  the <code>FileDescriptor</code> object that represents
+     * @return  the {@code FileDescriptor} object that represents
      *          the connection to the file in the file system being used
-     *          by this <code>FileOutputStream</code> object.
+     *          by this {@code FileOutputStream} object.
      *
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.FileDescriptor
      */
      public final FileDescriptor getFD()  throws IOException {
--- a/src/java.base/share/classes/java/io/FilePermission.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/FilePermission.java	Tue Sep 24 15:19:35 2019 -0400
@@ -46,7 +46,7 @@
  * <P>
  * Pathname is the pathname of the file or directory granted the specified
  * actions. A pathname that ends in "/*" (where "/" is
- * the file separator character, <code>File.separatorChar</code>) indicates
+ * the file separator character, {@code File.separatorChar}) indicates
  * all the files and directories contained in that directory. A pathname
  * that ends with "/-" indicates (recursively) all files
  * and subdirectories contained in that directory. Such a pathname is called
@@ -70,11 +70,11 @@
  *    <DT> read <DD> read permission
  *    <DT> write <DD> write permission
  *    <DT> execute
- *    <DD> execute permission. Allows <code>Runtime.exec</code> to
- *         be called. Corresponds to <code>SecurityManager.checkExec</code>.
+ *    <DD> execute permission. Allows {@code Runtime.exec} to
+ *         be called. Corresponds to {@code SecurityManager.checkExec}.
  *    <DT> delete
- *    <DD> delete permission. Allows <code>File.delete</code> to
- *         be called. Corresponds to <code>SecurityManager.checkDelete</code>.
+ *    <DD> delete permission. Allows {@code File.delete} to
+ *         be called. Corresponds to {@code SecurityManager.checkDelete}.
  *    <DT> readlink
  *    <DD> read link permission. Allows the target of a
  *         <a href="../nio/file/package-summary.html#links">symbolic link</a>
@@ -426,7 +426,7 @@
      * "read", "write", "execute", "delete", and "readlink".
      *
      * <p>A pathname that ends in "/*" (where "/" is
-     * the file separator character, <code>File.separatorChar</code>)
+     * the file separator character, {@code File.separatorChar})
      * indicates all the files and directories contained in that directory.
      * A pathname that ends with "/-" indicates (recursively) all files and
      * subdirectories contained in that directory. The special pathname
@@ -468,7 +468,7 @@
      * @param actions the action string.
      *
      * @throws IllegalArgumentException
-     *          If actions is <code>null</code>, empty or contains an action
+     *          If actions is {@code null}, empty or contains an action
      *          other than the specified possible actions.
      */
     public FilePermission(String path, String actions) {
@@ -481,7 +481,7 @@
      * More efficient than the FilePermission(String, String) constructor.
      * Can be used from within
      * code that needs to create a FilePermission object to pass into the
-     * <code>implies</code> method.
+     * {@code implies} method.
      *
      * @param path the pathname of the file/directory.
      * @param mask the action mask to use.
@@ -547,9 +547,9 @@
      *
      * @param p the permission to check against.
      *
-     * @return <code>true</code> if the specified permission is not
-     *                  <code>null</code> and is implied by this object,
-     *                  <code>false</code> otherwise.
+     * @return {@code true} if the specified permission is not
+     *                  {@code null} and is implied by this object,
+     *                  {@code false} otherwise.
      */
     @Override
     public boolean implies(Permission p) {
@@ -769,9 +769,9 @@
      * for itself, even if they are created using the same invalid path.
      *
      * @param obj the object we are testing for equality with this object.
-     * @return <code>true</code> if obj is a FilePermission, and has the same
+     * @return {@code true} if obj is a FilePermission, and has the same
      *          pathname and actions as this FilePermission object,
-     *          <code>false</code> otherwise.
+     *          {@code false} otherwise.
      */
     @Override
     public boolean equals(Object obj) {
@@ -987,7 +987,7 @@
      * Returns the "canonical string representation" of the actions.
      * That is, this method always returns present actions in the following order:
      * read, write, execute, delete, readlink. For example, if this FilePermission
-     * object allows both write and read actions, a call to <code>getActions</code>
+     * object allows both write and read actions, a call to {@code getActions}
      * will return the string "read,write".
      *
      * @return the canonical string representation of the actions.
@@ -1006,27 +1006,27 @@
      * <p>
      * FilePermission objects must be stored in a manner that allows them
      * to be inserted into the collection in any order, but that also enables the
-     * PermissionCollection <code>implies</code>
+     * PermissionCollection {@code implies}
      * method to be implemented in an efficient (and consistent) manner.
      *
      * <p>For example, if you have two FilePermissions:
      * <OL>
-     * <LI>  <code>"/tmp/-", "read"</code>
-     * <LI>  <code>"/tmp/scratch/foo", "write"</code>
+     * <LI>  {@code "/tmp/-", "read"}
+     * <LI>  {@code "/tmp/scratch/foo", "write"}
      * </OL>
      *
-     * <p>and you are calling the <code>implies</code> method with the FilePermission:
+     * <p>and you are calling the {@code implies} method with the FilePermission:
      *
      * <pre>
      *   "/tmp/scratch/foo", "read,write",
      * </pre>
      *
-     * then the <code>implies</code> function must
+     * then the {@code implies} function must
      * take into account both the "/tmp/-" and "/tmp/scratch/foo"
      * permissions, so the effective permission is "read,write",
-     * and <code>implies</code> returns true. The "implies" semantics for
+     * and {@code implies} returns true. The "implies" semantics for
      * FilePermissions are handled properly by the PermissionCollection object
-     * returned by this <code>newPermissionCollection</code> method.
+     * returned by this {@code newPermissionCollection} method.
      *
      * @return a new PermissionCollection object suitable for storing
      * FilePermissions.
@@ -1127,10 +1127,10 @@
      *
      * @param permission the Permission object to add.
      *
-     * @exception IllegalArgumentException - if the permission is not a
+     * @throws    IllegalArgumentException - if the permission is not a
      *                                       FilePermission
      *
-     * @exception SecurityException - if this FilePermissionCollection object
+     * @throws    SecurityException - if this FilePermissionCollection object
      *                                has been marked readonly
      */
     @Override
--- a/src/java.base/share/classes/java/io/FileReader.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/FileReader.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,11 +50,11 @@
     * using the platform's
     * {@linkplain java.nio.charset.Charset#defaultCharset() default charset}.
     *
-    * @param fileName the name of the file to read
-    * @exception  FileNotFoundException  if the named file does not exist,
-    *                   is a directory rather than a regular file,
-    *                   or for some other reason cannot be opened for
-    *                   reading.
+    * @param      fileName the name of the file to read
+    * @throws     FileNotFoundException  if the named file does not exist,
+    *             is a directory rather than a regular file,
+    *             or for some other reason cannot be opened for
+    *             reading.
     */
     public FileReader(String fileName) throws FileNotFoundException {
         super(new FileInputStream(fileName));
@@ -65,11 +65,11 @@
     * using the platform's
     * {@linkplain java.nio.charset.Charset#defaultCharset() default charset}.
     *
-    * @param file the {@code File} to read
-    * @exception  FileNotFoundException  if the file does not exist,
-    *                   is a directory rather than a regular file,
-    *                   or for some other reason cannot be opened for
-    *                   reading.
+    * @param      file the {@code File} to read
+    * @throws     FileNotFoundException  if the file does not exist,
+    *             is a directory rather than a regular file,
+    *             or for some other reason cannot be opened for
+    *             reading.
     */
     public FileReader(File file) throws FileNotFoundException {
         super(new FileInputStream(file));
@@ -90,12 +90,12 @@
     * Creates a new {@code FileReader}, given the name of the file to read
     * and the {@linkplain java.nio.charset.Charset charset}.
     *
-    * @param fileName the name of the file to read
-    * @param charset the {@linkplain java.nio.charset.Charset charset}
-    * @exception  IOException  if the named file does not exist,
-    *                   is a directory rather than a regular file,
-    *                   or for some other reason cannot be opened for
-    *                   reading.
+    * @param      fileName the name of the file to read
+    * @param      charset the {@linkplain java.nio.charset.Charset charset}
+    * @throws     IOException  if the named file does not exist,
+    *             is a directory rather than a regular file,
+    *             or for some other reason cannot be opened for
+    *             reading.
     *
     * @since 11
     */
@@ -107,12 +107,12 @@
     * Creates a new {@code FileReader}, given the {@code File} to read and
     * the {@linkplain java.nio.charset.Charset charset}.
     *
-    * @param file the {@code File} to read
-    * @param charset the {@linkplain java.nio.charset.Charset charset}
-    * @exception  IOException  if the file does not exist,
-    *                   is a directory rather than a regular file,
-    *                   or for some other reason cannot be opened for
-    *                   reading.
+    * @param      file the {@code File} to read
+    * @param      charset the {@linkplain java.nio.charset.Charset charset}
+    * @throws     IOException  if the file does not exist,
+    *             is a directory rather than a regular file,
+    *             or for some other reason cannot be opened for
+    *             reading.
     *
     * @since 11
     */
--- a/src/java.base/share/classes/java/io/FileSystem.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/FileSystem.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -148,7 +148,7 @@
 
     /**
      * Create a new empty file with the given pathname.  Return
-     * <code>true</code> if the file was created and <code>false</code> if a
+     * {@code true} if the file was created and {@code false} if a
      * file or directory with the given pathname already exists.  Throw an
      * IOException if an I/O error occurs.
      */
@@ -157,40 +157,40 @@
 
     /**
      * Delete the file or directory denoted by the given abstract pathname,
-     * returning <code>true</code> if and only if the operation succeeds.
+     * returning {@code true} if and only if the operation succeeds.
      */
     public abstract boolean delete(File f);
 
     /**
      * List the elements of the directory denoted by the given abstract
      * pathname.  Return an array of strings naming the elements of the
-     * directory if successful; otherwise, return <code>null</code>.
+     * directory if successful; otherwise, return {@code null}.
      */
     public abstract String[] list(File f);
 
     /**
      * Create a new directory denoted by the given abstract pathname,
-     * returning <code>true</code> if and only if the operation succeeds.
+     * returning {@code true} if and only if the operation succeeds.
      */
     public abstract boolean createDirectory(File f);
 
     /**
      * Rename the file or directory denoted by the first abstract pathname to
-     * the second abstract pathname, returning <code>true</code> if and only if
+     * the second abstract pathname, returning {@code true} if and only if
      * the operation succeeds.
      */
     public abstract boolean rename(File f1, File f2);
 
     /**
      * Set the last-modified time of the file or directory denoted by the
-     * given abstract pathname, returning <code>true</code> if and only if the
+     * given abstract pathname, returning {@code true} if and only if the
      * operation succeeds.
      */
     public abstract boolean setLastModifiedTime(File f, long time);
 
     /**
      * Mark the file or directory denoted by the given abstract pathname as
-     * read-only, returning <code>true</code> if and only if the operation
+     * read-only, returning {@code true} if and only if the operation
      * succeeds.
      */
     public abstract boolean setReadOnly(File f);
--- a/src/java.base/share/classes/java/io/FilenameFilter.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/FilenameFilter.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +28,8 @@
 /**
  * Instances of classes that implement this interface are used to
  * filter filenames. These instances are used to filter directory
- * listings in the <code>list</code> method of class
- * <code>File</code>, and by the Abstract Window Toolkit's file
+ * listings in the {@code list} method of class
+ * {@code File}, and by the Abstract Window Toolkit's file
  * dialog component.
  *
  * @author  Arthur van Hoff
@@ -46,8 +46,8 @@
      *
      * @param   dir    the directory in which the file was found.
      * @param   name   the name of the file.
-     * @return  <code>true</code> if and only if the name should be
-     * included in the file list; <code>false</code> otherwise.
+     * @return  {@code true} if and only if the name should be
+     * included in the file list; {@code false} otherwise.
      */
     boolean accept(File dir, String name);
 }
--- a/src/java.base/share/classes/java/io/FilterInputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/FilterInputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,15 +26,15 @@
 package java.io;
 
 /**
- * A <code>FilterInputStream</code> contains
+ * A {@code FilterInputStream} contains
  * some other input stream, which it uses as
  * its  basic source of data, possibly transforming
  * the data along the way or providing  additional
- * functionality. The class <code>FilterInputStream</code>
+ * functionality. The class {@code FilterInputStream}
  * itself simply overrides all  methods of
- * <code>InputStream</code> with versions that
+ * {@code InputStream} with versions that
  * pass all requests to the contained  input
- * stream. Subclasses of <code>FilterInputStream</code>
+ * stream. Subclasses of {@code FilterInputStream}
  * may further override some of  these methods
  * and may also provide additional methods
  * and fields.
@@ -50,12 +50,12 @@
     protected volatile InputStream in;
 
     /**
-     * Creates a <code>FilterInputStream</code>
-     * by assigning the  argument <code>in</code>
-     * to the field <code>this.in</code> so as
+     * Creates a {@code FilterInputStream}
+     * by assigning the  argument {@code in}
+     * to the field {@code this.in} so as
      * to remember it for later use.
      *
-     * @param   in   the underlying input stream, or <code>null</code> if
+     * @param   in   the underlying input stream, or {@code null} if
      *          this instance is to be created without an underlying stream.
      */
     protected FilterInputStream(InputStream in) {
@@ -64,19 +64,19 @@
 
     /**
      * Reads the next byte of data from this input stream. The value
-     * byte is returned as an <code>int</code> in the range
-     * <code>0</code> to <code>255</code>. If no byte is available
+     * byte is returned as an {@code int} in the range
+     * {@code 0} to {@code 255}. If no byte is available
      * because the end of the stream has been reached, the value
-     * <code>-1</code> is returned. This method blocks until input data
+     * {@code -1} is returned. This method blocks until input data
      * is available, the end of the stream is detected, or an exception
      * is thrown.
      * <p>
      * This method
-     * simply performs <code>in.read()</code> and returns the result.
+     * simply performs {@code in.read()} and returns the result.
      *
-     * @return     the next byte of data, or <code>-1</code> if the end of the
+     * @return     the next byte of data, or {@code -1} if the end of the
      *             stream is reached.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.FilterInputStream#in
      */
     public int read() throws IOException {
@@ -84,23 +84,23 @@
     }
 
     /**
-     * Reads up to <code>b.length</code> bytes of data from this
+     * Reads up to {@code b.length} bytes of data from this
      * input stream into an array of bytes. This method blocks until some
      * input is available.
      * <p>
      * This method simply performs the call
-     * <code>read(b, 0, b.length)</code> and returns
+     * {@code read(b, 0, b.length)} and returns
      * the  result. It is important that it does
-     * <i>not</i> do <code>in.read(b)</code> instead;
-     * certain subclasses of  <code>FilterInputStream</code>
+     * <i>not</i> do {@code in.read(b)} instead;
+     * certain subclasses of  {@code FilterInputStream}
      * depend on the implementation strategy actually
      * used.
      *
      * @param      b   the buffer into which the data is read.
      * @return     the total number of bytes read into the buffer, or
-     *             <code>-1</code> if there is no more data because the end of
+     *             {@code -1} if there is no more data because the end of
      *             the stream has been reached.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.FilterInputStream#read(byte[], int, int)
      */
     public int read(byte b[]) throws IOException {
@@ -108,25 +108,25 @@
     }
 
     /**
-     * Reads up to <code>len</code> bytes of data from this input stream
-     * into an array of bytes. If <code>len</code> is not zero, the method
+     * Reads up to {@code len} bytes of data from this input stream
+     * into an array of bytes. If {@code len} is not zero, the method
      * blocks until some input is available; otherwise, no
-     * bytes are read and <code>0</code> is returned.
+     * bytes are read and {@code 0} is returned.
      * <p>
-     * This method simply performs <code>in.read(b, off, len)</code>
+     * This method simply performs {@code in.read(b, off, len)}
      * and returns the result.
      *
      * @param      b     the buffer into which the data is read.
-     * @param      off   the start offset in the destination array <code>b</code>
+     * @param      off   the start offset in the destination array {@code b}
      * @param      len   the maximum number of bytes read.
      * @return     the total number of bytes read into the buffer, or
-     *             <code>-1</code> if there is no more data because the end of
+     *             {@code -1} if there is no more data because the end of
      *             the stream has been reached.
-     * @exception  NullPointerException If <code>b</code> is <code>null</code>.
-     * @exception  IndexOutOfBoundsException If <code>off</code> is negative,
-     * <code>len</code> is negative, or <code>len</code> is greater than
-     * <code>b.length - off</code>
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     NullPointerException If {@code b} is {@code null}.
+     * @throws     IndexOutOfBoundsException If {@code off} is negative,
+     *             {@code len} is negative, or {@code len} is greater than
+     *             {@code b.length - off}
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.FilterInputStream#in
      */
     public int read(byte b[], int off, int len) throws IOException {
@@ -134,13 +134,13 @@
     }
 
     /**
-     * Skips over and discards <code>n</code> bytes of data from the
-     * input stream. The <code>skip</code> method may, for a variety of
+     * Skips over and discards {@code n} bytes of data from the
+     * input stream. The {@code skip} method may, for a variety of
      * reasons, end up skipping over some smaller number of bytes,
-     * possibly <code>0</code>. The actual number of bytes skipped is
+     * possibly {@code 0}. The actual number of bytes skipped is
      * returned.
      * <p>
-     * This method simply performs <code>in.skip(n)</code>.
+     * This method simply performs {@code in.skip(n)}.
      *
      * @param      n   the number of bytes to be skipped.
      * @return     the actual number of bytes skipped.
@@ -161,7 +161,7 @@
      *
      * @return     an estimate of the number of bytes that can be read (or skipped
      *             over) from this input stream without blocking.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public int available() throws IOException {
         return in.available();
@@ -171,9 +171,9 @@
      * Closes this input stream and releases any system resources
      * associated with the stream.
      * This
-     * method simply performs <code>in.close()</code>.
+     * method simply performs {@code in.close()}.
      *
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.FilterInputStream#in
      */
     public void close() throws IOException {
@@ -182,14 +182,14 @@
 
     /**
      * Marks the current position in this input stream. A subsequent
-     * call to the <code>reset</code> method repositions this stream at
+     * call to the {@code reset} method repositions this stream at
      * the last marked position so that subsequent reads re-read the same bytes.
      * <p>
-     * The <code>readlimit</code> argument tells this input stream to
+     * The {@code readlimit} argument tells this input stream to
      * allow that many bytes to be read before the mark position gets
      * invalidated.
      * <p>
-     * This method simply performs <code>in.mark(readlimit)</code>.
+     * This method simply performs {@code in.mark(readlimit)}.
      *
      * @param   readlimit   the maximum limit of bytes that can be read before
      *                      the mark position becomes invalid.
@@ -202,10 +202,10 @@
 
     /**
      * Repositions this stream to the position at the time the
-     * <code>mark</code> method was last called on this input stream.
+     * {@code mark} method was last called on this input stream.
      * <p>
      * This method
-     * simply performs <code>in.reset()</code>.
+     * simply performs {@code in.reset()}.
      * <p>
      * Stream marks are intended to be used in
      * situations where you need to read ahead a little to see what's in
@@ -216,7 +216,7 @@
      * If this happens within readlimit bytes, it allows the outer
      * code to reset the stream and try another parser.
      *
-     * @exception  IOException  if the stream has not been marked or if the
+     * @throws     IOException  if the stream has not been marked or if the
      *               mark has been invalidated.
      * @see        java.io.FilterInputStream#in
      * @see        java.io.FilterInputStream#mark(int)
@@ -226,14 +226,14 @@
     }
 
     /**
-     * Tests if this input stream supports the <code>mark</code>
-     * and <code>reset</code> methods.
+     * Tests if this input stream supports the {@code mark}
+     * and {@code reset} methods.
      * This method
-     * simply performs <code>in.markSupported()</code>.
+     * simply performs {@code in.markSupported()}.
      *
-     * @return  <code>true</code> if this stream type supports the
-     *          <code>mark</code> and <code>reset</code> method;
-     *          <code>false</code> otherwise.
+     * @return  {@code true} if this stream type supports the
+     *          {@code mark} and {@code reset} method;
+     *          {@code false} otherwise.
      * @see     java.io.FilterInputStream#in
      * @see     java.io.InputStream#mark(int)
      * @see     java.io.InputStream#reset()
--- a/src/java.base/share/classes/java/io/FilterOutputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/FilterOutputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,10 @@
  * basic sink of data, but possibly transforming the data along the
  * way or providing additional functionality.
  * <p>
- * The class <code>FilterOutputStream</code> itself simply overrides
- * all methods of <code>OutputStream</code> with versions that pass
+ * The class {@code FilterOutputStream} itself simply overrides
+ * all methods of {@code OutputStream} with versions that pass
  * all requests to the underlying output stream. Subclasses of
- * <code>FilterOutputStream</code> may further override some of these
+ * {@code FilterOutputStream} may further override some of these
  * methods as well as provide additional methods and fields.
  *
  * @author  Jonathan Payne
@@ -63,7 +63,7 @@
      *
      * @param   out   the underlying output stream to be assigned to
      *                the field {@code this.out} for later use, or
-     *                <code>null</code> if this instance is to be
+     *                {@code null} if this instance is to be
      *                created without an underlying stream.
      */
     public FilterOutputStream(OutputStream out) {
@@ -71,16 +71,16 @@
     }
 
     /**
-     * Writes the specified <code>byte</code> to this output stream.
+     * Writes the specified {@code byte} to this output stream.
      * <p>
-     * The <code>write</code> method of <code>FilterOutputStream</code>
-     * calls the <code>write</code> method of its underlying output stream,
+     * The {@code write} method of {@code FilterOutputStream}
+     * calls the {@code write} method of its underlying output stream,
      * that is, it performs {@code out.write(b)}.
      * <p>
      * Implements the abstract {@code write} method of {@code OutputStream}.
      *
-     * @param      b   the <code>byte</code>.
-     * @exception  IOException  if an I/O error occurs.
+     * @param      b   the {@code byte}.
+     * @throws     IOException  if an I/O error occurs.
      */
     @Override
     public void write(int b) throws IOException {
@@ -88,19 +88,19 @@
     }
 
     /**
-     * Writes <code>b.length</code> bytes to this output stream.
+     * Writes {@code b.length} bytes to this output stream.
      * <p>
-     * The <code>write</code> method of <code>FilterOutputStream</code>
-     * calls its <code>write</code> method of three arguments with the
-     * arguments <code>b</code>, <code>0</code>, and
-     * <code>b.length</code>.
+     * The {@code write} method of {@code FilterOutputStream}
+     * calls its {@code write} method of three arguments with the
+     * arguments {@code b}, {@code 0}, and
+     * {@code b.length}.
      * <p>
      * Note that this method does not call the one-argument
-     * <code>write</code> method of its underlying output stream with
-     * the single argument <code>b</code>.
+     * {@code write} method of its underlying output stream with
+     * the single argument {@code b}.
      *
      * @param      b   the data to be written.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.FilterOutputStream#write(byte[], int, int)
      */
     @Override
@@ -109,23 +109,23 @@
     }
 
     /**
-     * Writes <code>len</code> bytes from the specified
-     * <code>byte</code> array starting at offset <code>off</code> to
+     * Writes {@code len} bytes from the specified
+     * {@code byte} array starting at offset {@code off} to
      * this output stream.
      * <p>
-     * The <code>write</code> method of <code>FilterOutputStream</code>
-     * calls the <code>write</code> method of one argument on each
-     * <code>byte</code> to output.
+     * The {@code write} method of {@code FilterOutputStream}
+     * calls the {@code write} method of one argument on each
+     * {@code byte} to output.
      * <p>
-     * Note that this method does not call the <code>write</code> method
+     * Note that this method does not call the {@code write} method
      * of its underlying output stream with the same arguments. Subclasses
-     * of <code>FilterOutputStream</code> should provide a more efficient
+     * of {@code FilterOutputStream} should provide a more efficient
      * implementation of this method.
      *
      * @param      b     the data.
      * @param      off   the start offset in the data.
      * @param      len   the number of bytes to write.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.FilterOutputStream#write(int)
      */
     @Override
@@ -142,10 +142,10 @@
      * Flushes this output stream and forces any buffered output bytes
      * to be written out to the stream.
      * <p>
-     * The <code>flush</code> method of <code>FilterOutputStream</code>
-     * calls the <code>flush</code> method of its underlying output stream.
+     * The {@code flush} method of {@code FilterOutputStream}
+     * calls the {@code flush} method of its underlying output stream.
      *
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.FilterOutputStream#out
      */
     @Override
@@ -161,7 +161,7 @@
      * FilterOutputStream} calls its {@code flush} method, and then
      * calls the {@code close} method of its underlying output stream.
      *
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.FilterOutputStream#flush()
      * @see        java.io.FilterOutputStream#out
      */
--- a/src/java.base/share/classes/java/io/FilterReader.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/FilterReader.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,9 +28,9 @@
 
 /**
  * Abstract class for reading filtered character streams.
- * The abstract class <code>FilterReader</code> itself
+ * The abstract class {@code FilterReader} itself
  * provides default methods that pass all requests to
- * the contained stream. Subclasses of <code>FilterReader</code>
+ * the contained stream. Subclasses of {@code FilterReader}
  * should override some of these methods and may also provide
  * additional methods and fields.
  *
@@ -49,7 +49,7 @@
      * Creates a new filtered reader.
      *
      * @param in  a Reader object providing the underlying stream.
-     * @throws NullPointerException if <code>in</code> is <code>null</code>
+     * @throws NullPointerException if {@code in} is {@code null}
      */
     protected FilterReader(Reader in) {
         super(in);
@@ -59,7 +59,7 @@
     /**
      * Reads a single character.
      *
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IOException  If an I/O error occurs
      */
     public int read() throws IOException {
         return in.read();
@@ -68,8 +68,8 @@
     /**
      * Reads characters into a portion of an array.
      *
-     * @exception  IOException  If an I/O error occurs
-     * @exception  IndexOutOfBoundsException {@inheritDoc}
+     * @throws     IOException  If an I/O error occurs
+     * @throws     IndexOutOfBoundsException {@inheritDoc}
      */
     public int read(char cbuf[], int off, int len) throws IOException {
         return in.read(cbuf, off, len);
@@ -78,7 +78,7 @@
     /**
      * Skips characters.
      *
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IOException  If an I/O error occurs
      */
     public long skip(long n) throws IOException {
         return in.skip(n);
@@ -87,7 +87,7 @@
     /**
      * Tells whether this stream is ready to be read.
      *
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IOException  If an I/O error occurs
      */
     public boolean ready() throws IOException {
         return in.ready();
@@ -103,7 +103,7 @@
     /**
      * Marks the present position in the stream.
      *
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IOException  If an I/O error occurs
      */
     public void mark(int readAheadLimit) throws IOException {
         in.mark(readAheadLimit);
@@ -112,7 +112,7 @@
     /**
      * Resets the stream.
      *
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IOException  If an I/O error occurs
      */
     public void reset() throws IOException {
         in.reset();
--- a/src/java.base/share/classes/java/io/FilterWriter.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/FilterWriter.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,9 +28,9 @@
 
 /**
  * Abstract class for writing filtered character streams.
- * The abstract class <code>FilterWriter</code> itself
+ * The abstract class {@code FilterWriter} itself
  * provides default methods that pass all requests to the
- * contained stream. Subclasses of <code>FilterWriter</code>
+ * contained stream. Subclasses of {@code FilterWriter}
  * should override some of these methods and may also
  * provide additional methods and fields.
  *
@@ -49,7 +49,7 @@
      * Create a new filtered writer.
      *
      * @param out  a Writer object to provide the underlying stream.
-     * @throws NullPointerException if <code>out</code> is <code>null</code>
+     * @throws NullPointerException if {@code out} is {@code null}
      */
     protected FilterWriter(Writer out) {
         super(out);
@@ -59,7 +59,7 @@
     /**
      * Writes a single character.
      *
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IOException  If an I/O error occurs
      */
     public void write(int c) throws IOException {
         out.write(c);
@@ -104,7 +104,7 @@
     /**
      * Flushes the stream.
      *
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IOException  If an I/O error occurs
      */
     public void flush() throws IOException {
         out.flush();
--- a/src/java.base/share/classes/java/io/InputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/InputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -34,7 +34,7 @@
  * This abstract class is the superclass of all classes representing
  * an input stream of bytes.
  *
- * <p> Applications that need to define a subclass of <code>InputStream</code>
+ * <p> Applications that need to define a subclass of {@code InputStream}
  * must always provide a method that returns the next byte of input.
  *
  * @author  Arthur van Hoff
@@ -167,51 +167,51 @@
 
     /**
      * Reads the next byte of data from the input stream. The value byte is
-     * returned as an <code>int</code> in the range <code>0</code> to
-     * <code>255</code>. If no byte is available because the end of the stream
-     * has been reached, the value <code>-1</code> is returned. This method
+     * returned as an {@code int} in the range {@code 0} to
+     * {@code 255}. If no byte is available because the end of the stream
+     * has been reached, the value {@code -1} is returned. This method
      * blocks until input data is available, the end of the stream is detected,
      * or an exception is thrown.
      *
      * <p> A subclass must provide an implementation of this method.
      *
-     * @return     the next byte of data, or <code>-1</code> if the end of the
+     * @return     the next byte of data, or {@code -1} if the end of the
      *             stream is reached.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public abstract int read() throws IOException;
 
     /**
      * Reads some number of bytes from the input stream and stores them into
-     * the buffer array <code>b</code>. The number of bytes actually read is
+     * the buffer array {@code b}. The number of bytes actually read is
      * returned as an integer.  This method blocks until input data is
      * available, end of file is detected, or an exception is thrown.
      *
-     * <p> If the length of <code>b</code> is zero, then no bytes are read and
-     * <code>0</code> is returned; otherwise, there is an attempt to read at
+     * <p> If the length of {@code b} is zero, then no bytes are read and
+     * {@code 0} is returned; otherwise, there is an attempt to read at
      * least one byte. If no byte is available because the stream is at the
-     * end of the file, the value <code>-1</code> is returned; otherwise, at
-     * least one byte is read and stored into <code>b</code>.
+     * end of the file, the value {@code -1} is returned; otherwise, at
+     * least one byte is read and stored into {@code b}.
      *
-     * <p> The first byte read is stored into element <code>b[0]</code>, the
-     * next one into <code>b[1]</code>, and so on. The number of bytes read is,
-     * at most, equal to the length of <code>b</code>. Let <i>k</i> be the
+     * <p> The first byte read is stored into element {@code b[0]}, the
+     * next one into {@code b[1]}, and so on. The number of bytes read is,
+     * at most, equal to the length of {@code b}. Let <i>k</i> be the
      * number of bytes actually read; these bytes will be stored in elements
-     * <code>b[0]</code> through <code>b[</code><i>k</i><code>-1]</code>,
-     * leaving elements <code>b[</code><i>k</i><code>]</code> through
-     * <code>b[b.length-1]</code> unaffected.
+     * {@code b[0]} through {@code b[}<i>k</i>{@code -1]},
+     * leaving elements {@code b[}<i>k</i>{@code ]} through
+     * {@code b[b.length-1]} unaffected.
      *
-     * <p> The <code>read(b)</code> method for class <code>InputStream</code>
-     * has the same effect as: <pre><code> read(b, 0, b.length) </code></pre>
+     * <p> The {@code read(b)} method for class {@code InputStream}
+     * has the same effect as: <pre>{@code  read(b, 0, b.length) }</pre>
      *
      * @param      b   the buffer into which the data is read.
      * @return     the total number of bytes read into the buffer, or
-     *             <code>-1</code> if there is no more data because the end of
+     *             {@code -1} if there is no more data because the end of
      *             the stream has been reached.
-     * @exception  IOException  If the first byte cannot be read for any reason
-     * other than the end of the file, if the input stream has been closed, or
-     * if some other I/O error occurs.
-     * @exception  NullPointerException  if <code>b</code> is <code>null</code>.
+     * @throws     IOException  If the first byte cannot be read for any reason
+     *             other than the end of the file, if the input stream has been
+     *             closed, or if some other I/O error occurs.
+     * @throws     NullPointerException  if {@code b} is {@code null}.
      * @see        java.io.InputStream#read(byte[], int, int)
      */
     public int read(byte b[]) throws IOException {
@@ -219,60 +219,60 @@
     }
 
     /**
-     * Reads up to <code>len</code> bytes of data from the input stream into
+     * Reads up to {@code len} bytes of data from the input stream into
      * an array of bytes.  An attempt is made to read as many as
-     * <code>len</code> bytes, but a smaller number may be read.
+     * {@code len} bytes, but a smaller number may be read.
      * The number of bytes actually read is returned as an integer.
      *
      * <p> This method blocks until input data is available, end of file is
      * detected, or an exception is thrown.
      *
-     * <p> If <code>len</code> is zero, then no bytes are read and
-     * <code>0</code> is returned; otherwise, there is an attempt to read at
+     * <p> If {@code len} is zero, then no bytes are read and
+     * {@code 0} is returned; otherwise, there is an attempt to read at
      * least one byte. If no byte is available because the stream is at end of
-     * file, the value <code>-1</code> is returned; otherwise, at least one
-     * byte is read and stored into <code>b</code>.
+     * file, the value {@code -1} is returned; otherwise, at least one
+     * byte is read and stored into {@code b}.
      *
-     * <p> The first byte read is stored into element <code>b[off]</code>, the
-     * next one into <code>b[off+1]</code>, and so on. The number of bytes read
-     * is, at most, equal to <code>len</code>. Let <i>k</i> be the number of
+     * <p> The first byte read is stored into element {@code b[off]}, the
+     * next one into {@code b[off+1]}, and so on. The number of bytes read
+     * is, at most, equal to {@code len}. Let <i>k</i> be the number of
      * bytes actually read; these bytes will be stored in elements
-     * <code>b[off]</code> through <code>b[off+</code><i>k</i><code>-1]</code>,
-     * leaving elements <code>b[off+</code><i>k</i><code>]</code> through
-     * <code>b[off+len-1]</code> unaffected.
+     * {@code b[off]} through {@code b[off+}<i>k</i>{@code -1]},
+     * leaving elements {@code b[off+}<i>k</i>{@code ]} through
+     * {@code b[off+len-1]} unaffected.
      *
-     * <p> In every case, elements <code>b[0]</code> through
-     * <code>b[off-1]</code> and elements <code>b[off+len]</code> through
-     * <code>b[b.length-1]</code> are unaffected.
+     * <p> In every case, elements {@code b[0]} through
+     * {@code b[off-1]} and elements {@code b[off+len]} through
+     * {@code b[b.length-1]} are unaffected.
      *
-     * <p> The <code>read(b,</code> <code>off,</code> <code>len)</code> method
-     * for class <code>InputStream</code> simply calls the method
-     * <code>read()</code> repeatedly. If the first such call results in an
-     * <code>IOException</code>, that exception is returned from the call to
-     * the <code>read(b,</code> <code>off,</code> <code>len)</code> method.  If
-     * any subsequent call to <code>read()</code> results in a
-     * <code>IOException</code>, the exception is caught and treated as if it
+     * <p> The {@code read(b, off, len)} method
+     * for class {@code InputStream} simply calls the method
+     * {@code read()} repeatedly. If the first such call results in an
+     * {@code IOException}, that exception is returned from the call to
+     * the {@code read(b,} {@code off,} {@code len)} method.  If
+     * any subsequent call to {@code read()} results in a
+     * {@code IOException}, the exception is caught and treated as if it
      * were end of file; the bytes read up to that point are stored into
-     * <code>b</code> and the number of bytes read before the exception
+     * {@code b} and the number of bytes read before the exception
      * occurred is returned. The default implementation of this method blocks
-     * until the requested amount of input data <code>len</code> has been read,
+     * until the requested amount of input data {@code len} has been read,
      * end of file is detected, or an exception is thrown. Subclasses are
      * encouraged to provide a more efficient implementation of this method.
      *
      * @param      b     the buffer into which the data is read.
-     * @param      off   the start offset in array <code>b</code>
+     * @param      off   the start offset in array {@code b}
      *                   at which the data is written.
      * @param      len   the maximum number of bytes to read.
      * @return     the total number of bytes read into the buffer, or
-     *             <code>-1</code> if there is no more data because the end of
+     *             {@code -1} if there is no more data because the end of
      *             the stream has been reached.
-     * @exception  IOException If the first byte cannot be read for any reason
-     * other than end of file, or if the input stream has been closed, or if
-     * some other I/O error occurs.
-     * @exception  NullPointerException If <code>b</code> is <code>null</code>.
-     * @exception  IndexOutOfBoundsException If <code>off</code> is negative,
-     * <code>len</code> is negative, or <code>len</code> is greater than
-     * <code>b.length - off</code>
+     * @throws     IOException If the first byte cannot be read for any reason
+     *             other than end of file, or if the input stream has been closed,
+     *             or if some other I/O error occurs.
+     * @throws     NullPointerException If {@code b} is {@code null}.
+     * @throws     IndexOutOfBoundsException If {@code off} is negative,
+     *             {@code len} is negative, or {@code len} is greater than
+     *             {@code b.length - off}
      * @see        java.io.InputStream#read()
      */
     public int read(byte b[], int off, int len) throws IOException {
@@ -509,18 +509,18 @@
     }
 
     /**
-     * Skips over and discards <code>n</code> bytes of data from this input
-     * stream. The <code>skip</code> method may, for a variety of reasons, end
-     * up skipping over some smaller number of bytes, possibly <code>0</code>.
+     * Skips over and discards {@code n} bytes of data from this input
+     * stream. The {@code skip} method may, for a variety of reasons, end
+     * up skipping over some smaller number of bytes, possibly {@code 0}.
      * This may result from any of a number of conditions; reaching end of file
-     * before <code>n</code> bytes have been skipped is only one possibility.
+     * before {@code n} bytes have been skipped is only one possibility.
      * The actual number of bytes skipped is returned. If {@code n} is
      * negative, the {@code skip} method for class {@code InputStream} always
      * returns 0, and no bytes are skipped. Subclasses may handle the negative
      * value differently.
      *
-     * <p> The <code>skip</code> method implementation of this class creates a
-     * byte array and then repeatedly reads into it until <code>n</code> bytes
+     * <p> The {@code skip} method implementation of this class creates a
+     * byte array and then repeatedly reads into it until {@code n} bytes
      * have been read or the end of the stream has been reached. Subclasses are
      * encouraged to provide a more efficient implementation of this method.
      * For instance, the implementation may depend on the ability to seek.
@@ -634,7 +634,7 @@
      * @return     an estimate of the number of bytes that can be read (or
      *             skipped over) from this input stream without blocking or
      *             {@code 0} when it reaches the end of the input stream.
-     * @exception  IOException if an I/O error occurs.
+     * @throws     IOException if an I/O error occurs.
      */
     public int available() throws IOException {
         return 0;
@@ -644,33 +644,33 @@
      * Closes this input stream and releases any system resources associated
      * with the stream.
      *
-     * <p> The <code>close</code> method of <code>InputStream</code> does
+     * <p> The {@code close} method of {@code InputStream} does
      * nothing.
      *
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public void close() throws IOException {}
 
     /**
      * Marks the current position in this input stream. A subsequent call to
-     * the <code>reset</code> method repositions this stream at the last marked
+     * the {@code reset} method repositions this stream at the last marked
      * position so that subsequent reads re-read the same bytes.
      *
-     * <p> The <code>readlimit</code> arguments tells this input stream to
+     * <p> The {@code readlimit} arguments tells this input stream to
      * allow that many bytes to be read before the mark position gets
      * invalidated.
      *
-     * <p> The general contract of <code>mark</code> is that, if the method
-     * <code>markSupported</code> returns <code>true</code>, the stream somehow
-     * remembers all the bytes read after the call to <code>mark</code> and
+     * <p> The general contract of {@code mark} is that, if the method
+     * {@code markSupported} returns {@code true}, the stream somehow
+     * remembers all the bytes read after the call to {@code mark} and
      * stands ready to supply those same bytes again if and whenever the method
-     * <code>reset</code> is called.  However, the stream is not required to
-     * remember any data at all if more than <code>readlimit</code> bytes are
-     * read from the stream before <code>reset</code> is called.
+     * {@code reset} is called.  However, the stream is not required to
+     * remember any data at all if more than {@code readlimit} bytes are
+     * read from the stream before {@code reset} is called.
      *
      * <p> Marking a closed stream should not have any effect on the stream.
      *
-     * <p> The <code>mark</code> method of <code>InputStream</code> does
+     * <p> The {@code mark} method of {@code InputStream} does
      * nothing.
      *
      * @param   readlimit   the maximum limit of bytes that can be read before
@@ -681,45 +681,45 @@
 
     /**
      * Repositions this stream to the position at the time the
-     * <code>mark</code> method was last called on this input stream.
+     * {@code mark} method was last called on this input stream.
      *
-     * <p> The general contract of <code>reset</code> is:
+     * <p> The general contract of {@code reset} is:
      *
      * <ul>
-     * <li> If the method <code>markSupported</code> returns
-     * <code>true</code>, then:
+     * <li> If the method {@code markSupported} returns
+     * {@code true}, then:
      *
-     *     <ul><li> If the method <code>mark</code> has not been called since
+     *     <ul><li> If the method {@code mark} has not been called since
      *     the stream was created, or the number of bytes read from the stream
-     *     since <code>mark</code> was last called is larger than the argument
-     *     to <code>mark</code> at that last call, then an
-     *     <code>IOException</code> might be thrown.
+     *     since {@code mark} was last called is larger than the argument
+     *     to {@code mark} at that last call, then an
+     *     {@code IOException} might be thrown.
      *
-     *     <li> If such an <code>IOException</code> is not thrown, then the
+     *     <li> If such an {@code IOException} is not thrown, then the
      *     stream is reset to a state such that all the bytes read since the
-     *     most recent call to <code>mark</code> (or since the start of the
-     *     file, if <code>mark</code> has not been called) will be resupplied
-     *     to subsequent callers of the <code>read</code> method, followed by
+     *     most recent call to {@code mark} (or since the start of the
+     *     file, if {@code mark} has not been called) will be resupplied
+     *     to subsequent callers of the {@code read} method, followed by
      *     any bytes that otherwise would have been the next input data as of
-     *     the time of the call to <code>reset</code>. </ul>
+     *     the time of the call to {@code reset}. </ul>
      *
-     * <li> If the method <code>markSupported</code> returns
-     * <code>false</code>, then:
+     * <li> If the method {@code markSupported} returns
+     * {@code false}, then:
      *
-     *     <ul><li> The call to <code>reset</code> may throw an
-     *     <code>IOException</code>.
+     *     <ul><li> The call to {@code reset} may throw an
+     *     {@code IOException}.
      *
-     *     <li> If an <code>IOException</code> is not thrown, then the stream
+     *     <li> If an {@code IOException} is not thrown, then the stream
      *     is reset to a fixed state that depends on the particular type of the
      *     input stream and how it was created. The bytes that will be supplied
-     *     to subsequent callers of the <code>read</code> method depend on the
+     *     to subsequent callers of the {@code read} method depend on the
      *     particular type of the input stream. </ul></ul>
      *
-     * <p>The method <code>reset</code> for class <code>InputStream</code>
-     * does nothing except throw an <code>IOException</code>.
+     * <p>The method {@code reset} for class {@code InputStream}
+     * does nothing except throw an {@code IOException}.
      *
-     * @exception  IOException  if this stream has not been marked or if the
-     *               mark has been invalidated.
+     * @throws  IOException  if this stream has not been marked or if the
+     *          mark has been invalidated.
      * @see     java.io.InputStream#mark(int)
      * @see     java.io.IOException
      */
@@ -728,14 +728,14 @@
     }
 
     /**
-     * Tests if this input stream supports the <code>mark</code> and
-     * <code>reset</code> methods. Whether or not <code>mark</code> and
-     * <code>reset</code> are supported is an invariant property of a
-     * particular input stream instance. The <code>markSupported</code> method
-     * of <code>InputStream</code> returns <code>false</code>.
+     * Tests if this input stream supports the {@code mark} and
+     * {@code reset} methods. Whether or not {@code mark} and
+     * {@code reset} are supported is an invariant property of a
+     * particular input stream instance. The {@code markSupported} method
+     * of {@code InputStream} returns {@code false}.
      *
-     * @return  <code>true</code> if this stream instance supports the mark
-     *          and reset methods; <code>false</code> otherwise.
+     * @return  {@code true} if this stream instance supports the mark
+     *          and reset methods; {@code false} otherwise.
      * @see     java.io.InputStream#mark(int)
      * @see     java.io.InputStream#reset()
      */
--- a/src/java.base/share/classes/java/io/InputStreamReader.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/InputStreamReader.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -88,7 +88,7 @@
      *         The name of a supported
      *         {@link java.nio.charset.Charset charset}
      *
-     * @exception  UnsupportedEncodingException
+     * @throws     UnsupportedEncodingException
      *             If the named charset is not supported
      */
     public InputStreamReader(InputStream in, String charsetName)
@@ -141,11 +141,11 @@
      * <p> If this instance was created with the {@link
      * #InputStreamReader(InputStream, String)} constructor then the returned
      * name, being unique for the encoding, may differ from the name passed to
-     * the constructor. This method will return <code>null</code> if the
+     * the constructor. This method will return {@code null} if the
      * stream has been closed.
      * </p>
      * @return The historical name of this encoding, or
-     *         <code>null</code> if the stream has been closed
+     *         {@code null} if the stream has been closed
      *
      * @see java.nio.charset.Charset
      *
@@ -162,7 +162,7 @@
      * @return The character read, or -1 if the end of the stream has been
      *         reached
      *
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IOException  If an I/O error occurs
      */
     public int read() throws IOException {
         return sd.read();
@@ -178,8 +178,8 @@
      * @return     The number of characters read, or -1 if the end of the
      *             stream has been reached
      *
-     * @exception  IOException  If an I/O error occurs
-     * @exception  IndexOutOfBoundsException {@inheritDoc}
+     * @throws     IOException  If an I/O error occurs
+     * @throws     IndexOutOfBoundsException {@inheritDoc}
      */
     public int read(char cbuf[], int offset, int length) throws IOException {
         return sd.read(cbuf, offset, length);
@@ -190,7 +190,7 @@
      * ready if its input buffer is not empty, or if bytes are available to be
      * read from the underlying byte stream.
      *
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IOException  If an I/O error occurs
      */
     public boolean ready() throws IOException {
         return sd.ready();
--- a/src/java.base/share/classes/java/io/InterruptedIOException.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/InterruptedIOException.java	Tue Sep 24 15:19:35 2019 -0400
@@ -27,7 +27,7 @@
 
 /**
  * Signals that an I/O operation has been interrupted. An
- * <code>InterruptedIOException</code> is thrown to indicate that an
+ * {@code InterruptedIOException} is thrown to indicate that an
  * input or output transfer has been terminated because the thread
  * performing it was interrupted. The field {@link #bytesTransferred}
  * indicates how many bytes were successfully transferred before
@@ -45,19 +45,19 @@
     private static final long serialVersionUID = 4020568460727500567L;
 
     /**
-     * Constructs an <code>InterruptedIOException</code> with
-     * <code>null</code> as its error detail message.
+     * Constructs an {@code InterruptedIOException} with
+     * {@code null} as its error detail message.
      */
     public InterruptedIOException() {
         super();
     }
 
     /**
-     * Constructs an <code>InterruptedIOException</code> with the
-     * specified detail message. The string <code>s</code> can be
+     * Constructs an {@code InterruptedIOException} with the
+     * specified detail message. The string {@code s} can be
      * retrieved later by the
      * <code>{@link java.lang.Throwable#getMessage}</code>
-     * method of class <code>java.lang.Throwable</code>.
+     * method of class {@code java.lang.Throwable}.
      *
      * @param   s   the detail message.
      */
--- a/src/java.base/share/classes/java/io/InvalidObjectException.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/InvalidObjectException.java	Tue Sep 24 15:19:35 2019 -0400
@@ -41,7 +41,7 @@
     private static final long serialVersionUID = 3233174318281839583L;
 
     /**
-     * Constructs an <code>InvalidObjectException</code>.
+     * Constructs an {@code InvalidObjectException}.
      * @param reason Detailed message explaining the reason for the failure.
      *
      * @see ObjectInputValidation
--- a/src/java.base/share/classes/java/io/LineNumberInputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/LineNumberInputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -83,7 +83,7 @@
      *
      * @return     the next byte of data, or {@code -1} if the end of this
      *             stream is reached.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.FilterInputStream#in
      * @see        java.io.LineNumberInputStream#getLineNumber()
      */
@@ -124,7 +124,7 @@
      * @return     the total number of bytes read into the buffer, or
      *             {@code -1} if there is no more data because the end of
      *             this stream has been reached.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.LineNumberInputStream#read()
      */
     public int read(byte b[], int off, int len) throws IOException {
@@ -173,7 +173,7 @@
      *
      * @param      n   the number of bytes to be skipped.
      * @return     the actual number of bytes skipped.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.FilterInputStream#in
      */
     public long skip(long n) throws IOException {
@@ -234,7 +234,7 @@
      *
      * @return     the number of bytes that can be read from this input stream
      *             without blocking.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.FilterInputStream#in
      */
     public int available() throws IOException {
@@ -281,7 +281,7 @@
      * which, if it happens within readlimit bytes, allows the outer
      * code to reset the stream and try another parser.
      *
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.FilterInputStream#in
      * @see        java.io.LineNumberInputStream#mark(int)
      */
--- a/src/java.base/share/classes/java/io/ObjectInput.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/ObjectInput.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,11 +41,11 @@
      * Read and return an object. The class that implements this interface
      * defines where the object is "read" from.
      *
-     * @return the object read from the stream
-     * @exception java.lang.ClassNotFoundException If the class of a serialized
-     *      object cannot be found.
-     * @exception IOException If any of the usual Input/Output
-     * related exceptions occur.
+     * @return    the object read from the stream
+     * @throws    java.lang.ClassNotFoundException If the class of a serialized
+     *            object cannot be found.
+     * @throws    IOException If any of the usual Input/Output
+     *            related exceptions occur.
      */
     public Object readObject()
         throws ClassNotFoundException, IOException;
@@ -55,45 +55,45 @@
      * available.
      * @return  the byte read, or -1 if the end of the
      *          stream is reached.
-     * @exception IOException If an I/O error has occurred.
+     * @throws  IOException If an I/O error has occurred.
      */
     public int read() throws IOException;
 
     /**
      * Reads into an array of bytes.  This method will
      * block until some input is available.
-     * @param b the buffer into which the data is read
+     * @param   b the buffer into which the data is read
      * @return  the actual number of bytes read, -1 is
      *          returned when the end of the stream is reached.
-     * @exception IOException If an I/O error has occurred.
+     * @throws  IOException If an I/O error has occurred.
      */
     public int read(byte b[]) throws IOException;
 
     /**
      * Reads into an array of bytes.  This method will
      * block until some input is available.
-     * @param b the buffer into which the data is read
-     * @param off the start offset of the data
-     * @param len the maximum number of bytes read
+     * @param   b the buffer into which the data is read
+     * @param   off the start offset of the data
+     * @param   len the maximum number of bytes read
      * @return  the actual number of bytes read, -1 is
      *          returned when the end of the stream is reached.
-     * @exception IOException If an I/O error has occurred.
+     * @throws  IOException If an I/O error has occurred.
      */
     public int read(byte b[], int off, int len) throws IOException;
 
     /**
      * Skips n bytes of input.
-     * @param n the number of bytes to be skipped
+     * @param   n the number of bytes to be skipped
      * @return  the actual number of bytes skipped.
-     * @exception IOException If an I/O error has occurred.
+     * @throws   IOException If an I/O error has occurred.
      */
     public long skip(long n) throws IOException;
 
     /**
      * Returns the number of bytes that can be read
      * without blocking.
-     * @return the number of available bytes.
-     * @exception IOException If an I/O error has occurred.
+     * @return  the number of available bytes.
+     * @throws  IOException If an I/O error has occurred.
      */
     public int available() throws IOException;
 
@@ -101,7 +101,7 @@
      * Closes the input stream. Must be called
      * to release any resources associated with
      * the stream.
-     * @exception IOException If an I/O error has occurred.
+     * @throws    IOException If an I/O error has occurred.
      */
     public void close() throws IOException;
 }
--- a/src/java.base/share/classes/java/io/ObjectInputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/ObjectInputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -74,7 +74,7 @@
  * <p>Only objects that support the java.io.Serializable or
  * java.io.Externalizable interface can be read from streams.
  *
- * <p>The method <code>readObject</code> is used to read an object from the
+ * <p>The method {@code readObject} is used to read an object from the
  * stream.  Java's safe casting should be used to get the desired type.  In
  * Java, strings and arrays are objects and are treated as objects during
  * serialization. When read they need to be cast to the expected type.
@@ -157,7 +157,7 @@
  * throw OptionalDataExceptions with eof set to true, bytewise reads will
  * return -1, and primitive reads will throw EOFExceptions.  Note that this
  * behavior does not hold for streams written with the old
- * <code>ObjectStreamConstants.PROTOCOL_VERSION_1</code> protocol, in which the
+ * {@code ObjectStreamConstants.PROTOCOL_VERSION_1} protocol, in which the
  * end of data written by writeExternal methods is not demarcated, and hence
  * cannot be detected.
  *
@@ -208,7 +208,7 @@
  * solely of its name; field values of the constant are not transmitted.  To
  * deserialize an enum constant, ObjectInputStream reads the constant name from
  * the stream; the deserialized constant is then obtained by calling the static
- * method <code>Enum.valueOf(Class, String)</code> with the enum constant's
+ * method {@code Enum.valueOf(Class, String)} with the enum constant's
  * base type and the received constant name as arguments.  Like other
  * serializable or externalizable objects, enum constants can function as the
  * targets of back references appearing subsequently in the serialization
@@ -335,7 +335,7 @@
      * @throws  IOException if an I/O error occurs while reading stream header
      * @throws  SecurityException if untrusted subclass illegally overrides
      *          security-sensitive methods
-     * @throws  NullPointerException if <code>in</code> is <code>null</code>
+     * @throws  NullPointerException if {@code in} is {@code null}
      * @see     ObjectInputStream#ObjectInputStream()
      * @see     ObjectInputStream#readFields()
      * @see     ObjectOutputStream#ObjectOutputStream(OutputStream)
@@ -360,12 +360,12 @@
      * {@linkplain ObjectInputFilter.Config#getSerialFilter() the system-wide filter}.
      *
      * <p>If there is a security manager installed, this method first calls the
-     * security manager's <code>checkPermission</code> method with the
-     * <code>SerializablePermission("enableSubclassImplementation")</code>
+     * security manager's {@code checkPermission} method with the
+     * {@code SerializablePermission("enableSubclassImplementation")}
      * permission to ensure it's ok to enable subclassing.
      *
      * @throws  SecurityException if a security manager exists and its
-     *          <code>checkPermission</code> method denies enabling
+     *          {@code checkPermission} method denies enabling
      *          subclassing.
      * @throws  IOException if an I/O error occurs while creating this stream
      * @see SecurityManager#checkPermission
@@ -587,7 +587,7 @@
      * Reads the persistent fields from the stream and makes them available by
      * name.
      *
-     * @return  the <code>GetField</code> object representing the persistent
+     * @return  the {@code GetField} object representing the persistent
      *          fields of the object being deserialized
      * @throws  ClassNotFoundException if the class of a serialized object
      *          could not be found.
@@ -651,36 +651,36 @@
      * description.  Subclasses may implement this method to allow classes to
      * be fetched from an alternate source.
      *
-     * <p>The corresponding method in <code>ObjectOutputStream</code> is
-     * <code>annotateClass</code>.  This method will be invoked only once for
+     * <p>The corresponding method in {@code ObjectOutputStream} is
+     * {@code annotateClass}.  This method will be invoked only once for
      * each unique class in the stream.  This method can be implemented by
      * subclasses to use an alternate loading mechanism but must return a
-     * <code>Class</code> object. Once returned, if the class is not an array
+     * {@code Class} object. Once returned, if the class is not an array
      * class, its serialVersionUID is compared to the serialVersionUID of the
      * serialized class, and if there is a mismatch, the deserialization fails
      * and an {@link InvalidClassException} is thrown.
      *
      * <p>The default implementation of this method in
-     * <code>ObjectInputStream</code> returns the result of calling
+     * {@code ObjectInputStream} returns the result of calling
      * <pre>
      *     Class.forName(desc.getName(), false, loader)
      * </pre>
-     * where <code>loader</code> is the first class loader on the current
+     * where {@code loader} is the first class loader on the current
      * thread's stack (starting from the currently executing method) that is
      * neither the {@linkplain ClassLoader#getPlatformClassLoader() platform
-     * class loader} nor its ancestor; otherwise, <code>loader</code> is the
+     * class loader} nor its ancestor; otherwise, {@code loader} is the
      * <em>platform class loader</em>. If this call results in a
-     * <code>ClassNotFoundException</code> and the name of the passed
-     * <code>ObjectStreamClass</code> instance is the Java language keyword
-     * for a primitive type or void, then the <code>Class</code> object
+     * {@code ClassNotFoundException} and the name of the passed
+     * {@code ObjectStreamClass} instance is the Java language keyword
+     * for a primitive type or void, then the {@code Class} object
      * representing that primitive type or void will be returned
-     * (e.g., an <code>ObjectStreamClass</code> with the name
-     * <code>"int"</code> will be resolved to <code>Integer.TYPE</code>).
-     * Otherwise, the <code>ClassNotFoundException</code> will be thrown to
+     * (e.g., an {@code ObjectStreamClass} with the name
+     * {@code "int"} will be resolved to {@code Integer.TYPE}).
+     * Otherwise, the {@code ClassNotFoundException} will be thrown to
      * the caller of this method.
      *
-     * @param   desc an instance of class <code>ObjectStreamClass</code>
-     * @return  a <code>Class</code> object corresponding to <code>desc</code>
+     * @param   desc an instance of class {@code ObjectStreamClass}
+     * @return  a {@code Class} object corresponding to {@code desc}
      * @throws  IOException any of the usual Input/Output exceptions.
      * @throws  ClassNotFoundException if class of a serialized object cannot
      *          be found.
@@ -711,43 +711,43 @@
      * <p>This method is called exactly once for each unique proxy class
      * descriptor in the stream.
      *
-     * <p>The corresponding method in <code>ObjectOutputStream</code> is
-     * <code>annotateProxyClass</code>.  For a given subclass of
-     * <code>ObjectInputStream</code> that overrides this method, the
-     * <code>annotateProxyClass</code> method in the corresponding subclass of
-     * <code>ObjectOutputStream</code> must write any data or objects read by
+     * <p>The corresponding method in {@code ObjectOutputStream} is
+     * {@code annotateProxyClass}.  For a given subclass of
+     * {@code ObjectInputStream} that overrides this method, the
+     * {@code annotateProxyClass} method in the corresponding subclass of
+     * {@code ObjectOutputStream} must write any data or objects read by
      * this method.
      *
      * <p>The default implementation of this method in
-     * <code>ObjectInputStream</code> returns the result of calling
-     * <code>Proxy.getProxyClass</code> with the list of <code>Class</code>
-     * objects for the interfaces that are named in the <code>interfaces</code>
-     * parameter.  The <code>Class</code> object for each interface name
-     * <code>i</code> is the value returned by calling
+     * {@code ObjectInputStream} returns the result of calling
+     * {@code Proxy.getProxyClass} with the list of {@code Class}
+     * objects for the interfaces that are named in the {@code interfaces}
+     * parameter.  The {@code Class} object for each interface name
+     * {@code i} is the value returned by calling
      * <pre>
      *     Class.forName(i, false, loader)
      * </pre>
-     * where <code>loader</code> is the first class loader on the current
+     * where {@code loader} is the first class loader on the current
      * thread's stack (starting from the currently executing method) that is
      * neither the {@linkplain ClassLoader#getPlatformClassLoader() platform
-     * class loader} nor its ancestor; otherwise, <code>loader</code> is the
+     * class loader} nor its ancestor; otherwise, {@code loader} is the
      * <em>platform class loader</em>.
      * Unless any of the resolved interfaces are non-public, this same value
-     * of <code>loader</code> is also the class loader passed to
-     * <code>Proxy.getProxyClass</code>; if non-public interfaces are present,
+     * of {@code loader} is also the class loader passed to
+     * {@code Proxy.getProxyClass}; if non-public interfaces are present,
      * their class loader is passed instead (if more than one non-public
      * interface class loader is encountered, an
-     * <code>IllegalAccessError</code> is thrown).
-     * If <code>Proxy.getProxyClass</code> throws an
-     * <code>IllegalArgumentException</code>, <code>resolveProxyClass</code>
-     * will throw a <code>ClassNotFoundException</code> containing the
-     * <code>IllegalArgumentException</code>.
+     * {@code IllegalAccessError} is thrown).
+     * If {@code Proxy.getProxyClass} throws an
+     * {@code IllegalArgumentException}, {@code resolveProxyClass}
+     * will throw a {@code ClassNotFoundException} containing the
+     * {@code IllegalArgumentException}.
      *
      * @param interfaces the list of interface names that were
      *                deserialized in the proxy class descriptor
      * @return  a proxy class for the specified interfaces
      * @throws        IOException any exception thrown by the underlying
-     *                <code>InputStream</code>
+     *                {@code InputStream}
      * @throws        ClassNotFoundException if the proxy class or any of the
      *                named interfaces could not be found
      * @see ObjectOutputStream#annotateProxyClass(Class)
@@ -863,7 +863,7 @@
      * and version number.
      *
      * @throws  IOException if there are I/O errors while reading from the
-     *          underlying <code>InputStream</code>
+     *          underlying {@code InputStream}
      * @throws  StreamCorruptedException if control information in the stream
      *          is inconsistent
      */
@@ -884,7 +884,7 @@
      * item in the serialization stream.  Subclasses of ObjectInputStream may
      * override this method to read in class descriptors that have been written
      * in non-standard formats (by subclasses of ObjectOutputStream which have
-     * overridden the <code>writeClassDescriptor</code> method).  By default,
+     * overridden the {@code writeClassDescriptor} method).  By default,
      * this method reads class descriptors according to the format defined in
      * the Object Serialization specification.
      *
@@ -946,7 +946,7 @@
      *
      * @return  the number of available bytes.
      * @throws  IOException if there are I/O errors while reading from the
-     *          underlying <code>InputStream</code>
+     *          underlying {@code InputStream}
      */
     public int available() throws IOException {
         return bin.available();
@@ -1129,7 +1129,7 @@
      *
      * @return  a String copy of the line.
      * @throws  IOException if there are I/O errors while reading from the
-     *          underlying <code>InputStream</code>
+     *          underlying {@code InputStream}
      * @deprecated This method does not properly convert bytes to characters.
      *          see DataInputStream for the details and alternatives.
      */
@@ -1145,7 +1145,7 @@
      *
      * @return  the String.
      * @throws  IOException if there are I/O errors while reading from the
-     *          underlying <code>InputStream</code>
+     *          underlying {@code InputStream}
      * @throws  UTFDataFormatException if read bytes do not represent a valid
      *          modified UTF-8 encoding of a string
      */
@@ -1340,8 +1340,8 @@
          * @param  name the name of the field
          * @return true, if and only if the named field is defaulted
          * @throws IOException if there are I/O errors while reading from
-         *         the underlying <code>InputStream</code>
-         * @throws IllegalArgumentException if <code>name</code> does not
+         *         the underlying {@code InputStream}
+         * @throws IllegalArgumentException if {@code name} does not
          *         correspond to a serializable field
          */
         public abstract boolean defaulted(String name) throws IOException;
@@ -1350,12 +1350,12 @@
          * Get the value of the named boolean field from the persistent field.
          *
          * @param  name the name of the field
-         * @param  val the default value to use if <code>name</code> does not
+         * @param  val the default value to use if {@code name} does not
          *         have a value
-         * @return the value of the named <code>boolean</code> field
+         * @return the value of the named {@code boolean} field
          * @throws IOException if there are I/O errors while reading from the
-         *         underlying <code>InputStream</code>
-         * @throws IllegalArgumentException if type of <code>name</code> is
+         *         underlying {@code InputStream}
+         * @throws IllegalArgumentException if type of {@code name} is
          *         not serializable or if the field type is incorrect
          */
         public abstract boolean get(String name, boolean val)
@@ -1365,12 +1365,12 @@
          * Get the value of the named byte field from the persistent field.
          *
          * @param  name the name of the field
-         * @param  val the default value to use if <code>name</code> does not
+         * @param  val the default value to use if {@code name} does not
          *         have a value
-         * @return the value of the named <code>byte</code> field
+         * @return the value of the named {@code byte} field
          * @throws IOException if there are I/O errors while reading from the
-         *         underlying <code>InputStream</code>
-         * @throws IllegalArgumentException if type of <code>name</code> is
+         *         underlying {@code InputStream}
+         * @throws IllegalArgumentException if type of {@code name} is
          *         not serializable or if the field type is incorrect
          */
         public abstract byte get(String name, byte val) throws IOException;
@@ -1379,12 +1379,12 @@
          * Get the value of the named char field from the persistent field.
          *
          * @param  name the name of the field
-         * @param  val the default value to use if <code>name</code> does not
+         * @param  val the default value to use if {@code name} does not
          *         have a value
-         * @return the value of the named <code>char</code> field
+         * @return the value of the named {@code char} field
          * @throws IOException if there are I/O errors while reading from the
-         *         underlying <code>InputStream</code>
-         * @throws IllegalArgumentException if type of <code>name</code> is
+         *         underlying {@code InputStream}
+         * @throws IllegalArgumentException if type of {@code name} is
          *         not serializable or if the field type is incorrect
          */
         public abstract char get(String name, char val) throws IOException;
@@ -1393,12 +1393,12 @@
          * Get the value of the named short field from the persistent field.
          *
          * @param  name the name of the field
-         * @param  val the default value to use if <code>name</code> does not
+         * @param  val the default value to use if {@code name} does not
          *         have a value
-         * @return the value of the named <code>short</code> field
+         * @return the value of the named {@code short} field
          * @throws IOException if there are I/O errors while reading from the
-         *         underlying <code>InputStream</code>
-         * @throws IllegalArgumentException if type of <code>name</code> is
+         *         underlying {@code InputStream}
+         * @throws IllegalArgumentException if type of {@code name} is
          *         not serializable or if the field type is incorrect
          */
         public abstract short get(String name, short val) throws IOException;
@@ -1407,12 +1407,12 @@
          * Get the value of the named int field from the persistent field.
          *
          * @param  name the name of the field
-         * @param  val the default value to use if <code>name</code> does not
+         * @param  val the default value to use if {@code name} does not
          *         have a value
-         * @return the value of the named <code>int</code> field
+         * @return the value of the named {@code int} field
          * @throws IOException if there are I/O errors while reading from the
-         *         underlying <code>InputStream</code>
-         * @throws IllegalArgumentException if type of <code>name</code> is
+         *         underlying {@code InputStream}
+         * @throws IllegalArgumentException if type of {@code name} is
          *         not serializable or if the field type is incorrect
          */
         public abstract int get(String name, int val) throws IOException;
@@ -1421,12 +1421,12 @@
          * Get the value of the named long field from the persistent field.
          *
          * @param  name the name of the field
-         * @param  val the default value to use if <code>name</code> does not
+         * @param  val the default value to use if {@code name} does not
          *         have a value
-         * @return the value of the named <code>long</code> field
+         * @return the value of the named {@code long} field
          * @throws IOException if there are I/O errors while reading from the
-         *         underlying <code>InputStream</code>
-         * @throws IllegalArgumentException if type of <code>name</code> is
+         *         underlying {@code InputStream}
+         * @throws IllegalArgumentException if type of {@code name} is
          *         not serializable or if the field type is incorrect
          */
         public abstract long get(String name, long val) throws IOException;
@@ -1435,12 +1435,12 @@
          * Get the value of the named float field from the persistent field.
          *
          * @param  name the name of the field
-         * @param  val the default value to use if <code>name</code> does not
+         * @param  val the default value to use if {@code name} does not
          *         have a value
-         * @return the value of the named <code>float</code> field
+         * @return the value of the named {@code float} field
          * @throws IOException if there are I/O errors while reading from the
-         *         underlying <code>InputStream</code>
-         * @throws IllegalArgumentException if type of <code>name</code> is
+         *         underlying {@code InputStream}
+         * @throws IllegalArgumentException if type of {@code name} is
          *         not serializable or if the field type is incorrect
          */
         public abstract float get(String name, float val) throws IOException;
@@ -1449,12 +1449,12 @@
          * Get the value of the named double field from the persistent field.
          *
          * @param  name the name of the field
-         * @param  val the default value to use if <code>name</code> does not
+         * @param  val the default value to use if {@code name} does not
          *         have a value
-         * @return the value of the named <code>double</code> field
+         * @return the value of the named {@code double} field
          * @throws IOException if there are I/O errors while reading from the
-         *         underlying <code>InputStream</code>
-         * @throws IllegalArgumentException if type of <code>name</code> is
+         *         underlying {@code InputStream}
+         * @throws IllegalArgumentException if type of {@code name} is
          *         not serializable or if the field type is incorrect
          */
         public abstract double get(String name, double val) throws IOException;
@@ -1463,12 +1463,12 @@
          * Get the value of the named Object field from the persistent field.
          *
          * @param  name the name of the field
-         * @param  val the default value to use if <code>name</code> does not
+         * @param  val the default value to use if {@code name} does not
          *         have a value
-         * @return the value of the named <code>Object</code> field
+         * @return the value of the named {@code Object} field
          * @throws IOException if there are I/O errors while reading from the
-         *         underlying <code>InputStream</code>
-         * @throws IllegalArgumentException if type of <code>name</code> is
+         *         underlying {@code InputStream}
+         * @throws IllegalArgumentException if type of {@code name} is
          *         not serializable or if the field type is incorrect
          */
         public abstract Object get(String name, Object val) throws IOException;
@@ -2414,22 +2414,6 @@
     }
 
     /**
-     * Converts specified span of bytes into float values.
-     */
-    // REMIND: remove once hotspot inlines Float.intBitsToFloat
-    private static native void bytesToFloats(byte[] src, int srcpos,
-                                             float[] dst, int dstpos,
-                                             int nfloats);
-
-    /**
-     * Converts specified span of bytes into double values.
-     */
-    // REMIND: remove once hotspot inlines Double.longBitsToDouble
-    private static native void bytesToDoubles(byte[] src, int srcpos,
-                                              double[] dst, int dstpos,
-                                              int ndoubles);
-
-    /**
      * Returns the first non-null and non-platform class loader (not counting
      * class loaders of generated reflection implementation classes) up the
      * execution stack, or the platform class loader if only code from the
@@ -3433,22 +3417,24 @@
         }
 
         void readFloats(float[] v, int off, int len) throws IOException {
-            int span, endoff = off + len;
+            int stop, endoff = off + len;
             while (off < endoff) {
                 if (!blkmode) {
-                    span = Math.min(endoff - off, MAX_BLOCK_SIZE >> 2);
+                    int span = Math.min(endoff - off, MAX_BLOCK_SIZE >> 2);
                     in.readFully(buf, 0, span << 2);
+                    stop = off + span;
                     pos = 0;
                 } else if (end - pos < 4) {
                     v[off++] = din.readFloat();
                     continue;
                 } else {
-                    span = Math.min(endoff - off, ((end - pos) >> 2));
+                    stop = Math.min(endoff, ((end - pos) >> 2));
                 }
 
-                bytesToFloats(buf, pos, v, off, span);
-                off += span;
-                pos += span << 2;
+                while (off < stop) {
+                    v[off++] = Bits.getFloat(buf, pos);
+                    pos += 4;
+                }
             }
         }
 
@@ -3475,22 +3461,24 @@
         }
 
         void readDoubles(double[] v, int off, int len) throws IOException {
-            int span, endoff = off + len;
+            int stop, endoff = off + len;
             while (off < endoff) {
                 if (!blkmode) {
-                    span = Math.min(endoff - off, MAX_BLOCK_SIZE >> 3);
+                    int span = Math.min(endoff - off, MAX_BLOCK_SIZE >> 3);
                     in.readFully(buf, 0, span << 3);
+                    stop = off + span;
                     pos = 0;
                 } else if (end - pos < 8) {
                     v[off++] = din.readDouble();
                     continue;
                 } else {
-                    span = Math.min(endoff - off, ((end - pos) >> 3));
+                    stop = Math.min(endoff - off, ((end - pos) >> 3));
                 }
 
-                bytesToDoubles(buf, pos, v, off, span);
-                off += span;
-                pos += span << 3;
+                while (off < stop) {
+                    v[off++] = Bits.getDouble(buf, pos);
+                    pos += 8;
+                }
             }
         }
 
--- a/src/java.base/share/classes/java/io/ObjectInputValidation.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/ObjectInputValidation.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,7 @@
     /**
      * Validates the object.
      *
-     * @exception InvalidObjectException If the object cannot validate itself.
+     * @throws    InvalidObjectException If the object cannot validate itself.
      */
     public void validateObject() throws InvalidObjectException;
 }
--- a/src/java.base/share/classes/java/io/ObjectOutput.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/ObjectOutput.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,8 +42,8 @@
      * class that implements this interface defines how the object is
      * written.
      *
-     * @param obj the object to be written
-     * @exception IOException Any of the usual Input/Output related exceptions.
+     * @param     obj the object to be written
+     * @throws    IOException Any of the usual Input/Output related exceptions.
      */
     public void writeObject(Object obj)
       throws IOException;
@@ -51,32 +51,32 @@
     /**
      * Writes a byte. This method will block until the byte is actually
      * written.
-     * @param b the byte
-     * @exception IOException If an I/O error has occurred.
+     * @param     b the byte
+     * @throws    IOException If an I/O error has occurred.
      */
     public void write(int b) throws IOException;
 
     /**
      * Writes an array of bytes. This method will block until the bytes
      * are actually written.
-     * @param b the data to be written
-     * @exception IOException If an I/O error has occurred.
+     * @param     b the data to be written
+     * @throws    IOException If an I/O error has occurred.
      */
     public void write(byte b[]) throws IOException;
 
     /**
      * Writes a sub array of bytes.
-     * @param b the data to be written
-     * @param off       the start offset in the data
-     * @param len       the number of bytes that are written
-     * @exception IOException If an I/O error has occurred.
+     * @param     b the data to be written
+     * @param     off       the start offset in the data
+     * @param     len       the number of bytes that are written
+     * @throws    IOException If an I/O error has occurred.
      */
     public void write(byte b[], int off, int len) throws IOException;
 
     /**
      * Flushes the stream. This will write any buffered
      * output bytes.
-     * @exception IOException If an I/O error has occurred.
+     * @throws    IOException If an I/O error has occurred.
      */
     public void flush() throws IOException;
 
@@ -84,7 +84,7 @@
      * Closes the stream. This method must be called
      * to release any resources associated with the
      * stream.
-     * @exception IOException If an I/O error has occurred.
+     * @throws    IOException If an I/O error has occurred.
      */
     public void close() throws IOException;
 }
--- a/src/java.base/share/classes/java/io/ObjectOutputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/ObjectOutputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -232,7 +232,7 @@
      * @throws  IOException if an I/O error occurs while writing stream header
      * @throws  SecurityException if untrusted subclass illegally overrides
      *          security-sensitive methods
-     * @throws  NullPointerException if <code>out</code> is <code>null</code>
+     * @throws  NullPointerException if {@code out} is {@code null}
      * @since   1.4
      * @see     ObjectOutputStream#ObjectOutputStream()
      * @see     ObjectOutputStream#putFields()
@@ -259,12 +259,12 @@
      * this implementation of ObjectOutputStream.
      *
      * <p>If there is a security manager installed, this method first calls the
-     * security manager's <code>checkPermission</code> method with a
-     * <code>SerializablePermission("enableSubclassImplementation")</code>
+     * security manager's {@code checkPermission} method with a
+     * {@code SerializablePermission("enableSubclassImplementation")}
      * permission to ensure it's ok to enable subclassing.
      *
      * @throws  SecurityException if a security manager exists and its
-     *          <code>checkPermission</code> method denies enabling
+     *          {@code checkPermission} method denies enabling
      *          subclassing.
      * @throws  IOException if an I/O error occurs while creating this stream
      * @see SecurityManager#checkPermission
@@ -429,7 +429,7 @@
      * called otherwise.
      *
      * @throws  IOException if I/O errors occur while writing to the underlying
-     *          <code>OutputStream</code>
+     *          {@code OutputStream}
      */
     public void defaultWriteObject() throws IOException {
         SerialCallbackContext ctx = curContext;
@@ -529,18 +529,18 @@
      *
      * <p>This method is called exactly once for each unique proxy class
      * descriptor in the stream.  The default implementation of this method in
-     * <code>ObjectOutputStream</code> does nothing.
+     * {@code ObjectOutputStream} does nothing.
      *
-     * <p>The corresponding method in <code>ObjectInputStream</code> is
-     * <code>resolveProxyClass</code>.  For a given subclass of
-     * <code>ObjectOutputStream</code> that overrides this method, the
-     * <code>resolveProxyClass</code> method in the corresponding subclass of
-     * <code>ObjectInputStream</code> must read any data or objects written by
-     * <code>annotateProxyClass</code>.
+     * <p>The corresponding method in {@code ObjectInputStream} is
+     * {@code resolveProxyClass}.  For a given subclass of
+     * {@code ObjectOutputStream} that overrides this method, the
+     * {@code resolveProxyClass} method in the corresponding subclass of
+     * {@code ObjectInputStream} must read any data or objects written by
+     * {@code annotateProxyClass}.
      *
      * @param   cl the proxy class to annotate custom data for
      * @throws  IOException any exception thrown by the underlying
-     *          <code>OutputStream</code>
+     *          {@code OutputStream}
      * @see ObjectInputStream#resolveProxyClass(String[])
      * @since   1.3
      */
@@ -646,16 +646,16 @@
      * stream.  Subclasses of ObjectOutputStream may override this method to
      * customize the way in which class descriptors are written to the
      * serialization stream.  The corresponding method in ObjectInputStream,
-     * <code>readClassDescriptor</code>, should then be overridden to
+     * {@code readClassDescriptor}, should then be overridden to
      * reconstitute the class descriptor from its custom stream representation.
      * By default, this method writes class descriptors according to the format
      * defined in the Object Serialization specification.
      *
      * <p>Note that this method will only be called if the ObjectOutputStream
      * is not using the old serialization stream format (set by calling
-     * ObjectOutputStream's <code>useProtocolVersion</code> method).  If this
+     * ObjectOutputStream's {@code useProtocolVersion} method).  If this
      * serialization stream is using the old format
-     * (<code>PROTOCOL_VERSION_1</code>), the class descriptor will be written
+     * ({@code PROTOCOL_VERSION_1}), the class descriptor will be written
      * internally in a manner that cannot be overridden or customized.
      *
      * @param   desc class descriptor to write to the stream
@@ -889,10 +889,10 @@
          *
          * @param  name the name of the serializable field
          * @param  val the value to assign to the field
-         * @throws IllegalArgumentException if <code>name</code> does not
+         * @throws IllegalArgumentException if {@code name} does not
          * match the name of a serializable field for the class whose fields
          * are being written, or if the type of the named field is not
-         * <code>boolean</code>
+         * {@code boolean}
          */
         public abstract void put(String name, boolean val);
 
@@ -901,10 +901,10 @@
          *
          * @param  name the name of the serializable field
          * @param  val the value to assign to the field
-         * @throws IllegalArgumentException if <code>name</code> does not
+         * @throws IllegalArgumentException if {@code name} does not
          * match the name of a serializable field for the class whose fields
          * are being written, or if the type of the named field is not
-         * <code>byte</code>
+         * {@code byte}
          */
         public abstract void put(String name, byte val);
 
@@ -913,10 +913,10 @@
          *
          * @param  name the name of the serializable field
          * @param  val the value to assign to the field
-         * @throws IllegalArgumentException if <code>name</code> does not
+         * @throws IllegalArgumentException if {@code name} does not
          * match the name of a serializable field for the class whose fields
          * are being written, or if the type of the named field is not
-         * <code>char</code>
+         * {@code char}
          */
         public abstract void put(String name, char val);
 
@@ -925,10 +925,10 @@
          *
          * @param  name the name of the serializable field
          * @param  val the value to assign to the field
-         * @throws IllegalArgumentException if <code>name</code> does not
+         * @throws IllegalArgumentException if {@code name} does not
          * match the name of a serializable field for the class whose fields
          * are being written, or if the type of the named field is not
-         * <code>short</code>
+         * {@code short}
          */
         public abstract void put(String name, short val);
 
@@ -937,10 +937,10 @@
          *
          * @param  name the name of the serializable field
          * @param  val the value to assign to the field
-         * @throws IllegalArgumentException if <code>name</code> does not
+         * @throws IllegalArgumentException if {@code name} does not
          * match the name of a serializable field for the class whose fields
          * are being written, or if the type of the named field is not
-         * <code>int</code>
+         * {@code int}
          */
         public abstract void put(String name, int val);
 
@@ -949,10 +949,10 @@
          *
          * @param  name the name of the serializable field
          * @param  val the value to assign to the field
-         * @throws IllegalArgumentException if <code>name</code> does not
+         * @throws IllegalArgumentException if {@code name} does not
          * match the name of a serializable field for the class whose fields
          * are being written, or if the type of the named field is not
-         * <code>long</code>
+         * {@code long}
          */
         public abstract void put(String name, long val);
 
@@ -961,10 +961,10 @@
          *
          * @param  name the name of the serializable field
          * @param  val the value to assign to the field
-         * @throws IllegalArgumentException if <code>name</code> does not
+         * @throws IllegalArgumentException if {@code name} does not
          * match the name of a serializable field for the class whose fields
          * are being written, or if the type of the named field is not
-         * <code>float</code>
+         * {@code float}
          */
         public abstract void put(String name, float val);
 
@@ -973,10 +973,10 @@
          *
          * @param  name the name of the serializable field
          * @param  val the value to assign to the field
-         * @throws IllegalArgumentException if <code>name</code> does not
+         * @throws IllegalArgumentException if {@code name} does not
          * match the name of a serializable field for the class whose fields
          * are being written, or if the type of the named field is not
-         * <code>double</code>
+         * {@code double}
          */
         public abstract void put(String name, double val);
 
@@ -985,8 +985,8 @@
          *
          * @param  name the name of the serializable field
          * @param  val the value to assign to the field
-         *         (which may be <code>null</code>)
-         * @throws IllegalArgumentException if <code>name</code> does not
+         *         (which may be {@code null})
+         * @throws IllegalArgumentException if {@code name} does not
          * match the name of a serializable field for the class whose fields
          * are being written, or if the type of the named field is not a
          * reference type
@@ -996,18 +996,18 @@
         /**
          * Write the data and fields to the specified ObjectOutput stream,
          * which must be the same stream that produced this
-         * <code>PutField</code> object.
+         * {@code PutField} object.
          *
          * @param  out the stream to write the data and fields to
          * @throws IOException if I/O errors occur while writing to the
          *         underlying stream
          * @throws IllegalArgumentException if the specified stream is not
-         *         the same stream that produced this <code>PutField</code>
+         *         the same stream that produced this {@code PutField}
          *         object
          * @deprecated This method does not write the values contained by this
-         *         <code>PutField</code> object in a proper format, and may
+         *         {@code PutField} object in a proper format, and may
          *         result in corruption of the serialization stream.  The
-         *         correct way to write <code>PutField</code> data is by
+         *         correct way to write {@code PutField} data is by
          *         calling the {@link java.io.ObjectOutputStream#writeFields()}
          *         method.
          */
@@ -1592,22 +1592,6 @@
     }
 
     /**
-     * Converts specified span of float values into byte values.
-     */
-    // REMIND: remove once hotspot inlines Float.floatToIntBits
-    private static native void floatsToBytes(float[] src, int srcpos,
-                                             byte[] dst, int dstpos,
-                                             int nfloats);
-
-    /**
-     * Converts specified span of double values into byte values.
-     */
-    // REMIND: remove once hotspot inlines Double.doubleToLongBits
-    private static native void doublesToBytes(double[] src, int srcpos,
-                                              byte[] dst, int dstpos,
-                                              int ndoubles);
-
-    /**
      * Default PutField implementation.
      */
     private class PutFieldImpl extends PutField {
@@ -2096,10 +2080,11 @@
             while (off < endoff) {
                 if (pos <= limit) {
                     int avail = (MAX_BLOCK_SIZE - pos) >> 2;
-                    int chunklen = Math.min(endoff - off, avail);
-                    floatsToBytes(v, off, buf, pos, chunklen);
-                    off += chunklen;
-                    pos += chunklen << 2;
+                    int stop = Math.min(endoff, off + avail);
+                    while (off < stop) {
+                        Bits.putFloat(buf, pos, v[off++]);
+                        pos += 4;
+                    }
                 } else {
                     dout.writeFloat(v[off++]);
                 }
@@ -2129,10 +2114,11 @@
             while (off < endoff) {
                 if (pos <= limit) {
                     int avail = (MAX_BLOCK_SIZE - pos) >> 3;
-                    int chunklen = Math.min(endoff - off, avail);
-                    doublesToBytes(v, off, buf, pos, chunklen);
-                    off += chunklen;
-                    pos += chunklen << 3;
+                    int stop = Math.min(endoff, off + avail);
+                    while (off < stop) {
+                        Bits.putDouble(buf, pos, v[off++]);
+                        pos += 8;
+                    }
                 } else {
                     dout.writeDouble(v[off++]);
                 }
--- a/src/java.base/share/classes/java/io/ObjectStreamClass.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/ObjectStreamClass.java	Tue Sep 24 15:19:35 2019 -0400
@@ -276,7 +276,7 @@
      * Return the class in the local VM that this version is mapped to.  Null
      * is returned if there is no corresponding local class.
      *
-     * @return  the <code>Class</code> instance that this descriptor represents
+     * @return  the {@code Class} instance that this descriptor represents
      */
     @CallerSensitive
     public Class<?> forClass() {
--- a/src/java.base/share/classes/java/io/ObjectStreamField.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/ObjectStreamField.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -60,10 +60,10 @@
 
     /**
      * Create a Serializable field with the specified type.  This field should
-     * be documented with a <code>serialField</code> tag.
+     * be documented with a {@code serialField} tag.
      *
      * @param   name the name of the serializable field
-     * @param   type the <code>Class</code> object of the serializable field
+     * @param   type the {@code Class} object of the serializable field
      */
     public ObjectStreamField(String name, Class<?> type) {
         this(name, type, false);
@@ -197,7 +197,7 @@
     /**
      * Get the name of this field.
      *
-     * @return  a <code>String</code> representing the name of the serializable
+     * @return  a {@code String} representing the name of the serializable
      *          field
      */
     public String getName() {
@@ -206,12 +206,12 @@
 
     /**
      * Get the type of the field.  If the type is non-primitive and this
-     * <code>ObjectStreamField</code> was obtained from a deserialized {@link
-     * ObjectStreamClass} instance, then <code>Object.class</code> is returned.
-     * Otherwise, the <code>Class</code> object for the type of the field is
+     * {@code ObjectStreamField} was obtained from a deserialized {@link
+     * ObjectStreamClass} instance, then {@code Object.class} is returned.
+     * Otherwise, the {@code Class} object for the type of the field is
      * returned.
      *
-     * @return  a <code>Class</code> object representing the type of the
+     * @return  a {@code Class} object representing the type of the
      *          serializable field
      */
     @CallerSensitive
@@ -303,7 +303,7 @@
     }
 
     /**
-     * Compare this field with another <code>ObjectStreamField</code>.  Return
+     * Compare this field with another {@code ObjectStreamField}.  Return
      * -1 if this is smaller, 0 if equal, 1 if greater.  Types that are
      * primitives are "smaller" than object types.  If equal, the field names
      * are compared.
--- a/src/java.base/share/classes/java/io/OptionalDataException.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/OptionalDataException.java	Tue Sep 24 15:19:35 2019 -0400
@@ -51,7 +51,7 @@
     private static final long serialVersionUID = -8011121865681257820L;
 
     /*
-     * Create an <code>OptionalDataException</code> with a length.
+     * Create an {@code OptionalDataException} with a length.
      */
     OptionalDataException(int len) {
         eof = false;
@@ -59,7 +59,7 @@
     }
 
     /*
-     * Create an <code>OptionalDataException</code> signifying no
+     * Create an {@code OptionalDataException} signifying no
      * more primitive data is available.
      */
     OptionalDataException(boolean end) {
--- a/src/java.base/share/classes/java/io/OutputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/OutputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -33,7 +33,7 @@
  * and sends them to some sink.
  * <p>
  * Applications that need to define a subclass of
- * <code>OutputStream</code> must always provide at least a method
+ * {@code OutputStream} must always provide at least a method
  * that writes one byte of output.
  *
  * @author  Arthur van Hoff
@@ -98,29 +98,29 @@
 
     /**
      * Writes the specified byte to this output stream. The general
-     * contract for <code>write</code> is that one byte is written
+     * contract for {@code write} is that one byte is written
      * to the output stream. The byte to be written is the eight
-     * low-order bits of the argument <code>b</code>. The 24
-     * high-order bits of <code>b</code> are ignored.
+     * low-order bits of the argument {@code b}. The 24
+     * high-order bits of {@code b} are ignored.
      * <p>
-     * Subclasses of <code>OutputStream</code> must provide an
+     * Subclasses of {@code OutputStream} must provide an
      * implementation for this method.
      *
-     * @param      b   the <code>byte</code>.
-     * @exception  IOException  if an I/O error occurs. In particular,
-     *             an <code>IOException</code> may be thrown if the
+     * @param      b   the {@code byte}.
+     * @throws     IOException  if an I/O error occurs. In particular,
+     *             an {@code IOException} may be thrown if the
      *             output stream has been closed.
      */
     public abstract void write(int b) throws IOException;
 
     /**
-     * Writes <code>b.length</code> bytes from the specified byte array
-     * to this output stream. The general contract for <code>write(b)</code>
+     * Writes {@code b.length} bytes from the specified byte array
+     * to this output stream. The general contract for {@code write(b)}
      * is that it should have exactly the same effect as the call
-     * <code>write(b, 0, b.length)</code>.
+     * {@code write(b, 0, b.length)}.
      *
      * @param      b   the data.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.OutputStream#write(byte[], int, int)
      */
     public void write(byte b[]) throws IOException {
@@ -128,31 +128,31 @@
     }
 
     /**
-     * Writes <code>len</code> bytes from the specified byte array
-     * starting at offset <code>off</code> to this output stream.
-     * The general contract for <code>write(b, off, len)</code> is that
-     * some of the bytes in the array <code>b</code> are written to the
-     * output stream in order; element <code>b[off]</code> is the first
-     * byte written and <code>b[off+len-1]</code> is the last byte written
+     * Writes {@code len} bytes from the specified byte array
+     * starting at offset {@code off} to this output stream.
+     * The general contract for {@code write(b, off, len)} is that
+     * some of the bytes in the array {@code b} are written to the
+     * output stream in order; element {@code b[off]} is the first
+     * byte written and {@code b[off+len-1]} is the last byte written
      * by this operation.
      * <p>
-     * The <code>write</code> method of <code>OutputStream</code> calls
+     * The {@code write} method of {@code OutputStream} calls
      * the write method of one argument on each of the bytes to be
      * written out. Subclasses are encouraged to override this method and
      * provide a more efficient implementation.
      * <p>
-     * If <code>b</code> is <code>null</code>, a
-     * <code>NullPointerException</code> is thrown.
+     * If {@code b} is {@code null}, a
+     * {@code NullPointerException} is thrown.
      * <p>
-     * If <code>off</code> is negative, or <code>len</code> is negative, or
-     * <code>off+len</code> is greater than the length of the array
+     * If {@code off} is negative, or {@code len} is negative, or
+     * {@code off+len} is greater than the length of the array
      * {@code b}, then an {@code IndexOutOfBoundsException} is thrown.
      *
      * @param      b     the data.
      * @param      off   the start offset in the data.
      * @param      len   the number of bytes to write.
-     * @exception  IOException  if an I/O error occurs. In particular,
-     *             an <code>IOException</code> is thrown if the output
+     * @throws     IOException  if an I/O error occurs. In particular,
+     *             an {@code IOException} is thrown if the output
      *             stream is closed.
      */
     public void write(byte b[], int off, int len) throws IOException {
@@ -165,7 +165,7 @@
 
     /**
      * Flushes this output stream and forces any buffered output bytes
-     * to be written out. The general contract of <code>flush</code> is
+     * to be written out. The general contract of {@code flush} is
      * that calling it is an indication that, if any bytes previously
      * written have been buffered by the implementation of the output
      * stream, such bytes should immediately be written to their
@@ -177,22 +177,22 @@
      * passed to the operating system for writing; it does not guarantee that
      * they are actually written to a physical device such as a disk drive.
      * <p>
-     * The <code>flush</code> method of <code>OutputStream</code> does nothing.
+     * The {@code flush} method of {@code OutputStream} does nothing.
      *
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public void flush() throws IOException {
     }
 
     /**
      * Closes this output stream and releases any system resources
-     * associated with this stream. The general contract of <code>close</code>
+     * associated with this stream. The general contract of {@code close}
      * is that it closes the output stream. A closed stream cannot perform
      * output operations and cannot be reopened.
      * <p>
-     * The <code>close</code> method of <code>OutputStream</code> does nothing.
+     * The {@code close} method of {@code OutputStream} does nothing.
      *
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public void close() throws IOException {
     }
--- a/src/java.base/share/classes/java/io/OutputStreamWriter.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/OutputStreamWriter.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -87,7 +87,7 @@
      *         The name of a supported
      *         {@link java.nio.charset.Charset charset}
      *
-     * @exception  UnsupportedEncodingException
+     * @throws     UnsupportedEncodingException
      *             If the named encoding is not supported
      */
     public OutputStreamWriter(OutputStream out, String charsetName)
@@ -164,7 +164,7 @@
      * been closed. </p>
      *
      * @return The historical name of this encoding, or possibly
-     *         <code>null</code> if the stream has been closed
+     *         {@code null} if the stream has been closed
      *
      * @see java.nio.charset.Charset
      *
@@ -187,7 +187,7 @@
     /**
      * Writes a single character.
      *
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IOException  If an I/O error occurs
      */
     public void write(int c) throws IOException {
         se.write(c);
@@ -248,7 +248,7 @@
     /**
      * Flushes the stream.
      *
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IOException  If an I/O error occurs
      */
     public void flush() throws IOException {
         se.flush();
--- a/src/java.base/share/classes/java/io/PipedInputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/PipedInputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,9 +30,9 @@
  * to a piped output stream; the piped  input
  * stream then provides whatever data bytes
  * are written to the piped output  stream.
- * Typically, data is read from a <code>PipedInputStream</code>
+ * Typically, data is read from a {@code PipedInputStream}
  * object by one thread  and data is written
- * to the corresponding <code>PipedOutputStream</code>
+ * to the corresponding {@code PipedOutputStream}
  * by some  other thread. Attempting to use
  * both objects from a single thread is not
  * recommended, as it may deadlock the thread.
@@ -80,7 +80,7 @@
      * The index of the position in the circular buffer at which the
      * next byte of data will be stored when received from the connected
      * piped output stream. <code>in&lt;0</code> implies the buffer is empty,
-     * <code>in==out</code> implies the buffer is full
+     * {@code in==out} implies the buffer is full
      * @since   1.1
      */
     protected int in = -1;
@@ -93,31 +93,31 @@
     protected int out = 0;
 
     /**
-     * Creates a <code>PipedInputStream</code> so
+     * Creates a {@code PipedInputStream} so
      * that it is connected to the piped output
-     * stream <code>src</code>. Data bytes written
-     * to <code>src</code> will then be  available
+     * stream {@code src}. Data bytes written
+     * to {@code src} will then be  available
      * as input from this stream.
      *
      * @param      src   the stream to connect to.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public PipedInputStream(PipedOutputStream src) throws IOException {
         this(src, DEFAULT_PIPE_SIZE);
     }
 
     /**
-     * Creates a <code>PipedInputStream</code> so that it is
+     * Creates a {@code PipedInputStream} so that it is
      * connected to the piped output stream
-     * <code>src</code> and uses the specified pipe size for
+     * {@code src} and uses the specified pipe size for
      * the pipe's buffer.
-     * Data bytes written to <code>src</code> will then
+     * Data bytes written to {@code src} will then
      * be available as input from this stream.
      *
      * @param      src   the stream to connect to.
      * @param      pipeSize the size of the pipe's buffer.
-     * @exception  IOException  if an I/O error occurs.
-     * @exception  IllegalArgumentException if {@code pipeSize <= 0}.
+     * @throws     IOException  if an I/O error occurs.
+     * @throws     IllegalArgumentException if {@code pipeSize <= 0}.
      * @since      1.6
      */
     public PipedInputStream(PipedOutputStream src, int pipeSize)
@@ -127,27 +127,27 @@
     }
 
     /**
-     * Creates a <code>PipedInputStream</code> so
+     * Creates a {@code PipedInputStream} so
      * that it is not yet {@linkplain #connect(java.io.PipedOutputStream)
      * connected}.
      * It must be {@linkplain java.io.PipedOutputStream#connect(
      * java.io.PipedInputStream) connected} to a
-     * <code>PipedOutputStream</code> before being used.
+     * {@code PipedOutputStream} before being used.
      */
     public PipedInputStream() {
         initPipe(DEFAULT_PIPE_SIZE);
     }
 
     /**
-     * Creates a <code>PipedInputStream</code> so that it is not yet
+     * Creates a {@code PipedInputStream} so that it is not yet
      * {@linkplain #connect(java.io.PipedOutputStream) connected} and
      * uses the specified pipe size for the pipe's buffer.
      * It must be {@linkplain java.io.PipedOutputStream#connect(
      * java.io.PipedInputStream)
-     * connected} to a <code>PipedOutputStream</code> before being used.
+     * connected} to a {@code PipedOutputStream} before being used.
      *
      * @param      pipeSize the size of the pipe's buffer.
-     * @exception  IllegalArgumentException if {@code pipeSize <= 0}.
+     * @throws     IllegalArgumentException if {@code pipeSize <= 0}.
      * @since      1.6
      */
     public PipedInputStream(int pipeSize) {
@@ -163,26 +163,26 @@
 
     /**
      * Causes this piped input stream to be connected
-     * to the piped  output stream <code>src</code>.
+     * to the piped  output stream {@code src}.
      * If this object is already connected to some
-     * other piped output  stream, an <code>IOException</code>
+     * other piped output  stream, an {@code IOException}
      * is thrown.
      * <p>
-     * If <code>src</code> is an
-     * unconnected piped output stream and <code>snk</code>
+     * If {@code src} is an
+     * unconnected piped output stream and {@code snk}
      * is an unconnected piped input stream, they
      * may be connected by either the call:
      *
-     * <pre><code>snk.connect(src)</code> </pre>
+     * <pre>{@code snk.connect(src)} </pre>
      * <p>
      * or the call:
      *
-     * <pre><code>src.connect(snk)</code> </pre>
+     * <pre>{@code src.connect(snk)} </pre>
      * <p>
      * The two calls have the same effect.
      *
      * @param      src   The piped output stream to connect to.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public void connect(PipedOutputStream src) throws IOException {
         src.connect(this);
@@ -191,11 +191,11 @@
     /**
      * Receives a byte of data.  This method will block if no input is
      * available.
-     * @param b the byte being received
-     * @exception IOException If the pipe is <a href="#BROKEN"> <code>broken</code></a>,
+     * @param   b the byte being received
+     * @throws  IOException If the pipe is <a href="#BROKEN"> {@code broken}</a>,
      *          {@link #connect(java.io.PipedOutputStream) unconnected},
      *          closed, or if an I/O error occurs.
-     * @since     1.1
+     * @since   1.1
      */
     protected synchronized void receive(int b) throws IOException {
         checkStateForReceive();
@@ -215,10 +215,10 @@
     /**
      * Receives data into an array of bytes.  This method will
      * block until some input is available.
-     * @param b the buffer into which the data is received
-     * @param off the start offset of the data
-     * @param len the maximum number of bytes received
-     * @exception IOException If the pipe is <a href="#BROKEN"> broken</a>,
+     * @param    b the buffer into which the data is received
+     * @param    off the start offset of the data
+     * @param    len the maximum number of bytes received
+     * @throws   IOException If the pipe is <a href="#BROKEN"> broken</a>,
      *           {@link #connect(java.io.PipedOutputStream) unconnected},
      *           closed,or if an I/O error occurs.
      */
@@ -288,16 +288,16 @@
 
     /**
      * Reads the next byte of data from this piped input stream. The
-     * value byte is returned as an <code>int</code> in the range
-     * <code>0</code> to <code>255</code>.
+     * value byte is returned as an {@code int} in the range
+     * {@code 0} to {@code 255}.
      * This method blocks until input data is available, the end of the
      * stream is detected, or an exception is thrown.
      *
-     * @return     the next byte of data, or <code>-1</code> if the end of the
-     *             stream is reached.
-     * @exception  IOException  if the pipe is
+     * @return   the next byte of data, or {@code -1} if the end of the
+     *           stream is reached.
+     * @throws   IOException  if the pipe is
      *           {@link #connect(java.io.PipedOutputStream) unconnected},
-     *           <a href="#BROKEN"> <code>broken</code></a>, closed,
+     *           <a href="#BROKEN"> {@code broken}</a>, closed,
      *           or if an I/O error occurs.
      */
     public synchronized int read()  throws IOException {
@@ -341,26 +341,26 @@
     }
 
     /**
-     * Reads up to <code>len</code> bytes of data from this piped input
-     * stream into an array of bytes. Less than <code>len</code> bytes
+     * Reads up to {@code len} bytes of data from this piped input
+     * stream into an array of bytes. Less than {@code len} bytes
      * will be read if the end of the data stream is reached or if
-     * <code>len</code> exceeds the pipe's buffer size.
-     * If <code>len </code> is zero, then no bytes are read and 0 is returned;
+     * {@code len} exceeds the pipe's buffer size.
+     * If {@code len } is zero, then no bytes are read and 0 is returned;
      * otherwise, the method blocks until at least 1 byte of input is
      * available, end of the stream has been detected, or an exception is
      * thrown.
      *
      * @param      b     the buffer into which the data is read.
-     * @param      off   the start offset in the destination array <code>b</code>
+     * @param      off   the start offset in the destination array {@code b}
      * @param      len   the maximum number of bytes read.
      * @return     the total number of bytes read into the buffer, or
-     *             <code>-1</code> if there is no more data because the end of
+     *             {@code -1} if there is no more data because the end of
      *             the stream has been reached.
-     * @exception  NullPointerException If <code>b</code> is <code>null</code>.
-     * @exception  IndexOutOfBoundsException If <code>off</code> is negative,
-     * <code>len</code> is negative, or <code>len</code> is greater than
-     * <code>b.length - off</code>
-     * @exception  IOException if the pipe is <a href="#BROKEN"> <code>broken</code></a>,
+     * @throws     NullPointerException If {@code b} is {@code null}.
+     * @throws     IndexOutOfBoundsException If {@code off} is negative,
+     *             {@code len} is negative, or {@code len} is greater than
+     *             {@code b.length - off}
+     * @throws     IOException if the pipe is <a href="#BROKEN"> {@code broken}</a>,
      *           {@link #connect(java.io.PipedOutputStream) unconnected},
      *           closed, or if an I/O error occurs.
      */
@@ -418,10 +418,10 @@
      *         without blocking, or {@code 0} if this input stream has been
      *         closed by invoking its {@link #close()} method, or if the pipe
      *         is {@link #connect(java.io.PipedOutputStream) unconnected}, or
-     *          <a href="#BROKEN"> <code>broken</code></a>.
+     *         <a href="#BROKEN"> {@code broken}</a>.
      *
-     * @exception  IOException  if an I/O error occurs.
-     * @since   1.0.2
+     * @throws IOException  if an I/O error occurs.
+     * @since  1.0.2
      */
     public synchronized int available() throws IOException {
         if(in < 0)
@@ -438,7 +438,7 @@
      * Closes this piped input stream and releases any system resources
      * associated with the stream.
      *
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public void close()  throws IOException {
         closedByReader = true;
--- a/src/java.base/share/classes/java/io/PipedOutputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/PipedOutputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,8 @@
  * A piped output stream can be connected to a piped input stream
  * to create a communications pipe. The piped output stream is the
  * sending end of the pipe. Typically, data is written to a
- * <code>PipedOutputStream</code> object by one thread and data is
- * read from the connected <code>PipedInputStream</code> by some
+ * {@code PipedOutputStream} object by one thread and data is
+ * read from the connected {@code PipedInputStream} by some
  * other thread. Attempting to use both objects from a single thread
  * is not recommended as it may deadlock the thread.
  * The pipe is said to be <a id=BROKEN> <i>broken</i> </a> if a
@@ -55,10 +55,10 @@
     /**
      * Creates a piped output stream connected to the specified piped
      * input stream. Data bytes written to this stream will then be
-     * available as input from <code>snk</code>.
+     * available as input from {@code snk}.
      *
      * @param      snk   The piped input stream to connect to.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public PipedOutputStream(PipedInputStream snk)  throws IOException {
         connect(snk);
@@ -78,10 +78,10 @@
     /**
      * Connects this piped output stream to a receiver. If this object
      * is already connected to some other piped input stream, an
-     * <code>IOException</code> is thrown.
+     * {@code IOException} is thrown.
      * <p>
-     * If <code>snk</code> is an unconnected piped input stream and
-     * <code>src</code> is an unconnected piped output stream, they may
+     * If {@code snk} is an unconnected piped input stream and
+     * {@code src} is an unconnected piped output stream, they may
      * be connected by either the call:
      * <blockquote><pre>
      * src.connect(snk)</pre></blockquote>
@@ -91,7 +91,7 @@
      * The two calls have the same effect.
      *
      * @param      snk   the piped input stream to connect to.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public synchronized void connect(PipedInputStream snk) throws IOException {
         if (snk == null) {
@@ -106,12 +106,12 @@
     }
 
     /**
-     * Writes the specified <code>byte</code> to the piped output stream.
+     * Writes the specified {@code byte} to the piped output stream.
      * <p>
-     * Implements the <code>write</code> method of <code>OutputStream</code>.
+     * Implements the {@code write} method of {@code OutputStream}.
      *
-     * @param      b   the <code>byte</code> to be written.
-     * @exception IOException if the pipe is <a href=#BROKEN> broken</a>,
+     * @param   b   the {@code byte} to be written.
+     * @throws  IOException if the pipe is <a href=#BROKEN> broken</a>,
      *          {@link #connect(java.io.PipedInputStream) unconnected},
      *          closed, or if an I/O error occurs.
      */
@@ -123,15 +123,15 @@
     }
 
     /**
-     * Writes <code>len</code> bytes from the specified byte array
-     * starting at offset <code>off</code> to this piped output stream.
+     * Writes {@code len} bytes from the specified byte array
+     * starting at offset {@code off} to this piped output stream.
      * This method blocks until all the bytes are written to the output
      * stream.
      *
-     * @param      b     the data.
-     * @param      off   the start offset in the data.
-     * @param      len   the number of bytes to write.
-     * @exception IOException if the pipe is <a href=#BROKEN> broken</a>,
+     * @param   b     the data.
+     * @param   off   the start offset in the data.
+     * @param   len   the number of bytes to write.
+     * @throws  IOException if the pipe is <a href=#BROKEN> broken</a>,
      *          {@link #connect(java.io.PipedInputStream) unconnected},
      *          closed, or if an I/O error occurs.
      */
@@ -154,7 +154,7 @@
      * to be written out.
      * This will notify any readers that bytes are waiting in the pipe.
      *
-     * @exception IOException if an I/O error occurs.
+     * @throws    IOException if an I/O error occurs.
      */
     public synchronized void flush() throws IOException {
         if (sink != null) {
@@ -169,7 +169,7 @@
      * associated with this stream. This stream may no longer be used for
      * writing bytes.
      *
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public void close()  throws IOException {
         if (sink != null) {
--- a/src/java.base/share/classes/java/io/PipedReader.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/PipedReader.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -59,7 +59,7 @@
      * The index of the position in the circular buffer at which the
      * next character of data will be stored when received from the connected
      * piped writer. <code>in&lt;0</code> implies the buffer is empty,
-     * <code>in==out</code> implies the buffer is full
+     * {@code in==out} implies the buffer is full
      */
     int in = -1;
 
@@ -70,28 +70,28 @@
     int out = 0;
 
     /**
-     * Creates a <code>PipedReader</code> so
+     * Creates a {@code PipedReader} so
      * that it is connected to the piped writer
-     * <code>src</code>. Data written to <code>src</code>
+     * {@code src}. Data written to {@code src}
      * will then be available as input from this stream.
      *
      * @param      src   the stream to connect to.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public PipedReader(PipedWriter src) throws IOException {
         this(src, DEFAULT_PIPE_SIZE);
     }
 
     /**
-     * Creates a <code>PipedReader</code> so that it is connected
-     * to the piped writer <code>src</code> and uses the specified
-     * pipe size for the pipe's buffer. Data written to <code>src</code>
+     * Creates a {@code PipedReader} so that it is connected
+     * to the piped writer {@code src} and uses the specified
+     * pipe size for the pipe's buffer. Data written to {@code src}
      * will then be  available as input from this stream.
 
      * @param      src       the stream to connect to.
      * @param      pipeSize  the size of the pipe's buffer.
-     * @exception  IOException  if an I/O error occurs.
-     * @exception  IllegalArgumentException if {@code pipeSize <= 0}.
+     * @throws     IOException  if an I/O error occurs.
+     * @throws     IllegalArgumentException if {@code pipeSize <= 0}.
      * @since      1.6
      */
     public PipedReader(PipedWriter src, int pipeSize) throws IOException {
@@ -101,10 +101,10 @@
 
 
     /**
-     * Creates a <code>PipedReader</code> so
+     * Creates a {@code PipedReader} so
      * that it is not yet {@linkplain #connect(java.io.PipedWriter)
      * connected}. It must be {@linkplain java.io.PipedWriter#connect(
-     * java.io.PipedReader) connected} to a <code>PipedWriter</code>
+     * java.io.PipedReader) connected} to a {@code PipedWriter}
      * before being used.
      */
     public PipedReader() {
@@ -112,16 +112,16 @@
     }
 
     /**
-     * Creates a <code>PipedReader</code> so that it is not yet
+     * Creates a {@code PipedReader} so that it is not yet
      * {@link #connect(java.io.PipedWriter) connected} and uses
      * the specified pipe size for the pipe's buffer.
      * It must be  {@linkplain java.io.PipedWriter#connect(
-     * java.io.PipedReader) connected} to a <code>PipedWriter</code>
+     * java.io.PipedReader) connected} to a {@code PipedWriter}
      * before being used.
      *
      * @param   pipeSize the size of the pipe's buffer.
-     * @exception  IllegalArgumentException if {@code pipeSize <= 0}.
-     * @since      1.6
+     * @throws  IllegalArgumentException if {@code pipeSize <= 0}.
+     * @since   1.6
      */
     public PipedReader(int pipeSize) {
         initPipe(pipeSize);
@@ -136,26 +136,26 @@
 
     /**
      * Causes this piped reader to be connected
-     * to the piped  writer <code>src</code>.
+     * to the piped  writer {@code src}.
      * If this object is already connected to some
-     * other piped writer, an <code>IOException</code>
+     * other piped writer, an {@code IOException}
      * is thrown.
      * <p>
-     * If <code>src</code> is an
-     * unconnected piped writer and <code>snk</code>
+     * If {@code src} is an
+     * unconnected piped writer and {@code snk}
      * is an unconnected piped reader, they
      * may be connected by either the call:
      *
-     * <pre><code>snk.connect(src)</code> </pre>
+     * <pre>{@code snk.connect(src)} </pre>
      * <p>
      * or the call:
      *
-     * <pre><code>src.connect(snk)</code> </pre>
+     * <pre>{@code src.connect(snk)} </pre>
      * <p>
      * The two calls have the same effect.
      *
      * @param      src   The piped writer to connect to.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public void connect(PipedWriter src) throws IOException {
         src.connect(this);
@@ -219,14 +219,14 @@
     /**
      * Reads the next character of data from this piped stream.
      * If no character is available because the end of the stream
-     * has been reached, the value <code>-1</code> is returned.
+     * has been reached, the value {@code -1} is returned.
      * This method blocks until input data is available, the end of
      * the stream is detected, or an exception is thrown.
      *
-     * @return     the next character of data, or <code>-1</code> if the end of the
-     *             stream is reached.
-     * @exception  IOException  if the pipe is
-     *          <a href=PipedInputStream.html#BROKEN> <code>broken</code></a>,
+     * @return  the next character of data, or {@code -1} if the end of the
+     *          stream is reached.
+     * @throws  IOException  if the pipe is
+     *          <a href=PipedInputStream.html#BROKEN> {@code broken}</a>,
      *          {@link #connect(java.io.PipedWriter) unconnected}, closed,
      *          or an I/O error occurs.
      */
@@ -270,23 +270,23 @@
     }
 
     /**
-     * Reads up to <code>len</code> characters of data from this piped
-     * stream into an array of characters. Less than <code>len</code> characters
+     * Reads up to {@code len} characters of data from this piped
+     * stream into an array of characters. Less than {@code len} characters
      * will be read if the end of the data stream is reached or if
-     * <code>len</code> exceeds the pipe's buffer size. This method
+     * {@code len} exceeds the pipe's buffer size. This method
      * blocks until at least one character of input is available.
      *
      * @param      cbuf     the buffer into which the data is read.
      * @param      off   the start offset of the data.
      * @param      len   the maximum number of characters read.
      * @return     the total number of characters read into the buffer, or
-     *             <code>-1</code> if there is no more data because the end of
+     *             {@code -1} if there is no more data because the end of
      *             the stream has been reached.
-     * @exception  IOException  if the pipe is
-     *                  <a href=PipedInputStream.html#BROKEN> <code>broken</code></a>,
-     *                  {@link #connect(java.io.PipedWriter) unconnected}, closed,
-     *                  or an I/O error occurs.
-     * @exception  IndexOutOfBoundsException {@inheritDoc}
+     * @throws     IOException  if the pipe is
+     *             <a href=PipedInputStream.html#BROKEN> {@code broken}</a>,
+     *             {@link #connect(java.io.PipedWriter) unconnected}, closed,
+     *             or an I/O error occurs.
+     * @throws     IndexOutOfBoundsException {@inheritDoc}
      */
     public synchronized int read(char cbuf[], int off, int len)  throws IOException {
         if (!connected) {
@@ -330,9 +330,9 @@
      * Tell whether this stream is ready to be read.  A piped character
      * stream is ready if the circular buffer is not empty.
      *
-     * @exception  IOException  if the pipe is
-     *                  <a href=PipedInputStream.html#BROKEN> <code>broken</code></a>,
-     *                  {@link #connect(java.io.PipedWriter) unconnected}, or closed.
+     * @throws     IOException  if the pipe is
+     *             <a href=PipedInputStream.html#BROKEN> {@code broken}</a>,
+     *             {@link #connect(java.io.PipedWriter) unconnected}, or closed.
      */
     public synchronized boolean ready() throws IOException {
         if (!connected) {
@@ -354,7 +354,7 @@
      * Closes this piped stream and releases any system resources
      * associated with the stream.
      *
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public void close()  throws IOException {
         in = -1;
--- a/src/java.base/share/classes/java/io/PipedWriter.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/PipedWriter.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,10 +50,10 @@
     /**
      * Creates a piped writer connected to the specified piped
      * reader. Data characters written to this stream will then be
-     * available as input from <code>snk</code>.
+     * available as input from {@code snk}.
      *
      * @param      snk   The piped reader to connect to.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public PipedWriter(PipedReader snk)  throws IOException {
         connect(snk);
@@ -73,10 +73,10 @@
     /**
      * Connects this piped writer to a receiver. If this object
      * is already connected to some other piped reader, an
-     * <code>IOException</code> is thrown.
+     * {@code IOException} is thrown.
      * <p>
-     * If <code>snk</code> is an unconnected piped reader and
-     * <code>src</code> is an unconnected piped writer, they may
+     * If {@code snk} is an unconnected piped reader and
+     * {@code src} is an unconnected piped writer, they may
      * be connected by either the call:
      * <blockquote><pre>
      * src.connect(snk)</pre></blockquote>
@@ -86,7 +86,7 @@
      * The two calls have the same effect.
      *
      * @param      snk   the piped reader to connect to.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public synchronized void connect(PipedReader snk) throws IOException {
         if (snk == null) {
@@ -104,16 +104,16 @@
     }
 
     /**
-     * Writes the specified <code>char</code> to the piped output stream.
+     * Writes the specified {@code char} to the piped output stream.
      * If a thread was reading data characters from the connected piped input
      * stream, but the thread is no longer alive, then an
-     * <code>IOException</code> is thrown.
+     * {@code IOException} is thrown.
      * <p>
-     * Implements the <code>write</code> method of <code>Writer</code>.
+     * Implements the {@code write} method of {@code Writer}.
      *
-     * @param      c   the <code>char</code> to be written.
-     * @exception  IOException  if the pipe is
-     *          <a href=PipedOutputStream.html#BROKEN> <code>broken</code></a>,
+     * @param   c   the {@code char} to be written.
+     * @throw   IOException  if the pipe is
+     *          <a href=PipedOutputStream.html#BROKEN> {@code broken}</a>,
      *          {@link #connect(java.io.PipedReader) unconnected}, closed
      *          or an I/O error occurs.
      */
@@ -133,9 +133,9 @@
      * stream, but the thread is no longer alive, then an
      * {@code IOException} is thrown.
      *
-     * @param      cbuf  the data.
-     * @param      off   the start offset in the data.
-     * @param      len   the number of characters to write.
+     * @param   cbuf  the data.
+     * @param   off   the start offset in the data.
+     * @param   len   the number of characters to write.
      *
      * @throws  IndexOutOfBoundsException
      *          If {@code off} is negative, or {@code len} is negative,
@@ -143,7 +143,7 @@
      *          of the given array
      *
      * @throws  IOException  if the pipe is
-     *          <a href=PipedOutputStream.html#BROKEN><code>broken</code></a>,
+     *          <a href=PipedOutputStream.html#BROKEN>{@code broken}</a>,
      *          {@link #connect(java.io.PipedReader) unconnected}, closed
      *          or an I/O error occurs.
      */
@@ -161,7 +161,7 @@
      * to be written out.
      * This will notify any readers that characters are waiting in the pipe.
      *
-     * @exception  IOException  if the pipe is closed, or an I/O error occurs.
+     * @throws     IOException  if the pipe is closed, or an I/O error occurs.
      */
     public synchronized void flush() throws IOException {
         if (sink != null) {
@@ -179,7 +179,7 @@
      * associated with this stream. This stream may no longer be used for
      * writing characters.
      *
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public void close()  throws IOException {
         closed = true;
--- a/src/java.base/share/classes/java/io/PushbackInputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/PushbackInputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -26,7 +26,7 @@
 package java.io;
 
 /**
- * A <code>PushbackInputStream</code> adds
+ * A {@code PushbackInputStream} adds
  * functionality to another input stream, namely
  * the  ability to "push back" or "unread" bytes,
  * by storing pushed-back bytes in an internal buffer.
@@ -59,8 +59,8 @@
 
     /**
      * The position within the pushback buffer from which the next byte will
-     * be read.  When the buffer is empty, <code>pos</code> is equal to
-     * <code>buf.length</code>; when the buffer is full, <code>pos</code> is
+     * be read.  When the buffer is empty, {@code pos} is equal to
+     * {@code buf.length}; when the buffer is full, {@code pos} is
      * equal to zero.
      *
      * @since   1.1
@@ -76,15 +76,15 @@
     }
 
     /**
-     * Creates a <code>PushbackInputStream</code>
-     * with a pushback buffer of the specified <code>size</code>,
+     * Creates a {@code PushbackInputStream}
+     * with a pushback buffer of the specified {@code size},
      * and saves its argument, the input stream
-     * <code>in</code>, for later use. Initially,
+     * {@code in}, for later use. Initially,
      * the pushback buffer is empty.
      *
      * @param  in    the input stream from which bytes will be read.
      * @param  size  the size of the pushback buffer.
-     * @exception IllegalArgumentException if {@code size <= 0}
+     * @throws IllegalArgumentException if {@code size <= 0}
      * @since  1.1
      */
     public PushbackInputStream(InputStream in, int size) {
@@ -97,9 +97,9 @@
     }
 
     /**
-     * Creates a <code>PushbackInputStream</code>
+     * Creates a {@code PushbackInputStream}
      * with a 1-byte pushback buffer, and saves its argument, the input stream
-     * <code>in</code>, for later use. Initially,
+     * {@code in}, for later use. Initially,
      * the pushback buffer is empty.
      *
      * @param   in   the input stream from which bytes will be read.
@@ -110,20 +110,20 @@
 
     /**
      * Reads the next byte of data from this input stream. The value
-     * byte is returned as an <code>int</code> in the range
-     * <code>0</code> to <code>255</code>. If no byte is available
+     * byte is returned as an {@code int} in the range
+     * {@code 0} to {@code 255}. If no byte is available
      * because the end of the stream has been reached, the value
-     * <code>-1</code> is returned. This method blocks until input data
+     * {@code -1} is returned. This method blocks until input data
      * is available, the end of the stream is detected, or an exception
      * is thrown.
      *
      * <p> This method returns the most recently pushed-back byte, if there is
-     * one, and otherwise calls the <code>read</code> method of its underlying
+     * one, and otherwise calls the {@code read} method of its underlying
      * input stream and returns whatever value that method returns.
      *
-     * @return     the next byte of data, or <code>-1</code> if the end of the
+     * @return     the next byte of data, or {@code -1} if the end of the
      *             stream has been reached.
-     * @exception  IOException  if this input stream has been closed by
+     * @throws     IOException  if this input stream has been closed by
      *             invoking its {@link #close()} method,
      *             or an I/O error occurs.
      * @see        java.io.InputStream#read()
@@ -137,24 +137,24 @@
     }
 
     /**
-     * Reads up to <code>len</code> bytes of data from this input stream into
+     * Reads up to {@code len} bytes of data from this input stream into
      * an array of bytes.  This method first reads any pushed-back bytes; after
-     * that, if fewer than <code>len</code> bytes have been read then it
-     * reads from the underlying input stream. If <code>len</code> is not zero, the method
+     * that, if fewer than {@code len} bytes have been read then it
+     * reads from the underlying input stream. If {@code len} is not zero, the method
      * blocks until at least 1 byte of input is available; otherwise, no
-     * bytes are read and <code>0</code> is returned.
+     * bytes are read and {@code 0} is returned.
      *
      * @param      b     the buffer into which the data is read.
-     * @param      off   the start offset in the destination array <code>b</code>
+     * @param      off   the start offset in the destination array {@code b}
      * @param      len   the maximum number of bytes read.
      * @return     the total number of bytes read into the buffer, or
-     *             <code>-1</code> if there is no more data because the end of
+     *             {@code -1} if there is no more data because the end of
      *             the stream has been reached.
-     * @exception  NullPointerException If <code>b</code> is <code>null</code>.
-     * @exception  IndexOutOfBoundsException If <code>off</code> is negative,
-     * <code>len</code> is negative, or <code>len</code> is greater than
-     * <code>b.length - off</code>
-     * @exception  IOException  if this input stream has been closed by
+     * @throws     NullPointerException If {@code b} is {@code null}.
+     * @throws     IndexOutOfBoundsException If {@code off} is negative,
+     *             {@code len} is negative, or {@code len} is greater than
+     *             {@code b.length - off}
+     * @throws     IOException  if this input stream has been closed by
      *             invoking its {@link #close()} method,
      *             or an I/O error occurs.
      * @see        java.io.InputStream#read(byte[], int, int)
@@ -192,11 +192,11 @@
     /**
      * Pushes back a byte by copying it to the front of the pushback buffer.
      * After this method returns, the next byte to be read will have the value
-     * <code>(byte)b</code>.
+     * {@code (byte)b}.
      *
-     * @param      b   the <code>int</code> value whose low-order
+     * @param      b   the {@code int} value whose low-order
      *                  byte is to be pushed back.
-     * @exception IOException If there is not enough room in the pushback
+     * @throws    IOException If there is not enough room in the pushback
      *            buffer for the byte, or this input stream has been closed by
      *            invoking its {@link #close()} method.
      */
@@ -211,14 +211,14 @@
     /**
      * Pushes back a portion of an array of bytes by copying it to the front
      * of the pushback buffer.  After this method returns, the next byte to be
-     * read will have the value <code>b[off]</code>, the byte after that will
-     * have the value <code>b[off+1]</code>, and so forth.
+     * read will have the value {@code b[off]}, the byte after that will
+     * have the value {@code b[off+1]}, and so forth.
      *
-     * @param b the byte array to push back.
-     * @param off the start offset of the data.
-     * @param len the number of bytes to push back.
-     * @exception NullPointerException If <code>b</code> is <code>null</code>.
-     * @exception IOException If there is not enough room in the pushback
+     * @param     b the byte array to push back.
+     * @param     off the start offset of the data.
+     * @param     len the number of bytes to push back.
+     * @throws    NullPointerException If {@code b} is {@code null}.
+     * @throws    IOException If there is not enough room in the pushback
      *            buffer for the specified number of bytes,
      *            or this input stream has been closed by
      *            invoking its {@link #close()} method.
@@ -236,12 +236,12 @@
     /**
      * Pushes back an array of bytes by copying it to the front of the
      * pushback buffer.  After this method returns, the next byte to be read
-     * will have the value <code>b[0]</code>, the byte after that will have the
-     * value <code>b[1]</code>, and so forth.
+     * will have the value {@code b[0]}, the byte after that will have the
+     * value {@code b[1]}, and so forth.
      *
-     * @param b the byte array to push back
-     * @exception NullPointerException If <code>b</code> is <code>null</code>.
-     * @exception IOException If there is not enough room in the pushback
+     * @param     b the byte array to push back
+     * @throws    NullPointerException If {@code b} is {@code null}.
+     * @throws    IOException If there is not enough room in the pushback
      *            buffer for the specified number of bytes,
      *            or this input stream has been closed by
      *            invoking its {@link #close()} method.
@@ -264,7 +264,7 @@
      *
      * @return     the number of bytes that can be read (or skipped over) from
      *             the input stream without blocking.
-     * @exception  IOException  if this input stream has been closed by
+     * @throws     IOException  if this input stream has been closed by
      *             invoking its {@link #close()} method,
      *             or an I/O error occurs.
      * @see        java.io.FilterInputStream#in
@@ -280,14 +280,14 @@
     }
 
     /**
-     * Skips over and discards <code>n</code> bytes of data from this
-     * input stream. The <code>skip</code> method may, for a variety of
+     * Skips over and discards {@code n} bytes of data from this
+     * input stream. The {@code skip} method may, for a variety of
      * reasons, end up skipping over some smaller number of bytes,
-     * possibly zero.  If <code>n</code> is negative, no bytes are skipped.
+     * possibly zero.  If {@code n} is negative, no bytes are skipped.
      *
-     * <p> The <code>skip</code> method of <code>PushbackInputStream</code>
+     * <p> The {@code skip} method of {@code PushbackInputStream}
      * first skips over the bytes in the pushback buffer, if any.  It then
-     * calls the <code>skip</code> method of the underlying input stream if
+     * calls the {@code skip} method of the underlying input stream if
      * more bytes need to be skipped.  The actual number of bytes skipped
      * is returned.
      *
@@ -322,13 +322,13 @@
     }
 
     /**
-     * Tests if this input stream supports the <code>mark</code> and
-     * <code>reset</code> methods, which it does not.
+     * Tests if this input stream supports the {@code mark} and
+     * {@code reset} methods, which it does not.
      *
-     * @return   <code>false</code>, since this class does not support the
-     *           <code>mark</code> and <code>reset</code> methods.
-     * @see     java.io.InputStream#mark(int)
-     * @see     java.io.InputStream#reset()
+     * @return   {@code false}, since this class does not support the
+     *           {@code mark} and {@code reset} methods.
+     * @see      java.io.InputStream#mark(int)
+     * @see      java.io.InputStream#reset()
      */
     public boolean markSupported() {
         return false;
@@ -337,7 +337,7 @@
     /**
      * Marks the current position in this input stream.
      *
-     * <p> The <code>mark</code> method of <code>PushbackInputStream</code>
+     * <p> The {@code mark} method of {@code PushbackInputStream}
      * does nothing.
      *
      * @param   readlimit   the maximum limit of bytes that can be read before
@@ -349,13 +349,13 @@
 
     /**
      * Repositions this stream to the position at the time the
-     * <code>mark</code> method was last called on this input stream.
+     * {@code mark} method was last called on this input stream.
      *
-     * <p> The method <code>reset</code> for class
-     * <code>PushbackInputStream</code> does nothing except throw an
-     * <code>IOException</code>.
+     * <p> The method {@code reset} for class
+     * {@code PushbackInputStream} does nothing except throw an
+     * {@code IOException}.
      *
-     * @exception  IOException  if this method is invoked.
+     * @throws  IOException  if this method is invoked.
      * @see     java.io.InputStream#mark(int)
      * @see     java.io.IOException
      */
@@ -370,7 +370,7 @@
      * available(), reset(), or skip() invocations will throw an IOException.
      * Closing a previously closed stream has no effect.
      *
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public synchronized void close() throws IOException {
         if (in == null)
--- a/src/java.base/share/classes/java/io/PushbackReader.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/PushbackReader.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,7 +47,7 @@
      *
      * @param   in   The reader from which characters will be read
      * @param   size The size of the pushback buffer
-     * @exception IllegalArgumentException if {@code size <= 0}
+     * @throws  IllegalArgumentException if {@code size <= 0}
      */
     public PushbackReader(Reader in, int size) {
         super(in);
@@ -79,7 +79,7 @@
      * @return     The character read, or -1 if the end of the stream has been
      *             reached
      *
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IOException  If an I/O error occurs
      */
     public int read() throws IOException {
         synchronized (lock) {
@@ -101,8 +101,8 @@
      * @return     The number of characters read, or -1 if the end of the
      *             stream has been reached
      *
-     * @exception  IOException  If an I/O error occurs
-     * @exception  IndexOutOfBoundsException {@inheritDoc}
+     * @throws     IOException  If an I/O error occurs
+     * @throws     IndexOutOfBoundsException {@inheritDoc}
      */
     public int read(char cbuf[], int off, int len) throws IOException {
         synchronized (lock) {
@@ -142,12 +142,12 @@
     /**
      * Pushes back a single character by copying it to the front of the
      * pushback buffer. After this method returns, the next character to be read
-     * will have the value <code>(char)c</code>.
+     * will have the value {@code (char)c}.
      *
      * @param  c  The int value representing a character to be pushed back
      *
-     * @exception  IOException  If the pushback buffer is full,
-     *                          or if some other I/O error occurs
+     * @throws IOException  If the pushback buffer is full,
+     *                      or if some other I/O error occurs
      */
     public void unread(int c) throws IOException {
         synchronized (lock) {
@@ -161,15 +161,15 @@
     /**
      * Pushes back a portion of an array of characters by copying it to the
      * front of the pushback buffer.  After this method returns, the next
-     * character to be read will have the value <code>cbuf[off]</code>, the
-     * character after that will have the value <code>cbuf[off+1]</code>, and
+     * character to be read will have the value {@code cbuf[off]}, the
+     * character after that will have the value {@code cbuf[off+1]}, and
      * so forth.
      *
-     * @param  cbuf  Character array
-     * @param  off   Offset of first character to push back
-     * @param  len   Number of characters to push back
+     * @param      cbuf  Character array
+     * @param      off   Offset of first character to push back
+     * @param      len   Number of characters to push back
      *
-     * @exception  IOException  If there is insufficient room in the pushback
+     * @throws     IOException  If there is insufficient room in the pushback
      *                          buffer, or if some other I/O error occurs
      */
     public void unread(char cbuf[], int off, int len) throws IOException {
@@ -185,12 +185,12 @@
     /**
      * Pushes back an array of characters by copying it to the front of the
      * pushback buffer.  After this method returns, the next character to be
-     * read will have the value <code>cbuf[0]</code>, the character after that
-     * will have the value <code>cbuf[1]</code>, and so forth.
+     * read will have the value {@code cbuf[0]}, the character after that
+     * will have the value {@code cbuf[1]}, and so forth.
      *
-     * @param  cbuf  Character array to push back
+     * @param      cbuf  Character array to push back
      *
-     * @exception  IOException  If there is insufficient room in the pushback
+     * @throws     IOException  If there is insufficient room in the pushback
      *                          buffer, or if some other I/O error occurs
      */
     public void unread(char cbuf[]) throws IOException {
@@ -200,7 +200,7 @@
     /**
      * Tells whether this stream is ready to be read.
      *
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IOException  If an I/O error occurs
      */
     public boolean ready() throws IOException {
         synchronized (lock) {
@@ -210,20 +210,20 @@
     }
 
     /**
-     * Marks the present position in the stream. The <code>mark</code>
-     * for class <code>PushbackReader</code> always throws an exception.
+     * Marks the present position in the stream. The {@code mark}
+     * for class {@code PushbackReader} always throws an exception.
      *
-     * @exception  IOException  Always, since mark is not supported
+     * @throws     IOException  Always, since mark is not supported
      */
     public void mark(int readAheadLimit) throws IOException {
         throw new IOException("mark/reset not supported");
     }
 
     /**
-     * Resets the stream. The <code>reset</code> method of
-     * <code>PushbackReader</code> always throws an exception.
+     * Resets the stream. The {@code reset} method of
+     * {@code PushbackReader} always throws an exception.
      *
-     * @exception  IOException  Always, since reset is not supported
+     * @throws     IOException  Always, since reset is not supported
      */
     public void reset() throws IOException {
         throw new IOException("mark/reset not supported");
@@ -244,7 +244,7 @@
      * Closing a previously closed stream has no effect. This method will block
      * while there is another thread blocking on the reader.
      *
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IOException  If an I/O error occurs
      */
     public void close() throws IOException {
         synchronized (lock) {
@@ -257,12 +257,12 @@
      * Skips characters.  This method will block until some characters are
      * available, an I/O error occurs, or the end of the stream is reached.
      *
-     * @param  n  The number of characters to skip
+     * @param     n  The number of characters to skip
      *
      * @return    The number of characters actually skipped
      *
-     * @exception  IllegalArgumentException  If <code>n</code> is negative.
-     * @exception  IOException  If an I/O error occurs
+     * @throws    IllegalArgumentException  If {@code n} is negative.
+     * @throws    IOException  If an I/O error occurs
      */
     public long skip(long n) throws IOException {
         if (n < 0L)
--- a/src/java.base/share/classes/java/io/RandomAccessFile.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/RandomAccessFile.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -103,17 +103,17 @@
      *
      * @param      name   the system-dependent filename
      * @param      mode   the access <a href="#mode">mode</a>
-     * @exception  IllegalArgumentException  if the mode argument is not equal
+     * @throws     IllegalArgumentException  if the mode argument is not equal
      *             to one of {@code "r"}, {@code "rw"}, {@code "rws"}, or
      *             {@code "rwd"}
-     * @exception FileNotFoundException
-     *            if the mode is {@code "r"} but the given string does not
-     *            denote an existing regular file, or if the mode begins with
-     *            {@code "rw"} but the given string does not denote an
-     *            existing, writable regular file and a new regular file of
-     *            that name cannot be created, or if some other error occurs
-     *            while opening or creating the file
-     * @exception  SecurityException   if a security manager exists and its
+     * @throws     FileNotFoundException
+     *             if the mode is {@code "r"} but the given string does not
+     *             denote an existing regular file, or if the mode begins with
+     *             {@code "rw"} but the given string does not denote an
+     *             existing, writable regular file and a new regular file of
+     *             that name cannot be created, or if some other error occurs
+     *             while opening or creating the file
+     * @throws      SecurityException   if a security manager exists and its
      *             {@code checkRead} method denies read access to the file
      *             or the mode is {@code "rw"} and the security manager's
      *             {@code checkWrite} method denies write access to the file
@@ -190,17 +190,17 @@
      * @param      file   the file object
      * @param      mode   the access mode, as described
      *                    <a href="#mode">above</a>
-     * @exception  IllegalArgumentException  if the mode argument is not equal
+     * @throws     IllegalArgumentException  if the mode argument is not equal
      *             to one of {@code "r"}, {@code "rw"}, {@code "rws"}, or
      *             {@code "rwd"}
-     * @exception FileNotFoundException
-     *            if the mode is {@code "r"} but the given file object does
-     *            not denote an existing regular file, or if the mode begins
-     *            with {@code "rw"} but the given file object does not denote
-     *            an existing, writable regular file and a new regular file of
-     *            that name cannot be created, or if some other error occurs
-     *            while opening or creating the file
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     FileNotFoundException
+     *             if the mode is {@code "r"} but the given file object does
+     *             not denote an existing regular file, or if the mode begins
+     *             with {@code "rw"} but the given file object does not denote
+     *             an existing, writable regular file and a new regular file of
+     *             that name cannot be created, or if some other error occurs
+     *             while opening or creating the file
+     * @throws      SecurityException  if a security manager exists and its
      *             {@code checkRead} method denies read access to the file
      *             or the mode is {@code "rw"} and the security manager's
      *             {@code checkWrite} method denies write access to the file
@@ -267,7 +267,7 @@
      * stream.
      *
      * @return     the file descriptor object associated with this stream.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.FileDescriptor
      */
     public final FileDescriptor getFD() throws IOException {
@@ -361,7 +361,7 @@
      *
      * @return     the next byte of data, or {@code -1} if the end of the
      *             file has been reached.
-     * @exception  IOException  if an I/O error occurs. Not thrown if
+     * @throws     IOException  if an I/O error occurs. Not thrown if
      *                          end-of-file has been reached.
      */
     public int read() throws IOException {
@@ -372,10 +372,10 @@
 
     /**
      * Reads a sub array as a sequence of bytes.
-     * @param b the buffer into which the data is read.
-     * @param off the start offset of the data.
-     * @param len the number of bytes to read.
-     * @exception IOException If an I/O error has occurred.
+     * @param     b the buffer into which the data is read.
+     * @param     off the start offset of the data.
+     * @param     len the number of bytes to read.
+     * @throws    IOException If an I/O error has occurred.
      */
     private native int readBytes(byte b[], int off, int len) throws IOException;
 
@@ -396,13 +396,13 @@
      * @return     the total number of bytes read into the buffer, or
      *             {@code -1} if there is no more data because the end of
      *             the file has been reached.
-     * @exception  IOException If the first byte cannot be read for any reason
-     * other than end of file, or if the random access file has been closed, or if
-     * some other I/O error occurs.
-     * @exception  NullPointerException If {@code b} is {@code null}.
-     * @exception  IndexOutOfBoundsException If {@code off} is negative,
-     * {@code len} is negative, or {@code len} is greater than
-     * {@code b.length - off}
+     * @throws     IOException If the first byte cannot be read for any reason
+     *             other than end of file, or if the random access file has been closed,
+     *             or if some other I/O error occurs.
+     * @throws     NullPointerException If {@code b} is {@code null}.
+     * @throws     IndexOutOfBoundsException If {@code off} is negative,
+     *             {@code len} is negative, or {@code len} is greater than
+     *             {@code b.length - off}
      */
     public int read(byte b[], int off, int len) throws IOException {
         return readBytes(b, off, len);
@@ -422,10 +422,10 @@
      * @return     the total number of bytes read into the buffer, or
      *             {@code -1} if there is no more data because the end of
      *             this file has been reached.
-     * @exception  IOException If the first byte cannot be read for any reason
-     * other than end of file, or if the random access file has been closed, or if
-     * some other I/O error occurs.
-     * @exception  NullPointerException If {@code b} is {@code null}.
+     * @throws     IOException If the first byte cannot be read for any reason
+     *             other than end of file, or if the random access file has been closed,
+     *             or if some other I/O error occurs.
+     * @throws     NullPointerException If {@code b} is {@code null}.
      */
     public int read(byte b[]) throws IOException {
         return readBytes(b, 0, b.length);
@@ -490,7 +490,7 @@
      *
      * @param      n   the number of bytes to be skipped.
      * @return     the actual number of bytes skipped.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public int skipBytes(int n) throws IOException {
         long pos;
@@ -519,7 +519,7 @@
      * the current file pointer.
      *
      * @param      b   the {@code byte} to be written.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public void write(int b) throws IOException {
         write0(b);
@@ -529,11 +529,11 @@
 
     /**
      * Writes a sub array as a sequence of bytes.
-     * @param b the data to be written
+     * @param     b the data to be written
 
-     * @param off the start offset in the data
-     * @param len the number of bytes that are written
-     * @exception IOException If an I/O error has occurred.
+     * @param     off the start offset in the data
+     * @param     len the number of bytes that are written
+     * @throws    IOException If an I/O error has occurred.
      */
     private native void writeBytes(byte b[], int off, int len) throws IOException;
 
@@ -542,7 +542,7 @@
      * to this file, starting at the current file pointer.
      *
      * @param      b   the data.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public void write(byte b[]) throws IOException {
         writeBytes(b, 0, b.length);
@@ -555,7 +555,7 @@
      * @param      b     the data.
      * @param      off   the start offset in the data.
      * @param      len   the number of bytes to write.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public void write(byte b[], int off, int len) throws IOException {
         writeBytes(b, off, len);
@@ -568,7 +568,7 @@
      *
      * @return     the offset from the beginning of the file, in bytes,
      *             at which the next read or write occurs.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public native long getFilePointer() throws IOException;
 
@@ -583,7 +583,7 @@
      * @param      pos   the offset position, measured in bytes from the
      *                   beginning of the file, at which to set the file
      *                   pointer.
-     * @exception  IOException  if {@code pos} is less than
+     * @throws     IOException  if {@code pos} is less than
      *                          {@code 0} or if an I/O error occurs.
      */
     public void seek(long pos) throws IOException {
@@ -600,7 +600,7 @@
      * Returns the length of this file.
      *
      * @return     the length of this file, measured in bytes.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public native long length() throws IOException;
 
@@ -620,7 +620,7 @@
      * the extended portion of the file are not defined.
      *
      * @param      newLength    The desired length of the file
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IOException  If an I/O error occurs
      * @since      1.2
      */
     public native void setLength(long newLength) throws IOException;
@@ -634,7 +634,7 @@
      * <p> If this file has an associated channel then the channel is closed
      * as well.
      *
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      *
      * @revised 1.4
      * @spec JSR-51
@@ -678,8 +678,8 @@
      * is detected, or an exception is thrown.
      *
      * @return     the {@code boolean} value read.
-     * @exception  EOFException  if this file has reached the end.
-     * @exception  IOException   if an I/O error occurs.
+     * @throws     EOFException  if this file has reached the end.
+     * @throws     IOException   if an I/O error occurs.
      */
     public final boolean readBoolean() throws IOException {
         int ch = this.read();
@@ -703,8 +703,8 @@
      *
      * @return     the next byte of this file as a signed eight-bit
      *             {@code byte}.
-     * @exception  EOFException  if this file has reached the end.
-     * @exception  IOException   if an I/O error occurs.
+     * @throws     EOFException  if this file has reached the end.
+     * @throws     IOException   if an I/O error occurs.
      */
     public final byte readByte() throws IOException {
         int ch = this.read();
@@ -723,8 +723,8 @@
      *
      * @return     the next byte of this file, interpreted as an unsigned
      *             eight-bit number.
-     * @exception  EOFException  if this file has reached the end.
-     * @exception  IOException   if an I/O error occurs.
+     * @throws     EOFException  if this file has reached the end.
+     * @throws     IOException   if an I/O error occurs.
      */
     public final int readUnsignedByte() throws IOException {
         int ch = this.read();
@@ -749,9 +749,9 @@
      *
      * @return     the next two bytes of this file, interpreted as a signed
      *             16-bit number.
-     * @exception  EOFException  if this file reaches the end before reading
+     * @throws     EOFException  if this file reaches the end before reading
      *               two bytes.
-     * @exception  IOException   if an I/O error occurs.
+     * @throws     IOException   if an I/O error occurs.
      */
     public final short readShort() throws IOException {
         int ch1 = this.read();
@@ -777,9 +777,9 @@
      *
      * @return     the next two bytes of this file, interpreted as an unsigned
      *             16-bit integer.
-     * @exception  EOFException  if this file reaches the end before reading
+     * @throws     EOFException  if this file reaches the end before reading
      *               two bytes.
-     * @exception  IOException   if an I/O error occurs.
+     * @throws     IOException   if an I/O error occurs.
      */
     public final int readUnsignedShort() throws IOException {
         int ch1 = this.read();
@@ -805,9 +805,9 @@
      *
      * @return     the next two bytes of this file, interpreted as a
      *                  {@code char}.
-     * @exception  EOFException  if this file reaches the end before reading
+     * @throws     EOFException  if this file reaches the end before reading
      *               two bytes.
-     * @exception  IOException   if an I/O error occurs.
+     * @throws     IOException   if an I/O error occurs.
      */
     public final char readChar() throws IOException {
         int ch1 = this.read();
@@ -833,9 +833,9 @@
      *
      * @return     the next four bytes of this file, interpreted as an
      *             {@code int}.
-     * @exception  EOFException  if this file reaches the end before reading
+     * @throws     EOFException  if this file reaches the end before reading
      *               four bytes.
-     * @exception  IOException   if an I/O error occurs.
+     * @throws     IOException   if an I/O error occurs.
      */
     public final int readInt() throws IOException {
         int ch1 = this.read();
@@ -871,9 +871,9 @@
      *
      * @return     the next eight bytes of this file, interpreted as a
      *             {@code long}.
-     * @exception  EOFException  if this file reaches the end before reading
+     * @throws     EOFException  if this file reaches the end before reading
      *               eight bytes.
-     * @exception  IOException   if an I/O error occurs.
+     * @throws     IOException   if an I/O error occurs.
      */
     public final long readLong() throws IOException {
         return ((long)(readInt()) << 32) + (readInt() & 0xFFFFFFFFL);
@@ -892,9 +892,9 @@
      *
      * @return     the next four bytes of this file, interpreted as a
      *             {@code float}.
-     * @exception  EOFException  if this file reaches the end before reading
+     * @throws     EOFException  if this file reaches the end before reading
      *             four bytes.
-     * @exception  IOException   if an I/O error occurs.
+     * @throws     IOException   if an I/O error occurs.
      * @see        java.io.RandomAccessFile#readInt()
      * @see        java.lang.Float#intBitsToFloat(int)
      */
@@ -915,9 +915,9 @@
      *
      * @return     the next eight bytes of this file, interpreted as a
      *             {@code double}.
-     * @exception  EOFException  if this file reaches the end before reading
+     * @throws     EOFException  if this file reaches the end before reading
      *             eight bytes.
-     * @exception  IOException   if an I/O error occurs.
+     * @throws     IOException   if an I/O error occurs.
      * @see        java.io.RandomAccessFile#readLong()
      * @see        java.lang.Double#longBitsToDouble(long)
      */
@@ -946,7 +946,7 @@
      *
      * @return     the next line of text from this file, or null if end
      *             of file is encountered before even one byte is read.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
 
     public final String readLine() throws IOException {
@@ -997,10 +997,10 @@
      * stream is detected, or an exception is thrown.
      *
      * @return     a Unicode string.
-     * @exception  EOFException            if this file reaches the end before
+     * @throws     EOFException            if this file reaches the end before
      *               reading all the bytes.
-     * @exception  IOException             if an I/O error occurs.
-     * @exception  UTFDataFormatException  if the bytes do not represent
+     * @throws     IOException             if an I/O error occurs.
+     * @throws     UTFDataFormatException  if the bytes do not represent
      *               valid modified UTF-8 encoding of a Unicode string.
      * @see        java.io.RandomAccessFile#readUnsignedShort()
      */
@@ -1016,7 +1016,7 @@
      * the current position of the file pointer.
      *
      * @param      v   a {@code boolean} value to be written.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public final void writeBoolean(boolean v) throws IOException {
         write(v ? 1 : 0);
@@ -1028,7 +1028,7 @@
      * write starts at the current position of the file pointer.
      *
      * @param      v   a {@code byte} value to be written.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public final void writeByte(int v) throws IOException {
         write(v);
@@ -1040,7 +1040,7 @@
      * The write starts at the current position of the file pointer.
      *
      * @param      v   a {@code short} to be written.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public final void writeShort(int v) throws IOException {
         write((v >>> 8) & 0xFF);
@@ -1054,7 +1054,7 @@
      * file pointer.
      *
      * @param      v   a {@code char} value to be written.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public final void writeChar(int v) throws IOException {
         write((v >>> 8) & 0xFF);
@@ -1067,7 +1067,7 @@
      * The write starts at the current position of the file pointer.
      *
      * @param      v   an {@code int} to be written.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public final void writeInt(int v) throws IOException {
         write((v >>> 24) & 0xFF);
@@ -1082,7 +1082,7 @@
      * The write starts at the current position of the file pointer.
      *
      * @param      v   a {@code long} to be written.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public final void writeLong(long v) throws IOException {
         write((int)(v >>> 56) & 0xFF);
@@ -1104,7 +1104,7 @@
      * current position of the file pointer.
      *
      * @param      v   a {@code float} value to be written.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.lang.Float#floatToIntBits(float)
      */
     public final void writeFloat(float v) throws IOException {
@@ -1119,7 +1119,7 @@
      * position of the file pointer.
      *
      * @param      v   a {@code double} value to be written.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.lang.Double#doubleToLongBits(double)
      */
     public final void writeDouble(double v) throws IOException {
@@ -1133,7 +1133,7 @@
      * the file pointer.
      *
      * @param      s   a string of bytes to be written.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     @SuppressWarnings("deprecation")
     public final void writeBytes(String s) throws IOException {
@@ -1150,7 +1150,7 @@
      * position of the file pointer.
      *
      * @param      s   a {@code String} value to be written.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.RandomAccessFile#writeChar(int)
      */
     public final void writeChars(String s) throws IOException {
@@ -1180,7 +1180,7 @@
      * for each character.
      *
      * @param      str   a string to be written.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public final void writeUTF(String str) throws IOException {
         DataOutputStream.writeUTF(str, this);
--- a/src/java.base/share/classes/java/io/Reader.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/Reader.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -203,7 +203,7 @@
      *             ({@code 0x00-0xffff}), or -1 if the end of the stream has
      *             been reached
      *
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IOException  If an I/O error occurs
      */
     public int read() throws IOException {
         char cb[] = new char[1];
@@ -223,7 +223,7 @@
      *              if the end of the stream
      *              has been reached
      *
-     * @exception   IOException  If an I/O error occurs
+     * @throws      IOException  If an I/O error occurs
      */
     public int read(char cbuf[]) throws IOException {
         return read(cbuf, 0, cbuf.length);
@@ -241,8 +241,8 @@
      * @return     The number of characters read, or -1 if the end of the
      *             stream has been reached
      *
-     * @exception  IOException  If an I/O error occurs
-     * @exception  IndexOutOfBoundsException
+     * @throws     IOException  If an I/O error occurs
+     * @throws     IndexOutOfBoundsException
      *             If {@code off} is negative, or {@code len} is negative,
      *             or {@code len} is greater than {@code cbuf.length - off}
      */
@@ -262,8 +262,8 @@
      *
      * @return    The number of characters actually skipped
      *
-     * @exception  IllegalArgumentException  If <code>n</code> is negative.
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IllegalArgumentException  If {@code n} is negative.
+     * @throws     IOException  If an I/O error occurs
      */
     public long skip(long n) throws IOException {
         if (n < 0L)
@@ -290,7 +290,7 @@
      * false otherwise.  Note that returning false does not guarantee that the
      * next read will block.
      *
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IOException  If an I/O error occurs
      */
     public boolean ready() throws IOException {
         return false;
@@ -317,7 +317,7 @@
      *                         reading this many characters, attempting to
      *                         reset the stream may fail.
      *
-     * @exception  IOException  If the stream does not support mark(),
+     * @throws     IOException  If the stream does not support mark(),
      *                          or if some other I/O error occurs
      */
     public void mark(int readAheadLimit) throws IOException {
@@ -332,7 +332,7 @@
      * character-input streams support the reset() operation, and some support
      * reset() without supporting mark().
      *
-     * @exception  IOException  If the stream has not been marked,
+     * @throws     IOException  If the stream has not been marked,
      *                          or if the mark has been invalidated,
      *                          or if the stream does not support reset(),
      *                          or if some other I/O error occurs
@@ -347,7 +347,7 @@
      * mark(), reset(), or skip() invocations will throw an IOException.
      * Closing a previously closed stream has no effect.
      *
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IOException  If an I/O error occurs
      */
      public abstract void close() throws IOException;
 
--- a/src/java.base/share/classes/java/io/SequenceInputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/SequenceInputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -30,7 +30,7 @@
 import java.util.Vector;
 
 /**
- * A <code>SequenceInputStream</code> represents
+ * A {@code SequenceInputStream} represents
  * the logical concatenation of other input
  * streams. It starts out with an ordered
  * collection of input streams and reads from
@@ -48,17 +48,17 @@
     InputStream in;
 
     /**
-     * Initializes a newly created <code>SequenceInputStream</code>
+     * Initializes a newly created {@code SequenceInputStream}
      * by remembering the argument, which must
-     * be an <code>Enumeration</code>  that produces
-     * objects whose run-time type is <code>InputStream</code>.
+     * be an {@code Enumeration}  that produces
+     * objects whose run-time type is {@code InputStream}.
      * The input streams that are  produced by
      * the enumeration will be read, in order,
      * to provide the bytes to be read  from this
-     * <code>SequenceInputStream</code>. After
+     * {@code SequenceInputStream}. After
      * each input stream from the enumeration
      * is exhausted, it is closed by calling its
-     * <code>close</code> method.
+     * {@code close} method.
      *
      * @param   e   an enumeration of input streams.
      * @see     java.util.Enumeration
@@ -70,11 +70,11 @@
 
     /**
      * Initializes a newly
-     * created <code>SequenceInputStream</code>
+     * created {@code SequenceInputStream}
      * by remembering the two arguments, which
-     * will be read in order, first <code>s1</code>
-     * and then <code>s2</code>, to provide the
-     * bytes to be read from this <code>SequenceInputStream</code>.
+     * will be read in order, first {@code s1}
+     * and then {@code s2}, to provide the
+     * bytes to be read from this {@code SequenceInputStream}.
      *
      * @param   s1   the first input stream to read.
      * @param   s2   the second input stream to read.
@@ -118,13 +118,13 @@
      * This method simply calls {@code available} of the current underlying
      * input stream and returns the result.
      *
-     * @return an estimate of the number of bytes that can be read (or
-     *         skipped over) from the current underlying input stream
-     *         without blocking or {@code 0} if this input stream
-     *         has been closed by invoking its {@link #close()} method
-     * @exception  IOException  if an I/O error occurs.
+     * @return   an estimate of the number of bytes that can be read (or
+     *           skipped over) from the current underlying input stream
+     *           without blocking or {@code 0} if this input stream
+     *           has been closed by invoking its {@link #close()} method
+     * @throw    IOException  if an I/O error occurs.
      *
-     * @since   1.1
+     * @since    1.1
      */
     public int available() throws IOException {
         if (in == null) {
@@ -135,21 +135,21 @@
 
     /**
      * Reads the next byte of data from this input stream. The byte is
-     * returned as an <code>int</code> in the range <code>0</code> to
-     * <code>255</code>. If no byte is available because the end of the
-     * stream has been reached, the value <code>-1</code> is returned.
+     * returned as an {@code int} in the range {@code 0} to
+     * {@code 255}. If no byte is available because the end of the
+     * stream has been reached, the value {@code -1} is returned.
      * This method blocks until input data is available, the end of the
      * stream is detected, or an exception is thrown.
      * <p>
      * This method
      * tries to read one character from the current substream. If it
-     * reaches the end of the stream, it calls the <code>close</code>
+     * reaches the end of the stream, it calls the {@code close}
      * method of the current substream and begins reading from the next
      * substream.
      *
-     * @return     the next byte of data, or <code>-1</code> if the end of the
+     * @return     the next byte of data, or {@code -1} if the end of the
      *             stream is reached.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public int read() throws IOException {
         while (in != null) {
@@ -163,27 +163,27 @@
     }
 
     /**
-     * Reads up to <code>len</code> bytes of data from this input stream
-     * into an array of bytes.  If <code>len</code> is not zero, the method
+     * Reads up to {@code len} bytes of data from this input stream
+     * into an array of bytes.  If {@code len} is not zero, the method
      * blocks until at least 1 byte of input is available; otherwise, no
-     * bytes are read and <code>0</code> is returned.
+     * bytes are read and {@code 0} is returned.
      * <p>
-     * The <code>read</code> method of <code>SequenceInputStream</code>
+     * The {@code read} method of {@code SequenceInputStream}
      * tries to read the data from the current substream. If it fails to
      * read any characters because the substream has reached the end of
-     * the stream, it calls the <code>close</code> method of the current
+     * the stream, it calls the {@code close} method of the current
      * substream and begins reading from the next substream.
      *
      * @param      b     the buffer into which the data is read.
-     * @param      off   the start offset in array <code>b</code>
+     * @param      off   the start offset in array {@code b}
      *                   at which the data is written.
      * @param      len   the maximum number of bytes read.
      * @return     int   the number of bytes read.
-     * @exception  NullPointerException If <code>b</code> is <code>null</code>.
-     * @exception  IndexOutOfBoundsException If <code>off</code> is negative,
-     * <code>len</code> is negative, or <code>len</code> is greater than
-     * <code>b.length - off</code>
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     NullPointerException If {@code b} is {@code null}.
+     * @throws     IndexOutOfBoundsException If {@code off} is negative,
+     *             {@code len} is negative, or {@code len} is
+     *             greater than {@code b.length - off}
+     * @throws     IOException  if an I/O error occurs.
      */
     public int read(byte b[], int off, int len) throws IOException {
         if (in == null) {
@@ -208,16 +208,16 @@
     /**
      * Closes this input stream and releases any system resources
      * associated with the stream.
-     * A closed <code>SequenceInputStream</code>
+     * A closed {@code SequenceInputStream}
      * cannot  perform input operations and cannot
      * be reopened.
      * <p>
      * If this stream was created
      * from an enumeration, all remaining elements
      * are requested from the enumeration and closed
-     * before the <code>close</code> method returns.
+     * before the {@code close} method returns.
      *
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      */
     public void close() throws IOException {
         IOException ioe = null;
--- a/src/java.base/share/classes/java/io/Serializable.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/Serializable.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -142,8 +142,8 @@
  * serialVersionUID than that of the corresponding sender's class, then
  * deserialization will result in an {@link InvalidClassException}.  A
  * serializable class can declare its own serialVersionUID explicitly by
- * declaring a field named <code>"serialVersionUID"</code> that must be static,
- * final, and of type <code>long</code>:
+ * declaring a field named {@code "serialVersionUID"} that must be static,
+ * final, and of type {@code long}:
  *
  * <PRE>
  * ANY-ACCESS-MODIFIER static final long serialVersionUID = 42L;
@@ -157,11 +157,11 @@
  * serialVersionUID values, since the default serialVersionUID computation is
  * highly sensitive to class details that may vary depending on compiler
  * implementations, and can thus result in unexpected
- * <code>InvalidClassException</code>s during deserialization.  Therefore, to
+ * {@code InvalidClassException}s during deserialization.  Therefore, to
  * guarantee a consistent serialVersionUID value across different java compiler
  * implementations, a serializable class must declare an explicit
  * serialVersionUID value.  It is also strongly advised that explicit
- * serialVersionUID declarations use the <code>private</code> modifier where
+ * serialVersionUID declarations use the {@code private} modifier where
  * possible, since such declarations apply only to the immediately declaring
  * class--serialVersionUID fields are not useful as inherited members. Array
  * classes cannot declare an explicit serialVersionUID, so they always have
--- a/src/java.base/share/classes/java/io/SerializablePermission.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/SerializablePermission.java	Tue Sep 24 15:19:35 2019 -0400
@@ -116,8 +116,8 @@
      *
      * @param name the name of the SerializablePermission.
      *
-     * @throws NullPointerException if <code>name</code> is <code>null</code>.
-     * @throws IllegalArgumentException if <code>name</code> is empty.
+     * @throws NullPointerException if {@code name} is {@code null}.
+     * @throws IllegalArgumentException if {@code name} is empty.
      */
     public SerializablePermission(String name)
     {
@@ -132,8 +132,8 @@
      * @param name the name of the SerializablePermission.
      * @param actions currently unused and must be set to null
      *
-     * @throws NullPointerException if <code>name</code> is <code>null</code>.
-     * @throws IllegalArgumentException if <code>name</code> is empty.
+     * @throws NullPointerException if {@code name} is {@code null}.
+     * @throws IllegalArgumentException if {@code name} is empty.
      */
 
     public SerializablePermission(String name, String actions)
--- a/src/java.base/share/classes/java/io/StreamTokenizer.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/StreamTokenizer.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -517,7 +517,7 @@
      * is returned.
      *
      * @return     the value of the {@code ttype} field.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      * @see        java.io.StreamTokenizer#nval
      * @see        java.io.StreamTokenizer#sval
      * @see        java.io.StreamTokenizer#ttype
--- a/src/java.base/share/classes/java/io/StringBufferInputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/StringBufferInputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
  * This class allows an application to create an input stream in
  * which the bytes read are supplied by the contents of a string.
  * Applications can also read bytes from a byte array by using a
- * <code>ByteArrayInputStream</code>.
+ * {@code ByteArrayInputStream}.
  * <p>
  * Only the low eight bits of each character in the string are used by
  * this class.
@@ -40,7 +40,7 @@
  * @since      1.0
  * @deprecated This class does not properly convert characters into bytes.  As
  *             of JDK&nbsp;1.1, the preferred way to create a stream from a
- *             string is via the <code>StringReader</code> class.
+ *             string is via the {@code StringReader} class.
  */
 @Deprecated
 public
@@ -76,16 +76,16 @@
 
     /**
      * Reads the next byte of data from this input stream. The value
-     * byte is returned as an <code>int</code> in the range
-     * <code>0</code> to <code>255</code>. If no byte is available
+     * byte is returned as an {@code int} in the range
+     * {@code 0} to {@code 255}. If no byte is available
      * because the end of the stream has been reached, the value
-     * <code>-1</code> is returned.
+     * {@code -1} is returned.
      * <p>
-     * The <code>read</code> method of
-     * <code>StringBufferInputStream</code> cannot block. It returns the
+     * The {@code read} method of
+     * {@code StringBufferInputStream} cannot block. It returns the
      * low eight bits of the next character in this input stream's buffer.
      *
-     * @return     the next byte of data, or <code>-1</code> if the end of the
+     * @return     the next byte of data, or {@code -1} if the end of the
      *             stream is reached.
      */
     public synchronized int read() {
@@ -93,11 +93,11 @@
     }
 
     /**
-     * Reads up to <code>len</code> bytes of data from this input stream
+     * Reads up to {@code len} bytes of data from this input stream
      * into an array of bytes.
      * <p>
-     * The <code>read</code> method of
-     * <code>StringBufferInputStream</code> cannot block. It copies the
+     * The {@code read} method of
+     * {@code StringBufferInputStream} cannot block. It copies the
      * low eight bits from the characters in this input stream's buffer into
      * the byte array argument.
      *
@@ -105,7 +105,7 @@
      * @param      off   the start offset of the data.
      * @param      len   the maximum number of bytes read.
      * @return     the total number of bytes read into the buffer, or
-     *             <code>-1</code> if there is no more data because the end of
+     *             {@code -1} if there is no more data because the end of
      *             the stream has been reached.
      */
     @SuppressWarnings("deprecation")
@@ -133,7 +133,7 @@
     }
 
     /**
-     * Skips <code>n</code> bytes of input from this input stream. Fewer
+     * Skips {@code n} bytes of input from this input stream. Fewer
      * bytes might be skipped if the end of the input stream is reached.
      *
      * @param      n   the number of bytes to be skipped.
--- a/src/java.base/share/classes/java/io/StringReader.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/StringReader.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -62,7 +62,7 @@
      * @return     The character read, or -1 if the end of the stream has been
      *             reached
      *
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IOException  If an I/O error occurs
      */
     public int read() throws IOException {
         synchronized (lock) {
@@ -83,8 +83,8 @@
      * @return     The number of characters read, or -1 if the end of the
      *             stream has been reached
      *
-     * @exception  IOException  If an I/O error occurs
-     * @exception  IndexOutOfBoundsException {@inheritDoc}
+     * @throws     IOException  If an I/O error occurs
+     * @throws     IndexOutOfBoundsException {@inheritDoc}
      */
     public int read(char cbuf[], int off, int len) throws IOException {
         synchronized (lock) {
@@ -108,9 +108,9 @@
      * Skips the specified number of characters in the stream. Returns
      * the number of characters that were skipped.
      *
-     * <p>The <code>ns</code> parameter may be negative, even though the
-     * <code>skip</code> method of the {@link Reader} superclass throws
-     * an exception in this case. Negative values of <code>ns</code> cause the
+     * <p>The {@code ns} parameter may be negative, even though the
+     * {@code skip} method of the {@link Reader} superclass throws
+     * an exception in this case. Negative values of {@code ns} cause the
      * stream to skip backwards. Negative return values indicate a skip
      * backwards. It is not possible to skip backwards past the beginning of
      * the string.
@@ -118,7 +118,7 @@
      * <p>If the entire string has been read or skipped, then this method has
      * no effect and always returns 0.
      *
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IOException  If an I/O error occurs
      */
     public long skip(long ns) throws IOException {
         synchronized (lock) {
@@ -138,7 +138,7 @@
      *
      * @return True if the next read() is guaranteed not to block for input
      *
-     * @exception  IOException  If the stream is closed
+     * @throws     IOException  If the stream is closed
      */
     public boolean ready() throws IOException {
         synchronized (lock) {
@@ -164,8 +164,8 @@
      *                         is no actual limit, so this argument must not
      *                         be negative, but is otherwise ignored.
      *
-     * @exception  IllegalArgumentException  If {@code readAheadLimit < 0}
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IllegalArgumentException  If {@code readAheadLimit < 0}
+     * @throws     IOException  If an I/O error occurs
      */
     public void mark(int readAheadLimit) throws IOException {
         if (readAheadLimit < 0){
@@ -181,7 +181,7 @@
      * Resets the stream to the most recent mark, or to the beginning of the
      * string if it has never been marked.
      *
-     * @exception  IOException  If an I/O error occurs
+     * @throws     IOException  If an I/O error occurs
      */
     public void reset() throws IOException {
         synchronized (lock) {
--- a/src/java.base/share/classes/java/io/UTFDataFormatException.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/io/UTFDataFormatException.java	Tue Sep 24 15:19:35 2019 -0400
@@ -32,7 +32,7 @@
  * input stream or by any class that implements the data input
  * interface.
  * See the
- * <a href="DataInput.html#modified-utf-8"><code>DataInput</code></a>
+ * <a href="DataInput.html#modified-utf-8">{@code DataInput}</a>
  * class description for the format in
  * which modified UTF-8 strings are read and written.
  *
@@ -48,19 +48,19 @@
     private static final long serialVersionUID = 420743449228280612L;
 
     /**
-     * Constructs a <code>UTFDataFormatException</code> with
-     * <code>null</code> as its error detail message.
+     * Constructs a {@code UTFDataFormatException} with
+     * {@code null} as its error detail message.
      */
     public UTFDataFormatException() {
         super();
     }
 
     /**
-     * Constructs a <code>UTFDataFormatException</code> with the
-     * specified detail message. The string <code>s</code> can be
+     * Constructs a {@code UTFDataFormatException} with the
+     * specified detail message. The string {@code s} can be
      * retrieved later by the
      * <code>{@link java.lang.Throwable#getMessage}</code>
-     * method of class <code>java.lang.Throwable</code>.
+     * method of class {@code java.lang.Throwable}.
      *
      * @param   s   the detail message.
      */
--- a/src/java.base/share/classes/java/lang/AbstractMethodError.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/AbstractMethodError.java	Tue Sep 24 15:19:35 2019 -0400
@@ -41,14 +41,14 @@
     private static final long serialVersionUID = -1654391082989018462L;
 
     /**
-     * Constructs an <code>AbstractMethodError</code> with no detail  message.
+     * Constructs an {@code AbstractMethodError} with no detail  message.
      */
     public AbstractMethodError() {
         super();
     }
 
     /**
-     * Constructs an <code>AbstractMethodError</code> with the specified
+     * Constructs an {@code AbstractMethodError} with the specified
      * detail message.
      *
      * @param   s   the detail message.
--- a/src/java.base/share/classes/java/lang/ArrayStoreException.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/ArrayStoreException.java	Tue Sep 24 15:19:35 2019 -0400
@@ -28,7 +28,7 @@
 /**
  * Thrown to indicate that an attempt has been made to store the
  * wrong type of object into an array of objects. For example, the
- * following code generates an <code>ArrayStoreException</code>:
+ * following code generates an {@code ArrayStoreException}:
  * <blockquote><pre>
  *     Object x[] = new String[3];
  *     x[0] = new Integer(0);
@@ -43,14 +43,14 @@
     private static final long serialVersionUID = -4522193890499838241L;
 
     /**
-     * Constructs an <code>ArrayStoreException</code> with no detail message.
+     * Constructs an {@code ArrayStoreException} with no detail message.
      */
     public ArrayStoreException() {
         super();
     }
 
     /**
-     * Constructs an <code>ArrayStoreException</code> with the specified
+     * Constructs an {@code ArrayStoreException} with the specified
      * detail message.
      *
      * @param   s   the detail message.
--- a/src/java.base/share/classes/java/lang/AssertionError.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/AssertionError.java	Tue Sep 24 15:19:35 2019 -0400
@@ -79,7 +79,7 @@
 
     /**
      * Constructs an AssertionError with its detail message derived
-     * from the specified <code>boolean</code>, which is converted to
+     * from the specified {@code boolean}, which is converted to
      * a string as defined in section 15.18.1.1 of
      * <cite>The Java&trade; Language Specification</cite>.
      *
@@ -91,7 +91,7 @@
 
     /**
      * Constructs an AssertionError with its detail message derived
-     * from the specified <code>char</code>, which is converted to a
+     * from the specified {@code char}, which is converted to a
      * string as defined in section 15.18.1.1 of
      * <cite>The Java&trade; Language Specification</cite>.
      *
@@ -103,7 +103,7 @@
 
     /**
      * Constructs an AssertionError with its detail message derived
-     * from the specified <code>int</code>, which is converted to a
+     * from the specified {@code int}, which is converted to a
      * string as defined in section 15.18.1.1 of
      * <cite>The Java&trade; Language Specification</cite>.
      *
@@ -115,7 +115,7 @@
 
     /**
      * Constructs an AssertionError with its detail message derived
-     * from the specified <code>long</code>, which is converted to a
+     * from the specified {@code long}, which is converted to a
      * string as defined in section 15.18.1.1 of
      * <cite>The Java&trade; Language Specification</cite>.
      *
@@ -127,7 +127,7 @@
 
     /**
      * Constructs an AssertionError with its detail message derived
-     * from the specified <code>float</code>, which is converted to a
+     * from the specified {@code float}, which is converted to a
      * string as defined in section 15.18.1.1 of
      * <cite>The Java&trade; Language Specification</cite>.
      *
@@ -139,7 +139,7 @@
 
     /**
      * Constructs an AssertionError with its detail message derived
-     * from the specified <code>double</code>, which is converted to a
+     * from the specified {@code double}, which is converted to a
      * string as defined in section 15.18.1.1 of
      * <cite>The Java&trade; Language Specification</cite>.
      *
--- a/src/java.base/share/classes/java/lang/Class.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/Class.java	Tue Sep 24 15:19:35 2019 -0400
@@ -321,10 +321,10 @@
      * @param      className   the fully qualified name of the desired class.
      * @return     the {@code Class} object for the class with the
      *             specified name.
-     * @exception LinkageError if the linkage fails
-     * @exception ExceptionInInitializerError if the initialization provoked
+     * @throws    LinkageError if the linkage fails
+     * @throws    ExceptionInInitializerError if the initialization provoked
      *            by this method fails
-     * @exception ClassNotFoundException if the class cannot be located
+     * @throws    ClassNotFoundException if the class cannot be located
      */
     @CallerSensitive
     public static Class<?> forName(String className)
@@ -379,12 +379,12 @@
      * @param loader     class loader from which the class must be loaded
      * @return           class object representing the desired class
      *
-     * @exception LinkageError if the linkage fails
-     * @exception ExceptionInInitializerError if the initialization provoked
+     * @throws    LinkageError if the linkage fails
+     * @throws    ExceptionInInitializerError if the initialization provoked
      *            by this method fails
-     * @exception ClassNotFoundException if the class cannot be located by
+     * @throws    ClassNotFoundException if the class cannot be located by
      *            the specified class loader
-     * @exception SecurityException
+     * @throws    SecurityException
      *            if a security manager is present, and the {@code loader} is
      *            {@code null}, and the caller's class loader is not
      *            {@code null}, and the caller does not have the
@@ -667,12 +667,12 @@
      * or via a widening reference conversion. See <em>The Java Language
      * Specification</em>, sections 5.1.1 and 5.1.4 , for details.
      *
-     * @param cls the {@code Class} object to be checked
-     * @return the {@code boolean} value indicating whether objects of the
-     * type {@code cls} can be assigned to objects of this class
-     * @exception NullPointerException if the specified Class parameter is
+     * @param     cls the {@code Class} object to be checked
+     * @return    the {@code boolean} value indicating whether objects of the
+     *            type {@code cls} can be assigned to objects of this class
+     * @throws    NullPointerException if the specified Class parameter is
      *            null.
-     * @since 1.1
+     * @since     1.1
      */
     @HotSpotIntrinsicCandidate
     public native boolean isAssignableFrom(Class<?> cls);
@@ -1512,7 +1512,7 @@
      * class.  If the underlying class is a top level class this
      * method returns {@code null}.
      * @return the immediately enclosing class of the underlying class
-     * @exception  SecurityException
+     * @throws     SecurityException
      *             If a security manager, <i>s</i>, is present and the caller's
      *             class loader is not the same as or an ancestor of the class
      *             loader for the enclosing class and invocation of {@link
--- a/src/java.base/share/classes/java/lang/ClassCastException.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/ClassCastException.java	Tue Sep 24 15:19:35 2019 -0400
@@ -28,7 +28,7 @@
 /**
  * Thrown to indicate that the code has attempted to cast an object
  * to a subclass of which it is not an instance. For example, the
- * following code generates a <code>ClassCastException</code>:
+ * following code generates a {@code ClassCastException}:
  * <blockquote><pre>
  *     Object x = new Integer(0);
  *     System.out.println((String)x);
@@ -43,14 +43,14 @@
     private static final long serialVersionUID = -9223365651070458532L;
 
     /**
-     * Constructs a <code>ClassCastException</code> with no detail message.
+     * Constructs a {@code ClassCastException} with no detail message.
      */
     public ClassCastException() {
         super();
     }
 
     /**
-     * Constructs a <code>ClassCastException</code> with the specified
+     * Constructs a {@code ClassCastException} with the specified
      * detail message.
      *
      * @param   s   the detail message.
--- a/src/java.base/share/classes/java/lang/ClassFormatError.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/ClassFormatError.java	Tue Sep 24 15:19:35 2019 -0400
@@ -39,14 +39,14 @@
     private static final long serialVersionUID = -8420114879011949195L;
 
     /**
-     * Constructs a <code>ClassFormatError</code> with no detail message.
+     * Constructs a {@code ClassFormatError} with no detail message.
      */
     public ClassFormatError() {
         super();
     }
 
     /**
-     * Constructs a <code>ClassFormatError</code> with the specified
+     * Constructs a {@code ClassFormatError} with the specified
      * detail message.
      *
      * @param   s   the detail message.
--- a/src/java.base/share/classes/java/lang/ClassLoader.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/ClassLoader.java	Tue Sep 24 15:19:35 2019 -0400
@@ -445,10 +445,10 @@
      * @param  parent
      *         The parent class loader
      *
-     * @throws  SecurityException
-     *          If a security manager exists and its
-     *          {@code checkCreateClassLoader} method doesn't allow creation
-     *          of a new class loader.
+     * @throws SecurityException
+     *         If a security manager exists and its
+     *         {@code checkCreateClassLoader} method doesn't allow creation
+     *         of a new class loader.
      *
      * @since  1.2
      */
@@ -509,8 +509,8 @@
      * to invoking {@link #loadClass(String, boolean) loadClass(name,
      * false)}.
      *
-     * @param  name
-     *         The <a href="#binary-name">binary name</a> of the class
+     * @param   name
+     *          The <a href="#binary-name">binary name</a> of the class
      *
      * @return  The resulting {@code Class} object
      *
@@ -551,11 +551,11 @@
      * {@link #getClassLoadingLock getClassLoadingLock} method
      * during the entire class loading process.
      *
-     * @param  name
-     *         The <a href="#binary-name">binary name</a> of the class
+     * @param   name
+     *          The <a href="#binary-name">binary name</a> of the class
      *
-     * @param  resolve
-     *         If {@code true} then resolve the class
+     * @param   resolve
+     *          If {@code true} then resolve the class
      *
      * @return  The resulting {@code Class} object
      *
@@ -704,8 +704,8 @@
      *
      * @implSpec The default implementation throws {@code ClassNotFoundException}.
      *
-     * @param  name
-     *         The <a href="#binary-name">binary name</a> of the class
+     * @param   name
+     *          The <a href="#binary-name">binary name</a> of the class
      *
      * @return  The resulting {@code Class} object
      *
--- a/src/java.base/share/classes/java/lang/ClassNotFoundException.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/ClassNotFoundException.java	Tue Sep 24 15:19:35 2019 -0400
@@ -34,10 +34,10 @@
  * Thrown when an application tries to load in a class through its
  * string name using:
  * <ul>
- * <li>The <code>forName</code> method in class <code>Class</code>.
- * <li>The <code>findSystemClass</code> method in class
- *     <code>ClassLoader</code> .
- * <li>The <code>loadClass</code> method in class <code>ClassLoader</code>.
+ * <li>The {@code forName} method in class {@code Class}.
+ * <li>The {@code findSystemClass} method in class
+ *     {@code ClassLoader} .
+ * <li>The {@code loadClass} method in class {@code ClassLoader}.
  * </ul>
  * <p>
  * but no definition for the class with the specified name could be found.
@@ -63,14 +63,14 @@
      private static final long serialVersionUID = 9176873029745254542L;
 
     /**
-     * Constructs a <code>ClassNotFoundException</code> with no detail message.
+     * Constructs a {@code ClassNotFoundException} with no detail message.
      */
     public ClassNotFoundException() {
         super((Throwable)null);  // Disallow initCause
     }
 
     /**
-     * Constructs a <code>ClassNotFoundException</code> with the
+     * Constructs a {@code ClassNotFoundException} with the
      * specified detail message.
      *
      * @param   s   the detail message.
@@ -80,7 +80,7 @@
     }
 
     /**
-     * Constructs a <code>ClassNotFoundException</code> with the
+     * Constructs a {@code ClassNotFoundException} with the
      * specified detail message and optional exception that was
      * raised while loading the class.
      *
@@ -100,7 +100,7 @@
      * The {@link Throwable#getCause()} method is now the preferred means of
      * obtaining this information.
      *
-     * @return the <code>Exception</code> that was raised while loading a class
+     * @return the {@code Exception} that was raised while loading a class
      * @since 1.2
      */
     public Throwable getException() {
--- a/src/java.base/share/classes/java/lang/CloneNotSupportedException.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/CloneNotSupportedException.java	Tue Sep 24 15:19:35 2019 -0400
@@ -26,12 +26,12 @@
 package java.lang;
 
 /**
- * Thrown to indicate that the <code>clone</code> method in class
- * <code>Object</code> has been called to clone an object, but that
- * the object's class does not implement the <code>Cloneable</code>
+ * Thrown to indicate that the {@code clone} method in class
+ * {@code Object} has been called to clone an object, but that
+ * the object's class does not implement the {@code Cloneable}
  * interface.
  * <p>
- * Applications that override the <code>clone</code> method can also
+ * Applications that override the {@code clone} method can also
  * throw this exception to indicate that an object could not or
  * should not be cloned.
  *
@@ -47,7 +47,7 @@
     private static final long serialVersionUID = 5195511250079656443L;
 
     /**
-     * Constructs a <code>CloneNotSupportedException</code> with no
+     * Constructs a {@code CloneNotSupportedException} with no
      * detail message.
      */
     public CloneNotSupportedException() {
@@ -55,7 +55,7 @@
     }
 
     /**
-     * Constructs a <code>CloneNotSupportedException</code> with the
+     * Constructs a {@code CloneNotSupportedException} with the
      * specified detail message.
      *
      * @param   s   the detail message.
--- a/src/java.base/share/classes/java/lang/Cloneable.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/Cloneable.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,14 +26,14 @@
 package java.lang;
 
 /**
- * A class implements the <code>Cloneable</code> interface to
+ * A class implements the {@code Cloneable} interface to
  * indicate to the {@link java.lang.Object#clone()} method that it
  * is legal for that method to make a
  * field-for-field copy of instances of that class.
  * <p>
  * Invoking Object's clone method on an instance that does not implement the
- * <code>Cloneable</code> interface results in the exception
- * <code>CloneNotSupportedException</code> being thrown.
+ * {@code Cloneable} interface results in the exception
+ * {@code CloneNotSupportedException} being thrown.
  * <p>
  * By convention, classes that implement this interface should override
  * {@code Object.clone} (which is protected) with a public method.
--- a/src/java.base/share/classes/java/lang/ConditionalSpecialCasing.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/ConditionalSpecialCasing.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,15 +34,15 @@
 
 
 /**
- * This is a utility class for <code>String.toLowerCase()</code> and
- * <code>String.toUpperCase()</code>, that handles special casing with
+ * This is a utility class for {@code String.toLowerCase()} and
+ * {@code String.toUpperCase()}, that handles special casing with
  * conditions.  In other words, it handles the mappings with conditions
  * that are defined in
  * <a href="http://www.unicode.org/Public/UNIDATA/SpecialCasing.txt">Special
  * Casing Properties</a> file.
  * <p>
  * Note that the unconditional case mappings (including 1:M mappings)
- * are handled in <code>Character.toLower/UpperCase()</code>.
+ * are handled in {@code Character.toLower/UpperCase()}.
  */
 final class ConditionalSpecialCasing {
 
@@ -329,7 +329,7 @@
     /**
      * Implements the "Before_Dot" condition
      *
-     * Specification: C is followed by <code>U+0307 COMBINING DOT ABOVE</code>.
+     * Specification: C is followed by {@code U+0307 COMBINING DOT ABOVE}.
      * Any sequence of characters with a combining class that is
      * neither 0 nor 230 may intervene between the current character
      * and the combining dot above.
--- a/src/java.base/share/classes/java/lang/ExceptionInInitializerError.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/ExceptionInInitializerError.java	Tue Sep 24 15:19:35 2019 -0400
@@ -32,7 +32,7 @@
 
 /**
  * Signals that an unexpected exception has occurred in a static initializer.
- * An <code>ExceptionInInitializerError</code> is thrown to indicate that an
+ * An {@code ExceptionInInitializerError} is thrown to indicate that an
  * exception occurred during evaluation of a static initializer or the
  * initializer for a static variable.
  *
@@ -54,8 +54,8 @@
     private static final long serialVersionUID = 1521711792217232256L;
 
     /**
-     * Constructs an <code>ExceptionInInitializerError</code> with
-     * <code>null</code> as its detail message string and with no saved
+     * Constructs an {@code ExceptionInInitializerError} with
+     * {@code null} as its detail message string and with no saved
      * throwable object.
      * A detail message is a String that describes this particular exception.
      */
@@ -64,10 +64,10 @@
     }
 
     /**
-     * Constructs a new <code>ExceptionInInitializerError</code> class by
-     * saving a reference to the <code>Throwable</code> object thrown for
+     * Constructs a new {@code ExceptionInInitializerError} class by
+     * saving a reference to the {@code Throwable} object thrown for
      * later retrieval by the {@link #getException()} method. The detail
-     * message string is set to <code>null</code>.
+     * message string is set to {@code null}.
      *
      * @param thrown The exception thrown
      */
@@ -97,8 +97,8 @@
      * obtaining this information.
      *
      * @return the saved throwable object of this
-     *         <code>ExceptionInInitializerError</code>, or <code>null</code>
-     *         if this <code>ExceptionInInitializerError</code> has no saved
+     *         {@code ExceptionInInitializerError}, or {@code null}
+     *         if this {@code ExceptionInInitializerError} has no saved
      *         throwable object.
      */
     public Throwable getException() {
--- a/src/java.base/share/classes/java/lang/IllegalAccessError.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/IllegalAccessError.java	Tue Sep 24 15:19:35 2019 -0400
@@ -41,14 +41,14 @@
     private static final long serialVersionUID = -8988904074992417891L;
 
     /**
-     * Constructs an <code>IllegalAccessError</code> with no detail message.
+     * Constructs an {@code IllegalAccessError} with no detail message.
      */
     public IllegalAccessError() {
         super();
     }
 
     /**
-     * Constructs an <code>IllegalAccessError</code> with the specified
+     * Constructs an {@code IllegalAccessError} with the specified
      * detail message.
      *
      * @param   s   the detail message.
--- a/src/java.base/share/classes/java/lang/IllegalAccessException.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/IllegalAccessException.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -60,7 +60,7 @@
     private static final long serialVersionUID = 6616958222490762034L;
 
     /**
-     * Constructs an <code>IllegalAccessException</code> without a
+     * Constructs an {@code IllegalAccessException} without a
      * detail message.
      */
     public IllegalAccessException() {
@@ -68,7 +68,7 @@
     }
 
     /**
-     * Constructs an <code>IllegalAccessException</code> with a detail message.
+     * Constructs an {@code IllegalAccessException} with a detail message.
      *
      * @param   s   the detail message.
      */
--- a/src/java.base/share/classes/java/lang/IllegalArgumentException.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/IllegalArgumentException.java	Tue Sep 24 15:19:35 2019 -0400
@@ -35,7 +35,7 @@
 public
 class IllegalArgumentException extends RuntimeException {
     /**
-     * Constructs an <code>IllegalArgumentException</code> with no
+     * Constructs an {@code IllegalArgumentException} with no
      * detail message.
      */
     public IllegalArgumentException() {
@@ -43,7 +43,7 @@
     }
 
     /**
-     * Constructs an <code>IllegalArgumentException</code> with the
+     * Constructs an {@code IllegalArgumentException} with the
      * specified detail message.
      *
      * @param   s   the detail message.
@@ -56,7 +56,7 @@
      * Constructs a new exception with the specified detail message and
      * cause.
      *
-     * <p>Note that the detail message associated with <code>cause</code> is
+     * <p>Note that the detail message associated with {@code cause} is
      * <i>not</i> automatically incorporated in this exception's detail
      * message.
      *
--- a/src/java.base/share/classes/java/lang/IllegalMonitorStateException.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/IllegalMonitorStateException.java	Tue Sep 24 15:19:35 2019 -0400
@@ -44,7 +44,7 @@
     private static final long serialVersionUID = 3713306369498869069L;
 
     /**
-     * Constructs an <code>IllegalMonitorStateException</code> with no
+     * Constructs an {@code IllegalMonitorStateException} with no
      * detail message.
      */
     public IllegalMonitorStateException() {
@@ -52,7 +52,7 @@
     }
 
     /**
-     * Constructs an <code>IllegalMonitorStateException</code> with the
+     * Constructs an {@code IllegalMonitorStateException} with the
      * specified detail message.
      *
      * @param   s   the detail message.
--- a/src/java.base/share/classes/java/lang/IllegalStateException.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/IllegalStateException.java	Tue Sep 24 15:19:35 2019 -0400
@@ -59,7 +59,7 @@
      * Constructs a new exception with the specified detail message and
      * cause.
      *
-     * <p>Note that the detail message associated with <code>cause</code> is
+     * <p>Note that the detail message associated with {@code cause} is
      * <i>not</i> automatically incorporated in this exception's detail
      * message.
      *
--- a/src/java.base/share/classes/java/lang/IllegalThreadStateException.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/IllegalThreadStateException.java	Tue Sep 24 15:19:35 2019 -0400
@@ -28,8 +28,8 @@
 /**
  * Thrown to indicate that a thread is not in an appropriate state
  * for the requested operation. See, for example, the
- * <code>suspend</code> and <code>resume</code> methods in class
- * <code>Thread</code>.
+ * {@code suspend} and {@code resume} methods in class
+ * {@code Thread}.
  *
  * @author  unascribed
  * @see     java.lang.Thread#resume()
@@ -41,7 +41,7 @@
     private static final long serialVersionUID = -7626246362397460174L;
 
     /**
-     * Constructs an <code>IllegalThreadStateException</code> with no
+     * Constructs an {@code IllegalThreadStateException} with no
      * detail message.
      */
     public IllegalThreadStateException() {
@@ -49,7 +49,7 @@
     }
 
     /**
-     * Constructs an <code>IllegalThreadStateException</code> with the
+     * Constructs an {@code IllegalThreadStateException} with the
      * specified detail message.
      *
      * @param   s   the detail message.
--- a/src/java.base/share/classes/java/lang/IncompatibleClassChangeError.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/IncompatibleClassChangeError.java	Tue Sep 24 15:19:35 2019 -0400
@@ -39,7 +39,7 @@
     private static final long serialVersionUID = -4914975503642802119L;
 
     /**
-     * Constructs an <code>IncompatibleClassChangeError</code> with no
+     * Constructs an {@code IncompatibleClassChangeError} with no
      * detail message.
      */
     public IncompatibleClassChangeError () {
@@ -47,7 +47,7 @@
     }
 
     /**
-     * Constructs an <code>IncompatibleClassChangeError</code> with the
+     * Constructs an {@code IncompatibleClassChangeError} with the
      * specified detail message.
      *
      * @param   s   the detail message.
--- a/src/java.base/share/classes/java/lang/InstantiationError.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/InstantiationError.java	Tue Sep 24 15:19:35 2019 -0400
@@ -26,7 +26,7 @@
 package java.lang;
 
 /**
- * Thrown when an application tries to use the Java <code>new</code>
+ * Thrown when an application tries to use the Java {@code new}
  * construct to instantiate an abstract class or an interface.
  * <p>
  * Normally, this error is caught by the compiler; this error can
@@ -44,14 +44,14 @@
     private static final long serialVersionUID = -4885810657349421204L;
 
     /**
-     * Constructs an <code>InstantiationError</code> with no detail  message.
+     * Constructs an {@code InstantiationError} with no detail  message.
      */
     public InstantiationError() {
         super();
     }
 
     /**
-     * Constructs an <code>InstantiationError</code> with the specified
+     * Constructs an {@code InstantiationError} with the specified
      * detail message.
      *
      * @param   s   the detail message.
--- a/src/java.base/share/classes/java/lang/Integer.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/Integer.java	Tue Sep 24 15:19:35 2019 -0400
@@ -598,7 +598,7 @@
      * @param      radix   the radix to be used while parsing {@code s}.
      * @return     the integer represented by the string argument in the
      *             specified radix.
-     * @exception  NumberFormatException if the {@code String}
+     * @throws     NumberFormatException if the {@code String}
      *             does not contain a parsable {@code int}.
      */
     public static int parseInt(String s, int radix)
@@ -763,7 +763,7 @@
      * @param s    a {@code String} containing the {@code int}
      *             representation to be parsed
      * @return     the integer value represented by the argument in decimal.
-     * @exception  NumberFormatException  if the string does not contain a
+     * @throws     NumberFormatException  if the string does not contain a
      *               parsable integer.
      */
     public static int parseInt(String s) throws NumberFormatException {
@@ -950,7 +950,7 @@
      * @return     an {@code Integer} object holding the value
      *             represented by the string argument in the specified
      *             radix.
-     * @exception NumberFormatException if the {@code String}
+     * @throws    NumberFormatException if the {@code String}
      *            does not contain a parsable {@code int}.
      */
     public static Integer valueOf(String s, int radix) throws NumberFormatException {
@@ -976,7 +976,7 @@
      * @param      s   the string to be parsed.
      * @return     an {@code Integer} object holding the value
      *             represented by the string argument.
-     * @exception  NumberFormatException  if the string cannot be parsed
+     * @throws     NumberFormatException  if the string cannot be parsed
      *             as an integer.
      */
     public static Integer valueOf(String s) throws NumberFormatException {
@@ -1393,7 +1393,7 @@
      * @param     nm the {@code String} to decode.
      * @return    an {@code Integer} object holding the {@code int}
      *             value represented by {@code nm}
-     * @exception NumberFormatException  if the {@code String} does not
+     * @throws    NumberFormatException  if the {@code String} does not
      *            contain a parsable integer.
      * @see java.lang.Integer#parseInt(java.lang.String, int)
      */
--- a/src/java.base/share/classes/java/lang/InternalError.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/InternalError.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,14 +36,14 @@
     private static final long serialVersionUID = -9062593416125562365L;
 
     /**
-     * Constructs an <code>InternalError</code> with no detail message.
+     * Constructs an {@code InternalError} with no detail message.
      */
     public InternalError() {
         super();
     }
 
     /**
-     * Constructs an <code>InternalError</code> with the specified
+     * Constructs an {@code InternalError} with the specified
      * detail message.
      *
      * @param   message   the detail message.
--- a/src/java.base/share/classes/java/lang/InterruptedException.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/InterruptedException.java	Tue Sep 24 15:19:35 2019 -0400
@@ -52,14 +52,14 @@
     private static final long serialVersionUID = 6700697376100628473L;
 
     /**
-     * Constructs an <code>InterruptedException</code> with no detail  message.
+     * Constructs an {@code InterruptedException} with no detail  message.
      */
     public InterruptedException() {
         super();
     }
 
     /**
-     * Constructs an <code>InterruptedException</code> with the
+     * Constructs an {@code InterruptedException} with the
      * specified detail message.
      *
      * @param   s   the detail message.
--- a/src/java.base/share/classes/java/lang/NegativeArraySizeException.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/NegativeArraySizeException.java	Tue Sep 24 15:19:35 2019 -0400
@@ -37,7 +37,7 @@
     private static final long serialVersionUID = -8960118058596991861L;
 
     /**
-     * Constructs a <code>NegativeArraySizeException</code> with no
+     * Constructs a {@code NegativeArraySizeException} with no
      * detail message.
      */
     public NegativeArraySizeException() {
@@ -45,7 +45,7 @@
     }
 
     /**
-     * Constructs a <code>NegativeArraySizeException</code> with the
+     * Constructs a {@code NegativeArraySizeException} with the
      * specified detail message.
      *
      * @param   s   the detail message.
--- a/src/java.base/share/classes/java/lang/NoClassDefFoundError.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/NoClassDefFoundError.java	Tue Sep 24 15:19:35 2019 -0400
@@ -26,9 +26,9 @@
 package java.lang;
 
 /**
- * Thrown if the Java Virtual Machine or a <code>ClassLoader</code> instance
+ * Thrown if the Java Virtual Machine or a {@code ClassLoader} instance
  * tries to load in the definition of a class (as part of a normal method call
- * or as part of creating a new instance using the <code>new</code> expression)
+ * or as part of creating a new instance using the {@code new} expression)
  * and no definition of the class could be found.
  * <p>
  * The searched-for class definition existed when the currently
@@ -44,14 +44,14 @@
     private static final long serialVersionUID = 9095859863287012458L;
 
     /**
-     * Constructs a <code>NoClassDefFoundError</code> with no detail message.
+     * Constructs a {@code NoClassDefFoundError} with no detail message.
      */
     public NoClassDefFoundError() {
         super();
     }
 
     /**
-     * Constructs a <code>NoClassDefFoundError</code> with the specified
+     * Constructs a {@code NoClassDefFoundError} with the specified
      * detail message.
      *
      * @param   s   the detail message.
--- a/src/java.base/share/classes/java/lang/NoSuchFieldError.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/NoSuchFieldError.java	Tue Sep 24 15:19:35 2019 -0400
@@ -42,14 +42,14 @@
     private static final long serialVersionUID = -3456430195886129035L;
 
     /**
-     * Constructs a <code>NoSuchFieldError</code> with no detail message.
+     * Constructs a {@code NoSuchFieldError} with no detail message.
      */
     public NoSuchFieldError() {
         super();
     }
 
     /**
-     * Constructs a <code>NoSuchFieldError</code> with the specified
+     * Constructs a {@code NoSuchFieldError} with the specified
      * detail message.
      *
      * @param   s   the detail message.
--- a/src/java.base/share/classes/java/lang/NoSuchMethodError.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/NoSuchMethodError.java	Tue Sep 24 15:19:35 2019 -0400
@@ -43,14 +43,14 @@
     private static final long serialVersionUID = -3765521442372831335L;
 
     /**
-     * Constructs a <code>NoSuchMethodError</code> with no detail message.
+     * Constructs a {@code NoSuchMethodError} with no detail message.
      */
     public NoSuchMethodError() {
         super();
     }
 
     /**
-     * Constructs a <code>NoSuchMethodError</code> with the
+     * Constructs a {@code NoSuchMethodError} with the
      * specified detail message.
      *
      * @param   s   the detail message.
--- a/src/java.base/share/classes/java/lang/NoSuchMethodException.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/NoSuchMethodException.java	Tue Sep 24 15:19:35 2019 -0400
@@ -37,14 +37,14 @@
     private static final long serialVersionUID = 5034388446362600923L;
 
     /**
-     * Constructs a <code>NoSuchMethodException</code> without a detail message.
+     * Constructs a {@code NoSuchMethodException} without a detail message.
      */
     public NoSuchMethodException() {
         super();
     }
 
     /**
-     * Constructs a <code>NoSuchMethodException</code> with a detail message.
+     * Constructs a {@code NoSuchMethodException} with a detail message.
      *
      * @param      s   the detail message.
      */
--- a/src/java.base/share/classes/java/lang/NumberFormatException.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/NumberFormatException.java	Tue Sep 24 15:19:35 2019 -0400
@@ -40,14 +40,14 @@
     static final long serialVersionUID = -2848938806368998894L;
 
     /**
-     * Constructs a <code>NumberFormatException</code> with no detail message.
+     * Constructs a {@code NumberFormatException} with no detail message.
      */
     public NumberFormatException () {
         super();
     }
 
     /**
-     * Constructs a <code>NumberFormatException</code> with the
+     * Constructs a {@code NumberFormatException} with the
      * specified detail message.
      *
      * @param   s   the detail message.
--- a/src/java.base/share/classes/java/lang/Package.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/Package.java	Tue Sep 24 15:19:35 2019 -0400
@@ -233,7 +233,7 @@
      * Returns true if this package is sealed with respect to the specified
      * code source {@code url}.
      *
-     * @param url the code source URL
+     * @param  url the code source URL
      * @return true if this package is sealed with respect to the given {@code url}
      */
     public boolean isSealed(URL url) {
@@ -267,12 +267,12 @@
      * If the values are equal the period is skipped and the next pair of
      * components is compared.
      *
-     * @param desired the version string of the desired version.
+     * @param  desired the version string of the desired version.
      * @return true if this package's version number is greater
-     *          than or equal to the desired version number
+     *         than or equal to the desired version number
      *
-     * @exception NumberFormatException if the current version is not known or
-     *          the desired or current version is not of the correct dotted form.
+     * @throws NumberFormatException if the current version is not known or
+     *         the desired or current version is not of the correct dotted form.
      */
     public boolean isCompatibleWith(String desired)
         throws NumberFormatException
--- a/src/java.base/share/classes/java/lang/ProcessHandleImpl.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/ProcessHandleImpl.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -223,9 +223,9 @@
     /**
      * Returns a ProcessHandle for an existing native process.
      *
-     * @param pid the native process identifier
+     * @param  pid the native process identifier
      * @return The ProcessHandle for the pid if the process is alive;
-     *      or {@code null} if the process ID does not exist in the native system.
+     *         or {@code null} if the process ID does not exist in the native system.
      * @throws SecurityException if RuntimePermission("manageProcess") is not granted
      */
     static Optional<ProcessHandle> get(long pid) {
--- a/src/java.base/share/classes/java/lang/Runnable.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/Runnable.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,23 +26,23 @@
 package java.lang;
 
 /**
- * The <code>Runnable</code> interface should be implemented by any
+ * The {@code Runnable} interface should be implemented by any
  * class whose instances are intended to be executed by a thread. The
- * class must define a method of no arguments called <code>run</code>.
+ * class must define a method of no arguments called {@code run}.
  * <p>
  * This interface is designed to provide a common protocol for objects that
  * wish to execute code while they are active. For example,
- * <code>Runnable</code> is implemented by class <code>Thread</code>.
+ * {@code Runnable} is implemented by class {@code Thread}.
  * Being active simply means that a thread has been started and has not
  * yet been stopped.
  * <p>
- * In addition, <code>Runnable</code> provides the means for a class to be
- * active while not subclassing <code>Thread</code>. A class that implements
- * <code>Runnable</code> can run without subclassing <code>Thread</code>
- * by instantiating a <code>Thread</code> instance and passing itself in
- * as the target.  In most cases, the <code>Runnable</code> interface should
- * be used if you are only planning to override the <code>run()</code>
- * method and no other <code>Thread</code> methods.
+ * In addition, {@code Runnable} provides the means for a class to be
+ * active while not subclassing {@code Thread}. A class that implements
+ * {@code Runnable} can run without subclassing {@code Thread}
+ * by instantiating a {@code Thread} instance and passing itself in
+ * as the target.  In most cases, the {@code Runnable} interface should
+ * be used if you are only planning to override the {@code run()}
+ * method and no other {@code Thread} methods.
  * This is important because classes should not be subclassed
  * unless the programmer intends on modifying or enhancing the fundamental
  * behavior of the class.
@@ -55,12 +55,12 @@
 @FunctionalInterface
 public interface Runnable {
     /**
-     * When an object implementing interface <code>Runnable</code> is used
+     * When an object implementing interface {@code Runnable} is used
      * to create a thread, starting the thread causes the object's
-     * <code>run</code> method to be called in that separately executing
+     * {@code run} method to be called in that separately executing
      * thread.
      * <p>
-     * The general contract of the method <code>run</code> is that it may
+     * The general contract of the method {@code run} is that it may
      * take any action whatsoever.
      *
      * @see     java.lang.Thread#run()
--- a/src/java.base/share/classes/java/lang/RuntimePermission.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/RuntimePermission.java	Tue Sep 24 15:19:35 2019 -0400
@@ -180,7 +180,7 @@
  *
  * <tr>
  *   <th scope="row">stopThread</th>
- *   <td>Stopping of threads via calls to the Thread <code>stop</code>
+ *   <td>Stopping of threads via calls to the Thread {@code stop}
  * method</td>
  *   <td>This allows code to stop any thread in the system provided that it is
  * already granted permission to access that thread.
@@ -191,9 +191,9 @@
  * <tr>
  *   <th scope="row">modifyThreadGroup</th>
  *   <td>modification of thread groups, e.g., via calls to ThreadGroup
- * <code>destroy</code>, <code>getParent</code>, <code>resume</code>,
- * <code>setDaemon</code>, <code>setMaxPriority</code>, <code>stop</code>,
- * and <code>suspend</code> methods</td>
+ * {@code destroy}, {@code getParent}, {@code resume},
+ * {@code setDaemon}, {@code setMaxPriority}, {@code stop},
+ * and {@code suspend} methods</td>
  *   <td>This allows an attacker to create thread groups and
  * set their run priority.</td>
  * </tr>
@@ -246,8 +246,8 @@
  * <tr>
  *   <th scope="row">accessClassInPackage.{package name}</th>
  *   <td>Access to the specified package via a class loader's
- * <code>loadClass</code> method when that class loader calls
- * the SecurityManager <code>checkPackageAccess</code> method</td>
+ * {@code loadClass} method when that class loader calls
+ * the SecurityManager {@code checkPackageAccess} method</td>
  *   <td>This gives code access to classes in packages
  * to which it normally does not have access. Malicious code
  * may use these classes to help in its attempt to compromise
@@ -257,12 +257,12 @@
  * <tr>
  *   <th scope="row">defineClassInPackage.{package name}</th>
  *   <td>Definition of classes in the specified package, via a class
- * loader's <code>defineClass</code> method when that class loader calls
- * the SecurityManager <code>checkPackageDefinition</code> method.</td>
+ * loader's {@code defineClass} method when that class loader calls
+ * the SecurityManager {@code checkPackageDefinition} method.</td>
  *   <td>This grants code permission to define a class
  * in a particular package. This is dangerous because malicious
  * code with this permission may define rogue classes in
- * trusted packages like <code>java.security</code> or <code>java.lang</code>,
+ * trusted packages like {@code java.security} or {@code java.lang},
  * for example.</td>
  * </tr>
  *
@@ -412,8 +412,8 @@
      *
      * @param name the name of the RuntimePermission.
      *
-     * @throws NullPointerException if <code>name</code> is <code>null</code>.
-     * @throws IllegalArgumentException if <code>name</code> is empty.
+     * @throws NullPointerException if {@code name} is {@code null}.
+     * @throws IllegalArgumentException if {@code name} is empty.
      */
 
     public RuntimePermission(String name)
@@ -429,8 +429,8 @@
      * @param name the name of the RuntimePermission.
      * @param actions should be null.
      *
-     * @throws NullPointerException if <code>name</code> is <code>null</code>.
-     * @throws IllegalArgumentException if <code>name</code> is empty.
+     * @throws NullPointerException if {@code name} is {@code null}.
+     * @throws IllegalArgumentException if {@code name} is empty.
      */
 
     public RuntimePermission(String name, String actions)
--- a/src/java.base/share/classes/java/lang/SecurityManager.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/SecurityManager.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -60,11 +60,11 @@
  * operation to be performed. The
  * application can allow or disallow the operation.
  * <p>
- * The <code>SecurityManager</code> class contains many methods with
- * names that begin with the word <code>check</code>. These methods
+ * The {@code SecurityManager} class contains many methods with
+ * names that begin with the word {@code check}. These methods
  * are called by various methods in the Java libraries before those
  * methods perform certain potentially sensitive operations. The
- * invocation of such a <code>check</code> method typically looks like this:
+ * invocation of such a {@code check} method typically looks like this:
  * <blockquote><pre>
  *     SecurityManager security = System.getSecurityManager();
  *     if (security != null) {
@@ -75,7 +75,7 @@
  * The security manager is thereby given an opportunity to prevent
  * completion of the operation by throwing an exception. A security
  * manager routine simply returns if the operation is permitted, but
- * throws a <code>SecurityException</code> if the operation is not
+ * throws a {@code SecurityException} if the operation is not
  * permitted.
  * <p>
  * Environments using a security manager will typically set the security
@@ -185,16 +185,16 @@
  *
  * <p>
  * If a requested access is allowed,
- * <code>checkPermission</code> returns quietly. If denied, a
- * <code>SecurityException</code> is thrown.
+ * {@code checkPermission} returns quietly. If denied, a
+ * {@code SecurityException} is thrown.
  * <p>
  * The default implementation of each of the other
- * <code>check</code> methods in <code>SecurityManager</code> is to
- * call the <code>SecurityManager checkPermission</code> method
+ * {@code check} methods in {@code SecurityManager} is to
+ * call the {@code SecurityManager checkPermission} method
  * to determine if the calling thread has permission to perform the requested
  * operation.
  * <p>
- * Note that the <code>checkPermission</code> method with
+ * Note that the {@code checkPermission} method with
  * just a single permission argument always performs security checks
  * within the context of the currently executing thread.
  * Sometimes a security check that should be made within a given context
@@ -205,7 +205,7 @@
  * java.lang.Object) checkPermission}
  * method that includes a context argument are provided
  * for this situation. The
- * <code>getSecurityContext</code> method returns a "snapshot"
+ * {@code getSecurityContext} method returns a "snapshot"
  * of the current calling context. (The default implementation
  * returns an AccessControlContext object.) A sample call is
  * the following:
@@ -217,14 +217,14 @@
  * </pre>
  *
  * <p>
- * The <code>checkPermission</code> method
+ * The {@code checkPermission} method
  * that takes a context object in addition to a permission
  * makes access decisions based on that context,
  * rather than on that of the current execution thread.
  * Code within a different context can thus call that method,
  * passing the permission and the
  * previously-saved context object. A sample call, using the
- * SecurityManager <code>sm</code> obtained as in the previous example,
+ * SecurityManager {@code sm} obtained as in the previous example,
  * is the following:
  *
  * <pre>
@@ -234,21 +234,21 @@
  * <p>Permissions fall into these categories: File, Socket, Net,
  * Security, Runtime, Property, AWT, Reflect, and Serializable.
  * The classes managing these various
- * permission categories are <code>java.io.FilePermission</code>,
- * <code>java.net.SocketPermission</code>,
- * <code>java.net.NetPermission</code>,
- * <code>java.security.SecurityPermission</code>,
- * <code>java.lang.RuntimePermission</code>,
- * <code>java.util.PropertyPermission</code>,
- * <code>java.awt.AWTPermission</code>,
- * <code>java.lang.reflect.ReflectPermission</code>, and
- * <code>java.io.SerializablePermission</code>.
+ * permission categories are {@code java.io.FilePermission},
+ * {@code java.net.SocketPermission},
+ * {@code java.net.NetPermission},
+ * {@code java.security.SecurityPermission},
+ * {@code java.lang.RuntimePermission},
+ * {@code java.util.PropertyPermission},
+ * {@code java.awt.AWTPermission},
+ * {@code java.lang.reflect.ReflectPermission}, and
+ * {@code java.io.SerializablePermission}.
  *
  * <p>All but the first two (FilePermission and SocketPermission) are
- * subclasses of <code>java.security.BasicPermission</code>, which itself
+ * subclasses of {@code java.security.BasicPermission}, which itself
  * is an abstract subclass of the
  * top-level class for permissions, which is
- * <code>java.security.Permission</code>. BasicPermission defines the
+ * {@code java.security.Permission}. BasicPermission defines the
  * functionality needed for all permissions that contain a name
  * that follows the hierarchical property naming convention
  * (for example, "exitVM", "setFactory", "queuePrintJob", etc).
@@ -259,16 +259,16 @@
  *
  * <p>FilePermission and SocketPermission are subclasses of the
  * top-level class for permissions
- * (<code>java.security.Permission</code>). Classes like these
+ * ({@code java.security.Permission}). Classes like these
  * that have a more complicated name syntax than that used by
  * BasicPermission subclass directly from Permission rather than from
  * BasicPermission. For example,
- * for a <code>java.io.FilePermission</code> object, the permission name is
+ * for a {@code java.io.FilePermission} object, the permission name is
  * the path name of a file (or directory).
  *
  * <p>Some of the permission classes have an "actions" list that tells
  * the actions that are permitted for the object.  For example,
- * for a <code>java.io.FilePermission</code> object, the actions list
+ * for a {@code java.io.FilePermission} object, the actions list
  * (such as "read, write") specifies which actions are granted for the
  * specified file (or for files in the specified directory).
  *
@@ -276,7 +276,7 @@
  * ones that contain a name but no actions list; you either have the
  * named permission or you don't.
  *
- * <p>Note: There is also a <code>java.security.AllPermission</code>
+ * <p>Note: There is also a {@code java.security.AllPermission}
  * permission that implies all permissions. It exists to simplify the work
  * of system administrators who might need to perform multiple
  * tasks that require all (or numerous) permissions.
@@ -285,7 +285,7 @@
  * Permissions in the Java Development Kit (JDK)}
  * for permission-related information.
  * This document includes a table listing the various SecurityManager
- * <code>check</code> methods and the permission(s) the default
+ * {@code check} methods and the permission(s) the default
  * implementation of each such method requires.
  * It also contains a table of the methods
  * that require permissions, and for each such method tells
@@ -322,17 +322,17 @@
     private boolean initialized = false;
 
     /**
-     * Constructs a new <code>SecurityManager</code>.
+     * Constructs a new {@code SecurityManager}.
      *
      * <p> If there is a security manager already installed, this method first
-     * calls the security manager's <code>checkPermission</code> method
-     * with the <code>RuntimePermission("createSecurityManager")</code>
+     * calls the security manager's {@code checkPermission} method
+     * with the {@code RuntimePermission("createSecurityManager")}
      * permission to ensure the calling thread has permission to create a new
      * security manager.
-     * This may result in throwing a <code>SecurityException</code>.
+     * This may result in throwing a {@code SecurityException}.
      *
-     * @exception  java.lang.SecurityException if a security manager already
-     *             exists and its <code>checkPermission</code> method
+     * @throws     java.lang.SecurityException if a security manager already
+     *             exists and its {@code checkPermission} method
      *             doesn't allow creation of a new security manager.
      * @see        java.lang.System#getSecurityManager()
      * @see        #checkPermission(java.security.Permission) checkPermission
@@ -355,8 +355,8 @@
      * Returns the current execution stack as an array of classes.
      * <p>
      * The length of the array is the number of methods on the execution
-     * stack. The element at index <code>0</code> is the class of the
-     * currently executing method, the element at index <code>1</code> is
+     * stack. The element at index {@code 0} is the class of the
+     * currently executing method, the element at index {@code 1} is
      * the class of that method's caller, and so on.
      *
      * @return  the execution stack.
@@ -366,15 +366,15 @@
     /**
      * Creates an object that encapsulates the current execution
      * environment. The result of this method is used, for example, by the
-     * three-argument <code>checkConnect</code> method and by the
-     * two-argument <code>checkRead</code> method.
+     * three-argument {@code checkConnect} method and by the
+     * two-argument {@code checkRead} method.
      * These methods are needed because a trusted method may be called
      * on to read a file or open a socket on behalf of another method.
      * The trusted method needs to determine if the other (possibly
      * untrusted) method would be allowed to perform the operation on its
      * own.
      * <p> The default implementation of this method is to return
-     * an <code>AccessControlContext</code> object.
+     * an {@code AccessControlContext} object.
      *
      * @return  an implementation-dependent object that encapsulates
      *          sufficient information about the current execution environment
@@ -390,18 +390,18 @@
     }
 
     /**
-     * Throws a <code>SecurityException</code> if the requested
+     * Throws a {@code SecurityException} if the requested
      * access, specified by the given permission, is not permitted based
      * on the security policy currently in effect.
      * <p>
-     * This method calls <code>AccessController.checkPermission</code>
+     * This method calls {@code AccessController.checkPermission}
      * with the given permission.
      *
      * @param     perm   the requested permission.
-     * @exception SecurityException if access is not permitted based on
+     * @throws    SecurityException if access is not permitted based on
      *            the current security policy.
-     * @exception NullPointerException if the permission argument is
-     *            <code>null</code>.
+     * @throws    NullPointerException if the permission argument is
+     *            {@code null}.
      * @since     1.2
      */
     public void checkPermission(Permission perm) {
@@ -409,32 +409,32 @@
     }
 
     /**
-     * Throws a <code>SecurityException</code> if the
+     * Throws a {@code SecurityException} if the
      * specified security context is denied access to the resource
      * specified by the given permission.
      * The context must be a security
      * context returned by a previous call to
-     * <code>getSecurityContext</code> and the access control
+     * {@code getSecurityContext} and the access control
      * decision is based upon the configured security policy for
      * that security context.
      * <p>
-     * If <code>context</code> is an instance of
-     * <code>AccessControlContext</code> then the
-     * <code>AccessControlContext.checkPermission</code> method is
+     * If {@code context} is an instance of
+     * {@code AccessControlContext} then the
+     * {@code AccessControlContext.checkPermission} method is
      * invoked with the specified permission.
      * <p>
-     * If <code>context</code> is not an instance of
-     * <code>AccessControlContext</code> then a
-     * <code>SecurityException</code> is thrown.
+     * If {@code context} is not an instance of
+     * {@code AccessControlContext} then a
+     * {@code SecurityException} is thrown.
      *
      * @param      perm      the specified permission
      * @param      context   a system-dependent security context.
-     * @exception  SecurityException  if the specified security context
-     *             is not an instance of <code>AccessControlContext</code>
-     *             (e.g., is <code>null</code>), or is denied access to the
+     * @throws     SecurityException  if the specified security context
+     *             is not an instance of {@code AccessControlContext}
+     *             (e.g., is {@code null}), or is denied access to the
      *             resource specified by the given permission.
-     * @exception  NullPointerException if the permission argument is
-     *             <code>null</code>.
+     * @throws     NullPointerException if the permission argument is
+     *             {@code null}.
      * @see        java.lang.SecurityManager#getSecurityContext()
      * @see java.security.AccessControlContext#checkPermission(java.security.Permission)
      * @since      1.2
@@ -448,19 +448,19 @@
     }
 
     /**
-     * Throws a <code>SecurityException</code> if the
+     * Throws a {@code SecurityException} if the
      * calling thread is not allowed to create a new class loader.
      * <p>
-     * This method calls <code>checkPermission</code> with the
-     * <code>RuntimePermission("createClassLoader")</code>
+     * This method calls {@code checkPermission} with the
+     * {@code RuntimePermission("createClassLoader")}
      * permission.
      * <p>
      * If you override this method, then you should make a call to
-     * <code>super.checkCreateClassLoader</code>
+     * {@code super.checkCreateClassLoader}
      * at the point the overridden method would normally throw an
      * exception.
      *
-     * @exception SecurityException if the calling thread does not
+     * @throws    SecurityException if the calling thread does not
      *             have permission
      *             to create a new class loader.
      * @see        java.lang.ClassLoader#ClassLoader()
@@ -486,39 +486,39 @@
     }
 
     /**
-     * Throws a <code>SecurityException</code> if the
+     * Throws a {@code SecurityException} if the
      * calling thread is not allowed to modify the thread argument.
      * <p>
      * This method is invoked for the current security manager by the
-     * <code>stop</code>, <code>suspend</code>, <code>resume</code>,
-     * <code>setPriority</code>, <code>setName</code>, and
-     * <code>setDaemon</code> methods of class <code>Thread</code>.
+     * {@code stop}, {@code suspend}, {@code resume},
+     * {@code setPriority}, {@code setName}, and
+     * {@code setDaemon} methods of class {@code Thread}.
      * <p>
      * If the thread argument is a system thread (belongs to
-     * the thread group with a <code>null</code> parent) then
-     * this method calls <code>checkPermission</code> with the
-     * <code>RuntimePermission("modifyThread")</code> permission.
+     * the thread group with a {@code null} parent) then
+     * this method calls {@code checkPermission} with the
+     * {@code RuntimePermission("modifyThread")} permission.
      * If the thread argument is <i>not</i> a system thread,
      * this method just returns silently.
      * <p>
      * Applications that want a stricter policy should override this
      * method. If this method is overridden, the method that overrides
      * it should additionally check to see if the calling thread has the
-     * <code>RuntimePermission("modifyThread")</code> permission, and
+     * {@code RuntimePermission("modifyThread")} permission, and
      * if so, return silently. This is to ensure that code granted
      * that permission (such as the JDK itself) is allowed to
      * manipulate any thread.
      * <p>
      * If this method is overridden, then
-     * <code>super.checkAccess</code> should
+     * {@code super.checkAccess} should
      * be called by the first statement in the overridden method, or the
      * equivalent security check should be placed in the overridden method.
      *
      * @param      t   the thread to be checked.
-     * @exception  SecurityException  if the calling thread does not have
+     * @throws     SecurityException  if the calling thread does not have
      *             permission to modify the thread.
-     * @exception  NullPointerException if the thread argument is
-     *             <code>null</code>.
+     * @throws     NullPointerException if the thread argument is
+     *             {@code null}.
      * @see        java.lang.Thread#resume() resume
      * @see        java.lang.Thread#setDaemon(boolean) setDaemon
      * @see        java.lang.Thread#setName(java.lang.String) setName
@@ -538,40 +538,40 @@
         }
     }
     /**
-     * Throws a <code>SecurityException</code> if the
+     * Throws a {@code SecurityException} if the
      * calling thread is not allowed to modify the thread group argument.
      * <p>
      * This method is invoked for the current security manager when a
      * new child thread or child thread group is created, and by the
-     * <code>setDaemon</code>, <code>setMaxPriority</code>,
-     * <code>stop</code>, <code>suspend</code>, <code>resume</code>, and
-     * <code>destroy</code> methods of class <code>ThreadGroup</code>.
+     * {@code setDaemon}, {@code setMaxPriority},
+     * {@code stop}, {@code suspend}, {@code resume}, and
+     * {@code destroy} methods of class {@code ThreadGroup}.
      * <p>
      * If the thread group argument is the system thread group (
-     * has a <code>null</code> parent) then
-     * this method calls <code>checkPermission</code> with the
-     * <code>RuntimePermission("modifyThreadGroup")</code> permission.
+     * has a {@code null} parent) then
+     * this method calls {@code checkPermission} with the
+     * {@code RuntimePermission("modifyThreadGroup")} permission.
      * If the thread group argument is <i>not</i> the system thread group,
      * this method just returns silently.
      * <p>
      * Applications that want a stricter policy should override this
      * method. If this method is overridden, the method that overrides
      * it should additionally check to see if the calling thread has the
-     * <code>RuntimePermission("modifyThreadGroup")</code> permission, and
+     * {@code RuntimePermission("modifyThreadGroup")} permission, and
      * if so, return silently. This is to ensure that code granted
      * that permission (such as the JDK itself) is allowed to
      * manipulate any thread.
      * <p>
      * If this method is overridden, then
-     * <code>super.checkAccess</code> should
+     * {@code super.checkAccess} should
      * be called by the first statement in the overridden method, or the
      * equivalent security check should be placed in the overridden method.
      *
      * @param      g   the thread group to be checked.
-     * @exception  SecurityException  if the calling thread does not have
+     * @throws     SecurityException  if the calling thread does not have
      *             permission to modify the thread group.
-     * @exception  NullPointerException if the thread group argument is
-     *             <code>null</code>.
+     * @throws     NullPointerException if the thread group argument is
+     *             {@code null}.
      * @see        java.lang.ThreadGroup#destroy() destroy
      * @see        java.lang.ThreadGroup#resume() resume
      * @see        java.lang.ThreadGroup#setDaemon(boolean) setDaemon
@@ -592,25 +592,25 @@
     }
 
     /**
-     * Throws a <code>SecurityException</code> if the
+     * Throws a {@code SecurityException} if the
      * calling thread is not allowed to cause the Java Virtual Machine to
      * halt with the specified status code.
      * <p>
      * This method is invoked for the current security manager by the
-     * <code>exit</code> method of class <code>Runtime</code>. A status
-     * of <code>0</code> indicates success; other values indicate various
+     * {@code exit} method of class {@code Runtime}. A status
+     * of {@code 0} indicates success; other values indicate various
      * errors.
      * <p>
-     * This method calls <code>checkPermission</code> with the
-     * <code>RuntimePermission("exitVM."+status)</code> permission.
+     * This method calls {@code checkPermission} with the
+     * {@code RuntimePermission("exitVM."+status)} permission.
      * <p>
      * If you override this method, then you should make a call to
-     * <code>super.checkExit</code>
+     * {@code super.checkExit}
      * at the point the overridden method would normally throw an
      * exception.
      *
      * @param      status   the exit status.
-     * @exception SecurityException if the calling thread does not have
+     * @throws    SecurityException if the calling thread does not have
      *              permission to halt the Java Virtual Machine with
      *              the specified status.
      * @see        java.lang.Runtime#exit(int) exit
@@ -621,28 +621,28 @@
     }
 
     /**
-     * Throws a <code>SecurityException</code> if the
+     * Throws a {@code SecurityException} if the
      * calling thread is not allowed to create a subprocess.
      * <p>
      * This method is invoked for the current security manager by the
-     * <code>exec</code> methods of class <code>Runtime</code>.
+     * {@code exec} methods of class {@code Runtime}.
      * <p>
-     * This method calls <code>checkPermission</code> with the
-     * <code>FilePermission(cmd,"execute")</code> permission
+     * This method calls {@code checkPermission} with the
+     * {@code FilePermission(cmd,"execute")} permission
      * if cmd is an absolute path, otherwise it calls
-     * <code>checkPermission</code> with
+     * {@code checkPermission} with
      * <code>FilePermission("&lt;&lt;ALL FILES&gt;&gt;","execute")</code>.
      * <p>
      * If you override this method, then you should make a call to
-     * <code>super.checkExec</code>
+     * {@code super.checkExec}
      * at the point the overridden method would normally throw an
      * exception.
      *
      * @param      cmd   the specified system command.
-     * @exception  SecurityException if the calling thread does not have
+     * @throws     SecurityException if the calling thread does not have
      *             permission to create a subprocess.
-     * @exception  NullPointerException if the <code>cmd</code> argument is
-     *             <code>null</code>.
+     * @throws     NullPointerException if the {@code cmd} argument is
+     *             {@code null}.
      * @see     java.lang.Runtime#exec(java.lang.String)
      * @see     java.lang.Runtime#exec(java.lang.String, java.lang.String[])
      * @see     java.lang.Runtime#exec(java.lang.String[])
@@ -661,28 +661,28 @@
     }
 
     /**
-     * Throws a <code>SecurityException</code> if the
+     * Throws a {@code SecurityException} if the
      * calling thread is not allowed to dynamic link the library code
      * specified by the string argument file. The argument is either a
      * simple library name or a complete filename.
      * <p>
      * This method is invoked for the current security manager by
-     * methods <code>load</code> and <code>loadLibrary</code> of class
-     * <code>Runtime</code>.
+     * methods {@code load} and {@code loadLibrary} of class
+     * {@code Runtime}.
      * <p>
-     * This method calls <code>checkPermission</code> with the
-     * <code>RuntimePermission("loadLibrary."+lib)</code> permission.
+     * This method calls {@code checkPermission} with the
+     * {@code RuntimePermission("loadLibrary."+lib)} permission.
      * <p>
      * If you override this method, then you should make a call to
-     * <code>super.checkLink</code>
+     * {@code super.checkLink}
      * at the point the overridden method would normally throw an
      * exception.
      *
      * @param      lib   the name of the library.
-     * @exception  SecurityException if the calling thread does not have
+     * @throws     SecurityException if the calling thread does not have
      *             permission to dynamically link the library.
-     * @exception  NullPointerException if the <code>lib</code> argument is
-     *             <code>null</code>.
+     * @throws     NullPointerException if the {@code lib} argument is
+     *             {@code null}.
      * @see        java.lang.Runtime#load(java.lang.String)
      * @see        java.lang.Runtime#loadLibrary(java.lang.String)
      * @see        #checkPermission(java.security.Permission) checkPermission
@@ -695,24 +695,24 @@
     }
 
     /**
-     * Throws a <code>SecurityException</code> if the
+     * Throws a {@code SecurityException} if the
      * calling thread is not allowed to read from the specified file
      * descriptor.
      * <p>
-     * This method calls <code>checkPermission</code> with the
-     * <code>RuntimePermission("readFileDescriptor")</code>
+     * This method calls {@code checkPermission} with the
+     * {@code RuntimePermission("readFileDescriptor")}
      * permission.
      * <p>
      * If you override this method, then you should make a call to
-     * <code>super.checkRead</code>
+     * {@code super.checkRead}
      * at the point the overridden method would normally throw an
      * exception.
      *
      * @param      fd   the system-dependent file descriptor.
-     * @exception  SecurityException  if the calling thread does not have
+     * @throws     SecurityException  if the calling thread does not have
      *             permission to access the specified file descriptor.
-     * @exception  NullPointerException if the file descriptor argument is
-     *             <code>null</code>.
+     * @throws     NullPointerException if the file descriptor argument is
+     *             {@code null}.
      * @see        java.io.FileDescriptor
      * @see        #checkPermission(java.security.Permission) checkPermission
      */
@@ -724,23 +724,23 @@
     }
 
     /**
-     * Throws a <code>SecurityException</code> if the
+     * Throws a {@code SecurityException} if the
      * calling thread is not allowed to read the file specified by the
      * string argument.
      * <p>
-     * This method calls <code>checkPermission</code> with the
-     * <code>FilePermission(file,"read")</code> permission.
+     * This method calls {@code checkPermission} with the
+     * {@code FilePermission(file,"read")} permission.
      * <p>
      * If you override this method, then you should make a call to
-     * <code>super.checkRead</code>
+     * {@code super.checkRead}
      * at the point the overridden method would normally throw an
      * exception.
      *
      * @param      file   the system-dependent file name.
-     * @exception  SecurityException if the calling thread does not have
+     * @throws     SecurityException if the calling thread does not have
      *             permission to access the specified file.
-     * @exception  NullPointerException if the <code>file</code> argument is
-     *             <code>null</code>.
+     * @throws     NullPointerException if the {@code file} argument is
+     *             {@code null}.
      * @see        #checkPermission(java.security.Permission) checkPermission
      */
     public void checkRead(String file) {
@@ -749,32 +749,32 @@
     }
 
     /**
-     * Throws a <code>SecurityException</code> if the
+     * Throws a {@code SecurityException} if the
      * specified security context is not allowed to read the file
      * specified by the string argument. The context must be a security
      * context returned by a previous call to
-     * <code>getSecurityContext</code>.
-     * <p> If <code>context</code> is an instance of
-     * <code>AccessControlContext</code> then the
-     * <code>AccessControlContext.checkPermission</code> method will
-     * be invoked with the <code>FilePermission(file,"read")</code> permission.
-     * <p> If <code>context</code> is not an instance of
-     * <code>AccessControlContext</code> then a
-     * <code>SecurityException</code> is thrown.
+     * {@code getSecurityContext}.
+     * <p> If {@code context} is an instance of
+     * {@code AccessControlContext} then the
+     * {@code AccessControlContext.checkPermission} method will
+     * be invoked with the {@code FilePermission(file,"read")} permission.
+     * <p> If {@code context} is not an instance of
+     * {@code AccessControlContext} then a
+     * {@code SecurityException} is thrown.
      * <p>
      * If you override this method, then you should make a call to
-     * <code>super.checkRead</code>
+     * {@code super.checkRead}
      * at the point the overridden method would normally throw an
      * exception.
      *
      * @param      file      the system-dependent filename.
      * @param      context   a system-dependent security context.
-     * @exception  SecurityException  if the specified security context
-     *             is not an instance of <code>AccessControlContext</code>
-     *             (e.g., is <code>null</code>), or does not have permission
+     * @throws     SecurityException  if the specified security context
+     *             is not an instance of {@code AccessControlContext}
+     *             (e.g., is {@code null}), or does not have permission
      *             to read the specified file.
-     * @exception  NullPointerException if the <code>file</code> argument is
-     *             <code>null</code>.
+     * @throws     NullPointerException if the {@code file} argument is
+     *             {@code null}.
      * @see        java.lang.SecurityManager#getSecurityContext()
      * @see        java.security.AccessControlContext#checkPermission(java.security.Permission)
      */
@@ -785,24 +785,24 @@
     }
 
     /**
-     * Throws a <code>SecurityException</code> if the
+     * Throws a {@code SecurityException} if the
      * calling thread is not allowed to write to the specified file
      * descriptor.
      * <p>
-     * This method calls <code>checkPermission</code> with the
-     * <code>RuntimePermission("writeFileDescriptor")</code>
+     * This method calls {@code checkPermission} with the
+     * {@code RuntimePermission("writeFileDescriptor")}
      * permission.
      * <p>
      * If you override this method, then you should make a call to
-     * <code>super.checkWrite</code>
+     * {@code super.checkWrite}
      * at the point the overridden method would normally throw an
      * exception.
      *
      * @param      fd   the system-dependent file descriptor.
-     * @exception SecurityException  if the calling thread does not have
+     * @throws    SecurityException  if the calling thread does not have
      *             permission to access the specified file descriptor.
-     * @exception  NullPointerException if the file descriptor argument is
-     *             <code>null</code>.
+     * @throws     NullPointerException if the file descriptor argument is
+     *             {@code null}.
      * @see        java.io.FileDescriptor
      * @see        #checkPermission(java.security.Permission) checkPermission
      */
@@ -815,23 +815,23 @@
     }
 
     /**
-     * Throws a <code>SecurityException</code> if the
+     * Throws a {@code SecurityException} if the
      * calling thread is not allowed to write to the file specified by
      * the string argument.
      * <p>
-     * This method calls <code>checkPermission</code> with the
-     * <code>FilePermission(file,"write")</code> permission.
+     * This method calls {@code checkPermission} with the
+     * {@code FilePermission(file,"write")} permission.
      * <p>
      * If you override this method, then you should make a call to
-     * <code>super.checkWrite</code>
+     * {@code super.checkWrite}
      * at the point the overridden method would normally throw an
      * exception.
      *
      * @param      file   the system-dependent filename.
-     * @exception  SecurityException  if the calling thread does not
+     * @throws     SecurityException  if the calling thread does not
      *             have permission to access the specified file.
-     * @exception  NullPointerException if the <code>file</code> argument is
-     *             <code>null</code>.
+     * @throws     NullPointerException if the {@code file} argument is
+     *             {@code null}.
      * @see        #checkPermission(java.security.Permission) checkPermission
      */
     public void checkWrite(String file) {
@@ -840,25 +840,25 @@
     }
 
     /**
-     * Throws a <code>SecurityException</code> if the
+     * Throws a {@code SecurityException} if the
      * calling thread is not allowed to delete the specified file.
      * <p>
      * This method is invoked for the current security manager by the
-     * <code>delete</code> method of class <code>File</code>.
+     * {@code delete} method of class {@code File}.
      * <p>
-     * This method calls <code>checkPermission</code> with the
-     * <code>FilePermission(file,"delete")</code> permission.
+     * This method calls {@code checkPermission} with the
+     * {@code FilePermission(file,"delete")} permission.
      * <p>
      * If you override this method, then you should make a call to
-     * <code>super.checkDelete</code>
+     * {@code super.checkDelete}
      * at the point the overridden method would normally throw an
      * exception.
      *
      * @param      file   the system-dependent filename.
-     * @exception  SecurityException if the calling thread does not
+     * @throws     SecurityException if the calling thread does not
      *             have permission to delete the file.
-     * @exception  NullPointerException if the <code>file</code> argument is
-     *             <code>null</code>.
+     * @throws     NullPointerException if the {@code file} argument is
+     *             {@code null}.
      * @see        java.io.File#delete()
      * @see        #checkPermission(java.security.Permission) checkPermission
      */
@@ -868,32 +868,32 @@
     }
 
     /**
-     * Throws a <code>SecurityException</code> if the
+     * Throws a {@code SecurityException} if the
      * calling thread is not allowed to open a socket connection to the
      * specified host and port number.
      * <p>
-     * A port number of <code>-1</code> indicates that the calling
+     * A port number of {@code -1} indicates that the calling
      * method is attempting to determine the IP address of the specified
      * host name.
      * <p>
-     * This method calls <code>checkPermission</code> with the
-     * <code>SocketPermission(host+":"+port,"connect")</code> permission if
+     * This method calls {@code checkPermission} with the
+     * {@code SocketPermission(host+":"+port,"connect")} permission if
      * the port is not equal to -1. If the port is equal to -1, then
-     * it calls <code>checkPermission</code> with the
-     * <code>SocketPermission(host,"resolve")</code> permission.
+     * it calls {@code checkPermission} with the
+     * {@code SocketPermission(host,"resolve")} permission.
      * <p>
      * If you override this method, then you should make a call to
-     * <code>super.checkConnect</code>
+     * {@code super.checkConnect}
      * at the point the overridden method would normally throw an
      * exception.
      *
      * @param      host   the host name port to connect to.
      * @param      port   the protocol port to connect to.
-     * @exception  SecurityException  if the calling thread does not have
+     * @throws     SecurityException  if the calling thread does not have
      *             permission to open a socket connection to the specified
-     *               <code>host</code> and <code>port</code>.
-     * @exception  NullPointerException if the <code>host</code> argument is
-     *             <code>null</code>.
+     *               {@code host} and {@code port}.
+     * @throws     NullPointerException if the {@code host} argument is
+     *             {@code null}.
      * @see        #checkPermission(java.security.Permission) checkPermission
      */
     public void checkConnect(String host, int port) {
@@ -913,41 +913,41 @@
     }
 
     /**
-     * Throws a <code>SecurityException</code> if the
+     * Throws a {@code SecurityException} if the
      * specified security context is not allowed to open a socket
      * connection to the specified host and port number.
      * <p>
-     * A port number of <code>-1</code> indicates that the calling
+     * A port number of {@code -1} indicates that the calling
      * method is attempting to determine the IP address of the specified
      * host name.
-     * <p> If <code>context</code> is not an instance of
-     * <code>AccessControlContext</code> then a
-     * <code>SecurityException</code> is thrown.
+     * <p> If {@code context} is not an instance of
+     * {@code AccessControlContext} then a
+     * {@code SecurityException} is thrown.
      * <p>
      * Otherwise, the port number is checked. If it is not equal
-     * to -1, the <code>context</code>'s <code>checkPermission</code>
+     * to -1, the {@code context}'s {@code checkPermission}
      * method is called with a
-     * <code>SocketPermission(host+":"+port,"connect")</code> permission.
+     * {@code SocketPermission(host+":"+port,"connect")} permission.
      * If the port is equal to -1, then
-     * the <code>context</code>'s <code>checkPermission</code> method
+     * the {@code context}'s {@code checkPermission} method
      * is called with a
-     * <code>SocketPermission(host,"resolve")</code> permission.
+     * {@code SocketPermission(host,"resolve")} permission.
      * <p>
      * If you override this method, then you should make a call to
-     * <code>super.checkConnect</code>
+     * {@code super.checkConnect}
      * at the point the overridden method would normally throw an
      * exception.
      *
      * @param      host      the host name port to connect to.
      * @param      port      the protocol port to connect to.
      * @param      context   a system-dependent security context.
-     * @exception  SecurityException if the specified security context
-     *             is not an instance of <code>AccessControlContext</code>
-     *             (e.g., is <code>null</code>), or does not have permission
+     * @throws     SecurityException if the specified security context
+     *             is not an instance of {@code AccessControlContext}
+     *             (e.g., is {@code null}), or does not have permission
      *             to open a socket connection to the specified
-     *             <code>host</code> and <code>port</code>.
-     * @exception  NullPointerException if the <code>host</code> argument is
-     *             <code>null</code>.
+     *             {@code host} and {@code port}.
+     * @throws     NullPointerException if the {@code host} argument is
+     *             {@code null}.
      * @see        java.lang.SecurityManager#getSecurityContext()
      * @see        java.security.AccessControlContext#checkPermission(java.security.Permission)
      */
@@ -969,20 +969,20 @@
     }
 
     /**
-     * Throws a <code>SecurityException</code> if the
+     * Throws a {@code SecurityException} if the
      * calling thread is not allowed to wait for a connection request on
      * the specified local port number.
      * <p>
-     * This method calls <code>checkPermission</code> with the
-     * <code>SocketPermission("localhost:"+port,"listen")</code>.
+     * This method calls {@code checkPermission} with the
+     * {@code SocketPermission("localhost:"+port,"listen")}.
      * <p>
      * If you override this method, then you should make a call to
-     * <code>super.checkListen</code>
+     * {@code super.checkListen}
      * at the point the overridden method would normally throw an
      * exception.
      *
      * @param      port   the local port.
-     * @exception  SecurityException  if the calling thread does not have
+     * @throws     SecurityException  if the calling thread does not have
      *             permission to listen on the specified port.
      * @see        #checkPermission(java.security.Permission) checkPermission
      */
@@ -992,27 +992,27 @@
     }
 
     /**
-     * Throws a <code>SecurityException</code> if the
+     * Throws a {@code SecurityException} if the
      * calling thread is not permitted to accept a socket connection from
      * the specified host and port number.
      * <p>
      * This method is invoked for the current security manager by the
-     * <code>accept</code> method of class <code>ServerSocket</code>.
+     * {@code accept} method of class {@code ServerSocket}.
      * <p>
-     * This method calls <code>checkPermission</code> with the
-     * <code>SocketPermission(host+":"+port,"accept")</code> permission.
+     * This method calls {@code checkPermission} with the
+     * {@code SocketPermission(host+":"+port,"accept")} permission.
      * <p>
      * If you override this method, then you should make a call to
-     * <code>super.checkAccept</code>
+     * {@code super.checkAccept}
      * at the point the overridden method would normally throw an
      * exception.
      *
      * @param      host   the host name of the socket connection.
      * @param      port   the port number of the socket connection.
-     * @exception  SecurityException  if the calling thread does not have
+     * @throws     SecurityException  if the calling thread does not have
      *             permission to accept the connection.
-     * @exception  NullPointerException if the <code>host</code> argument is
-     *             <code>null</code>.
+     * @throws     NullPointerException if the {@code host} argument is
+     *             {@code null}.
      * @see        java.net.ServerSocket#accept()
      * @see        #checkPermission(java.security.Permission) checkPermission
      */
@@ -1028,24 +1028,24 @@
     }
 
     /**
-     * Throws a <code>SecurityException</code> if the
+     * Throws a {@code SecurityException} if the
      * calling thread is not allowed to use
      * (join/leave/send/receive) IP multicast.
      * <p>
-     * This method calls <code>checkPermission</code> with the
+     * This method calls {@code checkPermission} with the
      * <code>java.net.SocketPermission(maddr.getHostAddress(),
      * "accept,connect")</code> permission.
      * <p>
      * If you override this method, then you should make a call to
-     * <code>super.checkMulticast</code>
+     * {@code super.checkMulticast}
      * at the point the overridden method would normally throw an
      * exception.
      *
      * @param      maddr  Internet group address to be used.
-     * @exception  SecurityException  if the calling thread is not allowed to
+     * @throws     SecurityException  if the calling thread is not allowed to
      *  use (join/leave/send/receive) IP multicast.
-     * @exception  NullPointerException if the address argument is
-     *             <code>null</code>.
+     * @throws     NullPointerException if the address argument is
+     *             {@code null}.
      * @since      1.1
      * @see        #checkPermission(java.security.Permission) checkPermission
      */
@@ -1059,16 +1059,16 @@
     }
 
     /**
-     * Throws a <code>SecurityException</code> if the
+     * Throws a {@code SecurityException} if the
      * calling thread is not allowed to use
      * (join/leave/send/receive) IP multicast.
      * <p>
-     * This method calls <code>checkPermission</code> with the
+     * This method calls {@code checkPermission} with the
      * <code>java.net.SocketPermission(maddr.getHostAddress(),
      * "accept,connect")</code> permission.
      * <p>
      * If you override this method, then you should make a call to
-     * <code>super.checkMulticast</code>
+     * {@code super.checkMulticast}
      * at the point the overridden method would normally throw an
      * exception.
      *
@@ -1076,10 +1076,10 @@
      * @param      ttl        value in use, if it is multicast send.
      * Note: this particular implementation does not use the ttl
      * parameter.
-     * @exception  SecurityException  if the calling thread is not allowed to
+     * @throws     SecurityException  if the calling thread is not allowed to
      *  use (join/leave/send/receive) IP multicast.
-     * @exception  NullPointerException if the address argument is
-     *             <code>null</code>.
+     * @throws     NullPointerException if the address argument is
+     *             {@code null}.
      * @since      1.1
      * @deprecated Use #checkPermission(java.security.Permission) instead
      * @see        #checkPermission(java.security.Permission) checkPermission
@@ -1095,22 +1095,22 @@
     }
 
     /**
-     * Throws a <code>SecurityException</code> if the
+     * Throws a {@code SecurityException} if the
      * calling thread is not allowed to access or modify the system
      * properties.
      * <p>
-     * This method is used by the <code>getProperties</code> and
-     * <code>setProperties</code> methods of class <code>System</code>.
+     * This method is used by the {@code getProperties} and
+     * {@code setProperties} methods of class {@code System}.
      * <p>
-     * This method calls <code>checkPermission</code> with the
-     * <code>PropertyPermission("*", "read,write")</code> permission.
+     * This method calls {@code checkPermission} with the
+     * {@code PropertyPermission("*", "read,write")} permission.
      * <p>
      * If you override this method, then you should make a call to
-     * <code>super.checkPropertiesAccess</code>
+     * {@code super.checkPropertiesAccess}
      * at the point the overridden method would normally throw an
      * exception.
      *
-     * @exception  SecurityException  if the calling thread does not have
+     * @throws     SecurityException  if the calling thread does not have
      *             permission to access or modify the system properties.
      * @see        java.lang.System#getProperties()
      * @see        java.lang.System#setProperties(java.util.Properties)
@@ -1122,28 +1122,28 @@
     }
 
     /**
-     * Throws a <code>SecurityException</code> if the
+     * Throws a {@code SecurityException} if the
      * calling thread is not allowed to access the system property with
-     * the specified <code>key</code> name.
+     * the specified {@code key} name.
      * <p>
-     * This method is used by the <code>getProperty</code> method of
-     * class <code>System</code>.
+     * This method is used by the {@code getProperty} method of
+     * class {@code System}.
      * <p>
-     * This method calls <code>checkPermission</code> with the
-     * <code>PropertyPermission(key, "read")</code> permission.
+     * This method calls {@code checkPermission} with the
+     * {@code PropertyPermission(key, "read")} permission.
      * <p>
      * If you override this method, then you should make a call to
-     * <code>super.checkPropertyAccess</code>
+     * {@code super.checkPropertyAccess}
      * at the point the overridden method would normally throw an
      * exception.
      *
      * @param      key   a system property key.
      *
-     * @exception  SecurityException  if the calling thread does not have
+     * @throws     SecurityException  if the calling thread does not have
      *             permission to access the specified system property.
-     * @exception  NullPointerException if the <code>key</code> argument is
-     *             <code>null</code>.
-     * @exception  IllegalArgumentException if <code>key</code> is empty.
+     * @throws     NullPointerException if the {@code key} argument is
+     *             {@code null}.
+     * @throws     IllegalArgumentException if {@code key} is empty.
      *
      * @see        java.lang.System#getProperty(java.lang.String)
      * @see        #checkPermission(java.security.Permission) checkPermission
@@ -1154,19 +1154,19 @@
     }
 
     /**
-     * Throws a <code>SecurityException</code> if the
+     * Throws a {@code SecurityException} if the
      * calling thread is not allowed to initiate a print job request.
      * <p>
      * This method calls
-     * <code>checkPermission</code> with the
-     * <code>RuntimePermission("queuePrintJob")</code> permission.
+     * {@code checkPermission} with the
+     * {@code RuntimePermission("queuePrintJob")} permission.
      * <p>
      * If you override this method, then you should make a call to
-     * <code>super.checkPrintJobAccess</code>
+     * {@code super.checkPrintJobAccess}
      * at the point the overridden method would normally throw an
      * exception.
      *
-     * @exception  SecurityException  if the calling thread does not have
+     * @throws     SecurityException  if the calling thread does not have
      *             permission to initiate a print job request.
      * @since   1.1
      * @see        #checkPermission(java.security.Permission) checkPermission
@@ -1461,20 +1461,20 @@
     }
 
     /**
-     * Throws a <code>SecurityException</code> if the
+     * Throws a {@code SecurityException} if the
      * calling thread is not allowed to set the socket factory used by
-     * <code>ServerSocket</code> or <code>Socket</code>, or the stream
-     * handler factory used by <code>URL</code>.
+     * {@code ServerSocket} or {@code Socket}, or the stream
+     * handler factory used by {@code URL}.
      * <p>
-     * This method calls <code>checkPermission</code> with the
-     * <code>RuntimePermission("setFactory")</code> permission.
+     * This method calls {@code checkPermission} with the
+     * {@code RuntimePermission("setFactory")} permission.
      * <p>
      * If you override this method, then you should make a call to
-     * <code>super.checkSetFactory</code>
+     * {@code super.checkSetFactory}
      * at the point the overridden method would normally throw an
      * exception.
      *
-     * @exception  SecurityException  if the calling thread does not have
+     * @throws     SecurityException  if the calling thread does not have
      *             permission to specify a socket factory or a stream
      *             handler factory.
      *
@@ -1494,8 +1494,8 @@
      * <p> If the requested permission is allowed, this method returns
      * quietly. If denied, a SecurityException is raised.
      *
-     * <p> This method creates a <code>SecurityPermission</code> object for
-     * the given permission target name and calls <code>checkPermission</code>
+     * <p> This method creates a {@code SecurityPermission} object for
+     * the given permission target name and calls {@code checkPermission}
      * with it.
      *
      * <p> See the documentation for
@@ -1503,16 +1503,16 @@
      * a list of possible permission target names.
      *
      * <p> If you override this method, then you should make a call to
-     * <code>super.checkSecurityAccess</code>
+     * {@code super.checkSecurityAccess}
      * at the point the overridden method would normally throw an
      * exception.
      *
-     * @param target the target name of the <code>SecurityPermission</code>.
+     * @param target the target name of the {@code SecurityPermission}.
      *
-     * @exception SecurityException if the calling thread does not have
+     * @throws    SecurityException if the calling thread does not have
      * permission for the requested access.
-     * @exception NullPointerException if <code>target</code> is null.
-     * @exception IllegalArgumentException if <code>target</code> is empty.
+     * @throws    NullPointerException if {@code target} is null.
+     * @throws    IllegalArgumentException if {@code target} is empty.
      *
      * @since   1.1
      * @see        #checkPermission(java.security.Permission) checkPermission
--- a/src/java.base/share/classes/java/lang/StackOverflowError.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/StackOverflowError.java	Tue Sep 24 15:19:35 2019 -0400
@@ -38,14 +38,14 @@
     private static final long serialVersionUID = 8609175038441759607L;
 
     /**
-     * Constructs a <code>StackOverflowError</code> with no detail message.
+     * Constructs a {@code StackOverflowError} with no detail message.
      */
     public StackOverflowError() {
         super();
     }
 
     /**
-     * Constructs a <code>StackOverflowError</code> with the specified
+     * Constructs a {@code StackOverflowError} with the specified
      * detail message.
      *
      * @param   s   the detail message.
--- a/src/java.base/share/classes/java/lang/String.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/String.java	Tue Sep 24 15:19:35 2019 -0400
@@ -702,7 +702,7 @@
      * @param      index   the index of the {@code char} value.
      * @return     the {@code char} value at the specified index of this string.
      *             The first {@code char} value is at index {@code 0}.
-     * @exception  IndexOutOfBoundsException  if the {@code index}
+     * @throws     IndexOutOfBoundsException  if the {@code index}
      *             argument is negative or not less than the length of this
      *             string.
      */
@@ -731,7 +731,7 @@
      * @param      index the index to the {@code char} values
      * @return     the code point value of the character at the
      *             {@code index}
-     * @exception  IndexOutOfBoundsException  if the {@code index}
+     * @throws     IndexOutOfBoundsException  if the {@code index}
      *             argument is negative or not less than the length of this
      *             string.
      * @since      1.5
@@ -763,7 +763,7 @@
      *
      * @param     index the index following the code point that should be returned
      * @return    the Unicode code point value before the given index.
-     * @exception IndexOutOfBoundsException if the {@code index}
+     * @throws    IndexOutOfBoundsException if the {@code index}
      *            argument is less than 1 or greater than the length
      *            of this string.
      * @since     1.5
@@ -794,7 +794,7 @@
      * the text range.
      * @return the number of Unicode code points in the specified text
      * range
-     * @exception IndexOutOfBoundsException if the
+     * @throws    IndexOutOfBoundsException if the
      * {@code beginIndex} is negative, or {@code endIndex}
      * is larger than the length of this {@code String}, or
      * {@code beginIndex} is larger than {@code endIndex}.
@@ -821,7 +821,7 @@
      * @param index the index to be offset
      * @param codePointOffset the offset in code points
      * @return the index within this {@code String}
-     * @exception IndexOutOfBoundsException if {@code index}
+     * @throws    IndexOutOfBoundsException if {@code index}
      *   is negative or larger then the length of this
      *   {@code String}, or if {@code codePointOffset} is positive
      *   and the substring starting with {@code index} has fewer
@@ -858,7 +858,7 @@
      *                        to copy.
      * @param      dst        the destination array.
      * @param      dstBegin   the start offset in the destination array.
-     * @exception IndexOutOfBoundsException If any of the following
+     * @throws    IndexOutOfBoundsException If any of the following
      *            is true:
      *            <ul><li>{@code srcBegin} is negative.
      *            <li>{@code srcBegin} is greater than {@code srcEnd}
@@ -1867,7 +1867,7 @@
      *
      * @param      beginIndex   the beginning index, inclusive.
      * @return     the specified substring.
-     * @exception  IndexOutOfBoundsException  if
+     * @throws     IndexOutOfBoundsException  if
      *             {@code beginIndex} is negative or larger than the
      *             length of this {@code String} object.
      */
@@ -1890,7 +1890,7 @@
      * @param      beginIndex   the beginning index, inclusive.
      * @param      endIndex     the ending index, exclusive.
      * @return     the specified substring.
-     * @exception  IndexOutOfBoundsException  if the
+     * @throws     IndexOutOfBoundsException  if the
      *             {@code beginIndex} is negative, or
      *             {@code endIndex} is larger than the length of
      *             this {@code String} object, or
@@ -3374,7 +3374,7 @@
      * @param   count    length of the subarray.
      * @return  a {@code String} that contains the characters of the
      *          specified subarray of the character array.
-     * @exception IndexOutOfBoundsException if {@code offset} is
+     * @throws    IndexOutOfBoundsException if {@code offset} is
      *          negative, or {@code count} is negative, or
      *          {@code offset+count} is larger than
      *          {@code data.length}.
@@ -3391,7 +3391,7 @@
      * @param   count    length of the subarray.
      * @return  a {@code String} that contains the characters of the
      *          specified subarray of the character array.
-     * @exception IndexOutOfBoundsException if {@code offset} is
+     * @throws    IndexOutOfBoundsException if {@code offset} is
      *          negative, or {@code count} is negative, or
      *          {@code offset+count} is larger than
      *          {@code data.length}.
--- a/src/java.base/share/classes/java/lang/UnknownError.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/UnknownError.java	Tue Sep 24 15:19:35 2019 -0400
@@ -38,14 +38,14 @@
     private static final long serialVersionUID = 2524784860676771849L;
 
     /**
-     * Constructs an <code>UnknownError</code> with no detail message.
+     * Constructs an {@code UnknownError} with no detail message.
      */
     public UnknownError() {
         super();
     }
 
     /**
-     * Constructs an <code>UnknownError</code> with the specified detail
+     * Constructs an {@code UnknownError} with the specified detail
      * message.
      *
      * @param   s   the detail message.
--- a/src/java.base/share/classes/java/lang/UnsatisfiedLinkError.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/UnsatisfiedLinkError.java	Tue Sep 24 15:19:35 2019 -0400
@@ -27,7 +27,7 @@
 
 /**
  * Thrown if the Java Virtual Machine cannot find an appropriate
- * native-language definition of a method declared <code>native</code>.
+ * native-language definition of a method declared {@code native}.
  *
  * @author unascribed
  * @see     java.lang.Runtime
@@ -39,14 +39,14 @@
     private static final long serialVersionUID = -4019343241616879428L;
 
     /**
-     * Constructs an <code>UnsatisfiedLinkError</code> with no detail message.
+     * Constructs an {@code UnsatisfiedLinkError} with no detail message.
      */
     public UnsatisfiedLinkError() {
         super();
     }
 
     /**
-     * Constructs an <code>UnsatisfiedLinkError</code> with the
+     * Constructs an {@code UnsatisfiedLinkError} with the
      * specified detail message.
      *
      * @param   s   the detail message.
--- a/src/java.base/share/classes/java/lang/UnsupportedClassVersionError.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/UnsupportedClassVersionError.java	Tue Sep 24 15:19:35 2019 -0400
@@ -38,7 +38,7 @@
     private static final long serialVersionUID = -7123279212883497373L;
 
     /**
-     * Constructs a <code>UnsupportedClassVersionError</code>
+     * Constructs a {@code UnsupportedClassVersionError}
      * with no detail message.
      */
     public UnsupportedClassVersionError() {
@@ -46,7 +46,7 @@
     }
 
     /**
-     * Constructs a <code>UnsupportedClassVersionError</code> with
+     * Constructs a {@code UnsupportedClassVersionError} with
      * the specified detail message.
      *
      * @param   s   the detail message.
--- a/src/java.base/share/classes/java/lang/UnsupportedOperationException.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/UnsupportedOperationException.java	Tue Sep 24 15:19:35 2019 -0400
@@ -56,7 +56,7 @@
      * Constructs a new exception with the specified detail message and
      * cause.
      *
-     * <p>Note that the detail message associated with <code>cause</code> is
+     * <p>Note that the detail message associated with {@code cause} is
      * <i>not</i> automatically incorporated in this exception's detail
      * message.
      *
--- a/src/java.base/share/classes/java/lang/VerifyError.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/VerifyError.java	Tue Sep 24 15:19:35 2019 -0400
@@ -39,14 +39,14 @@
     private static final long serialVersionUID = 7001962396098498785L;
 
     /**
-     * Constructs an <code>VerifyError</code> with no detail message.
+     * Constructs an {@code VerifyError} with no detail message.
      */
     public VerifyError() {
         super();
     }
 
     /**
-     * Constructs an <code>VerifyError</code> with the specified detail message.
+     * Constructs an {@code VerifyError} with the specified detail message.
      *
      * @param   s   the detail message.
      */
--- a/src/java.base/share/classes/java/lang/VirtualMachineError.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/VirtualMachineError.java	Tue Sep 24 15:19:35 2019 -0400
@@ -38,14 +38,14 @@
     private static final long serialVersionUID = 4161983926571568670L;
 
     /**
-     * Constructs a <code>VirtualMachineError</code> with no detail message.
+     * Constructs a {@code VirtualMachineError} with no detail message.
      */
     public VirtualMachineError() {
         super();
     }
 
     /**
-     * Constructs a <code>VirtualMachineError</code> with the specified
+     * Constructs a {@code VirtualMachineError} with the specified
      * detail message.
      *
      * @param   message   the detail message.
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandleInfo.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandleInfo.java	Tue Sep 24 15:19:35 2019 -0400
@@ -199,9 +199,9 @@
      * @param expected a class object representing the desired result type {@code T}
      * @param lookup the lookup object that created this MethodHandleInfo, or one with equivalent access privileges
      * @return a reference to the method, constructor, or field object
-     * @exception ClassCastException if the member is not of the expected type
-     * @exception NullPointerException if either argument is {@code null}
-     * @exception IllegalArgumentException if the underlying member is not accessible to the given lookup object
+     * @throws    ClassCastException if the member is not of the expected type
+     * @throws    NullPointerException if either argument is {@code null}
+     * @throws    IllegalArgumentException if the underlying member is not accessible to the given lookup object
      */
     public <T extends Member> T reflectAs(Class<T> expected, Lookup lookup);
 
@@ -243,7 +243,7 @@
      * The conventional prefix "REF_" is omitted.
      * @param referenceKind an integer code for a kind of reference used to access a class member
      * @return a mixed-case string such as {@code "getField"}
-     * @exception IllegalArgumentException if the argument is not a valid
+     * @throws    IllegalArgumentException if the argument is not a valid
      *            <a href="MethodHandleInfo.html#refkinds">reference kind number</a>
      */
     public static String referenceKindToString(int referenceKind) {
@@ -278,9 +278,9 @@
      * @param name the {@linkplain #getName member name} part of the symbolic reference
      * @param type the {@linkplain #getMethodType method type} part of the symbolic reference
      * @return a string of the form {@code "RK C.N:MT"}
-     * @exception IllegalArgumentException if the first argument is not a valid
+     * @throws    IllegalArgumentException if the first argument is not a valid
      *            <a href="MethodHandleInfo.html#refkinds">reference kind number</a>
-     * @exception NullPointerException if any reference argument is {@code null}
+     * @throws    NullPointerException if any reference argument is {@code null}
      */
     public static String toString(int kind, Class<?> defc, String name, MethodType type) {
         Objects.requireNonNull(name); Objects.requireNonNull(type);
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Tue Sep 24 15:19:35 2019 -0400
@@ -274,10 +274,10 @@
      * @param target a direct method handle to crack into symbolic reference components
      * @param expected a class object representing the desired result type {@code T}
      * @return a reference to the method, constructor, or field object
-     * @exception SecurityException if the caller is not privileged to call {@code setAccessible}
-     * @exception NullPointerException if either argument is {@code null}
-     * @exception IllegalArgumentException if the target is not a direct method handle
-     * @exception ClassCastException if the member is not of the expected type
+     * @throws    SecurityException if the caller is not privileged to call {@code setAccessible}
+     * @throws    NullPointerException if either argument is {@code null}
+     * @throws    IllegalArgumentException if the target is not a direct method handle
+     * @throws    ClassCastException if the member is not of the expected type
      * @since 1.8
      */
     public static <T extends Member> T
@@ -1042,7 +1042,7 @@
      * <td style="text-align:center">IAE</td>
      * </tr>
      * <tr>
-     * <td>{@code ANY.in(X)}, for inaccessible <code>X</code></td>
+     * <td>{@code ANY.in(X)}, for inaccessible {@code X}</td>
      * <td></td>
      * <td></td>
      * <td></td>
@@ -1754,7 +1754,7 @@
          *                                or if the method is not {@code static},
          *                                or if the method's variable arity modifier bit
          *                                is set and {@code asVarargsCollector} fails
-         * @exception SecurityException if a security manager is present and it
+         * @throws    SecurityException if a security manager is present and it
          *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
          * @throws NullPointerException if any argument is null
          */
@@ -1839,7 +1839,7 @@
          *                                or if the method is {@code static},
          *                                or if the method's variable arity modifier bit
          *                                is set and {@code asVarargsCollector} fails
-         * @exception SecurityException if a security manager is present and it
+         * @throws    SecurityException if a security manager is present and it
          *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
          * @throws NullPointerException if any argument is null
          */
@@ -1913,7 +1913,7 @@
          * @throws IllegalAccessException if access checking fails
          *                                or if the method's variable arity modifier bit
          *                                is set and {@code asVarargsCollector} fails
-         * @exception SecurityException if a security manager is present and it
+         * @throws    SecurityException if a security manager is present and it
          *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
          * @throws NullPointerException if any argument is null
          */
@@ -1941,13 +1941,13 @@
          *
          * @param targetName the fully qualified name of the class to be looked up.
          * @return the requested class.
-         * @exception SecurityException if a security manager is present and it
+         * @throws    SecurityException if a security manager is present and it
          *            <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
          * @throws LinkageError if the linkage fails
          * @throws ClassNotFoundException if the class cannot be loaded by the lookup class' loader.
          * @throws IllegalAccessException if the class is not accessible, using the allowed access
          * modes.
-         * @exception SecurityException if a security manager is present and it
+         * @throws    SecurityException if a security manager is present and it
          *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
          *
          * @jls 12.2 Loading of Classes and Interfaces
@@ -2022,7 +2022,7 @@
          * @return the class that has been access-checked
          * @throws IllegalAccessException if the class is not accessible from the lookup class
          * and previous lookup class, if present, using the allowed access modes.
-         * @exception SecurityException if a security manager is present and it
+         * @throws    SecurityException if a security manager is present and it
          *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
          * @since 9
          * @see <a href="#cross-module-lookup">Cross-module lookups</a>
@@ -2104,7 +2104,7 @@
          *                                or if the method is {@code static},
          *                                or if the method's variable arity modifier bit
          *                                is set and {@code asVarargsCollector} fails
-         * @exception SecurityException if a security manager is present and it
+         * @throws    SecurityException if a security manager is present and it
          *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
          * @throws NullPointerException if any argument is null
          */
@@ -2129,7 +2129,7 @@
          * @return a method handle which can load values from the field
          * @throws NoSuchFieldException if the field does not exist
          * @throws IllegalAccessException if access checking fails, or if the field is {@code static}
-         * @exception SecurityException if a security manager is present and it
+         * @throws    SecurityException if a security manager is present and it
          *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
          * @throws NullPointerException if any argument is null
          * @see #findVarHandle(Class, String, Class)
@@ -2153,7 +2153,7 @@
          * @throws NoSuchFieldException if the field does not exist
          * @throws IllegalAccessException if access checking fails, or if the field is {@code static}
          *                                or {@code final}
-         * @exception SecurityException if a security manager is present and it
+         * @throws    SecurityException if a security manager is present and it
          *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
          * @throws NullPointerException if any argument is null
          * @see #findVarHandle(Class, String, Class)
@@ -2226,7 +2226,7 @@
          * @return a VarHandle giving access to non-static fields.
          * @throws NoSuchFieldException if the field does not exist
          * @throws IllegalAccessException if access checking fails, or if the field is {@code static}
-         * @exception SecurityException if a security manager is present and it
+         * @throws    SecurityException if a security manager is present and it
          *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
          * @throws NullPointerException if any argument is null
          * @since 9
@@ -2252,7 +2252,7 @@
          * @return a method handle which can load values from the field
          * @throws NoSuchFieldException if the field does not exist
          * @throws IllegalAccessException if access checking fails, or if the field is not {@code static}
-         * @exception SecurityException if a security manager is present and it
+         * @throws    SecurityException if a security manager is present and it
          *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
          * @throws NullPointerException if any argument is null
          */
@@ -2277,7 +2277,7 @@
          * @throws NoSuchFieldException if the field does not exist
          * @throws IllegalAccessException if access checking fails, or if the field is not {@code static}
          *                                or is {@code final}
-         * @exception SecurityException if a security manager is present and it
+         * @throws    SecurityException if a security manager is present and it
          *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
          * @throws NullPointerException if any argument is null
          */
@@ -2351,7 +2351,7 @@
          * @return a VarHandle giving access to a static field
          * @throws NoSuchFieldException if the field does not exist
          * @throws IllegalAccessException if access checking fails, or if the field is not {@code static}
-         * @exception SecurityException if a security manager is present and it
+         * @throws    SecurityException if a security manager is present and it
          *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
          * @throws NullPointerException if any argument is null
          * @since 9
@@ -2405,7 +2405,7 @@
          * @throws IllegalAccessException if access checking fails
          *                                or if the method's variable arity modifier bit
          *                                is set and {@code asVarargsCollector} fails
-         * @exception SecurityException if a security manager is present and it
+         * @throws    SecurityException if a security manager is present and it
          *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
          * @throws NullPointerException if any argument is null
          * @see MethodHandle#bindTo
@@ -2707,10 +2707,10 @@
          * and was created by a lookup object for a different class.
          * @param target a direct method handle to crack into symbolic reference components
          * @return a symbolic reference which can be used to reconstruct this method handle from this lookup object
-         * @exception SecurityException if a security manager is present and it
+         * @throws    SecurityException if a security manager is present and it
          *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
          * @throws IllegalArgumentException if the target is not a direct method handle or if access checking fails
-         * @exception NullPointerException if the target is {@code null}
+         * @throws    NullPointerException if the target is {@code null}
          * @see MethodHandleInfo
          * @since 1.8
          */
--- a/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java	Tue Sep 24 15:19:35 2019 -0400
@@ -25,7 +25,6 @@
 
 package java.lang.invoke;
 
-import jdk.internal.vm.annotation.Stable;
 import sun.invoke.util.Wrapper;
 
 import java.lang.ref.SoftReference;
@@ -52,7 +51,8 @@
     final MethodType basicType;         // the canonical erasure, with primitives simplified
 
     // Cached adapter information:
-    @Stable final SoftReference<MethodHandle>[] methodHandles;
+    final SoftReference<MethodHandle>[] methodHandles;
+
     // Indexes into methodHandles:
     static final int
             MH_BASIC_INV      =  0,  // cached instance of MH.invokeBasic
@@ -61,7 +61,8 @@
             MH_LIMIT          =  3;
 
     // Cached lambda form information, for basic types only:
-    final @Stable SoftReference<LambdaForm>[] lambdaForms;
+    final SoftReference<LambdaForm>[] lambdaForms;
+
     // Indexes into lambdaForms:
     static final int
             LF_INVVIRTUAL              =  0,  // DMH invokeVirtual
@@ -103,15 +104,7 @@
         return basicType;
     }
 
-    private boolean assertIsBasicType() {
-        // primitives must be flattened also
-        assert(erasedType == basicType)
-                : "erasedType: " + erasedType + " != basicType: " + basicType;
-        return true;
-    }
-
     public MethodHandle cachedMethodHandle(int which) {
-        assert(assertIsBasicType());
         SoftReference<MethodHandle> entry = methodHandles[which];
         return (entry != null) ? entry.get() : null;
     }
@@ -130,7 +123,6 @@
     }
 
     public LambdaForm cachedLambdaForm(int which) {
-        assert(assertIsBasicType());
         SoftReference<LambdaForm> entry = lambdaForms[which];
         return (entry != null) ? entry.get() : null;
     }
@@ -162,59 +154,57 @@
 
         // Walk the argument types, looking for primitives.
         short primitiveCount = 0, longArgCount = 0;
-        Class<?>[] epts = ptypes;
-        Class<?>[] bpts = epts;
-        for (int i = 0; i < epts.length; i++) {
-            Class<?> pt = epts[i];
-            if (pt != Object.class) {
+        Class<?>[] erasedPtypes = ptypes;
+        Class<?>[] basicPtypes = erasedPtypes;
+        for (int i = 0; i < erasedPtypes.length; i++) {
+            Class<?> ptype = erasedPtypes[i];
+            if (ptype != Object.class) {
                 ++primitiveCount;
-                Wrapper w = Wrapper.forPrimitiveType(pt);
+                Wrapper w = Wrapper.forPrimitiveType(ptype);
                 if (w.isDoubleWord())  ++longArgCount;
-                if (w.isSubwordOrInt() && pt != int.class) {
-                    if (bpts == epts)
-                        bpts = bpts.clone();
-                    bpts[i] = int.class;
+                if (w.isSubwordOrInt() && ptype != int.class) {
+                    if (basicPtypes == erasedPtypes)
+                        basicPtypes = basicPtypes.clone();
+                    basicPtypes[i] = int.class;
                 }
             }
         }
         pslotCount += longArgCount;                  // #slots = #args + #longs
-        Class<?> rt = erasedType.returnType();
-        Class<?> bt = rt;
-        if (rt != Object.class) {
+        Class<?> returnType = erasedType.returnType();
+        Class<?> basicReturnType = returnType;
+        if (returnType != Object.class) {
             ++primitiveCount; // even void.class counts as a prim here
-            Wrapper w = Wrapper.forPrimitiveType(rt);
-            if (w.isSubwordOrInt() && rt != int.class)
-                bt = int.class;
+            Wrapper w = Wrapper.forPrimitiveType(returnType);
+            if (w.isSubwordOrInt() && returnType != int.class)
+                basicReturnType = int.class;
         }
-        if (epts == bpts && bt == rt) {
+        if (erasedPtypes == basicPtypes && basicReturnType == returnType) {
+            // Basic type
             this.basicType = erasedType;
+
+            if (pslotCount >= 256)  throw newIllegalArgumentException("too many arguments");
+
+            this.primitiveCount = primitiveCount;
+            this.parameterSlotCount = (short)pslotCount;
+            this.lambdaForms   = new SoftReference[LF_LIMIT];
+            this.methodHandles = new SoftReference[MH_LIMIT];
         } else {
-            this.basicType = MethodType.makeImpl(bt, bpts, true);
+            this.basicType = MethodType.makeImpl(basicReturnType, basicPtypes, true);
             // fill in rest of data from the basic type:
             MethodTypeForm that = this.basicType.form();
             assert(this != that);
+
             this.parameterSlotCount = that.parameterSlotCount;
             this.primitiveCount = that.primitiveCount;
             this.methodHandles = null;
             this.lambdaForms = null;
-            return;
         }
-
-        if (pslotCount >= 256)  throw newIllegalArgumentException("too many arguments");
-
-        this.primitiveCount = primitiveCount;
-        this.parameterSlotCount = (short)pslotCount;
-
-        // Initialize caches, but only for basic types
-        assert(basicType == erasedType);
-        this.lambdaForms   = new SoftReference[LF_LIMIT];
-        this.methodHandles = new SoftReference[MH_LIMIT];
     }
 
-    public int parameterCount() {                      // # outgoing values
+    public int parameterCount() {
         return erasedType.parameterCount();
     }
-    public int parameterSlotCount() {                  // # outgoing interpreter slots
+    public int parameterSlotCount() {
         return parameterSlotCount;
     }
     public boolean hasPrimitives() {
@@ -250,17 +240,17 @@
      */
     public static MethodType canonicalize(MethodType mt, int howRet, int howArgs) {
         Class<?>[] ptypes = mt.ptypes();
-        Class<?>[] ptc = canonicalizeAll(ptypes, howArgs);
+        Class<?>[] ptypesCanonical = canonicalizeAll(ptypes, howArgs);
         Class<?> rtype = mt.returnType();
-        Class<?> rtc = canonicalize(rtype, howRet);
-        if (ptc == null && rtc == null) {
+        Class<?> rtypeCanonical = canonicalize(rtype, howRet);
+        if (ptypesCanonical == null && rtypeCanonical == null) {
             // It is already canonical.
             return null;
         }
         // Find the erased version of the method type:
-        if (rtc == null)  rtc = rtype;
-        if (ptc == null)  ptc = ptypes;
-        return MethodType.makeImpl(rtc, ptc, true);
+        if (rtypeCanonical == null)  rtypeCanonical = rtype;
+        if (ptypesCanonical == null)  ptypesCanonical = ptypes;
+        return MethodType.makeImpl(rtypeCanonical, ptypesCanonical, true);
     }
 
     /** Canonicalize the given return or param type.
--- a/src/java.base/share/classes/java/lang/invoke/VarForm.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/invoke/VarForm.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -139,4 +139,4 @@
         }
         return table;
     }
-}
\ No newline at end of file
+}
--- a/src/java.base/share/classes/java/lang/invoke/package-info.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/invoke/package-info.java	Tue Sep 24 15:19:35 2019 -0400
@@ -216,22 +216,22 @@
  * <tbody>
  * <tr><th scope="row" style="font-weight:normal; vertical-align:top">*</th><td>
  *     <ul style="list-style:none; padding-left: 0; margin:0">
- *     <li><code>CallSite bootstrap(Lookup caller, String name, MethodType type, Object... args)</code>
- *     <li><code>CallSite bootstrap(Object... args)</code>
- *     <li><code>CallSite bootstrap(Object caller, Object... nameAndTypeWithArgs)</code>
+ *     <li>{@code CallSite bootstrap(Lookup caller, String name, MethodType type, Object... args)}
+ *     <li>{@code CallSite bootstrap(Object... args)}
+ *     <li>{@code CallSite bootstrap(Object caller, Object... nameAndTypeWithArgs)}
  *     </ul></td></tr>
  * <tr><th scope="row" style="font-weight:normal; vertical-align:top">0</th><td>
  *     <ul style="list-style:none; padding-left: 0; margin:0">
- *     <li><code>CallSite bootstrap(Lookup caller, String name, MethodType type)</code>
- *     <li><code>CallSite bootstrap(Lookup caller, Object... nameAndType)</code>
+ *     <li>{@code CallSite bootstrap(Lookup caller, String name, MethodType type)}
+ *     <li>{@code CallSite bootstrap(Lookup caller, Object... nameAndType)}
  *     </ul></td></tr>
  * <tr><th scope="row" style="font-weight:normal; vertical-align:top">1</th><td>
- *     <code>CallSite bootstrap(Lookup caller, String name, MethodType type, Object arg)</code></td></tr>
+ *     {@code CallSite bootstrap(Lookup caller, String name, MethodType type, Object arg)}</td></tr>
  * <tr><th scope="row" style="font-weight:normal; vertical-align:top">2</th><td>
  *     <ul style="list-style:none; padding-left: 0; margin:0">
- *     <li><code>CallSite bootstrap(Lookup caller, String name, MethodType type, Object... args)</code>
- *     <li><code>CallSite bootstrap(Lookup caller, String name, MethodType type, String... args)</code>
- *     <li><code>CallSite bootstrap(Lookup caller, String name, MethodType type, String x, int y)</code>
+ *     <li>{@code CallSite bootstrap(Lookup caller, String name, MethodType type, Object... args)}
+ *     <li>{@code CallSite bootstrap(Lookup caller, String name, MethodType type, String... args)}
+ *     <li>{@code CallSite bootstrap(Lookup caller, String name, MethodType type, String x, int y)}
  *     </ul></td></tr>
  * </tbody>
  * </table>
--- a/src/java.base/share/classes/java/lang/ref/Reference.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/ref/Reference.java	Tue Sep 24 15:19:35 2019 -0400
@@ -323,10 +323,10 @@
     /**
      * Returns this reference object's referent.  If this reference object has
      * been cleared, either by the program or by the garbage collector, then
-     * this method returns <code>null</code>.
+     * this method returns {@code null}.
      *
      * @return   The object to which this reference refers, or
-     *           <code>null</code> if this reference object has been cleared
+     *           {@code null} if this reference object has been cleared
      */
     @HotSpotIntrinsicCandidate
     public T get() {
@@ -350,9 +350,9 @@
      * Tells whether or not this reference object has been enqueued, either by
      * the program or by the garbage collector.  If this reference object was
      * not registered with a queue when it was created, then this method will
-     * always return <code>false</code>.
+     * always return {@code false}.
      *
-     * @return   <code>true</code> if and only if this reference object has
+     * @return   {@code true} if and only if this reference object has
      *           been enqueued
      */
     public boolean isEnqueued() {
@@ -366,8 +366,8 @@
      * <p> This method is invoked only by Java code; when the garbage collector
      * enqueues references it does so directly, without invoking this method.
      *
-     * @return   <code>true</code> if this reference object was successfully
-     *           enqueued; <code>false</code> if it was already enqueued or if
+     * @return   {@code true} if this reference object was successfully
+     *           enqueued; {@code false} if it was already enqueued or if
      *           it was not registered with a queue when it was created
      */
     public boolean enqueue() {
--- a/src/java.base/share/classes/java/lang/reflect/Array.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/reflect/Array.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -61,17 +61,17 @@
      * <p>The number of dimensions of the new array must not
      * exceed 255.
      *
-     * @param componentType the {@code Class} object representing the
-     * component type of the new array
-     * @param length the length of the new array
+     * @param  componentType the {@code Class} object representing the
+     *         component type of the new array
+     * @param  length the length of the new array
      * @return the new array
-     * @exception NullPointerException if the specified
-     * {@code componentType} parameter is null
-     * @exception IllegalArgumentException if componentType is {@link
-     * Void#TYPE} or if the number of dimensions of the requested array
-     * instance exceed 255.
-     * @exception NegativeArraySizeException if the specified {@code length}
-     * is negative
+     * @throws NullPointerException if the specified
+     *         {@code componentType} parameter is null
+     * @throws IllegalArgumentException if componentType is {@link
+     *         Void#TYPE} or if the number of dimensions of the requested array
+     *         instance exceed 255.
+     * @throws NegativeArraySizeException if the specified {@code length}
+     *         is negative
      */
     public static Object newInstance(Class<?> componentType, int length)
         throws NegativeArraySizeException {
@@ -100,13 +100,13 @@
      * @param dimensions an array of {@code int} representing the dimensions of
      * the new array
      * @return the new array
-     * @exception NullPointerException if the specified
+     * @throws    NullPointerException if the specified
      * {@code componentType} argument is null
-     * @exception IllegalArgumentException if the specified {@code dimensions}
+     * @throws    IllegalArgumentException if the specified {@code dimensions}
      * argument is a zero-dimensional array, if componentType is {@link
      * Void#TYPE}, or if the number of dimensions of the requested array
      * instance exceed 255.
-     * @exception NegativeArraySizeException if any of the components in
+     * @throws    NegativeArraySizeException if any of the components in
      * the specified {@code dimensions} argument is negative.
      */
     public static Object newInstance(Class<?> componentType, int... dimensions)
@@ -119,7 +119,7 @@
      *
      * @param array the array
      * @return the length of the array
-     * @exception IllegalArgumentException if the object argument is not
+     * @throws    IllegalArgumentException if the object argument is not
      * an array
      */
     @HotSpotIntrinsicCandidate
@@ -135,10 +135,10 @@
      * @param index the index
      * @return the (possibly wrapped) value of the indexed component in
      * the specified array
-     * @exception NullPointerException If the specified object is null
-     * @exception IllegalArgumentException If the specified object is not
+     * @throws    NullPointerException If the specified object is null
+     * @throws    IllegalArgumentException If the specified object is not
      * an array
-     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
+     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
      * argument is negative, or if it is greater than or equal to the
      * length of the specified array
      */
@@ -152,11 +152,11 @@
      * @param array the array
      * @param index the index
      * @return the value of the indexed component in the specified array
-     * @exception NullPointerException If the specified object is null
-     * @exception IllegalArgumentException If the specified object is not
+     * @throws    NullPointerException If the specified object is null
+     * @throws    IllegalArgumentException If the specified object is not
      * an array, or if the indexed element cannot be converted to the
      * return type by an identity or widening conversion
-     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
+     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
      * argument is negative, or if it is greater than or equal to the
      * length of the specified array
      * @see Array#get
@@ -171,11 +171,11 @@
      * @param array the array
      * @param index the index
      * @return the value of the indexed component in the specified array
-     * @exception NullPointerException If the specified object is null
-     * @exception IllegalArgumentException If the specified object is not
+     * @throws    NullPointerException If the specified object is null
+     * @throws    IllegalArgumentException If the specified object is not
      * an array, or if the indexed element cannot be converted to the
      * return type by an identity or widening conversion
-     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
+     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
      * argument is negative, or if it is greater than or equal to the
      * length of the specified array
      * @see Array#get
@@ -190,11 +190,11 @@
      * @param array the array
      * @param index the index
      * @return the value of the indexed component in the specified array
-     * @exception NullPointerException If the specified object is null
-     * @exception IllegalArgumentException If the specified object is not
+     * @throws    NullPointerException If the specified object is null
+     * @throws    IllegalArgumentException If the specified object is not
      * an array, or if the indexed element cannot be converted to the
      * return type by an identity or widening conversion
-     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
+     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
      * argument is negative, or if it is greater than or equal to the
      * length of the specified array
      * @see Array#get
@@ -209,11 +209,11 @@
      * @param array the array
      * @param index the index
      * @return the value of the indexed component in the specified array
-     * @exception NullPointerException If the specified object is null
-     * @exception IllegalArgumentException If the specified object is not
+     * @throws    NullPointerException If the specified object is null
+     * @throws    IllegalArgumentException If the specified object is not
      * an array, or if the indexed element cannot be converted to the
      * return type by an identity or widening conversion
-     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
+     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
      * argument is negative, or if it is greater than or equal to the
      * length of the specified array
      * @see Array#get
@@ -228,11 +228,11 @@
      * @param array the array
      * @param index the index
      * @return the value of the indexed component in the specified array
-     * @exception NullPointerException If the specified object is null
-     * @exception IllegalArgumentException If the specified object is not
+     * @throws    NullPointerException If the specified object is null
+     * @throws    IllegalArgumentException If the specified object is not
      * an array, or if the indexed element cannot be converted to the
      * return type by an identity or widening conversion
-     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
+     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
      * argument is negative, or if it is greater than or equal to the
      * length of the specified array
      * @see Array#get
@@ -247,11 +247,11 @@
      * @param array the array
      * @param index the index
      * @return the value of the indexed component in the specified array
-     * @exception NullPointerException If the specified object is null
-     * @exception IllegalArgumentException If the specified object is not
+     * @throws    NullPointerException If the specified object is null
+     * @throws    IllegalArgumentException If the specified object is not
      * an array, or if the indexed element cannot be converted to the
      * return type by an identity or widening conversion
-     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
+     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
      * argument is negative, or if it is greater than or equal to the
      * length of the specified array
      * @see Array#get
@@ -266,11 +266,11 @@
      * @param array the array
      * @param index the index
      * @return the value of the indexed component in the specified array
-     * @exception NullPointerException If the specified object is null
-     * @exception IllegalArgumentException If the specified object is not
+     * @throws    NullPointerException If the specified object is null
+     * @throws    IllegalArgumentException If the specified object is not
      * an array, or if the indexed element cannot be converted to the
      * return type by an identity or widening conversion
-     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
+     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
      * argument is negative, or if it is greater than or equal to the
      * length of the specified array
      * @see Array#get
@@ -285,11 +285,11 @@
      * @param array the array
      * @param index the index
      * @return the value of the indexed component in the specified array
-     * @exception NullPointerException If the specified object is null
-     * @exception IllegalArgumentException If the specified object is not
+     * @throws    NullPointerException If the specified object is null
+     * @throws    IllegalArgumentException If the specified object is not
      * an array, or if the indexed element cannot be converted to the
      * return type by an identity or widening conversion
-     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
+     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
      * argument is negative, or if it is greater than or equal to the
      * length of the specified array
      * @see Array#get
@@ -305,12 +305,12 @@
      * @param array the array
      * @param index the index into the array
      * @param value the new value of the indexed component
-     * @exception NullPointerException If the specified object argument
+     * @throws    NullPointerException If the specified object argument
      * is null
-     * @exception IllegalArgumentException If the specified object argument
+     * @throws    IllegalArgumentException If the specified object argument
      * is not an array, or if the array component type is primitive and
      * an unwrapping conversion fails
-     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
+     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
      * argument is negative, or if it is greater than or equal to
      * the length of the specified array
      */
@@ -323,13 +323,13 @@
      * @param array the array
      * @param index the index into the array
      * @param z the new value of the indexed component
-     * @exception NullPointerException If the specified object argument
+     * @throws    NullPointerException If the specified object argument
      * is null
-     * @exception IllegalArgumentException If the specified object argument
+     * @throws    IllegalArgumentException If the specified object argument
      * is not an array, or if the specified value cannot be converted
      * to the underlying array's component type by an identity or a
      * primitive widening conversion
-     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
+     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
      * argument is negative, or if it is greater than or equal to
      * the length of the specified array
      * @see Array#set
@@ -343,13 +343,13 @@
      * @param array the array
      * @param index the index into the array
      * @param b the new value of the indexed component
-     * @exception NullPointerException If the specified object argument
+     * @throws    NullPointerException If the specified object argument
      * is null
-     * @exception IllegalArgumentException If the specified object argument
+     * @throws    IllegalArgumentException If the specified object argument
      * is not an array, or if the specified value cannot be converted
      * to the underlying array's component type by an identity or a
      * primitive widening conversion
-     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
+     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
      * argument is negative, or if it is greater than or equal to
      * the length of the specified array
      * @see Array#set
@@ -363,13 +363,13 @@
      * @param array the array
      * @param index the index into the array
      * @param c the new value of the indexed component
-     * @exception NullPointerException If the specified object argument
+     * @throws    NullPointerException If the specified object argument
      * is null
-     * @exception IllegalArgumentException If the specified object argument
+     * @throws    IllegalArgumentException If the specified object argument
      * is not an array, or if the specified value cannot be converted
      * to the underlying array's component type by an identity or a
      * primitive widening conversion
-     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
+     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
      * argument is negative, or if it is greater than or equal to
      * the length of the specified array
      * @see Array#set
@@ -383,13 +383,13 @@
      * @param array the array
      * @param index the index into the array
      * @param s the new value of the indexed component
-     * @exception NullPointerException If the specified object argument
+     * @throws    NullPointerException If the specified object argument
      * is null
-     * @exception IllegalArgumentException If the specified object argument
+     * @throws    IllegalArgumentException If the specified object argument
      * is not an array, or if the specified value cannot be converted
      * to the underlying array's component type by an identity or a
      * primitive widening conversion
-     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
+     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
      * argument is negative, or if it is greater than or equal to
      * the length of the specified array
      * @see Array#set
@@ -403,13 +403,13 @@
      * @param array the array
      * @param index the index into the array
      * @param i the new value of the indexed component
-     * @exception NullPointerException If the specified object argument
+     * @throws    NullPointerException If the specified object argument
      * is null
-     * @exception IllegalArgumentException If the specified object argument
+     * @throws    IllegalArgumentException If the specified object argument
      * is not an array, or if the specified value cannot be converted
      * to the underlying array's component type by an identity or a
      * primitive widening conversion
-     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
+     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
      * argument is negative, or if it is greater than or equal to
      * the length of the specified array
      * @see Array#set
@@ -423,13 +423,13 @@
      * @param array the array
      * @param index the index into the array
      * @param l the new value of the indexed component
-     * @exception NullPointerException If the specified object argument
+     * @throws    NullPointerException If the specified object argument
      * is null
-     * @exception IllegalArgumentException If the specified object argument
+     * @throws    IllegalArgumentException If the specified object argument
      * is not an array, or if the specified value cannot be converted
      * to the underlying array's component type by an identity or a
      * primitive widening conversion
-     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
+     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
      * argument is negative, or if it is greater than or equal to
      * the length of the specified array
      * @see Array#set
@@ -443,13 +443,13 @@
      * @param array the array
      * @param index the index into the array
      * @param f the new value of the indexed component
-     * @exception NullPointerException If the specified object argument
+     * @throws    NullPointerException If the specified object argument
      * is null
-     * @exception IllegalArgumentException If the specified object argument
+     * @throws    IllegalArgumentException If the specified object argument
      * is not an array, or if the specified value cannot be converted
      * to the underlying array's component type by an identity or a
      * primitive widening conversion
-     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
+     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
      * argument is negative, or if it is greater than or equal to
      * the length of the specified array
      * @see Array#set
@@ -463,13 +463,13 @@
      * @param array the array
      * @param index the index into the array
      * @param d the new value of the indexed component
-     * @exception NullPointerException If the specified object argument
+     * @throws    NullPointerException If the specified object argument
      * is null
-     * @exception IllegalArgumentException If the specified object argument
+     * @throws    IllegalArgumentException If the specified object argument
      * is not an array, or if the specified value cannot be converted
      * to the underlying array's component type by an identity or a
      * primitive widening conversion
-     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
+     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
      * argument is negative, or if it is greater than or equal to
      * the length of the specified array
      * @see Array#set
--- a/src/java.base/share/classes/java/lang/reflect/Constructor.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/reflect/Constructor.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -454,21 +454,21 @@
      * @return a new object created by calling the constructor
      * this object represents
      *
-     * @exception IllegalAccessException    if this {@code Constructor} object
+     * @throws    IllegalAccessException    if this {@code Constructor} object
      *              is enforcing Java language access control and the underlying
      *              constructor is inaccessible.
-     * @exception IllegalArgumentException  if the number of actual
+     * @throws    IllegalArgumentException  if the number of actual
      *              and formal parameters differ; if an unwrapping
      *              conversion for primitive arguments fails; or if,
      *              after possible unwrapping, a parameter value
      *              cannot be converted to the corresponding formal
      *              parameter type by a method invocation conversion; if
      *              this constructor pertains to an enum type.
-     * @exception InstantiationException    if the class that declares the
+     * @throws    InstantiationException    if the class that declares the
      *              underlying constructor represents an abstract class.
-     * @exception InvocationTargetException if the underlying constructor
+     * @throws    InvocationTargetException if the underlying constructor
      *              throws an exception.
-     * @exception ExceptionInInitializerError if the initialization provoked
+     * @throws    ExceptionInInitializerError if the initialization provoked
      *              by this method fails.
      */
     @CallerSensitive
--- a/src/java.base/share/classes/java/lang/reflect/Field.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/reflect/Field.java	Tue Sep 24 15:19:35 2019 -0400
@@ -393,15 +393,15 @@
      * {@code obj}; primitive values are wrapped in an appropriate
      * object before being returned
      *
-     * @exception IllegalAccessException    if this {@code Field} object
+     * @throws    IllegalAccessException    if this {@code Field} object
      *              is enforcing Java language access control and the underlying
      *              field is inaccessible.
-     * @exception IllegalArgumentException  if the specified object is not an
+     * @throws    IllegalArgumentException  if the specified object is not an
      *              instance of the class or interface declaring the underlying
      *              field (or a subclass or implementor thereof).
-     * @exception NullPointerException      if the specified object is null
+     * @throws    NullPointerException      if the specified object is null
      *              and the field is an instance field.
-     * @exception ExceptionInInitializerError if the initialization provoked
+     * @throws    ExceptionInInitializerError if the initialization provoked
      *              by this method fails.
      */
     @CallerSensitive
@@ -423,18 +423,18 @@
      * from
      * @return the value of the {@code boolean} field
      *
-     * @exception IllegalAccessException    if this {@code Field} object
+     * @throws    IllegalAccessException    if this {@code Field} object
      *              is enforcing Java language access control and the underlying
      *              field is inaccessible.
-     * @exception IllegalArgumentException  if the specified object is not
+     * @throws    IllegalArgumentException  if the specified object is not
      *              an instance of the class or interface declaring the
      *              underlying field (or a subclass or implementor
      *              thereof), or if the field value cannot be
      *              converted to the type {@code boolean} by a
      *              widening conversion.
-     * @exception NullPointerException      if the specified object is null
+     * @throws    NullPointerException      if the specified object is null
      *              and the field is an instance field.
-     * @exception ExceptionInInitializerError if the initialization provoked
+     * @throws    ExceptionInInitializerError if the initialization provoked
      *              by this method fails.
      * @see       Field#get
      */
@@ -457,18 +457,18 @@
      * from
      * @return the value of the {@code byte} field
      *
-     * @exception IllegalAccessException    if this {@code Field} object
+     * @throws    IllegalAccessException    if this {@code Field} object
      *              is enforcing Java language access control and the underlying
      *              field is inaccessible.
-     * @exception IllegalArgumentException  if the specified object is not
+     * @throws    IllegalArgumentException  if the specified object is not
      *              an instance of the class or interface declaring the
      *              underlying field (or a subclass or implementor
      *              thereof), or if the field value cannot be
      *              converted to the type {@code byte} by a
      *              widening conversion.
-     * @exception NullPointerException      if the specified object is null
+     * @throws    NullPointerException      if the specified object is null
      *              and the field is an instance field.
-     * @exception ExceptionInInitializerError if the initialization provoked
+     * @throws    ExceptionInInitializerError if the initialization provoked
      *              by this method fails.
      * @see       Field#get
      */
@@ -493,18 +493,18 @@
      * from
      * @return the value of the field converted to type {@code char}
      *
-     * @exception IllegalAccessException    if this {@code Field} object
+     * @throws    IllegalAccessException    if this {@code Field} object
      *              is enforcing Java language access control and the underlying
      *              field is inaccessible.
-     * @exception IllegalArgumentException  if the specified object is not
+     * @throws    IllegalArgumentException  if the specified object is not
      *              an instance of the class or interface declaring the
      *              underlying field (or a subclass or implementor
      *              thereof), or if the field value cannot be
      *              converted to the type {@code char} by a
      *              widening conversion.
-     * @exception NullPointerException      if the specified object is null
+     * @throws    NullPointerException      if the specified object is null
      *              and the field is an instance field.
-     * @exception ExceptionInInitializerError if the initialization provoked
+     * @throws    ExceptionInInitializerError if the initialization provoked
      *              by this method fails.
      * @see Field#get
      */
@@ -529,18 +529,18 @@
      * from
      * @return the value of the field converted to type {@code short}
      *
-     * @exception IllegalAccessException    if this {@code Field} object
+     * @throws    IllegalAccessException    if this {@code Field} object
      *              is enforcing Java language access control and the underlying
      *              field is inaccessible.
-     * @exception IllegalArgumentException  if the specified object is not
+     * @throws    IllegalArgumentException  if the specified object is not
      *              an instance of the class or interface declaring the
      *              underlying field (or a subclass or implementor
      *              thereof), or if the field value cannot be
      *              converted to the type {@code short} by a
      *              widening conversion.
-     * @exception NullPointerException      if the specified object is null
+     * @throws    NullPointerException      if the specified object is null
      *              and the field is an instance field.
-     * @exception ExceptionInInitializerError if the initialization provoked
+     * @throws    ExceptionInInitializerError if the initialization provoked
      *              by this method fails.
      * @see       Field#get
      */
@@ -565,18 +565,18 @@
      * from
      * @return the value of the field converted to type {@code int}
      *
-     * @exception IllegalAccessException    if this {@code Field} object
+     * @throws    IllegalAccessException    if this {@code Field} object
      *              is enforcing Java language access control and the underlying
      *              field is inaccessible.
-     * @exception IllegalArgumentException  if the specified object is not
+     * @throws    IllegalArgumentException  if the specified object is not
      *              an instance of the class or interface declaring the
      *              underlying field (or a subclass or implementor
      *              thereof), or if the field value cannot be
      *              converted to the type {@code int} by a
      *              widening conversion.
-     * @exception NullPointerException      if the specified object is null
+     * @throws    NullPointerException      if the specified object is null
      *              and the field is an instance field.
-     * @exception ExceptionInInitializerError if the initialization provoked
+     * @throws    ExceptionInInitializerError if the initialization provoked
      *              by this method fails.
      * @see       Field#get
      */
@@ -601,18 +601,18 @@
      * from
      * @return the value of the field converted to type {@code long}
      *
-     * @exception IllegalAccessException    if this {@code Field} object
+     * @throws    IllegalAccessException    if this {@code Field} object
      *              is enforcing Java language access control and the underlying
      *              field is inaccessible.
-     * @exception IllegalArgumentException  if the specified object is not
+     * @throws    IllegalArgumentException  if the specified object is not
      *              an instance of the class or interface declaring the
      *              underlying field (or a subclass or implementor
      *              thereof), or if the field value cannot be
      *              converted to the type {@code long} by a
      *              widening conversion.
-     * @exception NullPointerException      if the specified object is null
+     * @throws    NullPointerException      if the specified object is null
      *              and the field is an instance field.
-     * @exception ExceptionInInitializerError if the initialization provoked
+     * @throws    ExceptionInInitializerError if the initialization provoked
      *              by this method fails.
      * @see       Field#get
      */
@@ -637,18 +637,18 @@
      * from
      * @return the value of the field converted to type {@code float}
      *
-     * @exception IllegalAccessException    if this {@code Field} object
+     * @throws    IllegalAccessException    if this {@code Field} object
      *              is enforcing Java language access control and the underlying
      *              field is inaccessible.
-     * @exception IllegalArgumentException  if the specified object is not
+     * @throws    IllegalArgumentException  if the specified object is not
      *              an instance of the class or interface declaring the
      *              underlying field (or a subclass or implementor
      *              thereof), or if the field value cannot be
      *              converted to the type {@code float} by a
      *              widening conversion.
-     * @exception NullPointerException      if the specified object is null
+     * @throws    NullPointerException      if the specified object is null
      *              and the field is an instance field.
-     * @exception ExceptionInInitializerError if the initialization provoked
+     * @throws    ExceptionInInitializerError if the initialization provoked
      *              by this method fails.
      * @see Field#get
      */
@@ -673,18 +673,18 @@
      * from
      * @return the value of the field converted to type {@code double}
      *
-     * @exception IllegalAccessException    if this {@code Field} object
+     * @throws    IllegalAccessException    if this {@code Field} object
      *              is enforcing Java language access control and the underlying
      *              field is inaccessible.
-     * @exception IllegalArgumentException  if the specified object is not
+     * @throws    IllegalArgumentException  if the specified object is not
      *              an instance of the class or interface declaring the
      *              underlying field (or a subclass or implementor
      *              thereof), or if the field value cannot be
      *              converted to the type {@code double} by a
      *              widening conversion.
-     * @exception NullPointerException      if the specified object is null
+     * @throws    NullPointerException      if the specified object is null
      *              and the field is an instance field.
-     * @exception ExceptionInInitializerError if the initialization provoked
+     * @throws    ExceptionInInitializerError if the initialization provoked
      *              by this method fails.
      * @see       Field#get
      */
@@ -754,16 +754,16 @@
      * @param value the new value for the field of {@code obj}
      * being modified
      *
-     * @exception IllegalAccessException    if this {@code Field} object
+     * @throws    IllegalAccessException    if this {@code Field} object
      *              is enforcing Java language access control and the underlying
      *              field is either inaccessible or final.
-     * @exception IllegalArgumentException  if the specified object is not an
+     * @throws    IllegalArgumentException  if the specified object is not an
      *              instance of the class or interface declaring the underlying
      *              field (or a subclass or implementor thereof),
      *              or if an unwrapping conversion fails.
-     * @exception NullPointerException      if the specified object is null
+     * @throws    NullPointerException      if the specified object is null
      *              and the field is an instance field.
-     * @exception ExceptionInInitializerError if the initialization provoked
+     * @throws    ExceptionInInitializerError if the initialization provoked
      *              by this method fails.
      */
     @CallerSensitive
@@ -789,16 +789,16 @@
      * @param z   the new value for the field of {@code obj}
      * being modified
      *
-     * @exception IllegalAccessException    if this {@code Field} object
+     * @throws    IllegalAccessException    if this {@code Field} object
      *              is enforcing Java language access control and the underlying
      *              field is either inaccessible or final.
-     * @exception IllegalArgumentException  if the specified object is not an
+     * @throws    IllegalArgumentException  if the specified object is not an
      *              instance of the class or interface declaring the underlying
      *              field (or a subclass or implementor thereof),
      *              or if an unwrapping conversion fails.
-     * @exception NullPointerException      if the specified object is null
+     * @throws    NullPointerException      if the specified object is null
      *              and the field is an instance field.
-     * @exception ExceptionInInitializerError if the initialization provoked
+     * @throws    ExceptionInInitializerError if the initialization provoked
      *              by this method fails.
      * @see       Field#set
      */
@@ -825,16 +825,16 @@
      * @param b   the new value for the field of {@code obj}
      * being modified
      *
-     * @exception IllegalAccessException    if this {@code Field} object
+     * @throws    IllegalAccessException    if this {@code Field} object
      *              is enforcing Java language access control and the underlying
      *              field is either inaccessible or final.
-     * @exception IllegalArgumentException  if the specified object is not an
+     * @throws    IllegalArgumentException  if the specified object is not an
      *              instance of the class or interface declaring the underlying
      *              field (or a subclass or implementor thereof),
      *              or if an unwrapping conversion fails.
-     * @exception NullPointerException      if the specified object is null
+     * @throws    NullPointerException      if the specified object is null
      *              and the field is an instance field.
-     * @exception ExceptionInInitializerError if the initialization provoked
+     * @throws    ExceptionInInitializerError if the initialization provoked
      *              by this method fails.
      * @see       Field#set
      */
@@ -861,16 +861,16 @@
      * @param c   the new value for the field of {@code obj}
      * being modified
      *
-     * @exception IllegalAccessException    if this {@code Field} object
+     * @throws    IllegalAccessException    if this {@code Field} object
      *              is enforcing Java language access control and the underlying
      *              field is either inaccessible or final.
-     * @exception IllegalArgumentException  if the specified object is not an
+     * @throws    IllegalArgumentException  if the specified object is not an
      *              instance of the class or interface declaring the underlying
      *              field (or a subclass or implementor thereof),
      *              or if an unwrapping conversion fails.
-     * @exception NullPointerException      if the specified object is null
+     * @throws    NullPointerException      if the specified object is null
      *              and the field is an instance field.
-     * @exception ExceptionInInitializerError if the initialization provoked
+     * @throws    ExceptionInInitializerError if the initialization provoked
      *              by this method fails.
      * @see       Field#set
      */
@@ -897,16 +897,16 @@
      * @param s   the new value for the field of {@code obj}
      * being modified
      *
-     * @exception IllegalAccessException    if this {@code Field} object
+     * @throws    IllegalAccessException    if this {@code Field} object
      *              is enforcing Java language access control and the underlying
      *              field is either inaccessible or final.
-     * @exception IllegalArgumentException  if the specified object is not an
+     * @throws    IllegalArgumentException  if the specified object is not an
      *              instance of the class or interface declaring the underlying
      *              field (or a subclass or implementor thereof),
      *              or if an unwrapping conversion fails.
-     * @exception NullPointerException      if the specified object is null
+     * @throws    NullPointerException      if the specified object is null
      *              and the field is an instance field.
-     * @exception ExceptionInInitializerError if the initialization provoked
+     * @throws    ExceptionInInitializerError if the initialization provoked
      *              by this method fails.
      * @see       Field#set
      */
@@ -933,16 +933,16 @@
      * @param i   the new value for the field of {@code obj}
      * being modified
      *
-     * @exception IllegalAccessException    if this {@code Field} object
+     * @throws    IllegalAccessException    if this {@code Field} object
      *              is enforcing Java language access control and the underlying
      *              field is either inaccessible or final.
-     * @exception IllegalArgumentException  if the specified object is not an
+     * @throws    IllegalArgumentException  if the specified object is not an
      *              instance of the class or interface declaring the underlying
      *              field (or a subclass or implementor thereof),
      *              or if an unwrapping conversion fails.
-     * @exception NullPointerException      if the specified object is null
+     * @throws    NullPointerException      if the specified object is null
      *              and the field is an instance field.
-     * @exception ExceptionInInitializerError if the initialization provoked
+     * @throws    ExceptionInInitializerError if the initialization provoked
      *              by this method fails.
      * @see       Field#set
      */
@@ -969,16 +969,16 @@
      * @param l   the new value for the field of {@code obj}
      * being modified
      *
-     * @exception IllegalAccessException    if this {@code Field} object
+     * @throws    IllegalAccessException    if this {@code Field} object
      *              is enforcing Java language access control and the underlying
      *              field is either inaccessible or final.
-     * @exception IllegalArgumentException  if the specified object is not an
+     * @throws    IllegalArgumentException  if the specified object is not an
      *              instance of the class or interface declaring the underlying
      *              field (or a subclass or implementor thereof),
      *              or if an unwrapping conversion fails.
-     * @exception NullPointerException      if the specified object is null
+     * @throws    NullPointerException      if the specified object is null
      *              and the field is an instance field.
-     * @exception ExceptionInInitializerError if the initialization provoked
+     * @throws    ExceptionInInitializerError if the initialization provoked
      *              by this method fails.
      * @see       Field#set
      */
@@ -1005,16 +1005,16 @@
      * @param f   the new value for the field of {@code obj}
      * being modified
      *
-     * @exception IllegalAccessException    if this {@code Field} object
+     * @throws    IllegalAccessException    if this {@code Field} object
      *              is enforcing Java language access control and the underlying
      *              field is either inaccessible or final.
-     * @exception IllegalArgumentException  if the specified object is not an
+     * @throws    IllegalArgumentException  if the specified object is not an
      *              instance of the class or interface declaring the underlying
      *              field (or a subclass or implementor thereof),
      *              or if an unwrapping conversion fails.
-     * @exception NullPointerException      if the specified object is null
+     * @throws    NullPointerException      if the specified object is null
      *              and the field is an instance field.
-     * @exception ExceptionInInitializerError if the initialization provoked
+     * @throws    ExceptionInInitializerError if the initialization provoked
      *              by this method fails.
      * @see       Field#set
      */
@@ -1041,16 +1041,16 @@
      * @param d   the new value for the field of {@code obj}
      * being modified
      *
-     * @exception IllegalAccessException    if this {@code Field} object
+     * @throws    IllegalAccessException    if this {@code Field} object
      *              is enforcing Java language access control and the underlying
      *              field is either inaccessible or final.
-     * @exception IllegalArgumentException  if the specified object is not an
+     * @throws    IllegalArgumentException  if the specified object is not an
      *              instance of the class or interface declaring the underlying
      *              field (or a subclass or implementor thereof),
      *              or if an unwrapping conversion fails.
-     * @exception NullPointerException      if the specified object is null
+     * @throws    NullPointerException      if the specified object is null
      *              and the field is an instance field.
-     * @exception ExceptionInInitializerError if the initialization provoked
+     * @throws    ExceptionInInitializerError if the initialization provoked
      *              by this method fails.
      * @see       Field#set
      */
--- a/src/java.base/share/classes/java/lang/reflect/Method.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/lang/reflect/Method.java	Tue Sep 24 15:19:35 2019 -0400
@@ -524,10 +524,10 @@
      * this object on {@code obj} with parameters
      * {@code args}
      *
-     * @exception IllegalAccessException    if this {@code Method} object
+     * @throws    IllegalAccessException    if this {@code Method} object
      *              is enforcing Java language access control and the underlying
      *              method is inaccessible.
-     * @exception IllegalArgumentException  if the method is an
+     * @throws    IllegalArgumentException  if the method is an
      *              instance method and the specified object argument
      *              is not an instance of the class or interface
      *              declaring the underlying method (or of a subclass
@@ -537,11 +537,11 @@
      *              after possible unwrapping, a parameter value
      *              cannot be converted to the corresponding formal
      *              parameter type by a method invocation conversion.
-     * @exception InvocationTargetException if the underlying method
+     * @throws    InvocationTargetException if the underlying method
      *              throws an exception.
-     * @exception NullPointerException      if the specified object is null
+     * @throws    NullPointerException      if the specified object is null
      *              and the method is an instance method.
-     * @exception ExceptionInInitializerError if the initialization
+     * @throws    ExceptionInInitializerError if the initialization
      * provoked by this method fails.
      */
     @CallerSensitive
--- a/src/java.base/share/classes/java/net/ContentHandler.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/net/ContentHandler.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -90,7 +90,7 @@
      *
      * @param      urlc   a URL connection.
      * @return     the object read by the {@code ContentHandler}.
-     * @exception  IOException  if an I/O error occurs while reading the object.
+     * @throws     IOException  if an I/O error occurs while reading the object.
      */
     public abstract Object getContent(URLConnection urlc) throws IOException;
 
@@ -108,7 +108,7 @@
      * @return     the object read by the {@code ContentHandler} that is
      *                 the first match of the suggested types or
      *                 {@code null} if none of the requested  are supported.
-     * @exception  IOException  if an I/O error occurs while reading the object.
+     * @throws     IOException  if an I/O error occurs while reading the object.
      * @since 1.3
      */
     @SuppressWarnings("rawtypes")
--- a/src/java.base/share/classes/java/net/DatagramPacket.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/net/DatagramPacket.java	Tue Sep 24 15:19:35 2019 -0400
@@ -245,7 +245,7 @@
      * @param length the length of the data
      *       and/or the length of the buffer used to receive data
      *
-     * @exception NullPointerException if the argument is null
+     * @throws    NullPointerException if the argument is null
      *
      * @see #getData
      * @see #getOffset
@@ -331,7 +331,7 @@
      *
      * @param buf the buffer to set for this packet.
      *
-     * @exception NullPointerException if the argument is null.
+     * @throws    NullPointerException if the argument is null.
      *
      * @see #getLength
      * @see #getData
@@ -357,7 +357,7 @@
      *
      * @param length the length to set for this packet.
      *
-     * @exception IllegalArgumentException if the length is negative
+     * @throws    IllegalArgumentException if the length is negative
      * of if the length is greater than the packet's data buffer
      * length.
      *
--- a/src/java.base/share/classes/java/net/DatagramSocket.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/net/DatagramSocket.java	Tue Sep 24 15:19:35 2019 -0400
@@ -188,9 +188,9 @@
      * with 0 as its argument to ensure the operation is allowed.
      * This could result in a SecurityException.
      *
-     * @exception  SocketException  if the socket could not be opened,
+     * @throws     SocketException  if the socket could not be opened,
      *               or the socket could not bind to the specified local port.
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     SecurityException  if a security manager exists and its
      *             {@code checkListen} method doesn't allow the operation.
      *
      * @see SecurityManager#checkListen
@@ -229,9 +229,9 @@
      * @param bindaddr local socket address to bind, or {@code null}
      *                 for an unbound socket.
      *
-     * @exception  SocketException  if the socket could not be opened,
+     * @throws     SocketException  if the socket could not be opened,
      *               or the socket could not bind to the specified local port.
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     SecurityException  if a security manager exists and its
      *             {@code checkListen} method doesn't allow the operation.
      *
      * @see SecurityManager#checkListen
@@ -263,9 +263,9 @@
      * This could result in a SecurityException.
      *
      * @param      port port to use.
-     * @exception  SocketException  if the socket could not be opened,
+     * @throws     SocketException  if the socket could not be opened,
      *               or the socket could not bind to the specified local port.
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     SecurityException  if a security manager exists and its
      *             {@code checkListen} method doesn't allow the operation.
      *
      * @see SecurityManager#checkListen
@@ -290,9 +290,9 @@
      * @param port local port to use
      * @param laddr local address to bind
      *
-     * @exception  SocketException  if the socket could not be opened,
+     * @throws     SocketException  if the socket could not be opened,
      *               or the socket could not bind to the specified local port.
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     SecurityException  if a security manager exists and its
      *             {@code checkListen} method doesn't allow the operation.
      *
      * @see SecurityManager#checkListen
@@ -635,17 +635,17 @@
      *
      * @param      p   the {@code DatagramPacket} to be sent.
      *
-     * @exception  IOException  if an I/O error occurs.
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     IOException  if an I/O error occurs.
+     * @throws     SecurityException  if a security manager exists and its
      *             {@code checkMulticast} or {@code checkConnect}
      *             method doesn't allow the send.
-     * @exception  PortUnreachableException may be thrown if the socket is connected
+     * @throws     PortUnreachableException may be thrown if the socket is connected
      *             to a currently unreachable destination. Note, there is no
      *             guarantee that the exception will be thrown.
-     * @exception  java.nio.channels.IllegalBlockingModeException
+     * @throws     java.nio.channels.IllegalBlockingModeException
      *             if this socket has an associated channel,
      *             and the channel is in non-blocking mode.
-     * @exception  IllegalArgumentException if the socket is connected,
+     * @throws     IllegalArgumentException if the socket is connected,
      *             and connected address and packet address differ.
      *
      * @see        java.net.DatagramPacket
@@ -714,13 +714,13 @@
      *
      * @param      p   the {@code DatagramPacket} into which to place
      *                 the incoming data.
-     * @exception  IOException  if an I/O error occurs.
-     * @exception  SocketTimeoutException  if setSoTimeout was previously called
+     * @throws     IOException  if an I/O error occurs.
+     * @throws     SocketTimeoutException  if setSoTimeout was previously called
      *                 and the timeout has expired.
-     * @exception  PortUnreachableException may be thrown if the socket is connected
+     * @throws     PortUnreachableException may be thrown if the socket is connected
      *             to a currently unreachable destination. Note, there is no guarantee that the
      *             exception will be thrown.
-     * @exception  java.nio.channels.IllegalBlockingModeException
+     * @throws     java.nio.channels.IllegalBlockingModeException
      *             if this socket has an associated channel,
      *             and the channel is in non-blocking mode.
      * @see        java.net.DatagramPacket
@@ -951,9 +951,9 @@
      * @param size the size to which to set the send buffer
      * size. This value must be greater than 0.
      *
-     * @exception SocketException if there is an error
+     * @throws    SocketException if there is an error
      * in the underlying protocol, such as an UDP error.
-     * @exception IllegalArgumentException if the value is 0 or is
+     * @throws    IllegalArgumentException if the value is 0 or is
      * negative.
      * @see #getSendBufferSize()
      */
@@ -972,7 +972,7 @@
      * buffer size used by the platform for output on this {@code DatagramSocket}.
      *
      * @return the value of the SO_SNDBUF option for this {@code DatagramSocket}
-     * @exception SocketException if there is an error in
+     * @throws    SocketException if there is an error in
      * the underlying protocol, such as an UDP error.
      * @see #setSendBufferSize
      */
@@ -1009,9 +1009,9 @@
      * @param size the size to which to set the receive buffer
      * size. This value must be greater than 0.
      *
-     * @exception SocketException if there is an error in
+     * @throws    SocketException if there is an error in
      * the underlying protocol, such as an UDP error.
-     * @exception IllegalArgumentException if the value is 0 or is
+     * @throws    IllegalArgumentException if the value is 0 or is
      * negative.
      * @see #getReceiveBufferSize()
      */
@@ -1030,7 +1030,7 @@
      * buffer size used by the platform for input on this {@code DatagramSocket}.
      *
      * @return the value of the SO_RCVBUF option for this {@code DatagramSocket}
-     * @exception SocketException if there is an error in the underlying protocol, such as an UDP error.
+     * @throws    SocketException if there is an error in the underlying protocol, such as an UDP error.
      * @see #setReceiveBufferSize(int)
      */
     public synchronized int getReceiveBufferSize()
@@ -1070,7 +1070,7 @@
      * is not defined.
      *
      * @param on  whether to enable or disable the
-     * @exception SocketException if an error occurs enabling or
+     * @throws    SocketException if an error occurs enabling or
      *            disabling the {@code SO_REUSEADDR} socket option,
      *            or the socket is closed.
      * @since 1.4
@@ -1093,7 +1093,7 @@
      * Tests if SO_REUSEADDR is enabled.
      *
      * @return a {@code boolean} indicating whether or not SO_REUSEADDR is enabled.
-     * @exception SocketException if there is an error
+     * @throws    SocketException if there is an error
      * in the underlying protocol, such as an UDP error.
      * @since   1.4
      * @see #setReuseAddress(boolean)
@@ -1131,7 +1131,7 @@
     /**
      * Tests if SO_BROADCAST is enabled.
      * @return a {@code boolean} indicating whether or not SO_BROADCAST is enabled.
-     * @exception SocketException if there is an error
+     * @throws    SocketException if there is an error
      * in the underlying protocol, such as an UDP error.
      * @since 1.4
      * @see #setBroadcast(boolean)
@@ -1290,10 +1290,10 @@
      * This could result in a SecurityException.
      *
      * @param      fac   the desired factory.
-     * @exception  IOException  if an I/O error occurs when setting the
+     * @throws     IOException  if an I/O error occurs when setting the
      *              datagram socket factory.
-     * @exception  SocketException  if the factory is already defined.
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     SocketException  if the factory is already defined.
+     * @throws     SecurityException  if a security manager exists and its
      *             {@code checkSetFactory} method doesn't allow the operation.
      * @see       java.net.DatagramSocketImplFactory#createDatagramSocketImpl()
      * @see       SecurityManager#checkSetFactory
--- a/src/java.base/share/classes/java/net/DatagramSocketImpl.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/net/DatagramSocketImpl.java	Tue Sep 24 15:19:35 2019 -0400
@@ -70,29 +70,29 @@
 
     /**
      * Creates a datagram socket.
-     * @exception SocketException if there is an error in the
+     * @throws    SocketException if there is an error in the
      * underlying protocol, such as a TCP error.
      */
     protected abstract void create() throws SocketException;
 
     /**
      * Binds a datagram socket to a local port and address.
-     * @param lport the local port
-     * @param laddr the local address
-     * @exception SocketException if there is an error in the
-     * underlying protocol, such as a TCP error.
+     * @param     lport the local port
+     * @param     laddr the local address
+     * @throws    SocketException if there is an error in the
+     *            underlying protocol, such as a TCP error.
      */
     protected abstract void bind(int lport, InetAddress laddr) throws SocketException;
 
     /**
      * Sends a datagram packet. The packet contains the data and the
      * destination address to send the packet to.
-     * @param p the packet to be sent.
-     * @exception IOException if an I/O exception occurs while sending the
-     * datagram packet.
-     * @exception  PortUnreachableException may be thrown if the socket is connected
-     * to a currently unreachable destination. Note, there is no guarantee that
-     * the exception will be thrown.
+     * @param    p the packet to be sent.
+     * @throws   IOException if an I/O exception occurs while sending the
+     *           datagram packet.
+     * @throws   PortUnreachableException may be thrown if the socket is connected
+     *           to a currently unreachable destination. Note, there is no guarantee that
+     *           the exception will be thrown.
      */
     protected abstract void send(DatagramPacket p) throws IOException;
 
@@ -107,11 +107,11 @@
      * packet has been received for that address, then a subsequent call to
      * send or receive may throw a PortUnreachableException.
      * Note, there is no guarantee that the exception will be thrown.
-     * @param address the remote InetAddress to connect to
-     * @param port the remote port number
-     * @exception   SocketException may be thrown if the socket cannot be
-     * connected to the remote destination
-     * @since 1.4
+     * @param   address the remote InetAddress to connect to
+     * @param   port the remote port number
+     * @throws  SocketException may be thrown if the socket cannot be
+     *          connected to the remote destination
+     * @since   1.4
      */
     protected void connect(InetAddress address, int port) throws SocketException {}
 
@@ -124,12 +124,12 @@
     /**
      * Peek at the packet to see who it is from. Updates the specified {@code InetAddress}
      * to the address which the packet came from.
-     * @param i an InetAddress object
-     * @return the port number which the packet came from.
-     * @exception IOException if an I/O exception occurs
-     * @exception  PortUnreachableException may be thrown if the socket is connected
-     *       to a currently unreachable destination. Note, there is no guarantee that the
-     *       exception will be thrown.
+     * @param     i an InetAddress object
+     * @return    the port number which the packet came from.
+     * @throws    IOException if an I/O exception occurs
+     * @throws    PortUnreachableException may be thrown if the socket is connected
+     *            to a currently unreachable destination. Note, there is no guarantee that the
+     *            exception will be thrown.
      */
     protected abstract int peek(InetAddress i) throws IOException;
 
@@ -138,23 +138,23 @@
      * {@code DatagramPacket}. The data is returned,
      * but not consumed, so that a subsequent peekData/receive operation
      * will see the same data.
-     * @param p the Packet Received.
-     * @return the port number which the packet came from.
-     * @exception IOException if an I/O exception occurs
-     * @exception  PortUnreachableException may be thrown if the socket is connected
-     *       to a currently unreachable destination. Note, there is no guarantee that the
-     *       exception will be thrown.
+     * @param     p the Packet Received.
+     * @return    the port number which the packet came from.
+     * @throws    IOException if an I/O exception occurs
+     * @throws    PortUnreachableException may be thrown if the socket is connected
+     *            to a currently unreachable destination. Note, there is no guarantee that the
+     *            exception will be thrown.
      * @since 1.4
      */
     protected abstract int peekData(DatagramPacket p) throws IOException;
     /**
      * Receive the datagram packet.
-     * @param p the Packet Received.
-     * @exception IOException if an I/O exception occurs
-     * while receiving the datagram packet.
-     * @exception  PortUnreachableException may be thrown if the socket is connected
-     *       to a currently unreachable destination. Note, there is no guarantee that the
-     *       exception will be thrown.
+     * @param     p the Packet Received.
+     * @throws    IOException if an I/O exception occurs
+     *            while receiving the datagram packet.
+     * @throws    PortUnreachableException may be thrown if the socket is connected
+     *            to a currently unreachable destination. Note, there is no guarantee that the
+     *            exception will be thrown.
      */
     protected abstract void receive(DatagramPacket p) throws IOException;
 
@@ -163,7 +163,7 @@
      * @param ttl a byte specifying the TTL value
      *
      * @deprecated use setTimeToLive instead.
-     * @exception IOException if an I/O exception occurs while setting
+     * @throws    IOException if an I/O exception occurs while setting
      * the time-to-live option.
      * @see #getTTL()
      */
@@ -173,7 +173,7 @@
     /**
      * Retrieve the TTL (time-to-live) option.
      *
-     * @exception IOException if an I/O exception occurs
+     * @throws    IOException if an I/O exception occurs
      * while retrieving the time-to-live option
      * @deprecated use getTimeToLive instead.
      * @return a byte representing the TTL value
@@ -185,7 +185,7 @@
     /**
      * Set the TTL (time-to-live) option.
      * @param ttl an {@code int} specifying the time-to-live value
-     * @exception IOException if an I/O exception occurs
+     * @throws    IOException if an I/O exception occurs
      * while setting the time-to-live option.
      * @see #getTimeToLive()
      */
@@ -193,7 +193,7 @@
 
     /**
      * Retrieve the TTL (time-to-live) option.
-     * @exception IOException if an I/O exception occurs
+     * @throws    IOException if an I/O exception occurs
      * while retrieving the time-to-live option
      * @return an {@code int} representing the time-to-live value
      * @see #setTimeToLive(int)
@@ -203,7 +203,7 @@
     /**
      * Join the multicast group.
      * @param inetaddr multicast address to join.
-     * @exception IOException if an I/O exception occurs
+     * @throws    IOException if an I/O exception occurs
      * while joining the multicast group.
      */
     protected abstract void join(InetAddress inetaddr) throws IOException;
@@ -211,7 +211,7 @@
     /**
      * Leave the multicast group.
      * @param inetaddr multicast address to leave.
-     * @exception IOException if an I/O exception occurs
+     * @throws    IOException if an I/O exception occurs
      * while leaving the multicast group.
      */
     protected abstract void leave(InetAddress inetaddr) throws IOException;
@@ -272,9 +272,9 @@
      * UnsupportedOperationException}. Subclasses should override this method
      * with an appropriate implementation.
      *
-     * @param <T> The type of the socket option value
-     * @param name The socket option
-     * @param value The value of the socket option. A value of {@code null}
+     * @param  <T> The type of the socket option value
+     * @param  name The socket option
+     * @param  value The value of the socket option. A value of {@code null}
      *              may be valid for some options.
      *
      * @throws UnsupportedOperationException if the DatagramSocketImpl does not
@@ -300,8 +300,8 @@
      * UnsupportedOperationException}. Subclasses should override this method
      * with an appropriate implementation.
      *
-     * @param <T> The type of the socket option value
-     * @param name The socket option
+     * @param  <T> The type of the socket option value
+     * @param  name The socket option
      * @return the socket option
      *
      * @throws UnsupportedOperationException if the DatagramSocketImpl does not
--- a/src/java.base/share/classes/java/net/HttpURLConnection.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/net/HttpURLConnection.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -381,7 +381,7 @@
      *
      * @param set a {@code boolean} indicating whether or not
      * to follow HTTP redirects.
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     SecurityException  if a security manager exists and its
      *             {@code checkSetFactory} method doesn't
      *             allow the operation.
      * @see        SecurityManager#checkSetFactory
@@ -456,9 +456,9 @@
      * method is GET.
      *
      * @param method the HTTP method
-     * @exception ProtocolException if the method cannot be reset or if
+     * @throws    ProtocolException if the method cannot be reset or if
      *              the requested method isn't valid for HTTP.
-     * @exception SecurityException if a security manager is set and the
+     * @throws    SecurityException if a security manager is set and the
      *              method is "TRACE", but the "allowHttpTrace"
      *              NetPermission is not granted.
      * @see #getRequestMethod()
@@ -627,7 +627,7 @@
      * Returns a {@link SocketPermission} object representing the
      * permission necessary to connect to the destination host and port.
      *
-     * @exception IOException if an error occurs while computing
+     * @throws    IOException if an error occurs while computing
      *            the permission.
      *
      * @return a {@code SocketPermission} object representing the
--- a/src/java.base/share/classes/java/net/InetAddress.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/net/InetAddress.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1161,7 +1161,7 @@
      * @param host the specified host
      * @param addr the raw IP address in network byte order
      * @return  an InetAddress object created from the raw IP address.
-     * @exception  UnknownHostException  if IP address is of illegal length
+     * @throws     UnknownHostException  if IP address is of illegal length
      * @since 1.4
      */
     public static InetAddress getByAddress(String host, byte[] addr)
@@ -1216,10 +1216,10 @@
      *
      * @param      host   the specified host, or {@code null}.
      * @return     an IP address for the given host name.
-     * @exception  UnknownHostException  if no IP address for the
+     * @throws     UnknownHostException  if no IP address for the
      *               {@code host} could be found, or if a scope_id was specified
      *               for a global IPv6 address.
-     * @exception  SecurityException if a security manager exists
+     * @throws     SecurityException if a security manager exists
      *             and its checkConnect method doesn't allow the operation
      */
     public static InetAddress getByName(String host)
@@ -1264,10 +1264,10 @@
      * @param      host   the name of the host, or {@code null}.
      * @return     an array of all the IP addresses for a given host name.
      *
-     * @exception  UnknownHostException  if no IP address for the
+     * @throws     UnknownHostException  if no IP address for the
      *               {@code host} could be found, or if a scope_id was specified
      *               for a global IPv6 address.
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     SecurityException  if a security manager exists and its
      *               {@code checkConnect} method doesn't allow the operation.
      *
      * @see SecurityManager#checkConnect
@@ -1542,7 +1542,7 @@
      *
      * @param addr the raw IP address in network byte order
      * @return  an InetAddress object created from the raw IP address.
-     * @exception  UnknownHostException  if IP address is of illegal length
+     * @throws     UnknownHostException  if IP address is of illegal length
      * @since 1.4
      */
     public static InetAddress getByAddress(byte[] addr)
@@ -1580,7 +1580,7 @@
      *
      * @return     the address of the local host.
      *
-     * @exception  UnknownHostException  if the local host name could not
+     * @throws     UnknownHostException  if the local host name could not
      *             be resolved into an address.
      *
      * @see SecurityManager#checkConnect
--- a/src/java.base/share/classes/java/net/JarURLConnection.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/net/JarURLConnection.java	Tue Sep 24 15:19:35 2019 -0400
@@ -217,7 +217,7 @@
      * a connection to an entry of a JAR file, the JAR file object is
      * returned
      *
-     * @exception IOException if an IOException occurs while trying to
+     * @throws    IOException if an IOException occurs while trying to
      * connect to the JAR file for this connection.
      *
      * @see #connect
@@ -230,7 +230,7 @@
      * @return the manifest object corresponding to the JAR file object
      * for this connection.
      *
-     * @exception IOException if getting the JAR file for this
+     * @throws    IOException if getting the JAR file for this
      * connection causes an IOException to be thrown.
      *
      * @see #getJarFile
@@ -247,7 +247,7 @@
      * @return the JAR entry object for this connection, or null if
      * the JAR URL for this connection points to a JAR file.
      *
-     * @exception IOException if getting the JAR file for this
+     * @throws    IOException if getting the JAR file for this
      * connection causes an IOException to be thrown.
      *
      * @see #getJarFile
@@ -264,7 +264,7 @@
      * @return the Attributes object for this connection if the URL
      * for it points to a JAR file entry, null otherwise.
      *
-     * @exception IOException if getting the JAR entry causes an
+     * @throws    IOException if getting the JAR entry causes an
      * IOException to be thrown.
      *
      * @see #getJarEntry
@@ -281,7 +281,7 @@
      * @return the main Attributes for the JAR file for this
      * connection.
      *
-     * @exception IOException if getting the manifest causes an
+     * @throws    IOException if getting the manifest causes an
      * IOException to be thrown.
      *
      * @see #getJarFile
@@ -303,7 +303,7 @@
      * @return the Certificate object for this connection if the URL
      * for it points to a JAR file entry, null otherwise.
      *
-     * @exception IOException if getting the JAR entry causes an
+     * @throws    IOException if getting the JAR entry causes an
      * IOException to be thrown.
      *
      * @see #getJarEntry
--- a/src/java.base/share/classes/java/net/MulticastSocket.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/net/MulticastSocket.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -103,9 +103,9 @@
      * {@link DatagramSocket#setReuseAddress(boolean)} method is called to
      * enable the SO_REUSEADDR socket option.
      *
-     * @exception IOException if an I/O exception occurs while creating the
+     * @throws    IOException if an I/O exception occurs while creating the
      * MulticastSocket
-     * @exception SecurityException if a security manager exists and its
+     * @throws    SecurityException if a security manager exists and its
      * {@code checkListen} method doesn't allow the operation.
      * @see SecurityManager#checkListen
      * @see java.net.DatagramSocket#setReuseAddress(boolean)
@@ -128,13 +128,13 @@
      * {@link DatagramSocket#setReuseAddress(boolean)} method is
      * called to enable the SO_REUSEADDR socket option.
      *
-     * @param port port to use
-     * @exception IOException if an I/O exception occurs
-     * while creating the MulticastSocket
-     * @exception  SecurityException  if a security manager exists and its
-     *             {@code checkListen} method doesn't allow the operation.
-     * @see SecurityManager#checkListen
-     * @see java.net.DatagramSocket#setReuseAddress(boolean)
+     * @param     port port to use
+     * @throws    IOException if an I/O exception occurs
+     *            while creating the MulticastSocket
+     * @throws    SecurityException  if a security manager exists and its
+     *            {@code checkListen} method doesn't allow the operation.
+     * @see       SecurityManager#checkListen
+     * @see       java.net.DatagramSocket#setReuseAddress(boolean)
      */
     public MulticastSocket(int port) throws IOException {
         this(new InetSocketAddress(port));
@@ -154,14 +154,14 @@
      * {@link DatagramSocket#setReuseAddress(boolean)} method is
      * called to enable the SO_REUSEADDR socket option.
      *
-     * @param bindaddr Socket address to bind to, or {@code null} for
-     *                 an unbound socket.
-     * @exception IOException if an I/O exception occurs
-     * while creating the MulticastSocket
-     * @exception  SecurityException  if a security manager exists and its
-     *             {@code checkListen} method doesn't allow the operation.
-     * @see SecurityManager#checkListen
-     * @see java.net.DatagramSocket#setReuseAddress(boolean)
+     * @param    bindaddr Socket address to bind to, or {@code null} for
+     *           an unbound socket.
+     * @throws   IOException if an I/O exception occurs
+     *           while creating the MulticastSocket
+     * @throws   SecurityException  if a security manager exists and its
+     *           {@code checkListen} method doesn't allow the operation.
+     * @see      SecurityManager#checkListen
+     * @see      java.net.DatagramSocket#setReuseAddress(boolean)
      *
      * @since 1.4
      */
@@ -208,11 +208,11 @@
      * <p>The ttl is an <b>unsigned</b> 8-bit quantity, and so <B>must</B> be
      * in the range {@code 0 <= ttl <= 0xFF }.
      *
-     * @param ttl the time-to-live
-     * @exception IOException if an I/O exception occurs
-     * while setting the default time-to-live value
+     * @param      ttl the time-to-live
+     * @throws     IOException if an I/O exception occurs
+     *             while setting the default time-to-live value
      * @deprecated use the setTimeToLive method instead, which uses
-     * <b>int</b> instead of <b>byte</b> as the type for ttl.
+     *             <b>int</b> instead of <b>byte</b> as the type for ttl.
      * @see #getTTL()
      */
     @Deprecated
@@ -254,7 +254,7 @@
      * Get the default time-to-live for multicast packets sent out on
      * the socket.
      *
-     * @exception IOException if an I/O exception occurs
+     * @throws    IOException if an I/O exception occurs
      * while getting the default time-to-live value
      * @return the default time-to-live value
      * @deprecated use the getTimeToLive method instead, which returns
@@ -271,7 +271,7 @@
     /**
      * Get the default time-to-live for multicast packets sent out on
      * the socket.
-     * @exception IOException if an I/O exception occurs while
+     * @throws    IOException if an I/O exception occurs while
      * getting the default time-to-live value
      * @return the default time-to-live value
      * @see #setTimeToLive(int)
@@ -293,10 +293,10 @@
      *
      * @param mcastaddr is the multicast address to join
      *
-     * @exception IOException if there is an error joining, or when the address
+     * @throws    IOException if there is an error joining, or when the address
      *            is not a multicast address, or the platform does not support
      *            multicasting
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     SecurityException  if a security manager exists and its
      * {@code checkMulticast} method doesn't allow the join.
      *
      * @see SecurityManager#checkMulticast(InetAddress)
@@ -339,9 +339,9 @@
      * as its argument.
      *
      * @param mcastaddr is the multicast address to leave
-     * @exception IOException if there is an error leaving
+     * @throws    IOException if there is an error leaving
      * or when the address is not a multicast address.
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     SecurityException  if a security manager exists and its
      * {@code checkMulticast} method doesn't allow the operation.
      *
      * @see SecurityManager#checkMulticast(InetAddress)
@@ -378,10 +378,10 @@
      *       {@link MulticastSocket#setInterface(InetAddress)} or
      *       {@link MulticastSocket#setNetworkInterface(NetworkInterface)}
      *
-     * @exception IOException if there is an error joining, or when the address
+     * @throws    IOException if there is an error joining, or when the address
      *            is not a multicast address, or the platform does not support
      *            multicasting
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     SecurityException  if a security manager exists and its
      * {@code checkMulticast} method doesn't allow the join.
      * @throws  IllegalArgumentException if mcastaddr is null or is a
      *          SocketAddress subclass not supported by this socket
@@ -426,9 +426,9 @@
      *             to the interface set by
      *             {@link MulticastSocket#setInterface(InetAddress)} or
      *             {@link MulticastSocket#setNetworkInterface(NetworkInterface)}
-     * @exception IOException if there is an error leaving
+     * @throws    IOException if there is an error leaving
      * or when the address is not a multicast address.
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     SecurityException  if a security manager exists and its
      * {@code checkMulticast} method doesn't allow the operation.
      * @throws  IllegalArgumentException if mcastaddr is null or is a
      *          SocketAddress subclass not supported by this socket
@@ -465,7 +465,7 @@
      * whose behavior would be affected by the value of the
      * network interface. Useful for multihomed hosts.
      * @param inf the InetAddress
-     * @exception SocketException if there is an error in
+     * @throws    SocketException if there is an error in
      * the underlying protocol, such as a TCP error.
      * @see #getInterface()
      */
@@ -489,7 +489,7 @@
      *  the address of the network interface used for
      *  multicast packets.
      *
-     * @exception SocketException if there is an error in
+     * @throws    SocketException if there is an error in
      * the underlying protocol, such as a TCP error.
      *
      * @see #setInterface(java.net.InetAddress)
@@ -549,7 +549,7 @@
      * sent on this socket.
      *
      * @param netIf the interface
-     * @exception SocketException if there is an error in
+     * @throws    SocketException if there is an error in
      * the underlying protocol, such as a TCP error.
      * @see #getNetworkInterface()
      * @since 1.4
@@ -567,7 +567,7 @@
     /**
      * Get the multicast network interface set.
      *
-     * @exception SocketException if there is an error in
+     * @throws    SocketException if there is an error in
      * the underlying protocol, such as a TCP error.
      * @return the multicast {@code NetworkInterface} currently set
      * @see #setNetworkInterface(NetworkInterface)
@@ -643,9 +643,9 @@
      * @param ttl optional time to live for multicast packet.
      * default ttl is 1.
      *
-     * @exception IOException is raised if an error occurs i.e
+     * @throws    IOException is raised if an error occurs i.e
      * error while setting ttl.
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     SecurityException  if a security manager exists and its
      *             {@code checkMulticast} or {@code checkConnect}
      *             method doesn't allow the send.
      *
--- a/src/java.base/share/classes/java/net/NetworkInterface.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/net/NetworkInterface.java	Tue Sep 24 15:19:35 2019 -0400
@@ -341,7 +341,7 @@
      * {@link #getInetAddresses()} to obtain all IP addresses for this node
      *
      * @return an Enumeration of NetworkInterfaces found on this machine
-     * @exception  SocketException  if an I/O error occurs,
+     * @throws     SocketException  if an I/O error occurs,
      *             or if the platform does not have at least one configured
      *             network interface.
      * @see #networkInterfaces()
@@ -371,7 +371,7 @@
      * }</pre>
      *
      * @return a Stream of NetworkInterfaces found on this machine
-     * @exception  SocketException  if an I/O error occurs,
+     * @throws     SocketException  if an I/O error occurs,
      *             or if the platform does not have at least one configured
      *             network interface.
      * @since 9
@@ -450,7 +450,7 @@
      * Returns whether a network interface is up and running.
      *
      * @return  {@code true} if the interface is up and running.
-     * @exception       SocketException if an I/O error occurs.
+     * @throws          SocketException if an I/O error occurs.
      * @since 1.6
      */
 
@@ -462,7 +462,7 @@
      * Returns whether a network interface is a loopback interface.
      *
      * @return  {@code true} if the interface is a loopback interface.
-     * @exception       SocketException if an I/O error occurs.
+     * @throws          SocketException if an I/O error occurs.
      * @since 1.6
      */
 
@@ -477,7 +477,7 @@
      *
      * @return  {@code true} if the interface is a point to point
      *          interface.
-     * @exception       SocketException if an I/O error occurs.
+     * @throws          SocketException if an I/O error occurs.
      * @since 1.6
      */
 
@@ -489,7 +489,7 @@
      * Returns whether a network interface supports multicasting or not.
      *
      * @return  {@code true} if the interface supports Multicasting.
-     * @exception       SocketException if an I/O error occurs.
+     * @throws          SocketException if an I/O error occurs.
      * @since 1.6
      */
 
@@ -508,7 +508,7 @@
      *          manager is set and the caller does not have the permission
      *          NetPermission("getNetworkInformation")
      *
-     * @exception       SocketException if an I/O error occurs.
+     * @throws          SocketException if an I/O error occurs.
      * @since 1.6
      */
     public byte[] getHardwareAddress() throws SocketException {
@@ -535,7 +535,7 @@
      * Returns the Maximum Transmission Unit (MTU) of this interface.
      *
      * @return the value of the MTU for that interface.
-     * @exception       SocketException if an I/O error occurs.
+     * @throws          SocketException if an I/O error occurs.
      * @since 1.6
      */
     public int getMTU() throws SocketException {
--- a/src/java.base/share/classes/java/net/ProxySelector.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/net/ProxySelector.java	Tue Sep 24 15:19:35 2019 -0400
@@ -85,10 +85,10 @@
      *
      * @throws  SecurityException
      *          If a security manager has been installed and it denies
-     * {@link NetPermission}{@code ("getProxySelector")}
-     * @see #setDefault(ProxySelector)
-     * @return the system-wide {@code ProxySelector}
-     * @since 1.5
+     *          {@link NetPermission}{@code ("getProxySelector")}
+     * @see     #setDefault(ProxySelector)
+     * @return  the system-wide {@code ProxySelector}
+     * @since   1.5
      */
     public static ProxySelector getDefault() {
         SecurityManager sm = System.getSecurityManager();
@@ -108,7 +108,7 @@
      *
      * @throws  SecurityException
      *          If a security manager has been installed and it denies
-     * {@link NetPermission}{@code ("setProxySelector")}
+     *          {@link NetPermission}{@code ("setProxySelector")}
      *
      * @see #getDefault()
      * @since 1.5
@@ -163,7 +163,7 @@
      *
      * @param   ioe
      *          The I/O exception thrown when the connect failed.
-     * @throws IllegalArgumentException if either argument is null
+     * @throws  IllegalArgumentException if either argument is null
      */
     public abstract void connectFailed(URI uri, SocketAddress sa, IOException ioe);
 
--- a/src/java.base/share/classes/java/net/ServerSocket.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/net/ServerSocket.java	Tue Sep 24 15:19:35 2019 -0400
@@ -83,7 +83,7 @@
     /**
      * Creates an unbound server socket.
      *
-     * @exception IOException IO error when opening the socket.
+     * @throws    IOException IO error when opening the socket.
      * @revised 1.4
      */
     public ServerSocket() throws IOException {
@@ -115,11 +115,11 @@
      * @param      port  the port number, or {@code 0} to use a port
      *                   number that is automatically allocated.
      *
-     * @exception  IOException  if an I/O error occurs when opening the socket.
-     * @exception  SecurityException
+     * @throws     IOException  if an I/O error occurs when opening the socket.
+     * @throws     SecurityException
      * if a security manager exists and its {@code checkListen}
      * method doesn't allow the operation.
-     * @exception  IllegalArgumentException if the port parameter is outside
+     * @throws     IllegalArgumentException if the port parameter is outside
      *             the specified range of valid port values, which is between
      *             0 and 65535, inclusive.
      *
@@ -168,11 +168,11 @@
      * @param      backlog  requested maximum length of the queue of incoming
      *                      connections.
      *
-     * @exception  IOException  if an I/O error occurs when opening the socket.
-     * @exception  SecurityException
+     * @throws     IOException  if an I/O error occurs when opening the socket.
+     * @throws     SecurityException
      * if a security manager exists and its {@code checkListen}
      * method doesn't allow the operation.
-     * @exception  IllegalArgumentException if the port parameter is outside
+     * @throws     IllegalArgumentException if the port parameter is outside
      *             the specified range of valid port values, which is between
      *             0 and 65535, inclusive.
      *
@@ -221,7 +221,7 @@
      * its {@code checkListen} method doesn't allow the operation.
      *
      * @throws  IOException if an I/O error occurs when opening the socket.
-     * @exception  IllegalArgumentException if the port parameter is outside
+     * @throws     IllegalArgumentException if the port parameter is outside
      *             the specified range of valid port values, which is between
      *             0 and 65535, inclusive.
      *
@@ -474,13 +474,13 @@
      * of the {@linkplain Socket#setSocketImplFactory(SocketImplFactory)
      * client socket implementation factory}, if one has been set.
      *
-     * @exception  IOException  if an I/O error occurs when waiting for a
+     * @throws     IOException  if an I/O error occurs when waiting for a
      *               connection.
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     SecurityException  if a security manager exists and its
      *             {@code checkAccept} method doesn't allow the operation.
-     * @exception  SocketTimeoutException if a timeout was previously set with setSoTimeout and
+     * @throws     SocketTimeoutException if a timeout was previously set with setSoTimeout and
      *             the timeout has been reached.
-     * @exception  java.nio.channels.IllegalBlockingModeException
+     * @throws     java.nio.channels.IllegalBlockingModeException
      *             if this socket has an associated channel, the channel is in
      *             non-blocking mode, and there is no connection ready to be
      *             accepted
@@ -674,7 +674,7 @@
      * <p> If this socket has an associated channel then the channel is closed
      * as well.
      *
-     * @exception  IOException  if an I/O error occurs when closing the socket.
+     * @throws     IOException  if an I/O error occurs when closing the socket.
      * @revised 1.4
      * @spec JSR-51
      */
@@ -763,7 +763,7 @@
      * Retrieve setting for {@link SocketOptions#SO_TIMEOUT SO_TIMEOUT}.
      * 0 returns implies that the option is disabled (i.e., timeout of infinity).
      * @return the {@link SocketOptions#SO_TIMEOUT SO_TIMEOUT} value
-     * @exception IOException if an I/O error occurs
+     * @throws    IOException if an I/O error occurs
      * @since   1.1
      * @see #setSoTimeout(int)
      */
@@ -806,7 +806,7 @@
      * is not defined.
      *
      * @param on  whether to enable or disable the socket option
-     * @exception SocketException if an error occurs enabling or
+     * @throws    SocketException if an error occurs enabling or
      *            disabling the {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR}
      *            socket option, or the socket is closed.
      * @since 1.4
@@ -826,7 +826,7 @@
      *
      * @return a {@code boolean} indicating whether or not
      *         {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} is enabled.
-     * @exception SocketException if there is an error
+     * @throws    SocketException if there is an error
      * in the underlying protocol, such as a TCP error.
      * @since   1.4
      * @see #setReuseAddress(boolean)
@@ -885,10 +885,10 @@
      * This could result in a SecurityException.
      *
      * @param      fac   the desired factory.
-     * @exception  IOException  if an I/O error occurs when setting the
+     * @throws     IOException  if an I/O error occurs when setting the
      *               socket factory.
-     * @exception  SocketException  if the factory has already been defined.
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     SocketException  if the factory has already been defined.
+     * @throws     SecurityException  if a security manager exists and its
      *             {@code checkSetFactory} method doesn't allow the operation.
      * @see        java.net.SocketImplFactory#createSocketImpl()
      * @see        SecurityManager#checkSetFactory
@@ -928,13 +928,13 @@
      * requested value but the TCP receive window in sockets accepted from
      * this ServerSocket will be no larger than 64K bytes.
      *
-     * @exception SocketException if there is an error
+     * @throws    SocketException if there is an error
      * in the underlying protocol, such as a TCP error.
      *
      * @param size the size to which to set the receive buffer
      * size. This value must be greater than 0.
      *
-     * @exception IllegalArgumentException if the
+     * @throws    IllegalArgumentException if the
      * value is 0 or is negative.
      *
      * @since 1.4
@@ -958,7 +958,7 @@
      * calling {@link Socket#getReceiveBufferSize()}.
      * @return the value of the {@link SocketOptions#SO_RCVBUF SO_RCVBUF}
      *         option for this {@code Socket}.
-     * @exception SocketException if there is an error
+     * @throws    SocketException if there is an error
      *            in the underlying protocol, such as a TCP error.
      * @see #setReceiveBufferSize(int)
      * @since 1.4
--- a/src/java.base/share/classes/java/net/Socket.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/net/Socket.java	Tue Sep 24 15:19:35 2019 -0400
@@ -180,7 +180,7 @@
      * @param impl an instance of a <B>SocketImpl</B>
      * the subclass wishes to use on the Socket.
      *
-     * @exception SocketException if there is an error in the underlying protocol,
+     * @throws    SocketException if there is an error in the underlying protocol,
      * such as a TCP error.
      * @since   1.1
      */
@@ -211,13 +211,13 @@
      * @param      host   the host name, or {@code null} for the loopback address.
      * @param      port   the port number.
      *
-     * @exception  UnknownHostException if the IP address of
+     * @throws     UnknownHostException if the IP address of
      * the host could not be determined.
      *
-     * @exception  IOException  if an I/O error occurs when creating the socket.
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     IOException  if an I/O error occurs when creating the socket.
+     * @throws     SecurityException  if a security manager exists and its
      *             {@code checkConnect} method doesn't allow the operation.
-     * @exception  IllegalArgumentException if the port parameter is outside
+     * @throws     IllegalArgumentException if the port parameter is outside
      *             the specified range of valid port values, which is between
      *             0 and 65535, inclusive.
      * @see        java.net.Socket#setSocketImplFactory(java.net.SocketImplFactory)
@@ -249,13 +249,13 @@
      *
      * @param      address   the IP address.
      * @param      port      the port number.
-     * @exception  IOException  if an I/O error occurs when creating the socket.
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     IOException  if an I/O error occurs when creating the socket.
+     * @throws     SecurityException  if a security manager exists and its
      *             {@code checkConnect} method doesn't allow the operation.
-     * @exception  IllegalArgumentException if the port parameter is outside
+     * @throws     IllegalArgumentException if the port parameter is outside
      *             the specified range of valid port values, which is between
      *             0 and 65535, inclusive.
-     * @exception  NullPointerException if {@code address} is null.
+     * @throws     NullPointerException if {@code address} is null.
      * @see        java.net.Socket#setSocketImplFactory(java.net.SocketImplFactory)
      * @see        java.net.SocketImpl
      * @see        java.net.SocketImplFactory#createSocketImpl()
@@ -291,12 +291,12 @@
      *        {@code null} for the {@code anyLocal} address.
      * @param localPort the local port the socket is bound to, or
      *        {@code zero} for a system selected free port.
-     * @exception  IOException  if an I/O error occurs when creating the socket.
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     IOException  if an I/O error occurs when creating the socket.
+     * @throws     SecurityException  if a security manager exists and its
      *             {@code checkConnect} method doesn't allow the connection
      *             to the destination, or if its {@code checkListen} method
      *             doesn't allow the bind to the local port.
-     * @exception  IllegalArgumentException if the port parameter or localPort
+     * @throws     IllegalArgumentException if the port parameter or localPort
      *             parameter is outside the specified range of valid port values,
      *             which is between 0 and 65535, inclusive.
      * @see        SecurityManager#checkConnect
@@ -332,15 +332,15 @@
      *        {@code null} for the {@code anyLocal} address.
      * @param localPort the local port the socket is bound to or
      *        {@code zero} for a system selected free port.
-     * @exception  IOException  if an I/O error occurs when creating the socket.
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     IOException  if an I/O error occurs when creating the socket.
+     * @throws     SecurityException  if a security manager exists and its
      *             {@code checkConnect} method doesn't allow the connection
      *             to the destination, or if its {@code checkListen} method
      *             doesn't allow the bind to the local port.
-     * @exception  IllegalArgumentException if the port parameter or localPort
+     * @throws     IllegalArgumentException if the port parameter or localPort
      *             parameter is outside the specified range of valid port values,
      *             which is between 0 and 65535, inclusive.
-     * @exception  NullPointerException if {@code address} is null.
+     * @throws     NullPointerException if {@code address} is null.
      * @see        SecurityManager#checkConnect
      * @since   1.1
      */
@@ -380,10 +380,10 @@
      * @param      port     the port number.
      * @param      stream   a {@code boolean} indicating whether this is
      *                      a stream socket or a datagram socket.
-     * @exception  IOException  if an I/O error occurs when creating the socket.
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     IOException  if an I/O error occurs when creating the socket.
+     * @throws     SecurityException  if a security manager exists and its
      *             {@code checkConnect} method doesn't allow the operation.
-     * @exception  IllegalArgumentException if the port parameter is outside
+     * @throws     IllegalArgumentException if the port parameter is outside
      *             the specified range of valid port values, which is between
      *             0 and 65535, inclusive.
      * @see        java.net.Socket#setSocketImplFactory(java.net.SocketImplFactory)
@@ -423,13 +423,13 @@
      * @param      port      the port number.
      * @param      stream    if {@code true}, create a stream socket;
      *                       otherwise, create a datagram socket.
-     * @exception  IOException  if an I/O error occurs when creating the socket.
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     IOException  if an I/O error occurs when creating the socket.
+     * @throws     SecurityException  if a security manager exists and its
      *             {@code checkConnect} method doesn't allow the operation.
-     * @exception  IllegalArgumentException if the port parameter is outside
+     * @throws     IllegalArgumentException if the port parameter is outside
      *             the specified range of valid port values, which is between
      *             0 and 65535, inclusive.
-     * @exception  NullPointerException if {@code host} is null.
+     * @throws     NullPointerException if {@code host} is null.
      * @see        java.net.Socket#setSocketImplFactory(java.net.SocketImplFactory)
      * @see        java.net.SocketImpl
      * @see        java.net.SocketImplFactory#createSocketImpl()
@@ -867,7 +867,7 @@
      * will close the associated socket.
      *
      * @return     an input stream for reading bytes from this socket.
-     * @exception  IOException  if an I/O error occurs when creating the
+     * @throws     IOException  if an I/O error occurs when creating the
      *             input stream, the socket is closed, the socket is
      *             not connected, or the socket input has been shutdown
      *             using {@link #shutdownInput()}
@@ -942,7 +942,7 @@
      * will close the associated socket.
      *
      * @return     an output stream for writing bytes to this socket.
-     * @exception  IOException  if an I/O error occurs when creating the
+     * @throws     IOException  if an I/O error occurs when creating the
      *               output stream or if the socket is not connected.
      * @revised 1.4
      * @spec JSR-51
@@ -1002,7 +1002,7 @@
      * @param on {@code true} to enable TCP_NODELAY,
      * {@code false} to disable.
      *
-     * @exception SocketException if there is an error
+     * @throws    SocketException if there is an error
      * in the underlying protocol, such as a TCP error.
      *
      * @since   1.1
@@ -1020,7 +1020,7 @@
      *
      * @return a {@code boolean} indicating whether or not
      *         {@link SocketOptions#TCP_NODELAY TCP_NODELAY} is enabled.
-     * @exception SocketException if there is an error
+     * @throws    SocketException if there is an error
      * in the underlying protocol, such as a TCP error.
      * @since   1.1
      * @see #setTcpNoDelay(boolean)
@@ -1040,9 +1040,9 @@
      *
      * @param on     whether or not to linger on.
      * @param linger how long to linger for, if on is true.
-     * @exception SocketException if there is an error
+     * @throws    SocketException if there is an error
      * in the underlying protocol, such as a TCP error.
-     * @exception IllegalArgumentException if the linger value is negative.
+     * @throws    IllegalArgumentException if the linger value is negative.
      * @since 1.1
      * @see #getSoLinger()
      */
@@ -1069,7 +1069,7 @@
      * The setting only affects socket close.
      *
      * @return the setting for {@link SocketOptions#SO_LINGER SO_LINGER}.
-     * @exception SocketException if there is an error
+     * @throws    SocketException if there is an error
      * in the underlying protocol, such as a TCP error.
      * @since   1.1
      * @see #setSoLinger(boolean, int)
@@ -1091,7 +1091,7 @@
      * sent after any preceding writes to the socket OutputStream
      * and before any future writes to the OutputStream.
      * @param data The byte of data to send
-     * @exception IOException if there is an error
+     * @throws    IOException if there is an error
      *  sending the data.
      * @since 1.4
      */
@@ -1120,7 +1120,7 @@
      *           {@link SocketOptions#SO_OOBINLINE SO_OOBINLINE},
      *           {@code false} to disable.
      *
-     * @exception SocketException if there is an error
+     * @throws    SocketException if there is an error
      * in the underlying protocol, such as a TCP error.
      *
      * @since   1.4
@@ -1139,7 +1139,7 @@
      * @return a {@code boolean} indicating whether or not
      *         {@link SocketOptions#SO_OOBINLINE SO_OOBINLINE} is enabled.
      *
-     * @exception SocketException if there is an error
+     * @throws    SocketException if there is an error
      * in the underlying protocol, such as a TCP error.
      * @since   1.4
      * @see #setOOBInline(boolean)
@@ -1182,7 +1182,7 @@
      * 0 returns implies that the option is disabled (i.e., timeout of infinity).
      *
      * @return the setting for {@link SocketOptions#SO_TIMEOUT SO_TIMEOUT}
-     * @exception SocketException if there is an error
+     * @throws    SocketException if there is an error
      * in the underlying protocol, such as a TCP error.
      *
      * @since   1.1
@@ -1211,13 +1211,13 @@
      * applications that want to verify what size the buffers were set to
      * should call {@link #getSendBufferSize()}.
      *
-     * @exception SocketException if there is an error
+     * @throws    SocketException if there is an error
      * in the underlying protocol, such as a TCP error.
      *
      * @param size the size to which to set the send buffer
      * size. This value must be greater than 0.
      *
-     * @exception IllegalArgumentException if the
+     * @throws    IllegalArgumentException if the
      * value is 0 or is negative.
      *
      * @see #getSendBufferSize()
@@ -1240,7 +1240,7 @@
      * @return the value of the {@link SocketOptions#SO_SNDBUF SO_SNDBUF}
      *         option for this {@code Socket}.
      *
-     * @exception SocketException if there is an error
+     * @throws    SocketException if there is an error
      * in the underlying protocol, such as a TCP error.
      *
      * @see #setSendBufferSize(int)
@@ -1287,10 +1287,10 @@
      * @param size the size to which to set the receive buffer
      * size. This value must be greater than 0.
      *
-     * @exception IllegalArgumentException if the value is 0 or is
+     * @throws    IllegalArgumentException if the value is 0 or is
      * negative.
      *
-     * @exception SocketException if there is an error
+     * @throws    SocketException if there is an error
      * in the underlying protocol, such as a TCP error.
      *
      * @see #getReceiveBufferSize()
@@ -1314,7 +1314,7 @@
      *
      * @return the value of the {@link SocketOptions#SO_RCVBUF SO_RCVBUF}
      *         option for this {@code Socket}.
-     * @exception SocketException if there is an error
+     * @throws    SocketException if there is an error
      * in the underlying protocol, such as a TCP error.
      * @see #setReceiveBufferSize(int)
      * @since 1.2
@@ -1335,7 +1335,7 @@
      * Enable/disable {@link SocketOptions#SO_KEEPALIVE SO_KEEPALIVE}.
      *
      * @param on  whether or not to have socket keep alive turned on.
-     * @exception SocketException if there is an error
+     * @throws    SocketException if there is an error
      * in the underlying protocol, such as a TCP error.
      * @since 1.3
      * @see #getKeepAlive()
@@ -1351,7 +1351,7 @@
      *
      * @return a {@code boolean} indicating whether or not
      *         {@link SocketOptions#SO_KEEPALIVE SO_KEEPALIVE} is enabled.
-     * @exception SocketException if there is an error
+     * @throws    SocketException if there is an error
      * in the underlying protocol, such as a TCP error.
      * @since   1.3
      * @see #setKeepAlive(boolean)
@@ -1470,7 +1470,7 @@
      * is not defined.
      *
      * @param on  whether to enable or disable the socket option
-     * @exception SocketException if an error occurs enabling or
+     * @throws    SocketException if an error occurs enabling or
      *            disabling the {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR}
      *            socket option, or the socket is closed.
      * @since 1.4
@@ -1490,7 +1490,7 @@
      *
      * @return a {@code boolean} indicating whether or not
      *         {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} is enabled.
-     * @exception SocketException if there is an error
+     * @throws    SocketException if there is an error
      * in the underlying protocol, such as a TCP error.
      * @since   1.4
      * @see #setReuseAddress(boolean)
@@ -1518,7 +1518,7 @@
      * <p> If this socket has an associated channel then the channel is closed
      * as well.
      *
-     * @exception  IOException  if an I/O error occurs when closing this socket.
+     * @throws     IOException  if an I/O error occurs when closing this socket.
      * @revised 1.4
      * @spec JSR-51
      * @see #isClosed
@@ -1542,7 +1542,7 @@
      * socket, the stream's {@code available} method will return 0, and its
      * {@code read} methods will return {@code -1} (end of stream).
      *
-     * @exception IOException if an I/O error occurs when shutting down this
+     * @throws    IOException if an I/O error occurs when shutting down this
      * socket.
      *
      * @since 1.3
@@ -1572,7 +1572,7 @@
      * shutdownOutput() on the socket, the stream will throw
      * an IOException.
      *
-     * @exception IOException if an I/O error occurs when shutting down this
+     * @throws    IOException if an I/O error occurs when shutting down this
      * socket.
      *
      * @since 1.3
@@ -1700,10 +1700,10 @@
      * This could result in a SecurityException.
      *
      * @param      fac   the desired factory.
-     * @exception  IOException  if an I/O error occurs when setting the
+     * @throws     IOException  if an I/O error occurs when setting the
      *               socket factory.
-     * @exception  SocketException  if the factory is already defined.
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     SocketException  if the factory is already defined.
+     * @throws     SecurityException  if a security manager exists and its
      *             {@code checkSetFactory} method doesn't allow the operation.
      * @see        java.net.SocketImplFactory#createSocketImpl()
      * @see        SecurityManager#checkSetFactory
--- a/src/java.base/share/classes/java/net/SocketImpl.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/net/SocketImpl.java	Tue Sep 24 15:19:35 2019 -0400
@@ -114,7 +114,7 @@
      *
      * @param      stream   if {@code true}, create a stream socket;
      *                      otherwise, create a datagram socket.
-     * @exception  IOException  if an I/O error occurs while creating the
+     * @throws     IOException  if an I/O error occurs while creating the
      *               socket.
      */
     protected abstract void create(boolean stream) throws IOException;
@@ -124,7 +124,7 @@
      *
      * @param      host   the name of the remote host.
      * @param      port   the port number.
-     * @exception  IOException  if an I/O error occurs when connecting to the
+     * @throws     IOException  if an I/O error occurs when connecting to the
      *               remote host.
      */
     protected abstract void connect(String host, int port) throws IOException;
@@ -134,7 +134,7 @@
      *
      * @param      address   the IP address of the remote host.
      * @param      port      the port number.
-     * @exception  IOException  if an I/O error occurs when attempting a
+     * @throws     IOException  if an I/O error occurs when attempting a
      *               connection.
      */
     protected abstract void connect(InetAddress address, int port) throws IOException;
@@ -146,7 +146,7 @@
      *
      * @param      address   the Socket address of the remote host.
      * @param     timeout  the timeout value, in milliseconds, or zero for no timeout.
-     * @exception  IOException  if an I/O error occurs when attempting a
+     * @throws     IOException  if an I/O error occurs when attempting a
      *               connection.
      * @since 1.4
      */
@@ -157,7 +157,7 @@
      *
      * @param      host   an IP address that belongs to a local interface.
      * @param      port   the port number.
-     * @exception  IOException  if an I/O error occurs when binding this socket.
+     * @throws     IOException  if an I/O error occurs when binding this socket.
      */
     protected abstract void bind(InetAddress host, int port) throws IOException;
 
@@ -168,7 +168,7 @@
      * connection is refused.
      *
      * @param      backlog   the maximum length of the queue.
-     * @exception  IOException  if an I/O error occurs when creating the queue.
+     * @throws     IOException  if an I/O error occurs when creating the queue.
      */
     protected abstract void listen(int backlog) throws IOException;
 
@@ -176,7 +176,7 @@
      * Accepts a connection.
      *
      * @param      s   the accepted connection.
-     * @exception  IOException  if an I/O error occurs when accepting the
+     * @throws     IOException  if an I/O error occurs when accepting the
      *               connection.
      */
     protected abstract void accept(SocketImpl s) throws IOException;
@@ -185,7 +185,7 @@
      * Returns an input stream for this socket.
      *
      * @return     a stream for reading from this socket.
-     * @exception  IOException  if an I/O error occurs when creating the
+     * @throws     IOException  if an I/O error occurs when creating the
      *               input stream.
     */
     protected abstract InputStream getInputStream() throws IOException;
@@ -194,7 +194,7 @@
      * Returns an output stream for this socket.
      *
      * @return     an output stream for writing to this socket.
-     * @exception  IOException  if an I/O error occurs when creating the
+     * @throws     IOException  if an I/O error occurs when creating the
      *               output stream.
      */
     protected abstract OutputStream getOutputStream() throws IOException;
@@ -205,7 +205,7 @@
      *
      * @return     the number of bytes that can be read from this socket
      *             without blocking.
-     * @exception  IOException  if an I/O error occurs when determining the
+     * @throws     IOException  if an I/O error occurs when determining the
      *               number of bytes available.
      */
     protected abstract int available() throws IOException;
@@ -213,7 +213,7 @@
     /**
      * Closes this socket.
      *
-     * @exception  IOException  if an I/O error occurs when closing this socket.
+     * @throws     IOException  if an I/O error occurs when closing this socket.
      */
     protected abstract void close() throws IOException;
 
@@ -235,7 +235,7 @@
      * socket, the stream's {@code available} method will return 0, and its
      * {@code read} methods will return {@code -1} (end of stream).
      *
-     * @exception IOException if an I/O error occurs when shutting down this
+     * @throws    IOException if an I/O error occurs when shutting down this
      * socket.
      * @see java.net.Socket#shutdownOutput()
      * @see java.net.Socket#close()
@@ -255,7 +255,7 @@
      * shutdownOutput() on the socket, the stream will throw
      * an IOException.
      *
-     * @exception IOException if an I/O error occurs when shutting down this
+     * @throws    IOException if an I/O error occurs when shutting down this
      * socket.
      * @see java.net.Socket#shutdownInput()
      * @see java.net.Socket#close()
@@ -313,7 +313,7 @@
      * Send one byte of urgent data on the socket.
      * The byte to be sent is the low eight bits of the parameter
      * @param data The byte of data to send
-     * @exception IOException if there is an error
+     * @throws    IOException if there is an error
      *  sending the data.
      * @since 1.4
      */
--- a/src/java.base/share/classes/java/net/SocketInputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/net/SocketInputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -86,7 +86,7 @@
      * @param timeout the read timeout in ms
      * @return the actual number of bytes read, -1 is
      *          returned when the end of the stream is reached.
-     * @exception IOException If an I/O error has occurred.
+     * @throws    IOException If an I/O error has occurred.
      */
     private native int socketRead0(FileDescriptor fd,
                                    byte b[], int off, int len,
@@ -104,7 +104,7 @@
      * @param timeout the read timeout in ms
      * @return the actual number of bytes read, -1 is
      *          returned when the end of the stream is reached.
-     * @exception IOException If an I/O error has occurred.
+     * @throws    IOException If an I/O error has occurred.
      */
     private int socketRead(FileDescriptor fd,
                            byte b[], int off, int len,
@@ -118,7 +118,7 @@
      * @param b the buffer into which the data is read
      * @return the actual number of bytes read, -1 is
      *          returned when the end of the stream is reached.
-     * @exception IOException If an I/O error has occurred.
+     * @throws    IOException If an I/O error has occurred.
      */
     public int read(byte b[]) throws IOException {
         return read(b, 0, b.length);
@@ -132,7 +132,7 @@
      * @param length the maximum number of bytes read
      * @return the actual number of bytes read, -1 is
      *          returned when the end of the stream is reached.
-     * @exception IOException If an I/O error has occurred.
+     * @throws    IOException If an I/O error has occurred.
      */
     public int read(byte b[], int off, int length) throws IOException {
         return read(b, off, length, impl.getTimeout());
@@ -206,7 +206,7 @@
      * Skips n bytes of input.
      * @param numbytes the number of bytes to skip
      * @return  the actual number of bytes skipped.
-     * @exception IOException If an I/O error has occurred.
+     * @throws    IOException If an I/O error has occurred.
      */
     public long skip(long numbytes) throws IOException {
         if (numbytes <= 0) {
--- a/src/java.base/share/classes/java/net/SocketOptions.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/net/SocketOptions.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -81,11 +81,11 @@
      * Throws SocketException if the option is unrecognized,
      * the socket is closed, or some low-level error occurred
      * <BR>
-     * @param optID identifies the option
-     * @param value the parameter of the socket option
+     * @param  optID identifies the option
+     * @param  value the parameter of the socket option
      * @throws SocketException if the option is unrecognized,
-     * the socket is closed, or some low-level error occurred
-     * @see #getOption(int)
+     *         the socket is closed, or some low-level error occurred
+     * @see    #getOption(int)
      */
     public void
         setOption(int optID, Object value) throws SocketException;
@@ -116,7 +116,7 @@
      * }
      * </PRE>
      *
-     * @param optID an {@code int} identifying the option to fetch
+     * @param  optID an {@code int} identifying the option to fetch
      * @return the value of the option
      * @throws SocketException if the socket is closed
      * @throws SocketException if <I>optID</I> is unknown along the
--- a/src/java.base/share/classes/java/net/SocketOutputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/net/SocketOutputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -79,7 +79,7 @@
      * @param b the data to be written
      * @param off the start offset in the data
      * @param len the number of bytes that are written
-     * @exception IOException If an I/O error has occurred.
+     * @throws    IOException If an I/O error has occurred.
      */
     private native void socketWrite0(FileDescriptor fd, byte[] b, int off,
                                      int len) throws IOException;
@@ -90,7 +90,7 @@
      * @param b the data to be written
      * @param off the start offset in the data
      * @param len the number of bytes that are written
-     * @exception IOException If an I/O error has occurred.
+     * @throws    IOException If an I/O error has occurred.
      */
     private void socketWrite(byte b[], int off, int len) throws IOException {
 
@@ -120,7 +120,7 @@
     /**
      * Writes a byte to the socket.
      * @param b the data to be written
-     * @exception IOException If an I/O error has occurred.
+     * @throws    IOException If an I/O error has occurred.
      */
     public void write(int b) throws IOException {
         temp[0] = (byte)b;
@@ -130,7 +130,7 @@
     /**
      * Writes the contents of the buffer <i>b</i> to the socket.
      * @param b the data to be written
-     * @exception SocketException If an I/O error has occurred.
+     * @throws    SocketException If an I/O error has occurred.
      */
     public void write(byte b[]) throws IOException {
         socketWrite(b, 0, b.length);
@@ -142,7 +142,7 @@
      * @param b the data to be written
      * @param off the start offset in the data
      * @param len the number of bytes that are written
-     * @exception SocketException If an I/O error has occurred.
+     * @throws    SocketException If an I/O error has occurred.
      */
     public void write(byte b[], int off, int len) throws IOException {
         socketWrite(b, off, len);
--- a/src/java.base/share/classes/java/net/SocketPermission.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/net/SocketPermission.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1361,10 +1361,10 @@
      *
      * @param permission the Permission object to add.
      *
-     * @exception IllegalArgumentException - if the permission is not a
+     * @throws    IllegalArgumentException - if the permission is not a
      *                                       SocketPermission
      *
-     * @exception SecurityException - if this SocketPermissionCollection object
+     * @throws    SecurityException - if this SocketPermissionCollection object
      *                                has been marked readonly
      */
     @Override
--- a/src/java.base/share/classes/java/net/URL.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/net/URL.java	Tue Sep 24 15:19:35 2019 -0400
@@ -349,7 +349,7 @@
      * @param      host       the name of the host.
      * @param      port       the port number on the host.
      * @param      file       the file on the host
-     * @exception  MalformedURLException  if an unknown protocol or the port
+     * @throws     MalformedURLException  if an unknown protocol or the port
      *                  is a negative number other than -1
      * @see        java.lang.System#getProperty(java.lang.String)
      * @see        java.net.URL#setURLStreamHandlerFactory(
@@ -378,7 +378,7 @@
      * @param      protocol   the name of the protocol to use.
      * @param      host       the name of the host.
      * @param      file       the file on the host.
-     * @exception  MalformedURLException  if an unknown protocol is specified.
+     * @throws     MalformedURLException  if an unknown protocol is specified.
      * @see        java.net.URL#URL(java.lang.String, java.lang.String,
      *                  int, java.lang.String)
      */
@@ -412,9 +412,9 @@
      * @param      port       the port number on the host.
      * @param      file       the file on the host
      * @param      handler    the stream handler for the URL.
-     * @exception  MalformedURLException  if an unknown protocol or the port
+     * @throws     MalformedURLException  if an unknown protocol or the port
                         is a negative number other than -1
-     * @exception  SecurityException
+     * @throws     SecurityException
      *        if a security manager exists and its
      *        {@code checkPermission} method doesn't allow
      *        specifying a stream handler explicitly.
@@ -494,7 +494,7 @@
      * constructor with a {@code null} first argument.
      *
      * @param      spec   the {@code String} to parse as a URL.
-     * @exception  MalformedURLException  if no protocol is specified, or an
+     * @throws     MalformedURLException  if no protocol is specified, or an
      *               unknown protocol is found, or {@code spec} is {@code null},
      *               or the parsed URL fails to comply with the specific syntax
      *               of the associated protocol.
@@ -543,7 +543,7 @@
      *
      * @param      context   the context in which to parse the specification.
      * @param      spec      the {@code String} to parse as a URL.
-     * @exception  MalformedURLException  if no protocol is specified, or an
+     * @throws     MalformedURLException  if no protocol is specified, or an
      *               unknown protocol is found, or {@code spec} is {@code null},
      *               or the parsed URL fails to comply with the specific syntax
      *               of the associated protocol.
@@ -565,11 +565,11 @@
      * @param      context   the context in which to parse the specification.
      * @param      spec      the {@code String} to parse as a URL.
      * @param      handler   the stream handler for the URL.
-     * @exception  MalformedURLException  if no protocol is specified, or an
+     * @throws     MalformedURLException  if no protocol is specified, or an
      *               unknown protocol is found, or {@code spec} is {@code null},
      *               or the parsed URL fails to comply with the specific syntax
      *               of the associated protocol.
-     * @exception  SecurityException
+     * @throws     SecurityException
      *        if a security manager exists and its
      *        {@code checkPermission} method doesn't allow
      *        specifying a stream handler.
@@ -1042,7 +1042,7 @@
      * to a URI. However, some URLs that are not strictly in compliance
      * can not be converted to a URI.
      *
-     * @exception URISyntaxException if this URL is not formatted strictly according to
+     * @throws    URISyntaxException if this URL is not formatted strictly according to
      *            RFC2396 and cannot be converted to a URI.
      *
      * @return    a URI instance equivalent to this URL.
@@ -1082,7 +1082,7 @@
      *
      * @return     a {@link java.net.URLConnection URLConnection} linking
      *             to the URL.
-     * @exception  IOException  if an I/O exception occurs.
+     * @throws     IOException  if an I/O exception occurs.
      * @see        java.net.URL#URL(java.lang.String, java.lang.String,
      *             int, java.lang.String)
      */
@@ -1103,13 +1103,13 @@
      *             will be made. If direct connection is desired,
      *             Proxy.NO_PROXY should be specified.
      * @return     a {@code URLConnection} to the URL.
-     * @exception  IOException  if an I/O exception occurs.
-     * @exception  SecurityException if a security manager is present
+     * @throws     IOException  if an I/O exception occurs.
+     * @throws     SecurityException if a security manager is present
      *             and the caller doesn't have permission to connect
      *             to the proxy.
-     * @exception  IllegalArgumentException will be thrown if proxy is null,
+     * @throws     IllegalArgumentException will be thrown if proxy is null,
      *             or proxy has the wrong type
-     * @exception  UnsupportedOperationException if the subclass that
+     * @throws     UnsupportedOperationException if the subclass that
      *             implements the protocol handler doesn't support
      *             this method.
      * @see        java.net.URL#URL(java.lang.String, java.lang.String,
@@ -1148,7 +1148,7 @@
      * </pre></blockquote>
      *
      * @return     an input stream for reading from the URL connection.
-     * @exception  IOException  if an I/O exception occurs.
+     * @throws     IOException  if an I/O exception occurs.
      * @see        java.net.URL#openConnection()
      * @see        java.net.URLConnection#getInputStream()
      */
@@ -1163,7 +1163,7 @@
      * </pre></blockquote>
      *
      * @return     the contents of this URL.
-     * @exception  IOException  if an I/O exception occurs.
+     * @throws     IOException  if an I/O exception occurs.
      * @see        java.net.URLConnection#getContent()
      */
     public final Object getContent() throws java.io.IOException {
@@ -1180,7 +1180,7 @@
      * @return     the content object of this URL that is the first match of
      *               the types specified in the classes array.
      *               null if none of the requested types are supported.
-     * @exception  IOException  if an I/O exception occurs.
+     * @throws     IOException  if an I/O exception occurs.
      * @see        java.net.URLConnection#getContent(Class[])
      * @since 1.3
      */
@@ -1208,8 +1208,8 @@
      * This could result in a SecurityException.
      *
      * @param      fac   the desired factory.
-     * @exception  Error  if the application has already set a factory.
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     Error  if the application has already set a factory.
+     * @throws     SecurityException  if a security manager exists and its
      *             {@code checkSetFactory} method doesn't allow
      *             the operation.
      * @see        java.net.URL#URL(java.lang.String, java.lang.String,
--- a/src/java.base/share/classes/java/net/URLClassLoader.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/net/URLClassLoader.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -99,12 +99,12 @@
      * calls the security manager's {@code checkCreateClassLoader} method
      * to ensure creation of a class loader is allowed.
      *
-     * @param urls the URLs from which to load classes and resources
-     * @param parent the parent class loader for delegation
-     * @exception  SecurityException  if a security manager exists and its
+     * @param      urls the URLs from which to load classes and resources
+     * @param      parent the parent class loader for delegation
+     * @throws     SecurityException  if a security manager exists and its
      *             {@code checkCreateClassLoader} method doesn't allow
      *             creation of a class loader.
-     * @exception  NullPointerException if {@code urls} or any of its
+     * @throws     NullPointerException if {@code urls} or any of its
      *             elements is {@code null}.
      * @see SecurityManager#checkCreateClassLoader
      */
@@ -134,12 +134,12 @@
      * calls the security manager's {@code checkCreateClassLoader} method
      * to ensure creation of a class loader is allowed.
      *
-     * @param urls the URLs from which to load classes and resources
+     * @param      urls the URLs from which to load classes and resources
      *
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     SecurityException  if a security manager exists and its
      *             {@code checkCreateClassLoader} method doesn't allow
      *             creation of a class loader.
-     * @exception  NullPointerException if {@code urls} or any of its
+     * @throws     NullPointerException if {@code urls} or any of its
      *             elements is {@code null}.
      * @see SecurityManager#checkCreateClassLoader
      */
@@ -166,15 +166,15 @@
      * calls the security manager's {@code checkCreateClassLoader} method
      * to ensure creation of a class loader is allowed.
      *
-     * @param urls the URLs from which to load classes and resources
-     * @param parent the parent class loader for delegation
-     * @param factory the URLStreamHandlerFactory to use when creating URLs
+     * @param  urls the URLs from which to load classes and resources
+     * @param  parent the parent class loader for delegation
+     * @param  factory the URLStreamHandlerFactory to use when creating URLs
      *
-     * @exception  SecurityException  if a security manager exists and its
-     *             {@code checkCreateClassLoader} method doesn't allow
-     *             creation of a class loader.
-     * @exception  NullPointerException if {@code urls} or any of its
-     *             elements is {@code null}.
+     * @throws SecurityException  if a security manager exists and its
+     *         {@code checkCreateClassLoader} method doesn't allow
+     *         creation of a class loader.
+     * @throws NullPointerException if {@code urls} or any of its
+     *         elements is {@code null}.
      * @see SecurityManager#checkCreateClassLoader
      */
     public URLClassLoader(URL[] urls, ClassLoader parent,
@@ -326,13 +326,13 @@
     * and errors are not caught. Calling close on an already closed
     * loader has no effect.
     *
-    * @exception IOException if closing any file opened by this class loader
+    * @throws    IOException if closing any file opened by this class loader
     * resulted in an IOException. Any such exceptions are caught internally.
     * If only one is caught, then it is re-thrown. If more than one exception
     * is caught, then the second and following exceptions are added
     * as suppressed exceptions of the first one caught, which is then re-thrown.
     *
-    * @exception SecurityException if a security manager is set, and it denies
+    * @throws    SecurityException if a security manager is set, and it denies
     *   {@link RuntimePermission}{@code ("closeClassLoader")}
     *
     * @since 1.7
@@ -401,11 +401,11 @@
      * path. Any URLs referring to JAR files are loaded and opened as needed
      * until the class is found.
      *
-     * @param name the name of the class
-     * @return the resulting class
-     * @exception ClassNotFoundException if the class could not be found,
+     * @param     name the name of the class
+     * @return    the resulting class
+     * @throws    ClassNotFoundException if the class could not be found,
      *            or if the loader is closed.
-     * @exception NullPointerException if {@code name} is {@code null}.
+     * @throws    NullPointerException if {@code name} is {@code null}.
      */
     protected Class<?> findClass(final String name)
         throws ClassNotFoundException
@@ -628,7 +628,7 @@
      * on the URL search path having the specified name.
      *
      * @param name the resource name
-     * @exception IOException if an I/O exception occurs
+     * @throws    IOException if an I/O exception occurs
      * @return An {@code Enumeration} of {@code URL}s.
      *         If the loader is closed, the Enumeration contains no elements.
      */
@@ -696,7 +696,7 @@
      * If the protocol is not "file", then permission
      * to connect to and accept connections from the URL's host is granted.
      * @param codesource the codesource
-     * @exception NullPointerException if {@code codesource} is {@code null}.
+     * @throws    NullPointerException if {@code codesource} is {@code null}.
      * @return the permissions granted to the codesource
      */
     protected PermissionCollection getPermissions(CodeSource codesource)
@@ -776,7 +776,7 @@
      *
      * @param urls the URLs to search for classes and resources
      * @param parent the parent class loader for delegation
-     * @exception  NullPointerException if {@code urls} or any of its
+     * @throws     NullPointerException if {@code urls} or any of its
      *             elements is {@code null}.
      * @return the resulting class loader
      */
@@ -803,7 +803,7 @@
      * loading the class.
      *
      * @param urls the URLs to search for classes and resources
-     * @exception  NullPointerException if {@code urls} or any of its
+     * @throws     NullPointerException if {@code urls} or any of its
      *             elements is {@code null}.
      * @return the resulting class loader
      */
--- a/src/java.base/share/classes/java/net/URLConnection.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/net/URLConnection.java	Tue Sep 24 15:19:35 2019 -0400
@@ -327,7 +327,7 @@
      * This could result in a SecurityException.
      *
      * @param map the FileNameMap to be set
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     SecurityException  if a security manager exists and its
      *             {@code checkSetFactory} method doesn't allow the operation.
      * @see        SecurityManager#checkSetFactory
      * @see #getFileNameMap()
@@ -357,7 +357,7 @@
      *
      * @throws SocketTimeoutException if the timeout expires before
      *               the connection can be established
-     * @exception  IOException  if an I/O error occurs while opening the
+     * @throws     IOException  if an I/O error occurs while opening the
      *               connection.
      * @see java.net.URLConnection#connected
      * @see #getConnectTimeout()
@@ -734,9 +734,9 @@
      * @return     the object fetched. The {@code instanceof} operator
      *               should be used to determine the specific kind of object
      *               returned.
-     * @exception  IOException              if an I/O error occurs while
+     * @throws     IOException              if an I/O error occurs while
      *               getting the content.
-     * @exception  UnknownServiceException  if the protocol does not support
+     * @throws     UnknownServiceException  if the protocol does not support
      *               the content type.
      * @see        java.net.ContentHandlerFactory#createContentHandler(java.lang.String)
      * @see        java.net.URLConnection#getContentType()
@@ -760,9 +760,9 @@
      *               the requested types are supported.
      *               The {@code instanceof} operator should be used to
      *               determine the specific kind of object returned.
-     * @exception  IOException              if an I/O error occurs while
+     * @throws     IOException              if an I/O error occurs while
      *               getting the content.
-     * @exception  UnknownServiceException  if the protocol does not support
+     * @throws     UnknownServiceException  if the protocol does not support
      *               the content type.
      * @see        java.net.URLConnection#getContent()
      * @see        java.net.ContentHandlerFactory#createContentHandler(java.lang.String)
@@ -813,7 +813,7 @@
      * necessary to make the connection represented by this
      * URLConnection.
      *
-     * @exception IOException if the computation of the permission
+     * @throws    IOException if the computation of the permission
      * requires network or file I/O and an exception occurs while
      * computing it.
      */
@@ -829,9 +829,9 @@
      * is available for read.
      *
      * @return     an input stream that reads from this open connection.
-     * @exception  IOException              if an I/O error occurs while
+     * @throws     IOException              if an I/O error occurs while
      *               creating the input stream.
-     * @exception  UnknownServiceException  if the protocol does not support
+     * @throws     UnknownServiceException  if the protocol does not support
      *               input.
      * @see #setReadTimeout(int)
      * @see #getReadTimeout()
@@ -844,9 +844,9 @@
      * Returns an output stream that writes to this connection.
      *
      * @return     an output stream that writes to this connection.
-     * @exception  IOException              if an I/O error occurs while
+     * @throws     IOException              if an I/O error occurs while
      *               creating the output stream.
-     * @exception  UnknownServiceException  if the protocol does not support
+     * @throws     UnknownServiceException  if the protocol does not support
      *               output.
      */
     public OutputStream getOutputStream() throws IOException {
@@ -1250,8 +1250,8 @@
      * This could result in a SecurityException.
      *
      * @param      fac   the desired factory.
-     * @exception  Error  if the factory has already been defined.
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     Error  if the factory has already been defined.
+     * @throws     SecurityException  if a security manager exists and its
      *             {@code checkSetFactory} method doesn't allow the operation.
      * @see        java.net.ContentHandlerFactory
      * @see        java.net.URLConnection#getContent()
@@ -1479,7 +1479,7 @@
      * @param      is   an input stream that supports marks.
      * @return     a guess at the content type, or {@code null} if none
      *             can be determined.
-     * @exception  IOException  if an I/O error occurs while reading the
+     * @throws     IOException  if an I/O error occurs while reading the
      *               input stream.
      * @see        java.io.InputStream#mark(int)
      * @see        java.io.InputStream#markSupported()
--- a/src/java.base/share/classes/java/net/URLPermission.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/net/URLPermission.java	Tue Sep 24 15:19:35 2019 -0400
@@ -175,7 +175,7 @@
      *
      * @param actions the actions string
      *
-     * @exception IllegalArgumentException if url is invalid or if actions contains white-space.
+     * @throws    IllegalArgumentException if url is invalid or if actions contains white-space.
      */
     public URLPermission(String url, String actions) {
         super(normalize(url));
--- a/src/java.base/share/classes/java/net/URLStreamHandler.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/net/URLStreamHandler.java	Tue Sep 24 15:19:35 2019 -0400
@@ -66,7 +66,7 @@
      *
      * @param      u   the URL that this connects to.
      * @return     a {@code URLConnection} object for the {@code URL}.
-     * @exception  IOException  if an I/O error occurs while opening the
+     * @throws     IOException  if an I/O error occurs while opening the
      *               connection.
      */
     protected abstract URLConnection openConnection(URL u) throws IOException;
@@ -91,11 +91,11 @@
      *                 If direct connection is desired, Proxy.NO_PROXY
      *                 should be specified.
      * @return     a {@code URLConnection} object for the {@code URL}.
-     * @exception  IOException  if an I/O error occurs while opening the
+     * @throws     IOException  if an I/O error occurs while opening the
      *               connection.
-     * @exception  IllegalArgumentException if either u or p is null,
+     * @throws     IllegalArgumentException if either u or p is null,
      *               or p has the wrong type.
-     * @exception  UnsupportedOperationException if the subclass that
+     * @throws     UnsupportedOperationException if the subclass that
      *               implements the protocol doesn't support this method.
      * @since      1.5
      */
@@ -510,7 +510,7 @@
      * @param   path      the path component of the URL.
      * @param   query     the query part for the URL.
      * @param   ref       the reference.
-     * @exception       SecurityException       if the protocol handler of the URL is
+     * @throws          SecurityException       if the protocol handler of the URL is
      *                                  different from this one
      * @since 1.3
      */
@@ -539,7 +539,7 @@
      * @param   port      the port on the remote machine.
      * @param   file      the file.
      * @param   ref       the reference.
-     * @exception       SecurityException       if the protocol handler of the URL is
+     * @throws          SecurityException       if the protocol handler of the URL is
      *                                  different from this one
      * @deprecated Use setURL(URL, String, String, int, String, String, String,
      *             String);
--- a/src/java.base/share/classes/java/nio/Buffer.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/nio/Buffer.java	Tue Sep 24 15:19:35 2019 -0400
@@ -249,8 +249,8 @@
      * @param  capacity
      *         The new buffer's capacity, in $type$s
      *
-     * @throws  IllegalArgumentException
-     *          If the {@code capacity} is a negative integer
+     * @throws IllegalArgumentException
+     *         If the {@code capacity} is a negative integer
      */
     static IllegalArgumentException createCapacityException(int capacity) {
         assert capacity < 0 : "capacity expected to be negative";
--- a/src/java.base/share/classes/java/nio/MappedByteBuffer.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/nio/MappedByteBuffer.java	Tue Sep 24 15:19:35 2019 -0400
@@ -322,14 +322,14 @@
      * mapping modes. This method may or may not have an effect for
      * implementation-specific mapping modes. </p>
      *
-     * @param index
-     *        The index of the first byte in the buffer region that is
-     *        to be written back to storage; must be non-negative
-     *        and less than limit()
+     * @param  index
+     *         The index of the first byte in the buffer region that is
+     *         to be written back to storage; must be non-negative
+     *         and less than limit()
      *
-     * @param length
-     *        The length of the region in bytes; must be non-negative
-     *        and no larger than limit() - index
+     * @param  length
+     *         The length of the region in bytes; must be non-negative
+     *         and no larger than limit() - index
      *
      * @throws IndexOutOfBoundsException
      *         if the preconditions on the index and length do not
--- a/src/java.base/share/classes/java/nio/charset/Charset-X-Coder.java.template	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/nio/charset/Charset-X-Coder.java.template	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -455,7 +455,14 @@
     /**
      * Returns the maximum number of $otype$s that will be produced for each
      * $itype$ of input.  This value may be used to compute the worst-case size
-     * of the output buffer required for a given input sequence.
+     * of the output buffer required for a given input sequence. This value
+     * accounts for any necessary content-independent prefix or suffix
+#if[encoder]
+     * $otype$s, such as byte-order marks.
+#end[encoder]
+#if[decoder]
+     * $otype$s.
+#end[decoder]
      *
      * @return  The maximum number of $otype$s that will be produced per
      *          $itype$ of input
--- a/src/java.base/share/classes/java/nio/file/package-info.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/nio/file/package-info.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
  * platform default provider, or to construct other provider implementations. </p>
  *
  * <h2><a id="links">Symbolic Links</a></h2>
- * <p> Many operating systems and file systems support for <em>symbolic links</em>.
+ * <p> Many operating systems and file systems have support for <em>symbolic links</em>.
  * A symbolic link is a special file that serves as a reference to another file.
  * For the most part, symbolic links are transparent to applications and
  * operations on symbolic links are automatically redirected to the <em>target</em>
@@ -62,8 +62,8 @@
  * to caching performed by the underlying operating system and delays induced by
  * network-filesystem protocols. This is true regardless of the language in which
  * these other programs are written, and whether they are running on the same machine
- * or on some other machine.  The exact nature of any such inconsistencies are
- * system-dependent and are therefore unspecified. </p>
+ * or on some other machine.  The exact nature of any such inconsistencies is
+ * system-dependent and therefore unspecified. </p>
  *
  * <h2><a id="integrity">Synchronized I/O File Integrity</a></h2>
  * <p> The {@link java.nio.file.StandardOpenOption#SYNC SYNC} and {@link
--- a/src/java.base/share/classes/java/security/AccessControlContext.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/AccessControlContext.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -162,10 +162,10 @@
      * @param combiner the {@code DomainCombiner} to be associated
      *          with the provided {@code AccessControlContext}.
      *
-     * @exception NullPointerException if the provided
+     * @throws    NullPointerException if the provided
      *          {@code context} is {@code null}.
      *
-     * @exception SecurityException if a security manager is installed and the
+     * @throws    SecurityException if a security manager is installed and the
      *          caller does not have the "createAccessControlContext"
      *          {@link SecurityPermission}
      * @since 1.3
@@ -344,7 +344,7 @@
      *          {@code AccessControlContext}, or {@code null}
      *          if there is none.
      *
-     * @exception SecurityException if a security manager is installed and
+     * @throws    SecurityException if a security manager is installed and
      *          the caller does not have the "getDomainCombiner"
      *          {@link SecurityPermission}
      * @since 1.3
@@ -383,10 +383,10 @@
      *
      * @param perm the requested permission.
      *
-     * @exception AccessControlException if the specified permission
+     * @throws    AccessControlException if the specified permission
      * is not permitted, based on the current security policy and the
      * context encapsulated by this object.
-     * @exception NullPointerException if the permission to check for is null.
+     * @throws    NullPointerException if the permission to check for is null.
      */
     public void checkPermission(Permission perm)
         throws AccessControlException
--- a/src/java.base/share/classes/java/security/AccessController.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/AccessController.java	Tue Sep 24 15:19:35 2019 -0400
@@ -298,7 +298,7 @@
      *
      * @return the value returned by the action's {@code run} method.
      *
-     * @exception NullPointerException if the action is {@code null}
+     * @throws    NullPointerException if the action is {@code null}
      *
      * @see #doPrivileged(PrivilegedAction,AccessControlContext)
      * @see #doPrivileged(PrivilegedExceptionAction)
@@ -330,7 +330,7 @@
      *
      * @return the value returned by the action's {@code run} method.
      *
-     * @exception NullPointerException if the action is {@code null}
+     * @throws    NullPointerException if the action is {@code null}
      *
      * @see #doPrivileged(PrivilegedAction)
      * @see java.security.DomainCombiner
@@ -377,7 +377,7 @@
      *
      * @return the value returned by the action's {@code run} method.
      *
-     * @exception NullPointerException if the action is {@code null}
+     * @throws    NullPointerException if the action is {@code null}
      *
      * @see #doPrivileged(PrivilegedAction)
      * @see #doPrivileged(PrivilegedExceptionAction,AccessControlContext)
@@ -534,9 +534,9 @@
      *
      * @return the value returned by the action's {@code run} method
      *
-     * @exception PrivilegedActionException if the specified action's
+     * @throws    PrivilegedActionException if the specified action's
      *         {@code run} method threw a <i>checked</i> exception
-     * @exception NullPointerException if the action is {@code null}
+     * @throws    NullPointerException if the action is {@code null}
      *
      * @see #doPrivileged(PrivilegedAction)
      * @see #doPrivileged(PrivilegedExceptionAction,AccessControlContext)
@@ -577,9 +577,9 @@
      *
      * @return the value returned by the action's {@code run} method
      *
-     * @exception PrivilegedActionException if the specified action's
+     * @throws    PrivilegedActionException if the specified action's
      *         {@code run} method threw a <i>checked</i> exception
-     * @exception NullPointerException if the action is {@code null}
+     * @throws    NullPointerException if the action is {@code null}
      *
      * @see #doPrivileged(PrivilegedAction)
      * @see #doPrivileged(PrivilegedExceptionAction,AccessControlContext)
@@ -672,9 +672,9 @@
      *
      * @return the value returned by the action's {@code run} method
      *
-     * @exception PrivilegedActionException if the specified action's
+     * @throws    PrivilegedActionException if the specified action's
      *         {@code run} method threw a <i>checked</i> exception
-     * @exception NullPointerException if the action is {@code null}
+     * @throws    NullPointerException if the action is {@code null}
      *
      * @see #doPrivileged(PrivilegedAction)
      * @see #doPrivileged(PrivilegedAction,AccessControlContext)
@@ -990,9 +990,9 @@
      *
      * @param perm the requested permission.
      *
-     * @exception AccessControlException if the specified permission
+     * @throws    AccessControlException if the specified permission
      *            is not permitted, based on the current security policy.
-     * @exception NullPointerException if the specified permission
+     * @throws    NullPointerException if the specified permission
      *            is {@code null} and is checked based on the
      *            security policy currently in effect.
      */
--- a/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -334,7 +334,7 @@
      *
      * @param genParamSpec the set of algorithm-specific parameter generation values.
      *
-     * @exception InvalidAlgorithmParameterException if the given parameter
+     * @throws    InvalidAlgorithmParameterException if the given parameter
      * generation values are inappropriate for this parameter generator.
      */
     public final void init(AlgorithmParameterSpec genParamSpec)
@@ -349,7 +349,7 @@
      * @param genParamSpec the set of algorithm-specific parameter generation values.
      * @param random the source of randomness.
      *
-     * @exception InvalidAlgorithmParameterException if the given parameter
+     * @throws    InvalidAlgorithmParameterException if the given parameter
      * generation values are inappropriate for this parameter generator.
      */
     public final void init(AlgorithmParameterSpec genParamSpec,
--- a/src/java.base/share/classes/java/security/AlgorithmParameterGeneratorSpi.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/AlgorithmParameterGeneratorSpi.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -76,7 +76,7 @@
      * @param genParamSpec the set of algorithm-specific parameter generation values.
      * @param random the source of randomness.
      *
-     * @exception InvalidAlgorithmParameterException if the given parameter
+     * @throws    InvalidAlgorithmParameterException if the given parameter
      * generation values are inappropriate for this parameter generator.
      */
     protected abstract void engineInit(AlgorithmParameterSpec genParamSpec,
--- a/src/java.base/share/classes/java/security/AlgorithmParameters.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/AlgorithmParameters.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -282,7 +282,7 @@
      *
      * @param paramSpec the parameter specification.
      *
-     * @exception InvalidParameterSpecException if the given parameter
+     * @throws    InvalidParameterSpecException if the given parameter
      * specification is inappropriate for the initialization of this parameter
      * object, or if this parameter object has already been initialized.
      */
@@ -303,7 +303,7 @@
      *
      * @param params the encoded parameters.
      *
-     * @exception IOException on decoding errors, or if this parameter object
+     * @throws    IOException on decoding errors, or if this parameter object
      * has already been initialized.
      */
     public final void init(byte[] params) throws IOException {
@@ -325,7 +325,7 @@
      *
      * @param format the name of the decoding scheme.
      *
-     * @exception IOException on decoding errors, or if this parameter object
+     * @throws    IOException on decoding errors, or if this parameter object
      * has already been initialized.
      */
     public final void init(byte[] params, String format) throws IOException {
@@ -349,7 +349,7 @@
      *
      * @return the parameter specification.
      *
-     * @exception InvalidParameterSpecException if the requested parameter
+     * @throws    InvalidParameterSpecException if the requested parameter
      * specification is inappropriate for this parameter object, or if this
      * parameter object has not been initialized.
      */
@@ -370,7 +370,7 @@
      *
      * @return the parameters encoded using their primary encoding format.
      *
-     * @exception IOException on encoding errors, or if this parameter object
+     * @throws    IOException on encoding errors, or if this parameter object
      * has not been initialized.
      */
     public final byte[] getEncoded() throws IOException
@@ -392,7 +392,7 @@
      *
      * @return the parameters encoded using the specified encoding scheme.
      *
-     * @exception IOException on encoding errors, or if this parameter object
+     * @throws    IOException on encoding errors, or if this parameter object
      * has not been initialized.
      */
     public final byte[] getEncoded(String format) throws IOException
--- a/src/java.base/share/classes/java/security/AlgorithmParametersSpi.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/AlgorithmParametersSpi.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -56,7 +56,7 @@
      *
      * @param paramSpec the parameter specification.
      *
-     * @exception InvalidParameterSpecException if the given parameter
+     * @throws    InvalidParameterSpecException if the given parameter
      * specification is inappropriate for the initialization of this parameter
      * object.
      */
@@ -71,7 +71,7 @@
      *
      * @param params the encoded parameters.
      *
-     * @exception IOException on decoding errors
+     * @throws    IOException on decoding errors
      */
     protected abstract void engineInit(byte[] params)
         throws IOException;
@@ -88,7 +88,7 @@
      *
      * @param format the name of the decoding format.
      *
-     * @exception IOException on decoding errors
+     * @throws    IOException on decoding errors
      */
     protected abstract void engineInit(byte[] params, String format)
         throws IOException;
@@ -109,7 +109,7 @@
      *
      * @return the parameter specification.
      *
-     * @exception InvalidParameterSpecException if the requested parameter
+     * @throws    InvalidParameterSpecException if the requested parameter
      * specification is inappropriate for this parameter object.
      */
     protected abstract
@@ -124,7 +124,7 @@
      *
      * @return the parameters encoded using their primary encoding format.
      *
-     * @exception IOException on encoding errors.
+     * @throws    IOException on encoding errors.
      */
     protected abstract byte[] engineGetEncoded() throws IOException;
 
@@ -139,7 +139,7 @@
      *
      * @return the parameters encoded using the specified encoding scheme.
      *
-     * @exception IOException on encoding errors.
+     * @throws    IOException on encoding errors.
      */
     protected abstract byte[] engineGetEncoded(String format)
         throws IOException;
--- a/src/java.base/share/classes/java/security/AllPermission.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/AllPermission.java	Tue Sep 24 15:19:35 2019 -0400
@@ -178,10 +178,10 @@
      *
      * @param permission the Permission object to add.
      *
-     * @exception IllegalArgumentException - if the permission is not a
+     * @throws    IllegalArgumentException - if the permission is not a
      *                                       AllPermission
      *
-     * @exception SecurityException - if this AllPermissionCollection object
+     * @throws    SecurityException - if this AllPermissionCollection object
      *                                has been marked readonly
      */
 
--- a/src/java.base/share/classes/java/security/BasicPermission.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/BasicPermission.java	Tue Sep 24 15:19:35 2019 -0400
@@ -349,13 +349,13 @@
      *
      * @param permission the Permission object to add.
      *
-     * @exception IllegalArgumentException - if the permission is not a
+     * @throws    IllegalArgumentException - if the permission is not a
      *                                       BasicPermission, or if
      *                                       the permission is not of the
      *                                       same Class as the other
      *                                       permissions in this collection.
      *
-     * @exception SecurityException - if this BasicPermissionCollection object
+     * @throws    SecurityException - if this BasicPermissionCollection object
      *                                has been marked readonly
      */
     @Override
--- a/src/java.base/share/classes/java/security/Certificate.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/Certificate.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -101,10 +101,10 @@
      * @param stream the output stream to which to encode the
      * certificate.
      *
-     * @exception KeyException if the certificate is not
+     * @throws    KeyException if the certificate is not
      * properly initialized, or data is missing, etc.
      *
-     * @exception IOException if a stream exception occurs while
+     * @throws    IOException if a stream exception occurs while
      * trying to output the encoded certificate to the output stream.
      *
      * @see #decode
@@ -121,10 +121,10 @@
      * @param stream the input stream from which to fetch the data
      * being decoded.
      *
-     * @exception KeyException if the certificate is not properly initialized,
+     * @throws    KeyException if the certificate is not properly initialized,
      * or data is missing, etc.
      *
-     * @exception IOException if an exception occurs while trying to input
+     * @throws    IOException if an exception occurs while trying to input
      * the encoded certificate from the input stream.
      *
      * @see #encode
--- a/src/java.base/share/classes/java/security/DigestInputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/DigestInputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -117,7 +117,7 @@
      *
      * @return the byte read.
      *
-     * @exception IOException if an I/O error occurs.
+     * @throws    IOException if an I/O error occurs.
      *
      * @see MessageDigest#update(byte)
      */
@@ -154,7 +154,7 @@
      * read because the end of the stream had already been reached when
      * the call was made.
      *
-     * @exception IOException if an I/O error occurs.
+     * @throws    IOException if an I/O error occurs.
      *
      * @see MessageDigest#update(byte[], int, int)
      */
--- a/src/java.base/share/classes/java/security/DigestOutputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/DigestOutputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -108,7 +108,7 @@
      * @param b the byte to be used for updating and writing to the
      * output stream.
      *
-     * @exception IOException if an I/O error occurs.
+     * @throws    IOException if an I/O error occurs.
      *
      * @see MessageDigest#update(byte)
      */
@@ -138,7 +138,7 @@
      * @param len the number of bytes of data to be updated and written
      * from {@code b}, starting at offset {@code off}.
      *
-     * @exception IOException if an I/O error occurs.
+     * @throws    IOException if an I/O error occurs.
      *
      * @see MessageDigest#update(byte[], int, int)
      */
--- a/src/java.base/share/classes/java/security/DomainLoadStoreParameter.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/DomainLoadStoreParameter.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -125,7 +125,7 @@
      *     been specified by properties in the domain configuration data.
      *     It is cloned to prevent subsequent modification.
      *
-     * @exception NullPointerException if {@code configuration} or
+     * @throws    NullPointerException if {@code configuration} or
      *     {@code protectionParams} is {@code null}
      */
     public DomainLoadStoreParameter(URI configuration,
--- a/src/java.base/share/classes/java/security/Guard.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/Guard.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@
      *
      * @param object the object being protected by the guard.
      *
-     * @exception SecurityException if access is denied.
+     * @throws    SecurityException if access is denied.
      *
      */
     void checkGuard(Object object) throws SecurityException;
--- a/src/java.base/share/classes/java/security/GuardedObject.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/GuardedObject.java	Tue Sep 24 15:19:35 2019 -0400
@@ -77,7 +77,7 @@
      *
      * @return the guarded object.
      *
-     * @exception SecurityException if access to the guarded object is
+     * @throws    SecurityException if access to the guarded object is
      * denied.
      */
     public Object getObject()
--- a/src/java.base/share/classes/java/security/Identity.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/Identity.java	Tue Sep 24 15:19:35 2019 -0400
@@ -113,7 +113,7 @@
      * @param name the identity name.
      * @param scope the scope of the identity.
      *
-     * @exception KeyManagementException if there is already an identity
+     * @throws    KeyManagementException if there is already an identity
      * with the same name in the scope.
      */
     public Identity(String name, IdentityScope scope) throws
@@ -173,10 +173,10 @@
      *
      * @param key the public key for this identity.
      *
-     * @exception KeyManagementException if another identity in the
+     * @throws    KeyManagementException if another identity in the
      * identity's scope has the same public key, or if another exception occurs.
      *
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     SecurityException  if a security manager exists and its
      * {@code checkSecurityAccess} method doesn't allow
      * setting the public key.
      *
@@ -200,7 +200,7 @@
      *
      * @param info the information string.
      *
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     SecurityException  if a security manager exists and its
      * {@code checkSecurityAccess} method doesn't allow
      * setting the information string.
      *
@@ -235,11 +235,11 @@
      *
      * @param certificate the certificate to be added.
      *
-     * @exception KeyManagementException if the certificate is not valid,
+     * @throws    KeyManagementException if the certificate is not valid,
      * if the public key in the certificate being added conflicts with
      * this identity's public key, or if another exception occurs.
      *
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     SecurityException  if a security manager exists and its
      * {@code checkSecurityAccess} method doesn't allow
      * adding a certificate.
      *
@@ -286,10 +286,10 @@
      *
      * @param certificate the certificate to be removed.
      *
-     * @exception KeyManagementException if the certificate is
+     * @throws    KeyManagementException if the certificate is
      * missing, or if another exception occurs.
      *
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     SecurityException  if a security manager exists and its
      * {@code checkSecurityAccess} method doesn't allow
      * removing a certificate.
      *
@@ -400,7 +400,7 @@
      * @return information about this identity, such as its name and the
      * name of its scope (if any).
      *
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     SecurityException  if a security manager exists and its
      * {@code checkSecurityAccess} method doesn't allow
      * returning a string describing this identity.
      *
@@ -430,7 +430,7 @@
      * is true, then this method returns more information than that
      * provided by the {@code toString} method without any arguments.
      *
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     SecurityException  if a security manager exists and its
      * {@code checkSecurityAccess} method doesn't allow
      * returning a string describing this identity.
      *
--- a/src/java.base/share/classes/java/security/IdentityScope.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/IdentityScope.java	Tue Sep 24 15:19:35 2019 -0400
@@ -121,7 +121,7 @@
      * @param name the scope name.
      * @param scope the scope for the new identity scope.
      *
-     * @exception KeyManagementException if there is already an identity
+     * @throws    KeyManagementException if there is already an identity
      * with the same name in the scope.
      */
     public IdentityScope(String name, IdentityScope scope)
@@ -155,7 +155,7 @@
      *
      * @param scope the scope to set.
      *
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     SecurityException  if a security manager exists and its
      * {@code checkSecurityAccess} method doesn't allow
      * setting the identity scope.
      *
@@ -214,7 +214,7 @@
      *
      * @param identity the identity to be added.
      *
-     * @exception KeyManagementException if the identity is not
+     * @throws    KeyManagementException if the identity is not
      * valid, a name conflict occurs, another identity has the same
      * public key as the identity being added, or another exception
      * occurs. */
@@ -226,7 +226,7 @@
      *
      * @param identity the identity to be removed.
      *
-     * @exception KeyManagementException if the identity is missing,
+     * @throws    KeyManagementException if the identity is missing,
      * or another exception occurs.
      */
     public abstract void removeIdentity(Identity identity)
--- a/src/java.base/share/classes/java/security/KeyFactory.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/KeyFactory.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -337,7 +337,7 @@
      *
      * @return the public key.
      *
-     * @exception InvalidKeySpecException if the given key specification
+     * @throws    InvalidKeySpecException if the given key specification
      * is inappropriate for this key factory to produce a public key.
      */
     public final PublicKey generatePublic(KeySpec keySpec)
@@ -375,7 +375,7 @@
      *
      * @return the private key.
      *
-     * @exception InvalidKeySpecException if the given key specification
+     * @throws    InvalidKeySpecException if the given key specification
      * is inappropriate for this key factory to produce a private key.
      */
     public final PrivateKey generatePrivate(KeySpec keySpec)
@@ -423,7 +423,7 @@
      * @return the underlying key specification (key material) in an instance
      * of the requested specification class.
      *
-     * @exception InvalidKeySpecException if the requested key specification is
+     * @throws    InvalidKeySpecException if the requested key specification is
      * inappropriate for the given key, or the given key cannot be processed
      * (e.g., the given key has an unrecognized algorithm or format).
      */
@@ -462,7 +462,7 @@
      *
      * @return the translated key.
      *
-     * @exception InvalidKeyException if the given key cannot be processed
+     * @throws    InvalidKeyException if the given key cannot be processed
      * by this key factory.
      */
     public final Key translateKey(Key key) throws InvalidKeyException {
--- a/src/java.base/share/classes/java/security/KeyFactorySpi.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/KeyFactorySpi.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -77,7 +77,7 @@
      *
      * @return the public key.
      *
-     * @exception InvalidKeySpecException if the given key specification
+     * @throws    InvalidKeySpecException if the given key specification
      * is inappropriate for this key factory to produce a public key.
      */
     protected abstract PublicKey engineGeneratePublic(KeySpec keySpec)
@@ -91,7 +91,7 @@
      *
      * @return the private key.
      *
-     * @exception InvalidKeySpecException if the given key specification
+     * @throws    InvalidKeySpecException if the given key specification
      * is inappropriate for this key factory to produce a private key.
      */
     protected abstract PrivateKey engineGeneratePrivate(KeySpec keySpec)
@@ -116,7 +116,7 @@
      * @return the underlying key specification (key material) in an instance
      * of the requested specification class.
 
-     * @exception InvalidKeySpecException if the requested key specification is
+     * @throws    InvalidKeySpecException if the requested key specification is
      * inappropriate for the given key, or the given key cannot be dealt with
      * (e.g., the given key has an unrecognized format).
      */
@@ -133,7 +133,7 @@
      *
      * @return the translated key.
      *
-     * @exception InvalidKeyException if the given key cannot be processed
+     * @throws    InvalidKeyException if the given key cannot be processed
      * by this key factory.
      */
     protected abstract Key engineTranslateKey(Key key)
--- a/src/java.base/share/classes/java/security/KeyPairGenerator.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/KeyPairGenerator.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -369,7 +369,7 @@
      * algorithm-specific metric, such as modulus length, specified in
      * number of bits.
      *
-     * @exception InvalidParameterException if the {@code keysize} is not
+     * @throws    InvalidParameterException if the {@code keysize} is not
      * supported by this KeyPairGenerator object.
      */
     public void initialize(int keysize) {
@@ -385,7 +385,7 @@
      * number of bits.
      * @param random the source of randomness.
      *
-     * @exception InvalidParameterException if the {@code keysize} is not
+     * @throws    InvalidParameterException if the {@code keysize} is not
      * supported by this KeyPairGenerator object.
      *
      * @since 1.2
@@ -426,7 +426,7 @@
      *
      * @param params the parameter set used to generate the keys.
      *
-     * @exception InvalidAlgorithmParameterException if the given parameters
+     * @throws    InvalidAlgorithmParameterException if the given parameters
      * are inappropriate for this key pair generator.
      *
      * @since 1.2
@@ -454,7 +454,7 @@
      * @param params the parameter set used to generate the keys.
      * @param random the source of randomness.
      *
-     * @exception InvalidAlgorithmParameterException if the given parameters
+     * @throws    InvalidAlgorithmParameterException if the given parameters
      * are inappropriate for this key pair generator.
      *
      * @since 1.2
--- a/src/java.base/share/classes/java/security/KeyPairGeneratorSpi.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/KeyPairGeneratorSpi.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -68,7 +68,7 @@
      *
      * @param random the source of randomness for this generator.
      *
-     * @exception InvalidParameterException if the {@code keysize} is not
+     * @throws    InvalidParameterException if the {@code keysize} is not
      * supported by this KeyPairGeneratorSpi object.
      */
     public abstract void initialize(int keysize, SecureRandom random);
@@ -90,7 +90,7 @@
      *
      * @param random the source of randomness for this generator.
      *
-     * @exception InvalidAlgorithmParameterException if the given parameters
+     * @throws    InvalidAlgorithmParameterException if the given parameters
      * are inappropriate for this key pair generator.
      *
      * @since 1.2
--- a/src/java.base/share/classes/java/security/KeyRep.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/KeyRep.java	Tue Sep 24 15:19:35 2019 -0400
@@ -121,7 +121,7 @@
      * @param encoded the encoded bytes returned from
      *          {@code Key.getEncoded()}
      *
-     * @exception NullPointerException
+     * @throws    NullPointerException
      *          if type is {@code null},
      *          if algorithm is {@code null},
      *          if format is {@code null},
@@ -158,7 +158,7 @@
      *
      * @return the resolved Key object
      *
-     * @exception ObjectStreamException if the Type/format
+     * @throws    ObjectStreamException if the Type/format
      *  combination is unrecognized, if the algorithm, key format, or
      *  encoded key bytes are unrecognized/invalid, of if the
      *  resolution of the key fails for any reason
--- a/src/java.base/share/classes/java/security/KeyStore.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/KeyStore.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -296,7 +296,7 @@
          *     for information about standard encryption algorithm names.
          * @param protectionParameters the encryption algorithm parameter
          *     specification, which may be {@code null}
-         * @exception NullPointerException if {@code protectionAlgorithm} is
+         * @throws    NullPointerException if {@code protectionAlgorithm} is
          *     {@code null}
          *
          * @since 1.8
@@ -346,7 +346,7 @@
          *
          * @see #destroy()
          * @return the password, which may be {@code null}
-         * @exception IllegalStateException if the password has
+         * @throws    IllegalStateException if the password has
          *              been cleared (destroyed)
          */
         public synchronized char[] getPassword() {
@@ -359,7 +359,7 @@
         /**
          * Clears the password.
          *
-         * @exception DestroyFailedException if this method was unable
+         * @throws    DestroyFailedException if this method was unable
          *      to clear the password
          */
         public synchronized void destroy() throws DestroyFailedException {
@@ -394,7 +394,7 @@
          * CallbackHandler.
          *
          * @param handler the CallbackHandler
-         * @exception NullPointerException if handler is null
+         * @throws    NullPointerException if handler is null
          */
         public CallbackHandlerProtection(CallbackHandler handler) {
             if (handler == null) {
@@ -485,10 +485,10 @@
          *      {@code Certificate} at index 0
          *      corresponding to the private key.
          *
-         * @exception NullPointerException if
+         * @throws    NullPointerException if
          *      {@code privateKey} or {@code chain}
          *      is {@code null}
-         * @exception IllegalArgumentException if the specified chain has a
+         * @throws    IllegalArgumentException if the specified chain has a
          *      length of 0, if the specified chain does not contain
          *      {@code Certificate}s of the same type,
          *      or if the {@code PrivateKey} algorithm
@@ -514,9 +514,9 @@
          *      corresponding to the private key.
          * @param attributes the attributes
          *
-         * @exception NullPointerException if {@code privateKey}, {@code chain}
+         * @throws    NullPointerException if {@code privateKey}, {@code chain}
          *      or {@code attributes} is {@code null}
-         * @exception IllegalArgumentException if the specified chain has a
+         * @throws    IllegalArgumentException if the specified chain has a
          *      length of 0, if the specified chain does not contain
          *      {@code Certificate}s of the same type,
          *      or if the {@code PrivateKey} algorithm
@@ -651,7 +651,7 @@
          *
          * @param secretKey the {@code SecretKey}
          *
-         * @exception NullPointerException if {@code secretKey}
+         * @throws    NullPointerException if {@code secretKey}
          *      is {@code null}
          */
         public SecretKeyEntry(SecretKey secretKey) {
@@ -672,7 +672,7 @@
          * @param secretKey the {@code SecretKey}
          * @param attributes the attributes
          *
-         * @exception NullPointerException if {@code secretKey} or
+         * @throws    NullPointerException if {@code secretKey} or
          *     {@code attributes} is {@code null}
          *
          * @since 1.8
@@ -734,7 +734,7 @@
          *
          * @param trustedCert the trusted {@code Certificate}
          *
-         * @exception NullPointerException if
+         * @throws    NullPointerException if
          *      {@code trustedCert} is {@code null}
          */
         public TrustedCertificateEntry(Certificate trustedCert) {
@@ -755,7 +755,7 @@
          * @param trustedCert the trusted {@code Certificate}
          * @param attributes the attributes
          *
-         * @exception NullPointerException if {@code trustedCert} or
+         * @throws    NullPointerException if {@code trustedCert} or
          *     {@code attributes} is {@code null}
          *
          * @since 1.8
@@ -1033,11 +1033,11 @@
      * @return the requested key, or null if the given alias does not exist
      * or does not identify a key-related entry.
      *
-     * @exception KeyStoreException if the keystore has not been initialized
+     * @throws    KeyStoreException if the keystore has not been initialized
      * (loaded).
-     * @exception NoSuchAlgorithmException if the algorithm for recovering the
+     * @throws    NoSuchAlgorithmException if the algorithm for recovering the
      * key cannot be found
-     * @exception UnrecoverableKeyException if the key cannot be recovered
+     * @throws    UnrecoverableKeyException if the key cannot be recovered
      * (e.g., the given password is wrong).
      */
     public final Key getKey(String alias, char[] password)
@@ -1063,7 +1063,7 @@
      * followed by zero or more certificate authorities), or null if the given alias
      * does not exist or does not contain a certificate chain
      *
-     * @exception KeyStoreException if the keystore has not been initialized
+     * @throws    KeyStoreException if the keystore has not been initialized
      * (loaded).
      */
     public final Certificate[] getCertificateChain(String alias)
@@ -1096,7 +1096,7 @@
      * @return the certificate, or null if the given alias does not exist or
      * does not contain a certificate.
      *
-     * @exception KeyStoreException if the keystore has not been initialized
+     * @throws    KeyStoreException if the keystore has not been initialized
      * (loaded).
      */
     public final Certificate getCertificate(String alias)
@@ -1116,7 +1116,7 @@
      * @return the creation date of this entry, or null if the given alias does
      * not exist
      *
-     * @exception KeyStoreException if the keystore has not been initialized
+     * @throws    KeyStoreException if the keystore has not been initialized
      * (loaded).
      */
     public final Date getCreationDate(String alias)
@@ -1147,7 +1147,7 @@
      * key (only required if the given key is of type
      * {@code java.security.PrivateKey}).
      *
-     * @exception KeyStoreException if the keystore has not been initialized
+     * @throws    KeyStoreException if the keystore has not been initialized
      * (loaded), the given key cannot be protected, or this operation fails
      * for some other reason
      */
@@ -1188,7 +1188,7 @@
      *          key (only useful if the protected key is of type
      *          {@code java.security.PrivateKey}).
      *
-     * @exception KeyStoreException if the keystore has not been initialized
+     * @throws    KeyStoreException if the keystore has not been initialized
      * (loaded), or if this operation fails for some other reason.
      */
     public final void setKeyEntry(String alias, byte[] key,
@@ -1214,7 +1214,7 @@
      * @param alias the alias name
      * @param cert the certificate
      *
-     * @exception KeyStoreException if the keystore has not been initialized,
+     * @throws    KeyStoreException if the keystore has not been initialized,
      * or the given alias already exists and does not identify an
      * entry containing a trusted certificate,
      * or this operation fails for some other reason.
@@ -1233,7 +1233,7 @@
      *
      * @param alias the alias name
      *
-     * @exception KeyStoreException if the keystore has not been initialized,
+     * @throws    KeyStoreException if the keystore has not been initialized,
      * or if the entry cannot be removed.
      */
     public final void deleteEntry(String alias)
@@ -1250,7 +1250,7 @@
      *
      * @return enumeration of the alias names
      *
-     * @exception KeyStoreException if the keystore has not been initialized
+     * @throws    KeyStoreException if the keystore has not been initialized
      * (loaded).
      */
     public final Enumeration<String> aliases()
@@ -1269,7 +1269,7 @@
      *
      * @return true if the alias exists, false otherwise
      *
-     * @exception KeyStoreException if the keystore has not been initialized
+     * @throws    KeyStoreException if the keystore has not been initialized
      * (loaded).
      */
     public final boolean containsAlias(String alias)
@@ -1286,7 +1286,7 @@
      *
      * @return the number of entries in this keystore
      *
-     * @exception KeyStoreException if the keystore has not been initialized
+     * @throws    KeyStoreException if the keystore has not been initialized
      * (loaded).
      */
     public final int size()
@@ -1309,7 +1309,7 @@
      * @return true if the entry identified by the given alias is a
      * key-related entry, false otherwise.
      *
-     * @exception KeyStoreException if the keystore has not been initialized
+     * @throws    KeyStoreException if the keystore has not been initialized
      * (loaded).
      */
     public final boolean isKeyEntry(String alias)
@@ -1332,7 +1332,7 @@
      * @return true if the entry identified by the given alias contains a
      * trusted certificate, false otherwise.
      *
-     * @exception KeyStoreException if the keystore has not been initialized
+     * @throws    KeyStoreException if the keystore has not been initialized
      * (loaded).
      */
     public final boolean isCertificateEntry(String alias)
@@ -1367,7 +1367,7 @@
      * @return the alias name of the first entry with a matching certificate,
      * or null if no such entry exists in this keystore.
      *
-     * @exception KeyStoreException if the keystore has not been initialized
+     * @throws    KeyStoreException if the keystore has not been initialized
      * (loaded).
      */
     public final String getCertificateAlias(Certificate cert)
@@ -1386,12 +1386,12 @@
      * @param stream the output stream to which this keystore is written.
      * @param password the password to generate the keystore integrity check
      *
-     * @exception KeyStoreException if the keystore has not been initialized
+     * @throws    KeyStoreException if the keystore has not been initialized
      * (loaded).
-     * @exception IOException if there was an I/O problem with data
-     * @exception NoSuchAlgorithmException if the appropriate data integrity
+     * @throws    IOException if there was an I/O problem with data
+     * @throws    NoSuchAlgorithmException if the appropriate data integrity
      * algorithm could not be found
-     * @exception CertificateException if any of the certificates included in
+     * @throws    CertificateException if any of the certificates included in
      * the keystore data could not be stored
      */
     public final void store(OutputStream stream, char[] password)
@@ -1411,15 +1411,15 @@
      *          that specifies how to store the keystore,
      *          which may be {@code null}
      *
-     * @exception IllegalArgumentException if the given
+     * @throws    IllegalArgumentException if the given
      *          {@code LoadStoreParameter}
      *          input is not recognized
-     * @exception KeyStoreException if the keystore has not been initialized
+     * @throws    KeyStoreException if the keystore has not been initialized
      *          (loaded)
-     * @exception IOException if there was an I/O problem with data
-     * @exception NoSuchAlgorithmException if the appropriate data integrity
+     * @throws    IOException if there was an I/O problem with data
+     * @throws    NoSuchAlgorithmException if the appropriate data integrity
      *          algorithm could not be found
-     * @exception CertificateException if any of the certificates included in
+     * @throws    CertificateException if any of the certificates included in
      *          the keystore data could not be stored
      *
      * @since 1.5
@@ -1455,15 +1455,15 @@
      * the keystore, the password used to unlock the keystore,
      * or {@code null}
      *
-     * @exception IOException if there is an I/O or format problem with the
+     * @throws    IOException if there is an I/O or format problem with the
      * keystore data, if a password is required but not given,
      * or if the given password was incorrect. If the error is due to a
      * wrong password, the {@link Throwable#getCause cause} of the
      * {@code IOException} should be an
      * {@code UnrecoverableKeyException}
-     * @exception NoSuchAlgorithmException if the algorithm used to check
+     * @throws    NoSuchAlgorithmException if the algorithm used to check
      * the integrity of the keystore cannot be found
-     * @exception CertificateException if any of the certificates in the
+     * @throws    CertificateException if any of the certificates in the
      * keystore could not be loaded
      */
     public final void load(InputStream stream, char[] password)
@@ -1483,18 +1483,18 @@
      *          that specifies how to load the keystore,
      *          which may be {@code null}
      *
-     * @exception IllegalArgumentException if the given
+     * @throws    IllegalArgumentException if the given
      *          {@code LoadStoreParameter}
      *          input is not recognized
-     * @exception IOException if there is an I/O or format problem with the
+     * @throws    IOException if there is an I/O or format problem with the
      *          keystore data. If the error is due to an incorrect
      *         {@code ProtectionParameter} (e.g. wrong password)
      *         the {@link Throwable#getCause cause} of the
      *         {@code IOException} should be an
      *         {@code UnrecoverableKeyException}
-     * @exception NoSuchAlgorithmException if the algorithm used to check
+     * @throws    NoSuchAlgorithmException if the algorithm used to check
      *          the integrity of the keystore cannot be found
-     * @exception CertificateException if any of the certificates in the
+     * @throws    CertificateException if any of the certificates in the
      *          keystore could not be loaded
      *
      * @since 1.5
@@ -1519,17 +1519,17 @@
      * @return the keystore {@code Entry} for the specified alias,
      *          or {@code null} if there is no such entry
      *
-     * @exception NullPointerException if
+     * @throws    NullPointerException if
      *          {@code alias} is {@code null}
-     * @exception NoSuchAlgorithmException if the algorithm for recovering the
+     * @throws    NoSuchAlgorithmException if the algorithm for recovering the
      *          entry cannot be found
-     * @exception UnrecoverableEntryException if the specified
+     * @throws    UnrecoverableEntryException if the specified
      *          {@code protParam} were insufficient or invalid
-     * @exception UnrecoverableKeyException if the entry is a
+     * @throws    UnrecoverableKeyException if the entry is a
      *          {@code PrivateKeyEntry} or {@code SecretKeyEntry}
      *          and the specified {@code protParam} does not contain
      *          the information needed to recover the key (e.g. wrong password)
-     * @exception KeyStoreException if the keystore has not been initialized
+     * @throws    KeyStoreException if the keystore has not been initialized
      *          (loaded).
      * @see #setEntry(String, KeyStore.Entry, KeyStore.ProtectionParameter)
      *
@@ -1562,10 +1562,10 @@
      *          used to protect the {@code Entry},
      *          which may be {@code null}
      *
-     * @exception NullPointerException if
+     * @throws    NullPointerException if
      *          {@code alias} or {@code entry}
      *          is {@code null}
-     * @exception KeyStoreException if the keystore has not been initialized
+     * @throws    KeyStoreException if the keystore has not been initialized
      *          (loaded), or if this operation fails for some other reason
      *
      * @see #getEntry(String, KeyStore.ProtectionParameter)
@@ -1596,10 +1596,10 @@
      *          {@code alias} is an instance or subclass of the
      *          specified {@code entryClass}, false otherwise
      *
-     * @exception NullPointerException if
+     * @throws    NullPointerException if
      *          {@code alias} or {@code entryClass}
      *          is {@code null}
-     * @exception KeyStoreException if the keystore has not been
+     * @throws    KeyStoreException if the keystore has not been
      *          initialized (loaded)
      *
      * @since 1.5
@@ -1841,7 +1841,7 @@
          * Returns the KeyStore described by this object.
          *
          * @return the {@code KeyStore} described by this object
-         * @exception KeyStoreException if an error occurred during the
+         * @throws    KeyStoreException if an error occurred during the
          *   operation, for example if the KeyStore could not be
          *   instantiated or loaded
          */
--- a/src/java.base/share/classes/java/security/KeyStoreSpi.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/KeyStoreSpi.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -66,9 +66,9 @@
      * @return the requested key, or null if the given alias does not exist
      * or does not identify a key-related entry.
      *
-     * @exception NoSuchAlgorithmException if the algorithm for recovering the
+     * @throws    NoSuchAlgorithmException if the algorithm for recovering the
      * key cannot be found
-     * @exception UnrecoverableKeyException if the key cannot be recovered
+     * @throws    UnrecoverableKeyException if the key cannot be recovered
      * (e.g., the given password is wrong).
      */
     public abstract Key engineGetKey(String alias, char[] password)
@@ -141,7 +141,7 @@
      * key (only required if the given key is of type
      * {@code java.security.PrivateKey}).
      *
-     * @exception KeyStoreException if the given key cannot be protected, or
+     * @throws    KeyStoreException if the given key cannot be protected, or
      * this operation fails for some other reason
      */
     public abstract void engineSetKeyEntry(String alias, Key key,
@@ -168,7 +168,7 @@
      * key (only useful if the protected key is of type
      * {@code java.security.PrivateKey}).
      *
-     * @exception KeyStoreException if this operation fails.
+     * @throws    KeyStoreException if this operation fails.
      */
     public abstract void engineSetKeyEntry(String alias, byte[] key,
                                            Certificate[] chain)
@@ -187,7 +187,7 @@
      * @param alias the alias name
      * @param cert the certificate
      *
-     * @exception KeyStoreException if the given alias already exists and does
+     * @throws    KeyStoreException if the given alias already exists and does
      * not identify an entry containing a trusted certificate,
      * or this operation fails for some other reason.
      */
@@ -200,7 +200,7 @@
      *
      * @param alias the alias name
      *
-     * @exception KeyStoreException if the entry cannot be removed.
+     * @throws    KeyStoreException if the entry cannot be removed.
      */
     public abstract void engineDeleteEntry(String alias)
         throws KeyStoreException;
@@ -286,10 +286,10 @@
      * @param stream the output stream to which this keystore is written.
      * @param password the password to generate the keystore integrity check
      *
-     * @exception IOException if there was an I/O problem with data
-     * @exception NoSuchAlgorithmException if the appropriate data integrity
+     * @throws    IOException if there was an I/O problem with data
+     * @throws    NoSuchAlgorithmException if the appropriate data integrity
      * algorithm could not be found
-     * @exception CertificateException if any of the certificates included in
+     * @throws    CertificateException if any of the certificates included in
      * the keystore data could not be stored
      */
     public abstract void engineStore(OutputStream stream, char[] password)
@@ -303,13 +303,13 @@
      *          that specifies how to store the keystore,
      *          which may be {@code null}
      *
-     * @exception IllegalArgumentException if the given
+     * @throws    IllegalArgumentException if the given
      *          {@code KeyStore.LoadStoreParmeter}
      *          input is not recognized
-     * @exception IOException if there was an I/O problem with data
-     * @exception NoSuchAlgorithmException if the appropriate data integrity
+     * @throws    IOException if there was an I/O problem with data
+     * @throws    NoSuchAlgorithmException if the appropriate data integrity
      *          algorithm could not be found
-     * @exception CertificateException if any of the certificates included in
+     * @throws    CertificateException if any of the certificates included in
      *          the keystore data could not be stored
      *
      * @since 1.5
@@ -335,15 +335,15 @@
      * the keystore, the password used to unlock the keystore,
      * or {@code null}
      *
-     * @exception IOException if there is an I/O or format problem with the
+     * @throws    IOException if there is an I/O or format problem with the
      * keystore data, if a password is required but not given,
      * or if the given password was incorrect. If the error is due to a
      * wrong password, the {@link Throwable#getCause cause} of the
      * {@code IOException} should be an
      * {@code UnrecoverableKeyException}
-     * @exception NoSuchAlgorithmException if the algorithm used to check
+     * @throws    NoSuchAlgorithmException if the algorithm used to check
      * the integrity of the keystore cannot be found
-     * @exception CertificateException if any of the certificates in the
+     * @throws    CertificateException if any of the certificates in the
      * keystore could not be loaded
      */
     public abstract void engineLoad(InputStream stream, char[] password)
@@ -376,18 +376,18 @@
      * extracted. If the {@code KeyStore.ProtectionParameter} is neither
      * of those classes then a {@code NoSuchAlgorithmException} is thrown.
      *
-     * @exception IllegalArgumentException if the given
+     * @throws    IllegalArgumentException if the given
      *          {@code KeyStore.LoadStoreParameter}
      *          input is not recognized
-     * @exception IOException if there is an I/O or format problem with the
+     * @throws    IOException if there is an I/O or format problem with the
      *          keystore data. If the error is due to an incorrect
      *         {@code ProtectionParameter} (e.g. wrong password)
      *         the {@link Throwable#getCause cause} of the
      *         {@code IOException} should be an
      *         {@code UnrecoverableKeyException}
-     * @exception NoSuchAlgorithmException if the algorithm used to check
+     * @throws    NoSuchAlgorithmException if the algorithm used to check
      *          the integrity of the keystore cannot be found
-     * @exception CertificateException if any of the certificates in the
+     * @throws    CertificateException if any of the certificates in the
      *          keystore could not be loaded
      *
      * @since 1.5
@@ -447,12 +447,12 @@
      * @return the {@code KeyStore.Entry} for the specified alias,
      *          or {@code null} if there is no such entry
      *
-     * @exception KeyStoreException if the operation failed
-     * @exception NoSuchAlgorithmException if the algorithm for recovering the
+     * @throws    KeyStoreException if the operation failed
+     * @throws    NoSuchAlgorithmException if the algorithm for recovering the
      *          entry cannot be found
-     * @exception UnrecoverableEntryException if the specified
+     * @throws    UnrecoverableEntryException if the specified
      *          {@code protParam} were insufficient or invalid
-     * @exception UnrecoverableKeyException if the entry is a
+     * @throws    UnrecoverableKeyException if the entry is a
      *          {@code PrivateKeyEntry} or {@code SecretKeyEntry}
      *          and the specified {@code protParam} does not contain
      *          the information needed to recover the key (e.g. wrong password)
@@ -518,7 +518,7 @@
      *          used to protect the {@code Entry},
      *          which may be {@code null}
      *
-     * @exception KeyStoreException if this operation fails
+     * @throws    KeyStoreException if this operation fails
      *
      * @since 1.5
      */
--- a/src/java.base/share/classes/java/security/MessageDigest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/MessageDigest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -399,7 +399,7 @@
      *
      * @return the number of bytes placed into {@code buf}
      *
-     * @exception DigestException if an error occurs.
+     * @throws    DigestException if an error occurs.
      */
     public int digest(byte[] buf, int offset, int len) throws DigestException {
         if (buf == null) {
@@ -536,7 +536,7 @@
      *
      * @return a clone if the implementation is cloneable.
      *
-     * @exception CloneNotSupportedException if this is called on an
+     * @throws    CloneNotSupportedException if this is called on an
      * implementation that does not support {@code Cloneable}.
      */
     public Object clone() throws CloneNotSupportedException {
@@ -580,7 +580,7 @@
          *
          * @return a clone if the delegate is cloneable.
          *
-         * @exception CloneNotSupportedException if this is called on a
+         * @throws    CloneNotSupportedException if this is called on a
          * delegate that does not support {@code Cloneable}.
          */
         public Object clone() throws CloneNotSupportedException {
--- a/src/java.base/share/classes/java/security/MessageDigestSpi.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/MessageDigestSpi.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -167,7 +167,7 @@
      *
      * @return the length of the digest stored in the output buffer.
      *
-     * @exception DigestException if an error occurs.
+     * @throws    DigestException if an error occurs.
      *
      * @since 1.2
      */
@@ -194,7 +194,7 @@
      *
      * @return a clone if the implementation is cloneable.
      *
-     * @exception CloneNotSupportedException if this is called on an
+     * @throws    CloneNotSupportedException if this is called on an
      * implementation that does not support {@code Cloneable}.
      */
     public Object clone() throws CloneNotSupportedException {
--- a/src/java.base/share/classes/java/security/PKCS12Attribute.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/PKCS12Attribute.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -64,9 +64,9 @@
      * @param name the attribute's identifier
      * @param value the attribute's value
      *
-     * @exception NullPointerException if {@code name} or {@code value}
+     * @throws    NullPointerException if {@code name} or {@code value}
      *     is {@code null}
-     * @exception IllegalArgumentException if {@code name} or
+     * @throws    IllegalArgumentException if {@code name} or
      *     {@code value} is incorrectly formatted
      */
     public PKCS12Attribute(String name, String value) {
@@ -117,9 +117,9 @@
      * @param encoded the attribute's ASN.1 DER encoding. It is cloned
      *     to prevent subsequent modificaion.
      *
-     * @exception NullPointerException if {@code encoded} is
+     * @throws    NullPointerException if {@code encoded} is
      *     {@code null}
-     * @exception IllegalArgumentException if {@code encoded} is
+     * @throws    IllegalArgumentException if {@code encoded} is
      *     incorrectly formatted
      */
     public PKCS12Attribute(byte[] encoded) {
--- a/src/java.base/share/classes/java/security/PermissionCollection.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/PermissionCollection.java	Tue Sep 24 15:19:35 2019 -0400
@@ -107,9 +107,9 @@
      *
      * @param permission the Permission object to add.
      *
-     * @exception SecurityException -  if this PermissionCollection object
+     * @throws    SecurityException -  if this PermissionCollection object
      *                                 has been marked readonly
-     * @exception IllegalArgumentException - if this PermissionCollection
+     * @throws    IllegalArgumentException - if this PermissionCollection
      *                object is a homogeneous collection and the permission
      *                is not of the correct type.
      */
--- a/src/java.base/share/classes/java/security/Permissions.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/Permissions.java	Tue Sep 24 15:19:35 2019 -0400
@@ -116,7 +116,7 @@
      *
      * @param permission the Permission object to add.
      *
-     * @exception SecurityException if this Permissions object is
+     * @throws    SecurityException if this Permissions object is
      * marked as readonly.
      *
      * @see PermissionCollection#isReadOnly()
--- a/src/java.base/share/classes/java/security/Policy.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/Policy.java	Tue Sep 24 15:19:35 2019 -0400
@@ -837,7 +837,7 @@
          *
          * @param permission the Permission object to add.
          *
-         * @exception SecurityException - if this PermissionCollection object
+         * @throws    SecurityException - if this PermissionCollection object
          *                                has been marked readonly
          */
         @Override public void add(Permission permission) {
--- a/src/java.base/share/classes/java/security/Provider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/Provider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -403,7 +403,7 @@
      * Reads a property list (key and element pairs) from the input stream.
      *
      * @param inStream the input stream.
-     * @exception IOException if an error occurred when reading from the
+     * @throws    IOException if an error occurred when reading from the
      *               input stream.
      * @see java.util.Properties#load
      */
--- a/src/java.base/share/classes/java/security/SecureClassLoader.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/SecureClassLoader.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -68,7 +68,7 @@
      * method  to ensure creation of a class loader is allowed.
      *
      * @param parent the parent ClassLoader
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     SecurityException  if a security manager exists and its
      *             {@code checkCreateClassLoader} method doesn't allow
      *             creation of a class loader.
      * @see SecurityManager#checkCreateClassLoader
@@ -85,7 +85,7 @@
      * calls the security manager's {@code checkCreateClassLoader}
      * method  to ensure creation of a class loader is allowed.
      *
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     SecurityException  if a security manager exists and its
      *             {@code checkCreateClassLoader} method doesn't allow
      *             creation of a class loader.
      * @see SecurityManager#checkCreateClassLoader
@@ -134,12 +134,12 @@
      * @param      cs   the associated CodeSource, or {@code null} if none
      * @return the {@code Class} object created from the data,
      *         and optional CodeSource.
-     * @exception  ClassFormatError if the data did not contain a valid class
-     * @exception  IndexOutOfBoundsException if either {@code off} or
+     * @throws     ClassFormatError if the data did not contain a valid class
+     * @throws     IndexOutOfBoundsException if either {@code off} or
      *             {@code len} is negative, or if
      *             {@code off+len} is greater than {@code b.length}.
      *
-     * @exception  SecurityException if an attempt is made to add this class
+     * @throws     SecurityException if an attempt is made to add this class
      *             to a package that contains classes that were signed by
      *             a different set of certificates than this class, or if
      *             the class name begins with "java.".
@@ -169,8 +169,8 @@
      * @param      cs   the associated CodeSource, or {@code null} if none
      * @return the {@code Class} object created from the data,
      *         and optional CodeSource.
-     * @exception  ClassFormatError if the data did not contain a valid class
-     * @exception  SecurityException if an attempt is made to add this class
+     * @throws     ClassFormatError if the data did not contain a valid class
+     * @throws     SecurityException if an attempt is made to add this class
      *             to a package that contains classes that were signed by
      *             a different set of certificates than this class, or if
      *             the class name begins with "java.".
--- a/src/java.base/share/classes/java/security/Signature.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/Signature.java	Tue Sep 24 15:19:35 2019 -0400
@@ -498,7 +498,7 @@
      * @param publicKey the public key of the identity whose signature is
      * going to be verified.
      *
-     * @exception InvalidKeyException if the key is invalid.
+     * @throws    InvalidKeyException if the key is invalid.
      */
     public final void initVerify(PublicKey publicKey)
             throws InvalidKeyException {
@@ -520,8 +520,8 @@
      * going to be verified.
      * @param params the parameters used for verifying this signature.
      *
-     * @exception InvalidKeyException if the key is invalid.
-     * @exception InvalidAlgorithmParameterException if the params is invalid.
+     * @throws    InvalidKeyException if the key is invalid.
+     * @throws    InvalidAlgorithmParameterException if the params is invalid.
      */
     final void initVerify(PublicKey publicKey, AlgorithmParameterSpec params)
             throws InvalidKeyException, InvalidAlgorithmParameterException {
@@ -571,7 +571,7 @@
      * @param certificate the certificate of the identity whose signature is
      * going to be verified.
      *
-     * @exception InvalidKeyException  if the public key in the certificate
+     * @throws    InvalidKeyException  if the public key in the certificate
      * is not encoded properly or does not include required  parameter
      * information or cannot be used for digital signature purposes.
      * @since 1.3
@@ -601,10 +601,10 @@
      * going to be verified.
      * @param params the parameters used for verifying this signature.
      *
-     * @exception InvalidKeyException  if the public key in the certificate
+     * @throws    InvalidKeyException  if the public key in the certificate
      * is not encoded properly or does not include required  parameter
      * information or cannot be used for digital signature purposes.
-     * @exception InvalidAlgorithmParameterException if the params is invalid.
+     * @throws    InvalidAlgorithmParameterException if the params is invalid.
      *
      * @since 13
      */
@@ -628,7 +628,7 @@
      * @param privateKey the private key of the identity whose signature
      * is going to be generated.
      *
-     * @exception InvalidKeyException if the key is invalid.
+     * @throws    InvalidKeyException if the key is invalid.
      */
     public final void initSign(PrivateKey privateKey)
             throws InvalidKeyException {
@@ -651,7 +651,7 @@
      *
      * @param random the source of randomness for this signature.
      *
-     * @exception InvalidKeyException if the key is invalid.
+     * @throws    InvalidKeyException if the key is invalid.
      */
     public final void initSign(PrivateKey privateKey, SecureRandom random)
             throws InvalidKeyException {
@@ -674,8 +674,8 @@
      * @param params the parameters used for generating signature.
      * @param random the source of randomness for this signature.
      *
-     * @exception InvalidKeyException if the key is invalid.
-     * @exception InvalidAlgorithmParameterException if the params is invalid
+     * @throws    InvalidKeyException if the key is invalid.
+     * @throws    InvalidAlgorithmParameterException if the params is invalid
      */
     final void initSign(PrivateKey privateKey,
             AlgorithmParameterSpec params, SecureRandom random)
@@ -703,7 +703,7 @@
      *
      * @return the signature bytes of the signing operation's result.
      *
-     * @exception SignatureException if this signature object is not
+     * @throws    SignatureException if this signature object is not
      * initialized properly or if this signature algorithm is unable to
      * process the input data provided.
      */
@@ -736,11 +736,11 @@
      *
      * @return the number of bytes placed into {@code outbuf}.
      *
-     * @exception SignatureException if this signature object is not
+     * @throws    SignatureException if this signature object is not
      *     initialized properly, if this signature algorithm is unable to
      *     process the input data provided, or if {@code len} is less
      *     than the actual signature length.
-     * @exception IllegalArgumentException if {@code outbuf} is {@code null},
+     * @throws    IllegalArgumentException if {@code outbuf} is {@code null},
      *     or {@code offset} or {@code len} is less than 0, or the sum of
      *     {@code offset} and {@code len} is greater than the length of
      *     {@code outbuf}.
@@ -779,7 +779,7 @@
      *
      * @return true if the signature was verified, false if not.
      *
-     * @exception SignatureException if this signature object is not
+     * @throws    SignatureException if this signature object is not
      * initialized properly, the passed-in signature is improperly
      * encoded or of the wrong type, if this signature algorithm is unable to
      * process the input data provided, etc.
@@ -809,11 +809,11 @@
      *
      * @return true if the signature was verified, false if not.
      *
-     * @exception SignatureException if this signature object is not
+     * @throws    SignatureException if this signature object is not
      * initialized properly, the passed-in signature is improperly
      * encoded or of the wrong type, if this signature algorithm is unable to
      * process the input data provided, etc.
-     * @exception IllegalArgumentException if the {@code signature}
+     * @throws    IllegalArgumentException if the {@code signature}
      * byte array is {@code null}, or the {@code offset} or {@code length}
      * is less than 0, or the sum of the {@code offset} and
      * {@code length} is greater than the length of the
@@ -846,7 +846,7 @@
      *
      * @param b the byte to use for the update.
      *
-     * @exception SignatureException if this signature object is not
+     * @throws    SignatureException if this signature object is not
      * initialized properly.
      */
     public final void update(byte b) throws SignatureException {
@@ -864,7 +864,7 @@
      *
      * @param data the byte array to use for the update.
      *
-     * @exception SignatureException if this signature object is not
+     * @throws    SignatureException if this signature object is not
      * initialized properly.
      */
     public final void update(byte[] data) throws SignatureException {
@@ -879,9 +879,9 @@
      * @param off the offset to start from in the array of bytes.
      * @param len the number of bytes to use, starting at offset.
      *
-     * @exception SignatureException if this signature object is not
+     * @throws    SignatureException if this signature object is not
      *     initialized properly.
-     * @exception IllegalArgumentException if {@code data} is {@code null},
+     * @throws    IllegalArgumentException if {@code data} is {@code null},
      *     or {@code off} or {@code len} is less than 0, or the sum of
      *     {@code off} and {@code len} is greater than the length of
      *     {@code data}.
@@ -915,7 +915,7 @@
      *
      * @param data the ByteBuffer
      *
-     * @exception SignatureException if this signature object is not
+     * @throws    SignatureException if this signature object is not
      * initialized properly.
      * @since 1.5
      */
@@ -976,7 +976,7 @@
      * @param param the string identifier of the parameter.
      * @param value the parameter value.
      *
-     * @exception InvalidParameterException if {@code param} is an
+     * @throws    InvalidParameterException if {@code param} is an
      * invalid parameter for this signature algorithm engine,
      * the parameter is already set
      * and cannot be set again, a security exception occurs, and so on.
@@ -998,7 +998,7 @@
      *
      * @param params the parameters
      *
-     * @exception InvalidAlgorithmParameterException if the given parameters
+     * @throws    InvalidAlgorithmParameterException if the given parameters
      * are inappropriate for this signature engine
      *
      * @see #getParameters
@@ -1043,7 +1043,7 @@
      * @return the object that represents the parameter value, or {@code null} if
      * there is none.
      *
-     * @exception InvalidParameterException if {@code param} is an invalid
+     * @throws    InvalidParameterException if {@code param} is an invalid
      * parameter for this engine, or another exception occurs while
      * trying to get this parameter.
      *
@@ -1062,7 +1062,7 @@
      *
      * @return a clone if the implementation is cloneable.
      *
-     * @exception CloneNotSupportedException if this is called
+     * @throws    CloneNotSupportedException if this is called
      * on an implementation that does not support {@code Cloneable}.
      */
     public Object clone() throws CloneNotSupportedException {
@@ -1126,7 +1126,7 @@
          *
          * @return a clone if the delegate is cloneable.
          *
-         * @exception CloneNotSupportedException if this is called on a
+         * @throws    CloneNotSupportedException if this is called on a
          * delegate that does not support {@code Cloneable}.
          */
         public Object clone() throws CloneNotSupportedException {
--- a/src/java.base/share/classes/java/security/SignatureSpi.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/SignatureSpi.java	Tue Sep 24 15:19:35 2019 -0400
@@ -64,7 +64,7 @@
      * @param publicKey the public key of the identity whose signature is
      * going to be verified.
      *
-     * @exception InvalidKeyException if the key is improperly
+     * @throws    InvalidKeyException if the key is improperly
      * encoded, parameters are missing, and so on.
      */
     protected abstract void engineInitVerify(PublicKey publicKey)
@@ -78,9 +78,9 @@
      * going to be verified.
      * @param params the parameters for generating this signature
      *
-     * @exception InvalidKeyException if the key is improperly
+     * @throws    InvalidKeyException if the key is improperly
      * encoded, does not work with the given parameters, and so on.
-     * @exception InvalidAlgorithmParameterException if the given parameters
+     * @throws    InvalidAlgorithmParameterException if the given parameters
      * is invalid.
      */
     void engineInitVerify(PublicKey publicKey,
@@ -104,7 +104,7 @@
      * @param privateKey the private key of the identity whose signature
      * will be generated.
      *
-     * @exception InvalidKeyException if the key is improperly
+     * @throws    InvalidKeyException if the key is improperly
      * encoded, parameters are missing, and so on.
      */
     protected abstract void engineInitSign(PrivateKey privateKey)
@@ -121,7 +121,7 @@
      * will be generated.
      * @param random the source of randomness
      *
-     * @exception InvalidKeyException if the key is improperly
+     * @throws    InvalidKeyException if the key is improperly
      * encoded, parameters are missing, and so on.
      */
     protected void engineInitSign(PrivateKey privateKey,
@@ -143,9 +143,9 @@
      * @param params the parameters for generating this signature
      * @param random the source of randomness
      *
-     * @exception InvalidKeyException if the key is improperly
+     * @throws    InvalidKeyException if the key is improperly
      * encoded, parameters are missing, and so on.
-     * @exception InvalidAlgorithmParameterException if the parameters is
+     * @throws    InvalidAlgorithmParameterException if the parameters is
      * invalid.
      */
     void engineInitSign(PrivateKey privateKey,
@@ -168,7 +168,7 @@
      *
      * @param b the byte to use for the update.
      *
-     * @exception SignatureException if the engine is not initialized
+     * @throws    SignatureException if the engine is not initialized
      * properly.
      */
     protected abstract void engineUpdate(byte b) throws SignatureException;
@@ -181,7 +181,7 @@
      * @param off the offset to start from in the array of bytes
      * @param len the number of bytes to use, starting at offset
      *
-     * @exception SignatureException if the engine is not initialized
+     * @throws    SignatureException if the engine is not initialized
      * properly
      */
     protected abstract void engineUpdate(byte[] b, int off, int len)
@@ -234,7 +234,7 @@
      *
      * @return the signature bytes of the signing operation's result.
      *
-     * @exception SignatureException if the engine is not
+     * @throws    SignatureException if the engine is not
      * initialized properly or if this signature algorithm is unable to
      * process the input data provided.
      */
@@ -273,7 +273,7 @@
      *
      * @return the number of bytes placed into {@code outbuf}
      *
-     * @exception SignatureException if the engine is not
+     * @throws    SignatureException if the engine is not
      * initialized properly, if this signature algorithm is unable to
      * process the input data provided, or if {@code len} is less
      * than the actual signature length.
@@ -303,7 +303,7 @@
      *
      * @return true if the signature was verified, false if not.
      *
-     * @exception SignatureException if the engine is not
+     * @throws    SignatureException if the engine is not
      * initialized properly, the passed-in signature is improperly
      * encoded or of the wrong type, if this signature algorithm is unable to
      * process the input data provided, etc.
@@ -324,7 +324,7 @@
      *
      * @return true if the signature was verified, false if not.
      *
-     * @exception SignatureException if the engine is not
+     * @throws    SignatureException if the engine is not
      * initialized properly, the passed-in signature is improperly
      * encoded or of the wrong type, if this signature algorithm is unable to
      * process the input data provided, etc.
@@ -352,7 +352,7 @@
      *
      * @param value the parameter value.
      *
-     * @exception InvalidParameterException if {@code param} is an
+     * @throws    InvalidParameterException if {@code param} is an
      * invalid parameter for this signature algorithm engine,
      * the parameter is already set
      * and cannot be set again, a security exception occurs, and so on.
@@ -371,10 +371,10 @@
      *
      * @param params the parameters
      *
-     * @exception UnsupportedOperationException if this method is not
+     * @throws    UnsupportedOperationException if this method is not
      * overridden by a provider
      *
-     * @exception InvalidAlgorithmParameterException if this method is
+     * @throws    InvalidAlgorithmParameterException if this method is
      * overridden by a provider and the given parameters
      * are inappropriate for this signature engine
      */
@@ -397,7 +397,7 @@
      *
      * @return the parameters used with this signature engine, or {@code null}
      *
-     * @exception UnsupportedOperationException if this method is
+     * @throws    UnsupportedOperationException if this method is
      * not overridden by a provider
      * @since 1.4
      */
@@ -421,7 +421,7 @@
      * @return the object that represents the parameter value, or {@code null} if
      * there is none.
      *
-     * @exception InvalidParameterException if {@code param} is an
+     * @throws    InvalidParameterException if {@code param} is an
      * invalid parameter for this engine, or another exception occurs while
      * trying to get this parameter.
      *
@@ -436,7 +436,7 @@
      *
      * @return a clone if the implementation is cloneable.
      *
-     * @exception CloneNotSupportedException if this is called
+     * @throws    CloneNotSupportedException if this is called
      * on an implementation that does not support {@code Cloneable}.
      */
     public Object clone() throws CloneNotSupportedException {
--- a/src/java.base/share/classes/java/security/SignedObject.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/SignedObject.java	Tue Sep 24 15:19:35 2019 -0400
@@ -140,9 +140,9 @@
      * @param signingKey the private key for signing.
      * @param signingEngine the signature signing engine.
      *
-     * @exception IOException if an error occurs during serialization
-     * @exception InvalidKeyException if the key is invalid.
-     * @exception SignatureException if signing fails.
+     * @throws    IOException if an error occurs during serialization
+     * @throws    InvalidKeyException if the key is invalid.
+     * @throws    SignatureException if signing fails.
      */
     public SignedObject(Serializable object, PrivateKey signingKey,
                         Signature signingEngine)
@@ -168,8 +168,8 @@
      *
      * @return the encapsulated object.
      *
-     * @exception IOException if an error occurs during de-serialization
-     * @exception ClassNotFoundException if an error occurs during
+     * @throws    IOException if an error occurs during de-serialization
+     * @throws    ClassNotFoundException if an error occurs during
      * de-serialization
      */
     public Object getObject()
@@ -212,10 +212,10 @@
      * @param verificationKey the public key for verification.
      * @param verificationEngine the signature verification engine.
      *
-     * @exception SignatureException if signature verification failed (an
+     * @throws    SignatureException if signature verification failed (an
      *     exception prevented the signature verification engine from completing
      *     normally).
-     * @exception InvalidKeyException if the verification key is invalid.
+     * @throws    InvalidKeyException if the verification key is invalid.
      *
      * @return {@code true} if the signature
      * is valid, {@code false} otherwise
@@ -235,8 +235,8 @@
      * @param signingKey the private key for signing.
      * @param signingEngine the signature signing engine.
      *
-     * @exception InvalidKeyException if the key is invalid.
-     * @exception SignatureException if signing fails.
+     * @throws    InvalidKeyException if the key is invalid.
+     * @throws    SignatureException if signing fails.
      */
     private void sign(PrivateKey signingKey, Signature signingEngine)
         throws InvalidKeyException, SignatureException {
--- a/src/java.base/share/classes/java/security/Signer.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/Signer.java	Tue Sep 24 15:19:35 2019 -0400
@@ -84,7 +84,7 @@
      *
      * @param scope the scope of the identity.
      *
-     * @exception KeyManagementException if there is already an identity
+     * @throws    KeyManagementException if there is already an identity
      * with the same name in the scope.
      */
     public Signer(String name, IdentityScope scope)
@@ -102,7 +102,7 @@
      * @return this signer's private key, or null if the private key has
      * not yet been set.
      *
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     SecurityException  if a security manager exists and its
      * {@code checkSecurityAccess} method doesn't allow
      * returning the private key.
      *
@@ -122,11 +122,11 @@
      *
      * @param pair an initialized key pair.
      *
-     * @exception InvalidParameterException if the key pair is not
+     * @throws    InvalidParameterException if the key pair is not
      * properly initialized.
-     * @exception KeyException if the key pair cannot be set for any
+     * @throws    KeyException if the key pair cannot be set for any
      * other reason.
-     * @exception  SecurityException  if a security manager exists and its
+     * @throws     SecurityException  if a security manager exists and its
      * {@code checkSecurityAccess} method doesn't allow
      * setting the key pair.
      *
--- a/src/java.base/share/classes/java/security/URIParameter.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/URIParameter.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,7 @@
      *
      * @param uri the URI pointing to the data.
      *
-     * @exception NullPointerException if the specified URI is null.
+     * @throws    NullPointerException if the specified URI is null.
      */
     public URIParameter(java.net.URI uri) {
         if (uri == null) {
--- a/src/java.base/share/classes/java/security/cert/CertPath.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/cert/CertPath.java	Tue Sep 24 15:19:35 2019 -0400
@@ -248,7 +248,7 @@
      * encoding.
      *
      * @return the encoded bytes
-     * @exception CertificateEncodingException if an encoding error occurs
+     * @throws    CertificateEncodingException if an encoding error occurs
      */
     public abstract byte[] getEncoded()
         throws CertificateEncodingException;
@@ -259,7 +259,7 @@
      *
      * @param encoding the name of the encoding to use
      * @return the encoded bytes
-     * @exception CertificateEncodingException if an encoding error occurs or
+     * @throws    CertificateEncodingException if an encoding error occurs or
      *   the encoding requested is not supported
      */
     public abstract byte[] getEncoded(String encoding)
--- a/src/java.base/share/classes/java/security/cert/CertPathValidator.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/cert/CertPathValidator.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -296,9 +296,9 @@
      * @param certPath the {@code CertPath} to be validated
      * @param params the algorithm parameters
      * @return the result of the validation algorithm
-     * @exception CertPathValidatorException if the {@code CertPath}
+     * @throws    CertPathValidatorException if the {@code CertPath}
      * does not validate
-     * @exception InvalidAlgorithmParameterException if the specified
+     * @throws    InvalidAlgorithmParameterException if the specified
      * parameters or the type of the specified {@code CertPath} are
      * inappropriate for this {@code CertPathValidator}
      */
--- a/src/java.base/share/classes/java/security/cert/CertPathValidatorSpi.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/cert/CertPathValidatorSpi.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -73,9 +73,9 @@
      * @param certPath the {@code CertPath} to be validated
      * @param params the algorithm parameters
      * @return the result of the validation algorithm
-     * @exception CertPathValidatorException if the {@code CertPath}
+     * @throws    CertPathValidatorException if the {@code CertPath}
      * does not validate
-     * @exception InvalidAlgorithmParameterException if the specified
+     * @throws    InvalidAlgorithmParameterException if the specified
      * parameters or the type of the specified {@code CertPath} are
      * inappropriate for this {@code CertPathValidator}
      */
--- a/src/java.base/share/classes/java/security/cert/Certificate.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/cert/Certificate.java	Tue Sep 24 15:19:35 2019 -0400
@@ -148,7 +148,7 @@
      *
      * @return the encoded form of this certificate
      *
-     * @exception CertificateEncodingException if an encoding error occurs.
+     * @throws    CertificateEncodingException if an encoding error occurs.
      */
     public abstract byte[] getEncoded()
         throws CertificateEncodingException;
@@ -159,12 +159,12 @@
      *
      * @param key the PublicKey used to carry out the verification.
      *
-     * @exception NoSuchAlgorithmException on unsupported signature
+     * @throws    NoSuchAlgorithmException on unsupported signature
      * algorithms.
-     * @exception InvalidKeyException on incorrect key.
-     * @exception NoSuchProviderException if there's no default provider.
-     * @exception SignatureException on signature errors.
-     * @exception CertificateException on encoding errors.
+     * @throws    InvalidKeyException on incorrect key.
+     * @throws    NoSuchProviderException if there's no default provider.
+     * @throws    SignatureException on signature errors.
+     * @throws    CertificateException on encoding errors.
      */
     public abstract void verify(PublicKey key)
         throws CertificateException, NoSuchAlgorithmException,
@@ -180,12 +180,12 @@
      * @param key the PublicKey used to carry out the verification.
      * @param sigProvider the name of the signature provider.
      *
-     * @exception NoSuchAlgorithmException on unsupported signature
+     * @throws    NoSuchAlgorithmException on unsupported signature
      * algorithms.
-     * @exception InvalidKeyException on incorrect key.
-     * @exception NoSuchProviderException on incorrect provider.
-     * @exception SignatureException on signature errors.
-     * @exception CertificateException on encoding errors.
+     * @throws    InvalidKeyException on incorrect key.
+     * @throws    NoSuchProviderException on incorrect provider.
+     * @throws    SignatureException on signature errors.
+     * @throws    CertificateException on encoding errors.
      */
     public abstract void verify(PublicKey key, String sigProvider)
         throws CertificateException, NoSuchAlgorithmException,
@@ -207,12 +207,12 @@
      * @param key the PublicKey used to carry out the verification.
      * @param sigProvider the signature provider.
      *
-     * @exception NoSuchAlgorithmException on unsupported signature
+     * @throws    NoSuchAlgorithmException on unsupported signature
      * algorithms.
-     * @exception InvalidKeyException on incorrect key.
-     * @exception SignatureException on signature errors.
-     * @exception CertificateException on encoding errors.
-     * @exception UnsupportedOperationException if the method is not supported
+     * @throws    InvalidKeyException on incorrect key.
+     * @throws    SignatureException on signature errors.
+     * @throws    CertificateException on encoding errors.
+     * @throws    UnsupportedOperationException if the method is not supported
      * @since 1.8
      */
     public void verify(PublicKey key, Provider sigProvider)
--- a/src/java.base/share/classes/java/security/cert/CertificateFactory.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/cert/CertificateFactory.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -347,7 +347,7 @@
      * @return a certificate object initialized with the data
      * from the input stream.
      *
-     * @exception CertificateException on parsing errors.
+     * @throws    CertificateException on parsing errors.
      */
     public final Certificate generateCertificate(InputStream inStream)
         throws CertificateException
@@ -385,7 +385,7 @@
      * @param inStream an {@code InputStream} containing the data
      * @return a {@code CertPath} initialized with the data from the
      *   {@code InputStream}
-     * @exception CertificateException if an exception occurs while decoding
+     * @throws    CertificateException if an exception occurs while decoding
      * @since 1.4
      */
     public final CertPath generateCertPath(InputStream inStream)
@@ -407,7 +407,7 @@
      * @param encoding the encoding used for the data
      * @return a {@code CertPath} initialized with the data from the
      *   {@code InputStream}
-     * @exception CertificateException if an exception occurs while decoding or
+     * @throws    CertificateException if an exception occurs while decoding or
      *   the encoding requested is not supported
      * @since 1.4
      */
@@ -428,7 +428,7 @@
      * @param certificates a {@code List} of {@code Certificate}s
      * @return a {@code CertPath} initialized with the supplied list of
      *   certificates
-     * @exception CertificateException if an exception occurs
+     * @throws    CertificateException if an exception occurs
      * @since 1.4
      */
     public final CertPath
@@ -471,7 +471,7 @@
      * java.security.cert.Certificate objects
      * initialized with the data from the input stream.
      *
-     * @exception CertificateException on parsing errors.
+     * @throws    CertificateException on parsing errors.
      */
     public final Collection<? extends Certificate> generateCertificates
             (InputStream inStream) throws CertificateException {
@@ -505,7 +505,7 @@
      * @return a CRL object initialized with the data
      * from the input stream.
      *
-     * @exception CRLException on parsing errors.
+     * @throws    CRLException on parsing errors.
      */
     public final CRL generateCRL(InputStream inStream)
         throws CRLException
@@ -544,7 +544,7 @@
      * java.security.cert.CRL objects initialized with the data from the input
      * stream.
      *
-     * @exception CRLException on parsing errors.
+     * @throws    CRLException on parsing errors.
      */
     public final Collection<? extends CRL> generateCRLs(InputStream inStream)
             throws CRLException {
--- a/src/java.base/share/classes/java/security/cert/CertificateFactorySpi.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/cert/CertificateFactorySpi.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -99,7 +99,7 @@
      * @return a certificate object initialized with the data
      * from the input stream.
      *
-     * @exception CertificateException on parsing errors.
+     * @throws    CertificateException on parsing errors.
      */
     public abstract Certificate engineGenerateCertificate(InputStream inStream)
         throws CertificateException;
@@ -117,8 +117,8 @@
      * @param inStream an {@code InputStream} containing the data
      * @return a {@code CertPath} initialized with the data from the
      *   {@code InputStream}
-     * @exception CertificateException if an exception occurs while decoding
-     * @exception UnsupportedOperationException if the method is not supported
+     * @throws    CertificateException if an exception occurs while decoding
+     * @throws    UnsupportedOperationException if the method is not supported
      * @since 1.4
      */
     public CertPath engineGenerateCertPath(InputStream inStream)
@@ -141,9 +141,9 @@
      * @param encoding the encoding used for the data
      * @return a {@code CertPath} initialized with the data from the
      *   {@code InputStream}
-     * @exception CertificateException if an exception occurs while decoding or
+     * @throws    CertificateException if an exception occurs while decoding or
      *   the encoding requested is not supported
-     * @exception UnsupportedOperationException if the method is not supported
+     * @throws    UnsupportedOperationException if the method is not supported
      * @since 1.4
      */
     public CertPath engineGenerateCertPath(InputStream inStream,
@@ -168,8 +168,8 @@
      * @param certificates a {@code List} of {@code Certificate}s
      * @return a {@code CertPath} initialized with the supplied list of
      *   certificates
-     * @exception CertificateException if an exception occurs
-     * @exception UnsupportedOperationException if the method is not supported
+     * @throws    CertificateException if an exception occurs
+     * @throws    UnsupportedOperationException if the method is not supported
      * @since 1.4
      */
     public CertPath
@@ -198,7 +198,7 @@
      *
      * @return an {@code Iterator} over the names of the supported
      *         {@code CertPath} encodings (as {@code String}s)
-     * @exception UnsupportedOperationException if the method is not supported
+     * @throws    UnsupportedOperationException if the method is not supported
      * @since 1.4
      */
     public Iterator<String> engineGetCertPathEncodings() {
@@ -239,7 +239,7 @@
      * java.security.cert.Certificate objects
      * initialized with the data from the input stream.
      *
-     * @exception CertificateException on parsing errors.
+     * @throws    CertificateException on parsing errors.
      */
     public abstract Collection<? extends Certificate>
             engineGenerateCertificates(InputStream inStream)
@@ -272,7 +272,7 @@
      * @return a CRL object initialized with the data
      * from the input stream.
      *
-     * @exception CRLException on parsing errors.
+     * @throws    CRLException on parsing errors.
      */
     public abstract CRL engineGenerateCRL(InputStream inStream)
         throws CRLException;
@@ -308,7 +308,7 @@
      * java.security.cert.CRL objects initialized with the data from the input
      * stream.
      *
-     * @exception CRLException on parsing errors.
+     * @throws    CRLException on parsing errors.
      */
     public abstract Collection<? extends CRL> engineGenerateCRLs
             (InputStream inStream) throws CRLException;
--- a/src/java.base/share/classes/java/security/cert/CollectionCertStoreParameters.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/cert/CollectionCertStoreParameters.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -80,7 +80,7 @@
      *
      * @param collection a {@code Collection} of
      *        {@code Certificate}s and {@code CRL}s
-     * @exception NullPointerException if {@code collection} is
+     * @throws    NullPointerException if {@code collection} is
      * {@code null}
      */
     public CollectionCertStoreParameters(Collection<?> collection) {
--- a/src/java.base/share/classes/java/security/cert/Extension.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/cert/Extension.java	Tue Sep 24 15:19:35 2019 -0400
@@ -94,8 +94,8 @@
      * stream.
      *
      * @param out the output stream
-     * @exception IOException on encoding or output error.
-     * @exception NullPointerException if {@code out} is {@code null}.
+     * @throws    IOException on encoding or output error.
+     * @throws    NullPointerException if {@code out} is {@code null}.
      */
     void encode(OutputStream out) throws IOException;
 }
--- a/src/java.base/share/classes/java/security/cert/LDAPCertStoreParameters.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/cert/LDAPCertStoreParameters.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -69,7 +69,7 @@
      *
      * @param serverName the DNS name of the LDAP server
      * @param port the port number of the LDAP server
-     * @exception NullPointerException if {@code serverName} is
+     * @throws    NullPointerException if {@code serverName} is
      * {@code null}
      */
     public LDAPCertStoreParameters(String serverName, int port) {
@@ -84,7 +84,7 @@
      * specified server name and a default port of 389.
      *
      * @param serverName the DNS name of the LDAP server
-     * @exception NullPointerException if {@code serverName} is
+     * @throws    NullPointerException if {@code serverName} is
      * {@code null}
      */
     public LDAPCertStoreParameters(String serverName) {
--- a/src/java.base/share/classes/java/security/cert/PKIXCertPathChecker.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/cert/PKIXCertPathChecker.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -158,7 +158,7 @@
      * @param cert the {@code Certificate} to be checked
      * @param unresolvedCritExts a {@code Collection} of OID strings
      * representing the current set of unresolved critical extensions
-     * @exception CertPathValidatorException if the specified certificate does
+     * @throws    CertPathValidatorException if the specified certificate does
      * not pass the check
      */
     public abstract void check(Certificate cert,
--- a/src/java.base/share/classes/java/security/cert/PolicyQualifierInfo.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/cert/PolicyQualifierInfo.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -94,7 +94,7 @@
      * encoded bytes. The encoded byte array is copied on construction.
      *
      * @param encoded a byte array containing the qualifier in DER encoding
-     * @exception IOException thrown if the byte array does not represent a
+     * @throws    IOException thrown if the byte array does not represent a
      * valid and parsable policy qualifier
      */
     public PolicyQualifierInfo(byte[] encoded) throws IOException {
--- a/src/java.base/share/classes/java/security/cert/X509CRL.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/cert/X509CRL.java	Tue Sep 24 15:19:35 2019 -0400
@@ -170,7 +170,7 @@
      * Returns the ASN.1 DER-encoded form of this CRL.
      *
      * @return the encoded form of this certificate
-     * @exception CRLException if an encoding error occurs.
+     * @throws    CRLException if an encoding error occurs.
      */
     public abstract byte[] getEncoded()
         throws CRLException;
@@ -181,12 +181,12 @@
      *
      * @param key the PublicKey used to carry out the verification.
      *
-     * @exception NoSuchAlgorithmException on unsupported signature
+     * @throws    NoSuchAlgorithmException on unsupported signature
      * algorithms.
-     * @exception InvalidKeyException on incorrect key.
-     * @exception NoSuchProviderException if there's no default provider.
-     * @exception SignatureException on signature errors.
-     * @exception CRLException on encoding errors.
+     * @throws    InvalidKeyException on incorrect key.
+     * @throws    NoSuchProviderException if there's no default provider.
+     * @throws    SignatureException on signature errors.
+     * @throws    CRLException on encoding errors.
      */
     public abstract void verify(PublicKey key)
         throws CRLException,  NoSuchAlgorithmException,
@@ -202,12 +202,12 @@
      * @param key the PublicKey used to carry out the verification.
      * @param sigProvider the name of the signature provider.
      *
-     * @exception NoSuchAlgorithmException on unsupported signature
+     * @throws    NoSuchAlgorithmException on unsupported signature
      * algorithms.
-     * @exception InvalidKeyException on incorrect key.
-     * @exception NoSuchProviderException on incorrect provider.
-     * @exception SignatureException on signature errors.
-     * @exception CRLException on encoding errors.
+     * @throws    InvalidKeyException on incorrect key.
+     * @throws    NoSuchProviderException on incorrect provider.
+     * @throws    SignatureException on signature errors.
+     * @throws    CRLException on encoding errors.
      */
     public abstract void verify(PublicKey key, String sigProvider)
         throws CRLException, NoSuchAlgorithmException,
@@ -229,11 +229,11 @@
      * @param key the PublicKey used to carry out the verification.
      * @param sigProvider the signature provider.
      *
-     * @exception NoSuchAlgorithmException on unsupported signature
+     * @throws    NoSuchAlgorithmException on unsupported signature
      * algorithms.
-     * @exception InvalidKeyException on incorrect key.
-     * @exception SignatureException on signature errors.
-     * @exception CRLException on encoding errors.
+     * @throws    InvalidKeyException on incorrect key.
+     * @throws    SignatureException on signature errors.
+     * @throws    CRLException on encoding errors.
      * @since 1.8
      */
     public void verify(PublicKey key, Provider sigProvider)
@@ -383,7 +383,7 @@
      *   up
      * @return the entry for the given certificate, or null if no such entry
      *   exists in this CRL.
-     * @exception NullPointerException if certificate is null
+     * @throws    NullPointerException if certificate is null
      *
      * @since 1.5
      */
@@ -411,7 +411,7 @@
      * This can be used to verify the signature independently.
      *
      * @return the DER-encoded CRL information.
-     * @exception CRLException if an encoding error occurs.
+     * @throws    CRLException if an encoding error occurs.
      */
     public abstract byte[] getTBSCertList() throws CRLException;
 
--- a/src/java.base/share/classes/java/security/cert/X509CRLEntry.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/cert/X509CRLEntry.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -122,7 +122,7 @@
      * that is the inner SEQUENCE.
      *
      * @return the encoded form of this certificate
-     * @exception CRLException if an encoding error occurs.
+     * @throws    CRLException if an encoding error occurs.
      */
     public abstract byte[] getEncoded() throws CRLException;
 
--- a/src/java.base/share/classes/java/security/cert/X509Certificate.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/cert/X509Certificate.java	Tue Sep 24 15:19:35 2019 -0400
@@ -141,8 +141,8 @@
      *     generalTime    GeneralizedTime }
      * </pre>
      *
-     * @exception CertificateExpiredException if the certificate has expired.
-     * @exception CertificateNotYetValidException if the certificate is not
+     * @throws    CertificateExpiredException if the certificate has expired.
+     * @throws    CertificateNotYetValidException if the certificate is not
      * yet valid.
      */
     public abstract void checkValidity()
@@ -156,9 +156,9 @@
      * @param date the Date to check against to see if this certificate
      *        is valid at that date/time.
      *
-     * @exception CertificateExpiredException if the certificate has expired
+     * @throws    CertificateExpiredException if the certificate has expired
      * with respect to the {@code date} supplied.
-     * @exception CertificateNotYetValidException if the certificate is not
+     * @throws    CertificateNotYetValidException if the certificate is not
      * yet valid with respect to the {@code date} supplied.
      *
      * @see #checkValidity()
@@ -334,7 +334,7 @@
      * This can be used to verify the signature independently.
      *
      * @return the DER-encoded certificate information.
-     * @exception CertificateEncodingException if an encoding error occurs.
+     * @throws    CertificateEncodingException if an encoding error occurs.
      */
     public abstract byte[] getTBSCertificate()
         throws CertificateEncodingException;
@@ -666,12 +666,12 @@
      * @param key the PublicKey used to carry out the verification.
      * @param sigProvider the signature provider.
      *
-     * @exception NoSuchAlgorithmException on unsupported signature
+     * @throws    NoSuchAlgorithmException on unsupported signature
      * algorithms.
-     * @exception InvalidKeyException on incorrect key.
-     * @exception SignatureException on signature errors.
-     * @exception CertificateException on encoding errors.
-     * @exception UnsupportedOperationException if the method is not supported
+     * @throws    InvalidKeyException on incorrect key.
+     * @throws    SignatureException on signature errors.
+     * @throws    CertificateException on encoding errors.
+     * @throws    UnsupportedOperationException if the method is not supported
      * @since 1.8
      */
     public void verify(PublicKey key, Provider sigProvider)
--- a/src/java.base/share/classes/java/security/interfaces/DSAKeyPairGenerator.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/interfaces/DSAKeyPairGenerator.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -85,7 +85,7 @@
      * @param random the random bit source to use to generate key bits;
      * can be null.
      *
-     * @exception InvalidParameterException if the {@code params}
+     * @throws    InvalidParameterException if the {@code params}
      * value is invalid, null, or unsupported.
      */
    public void initialize(DSAParams params, SecureRandom random)
@@ -112,7 +112,7 @@
      * @param genParams whether or not to generate new parameters for
      * the modulus length requested.
      *
-     * @exception InvalidParameterException if {@code modlen} is
+     * @throws    InvalidParameterException if {@code modlen} is
      * invalid, or unsupported, or if {@code genParams} is false and there
      * are no precomputed parameters for the requested modulus length.
      */
--- a/src/java.base/share/classes/java/security/spec/DSAGenParameterSpec.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/spec/DSAGenParameterSpec.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,7 +46,7 @@
      * length of the domain parameter seed in bits.
      * @param primePLen the desired length of the prime P in bits.
      * @param subprimeQLen the desired length of the sub-prime Q in bits.
-     * @exception IllegalArgumentException if {@code primePLen}
+     * @throws    IllegalArgumentException if {@code primePLen}
      * or {@code subprimeQLen} is illegal per the specification of
      * FIPS 186-3.
      */
@@ -62,7 +62,7 @@
      * @param subprimeQLen the desired length of the sub-prime Q in bits.
      * @param seedLen the desired length of the domain parameter seed in bits,
      * shall be equal to or greater than {@code subprimeQLen}.
-     * @exception IllegalArgumentException if {@code primePLenLen},
+     * @throws    IllegalArgumentException if {@code primePLenLen},
      * {@code subprimeQLen}, or {@code seedLen} is illegal per the
      * specification of FIPS 186-3.
      */
--- a/src/java.base/share/classes/java/security/spec/ECFieldF2m.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/spec/ECFieldF2m.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,7 +47,7 @@
      * Creates an elliptic curve characteristic 2 finite
      * field which has 2^{@code m} elements with normal basis.
      * @param m with 2^{@code m} being the number of elements.
-     * @exception IllegalArgumentException if {@code m}
+     * @throws    IllegalArgumentException if {@code m}
      * is not positive.
      */
     public ECFieldF2m(int m) {
@@ -76,8 +76,8 @@
      * @param m with 2^{@code m} being the number of elements.
      * @param rp the BigInteger whose i-th bit corresponds to
      * the i-th coefficient of the reduction polynomial.
-     * @exception NullPointerException if {@code rp} is null.
-     * @exception IllegalArgumentException if {@code m}
+     * @throws    NullPointerException if {@code rp} is null.
+     * @throws    IllegalArgumentException if {@code m}
      * is not positive, or {@code rp} does not represent
      * a valid reduction polynomial.
      */
@@ -123,8 +123,8 @@
      * @param ks the order of the middle term(s) of the
      * reduction polynomial. Contents of this array are copied
      * to protect against subsequent modification.
-     * @exception NullPointerException if {@code ks} is null.
-     * @exception IllegalArgumentException if{@code m}
+     * @throws    NullPointerException if {@code ks} is null.
+     * @throws    IllegalArgumentException if{@code m}
      * is not positive, or the length of {@code ks}
      * is neither 1 nor 3, or values in {@code ks}
      * are not between {@code m}-1 and 1 (inclusive)
--- a/src/java.base/share/classes/java/security/spec/ECFieldFp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/spec/ECFieldFp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,8 +45,8 @@
      * Creates an elliptic curve prime finite field
      * with the specified prime {@code p}.
      * @param p the prime.
-     * @exception NullPointerException if {@code p} is null.
-     * @exception IllegalArgumentException if {@code p}
+     * @throws    NullPointerException if {@code p} is null.
+     * @throws    IllegalArgumentException if {@code p}
      * is not positive.
      */
     public ECFieldFp(BigInteger p) {
--- a/src/java.base/share/classes/java/security/spec/ECParameterSpec.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/spec/ECParameterSpec.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,9 +51,9 @@
      * @param g the generator which is also known as the base point.
      * @param n the order of the generator {@code g}.
      * @param h the cofactor.
-     * @exception NullPointerException if {@code curve},
+     * @throws    NullPointerException if {@code curve},
      * {@code g}, or {@code n} is null.
-     * @exception IllegalArgumentException if {@code n}
+     * @throws    IllegalArgumentException if {@code n}
      * or {@code h} is not positive.
      */
     public ECParameterSpec(EllipticCurve curve, ECPoint g,
--- a/src/java.base/share/classes/java/security/spec/ECPoint.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/spec/ECPoint.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -57,7 +57,7 @@
      * {@code x} and affine y-coordinate {@code y}.
      * @param x the affine x-coordinate.
      * @param y the affine y-coordinate.
-     * @exception NullPointerException if {@code x} or
+     * @throws    NullPointerException if {@code x} or
      * {@code y} is null.
      */
     public ECPoint(BigInteger x, BigInteger y) {
--- a/src/java.base/share/classes/java/security/spec/ECPrivateKeySpec.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/spec/ECPrivateKeySpec.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,7 +48,7 @@
      * @param s the private value.
      * @param params the associated elliptic curve domain
      * parameters.
-     * @exception NullPointerException if {@code s}
+     * @throws    NullPointerException if {@code s}
      * or {@code params} is null.
      */
     public ECPrivateKeySpec(BigInteger s, ECParameterSpec params) {
--- a/src/java.base/share/classes/java/security/spec/ECPublicKeySpec.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/spec/ECPublicKeySpec.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,9 +47,9 @@
      * @param w the public point.
      * @param params the associated elliptic curve domain
      * parameters.
-     * @exception NullPointerException if {@code w}
+     * @throws    NullPointerException if {@code w}
      * or {@code params} is null.
-     * @exception IllegalArgumentException if {@code w}
+     * @throws    IllegalArgumentException if {@code w}
      * is point at infinity, i.e. ECPoint.POINT_INFINITY
      */
     public ECPublicKeySpec(ECPoint w, ECParameterSpec params) {
--- a/src/java.base/share/classes/java/security/spec/EllipticCurve.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/spec/EllipticCurve.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -73,9 +73,9 @@
      * @param field the finite field that this elliptic curve is over.
      * @param a the first coefficient of this elliptic curve.
      * @param b the second coefficient of this elliptic curve.
-     * @exception NullPointerException if {@code field},
+     * @throws    NullPointerException if {@code field},
      * {@code a}, or {@code b} is null.
-     * @exception IllegalArgumentException if {@code a}
+     * @throws    IllegalArgumentException if {@code a}
      * or {@code b} is not null and not in {@code field}.
      */
     public EllipticCurve(ECField field, BigInteger a,
@@ -93,9 +93,9 @@
      * @param seed the bytes used during curve generation for later
      * validation. Contents of this array are copied to protect against
      * subsequent modification.
-     * @exception NullPointerException if {@code field},
+     * @throws    NullPointerException if {@code field},
      * {@code a}, or {@code b} is null.
-     * @exception IllegalArgumentException if {@code a}
+     * @throws    IllegalArgumentException if {@code a}
      * or {@code b} is not null and not in {@code field}.
      */
     public EllipticCurve(ECField field, BigInteger a,
--- a/src/java.base/share/classes/java/security/spec/MGF1ParameterSpec.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/spec/MGF1ParameterSpec.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -116,7 +116,7 @@
      *
      * @param mdName the algorithm name for the message digest
      * used in this mask generation function MGF1.
-     * @exception NullPointerException if {@code mdName} is null.
+     * @throws    NullPointerException if {@code mdName} is null.
      */
     public MGF1ParameterSpec(String mdName) {
         if (mdName == null) {
--- a/src/java.base/share/classes/java/security/spec/PSSParameterSpec.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/spec/PSSParameterSpec.java	Tue Sep 24 15:19:35 2019 -0400
@@ -128,9 +128,9 @@
      *         getMGFParameters().
      * @param saltLen      the length of salt
      * @param trailerField the value of the trailer field
-     * @exception NullPointerException if {@code mdName}, or {@code mgfName}
+     * @throws    NullPointerException if {@code mdName}, or {@code mgfName}
      *         is null
-     * @exception IllegalArgumentException if {@code saltLen} or
+     * @throws    IllegalArgumentException if {@code saltLen} or
      *         {@code trailerField} is less than 0
      * @since 1.5
      */
@@ -161,7 +161,7 @@
      *
      * @param saltLen the length of salt in bytes to be used in PKCS#1
      *         PSS encoding
-     * @exception IllegalArgumentException if {@code saltLen} is
+     * @throws    IllegalArgumentException if {@code saltLen} is
      *         less than 0
      */
     public PSSParameterSpec(int saltLen) {
--- a/src/java.base/share/classes/java/security/spec/RSAOtherPrimeInfo.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/security/spec/RSAOtherPrimeInfo.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,7 @@
     * @param primeExponent the exponent.
     * @param crtCoefficient the Chinese Remainder Theorem
     * coefficient.
-    * @exception NullPointerException if any of the parameters, i.e.
+    * @throws    NullPointerException if any of the parameters, i.e.
     * {@code prime}, {@code primeExponent},
     * {@code crtCoefficient}, is null.
     *
--- a/src/java.base/share/classes/java/text/AttributedString.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/text/AttributedString.java	Tue Sep 24 15:19:35 2019 -0400
@@ -117,7 +117,7 @@
     /**
      * Constructs an AttributedString instance with the given text.
      * @param text The text for this attributed string.
-     * @exception NullPointerException if <code>text</code> is null.
+     * @throws    NullPointerException if {@code text} is null.
      */
     public AttributedString(String text) {
         if (text == null) {
@@ -130,9 +130,9 @@
      * Constructs an AttributedString instance with the given text and attributes.
      * @param text The text for this attributed string.
      * @param attributes The attributes that apply to the entire string.
-     * @exception NullPointerException if <code>text</code> or
-     *            <code>attributes</code> is null.
-     * @exception IllegalArgumentException if the text has length 0
+     * @throws    NullPointerException if {@code text} or
+     *            {@code attributes} is null.
+     * @throws    IllegalArgumentException if the text has length 0
      * and the attributes parameter is not an empty Map (attributes
      * cannot be applied to a 0-length range).
      */
@@ -171,7 +171,7 @@
      * Constructs an AttributedString instance with the given attributed
      * text represented by AttributedCharacterIterator.
      * @param text The text for this attributed string.
-     * @exception NullPointerException if <code>text</code> is null.
+     * @throws    NullPointerException if {@code text} is null.
      */
     public AttributedString(AttributedCharacterIterator text) {
         // If performance is critical, this constructor should be
@@ -192,8 +192,8 @@
      * @param beginIndex Index of the first character of the range.
      * @param endIndex Index of the character following the last character
      * of the range.
-     * @exception NullPointerException if <code>text</code> is null.
-     * @exception IllegalArgumentException if the subrange given by
+     * @throws    NullPointerException if {@code text} is null.
+     * @throws    IllegalArgumentException if the subrange given by
      * beginIndex and endIndex is out of the text range.
      * @see java.text.Annotation
      */
@@ -220,8 +220,8 @@
      * @param attributes Specifies attributes to be extracted
      * from the text. If null is specified, all available attributes will
      * be used.
-     * @exception NullPointerException if <code>text</code> is null.
-     * @exception IllegalArgumentException if the subrange given by
+     * @throws    NullPointerException if {@code text} is null.
+     * @throws    IllegalArgumentException if the subrange given by
      * beginIndex and endIndex is out of the text range.
      * @see java.text.Annotation
      */
@@ -307,8 +307,8 @@
      * Adds an attribute to the entire string.
      * @param attribute the attribute key
      * @param value the value of the attribute; may be null
-     * @exception NullPointerException if <code>attribute</code> is null.
-     * @exception IllegalArgumentException if the AttributedString has length 0
+     * @throws    NullPointerException if {@code attribute} is null.
+     * @throws    IllegalArgumentException if the AttributedString has length 0
      * (attributes cannot be applied to a 0-length range).
      */
     public void addAttribute(Attribute attribute, Object value) {
@@ -331,8 +331,8 @@
      * @param value The value of the attribute. May be null.
      * @param beginIndex Index of the first character of the range.
      * @param endIndex Index of the character following the last character of the range.
-     * @exception NullPointerException if <code>attribute</code> is null.
-     * @exception IllegalArgumentException if beginIndex is less than 0, endIndex is
+     * @throws    NullPointerException if {@code attribute} is null.
+     * @throws    IllegalArgumentException if beginIndex is less than 0, endIndex is
      * greater than the length of the string, or beginIndex and endIndex together don't
      * define a non-empty subrange of the string.
      */
@@ -356,8 +356,8 @@
      * @param beginIndex Index of the first character of the range.
      * @param endIndex Index of the character following the last
      * character of the range.
-     * @exception NullPointerException if <code>attributes</code> is null.
-     * @exception IllegalArgumentException if beginIndex is less than
+     * @throws    NullPointerException if {@code attributes} is null.
+     * @throws    IllegalArgumentException if beginIndex is less than
      * 0, endIndex is greater than the length of the string, or
      * beginIndex and endIndex together don't define a non-empty
      * subrange of the string and the attributes parameter is not an
@@ -580,7 +580,7 @@
      * @param beginIndex the index of the first character
      * @param endIndex the index of the character following the last character
      * @return an iterator providing access to the text and its attributes
-     * @exception IllegalArgumentException if beginIndex is less than 0,
+     * @throws    IllegalArgumentException if beginIndex is less than 0,
      * endIndex is greater than the length of the string, or beginIndex is
      * greater than endIndex.
      */
--- a/src/java.base/share/classes/java/text/Bidi.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/text/Bidi.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,7 +261,7 @@
 
     /**
      * Return the level of the nth logical run in this line.
-     * @param run the index of the run, between 0 and <code>getRunCount()</code>
+     * @param run the index of the run, between 0 and {@code getRunCount()}
      * @return the level of the run
      */
     public int getRunLevel(int run) {
@@ -271,7 +271,7 @@
     /**
      * Return the index of the character at the start of the nth logical run in this line, as
      * an offset from the start of the line.
-     * @param run the index of the run, between 0 and <code>getRunCount()</code>
+     * @param run the index of the run, between 0 and {@code getRunCount()}
      * @return the start of the run
      */
     public int getRunStart(int run) {
@@ -282,7 +282,7 @@
      * Return the index of the character past the end of the nth logical run in this line, as
      * an offset from the start of the line.  For example, this will return the length
      * of the line for the last run on the line.
-     * @param run the index of the run, between 0 and <code>getRunCount()</code>
+     * @param run the index of the run, between 0 and {@code getRunCount()}
      * @return limit the limit of the run
      */
     public int getRunLimit(int run) {
@@ -308,11 +308,11 @@
      * Reorder the objects in the array into visual order based on their levels.
      * This is a utility function to use when you have a collection of objects
      * representing runs of text in logical order, each run containing text
-     * at a single level.  The elements at <code>index</code> from
-     * <code>objectStart</code> up to <code>objectStart + count</code>
+     * at a single level.  The elements at {@code index} from
+     * {@code objectStart} up to {@code objectStart + count}
      * in the objects array will be reordered into visual order assuming
      * each run of text has the level indicated by the corresponding element
-     * in the levels array (at <code>index - objectStart + levelStart</code>).
+     * in the levels array (at {@code index - objectStart + levelStart}).
      *
      * @param levels an array representing the bidi level of each object
      * @param levelStart the start position in the levels array
--- a/src/java.base/share/classes/java/text/BreakIterator.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/text/BreakIterator.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,23 +48,23 @@
 
 
 /**
- * The <code>BreakIterator</code> class implements methods for finding
- * the location of boundaries in text. Instances of <code>BreakIterator</code>
+ * The {@code BreakIterator} class implements methods for finding
+ * the location of boundaries in text. Instances of {@code BreakIterator}
  * maintain a current position and scan over text
  * returning the index of characters where boundaries occur.
- * Internally, <code>BreakIterator</code> scans text using a
- * <code>CharacterIterator</code>, and is thus able to scan text held
- * by any object implementing that protocol. A <code>StringCharacterIterator</code>
- * is used to scan <code>String</code> objects passed to <code>setText</code>.
+ * Internally, {@code BreakIterator} scans text using a
+ * {@code CharacterIterator}, and is thus able to scan text held
+ * by any object implementing that protocol. A {@code StringCharacterIterator}
+ * is used to scan {@code String} objects passed to {@code setText}.
  *
  * <p>
  * You use the factory methods provided by this class to create
  * instances of various types of break iterators. In particular,
- * use <code>getWordInstance</code>, <code>getLineInstance</code>,
- * <code>getSentenceInstance</code>, and <code>getCharacterInstance</code>
- * to create <code>BreakIterator</code>s that perform
+ * use {@code getWordInstance}, {@code getLineInstance},
+ * {@code getSentenceInstance}, and {@code getCharacterInstance}
+ * to create {@code BreakIterator}s that perform
  * word, line, sentence, and character boundary analysis respectively.
- * A single <code>BreakIterator</code> can work only on one unit
+ * A single {@code BreakIterator} can work only on one unit
  * (word, line, sentence, and so on). You must use a different iterator
  * for each unit boundary analysis you wish to perform.
  *
@@ -100,7 +100,7 @@
  * differ between languages.
  *
  * <p>
- * The <code>BreakIterator</code> instances returned by the factory methods
+ * The {@code BreakIterator} instances returned by the factory methods
  * of this class are intended for use with natural languages only, not for
  * programming language text. It is however possible to define subclasses
  * that tokenize a programming language.
@@ -274,31 +274,31 @@
     /**
      * Returns the nth boundary from the current boundary. If either
      * the first or last text boundary has been reached, it returns
-     * <code>BreakIterator.DONE</code> and the current position is set to either
+     * {@code BreakIterator.DONE} and the current position is set to either
      * the first or last text boundary depending on which one is reached. Otherwise,
      * the iterator's current position is set to the new boundary.
      * For example, if the iterator's current position is the mth text boundary
      * and three more boundaries exist from the current boundary to the last text
      * boundary, the next(2) call will return m + 2. The new text position is set
      * to the (m + 2)th text boundary. A next(4) call would return
-     * <code>BreakIterator.DONE</code> and the last text boundary would become the
+     * {@code BreakIterator.DONE} and the last text boundary would become the
      * new text position.
      * @param n which boundary to return.  A value of 0
      * does nothing.  Negative values move to previous boundaries
      * and positive values move to later boundaries.
      * @return The character index of the nth boundary from the current position
-     * or <code>BreakIterator.DONE</code> if either first or last text boundary
+     * or {@code BreakIterator.DONE} if either first or last text boundary
      * has been reached.
      */
     public abstract int next(int n);
 
     /**
      * Returns the boundary following the current boundary. If the current boundary
-     * is the last text boundary, it returns <code>BreakIterator.DONE</code> and
+     * is the last text boundary, it returns {@code BreakIterator.DONE} and
      * the iterator's current position is unchanged. Otherwise, the iterator's
      * current position is set to the boundary following the current boundary.
      * @return The character index of the next text boundary or
-     * <code>BreakIterator.DONE</code> if the current boundary is the last text
+     * {@code BreakIterator.DONE} if the current boundary is the last text
      * boundary.
      * Equivalent to next(1).
      * @see #next(int)
@@ -307,11 +307,11 @@
 
     /**
      * Returns the boundary preceding the current boundary. If the current boundary
-     * is the first text boundary, it returns <code>BreakIterator.DONE</code> and
+     * is the first text boundary, it returns {@code BreakIterator.DONE} and
      * the iterator's current position is unchanged. Otherwise, the iterator's
      * current position is set to the boundary preceding the current boundary.
      * @return The character index of the previous text boundary or
-     * <code>BreakIterator.DONE</code> if the current boundary is the first text
+     * {@code BreakIterator.DONE} if the current boundary is the first text
      * boundary.
      */
     public abstract int previous();
@@ -319,15 +319,15 @@
     /**
      * Returns the first boundary following the specified character offset. If the
      * specified offset equals to the last text boundary, it returns
-     * <code>BreakIterator.DONE</code> and the iterator's current position is unchanged.
+     * {@code BreakIterator.DONE} and the iterator's current position is unchanged.
      * Otherwise, the iterator's current position is set to the returned boundary.
      * The value returned is always greater than the offset or the value
-     * <code>BreakIterator.DONE</code>.
+     * {@code BreakIterator.DONE}.
      * @param offset the character offset to begin scanning.
      * @return The first boundary after the specified offset or
-     * <code>BreakIterator.DONE</code> if the last text boundary is passed in
+     * {@code BreakIterator.DONE} if the last text boundary is passed in
      * as the offset.
-     * @exception  IllegalArgumentException if the specified offset is less than
+     * @throws     IllegalArgumentException if the specified offset is less than
      * the first text boundary or greater than the last text boundary.
      */
     public abstract int following(int offset);
@@ -335,15 +335,15 @@
     /**
      * Returns the last boundary preceding the specified character offset. If the
      * specified offset equals to the first text boundary, it returns
-     * <code>BreakIterator.DONE</code> and the iterator's current position is unchanged.
+     * {@code BreakIterator.DONE} and the iterator's current position is unchanged.
      * Otherwise, the iterator's current position is set to the returned boundary.
      * The value returned is always less than the offset or the value
-     * <code>BreakIterator.DONE</code>.
+     * {@code BreakIterator.DONE}.
      * @param offset the character offset to begin scanning.
      * @return The last boundary before the specified offset or
-     * <code>BreakIterator.DONE</code> if the first text boundary is passed in
+     * {@code BreakIterator.DONE} if the first text boundary is passed in
      * as the offset.
-     * @exception   IllegalArgumentException if the specified offset is less than
+     * @throws      IllegalArgumentException if the specified offset is less than
      * the first text boundary or greater than the last text boundary.
      * @since 1.2
      */
@@ -361,9 +361,9 @@
     /**
      * Returns true if the specified character offset is a text boundary.
      * @param offset the character offset to check.
-     * @return <code>true</code> if "offset" is a boundary position,
-     * <code>false</code> otherwise.
-     * @exception   IllegalArgumentException if the specified offset is less than
+     * @return {@code true} if "offset" is a boundary position,
+     * {@code false} otherwise.
+     * @throws      IllegalArgumentException if the specified offset is less than
      * the first text boundary or greater than the last text boundary.
      * @since 1.2
      */
@@ -390,7 +390,7 @@
      * Returns character index of the text boundary that was most
      * recently returned by next(), next(int), previous(), first(), last(),
      * following(int) or preceding(int). If any of these methods returns
-     * <code>BreakIterator.DONE</code> because either first or last text boundary
+     * {@code BreakIterator.DONE} because either first or last text boundary
      * has been reached, it returns the first or last text boundary depending on
      * which one is reached.
      * @return The text boundary returned from the above methods, first or last
@@ -437,7 +437,7 @@
     private static final SoftReference<BreakIteratorCache>[] iterCache = (SoftReference<BreakIteratorCache>[]) new SoftReference<?>[4];
 
     /**
-     * Returns a new <code>BreakIterator</code> instance
+     * Returns a new {@code BreakIterator} instance
      * for <a href="BreakIterator.html#word">word breaks</a>
      * for the {@linkplain Locale#getDefault() default locale}.
      * @return A break iterator for word breaks
@@ -448,12 +448,12 @@
     }
 
     /**
-     * Returns a new <code>BreakIterator</code> instance
+     * Returns a new {@code BreakIterator} instance
      * for <a href="BreakIterator.html#word">word breaks</a>
      * for the given locale.
      * @param locale the desired locale
      * @return A break iterator for word breaks
-     * @exception NullPointerException if <code>locale</code> is null
+     * @throws    NullPointerException if {@code locale} is null
      */
     public static BreakIterator getWordInstance(Locale locale)
     {
@@ -461,7 +461,7 @@
     }
 
     /**
-     * Returns a new <code>BreakIterator</code> instance
+     * Returns a new {@code BreakIterator} instance
      * for <a href="BreakIterator.html#line">line breaks</a>
      * for the {@linkplain Locale#getDefault() default locale}.
      * @return A break iterator for line breaks
@@ -472,12 +472,12 @@
     }
 
     /**
-     * Returns a new <code>BreakIterator</code> instance
+     * Returns a new {@code BreakIterator} instance
      * for <a href="BreakIterator.html#line">line breaks</a>
      * for the given locale.
      * @param locale the desired locale
      * @return A break iterator for line breaks
-     * @exception NullPointerException if <code>locale</code> is null
+     * @throws    NullPointerException if {@code locale} is null
      */
     public static BreakIterator getLineInstance(Locale locale)
     {
@@ -485,7 +485,7 @@
     }
 
     /**
-     * Returns a new <code>BreakIterator</code> instance
+     * Returns a new {@code BreakIterator} instance
      * for <a href="BreakIterator.html#character">character breaks</a>
      * for the {@linkplain Locale#getDefault() default locale}.
      * @return A break iterator for character breaks
@@ -496,12 +496,12 @@
     }
 
     /**
-     * Returns a new <code>BreakIterator</code> instance
+     * Returns a new {@code BreakIterator} instance
      * for <a href="BreakIterator.html#character">character breaks</a>
      * for the given locale.
      * @param locale the desired locale
      * @return A break iterator for character breaks
-     * @exception NullPointerException if <code>locale</code> is null
+     * @throws    NullPointerException if {@code locale} is null
      */
     public static BreakIterator getCharacterInstance(Locale locale)
     {
@@ -509,7 +509,7 @@
     }
 
     /**
-     * Returns a new <code>BreakIterator</code> instance
+     * Returns a new {@code BreakIterator} instance
      * for <a href="BreakIterator.html#sentence">sentence breaks</a>
      * for the {@linkplain Locale#getDefault() default locale}.
      * @return A break iterator for sentence breaks
@@ -520,12 +520,12 @@
     }
 
     /**
-     * Returns a new <code>BreakIterator</code> instance
+     * Returns a new {@code BreakIterator} instance
      * for <a href="BreakIterator.html#sentence">sentence breaks</a>
      * for the given locale.
      * @param locale the desired locale
      * @return A break iterator for sentence breaks
-     * @exception NullPointerException if <code>locale</code> is null
+     * @throws    NullPointerException if {@code locale} is null
      */
     public static BreakIterator getSentenceInstance(Locale locale)
     {
@@ -580,16 +580,16 @@
 
     /**
      * Returns an array of all locales for which the
-     * <code>get*Instance</code> methods of this class can return
+     * {@code get*Instance} methods of this class can return
      * localized instances.
      * The returned array represents the union of locales supported by the Java
      * runtime and by installed
      * {@link java.text.spi.BreakIteratorProvider BreakIteratorProvider} implementations.
-     * It must contain at least a <code>Locale</code>
+     * It must contain at least a {@code Locale}
      * instance equal to {@link java.util.Locale#US Locale.US}.
      *
      * @return An array of locales for which localized
-     *         <code>BreakIterator</code> instances are available.
+     *         {@code BreakIterator} instances are available.
      */
     public static synchronized Locale[] getAvailableLocales()
     {
--- a/src/java.base/share/classes/java/text/CharacterIteratorFieldDelegate.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/text/CharacterIteratorFieldDelegate.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,16 +28,16 @@
 
 /**
  * CharacterIteratorFieldDelegate combines the notifications from a Format
- * into a resulting <code>AttributedCharacterIterator</code>. The resulting
- * <code>AttributedCharacterIterator</code> can be retrieved by way of
- * the <code>getIterator</code> method.
+ * into a resulting {@code AttributedCharacterIterator}. The resulting
+ * {@code AttributedCharacterIterator} can be retrieved by way of
+ * the {@code getIterator} method.
  *
  */
 class CharacterIteratorFieldDelegate implements Format.FieldDelegate {
     /**
-     * Array of AttributeStrings. Whenever <code>formatted</code> is invoked
+     * Array of AttributeStrings. Whenever {@code formatted} is invoked
      * for a region > size, a new instance of AttributedString is added to
-     * attributedStrings. Subsequent invocations of <code>formatted</code>
+     * attributedStrings. Subsequent invocations of {@code formatted}
      * for existing regions result in invoking addAttribute on the existing
      * AttributedStrings.
      */
@@ -98,7 +98,7 @@
     }
 
     /**
-     * Returns an <code>AttributedCharacterIterator</code> that can be used
+     * Returns an {@code AttributedCharacterIterator} that can be used
      * to iterate over the resulting formatted String.
      *
      * @pararm string Result of formatting.
--- a/src/java.base/share/classes/java/text/ChoiceFormat.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/text/ChoiceFormat.java	Tue Sep 24 15:19:35 2019 -0400
@@ -44,8 +44,8 @@
 import java.util.Arrays;
 
 /**
- * A <code>ChoiceFormat</code> allows you to attach a format to a range of numbers.
- * It is generally used in a <code>MessageFormat</code> for handling plurals.
+ * A {@code ChoiceFormat} allows you to attach a format to a range of numbers.
+ * It is generally used in a {@code MessageFormat} for handling plurals.
  * The choice is specified with an ascending list of doubles, where each item
  * specifies a half-open interval up to the next item:
  * <blockquote>
@@ -60,15 +60,15 @@
  *
  * <p>
  * <strong>Note:</strong>
- * <code>ChoiceFormat</code> differs from the other <code>Format</code>
- * classes in that you create a <code>ChoiceFormat</code> object with a
- * constructor (not with a <code>getInstance</code> style factory
- * method). The factory methods aren't necessary because <code>ChoiceFormat</code>
+ * {@code ChoiceFormat} differs from the other {@code Format}
+ * classes in that you create a {@code ChoiceFormat} object with a
+ * constructor (not with a {@code getInstance} style factory
+ * method). The factory methods aren't necessary because {@code ChoiceFormat}
  * doesn't require any complex setup for a given locale. In fact,
- * <code>ChoiceFormat</code> doesn't implement any locale specific behavior.
+ * {@code ChoiceFormat} doesn't implement any locale specific behavior.
  *
  * <p>
- * When creating a <code>ChoiceFormat</code>, you must specify an array of formats
+ * When creating a {@code ChoiceFormat}, you must specify an array of formats
  * and an array of limits. The length of these arrays must be the same.
  * For example,
  * <ul>
@@ -78,7 +78,7 @@
  * <li>
  *     <em>limits</em> = {0, 1, ChoiceFormat.nextDouble(1)}<br>
  *     <em>formats</em> = {"no files", "one file", "many files"}<br>
- *     (<code>nextDouble</code> can be used to get the next higher double, to
+ *     ({@code nextDouble} can be used to get the next higher double, to
  *     make the half-open interval.)
  * </ul>
  *
@@ -174,7 +174,7 @@
     /**
      * Sets the pattern.
      * @param newPattern See the class description.
-     * @exception NullPointerException if {@code newPattern}
+     * @throws    NullPointerException if {@code newPattern}
      *            is {@code null}
      */
     public void applyPattern(String newPattern) {
@@ -313,7 +313,7 @@
      * Constructs with limits and corresponding formats based on the pattern.
      *
      * @param newPattern the new pattern string
-     * @exception NullPointerException if {@code newPattern} is
+     * @throws    NullPointerException if {@code newPattern} is
      *            {@code null}
      * @see #applyPattern
      */
@@ -326,7 +326,7 @@
      *
      * @param limits limits in ascending order
      * @param formats corresponding format strings
-     * @exception NullPointerException if {@code limits} or {@code formats}
+     * @throws    NullPointerException if {@code limits} or {@code formats}
      *            is {@code null}
      * @see #setChoices
      */
@@ -347,7 +347,7 @@
      * When formatting with object Y,
      * if the object is a NumberFormat, then ((NumberFormat) Y).format(X)
      * is called. Otherwise Y.toString() is called.
-     * @exception NullPointerException if {@code limits} or
+     * @throws    NullPointerException if {@code limits} or
      *            {@code formats} is {@code null}
      */
     public void setChoices(double[] limits, String formats[]) {
@@ -381,7 +381,7 @@
 
     /**
      * Specialization of format. This method really calls
-     * <code>format(double, StringBuffer, FieldPosition)</code>
+     * {@code format(double, StringBuffer, FieldPosition)}
      * thus the range of longs that are supported is only equal to
      * the range that can be stored by double. This will never be
      * a practical limitation.
@@ -396,7 +396,7 @@
      * @param number number to be formatted and substituted.
      * @param toAppendTo where text is appended.
      * @param status ignore no useful status is returned.
-     * @exception NullPointerException if {@code toAppendTo}
+     * @throws    NullPointerException if {@code toAppendTo}
      *            is {@code null}
      */
    public StringBuffer format(double number, StringBuffer toAppendTo,
@@ -426,7 +426,7 @@
      * status.index is unchanged and status.errorIndex is set to the
      * first index of the character that caused the parse to fail.
      * @return A Number representing the value of the number parsed.
-     * @exception NullPointerException if {@code status} is {@code null}
+     * @throws    NullPointerException if {@code status} is {@code null}
      *            or if {@code text} is {@code null} and the list of
      *            choice strings is not empty.
      */
@@ -542,16 +542,16 @@
 
     /**
      * A list of lower bounds for the choices.  The formatter will return
-     * <code>choiceFormats[i]</code> if the number being formatted is greater than or equal to
-     * <code>choiceLimits[i]</code> and less than <code>choiceLimits[i+1]</code>.
+     * {@code choiceFormats[i]} if the number being formatted is greater than or equal to
+     * {@code choiceLimits[i]} and less than {@code choiceLimits[i+1]}.
      * @serial
      */
     private double[] choiceLimits;
 
     /**
      * A list of choice strings.  The formatter will return
-     * <code>choiceFormats[i]</code> if the number being formatted is greater than or equal to
-     * <code>choiceLimits[i]</code> and less than <code>choiceLimits[i+1]</code>.
+     * {@code choiceFormats[i]} if the number being formatted is greater than or equal to
+     * {@code choiceLimits[i]} and less than {@code choiceLimits[i+1]}.
      * @serial
      */
     private String[] choiceFormats;
--- a/src/java.base/share/classes/java/text/CollationElementIterator.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/text/CollationElementIterator.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,7 +44,7 @@
 import sun.text.normalizer.NormalizerBase;
 
 /**
- * The <code>CollationElementIterator</code> class is used as an iterator
+ * The {@code CollationElementIterator} class is used as an iterator
  * to walk through each character of an international string. Use the iterator
  * to return the ordering priority of the positioned character. The ordering
  * priority of a character, which we refer to as a key, defines how a character
@@ -68,9 +68,9 @@
  * The key of a character is an integer composed of primary order(short),
  * secondary order(byte), and tertiary order(byte). Java strictly defines
  * the size and signedness of its primitive data types. Therefore, the static
- * functions <code>primaryOrder</code>, <code>secondaryOrder</code>, and
- * <code>tertiaryOrder</code> return <code>int</code>, <code>short</code>,
- * and <code>short</code> respectively to ensure the correctness of the key
+ * functions {@code primaryOrder}, {@code secondaryOrder}, and
+ * {@code tertiaryOrder} return {@code int}, {@code short},
+ * and {@code short} respectively to ensure the correctness of the key
  * value.
  *
  * <p>
@@ -90,16 +90,16 @@
  * </blockquote>
  *
  * <p>
- * <code>CollationElementIterator.next</code> returns the collation order
+ * {@code CollationElementIterator.next} returns the collation order
  * of the next character. A collation order consists of primary order,
  * secondary order and tertiary order. The data type of the collation
  * order is <strong>int</strong>. The first 16 bits of a collation order
  * is its primary order; the next 8 bits is the secondary order and the
  * last 8 bits is the tertiary order.
  *
- * <p><b>Note:</b> <code>CollationElementIterator</code> is a part of
- * <code>RuleBasedCollator</code> implementation. It is only usable
- * with <code>RuleBasedCollator</code> instances.
+ * <p><b>Note:</b> {@code CollationElementIterator} is a part of
+ * {@code RuleBasedCollator} implementation. It is only usable
+ * with {@code RuleBasedCollator} instances.
  *
  * @see                Collator
  * @see                RuleBasedCollator
--- a/src/java.base/share/classes/java/text/CollationKey.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/text/CollationKey.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,34 +39,34 @@
 package java.text;
 
 /**
- * A <code>CollationKey</code> represents a <code>String</code> under the
- * rules of a specific <code>Collator</code> object. Comparing two
- * <code>CollationKey</code>s returns the relative order of the
- * <code>String</code>s they represent. Using <code>CollationKey</code>s
- * to compare <code>String</code>s is generally faster than using
- * <code>Collator.compare</code>. Thus, when the <code>String</code>s
+ * A {@code CollationKey} represents a {@code String} under the
+ * rules of a specific {@code Collator} object. Comparing two
+ * {@code CollationKey}s returns the relative order of the
+ * {@code String}s they represent. Using {@code CollationKey}s
+ * to compare {@code String}s is generally faster than using
+ * {@code Collator.compare}. Thus, when the {@code String}s
  * must be compared multiple times, for example when sorting a list
- * of <code>String</code>s. It's more efficient to use <code>CollationKey</code>s.
+ * of {@code String}s. It's more efficient to use {@code CollationKey}s.
  *
  * <p>
- * You can not create <code>CollationKey</code>s directly. Rather,
- * generate them by calling <code>Collator.getCollationKey</code>.
- * You can only compare <code>CollationKey</code>s generated from
- * the same <code>Collator</code> object.
+ * You can not create {@code CollationKey}s directly. Rather,
+ * generate them by calling {@code Collator.getCollationKey}.
+ * You can only compare {@code CollationKey}s generated from
+ * the same {@code Collator} object.
  *
  * <p>
- * Generating a <code>CollationKey</code> for a <code>String</code>
- * involves examining the entire <code>String</code>
+ * Generating a {@code CollationKey} for a {@code String}
+ * involves examining the entire {@code String}
  * and converting it to series of bits that can be compared bitwise. This
  * allows fast comparisons once the keys are generated. The cost of generating
- * keys is recouped in faster comparisons when <code>String</code>s need
+ * keys is recouped in faster comparisons when {@code String}s need
  * to be compared many times. On the other hand, the result of a comparison
- * is often determined by the first couple of characters of each <code>String</code>.
- * <code>Collator.compare</code> examines only as many characters as it needs which
+ * is often determined by the first couple of characters of each {@code String}.
+ * {@code Collator.compare} examines only as many characters as it needs which
  * allows it to be faster when doing single comparisons.
  * <p>
- * The following example shows how <code>CollationKey</code>s might be used
- * to sort a list of <code>String</code>s.
+ * The following example shows how {@code CollationKey}s might be used
+ * to sort a list of {@code String}s.
  * <blockquote>
  * <pre>{@code
  * // Create an array of CollationKeys for the Strings to be sorted.
@@ -136,7 +136,7 @@
    * CollationKey constructor.
    *
    * @param source the source string
-   * @exception NullPointerException if {@code source} is null
+   * @throws    NullPointerException if {@code source} is null
    * @since 1.6
    */
     protected CollationKey(String source) {
--- a/src/java.base/share/classes/java/text/Collator.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/text/Collator.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -49,28 +49,28 @@
 
 
 /**
- * The <code>Collator</code> class performs locale-sensitive
- * <code>String</code> comparison. You use this class to build
+ * The {@code Collator} class performs locale-sensitive
+ * {@code String} comparison. You use this class to build
  * searching and sorting routines for natural language text.
  *
  * <p>
- * <code>Collator</code> is an abstract base class. Subclasses
+ * {@code Collator} is an abstract base class. Subclasses
  * implement specific collation strategies. One subclass,
- * <code>RuleBasedCollator</code>, is currently provided with
+ * {@code RuleBasedCollator}, is currently provided with
  * the Java Platform and is applicable to a wide set of languages. Other
  * subclasses may be created to handle more specialized needs.
  *
  * <p>
  * Like other locale-sensitive classes, you can use the static
- * factory method, <code>getInstance</code>, to obtain the appropriate
- * <code>Collator</code> object for a given locale. You will only need
- * to look at the subclasses of <code>Collator</code> if you need
+ * factory method, {@code getInstance}, to obtain the appropriate
+ * {@code Collator} object for a given locale. You will only need
+ * to look at the subclasses of {@code Collator} if you need
  * to understand the details of a particular collation strategy or
  * if you need to modify that strategy.
  *
  * <p>
  * The following example shows how to compare two strings using
- * the <code>Collator</code> for the default locale.
+ * the {@code Collator} for the default locale.
  * <blockquote>
  * <pre>{@code
  * // Compare two strings in the default locale
@@ -83,10 +83,10 @@
  * </blockquote>
  *
  * <p>
- * You can set a <code>Collator</code>'s <em>strength</em> property
+ * You can set a {@code Collator}'s <em>strength</em> property
  * to determine the level of difference considered significant in
- * comparisons. Four strengths are provided: <code>PRIMARY</code>,
- * <code>SECONDARY</code>, <code>TERTIARY</code>, and <code>IDENTICAL</code>.
+ * comparisons. Four strengths are provided: {@code PRIMARY},
+ * {@code SECONDARY}, {@code TERTIARY}, and {@code IDENTICAL}.
  * The exact assignment of strengths to language features is
  * locale dependent.  For example, in Czech, "e" and "f" are considered
  * primary differences, while "e" and "&#283;" are secondary differences,
@@ -104,19 +104,19 @@
  * </pre>
  * </blockquote>
  * <p>
- * For comparing <code>String</code>s exactly once, the <code>compare</code>
+ * For comparing {@code String}s exactly once, the {@code compare}
  * method provides the best performance. When sorting a list of
- * <code>String</code>s however, it is generally necessary to compare each
- * <code>String</code> multiple times. In this case, <code>CollationKey</code>s
- * provide better performance. The <code>CollationKey</code> class converts
- * a <code>String</code> to a series of bits that can be compared bitwise
- * against other <code>CollationKey</code>s. A <code>CollationKey</code> is
- * created by a <code>Collator</code> object for a given <code>String</code>.
+ * {@code String}s however, it is generally necessary to compare each
+ * {@code String} multiple times. In this case, {@code CollationKey}s
+ * provide better performance. The {@code CollationKey} class converts
+ * a {@code String} to a series of bits that can be compared bitwise
+ * against other {@code CollationKey}s. A {@code CollationKey} is
+ * created by a {@code Collator} object for a given {@code String}.
  * <br>
- * <strong>Note:</strong> <code>CollationKey</code>s from different
- * <code>Collator</code>s can not be compared. See the class description
+ * <strong>Note:</strong> {@code CollationKey}s from different
+ * {@code Collator}s can not be compared. See the class description
  * for {@link CollationKey}
- * for an example using <code>CollationKey</code>s.
+ * for an example using {@code CollationKey}s.
  *
  * @see         RuleBasedCollator
  * @see         CollationKey
@@ -291,12 +291,12 @@
      * to, or greater than the second.
      * <p>
      * This implementation merely returns
-     *  <code> compare((String)o1, (String)o2) </code>.
+     *  {@code  compare((String)o1, (String)o2) }.
      *
      * @return a negative integer, zero, or a positive integer as the
      *         first argument is less than, equal to, or greater than the
      *         second.
-     * @exception ClassCastException the arguments cannot be cast to Strings.
+     * @throws    ClassCastException the arguments cannot be cast to Strings.
      * @see java.util.Comparator
      * @since   1.2
      */
@@ -358,7 +358,7 @@
      * @see java.text.Collator#SECONDARY
      * @see java.text.Collator#TERTIARY
      * @see java.text.Collator#IDENTICAL
-     * @exception  IllegalArgumentException If the new strength value is not one of
+     * @throws     IllegalArgumentException If the new strength value is not one of
      * PRIMARY, SECONDARY, TERTIARY or IDENTICAL.
      */
     public synchronized void setStrength(int newStrength) {
@@ -402,7 +402,7 @@
      * @see java.text.Collator#NO_DECOMPOSITION
      * @see java.text.Collator#CANONICAL_DECOMPOSITION
      * @see java.text.Collator#FULL_DECOMPOSITION
-     * @exception IllegalArgumentException If the given value is not a valid decomposition
+     * @throws    IllegalArgumentException If the given value is not a valid decomposition
      * mode.
      */
     public synchronized void setDecomposition(int decompositionMode) {
@@ -416,7 +416,7 @@
 
     /**
      * Returns an array of all locales for which the
-     * <code>getInstance</code> methods of this class can return
+     * {@code getInstance} methods of this class can return
      * localized instances.
      * The returned array represents the union of locales supported
      * by the Java runtime and by installed
@@ -425,7 +425,7 @@
      * {@link java.util.Locale#US Locale.US}.
      *
      * @return An array of locales for which localized
-     *         <code>Collator</code> instances are available.
+     *         {@code Collator} instances are available.
      */
     public static synchronized Locale[] getAvailableLocales() {
         LocaleServiceProviderPool pool =
--- a/src/java.base/share/classes/java/text/CompactNumberFormat.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/text/CompactNumberFormat.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1342,7 +1342,7 @@
      * @param pos  a {@code ParsePosition} object with index and error
      *             index information as described above
      * @return the parsed value, or {@code null} if the parse fails
-     * @exception  NullPointerException if {@code text} or
+     * @throws     NullPointerException if {@code text} or
      *             {@code pos} is null
      *
      */
@@ -2143,4 +2143,3 @@
     }
 
 }
-
--- a/src/java.base/share/classes/java/text/DateFormat.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/text/DateFormat.java	Tue Sep 24 15:19:35 2019 -0400
@@ -58,7 +58,7 @@
  * formats and parses dates or time in a language-independent manner.
  * The date/time formatting subclass, such as {@link SimpleDateFormat}, allows for
  * formatting (i.e., date &rarr; text), parsing (text &rarr; date), and
- * normalization.  The date is represented as a <code>Date</code> object or
+ * normalization.  The date is represented as a {@code Date} object or
  * as the milliseconds since January 1, 1970, 00:00:00 GMT.
  *
  * <p>{@code DateFormat} provides many class methods for obtaining default date/time
@@ -185,15 +185,15 @@
      *
      * <p>Subclasses should initialize this field to a {@link Calendar}
      * appropriate for the {@link Locale} associated with this
-     * <code>DateFormat</code>.
+     * {@code DateFormat}.
      * @serial
      */
     protected Calendar calendar;
 
     /**
-     * The number formatter that <code>DateFormat</code> uses to format numbers
+     * The number formatter that {@code DateFormat} uses to format numbers
      * in dates and times.  Subclasses should initialize this to a number format
-     * appropriate for the locale associated with this <code>DateFormat</code>.
+     * appropriate for the locale associated with this {@code DateFormat}.
      * @serial
      */
     protected NumberFormat numberFormat;
@@ -323,7 +323,7 @@
      * first occurrence of the timezone pattern character {@code 'z'}.
      * @return the string buffer passed in as {@code toAppendTo},
      *         with formatted text appended.
-     * @exception IllegalArgumentException if the {@code Format} cannot format
+     * @throws    IllegalArgumentException if the {@code Format} cannot format
      *            the given {@code obj}.
      * @see java.text.Format
      */
@@ -383,9 +383,9 @@
      * See the {@link #parse(String, ParsePosition)} method for more information
      * on date parsing.
      *
-     * @param source A <code>String</code> whose beginning should be parsed.
-     * @return A <code>Date</code> parsed from the string.
-     * @exception ParseException if the beginning of the specified string
+     * @param source A {@code String} whose beginning should be parsed.
+     * @return A {@code Date} parsed from the string.
+     * @throws    ParseException if the beginning of the specified string
      *            cannot be parsed.
      */
     public Date parse(String source) throws ParseException
@@ -427,26 +427,26 @@
     public abstract Date parse(String source, ParsePosition pos);
 
     /**
-     * Parses text from a string to produce a <code>Date</code>.
+     * Parses text from a string to produce a {@code Date}.
      * <p>
      * The method attempts to parse text starting at the index given by
-     * <code>pos</code>.
-     * If parsing succeeds, then the index of <code>pos</code> is updated
+     * {@code pos}.
+     * If parsing succeeds, then the index of {@code pos} is updated
      * to the index after the last character used (parsing does not necessarily
      * use all characters up to the end of the string), and the parsed
-     * date is returned. The updated <code>pos</code> can be used to
+     * date is returned. The updated {@code pos} can be used to
      * indicate the starting point for the next call to this method.
-     * If an error occurs, then the index of <code>pos</code> is not
-     * changed, the error index of <code>pos</code> is set to the index of
+     * If an error occurs, then the index of {@code pos} is not
+     * changed, the error index of {@code pos} is set to the index of
      * the character where the error occurred, and null is returned.
      * <p>
      * See the {@link #parse(String, ParsePosition)} method for more information
      * on date parsing.
      *
-     * @param source A <code>String</code>, part of which should be parsed.
-     * @param pos A <code>ParsePosition</code> object with index and error
+     * @param source A {@code String}, part of which should be parsed.
+     * @param pos A {@code ParsePosition} object with index and error
      *            index information as described above.
-     * @return A <code>Date</code> parsed from the string. In case of
+     * @return A {@code Date} parsed from the string. In case of
      *         error, returns null.
      * @throws NullPointerException if {@code source} or {@code pos} is null.
      */
@@ -628,16 +628,16 @@
 
     /**
      * Returns an array of all locales for which the
-     * <code>get*Instance</code> methods of this class can return
+     * {@code get*Instance} methods of this class can return
      * localized instances.
      * The returned array represents the union of locales supported by the Java
      * runtime and by installed
      * {@link java.text.spi.DateFormatProvider DateFormatProvider} implementations.
-     * It must contain at least a <code>Locale</code> instance equal to
+     * It must contain at least a {@code Locale} instance equal to
      * {@link java.util.Locale#US Locale.US}.
      *
      * @return An array of locales for which localized
-     *         <code>DateFormat</code> instances are available.
+     *         {@code DateFormat} instances are available.
      */
     public static Locale[] getAvailableLocales()
     {
@@ -854,9 +854,9 @@
 
     /**
      * Defines constants that are used as attribute keys in the
-     * <code>AttributedCharacterIterator</code> returned
-     * from <code>DateFormat.formatToCharacterIterator</code> and as
-     * field identifiers in <code>FieldPosition</code>.
+     * {@code AttributedCharacterIterator} returned
+     * from {@code DateFormat.formatToCharacterIterator} and as
+     * field identifiers in {@code FieldPosition}.
      * <p>
      * The class also provides two methods to map
      * between its constants and the corresponding Calendar constants.
@@ -881,13 +881,13 @@
         private int calendarField;
 
         /**
-         * Returns the <code>Field</code> constant that corresponds to
-         * the <code>Calendar</code> constant <code>calendarField</code>.
-         * If there is no direct mapping between the <code>Calendar</code>
-         * constant and a <code>Field</code>, null is returned.
+         * Returns the {@code Field} constant that corresponds to
+         * the {@code Calendar} constant {@code calendarField}.
+         * If there is no direct mapping between the {@code Calendar}
+         * constant and a {@code Field}, null is returned.
          *
-         * @throws IllegalArgumentException if <code>calendarField</code> is
-         *         not the value of a <code>Calendar</code> field constant.
+         * @throws IllegalArgumentException if {@code calendarField} is
+         *         not the value of a {@code Calendar} field constant.
          * @param calendarField Calendar field constant
          * @return Field instance representing calendarField.
          * @see java.util.Calendar
@@ -902,14 +902,14 @@
         }
 
         /**
-         * Creates a <code>Field</code>.
+         * Creates a {@code Field}.
          *
-         * @param name the name of the <code>Field</code>
-         * @param calendarField the <code>Calendar</code> constant this
-         *        <code>Field</code> corresponds to; any value, even one
-         *        outside the range of legal <code>Calendar</code> values may
-         *        be used, but <code>-1</code> should be used for values
-         *        that don't correspond to legal <code>Calendar</code> values
+         * @param name the name of the {@code Field}
+         * @param calendarField the {@code Calendar} constant this
+         *        {@code Field} corresponds to; any value, even one
+         *        outside the range of legal {@code Calendar} values may
+         *        be used, but {@code -1} should be used for values
+         *        that don't correspond to legal {@code Calendar} values
          */
         protected Field(String name, int calendarField) {
             super(name);
@@ -924,11 +924,11 @@
         }
 
         /**
-         * Returns the <code>Calendar</code> field associated with this
+         * Returns the {@code Calendar} field associated with this
          * attribute. For example, if this represents the hours field of
-         * a <code>Calendar</code>, this would return
-         * <code>Calendar.HOUR</code>. If there is no corresponding
-         * <code>Calendar</code> constant, this will return -1.
+         * a {@code Calendar}, this would return
+         * {@code Calendar.HOUR}. If there is no corresponding
+         * {@code Calendar} constant, this will return -1.
          *
          * @return Calendar constant for this field
          * @see java.util.Calendar
--- a/src/java.base/share/classes/java/text/DateFormatSymbols.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/text/DateFormatSymbols.java	Tue Sep 24 15:19:35 2019 -0400
@@ -56,22 +56,22 @@
 import sun.util.locale.provider.TimeZoneNameUtility;
 
 /**
- * <code>DateFormatSymbols</code> is a public class for encapsulating
+ * {@code DateFormatSymbols} is a public class for encapsulating
  * localizable date-time formatting data, such as the names of the
  * months, the names of the days of the week, and the time zone data.
- * <code>SimpleDateFormat</code> uses
- * <code>DateFormatSymbols</code> to encapsulate this information.
+ * {@code SimpleDateFormat} uses
+ * {@code DateFormatSymbols} to encapsulate this information.
  *
  * <p>
- * Typically you shouldn't use <code>DateFormatSymbols</code> directly.
+ * Typically you shouldn't use {@code DateFormatSymbols} directly.
  * Rather, you are encouraged to create a date-time formatter with the
- * <code>DateFormat</code> class's factory methods: <code>getTimeInstance</code>,
- * <code>getDateInstance</code>, or <code>getDateTimeInstance</code>.
- * These methods automatically create a <code>DateFormatSymbols</code> for
+ * {@code DateFormat} class's factory methods: {@code getTimeInstance},
+ * {@code getDateInstance}, or {@code getDateTimeInstance}.
+ * These methods automatically create a {@code DateFormatSymbols} for
  * the formatter so that you don't have to. After the
  * formatter is created, you may modify its format pattern using the
- * <code>setPattern</code> method. For more information about
- * creating formatters using <code>DateFormat</code>'s factory methods,
+ * {@code setPattern} method. For more information about
+ * creating formatters using {@code DateFormat}'s factory methods,
  * see {@link DateFormat}.
  *
  * <p>
@@ -88,16 +88,16 @@
  * the symbols are overridden for the designated region.
  *
  * <p>
- * <code>DateFormatSymbols</code> objects are cloneable. When you obtain
- * a <code>DateFormatSymbols</code> object, feel free to modify the
+ * {@code DateFormatSymbols} objects are cloneable. When you obtain
+ * a {@code DateFormatSymbols} object, feel free to modify the
  * date-time formatting data. For instance, you can replace the localized
  * date-time format pattern characters with the ones that you feel easy
  * to remember. Or you can change the representative cities
  * to your favorite ones.
  *
  * <p>
- * New <code>DateFormatSymbols</code> subclasses may be added to support
- * <code>SimpleDateFormat</code> for date-time formatting for additional locales.
+ * New {@code DateFormatSymbols} subclasses may be added to support
+ * {@code SimpleDateFormat} for date-time formatting for additional locales.
 
  * @see          DateFormat
  * @see          SimpleDateFormat
@@ -122,7 +122,7 @@
      * @see #getInstance()
      * @see java.util.Locale#getDefault(java.util.Locale.Category)
      * @see java.util.Locale.Category#FORMAT
-     * @exception  java.util.MissingResourceException
+     * @throws     java.util.MissingResourceException
      *             if the resources for the default locale cannot be
      *             found or cannot be loaded.
      */
@@ -142,7 +142,7 @@
      *
      * @param locale the desired locale
      * @see #getInstance(Locale)
-     * @exception  java.util.MissingResourceException
+     * @throws     java.util.MissingResourceException
      *             if the resources for the specified locale cannot be
      *             found or cannot be loaded.
      */
@@ -159,7 +159,7 @@
 
     /**
      * Era strings. For example: "AD" and "BC".  An array of 2 strings,
-     * indexed by <code>Calendar.BC</code> and <code>Calendar.AD</code>.
+     * indexed by {@code Calendar.BC} and {@code Calendar.AD}.
      * @serial
      */
     String eras[] = null;
@@ -167,7 +167,7 @@
     /**
      * Month strings. For example: "January", "February", etc.  An array
      * of 13 strings (some calendars have 13 months), indexed by
-     * <code>Calendar.JANUARY</code>, <code>Calendar.FEBRUARY</code>, etc.
+     * {@code Calendar.JANUARY}, {@code Calendar.FEBRUARY}, etc.
      * @serial
      */
     String months[] = null;
@@ -175,7 +175,7 @@
     /**
      * Short month strings. For example: "Jan", "Feb", etc.  An array of
      * 13 strings (some calendars have 13 months), indexed by
-     * <code>Calendar.JANUARY</code>, <code>Calendar.FEBRUARY</code>, etc.
+     * {@code Calendar.JANUARY}, {@code Calendar.FEBRUARY}, etc.
 
      * @serial
      */
@@ -183,26 +183,26 @@
 
     /**
      * Weekday strings. For example: "Sunday", "Monday", etc.  An array
-     * of 8 strings, indexed by <code>Calendar.SUNDAY</code>,
-     * <code>Calendar.MONDAY</code>, etc.
-     * The element <code>weekdays[0]</code> is ignored.
+     * of 8 strings, indexed by {@code Calendar.SUNDAY},
+     * {@code Calendar.MONDAY}, etc.
+     * The element {@code weekdays[0]} is ignored.
      * @serial
      */
     String weekdays[] = null;
 
     /**
      * Short weekday strings. For example: "Sun", "Mon", etc.  An array
-     * of 8 strings, indexed by <code>Calendar.SUNDAY</code>,
-     * <code>Calendar.MONDAY</code>, etc.
-     * The element <code>shortWeekdays[0]</code> is ignored.
+     * of 8 strings, indexed by {@code Calendar.SUNDAY},
+     * {@code Calendar.MONDAY}, etc.
+     * The element {@code shortWeekdays[0]} is ignored.
      * @serial
      */
     String shortWeekdays[] = null;
 
     /**
      * AM and PM strings. For example: "AM" and "PM".  An array of
-     * 2 strings, indexed by <code>Calendar.AM</code> and
-     * <code>Calendar.PM</code>.
+     * 2 strings, indexed by {@code Calendar.AM} and
+     * {@code Calendar.PM}.
      * @serial
      */
     String ampms[] = null;
@@ -211,18 +211,18 @@
      * Localized names of time zones in this locale.  This is a
      * two-dimensional array of strings of size <em>n</em> by <em>m</em>,
      * where <em>m</em> is at least 5.  Each of the <em>n</em> rows is an
-     * entry containing the localized names for a single <code>TimeZone</code>.
-     * Each such row contains (with <code>i</code> ranging from
+     * entry containing the localized names for a single {@code TimeZone}.
+     * Each such row contains (with {@code i} ranging from
      * 0..<em>n</em>-1):
      * <ul>
-     * <li><code>zoneStrings[i][0]</code> - time zone ID</li>
-     * <li><code>zoneStrings[i][1]</code> - long name of zone in standard
+     * <li>{@code zoneStrings[i][0]} - time zone ID</li>
+     * <li>{@code zoneStrings[i][1]} - long name of zone in standard
      * time</li>
-     * <li><code>zoneStrings[i][2]</code> - short name of zone in
+     * <li>{@code zoneStrings[i][2]} - short name of zone in
      * standard time</li>
-     * <li><code>zoneStrings[i][3]</code> - long name of zone in daylight
+     * <li>{@code zoneStrings[i][3]} - long name of zone in daylight
      * saving time</li>
-     * <li><code>zoneStrings[i][4]</code> - short name of zone in daylight
+     * <li>{@code zoneStrings[i][4]} - short name of zone in daylight
      * saving time</li>
      * </ul>
      * The zone ID is <em>not</em> localized; it's one of the valid IDs of
@@ -274,8 +274,8 @@
      * wish to use 'u' rather than 'y' to represent years in its date format
      * pattern strings.
      * This string must be exactly 18 characters long, with the index of
-     * the characters described by <code>DateFormat.ERA_FIELD</code>,
-     * <code>DateFormat.YEAR_FIELD</code>, etc.  Thus, if the string were
+     * the characters described by {@code DateFormat.ERA_FIELD},
+     * {@code DateFormat.YEAR_FIELD}, etc.  Thus, if the string were
      * "Xz...", then localized patterns would use 'X' for era and 'z' for year.
      * @serial
      */
@@ -295,16 +295,16 @@
 
     /**
      * Returns an array of all locales for which the
-     * <code>getInstance</code> methods of this class can return
+     * {@code getInstance} methods of this class can return
      * localized instances.
      * The returned array represents the union of locales supported by the
      * Java runtime and by installed
      * {@link java.text.spi.DateFormatSymbolsProvider DateFormatSymbolsProvider}
-     * implementations.  It must contain at least a <code>Locale</code>
+     * implementations.  It must contain at least a {@code Locale}
      * instance equal to {@link java.util.Locale#US Locale.US}.
      *
      * @return An array of locales for which localized
-     *         <code>DateFormatSymbols</code> instances are available.
+     *         {@code DateFormatSymbols} instances are available.
      * @since 1.6
      */
     public static Locale[] getAvailableLocales() {
@@ -314,8 +314,8 @@
     }
 
     /**
-     * Gets the <code>DateFormatSymbols</code> instance for the default
-     * locale.  This method provides access to <code>DateFormatSymbols</code>
+     * Gets the {@code DateFormatSymbols} instance for the default
+     * locale.  This method provides access to {@code DateFormatSymbols}
      * instances for locales supported by the Java runtime itself as well
      * as for those supported by installed
      * {@link java.text.spi.DateFormatSymbolsProvider DateFormatSymbolsProvider}
@@ -324,7 +324,7 @@
      *     getInstance(Locale.getDefault(Locale.Category.FORMAT))}.
      * @see java.util.Locale#getDefault(java.util.Locale.Category)
      * @see java.util.Locale.Category#FORMAT
-     * @return a <code>DateFormatSymbols</code> instance.
+     * @return a {@code DateFormatSymbols} instance.
      * @since 1.6
      */
     public static final DateFormatSymbols getInstance() {
@@ -332,15 +332,15 @@
     }
 
     /**
-     * Gets the <code>DateFormatSymbols</code> instance for the specified
-     * locale.  This method provides access to <code>DateFormatSymbols</code>
+     * Gets the {@code DateFormatSymbols} instance for the specified
+     * locale.  This method provides access to {@code DateFormatSymbols}
      * instances for locales supported by the Java runtime itself as well
      * as for those supported by installed
      * {@link java.text.spi.DateFormatSymbolsProvider DateFormatSymbolsProvider}
      * implementations.
      * @param locale the given locale.
-     * @return a <code>DateFormatSymbols</code> instance.
-     * @exception NullPointerException if <code>locale</code> is null
+     * @return a {@code DateFormatSymbols} instance.
+     * @throws    NullPointerException if {@code locale} is null
      * @since 1.6
      */
     public static final DateFormatSymbols getInstance(Locale locale) {
@@ -538,18 +538,18 @@
      * The value returned is a
      * two-dimensional array of strings of size <em>n</em> by <em>m</em>,
      * where <em>m</em> is at least 5.  Each of the <em>n</em> rows is an
-     * entry containing the localized names for a single <code>TimeZone</code>.
-     * Each such row contains (with <code>i</code> ranging from
+     * entry containing the localized names for a single {@code TimeZone}.
+     * Each such row contains (with {@code i} ranging from
      * 0..<em>n</em>-1):
      * <ul>
-     * <li><code>zoneStrings[i][0]</code> - time zone ID</li>
-     * <li><code>zoneStrings[i][1]</code> - long name of zone in standard
+     * <li>{@code zoneStrings[i][0]} - time zone ID</li>
+     * <li>{@code zoneStrings[i][1]} - long name of zone in standard
      * time</li>
-     * <li><code>zoneStrings[i][2]</code> - short name of zone in
+     * <li>{@code zoneStrings[i][2]} - short name of zone in
      * standard time</li>
-     * <li><code>zoneStrings[i][3]</code> - long name of zone in daylight
+     * <li>{@code zoneStrings[i][3]} - long name of zone in daylight
      * saving time</li>
-     * <li><code>zoneStrings[i][4]</code> - short name of zone in daylight
+     * <li>{@code zoneStrings[i][4]} - short name of zone in daylight
      * saving time</li>
      * </ul>
      * The zone ID is <em>not</em> localized; it's one of the valid IDs of
@@ -559,7 +559,7 @@
      * daylight saving time, the daylight saving time names should not be used.
      * <p>
      * If {@link #setZoneStrings(String[][]) setZoneStrings} has been called
-     * on this <code>DateFormatSymbols</code> instance, then the strings
+     * on this {@code DateFormatSymbols} instance, then the strings
      * provided by that call are returned. Otherwise, the returned array
      * contains names provided by the Java runtime and by installed
      * {@link java.util.spi.TimeZoneNameProvider TimeZoneNameProvider}
@@ -576,18 +576,18 @@
      * Sets time zone strings.  The argument must be a
      * two-dimensional array of strings of size <em>n</em> by <em>m</em>,
      * where <em>m</em> is at least 5.  Each of the <em>n</em> rows is an
-     * entry containing the localized names for a single <code>TimeZone</code>.
-     * Each such row contains (with <code>i</code> ranging from
+     * entry containing the localized names for a single {@code TimeZone}.
+     * Each such row contains (with {@code i} ranging from
      * 0..<em>n</em>-1):
      * <ul>
-     * <li><code>zoneStrings[i][0]</code> - time zone ID</li>
-     * <li><code>zoneStrings[i][1]</code> - long name of zone in standard
+     * <li>{@code zoneStrings[i][0]} - time zone ID</li>
+     * <li>{@code zoneStrings[i][1]} - long name of zone in standard
      * time</li>
-     * <li><code>zoneStrings[i][2]</code> - short name of zone in
+     * <li>{@code zoneStrings[i][2]} - short name of zone in
      * standard time</li>
-     * <li><code>zoneStrings[i][3]</code> - long name of zone in daylight
+     * <li>{@code zoneStrings[i][3]} - long name of zone in daylight
      * saving time</li>
-     * <li><code>zoneStrings[i][4]</code> - short name of zone in daylight
+     * <li>{@code zoneStrings[i][4]} - short name of zone in daylight
      * saving time</li>
      * </ul>
      * The zone ID is <em>not</em> localized; it's one of the valid IDs of
@@ -596,9 +596,9 @@
      * All other entries are localized names.
      *
      * @param newZoneStrings the new time zone strings.
-     * @exception IllegalArgumentException if the length of any row in
-     *    <code>newZoneStrings</code> is less than 5
-     * @exception NullPointerException if <code>newZoneStrings</code> is null
+     * @throws    IllegalArgumentException if the length of any row in
+     *    {@code newZoneStrings} is less than 5
+     * @throws    NullPointerException if {@code newZoneStrings} is null
      * @see #getZoneStrings()
      */
     public void setZoneStrings(String[][] newZoneStrings) {
@@ -888,7 +888,7 @@
 
     /**
      * Write out the default serializable data, after ensuring the
-     * <code>zoneStrings</code> field is initialized in order to make
+     * {@code zoneStrings} field is initialized in order to make
      * sure the backward compatibility.
      *
      * @since 1.6
--- a/src/java.base/share/classes/java/text/DecimalFormat.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/text/DecimalFormat.java	Tue Sep 24 15:19:35 2019 -0400
@@ -425,8 +425,8 @@
      * locale.
      *
      * @param pattern a non-localized pattern string.
-     * @exception NullPointerException if {@code pattern} is null
-     * @exception IllegalArgumentException if the given pattern is invalid.
+     * @throws    NullPointerException if {@code pattern} is null
+     * @throws    IllegalArgumentException if the given pattern is invalid.
      * @see java.text.NumberFormat#getInstance
      * @see java.text.NumberFormat#getNumberInstance
      * @see java.text.NumberFormat#getCurrencyInstance
@@ -452,8 +452,8 @@
      *
      * @param pattern a non-localized pattern string
      * @param symbols the set of symbols to be used
-     * @exception NullPointerException if any of the given arguments is null
-     * @exception IllegalArgumentException if the given pattern is invalid
+     * @throws    NullPointerException if any of the given arguments is null
+     * @throws    IllegalArgumentException if the given pattern is invalid
      * @see java.text.NumberFormat#getInstance
      * @see java.text.NumberFormat#getNumberInstance
      * @see java.text.NumberFormat#getCurrencyInstance
@@ -486,11 +486,11 @@
      *                   to 0 and 9, respectively for the output string
      *                   {@code 1,234,567.89}.
      * @return           the value passed in as {@code toAppendTo}
-     * @exception        IllegalArgumentException if {@code number} is
+     * @throws           IllegalArgumentException if {@code number} is
      *                   null or not an instance of {@code Number}.
-     * @exception        NullPointerException if {@code toAppendTo} or
+     * @throws           NullPointerException if {@code toAppendTo} or
      *                   {@code pos} is null
-     * @exception        ArithmeticException if rounding is needed with rounding
+     * @throws           ArithmeticException if rounding is needed with rounding
      *                   mode being set to RoundingMode.UNNECESSARY
      * @see              java.text.FieldPosition
      */
@@ -528,9 +528,9 @@
      *                         and end index of {@code fieldPosition} will be set
      *                         to 0 and 9, respectively for the output string
      *                         {@code 1,234,567.89}.
-     * @exception NullPointerException if {@code result} or
+     * @throws    NullPointerException if {@code result} or
      *            {@code fieldPosition} is {@code null}
-     * @exception ArithmeticException if rounding is needed with rounding
+     * @throws    ArithmeticException if rounding is needed with rounding
      *            mode being set to RoundingMode.UNNECESSARY
      * @return The formatted number string
      * @see java.text.FieldPosition
@@ -565,7 +565,7 @@
      * @param number    The double to format
      * @param result    where the text is to be appended
      * @param delegate notified of locations of sub fields
-     * @exception       ArithmeticException if rounding is needed with rounding
+     * @throws          ArithmeticException if rounding is needed with rounding
      *                  mode being set to RoundingMode.UNNECESSARY
      * @return The formatted number string
      */
@@ -698,9 +698,9 @@
      *                         and end index of {@code fieldPosition} will be set
      *                         to 0 and 11, respectively for the output string
      *                         {@code 123,456,789}.
-     * @exception       NullPointerException if {@code result} or
+     * @throws          NullPointerException if {@code result} or
      *                  {@code fieldPosition} is {@code null}
-     * @exception       ArithmeticException if rounding is needed with rounding
+     * @throws          ArithmeticException if rounding is needed with rounding
      *                  mode being set to RoundingMode.UNNECESSARY
      * @return The formatted number string
      * @see java.text.FieldPosition
@@ -720,7 +720,7 @@
      * @param result    where the text is to be appended
      * @param delegate notified of locations of sub fields
      * @return The formatted number string
-     * @exception        ArithmeticException if rounding is needed with rounding
+     * @throws           ArithmeticException if rounding is needed with rounding
      *                   mode being set to RoundingMode.UNNECESSARY
      * @see java.text.FieldPosition
      */
@@ -795,7 +795,7 @@
      *                         to 0 and 9, respectively for the output string
      *                         {@code 1,234,567.89}.
      * @return The formatted number string
-     * @exception        ArithmeticException if rounding is needed with rounding
+     * @throws           ArithmeticException if rounding is needed with rounding
      *                   mode being set to RoundingMode.UNNECESSARY
      * @see java.text.FieldPosition
      */
@@ -811,7 +811,7 @@
      * @param number    The BigDecimal to format
      * @param result    where the text is to be appended
      * @param delegate notified of locations of sub fields
-     * @exception        ArithmeticException if rounding is needed with rounding
+     * @throws           ArithmeticException if rounding is needed with rounding
      *                   mode being set to RoundingMode.UNNECESSARY
      * @return The formatted number string
      */
@@ -854,7 +854,7 @@
      *                         to 0 and 11, respectively for the output string
      *                         {@code 123,456,789}.
      * @return The formatted number string
-     * @exception        ArithmeticException if rounding is needed with rounding
+     * @throws           ArithmeticException if rounding is needed with rounding
      *                   mode being set to RoundingMode.UNNECESSARY
      * @see java.text.FieldPosition
      */
@@ -872,7 +872,7 @@
      * @param result    where the text is to be appended
      * @param delegate notified of locations of sub fields
      * @return The formatted number string
-     * @exception        ArithmeticException if rounding is needed with rounding
+     * @throws           ArithmeticException if rounding is needed with rounding
      *                   mode being set to RoundingMode.UNNECESSARY
      * @see java.text.FieldPosition
      */
@@ -923,10 +923,10 @@
      * {@code NumberFormat.Field}, with the attribute value being the
      * same as the attribute key.
      *
-     * @exception NullPointerException if obj is null.
-     * @exception IllegalArgumentException when the Format cannot format the
+     * @throws    NullPointerException if obj is null.
+     * @throws    IllegalArgumentException when the Format cannot format the
      *            given object.
-     * @exception        ArithmeticException if rounding is needed with rounding
+     * @throws           ArithmeticException if rounding is needed with rounding
      *                   mode being set to RoundingMode.UNNECESSARY
      * @param obj The object to format
      * @return AttributedCharacterIterator describing the formatted value.
@@ -2130,7 +2130,7 @@
      * @param pos  A {@code ParsePosition} object with index and error
      *             index information as described above.
      * @return     the parsed value, or {@code null} if the parse fails
-     * @exception  NullPointerException if {@code text} or
+     * @throws     NullPointerException if {@code text} or
      *             {@code pos} is null.
      */
     @Override
@@ -3254,8 +3254,8 @@
      * these are presumed to be set in the positive pattern.
      *
      * @param pattern a new pattern
-     * @exception NullPointerException if {@code pattern} is null
-     * @exception IllegalArgumentException if the given pattern is invalid.
+     * @throws    NullPointerException if {@code pattern} is null
+     * @throws    IllegalArgumentException if the given pattern is invalid.
      */
     public void applyPattern(String pattern) {
         applyPattern(pattern, false);
@@ -3281,8 +3281,8 @@
      * these are presumed to be set in the positive pattern.
      *
      * @param pattern a new pattern
-     * @exception NullPointerException if {@code pattern} is null
-     * @exception IllegalArgumentException if the given pattern is invalid.
+     * @throws    NullPointerException if {@code pattern} is null
+     * @throws    IllegalArgumentException if the given pattern is invalid.
      */
     public void applyLocalizedPattern(String pattern) {
         applyPattern(pattern, true);
@@ -3782,7 +3782,7 @@
      * on this number format's symbols.
      *
      * @param currency the new currency to be used by this decimal format
-     * @exception NullPointerException if {@code currency} is null
+     * @throws    NullPointerException if {@code currency} is null
      * @since 1.4
      */
     @Override
@@ -3813,7 +3813,7 @@
      *
      * @param roundingMode The {@code RoundingMode} to be used
      * @see #getRoundingMode()
-     * @exception NullPointerException if {@code roundingMode} is null.
+     * @throws    NullPointerException if {@code roundingMode} is null.
      * @since 1.6
      */
     @Override
--- a/src/java.base/share/classes/java/text/DecimalFormatSymbols.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/text/DecimalFormatSymbols.java	Tue Sep 24 15:19:35 2019 -0400
@@ -109,7 +109,7 @@
      * instead of the Latin numbering system.
      *
      * @param locale the desired locale
-     * @exception NullPointerException if {@code locale} is null
+     * @throws    NullPointerException if {@code locale} is null
      */
     public DecimalFormatSymbols( Locale locale ) {
         initialize( locale );
@@ -172,7 +172,7 @@
      *
      * @param locale the desired locale.
      * @return a {@code DecimalFormatSymbols} instance.
-     * @exception NullPointerException if {@code locale} is null
+     * @throws    NullPointerException if {@code locale} is null
      * @since 1.6
      */
     public static final DecimalFormatSymbols getInstance(Locale locale) {
@@ -576,7 +576,7 @@
      * symbol attribute to the currency's ISO 4217 currency code.
      *
      * @param currency the new currency to be used
-     * @exception NullPointerException if {@code currency} is null
+     * @throws    NullPointerException if {@code currency} is null
      * @since 1.4
      * @see #setCurrencySymbol
      * @see #setInternationalCurrencySymbol
@@ -652,7 +652,7 @@
      * Examples: "x10^" for 1.23x10^4, "E" for 1.23E4.
      *
      * @param exp the exponent separator string
-     * @exception NullPointerException if {@code exp} is null
+     * @throws    NullPointerException if {@code exp} is null
      * @see #getExponentSeparator()
      * @since 1.6
      */
--- a/src/java.base/share/classes/java/text/DigitList.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/text/DigitList.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -439,15 +439,15 @@
      * java.math.RoundingMode class.
      * [bnf]
      * @param maximumDigits the number of digits to keep, from 0 to
-     * <code>count-1</code>.  If 0, then all digits are rounded away, and
+     * {@code count-1}.  If 0, then all digits are rounded away, and
      * this method returns true if a one should be generated (e.g., formatting
      * 0.09 with "#.#").
      * @param alreadyRounded whether or not rounding up has already happened.
      * @param valueExactAsDecimal whether or not collected digits provide
      * an exact decimal representation of the value.
-     * @exception ArithmeticException if rounding is needed with rounding
+     * @throws    ArithmeticException if rounding is needed with rounding
      *            mode being set to RoundingMode.UNNECESSARY
-     * @return true if digit <code>maximumDigits-1</code> should be
+     * @return true if digit {@code maximumDigits-1} should be
      * incremented
      */
     private boolean shouldRoundUp(int maximumDigits,
--- a/src/java.base/share/classes/java/text/FieldPosition.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/text/FieldPosition.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,33 +39,33 @@
 package java.text;
 
 /**
- * <code>FieldPosition</code> is a simple class used by <code>Format</code>
+ * {@code FieldPosition} is a simple class used by {@code Format}
  * and its subclasses to identify fields in formatted output. Fields can
  * be identified in two ways:
  * <ul>
  *  <li>By an integer constant, whose names typically end with
- *      <code>_FIELD</code>. The constants are defined in the various
- *      subclasses of <code>Format</code>.
- *  <li>By a <code>Format.Field</code> constant, see <code>ERA_FIELD</code>
- *      and its friends in <code>DateFormat</code> for an example.
+ *      {@code _FIELD}. The constants are defined in the various
+ *      subclasses of {@code Format}.
+ *  <li>By a {@code Format.Field} constant, see {@code ERA_FIELD}
+ *      and its friends in {@code DateFormat} for an example.
  * </ul>
  * <p>
- * <code>FieldPosition</code> keeps track of the position of the
+ * {@code FieldPosition} keeps track of the position of the
  * field within the formatted output with two indices: the index
  * of the first character of the field and the index of the last
  * character of the field.
  *
  * <p>
- * One version of the <code>format</code> method in the various
- * <code>Format</code> classes requires a <code>FieldPosition</code>
- * object as an argument. You use this <code>format</code> method
+ * One version of the {@code format} method in the various
+ * {@code Format} classes requires a {@code FieldPosition}
+ * object as an argument. You use this {@code format} method
  * to perform partial formatting or to get information about the
  * formatted output (such as the position of a field).
  *
  * <p>
  * If you are interested in the positions of all attributes in the
- * formatted string use the <code>Format</code> method
- * <code>formatToCharacterIterator</code>.
+ * formatted string use the {@code Format} method
+ * {@code formatToCharacterIterator}.
  *
  * @author      Mark Davis
  * @since 1.1
@@ -113,9 +113,9 @@
 
     /**
      * Creates a FieldPosition object for the given field constant. Fields are
-     * identified by constants defined in the various <code>Format</code>
+     * identified by constants defined in the various {@code Format}
      * subclasses. This is equivalent to calling
-     * <code>new FieldPosition(attribute, -1)</code>.
+     * {@code new FieldPosition(attribute, -1)}.
      *
      * @param attribute Format.Field constant identifying a field
      * @since 1.4
@@ -125,16 +125,16 @@
     }
 
     /**
-     * Creates a <code>FieldPosition</code> object for the given field.
+     * Creates a {@code FieldPosition} object for the given field.
      * The field is identified by an attribute constant from one of the
-     * <code>Field</code> subclasses as well as an integer field ID
-     * defined by the <code>Format</code> subclasses. <code>Format</code>
-     * subclasses that are aware of <code>Field</code> should give precedence
-     * to <code>attribute</code> and ignore <code>fieldID</code> if
-     * <code>attribute</code> is not null. However, older <code>Format</code>
-     * subclasses may not be aware of <code>Field</code> and rely on
-     * <code>fieldID</code>. If the field has no corresponding integer
-     * constant, <code>fieldID</code> should be -1.
+     * {@code Field} subclasses as well as an integer field ID
+     * defined by the {@code Format} subclasses. {@code Format}
+     * subclasses that are aware of {@code Field} should give precedence
+     * to {@code attribute} and ignore {@code fieldID} if
+     * {@code attribute} is not null. However, older {@code Format}
+     * subclasses may not be aware of {@code Field} and rely on
+     * {@code fieldID}. If the field has no corresponding integer
+     * constant, {@code fieldID} should be -1.
      *
      * @param attribute Format.Field constant identifying a field
      * @param fieldID integer constant identifying a field
@@ -147,7 +147,7 @@
 
     /**
      * Returns the field identifier as an attribute constant
-     * from one of the <code>Field</code> subclasses. May return null if
+     * from one of the {@code Field} subclasses. May return null if
      * the field is specified only by an integer field ID.
      *
      * @return Identifier for the field
@@ -206,7 +206,7 @@
     }
 
     /**
-     * Returns a <code>Format.FieldDelegate</code> instance that is associated
+     * Returns a {@code Format.FieldDelegate} instance that is associated
      * with the FieldPosition. When the delegate is notified of the same
      * field the FieldPosition is associated with, the begin/end will be
      * adjusted.
@@ -258,8 +258,8 @@
 
 
     /**
-     * Return true if the receiver wants a <code>Format.Field</code> value and
-     * <code>attribute</code> is equal to it.
+     * Return true if the receiver wants a {@code Format.Field} value and
+     * {@code attribute} is equal to it.
      */
     private boolean matchesField(Format.Field attribute) {
         if (this.attribute != null) {
@@ -269,9 +269,9 @@
     }
 
     /**
-     * Return true if the receiver wants a <code>Format.Field</code> value and
-     * <code>attribute</code> is equal to it, or true if the receiver
-     * represents an inteter constant and <code>field</code> equals it.
+     * Return true if the receiver wants a {@code Format.Field} value and
+     * {@code attribute} is equal to it, or true if the receiver
+     * represents an inteter constant and {@code field} equals it.
      */
     private boolean matchesField(Format.Field attribute, int field) {
         if (this.attribute != null) {
@@ -289,7 +289,7 @@
     private class Delegate implements Format.FieldDelegate {
         /**
          * Indicates whether the field has been  encountered before. If this
-         * is true, and <code>formatted</code> is invoked, the begin/end
+         * is true, and {@code formatted} is invoked, the begin/end
          * are not updated.
          */
         private boolean encounteredField;
--- a/src/java.base/share/classes/java/text/Format.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/text/Format.java	Tue Sep 24 15:19:35 2019 -0400
@@ -41,64 +41,64 @@
 import java.io.Serializable;
 
 /**
- * <code>Format</code> is an abstract base class for formatting locale-sensitive
+ * {@code Format} is an abstract base class for formatting locale-sensitive
  * information such as dates, messages, and numbers.
  *
  * <p>
- * <code>Format</code> defines the programming interface for formatting
- * locale-sensitive objects into <code>String</code>s (the
- * <code>format</code> method) and for parsing <code>String</code>s back
- * into objects (the <code>parseObject</code> method).
+ * {@code Format} defines the programming interface for formatting
+ * locale-sensitive objects into {@code String}s (the
+ * {@code format} method) and for parsing {@code String}s back
+ * into objects (the {@code parseObject} method).
  *
  * <p>
- * Generally, a format's <code>parseObject</code> method must be able to parse
- * any string formatted by its <code>format</code> method. However, there may
+ * Generally, a format's {@code parseObject} method must be able to parse
+ * any string formatted by its {@code format} method. However, there may
  * be exceptional cases where this is not possible. For example, a
- * <code>format</code> method might create two adjacent integer numbers with
- * no separator in between, and in this case the <code>parseObject</code> could
+ * {@code format} method might create two adjacent integer numbers with
+ * no separator in between, and in this case the {@code parseObject} could
  * not tell which digits belong to which number.
  *
  * <h2>Subclassing</h2>
  *
  * <p>
- * The Java Platform provides three specialized subclasses of <code>Format</code>--
- * <code>DateFormat</code>, <code>MessageFormat</code>, and
- * <code>NumberFormat</code>--for formatting dates, messages, and numbers,
+ * The Java Platform provides three specialized subclasses of {@code Format}--
+ * {@code DateFormat}, {@code MessageFormat}, and
+ * {@code NumberFormat}--for formatting dates, messages, and numbers,
  * respectively.
  * <p>
  * Concrete subclasses must implement three methods:
  * <ol>
- * <li> <code>format(Object obj, StringBuffer toAppendTo, FieldPosition pos)</code>
- * <li> <code>formatToCharacterIterator(Object obj)</code>
- * <li> <code>parseObject(String source, ParsePosition pos)</code>
+ * <li> {@code format(Object obj, StringBuffer toAppendTo, FieldPosition pos)}
+ * <li> {@code formatToCharacterIterator(Object obj)}
+ * <li> {@code parseObject(String source, ParsePosition pos)}
  * </ol>
  * These general methods allow polymorphic parsing and formatting of objects
- * and are used, for example, by <code>MessageFormat</code>.
- * Subclasses often also provide additional <code>format</code> methods for
- * specific input types as well as <code>parse</code> methods for specific
- * result types. Any <code>parse</code> method that does not take a
- * <code>ParsePosition</code> argument should throw <code>ParseException</code>
+ * and are used, for example, by {@code MessageFormat}.
+ * Subclasses often also provide additional {@code format} methods for
+ * specific input types as well as {@code parse} methods for specific
+ * result types. Any {@code parse} method that does not take a
+ * {@code ParsePosition} argument should throw {@code ParseException}
  * when no text in the required format is at the beginning of the input text.
  *
  * <p>
  * Most subclasses will also implement the following factory methods:
  * <ol>
  * <li>
- * <code>getInstance</code> for getting a useful format object appropriate
+ * {@code getInstance} for getting a useful format object appropriate
  * for the current locale
  * <li>
- * <code>getInstance(Locale)</code> for getting a useful format
+ * {@code getInstance(Locale)} for getting a useful format
  * object appropriate for the specified locale
  * </ol>
  * In addition, some subclasses may also implement other
- * <code>getXxxxInstance</code> methods for more specialized control. For
- * example, the <code>NumberFormat</code> class provides
- * <code>getPercentInstance</code> and <code>getCurrencyInstance</code>
+ * {@code getXxxxInstance} methods for more specialized control. For
+ * example, the {@code NumberFormat} class provides
+ * {@code getPercentInstance} and {@code getCurrencyInstance}
  * methods for getting specialized number formatters.
  *
  * <p>
- * Subclasses of <code>Format</code> that allow programmers to create objects
- * for locales (with <code>getInstance(Locale)</code> for example)
+ * Subclasses of {@code Format} that allow programmers to create objects
+ * for locales (with {@code getInstance(Locale)} for example)
  * must also implement the following class method:
  * <blockquote>
  * <pre>
@@ -112,7 +112,7 @@
  * object which identifies what information is contained in the field and its
  * position in the formatted result. These constants should be named
  * <code><em>item</em>_FIELD</code> where <code><em>item</em></code> identifies
- * the field. For examples of these constants, see <code>ERA_FIELD</code> and its
+ * the field. For examples of these constants, see {@code ERA_FIELD} and its
  * friends in {@link DateFormat}.
  *
  * <h3><a id="synchronization">Synchronization</a></h3>
@@ -152,7 +152,7 @@
      *
      * @param obj    The object to format
      * @return       Formatted string.
-     * @exception IllegalArgumentException if the Format cannot format the given
+     * @throws    IllegalArgumentException if the Format cannot format the given
      *            object
      */
     public final String format (Object obj) {
@@ -162,19 +162,19 @@
     /**
      * Formats an object and appends the resulting text to a given string
      * buffer.
-     * If the <code>pos</code> argument identifies a field used by the format,
+     * If the {@code pos} argument identifies a field used by the format,
      * then its indices are set to the beginning and end of the first such
      * field encountered.
      *
      * @param obj    The object to format
      * @param toAppendTo    where the text is to be appended
-     * @param pos    A <code>FieldPosition</code> identifying a field
+     * @param pos    A {@code FieldPosition} identifying a field
      *               in the formatted text
-     * @return       the string buffer passed in as <code>toAppendTo</code>,
+     * @return       the string buffer passed in as {@code toAppendTo},
      *               with formatted text appended
-     * @exception NullPointerException if <code>toAppendTo</code> or
-     *            <code>pos</code> is null
-     * @exception IllegalArgumentException if the Format cannot format the given
+     * @throws    NullPointerException if {@code toAppendTo} or
+     *            {@code pos} is null
+     * @throws    IllegalArgumentException if the Format cannot format the given
      *            object
      */
     public abstract StringBuffer format(Object obj,
@@ -182,23 +182,23 @@
                     FieldPosition pos);
 
     /**
-     * Formats an Object producing an <code>AttributedCharacterIterator</code>.
-     * You can use the returned <code>AttributedCharacterIterator</code>
+     * Formats an Object producing an {@code AttributedCharacterIterator}.
+     * You can use the returned {@code AttributedCharacterIterator}
      * to build the resulting String, as well as to determine information
      * about the resulting String.
      * <p>
      * Each attribute key of the AttributedCharacterIterator will be of type
-     * <code>Field</code>. It is up to each <code>Format</code> implementation
+     * {@code Field}. It is up to each {@code Format} implementation
      * to define what the legal values are for each attribute in the
-     * <code>AttributedCharacterIterator</code>, but typically the attribute
+     * {@code AttributedCharacterIterator}, but typically the attribute
      * key is also used as the attribute value.
      * <p>The default implementation creates an
-     * <code>AttributedCharacterIterator</code> with no attributes. Subclasses
+     * {@code AttributedCharacterIterator} with no attributes. Subclasses
      * that support fields should override this and create an
-     * <code>AttributedCharacterIterator</code> with meaningful attributes.
+     * {@code AttributedCharacterIterator} with meaningful attributes.
      *
-     * @exception NullPointerException if obj is null.
-     * @exception IllegalArgumentException when the Format cannot format the
+     * @throws    NullPointerException if obj is null.
+     * @throws    IllegalArgumentException when the Format cannot format the
      *            given object.
      * @param obj The object to format
      * @return AttributedCharacterIterator describing the formatted value.
@@ -212,20 +212,20 @@
      * Parses text from a string to produce an object.
      * <p>
      * The method attempts to parse text starting at the index given by
-     * <code>pos</code>.
-     * If parsing succeeds, then the index of <code>pos</code> is updated
+     * {@code pos}.
+     * If parsing succeeds, then the index of {@code pos} is updated
      * to the index after the last character used (parsing does not necessarily
      * use all characters up to the end of the string), and the parsed
-     * object is returned. The updated <code>pos</code> can be used to
+     * object is returned. The updated {@code pos} can be used to
      * indicate the starting point for the next call to this method.
-     * If an error occurs, then the index of <code>pos</code> is not
-     * changed, the error index of <code>pos</code> is set to the index of
+     * If an error occurs, then the index of {@code pos} is not
+     * changed, the error index of {@code pos} is set to the index of
      * the character where the error occurred, and null is returned.
      *
-     * @param source A <code>String</code>, part of which should be parsed.
-     * @param pos A <code>ParsePosition</code> object with index and error
+     * @param source A {@code String}, part of which should be parsed.
+     * @param pos A {@code ParsePosition} object with index and error
      *            index information as described above.
-     * @return An <code>Object</code> parsed from the string. In case of
+     * @return An {@code Object} parsed from the string. In case of
      *         error, returns null.
      * @throws NullPointerException if {@code source} or {@code pos} is null.
      */
@@ -235,9 +235,9 @@
      * Parses text from the beginning of the given string to produce an object.
      * The method may not use the entire text of the given string.
      *
-     * @param source A <code>String</code> whose beginning should be parsed.
-     * @return An <code>Object</code> parsed from the string.
-     * @exception ParseException if the beginning of the specified string
+     * @param source A {@code String} whose beginning should be parsed.
+     * @return An {@code Object} parsed from the string.
+     * @throws    ParseException if the beginning of the specified string
      *            cannot be parsed.
      * @throws NullPointerException if {@code source} is null.
      */
@@ -271,8 +271,8 @@
     //
 
     /**
-     * Creates an <code>AttributedCharacterIterator</code> for the String
-     * <code>s</code>.
+     * Creates an {@code AttributedCharacterIterator} for the String
+     * {@code s}.
      *
      * @param s String to create AttributedCharacterIterator from
      * @return AttributedCharacterIterator wrapping s
@@ -284,9 +284,9 @@
     }
 
     /**
-     * Creates an <code>AttributedCharacterIterator</code> containing the
+     * Creates an {@code AttributedCharacterIterator} containing the
      * concatenated contents of the passed in
-     * <code>AttributedCharacterIterator</code>s.
+     * {@code AttributedCharacterIterator}s.
      *
      * @param iterators AttributedCharacterIterators used to create resulting
      *                  AttributedCharacterIterators
@@ -302,8 +302,8 @@
 
     /**
      * Returns an AttributedCharacterIterator with the String
-     * <code>string</code> and additional key/value pair <code>key</code>,
-     * <code>value</code>.
+     * {@code string} and additional key/value pair {@code key},
+     * {@code value}.
      *
      * @param string String to create AttributedCharacterIterator from
      * @param key Key for AttributedCharacterIterator
@@ -321,8 +321,8 @@
 
     /**
      * Creates an AttributedCharacterIterator with the contents of
-     * <code>iterator</code> and the additional attribute <code>key</code>
-     * <code>value</code>.
+     * {@code iterator} and the additional attribute {@code key}
+     * {@code value}.
      *
      * @param iterator Initial AttributedCharacterIterator to add arg to
      * @param key Key for AttributedCharacterIterator
@@ -341,9 +341,9 @@
 
     /**
      * Defines constants that are used as attribute keys in the
-     * <code>AttributedCharacterIterator</code> returned
-     * from <code>Format.formatToCharacterIterator</code> and as
-     * field identifiers in <code>FieldPosition</code>.
+     * {@code AttributedCharacterIterator} returned
+     * from {@code Format.formatToCharacterIterator} and as
+     * field identifiers in {@code FieldPosition}.
      *
      * @since 1.4
      */
@@ -365,13 +365,13 @@
 
 
     /**
-     * FieldDelegate is notified by the various <code>Format</code>
+     * FieldDelegate is notified by the various {@code Format}
      * implementations as they are formatting the Objects. This allows for
      * storage of the individual sections of the formatted String for
-     * later use, such as in a <code>FieldPosition</code> or for an
-     * <code>AttributedCharacterIterator</code>.
+     * later use, such as in a {@code FieldPosition} or for an
+     * {@code AttributedCharacterIterator}.
      * <p>
-     * Delegates should NOT assume that the <code>Format</code> will notify
+     * Delegates should NOT assume that the {@code Format} will notify
      * the delegate of fields in any particular order.
      *
      * @see FieldPosition#getFieldDelegate
@@ -381,7 +381,7 @@
         /**
          * Notified when a particular region of the String is formatted. This
          * method will be invoked if there is no corresponding integer field id
-         * matching <code>attr</code>.
+         * matching {@code attr}.
          *
          * @param attr Identifies the field matched
          * @param value Value associated with the field
--- a/src/java.base/share/classes/java/text/MergeCollation.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/text/MergeCollation.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -64,7 +64,7 @@
 
     /**
      * Creates from a pattern
-     * @exception ParseException If the input pattern is incorrect.
+     * @throws    ParseException If the input pattern is incorrect.
      */
     public MergeCollation(String pattern) throws ParseException
     {
--- a/src/java.base/share/classes/java/text/MessageFormat.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/text/MessageFormat.java	Tue Sep 24 15:19:35 2019 -0400
@@ -50,27 +50,27 @@
 
 
 /**
- * <code>MessageFormat</code> provides a means to produce concatenated
+ * {@code MessageFormat} provides a means to produce concatenated
  * messages in a language-neutral way. Use this to construct messages
  * displayed for end users.
  *
  * <p>
- * <code>MessageFormat</code> takes a set of objects, formats them, then
+ * {@code MessageFormat} takes a set of objects, formats them, then
  * inserts the formatted strings into the pattern at the appropriate places.
  *
  * <p>
  * <strong>Note:</strong>
- * <code>MessageFormat</code> differs from the other <code>Format</code>
- * classes in that you create a <code>MessageFormat</code> object with one
- * of its constructors (not with a <code>getInstance</code> style factory
- * method). The factory methods aren't necessary because <code>MessageFormat</code>
+ * {@code MessageFormat} differs from the other {@code Format}
+ * classes in that you create a {@code MessageFormat} object with one
+ * of its constructors (not with a {@code getInstance} style factory
+ * method). The factory methods aren't necessary because {@code MessageFormat}
  * itself doesn't implement locale specific behavior. Any locale specific
  * behavior is defined by the pattern that you provide as well as the
  * subformats used for inserted arguments.
  *
  * <h2><a id="patterns">Patterns and Their Interpretation</a></h2>
  *
- * <code>MessageFormat</code> uses patterns of the following form:
+ * {@code MessageFormat} uses patterns of the following form:
  * <blockquote><pre>
  * <i>MessageFormatPattern:</i>
  *         <i>String</i>
@@ -102,7 +102,7 @@
  * must be represented by doubled single quotes {@code ''} throughout a
  * <i>String</i>.  For example, pattern string <code>"'{''}'"</code> is
  * interpreted as a sequence of <code>'{</code> (start of quoting and a
- * left curly brace), <code>''</code> (a single quote), and
+ * left curly brace), {@code ''} (a single quote), and
  * <code>}'</code> (a right curly brace and end of quoting),
  * <em>not</em> <code>'{'</code> and <code>'}'</code> (quoted left and
  * right curly braces): representing string <code>"{'}"</code>,
@@ -228,8 +228,8 @@
  * static strings will, of course, be obtained from resource bundles.
  * Other parameters will be dynamically determined at runtime.
  * <p>
- * The first example uses the static method <code>MessageFormat.format</code>,
- * which internally creates a <code>MessageFormat</code> for one-time use:
+ * The first example uses the static method {@code MessageFormat.format},
+ * which internally creates a {@code MessageFormat} for one-time use:
  * <blockquote><pre>
  * int planet = 7;
  * String event = "a disturbance in the Force";
@@ -244,7 +244,7 @@
  * </pre></blockquote>
  *
  * <p>
- * The following example creates a <code>MessageFormat</code> instance that
+ * The following example creates a {@code MessageFormat} instance that
  * can be used repeatedly:
  * <blockquote><pre>
  * int fileCount = 1273;
@@ -256,7 +256,7 @@
  *
  * System.out.println(form.format(testArgs));
  * </pre></blockquote>
- * The output with different values for <code>fileCount</code>:
+ * The output with different values for {@code fileCount}:
  * <blockquote><pre>
  * The disk "MyDisk" contains 0 file(s).
  * The disk "MyDisk" contains 1 file(s).
@@ -264,7 +264,7 @@
  * </pre></blockquote>
  *
  * <p>
- * For more sophisticated patterns, you can use a <code>ChoiceFormat</code>
+ * For more sophisticated patterns, you can use a {@code ChoiceFormat}
  * to produce correct forms for singular and plural:
  * <blockquote><pre>
  * MessageFormat form = new MessageFormat("The disk \"{1}\" contains {0}.");
@@ -279,7 +279,7 @@
  *
  * System.out.println(form.format(testArgs));
  * </pre></blockquote>
- * The output with different values for <code>fileCount</code>:
+ * The output with different values for {@code fileCount}:
  * <blockquote><pre>
  * The disk "MyDisk" contains no files.
  * The disk "MyDisk" contains one file.
@@ -287,7 +287,7 @@
  * </pre></blockquote>
  *
  * <p>
- * You can create the <code>ChoiceFormat</code> programmatically, as in the
+ * You can create the {@code ChoiceFormat} programmatically, as in the
  * above example, or by using a pattern. See {@link ChoiceFormat}
  * for more information.
  * <blockquote><pre>{@code
@@ -297,9 +297,9 @@
  *
  * <p>
  * <strong>Note:</strong> As we see above, the string produced
- * by a <code>ChoiceFormat</code> in <code>MessageFormat</code> is treated as special;
+ * by a {@code ChoiceFormat} in {@code MessageFormat} is treated as special;
  * occurrences of '{' are used to indicate subformats, and cause recursion.
- * If you create both a <code>MessageFormat</code> and <code>ChoiceFormat</code>
+ * If you create both a {@code MessageFormat} and {@code ChoiceFormat}
  * programmatically (instead of using the string patterns), then be careful not to
  * produce a format that recurses on itself, which will cause an infinite loop.
  * <p>
@@ -362,8 +362,8 @@
      * <a href="#patterns">class description</a>.
      *
      * @param pattern the pattern for this message format
-     * @exception IllegalArgumentException if the pattern is invalid
-     * @exception NullPointerException if {@code pattern} is
+     * @throws    IllegalArgumentException if the pattern is invalid
+     * @throws    NullPointerException if {@code pattern} is
      *            {@code null}
      */
     public MessageFormat(String pattern) {
@@ -381,8 +381,8 @@
      *
      * @param pattern the pattern for this message format
      * @param locale the locale for this message format
-     * @exception IllegalArgumentException if the pattern is invalid
-     * @exception NullPointerException if {@code pattern} is
+     * @throws    IllegalArgumentException if the pattern is invalid
+     * @throws    NullPointerException if {@code pattern} is
      *            {@code null}
      * @since 1.4
      */
@@ -398,8 +398,8 @@
      * <li>to the {@link #applyPattern applyPattern}
      *     and {@link #toPattern toPattern} methods if format elements specify
      *     a format type and therefore have the subformats created in the
-     *     <code>applyPattern</code> method, as well as
-     * <li>to the <code>format</code> and
+     *     {@code applyPattern} method, as well as
+     * <li>to the {@code format} and
      *     {@link #formatToCharacterIterator formatToCharacterIterator} methods
      *     if format elements do not specify a format type and therefore have
      *     the subformats created in the formatting methods.
@@ -430,8 +430,8 @@
      * <a href="#patterns">class description</a>.
      *
      * @param pattern the pattern for this message format
-     * @exception IllegalArgumentException if the pattern is invalid
-     * @exception NullPointerException if {@code pattern} is
+     * @throws    IllegalArgumentException if the pattern is invalid
+     * @throws    NullPointerException if {@code pattern} is
      *            {@code null}
      */
     @SuppressWarnings("fallthrough") // fallthrough in switch is expected, suppress it
@@ -596,14 +596,14 @@
 
     /**
      * Sets the formats to use for the values passed into
-     * <code>format</code> methods or returned from <code>parse</code>
-     * methods. The indices of elements in <code>newFormats</code>
+     * {@code format} methods or returned from {@code parse}
+     * methods. The indices of elements in {@code newFormats}
      * correspond to the argument indices used in the previously set
      * pattern string.
-     * The order of formats in <code>newFormats</code> thus corresponds to
-     * the order of elements in the <code>arguments</code> array passed
-     * to the <code>format</code> methods or the result array returned
-     * by the <code>parse</code> methods.
+     * The order of formats in {@code newFormats} thus corresponds to
+     * the order of elements in the {@code arguments} array passed
+     * to the {@code format} methods or the result array returned
+     * by the {@code parse} methods.
      * <p>
      * If an argument index is used for more than one format element
      * in the pattern string, then the corresponding new format is used
@@ -611,10 +611,10 @@
      * for any format element in the pattern string, then the
      * corresponding new format is ignored. If fewer formats are provided
      * than needed, then only the formats for argument indices less
-     * than <code>newFormats.length</code> are replaced.
+     * than {@code newFormats.length} are replaced.
      *
      * @param newFormats the new formats to use
-     * @exception NullPointerException if <code>newFormats</code> is null
+     * @throws    NullPointerException if {@code newFormats} is null
      * @since 1.4
      */
     public void setFormatsByArgumentIndex(Format[] newFormats) {
@@ -629,24 +629,24 @@
     /**
      * Sets the formats to use for the format elements in the
      * previously set pattern string.
-     * The order of formats in <code>newFormats</code> corresponds to
+     * The order of formats in {@code newFormats} corresponds to
      * the order of format elements in the pattern string.
      * <p>
      * If more formats are provided than needed by the pattern string,
      * the remaining ones are ignored. If fewer formats are provided
-     * than needed, then only the first <code>newFormats.length</code>
+     * than needed, then only the first {@code newFormats.length}
      * formats are replaced.
      * <p>
      * Since the order of format elements in a pattern string often
      * changes during localization, it is generally better to use the
      * {@link #setFormatsByArgumentIndex setFormatsByArgumentIndex}
      * method, which assumes an order of formats corresponding to the
-     * order of elements in the <code>arguments</code> array passed to
-     * the <code>format</code> methods or the result array returned by
-     * the <code>parse</code> methods.
+     * order of elements in the {@code arguments} array passed to
+     * the {@code format} methods or the result array returned by
+     * the {@code parse} methods.
      *
      * @param newFormats the new formats to use
-     * @exception NullPointerException if <code>newFormats</code> is null
+     * @throws    NullPointerException if {@code newFormats} is null
      */
     public void setFormats(Format[] newFormats) {
         int runsToCopy = newFormats.length;
@@ -663,9 +663,9 @@
      * previously set pattern string that use the given argument
      * index.
      * The argument index is part of the format element definition and
-     * represents an index into the <code>arguments</code> array passed
-     * to the <code>format</code> methods or the result array returned
-     * by the <code>parse</code> methods.
+     * represents an index into the {@code arguments} array passed
+     * to the {@code format} methods or the result array returned
+     * by the {@code parse} methods.
      * <p>
      * If the argument index is used for more than one format element
      * in the pattern string, then the new format is used for all such
@@ -698,7 +698,7 @@
      *
      * @param formatElementIndex the index of a format element within the pattern
      * @param newFormat the format to use for the specified format element
-     * @exception ArrayIndexOutOfBoundsException if {@code formatElementIndex} is equal to or
+     * @throws    ArrayIndexOutOfBoundsException if {@code formatElementIndex} is equal to or
      *            larger than the number of format elements in the pattern string
      */
     public void setFormat(int formatElementIndex, Format newFormat) {
@@ -711,14 +711,14 @@
 
     /**
      * Gets the formats used for the values passed into
-     * <code>format</code> methods or returned from <code>parse</code>
+     * {@code format} methods or returned from {@code parse}
      * methods. The indices of elements in the returned array
      * correspond to the argument indices used in the previously set
      * pattern string.
      * The order of formats in the returned array thus corresponds to
-     * the order of elements in the <code>arguments</code> array passed
-     * to the <code>format</code> methods or the result array returned
-     * by the <code>parse</code> methods.
+     * the order of elements in the {@code arguments} array passed
+     * to the {@code format} methods or the result array returned
+     * by the {@code parse} methods.
      * <p>
      * If an argument index is used for more than one format element
      * in the pattern string, then the format used for the last such
@@ -753,9 +753,9 @@
      * changes during localization, it's generally better to use the
      * {@link #getFormatsByArgumentIndex getFormatsByArgumentIndex}
      * method, which assumes an order of formats corresponding to the
-     * order of elements in the <code>arguments</code> array passed to
-     * the <code>format</code> methods or the result array returned by
-     * the <code>parse</code> methods.
+     * order of elements in the {@code arguments} array passed to
+     * the {@code format} methods or the result array returned by
+     * the {@code parse} methods.
      *
      * @return the formats used for the format elements in the pattern
      */
@@ -766,16 +766,16 @@
     }
 
     /**
-     * Formats an array of objects and appends the <code>MessageFormat</code>'s
+     * Formats an array of objects and appends the {@code MessageFormat}'s
      * pattern, with format elements replaced by the formatted objects, to the
-     * provided <code>StringBuffer</code>.
+     * provided {@code StringBuffer}.
      * <p>
      * The text substituted for the individual format elements is derived from
      * the current subformat of the format element and the
-     * <code>arguments</code> element at the format element's argument index
+     * {@code arguments} element at the format element's argument index
      * as indicated by the first matching line of the following table. An
-     * argument is <i>unavailable</i> if <code>arguments</code> is
-     * <code>null</code> or has fewer than argumentIndex+1 elements.
+     * argument is <i>unavailable</i> if {@code arguments} is
+     * {@code null} or has fewer than argumentIndex+1 elements.
      *
      * <table class="plain">
      * <caption style="display:none">Examples of subformat,argument,and formatted text</caption>
@@ -791,36 +791,36 @@
      *       <th scope="row" style="text-weight-normal"><i>unavailable</i>
      *       <td><code>"{" + argumentIndex + "}"</code>
      *    <tr>
-     *       <th scope="row" style="text-weight-normal"><code>null</code>
-     *       <td><code>"null"</code>
+     *       <th scope="row" style="text-weight-normal">{@code null}
+     *       <td>{@code "null"}
      *    <tr>
-     *       <th scope="row" style="text-weight-normal"><code>instanceof ChoiceFormat</code>
+     *       <th scope="row" style="text-weight-normal">{@code instanceof ChoiceFormat}
      *       <th scope="row" style="text-weight-normal"><i>any</i>
      *       <td><code>subformat.format(argument).indexOf('{') &gt;= 0 ?<br>
      *           (new MessageFormat(subformat.format(argument), getLocale())).format(argument) :
      *           subformat.format(argument)</code>
      *    <tr>
-     *       <th scope="row" style="text-weight-normal"><code>!= null</code>
+     *       <th scope="row" style="text-weight-normal">{@code != null}
      *       <th scope="row" style="text-weight-normal"><i>any</i>
-     *       <td><code>subformat.format(argument)</code>
+     *       <td>{@code subformat.format(argument)}
      *    <tr>
-     *       <th scope="row" style="text-weight-normal" rowspan=4><code>null</code>
-     *       <th scope="row" style="text-weight-normal"><code>instanceof Number</code>
-     *       <td><code>NumberFormat.getInstance(getLocale()).format(argument)</code>
+     *       <th scope="row" style="text-weight-normal" rowspan=4>{@code null}
+     *       <th scope="row" style="text-weight-normal">{@code instanceof Number}
+     *       <td>{@code NumberFormat.getInstance(getLocale()).format(argument)}
      *    <tr>
-     *       <th scope="row" style="text-weight-normal"><code>instanceof Date</code>
-     *       <td><code>DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, getLocale()).format(argument)</code>
+     *       <th scope="row" style="text-weight-normal">{@code instanceof Date}
+     *       <td>{@code DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, getLocale()).format(argument)}
      *    <tr>
-     *       <th scope="row" style="text-weight-normal"><code>instanceof String</code>
-     *       <td><code>argument</code>
+     *       <th scope="row" style="text-weight-normal">{@code instanceof String}
+     *       <td>{@code argument}
      *    <tr>
      *       <th scope="row" style="text-weight-normal"><i>any</i>
-     *       <td><code>argument.toString()</code>
+     *       <td>{@code argument.toString()}
      * </tbody>
      * </table>
      * <p>
-     * If <code>pos</code> is non-null, and refers to
-     * <code>Field.ARGUMENT</code>, the location of the first formatted
+     * If {@code pos} is non-null, and refers to
+     * {@code Field.ARGUMENT}, the location of the first formatted
      * string will be returned.
      *
      * @param arguments an array of objects to be formatted and substituted.
@@ -829,10 +829,10 @@
                   in the output string.
      * @return the string buffer passed in as {@code result}, with formatted
      * text appended
-     * @exception IllegalArgumentException if an argument in the
-     *            <code>arguments</code> array is not of the type
+     * @throws    IllegalArgumentException if an argument in the
+     *            {@code arguments} array is not of the type
      *            expected by the format element(s) that use it.
-     * @exception NullPointerException if {@code result} is {@code null}
+     * @throws    NullPointerException if {@code result} is {@code null}
      */
     public final StringBuffer format(Object[] arguments, StringBuffer result,
                                      FieldPosition pos)
@@ -850,11 +850,11 @@
      * @param pattern   the pattern string
      * @param arguments object(s) to format
      * @return the formatted string
-     * @exception IllegalArgumentException if the pattern is invalid,
-     *            or if an argument in the <code>arguments</code> array
+     * @throws    IllegalArgumentException if the pattern is invalid,
+     *            or if an argument in the {@code arguments} array
      *            is not of the type expected by the format element(s)
      *            that use it.
-     * @exception NullPointerException if {@code pattern} is {@code null}
+     * @throws    NullPointerException if {@code pattern} is {@code null}
      */
     public static String format(String pattern, Object ... arguments) {
         MessageFormat temp = new MessageFormat(pattern);
@@ -863,9 +863,9 @@
 
     // Overrides
     /**
-     * Formats an array of objects and appends the <code>MessageFormat</code>'s
+     * Formats an array of objects and appends the {@code MessageFormat}'s
      * pattern, with format elements replaced by the formatted objects, to the
-     * provided <code>StringBuffer</code>.
+     * provided {@code StringBuffer}.
      * This is equivalent to
      * <blockquote>
      *     <code>{@link #format(java.lang.Object[], java.lang.StringBuffer, java.text.FieldPosition) format}((Object[]) arguments, result, pos)</code>
@@ -875,10 +875,10 @@
      * @param result where text is appended.
      * @param pos keeps track on the position of the first replaced argument
      *            in the output string.
-     * @exception IllegalArgumentException if an argument in the
-     *            <code>arguments</code> array is not of the type
+     * @throws    IllegalArgumentException if an argument in the
+     *            {@code arguments} array is not of the type
      *            expected by the format element(s) that use it.
-     * @exception NullPointerException if {@code result} is {@code null}
+     * @throws    NullPointerException if {@code result} is {@code null}
      */
     public final StringBuffer format(Object arguments, StringBuffer result,
                                      FieldPosition pos)
@@ -888,36 +888,36 @@
 
     /**
      * Formats an array of objects and inserts them into the
-     * <code>MessageFormat</code>'s pattern, producing an
-     * <code>AttributedCharacterIterator</code>.
-     * You can use the returned <code>AttributedCharacterIterator</code>
+     * {@code MessageFormat}'s pattern, producing an
+     * {@code AttributedCharacterIterator}.
+     * You can use the returned {@code AttributedCharacterIterator}
      * to build the resulting String, as well as to determine information
      * about the resulting String.
      * <p>
-     * The text of the returned <code>AttributedCharacterIterator</code> is
+     * The text of the returned {@code AttributedCharacterIterator} is
      * the same that would be returned by
      * <blockquote>
      *     <code>{@link #format(java.lang.Object[], java.lang.StringBuffer, java.text.FieldPosition) format}(arguments, new StringBuffer(), null).toString()</code>
      * </blockquote>
      * <p>
-     * In addition, the <code>AttributedCharacterIterator</code> contains at
+     * In addition, the {@code AttributedCharacterIterator} contains at
      * least attributes indicating where text was generated from an
-     * argument in the <code>arguments</code> array. The keys of these attributes are of
-     * type <code>MessageFormat.Field</code>, their values are
-     * <code>Integer</code> objects indicating the index in the <code>arguments</code>
+     * argument in the {@code arguments} array. The keys of these attributes are of
+     * type {@code MessageFormat.Field}, their values are
+     * {@code Integer} objects indicating the index in the {@code arguments}
      * array of the argument from which the text was generated.
      * <p>
-     * The attributes/value from the underlying <code>Format</code>
-     * instances that <code>MessageFormat</code> uses will also be
-     * placed in the resulting <code>AttributedCharacterIterator</code>.
+     * The attributes/value from the underlying {@code Format}
+     * instances that {@code MessageFormat} uses will also be
+     * placed in the resulting {@code AttributedCharacterIterator}.
      * This allows you to not only find where an argument is placed in the
      * resulting String, but also which fields it contains in turn.
      *
      * @param arguments an array of objects to be formatted and substituted.
      * @return AttributedCharacterIterator describing the formatted value.
-     * @exception NullPointerException if <code>arguments</code> is null.
-     * @exception IllegalArgumentException if an argument in the
-     *            <code>arguments</code> array is not of the type
+     * @throws    NullPointerException if {@code arguments} is null.
+     * @throws    IllegalArgumentException if an argument in the
+     *            {@code arguments} array is not of the type
      *            expected by the format element(s) that use it.
      * @since 1.4
      */
@@ -968,7 +968,7 @@
      * @param source the string to parse
      * @param pos    the parse position
      * @return an array of parsed objects
-     * @exception NullPointerException if {@code pos} is {@code null}
+     * @throws    NullPointerException if {@code pos} is {@code null}
      *            for a non-null {@code source} string.
      */
     public Object[] parse(String source, ParsePosition pos) {
@@ -1055,9 +1055,9 @@
      * See the {@link #parse(String, ParsePosition)} method for more information
      * on message parsing.
      *
-     * @param source A <code>String</code> whose beginning should be parsed.
-     * @return An <code>Object</code> array parsed from the string.
-     * @exception ParseException if the beginning of the specified string
+     * @param source A {@code String} whose beginning should be parsed.
+     * @return An {@code Object} array parsed from the string.
+     * @throws    ParseException if the beginning of the specified string
      *            cannot be parsed.
      */
     public Object[] parse(String source) throws ParseException {
@@ -1073,23 +1073,23 @@
      * Parses text from a string to produce an object array.
      * <p>
      * The method attempts to parse text starting at the index given by
-     * <code>pos</code>.
-     * If parsing succeeds, then the index of <code>pos</code> is updated
+     * {@code pos}.
+     * If parsing succeeds, then the index of {@code pos} is updated
      * to the index after the last character used (parsing does not necessarily
      * use all characters up to the end of the string), and the parsed
-     * object array is returned. The updated <code>pos</code> can be used to
+     * object array is returned. The updated {@code pos} can be used to
      * indicate the starting point for the next call to this method.
-     * If an error occurs, then the index of <code>pos</code> is not
-     * changed, the error index of <code>pos</code> is set to the index of
+     * If an error occurs, then the index of {@code pos} is not
+     * changed, the error index of {@code pos} is set to the index of
      * the character where the error occurred, and null is returned.
      * <p>
      * See the {@link #parse(String, ParsePosition)} method for more information
      * on message parsing.
      *
-     * @param source A <code>String</code>, part of which should be parsed.
-     * @param pos A <code>ParsePosition</code> object with index and error
+     * @param source A {@code String}, part of which should be parsed.
+     * @param pos A {@code ParsePosition} object with index and error
      *            index information as described above.
-     * @return An <code>Object</code> array parsed from the string. In case of
+     * @return An {@code Object} array parsed from the string. In case of
      *         error, returns null.
      * @throws NullPointerException if {@code pos} is null.
      */
@@ -1146,8 +1146,8 @@
 
     /**
      * Defines constants that are used as attribute keys in the
-     * <code>AttributedCharacterIterator</code> returned
-     * from <code>MessageFormat.formatToCharacterIterator</code>.
+     * {@code AttributedCharacterIterator} returned
+     * from {@code MessageFormat.formatToCharacterIterator}.
      *
      * @since 1.4
      */
@@ -1188,9 +1188,9 @@
 
         /**
          * Constant identifying a portion of a message that was generated
-         * from an argument passed into <code>formatToCharacterIterator</code>.
-         * The value associated with the key will be an <code>Integer</code>
-         * indicating the index in the <code>arguments</code> array of the
+         * from an argument passed into {@code formatToCharacterIterator}.
+         * The value associated with the key will be an {@code Integer}
+         * indicating the index in the {@code arguments} array of the
          * argument from which the text was generated.
          */
         public static final Field ARGUMENT =
@@ -1237,9 +1237,9 @@
     private int[] argumentNumbers = new int[INITIAL_FORMATS];
 
     /**
-     * One less than the number of entries in <code>offsets</code>.  Can also be thought of
-     * as the index of the highest-numbered element in <code>offsets</code> that is being used.
-     * All of these arrays should have the same number of elements being used as <code>offsets</code>
+     * One less than the number of entries in {@code offsets}.  Can also be thought of
+     * as the index of the highest-numbered element in {@code offsets} that is being used.
+     * All of these arrays should have the same number of elements being used as {@code offsets}
      * does, and so this variable suffices to tell us how many entries are in all of them.
      * @serial
      */
@@ -1253,8 +1253,8 @@
      * {@code Field.ARGUMENT} as the field attribute, the location of
      * the first replaced argument will be set in it.
      *
-     * @exception IllegalArgumentException if an argument in the
-     *            <code>arguments</code> array is not of the type
+     * @throws    IllegalArgumentException if an argument in the
+     *            {@code arguments} array is not of the type
      *            expected by the format element(s) that use it.
      */
     private StringBuffer subformat(Object[] arguments, StringBuffer result,
@@ -1367,7 +1367,7 @@
 
     /**
      * Convenience method to append all the characters in
-     * <code>iterator</code> to the StringBuffer <code>result</code>.
+     * {@code iterator} to the StringBuffer {@code result}.
      */
     private void append(StringBuffer result, CharacterIterator iterator) {
         if (iterator.first() != CharacterIterator.DONE) {
--- a/src/java.base/share/classes/java/text/Normalizer.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/text/Normalizer.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,10 +40,10 @@
 import sun.text.normalizer.NormalizerBase;
 
 /**
- * This class provides the method <code>normalize</code> which transforms Unicode
+ * This class provides the method {@code normalize} which transforms Unicode
  * text into an equivalent composed or decomposed form, allowing for easier
  * sorting and searching of text.
- * The <code>normalize</code> method supports the standard normalization forms
+ * The {@code normalize} method supports the standard normalization forms
  * described in
  * <a href="http://www.unicode.org/unicode/reports/tr15/tr15-23.html">
  * Unicode Standard Annex #15 &mdash; Unicode Normalization Forms</a>.
@@ -88,12 +88,12 @@
  * into the corresponding semantic characters.  When sorting and searching, you
  * will often want to use these mappings.
  * <p>
- * The <code>normalize</code> method helps solve these problems by transforming
+ * The {@code normalize} method helps solve these problems by transforming
  * text into the canonical composed and decomposed forms as shown in the first
  * example above. In addition, you can have it perform compatibility
  * decompositions so that you can treat compatibility characters the same as
  * their equivalents.
- * Finally, the <code>normalize</code> method rearranges accents into the
+ * Finally, the {@code normalize} method rearranges accents into the
  * proper canonical order, so that you do not have to worry about accent
  * rearrangement on your own.
  * <p>
@@ -152,7 +152,7 @@
      *                   {@link java.text.Normalizer.Form#NFKC},
      *                   {@link java.text.Normalizer.Form#NFKD}
      * @return The normalized String
-     * @throws NullPointerException If <code>src</code> or <code>form</code>
+     * @throws NullPointerException If {@code src} or {@code form}
      * is null.
      */
     public static String normalize(CharSequence src, Form form) {
@@ -169,7 +169,7 @@
      *                   {@link java.text.Normalizer.Form#NFKD}
      * @return true if the sequence of char values is normalized;
      * false otherwise.
-     * @throws NullPointerException If <code>src</code> or <code>form</code>
+     * @throws NullPointerException If {@code src} or {@code form}
      * is null.
      */
     public static boolean isNormalized(CharSequence src, Form form) {
--- a/src/java.base/share/classes/java/text/NumberFormat.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/text/NumberFormat.java	Tue Sep 24 15:19:35 2019 -0400
@@ -56,13 +56,13 @@
 import sun.util.locale.provider.LocaleServiceProviderPool;
 
 /**
- * <code>NumberFormat</code> is the abstract base class for all number
+ * {@code NumberFormat} is the abstract base class for all number
  * formats. This class provides the interface for formatting and parsing
- * numbers. <code>NumberFormat</code> also provides methods for determining
+ * numbers. {@code NumberFormat} also provides methods for determining
  * which locales have number formats, and what their names are.
  *
  * <p>
- * <code>NumberFormat</code> helps you to format and parse numbers for any locale.
+ * {@code NumberFormat} helps you to format and parse numbers for any locale.
  * Your code can be completely independent of the locale conventions for
  * decimal points, thousands-separators, or even the particular decimal
  * digits used, or whether the number format is even decimal.
@@ -88,7 +88,7 @@
  * }</pre>
  * </blockquote>
  * To format a number for a different Locale, specify it in the
- * call to <code>getInstance</code>.
+ * call to {@code getInstance}.
  * <blockquote>
  * <pre>{@code
  * NumberFormat nf = NumberFormat.getInstance(Locale.FRENCH);
@@ -107,25 +107,25 @@
  * myNumber = nf.parse(myString);
  * }</pre>
  * </blockquote>
- * Use <code>getInstance</code> or <code>getNumberInstance</code> to get the
- * normal number format. Use <code>getIntegerInstance</code> to get an
- * integer number format. Use <code>getCurrencyInstance</code> to get the
+ * Use {@code getInstance} or {@code getNumberInstance} to get the
+ * normal number format. Use {@code getIntegerInstance} to get an
+ * integer number format. Use {@code getCurrencyInstance} to get the
  * currency number format. Use {@code getCompactNumberInstance} to get the
  * compact number format to format a number in shorter form. For example,
  * {@code 2000} can be formatted as {@code "2K"} in
- * {@link java.util.Locale#US US locale}. Use <code>getPercentInstance</code>
+ * {@link java.util.Locale#US US locale}. Use {@code getPercentInstance}
  * to get a format for displaying percentages. With this format, a fraction
  * like 0.53 is displayed as 53%.
  *
  * <p>
  * You can also control the display of numbers with such methods as
- * <code>setMinimumFractionDigits</code>.
+ * {@code setMinimumFractionDigits}.
  * If you want even more control over the format or parsing,
  * or want to give your users more control,
- * you can try casting the <code>NumberFormat</code> you get from the factory methods
+ * you can try casting the {@code NumberFormat} you get from the factory methods
  * to a {@code DecimalFormat} or {@code CompactNumberFormat} depending on
  * the factory method used. This will work for the vast majority of locales;
- * just remember to put it in a <code>try</code> block in case you encounter
+ * just remember to put it in a {@code try} block in case you encounter
  * an unusual one.
  *
  * <p>
@@ -149,8 +149,8 @@
  * point, use setParseIntegerOnly.
  *
  * <p>
- * You can also use forms of the <code>parse</code> and <code>format</code>
- * methods with <code>ParsePosition</code> and <code>FieldPosition</code> to
+ * You can also use forms of the {@code parse} and {@code format}
+ * methods with {@code ParsePosition} and {@code FieldPosition} to
  * allow you to:
  * <ul>
  * <li> progressively parse through pieces of a string
@@ -159,15 +159,15 @@
  * For example, you can align numbers in two ways:
  * <ol>
  * <li> If you are using a monospaced font with spacing for alignment,
- *      you can pass the <code>FieldPosition</code> in your format call, with
- *      <code>field</code> = <code>INTEGER_FIELD</code>. On output,
- *      <code>getEndIndex</code> will be set to the offset between the
+ *      you can pass the {@code FieldPosition} in your format call, with
+ *      {@code field} = {@code INTEGER_FIELD}. On output,
+ *      {@code getEndIndex} will be set to the offset between the
  *      last character of the integer and the decimal. Add
  *      (desiredSpaceCount - getEndIndex) spaces at the front of the string.
  *
  * <li> If you are using proportional fonts,
  *      instead of padding with spaces, measure the width
- *      of the string in pixels from the start to <code>getEndIndex</code>.
+ *      of the string in pixels from the start to {@code getEndIndex}.
  *      Then move the pen by
  *      (desiredPixelWidth - widthToAlignmentPoint) before drawing the text.
  *      It also works where there is no decimal, but possibly additional
@@ -238,17 +238,17 @@
      * <p>
      * This implementation extracts the number's value using
      * {@link java.lang.Number#longValue()} for all integral type values that
-     * can be converted to <code>long</code> without loss of information,
-     * including <code>BigInteger</code> values with a
+     * can be converted to {@code long} without loss of information,
+     * including {@code BigInteger} values with a
      * {@link java.math.BigInteger#bitLength() bit length} of less than 64,
      * and {@link java.lang.Number#doubleValue()} for all other types. It
      * then calls
      * {@link #format(long,java.lang.StringBuffer,java.text.FieldPosition)}
      * or {@link #format(double,java.lang.StringBuffer,java.text.FieldPosition)}.
      * This may result in loss of magnitude information and precision for
-     * <code>BigInteger</code> and <code>BigDecimal</code> values.
+     * {@code BigInteger} and {@code BigDecimal} values.
      * @param number     the number to format
-     * @param toAppendTo the <code>StringBuffer</code> to which the formatted
+     * @param toAppendTo the {@code StringBuffer} to which the formatted
      *                   text is to be appended
      * @param pos        keeps track on the position of the field within the
      *                   returned string. For example, for formatting a number
@@ -258,12 +258,12 @@
      *                   and end index of {@code fieldPosition} will be set
      *                   to 0 and 9, respectively for the output string
      *                   {@code 1,234,567.89}.
-     * @return           the value passed in as <code>toAppendTo</code>
-     * @exception        IllegalArgumentException if <code>number</code> is
-     *                   null or not an instance of <code>Number</code>.
-     * @exception        NullPointerException if <code>toAppendTo</code> or
-     *                   <code>pos</code> is null
-     * @exception        ArithmeticException if rounding is needed with rounding
+     * @return           the value passed in as {@code toAppendTo}
+     * @throws           IllegalArgumentException if {@code number} is
+     *                   null or not an instance of {@code Number}.
+     * @throws           NullPointerException if {@code toAppendTo} or
+     *                   {@code pos} is null
+     * @throws           ArithmeticException if rounding is needed with rounding
      *                   mode being set to RoundingMode.UNNECESSARY
      * @see              java.text.FieldPosition
      */
@@ -285,26 +285,26 @@
     }
 
     /**
-     * Parses text from a string to produce a <code>Number</code>.
+     * Parses text from a string to produce a {@code Number}.
      * <p>
      * The method attempts to parse text starting at the index given by
-     * <code>pos</code>.
-     * If parsing succeeds, then the index of <code>pos</code> is updated
+     * {@code pos}.
+     * If parsing succeeds, then the index of {@code pos} is updated
      * to the index after the last character used (parsing does not necessarily
      * use all characters up to the end of the string), and the parsed
-     * number is returned. The updated <code>pos</code> can be used to
+     * number is returned. The updated {@code pos} can be used to
      * indicate the starting point for the next call to this method.
-     * If an error occurs, then the index of <code>pos</code> is not
-     * changed, the error index of <code>pos</code> is set to the index of
+     * If an error occurs, then the index of {@code pos} is not
+     * changed, the error index of {@code pos} is set to the index of
      * the character where the error occurred, and null is returned.
      * <p>
      * See the {@link #parse(String, ParsePosition)} method for more information
      * on number parsing.
      *
-     * @param source A <code>String</code>, part of which should be parsed.
-     * @param pos A <code>ParsePosition</code> object with index and error
+     * @param source A {@code String}, part of which should be parsed.
+     * @param pos A {@code ParsePosition} object with index and error
      *            index information as described above.
-     * @return A <code>Number</code> parsed from the string. In case of
+     * @return A {@code Number} parsed from the string. In case of
      *         error, returns null.
      * @throws NullPointerException if {@code source} or {@code pos} is null.
      */
@@ -318,7 +318,7 @@
      *
      * @param number the double number to format
      * @return the formatted String
-     * @exception        ArithmeticException if rounding is needed with rounding
+     * @throws           ArithmeticException if rounding is needed with rounding
      *                   mode being set to RoundingMode.UNNECESSARY
      * @see java.text.Format#format
      */
@@ -343,7 +343,7 @@
      *
      * @param number the long number to format
      * @return the formatted String
-     * @exception        ArithmeticException if rounding is needed with rounding
+     * @throws           ArithmeticException if rounding is needed with rounding
      *                   mode being set to RoundingMode.UNNECESSARY
      * @see java.text.Format#format
      */
@@ -367,7 +367,7 @@
      *                   to 0 and 9, respectively for the output string
      *                   {@code 1,234,567.89}.
      * @return the formatted StringBuffer
-     * @exception        ArithmeticException if rounding is needed with rounding
+     * @throws           ArithmeticException if rounding is needed with rounding
      *                   mode being set to RoundingMode.UNNECESSARY
      * @see java.text.Format#format
      */
@@ -390,7 +390,7 @@
      *                   to 0 and 11, respectively for the output string
      *                   {@code 123,456,789}.
      * @return the formatted StringBuffer
-     * @exception        ArithmeticException if rounding is needed with rounding
+     * @throws           ArithmeticException if rounding is needed with rounding
      *                   mode being set to RoundingMode.UNNECESSARY
      * @see java.text.Format#format
      */
@@ -422,9 +422,9 @@
      * See the {@link #parse(String, ParsePosition)} method for more information
      * on number parsing.
      *
-     * @param source A <code>String</code> whose beginning should be parsed.
-     * @return A <code>Number</code> parsed from the string.
-     * @exception ParseException if the beginning of the specified string
+     * @param source A {@code String} whose beginning should be parsed.
+     * @return A {@code Number} parsed from the string.
+     * @throws    ParseException if the beginning of the specified string
      *            cannot be parsed.
      */
     public Number parse(String source) throws ParseException {
@@ -677,16 +677,16 @@
 
     /**
      * Returns an array of all locales for which the
-     * <code>get*Instance</code> methods of this class can return
+     * {@code get*Instance} methods of this class can return
      * localized instances.
      * The returned array represents the union of locales supported by the Java
      * runtime and by installed
      * {@link java.text.spi.NumberFormatProvider NumberFormatProvider} implementations.
-     * It must contain at least a <code>Locale</code> instance equal to
+     * It must contain at least a {@code Locale} instance equal to
      * {@link java.util.Locale#US Locale.US}.
      *
      * @return An array of locales for which localized
-     *         <code>NumberFormat</code> instances are available.
+     *         {@code NumberFormat} instances are available.
      */
     public static Locale[] getAvailableLocales() {
         LocaleServiceProviderPool pool =
@@ -888,10 +888,10 @@
      * {@link #setCurrency(java.util.Currency) setCurrency}.
      * <p>
      * The default implementation throws
-     * <code>UnsupportedOperationException</code>.
+     * {@code UnsupportedOperationException}.
      *
-     * @return the currency used by this number format, or <code>null</code>
-     * @exception UnsupportedOperationException if the number format class
+     * @return the currency used by this number format, or {@code null}
+     * @throws    UnsupportedOperationException if the number format class
      * doesn't implement currency formatting
      * @since 1.4
      */
@@ -905,12 +905,12 @@
      * number of fraction digits used by the number format.
      * <p>
      * The default implementation throws
-     * <code>UnsupportedOperationException</code>.
+     * {@code UnsupportedOperationException}.
      *
      * @param currency the new currency to be used by this number format
-     * @exception UnsupportedOperationException if the number format class
+     * @throws    UnsupportedOperationException if the number format class
      * doesn't implement currency formatting
-     * @exception NullPointerException if <code>currency</code> is null
+     * @throws    NullPointerException if {@code currency} is null
      * @since 1.4
      */
     public void setCurrency(Currency currency) {
@@ -924,9 +924,9 @@
      * Subclasses which handle different rounding modes should override
      * this method.
      *
-     * @exception UnsupportedOperationException The default implementation
+     * @throws    UnsupportedOperationException The default implementation
      *     always throws this exception
-     * @return The <code>RoundingMode</code> used for this NumberFormat.
+     * @return The {@code RoundingMode} used for this NumberFormat.
      * @see #setRoundingMode(RoundingMode)
      * @since 1.6
      */
@@ -941,10 +941,10 @@
      * Subclasses which handle different rounding modes should override
      * this method.
      *
-     * @exception UnsupportedOperationException The default implementation
+     * @throws    UnsupportedOperationException The default implementation
      *     always throws this exception
-     * @exception NullPointerException if <code>roundingMode</code> is null
-     * @param roundingMode The <code>RoundingMode</code> to be used
+     * @throws    NullPointerException if {@code roundingMode} is null
+     * @param roundingMode The {@code RoundingMode} to be used
      * @see #getRoundingMode()
      * @since 1.6
      */
@@ -996,20 +996,20 @@
     /**
      * First, read in the default serializable data.
      *
-     * Then, if <code>serialVersionOnStream</code> is less than 1, indicating that
+     * Then, if {@code serialVersionOnStream} is less than 1, indicating that
      * the stream was written by JDK 1.1,
-     * set the <code>int</code> fields such as <code>maximumIntegerDigits</code>
-     * to be equal to the <code>byte</code> fields such as <code>maxIntegerDigits</code>,
-     * since the <code>int</code> fields were not present in JDK 1.1.
+     * set the {@code int} fields such as {@code maximumIntegerDigits}
+     * to be equal to the {@code byte} fields such as {@code maxIntegerDigits},
+     * since the {@code int} fields were not present in JDK 1.1.
      * Finally, set serialVersionOnStream back to the maximum allowed value so that
      * default serialization will work properly if this object is streamed out again.
      *
-     * <p>If <code>minimumIntegerDigits</code> is greater than
-     * <code>maximumIntegerDigits</code> or <code>minimumFractionDigits</code>
-     * is greater than <code>maximumFractionDigits</code>, then the stream data
-     * is invalid and this method throws an <code>InvalidObjectException</code>.
+     * <p>If {@code minimumIntegerDigits} is greater than
+     * {@code maximumIntegerDigits} or {@code minimumFractionDigits}
+     * is greater than {@code maximumFractionDigits}, then the stream data
+     * is invalid and this method throws an {@code InvalidObjectException}.
      * In addition, if any of these values is negative, then this method throws
-     * an <code>InvalidObjectException</code>.
+     * an {@code InvalidObjectException}.
      *
      * @since 1.2
      */
@@ -1035,9 +1035,9 @@
 
     /**
      * Write out the default serializable data, after first setting
-     * the <code>byte</code> fields such as <code>maxIntegerDigits</code> to be
-     * equal to the <code>int</code> fields such as <code>maximumIntegerDigits</code>
-     * (or to <code>Byte.MAX_VALUE</code>, whichever is smaller), for compatibility
+     * the {@code byte} fields such as {@code maxIntegerDigits} to be
+     * equal to the {@code int} fields such as {@code maximumIntegerDigits}
+     * (or to {@code Byte.MAX_VALUE}, whichever is smaller), for compatibility
      * with the JDK 1.1 version of the stream format.
      *
      * @since 1.2
@@ -1076,16 +1076,16 @@
 
     /**
      * The maximum number of digits allowed in the integer portion of a
-     * number.  <code>maxIntegerDigits</code> must be greater than or equal to
-     * <code>minIntegerDigits</code>.
+     * number.  {@code maxIntegerDigits} must be greater than or equal to
+     * {@code minIntegerDigits}.
      * <p>
      * <strong>Note:</strong> This field exists only for serialization
      * compatibility with JDK 1.1.  In Java platform 2 v1.2 and higher, the new
-     * <code>int</code> field <code>maximumIntegerDigits</code> is used instead.
-     * When writing to a stream, <code>maxIntegerDigits</code> is set to
-     * <code>maximumIntegerDigits</code> or <code>Byte.MAX_VALUE</code>,
+     * {@code int} field {@code maximumIntegerDigits} is used instead.
+     * When writing to a stream, {@code maxIntegerDigits} is set to
+     * {@code maximumIntegerDigits} or {@code Byte.MAX_VALUE},
      * whichever is smaller.  When reading from a stream, this field is used
-     * only if <code>serialVersionOnStream</code> is less than 1.
+     * only if {@code serialVersionOnStream} is less than 1.
      *
      * @serial
      * @see #getMaximumIntegerDigits
@@ -1094,16 +1094,16 @@
 
     /**
      * The minimum number of digits allowed in the integer portion of a
-     * number.  <code>minimumIntegerDigits</code> must be less than or equal to
-     * <code>maximumIntegerDigits</code>.
+     * number.  {@code minimumIntegerDigits} must be less than or equal to
+     * {@code maximumIntegerDigits}.
      * <p>
      * <strong>Note:</strong> This field exists only for serialization
      * compatibility with JDK 1.1.  In Java platform 2 v1.2 and higher, the new
-     * <code>int</code> field <code>minimumIntegerDigits</code> is used instead.
-     * When writing to a stream, <code>minIntegerDigits</code> is set to
-     * <code>minimumIntegerDigits</code> or <code>Byte.MAX_VALUE</code>,
+     * {@code int} field {@code minimumIntegerDigits} is used instead.
+     * When writing to a stream, {@code minIntegerDigits} is set to
+     * {@code minimumIntegerDigits} or {@code Byte.MAX_VALUE},
      * whichever is smaller.  When reading from a stream, this field is used
-     * only if <code>serialVersionOnStream</code> is less than 1.
+     * only if {@code serialVersionOnStream} is less than 1.
      *
      * @serial
      * @see #getMinimumIntegerDigits
@@ -1112,16 +1112,16 @@
 
     /**
      * The maximum number of digits allowed in the fractional portion of a
-     * number.  <code>maximumFractionDigits</code> must be greater than or equal to
-     * <code>minimumFractionDigits</code>.
+     * number.  {@code maximumFractionDigits} must be greater than or equal to
+     * {@code minimumFractionDigits}.
      * <p>
      * <strong>Note:</strong> This field exists only for serialization
      * compatibility with JDK 1.1.  In Java platform 2 v1.2 and higher, the new
-     * <code>int</code> field <code>maximumFractionDigits</code> is used instead.
-     * When writing to a stream, <code>maxFractionDigits</code> is set to
-     * <code>maximumFractionDigits</code> or <code>Byte.MAX_VALUE</code>,
+     * {@code int} field {@code maximumFractionDigits} is used instead.
+     * When writing to a stream, {@code maxFractionDigits} is set to
+     * {@code maximumFractionDigits} or {@code Byte.MAX_VALUE},
      * whichever is smaller.  When reading from a stream, this field is used
-     * only if <code>serialVersionOnStream</code> is less than 1.
+     * only if {@code serialVersionOnStream} is less than 1.
      *
      * @serial
      * @see #getMaximumFractionDigits
@@ -1130,16 +1130,16 @@
 
     /**
      * The minimum number of digits allowed in the fractional portion of a
-     * number.  <code>minimumFractionDigits</code> must be less than or equal to
-     * <code>maximumFractionDigits</code>.
+     * number.  {@code minimumFractionDigits} must be less than or equal to
+     * {@code maximumFractionDigits}.
      * <p>
      * <strong>Note:</strong> This field exists only for serialization
      * compatibility with JDK 1.1.  In Java platform 2 v1.2 and higher, the new
-     * <code>int</code> field <code>minimumFractionDigits</code> is used instead.
-     * When writing to a stream, <code>minFractionDigits</code> is set to
-     * <code>minimumFractionDigits</code> or <code>Byte.MAX_VALUE</code>,
+     * {@code int} field {@code minimumFractionDigits} is used instead.
+     * When writing to a stream, {@code minFractionDigits} is set to
+     * {@code minimumFractionDigits} or {@code Byte.MAX_VALUE},
      * whichever is smaller.  When reading from a stream, this field is used
-     * only if <code>serialVersionOnStream</code> is less than 1.
+     * only if {@code serialVersionOnStream} is less than 1.
      *
      * @serial
      * @see #getMinimumFractionDigits
@@ -1158,8 +1158,8 @@
 
     /**
      * The maximum number of digits allowed in the integer portion of a
-     * number.  <code>maximumIntegerDigits</code> must be greater than or equal to
-     * <code>minimumIntegerDigits</code>.
+     * number.  {@code maximumIntegerDigits} must be greater than or equal to
+     * {@code minimumIntegerDigits}.
      *
      * @serial
      * @since 1.2
@@ -1169,8 +1169,8 @@
 
     /**
      * The minimum number of digits allowed in the integer portion of a
-     * number.  <code>minimumIntegerDigits</code> must be less than or equal to
-     * <code>maximumIntegerDigits</code>.
+     * number.  {@code minimumIntegerDigits} must be less than or equal to
+     * {@code maximumIntegerDigits}.
      *
      * @serial
      * @since 1.2
@@ -1180,8 +1180,8 @@
 
     /**
      * The maximum number of digits allowed in the fractional portion of a
-     * number.  <code>maximumFractionDigits</code> must be greater than or equal to
-     * <code>minimumFractionDigits</code>.
+     * number.  {@code maximumFractionDigits} must be greater than or equal to
+     * {@code minimumFractionDigits}.
      *
      * @serial
      * @since 1.2
@@ -1191,8 +1191,8 @@
 
     /**
      * The minimum number of digits allowed in the fractional portion of a
-     * number.  <code>minimumFractionDigits</code> must be less than or equal to
-     * <code>maximumFractionDigits</code>.
+     * number.  {@code minimumFractionDigits} must be less than or equal to
+     * {@code maximumFractionDigits}.
      *
      * @serial
      * @since 1.2
@@ -1203,21 +1203,21 @@
     static final int currentSerialVersion = 1;
 
     /**
-     * Describes the version of <code>NumberFormat</code> present on the stream.
+     * Describes the version of {@code NumberFormat} present on the stream.
      * Possible values are:
      * <ul>
      * <li><b>0</b> (or uninitialized): the JDK 1.1 version of the stream format.
-     *     In this version, the <code>int</code> fields such as
-     *     <code>maximumIntegerDigits</code> were not present, and the <code>byte</code>
-     *     fields such as <code>maxIntegerDigits</code> are used instead.
+     *     In this version, the {@code int} fields such as
+     *     {@code maximumIntegerDigits} were not present, and the {@code byte}
+     *     fields such as {@code maxIntegerDigits} are used instead.
      *
      * <li><b>1</b>: the 1.2 version of the stream format.  The values of the
-     *     <code>byte</code> fields such as <code>maxIntegerDigits</code> are ignored,
-     *     and the <code>int</code> fields such as <code>maximumIntegerDigits</code>
+     *     {@code byte} fields such as {@code maxIntegerDigits} are ignored,
+     *     and the {@code int} fields such as {@code maximumIntegerDigits}
      *     are used instead.
      * </ul>
-     * When streaming out a <code>NumberFormat</code>, the most recent format
-     * (corresponding to the highest allowable <code>serialVersionOnStream</code>)
+     * When streaming out a {@code NumberFormat}, the most recent format
+     * (corresponding to the highest allowable {@code serialVersionOnStream})
      * is always written.
      *
      * @serial
@@ -1236,9 +1236,9 @@
     //
     /**
      * Defines constants that are used as attribute keys in the
-     * <code>AttributedCharacterIterator</code> returned
-     * from <code>NumberFormat.formatToCharacterIterator</code> and as
-     * field identifiers in <code>FieldPosition</code>.
+     * {@code AttributedCharacterIterator} returned
+     * from {@code NumberFormat.formatToCharacterIterator} and as
+     * field identifiers in {@code FieldPosition}.
      *
      * @since 1.4
      */
--- a/src/java.base/share/classes/java/text/ParsePosition.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/text/ParsePosition.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,14 +40,14 @@
 
 
 /**
- * <code>ParsePosition</code> is a simple class used by <code>Format</code>
+ * {@code ParsePosition} is a simple class used by {@code Format}
  * and its subclasses to keep track of the current position during parsing.
- * The <code>parseObject</code> method in the various <code>Format</code>
- * classes requires a <code>ParsePosition</code> object as an argument.
+ * The {@code parseObject} method in the various {@code Format}
+ * classes requires a {@code ParsePosition} object as an argument.
  *
  * <p>
  * By design, as you parse through a string with different formats,
- * you can use the same <code>ParsePosition</code>, since the index parameter
+ * you can use the same {@code ParsePosition}, since the index parameter
  * records the current position.
  *
  * @author      Mark Davis
--- a/src/java.base/share/classes/java/text/RBTableBuilder.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/text/RBTableBuilder.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -72,7 +72,7 @@
      * stores them back in the RBCollationTables object.  It is called
      * ONLY by the RBCollationTables constructor.
      * @see RuleBasedCollator#RuleBasedCollator
-     * @exception ParseException If the rules format is incorrect.
+     * @throws    ParseException If the rules format is incorrect.
      */
 
     public void build(String pattern, int decmp) throws ParseException {
--- a/src/java.base/share/classes/java/text/RuleBasedCollator.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/text/RuleBasedCollator.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,14 +43,14 @@
 import java.util.Locale;
 
 /**
- * The <code>RuleBasedCollator</code> class is a concrete subclass of
- * <code>Collator</code> that provides a simple, data-driven, table
+ * The {@code RuleBasedCollator} class is a concrete subclass of
+ * {@code Collator} that provides a simple, data-driven, table
  * collator.  With this class you can create a customized table-based
- * <code>Collator</code>.  <code>RuleBasedCollator</code> maps
+ * {@code Collator}.  {@code RuleBasedCollator} maps
  * characters to sort keys.
  *
  * <p>
- * <code>RuleBasedCollator</code> has the following restrictions
+ * {@code RuleBasedCollator} has the following restrictions
  * for efficiency (other subclasses may be used for more complex languages) :
  * <ol>
  * <li>If a special collation rule controlled by a &lt;modifier&gt; is
@@ -75,7 +75,7 @@
  *        [0021-002F, 003A-0040, 005B-0060, 007B-007E]). If those
  *        characters are desired, you can put them in single quotes
  *        (e.g. ampersand =&gt; '&amp;'). Note that unquoted white space characters
- *        are ignored; e.g. <code>b c</code> is treated as <code>bc</code>.
+ *        are ignored; e.g. {@code b c} is treated as {@code bc}.
  *    <LI><strong>Modifier</strong>: There are currently two modifiers that
  *        turn on special collation rules.
  *        <UL>
@@ -146,7 +146,7 @@
  *
  * <p><strong>Normalization and Accents</strong>
  * <p>
- * <code>RuleBasedCollator</code> automatically processes its rule table to
+ * {@code RuleBasedCollator} automatically processes its rule table to
  * include both pre-composed and combining-character versions of
  * accented characters.  Even if the provided rule string contains only
  * base characters and separate combining accent characters, the pre-composed
@@ -175,8 +175,8 @@
  *         text-argument) is not already in the sequence.
  *         (e.g. "a &lt; b &amp; e &lt; f")
  * </UL>
- * If you produce one of these errors, a <code>RuleBasedCollator</code> throws
- * a <code>ParseException</code>.
+ * If you produce one of these errors, a {@code RuleBasedCollator} throws
+ * a {@code ParseException}.
  *
  * <p><strong>Examples</strong>
  * <p>Simple:     "&lt; a &lt; b &lt; c &lt; d"
@@ -191,9 +191,9 @@
  *                      aa, AA"
  *
  * <p>
- * To create a <code>RuleBasedCollator</code> object with specialized
- * rules tailored to your needs, you construct the <code>RuleBasedCollator</code>
- * with the rules contained in a <code>String</code> object. For example:
+ * To create a {@code RuleBasedCollator} object with specialized
+ * rules tailored to your needs, you construct the {@code RuleBasedCollator}
+ * with the rules contained in a {@code String} object. For example:
  * <blockquote>
  * <pre>
  * String simple = "&lt; a&lt; b&lt; c&lt; d";
@@ -218,7 +218,7 @@
  * <p>
  * A new collation rules string can be created by concatenating rules
  * strings. For example, the rules returned by {@link #getRules()} could
- * be concatenated to combine multiple <code>RuleBasedCollator</code>s.
+ * be concatenated to combine multiple {@code RuleBasedCollator}s.
  *
  * <p>
  * The following example demonstrates how to change the order of
@@ -273,7 +273,7 @@
      * description for more details on the collation rule syntax.
      * @see java.util.Locale
      * @param rules the collation rules to build the collation table from.
-     * @exception ParseException A format exception
+     * @throws    ParseException A format exception
      * will be thrown if the build process of the rules fails. For
      * example, build rule "a &lt; ? &lt; d" will cause the constructor to
      * throw the ParseException because the '?' is not quoted.
@@ -290,7 +290,7 @@
      * @param rules the collation rules to build the collation table from.
      * @param decomp the decomposition strength used to build the
      * collation table and to perform comparisons.
-     * @exception ParseException A format exception
+     * @throws    ParseException A format exception
      * will be thrown if the build process of the rules fails. For
      * example, build rule "a < ? < d" will cause the constructor to
      * throw the ParseException because the '?' is not quoted.
@@ -350,7 +350,7 @@
      * than, greater than or equal to another string in a language.
      * This can be overridden in a subclass.
      *
-     * @exception NullPointerException if <code>source</code> or <code>target</code> is null.
+     * @throws    NullPointerException if {@code source} or {@code target} is null.
      */
     public synchronized int compare(String source, String target)
     {
--- a/src/java.base/share/classes/java/text/SimpleDateFormat.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/text/SimpleDateFormat.java	Tue Sep 24 15:19:35 2019 -0400
@@ -58,19 +58,19 @@
 import sun.util.locale.provider.TimeZoneNameUtility;
 
 /**
- * <code>SimpleDateFormat</code> is a concrete class for formatting and
+ * {@code SimpleDateFormat} is a concrete class for formatting and
  * parsing dates in a locale-sensitive manner. It allows for formatting
  * (date &rarr; text), parsing (text &rarr; date), and normalization.
  *
  * <p>
- * <code>SimpleDateFormat</code> allows you to start by choosing
+ * {@code SimpleDateFormat} allows you to start by choosing
  * any user-defined patterns for date-time formatting. However, you
  * are encouraged to create a date-time formatter with either
- * <code>getTimeInstance</code>, <code>getDateInstance</code>, or
- * <code>getDateTimeInstance</code> in <code>DateFormat</code>. Each
+ * {@code getTimeInstance}, {@code getDateInstance}, or
+ * {@code getDateTimeInstance} in {@code DateFormat}. Each
  * of these class methods can return a date/time formatter initialized
  * with a default format pattern. You may modify the format pattern
- * using the <code>applyPattern</code> methods as desired.
+ * using the {@code applyPattern} methods as desired.
  * For more information on using these methods, see
  * {@link DateFormat}.
  *
@@ -79,19 +79,19 @@
  * Date and time formats are specified by <em>date and time pattern</em>
  * strings.
  * Within date and time pattern strings, unquoted letters from
- * <code>'A'</code> to <code>'Z'</code> and from <code>'a'</code> to
- * <code>'z'</code> are interpreted as pattern letters representing the
+ * {@code 'A'} to {@code 'Z'} and from {@code 'a'} to
+ * {@code 'z'} are interpreted as pattern letters representing the
  * components of a date or time string.
- * Text can be quoted using single quotes (<code>'</code>) to avoid
+ * Text can be quoted using single quotes ({@code '}) to avoid
  * interpretation.
- * <code>"''"</code> represents a single quote.
+ * {@code "''"} represents a single quote.
  * All other characters are not interpreted; they're simply copied into the
  * output string during formatting or matched against the input string
  * during parsing.
  * <p>
  * The following pattern letters are defined (all other characters from
- * <code>'A'</code> to <code>'Z'</code> and from <code>'a'</code> to
- * <code>'z'</code> are reserved):
+ * {@code 'A'} to {@code 'Z'} and from {@code 'a'} to
+ * {@code 'z'} are reserved):
  * <blockquote>
  * <table class="striped">
  * <caption style="display:none">Chart shows pattern letters, date/time component, presentation, and examples.</caption>
@@ -104,120 +104,120 @@
  * </thead>
  * <tbody>
  *     <tr>
- *         <th scope="row"><code>G</code>
+ *         <th scope="row">{@code G}
  *         <td>Era designator
  *         <td><a href="#text">Text</a>
- *         <td><code>AD</code>
+ *         <td>{@code AD}
  *     <tr>
- *         <th scope="row"><code>y</code>
+ *         <th scope="row">{@code y}
  *         <td>Year
  *         <td><a href="#year">Year</a>
- *         <td><code>1996</code>; <code>96</code>
+ *         <td>{@code 1996}; {@code 96}
  *     <tr>
- *         <th scope="row"><code>Y</code>
+ *         <th scope="row">{@code Y}
  *         <td>Week year
  *         <td><a href="#year">Year</a>
- *         <td><code>2009</code>; <code>09</code>
+ *         <td>{@code 2009}; {@code 09}
  *     <tr>
- *         <th scope="row"><code>M</code>
+ *         <th scope="row">{@code M}
  *         <td>Month in year (context sensitive)
  *         <td><a href="#month">Month</a>
- *         <td><code>July</code>; <code>Jul</code>; <code>07</code>
+ *         <td>{@code July}; {@code Jul}; {@code 07}
  *     <tr>
- *         <th scope="row"><code>L</code>
+ *         <th scope="row">{@code L}
  *         <td>Month in year (standalone form)
  *         <td><a href="#month">Month</a>
- *         <td><code>July</code>; <code>Jul</code>; <code>07</code>
+ *         <td>{@code July}; {@code Jul}; {@code 07}
  *     <tr>
- *         <th scope="row"><code>w</code>
+ *         <th scope="row">{@code w}
  *         <td>Week in year
  *         <td><a href="#number">Number</a>
- *         <td><code>27</code>
+ *         <td>{@code 27}
  *     <tr>
- *         <th scope="row"><code>W</code>
+ *         <th scope="row">{@code W}
  *         <td>Week in month
  *         <td><a href="#number">Number</a>
- *         <td><code>2</code>
+ *         <td>{@code 2}
  *     <tr>
- *         <th scope="row"><code>D</code>
+ *         <th scope="row">{@code D}
  *         <td>Day in year
  *         <td><a href="#number">Number</a>
- *         <td><code>189</code>
+ *         <td>{@code 189}
  *     <tr>
- *         <th scope="row"><code>d</code>
+ *         <th scope="row">{@code d}
  *         <td>Day in month
  *         <td><a href="#number">Number</a>
- *         <td><code>10</code>
+ *         <td>{@code 10}
  *     <tr>
- *         <th scope="row"><code>F</code>
+ *         <th scope="row">{@code F}
  *         <td>Day of week in month
  *         <td><a href="#number">Number</a>
- *         <td><code>2</code>
+ *         <td>{@code 2}
  *     <tr>
- *         <th scope="row"><code>E</code>
+ *         <th scope="row">{@code E}
  *         <td>Day name in week
  *         <td><a href="#text">Text</a>
- *         <td><code>Tuesday</code>; <code>Tue</code>
+ *         <td>{@code Tuesday}; {@code Tue}
  *     <tr>
- *         <th scope="row"><code>u</code>
+ *         <th scope="row">{@code u}
  *         <td>Day number of week (1 = Monday, ..., 7 = Sunday)
  *         <td><a href="#number">Number</a>
- *         <td><code>1</code>
+ *         <td>{@code 1}
  *     <tr>
- *         <th scope="row"><code>a</code>
+ *         <th scope="row">{@code a}
  *         <td>Am/pm marker
  *         <td><a href="#text">Text</a>
- *         <td><code>PM</code>
+ *         <td>{@code PM}
  *     <tr>
- *         <th scope="row"><code>H</code>
+ *         <th scope="row">{@code H}
  *         <td>Hour in day (0-23)
  *         <td><a href="#number">Number</a>
- *         <td><code>0</code>
+ *         <td>{@code 0}
  *     <tr>
- *         <th scope="row"><code>k</code>
+ *         <th scope="row">{@code k}
  *         <td>Hour in day (1-24)
  *         <td><a href="#number">Number</a>
- *         <td><code>24</code>
+ *         <td>{@code 24}
  *     <tr>
- *         <th scope="row"><code>K</code>
+ *         <th scope="row">{@code K}
  *         <td>Hour in am/pm (0-11)
  *         <td><a href="#number">Number</a>
- *         <td><code>0</code>
+ *         <td>{@code 0}
  *     <tr>
- *         <th scope="row"><code>h</code>
+ *         <th scope="row">{@code h}
  *         <td>Hour in am/pm (1-12)
  *         <td><a href="#number">Number</a>
- *         <td><code>12</code>
+ *         <td>{@code 12}
  *     <tr>
- *         <th scope="row"><code>m</code>
+ *         <th scope="row">{@code m}
  *         <td>Minute in hour
  *         <td><a href="#number">Number</a>
- *         <td><code>30</code>
+ *         <td>{@code 30}
  *     <tr>
- *         <th scope="row"><code>s</code>
+ *         <th scope="row">{@code s}
  *         <td>Second in minute
  *         <td><a href="#number">Number</a>
- *         <td><code>55</code>
+ *         <td>{@code 55}
  *     <tr>
- *         <th scope="row"><code>S</code>
+ *         <th scope="row">{@code S}
  *         <td>Millisecond
  *         <td><a href="#number">Number</a>
- *         <td><code>978</code>
+ *         <td>{@code 978}
  *     <tr>
- *         <th scope="row"><code>z</code>
+ *         <th scope="row">{@code z}
  *         <td>Time zone
  *         <td><a href="#timezone">General time zone</a>
- *         <td><code>Pacific Standard Time</code>; <code>PST</code>; <code>GMT-08:00</code>
+ *         <td>{@code Pacific Standard Time}; {@code PST}; {@code GMT-08:00}
  *     <tr>
- *         <th scope="row"><code>Z</code>
+ *         <th scope="row">{@code Z}
  *         <td>Time zone
  *         <td><a href="#rfc822timezone">RFC 822 time zone</a>
- *         <td><code>-0800</code>
+ *         <td>{@code -0800}
  *     <tr>
- *         <th scope="row"><code>X</code>
+ *         <th scope="row">{@code X}
  *         <td>Time zone
  *         <td><a href="#iso8601timezone">ISO 8601 time zone</a>
- *         <td><code>-08</code>; <code>-0800</code>;  <code>-08:00</code>
+ *         <td>{@code -08}; {@code -0800};  {@code -08:00}
  * </tbody>
  * </table>
  * </blockquote>
@@ -247,11 +247,11 @@
  *         digits. So using the pattern "MM/dd/yyyy", "01/11/12" parses to
  *         Jan 11, 12 A.D.
  *     <li>For parsing with the abbreviated year pattern ("y" or "yy"),
- *         <code>SimpleDateFormat</code> must interpret the abbreviated year
+ *         {@code SimpleDateFormat} must interpret the abbreviated year
  *         relative to some century.  It does this by adjusting dates to be
- *         within 80 years before and 20 years after the time the <code>SimpleDateFormat</code>
+ *         within 80 years before and 20 years after the time the {@code SimpleDateFormat}
  *         instance is created. For example, using a pattern of "MM/dd/yy" and a
- *         <code>SimpleDateFormat</code> instance created on Jan 1, 1997,  the string
+ *         {@code SimpleDateFormat} instance created on Jan 1, 1997,  the string
  *         "01/11/12" would be interpreted as Jan 11, 2012 while the string "05/04/64"
  *         would be interpreted as May 4, 1964.
  *         During parsing, only strings consisting of exactly two digits, as defined by
@@ -303,16 +303,16 @@
  *     following syntax is used:
  *     <pre>
  *     <a id="GMTOffsetTimeZone"><i>GMTOffsetTimeZone:</i></a>
- *             <code>GMT</code> <i>Sign</i> <i>Hours</i> <code>:</code> <i>Minutes</i>
+ *             {@code GMT} <i>Sign</i> <i>Hours</i> {@code :} <i>Minutes</i>
  *     <i>Sign:</i> one of
- *             <code>+ -</code>
+ *             {@code + -}
  *     <i>Hours:</i>
  *             <i>Digit</i>
  *             <i>Digit</i> <i>Digit</i>
  *     <i>Minutes:</i>
  *             <i>Digit</i> <i>Digit</i>
  *     <i>Digit:</i> one of
- *             <code>0 1 2 3 4 5 6 7 8 9</code></pre>
+ *             {@code 0 1 2 3 4 5 6 7 8 9}</pre>
  *     <i>Hours</i> must be between 0 and 23, and <i>Minutes</i> must be between
  *     00 and 59. The format is locale independent and digits must be taken
  *     from the Basic Latin block of the Unicode standard.
@@ -364,10 +364,10 @@
  *     SimpleDateFormat} or {@linkplain #applyPattern(String) applying a
  *     pattern}.
  * </ul>
- * <code>SimpleDateFormat</code> also supports <em>localized date and time
+ * {@code SimpleDateFormat} also supports <em>localized date and time
  * pattern</em> strings. In these strings, the pattern letters described above
  * may be replaced with other, locale dependent, pattern letters.
- * <code>SimpleDateFormat</code> does not deal with the localization of text
+ * {@code SimpleDateFormat} does not deal with the localization of text
  * other than the pattern letters; that's up to the client of the class.
  *
  * <h3>Examples</h3>
@@ -385,38 +385,38 @@
  * </thead>
  * <tbody>
  *     <tr>
- *         <th scope="row"><code>"yyyy.MM.dd G 'at' HH:mm:ss z"</code>
- *         <td><code>2001.07.04 AD at 12:08:56 PDT</code>
+ *         <th scope="row">{@code "yyyy.MM.dd G 'at' HH:mm:ss z"}
+ *         <td>{@code 2001.07.04 AD at 12:08:56 PDT}
  *     <tr>
- *         <th scope="row"><code>"EEE, MMM d, ''yy"</code>
- *         <td><code>Wed, Jul 4, '01</code>
+ *         <th scope="row">{@code "EEE, MMM d, ''yy"}
+ *         <td>{@code Wed, Jul 4, '01}
  *     <tr>
- *         <th scope="row"><code>"h:mm a"</code>
- *         <td><code>12:08 PM</code>
+ *         <th scope="row">{@code "h:mm a"}
+ *         <td>{@code 12:08 PM}
  *     <tr>
- *         <th scope="row"><code>"hh 'o''clock' a, zzzz"</code>
- *         <td><code>12 o'clock PM, Pacific Daylight Time</code>
+ *         <th scope="row">{@code "hh 'o''clock' a, zzzz"}
+ *         <td>{@code 12 o'clock PM, Pacific Daylight Time}
  *     <tr>
- *         <th scope="row"><code>"K:mm a, z"</code>
- *         <td><code>0:08 PM, PDT</code>
+ *         <th scope="row">{@code "K:mm a, z"}
+ *         <td>{@code 0:08 PM, PDT}
  *     <tr>
- *         <th scope="row"><code>"yyyyy.MMMMM.dd GGG hh:mm aaa"</code>
- *         <td><code>02001.July.04 AD 12:08 PM</code>
+ *         <th scope="row">{@code "yyyyy.MMMMM.dd GGG hh:mm aaa"}
+ *         <td>{@code 02001.July.04 AD 12:08 PM}
  *     <tr>
- *         <th scope="row"><code>"EEE, d MMM yyyy HH:mm:ss Z"</code>
- *         <td><code>Wed, 4 Jul 2001 12:08:56 -0700</code>
+ *         <th scope="row">{@code "EEE, d MMM yyyy HH:mm:ss Z"}
+ *         <td>{@code Wed, 4 Jul 2001 12:08:56 -0700}
  *     <tr>
- *         <th scope="row"><code>"yyMMddHHmmssZ"</code>
- *         <td><code>010704120856-0700</code>
+ *         <th scope="row">{@code "yyMMddHHmmssZ"}
+ *         <td>{@code 010704120856-0700}
  *     <tr>
- *         <th scope="row"><code>"yyyy-MM-dd'T'HH:mm:ss.SSSZ"</code>
- *         <td><code>2001-07-04T12:08:56.235-0700</code>
+ *         <th scope="row">{@code "yyyy-MM-dd'T'HH:mm:ss.SSSZ"}
+ *         <td>{@code 2001-07-04T12:08:56.235-0700}
  *     <tr>
- *         <th scope="row"><code>"yyyy-MM-dd'T'HH:mm:ss.SSSXXX"</code>
- *         <td><code>2001-07-04T12:08:56.235-07:00</code>
+ *         <th scope="row">{@code "yyyy-MM-dd'T'HH:mm:ss.SSSXXX"}
+ *         <td>{@code 2001-07-04T12:08:56.235-07:00}
  *     <tr>
- *         <th scope="row"><code>"YYYY-'W'ww-u"</code>
- *         <td><code>2001-W27-3</code>
+ *         <th scope="row">{@code "YYYY-'W'ww-u"}
+ *         <td>{@code 2001-W27-3}
  * </tbody>
  * </table>
  * </blockquote>
@@ -453,12 +453,12 @@
      * The version of the serialized data on the stream.  Possible values:
      * <ul>
      * <li><b>0</b> or not present on stream: JDK 1.1.3.  This version
-     * has no <code>defaultCenturyStart</code> on stream.
+     * has no {@code defaultCenturyStart} on stream.
      * <li><b>1</b> JDK 1.1.4 or later.  This version adds
-     * <code>defaultCenturyStart</code>.
+     * {@code defaultCenturyStart}.
      * </ul>
      * When streaming out this class, the most recent format
-     * and the highest allowable <code>serialVersionOnStream</code>
+     * and the highest allowable {@code serialVersionOnStream}
      * is written.
      * @serial
      * @since 1.1.4
@@ -523,7 +523,7 @@
 
     /**
      * We map dates with two-digit years into the century starting at
-     * <code>defaultCenturyStart</code>, which may be any date.  May
+     * {@code defaultCenturyStart}, which may be any date.  May
      * not be null.
      * @serial
      * @since 1.1.4
@@ -546,8 +546,8 @@
 
     /**
      * The Locale used to instantiate this
-     * <code>SimpleDateFormat</code>. The value may be null if this object
-     * has been created by an older <code>SimpleDateFormat</code> and
+     * {@code SimpleDateFormat}. The value may be null if this object
+     * has been created by an older {@code SimpleDateFormat} and
      * deserialized.
      *
      * @serial
@@ -556,7 +556,7 @@
     private Locale locale;
 
     /**
-     * Indicates whether this <code>SimpleDateFormat</code> should use
+     * Indicates whether this {@code SimpleDateFormat} should use
      * the DateFormatSymbols. If true, the format and parse methods
      * use the DateFormatSymbols values. If false, the format and
      * parse methods call Calendar.getDisplayName or
@@ -565,7 +565,7 @@
     transient boolean useDateFormatSymbols;
 
     /**
-     * Constructs a <code>SimpleDateFormat</code> using the default pattern and
+     * Constructs a {@code SimpleDateFormat} using the default pattern and
      * date format symbols for the default
      * {@link java.util.Locale.Category#FORMAT FORMAT} locale.
      * <b>Note:</b> This constructor may not support all locales.
@@ -579,7 +579,7 @@
     }
 
     /**
-     * Constructs a <code>SimpleDateFormat</code> using the given pattern and
+     * Constructs a {@code SimpleDateFormat} using the given pattern and
      * the default date format symbols for the default
      * {@link java.util.Locale.Category#FORMAT FORMAT} locale.
      * <b>Note:</b> This constructor may not support all locales.
@@ -592,8 +592,8 @@
      * @see java.util.Locale#getDefault(java.util.Locale.Category)
      * @see java.util.Locale.Category#FORMAT
      * @param pattern the pattern describing the date and time format
-     * @exception NullPointerException if the given pattern is null
-     * @exception IllegalArgumentException if the given pattern is invalid
+     * @throws    NullPointerException if the given pattern is null
+     * @throws    IllegalArgumentException if the given pattern is invalid
      */
     public SimpleDateFormat(String pattern)
     {
@@ -601,7 +601,7 @@
     }
 
     /**
-     * Constructs a <code>SimpleDateFormat</code> using the given pattern and
+     * Constructs a {@code SimpleDateFormat} using the given pattern and
      * the default date format symbols for the given locale.
      * <b>Note:</b> This constructor may not support all locales.
      * For full coverage, use the factory methods in the {@link DateFormat}
@@ -609,8 +609,8 @@
      *
      * @param pattern the pattern describing the date and time format
      * @param locale the locale whose date format symbols should be used
-     * @exception NullPointerException if the given pattern or locale is null
-     * @exception IllegalArgumentException if the given pattern is invalid
+     * @throws    NullPointerException if the given pattern or locale is null
+     * @throws    IllegalArgumentException if the given pattern is invalid
      */
     public SimpleDateFormat(String pattern, Locale locale)
     {
@@ -626,13 +626,13 @@
     }
 
     /**
-     * Constructs a <code>SimpleDateFormat</code> using the given pattern and
+     * Constructs a {@code SimpleDateFormat} using the given pattern and
      * date format symbols.
      *
      * @param pattern the pattern describing the date and time format
      * @param formatSymbols the date format symbols to be used for formatting
-     * @exception NullPointerException if the given pattern or formatSymbols is null
-     * @exception IllegalArgumentException if the given pattern is invalid
+     * @throws    NullPointerException if the given pattern or formatSymbols is null
+     * @throws    IllegalArgumentException if the given pattern is invalid
      */
     public SimpleDateFormat(String pattern, DateFormatSymbols formatSymbols)
     {
@@ -739,8 +739,8 @@
      * is "'o'", the TaggedData entry is
      * <code>((TAG_QUOTE_ASCII_CHAR&nbs;<<&nbs;8)&nbs;|&nbs;'o')</code>.
      *
-     * @exception NullPointerException if the given pattern is null
-     * @exception IllegalArgumentException if the given pattern is invalid
+     * @throws    NullPointerException if the given pattern is null
+     * @throws    IllegalArgumentException if the given pattern is invalid
      */
     private char[] compile(String pattern) {
         int length = pattern.length();
@@ -916,7 +916,7 @@
      * to begin on the date the user specifies.
      *
      * @param startDate During parsing, two digit years will be placed in the range
-     * <code>startDate</code> to <code>startDate + 100 years</code>.
+     * {@code startDate} to {@code startDate + 100 years}.
      * @see #get2DigitYearStart
      * @throws NullPointerException if {@code startDate} is {@code null}.
      * @since 1.2
@@ -939,8 +939,8 @@
     }
 
     /**
-     * Formats the given <code>Date</code> into a date/time string and appends
-     * the result to the given <code>StringBuffer</code>.
+     * Formats the given {@code Date} into a date/time string and appends
+     * the result to the given {@code StringBuffer}.
      *
      * @param date the date-time value to be formatted into a date-time string.
      * @param toAppendTo where the new date-time text is to be appended.
@@ -958,7 +958,7 @@
      * {@code fieldPosition} will be set to 5 and 8, respectively, for the
      * first occurrence of the timezone pattern character {@code 'z'}.
      * @return the formatted date-time string.
-     * @exception NullPointerException if any of the parameters is {@code null}.
+     * @throws    NullPointerException if any of the parameters is {@code null}.
      */
     @Override
     public StringBuffer format(Date date, StringBuffer toAppendTo,
@@ -1003,17 +1003,17 @@
     }
 
     /**
-     * Formats an Object producing an <code>AttributedCharacterIterator</code>.
-     * You can use the returned <code>AttributedCharacterIterator</code>
+     * Formats an Object producing an {@code AttributedCharacterIterator}.
+     * You can use the returned {@code AttributedCharacterIterator}
      * to build the resulting String, as well as to determine information
      * about the resulting String.
      * <p>
      * Each attribute key of the AttributedCharacterIterator will be of type
-     * <code>DateFormat.Field</code>, with the corresponding attribute value
+     * {@code DateFormat.Field}, with the corresponding attribute value
      * being the same as the attribute key.
      *
-     * @exception NullPointerException if obj is null.
-     * @exception IllegalArgumentException if the Format cannot format the
+     * @throws    NullPointerException if obj is null.
+     * @throws    IllegalArgumentException if the Format cannot format the
      *            given object, or if the Format's pattern string is invalid.
      * @param obj The object to format
      * @return AttributedCharacterIterator describing the formatted value.
@@ -1427,17 +1427,17 @@
 
 
     /**
-     * Parses text from a string to produce a <code>Date</code>.
+     * Parses text from a string to produce a {@code Date}.
      * <p>
      * The method attempts to parse text starting at the index given by
-     * <code>pos</code>.
-     * If parsing succeeds, then the index of <code>pos</code> is updated
+     * {@code pos}.
+     * If parsing succeeds, then the index of {@code pos} is updated
      * to the index after the last character used (parsing does not necessarily
      * use all characters up to the end of the string), and the parsed
-     * date is returned. The updated <code>pos</code> can be used to
+     * date is returned. The updated {@code pos} can be used to
      * indicate the starting point for the next call to this method.
-     * If an error occurs, then the index of <code>pos</code> is not
-     * changed, the error index of <code>pos</code> is set to the index of
+     * If an error occurs, then the index of {@code pos} is not
+     * changed, the error index of {@code pos} is set to the index of
      * the character where the error occurred, and null is returned.
      *
      * <p>This parsing operation uses the {@link DateFormat#calendar
@@ -1454,12 +1454,12 @@
      * {@link #setTimeZone(java.util.TimeZone) setTimeZone} may need
      * to be restored for further operations.
      *
-     * @param text  A <code>String</code>, part of which should be parsed.
-     * @param pos   A <code>ParsePosition</code> object with index and error
+     * @param text  A {@code String}, part of which should be parsed.
+     * @param pos   A {@code ParsePosition} object with index and error
      *              index information as described above.
-     * @return A <code>Date</code> parsed from the string. In case of
+     * @return A {@code Date} parsed from the string. In case of
      *         error, returns null.
-     * @exception NullPointerException if <code>text</code> or <code>pos</code> is null.
+     * @throws    NullPointerException if {@code text} or {@code pos} is null.
      */
     @Override
     public Date parse(String text, ParsePosition pos)
@@ -2276,7 +2276,7 @@
      * Translates a pattern, mapping each character in the from string to the
      * corresponding character in the to string.
      *
-     * @exception IllegalArgumentException if the given pattern is invalid
+     * @throws    IllegalArgumentException if the given pattern is invalid
      */
     private String translatePattern(String pattern, String from, String to) {
         StringBuilder result = new StringBuilder();
@@ -2339,8 +2339,8 @@
      * Applies the given pattern string to this date format.
      *
      * @param pattern the new date and time pattern for this date format
-     * @exception NullPointerException if the given pattern is null
-     * @exception IllegalArgumentException if the given pattern is invalid
+     * @throws    NullPointerException if the given pattern is null
+     * @throws    IllegalArgumentException if the given pattern is invalid
      */
     public void applyPattern(String pattern)
     {
@@ -2357,8 +2357,8 @@
      *
      * @param pattern a String to be mapped to the new date and time format
      *        pattern for this format
-     * @exception NullPointerException if the given pattern is null
-     * @exception IllegalArgumentException if the given pattern is invalid
+     * @throws    NullPointerException if the given pattern is null
+     * @throws    IllegalArgumentException if the given pattern is invalid
      */
     public void applyLocalizedPattern(String pattern) {
          String p = translatePattern(pattern,
@@ -2383,7 +2383,7 @@
      * Sets the date and time format symbols of this date format.
      *
      * @param newFormatSymbols the new date and time format symbols
-     * @exception NullPointerException if the given newFormatSymbols is null
+     * @throws    NullPointerException if the given newFormatSymbols is null
      * @see #getDateFormatSymbols
      */
     public void setDateFormatSymbols(DateFormatSymbols newFormatSymbols)
@@ -2393,10 +2393,10 @@
     }
 
     /**
-     * Creates a copy of this <code>SimpleDateFormat</code>. This also
+     * Creates a copy of this {@code SimpleDateFormat}. This also
      * clones the format's date format symbols.
      *
-     * @return a clone of this <code>SimpleDateFormat</code>
+     * @return a clone of this {@code SimpleDateFormat}
      */
     @Override
     public Object clone() {
@@ -2406,9 +2406,9 @@
     }
 
     /**
-     * Returns the hash code value for this <code>SimpleDateFormat</code> object.
+     * Returns the hash code value for this {@code SimpleDateFormat} object.
      *
-     * @return the hash code value for this <code>SimpleDateFormat</code> object.
+     * @return the hash code value for this {@code SimpleDateFormat} object.
      */
     @Override
     public int hashCode()
@@ -2418,11 +2418,11 @@
     }
 
     /**
-     * Compares the given object with this <code>SimpleDateFormat</code> for
+     * Compares the given object with this {@code SimpleDateFormat} for
      * equality.
      *
      * @return true if the given object is equal to this
-     * <code>SimpleDateFormat</code>
+     * {@code SimpleDateFormat}
      */
     @Override
     public boolean equals(Object obj)
@@ -2470,7 +2470,7 @@
      * After reading an object from the input stream, the format
      * pattern in the object is verified.
      *
-     * @exception InvalidObjectException if the pattern is invalid
+     * @throws    InvalidObjectException if the pattern is invalid
      */
     @java.io.Serial
     private void readObject(ObjectInputStream stream)
--- a/src/java.base/share/classes/java/text/StringCharacterIterator.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/text/StringCharacterIterator.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,10 +41,10 @@
 package java.text;
 
 /**
- * <code>StringCharacterIterator</code> implements the
- * <code>CharacterIterator</code> protocol for a <code>String</code>.
- * The <code>StringCharacterIterator</code> class iterates over the
- * entire <code>String</code>.
+ * {@code StringCharacterIterator} implements the
+ * {@code CharacterIterator} protocol for a {@code String}.
+ * The {@code StringCharacterIterator} class iterates over the
+ * entire {@code String}.
  *
  * @see CharacterIterator
  * @since 1.1
--- a/src/java.base/share/classes/java/text/spi/BreakIteratorProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/text/spi/BreakIteratorProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,13 +46,13 @@
     }
 
     /**
-     * Returns a new <code>BreakIterator</code> instance
+     * Returns a new {@code BreakIterator} instance
      * for <a href="../BreakIterator.html#word">word breaks</a>
      * for the given locale.
      * @param locale the desired locale
      * @return A break iterator for word breaks
-     * @exception NullPointerException if <code>locale</code> is null
-     * @exception IllegalArgumentException if <code>locale</code> isn't
+     * @throws    NullPointerException if {@code locale} is null
+     * @throws    IllegalArgumentException if {@code locale} isn't
      *     one of the locales returned from
      *     {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
      *     getAvailableLocales()}.
@@ -61,13 +61,13 @@
     public abstract BreakIterator getWordInstance(Locale locale);
 
     /**
-     * Returns a new <code>BreakIterator</code> instance
+     * Returns a new {@code BreakIterator} instance
      * for <a href="../BreakIterator.html#line">line breaks</a>
      * for the given locale.
      * @param locale the desired locale
      * @return A break iterator for line breaks
-     * @exception NullPointerException if <code>locale</code> is null
-     * @exception IllegalArgumentException if <code>locale</code> isn't
+     * @throws    NullPointerException if {@code locale} is null
+     * @throws    IllegalArgumentException if {@code locale} isn't
      *     one of the locales returned from
      *     {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
      *     getAvailableLocales()}.
@@ -76,13 +76,13 @@
     public abstract BreakIterator getLineInstance(Locale locale);
 
     /**
-     * Returns a new <code>BreakIterator</code> instance
+     * Returns a new {@code BreakIterator} instance
      * for <a href="../BreakIterator.html#character">character breaks</a>
      * for the given locale.
      * @param locale the desired locale
      * @return A break iterator for character breaks
-     * @exception NullPointerException if <code>locale</code> is null
-     * @exception IllegalArgumentException if <code>locale</code> isn't
+     * @throws    NullPointerException if {@code locale} is null
+     * @throws    IllegalArgumentException if {@code locale} isn't
      *     one of the locales returned from
      *     {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
      *     getAvailableLocales()}.
@@ -91,13 +91,13 @@
     public abstract BreakIterator getCharacterInstance(Locale locale);
 
     /**
-     * Returns a new <code>BreakIterator</code> instance
+     * Returns a new {@code BreakIterator} instance
      * for <a href="../BreakIterator.html#sentence">sentence breaks</a>
      * for the given locale.
      * @param locale the desired locale
      * @return A break iterator for sentence breaks
-     * @exception NullPointerException if <code>locale</code> is null
-     * @exception IllegalArgumentException if <code>locale</code> isn't
+     * @throws    NullPointerException if {@code locale} is null
+     * @throws    IllegalArgumentException if {@code locale} isn't
      *     one of the locales returned from
      *     {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
      *     getAvailableLocales()}.
--- a/src/java.base/share/classes/java/text/spi/CollatorProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/text/spi/CollatorProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,12 +46,12 @@
     }
 
     /**
-     * Returns a new <code>Collator</code> instance for the specified locale.
+     * Returns a new {@code Collator} instance for the specified locale.
      * @param locale the desired locale.
-     * @return the <code>Collator</code> for the desired locale.
-     * @exception NullPointerException if
-     * <code>locale</code> is null
-     * @exception IllegalArgumentException if <code>locale</code> isn't
+     * @return the {@code Collator} for the desired locale.
+     * @throws    NullPointerException if
+     * {@code locale} is null
+     * @throws    IllegalArgumentException if {@code locale} isn't
      *     one of the locales returned from
      *     {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
      *     getAvailableLocales()}.
--- a/src/java.base/share/classes/java/text/spi/DateFormatProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/text/spi/DateFormatProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,7 +46,7 @@
     }
 
     /**
-     * Returns a new <code>DateFormat</code> instance which formats time
+     * Returns a new {@code DateFormat} instance which formats time
      * with the given formatting style for the specified locale.
      * @param style the given formatting style.  Either one of
      *     {@link java.text.DateFormat#SHORT DateFormat.SHORT},
@@ -54,19 +54,19 @@
      *     {@link java.text.DateFormat#LONG DateFormat.LONG}, or
      *     {@link java.text.DateFormat#FULL DateFormat.FULL}.
      * @param locale the desired locale.
-     * @exception IllegalArgumentException if <code>style</code> is invalid,
-     *     or if <code>locale</code> isn't
+     * @throws    IllegalArgumentException if {@code style} is invalid,
+     *     or if {@code locale} isn't
      *     one of the locales returned from
      *     {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
      *     getAvailableLocales()}.
-     * @exception NullPointerException if <code>locale</code> is null
+     * @throws    NullPointerException if {@code locale} is null
      * @return a time formatter.
      * @see java.text.DateFormat#getTimeInstance(int, java.util.Locale)
      */
     public abstract DateFormat getTimeInstance(int style, Locale locale);
 
     /**
-     * Returns a new <code>DateFormat</code> instance which formats date
+     * Returns a new {@code DateFormat} instance which formats date
      * with the given formatting style for the specified locale.
      * @param style the given formatting style.  Either one of
      *     {@link java.text.DateFormat#SHORT DateFormat.SHORT},
@@ -74,19 +74,19 @@
      *     {@link java.text.DateFormat#LONG DateFormat.LONG}, or
      *     {@link java.text.DateFormat#FULL DateFormat.FULL}.
      * @param locale the desired locale.
-     * @exception IllegalArgumentException if <code>style</code> is invalid,
-     *     or if <code>locale</code> isn't
+     * @throws    IllegalArgumentException if {@code style} is invalid,
+     *     or if {@code locale} isn't
      *     one of the locales returned from
      *     {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
      *     getAvailableLocales()}.
-     * @exception NullPointerException if <code>locale</code> is null
+     * @throws    NullPointerException if {@code locale} is null
      * @return a date formatter.
      * @see java.text.DateFormat#getDateInstance(int, java.util.Locale)
      */
     public abstract DateFormat getDateInstance(int style, Locale locale);
 
     /**
-     * Returns a new <code>DateFormat</code> instance which formats date and time
+     * Returns a new {@code DateFormat} instance which formats date and time
      * with the given formatting style for the specified locale.
      * @param dateStyle the given date formatting style.  Either one of
      *     {@link java.text.DateFormat#SHORT DateFormat.SHORT},
@@ -99,13 +99,13 @@
      *     {@link java.text.DateFormat#LONG DateFormat.LONG}, or
      *     {@link java.text.DateFormat#FULL DateFormat.FULL}.
      * @param locale the desired locale.
-     * @exception IllegalArgumentException if <code>dateStyle</code> or
-     *     <code>timeStyle</code> is invalid,
-     *     or if <code>locale</code> isn't
+     * @throws    IllegalArgumentException if {@code dateStyle} or
+     *     {@code timeStyle} is invalid,
+     *     or if {@code locale} isn't
      *     one of the locales returned from
      *     {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
      *     getAvailableLocales()}.
-     * @exception NullPointerException if <code>locale</code> is null
+     * @throws    NullPointerException if {@code locale} is null
      * @return a date/time formatter.
      * @see java.text.DateFormat#getDateTimeInstance(int, int, java.util.Locale)
      */
--- a/src/java.base/share/classes/java/text/spi/DateFormatSymbolsProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/text/spi/DateFormatSymbolsProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,16 +46,16 @@
     }
 
     /**
-     * Returns a new <code>DateFormatSymbols</code> instance for the
+     * Returns a new {@code DateFormatSymbols} instance for the
      * specified locale.
      *
      * @param locale the desired locale
-     * @exception NullPointerException if <code>locale</code> is null
-     * @exception IllegalArgumentException if <code>locale</code> isn't
+     * @throws    NullPointerException if {@code locale} is null
+     * @throws    IllegalArgumentException if {@code locale} isn't
      *     one of the locales returned from
      *     {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
      *     getAvailableLocales()}.
-     * @return a <code>DateFormatSymbols</code> instance.
+     * @return a {@code DateFormatSymbols} instance.
      * @see java.text.DateFormatSymbols#getInstance(java.util.Locale)
      */
     public abstract DateFormatSymbols getInstance(Locale locale);
--- a/src/java.base/share/classes/java/text/spi/DecimalFormatSymbolsProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/text/spi/DecimalFormatSymbolsProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -56,16 +56,16 @@
     }
 
     /**
-     * Returns a new <code>DecimalFormatSymbols</code> instance for the
+     * Returns a new {@code DecimalFormatSymbols} instance for the
      * specified locale.
      *
      * @param locale the desired locale
-     * @exception NullPointerException if <code>locale</code> is null
-     * @exception IllegalArgumentException if <code>locale</code> isn't
+     * @throws    NullPointerException if {@code locale} is null
+     * @throws    IllegalArgumentException if {@code locale} isn't
      *     one of the locales returned from
      *     {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
      *     getAvailableLocales()}.
-     * @return a <code>DecimalFormatSymbols</code> instance.
+     * @return a {@code DecimalFormatSymbols} instance.
      * @see java.text.DecimalFormatSymbols#getInstance(java.util.Locale)
      */
     public abstract DecimalFormatSymbols getInstance(Locale locale);
--- a/src/java.base/share/classes/java/text/spi/NumberFormatProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/text/spi/NumberFormatProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,12 +46,12 @@
     }
 
     /**
-     * Returns a new <code>NumberFormat</code> instance which formats
+     * Returns a new {@code NumberFormat} instance which formats
      * monetary values for the specified locale.
      *
      * @param locale the desired locale.
-     * @exception NullPointerException if <code>locale</code> is null
-     * @exception IllegalArgumentException if <code>locale</code> isn't
+     * @throws    NullPointerException if {@code locale} is null
+     * @throws    IllegalArgumentException if {@code locale} isn't
      *     one of the locales returned from
      *     {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
      *     getAvailableLocales()}.
@@ -61,7 +61,7 @@
     public abstract NumberFormat getCurrencyInstance(Locale locale);
 
     /**
-     * Returns a new <code>NumberFormat</code> instance which formats
+     * Returns a new {@code NumberFormat} instance which formats
      * integer values for the specified locale.
      * The returned number format is configured to
      * round floating point numbers to the nearest integer using
@@ -71,8 +71,8 @@
      * java.text.NumberFormat#isParseIntegerOnly isParseIntegerOnly}).
      *
      * @param locale the desired locale
-     * @exception NullPointerException if <code>locale</code> is null
-     * @exception IllegalArgumentException if <code>locale</code> isn't
+     * @throws    NullPointerException if {@code locale} is null
+     * @throws    IllegalArgumentException if {@code locale} isn't
      *     one of the locales returned from
      *     {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
      *     getAvailableLocales()}.
@@ -82,12 +82,12 @@
     public abstract NumberFormat getIntegerInstance(Locale locale);
 
     /**
-     * Returns a new general-purpose <code>NumberFormat</code> instance for
+     * Returns a new general-purpose {@code NumberFormat} instance for
      * the specified locale.
      *
      * @param locale the desired locale
-     * @exception NullPointerException if <code>locale</code> is null
-     * @exception IllegalArgumentException if <code>locale</code> isn't
+     * @throws    NullPointerException if {@code locale} is null
+     * @throws    IllegalArgumentException if {@code locale} isn't
      *     one of the locales returned from
      *     {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
      *     getAvailableLocales()}.
@@ -97,12 +97,12 @@
     public abstract NumberFormat getNumberInstance(Locale locale);
 
     /**
-     * Returns a new <code>NumberFormat</code> instance which formats
+     * Returns a new {@code NumberFormat} instance which formats
      * percentage values for the specified locale.
      *
      * @param locale the desired locale
-     * @exception NullPointerException if <code>locale</code> is null
-     * @exception IllegalArgumentException if <code>locale</code> isn't
+     * @throws    NullPointerException if {@code locale} is null
+     * @throws    IllegalArgumentException if {@code locale} isn't
      *     one of the locales returned from
      *     {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
      *     getAvailableLocales()}.
--- a/src/java.base/share/classes/java/time/ZoneId.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/time/ZoneId.java	Tue Sep 24 15:19:35 2019 -0400
@@ -339,7 +339,7 @@
      *  The rules of the returned {@code ZoneId} will be equivalent to the
      *  parsed {@code ZoneOffset}.
      * <li>All other IDs are parsed as region-based zone IDs. Region IDs must
-     *  match the regular expression <code>[A-Za-z][A-Za-z0-9~/._+-]+</code>
+     *  match the regular expression {@code [A-Za-z][A-Za-z0-9~/._+-]+}
      *  otherwise a {@code DateTimeException} is thrown. If the zone ID is not
      *  in the configured set of IDs, {@code ZoneRulesException} is thrown.
      *  The detailed format of the region ID depends on the group supplying the data.
--- a/src/java.base/share/classes/java/util/Calendar.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/Calendar.java	Tue Sep 24 15:19:35 2019 -0400
@@ -62,10 +62,10 @@
 import sun.util.spi.CalendarProvider;
 
 /**
- * The <code>Calendar</code> class is an abstract class that provides methods
+ * The {@code Calendar} class is an abstract class that provides methods
  * for converting between a specific instant in time and a set of {@link
- * #fields calendar fields} such as <code>YEAR</code>, <code>MONTH</code>,
- * <code>DAY_OF_MONTH</code>, <code>HOUR</code>, and so on, and for
+ * #fields calendar fields} such as {@code YEAR}, {@code MONTH},
+ * {@code DAY_OF_MONTH}, {@code HOUR}, and so on, and for
  * manipulating the calendar fields, such as getting the date of the next
  * week. An instant in time can be represented by a millisecond value that is
  * an offset from the <a id="Epoch"><em>Epoch</em></a>, January 1, 1970
@@ -73,13 +73,13 @@
  *
  * <p>The class also provides additional fields and methods for
  * implementing a concrete calendar system outside the package. Those
- * fields and methods are defined as <code>protected</code>.
+ * fields and methods are defined as {@code protected}.
  *
  * <p>
- * Like other locale-sensitive classes, <code>Calendar</code> provides a
- * class method, <code>getInstance</code>, for getting a generally useful
- * object of this type. <code>Calendar</code>'s <code>getInstance</code> method
- * returns a <code>Calendar</code> object whose
+ * Like other locale-sensitive classes, {@code Calendar} provides a
+ * class method, {@code getInstance}, for getting a generally useful
+ * object of this type. {@code Calendar}'s {@code getInstance} method
+ * returns a {@code Calendar} object whose
  * calendar fields have been initialized with the current date and time:
  * <blockquote>
  * <pre>
@@ -87,47 +87,47 @@
  * </pre>
  * </blockquote>
  *
- * <p>A <code>Calendar</code> object can produce all the calendar field values
+ * <p>A {@code Calendar} object can produce all the calendar field values
  * needed to implement the date-time formatting for a particular language and
  * calendar style (for example, Japanese-Gregorian, Japanese-Traditional).
- * <code>Calendar</code> defines the range of values returned by
+ * {@code Calendar} defines the range of values returned by
  * certain calendar fields, as well as their meaning.  For example,
  * the first month of the calendar system has value <code>MONTH ==
  * JANUARY</code> for all calendars.  Other values are defined by the
- * concrete subclass, such as <code>ERA</code>.  See individual field
+ * concrete subclass, such as {@code ERA}.  See individual field
  * documentation and subclass documentation for details.
  *
  * <h2>Getting and Setting Calendar Field Values</h2>
  *
- * <p>The calendar field values can be set by calling the <code>set</code>
- * methods. Any field values set in a <code>Calendar</code> will not be
+ * <p>The calendar field values can be set by calling the {@code set}
+ * methods. Any field values set in a {@code Calendar} will not be
  * interpreted until it needs to calculate its time value (milliseconds from
  * the Epoch) or values of the calendar fields. Calling the
- * <code>get</code>, <code>getTimeInMillis</code>, <code>getTime</code>,
- * <code>add</code> and <code>roll</code> involves such calculation.
+ * {@code get}, {@code getTimeInMillis}, {@code getTime},
+ * {@code add} and {@code roll} involves such calculation.
  *
  * <h3>Leniency</h3>
  *
- * <p><code>Calendar</code> has two modes for interpreting the calendar
+ * <p>{@code Calendar} has two modes for interpreting the calendar
  * fields, <em>lenient</em> and <em>non-lenient</em>.  When a
- * <code>Calendar</code> is in lenient mode, it accepts a wider range of
- * calendar field values than it produces.  When a <code>Calendar</code>
- * recomputes calendar field values for return by <code>get()</code>, all of
+ * {@code Calendar} is in lenient mode, it accepts a wider range of
+ * calendar field values than it produces.  When a {@code Calendar}
+ * recomputes calendar field values for return by {@code get()}, all of
  * the calendar fields are normalized. For example, a lenient
- * <code>GregorianCalendar</code> interprets <code>MONTH == JANUARY</code>,
- * <code>DAY_OF_MONTH == 32</code> as February 1.
+ * {@code GregorianCalendar} interprets {@code MONTH == JANUARY},
+ * {@code DAY_OF_MONTH == 32} as February 1.
 
- * <p>When a <code>Calendar</code> is in non-lenient mode, it throws an
+ * <p>When a {@code Calendar} is in non-lenient mode, it throws an
  * exception if there is any inconsistency in its calendar fields. For
- * example, a <code>GregorianCalendar</code> always produces
- * <code>DAY_OF_MONTH</code> values between 1 and the length of the month. A
- * non-lenient <code>GregorianCalendar</code> throws an exception upon
+ * example, a {@code GregorianCalendar} always produces
+ * {@code DAY_OF_MONTH} values between 1 and the length of the month. A
+ * non-lenient {@code GregorianCalendar} throws an exception upon
  * calculating its time or calendar field values if any out-of-range field
  * value has been set.
  *
  * <h3><a id="first_week">First Week</a></h3>
  *
- * <code>Calendar</code> defines a locale-specific seven day week using two
+ * {@code Calendar} defines a locale-specific seven day week using two
  * parameters: the first day of the week and the minimal days in first week
  * (from 1 to 7).  These numbers are taken from the locale resource data or the
  * locale itself when a {@code Calendar} is constructed. If the designated
@@ -138,15 +138,15 @@
  * They may also be specified explicitly through the methods for setting their
  * values.
  *
- * <p>When setting or getting the <code>WEEK_OF_MONTH</code> or
- * <code>WEEK_OF_YEAR</code> fields, <code>Calendar</code> must determine the
+ * <p>When setting or getting the {@code WEEK_OF_MONTH} or
+ * {@code WEEK_OF_YEAR} fields, {@code Calendar} must determine the
  * first week of the month or year as a reference point.  The first week of a
  * month or year is defined as the earliest seven day period beginning on
- * <code>getFirstDayOfWeek()</code> and containing at least
- * <code>getMinimalDaysInFirstWeek()</code> days of that month or year.  Weeks
+ * {@code getFirstDayOfWeek()} and containing at least
+ * {@code getMinimalDaysInFirstWeek()} days of that month or year.  Weeks
  * numbered ..., -1, 0 precede the first week; weeks numbered 2, 3,... follow
- * it.  Note that the normalized numbering returned by <code>get()</code> may be
- * different.  For example, a specific <code>Calendar</code> subclass may
+ * it.  Note that the normalized numbering returned by {@code get()} may be
+ * different.  For example, a specific {@code Calendar} subclass may
  * designate the week before week 1 of a year as week <code><i>n</i></code> of
  * the previous year.
  *
@@ -156,12 +156,12 @@
  * may be insufficient information for the computation (such as only
  * year and month with no day of month), or there may be inconsistent
  * information (such as Tuesday, July 15, 1996 (Gregorian) -- July 15,
- * 1996 is actually a Monday). <code>Calendar</code> will resolve
+ * 1996 is actually a Monday). {@code Calendar} will resolve
  * calendar field values to determine the date and time in the
  * following way.
  *
  * <p><a id="resolution">If there is any conflict in calendar field values,
- * <code>Calendar</code> gives priorities to calendar fields that have been set
+ * {@code Calendar} gives priorities to calendar fields that have been set
  * more recently.</a> The following are the default combinations of the
  * calendar fields. The most recent combination, as determined by the
  * most recently set single field, will be used.
@@ -184,11 +184,11 @@
  * </pre></blockquote>
  *
  * <p>If there are any calendar fields whose values haven't been set in the selected
- * field combination, <code>Calendar</code> uses their default values. The default
+ * field combination, {@code Calendar} uses their default values. The default
  * value of each field may vary by concrete calendar systems. For example, in
- * <code>GregorianCalendar</code>, the default of a field is the same as that
- * of the start of the Epoch: i.e., <code>YEAR = 1970</code>, <code>MONTH =
- * JANUARY</code>, <code>DAY_OF_MONTH = 1</code>, etc.
+ * {@code GregorianCalendar}, the default of a field is the same as that
+ * of the start of the Epoch: i.e., {@code YEAR = 1970}, <code>MONTH =
+ * JANUARY</code>, {@code DAY_OF_MONTH = 1}, etc.
  *
  * <p>
  * <strong>Note:</strong> There are certain possible ambiguities in
@@ -213,98 +213,98 @@
  * <h3>Field Manipulation</h3>
  *
  * The calendar fields can be changed using three methods:
- * <code>set()</code>, <code>add()</code>, and <code>roll()</code>.
+ * {@code set()}, {@code add()}, and {@code roll()}.
  *
- * <p><strong><code>set(f, value)</code></strong> changes calendar field
- * <code>f</code> to <code>value</code>.  In addition, it sets an
- * internal member variable to indicate that calendar field <code>f</code> has
- * been changed. Although calendar field <code>f</code> is changed immediately,
+ * <p><strong>{@code set(f, value)}</strong> changes calendar field
+ * {@code f} to {@code value}.  In addition, it sets an
+ * internal member variable to indicate that calendar field {@code f} has
+ * been changed. Although calendar field {@code f} is changed immediately,
  * the calendar's time value in milliseconds is not recomputed until the next call to
- * <code>get()</code>, <code>getTime()</code>, <code>getTimeInMillis()</code>,
- * <code>add()</code>, or <code>roll()</code> is made. Thus, multiple calls to
- * <code>set()</code> do not trigger multiple, unnecessary
+ * {@code get()}, {@code getTime()}, {@code getTimeInMillis()},
+ * {@code add()}, or {@code roll()} is made. Thus, multiple calls to
+ * {@code set()} do not trigger multiple, unnecessary
  * computations. As a result of changing a calendar field using
- * <code>set()</code>, other calendar fields may also change, depending on the
+ * {@code set()}, other calendar fields may also change, depending on the
  * calendar field, the calendar field value, and the calendar system. In addition,
- * <code>get(f)</code> will not necessarily return <code>value</code> set by
- * the call to the <code>set</code> method
+ * {@code get(f)} will not necessarily return {@code value} set by
+ * the call to the {@code set} method
  * after the calendar fields have been recomputed. The specifics are determined by
  * the concrete calendar class.</p>
  *
- * <p><em>Example</em>: Consider a <code>GregorianCalendar</code>
+ * <p><em>Example</em>: Consider a {@code GregorianCalendar}
  * originally set to August 31, 1999. Calling <code>set(Calendar.MONTH,
  * Calendar.SEPTEMBER)</code> sets the date to September 31,
  * 1999. This is a temporary internal representation that resolves to
- * October 1, 1999 if <code>getTime()</code>is then called. However, a
- * call to <code>set(Calendar.DAY_OF_MONTH, 30)</code> before the call to
- * <code>getTime()</code> sets the date to September 30, 1999, since
- * no recomputation occurs after <code>set()</code> itself.</p>
+ * October 1, 1999 if {@code getTime()}is then called. However, a
+ * call to {@code set(Calendar.DAY_OF_MONTH, 30)} before the call to
+ * {@code getTime()} sets the date to September 30, 1999, since
+ * no recomputation occurs after {@code set()} itself.</p>
  *
- * <p><strong><code>add(f, delta)</code></strong> adds <code>delta</code>
- * to field <code>f</code>.  This is equivalent to calling <code>set(f,
+ * <p><strong>{@code add(f, delta)}</strong> adds {@code delta}
+ * to field {@code f}.  This is equivalent to calling <code>set(f,
  * get(f) + delta)</code> with two adjustments:</p>
  *
  * <blockquote>
- *   <p><strong>Add rule 1</strong>. The value of field <code>f</code>
- *   after the call minus the value of field <code>f</code> before the
- *   call is <code>delta</code>, modulo any overflow that has occurred in
- *   field <code>f</code>. Overflow occurs when a field value exceeds its
+ *   <p><strong>Add rule 1</strong>. The value of field {@code f}
+ *   after the call minus the value of field {@code f} before the
+ *   call is {@code delta}, modulo any overflow that has occurred in
+ *   field {@code f}. Overflow occurs when a field value exceeds its
  *   range and, as a result, the next larger field is incremented or
  *   decremented and the field value is adjusted back into its range.</p>
  *
  *   <p><strong>Add rule 2</strong>. If a smaller field is expected to be
  *   invariant, but it is impossible for it to be equal to its
  *   prior value because of changes in its minimum or maximum after field
- *   <code>f</code> is changed or other constraints, such as time zone
+ *   {@code f} is changed or other constraints, such as time zone
  *   offset changes, then its value is adjusted to be as close
  *   as possible to its expected value. A smaller field represents a
- *   smaller unit of time. <code>HOUR</code> is a smaller field than
- *   <code>DAY_OF_MONTH</code>. No adjustment is made to smaller fields
+ *   smaller unit of time. {@code HOUR} is a smaller field than
+ *   {@code DAY_OF_MONTH}. No adjustment is made to smaller fields
  *   that are not expected to be invariant. The calendar system
  *   determines what fields are expected to be invariant.</p>
  * </blockquote>
  *
- * <p>In addition, unlike <code>set()</code>, <code>add()</code> forces
+ * <p>In addition, unlike {@code set()}, {@code add()} forces
  * an immediate recomputation of the calendar's milliseconds and all
  * fields.</p>
  *
- * <p><em>Example</em>: Consider a <code>GregorianCalendar</code>
+ * <p><em>Example</em>: Consider a {@code GregorianCalendar}
  * originally set to August 31, 1999. Calling <code>add(Calendar.MONTH,
  * 13)</code> sets the calendar to September 30, 2000. <strong>Add rule
- * 1</strong> sets the <code>MONTH</code> field to September, since
+ * 1</strong> sets the {@code MONTH} field to September, since
  * adding 13 months to August gives September of the next year. Since
- * <code>DAY_OF_MONTH</code> cannot be 31 in September in a
- * <code>GregorianCalendar</code>, <strong>add rule 2</strong> sets the
- * <code>DAY_OF_MONTH</code> to 30, the closest possible value. Although
- * it is a smaller field, <code>DAY_OF_WEEK</code> is not adjusted by
+ * {@code DAY_OF_MONTH} cannot be 31 in September in a
+ * {@code GregorianCalendar}, <strong>add rule 2</strong> sets the
+ * {@code DAY_OF_MONTH} to 30, the closest possible value. Although
+ * it is a smaller field, {@code DAY_OF_WEEK} is not adjusted by
  * rule 2, since it is expected to change when the month changes in a
- * <code>GregorianCalendar</code>.</p>
+ * {@code GregorianCalendar}.</p>
  *
- * <p><strong><code>roll(f, delta)</code></strong> adds
- * <code>delta</code> to field <code>f</code> without changing larger
- * fields. This is equivalent to calling <code>add(f, delta)</code> with
+ * <p><strong>{@code roll(f, delta)}</strong> adds
+ * {@code delta} to field {@code f} without changing larger
+ * fields. This is equivalent to calling {@code add(f, delta)} with
  * the following adjustment:</p>
  *
  * <blockquote>
  *   <p><strong>Roll rule</strong>. Larger fields are unchanged after the
  *   call. A larger field represents a larger unit of
- *   time. <code>DAY_OF_MONTH</code> is a larger field than
- *   <code>HOUR</code>.</p>
+ *   time. {@code DAY_OF_MONTH} is a larger field than
+ *   {@code HOUR}.</p>
  * </blockquote>
  *
  * <p><em>Example</em>: See {@link java.util.GregorianCalendar#roll(int, int)}.
  *
  * <p><strong>Usage model</strong>. To motivate the behavior of
- * <code>add()</code> and <code>roll()</code>, consider a user interface
+ * {@code add()} and {@code roll()}, consider a user interface
  * component with increment and decrement buttons for the month, day, and
- * year, and an underlying <code>GregorianCalendar</code>. If the
+ * year, and an underlying {@code GregorianCalendar}. If the
  * interface reads January 31, 1999 and the user presses the month
  * increment button, what should it read? If the underlying
- * implementation uses <code>set()</code>, it might read March 3, 1999. A
+ * implementation uses {@code set()}, it might read March 3, 1999. A
  * better result would be February 28, 1999. Furthermore, if the user
  * presses the month increment button again, it should read March 31,
  * 1999, not March 28, 1999. By saving the original date and using either
- * <code>add()</code> or <code>roll()</code>, depending on whether larger
+ * {@code add()} or {@code roll()}, depending on whether larger
  * fields should be affected, the user interface can behave as most users
  * will intuitively expect.</p>
  *
@@ -369,7 +369,7 @@
     // ranges when they are regenerated.
 
     /**
-     * Field number for <code>get</code> and <code>set</code> indicating the
+     * Field number for {@code get} and {@code set} indicating the
      * era, e.g., AD or BC in the Julian calendar. This is a calendar-specific
      * value; see subclass documentation.
      *
@@ -379,16 +379,16 @@
     public static final int ERA = 0;
 
     /**
-     * Field number for <code>get</code> and <code>set</code> indicating the
+     * Field number for {@code get} and {@code set} indicating the
      * year. This is a calendar-specific value; see subclass documentation.
      */
     public static final int YEAR = 1;
 
     /**
-     * Field number for <code>get</code> and <code>set</code> indicating the
+     * Field number for {@code get} and {@code set} indicating the
      * month. This is a calendar-specific value. The first month of
      * the year in the Gregorian and Julian calendars is
-     * <code>JANUARY</code> which is 0; the last depends on the number
+     * {@code JANUARY} which is 0; the last depends on the number
      * of months in a year.
      *
      * @see #JANUARY
@@ -408,11 +408,11 @@
     public static final int MONTH = 2;
 
     /**
-     * Field number for <code>get</code> and <code>set</code> indicating the
+     * Field number for {@code get} and {@code set} indicating the
      * week number within the current year.  The first week of the year, as
-     * defined by <code>getFirstDayOfWeek()</code> and
-     * <code>getMinimalDaysInFirstWeek()</code>, has value 1.  Subclasses define
-     * the value of <code>WEEK_OF_YEAR</code> for days before the first week of
+     * defined by {@code getFirstDayOfWeek()} and
+     * {@code getMinimalDaysInFirstWeek()}, has value 1.  Subclasses define
+     * the value of {@code WEEK_OF_YEAR} for days before the first week of
      * the year.
      *
      * @see #getFirstDayOfWeek
@@ -421,11 +421,11 @@
     public static final int WEEK_OF_YEAR = 3;
 
     /**
-     * Field number for <code>get</code> and <code>set</code> indicating the
+     * Field number for {@code get} and {@code set} indicating the
      * week number within the current month.  The first week of the month, as
-     * defined by <code>getFirstDayOfWeek()</code> and
-     * <code>getMinimalDaysInFirstWeek()</code>, has value 1.  Subclasses define
-     * the value of <code>WEEK_OF_MONTH</code> for days before the first week of
+     * defined by {@code getFirstDayOfWeek()} and
+     * {@code getMinimalDaysInFirstWeek()}, has value 1.  Subclasses define
+     * the value of {@code WEEK_OF_MONTH} for days before the first week of
      * the month.
      *
      * @see #getFirstDayOfWeek
@@ -434,8 +434,8 @@
     public static final int WEEK_OF_MONTH = 4;
 
     /**
-     * Field number for <code>get</code> and <code>set</code> indicating the
-     * day of the month. This is a synonym for <code>DAY_OF_MONTH</code>.
+     * Field number for {@code get} and {@code set} indicating the
+     * day of the month. This is a synonym for {@code DAY_OF_MONTH}.
      * The first day of the month has value 1.
      *
      * @see #DAY_OF_MONTH
@@ -443,8 +443,8 @@
     public static final int DATE = 5;
 
     /**
-     * Field number for <code>get</code> and <code>set</code> indicating the
-     * day of the month. This is a synonym for <code>DATE</code>.
+     * Field number for {@code get} and {@code set} indicating the
+     * day of the month. This is a synonym for {@code DATE}.
      * The first day of the month has value 1.
      *
      * @see #DATE
@@ -452,16 +452,16 @@
     public static final int DAY_OF_MONTH = 5;
 
     /**
-     * Field number for <code>get</code> and <code>set</code> indicating the day
+     * Field number for {@code get} and {@code set} indicating the day
      * number within the current year.  The first day of the year has value 1.
      */
     public static final int DAY_OF_YEAR = 6;
 
     /**
-     * Field number for <code>get</code> and <code>set</code> indicating the day
-     * of the week.  This field takes values <code>SUNDAY</code>,
-     * <code>MONDAY</code>, <code>TUESDAY</code>, <code>WEDNESDAY</code>,
-     * <code>THURSDAY</code>, <code>FRIDAY</code>, and <code>SATURDAY</code>.
+     * Field number for {@code get} and {@code set} indicating the day
+     * of the week.  This field takes values {@code SUNDAY},
+     * {@code MONDAY}, {@code TUESDAY}, {@code WEDNESDAY},
+     * {@code THURSDAY}, {@code FRIDAY}, and {@code SATURDAY}.
      *
      * @see #SUNDAY
      * @see #MONDAY
@@ -474,24 +474,24 @@
     public static final int DAY_OF_WEEK = 7;
 
     /**
-     * Field number for <code>get</code> and <code>set</code> indicating the
+     * Field number for {@code get} and {@code set} indicating the
      * ordinal number of the day of the week within the current month. Together
-     * with the <code>DAY_OF_WEEK</code> field, this uniquely specifies a day
-     * within a month.  Unlike <code>WEEK_OF_MONTH</code> and
-     * <code>WEEK_OF_YEAR</code>, this field's value does <em>not</em> depend on
-     * <code>getFirstDayOfWeek()</code> or
-     * <code>getMinimalDaysInFirstWeek()</code>.  <code>DAY_OF_MONTH 1</code>
-     * through <code>7</code> always correspond to <code>DAY_OF_WEEK_IN_MONTH
-     * 1</code>; <code>8</code> through <code>14</code> correspond to
-     * <code>DAY_OF_WEEK_IN_MONTH 2</code>, and so on.
-     * <code>DAY_OF_WEEK_IN_MONTH 0</code> indicates the week before
-     * <code>DAY_OF_WEEK_IN_MONTH 1</code>.  Negative values count back from the
+     * with the {@code DAY_OF_WEEK} field, this uniquely specifies a day
+     * within a month.  Unlike {@code WEEK_OF_MONTH} and
+     * {@code WEEK_OF_YEAR}, this field's value does <em>not</em> depend on
+     * {@code getFirstDayOfWeek()} or
+     * {@code getMinimalDaysInFirstWeek()}.  {@code DAY_OF_MONTH 1}
+     * through {@code 7} always correspond to <code>DAY_OF_WEEK_IN_MONTH
+     * 1</code>; {@code 8} through {@code 14} correspond to
+     * {@code DAY_OF_WEEK_IN_MONTH 2}, and so on.
+     * {@code DAY_OF_WEEK_IN_MONTH 0} indicates the week before
+     * {@code DAY_OF_WEEK_IN_MONTH 1}.  Negative values count back from the
      * end of the month, so the last Sunday of a month is specified as
-     * <code>DAY_OF_WEEK = SUNDAY, DAY_OF_WEEK_IN_MONTH = -1</code>.  Because
+     * {@code DAY_OF_WEEK = SUNDAY, DAY_OF_WEEK_IN_MONTH = -1}.  Because
      * negative values count backward they will usually be aligned differently
      * within the month than positive values.  For example, if a month has 31
-     * days, <code>DAY_OF_WEEK_IN_MONTH -1</code> will overlap
-     * <code>DAY_OF_WEEK_IN_MONTH 5</code> and the end of <code>4</code>.
+     * days, {@code DAY_OF_WEEK_IN_MONTH -1} will overlap
+     * {@code DAY_OF_WEEK_IN_MONTH 5} and the end of {@code 4}.
      *
      * @see #DAY_OF_WEEK
      * @see #WEEK_OF_MONTH
@@ -499,9 +499,9 @@
     public static final int DAY_OF_WEEK_IN_MONTH = 8;
 
     /**
-     * Field number for <code>get</code> and <code>set</code> indicating
-     * whether the <code>HOUR</code> is before or after noon.
-     * E.g., at 10:04:15.250 PM the <code>AM_PM</code> is <code>PM</code>.
+     * Field number for {@code get} and {@code set} indicating
+     * whether the {@code HOUR} is before or after noon.
+     * E.g., at 10:04:15.250 PM the {@code AM_PM} is {@code PM}.
      *
      * @see #AM
      * @see #PM
@@ -510,10 +510,10 @@
     public static final int AM_PM = 9;
 
     /**
-     * Field number for <code>get</code> and <code>set</code> indicating the
-     * hour of the morning or afternoon. <code>HOUR</code> is used for the
+     * Field number for {@code get} and {@code set} indicating the
+     * hour of the morning or afternoon. {@code HOUR} is used for the
      * 12-hour clock (0 - 11). Noon and midnight are represented by 0, not by 12.
-     * E.g., at 10:04:15.250 PM the <code>HOUR</code> is 10.
+     * E.g., at 10:04:15.250 PM the {@code HOUR} is 10.
      *
      * @see #AM_PM
      * @see #HOUR_OF_DAY
@@ -521,60 +521,60 @@
     public static final int HOUR = 10;
 
     /**
-     * Field number for <code>get</code> and <code>set</code> indicating the
-     * hour of the day. <code>HOUR_OF_DAY</code> is used for the 24-hour clock.
-     * E.g., at 10:04:15.250 PM the <code>HOUR_OF_DAY</code> is 22.
+     * Field number for {@code get} and {@code set} indicating the
+     * hour of the day. {@code HOUR_OF_DAY} is used for the 24-hour clock.
+     * E.g., at 10:04:15.250 PM the {@code HOUR_OF_DAY} is 22.
      *
      * @see #HOUR
      */
     public static final int HOUR_OF_DAY = 11;
 
     /**
-     * Field number for <code>get</code> and <code>set</code> indicating the
+     * Field number for {@code get} and {@code set} indicating the
      * minute within the hour.
-     * E.g., at 10:04:15.250 PM the <code>MINUTE</code> is 4.
+     * E.g., at 10:04:15.250 PM the {@code MINUTE} is 4.
      */
     public static final int MINUTE = 12;
 
     /**
-     * Field number for <code>get</code> and <code>set</code> indicating the
+     * Field number for {@code get} and {@code set} indicating the
      * second within the minute.
-     * E.g., at 10:04:15.250 PM the <code>SECOND</code> is 15.
+     * E.g., at 10:04:15.250 PM the {@code SECOND} is 15.
      */
     public static final int SECOND = 13;
 
     /**
-     * Field number for <code>get</code> and <code>set</code> indicating the
+     * Field number for {@code get} and {@code set} indicating the
      * millisecond within the second.
-     * E.g., at 10:04:15.250 PM the <code>MILLISECOND</code> is 250.
+     * E.g., at 10:04:15.250 PM the {@code MILLISECOND} is 250.
      */
     public static final int MILLISECOND = 14;
 
     /**
-     * Field number for <code>get</code> and <code>set</code>
+     * Field number for {@code get} and {@code set}
      * indicating the raw offset from GMT in milliseconds.
      * <p>
      * This field reflects the correct GMT offset value of the time
-     * zone of this <code>Calendar</code> if the
-     * <code>TimeZone</code> implementation subclass supports
+     * zone of this {@code Calendar} if the
+     * {@code TimeZone} implementation subclass supports
      * historical GMT offset changes.
      */
     public static final int ZONE_OFFSET = 15;
 
     /**
-     * Field number for <code>get</code> and <code>set</code> indicating the
+     * Field number for {@code get} and {@code set} indicating the
      * daylight saving offset in milliseconds.
      * <p>
      * This field reflects the correct daylight saving offset value of
-     * the time zone of this <code>Calendar</code> if the
-     * <code>TimeZone</code> implementation subclass supports
+     * the time zone of this {@code Calendar} if the
+     * {@code TimeZone} implementation subclass supports
      * historical Daylight Saving Time schedule changes.
      */
     public static final int DST_OFFSET = 16;
 
     /**
-     * The number of distinct fields recognized by <code>get</code> and <code>set</code>.
-     * Field numbers range from <code>0..FIELD_COUNT-1</code>.
+     * The number of distinct fields recognized by {@code get} and {@code set}.
+     * Field numbers range from {@code 0..FIELD_COUNT-1}.
      */
     public static final int FIELD_COUNT = 17;
 
@@ -694,7 +694,7 @@
 
     /**
      * Value of the {@link #MONTH} field indicating the
-     * thirteenth month of the year. Although <code>GregorianCalendar</code>
+     * thirteenth month of the year. Although {@code GregorianCalendar}
      * does not use this value, lunar calendars do.
      */
     public static final int UNDECIMBER = 12;
@@ -839,8 +839,8 @@
 
     /**
      * The calendar field values for the currently set time for this calendar.
-     * This is an array of <code>FIELD_COUNT</code> integers, with index values
-     * <code>ERA</code> through <code>DST_OFFSET</code>.
+     * This is an array of {@code FIELD_COUNT} integers, with index values
+     * {@code ERA} through {@code DST_OFFSET}.
      * @serial
      */
     @SuppressWarnings("ProtectedField")
@@ -850,8 +850,8 @@
      * The flags which tell if a specified calendar field for the calendar is set.
      * A new object has no fields set.  After the first call to a method
      * which generates the fields, they all remain set after that.
-     * This is an array of <code>FIELD_COUNT</code> booleans, with index values
-     * <code>ERA</code> through <code>DST_OFFSET</code>.
+     * This is an array of {@code FIELD_COUNT} booleans, with index values
+     * {@code ERA} through {@code DST_OFFSET}.
      * @serial
      */
     @SuppressWarnings("ProtectedField")
@@ -874,8 +874,8 @@
     protected long          time;
 
     /**
-     * True if then the value of <code>time</code> is valid.
-     * The time is made invalid by a change to an item of <code>field[]</code>.
+     * True if then the value of {@code time} is valid.
+     * The time is made invalid by a change to an item of {@code field[]}.
      * @see #time
      * @serial
      */
@@ -883,10 +883,10 @@
     protected boolean       isTimeSet;
 
     /**
-     * True if <code>fields[]</code> are in sync with the currently set time.
+     * True if {@code fields[]} are in sync with the currently set time.
      * If false, then the next attempt to get the value of a field will
      * force a recomputation of all fields from the current value of
-     * <code>time</code>.
+     * {@code time}.
      * @serial
      */
     @SuppressWarnings("ProtectedField")
@@ -899,8 +899,8 @@
     transient boolean       areAllFieldsSet;
 
     /**
-     * <code>True</code> if this calendar allows out-of-range field values during computation
-     * of <code>time</code> from <code>fields[]</code>.
+     * {@code True} if this calendar allows out-of-range field values during computation
+     * of {@code time} from {@code fields[]}.
      * @see #setLenient
      * @see #isLenient
      * @serial
@@ -908,20 +908,20 @@
     private boolean         lenient = true;
 
     /**
-     * The <code>TimeZone</code> used by this calendar. <code>Calendar</code>
+     * The {@code TimeZone} used by this calendar. {@code Calendar}
      * uses the time zone data to translate between locale and GMT time.
      * @serial
      */
     private TimeZone        zone;
 
     /**
-     * <code>True</code> if zone references to a shared TimeZone object.
+     * {@code True} if zone references to a shared TimeZone object.
      */
     private transient boolean sharedZone = false;
 
     /**
-     * The first day of the week, with possible values <code>SUNDAY</code>,
-     * <code>MONDAY</code>, etc.  This is a locale-dependent value.
+     * The first day of the week, with possible values {@code SUNDAY},
+     * {@code MONDAY}, etc.  This is a locale-dependent value.
      * @serial
      */
     private int             firstDayOfWeek;
@@ -964,10 +964,10 @@
     static final int ALL_FIELDS = (1 << FIELD_COUNT) - 1;
 
     /**
-     * The next available value for <code>stamp[]</code>, an internal array.
+     * The next available value for {@code stamp[]}, an internal array.
      * This actually should not be written out to the stream, and will probably
      * be removed from the stream in the near future.  In the meantime,
-     * a value of <code>MINIMUM_USER_STAMP</code> should be used.
+     * a value of {@code MINIMUM_USER_STAMP} should be used.
      * @serial
      */
     private int             nextStamp = MINIMUM_USER_STAMP;
@@ -997,7 +997,7 @@
      * </dd>
      * </dl>
      * When streaming out this class, the most recent format
-     * and the highest allowable <code>serialVersionOnStream</code>
+     * and the highest allowable {@code serialVersionOnStream}
      * is written.
      * @serial
      * @since 1.1.6
@@ -1307,7 +1307,7 @@
          * Sets the time zone parameter to the given {@code zone}. If no time
          * zone parameter is given to this {@code Calendar.Builder}, the
          * {@linkplain TimeZone#getDefault() default
-         * <code>TimeZone</code>} will be used in the {@link #build() build}
+         * {@code TimeZone}} will be used in the {@link #build() build}
          * method.
          *
          * @param zone the {@link TimeZone}
@@ -1378,7 +1378,7 @@
         /**
          * Sets the locale parameter to the given {@code locale}. If no locale
          * is given to this {@code Calendar.Builder}, the {@linkplain
-         * Locale#getDefault(Locale.Category) default <code>Locale</code>}
+         * Locale#getDefault(Locale.Category) default {@code Locale}}
          * for {@link Locale.Category#FORMAT} will be used.
          *
          * <p>If no calendar type is explicitly given by a call to the
@@ -1614,7 +1614,7 @@
 
     /**
      * Gets a calendar using the default time zone and locale. The
-     * <code>Calendar</code> returned is based on the current time
+     * {@code Calendar} returned is based on the current time
      * in the default time zone with the default
      * {@link Locale.Category#FORMAT FORMAT} locale.
      * <p>
@@ -1632,7 +1632,7 @@
 
     /**
      * Gets a calendar using the specified time zone and default locale.
-     * The <code>Calendar</code> returned is based on the current time
+     * The {@code Calendar} returned is based on the current time
      * in the given time zone with the default
      * {@link Locale.Category#FORMAT FORMAT} locale.
      *
@@ -1646,7 +1646,7 @@
 
     /**
      * Gets a calendar using the default time zone and specified locale.
-     * The <code>Calendar</code> returned is based on the current time
+     * The {@code Calendar} returned is based on the current time
      * in the default time zone with the given locale.
      * <p>
      * If the locale contains the time zone with "tz"
@@ -1663,7 +1663,7 @@
 
     /**
      * Gets a calendar with the specified time zone and locale.
-     * The <code>Calendar</code> returned is based on the current time
+     * The {@code Calendar} returned is based on the current time
      * in the given time zone with the given locale.
      *
      * @param zone the time zone to use
@@ -1738,13 +1738,13 @@
     }
 
     /**
-     * Returns an array of all locales for which the <code>getInstance</code>
+     * Returns an array of all locales for which the {@code getInstance}
      * methods of this class can return localized instances.
-     * The array returned must contain at least a <code>Locale</code>
+     * The array returned must contain at least a {@code Locale}
      * instance equal to {@link java.util.Locale#US Locale.US}.
      *
      * @return An array of locales for which localized
-     *         <code>Calendar</code> instances are available.
+     *         {@code Calendar} instances are available.
      */
     public static synchronized Locale[] getAvailableLocales()
     {
@@ -1774,11 +1774,11 @@
     protected abstract void computeFields();
 
     /**
-     * Returns a <code>Date</code> object representing this
-     * <code>Calendar</code>'s time value (millisecond offset from the <a
+     * Returns a {@code Date} object representing this
+     * {@code Calendar}'s time value (millisecond offset from the <a
      * href="#Epoch">Epoch</a>").
      *
-     * @return a <code>Date</code> representing the time value.
+     * @return a {@code Date} representing the time value.
      * @see #setTime(Date)
      * @see #getTimeInMillis()
      */
@@ -1787,11 +1787,11 @@
     }
 
     /**
-     * Sets this Calendar's time with the given <code>Date</code>.
+     * Sets this Calendar's time with the given {@code Date}.
      * <p>
-     * Note: Calling <code>setTime()</code> with
-     * <code>Date(Long.MAX_VALUE)</code> or <code>Date(Long.MIN_VALUE)</code>
-     * may yield incorrect field values from <code>get()</code>.
+     * Note: Calling {@code setTime()} with
+     * {@code Date(Long.MAX_VALUE)} or {@code Date(Long.MIN_VALUE)}
+     * may yield incorrect field values from {@code get()}.
      *
      * @param date the given Date.
      * @see #getTime()
@@ -1874,7 +1874,7 @@
     /**
      * Sets the value of the given calendar field. This method does
      * not affect any setting state of the field in this
-     * <code>Calendar</code> instance.
+     * {@code Calendar} instance.
      *
      * @throws IndexOutOfBoundsException if the specified field is out of range
      *             (<code>field &lt; 0 || field &gt;= FIELD_COUNT</code>).
@@ -1920,15 +1920,15 @@
     }
 
     /**
-     * Sets the values for the calendar fields <code>YEAR</code>,
-     * <code>MONTH</code>, and <code>DAY_OF_MONTH</code>.
+     * Sets the values for the calendar fields {@code YEAR},
+     * {@code MONTH}, and {@code DAY_OF_MONTH}.
      * Previous values of other calendar fields are retained.  If this is not desired,
      * call {@link #clear()} first.
      *
-     * @param year the value used to set the <code>YEAR</code> calendar field.
-     * @param month the value used to set the <code>MONTH</code> calendar field.
+     * @param year the value used to set the {@code YEAR} calendar field.
+     * @param month the value used to set the {@code MONTH} calendar field.
      * Month value is 0-based. e.g., 0 for January.
-     * @param date the value used to set the <code>DAY_OF_MONTH</code> calendar field.
+     * @param date the value used to set the {@code DAY_OF_MONTH} calendar field.
      * @see #set(int,int)
      * @see #set(int,int,int,int,int)
      * @see #set(int,int,int,int,int,int)
@@ -1941,18 +1941,18 @@
     }
 
     /**
-     * Sets the values for the calendar fields <code>YEAR</code>,
-     * <code>MONTH</code>, <code>DAY_OF_MONTH</code>,
-     * <code>HOUR_OF_DAY</code>, and <code>MINUTE</code>.
+     * Sets the values for the calendar fields {@code YEAR},
+     * {@code MONTH}, {@code DAY_OF_MONTH},
+     * {@code HOUR_OF_DAY}, and {@code MINUTE}.
      * Previous values of other fields are retained.  If this is not desired,
      * call {@link #clear()} first.
      *
-     * @param year the value used to set the <code>YEAR</code> calendar field.
-     * @param month the value used to set the <code>MONTH</code> calendar field.
+     * @param year the value used to set the {@code YEAR} calendar field.
+     * @param month the value used to set the {@code MONTH} calendar field.
      * Month value is 0-based. e.g., 0 for January.
-     * @param date the value used to set the <code>DAY_OF_MONTH</code> calendar field.
-     * @param hourOfDay the value used to set the <code>HOUR_OF_DAY</code> calendar field.
-     * @param minute the value used to set the <code>MINUTE</code> calendar field.
+     * @param date the value used to set the {@code DAY_OF_MONTH} calendar field.
+     * @param hourOfDay the value used to set the {@code HOUR_OF_DAY} calendar field.
+     * @param minute the value used to set the {@code MINUTE} calendar field.
      * @see #set(int,int)
      * @see #set(int,int,int)
      * @see #set(int,int,int,int,int,int)
@@ -1967,19 +1967,19 @@
     }
 
     /**
-     * Sets the values for the fields <code>YEAR</code>, <code>MONTH</code>,
-     * <code>DAY_OF_MONTH</code>, <code>HOUR_OF_DAY</code>, <code>MINUTE</code>, and
-     * <code>SECOND</code>.
+     * Sets the values for the fields {@code YEAR}, {@code MONTH},
+     * {@code DAY_OF_MONTH}, {@code HOUR_OF_DAY}, {@code MINUTE}, and
+     * {@code SECOND}.
      * Previous values of other fields are retained.  If this is not desired,
      * call {@link #clear()} first.
      *
-     * @param year the value used to set the <code>YEAR</code> calendar field.
-     * @param month the value used to set the <code>MONTH</code> calendar field.
+     * @param year the value used to set the {@code YEAR} calendar field.
+     * @param month the value used to set the {@code MONTH} calendar field.
      * Month value is 0-based. e.g., 0 for January.
-     * @param date the value used to set the <code>DAY_OF_MONTH</code> calendar field.
-     * @param hourOfDay the value used to set the <code>HOUR_OF_DAY</code> calendar field.
-     * @param minute the value used to set the <code>MINUTE</code> calendar field.
-     * @param second the value used to set the <code>SECOND</code> calendar field.
+     * @param date the value used to set the {@code DAY_OF_MONTH} calendar field.
+     * @param hourOfDay the value used to set the {@code HOUR_OF_DAY} calendar field.
+     * @param minute the value used to set the {@code MINUTE} calendar field.
+     * @param second the value used to set the {@code SECOND} calendar field.
      * @see #set(int,int)
      * @see #set(int,int,int)
      * @see #set(int,int,int,int,int)
@@ -1998,14 +1998,14 @@
     /**
      * Sets all the calendar field values and the time value
      * (millisecond offset from the <a href="#Epoch">Epoch</a>) of
-     * this <code>Calendar</code> undefined. This means that {@link
-     * #isSet(int) isSet()} will return <code>false</code> for all the
+     * this {@code Calendar} undefined. This means that {@link
+     * #isSet(int) isSet()} will return {@code false} for all the
      * calendar fields, and the date and time calculations will treat
      * the fields as if they had never been set. A
-     * <code>Calendar</code> implementation class may use its specific
+     * {@code Calendar} implementation class may use its specific
      * default field values for date/time calculations. For example,
-     * <code>GregorianCalendar</code> uses 1970 if the
-     * <code>YEAR</code> field value is undefined.
+     * {@code GregorianCalendar} uses 1970 if the
+     * {@code YEAR} field value is undefined.
      *
      * @see #clear(int)
      */
@@ -2022,10 +2022,10 @@
     /**
      * Sets the given calendar field value and the time value
      * (millisecond offset from the <a href="#Epoch">Epoch</a>) of
-     * this <code>Calendar</code> undefined. This means that {@link
-     * #isSet(int) isSet(field)} will return <code>false</code>, and
+     * this {@code Calendar} undefined. This means that {@link
+     * #isSet(int) isSet(field)} will return {@code false}, and
      * the date and time calculations will treat the field as if it
-     * had never been set. A <code>Calendar</code> implementation
+     * had never been set. A {@code Calendar} implementation
      * class may use the field's specific default value for date and
      * time calculations.
      *
@@ -2033,7 +2033,7 @@
      * fields are handled independently and the <a
      * href="#time_resolution">the resolution rule for the time of
      * day</a> is applied. Clearing one of the fields doesn't reset
-     * the hour of day value of this <code>Calendar</code>. Use {@link
+     * the hour of day value of this {@code Calendar}. Use {@link
      * #set(int,int) set(Calendar.HOUR_OF_DAY, 0)} to reset the hour
      * value.
      *
@@ -2053,11 +2053,11 @@
     /**
      * Determines if the given calendar field has a value set,
      * including cases that the value has been set by internal fields
-     * calculations triggered by a <code>get</code> method call.
+     * calculations triggered by a {@code get} method call.
      *
      * @param field the calendar field to test
-     * @return <code>true</code> if the given calendar field has a value set;
-     * <code>false</code> otherwise.
+     * @return {@code true} if the given calendar field has a value set;
+     * {@code false} otherwise.
      */
     public final boolean isSet(int field)
     {
@@ -2066,24 +2066,24 @@
 
     /**
      * Returns the string representation of the calendar
-     * <code>field</code> value in the given <code>style</code> and
-     * <code>locale</code>.  If no string representation is
-     * applicable, <code>null</code> is returned. This method calls
+     * {@code field} value in the given {@code style} and
+     * {@code locale}.  If no string representation is
+     * applicable, {@code null} is returned. This method calls
      * {@link Calendar#get(int) get(field)} to get the calendar
-     * <code>field</code> value if the string representation is
-     * applicable to the given calendar <code>field</code>.
+     * {@code field} value if the string representation is
+     * applicable to the given calendar {@code field}.
      *
-     * <p>For example, if this <code>Calendar</code> is a
-     * <code>GregorianCalendar</code> and its date is 2005-01-01, then
+     * <p>For example, if this {@code Calendar} is a
+     * {@code GregorianCalendar} and its date is 2005-01-01, then
      * the string representation of the {@link #MONTH} field would be
      * "January" in the long style in an English locale or "Jan" in
      * the short style. However, no string representation would be
      * available for the {@link #DAY_OF_MONTH} field, and this method
-     * would return <code>null</code>.
+     * would return {@code null}.
      *
      * <p>The default implementation supports the calendar fields for
      * which a {@link DateFormatSymbols} has names in the given
-     * <code>locale</code>.
+     * {@code locale}.
      *
      * @param field
      *        the calendar field for which the string representation
@@ -2100,11 +2100,11 @@
      *        {@code field} in the given {@code style}, or
      *        {@code null} if no string representation is
      *        applicable.
-     * @exception IllegalArgumentException
+     * @throws    IllegalArgumentException
      *        if {@code field} or {@code style} is invalid,
      *        or if this {@code Calendar} is non-lenient and any
      *        of the calendar fields have invalid values
-     * @exception NullPointerException
+     * @throws    NullPointerException
      *        if {@code locale} is null
      * @since 1.6
      */
@@ -2191,11 +2191,11 @@
      *        {@code style} and {@code locale} and their
      *        field values, or {@code null} if no display names
      *        are defined for {@code field}
-     * @exception IllegalArgumentException
+     * @throws    IllegalArgumentException
      *        if {@code field} or {@code style} is invalid,
      *        or if this {@code Calendar} is non-lenient and any
      *        of the calendar fields have invalid values
-     * @exception NullPointerException
+     * @throws    NullPointerException
      *        if {@code locale} is null
      * @since 1.6
      */
@@ -2309,10 +2309,10 @@
      * externally by calling one of the setter methods rather than by the
      * internal time calculation.
      *
-     * @return <code>true</code> if the field has been set externally,
-     * <code>false</code> otherwise.
-     * @exception IndexOutOfBoundsException if the specified
-     *                <code>field</code> is out of range
+     * @return {@code true} if the field has been set externally,
+     * {@code false} otherwise.
+     * @throws    IndexOutOfBoundsException if the specified
+     *                {@code field} is out of range
      *               (<code>field &lt; 0 || field &gt;= FIELD_COUNT</code>).
      * @see #selectFields()
      * @see #setFieldsComputed(int)
@@ -2344,8 +2344,8 @@
      * rather than by calling one of the setter methods.
      *
      * @param fieldMask the field to be marked as computed.
-     * @exception IndexOutOfBoundsException if the specified
-     *                <code>field</code> is out of range
+     * @throws    IndexOutOfBoundsException if the specified
+     *                {@code field} is out of range
      *               (<code>field &lt; 0 || field &gt;= FIELD_COUNT</code>).
      * @see #isExternallySet(int)
      * @see #selectFields()
@@ -2374,15 +2374,15 @@
 
     /**
      * Sets the state of the calendar fields that are <em>not</em> specified
-     * by <code>fieldMask</code> to <em>unset</em>. If <code>fieldMask</code>
+     * by {@code fieldMask} to <em>unset</em>. If {@code fieldMask}
      * specifies all the calendar fields, then the state of this
-     * <code>Calendar</code> becomes that all the calendar fields are in sync
+     * {@code Calendar} becomes that all the calendar fields are in sync
      * with the time value (millisecond offset from the Epoch).
      *
      * @param fieldMask the field mask indicating which calendar fields are in
      * sync with the time value.
-     * @exception IndexOutOfBoundsException if the specified
-     *                <code>field</code> is out of range
+     * @throws    IndexOutOfBoundsException if the specified
+     *                {@code field} is out of range
      *               (<code>field &lt; 0 || field &gt;= FIELD_COUNT</code>).
      * @see #isExternallySet(int)
      * @see #selectFields()
@@ -2428,8 +2428,8 @@
     }
 
     /**
-     * Returns whether the specified <code>field</code> is on in the
-     * <code>fieldMask</code>.
+     * Returns whether the specified {@code field} is on in the
+     * {@code fieldMask}.
      */
     static boolean isFieldSet(int fieldMask, int field) {
         return (fieldMask & (1 << field)) != 0;
@@ -2439,16 +2439,16 @@
      * Returns a field mask indicating which calendar field values
      * to be used to calculate the time value. The calendar fields are
      * returned as a bit mask, each bit of which corresponds to a field, i.e.,
-     * the mask value of <code>field</code> is <code>(1 &lt;&lt;
-     * field)</code>. For example, 0x26 represents the <code>YEAR</code>,
-     * <code>MONTH</code>, and <code>DAY_OF_MONTH</code> fields (i.e., 0x26 is
+     * the mask value of {@code field} is <code>(1 &lt;&lt;
+     * field)</code>. For example, 0x26 represents the {@code YEAR},
+     * {@code MONTH}, and {@code DAY_OF_MONTH} fields (i.e., 0x26 is
      * equal to
      * <code>(1&lt;&lt;YEAR)|(1&lt;&lt;MONTH)|(1&lt;&lt;DAY_OF_MONTH))</code>.
      *
      * <p>This method supports the calendar fields resolution as described in
      * the class description. If the bit mask for a given field is on and its
-     * field has not been set (i.e., <code>isSet(field)</code> is
-     * <code>false</code>), then the default value of the field has to be
+     * field has not been set (i.e., {@code isSet(field)} is
+     * {@code false}), then the default value of the field has to be
      * used, which case means that the field has been selected because the
      * selected combination involves the field.
      *
@@ -2693,26 +2693,26 @@
     }
 
     /**
-     * Compares this <code>Calendar</code> to the specified
-     * <code>Object</code>.  The result is <code>true</code> if and only if
-     * the argument is a <code>Calendar</code> object of the same calendar
+     * Compares this {@code Calendar} to the specified
+     * {@code Object}.  The result is {@code true} if and only if
+     * the argument is a {@code Calendar} object of the same calendar
      * system that represents the same time value (millisecond offset from the
      * <a href="#Epoch">Epoch</a>) under the same
-     * <code>Calendar</code> parameters as this object.
+     * {@code Calendar} parameters as this object.
      *
-     * <p>The <code>Calendar</code> parameters are the values represented
-     * by the <code>isLenient</code>, <code>getFirstDayOfWeek</code>,
-     * <code>getMinimalDaysInFirstWeek</code> and <code>getTimeZone</code>
+     * <p>The {@code Calendar} parameters are the values represented
+     * by the {@code isLenient}, {@code getFirstDayOfWeek},
+     * {@code getMinimalDaysInFirstWeek} and {@code getTimeZone}
      * methods. If there is any difference in those parameters
-     * between the two <code>Calendar</code>s, this method returns
-     * <code>false</code>.
+     * between the two {@code Calendar}s, this method returns
+     * {@code false}.
      *
      * <p>Use the {@link #compareTo(Calendar) compareTo} method to
      * compare only the time values.
      *
      * @param obj the object to compare with.
-     * @return <code>true</code> if this object is equal to <code>obj</code>;
-     * <code>false</code> otherwise.
+     * @return {@code true} if this object is equal to {@code obj};
+     * {@code false} otherwise.
      */
     @SuppressWarnings("EqualsWhichDoesntCheckParameterClass")
     @Override
@@ -2753,19 +2753,19 @@
     }
 
     /**
-     * Returns whether this <code>Calendar</code> represents a time
+     * Returns whether this {@code Calendar} represents a time
      * before the time represented by the specified
-     * <code>Object</code>. This method is equivalent to:
+     * {@code Object}. This method is equivalent to:
      * <pre>{@code
      *         compareTo(when) < 0
      * }</pre>
-     * if and only if <code>when</code> is a <code>Calendar</code>
-     * instance. Otherwise, the method returns <code>false</code>.
+     * if and only if {@code when} is a {@code Calendar}
+     * instance. Otherwise, the method returns {@code false}.
      *
-     * @param when the <code>Object</code> to be compared
-     * @return <code>true</code> if the time of this
-     * <code>Calendar</code> is before the time represented by
-     * <code>when</code>; <code>false</code> otherwise.
+     * @param when the {@code Object} to be compared
+     * @return {@code true} if the time of this
+     * {@code Calendar} is before the time represented by
+     * {@code when}; {@code false} otherwise.
      * @see     #compareTo(Calendar)
      */
     public boolean before(Object when) {
@@ -2774,18 +2774,18 @@
     }
 
     /**
-     * Returns whether this <code>Calendar</code> represents a time
+     * Returns whether this {@code Calendar} represents a time
      * after the time represented by the specified
-     * <code>Object</code>. This method is equivalent to:
+     * {@code Object}. This method is equivalent to:
      * <pre>{@code
      *         compareTo(when) > 0
      * }</pre>
-     * if and only if <code>when</code> is a <code>Calendar</code>
-     * instance. Otherwise, the method returns <code>false</code>.
+     * if and only if {@code when} is a {@code Calendar}
+     * instance. Otherwise, the method returns {@code false}.
      *
-     * @param when the <code>Object</code> to be compared
-     * @return <code>true</code> if the time of this <code>Calendar</code> is
-     * after the time represented by <code>when</code>; <code>false</code>
+     * @param when the {@code Object} to be compared
+     * @return {@code true} if the time of this {@code Calendar} is
+     * after the time represented by {@code when}; {@code false}
      * otherwise.
      * @see     #compareTo(Calendar)
      */
@@ -2797,19 +2797,19 @@
     /**
      * Compares the time values (millisecond offsets from the <a
      * href="#Epoch">Epoch</a>) represented by two
-     * <code>Calendar</code> objects.
+     * {@code Calendar} objects.
      *
-     * @param anotherCalendar the <code>Calendar</code> to be compared.
-     * @return the value <code>0</code> if the time represented by the argument
-     * is equal to the time represented by this <code>Calendar</code>; a value
-     * less than <code>0</code> if the time of this <code>Calendar</code> is
+     * @param anotherCalendar the {@code Calendar} to be compared.
+     * @return the value {@code 0} if the time represented by the argument
+     * is equal to the time represented by this {@code Calendar}; a value
+     * less than {@code 0} if the time of this {@code Calendar} is
      * before the time represented by the argument; and a value greater than
-     * <code>0</code> if the time of this <code>Calendar</code> is after the
+     * {@code 0} if the time of this {@code Calendar} is after the
      * time represented by the argument.
-     * @exception NullPointerException if the specified <code>Calendar</code> is
-     *            <code>null</code>.
-     * @exception IllegalArgumentException if the time value of the
-     * specified <code>Calendar</code> object can't be obtained due to
+     * @throws    NullPointerException if the specified {@code Calendar} is
+     *            {@code null}.
+     * @throws    IllegalArgumentException if the time value of the
+     * specified {@code Calendar} object can't be obtained due to
      * any invalid calendar values.
      * @since   1.5
      */
@@ -2822,7 +2822,7 @@
      * Adds or subtracts the specified amount of time to the given calendar field,
      * based on the calendar's rules. For example, to subtract 5 days from
      * the current time of the calendar, you can achieve it by calling:
-     * <p><code>add(Calendar.DAY_OF_MONTH, -5)</code>.
+     * <p>{@code add(Calendar.DAY_OF_MONTH, -5)}.
      *
      * @param field the calendar field.
      * @param amount the amount of date or time to be added to the field.
@@ -2838,7 +2838,7 @@
      * <p>roll(Calendar.DATE, true).
      * When rolling on the year or Calendar.YEAR field, it will roll the year
      * value in the range between 1 and the value returned by calling
-     * <code>getMaximum(Calendar.YEAR)</code>.
+     * {@code getMaximum(Calendar.YEAR)}.
      * When rolling on the month or Calendar.MONTH field, other fields like
      * date might conflict and, need to be changed. For instance,
      * rolling the month on the date 01/31/96 will result in 02/29/96.
@@ -2858,15 +2858,15 @@
      * without changing larger fields.  A negative amount means to roll
      * down.
      *
-     * <p>NOTE:  This default implementation on <code>Calendar</code> just repeatedly calls the
+     * <p>NOTE:  This default implementation on {@code Calendar} just repeatedly calls the
      * version of {@link #roll(int,boolean) roll()} that rolls by one unit.  This may not
-     * always do the right thing.  For example, if the <code>DAY_OF_MONTH</code> field is 31,
-     * rolling through February will leave it set to 28.  The <code>GregorianCalendar</code>
+     * always do the right thing.  For example, if the {@code DAY_OF_MONTH} field is 31,
+     * rolling through February will leave it set to 28.  The {@code GregorianCalendar}
      * version of this function takes care of this problem.  Other subclasses
      * should also provide overrides of this function that do the right thing.
      *
      * @param field the calendar field.
-     * @param amount the signed amount to add to the calendar <code>field</code>.
+     * @param amount the signed amount to add to the calendar {@code field}.
      * @since 1.2
      * @see #roll(int,boolean)
      * @see #add(int,int)
@@ -2929,7 +2929,7 @@
     }
 
     /**
-     * Sets the sharedZone flag to <code>shared</code>.
+     * Sets the sharedZone flag to {@code shared}.
      */
     void setZoneShared(boolean shared) {
         sharedZone = shared;
@@ -2942,8 +2942,8 @@
      * With strict (non-lenient) interpretation, such dates will cause an exception to be
      * thrown. The default is lenient.
      *
-     * @param lenient <code>true</code> if the lenient mode is to be turned
-     * on; <code>false</code> if it is to be turned off.
+     * @param lenient {@code true} if the lenient mode is to be turned
+     * on; {@code false} if it is to be turned off.
      * @see #isLenient()
      * @see java.text.DateFormat#setLenient
      */
@@ -2955,8 +2955,8 @@
     /**
      * Tells whether date/time interpretation is to be lenient.
      *
-     * @return <code>true</code> if the interpretation mode of this calendar is lenient;
-     * <code>false</code> otherwise.
+     * @return {@code true} if the interpretation mode of this calendar is lenient;
+     * {@code false} otherwise.
      * @see #setLenient(boolean)
      */
     public boolean isLenient()
@@ -2965,8 +2965,8 @@
     }
 
     /**
-     * Sets what the first day of the week is; e.g., <code>SUNDAY</code> in the U.S.,
-     * <code>MONDAY</code> in France.
+     * Sets what the first day of the week is; e.g., {@code SUNDAY} in the U.S.,
+     * {@code MONDAY} in France.
      *
      * @param value the given first day of the week.
      * @see #getFirstDayOfWeek()
@@ -2982,8 +2982,8 @@
     }
 
     /**
-     * Gets what the first day of the week is; e.g., <code>SUNDAY</code> in the U.S.,
-     * <code>MONDAY</code> in France.
+     * Gets what the first day of the week is; e.g., {@code SUNDAY} in the U.S.,
+     * {@code MONDAY} in France.
      *
      * @return the first day of the week.
      * @see #setFirstDayOfWeek(int)
@@ -3054,7 +3054,7 @@
      * {@link UnsupportedOperationException}.
      *
      * @return the week year of this {@code Calendar}
-     * @exception UnsupportedOperationException
+     * @throws    UnsupportedOperationException
      *            if any week year numbering isn't supported
      *            in this {@code Calendar}.
      * @see #isWeekDateSupported()
@@ -3086,11 +3086,11 @@
      * @param dayOfWeek  the day of week value: one of the constants
      *                   for the {@link #DAY_OF_WEEK} field: {@link
      *                   #SUNDAY}, ..., {@link #SATURDAY}.
-     * @exception IllegalArgumentException
+     * @throws    IllegalArgumentException
      *            if any of the given date specifiers is invalid
      *            or any of the calendar fields are inconsistent
      *            with the given date specifiers in non-lenient mode
-     * @exception UnsupportedOperationException
+     * @throws    UnsupportedOperationException
      *            if any week year numbering isn't supported in this
      *            {@code Calendar}.
      * @see #isWeekDateSupported()
@@ -3110,7 +3110,7 @@
      * {@code UnsupportedOperationException}.
      *
      * @return the number of weeks in the week year.
-     * @exception UnsupportedOperationException
+     * @throws    UnsupportedOperationException
      *            if any week year numbering isn't supported in this
      *            {@code Calendar}.
      * @see #WEEK_OF_YEAR
@@ -3125,7 +3125,7 @@
 
     /**
      * Returns the minimum value for the given calendar field of this
-     * <code>Calendar</code> instance. The minimum value is defined as
+     * {@code Calendar} instance. The minimum value is defined as
      * the smallest value returned by the {@link #get(int) get} method
      * for any possible time value.  The minimum value depends on
      * calendar system specific parameters of the instance.
@@ -3142,7 +3142,7 @@
 
     /**
      * Returns the maximum value for the given calendar field of this
-     * <code>Calendar</code> instance. The maximum value is defined as
+     * {@code Calendar} instance. The maximum value is defined as
      * the largest value returned by the {@link #get(int) get} method
      * for any possible time value. The maximum value depends on
      * calendar system specific parameters of the instance.
@@ -3159,7 +3159,7 @@
 
     /**
      * Returns the highest minimum value for the given calendar field
-     * of this <code>Calendar</code> instance. The highest minimum
+     * of this {@code Calendar} instance. The highest minimum
      * value is defined as the largest value returned by {@link
      * #getActualMinimum(int)} for any possible time value. The
      * greatest minimum value depends on calendar system specific
@@ -3177,13 +3177,13 @@
 
     /**
      * Returns the lowest maximum value for the given calendar field
-     * of this <code>Calendar</code> instance. The lowest maximum
+     * of this {@code Calendar} instance. The lowest maximum
      * value is defined as the smallest value returned by {@link
      * #getActualMaximum(int)} for any possible time value. The least
      * maximum value depends on calendar system specific parameters of
-     * the instance. For example, a <code>Calendar</code> for the
+     * the instance. For example, a {@code Calendar} for the
      * Gregorian calendar system returns 28 for the
-     * <code>DAY_OF_MONTH</code> field, because the 28th is the last
+     * {@code DAY_OF_MONTH} field, because the 28th is the last
      * day of the shortest month of this calendar, February in a
      * common year.
      *
@@ -3199,17 +3199,17 @@
 
     /**
      * Returns the minimum value that the specified calendar field
-     * could have, given the time value of this <code>Calendar</code>.
+     * could have, given the time value of this {@code Calendar}.
      *
      * <p>The default implementation of this method uses an iterative
      * algorithm to determine the actual minimum value for the
      * calendar field. Subclasses should, if possible, override this
      * with a more efficient implementation - in many cases, they can
-     * simply return <code>getMinimum()</code>.
+     * simply return {@code getMinimum()}.
      *
      * @param field the calendar field
      * @return the minimum of the given calendar field for the time
-     * value of this <code>Calendar</code>
+     * value of this {@code Calendar}
      * @see #getMinimum(int)
      * @see #getMaximum(int)
      * @see #getGreatestMinimum(int)
@@ -3252,8 +3252,8 @@
     /**
      * Returns the maximum value that the specified calendar field
      * could have, given the time value of this
-     * <code>Calendar</code>. For example, the actual maximum value of
-     * the <code>MONTH</code> field is 12 in some years, and 13 in
+     * {@code Calendar}. For example, the actual maximum value of
+     * the {@code MONTH} field is 12 in some years, and 13 in
      * other years in the Hebrew calendar system.
      *
      * <p>The default implementation of this method uses an iterative
@@ -3263,7 +3263,7 @@
      *
      * @param field the calendar field
      * @return the maximum of the given calendar field for the time
-     * value of this <code>Calendar</code>
+     * value of this {@code Calendar}
      * @see #getMinimum(int)
      * @see #getMaximum(int)
      * @see #getGreatestMinimum(int)
@@ -3351,7 +3351,7 @@
      *
      * @param field the calendar field
      * @return the calendar field name
-     * @exception IndexOutOfBoundsException if <code>field</code> is negative,
+     * @throws    IndexOutOfBoundsException if {@code field} is negative,
      * equal to or greater than {@code FIELD_COUNT}.
      */
     static String getFieldName(int field) {
@@ -3362,7 +3362,7 @@
      * Return a string representation of this calendar. This method
      * is intended to be used only for debugging purposes, and the
      * format of the returned string may vary between implementations.
-     * The returned string may be empty but may not be <code>null</code>.
+     * The returned string may be empty but may not be {@code null}.
      *
      * @return  a string representation of this calendar.
      */
@@ -3517,13 +3517,13 @@
     /**
      * Save the state of this object to a stream (i.e., serialize it).
      *
-     * Ideally, <code>Calendar</code> would only write out its state data and
+     * Ideally, {@code Calendar} would only write out its state data and
      * the current time, and not write any field data out, such as
-     * <code>fields[]</code>, <code>isTimeSet</code>, <code>areFieldsSet</code>,
-     * and <code>isSet[]</code>.  <code>nextStamp</code> also should not be part
+     * {@code fields[]}, {@code isTimeSet}, {@code areFieldsSet},
+     * and {@code isSet[]}.  {@code nextStamp} also should not be part
      * of the persistent state. Unfortunately, this didn't happen before JDK 1.1
      * shipped. To be compatible with JDK 1.1, we will always have to write out
-     * the field values and state flags.  However, <code>nextStamp</code> can be
+     * the field values and state flags.  However, {@code nextStamp} can be
      * removed from the serialization stream; this will probably happen in the
      * near future.
      */
--- a/src/java.base/share/classes/java/util/ConcurrentModificationException.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/ConcurrentModificationException.java	Tue Sep 24 15:19:35 2019 -0400
@@ -107,7 +107,7 @@
      * Constructs a new exception with the specified detail message and
      * cause.
      *
-     * <p>Note that the detail message associated with <code>cause</code> is
+     * <p>Note that the detail message associated with {@code cause} is
      * <i>not</i> automatically incorporated in this exception's detail
      * message.
      *
--- a/src/java.base/share/classes/java/util/Currency.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/Currency.java	Tue Sep 24 15:19:35 2019 -0400
@@ -55,9 +55,9 @@
  * ISO web site</a> for more information.
  * <p>
  * The class is designed so that there's never more than one
- * <code>Currency</code> instance for any given currency. Therefore, there's
- * no public constructor. You obtain a <code>Currency</code> instance using
- * the <code>getInstance</code> methods.
+ * {@code Currency} instance for any given currency. Therefore, there's
+ * no public constructor. You obtain a {@code Currency} instance using
+ * the {@code getInstance} methods.
  * <p>
  * Users can supersede the Java runtime currency data by means of the system
  * property {@systemProperty java.util.currency.data}. If this system property is
@@ -274,7 +274,7 @@
 
 
     /**
-     * Constructs a <code>Currency</code> instance. The constructor is private
+     * Constructs a {@code Currency} instance. The constructor is private
      * so that we can insure that there's never more than one instance for a
      * given currency.
      */
@@ -285,12 +285,12 @@
     }
 
     /**
-     * Returns the <code>Currency</code> instance for the given currency code.
+     * Returns the {@code Currency} instance for the given currency code.
      *
      * @param currencyCode the ISO 4217 code of the currency
-     * @return the <code>Currency</code> instance for the given currency code
-     * @exception NullPointerException if <code>currencyCode</code> is null
-     * @exception IllegalArgumentException if <code>currencyCode</code> is not
+     * @return the {@code Currency} instance for the given currency code
+     * @throws    NullPointerException if {@code currencyCode} is null
+     * @throws    IllegalArgumentException if {@code currencyCode} is not
      * a supported ISO 4217 code.
      */
     public static Currency getInstance(String currencyCode) {
@@ -350,7 +350,7 @@
     }
 
     /**
-     * Returns the <code>Currency</code> instance for the country of the
+     * Returns the {@code Currency} instance for the country of the
      * given locale. The language and variant components of the locale
      * are ignored. The result may vary over time, as countries change their
      * currencies. For example, for the original member countries of the
@@ -365,16 +365,16 @@
      * specified, the currency from the "cu" extension supersedes the implicit one
      * from the "rg" extension.
      * <p>
-     * The method returns <code>null</code> for territories that don't
+     * The method returns {@code null} for territories that don't
      * have a currency, such as Antarctica.
      *
-     * @param locale the locale for whose country a <code>Currency</code>
+     * @param locale the locale for whose country a {@code Currency}
      * instance is needed
-     * @return the <code>Currency</code> instance for the country of the given
+     * @return the {@code Currency} instance for the country of the given
      * locale, or {@code null}
-     * @exception NullPointerException if <code>locale</code>
+     * @throws    NullPointerException if {@code locale}
      * is {@code null}
-     * @exception IllegalArgumentException if the country of the given {@code locale}
+     * @throws    IllegalArgumentException if the country of the given {@code locale}
      * is not a supported ISO 3166 country code.
      */
     public static Currency getInstance(Locale locale) {
@@ -537,7 +537,7 @@
      * @param locale the locale for which a display name for this currency is
      * needed
      * @return the symbol of this currency for the specified locale
-     * @exception NullPointerException if <code>locale</code> is null
+     * @throws    NullPointerException if {@code locale} is null
      */
     public String getSymbol(Locale locale) {
         LocaleServiceProviderPool pool =
@@ -632,7 +632,7 @@
      * @param locale the locale for which a display name for this currency is
      * needed
      * @return the display name of this currency for the specified locale
-     * @exception NullPointerException if <code>locale</code> is null
+     * @throws    NullPointerException if {@code locale} is null
      * @since 1.7
      */
     public String getDisplayName(Locale locale) {
@@ -1197,5 +1197,3 @@
     }
 
 }
-
-
--- a/src/java.base/share/classes/java/util/Date.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/Date.java	Tue Sep 24 15:19:35 2019 -0400
@@ -910,7 +910,7 @@
      *            represented by this {@code Date} object is strictly
      *            earlier than the instant represented by {@code when};
      *          {@code false} otherwise.
-     * @exception NullPointerException if {@code when} is null.
+     * @throws    NullPointerException if {@code when} is null.
      */
     public boolean before(Date when) {
         return getMillisOf(this) < getMillisOf(when);
@@ -924,7 +924,7 @@
      *          by this {@code Date} object is strictly later than the
      *          instant represented by {@code when};
      *          {@code false} otherwise.
-     * @exception NullPointerException if {@code when} is null.
+     * @throws    NullPointerException if {@code when} is null.
      */
     public boolean after(Date when) {
         return getMillisOf(this) > getMillisOf(when);
@@ -973,7 +973,7 @@
      *          is before the Date argument; and a value greater than
      *      {@code 0} if this Date is after the Date argument.
      * @since   1.2
-     * @exception NullPointerException if {@code anotherDate} is null.
+     * @throws    NullPointerException if {@code anotherDate} is null.
      */
     public int compareTo(Date anotherDate) {
         long thisTime = getMillisOf(this);
@@ -1353,8 +1353,8 @@
      * @param instant  the instant to convert
      * @return a {@code Date} representing the same point on the time-line as
      *  the provided instant
-     * @exception NullPointerException if {@code instant} is null.
-     * @exception IllegalArgumentException if the instant is too large to
+     * @throws    NullPointerException if {@code instant} is null.
+     * @throws    IllegalArgumentException if the instant is too large to
      *  represent as a {@code Date}
      * @since 1.8
      */
--- a/src/java.base/share/classes/java/util/Dictionary.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/Dictionary.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -106,7 +106,7 @@
      * @param   key   a key in this dictionary.
      *          {@code null} if the key is not mapped to any value in
      *          this dictionary.
-     * @exception NullPointerException if the {@code key} is {@code null}.
+     * @throws    NullPointerException if the {@code key} is {@code null}.
      * @see     java.util.Dictionary#put(java.lang.Object, java.lang.Object)
      */
     public abstract V get(Object key);
@@ -133,7 +133,7 @@
      * @return     the previous value to which the {@code key} was mapped
      *             in this dictionary, or {@code null} if the key did not
      *             have a previous mapping.
-     * @exception  NullPointerException  if the {@code key} or
+     * @throws     NullPointerException  if the {@code key} or
      *               {@code value} is {@code null}.
      * @see        java.lang.Object#equals(java.lang.Object)
      * @see        java.util.Dictionary#get(java.lang.Object)
@@ -149,7 +149,7 @@
      * @return  the value to which the {@code key} had been mapped in this
      *          dictionary, or {@code null} if the key did not have a
      *          mapping.
-     * @exception NullPointerException if {@code key} is {@code null}.
+     * @throws    NullPointerException if {@code key} is {@code null}.
      */
     public abstract V remove(Object key);
 }
--- a/src/java.base/share/classes/java/util/Enumeration.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/Enumeration.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -76,7 +76,7 @@
      * object has at least one more element to provide.
      *
      * @return     the next element of this enumeration.
-     * @exception  NoSuchElementException  if no more elements exist.
+     * @throws     NoSuchElementException  if no more elements exist.
      */
     E nextElement();
 
--- a/src/java.base/share/classes/java/util/GregorianCalendar.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/GregorianCalendar.java	Tue Sep 24 15:19:35 2019 -0400
@@ -53,11 +53,11 @@
 import sun.util.calendar.ZoneInfo;
 
 /**
- * <code>GregorianCalendar</code> is a concrete subclass of
- * <code>Calendar</code> and provides the standard calendar system
+ * {@code GregorianCalendar} is a concrete subclass of
+ * {@code Calendar} and provides the standard calendar system
  * used by most of the world.
  *
- * <p> <code>GregorianCalendar</code> is a hybrid calendar that
+ * <p> {@code GregorianCalendar} is a hybrid calendar that
  * supports both the Julian and Gregorian calendar systems with the
  * support of a single discontinuity, which corresponds by default to
  * the Gregorian date when the Gregorian calendar was instituted
@@ -68,19 +68,19 @@
  * <p>
  * Historically, in those countries which adopted the Gregorian calendar first,
  * October 4, 1582 (Julian) was thus followed by October 15, 1582 (Gregorian). This calendar models
- * this correctly.  Before the Gregorian cutover, <code>GregorianCalendar</code>
+ * this correctly.  Before the Gregorian cutover, {@code GregorianCalendar}
  * implements the Julian calendar.  The only difference between the Gregorian
  * and the Julian calendar is the leap year rule. The Julian calendar specifies
  * leap years every four years, whereas the Gregorian calendar omits century
  * years which are not divisible by 400.
  *
  * <p>
- * <code>GregorianCalendar</code> implements <em>proleptic</em> Gregorian and
+ * {@code GregorianCalendar} implements <em>proleptic</em> Gregorian and
  * Julian calendars. That is, dates are computed by extrapolating the current
  * rules indefinitely far backward and forward in time. As a result,
- * <code>GregorianCalendar</code> may be used for all years to generate
+ * {@code GregorianCalendar} may be used for all years to generate
  * meaningful and consistent results. However, dates obtained using
- * <code>GregorianCalendar</code> are historically accurate only from March 1, 4
+ * {@code GregorianCalendar} are historically accurate only from March 1, 4
  * AD onward, when modern Julian calendar rules were adopted.  Before this date,
  * leap year rules were applied irregularly, and before 45 BC the Julian
  * calendar did not even exist.
@@ -135,28 +135,28 @@
  *
  * <h3>Week Of Month</h3>
  *
- * <p>Values calculated for the <code>WEEK_OF_MONTH</code> field range from 0
+ * <p>Values calculated for the {@code WEEK_OF_MONTH} field range from 0
  * to 6.  Week 1 of a month (the days with <code>WEEK_OF_MONTH =
  * 1</code>) is the earliest set of at least
- * <code>getMinimalDaysInFirstWeek()</code> contiguous days in that month,
- * ending on the day before <code>getFirstDayOfWeek()</code>.  Unlike
+ * {@code getMinimalDaysInFirstWeek()} contiguous days in that month,
+ * ending on the day before {@code getFirstDayOfWeek()}.  Unlike
  * week 1 of a year, week 1 of a month may be shorter than 7 days, need
- * not start on <code>getFirstDayOfWeek()</code>, and will not include days of
+ * not start on {@code getFirstDayOfWeek()}, and will not include days of
  * the previous month.  Days of a month before week 1 have a
- * <code>WEEK_OF_MONTH</code> of 0.
+ * {@code WEEK_OF_MONTH} of 0.
  *
- * <p>For example, if <code>getFirstDayOfWeek()</code> is <code>SUNDAY</code>
- * and <code>getMinimalDaysInFirstWeek()</code> is 4, then the first week of
+ * <p>For example, if {@code getFirstDayOfWeek()} is {@code SUNDAY}
+ * and {@code getMinimalDaysInFirstWeek()} is 4, then the first week of
  * January 1998 is Sunday, January 4 through Saturday, January 10.  These days
- * have a <code>WEEK_OF_MONTH</code> of 1.  Thursday, January 1 through
- * Saturday, January 3 have a <code>WEEK_OF_MONTH</code> of 0.  If
- * <code>getMinimalDaysInFirstWeek()</code> is changed to 3, then January 1
- * through January 3 have a <code>WEEK_OF_MONTH</code> of 1.
+ * have a {@code WEEK_OF_MONTH} of 1.  Thursday, January 1 through
+ * Saturday, January 3 have a {@code WEEK_OF_MONTH} of 0.  If
+ * {@code getMinimalDaysInFirstWeek()} is changed to 3, then January 1
+ * through January 3 have a {@code WEEK_OF_MONTH} of 1.
  *
  * <h3>Default Fields Values</h3>
  *
- * <p>The <code>clear</code> method sets calendar field(s)
- * undefined. <code>GregorianCalendar</code> uses the following
+ * <p>The {@code clear} method sets calendar field(s)
+ * undefined. {@code GregorianCalendar} uses the following
  * default value for each calendar field if its value is undefined.
  *
  * <table class="striped" style="text-align: left; width: 66%;">
@@ -174,74 +174,74 @@
  *   <tbody>
  *     <tr>
  *       <th scope="row">
- *              <code>ERA</code>
+ *              {@code ERA}
  *       </th>
  *       <td>
- *              <code>AD</code>
+ *              {@code AD}
  *       </td>
  *     </tr>
  *     <tr>
  *       <th scope="row">
- *              <code>YEAR</code>
+ *              {@code YEAR}
  *       </th>
  *       <td>
- *              <code>1970</code>
+ *              {@code 1970}
  *       </td>
  *     </tr>
  *     <tr>
  *       <th scope="row">
- *              <code>MONTH</code>
+ *              {@code MONTH}
  *       </th>
  *       <td>
- *              <code>JANUARY</code>
+ *              {@code JANUARY}
  *       </td>
  *     </tr>
  *     <tr>
  *       <th scope="row">
- *              <code>DAY_OF_MONTH</code>
+ *              {@code DAY_OF_MONTH}
  *       </th>
  *       <td>
- *              <code>1</code>
+ *              {@code 1}
  *       </td>
  *     </tr>
  *     <tr>
  *       <th scope="row">
- *              <code>DAY_OF_WEEK</code>
+ *              {@code DAY_OF_WEEK}
  *       </th>
  *       <td>
- *              <code>the first day of week</code>
+ *              {@code the first day of week}
  *       </td>
  *     </tr>
  *     <tr>
  *       <th scope="row">
- *              <code>WEEK_OF_MONTH</code>
+ *              {@code WEEK_OF_MONTH}
  *       </th>
  *       <td>
- *              <code>0</code>
+ *              {@code 0}
  *       </td>
  *     </tr>
  *     <tr>
  *       <th scope="row">
- *              <code>DAY_OF_WEEK_IN_MONTH</code>
+ *              {@code DAY_OF_WEEK_IN_MONTH}
  *       </th>
  *       <td>
- *              <code>1</code>
+ *              {@code 1}
  *       </td>
  *     </tr>
  *     <tr>
  *       <th scope="row">
- *              <code>AM_PM</code>
+ *              {@code AM_PM}
  *       </th>
  *       <td>
- *              <code>AM</code>
+ *              {@code AM}
  *       </td>
  *     </tr>
  *     <tr>
  *       <th scope="row">
- *              <code>HOUR, HOUR_OF_DAY, MINUTE, SECOND, MILLISECOND</code>
+ *              {@code HOUR, HOUR_OF_DAY, MINUTE, SECOND, MILLISECOND}
  *       </th>
  *       <td>
- *              <code>0</code>
+ *              {@code 0}
  *       </td>
  *     </tr>
  *   </tbody>
@@ -360,9 +360,9 @@
 //////////////////
 
     /**
-     * Value of the <code>ERA</code> field indicating
+     * Value of the {@code ERA} field indicating
      * the period before the common era (before Christ), also known as BCE.
-     * The sequence of years at the transition from <code>BC</code> to <code>AD</code> is
+     * The sequence of years at the transition from {@code BC} to {@code AD} is
      * ..., 2 BC, 1 BC, 1 AD, 2 AD,...
      *
      * @see #ERA
@@ -378,9 +378,9 @@
     static final int BCE = 0;
 
     /**
-     * Value of the <code>ERA</code> field indicating
+     * Value of the {@code ERA} field indicating
      * the common era (Anno Domini), also known as CE.
-     * The sequence of years at the transition from <code>BC</code> to <code>AD</code> is
+     * The sequence of years at the transition from {@code BC} to {@code AD} is
      * ..., 2 BC, 1 BC, 1 AD, 2 AD,...
      *
      * @see #ERA
@@ -585,7 +585,7 @@
 ///////////////
 
     /**
-     * Constructs a default <code>GregorianCalendar</code> using the current time
+     * Constructs a default {@code GregorianCalendar} using the current time
      * in the default time zone with the default
      * {@link Locale.Category#FORMAT FORMAT} locale.
      */
@@ -595,7 +595,7 @@
     }
 
     /**
-     * Constructs a <code>GregorianCalendar</code> based on the current time
+     * Constructs a {@code GregorianCalendar} based on the current time
      * in the given time zone with the default
      * {@link Locale.Category#FORMAT FORMAT} locale.
      *
@@ -606,7 +606,7 @@
     }
 
     /**
-     * Constructs a <code>GregorianCalendar</code> based on the current time
+     * Constructs a {@code GregorianCalendar} based on the current time
      * in the default time zone with the given locale.
      *
      * @param aLocale the given locale.
@@ -617,7 +617,7 @@
     }
 
     /**
-     * Constructs a <code>GregorianCalendar</code> based on the current time
+     * Constructs a {@code GregorianCalendar} based on the current time
      * in the given time zone with the given locale.
      *
      * @param zone the given time zone.
@@ -630,29 +630,29 @@
     }
 
     /**
-     * Constructs a <code>GregorianCalendar</code> with the given date set
+     * Constructs a {@code GregorianCalendar} with the given date set
      * in the default time zone with the default locale.
      *
-     * @param year the value used to set the <code>YEAR</code> calendar field in the calendar.
-     * @param month the value used to set the <code>MONTH</code> calendar field in the calendar.
+     * @param year the value used to set the {@code YEAR} calendar field in the calendar.
+     * @param month the value used to set the {@code MONTH} calendar field in the calendar.
      * Month value is 0-based. e.g., 0 for January.
-     * @param dayOfMonth the value used to set the <code>DAY_OF_MONTH</code> calendar field in the calendar.
+     * @param dayOfMonth the value used to set the {@code DAY_OF_MONTH} calendar field in the calendar.
      */
     public GregorianCalendar(int year, int month, int dayOfMonth) {
         this(year, month, dayOfMonth, 0, 0, 0, 0);
     }
 
     /**
-     * Constructs a <code>GregorianCalendar</code> with the given date
+     * Constructs a {@code GregorianCalendar} with the given date
      * and time set for the default time zone with the default locale.
      *
-     * @param year the value used to set the <code>YEAR</code> calendar field in the calendar.
-     * @param month the value used to set the <code>MONTH</code> calendar field in the calendar.
+     * @param year the value used to set the {@code YEAR} calendar field in the calendar.
+     * @param month the value used to set the {@code MONTH} calendar field in the calendar.
      * Month value is 0-based. e.g., 0 for January.
-     * @param dayOfMonth the value used to set the <code>DAY_OF_MONTH</code> calendar field in the calendar.
-     * @param hourOfDay the value used to set the <code>HOUR_OF_DAY</code> calendar field
+     * @param dayOfMonth the value used to set the {@code DAY_OF_MONTH} calendar field in the calendar.
+     * @param hourOfDay the value used to set the {@code HOUR_OF_DAY} calendar field
      * in the calendar.
-     * @param minute the value used to set the <code>MINUTE</code> calendar field
+     * @param minute the value used to set the {@code MINUTE} calendar field
      * in the calendar.
      */
     public GregorianCalendar(int year, int month, int dayOfMonth, int hourOfDay,
@@ -664,15 +664,15 @@
      * Constructs a GregorianCalendar with the given date
      * and time set for the default time zone with the default locale.
      *
-     * @param year the value used to set the <code>YEAR</code> calendar field in the calendar.
-     * @param month the value used to set the <code>MONTH</code> calendar field in the calendar.
+     * @param year the value used to set the {@code YEAR} calendar field in the calendar.
+     * @param month the value used to set the {@code MONTH} calendar field in the calendar.
      * Month value is 0-based. e.g., 0 for January.
-     * @param dayOfMonth the value used to set the <code>DAY_OF_MONTH</code> calendar field in the calendar.
-     * @param hourOfDay the value used to set the <code>HOUR_OF_DAY</code> calendar field
+     * @param dayOfMonth the value used to set the {@code DAY_OF_MONTH} calendar field in the calendar.
+     * @param hourOfDay the value used to set the {@code HOUR_OF_DAY} calendar field
      * in the calendar.
-     * @param minute the value used to set the <code>MINUTE</code> calendar field
+     * @param minute the value used to set the {@code MINUTE} calendar field
      * in the calendar.
-     * @param second the value used to set the <code>SECOND</code> calendar field
+     * @param second the value used to set the {@code SECOND} calendar field
      * in the calendar.
      */
     public GregorianCalendar(int year, int month, int dayOfMonth, int hourOfDay,
@@ -681,20 +681,20 @@
     }
 
     /**
-     * Constructs a <code>GregorianCalendar</code> with the given date
+     * Constructs a {@code GregorianCalendar} with the given date
      * and time set for the default time zone with the default locale.
      *
-     * @param year the value used to set the <code>YEAR</code> calendar field in the calendar.
-     * @param month the value used to set the <code>MONTH</code> calendar field in the calendar.
+     * @param year the value used to set the {@code YEAR} calendar field in the calendar.
+     * @param month the value used to set the {@code MONTH} calendar field in the calendar.
      * Month value is 0-based. e.g., 0 for January.
-     * @param dayOfMonth the value used to set the <code>DAY_OF_MONTH</code> calendar field in the calendar.
-     * @param hourOfDay the value used to set the <code>HOUR_OF_DAY</code> calendar field
+     * @param dayOfMonth the value used to set the {@code DAY_OF_MONTH} calendar field in the calendar.
+     * @param hourOfDay the value used to set the {@code HOUR_OF_DAY} calendar field
      * in the calendar.
-     * @param minute the value used to set the <code>MINUTE</code> calendar field
+     * @param minute the value used to set the {@code MINUTE} calendar field
      * in the calendar.
-     * @param second the value used to set the <code>SECOND</code> calendar field
+     * @param second the value used to set the {@code SECOND} calendar field
      * in the calendar.
-     * @param millis the value used to set the <code>MILLISECOND</code> calendar field
+     * @param millis the value used to set the {@code MILLISECOND} calendar field
      */
     GregorianCalendar(int year, int month, int dayOfMonth,
                       int hourOfDay, int minute, int second, int millis) {
@@ -745,13 +745,13 @@
 /////////////////
 
     /**
-     * Sets the <code>GregorianCalendar</code> change date. This is the point when the switch
+     * Sets the {@code GregorianCalendar} change date. This is the point when the switch
      * from Julian dates to Gregorian dates occurred. Default is October 15,
      * 1582 (Gregorian). Previous to this, dates will be in the Julian calendar.
      * <p>
      * To obtain a pure Julian calendar, set the change date to
-     * <code>Date(Long.MAX_VALUE)</code>.  To obtain a pure Gregorian calendar,
-     * set the change date to <code>Date(Long.MIN_VALUE)</code>.
+     * {@code Date(Long.MAX_VALUE)}.  To obtain a pure Gregorian calendar,
+     * set the change date to {@code Date(Long.MIN_VALUE)}.
      *
      * @param date the given Gregorian cutover date.
      */
@@ -803,20 +803,20 @@
      * October 15, 1582 (Gregorian). Previous to this, dates will be in the Julian
      * calendar.
      *
-     * @return the Gregorian cutover date for this <code>GregorianCalendar</code> object.
+     * @return the Gregorian cutover date for this {@code GregorianCalendar} object.
      */
     public final Date getGregorianChange() {
         return new Date(gregorianCutover);
     }
 
     /**
-     * Determines if the given year is a leap year. Returns <code>true</code> if
+     * Determines if the given year is a leap year. Returns {@code true} if
      * the given year is a leap year. To specify BC year numbers,
-     * <code>1 - year number</code> must be given. For example, year BC 4 is
+     * {@code 1 - year number} must be given. For example, year BC 4 is
      * specified as -3.
      *
      * @param year the given year.
-     * @return <code>true</code> if the given year is a leap year; <code>false</code> otherwise.
+     * @return {@code true} if the given year is a leap year; {@code false} otherwise.
      */
     public boolean isLeapYear(int year) {
         if ((year & 3) != 0) {
@@ -853,17 +853,17 @@
     }
 
     /**
-     * Compares this <code>GregorianCalendar</code> to the specified
-     * <code>Object</code>. The result is <code>true</code> if and
-     * only if the argument is a <code>GregorianCalendar</code> object
+     * Compares this {@code GregorianCalendar} to the specified
+     * {@code Object}. The result is {@code true} if and
+     * only if the argument is a {@code GregorianCalendar} object
      * that represents the same time value (millisecond offset from
      * the <a href="Calendar.html#Epoch">Epoch</a>) under the same
-     * <code>Calendar</code> parameters and Gregorian change date as
+     * {@code Calendar} parameters and Gregorian change date as
      * this object.
      *
      * @param obj the object to compare with.
-     * @return <code>true</code> if this object is equal to <code>obj</code>;
-     * <code>false</code> otherwise.
+     * @return {@code true} if this object is equal to {@code obj};
+     * {@code false} otherwise.
      * @see Calendar#compareTo(Calendar)
      */
     @Override
@@ -874,7 +874,7 @@
     }
 
     /**
-     * Generates the hash code for this <code>GregorianCalendar</code> object.
+     * Generates the hash code for this {@code GregorianCalendar} object.
      */
     @Override
     public int hashCode() {
@@ -885,27 +885,27 @@
      * Adds the specified (signed) amount of time to the given calendar field,
      * based on the calendar's rules.
      *
-     * <p><em>Add rule 1</em>. The value of <code>field</code>
-     * after the call minus the value of <code>field</code> before the
-     * call is <code>amount</code>, modulo any overflow that has occurred in
-     * <code>field</code>. Overflow occurs when a field value exceeds its
+     * <p><em>Add rule 1</em>. The value of {@code field}
+     * after the call minus the value of {@code field} before the
+     * call is {@code amount}, modulo any overflow that has occurred in
+     * {@code field}. Overflow occurs when a field value exceeds its
      * range and, as a result, the next larger field is incremented or
      * decremented and the field value is adjusted back into its range.</p>
      *
      * <p><em>Add rule 2</em>. If a smaller field is expected to be
      * invariant, but it is impossible for it to be equal to its
      * prior value because of changes in its minimum or maximum after
-     * <code>field</code> is changed, then its value is adjusted to be as close
+     * {@code field} is changed, then its value is adjusted to be as close
      * as possible to its expected value. A smaller field represents a
-     * smaller unit of time. <code>HOUR</code> is a smaller field than
-     * <code>DAY_OF_MONTH</code>. No adjustment is made to smaller fields
+     * smaller unit of time. {@code HOUR} is a smaller field than
+     * {@code DAY_OF_MONTH}. No adjustment is made to smaller fields
      * that are not expected to be invariant. The calendar system
      * determines what fields are expected to be invariant.</p>
      *
      * @param field the calendar field.
      * @param amount the amount of date or time to be added to the field.
-     * @exception IllegalArgumentException if <code>field</code> is
-     * <code>ZONE_OFFSET</code>, <code>DST_OFFSET</code>, or unknown,
+     * @throws    IllegalArgumentException if {@code field} is
+     * {@code ZONE_OFFSET}, {@code DST_OFFSET}, or unknown,
      * or if any calendar fields have out-of-range values in
      * non-lenient mode.
      */
@@ -1094,15 +1094,15 @@
      * Adds or subtracts (up/down) a single unit of time on the given time
      * field without changing larger fields.
      * <p>
-     * <em>Example</em>: Consider a <code>GregorianCalendar</code>
+     * <em>Example</em>: Consider a {@code GregorianCalendar}
      * originally set to December 31, 1999. Calling {@link #roll(int,boolean) roll(Calendar.MONTH, true)}
-     * sets the calendar to January 31, 1999.  The <code>YEAR</code> field is unchanged
-     * because it is a larger field than <code>MONTH</code>.</p>
+     * sets the calendar to January 31, 1999.  The {@code YEAR} field is unchanged
+     * because it is a larger field than {@code MONTH}.</p>
      *
      * @param up indicates if the value of the specified calendar field is to be
-     * rolled up or rolled down. Use <code>true</code> if rolling up, <code>false</code> otherwise.
-     * @exception IllegalArgumentException if <code>field</code> is
-     * <code>ZONE_OFFSET</code>, <code>DST_OFFSET</code>, or unknown,
+     * rolled up or rolled down. Use {@code true} if rolling up, {@code false} otherwise.
+     * @throws    IllegalArgumentException if {@code field} is
+     * {@code ZONE_OFFSET}, {@code DST_OFFSET}, or unknown,
      * or if any calendar fields have out-of-range values in
      * non-lenient mode.
      * @see #add(int,int)
@@ -1121,35 +1121,35 @@
      * <p>This method calls {@link #complete()} before adding the
      * amount so that all the calendar fields are normalized. If there
      * is any calendar field having an out-of-range value in non-lenient mode, then an
-     * <code>IllegalArgumentException</code> is thrown.
+     * {@code IllegalArgumentException} is thrown.
      *
      * <p>
-     * <em>Example</em>: Consider a <code>GregorianCalendar</code>
+     * <em>Example</em>: Consider a {@code GregorianCalendar}
      * originally set to August 31, 1999. Calling <code>roll(Calendar.MONTH,
      * 8)</code> sets the calendar to April 30, <strong>1999</strong>. Using a
-     * <code>GregorianCalendar</code>, the <code>DAY_OF_MONTH</code> field cannot
-     * be 31 in the month April. <code>DAY_OF_MONTH</code> is set to the closest possible
-     * value, 30. The <code>YEAR</code> field maintains the value of 1999 because it
-     * is a larger field than <code>MONTH</code>.
+     * {@code GregorianCalendar}, the {@code DAY_OF_MONTH} field cannot
+     * be 31 in the month April. {@code DAY_OF_MONTH} is set to the closest possible
+     * value, 30. The {@code YEAR} field maintains the value of 1999 because it
+     * is a larger field than {@code MONTH}.
      * <p>
-     * <em>Example</em>: Consider a <code>GregorianCalendar</code>
+     * <em>Example</em>: Consider a {@code GregorianCalendar}
      * originally set to Sunday June 6, 1999. Calling
-     * <code>roll(Calendar.WEEK_OF_MONTH, -1)</code> sets the calendar to
+     * {@code roll(Calendar.WEEK_OF_MONTH, -1)} sets the calendar to
      * Tuesday June 1, 1999, whereas calling
-     * <code>add(Calendar.WEEK_OF_MONTH, -1)</code> sets the calendar to
+     * {@code add(Calendar.WEEK_OF_MONTH, -1)} sets the calendar to
      * Sunday May 30, 1999. This is because the roll rule imposes an
-     * additional constraint: The <code>MONTH</code> must not change when the
-     * <code>WEEK_OF_MONTH</code> is rolled. Taken together with add rule 1,
+     * additional constraint: The {@code MONTH} must not change when the
+     * {@code WEEK_OF_MONTH} is rolled. Taken together with add rule 1,
      * the resultant date must be between Tuesday June 1 and Saturday June
-     * 5. According to add rule 2, the <code>DAY_OF_WEEK</code>, an invariant
-     * when changing the <code>WEEK_OF_MONTH</code>, is set to Tuesday, the
+     * 5. According to add rule 2, the {@code DAY_OF_WEEK}, an invariant
+     * when changing the {@code WEEK_OF_MONTH}, is set to Tuesday, the
      * closest possible value to Sunday (where Sunday is the first day of the
      * week).</p>
      *
      * @param field the calendar field.
-     * @param amount the signed amount to add to <code>field</code>.
-     * @exception IllegalArgumentException if <code>field</code> is
-     * <code>ZONE_OFFSET</code>, <code>DST_OFFSET</code>, or unknown,
+     * @param amount the signed amount to add to {@code field}.
+     * @throws    IllegalArgumentException if {@code field} is
+     * {@code ZONE_OFFSET}, {@code DST_OFFSET}, or unknown,
      * or if any calendar fields have out-of-range values in
      * non-lenient mode.
      * @see #roll(int,boolean)
@@ -1512,7 +1512,7 @@
 
     /**
      * Returns the minimum value for the given calendar field of this
-     * <code>GregorianCalendar</code> instance. The minimum value is
+     * {@code GregorianCalendar} instance. The minimum value is
      * defined as the smallest value returned by the {@link
      * Calendar#get(int) get} method for any possible time value,
      * taking into consideration the current values of the
@@ -1536,7 +1536,7 @@
 
     /**
      * Returns the maximum value for the given calendar field of this
-     * <code>GregorianCalendar</code> instance. The maximum value is
+     * {@code GregorianCalendar} instance. The maximum value is
      * defined as the largest value returned by the {@link
      * Calendar#get(int) get} method for any possible time value,
      * taking into consideration the current values of the
@@ -1585,7 +1585,7 @@
 
     /**
      * Returns the highest minimum value for the given calendar field
-     * of this <code>GregorianCalendar</code> instance. The highest
+     * of this {@code GregorianCalendar} instance. The highest
      * minimum value is defined as the largest value returned by
      * {@link #getActualMinimum(int)} for any possible time value,
      * taking into consideration the current values of the
@@ -1615,7 +1615,7 @@
 
     /**
      * Returns the lowest maximum value for the given calendar field
-     * of this <code>GregorianCalendar</code> instance. The lowest
+     * of this {@code GregorianCalendar} instance. The lowest
      * maximum value is defined as the smallest value returned by
      * {@link #getActualMaximum(int)} for any possible time value,
      * taking into consideration the current values of the
@@ -1665,16 +1665,16 @@
      * {@link Calendar#getTimeZone() getTimeZone} methods.
      *
      * <p>For example, if the Gregorian change date is January 10,
-     * 1970 and the date of this <code>GregorianCalendar</code> is
+     * 1970 and the date of this {@code GregorianCalendar} is
      * January 20, 1970, the actual minimum value of the
-     * <code>DAY_OF_MONTH</code> field is 10 because the previous date
+     * {@code DAY_OF_MONTH} field is 10 because the previous date
      * of January 10, 1970 is December 27, 1996 (in the Julian
      * calendar). Therefore, December 28, 1969 to January 9, 1970
      * don't exist.
      *
      * @param field the calendar field
      * @return the minimum of the given field for the time value of
-     * this <code>GregorianCalendar</code>
+     * this {@code GregorianCalendar}
      * @see #getMinimum(int)
      * @see #getMaximum(int)
      * @see #getGreatestMinimum(int)
@@ -1705,7 +1705,7 @@
      * {@link #getGregorianChange() getGregorianChange} and
      * {@link Calendar#getTimeZone() getTimeZone} methods.
      * For example, if the date of this instance is February 1, 2004,
-     * the actual maximum value of the <code>DAY_OF_MONTH</code> field
+     * the actual maximum value of the {@code DAY_OF_MONTH} field
      * is 29 because 2004 is a leap year, and if the date of this
      * instance is February 1, 2005, it's 28.
      *
@@ -1718,7 +1718,7 @@
      *
      * @param field the calendar field
      * @return the maximum of the given field for the time value of
-     * this <code>GregorianCalendar</code>
+     * this {@code GregorianCalendar}
      * @see #getMinimum(int)
      * @see #getMaximum(int)
      * @see #getGreatestMinimum(int)
@@ -2183,7 +2183,7 @@
      *                    for the {@link #DAY_OF_WEEK DAY_OF_WEEK} field:
      *                    {@link Calendar#SUNDAY SUNDAY}, ...,
      *                    {@link Calendar#SATURDAY SATURDAY}.
-     * @exception IllegalArgumentException
+     * @throws    IllegalArgumentException
      *            if any of the given date specifiers is invalid,
      *            or if any of the calendar fields are inconsistent
      *            with the given date specifiers in non-lenient mode
@@ -2287,7 +2287,7 @@
      * href="Calendar.html#Epoch">Epoch</a>) to calendar field values.
      * The time is <em>not</em>
      * recomputed first; to recompute the time, then the fields, call the
-     * <code>complete</code> method.
+     * {@code complete} method.
      *
      * @see Calendar#complete
      */
@@ -2626,7 +2626,7 @@
      * Converts calendar field values to the time value (millisecond
      * offset from the <a href="Calendar.html#Epoch">Epoch</a>).
      *
-     * @exception IllegalArgumentException if any calendar fields are invalid.
+     * @throws    IllegalArgumentException if any calendar fields are invalid.
      */
     @Override
     protected void computeTime() {
@@ -3279,8 +3279,8 @@
      * @param zdt  the zoned date-time object to convert
      * @return  the gregorian calendar representing the same point on the
      *  time-line as the zoned date-time provided
-     * @exception NullPointerException if {@code zdt} is null
-     * @exception IllegalArgumentException if the zoned date-time is too
+     * @throws    NullPointerException if {@code zdt} is null
+     * @throws    IllegalArgumentException if the zoned date-time is too
      * large to represent as a {@code GregorianCalendar}
      * @since 1.8
      */
--- a/src/java.base/share/classes/java/util/Hashtable.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/Hashtable.java	Tue Sep 24 15:19:35 2019 -0400
@@ -180,7 +180,7 @@
      *
      * @param      initialCapacity   the initial capacity of the hashtable.
      * @param      loadFactor        the load factor of the hashtable.
-     * @exception  IllegalArgumentException  if the initial capacity is less
+     * @throws     IllegalArgumentException  if the initial capacity is less
      *             than zero, or if the load factor is nonpositive.
      */
     public Hashtable(int initialCapacity, float loadFactor) {
@@ -202,7 +202,7 @@
      * and default load factor (0.75).
      *
      * @param     initialCapacity   the initial capacity of the hashtable.
-     * @exception IllegalArgumentException if the initial capacity is less
+     * @throws    IllegalArgumentException if the initial capacity is less
      *              than zero.
      */
     public Hashtable(int initialCapacity) {
@@ -304,7 +304,7 @@
      *             {@code value} argument in this hashtable as
      *             determined by the {@code equals} method;
      *             {@code false} otherwise.
-     * @exception  NullPointerException  if the value is {@code null}
+     * @throws     NullPointerException  if the value is {@code null}
      */
     public synchronized boolean contains(Object value) {
         if (value == null) {
@@ -465,7 +465,7 @@
      * @param      value   the value
      * @return     the previous value of the specified key in this hashtable,
      *             or {@code null} if it did not have one
-     * @exception  NullPointerException  if the key or value is
+     * @throws     NullPointerException  if the key or value is
      *               {@code null}
      * @see     Object#equals(Object)
      * @see     #get(Object)
--- a/src/java.base/share/classes/java/util/IllformedLocaleException.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/IllformedLocaleException.java	Tue Sep 24 15:19:35 2019 -0400
@@ -47,7 +47,7 @@
     private int _errIdx = -1;
 
     /**
-     * Constructs a new <code>IllformedLocaleException</code> with no
+     * Constructs a new {@code IllformedLocaleException} with no
      * detail message and -1 as the error index.
      */
     public IllformedLocaleException() {
@@ -55,7 +55,7 @@
     }
 
     /**
-     * Constructs a new <code>IllformedLocaleException</code> with the
+     * Constructs a new {@code IllformedLocaleException} with the
      * given message and -1 as the error index.
      *
      * @param message the message
@@ -65,7 +65,7 @@
     }
 
     /**
-     * Constructs a new <code>IllformedLocaleException</code> with the
+     * Constructs a new {@code IllformedLocaleException} with the
      * given message and the error index.  The error index is the approximate
      * offset from the start of the ill-formed value to the point where the
      * parse first detected an error.  A negative error index value indicates
--- a/src/java.base/share/classes/java/util/JapaneseImperialCalendar.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/JapaneseImperialCalendar.java	Tue Sep 24 15:19:35 2019 -0400
@@ -418,7 +418,7 @@
      *
      * @param field the calendar field.
      * @param amount the amount of date or time to be added to the field.
-     * @exception IllegalArgumentException if {@code field} is
+     * @throws    IllegalArgumentException if {@code field} is
      * {@code ZONE_OFFSET}, {@code DST_OFFSET}, or unknown,
      * or if any calendar fields have out-of-range values in
      * non-lenient mode.
@@ -569,7 +569,7 @@
      *
      * @param field the calendar field.
      * @param amount the signed amount to add to {@code field}.
-     * @exception IllegalArgumentException if {@code field} is
+     * @throws    IllegalArgumentException if {@code field} is
      * {@code ZONE_OFFSET}, {@code DST_OFFSET}, or unknown,
      * or if any calendar fields have out-of-range values in
      * non-lenient mode.
@@ -1867,7 +1867,7 @@
      * Converts calendar field values to the time value (millisecond
      * offset from the <a href="Calendar.html#Epoch">Epoch</a>).
      *
-     * @exception IllegalArgumentException if any calendar fields are invalid.
+     * @throws    IllegalArgumentException if any calendar fields are invalid.
      */
     protected void computeTime() {
         // In non-lenient mode, perform brief checking of calendar
--- a/src/java.base/share/classes/java/util/ListResourceBundle.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/ListResourceBundle.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,16 +43,16 @@
 import sun.util.ResourceBundleEnumeration;
 
 /**
- * <code>ListResourceBundle</code> is an abstract subclass of
- * <code>ResourceBundle</code> that manages resources for a locale
- * in a convenient and easy to use list. See <code>ResourceBundle</code> for
+ * {@code ListResourceBundle} is an abstract subclass of
+ * {@code ResourceBundle} that manages resources for a locale
+ * in a convenient and easy to use list. See {@code ResourceBundle} for
  * more information about resource bundles in general.
  *
  * <P>
- * Subclasses must override <code>getContents</code> and provide an array,
+ * Subclasses must override {@code getContents} and provide an array,
  * where each item in the array is a pair of objects.
  * The first element of each pair is the key, which must be a
- * <code>String</code>, and the second element is the value associated with
+ * {@code String}, and the second element is the value associated with
  * that key.
  *
  * <p>
@@ -60,7 +60,7 @@
  * bundle family with the base name "MyResources".
  * "MyResources" is the default member of the bundle family, and
  * "MyResources_fr" is the French member.
- * These members are based on <code>ListResourceBundle</code>
+ * These members are based on {@code ListResourceBundle}
  * (a related <a href="PropertyResourceBundle.html#sample">example</a> shows
  * how you can add a bundle to this family that's based on a properties file).
  * The keys in this example are of the form "s1" etc. The actual
@@ -136,11 +136,11 @@
     }
 
     /**
-     * Returns an <code>Enumeration</code> of the keys contained in
-     * this <code>ResourceBundle</code> and its parent bundles.
+     * Returns an {@code Enumeration} of the keys contained in
+     * this {@code ResourceBundle} and its parent bundles.
      *
-     * @return an <code>Enumeration</code> of the keys contained in
-     *         this <code>ResourceBundle</code> and its parent bundles.
+     * @return an {@code Enumeration} of the keys contained in
+     *         this {@code ResourceBundle} and its parent bundles.
      * @see #keySet()
      */
     public Enumeration<String> getKeys() {
@@ -155,11 +155,11 @@
     }
 
     /**
-     * Returns a <code>Set</code> of the keys contained
-     * <em>only</em> in this <code>ResourceBundle</code>.
+     * Returns a {@code Set} of the keys contained
+     * <em>only</em> in this {@code ResourceBundle}.
      *
-     * @return a <code>Set</code> of the keys contained only in this
-     *         <code>ResourceBundle</code>
+     * @return a {@code Set} of the keys contained only in this
+     *         {@code ResourceBundle}
      * @since 1.6
      * @see #keySet()
      */
@@ -172,12 +172,12 @@
 
     /**
      * Returns an array in which each item is a pair of objects in an
-     * <code>Object</code> array. The first element of each pair is
-     * the key, which must be a <code>String</code>, and the second
+     * {@code Object} array. The first element of each pair is
+     * the key, which must be a {@code String}, and the second
      * element is the value associated with that key.  See the class
      * description for details.
      *
-     * @return an array of an <code>Object</code> array representing a
+     * @return an array of an {@code Object} array representing a
      * key-value pair.
      */
     protected abstract Object[][] getContents();
--- a/src/java.base/share/classes/java/util/Locale.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/Locale.java	Tue Sep 24 15:19:35 2019 -0400
@@ -66,9 +66,9 @@
 import sun.util.locale.provider.TimeZoneNameUtility;
 
 /**
- * A <code>Locale</code> object represents a specific geographical, political,
- * or cultural region. An operation that requires a <code>Locale</code> to perform
- * its task is called <em>locale-sensitive</em> and uses the <code>Locale</code>
+ * A {@code Locale} object represents a specific geographical, political,
+ * or cultural region. An operation that requires a {@code Locale} to perform
+ * its task is called <em>locale-sensitive</em> and uses the {@code Locale}
  * to tailor information for the user. For example, displaying a number
  * is a locale-sensitive operation&mdash; the number should be formatted
  * according to the customs and conventions of the user's native country,
@@ -81,7 +81,7 @@
  * Locale Data Markup Language") BCP 47-compatible extensions for locale data
  * exchange.
  *
- * <p> A <code>Locale</code> object logically consists of the fields
+ * <p> A {@code Locale} object logically consists of the fields
  * described below.
  *
  * <dl>
@@ -93,7 +93,7 @@
  *   alpha-2 code must be used.  You can find a full list of valid
  *   language codes in the IANA Language Subtag Registry (search for
  *   "Type: language").  The language field is case insensitive, but
- *   <code>Locale</code> always canonicalizes to lower case.</dd>
+ *   {@code Locale} always canonicalizes to lower case.</dd>
  *
  *   <dd>Well-formed language values have the form
  *   <code>[a-zA-Z]{2,8}</code>.  Note that this is not the full
@@ -108,7 +108,7 @@
  *   <dd>ISO 15924 alpha-4 script code.  You can find a full list of
  *   valid script codes in the IANA Language Subtag Registry (search
  *   for "Type: script").  The script field is case insensitive, but
- *   <code>Locale</code> always canonicalizes to title case (the first
+ *   {@code Locale} always canonicalizes to title case (the first
  *   letter is upper case and the rest of the letters are lower
  *   case).</dd>
  *
@@ -123,7 +123,7 @@
  *   You can find a full list of valid country and region codes in the
  *   IANA Language Subtag Registry (search for "Type: region").  The
  *   country (region) field is case insensitive, but
- *   <code>Locale</code> always canonicalizes to upper case.</dd>
+ *   {@code Locale} always canonicalizes to upper case.</dd>
  *
  *   <dd>Well-formed country/region values have
  *   the form <code>[a-zA-Z]{2} | [0-9]{3}</code></dd>
@@ -134,7 +134,7 @@
  *   <dt><a id="def_variant"><b>variant</b></a></dt>
  *
  *   <dd>Any arbitrary value used to indicate a variation of a
- *   <code>Locale</code>.  Where there are two or more variant values
+ *   {@code Locale}.  Where there are two or more variant values
  *   each indicating its own semantics, these values should be ordered
  *   by importance, with most important first, separated by
  *   underscore('_').  The variant field is case sensitive.</dd>
@@ -146,7 +146,7 @@
  *   region subtags.  You can find a full list of valid variant codes
  *   in the IANA Language Subtag Registry (search for "Type: variant").
  *
- *   <p>However, the variant field in <code>Locale</code> has
+ *   <p>However, the variant field in {@code Locale} has
  *   historically been used for any kind of variation, not just
  *   language variations.  For example, some supported variants
  *   available in Java SE Runtime Environments indicate alternative
@@ -166,15 +166,15 @@
  *
  *   <dd>A map from single character keys to string values, indicating
  *   extensions apart from language identification.  The extensions in
- *   <code>Locale</code> implement the semantics and syntax of BCP 47
+ *   {@code Locale} implement the semantics and syntax of BCP 47
  *   extension subtags and private use subtags. The extensions are
- *   case insensitive, but <code>Locale</code> canonicalizes all
+ *   case insensitive, but {@code Locale} canonicalizes all
  *   extension keys and values to lower case. Note that extensions
  *   cannot have empty values.</dd>
  *
  *   <dd>Well-formed keys are single characters from the set
- *   <code>[0-9a-zA-Z]</code>.  Well-formed values have the form
- *   <code>SUBTAG ('-' SUBTAG)*</code> where for the key 'x'
+ *   {@code [0-9a-zA-Z]}.  Well-formed values have the form
+ *   {@code SUBTAG ('-' SUBTAG)*} where for the key 'x'
  *   <code>SUBTAG = [0-9a-zA-Z]{1,8}</code> and for other keys
  *   <code>SUBTAG = [0-9a-zA-Z]{2,8}</code> (that is, 'x' allows
  *   single-character subtags).</dd>
@@ -184,8 +184,8 @@
  * </dl>
  *
  * <b>Note:</b> Although BCP 47 requires field values to be registered
- * in the IANA Language Subtag Registry, the <code>Locale</code> class
- * does not provide any validation features.  The <code>Builder</code>
+ * in the IANA Language Subtag Registry, the {@code Locale} class
+ * does not provide any validation features.  The {@code Builder}
  * only checks if an individual field satisfies the syntactic
  * requirement (is well-formed), but does not validate the value
  * itself.  See {@link Builder} for details.
@@ -203,11 +203,11 @@
  * extension key 'u' ({@link #UNICODE_LOCALE_EXTENSION}).  The above
  * example, "nu-thai", becomes the extension "u-nu-thai".
  *
- * <p>Thus, when a <code>Locale</code> object contains Unicode locale
+ * <p>Thus, when a {@code Locale} object contains Unicode locale
  * attributes and keywords,
- * <code>getExtension(UNICODE_LOCALE_EXTENSION)</code> will return a
+ * {@code getExtension(UNICODE_LOCALE_EXTENSION)} will return a
  * String representing this information, for example, "nu-thai".  The
- * <code>Locale</code> class also provides {@link
+ * {@code Locale} class also provides {@link
  * #getUnicodeLocaleAttributes}, {@link #getUnicodeLocaleKeys}, and
  * {@link #getUnicodeLocaleType} which allow you to access Unicode
  * locale attributes and key/type pairs directly.  When represented as
@@ -232,17 +232,17 @@
  *
  * <h3>Creating a Locale</h3>
  *
- * <p>There are several different ways to create a <code>Locale</code>
+ * <p>There are several different ways to create a {@code Locale}
  * object.
  *
  * <h4>Builder</h4>
  *
- * <p>Using {@link Builder} you can construct a <code>Locale</code> object
+ * <p>Using {@link Builder} you can construct a {@code Locale} object
  * that conforms to BCP 47 syntax.
  *
  * <h4>Constructors</h4>
  *
- * <p>The <code>Locale</code> class provides three constructors:
+ * <p>The {@code Locale} class provides three constructors:
  * <blockquote>
  * <pre>
  *     {@link #Locale(String language)}
@@ -250,20 +250,20 @@
  *     {@link #Locale(String language, String country, String variant)}
  * </pre>
  * </blockquote>
- * These constructors allow you to create a <code>Locale</code> object
+ * These constructors allow you to create a {@code Locale} object
  * with language, country and variant, but you cannot specify
  * script or extensions.
  *
  * <h4>Factory Methods</h4>
  *
- * <p>The method {@link #forLanguageTag} creates a <code>Locale</code>
+ * <p>The method {@link #forLanguageTag} creates a {@code Locale}
  * object for a well-formed BCP 47 language tag.
  *
  * <h4>Locale Constants</h4>
  *
- * <p>The <code>Locale</code> class provides a number of convenient constants
- * that you can use to create <code>Locale</code> objects for commonly used
- * locales. For example, the following creates a <code>Locale</code> object
+ * <p>The {@code Locale} class provides a number of convenient constants
+ * that you can use to create {@code Locale} objects for commonly used
+ * locales. For example, the following creates a {@code Locale} object
  * for the United States:
  * <blockquote>
  * <pre>
@@ -344,25 +344,25 @@
  *
  * <h3>Use of Locale</h3>
  *
- * <p>Once you've created a <code>Locale</code> you can query it for information
- * about itself. Use <code>getCountry</code> to get the country (or region)
- * code and <code>getLanguage</code> to get the language code.
- * You can use <code>getDisplayCountry</code> to get the
+ * <p>Once you've created a {@code Locale} you can query it for information
+ * about itself. Use {@code getCountry} to get the country (or region)
+ * code and {@code getLanguage} to get the language code.
+ * You can use {@code getDisplayCountry} to get the
  * name of the country suitable for displaying to the user. Similarly,
- * you can use <code>getDisplayLanguage</code> to get the name of
+ * you can use {@code getDisplayLanguage} to get the name of
  * the language suitable for displaying to the user. Interestingly,
- * the <code>getDisplayXXX</code> methods are themselves locale-sensitive
+ * the {@code getDisplayXXX} methods are themselves locale-sensitive
  * and have two versions: one that uses the default
  * {@link Locale.Category#DISPLAY DISPLAY} locale and one
  * that uses the locale specified as an argument.
  *
  * <p>The Java Platform provides a number of classes that perform locale-sensitive
- * operations. For example, the <code>NumberFormat</code> class formats
+ * operations. For example, the {@code NumberFormat} class formats
  * numbers, currency, and percentages in a locale-sensitive manner. Classes
- * such as <code>NumberFormat</code> have several convenience methods
+ * such as {@code NumberFormat} have several convenience methods
  * for creating a default object of that type. For example, the
- * <code>NumberFormat</code> class provides these three convenience methods
- * for creating a default <code>NumberFormat</code> object:
+ * {@code NumberFormat} class provides these three convenience methods
+ * for creating a default {@code NumberFormat} object:
  * <blockquote>
  * <pre>
  *     NumberFormat.getInstance()
@@ -380,8 +380,8 @@
  *     NumberFormat.getPercentInstance(myLocale)
  * </pre>
  * </blockquote>
- * A <code>Locale</code> is the mechanism for identifying the kind of object
- * (<code>NumberFormat</code>) that you would like to get. The locale is
+ * A {@code Locale} is the mechanism for identifying the kind of object
+ * ({@code NumberFormat}) that you would like to get. The locale is
  * <STRONG>just</STRONG> a mechanism for identifying objects,
  * <STRONG>not</STRONG> a container for the objects themselves.
  *
@@ -390,7 +390,7 @@
  * <p>In order to maintain compatibility with existing usage, Locale's
  * constructors retain their behavior prior to the Java Runtime
  * Environment version 1.7.  The same is largely true for the
- * <code>toString</code> method. Thus Locale objects can continue to
+ * {@code toString} method. Thus Locale objects can continue to
  * be used as they were. In particular, clients who parse the output
  * of toString into language, country, and variant fields can continue
  * to do so (although this is strongly discouraged), although the
@@ -400,15 +400,15 @@
  * <p>In addition, BCP 47 imposes syntax restrictions that are not
  * imposed by Locale's constructors. This means that conversions
  * between some Locales and BCP 47 language tags cannot be made without
- * losing information. Thus <code>toLanguageTag</code> cannot
+ * losing information. Thus {@code toLanguageTag} cannot
  * represent the state of locales whose language, country, or variant
  * do not conform to BCP 47.
  *
  * <p>Because of these issues, it is recommended that clients migrate
  * away from constructing non-conforming locales and use the
- * <code>forLanguageTag</code> and <code>Locale.Builder</code> APIs instead.
+ * {@code forLanguageTag} and {@code Locale.Builder} APIs instead.
  * Clients desiring a string representation of the complete locale can
- * then always rely on <code>toLanguageTag</code> for this purpose.
+ * then always rely on {@code toLanguageTag} for this purpose.
  *
  * <h4><a id="special_cases_constructor">Special cases</a></h4>
  *
@@ -454,9 +454,9 @@
  *
  * <p>The APIs added in 1.7 map between the old and new language codes,
  * maintaining the old codes internal to Locale (so that
- * <code>getLanguage</code> and <code>toString</code> reflect the old
+ * {@code getLanguage} and {@code toString} reflect the old
  * code), but using the new codes in the BCP 47 language tag APIs (so
- * that <code>toLanguageTag</code> reflects the new one). This
+ * that {@code toLanguageTag} reflects the new one). This
  * preserves the equivalence between Locales no matter which code or
  * API is used to construct them. Java's default resource bundle
  * lookup mechanism also implements this mapping, so that resources
@@ -734,13 +734,13 @@
      * </ul>
      *
      * @param language An ISO 639 alpha-2 or alpha-3 language code, or a language subtag
-     * up to 8 characters in length.  See the <code>Locale</code> class description about
+     * up to 8 characters in length.  See the {@code Locale} class description about
      * valid language values.
      * @param country An ISO 3166 alpha-2 country code or a UN M.49 numeric-3 area code.
-     * See the <code>Locale</code> class description about valid country values.
-     * @param variant Any arbitrary value used to indicate a variation of a <code>Locale</code>.
-     * See the <code>Locale</code> class description for the details.
-     * @exception NullPointerException thrown if any argument is null.
+     * See the {@code Locale} class description about valid country values.
+     * @param variant Any arbitrary value used to indicate a variation of a {@code Locale}.
+     * See the {@code Locale} class description for the details.
+     * @throws    NullPointerException thrown if any argument is null.
      */
     public Locale(String language, String country, String variant) {
         if (language == null || country == null || variant == null) {
@@ -766,11 +766,11 @@
      * </ul>
      *
      * @param language An ISO 639 alpha-2 or alpha-3 language code, or a language subtag
-     * up to 8 characters in length.  See the <code>Locale</code> class description about
+     * up to 8 characters in length.  See the {@code Locale} class description about
      * valid language values.
      * @param country An ISO 3166 alpha-2 country code or a UN M.49 numeric-3 area code.
-     * See the <code>Locale</code> class description about valid country values.
-     * @exception NullPointerException thrown if either argument is null.
+     * See the {@code Locale} class description about valid country values.
+     * @throws    NullPointerException thrown if either argument is null.
      */
     public Locale(String language, String country) {
         this(language, country, "");
@@ -791,9 +791,9 @@
      * </ul>
      *
      * @param language An ISO 639 alpha-2 or alpha-3 language code, or a language subtag
-     * up to 8 characters in length.  See the <code>Locale</code> class description about
+     * up to 8 characters in length.  See the {@code Locale} class description about
      * valid language values.
-     * @exception NullPointerException thrown if argument is null.
+     * @throws    NullPointerException thrown if argument is null.
      * @since 1.4
      */
     public Locale(String language) {
@@ -801,18 +801,18 @@
     }
 
     /**
-     * Returns a <code>Locale</code> constructed from the given
-     * <code>language</code>, <code>country</code> and
-     * <code>variant</code>. If the same <code>Locale</code> instance
+     * Returns a {@code Locale} constructed from the given
+     * {@code language}, {@code country} and
+     * {@code variant}. If the same {@code Locale} instance
      * is available in the cache, then that instance is
-     * returned. Otherwise, a new <code>Locale</code> instance is
+     * returned. Otherwise, a new {@code Locale} instance is
      * created and cached.
      *
      * @param language lowercase 2 to 8 language code.
      * @param country uppercase two-letter ISO-3166 code and numeric-3 UN M.49 area code.
      * @param variant vendor and browser specific code. See class description.
-     * @return the <code>Locale</code> instance requested
-     * @exception NullPointerException if any argument is null.
+     * @return the {@code Locale} instance requested
+     * @throws    NullPointerException if any argument is null.
      */
     static Locale getInstance(String language, String country, String variant) {
         return getInstance(language, "", country, variant, null);
@@ -1029,8 +1029,8 @@
      * Sets the default locale for this instance of the Java Virtual Machine.
      * This does not affect the host locale.
      * <p>
-     * If there is a security manager, its <code>checkPermission</code>
-     * method is called with a <code>PropertyPermission("user.language", "write")</code>
+     * If there is a security manager, its {@code checkPermission}
+     * method is called with a {@code PropertyPermission("user.language", "write")}
      * permission before the default locale is changed.
      * <p>
      * The Java Virtual Machine sets the default locale during startup
@@ -1047,8 +1047,8 @@
      *
      * @throws SecurityException
      *        if a security manager exists and its
-     *        <code>checkPermission</code> method doesn't allow the operation.
-     * @throws NullPointerException if <code>newLocale</code> is null
+     *        {@code checkPermission} method doesn't allow the operation.
+     * @throws NullPointerException if {@code newLocale} is null
      * @param newLocale the new default locale
      * @see SecurityManager#checkPermission
      * @see java.util.PropertyPermission
@@ -1113,7 +1113,7 @@
      * The returned array represents the union of locales supported
      * by the Java runtime environment and by installed
      * {@link java.util.spi.LocaleServiceProvider LocaleServiceProvider}
-     * implementations.  It must contain at least a <code>Locale</code>
+     * implementations.  It must contain at least a {@code Locale}
      * instance equal to {@link java.util.Locale#US Locale.US}.
      *
      * @return An array of installed locales.
@@ -1128,7 +1128,7 @@
      * This method is equivalent to {@link #getISOCountries(Locale.IsoCountryCode type)}
      * with {@code type}  {@link IsoCountryCode#PART1_ALPHA2}.
      * <p>
-     * <b>Note:</b> The <code>Locale</code> class also supports other codes for
+     * <b>Note:</b> The {@code Locale} class also supports other codes for
      * country (region), such as 3-letter numeric UN M.49 area codes.
      * Therefore, the list returned by this method does not contain ALL valid
      * codes that can be used to create Locales.
@@ -1171,7 +1171,7 @@
      * <li>ISO 639 is not a stable standard&mdash; some languages' codes have changed.
      * The list this function returns includes both the new and the old codes for the
      * languages whose codes have changed.
-     * <li>The <code>Locale</code> class also supports language codes up to
+     * <li>The {@code Locale} class also supports language codes up to
      * 8 characters in length.  Therefore, the list returned by this method does
      * not contain ALL valid codes that can be used to create Locales.
      * </ul>
@@ -1283,7 +1283,7 @@
      * Returns the extension (or private use) value associated with
      * the specified key, or null if there is no extension
      * associated with the key. To be well-formed, the key must be one
-     * of <code>[0-9A-Za-z]</code>. Keys are case-insensitive, so
+     * of {@code [0-9A-Za-z]}. Keys are case-insensitive, so
      * for example 'z' and 'Z' represent the same extension.
      *
      * @param key the extension key
@@ -1343,7 +1343,7 @@
      * @return The Unicode locale type associated with the key, or null if the
      * locale does not define the key.
      * @throws IllegalArgumentException if the key is not well-formed
-     * @throws NullPointerException if <code>key</code> is null
+     * @throws NullPointerException if {@code key} is null
      * @since 1.7
      */
     public String getUnicodeLocaleType(String key) {
@@ -1388,7 +1388,7 @@
      }
 
     /**
-     * Returns a string representation of this <code>Locale</code>
+     * Returns a string representation of this {@code Locale}
      * object, consisting of language, country, variant, script,
      * and extensions as below:
      * <blockquote>
@@ -1411,7 +1411,7 @@
      * added before the "#".
      *
      * <p>This behavior is designed to support debugging and to be compatible with
-     * previous uses of <code>toString</code> that expected language, country, and variant
+     * previous uses of {@code toString} that expected language, country, and variant
      * fields only.  To represent a Locale as a String for interchange purposes, use
      * {@link #toLanguageTag}.
      *
@@ -1467,7 +1467,7 @@
      * Returns a well-formed IETF BCP 47 language tag representing
      * this locale.
      *
-     * <p>If this <code>Locale</code> has a language, country, or
+     * <p>If this {@code Locale} has a language, country, or
      * variant that does not satisfy the IETF BCP 47 language tag
      * syntax requirements, this method handles these fields as
      * described below:
@@ -1703,12 +1703,12 @@
      * <p>For a list of all grandfathered tags, see the
      * IANA Language Subtag Registry (search for "Type: grandfathered").
      *
-     * <p><b>Note</b>: there is no guarantee that <code>toLanguageTag</code>
-     * and <code>forLanguageTag</code> will round-trip.
+     * <p><b>Note</b>: there is no guarantee that {@code toLanguageTag}
+     * and {@code forLanguageTag} will round-trip.
      *
      * @param languageTag the language tag
      * @return The locale that best represents the language tag.
-     * @throws NullPointerException if <code>languageTag</code> is <code>null</code>
+     * @throws NullPointerException if {@code languageTag} is {@code null}
      * @see #toLanguageTag()
      * @see java.util.Locale.Builder#setLanguageTag(String)
      * @since 1.7
@@ -1737,7 +1737,7 @@
      * not specify a language the empty string is returned.
      *
      * @return A three-letter abbreviation of this locale's language.
-     * @exception MissingResourceException Throws MissingResourceException if
+     * @throws    MissingResourceException Throws MissingResourceException if
      * three-letter language abbreviation is not available for this locale.
      */
     public String getISO3Language() throws MissingResourceException {
@@ -1764,7 +1764,7 @@
      * <p>The ISO 3166-1 codes can be found on-line.
      *
      * @return A three-letter abbreviation of this locale's country.
-     * @exception MissingResourceException Throws MissingResourceException if the
+     * @throws    MissingResourceException Throws MissingResourceException if the
      * three-letter country abbreviation is not available for this locale.
      */
     public String getISO3Country() throws MissingResourceException {
@@ -1834,7 +1834,7 @@
      *
      * @param inLocale The locale for which to retrieve the display language.
      * @return The name of the display language appropriate to the given locale.
-     * @exception NullPointerException if <code>inLocale</code> is <code>null</code>
+     * @throws    NullPointerException if {@code inLocale} is {@code null}
      */
     public String getDisplayLanguage(Locale inLocale) {
         return getDisplayString(baseLocale.getLanguage(), null, inLocale, DISPLAY_LANGUAGE);
@@ -1863,7 +1863,7 @@
      * @param inLocale The locale for which to retrieve the display script.
      * @return the display name of the script code for the current default
      * {@link Locale.Category#DISPLAY DISPLAY} locale
-     * @throws NullPointerException if <code>inLocale</code> is <code>null</code>
+     * @throws NullPointerException if {@code inLocale} is {@code null}
      * @since 1.7
      */
     public String getDisplayScript(Locale inLocale) {
@@ -1907,7 +1907,7 @@
      *
      * @param inLocale The locale for which to retrieve the display country.
      * @return The name of the country appropriate to the given locale.
-     * @exception NullPointerException if <code>inLocale</code> is <code>null</code>
+     * @throws    NullPointerException if {@code inLocale} is {@code null}
      */
     public String getDisplayCountry(Locale inLocale) {
         return getDisplayString(baseLocale.getRegion(), null, inLocale, DISPLAY_COUNTRY);
@@ -1949,7 +1949,7 @@
      *
      * @param inLocale The locale for which to retrieve the display variant code.
      * @return The name of the display variant code appropriate to the given locale.
-     * @exception NullPointerException if <code>inLocale</code> is <code>null</code>
+     * @throws    NullPointerException if {@code inLocale} is {@code null}
      */
     public String getDisplayVariant(Locale inLocale) {
         if (baseLocale.getVariant().isEmpty())
@@ -2014,7 +2014,7 @@
      *
      * @param inLocale The locale for which to retrieve the display name.
      * @return The name of the locale appropriate to display.
-     * @throws NullPointerException if <code>inLocale</code> is <code>null</code>
+     * @throws NullPointerException if {@code inLocale} is {@code null}
      */
     public String getDisplayName(Locale inLocale) {
         LocaleResources lr =  LocaleProviderAdapter
@@ -2313,8 +2313,8 @@
     };
 
     /**
-     * Serializes this <code>Locale</code> to the specified <code>ObjectOutputStream</code>.
-     * @param out the <code>ObjectOutputStream</code> to write
+     * Serializes this {@code Locale} to the specified {@code ObjectOutputStream}.
+     * @param out the {@code ObjectOutputStream} to write
      * @throws IOException
      * @since 1.7
      */
@@ -2331,8 +2331,8 @@
     }
 
     /**
-     * Deserializes this <code>Locale</code>.
-     * @param in the <code>ObjectInputStream</code> to read
+     * Deserializes this {@code Locale}.
+     * @param in the {@code ObjectInputStream} to read
      * @throws IOException
      * @throws ClassNotFoundException
      * @throws IllformedLocaleException
@@ -2362,17 +2362,17 @@
     }
 
     /**
-     * Returns a cached <code>Locale</code> instance equivalent to
-     * the deserialized <code>Locale</code>. When serialized
+     * Returns a cached {@code Locale} instance equivalent to
+     * the deserialized {@code Locale}. When serialized
      * language, country and variant fields read from the object data stream
      * are exactly "ja", "JP", "JP" or "th", "TH", "TH" and script/extensions
-     * fields are empty, this method supplies <code>UNICODE_LOCALE_EXTENSION</code>
+     * fields are empty, this method supplies {@code UNICODE_LOCALE_EXTENSION}
      * "ca"/"japanese" (calendar type is "japanese") or "nu"/"thai" (number script
      * type is "thai"). See <a href="Locale.html#special_cases_constructor">Special Cases</a>
      * for more information.
      *
-     * @return an instance of <code>Locale</code> equivalent to
-     * the deserialized <code>Locale</code>.
+     * @return an instance of {@code Locale} equivalent to
+     * the deserialized {@code Locale}.
      * @throws java.io.ObjectStreamException
      */
     @java.io.Serial
@@ -2509,33 +2509,33 @@
     }
 
     /**
-     * <code>Builder</code> is used to build instances of <code>Locale</code>
-     * from values configured by the setters.  Unlike the <code>Locale</code>
-     * constructors, the <code>Builder</code> checks if a value configured by a
-     * setter satisfies the syntax requirements defined by the <code>Locale</code>
-     * class.  A <code>Locale</code> object created by a <code>Builder</code> is
+     * {@code Builder} is used to build instances of {@code Locale}
+     * from values configured by the setters.  Unlike the {@code Locale}
+     * constructors, the {@code Builder} checks if a value configured by a
+     * setter satisfies the syntax requirements defined by the {@code Locale}
+     * class.  A {@code Locale} object created by a {@code Builder} is
      * well-formed and can be transformed to a well-formed IETF BCP 47 language tag
      * without losing information.
      *
-     * <p><b>Note:</b> The <code>Locale</code> class does not provide any
+     * <p><b>Note:</b> The {@code Locale} class does not provide any
      * syntactic restrictions on variant, while BCP 47 requires each variant
      * subtag to be 5 to 8 alphanumerics or a single numeric followed by 3
-     * alphanumerics.  The method <code>setVariant</code> throws
-     * <code>IllformedLocaleException</code> for a variant that does not satisfy
+     * alphanumerics.  The method {@code setVariant} throws
+     * {@code IllformedLocaleException} for a variant that does not satisfy
      * this restriction. If it is necessary to support such a variant, use a
-     * Locale constructor.  However, keep in mind that a <code>Locale</code>
+     * Locale constructor.  However, keep in mind that a {@code Locale}
      * object created this way might lose the variant information when
      * transformed to a BCP 47 language tag.
      *
-     * <p>The following example shows how to create a <code>Locale</code> object
-     * with the <code>Builder</code>.
+     * <p>The following example shows how to create a {@code Locale} object
+     * with the {@code Builder}.
      * <blockquote>
      * <pre>
      *     Locale aLocale = new Builder().setLanguage("sr").setScript("Latn").setRegion("RS").build();
      * </pre>
      * </blockquote>
      *
-     * <p>Builders can be reused; <code>clear()</code> resets all
+     * <p>Builders can be reused; {@code clear()} resets all
      * fields to their default values.
      *
      * @see Locale#forLanguageTag
@@ -2554,13 +2554,13 @@
         }
 
         /**
-         * Resets the <code>Builder</code> to match the provided
-         * <code>locale</code>.  Existing state is discarded.
+         * Resets the {@code Builder} to match the provided
+         * {@code locale}.  Existing state is discarded.
          *
          * <p>All fields of the locale must be well-formed, see {@link Locale}.
          *
          * <p>Locales with any ill-formed fields cause
-         * <code>IllformedLocaleException</code> to be thrown, except for the
+         * {@code IllformedLocaleException} to be thrown, except for the
          * following three cases which are accepted for compatibility
          * reasons:<ul>
          * <li>Locale("ja", "JP", "JP") is treated as "ja-JP-u-ca-japanese"
@@ -2569,9 +2569,9 @@
          *
          * @param locale the locale
          * @return This builder.
-         * @throws IllformedLocaleException if <code>locale</code> has
+         * @throws IllformedLocaleException if {@code locale} has
          * any ill-formed fields.
-         * @throws NullPointerException if <code>locale</code> is null.
+         * @throws NullPointerException if {@code locale} is null.
          */
         public Builder setLocale(Locale locale) {
             try {
@@ -2590,13 +2590,13 @@
          * Locale#forLanguageTag}) are converted to their canonical
          * form before being processed.  Otherwise, the language tag
          * must be well-formed (see {@link Locale}) or an exception is
-         * thrown (unlike <code>Locale.forLanguageTag</code>, which
+         * thrown (unlike {@code Locale.forLanguageTag}, which
          * just discards ill-formed and following portions of the
          * tag).
          *
          * @param languageTag the language tag
          * @return This builder.
-         * @throws IllformedLocaleException if <code>languageTag</code> is ill-formed
+         * @throws IllformedLocaleException if {@code languageTag} is ill-formed
          * @see Locale#forLanguageTag(String)
          */
         public Builder setLanguageTag(String languageTag) {
@@ -2610,8 +2610,8 @@
         }
 
         /**
-         * Sets the language.  If <code>language</code> is the empty string or
-         * null, the language in this <code>Builder</code> is removed.  Otherwise,
+         * Sets the language.  If {@code language} is the empty string or
+         * null, the language in this {@code Builder} is removed.  Otherwise,
          * the language must be <a href="./Locale.html#def_language">well-formed</a>
          * or an exception is thrown.
          *
@@ -2620,7 +2620,7 @@
          *
          * @param language the language
          * @return This builder.
-         * @throws IllformedLocaleException if <code>language</code> is ill-formed
+         * @throws IllformedLocaleException if {@code language} is ill-formed
          */
         public Builder setLanguage(String language) {
             try {
@@ -2632,8 +2632,8 @@
         }
 
         /**
-         * Sets the script. If <code>script</code> is null or the empty string,
-         * the script in this <code>Builder</code> is removed.
+         * Sets the script. If {@code script} is null or the empty string,
+         * the script in this {@code Builder} is removed.
          * Otherwise, the script must be <a href="./Locale.html#def_script">well-formed</a> or an
          * exception is thrown.
          *
@@ -2641,7 +2641,7 @@
          *
          * @param script the script
          * @return This builder.
-         * @throws IllformedLocaleException if <code>script</code> is ill-formed
+         * @throws IllformedLocaleException if {@code script} is ill-formed
          */
         public Builder setScript(String script) {
             try {
@@ -2654,19 +2654,19 @@
 
         /**
          * Sets the region.  If region is null or the empty string, the region
-         * in this <code>Builder</code> is removed.  Otherwise,
+         * in this {@code Builder} is removed.  Otherwise,
          * the region must be <a href="./Locale.html#def_region">well-formed</a> or an
          * exception is thrown.
          *
          * <p>The typical region value is a two-letter ISO 3166 code or a
          * three-digit UN M.49 area code.
          *
-         * <p>The country value in the <code>Locale</code> created by the
-         * <code>Builder</code> is always normalized to upper case.
+         * <p>The country value in the {@code Locale} created by the
+         * {@code Builder} is always normalized to upper case.
          *
          * @param region the region
          * @return This builder.
-         * @throws IllformedLocaleException if <code>region</code> is ill-formed
+         * @throws IllformedLocaleException if {@code region} is ill-formed
          */
         public Builder setRegion(String region) {
             try {
@@ -2679,21 +2679,21 @@
 
         /**
          * Sets the variant.  If variant is null or the empty string, the
-         * variant in this <code>Builder</code> is removed.  Otherwise, it
+         * variant in this {@code Builder} is removed.  Otherwise, it
          * must consist of one or more <a href="./Locale.html#def_variant">well-formed</a>
          * subtags, or an exception is thrown.
          *
-         * <p><b>Note:</b> This method checks if <code>variant</code>
+         * <p><b>Note:</b> This method checks if {@code variant}
          * satisfies the IETF BCP 47 variant subtag's syntax requirements,
          * and normalizes the value to lowercase letters.  However,
-         * the <code>Locale</code> class does not impose any syntactic
+         * the {@code Locale} class does not impose any syntactic
          * restriction on variant, and the variant value in
-         * <code>Locale</code> is case sensitive.  To set such a variant,
+         * {@code Locale} is case sensitive.  To set such a variant,
          * use a Locale constructor.
          *
          * @param variant the variant
          * @return This builder.
-         * @throws IllformedLocaleException if <code>variant</code> is ill-formed
+         * @throws IllformedLocaleException if {@code variant} is ill-formed
          */
         public Builder setVariant(String variant) {
             try {
@@ -2723,8 +2723,8 @@
          * @param key the extension key
          * @param value the extension value
          * @return This builder.
-         * @throws IllformedLocaleException if <code>key</code> is illegal
-         * or <code>value</code> is ill-formed
+         * @throws IllformedLocaleException if {@code key} is illegal
+         * or {@code value} is ill-formed
          * @see #setUnicodeLocaleKeyword(String, String)
          */
         public Builder setExtension(char key, String value) {
@@ -2752,9 +2752,9 @@
          * @param key the Unicode locale key
          * @param type the Unicode locale type
          * @return This builder.
-         * @throws IllformedLocaleException if <code>key</code> or <code>type</code>
+         * @throws IllformedLocaleException if {@code key} or {@code type}
          * is ill-formed
-         * @throws NullPointerException if <code>key</code> is null
+         * @throws NullPointerException if {@code key} is null
          * @see #setExtension(char, String)
          */
         public Builder setUnicodeLocaleKeyword(String key, String type) {
@@ -2774,8 +2774,8 @@
          *
          * @param attribute the attribute
          * @return This builder.
-         * @throws NullPointerException if <code>attribute</code> is null
-         * @throws IllformedLocaleException if <code>attribute</code> is ill-formed
+         * @throws NullPointerException if {@code attribute} is null
+         * @throws IllformedLocaleException if {@code attribute} is ill-formed
          * @see #setExtension(char, String)
          */
         public Builder addUnicodeLocaleAttribute(String attribute) {
@@ -2797,8 +2797,8 @@
          *
          * @param attribute the attribute
          * @return This builder.
-         * @throws NullPointerException if <code>attribute</code> is null
-         * @throws IllformedLocaleException if <code>attribute</code> is ill-formed
+         * @throws NullPointerException if {@code attribute} is null
+         * @throws IllformedLocaleException if {@code attribute} is ill-formed
          * @see #setExtension(char, String)
          */
         public Builder removeUnicodeLocaleAttribute(String attribute) {
@@ -2834,7 +2834,7 @@
         }
 
         /**
-         * Returns an instance of <code>Locale</code> created from the fields set
+         * Returns an instance of {@code Locale} created from the fields set
          * on this builder.
          *
          * <p>This applies the conversions listed in {@link Locale#forLanguageTag}
@@ -3482,7 +3482,7 @@
      * @param priorityList user's Language Priority List in which each language
      *     tag is sorted in descending order based on priority or weight
      * @param locales {@code Locale} instances used for matching
-     * @return the best matching <code>Locale</code> instance chosen based on
+     * @return the best matching {@code Locale} instance chosen based on
      *     priority or weight, or {@code null} if nothing matches.
      * @throws NullPointerException if {@code priorityList} or {@code tags} is
      *     {@code null}
--- a/src/java.base/share/classes/java/util/Properties.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/Properties.java	Tue Sep 24 15:19:35 2019 -0400
@@ -394,7 +394,7 @@
      * The specified stream remains open after this method returns.
      *
      * @param      inStream   the input stream.
-     * @exception  IOException  if an error occurred when reading from the
+     * @throws     IOException  if an error occurred when reading from the
      *             input stream.
      * @throws     IllegalArgumentException if the input stream contains a
      *             malformed Unicode escape sequence.
@@ -801,7 +801,7 @@
      *
      * @param   out      an output stream.
      * @param   comments   a description of the property list.
-     * @exception  ClassCastException  if this {@code Properties} object
+     * @throws     ClassCastException  if this {@code Properties} object
      *             contains any keys or values that are not
      *             {@code Strings}.
      */
@@ -853,11 +853,11 @@
      *
      * @param   writer      an output character stream writer.
      * @param   comments   a description of the property list.
-     * @exception  IOException if writing this property list to the specified
+     * @throws     IOException if writing this property list to the specified
      *             output stream throws an {@code IOException}.
-     * @exception  ClassCastException  if this {@code Properties} object
+     * @throws     ClassCastException  if this {@code Properties} object
      *             contains any keys or values that are not {@code Strings}.
-     * @exception  NullPointerException  if {@code writer} is null.
+     * @throws     NullPointerException  if {@code writer} is null.
      * @since 1.6
      */
     public void store(Writer writer, String comments)
@@ -900,11 +900,11 @@
      *
      * @param   out      an output stream.
      * @param   comments   a description of the property list.
-     * @exception  IOException if writing this property list to the specified
+     * @throws     IOException if writing this property list to the specified
      *             output stream throws an {@code IOException}.
-     * @exception  ClassCastException  if this {@code Properties} object
+     * @throws     ClassCastException  if this {@code Properties} object
      *             contains any keys or values that are not {@code Strings}.
-     * @exception  NullPointerException  if {@code out} is null.
+     * @throws     NullPointerException  if {@code out} is null.
      * @since 1.2
      */
     public void store(OutputStream out, String comments)
--- a/src/java.base/share/classes/java/util/PropertyPermission.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/PropertyPermission.java	Tue Sep 24 15:19:35 2019 -0400
@@ -54,10 +54,10 @@
  *
  * <DL>
  *    <DT> read
- *    <DD> read permission. Allows <code>System.getProperty</code> to
+ *    <DD> read permission. Allows {@code System.getProperty} to
  *         be called.
  *    <DT> write
- *    <DD> write permission. Allows <code>System.setProperty</code> to
+ *    <DD> write permission. Allows {@code System.setProperty} to
  *         be called.
  * </DL>
  * <P>
@@ -149,9 +149,9 @@
      * @param name the name of the PropertyPermission.
      * @param actions the actions string.
      *
-     * @throws NullPointerException if <code>name</code> is <code>null</code>.
-     * @throws IllegalArgumentException if <code>name</code> is empty or if
-     * <code>actions</code> is invalid.
+     * @throws NullPointerException if {@code name} is {@code null}.
+     * @throws IllegalArgumentException if {@code name} is empty or if
+     * {@code actions} is invalid.
      */
     public PropertyPermission(String name, String actions) {
         super(name,actions);
@@ -223,7 +223,7 @@
     /**
      * Returns the hash code value for this object.
      * The hash code used is the hash code of this permissions name, that is,
-     * <code>getName().hashCode()</code>, where <code>getName</code> is
+     * {@code getName().hashCode()}, where {@code getName} is
      * from the Permission superclass.
      *
      * @return a hash code value for this object.
@@ -350,7 +350,7 @@
      * Returns the "canonical string representation" of the actions.
      * That is, this method always returns present actions in the following order:
      * read, write. For example, if this PropertyPermission object
-     * allows both write and read actions, a call to <code>getActions</code>
+     * allows both write and read actions, a call to {@code getActions}
      * will return the string "read,write".
      *
      * @return the canonical string representation of the actions.
@@ -463,10 +463,10 @@
      *
      * @param permission the Permission object to add.
      *
-     * @exception IllegalArgumentException - if the permission is not a
+     * @throws    IllegalArgumentException - if the permission is not a
      *                                       PropertyPermission
      *
-     * @exception SecurityException - if this PropertyPermissionCollection
+     * @throws    SecurityException - if this PropertyPermissionCollection
      *                                object has been marked readonly
      */
     @Override
--- a/src/java.base/share/classes/java/util/PropertyResourceBundle.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/PropertyResourceBundle.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,18 +51,18 @@
 import sun.util.ResourceBundleEnumeration;
 
 /**
- * <code>PropertyResourceBundle</code> is a concrete subclass of
- * <code>ResourceBundle</code> that manages resources for a locale
+ * {@code PropertyResourceBundle} is a concrete subclass of
+ * {@code ResourceBundle} that manages resources for a locale
  * using a set of static strings from a property file. See
  * {@link ResourceBundle ResourceBundle} for more information about resource
  * bundles.
  *
  * <p>
  * Unlike other types of resource bundle, you don't subclass
- * <code>PropertyResourceBundle</code>.  Instead, you supply properties
- * files containing the resource data.  <code>ResourceBundle.getBundle</code>
+ * {@code PropertyResourceBundle}.  Instead, you supply properties
+ * files containing the resource data.  {@code ResourceBundle.getBundle}
  * will automatically look for the appropriate properties file and create a
- * <code>PropertyResourceBundle</code> that refers to it. See
+ * {@code PropertyResourceBundle} that refers to it. See
  * {@link ResourceBundle#getBundle(String, Locale, ClassLoader) ResourceBundle.getBundle}
  * for a complete description of the search and instantiation strategy.
  *
@@ -71,11 +71,11 @@
  * bundle family with the base name "MyResources".
  * The text defines the bundle "MyResources_de",
  * the German member of the bundle family.
- * This member is based on <code>PropertyResourceBundle</code>, and the text
+ * This member is based on {@code PropertyResourceBundle}, and the text
  * therefore is the content of the file "MyResources_de.properties"
  * (a related <a href="ListResourceBundle.html#sample">example</a> shows
  * how you can add bundles to this family that are implemented as subclasses
- * of <code>ListResourceBundle</code>).
+ * of {@code ListResourceBundle}).
  * The keys in this example are of the form "s1" etc. The actual
  * keys are entirely up to your choice, so long as they are the same as
  * the keys you use in your program to retrieve the objects from the bundle.
@@ -162,7 +162,7 @@
      * @param stream an InputStream that represents a property file
      *        to read from.
      * @throws IOException if an I/O error occurs
-     * @throws NullPointerException if <code>stream</code> is null
+     * @throws NullPointerException if {@code stream} is null
      * @throws IllegalArgumentException if {@code stream} contains a
      *     malformed Unicode escape sequence.
      * @throws MalformedInputException if the system property
@@ -189,7 +189,7 @@
      * @param reader a Reader that represents a property file to
      *        read from.
      * @throws IOException if an I/O error occurs
-     * @throws NullPointerException if <code>reader</code> is null
+     * @throws NullPointerException if {@code reader} is null
      * @throws IllegalArgumentException if a malformed Unicode escape sequence appears
      *     from {@code reader}.
      * @since 1.6
@@ -210,11 +210,11 @@
     }
 
     /**
-     * Returns an <code>Enumeration</code> of the keys contained in
-     * this <code>ResourceBundle</code> and its parent bundles.
+     * Returns an {@code Enumeration} of the keys contained in
+     * this {@code ResourceBundle} and its parent bundles.
      *
-     * @return an <code>Enumeration</code> of the keys contained in
-     *         this <code>ResourceBundle</code> and its parent bundles.
+     * @return an {@code Enumeration} of the keys contained in
+     *         this {@code ResourceBundle} and its parent bundles.
      * @see #keySet()
      */
     public Enumeration<String> getKeys() {
@@ -224,11 +224,11 @@
     }
 
     /**
-     * Returns a <code>Set</code> of the keys contained
-     * <em>only</em> in this <code>ResourceBundle</code>.
+     * Returns a {@code Set} of the keys contained
+     * <em>only</em> in this {@code ResourceBundle}.
      *
-     * @return a <code>Set</code> of the keys contained only in this
-     *         <code>ResourceBundle</code>
+     * @return a {@code Set} of the keys contained only in this
+     *         {@code ResourceBundle}
      * @since 1.6
      * @see #keySet()
      */
--- a/src/java.base/share/classes/java/util/ResourceBundle.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/ResourceBundle.java	Tue Sep 24 15:19:35 2019 -0400
@@ -79,7 +79,7 @@
 /**
  *
  * Resource bundles contain locale-specific objects.  When your program needs a
- * locale-specific resource, a <code>String</code> for example, your program can
+ * locale-specific resource, a {@code String} for example, your program can
  * load it from the resource bundle that is appropriate for the current user's
  * locale. In this way, you can write program code that is largely independent
  * of the user's locale isolating most, if not all, of the locale-specific
@@ -108,8 +108,8 @@
  * Each resource bundle in a family contains the same items, but the items have
  * been translated for the locale represented by that resource bundle.
  * For example, both "MyResources" and "MyResources_de" may have a
- * <code>String</code> that's used on a button for canceling operations.
- * In "MyResources" the <code>String</code> may contain "Cancel" and in
+ * {@code String} that's used on a button for canceling operations.
+ * In "MyResources" the {@code String} may contain "Cancel" and in
  * "MyResources_de" it may contain "Abbrechen".
  *
  * <P>
@@ -121,7 +121,7 @@
  *
  * <P>
  * When your program needs a locale-specific object, it loads
- * the <code>ResourceBundle</code> class using the
+ * the {@code ResourceBundle} class using the
  * {@link #getBundle(java.lang.String, java.util.Locale) getBundle}
  * method:
  * <blockquote>
@@ -134,7 +134,7 @@
  * <P>
  * Resource bundles contain key/value pairs. The keys uniquely
  * identify a locale-specific object in the bundle. Here's an
- * example of a <code>ListResourceBundle</code> that contains
+ * example of a {@code ListResourceBundle} that contains
  * two key/value pairs:
  * <blockquote>
  * <pre>
@@ -150,16 +150,16 @@
  * }
  * </pre>
  * </blockquote>
- * Keys are always <code>String</code>s.
+ * Keys are always {@code String}s.
  * In this example, the keys are "OkKey" and "CancelKey".
  * In the above example, the values
- * are also <code>String</code>s--"OK" and "Cancel"--but
+ * are also {@code String}s--"OK" and "Cancel"--but
  * they don't have to be. The values can be any type of object.
  *
  * <P>
  * You retrieve an object from resource bundle using the appropriate
  * getter method. Because "OkKey" and "CancelKey"
- * are both strings, you would use <code>getString</code> to retrieve them:
+ * are both strings, you would use {@code getString} to retrieve them:
  * <blockquote>
  * <pre>
  * button1 = new Button(myResources.getString("OkKey"));
@@ -168,13 +168,13 @@
  * </blockquote>
  * The getter methods all require the key as an argument and return
  * the object if found. If the object is not found, the getter method
- * throws a <code>MissingResourceException</code>.
+ * throws a {@code MissingResourceException}.
  *
  * <P>
- * Besides <code>getString</code>, <code>ResourceBundle</code> also provides
- * a method for getting string arrays, <code>getStringArray</code>,
- * as well as a generic <code>getObject</code> method for any other
- * type of object. When using <code>getObject</code>, you'll
+ * Besides {@code getString}, {@code ResourceBundle} also provides
+ * a method for getting string arrays, {@code getStringArray},
+ * as well as a generic {@code getObject} method for any other
+ * type of object. When using {@code getObject}, you'll
  * have to cast the result to the appropriate type. For example:
  * <blockquote>
  * <pre>
@@ -183,19 +183,19 @@
  * </blockquote>
  *
  * <P>
- * The Java Platform provides two subclasses of <code>ResourceBundle</code>,
- * <code>ListResourceBundle</code> and <code>PropertyResourceBundle</code>,
+ * The Java Platform provides two subclasses of {@code ResourceBundle},
+ * {@code ListResourceBundle} and {@code PropertyResourceBundle},
  * that provide a fairly simple way to create resources.
- * As you saw briefly in a previous example, <code>ListResourceBundle</code>
+ * As you saw briefly in a previous example, {@code ListResourceBundle}
  * manages its resource as a list of key/value pairs.
- * <code>PropertyResourceBundle</code> uses a properties file to manage
+ * {@code PropertyResourceBundle} uses a properties file to manage
  * its resources.
  *
  * <p>
- * If <code>ListResourceBundle</code> or <code>PropertyResourceBundle</code>
- * do not suit your needs, you can write your own <code>ResourceBundle</code>
- * subclass.  Your subclasses must override two methods: <code>handleGetObject</code>
- * and <code>getKeys()</code>.
+ * If {@code ListResourceBundle} or {@code PropertyResourceBundle}
+ * do not suit your needs, you can write your own {@code ResourceBundle}
+ * subclass.  Your subclasses must override two methods: {@code handleGetObject}
+ * and {@code getKeys()}.
  *
  * <p>
  * The implementation of a {@code ResourceBundle} subclass must be thread-safe
@@ -272,8 +272,8 @@
  * <h3>ResourceBundle.Control</h3>
  *
  * The {@link ResourceBundle.Control} class provides information necessary
- * to perform the bundle loading process by the <code>getBundle</code>
- * factory methods that take a <code>ResourceBundle.Control</code>
+ * to perform the bundle loading process by the {@code getBundle}
+ * factory methods that take a {@code ResourceBundle.Control}
  * instance. You can implement your own subclass in order to enable
  * non-standard resource bundle formats, change the search strategy, or
  * define caching parameters. Refer to the descriptions of the class and the
@@ -302,14 +302,14 @@
  *
  * <h2>Cache Management</h2>
  *
- * Resource bundle instances created by the <code>getBundle</code> factory
+ * Resource bundle instances created by the {@code getBundle} factory
  * methods are cached by default, and the factory methods return the same
  * resource bundle instance multiple times if it has been
- * cached. <code>getBundle</code> clients may clear the cache, manage the
+ * cached. {@code getBundle} clients may clear the cache, manage the
  * lifetime of cached resource bundle instances using time-to-live values,
  * or specify not to cache resource bundle instances. Refer to the
  * descriptions of the {@linkplain #getBundle(String, Locale, ClassLoader,
- * Control) <code>getBundle</code> factory method}, {@link
+ * Control) {@code getBundle} factory method}, {@link
  * #clearCache(ClassLoader) clearCache}, {@link
  * Control#getTimeToLive(String, Locale)
  * ResourceBundle.Control.getTimeToLive}, and {@link
@@ -318,11 +318,11 @@
  *
  * <h2>Example</h2>
  *
- * The following is a very simple example of a <code>ResourceBundle</code>
- * subclass, <code>MyResources</code>, that manages two resources (for a larger number of
- * resources you would probably use a <code>Map</code>).
+ * The following is a very simple example of a {@code ResourceBundle}
+ * subclass, {@code MyResources}, that manages two resources (for a larger number of
+ * resources you would probably use a {@code Map}).
  * Notice that you don't need to supply a value if
- * a "parent-level" <code>ResourceBundle</code> handles the same
+ * a "parent-level" {@code ResourceBundle} handles the same
  * key with the same value (as for the okKey below).
  * <blockquote>
  * <pre>
@@ -360,11 +360,11 @@
  * </pre>
  * </blockquote>
  * You do not have to restrict yourself to using a single family of
- * <code>ResourceBundle</code>s. For example, you could have a set of bundles for
- * exception messages, <code>ExceptionResources</code>
- * (<code>ExceptionResources_fr</code>, <code>ExceptionResources_de</code>, ...),
- * and one for widgets, <code>WidgetResource</code> (<code>WidgetResources_fr</code>,
- * <code>WidgetResources_de</code>, ...); breaking up the resources however you like.
+ * {@code ResourceBundle}s. For example, you could have a set of bundles for
+ * exception messages, {@code ExceptionResources}
+ * ({@code ExceptionResources_fr}, {@code ExceptionResources_de}, ...),
+ * and one for widgets, {@code WidgetResource} ({@code WidgetResources_fr},
+ * {@code WidgetResources_de}, ...); breaking up the resources however you like.
  *
  * @see ListResourceBundle
  * @see PropertyResourceBundle
@@ -512,9 +512,9 @@
      * </blockquote>
      *
      * @param key the key for the desired string
-     * @exception NullPointerException if <code>key</code> is <code>null</code>
-     * @exception MissingResourceException if no object for the given key can be found
-     * @exception ClassCastException if the object found for the given key is not a string
+     * @throws    NullPointerException if {@code key} is {@code null}
+     * @throws    MissingResourceException if no object for the given key can be found
+     * @throws    ClassCastException if the object found for the given key is not a string
      * @return the string for the given key
      */
     public final String getString(String key) {
@@ -529,9 +529,9 @@
      * </blockquote>
      *
      * @param key the key for the desired string array
-     * @exception NullPointerException if <code>key</code> is <code>null</code>
-     * @exception MissingResourceException if no object for the given key can be found
-     * @exception ClassCastException if the object found for the given key is not a string array
+     * @throws    NullPointerException if {@code key} is {@code null}
+     * @throws    MissingResourceException if no object for the given key can be found
+     * @throws    ClassCastException if the object found for the given key is not a string array
      * @return the string array for the given key
      */
     public final String[] getStringArray(String key) {
@@ -543,12 +543,12 @@
      * This method first tries to obtain the object from this resource bundle using
      * {@link #handleGetObject(java.lang.String) handleGetObject}.
      * If not successful, and the parent resource bundle is not null,
-     * it calls the parent's <code>getObject</code> method.
+     * it calls the parent's {@code getObject} method.
      * If still not successful, it throws a MissingResourceException.
      *
      * @param key the key for the desired object
-     * @exception NullPointerException if <code>key</code> is <code>null</code>
-     * @exception MissingResourceException if no object for the given key can be found
+     * @throws    NullPointerException if {@code key} is {@code null}
+     * @throws    MissingResourceException if no object for the given key can be found
      * @return the object for the given key
      */
     public final Object getObject(String key) {
@@ -837,13 +837,13 @@
      * Gets a resource bundle using the specified base name, the default locale,
      * and the caller module. Calling this method is equivalent to calling
      * <blockquote>
-     * <code>getBundle(baseName, Locale.getDefault(), callerModule)</code>,
+     * {@code getBundle(baseName, Locale.getDefault(), callerModule)},
      * </blockquote>
      *
      * @param baseName the base name of the resource bundle, a fully qualified class name
-     * @exception java.lang.NullPointerException
-     *     if <code>baseName</code> is <code>null</code>
-     * @exception MissingResourceException
+     * @throws    java.lang.NullPointerException
+     *     if {@code baseName} is {@code null}
+     * @throws    MissingResourceException
      *     if no resource bundle for the specified base name can be found
      * @return a resource bundle for the given base name and the default locale
      *
@@ -866,11 +866,11 @@
      * getBundle(baseName, Locale.getDefault(),
      *           this.getClass().getClassLoader(), control),
      * </pre>
-     * except that <code>getClassLoader()</code> is run with the security
-     * privileges of <code>ResourceBundle</code>.  See {@link
+     * except that {@code getClassLoader()} is run with the security
+     * privileges of {@code ResourceBundle}.  See {@link
      * #getBundle(String, Locale, ClassLoader, Control) getBundle} for the
      * complete description of the resource bundle loading process with a
-     * <code>ResourceBundle.Control</code>.
+     * {@code ResourceBundle.Control}.
      *
      * @param baseName
      *        the base name of the resource bundle, a fully qualified class
@@ -880,14 +880,14 @@
      *        loading process
      * @return a resource bundle for the given base name and the default locale
      * @throws NullPointerException
-     *         if <code>baseName</code> or <code>control</code> is
-     *         <code>null</code>
+     *         if {@code baseName} or {@code control} is
+     *         {@code null}
      * @throws MissingResourceException
      *         if no resource bundle for the specified base name can be found
      * @throws IllegalArgumentException
-     *         if the given <code>control</code> doesn't perform properly
-     *         (e.g., <code>control.getCandidateLocales</code> returns null.)
-     *         Note that validation of <code>control</code> is performed as
+     *         if the given {@code control} doesn't perform properly
+     *         (e.g., {@code control.getCandidateLocales} returns null.)
+     *         Note that validation of {@code control} is performed as
      *         needed.
      * @throws UnsupportedOperationException
      *         if this method is called in a named module
@@ -908,16 +908,16 @@
      * Gets a resource bundle using the specified base name and locale,
      * and the caller module. Calling this method is equivalent to calling
      * <blockquote>
-     * <code>getBundle(baseName, locale, callerModule)</code>,
+     * {@code getBundle(baseName, locale, callerModule)},
      * </blockquote>
      *
      * @param baseName
      *        the base name of the resource bundle, a fully qualified class name
      * @param locale
      *        the locale for which a resource bundle is desired
-     * @exception NullPointerException
-     *        if <code>baseName</code> or <code>locale</code> is <code>null</code>
-     * @exception MissingResourceException
+     * @throws    NullPointerException
+     *        if {@code baseName} or {@code locale} is {@code null}
+     * @throws    MissingResourceException
      *        if no resource bundle for the specified base name can be found
      * @return a resource bundle for the given base name and locale
      *
@@ -937,7 +937,7 @@
      * Gets a resource bundle using the specified base name and the default locale
      * on behalf of the specified module. This method is equivalent to calling
      * <blockquote>
-     * <code>getBundle(baseName, Locale.getDefault(), module)</code>
+     * {@code getBundle(baseName, Locale.getDefault(), module)}
      * </blockquote>
      *
      * @param baseName the base name of the resource bundle,
@@ -1025,11 +1025,11 @@
      * getBundle(baseName, targetLocale, this.getClass().getClassLoader(),
      *           control),
      * </pre>
-     * except that <code>getClassLoader()</code> is run with the security
-     * privileges of <code>ResourceBundle</code>.  See {@link
+     * except that {@code getClassLoader()} is run with the security
+     * privileges of {@code ResourceBundle}.  See {@link
      * #getBundle(String, Locale, ClassLoader, Control) getBundle} for the
      * complete description of the resource bundle loading process with a
-     * <code>ResourceBundle.Control</code>.
+     * {@code ResourceBundle.Control}.
      *
      * @param baseName
      *        the base name of the resource bundle, a fully qualified
@@ -1040,17 +1040,17 @@
      *        the control which gives information for the resource
      *        bundle loading process
      * @return a resource bundle for the given base name and a
-     *         <code>Locale</code> in <code>locales</code>
+     *         {@code Locale} in {@code locales}
      * @throws NullPointerException
-     *         if <code>baseName</code>, <code>locales</code> or
-     *         <code>control</code> is <code>null</code>
+     *         if {@code baseName}, {@code locales} or
+     *         {@code control} is {@code null}
      * @throws MissingResourceException
      *         if no resource bundle for the specified base name in any
-     *         of the <code>locales</code> can be found.
+     *         of the {@code locales} can be found.
      * @throws IllegalArgumentException
-     *         if the given <code>control</code> doesn't perform properly
-     *         (e.g., <code>control.getCandidateLocales</code> returns null.)
-     *         Note that validation of <code>control</code> is performed as
+     *         if the given {@code control} doesn't perform properly
+     *         (e.g., {@code control.getCandidateLocales} returns null.)
+     *         Note that validation of {@code control} is performed as
      *         needed.
      * @throws UnsupportedOperationException
      *         if this method is called in a named module
@@ -1090,7 +1090,7 @@
      * <p>
      * <b><a id="default_behavior">Resource Bundle Search and Loading Strategy</a></b>
      *
-     * <p><code>getBundle</code> uses the base name, the specified locale, and
+     * <p>{@code getBundle} uses the base name, the specified locale, and
      * the default locale (obtained from {@link java.util.Locale#getDefault()
      * Locale.getDefault}) to generate a sequence of <a
      * id="candidates"><em>candidate bundle names</em></a>.  If the specified
@@ -1140,13 +1140,13 @@
      * MyResource_en
      * </pre>
      *
-     * <blockquote><b>Note:</b> For some <code>Locale</code>s, the list of
+     * <blockquote><b>Note:</b> For some {@code Locale}s, the list of
      * candidate bundle names contains extra names, or the order of bundle names
      * is slightly modified.  See the description of the default implementation
      * of {@link Control#getCandidateLocales(String, Locale)
      * getCandidateLocales} for details.</blockquote>
      *
-     * <p><code>getBundle</code> then iterates over the candidate bundle names
+     * <p>{@code getBundle} then iterates over the candidate bundle names
      * to find the first one for which it can <em>instantiate</em> an actual
      * resource bundle. It uses the default controls' {@link Control#getFormats
      * getFormats} method, which generates two bundle names for each generated
@@ -1156,18 +1156,18 @@
      * <ul><li>First, it attempts to load a class using the generated class name.
      * If such a class can be found and loaded using the specified class
      * loader, is assignment compatible with ResourceBundle, is accessible from
-     * ResourceBundle, and can be instantiated, <code>getBundle</code> creates a
+     * ResourceBundle, and can be instantiated, {@code getBundle} creates a
      * new instance of this class and uses it as the <em>result resource
      * bundle</em>.
      *
-     * <li>Otherwise, <code>getBundle</code> attempts to locate a property
+     * <li>Otherwise, {@code getBundle} attempts to locate a property
      * resource file using the generated properties file name.  It generates a
      * path name from the candidate bundle name by replacing all "." characters
      * with "/" and appending the string ".properties".  It attempts to find a
      * "resource" with this name using {@link
      * java.lang.ClassLoader#getResource(java.lang.String)
      * ClassLoader.getResource}.  (Note that a "resource" in the sense of
-     * <code>getResource</code> has nothing to do with the contents of a
+     * {@code getResource} has nothing to do with the contents of a
      * resource bundle, it is just a container of data, such as a file.)  If it
      * finds a "resource", it attempts to create a new {@link
      * PropertyResourceBundle} instance from its contents.  If successful, this
@@ -1181,14 +1181,14 @@
      * locale and searched again, as above.
      *
      * <p>If still no result bundle is found, the base name alone is looked up. If
-     * this still fails, a <code>MissingResourceException</code> is thrown.
+     * this still fails, a {@code MissingResourceException} is thrown.
      *
      * <p><a id="parent_chain"> Once a result resource bundle has been found,
      * its <em>parent chain</em> is instantiated</a>.  If the result bundle already
      * has a parent (perhaps because it was returned from a cache) the chain is
      * complete.
      *
-     * <p>Otherwise, <code>getBundle</code> examines the remainder of the
+     * <p>Otherwise, {@code getBundle} examines the remainder of the
      * candidate locale list that was used during the pass that generated the
      * result resource bundle.  (As before, candidate bundle names where the
      * final component is an empty string are omitted.)  When it comes to the
@@ -1203,13 +1203,13 @@
      *
      * <p>Once the parent chain is complete, the bundle is returned.
      *
-     * <p><b>Note:</b> <code>getBundle</code> caches instantiated resource
+     * <p><b>Note:</b> {@code getBundle} caches instantiated resource
      * bundles and might return the same resource bundle instance multiple times.
      *
-     * <p><b>Note:</b>The <code>baseName</code> argument should be a fully
+     * <p><b>Note:</b>The {@code baseName} argument should be a fully
      * qualified class name. However, for compatibility with earlier versions,
      * Java SE Runtime Environments do not verify this, and so it is
-     * possible to access <code>PropertyResourceBundle</code>s by specifying a
+     * possible to access {@code PropertyResourceBundle}s by specifying a
      * path name (using "/") instead of a fully qualified class name (using
      * ".").
      *
@@ -1228,11 +1228,11 @@
      * </ul>
      *
      * The contents of all files are valid (that is, public non-abstract
-     * subclasses of <code>ResourceBundle</code> for the ".class" files,
+     * subclasses of {@code ResourceBundle} for the ".class" files,
      * syntactically correct ".properties" files).  The default locale is
-     * <code>Locale("en", "GB")</code>.
+     * {@code Locale("en", "GB")}.
      *
-     * <p>Calling <code>getBundle</code> with the locale arguments below will
+     * <p>Calling {@code getBundle} with the locale arguments below will
      * instantiate resource bundles as follows:
      *
      * <table class="striped">
@@ -1264,9 +1264,9 @@
      * @param locale the locale for which a resource bundle is desired
      * @param loader the class loader from which to load the resource bundle
      * @return a resource bundle for the given base name and locale
-     * @exception java.lang.NullPointerException
-     *        if <code>baseName</code>, <code>locale</code>, or <code>loader</code> is <code>null</code>
-     * @exception MissingResourceException
+     * @throws    java.lang.NullPointerException
+     *        if {@code baseName}, {@code locale}, or {@code loader} is {@code null}
+     * @throws    MissingResourceException
      *        if no resource bundle for the specified base name can be found
      * @since 1.2
      * @revised 9
@@ -1289,14 +1289,14 @@
      * locale, class loader and control. Unlike the {@link
      * #getBundle(String, Locale, ClassLoader) getBundle}
      * factory methods with no {@code control} argument, the given
-     * <code>control</code> specifies how to locate and instantiate resource
+     * {@code control} specifies how to locate and instantiate resource
      * bundles. Conceptually, the bundle loading process with the given
-     * <code>control</code> is performed in the following steps.
+     * {@code control} is performed in the following steps.
      *
      * <ol>
      * <li>This factory method looks up the resource bundle in the cache for
-     * the specified <code>baseName</code>, <code>targetLocale</code> and
-     * <code>loader</code>.  If the requested resource bundle instance is
+     * the specified {@code baseName}, {@code targetLocale} and
+     * {@code loader}.  If the requested resource bundle instance is
      * found in the cache and the time-to-live periods of the instance and
      * all of its parent instances have not expired, the instance is returned
      * to the caller. Otherwise, this factory method proceeds with the
@@ -1305,71 +1305,71 @@
      * <li>The {@link ResourceBundle.Control#getFormats(String)
      * control.getFormats} method is called to get resource bundle formats
      * to produce bundle or resource names. The strings
-     * <code>"java.class"</code> and <code>"java.properties"</code>
+     * {@code "java.class"} and {@code "java.properties"}
      * designate class-based and {@linkplain PropertyResourceBundle
      * property}-based resource bundles, respectively. Other strings
-     * starting with <code>"java."</code> are reserved for future extensions
+     * starting with {@code "java."} are reserved for future extensions
      * and must not be used for application-defined formats. Other strings
      * designate application-defined formats.</li>
      *
      * <li>The {@link ResourceBundle.Control#getCandidateLocales(String,
      * Locale) control.getCandidateLocales} method is called with the target
-     * locale to get a list of <em>candidate <code>Locale</code>s</em> for
+     * locale to get a list of <em>candidate {@code Locale}s</em> for
      * which resource bundles are searched.</li>
      *
      * <li>The {@link ResourceBundle.Control#newBundle(String, Locale,
      * String, ClassLoader, boolean) control.newBundle} method is called to
-     * instantiate a <code>ResourceBundle</code> for the base bundle name, a
+     * instantiate a {@code ResourceBundle} for the base bundle name, a
      * candidate locale, and a format. (Refer to the note on the cache
      * lookup below.) This step is iterated over all combinations of the
-     * candidate locales and formats until the <code>newBundle</code> method
-     * returns a <code>ResourceBundle</code> instance or the iteration has
+     * candidate locales and formats until the {@code newBundle} method
+     * returns a {@code ResourceBundle} instance or the iteration has
      * used up all the combinations. For example, if the candidate locales
-     * are <code>Locale("de", "DE")</code>, <code>Locale("de")</code> and
-     * <code>Locale("")</code> and the formats are <code>"java.class"</code>
-     * and <code>"java.properties"</code>, then the following is the
+     * are {@code Locale("de", "DE")}, {@code Locale("de")} and
+     * {@code Locale("")} and the formats are {@code "java.class"}
+     * and {@code "java.properties"}, then the following is the
      * sequence of locale-format combinations to be used to call
-     * <code>control.newBundle</code>.
+     * {@code control.newBundle}.
      *
      * <table class=striped style="width: 50%; text-align: left; margin-left: 40px;">
      * <caption style="display:none">locale-format combinations for newBundle</caption>
      * <thead>
      * <tr>
      * <th scope="col">Index</th>
-     * <th scope="col"><code>Locale</code></th>
-     * <th scope="col"><code>format</code></th>
+     * <th scope="col">{@code Locale}</th>
+     * <th scope="col">{@code format}</th>
      * </tr>
      * </thead>
      * <tbody>
      * <tr>
      * <th scope="row">1</th>
-     * <td><code>Locale("de", "DE")</code></td>
-     * <td><code>java.class</code></td>
+     * <td>{@code Locale("de", "DE")}</td>
+     * <td>{@code java.class}</td>
      * </tr>
      * <tr>
      * <th scope="row">2</th>
-     * <td><code>Locale("de", "DE")</code></td>
-     * <td><code>java.properties</code></td>
+     * <td>{@code Locale("de", "DE")}</td>
+     * <td>{@code java.properties}</td>
      * </tr>
      * <tr>
      * <th scope="row">3</th>
-     * <td><code>Locale("de")</code></td>
-     * <td><code>java.class</code></td>
+     * <td>{@code Locale("de")}</td>
+     * <td>{@code java.class}</td>
      * </tr>
      * <tr>
      * <th scope="row">4</th>
-     * <td><code>Locale("de")</code></td>
-     * <td><code>java.properties</code></td>
+     * <td>{@code Locale("de")}</td>
+     * <td>{@code java.properties}</td>
      * </tr>
      * <tr>
      * <th scope="row">5</th>
-     * <td><code>Locale("")</code></td>
-     * <td><code>java.class</code></td>
+     * <td>{@code Locale("")}</td>
+     * <td>{@code java.class}</td>
      * </tr>
      * <tr>
      * <th scope="row">6</th>
-     * <td><code>Locale("")</code></td>
-     * <td><code>java.properties</code></td>
+     * <td>{@code Locale("")}</td>
+     * <td>{@code java.properties}</td>
      * </tr>
      * </tbody>
      * </table>
@@ -1377,8 +1377,8 @@
      *
      * <li>If the previous step has found no resource bundle, proceed to
      * Step 6. If a bundle has been found that is a base bundle (a bundle
-     * for <code>Locale("")</code>), and the candidate locale list only contained
-     * <code>Locale("")</code>, return the bundle to the caller. If a bundle
+     * for {@code Locale("")}), and the candidate locale list only contained
+     * {@code Locale("")}, return the bundle to the caller. If a bundle
      * has been found that is a base bundle, but the candidate locale list
      * contained locales other than Locale(""), put the bundle on hold and
      * proceed to Step 6. If a bundle has been found that is not a base
@@ -1410,65 +1410,65 @@
      * String, ClassLoader, ResourceBundle, long) control.needsReload}
      * method to determine whether the resource bundle needs to be reloaded.
      * If reloading is required, the factory method calls
-     * <code>control.newBundle</code> to reload the resource bundle.  If
-     * <code>control.newBundle</code> returns <code>null</code>, the factory
+     * {@code control.newBundle} to reload the resource bundle.  If
+     * {@code control.newBundle} returns {@code null}, the factory
      * method puts a dummy resource bundle in the cache as a mark of
      * nonexistent resource bundles in order to avoid lookup overhead for
      * subsequent requests. Such dummy resource bundles are under the same
-     * expiration control as specified by <code>control</code>.
+     * expiration control as specified by {@code control}.
      *
      * <p>All resource bundles loaded are cached by default. Refer to
      * {@link Control#getTimeToLive(String,Locale)
      * control.getTimeToLive} for details.
      *
      * <p>The following is an example of the bundle loading process with the
-     * default <code>ResourceBundle.Control</code> implementation.
+     * default {@code ResourceBundle.Control} implementation.
      *
      * <p>Conditions:
      * <ul>
-     * <li>Base bundle name: <code>foo.bar.Messages</code>
-     * <li>Requested <code>Locale</code>: {@link Locale#ITALY}</li>
-     * <li>Default <code>Locale</code>: {@link Locale#FRENCH}</li>
+     * <li>Base bundle name: {@code foo.bar.Messages}
+     * <li>Requested {@code Locale}: {@link Locale#ITALY}</li>
+     * <li>Default {@code Locale}: {@link Locale#FRENCH}</li>
      * <li>Available resource bundles:
-     * <code>foo/bar/Messages_fr.properties</code> and
-     * <code>foo/bar/Messages.properties</code></li>
+     * {@code foo/bar/Messages_fr.properties} and
+     * {@code foo/bar/Messages.properties}</li>
      * </ul>
      *
-     * <p>First, <code>getBundle</code> tries loading a resource bundle in
+     * <p>First, {@code getBundle} tries loading a resource bundle in
      * the following sequence.
      *
      * <ul>
-     * <li>class <code>foo.bar.Messages_it_IT</code>
-     * <li>file <code>foo/bar/Messages_it_IT.properties</code>
-     * <li>class <code>foo.bar.Messages_it</code></li>
-     * <li>file <code>foo/bar/Messages_it.properties</code></li>
-     * <li>class <code>foo.bar.Messages</code></li>
-     * <li>file <code>foo/bar/Messages.properties</code></li>
+     * <li>class {@code foo.bar.Messages_it_IT}
+     * <li>file {@code foo/bar/Messages_it_IT.properties}
+     * <li>class {@code foo.bar.Messages_it}</li>
+     * <li>file {@code foo/bar/Messages_it.properties}</li>
+     * <li>class {@code foo.bar.Messages}</li>
+     * <li>file {@code foo/bar/Messages.properties}</li>
      * </ul>
      *
-     * <p>At this point, <code>getBundle</code> finds
-     * <code>foo/bar/Messages.properties</code>, which is put on hold
-     * because it's the base bundle.  <code>getBundle</code> calls {@link
+     * <p>At this point, {@code getBundle} finds
+     * {@code foo/bar/Messages.properties}, which is put on hold
+     * because it's the base bundle.  {@code getBundle} calls {@link
      * Control#getFallbackLocale(String, Locale)
      * control.getFallbackLocale("foo.bar.Messages", Locale.ITALY)} which
-     * returns <code>Locale.FRENCH</code>. Next, <code>getBundle</code>
+     * returns {@code Locale.FRENCH}. Next, {@code getBundle}
      * tries loading a bundle in the following sequence.
      *
      * <ul>
-     * <li>class <code>foo.bar.Messages_fr</code></li>
-     * <li>file <code>foo/bar/Messages_fr.properties</code></li>
-     * <li>class <code>foo.bar.Messages</code></li>
-     * <li>file <code>foo/bar/Messages.properties</code></li>
+     * <li>class {@code foo.bar.Messages_fr}</li>
+     * <li>file {@code foo/bar/Messages_fr.properties}</li>
+     * <li>class {@code foo.bar.Messages}</li>
+     * <li>file {@code foo/bar/Messages.properties}</li>
      * </ul>
      *
-     * <p><code>getBundle</code> finds
-     * <code>foo/bar/Messages_fr.properties</code> and creates a
-     * <code>ResourceBundle</code> instance. Then, <code>getBundle</code>
+     * <p>{@code getBundle} finds
+     * {@code foo/bar/Messages_fr.properties} and creates a
+     * {@code ResourceBundle} instance. Then, {@code getBundle}
      * sets up its parent chain from the list of the candidate locales.  Only
-     * <code>foo/bar/Messages.properties</code> is found in the list and
-     * <code>getBundle</code> creates a <code>ResourceBundle</code> instance
+     * {@code foo/bar/Messages.properties} is found in the list and
+     * {@code getBundle} creates a {@code ResourceBundle} instance
      * that becomes the parent of the instance for
-     * <code>foo/bar/Messages_fr.properties</code>.
+     * {@code foo/bar/Messages_fr.properties}.
      *
      * @param baseName
      *        the base name of the resource bundle, a fully qualified
@@ -1482,15 +1482,15 @@
      *        bundle loading process
      * @return a resource bundle for the given base name and locale
      * @throws NullPointerException
-     *         if <code>baseName</code>, <code>targetLocale</code>,
-     *         <code>loader</code>, or <code>control</code> is
-     *         <code>null</code>
+     *         if {@code baseName}, {@code targetLocale},
+     *         {@code loader}, or {@code control} is
+     *         {@code null}
      * @throws MissingResourceException
      *         if no resource bundle for the specified base name can be found
      * @throws IllegalArgumentException
-     *         if the given <code>control</code> doesn't perform properly
-     *         (e.g., <code>control.getCandidateLocales</code> returns null.)
-     *         Note that validation of <code>control</code> is performed as
+     *         if the given {@code control} doesn't perform properly
+     *         (e.g., {@code control.getCandidateLocales} returns null.)
+     *         Note that validation of {@code control} is performed as
      *         needed.
      * @throws UnsupportedOperationException
      *         if this method is called in a named module
@@ -1700,7 +1700,7 @@
     }
 
     /**
-     * Checks if the given <code>List</code> is not null, not empty,
+     * Checks if the given {@code List} is not null, not empty,
      * not having null in its elements.
      */
     private static boolean checkList(List<?> a) {
@@ -2066,7 +2066,7 @@
      * @param cacheKey the key to look up the cache
      * @param control the Control to be used for the expiration control
      * @return the cached bundle, or null if the bundle is not found in the
-     * cache or its parent has expired. <code>bundle.expire</code> is true
+     * cache or its parent has expired. {@code bundle.expire} is true
      * upon return if the bundle in the cache has expired.
      */
     private static ResourceBundle findBundleInCache(CacheKey cacheKey,
@@ -2250,7 +2250,7 @@
      * by the given class loader.
      *
      * @param loader the class loader
-     * @exception NullPointerException if <code>loader</code> is null
+     * @throws    NullPointerException if {@code loader} is null
      * @since 1.6
      * @see ResourceBundle.Control#getTimeToLive(String,Locale)
      */
@@ -2271,7 +2271,7 @@
      * object for the given key.
      *
      * @param key the key for the desired object
-     * @exception NullPointerException if <code>key</code> is <code>null</code>
+     * @throws    NullPointerException if {@code key} is {@code null}
      * @return the object for the given key, or null
      */
     protected abstract Object handleGetObject(String key);
@@ -2279,22 +2279,22 @@
     /**
      * Returns an enumeration of the keys.
      *
-     * @return an <code>Enumeration</code> of the keys contained in
-     *         this <code>ResourceBundle</code> and its parent bundles.
+     * @return an {@code Enumeration} of the keys contained in
+     *         this {@code ResourceBundle} and its parent bundles.
      */
     public abstract Enumeration<String> getKeys();
 
     /**
-     * Determines whether the given <code>key</code> is contained in
-     * this <code>ResourceBundle</code> or its parent bundles.
+     * Determines whether the given {@code key} is contained in
+     * this {@code ResourceBundle} or its parent bundles.
      *
      * @param key
-     *        the resource <code>key</code>
-     * @return <code>true</code> if the given <code>key</code> is
-     *        contained in this <code>ResourceBundle</code> or its
-     *        parent bundles; <code>false</code> otherwise.
-     * @exception NullPointerException
-     *         if <code>key</code> is <code>null</code>
+     *        the resource {@code key}
+     * @return {@code true} if the given {@code key} is
+     *        contained in this {@code ResourceBundle} or its
+     *        parent bundles; {@code false} otherwise.
+     * @throws    NullPointerException
+     *         if {@code key} is {@code null}
      * @since 1.6
      */
     public boolean containsKey(String key) {
@@ -2310,11 +2310,11 @@
     }
 
     /**
-     * Returns a <code>Set</code> of all keys contained in this
-     * <code>ResourceBundle</code> and its parent bundles.
+     * Returns a {@code Set} of all keys contained in this
+     * {@code ResourceBundle} and its parent bundles.
      *
-     * @return a <code>Set</code> of all keys contained in this
-     *         <code>ResourceBundle</code> and its parent bundles.
+     * @return a {@code Set} of all keys contained in this
+     *         {@code ResourceBundle} and its parent bundles.
      * @since 1.6
      */
     public Set<String> keySet() {
@@ -2326,20 +2326,20 @@
     }
 
     /**
-     * Returns a <code>Set</code> of the keys contained <em>only</em>
-     * in this <code>ResourceBundle</code>.
+     * Returns a {@code Set} of the keys contained <em>only</em>
+     * in this {@code ResourceBundle}.
      *
-     * <p>The default implementation returns a <code>Set</code> of the
+     * <p>The default implementation returns a {@code Set} of the
      * keys returned by the {@link #getKeys() getKeys} method except
      * for the ones for which the {@link #handleGetObject(String)
-     * handleGetObject} method returns <code>null</code>. Once the
-     * <code>Set</code> has been created, the value is kept in this
-     * <code>ResourceBundle</code> in order to avoid producing the
-     * same <code>Set</code> in subsequent calls. Subclasses can
+     * handleGetObject} method returns {@code null}. Once the
+     * {@code Set} has been created, the value is kept in this
+     * {@code ResourceBundle} in order to avoid producing the
+     * same {@code Set} in subsequent calls. Subclasses can
      * override this method for faster handling.
      *
-     * @return a <code>Set</code> of the keys contained only in this
-     *        <code>ResourceBundle</code>
+     * @return a {@code Set} of the keys contained only in this
+     *        {@code ResourceBundle}
      * @since 1.6
      */
     protected Set<String> handleKeySet() {
@@ -2364,11 +2364,11 @@
 
 
     /**
-     * <code>ResourceBundle.Control</code> defines a set of callback methods
+     * {@code ResourceBundle.Control} defines a set of callback methods
      * that are invoked by the {@link ResourceBundle#getBundle(String,
      * Locale, ClassLoader, Control) ResourceBundle.getBundle} factory
      * methods during the bundle loading process. In other words, a
-     * <code>ResourceBundle.Control</code> collaborates with the factory
+     * {@code ResourceBundle.Control} collaborates with the factory
      * methods for loading resource bundles. The default implementation of
      * the callback methods provides the information necessary for the
      * factory methods to perform the <a
@@ -2386,45 +2386,45 @@
      * #toBundleName(String, Locale) toBundleName} and {@link
      * #toResourceName(String, String) toResourceName} methods are defined
      * primarily for convenience in implementing the callback
-     * methods. However, the <code>toBundleName</code> method could be
+     * methods. However, the {@code toBundleName} method could be
      * overridden to provide different conventions in the organization and
-     * packaging of localized resources.  The <code>toResourceName</code>
-     * method is <code>final</code> to avoid use of wrong resource and class
+     * packaging of localized resources.  The {@code toResourceName}
+     * method is {@code final} to avoid use of wrong resource and class
      * name separators.
      *
      * <p>Two factory methods, {@link #getControl(List)} and {@link
      * #getNoFallbackControl(List)}, provide
-     * <code>ResourceBundle.Control</code> instances that implement common
+     * {@code ResourceBundle.Control} instances that implement common
      * variations of the default bundle loading process.
      *
      * <p>The formats returned by the {@link Control#getFormats(String)
      * getFormats} method and candidate locales returned by the {@link
      * ResourceBundle.Control#getCandidateLocales(String, Locale)
      * getCandidateLocales} method must be consistent in all
-     * <code>ResourceBundle.getBundle</code> invocations for the same base
-     * bundle. Otherwise, the <code>ResourceBundle.getBundle</code> methods
+     * {@code ResourceBundle.getBundle} invocations for the same base
+     * bundle. Otherwise, the {@code ResourceBundle.getBundle} methods
      * may return unintended bundles. For example, if only
-     * <code>"java.class"</code> is returned by the <code>getFormats</code>
-     * method for the first call to <code>ResourceBundle.getBundle</code>
-     * and only <code>"java.properties"</code> for the second call, then the
+     * {@code "java.class"} is returned by the {@code getFormats}
+     * method for the first call to {@code ResourceBundle.getBundle}
+     * and only {@code "java.properties"} for the second call, then the
      * second call will return the class-based one that has been cached
      * during the first call.
      *
-     * <p>A <code>ResourceBundle.Control</code> instance must be thread-safe
+     * <p>A {@code ResourceBundle.Control} instance must be thread-safe
      * if it's simultaneously used by multiple threads.
-     * <code>ResourceBundle.getBundle</code> does not synchronize to call
-     * the <code>ResourceBundle.Control</code> methods. The default
+     * {@code ResourceBundle.getBundle} does not synchronize to call
+     * the {@code ResourceBundle.Control} methods. The default
      * implementations of the methods are thread-safe.
      *
-     * <p>Applications can specify <code>ResourceBundle.Control</code>
-     * instances returned by the <code>getControl</code> factory methods or
-     * created from a subclass of <code>ResourceBundle.Control</code> to
+     * <p>Applications can specify {@code ResourceBundle.Control}
+     * instances returned by the {@code getControl} factory methods or
+     * created from a subclass of {@code ResourceBundle.Control} to
      * customize the bundle loading process. The following are examples of
      * changing the default bundle loading process.
      *
      * <p><b>Example 1</b>
      *
-     * <p>The following code lets <code>ResourceBundle.getBundle</code> look
+     * <p>The following code lets {@code ResourceBundle.getBundle} look
      * up only properties-based resources.
      *
      * <pre>
@@ -2438,12 +2438,12 @@
      *
      * Given the resource bundles in the <a
      * href="./ResourceBundle.html#default_behavior_example">example</a> in
-     * the <code>ResourceBundle.getBundle</code> description, this
-     * <code>ResourceBundle.getBundle</code> call loads
-     * <code>MyResources_fr_CH.properties</code> whose parent is
-     * <code>MyResources_fr.properties</code> whose parent is
-     * <code>MyResources.properties</code>. (<code>MyResources_fr_CH.properties</code>
-     * is not hidden, but <code>MyResources_fr_CH.class</code> is.)
+     * the {@code ResourceBundle.getBundle} description, this
+     * {@code ResourceBundle.getBundle} call loads
+     * {@code MyResources_fr_CH.properties} whose parent is
+     * {@code MyResources_fr.properties} whose parent is
+     * {@code MyResources.properties}. ({@code MyResources_fr_CH.properties}
+     * is not hidden, but {@code MyResources_fr_CH.class} is.)
      *
      * <p><b>Example 2</b>
      *
@@ -2529,9 +2529,9 @@
      */
     public static class Control {
         /**
-         * The default format <code>List</code>, which contains the strings
-         * <code>"java.class"</code> and <code>"java.properties"</code>, in
-         * this order. This <code>List</code> is unmodifiable.
+         * The default format {@code List}, which contains the strings
+         * {@code "java.class"} and {@code "java.properties"}, in
+         * this order. This {@code List} is unmodifiable.
          *
          * @see #getFormats(String)
          */
@@ -2539,16 +2539,16 @@
             = List.of("java.class", "java.properties");
 
         /**
-         * The class-only format <code>List</code> containing
-         * <code>"java.class"</code>. This <code>List</code> is unmodifiable.
+         * The class-only format {@code List} containing
+         * {@code "java.class"}. This {@code List} is unmodifiable.
          *
          * @see #getFormats(String)
          */
         public static final List<String> FORMAT_CLASS = List.of("java.class");
 
         /**
-         * The properties-only format <code>List</code> containing
-         * <code>"java.properties"</code>. This <code>List</code> is unmodifiable.
+         * The properties-only format {@code List} containing
+         * {@code "java.properties"}. This {@code List} is unmodifiable.
          *
          * @see #getFormats(String)
          */
@@ -2581,27 +2581,27 @@
         }
 
         /**
-         * Returns a <code>ResourceBundle.Control</code> in which the {@link
+         * Returns a {@code ResourceBundle.Control} in which the {@link
          * #getFormats(String) getFormats} method returns the specified
-         * <code>formats</code>. The <code>formats</code> must be equal to
+         * {@code formats}. The {@code formats} must be equal to
          * one of {@link Control#FORMAT_PROPERTIES}, {@link
          * Control#FORMAT_CLASS} or {@link
-         * Control#FORMAT_DEFAULT}. <code>ResourceBundle.Control</code>
+         * Control#FORMAT_DEFAULT}. {@code ResourceBundle.Control}
          * instances returned by this method are singletons and thread-safe.
          *
          * <p>Specifying {@link Control#FORMAT_DEFAULT} is equivalent to
-         * instantiating the <code>ResourceBundle.Control</code> class,
+         * instantiating the {@code ResourceBundle.Control} class,
          * except that this method returns a singleton.
          *
          * @param formats
          *        the formats to be returned by the
-         *        <code>ResourceBundle.Control.getFormats</code> method
-         * @return a <code>ResourceBundle.Control</code> supporting the
-         *        specified <code>formats</code>
-         * @exception NullPointerException
-         *        if <code>formats</code> is <code>null</code>
-         * @exception IllegalArgumentException
-         *        if <code>formats</code> is unknown
+         *        {@code ResourceBundle.Control.getFormats} method
+         * @return a {@code ResourceBundle.Control} supporting the
+         *        specified {@code formats}
+         * @throws    NullPointerException
+         *        if {@code formats} is {@code null}
+         * @throws    IllegalArgumentException
+         *        if {@code formats} is unknown
          */
         public static final Control getControl(List<String> formats) {
             if (formats.equals(Control.FORMAT_PROPERTIES)) {
@@ -2617,26 +2617,26 @@
         }
 
         /**
-         * Returns a <code>ResourceBundle.Control</code> in which the {@link
+         * Returns a {@code ResourceBundle.Control} in which the {@link
          * #getFormats(String) getFormats} method returns the specified
-         * <code>formats</code> and the {@link
+         * {@code formats} and the {@link
          * Control#getFallbackLocale(String, Locale) getFallbackLocale}
-         * method returns <code>null</code>. The <code>formats</code> must
+         * method returns {@code null}. The {@code formats} must
          * be equal to one of {@link Control#FORMAT_PROPERTIES}, {@link
          * Control#FORMAT_CLASS} or {@link Control#FORMAT_DEFAULT}.
-         * <code>ResourceBundle.Control</code> instances returned by this
+         * {@code ResourceBundle.Control} instances returned by this
          * method are singletons and thread-safe.
          *
          * @param formats
          *        the formats to be returned by the
-         *        <code>ResourceBundle.Control.getFormats</code> method
-         * @return a <code>ResourceBundle.Control</code> supporting the
-         *        specified <code>formats</code> with no fallback
-         *        <code>Locale</code> support
-         * @exception NullPointerException
-         *        if <code>formats</code> is <code>null</code>
-         * @exception IllegalArgumentException
-         *        if <code>formats</code> is unknown
+         *        {@code ResourceBundle.Control.getFormats} method
+         * @return a {@code ResourceBundle.Control} supporting the
+         *        specified {@code formats} with no fallback
+         *        {@code Locale} support
+         * @throws    NullPointerException
+         *        if {@code formats} is {@code null}
+         * @throws    IllegalArgumentException
+         *        if {@code formats} is unknown
          */
         public static final Control getNoFallbackControl(List<String> formats) {
             if (formats.equals(Control.FORMAT_DEFAULT)) {
@@ -2652,35 +2652,35 @@
         }
 
         /**
-         * Returns a <code>List</code> of <code>String</code>s containing
+         * Returns a {@code List} of {@code String}s containing
          * formats to be used to load resource bundles for the given
-         * <code>baseName</code>. The <code>ResourceBundle.getBundle</code>
+         * {@code baseName}. The {@code ResourceBundle.getBundle}
          * factory method tries to load resource bundles with formats in the
          * order specified by the list. The list returned by this method
-         * must have at least one <code>String</code>. The predefined
-         * formats are <code>"java.class"</code> for class-based resource
-         * bundles and <code>"java.properties"</code> for {@linkplain
+         * must have at least one {@code String}. The predefined
+         * formats are {@code "java.class"} for class-based resource
+         * bundles and {@code "java.properties"} for {@linkplain
          * PropertyResourceBundle properties-based} ones. Strings starting
-         * with <code>"java."</code> are reserved for future extensions and
+         * with {@code "java."} are reserved for future extensions and
          * must not be used by application-defined formats.
          *
          * <p>It is not a requirement to return an immutable (unmodifiable)
-         * <code>List</code>.  However, the returned <code>List</code> must
+         * {@code List}.  However, the returned {@code List} must
          * not be mutated after it has been returned by
-         * <code>getFormats</code>.
+         * {@code getFormats}.
          *
          * <p>The default implementation returns {@link #FORMAT_DEFAULT} so
-         * that the <code>ResourceBundle.getBundle</code> factory method
+         * that the {@code ResourceBundle.getBundle} factory method
          * looks up first class-based resource bundles, then
          * properties-based ones.
          *
          * @param baseName
          *        the base name of the resource bundle, a fully qualified class
          *        name
-         * @return a <code>List</code> of <code>String</code>s containing
+         * @return a {@code List} of {@code String}s containing
          *        formats for loading resource bundles.
-         * @exception NullPointerException
-         *        if <code>baseName</code> is null
+         * @throws    NullPointerException
+         *        if {@code baseName} is null
          * @see #FORMAT_DEFAULT
          * @see #FORMAT_CLASS
          * @see #FORMAT_PROPERTIES
@@ -2693,11 +2693,11 @@
         }
 
         /**
-         * Returns a <code>List</code> of <code>Locale</code>s as candidate
-         * locales for <code>baseName</code> and <code>locale</code>. This
-         * method is called by the <code>ResourceBundle.getBundle</code>
+         * Returns a {@code List} of {@code Locale}s as candidate
+         * locales for {@code baseName} and {@code locale}. This
+         * method is called by the {@code ResourceBundle.getBundle}
          * factory method each time the factory method tries finding a
-         * resource bundle for a target <code>Locale</code>.
+         * resource bundle for a target {@code Locale}.
          *
          * <p>The sequence of the candidate locales also corresponds to the
          * runtime resource lookup path (also known as the <I>parent
@@ -2707,42 +2707,42 @@
          * must be a {@linkplain Locale#ROOT root locale} if it is desired to
          * have the base bundle as the terminal of the parent chain.
          *
-         * <p>If the given locale is equal to <code>Locale.ROOT</code> (the
-         * root locale), a <code>List</code> containing only the root
-         * <code>Locale</code> must be returned. In this case, the
-         * <code>ResourceBundle.getBundle</code> factory method loads only
+         * <p>If the given locale is equal to {@code Locale.ROOT} (the
+         * root locale), a {@code List} containing only the root
+         * {@code Locale} must be returned. In this case, the
+         * {@code ResourceBundle.getBundle} factory method loads only
          * the base bundle as the resulting resource bundle.
          *
          * <p>It is not a requirement to return an immutable (unmodifiable)
-         * <code>List</code>. However, the returned <code>List</code> must not
+         * {@code List}. However, the returned {@code List} must not
          * be mutated after it has been returned by
-         * <code>getCandidateLocales</code>.
+         * {@code getCandidateLocales}.
          *
-         * <p>The default implementation returns a <code>List</code> containing
-         * <code>Locale</code>s using the rules described below.  In the
+         * <p>The default implementation returns a {@code List} containing
+         * {@code Locale}s using the rules described below.  In the
          * description below, <em>L</em>, <em>S</em>, <em>C</em> and <em>V</em>
          * respectively represent non-empty language, script, country, and
          * variant.  For example, [<em>L</em>, <em>C</em>] represents a
-         * <code>Locale</code> that has non-empty values only for language and
+         * {@code Locale} that has non-empty values only for language and
          * country.  The form <em>L</em>("xx") represents the (non-empty)
-         * language value is "xx".  For all cases, <code>Locale</code>s whose
+         * language value is "xx".  For all cases, {@code Locale}s whose
          * final component values are empty strings are omitted.
          *
-         * <ol><li>For an input <code>Locale</code> with an empty script value,
-         * append candidate <code>Locale</code>s by omitting the final component
+         * <ol><li>For an input {@code Locale} with an empty script value,
+         * append candidate {@code Locale}s by omitting the final component
          * one by one as below:
          *
          * <ul>
          * <li> [<em>L</em>, <em>C</em>, <em>V</em>] </li>
          * <li> [<em>L</em>, <em>C</em>] </li>
          * <li> [<em>L</em>] </li>
-         * <li> <code>Locale.ROOT</code> </li>
+         * <li> {@code Locale.ROOT} </li>
          * </ul></li>
          *
-         * <li>For an input <code>Locale</code> with a non-empty script value,
-         * append candidate <code>Locale</code>s by omitting the final component
+         * <li>For an input {@code Locale} with a non-empty script value,
+         * append candidate {@code Locale}s by omitting the final component
          * up to language, then append candidates generated from the
-         * <code>Locale</code> with country and variant restored:
+         * {@code Locale} with country and variant restored:
          *
          * <ul>
          * <li> [<em>L</em>, <em>S</em>, <em>C</em>, <em>V</em>]</li>
@@ -2751,13 +2751,13 @@
          * <li> [<em>L</em>, <em>C</em>, <em>V</em>]</li>
          * <li> [<em>L</em>, <em>C</em>]</li>
          * <li> [<em>L</em>]</li>
-         * <li> <code>Locale.ROOT</code></li>
+         * <li> {@code Locale.ROOT}</li>
          * </ul></li>
          *
-         * <li>For an input <code>Locale</code> with a variant value consisting
+         * <li>For an input {@code Locale} with a variant value consisting
          * of multiple subtags separated by underscore, generate candidate
-         * <code>Locale</code>s by omitting the variant subtags one by one, then
-         * insert them after every occurrence of <code> Locale</code>s with the
+         * {@code Locale}s by omitting the variant subtags one by one, then
+         * insert them after every occurrence of {@code  Locale}s with the
          * full variant value in the original list.  For example, if
          * the variant consists of two subtags <em>V1</em> and <em>V2</em>:
          *
@@ -2770,10 +2770,10 @@
          * <li> [<em>L</em>, <em>C</em>, <em>V1</em>]</li>
          * <li> [<em>L</em>, <em>C</em>]</li>
          * <li> [<em>L</em>]</li>
-         * <li> <code>Locale.ROOT</code></li>
+         * <li> {@code Locale.ROOT}</li>
          * </ul></li>
          *
-         * <li>Special cases for Chinese.  When an input <code>Locale</code> has the
+         * <li>Special cases for Chinese.  When an input {@code Locale} has the
          * language "zh" (Chinese) and an empty script value, either "Hans" (Simplified) or
          * "Hant" (Traditional) might be supplied, depending on the country.
          * When the country is "CN" (China) or "SG" (Singapore), "Hans" is supplied.
@@ -2786,20 +2786,20 @@
          * <li> [<em>L</em>("zh"), <em>S</em>("Hans")]</li>
          * <li> [<em>L</em>("zh"), <em>C</em>("CN")]</li>
          * <li> [<em>L</em>("zh")]</li>
-         * <li> <code>Locale.ROOT</code></li>
+         * <li> {@code Locale.ROOT}</li>
          * </ul>
          *
-         * For <code>Locale("zh", "TW")</code>, the candidate list will be:
+         * For {@code Locale("zh", "TW")}, the candidate list will be:
          * <ul>
          * <li> [<em>L</em>("zh"), <em>S</em>("Hant"), <em>C</em>("TW")]</li>
          * <li> [<em>L</em>("zh"), <em>S</em>("Hant")]</li>
          * <li> [<em>L</em>("zh"), <em>C</em>("TW")]</li>
          * <li> [<em>L</em>("zh")]</li>
-         * <li> <code>Locale.ROOT</code></li>
+         * <li> {@code Locale.ROOT}</li>
          * </ul></li>
          *
-         * <li>Special cases for Norwegian.  Both <code>Locale("no", "NO",
-         * "NY")</code> and <code>Locale("nn", "NO")</code> represent Norwegian
+         * <li>Special cases for Norwegian.  Both {@code Locale("no", "NO",
+         * "NY")} and {@code Locale("nn", "NO")} represent Norwegian
          * Nynorsk.  When a locale's language is "nn", the standard candidate
          * list is generated up to [<em>L</em>("nn")], and then the following
          * candidates are added:
@@ -2807,20 +2807,20 @@
          * <ul><li> [<em>L</em>("no"), <em>C</em>("NO"), <em>V</em>("NY")]</li>
          * <li> [<em>L</em>("no"), <em>C</em>("NO")]</li>
          * <li> [<em>L</em>("no")]</li>
-         * <li> <code>Locale.ROOT</code></li>
+         * <li> {@code Locale.ROOT}</li>
          * </ul>
          *
-         * If the locale is exactly <code>Locale("no", "NO", "NY")</code>, it is first
-         * converted to <code>Locale("nn", "NO")</code> and then the above procedure is
+         * If the locale is exactly {@code Locale("no", "NO", "NY")}, it is first
+         * converted to {@code Locale("nn", "NO")} and then the above procedure is
          * followed.
          *
          * <p>Also, Java treats the language "no" as a synonym of Norwegian
-         * Bokm&#xE5;l "nb".  Except for the single case <code>Locale("no",
-         * "NO", "NY")</code> (handled above), when an input <code>Locale</code>
-         * has language "no" or "nb", candidate <code>Locale</code>s with
+         * Bokm&#xE5;l "nb".  Except for the single case {@code Locale("no",
+         * "NO", "NY")} (handled above), when an input {@code Locale}
+         * has language "no" or "nb", candidate {@code Locale}s with
          * language code "no" and "nb" are interleaved, first using the
          * requested language, then using its synonym. For example,
-         * <code>Locale("nb", "NO", "POSIX")</code> generates the following
+         * {@code Locale("nb", "NO", "POSIX")} generates the following
          * candidate list:
          *
          * <ul>
@@ -2830,10 +2830,10 @@
          * <li> [<em>L</em>("no"), <em>C</em>("NO")]</li>
          * <li> [<em>L</em>("nb")]</li>
          * <li> [<em>L</em>("no")]</li>
-         * <li> <code>Locale.ROOT</code></li>
+         * <li> {@code Locale.ROOT}</li>
          * </ul>
          *
-         * <code>Locale("no", "NO", "POSIX")</code> would generate the same list
+         * {@code Locale("no", "NO", "POSIX")} would generate the same list
          * except that locales with "no" would appear before the corresponding
          * locales with "nb".</li>
          * </ol>
@@ -2841,19 +2841,19 @@
          * <p>The default implementation uses an {@link ArrayList} that
          * overriding implementations may modify before returning it to the
          * caller. However, a subclass must not modify it after it has
-         * been returned by <code>getCandidateLocales</code>.
+         * been returned by {@code getCandidateLocales}.
          *
-         * <p>For example, if the given <code>baseName</code> is "Messages"
-         * and the given <code>locale</code> is
+         * <p>For example, if the given {@code baseName} is "Messages"
+         * and the given {@code locale} is
          * <code>Locale("ja",&nbsp;"",&nbsp;"XX")</code>, then a
-         * <code>List</code> of <code>Locale</code>s:
+         * {@code List} of {@code Locale}s:
          * <pre>
          *     Locale("ja", "", "XX")
          *     Locale("ja")
          *     Locale.ROOT
          * </pre>
          * is returned. And if the resource bundles for the "ja" and
-         * "" <code>Locale</code>s are found, then the runtime resource
+         * "" {@code Locale}s are found, then the runtime resource
          * lookup path (parent chain) is:
          * <pre>{@code
          *     Messages_ja -> Messages
@@ -2864,11 +2864,11 @@
          *        qualified class name
          * @param locale
          *        the locale for which a resource bundle is desired
-         * @return a <code>List</code> of candidate
-         *        <code>Locale</code>s for the given <code>locale</code>
-         * @exception NullPointerException
-         *        if <code>baseName</code> or <code>locale</code> is
-         *        <code>null</code>
+         * @return a {@code List} of candidate
+         *        {@code Locale}s for the given {@code locale}
+         * @throws    NullPointerException
+         *        if {@code baseName} or {@code locale} is
+         *        {@code null}
          */
         public List<Locale> getCandidateLocales(String baseName, Locale locale) {
             if (baseName == null) {
@@ -3003,40 +3003,40 @@
         }
 
         /**
-         * Returns a <code>Locale</code> to be used as a fallback locale for
+         * Returns a {@code Locale} to be used as a fallback locale for
          * further resource bundle searches by the
-         * <code>ResourceBundle.getBundle</code> factory method. This method
+         * {@code ResourceBundle.getBundle} factory method. This method
          * is called from the factory method every time when no resulting
-         * resource bundle has been found for <code>baseName</code> and
-         * <code>locale</code>, where locale is either the parameter for
-         * <code>ResourceBundle.getBundle</code> or the previous fallback
+         * resource bundle has been found for {@code baseName} and
+         * {@code locale}, where locale is either the parameter for
+         * {@code ResourceBundle.getBundle} or the previous fallback
          * locale returned by this method.
          *
-         * <p>The method returns <code>null</code> if no further fallback
+         * <p>The method returns {@code null} if no further fallback
          * search is desired.
          *
          * <p>The default implementation returns the {@linkplain
-         * Locale#getDefault() default <code>Locale</code>} if the given
-         * <code>locale</code> isn't the default one.  Otherwise,
-         * <code>null</code> is returned.
+         * Locale#getDefault() default {@code Locale}} if the given
+         * {@code locale} isn't the default one.  Otherwise,
+         * {@code null} is returned.
          *
          * @param baseName
          *        the base name of the resource bundle, a fully
          *        qualified class name for which
-         *        <code>ResourceBundle.getBundle</code> has been
+         *        {@code ResourceBundle.getBundle} has been
          *        unable to find any resource bundles (except for the
          *        base bundle)
          * @param locale
-         *        the <code>Locale</code> for which
-         *        <code>ResourceBundle.getBundle</code> has been
+         *        the {@code Locale} for which
+         *        {@code ResourceBundle.getBundle} has been
          *        unable to find any resource bundles (except for the
          *        base bundle)
-         * @return a <code>Locale</code> for the fallback search,
-         *        or <code>null</code> if no further fallback search
+         * @return a {@code Locale} for the fallback search,
+         *        or {@code null} if no further fallback search
          *        is desired.
-         * @exception NullPointerException
-         *        if <code>baseName</code> or <code>locale</code>
-         *        is <code>null</code>
+         * @throws    NullPointerException
+         *        if {@code baseName} or {@code locale}
+         *        is {@code null}
          */
         public Locale getFallbackLocale(String baseName, Locale locale) {
             if (baseName == null) {
@@ -3049,14 +3049,14 @@
         /**
          * Instantiates a resource bundle for the given bundle name of the
          * given format and locale, using the given class loader if
-         * necessary. This method returns <code>null</code> if there is no
+         * necessary. This method returns {@code null} if there is no
          * resource bundle available for the given parameters. If a resource
          * bundle can't be instantiated due to an unexpected error, the
-         * error must be reported by throwing an <code>Error</code> or
-         * <code>Exception</code> rather than simply returning
-         * <code>null</code>.
+         * error must be reported by throwing an {@code Error} or
+         * {@code Exception} rather than simply returning
+         * {@code null}.
          *
-         * <p>If the <code>reload</code> flag is <code>true</code>, it
+         * <p>If the {@code reload} flag is {@code true}, it
          * indicates that this method is being called because the previously
          * loaded resource bundle has expired.
          *
@@ -3069,7 +3069,7 @@
          * to the resource bundle is open unconditionally.
          *
          * <p>The default implementation instantiates a
-         * <code>ResourceBundle</code> as follows.
+         * {@code ResourceBundle} as follows.
          *
          * <ul>
          *
@@ -3077,37 +3077,37 @@
          * #toBundleName(String, Locale) toBundleName(baseName,
          * locale)}.</li>
          *
-         * <li>If <code>format</code> is <code>"java.class"</code>, the
+         * <li>If {@code format} is {@code "java.class"}, the
          * {@link Class} specified by the bundle name is loaded with the
          * given class loader. If the {@code Class} is found and accessible
-         * then the <code>ResourceBundle</code> is instantiated.  The
+         * then the {@code ResourceBundle} is instantiated.  The
          * resource bundle is accessible if the package of the bundle class file
          * is open unconditionally; otherwise, {@code IllegalAccessException}
          * will be thrown.
-         * Note that the <code>reload</code> flag is ignored for loading
+         * Note that the {@code reload} flag is ignored for loading
          * class-based resource bundles in this default implementation.
          * </li>
          *
-         * <li>If <code>format</code> is <code>"java.properties"</code>,
+         * <li>If {@code format} is {@code "java.properties"},
          * {@link #toResourceName(String, String) toResourceName(bundlename,
          * "properties")} is called to get the resource name.
-         * If <code>reload</code> is <code>true</code>, {@link
+         * If {@code reload} is {@code true}, {@link
          * ClassLoader#getResource(String) load.getResource} is called
          * to get a {@link URL} for creating a {@link
-         * URLConnection}. This <code>URLConnection</code> is used to
+         * URLConnection}. This {@code URLConnection} is used to
          * {@linkplain URLConnection#setUseCaches(boolean) disable the
          * caches} of the underlying resource loading layers,
          * and to {@linkplain URLConnection#getInputStream() get an
-         * <code>InputStream</code>}.
+         * {@code InputStream}}.
          * Otherwise, {@link ClassLoader#getResourceAsStream(String)
          * loader.getResourceAsStream} is called to get an {@link
          * InputStream}. Then, a {@link
          * PropertyResourceBundle} is constructed with the
-         * <code>InputStream</code>.</li>
+         * {@code InputStream}.</li>
          *
-         * <li>If <code>format</code> is neither <code>"java.class"</code>
-         * nor <code>"java.properties"</code>, an
-         * <code>IllegalArgumentException</code> is thrown.</li>
+         * <li>If {@code format} is neither {@code "java.class"}
+         * nor {@code "java.properties"}, an
+         * {@code IllegalArgumentException} is thrown.</li>
          *
          * </ul>
          *
@@ -3120,36 +3120,36 @@
          * @param format
          *        the resource bundle format to be loaded
          * @param loader
-         *        the <code>ClassLoader</code> to use to load the bundle
+         *        the {@code ClassLoader} to use to load the bundle
          * @param reload
-         *        the flag to indicate bundle reloading; <code>true</code>
+         *        the flag to indicate bundle reloading; {@code true}
          *        if reloading an expired resource bundle,
-         *        <code>false</code> otherwise
+         *        {@code false} otherwise
          * @return the resource bundle instance,
-         *        or <code>null</code> if none could be found.
-         * @exception NullPointerException
-         *        if <code>bundleName</code>, <code>locale</code>,
-         *        <code>format</code>, or <code>loader</code> is
-         *        <code>null</code>, or if <code>null</code> is returned by
+         *        or {@code null} if none could be found.
+         * @throws    NullPointerException
+         *        if {@code bundleName}, {@code locale},
+         *        {@code format}, or {@code loader} is
+         *        {@code null}, or if {@code null} is returned by
          *        {@link #toBundleName(String, Locale) toBundleName}
-         * @exception IllegalArgumentException
-         *        if <code>format</code> is unknown, or if the resource
+         * @throws    IllegalArgumentException
+         *        if {@code format} is unknown, or if the resource
          *        found for the given parameters contains malformed data.
-         * @exception ClassCastException
-         *        if the loaded class cannot be cast to <code>ResourceBundle</code>
-         * @exception IllegalAccessException
+         * @throws    ClassCastException
+         *        if the loaded class cannot be cast to {@code ResourceBundle}
+         * @throws    IllegalAccessException
          *        if the class or its nullary constructor is not
          *        accessible.
-         * @exception InstantiationException
+         * @throws    InstantiationException
          *        if the instantiation of a class fails for some other
          *        reason.
-         * @exception ExceptionInInitializerError
+         * @throws    ExceptionInInitializerError
          *        if the initialization provoked by this method fails.
-         * @exception SecurityException
+         * @throws    SecurityException
          *        If a security manager is present and creation of new
          *        instances is denied. See {@link Class#newInstance()}
          *        for details.
-         * @exception IOException
+         * @throws    IOException
          *        if an error occurred when reading resources using
          *        any I/O operations
          * @see java.util.spi.ResourceBundleProvider#getBundle(String, Locale)
@@ -3256,7 +3256,7 @@
         /**
          * Returns the time-to-live (TTL) value for resource bundles that
          * are loaded under this
-         * <code>ResourceBundle.Control</code>. Positive time-to-live values
+         * {@code ResourceBundle.Control}. Positive time-to-live values
          * specify the number of milliseconds a bundle can remain in the
          * cache without being validated against the source data from which
          * it was constructed. The value 0 indicates that a bundle must be
@@ -3267,13 +3267,13 @@
          * expiration control.
          *
          * <p>The expiration affects only the bundle loading process by the
-         * <code>ResourceBundle.getBundle</code> factory method.  That is,
+         * {@code ResourceBundle.getBundle} factory method.  That is,
          * if the factory method finds a resource bundle in the cache that
          * has expired, the factory method calls the {@link
          * #needsReload(String, Locale, String, ClassLoader, ResourceBundle,
          * long) needsReload} method to determine whether the resource
-         * bundle needs to be reloaded. If <code>needsReload</code> returns
-         * <code>true</code>, the cached resource bundle instance is removed
+         * bundle needs to be reloaded. If {@code needsReload} returns
+         * {@code true}, the cached resource bundle instance is removed
          * from the cache. Otherwise, the instance stays in the cache,
          * updated with the new TTL value returned by this method.
          *
@@ -3295,9 +3295,9 @@
          *        {@link #TTL_NO_EXPIRATION_CONTROL} to disable the
          *        expiration control, or {@link #TTL_DONT_CACHE} to disable
          *        caching.
-         * @exception NullPointerException
-         *        if <code>baseName</code> or <code>locale</code> is
-         *        <code>null</code>
+         * @throws    NullPointerException
+         *        if {@code baseName} or {@code locale} is
+         *        {@code null}
          */
         public long getTimeToLive(String baseName, Locale locale) {
             if (baseName == null || locale == null) {
@@ -3307,30 +3307,30 @@
         }
 
         /**
-         * Determines if the expired <code>bundle</code> in the cache needs
+         * Determines if the expired {@code bundle} in the cache needs
          * to be reloaded based on the loading time given by
-         * <code>loadTime</code> or some other criteria. The method returns
-         * <code>true</code> if reloading is required; <code>false</code>
-         * otherwise. <code>loadTime</code> is a millisecond offset since
-         * the <a href="Calendar.html#Epoch"> <code>Calendar</code>
+         * {@code loadTime} or some other criteria. The method returns
+         * {@code true} if reloading is required; {@code false}
+         * otherwise. {@code loadTime} is a millisecond offset since
+         * the <a href="Calendar.html#Epoch"> {@code Calendar}
          * Epoch</a>.
          *
          * <p>
-         * The calling <code>ResourceBundle.getBundle</code> factory method
-         * calls this method on the <code>ResourceBundle.Control</code>
+         * The calling {@code ResourceBundle.getBundle} factory method
+         * calls this method on the {@code ResourceBundle.Control}
          * instance used for its current invocation, not on the instance
          * used in the invocation that originally loaded the resource
          * bundle.
          *
-         * <p>The default implementation compares <code>loadTime</code> and
+         * <p>The default implementation compares {@code loadTime} and
          * the last modified time of the source data of the resource
          * bundle. If it's determined that the source data has been modified
-         * since <code>loadTime</code>, <code>true</code> is
-         * returned. Otherwise, <code>false</code> is returned. This
-         * implementation assumes that the given <code>format</code> is the
+         * since {@code loadTime}, {@code true} is
+         * returned. Otherwise, {@code false} is returned. This
+         * implementation assumes that the given {@code format} is the
          * same string as its file suffix if it's not one of the default
-         * formats, <code>"java.class"</code> or
-         * <code>"java.properties"</code>.
+         * formats, {@code "java.class"} or
+         * {@code "java.properties"}.
          *
          * @param baseName
          *        the base bundle name of the resource bundle, a
@@ -3341,19 +3341,19 @@
          * @param format
          *        the resource bundle format to be loaded
          * @param loader
-         *        the <code>ClassLoader</code> to use to load the bundle
+         *        the {@code ClassLoader} to use to load the bundle
          * @param bundle
          *        the resource bundle instance that has been expired
          *        in the cache
          * @param loadTime
-         *        the time when <code>bundle</code> was loaded and put
+         *        the time when {@code bundle} was loaded and put
          *        in the cache
-         * @return <code>true</code> if the expired bundle needs to be
-         *        reloaded; <code>false</code> otherwise.
-         * @exception NullPointerException
-         *        if <code>baseName</code>, <code>locale</code>,
-         *        <code>format</code>, <code>loader</code>, or
-         *        <code>bundle</code> is <code>null</code>
+         * @return {@code true} if the expired bundle needs to be
+         *        reloaded; {@code false} otherwise.
+         * @throws    NullPointerException
+         *        if {@code baseName}, {@code locale},
+         *        {@code format}, {@code loader}, or
+         *        {@code bundle} is {@code null}
          */
         public boolean needsReload(String baseName, Locale locale,
                                    String format, ClassLoader loader,
@@ -3400,7 +3400,7 @@
         }
 
         /**
-         * Converts the given <code>baseName</code> and <code>locale</code>
+         * Converts the given {@code baseName} and {@code locale}
          * to the bundle name. This method is called from the default
          * implementation of the {@link #newBundle(String, Locale, String,
          * ClassLoader, boolean) newBundle} and {@link #needsReload(String,
@@ -3411,20 +3411,20 @@
          * <pre>
          *     baseName + "_" + language + "_" + script + "_" + country + "_" + variant
          * </pre>
-         * where <code>language</code>, <code>script</code>, <code>country</code>,
-         * and <code>variant</code> are the language, script, country, and variant
-         * values of <code>locale</code>, respectively. Final component values that
+         * where {@code language}, {@code script}, {@code country},
+         * and {@code variant} are the language, script, country, and variant
+         * values of {@code locale}, respectively. Final component values that
          * are empty Strings are omitted along with the preceding '_'.  When the
          * script is empty, the script value is omitted along with the preceding '_'.
-         * If all of the values are empty strings, then <code>baseName</code>
+         * If all of the values are empty strings, then {@code baseName}
          * is returned.
          *
-         * <p>For example, if <code>baseName</code> is
-         * <code>"baseName"</code> and <code>locale</code> is
+         * <p>For example, if {@code baseName} is
+         * {@code "baseName"} and {@code locale} is
          * <code>Locale("ja",&nbsp;"",&nbsp;"XX")</code>, then
          * <code>"baseName_ja_&thinsp;_XX"</code> is returned. If the given
-         * locale is <code>Locale("en")</code>, then
-         * <code>"baseName_en"</code> is returned.
+         * locale is {@code Locale("en")}, then
+         * {@code "baseName_en"} is returned.
          *
          * <p>Overriding this method allows applications to use different
          * conventions in the organization and packaging of localized
@@ -3437,9 +3437,9 @@
          *        the locale for which a resource bundle should be
          *        loaded
          * @return the bundle name for the resource bundle
-         * @exception NullPointerException
-         *        if <code>baseName</code> or <code>locale</code>
-         *        is <code>null</code>
+         * @throws    NullPointerException
+         *        if {@code baseName} or {@code locale}
+         *        is {@code null}
          * @see java.util.spi.AbstractResourceBundleProvider#toBundleName(String, Locale)
          */
         public String toBundleName(String baseName, Locale locale) {
@@ -3495,7 +3495,7 @@
          * @param suffix
          *        the file type suffix
          * @return the converted resource name
-         * @exception NullPointerException
+         * @throws    NullPointerException
          *         if {@code bundleName} or {@code suffix}
          *         is {@code null}
          */
--- a/src/java.base/share/classes/java/util/SimpleTimeZone.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/SimpleTimeZone.java	Tue Sep 24 15:19:35 2019 -0400
@@ -48,7 +48,7 @@
 import sun.util.calendar.Gregorian;
 
 /**
- * <code>SimpleTimeZone</code> is a concrete subclass of <code>TimeZone</code>
+ * {@code SimpleTimeZone} is a concrete subclass of {@code TimeZone}
  * that represents a time zone for use with a Gregorian calendar.
  * The class holds an offset from GMT, called <em>raw offset</em>, and start
  * and end rules for a daylight saving time schedule.  Since it only holds
@@ -57,7 +57,7 @@
  * #setStartYear setStartYear} method can specify the year when the daylight
  * saving time schedule starts in effect.
  * <p>
- * To construct a <code>SimpleTimeZone</code> with a daylight saving time
+ * To construct a {@code SimpleTimeZone} with a daylight saving time
  * schedule, the schedule can be described with a set of rules,
  * <em>start-rule</em> and <em>end-rule</em>. A day when daylight saving time
  * starts or ends is specified by a combination of <em>month</em>,
@@ -81,7 +81,7 @@
  * or after which the rule is applied, and <em>day-of-week</em> to a negative {@link
  * Calendar#DAY_OF_WEEK DAY_OF_WEEK} field value. For example, to specify the
  * second Sunday of April, set <em>month</em> to {@link Calendar#APRIL APRIL},
- * <em>day-of-month</em> to 8, and <em>day-of-week</em> to <code>-</code>{@link
+ * <em>day-of-month</em> to 8, and <em>day-of-week</em> to {@code -}{@link
  * Calendar#SUNDAY SUNDAY}.</li>
  *
  * <li><b>Day of week on or before day of month</b><br>
@@ -89,7 +89,7 @@
  * <em>day-of-month</em> and <em>day-of-week</em> to a negative value. For
  * example, to specify the last Wednesday on or before the 21st of March, set
  * <em>month</em> to {@link Calendar#MARCH MARCH}, <em>day-of-month</em> is -21
- * and <em>day-of-week</em> is <code>-</code>{@link Calendar#WEDNESDAY WEDNESDAY}. </li>
+ * and <em>day-of-week</em> is {@code -}{@link Calendar#WEDNESDAY WEDNESDAY}. </li>
  *
  * <li><b>Last day-of-week of month</b><br>
  * To specify, the last day-of-week of the month, set <em>day-of-week</em> to a
@@ -139,7 +139,7 @@
  *                     3600000)
  * </code></pre>
  * These parameter rules are also applicable to the set rule methods, such as
- * <code>setStartRule</code>.
+ * {@code setStartRule}.
  *
  * @since 1.1
  * @see      Calendar
@@ -167,7 +167,7 @@
      * Constructs a SimpleTimeZone with the given base time zone offset from
      * GMT, time zone ID, and rules for starting and ending the daylight
      * time.
-     * Both <code>startTime</code> and <code>endTime</code> are specified to be
+     * Both {@code startTime} and {@code endTime} are specified to be
      * represented in the wall clock time. The amount of daylight saving is
      * assumed to be 3600000 milliseconds (i.e., one hour). This constructor is
      * equivalent to:
@@ -209,7 +209,7 @@
      * @param endTime         The daylight saving ending time in local wall clock time,
      *                        (in milliseconds within the day) which is local daylight
      *                        time in this case.
-     * @exception IllegalArgumentException if the month, day, dayOfWeek, or time
+     * @throws    IllegalArgumentException if the month, day, dayOfWeek, or time
      * parameters are out of range for the start or end rule
      */
     public SimpleTimeZone(int rawOffset, String ID,
@@ -226,7 +226,7 @@
      * Constructs a SimpleTimeZone with the given base time zone offset from
      * GMT, time zone ID, and rules for starting and ending the daylight
      * time.
-     * Both <code>startTime</code> and <code>endTime</code> are assumed to be
+     * Both {@code startTime} and {@code endTime} are assumed to be
      * represented in the wall clock time. This constructor is equivalent to:
      * <pre><code>
      *     SimpleTimeZone(rawOffset,
@@ -266,7 +266,7 @@
      *                        which is local daylight time in this case.
      * @param dstSavings      The amount of time in milliseconds saved during
      *                        daylight saving time.
-     * @exception IllegalArgumentException if the month, day, dayOfWeek, or time
+     * @throws    IllegalArgumentException if the month, day, dayOfWeek, or time
      * parameters are out of range for the start or end rule
      * @since 1.2
      */
@@ -286,8 +286,8 @@
      * GMT, time zone ID, and rules for starting and ending the daylight
      * time.
      * This constructor takes the full set of the start and end rules
-     * parameters, including modes of <code>startTime</code> and
-     * <code>endTime</code>. The mode specifies either {@link #WALL_TIME wall
+     * parameters, including modes of {@code startTime} and
+     * {@code endTime}. The mode specifies either {@link #WALL_TIME wall
      * time} or {@link #STANDARD_TIME standard time} or {@link #UTC_TIME UTC
      * time}.
      *
@@ -301,7 +301,7 @@
      * @param startDayOfWeek  The daylight saving time starting day-of-week.
      *                        See the class description for the special cases of this parameter.
      * @param startTime       The daylight saving time starting time in the time mode
-     *                        specified by <code>startTimeMode</code>.
+     *                        specified by {@code startTimeMode}.
      * @param startTimeMode   The mode of the start time specified by startTime.
      * @param endMonth        The daylight saving time ending month. Month is
      *                        a {@link Calendar#MONTH MONTH} field
@@ -311,12 +311,12 @@
      * @param endDayOfWeek    The daylight saving time ending day-of-week.
      *                        See the class description for the special cases of this parameter.
      * @param endTime         The daylight saving ending time in time mode
-     *                        specified by <code>endTimeMode</code>.
+     *                        specified by {@code endTimeMode}.
      * @param endTimeMode     The mode of the end time specified by endTime
      * @param dstSavings      The amount of time in milliseconds saved during
      *                        daylight saving time.
      *
-     * @exception IllegalArgumentException if the month, day, dayOfWeek, time more, or
+     * @throws    IllegalArgumentException if the month, day, dayOfWeek, time more, or
      * time parameters are out of range for the start or end rule, or if a time mode
      * value is invalid.
      *
@@ -369,7 +369,7 @@
      * Sets the daylight saving time start rule. For example, if daylight saving
      * time starts on the first Sunday in April at 2 am in local wall clock
      * time, you can set the start rule by calling:
-     * <pre><code>setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2*60*60*1000);</code></pre>
+     * <pre>{@code setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2*60*60*1000);}</pre>
      *
      * @param startMonth      The daylight saving time starting month. Month is
      *                        a {@link Calendar#MONTH MONTH} field
@@ -380,8 +380,8 @@
      *                        See the class description for the special cases of this parameter.
      * @param startTime       The daylight saving time starting time in local wall clock
      *                        time, which is local standard time in this case.
-     * @exception IllegalArgumentException if the <code>startMonth</code>, <code>startDay</code>,
-     * <code>startDayOfWeek</code>, or <code>startTime</code> parameters are out of range
+     * @throws    IllegalArgumentException if the {@code startMonth}, {@code startDay},
+     * {@code startDayOfWeek}, or {@code startTime} parameters are out of range
      */
     public void setStartRule(int startMonth, int startDay, int startDayOfWeek, int startTime)
     {
@@ -397,7 +397,7 @@
     /**
      * Sets the daylight saving time start rule to a fixed date within a month.
      * This method is equivalent to:
-     * <pre><code>setStartRule(startMonth, startDay, 0, startTime)</code></pre>
+     * <pre>{@code setStartRule(startMonth, startDay, 0, startTime)}</pre>
      *
      * @param startMonth      The daylight saving time starting month. Month is
      *                        a {@link Calendar#MONTH MONTH} field
@@ -406,8 +406,8 @@
      * @param startTime       The daylight saving time starting time in local wall clock
      *                        time, which is local standard time in this case.
      *                        See the class description for the special cases of this parameter.
-     * @exception IllegalArgumentException if the <code>startMonth</code>,
-     * <code>startDayOfMonth</code>, or <code>startTime</code> parameters are out of range
+     * @throws    IllegalArgumentException if the {@code startMonth},
+     * {@code startDayOfMonth}, or {@code startTime} parameters are out of range
      * @since 1.2
      */
     public void setStartRule(int startMonth, int startDay, int startTime) {
@@ -425,12 +425,12 @@
      * @param startDayOfWeek  The daylight saving time starting day-of-week.
      * @param startTime       The daylight saving time starting time in local wall clock
      *                        time, which is local standard time in this case.
-     * @param after           If true, this rule selects the first <code>dayOfWeek</code> on or
-     *                        <em>after</em> <code>dayOfMonth</code>.  If false, this rule
-     *                        selects the last <code>dayOfWeek</code> on or <em>before</em>
-     *                        <code>dayOfMonth</code>.
-     * @exception IllegalArgumentException if the <code>startMonth</code>, <code>startDay</code>,
-     * <code>startDayOfWeek</code>, or <code>startTime</code> parameters are out of range
+     * @param after           If true, this rule selects the first {@code dayOfWeek} on or
+     *                        <em>after</em> {@code dayOfMonth}.  If false, this rule
+     *                        selects the last {@code dayOfWeek} on or <em>before</em>
+     *                        {@code dayOfMonth}.
+     * @throws    IllegalArgumentException if the {@code startMonth}, {@code startDay},
+     * {@code startDayOfWeek}, or {@code startTime} parameters are out of range
      * @since 1.2
      */
     public void setStartRule(int startMonth, int startDay, int startDayOfWeek,
@@ -448,7 +448,7 @@
      * Sets the daylight saving time end rule. For example, if daylight saving time
      * ends on the last Sunday in October at 2 am in wall clock time,
      * you can set the end rule by calling:
-     * <code>setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2*60*60*1000);</code>
+     * {@code setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2*60*60*1000);}
      *
      * @param endMonth        The daylight saving time ending month. Month is
      *                        a {@link Calendar#MONTH MONTH} field
@@ -460,8 +460,8 @@
      * @param endTime         The daylight saving ending time in local wall clock time,
      *                        (in milliseconds within the day) which is local daylight
      *                        time in this case.
-     * @exception IllegalArgumentException if the <code>endMonth</code>, <code>endDay</code>,
-     * <code>endDayOfWeek</code>, or <code>endTime</code> parameters are out of range
+     * @throws    IllegalArgumentException if the {@code endMonth}, {@code endDay},
+     * {@code endDayOfWeek}, or {@code endTime} parameters are out of range
      */
     public void setEndRule(int endMonth, int endDay, int endDayOfWeek,
                            int endTime)
@@ -478,7 +478,7 @@
     /**
      * Sets the daylight saving time end rule to a fixed date within a month.
      * This method is equivalent to:
-     * <pre><code>setEndRule(endMonth, endDay, 0, endTime)</code></pre>
+     * <pre>{@code setEndRule(endMonth, endDay, 0, endTime)}</pre>
      *
      * @param endMonth        The daylight saving time ending month. Month is
      *                        a {@link Calendar#MONTH MONTH} field
@@ -487,8 +487,8 @@
      * @param endTime         The daylight saving ending time in local wall clock time,
      *                        (in milliseconds within the day) which is local daylight
      *                        time in this case.
-     * @exception IllegalArgumentException the <code>endMonth</code>, <code>endDay</code>,
-     * or <code>endTime</code> parameters are out of range
+     * @throws    IllegalArgumentException the {@code endMonth}, {@code endDay},
+     * or {@code endTime} parameters are out of range
      * @since 1.2
      */
     public void setEndRule(int endMonth, int endDay, int endTime)
@@ -508,12 +508,12 @@
      * @param endTime         The daylight saving ending time in local wall clock time,
      *                        (in milliseconds within the day) which is local daylight
      *                        time in this case.
-     * @param after           If true, this rule selects the first <code>endDayOfWeek</code> on
-     *                        or <em>after</em> <code>endDay</code>.  If false, this rule
-     *                        selects the last <code>endDayOfWeek</code> on or before
-     *                        <code>endDay</code> of the month.
-     * @exception IllegalArgumentException the <code>endMonth</code>, <code>endDay</code>,
-     * <code>endDayOfWeek</code>, or <code>endTime</code> parameters are out of range
+     * @param after           If true, this rule selects the first {@code endDayOfWeek} on
+     *                        or <em>after</em> {@code endDay}.  If false, this rule
+     *                        selects the last {@code endDayOfWeek} on or before
+     *                        {@code endDay} of the month.
+     * @throws    IllegalArgumentException the {@code endMonth}, {@code endDay},
+     * {@code endDayOfWeek}, or {@code endTime} parameters are out of range
      * @since 1.2
      */
     public void setEndRule(int endMonth, int endDay, int endDayOfWeek, int endTime, boolean after)
@@ -583,10 +583,10 @@
      * uses a default {@link GregorianCalendar} object as its
      * underlying calendar, such as for determining leap years.  Do
      * not use the result of this method with a calendar other than a
-     * default <code>GregorianCalendar</code>.
+     * default {@code GregorianCalendar}.
      *
      * <p><em>Note:  In general, clients should use
-     * <code>Calendar.get(ZONE_OFFSET) + Calendar.get(DST_OFFSET)</code>
+     * {@code Calendar.get(ZONE_OFFSET) + Calendar.get(DST_OFFSET)}
      * instead of calling this method.</em>
      *
      * @param era       The era of the given date.
@@ -597,9 +597,9 @@
      * @param dayOfWeek The day-of-week of the given date.
      * @param millis    The milliseconds in day in <em>standard</em> local time.
      * @return          The milliseconds to add to UTC to get local time.
-     * @exception       IllegalArgumentException the <code>era</code>,
-     *                  <code>month</code>, <code>day</code>, <code>dayOfWeek</code>,
-     *                  or <code>millis</code> parameters are out of range
+     * @throws          IllegalArgumentException the {@code era},
+     *                  {@code month}, {@code day}, {@code dayOfWeek},
+     *                  or {@code millis} parameters are out of range
      */
     public int getOffset(int era, int year, int month, int day, int dayOfWeek,
                          int millis)
@@ -853,7 +853,7 @@
     }
 
     /**
-     * Returns a clone of this <code>SimpleTimeZone</code> instance.
+     * Returns a clone of this {@code SimpleTimeZone} instance.
      * @return a clone of this instance.
      */
     public Object clone()
@@ -872,11 +872,11 @@
     }
 
     /**
-     * Compares the equality of two <code>SimpleTimeZone</code> objects.
+     * Compares the equality of two {@code SimpleTimeZone} objects.
      *
-     * @param obj  The <code>SimpleTimeZone</code> object to be compared with.
-     * @return     True if the given <code>obj</code> is the same as this
-     *             <code>SimpleTimeZone</code> object; false otherwise.
+     * @param obj  The {@code SimpleTimeZone} object to be compared with.
+     * @return     True if the given {@code obj} is the same as this
+     *             {@code SimpleTimeZone} object; false otherwise.
      */
     public boolean equals(Object obj)
     {
@@ -894,9 +894,9 @@
     }
 
     /**
-     * Returns <code>true</code> if this zone has the same rules and offset as another zone.
+     * Returns {@code true} if this zone has the same rules and offset as another zone.
      * @param other the TimeZone object to be compared with
-     * @return <code>true</code> if the given zone is a SimpleTimeZone and has the
+     * @return {@code true} if the given zone is a SimpleTimeZone and has the
      * same rules and offset as this one
      * @since 1.2
      */
@@ -957,10 +957,10 @@
 
     /**
      * The month in which daylight saving time starts.  This value must be
-     * between <code>Calendar.JANUARY</code> and
-     * <code>Calendar.DECEMBER</code> inclusive.  This value must not equal
-     * <code>endMonth</code>.
-     * <p>If <code>useDaylight</code> is false, this value is ignored.
+     * between {@code Calendar.JANUARY} and
+     * {@code Calendar.DECEMBER} inclusive.  This value must not equal
+     * {@code endMonth}.
+     * <p>If {@code useDaylight} is false, this value is ignored.
      * @serial
      */
     private int startMonth;
@@ -968,34 +968,34 @@
     /**
      * This field has two possible interpretations:
      * <dl>
-     * <dt><code>startMode == DOW_IN_MONTH</code></dt>
+     * <dt>{@code startMode == DOW_IN_MONTH}</dt>
      * <dd>
-     * <code>startDay</code> indicates the day of the month of
-     * <code>startMonth</code> on which daylight
+     * {@code startDay} indicates the day of the month of
+     * {@code startMonth} on which daylight
      * saving time starts, from 1 to 28, 30, or 31, depending on the
-     * <code>startMonth</code>.
+     * {@code startMonth}.
      * </dd>
-     * <dt><code>startMode != DOW_IN_MONTH</code></dt>
+     * <dt>{@code startMode != DOW_IN_MONTH}</dt>
      * <dd>
-     * <code>startDay</code> indicates which <code>startDayOfWeek</code> in the
-     * month <code>startMonth</code> daylight
+     * {@code startDay} indicates which {@code startDayOfWeek} in the
+     * month {@code startMonth} daylight
      * saving time starts on.  For example, a value of +1 and a
-     * <code>startDayOfWeek</code> of <code>Calendar.SUNDAY</code> indicates the
-     * first Sunday of <code>startMonth</code>.  Likewise, +2 would indicate the
+     * {@code startDayOfWeek} of {@code Calendar.SUNDAY} indicates the
+     * first Sunday of {@code startMonth}.  Likewise, +2 would indicate the
      * second Sunday, and -1 the last Sunday.  A value of 0 is illegal.
      * </dd>
      * </dl>
-     * <p>If <code>useDaylight</code> is false, this value is ignored.
+     * <p>If {@code useDaylight} is false, this value is ignored.
      * @serial
      */
     private int startDay;
 
     /**
      * The day of the week on which daylight saving time starts.  This value
-     * must be between <code>Calendar.SUNDAY</code> and
-     * <code>Calendar.SATURDAY</code> inclusive.
-     * <p>If <code>useDaylight</code> is false or
-     * <code>startMode == DAY_OF_MONTH</code>, this value is ignored.
+     * must be between {@code Calendar.SUNDAY} and
+     * {@code Calendar.SATURDAY} inclusive.
+     * <p>If {@code useDaylight} is false or
+     * {@code startMode == DAY_OF_MONTH}, this value is ignored.
      * @serial
      */
     private int startDayOfWeek;
@@ -1003,8 +1003,8 @@
     /**
      * The time in milliseconds after midnight at which daylight saving
      * time starts.  This value is expressed as wall time, standard time,
-     * or UTC time, depending on the setting of <code>startTimeMode</code>.
-     * <p>If <code>useDaylight</code> is false, this value is ignored.
+     * or UTC time, depending on the setting of {@code startTimeMode}.
+     * <p>If {@code useDaylight} is false, this value is ignored.
      * @serial
      */
     private int startTime;
@@ -1018,10 +1018,10 @@
 
     /**
      * The month in which daylight saving time ends.  This value must be
-     * between <code>Calendar.JANUARY</code> and
-     * <code>Calendar.UNDECIMBER</code>.  This value must not equal
-     * <code>startMonth</code>.
-     * <p>If <code>useDaylight</code> is false, this value is ignored.
+     * between {@code Calendar.JANUARY} and
+     * {@code Calendar.UNDECIMBER}.  This value must not equal
+     * {@code startMonth}.
+     * <p>If {@code useDaylight} is false, this value is ignored.
      * @serial
      */
     private int endMonth;
@@ -1029,34 +1029,34 @@
     /**
      * This field has two possible interpretations:
      * <dl>
-     * <dt><code>endMode == DOW_IN_MONTH</code></dt>
+     * <dt>{@code endMode == DOW_IN_MONTH}</dt>
      * <dd>
-     * <code>endDay</code> indicates the day of the month of
-     * <code>endMonth</code> on which daylight
+     * {@code endDay} indicates the day of the month of
+     * {@code endMonth} on which daylight
      * saving time ends, from 1 to 28, 30, or 31, depending on the
-     * <code>endMonth</code>.
+     * {@code endMonth}.
      * </dd>
-     * <dt><code>endMode != DOW_IN_MONTH</code></dt>
+     * <dt>{@code endMode != DOW_IN_MONTH}</dt>
      * <dd>
-     * <code>endDay</code> indicates which <code>endDayOfWeek</code> in th
-     * month <code>endMonth</code> daylight
+     * {@code endDay} indicates which {@code endDayOfWeek} in th
+     * month {@code endMonth} daylight
      * saving time ends on.  For example, a value of +1 and a
-     * <code>endDayOfWeek</code> of <code>Calendar.SUNDAY</code> indicates the
-     * first Sunday of <code>endMonth</code>.  Likewise, +2 would indicate the
+     * {@code endDayOfWeek} of {@code Calendar.SUNDAY} indicates the
+     * first Sunday of {@code endMonth}.  Likewise, +2 would indicate the
      * second Sunday, and -1 the last Sunday.  A value of 0 is illegal.
      * </dd>
      * </dl>
-     * <p>If <code>useDaylight</code> is false, this value is ignored.
+     * <p>If {@code useDaylight} is false, this value is ignored.
      * @serial
      */
     private int endDay;
 
     /**
      * The day of the week on which daylight saving time ends.  This value
-     * must be between <code>Calendar.SUNDAY</code> and
-     * <code>Calendar.SATURDAY</code> inclusive.
-     * <p>If <code>useDaylight</code> is false or
-     * <code>endMode == DAY_OF_MONTH</code>, this value is ignored.
+     * must be between {@code Calendar.SUNDAY} and
+     * {@code Calendar.SATURDAY} inclusive.
+     * <p>If {@code useDaylight} is false or
+     * {@code endMode == DAY_OF_MONTH}, this value is ignored.
      * @serial
      */
     private int endDayOfWeek;
@@ -1064,15 +1064,15 @@
     /**
      * The time in milliseconds after midnight at which daylight saving
      * time ends.  This value is expressed as wall time, standard time,
-     * or UTC time, depending on the setting of <code>endTimeMode</code>.
-     * <p>If <code>useDaylight</code> is false, this value is ignored.
+     * or UTC time, depending on the setting of {@code endTimeMode}.
+     * <p>If {@code useDaylight} is false, this value is ignored.
      * @serial
      */
     private int endTime;
 
     /**
-     * The format of endTime, either <code>WALL_TIME</code>,
-     * <code>STANDARD_TIME</code>, or <code>UTC_TIME</code>.
+     * The format of endTime, either {@code WALL_TIME},
+     * {@code STANDARD_TIME}, or {@code UTC_TIME}.
      * @serial
      * @since 1.3
      */
@@ -1081,8 +1081,8 @@
     /**
      * The year in which daylight saving time is first observed.  This is an {@link GregorianCalendar#AD AD}
      * value.  If this value is less than 1 then daylight saving time is observed
-     * for all <code>AD</code> years.
-     * <p>If <code>useDaylight</code> is false, this value is ignored.
+     * for all {@code AD} years.
+     * <p>If {@code useDaylight} is false, this value is ignored.
      * @serial
      */
     private int startYear;
@@ -1091,7 +1091,7 @@
      * The offset in milliseconds between this zone and GMT.  Negative offsets
      * are to the west of Greenwich.  To obtain local <em>standard</em> time,
      * add the offset to GMT time.  To obtain local wall time it may also be
-     * necessary to add <code>dstSavings</code>.
+     * necessary to add {@code dstSavings}.
      * @serial
      */
     private int rawOffset;
@@ -1122,26 +1122,26 @@
      * Variables specifying the mode of the start rule.  Takes the following
      * values:
      * <dl>
-     * <dt><code>DOM_MODE</code></dt>
+     * <dt>{@code DOM_MODE}</dt>
      * <dd>
      * Exact day of week; e.g., March 1.
      * </dd>
-     * <dt><code>DOW_IN_MONTH_MODE</code></dt>
+     * <dt>{@code DOW_IN_MONTH_MODE}</dt>
      * <dd>
      * Day of week in month; e.g., last Sunday in March.
      * </dd>
-     * <dt><code>DOW_GE_DOM_MODE</code></dt>
+     * <dt>{@code DOW_GE_DOM_MODE}</dt>
      * <dd>
      * Day of week after day of month; e.g., Sunday on or after March 15.
      * </dd>
-     * <dt><code>DOW_LE_DOM_MODE</code></dt>
+     * <dt>{@code DOW_LE_DOM_MODE}</dt>
      * <dd>
      * Day of week before day of month; e.g., Sunday on or before March 15.
      * </dd>
      * </dl>
      * The setting of this field affects the interpretation of the
-     * <code>startDay</code> field.
-     * <p>If <code>useDaylight</code> is false, this value is ignored.
+     * {@code startDay} field.
+     * <p>If {@code useDaylight} is false, this value is ignored.
      * @serial
      * @since 1.1.4
      */
@@ -1151,26 +1151,26 @@
      * Variables specifying the mode of the end rule.  Takes the following
      * values:
      * <dl>
-     * <dt><code>DOM_MODE</code></dt>
+     * <dt>{@code DOM_MODE}</dt>
      * <dd>
      * Exact day of week; e.g., March 1.
      * </dd>
-     * <dt><code>DOW_IN_MONTH_MODE</code></dt>
+     * <dt>{@code DOW_IN_MONTH_MODE}</dt>
      * <dd>
      * Day of week in month; e.g., last Sunday in March.
      * </dd>
-     * <dt><code>DOW_GE_DOM_MODE</code></dt>
+     * <dt>{@code DOW_GE_DOM_MODE}</dt>
      * <dd>
      * Day of week after day of month; e.g., Sunday on or after March 15.
      * </dd>
-     * <dt><code>DOW_LE_DOM_MODE</code></dt>
+     * <dt>{@code DOW_LE_DOM_MODE}</dt>
      * <dd>
      * Day of week before day of month; e.g., Sunday on or before March 15.
      * </dd>
      * </dl>
      * The setting of this field affects the interpretation of the
-     * <code>endDay</code> field.
-     * <p>If <code>useDaylight</code> is false, this value is ignored.
+     * {@code endDay} field.
+     * <p>If {@code useDaylight} is false, this value is ignored.
      * @serial
      * @since 1.1.4
      */
@@ -1180,7 +1180,7 @@
      * A positive value indicating the amount of time saved during DST in
      * milliseconds.
      * Typically one hour (3600000); sometimes 30 minutes (1800000).
-     * <p>If <code>useDaylight</code> is false, this value is ignored.
+     * <p>If {@code useDaylight} is false, this value is ignored.
      * @serial
      * @since 1.1.4
      */
@@ -1260,17 +1260,17 @@
      * </dd>
      * <dt><b>1</b></dt>
      * <dd>
-     * JDK 1.1.4 or later.  Includes three new fields: <code>startMode</code>,
-     * <code>endMode</code>, and <code>dstSavings</code>.
+     * JDK 1.1.4 or later.  Includes three new fields: {@code startMode},
+     * {@code endMode}, and {@code dstSavings}.
      * </dd>
      * <dt><b>2</b></dt>
      * <dd>
-     * JDK 1.3 or later.  Includes two new fields: <code>startTimeMode</code>
-     * and <code>endTimeMode</code>.
+     * JDK 1.3 or later.  Includes two new fields: {@code startTimeMode}
+     * and {@code endTimeMode}.
      * </dd>
      * </dl>
      * When streaming out this class, the most recent format
-     * and the highest allowable <code>serialVersionOnStream</code>
+     * and the highest allowable {@code serialVersionOnStream}
      * is written.
      * @serial
      * @since 1.1.4
@@ -1625,16 +1625,16 @@
      * Save the state of this object to a stream (i.e., serialize it).
      *
      * @serialData We write out two formats, a JDK 1.1 compatible format, using
-     * <code>DOW_IN_MONTH_MODE</code> rules, in the required section, followed
+     * {@code DOW_IN_MONTH_MODE} rules, in the required section, followed
      * by the full rules, in packed format, in the optional section.  The
      * optional section will be ignored by JDK 1.1 code upon stream in.
      * <p> Contents of the optional section: The length of a byte array is
      * emitted (int); this is 4 as of this release. The byte array of the given
      * length is emitted. The contents of the byte array are the true values of
-     * the fields <code>startDay</code>, <code>startDayOfWeek</code>,
-     * <code>endDay</code>, and <code>endDayOfWeek</code>.  The values of these
+     * the fields {@code startDay}, {@code startDayOfWeek},
+     * {@code endDay}, and {@code endDayOfWeek}.  The values of these
      * fields in the required section are approximate values suited to the rule
-     * mode <code>DOW_IN_MONTH_MODE</code>, which is the only mode recognized by
+     * mode {@code DOW_IN_MONTH_MODE}, which is the only mode recognized by
      * JDK 1.1.
      */
     @java.io.Serial
--- a/src/java.base/share/classes/java/util/StringTokenizer.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/StringTokenizer.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -189,7 +189,7 @@
      * @param   delim          the delimiters.
      * @param   returnDelims   flag indicating whether to return the delimiters
      *                         as tokens.
-     * @exception NullPointerException if str is {@code null}
+     * @throws    NullPointerException if str is {@code null}
      */
     public StringTokenizer(String str, String delim, boolean returnDelims) {
         currentPosition = 0;
@@ -215,7 +215,7 @@
      *
      * @param   str     a string to be parsed.
      * @param   delim   the delimiters.
-     * @exception NullPointerException if str is {@code null}
+     * @throws    NullPointerException if str is {@code null}
      */
     public StringTokenizer(String str, String delim) {
         this(str, delim, false);
@@ -230,7 +230,7 @@
      * not be treated as tokens.
      *
      * @param   str   a string to be parsed.
-     * @exception NullPointerException if str is {@code null}
+     * @throws    NullPointerException if str is {@code null}
      */
     public StringTokenizer(String str) {
         this(str, " \t\n\r\f", false);
@@ -328,7 +328,7 @@
      * Returns the next token from this string tokenizer.
      *
      * @return     the next token from this string tokenizer.
-     * @exception  NoSuchElementException  if there are no more tokens in this
+     * @throws     NoSuchElementException  if there are no more tokens in this
      *               tokenizer's string.
      */
     public String nextToken() {
@@ -363,9 +363,9 @@
      *
      * @param      delim   the new delimiters.
      * @return     the next token, after switching to the new delimiter set.
-     * @exception  NoSuchElementException  if there are no more tokens in this
+     * @throws     NoSuchElementException  if there are no more tokens in this
      *               tokenizer's string.
-     * @exception NullPointerException if delim is {@code null}
+     * @throws    NullPointerException if delim is {@code null}
      */
     public String nextToken(String delim) {
         delimiters = delim;
@@ -398,7 +398,7 @@
      * {@code Enumeration} interface.
      *
      * @return     the next token in the string.
-     * @exception  NoSuchElementException  if there are no more tokens in this
+     * @throws     NoSuchElementException  if there are no more tokens in this
      *               tokenizer's string.
      * @see        java.util.Enumeration
      * @see        java.util.StringTokenizer#nextToken()
--- a/src/java.base/share/classes/java/util/TimeZone.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/TimeZone.java	Tue Sep 24 15:19:35 2019 -0400
@@ -48,44 +48,44 @@
 import sun.util.locale.provider.TimeZoneNameUtility;
 
 /**
- * <code>TimeZone</code> represents a time zone offset, and also figures out daylight
+ * {@code TimeZone} represents a time zone offset, and also figures out daylight
  * savings.
  *
  * <p>
- * Typically, you get a <code>TimeZone</code> using <code>getDefault</code>
- * which creates a <code>TimeZone</code> based on the time zone where the program
- * is running. For example, for a program running in Japan, <code>getDefault</code>
- * creates a <code>TimeZone</code> object based on Japanese Standard Time.
+ * Typically, you get a {@code TimeZone} using {@code getDefault}
+ * which creates a {@code TimeZone} based on the time zone where the program
+ * is running. For example, for a program running in Japan, {@code getDefault}
+ * creates a {@code TimeZone} object based on Japanese Standard Time.
  *
  * <p>
- * You can also get a <code>TimeZone</code> using <code>getTimeZone</code>
+ * You can also get a {@code TimeZone} using {@code getTimeZone}
  * along with a time zone ID. For instance, the time zone ID for the
  * U.S. Pacific Time zone is "America/Los_Angeles". So, you can get a
- * U.S. Pacific Time <code>TimeZone</code> object with:
+ * U.S. Pacific Time {@code TimeZone} object with:
  * <blockquote><pre>
  * TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");
  * </pre></blockquote>
- * You can use the <code>getAvailableIDs</code> method to iterate through
+ * You can use the {@code getAvailableIDs} method to iterate through
  * all the supported time zone IDs. You can then choose a
- * supported ID to get a <code>TimeZone</code>.
+ * supported ID to get a {@code TimeZone}.
  * If the time zone you want is not represented by one of the
  * supported IDs, then a custom time zone ID can be specified to
  * produce a TimeZone. The syntax of a custom time zone ID is:
  *
  * <blockquote><pre>
  * <a id="CustomID"><i>CustomID:</i></a>
- *         <code>GMT</code> <i>Sign</i> <i>Hours</i> <code>:</code> <i>Minutes</i>
- *         <code>GMT</code> <i>Sign</i> <i>Hours</i> <i>Minutes</i>
- *         <code>GMT</code> <i>Sign</i> <i>Hours</i>
+ *         {@code GMT} <i>Sign</i> <i>Hours</i> {@code :} <i>Minutes</i>
+ *         {@code GMT} <i>Sign</i> <i>Hours</i> <i>Minutes</i>
+ *         {@code GMT} <i>Sign</i> <i>Hours</i>
  * <i>Sign:</i> one of
- *         <code>+ -</code>
+ *         {@code + -}
  * <i>Hours:</i>
  *         <i>Digit</i>
  *         <i>Digit</i> <i>Digit</i>
  * <i>Minutes:</i>
  *         <i>Digit</i> <i>Digit</i>
  * <i>Digit:</i> one of
- *         <code>0 1 2 3 4 5 6 7 8 9</code>
+ *         {@code 0 1 2 3 4 5 6 7 8 9}
  * </pre></blockquote>
  *
  * <i>Hours</i> must be between 0 to 23 and <i>Minutes</i> must be
@@ -95,22 +95,22 @@
  * The format is locale independent and digits must be taken from the
  * Basic Latin block of the Unicode standard. No daylight saving time
  * transition schedule can be specified with a custom time zone ID. If
- * the specified string doesn't match the syntax, <code>"GMT"</code>
+ * the specified string doesn't match the syntax, {@code "GMT"}
  * is used.
  * <p>
- * When creating a <code>TimeZone</code>, the specified custom time
+ * When creating a {@code TimeZone}, the specified custom time
  * zone ID is normalized in the following syntax:
  * <blockquote><pre>
  * <a id="NormalizedCustomID"><i>NormalizedCustomID:</i></a>
- *         <code>GMT</code> <i>Sign</i> <i>TwoDigitHours</i> <code>:</code> <i>Minutes</i>
+ *         {@code GMT} <i>Sign</i> <i>TwoDigitHours</i> {@code :} <i>Minutes</i>
  * <i>Sign:</i> one of
- *         <code>+ -</code>
+ *         {@code + -}
  * <i>TwoDigitHours:</i>
  *         <i>Digit</i> <i>Digit</i>
  * <i>Minutes:</i>
  *         <i>Digit</i> <i>Digit</i>
  * <i>Digit:</i> one of
- *         <code>0 1 2 3 4 5 6 7 8 9</code>
+ *         {@code 0 1 2 3 4 5 6 7 8 9}
  * </pre></blockquote>
  * For example, TimeZone.getTimeZone("GMT-8").getID() returns "GMT-08:00".
  *
@@ -139,7 +139,7 @@
     }
 
     /**
-     * A style specifier for <code>getDisplayName()</code> indicating
+     * A style specifier for {@code getDisplayName()} indicating
      * a short name, such as "PST."
      * @see #LONG
      * @since 1.2
@@ -147,7 +147,7 @@
     public static final int SHORT = 0;
 
     /**
-     * A style specifier for <code>getDisplayName()</code> indicating
+     * A style specifier for {@code getDisplayName()} indicating
      * a long name, such as "Pacific Standard Time."
      * @see #SHORT
      * @since 1.2
@@ -168,7 +168,7 @@
      * daylight savings. This is the offset to add to UTC to get local time.
      * <p>
      * This method returns a historically correct offset if an
-     * underlying <code>TimeZone</code> implementation subclass
+     * underlying {@code TimeZone} implementation subclass
      * supports historical Daylight Saving Time schedule and GMT
      * offset changes.
      *
@@ -246,7 +246,7 @@
      * Sets the base time zone offset to GMT.
      * This is the offset to add to UTC to get local time.
      * <p>
-     * If an underlying <code>TimeZone</code> implementation subclass
+     * If an underlying {@code TimeZone} implementation subclass
      * supports historical GMT offset changes, the specified GMT
      * offset is set as the latest GMT offset and the difference from
      * the known latest GMT offset value is used to adjust all
@@ -262,7 +262,7 @@
      * affected by daylight saving time, it is called <I>raw
      * offset</I>.
      * <p>
-     * If an underlying <code>TimeZone</code> implementation subclass
+     * If an underlying {@code TimeZone} implementation subclass
      * supports historical GMT offset changes, the method returns the
      * raw offset value of the current date. In Honolulu, for example,
      * its raw offset changed from GMT-10:30 to GMT-10:00 in 1947, and
@@ -329,7 +329,7 @@
      *
      * @param locale the locale in which to supply the display name.
      * @return the human-readable name of this time zone in the given locale.
-     * @exception NullPointerException if {@code locale} is {@code null}.
+     * @throws    NullPointerException if {@code locale} is {@code null}.
      * @since 1.2
      * @see #getDisplayName(boolean, int, Locale)
      */
@@ -354,7 +354,7 @@
      *                 {@code false} specifying a Standard Time name
      * @param style either {@link #LONG} or {@link #SHORT}
      * @return the human-readable name of this time zone in the default locale.
-     * @exception IllegalArgumentException if {@code style} is invalid.
+     * @throws    IllegalArgumentException if {@code style} is invalid.
      * @since 1.2
      * @see #getDisplayName(boolean, int, Locale)
      * @see Locale#getDefault(Locale.Category)
@@ -376,10 +376,10 @@
      *
      * <p>When looking up a time zone name, the {@linkplain
      * ResourceBundle.Control#getCandidateLocales(String,Locale) default
-     * <code>Locale</code> search path of <code>ResourceBundle</code>} derived
+     * {@code Locale} search path of {@code ResourceBundle}} derived
      * from the specified {@code locale} is used. (No {@linkplain
      * ResourceBundle.Control#getFallbackLocale(String,Locale) fallback
-     * <code>Locale</code>} search is performed.) If a time zone name in any
+     * {@code Locale}} search is performed.) If a time zone name in any
      * {@code Locale} of the search path, including {@link Locale#ROOT}, is
      * found, the name is returned. Otherwise, a string in the
      * <a href="#NormalizedCustomID">normalized custom ID format</a> is returned.
@@ -389,8 +389,8 @@
      * @param style either {@link #LONG} or {@link #SHORT}
      * @param locale   the locale in which to supply the display name.
      * @return the human-readable name of this time zone in the given locale.
-     * @exception IllegalArgumentException if {@code style} is invalid.
-     * @exception NullPointerException if {@code locale} is {@code null}.
+     * @throws    IllegalArgumentException if {@code style} is invalid.
+     * @throws    NullPointerException if {@code locale} is {@code null}.
      * @since 1.2
      * @see java.text.DateFormatSymbols#getZoneStrings()
      */
@@ -504,14 +504,14 @@
     public abstract boolean inDaylightTime(Date date);
 
     /**
-     * Gets the <code>TimeZone</code> for the given ID.
+     * Gets the {@code TimeZone} for the given ID.
      *
-     * @param ID the ID for a <code>TimeZone</code>, either an abbreviation
+     * @param ID the ID for a {@code TimeZone}, either an abbreviation
      * such as "PST", a full name such as "America/Los_Angeles", or a custom
      * ID such as "GMT-8:00". Note that the support of abbreviations is
      * for JDK 1.1.x compatibility only and full names should be used.
      *
-     * @return the specified <code>TimeZone</code>, or the GMT zone if the given ID
+     * @return the specified {@code TimeZone}, or the GMT zone if the given ID
      * cannot be understood.
      */
     public static synchronized TimeZone getTimeZone(String ID) {
@@ -733,7 +733,7 @@
      * Returns true if this zone has the same rule and offset as another zone.
      * That is, if this zone differs only in ID, if at all.  Returns false
      * if the other zone is null.
-     * @param other the <code>TimeZone</code> object to be compared with
+     * @param other the {@code TimeZone} object to be compared with
      * @return true if the other zone is not null and is the same as this one,
      * with the possible exception of the ID
      * @since 1.2
@@ -744,9 +744,9 @@
     }
 
     /**
-     * Creates a copy of this <code>TimeZone</code>.
+     * Creates a copy of this {@code TimeZone}.
      *
-     * @return a clone of this <code>TimeZone</code>
+     * @return a clone of this {@code TimeZone}
      */
     public Object clone()
     {
@@ -765,10 +765,10 @@
     // =======================privates===============================
 
     /**
-     * The string identifier of this <code>TimeZone</code>.  This is a
-     * programmatic identifier used internally to look up <code>TimeZone</code>
+     * The string identifier of this {@code TimeZone}.  This is a
+     * programmatic identifier used internally to look up {@code TimeZone}
      * objects from the system table and also to map them to their localized
-     * display names.  <code>ID</code> values are unique in the system
+     * display names.  {@code ID} values are unique in the system
      * table but may not be for dynamically created zones.
      * @serial
      */
--- a/src/java.base/share/classes/java/util/TooManyListenersException.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/TooManyListenersException.java	Tue Sep 24 15:19:35 2019 -0400
@@ -27,7 +27,7 @@
 
 /**
  * <p>
- * The <code> TooManyListenersException </code> Exception is used as part of
+ * The {@code  TooManyListenersException } Exception is used as part of
  * the Java Event model to annotate and implement a unicast special case of
  * a multicast Event Source.
  * </p>
--- a/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java	Tue Sep 24 15:19:35 2019 -0400
@@ -385,7 +385,7 @@
      * cases where old nodes can be reused because their next fields
      * won't change.  On average, only about one-sixth of them need
      * cloning when a table doubles. The nodes they replace will be
-     * garbage collectable as soon as they are no longer referenced by
+     * garbage collectible as soon as they are no longer referenced by
      * any reader thread that may be in the midst of concurrently
      * traversing table.  Upon transfer, the old table bin contains
      * only a special forwarding node (with hash field "MOVED") that
@@ -3286,9 +3286,8 @@
             return true;
         }
 
-        private static final Unsafe U = Unsafe.getUnsafe();
         private static final long LOCKSTATE
-                = U.objectFieldOffset(TreeBin.class, "lockState");
+            = U.objectFieldOffset(TreeBin.class, "lockState");
     }
 
     /* ----------------Table Traversal -------------- */
@@ -6345,28 +6344,20 @@
 
     // Unsafe mechanics
     private static final Unsafe U = Unsafe.getUnsafe();
-    private static final long SIZECTL;
-    private static final long TRANSFERINDEX;
-    private static final long BASECOUNT;
-    private static final long CELLSBUSY;
-    private static final long CELLVALUE;
-    private static final int ABASE;
+    private static final long SIZECTL
+        = U.objectFieldOffset(ConcurrentHashMap.class, "sizeCtl");
+    private static final long TRANSFERINDEX
+        = U.objectFieldOffset(ConcurrentHashMap.class, "transferIndex");
+    private static final long BASECOUNT
+        = U.objectFieldOffset(ConcurrentHashMap.class, "baseCount");
+    private static final long CELLSBUSY
+        = U.objectFieldOffset(ConcurrentHashMap.class, "cellsBusy");
+    private static final long CELLVALUE
+        = U.objectFieldOffset(CounterCell.class, "value");
+    private static final int ABASE = U.arrayBaseOffset(Node[].class);
     private static final int ASHIFT;
 
     static {
-        SIZECTL = U.objectFieldOffset
-            (ConcurrentHashMap.class, "sizeCtl");
-        TRANSFERINDEX = U.objectFieldOffset
-            (ConcurrentHashMap.class, "transferIndex");
-        BASECOUNT = U.objectFieldOffset
-            (ConcurrentHashMap.class, "baseCount");
-        CELLSBUSY = U.objectFieldOffset
-            (ConcurrentHashMap.class, "cellsBusy");
-
-        CELLVALUE = U.objectFieldOffset
-            (CounterCell.class, "value");
-
-        ABASE = U.arrayBaseOffset(Node[].class);
         int scale = U.arrayIndexScale(Node[].class);
         if ((scale & (scale - 1)) != 0)
             throw new ExceptionInInitializerError("array index scale not a power of two");
--- a/src/java.base/share/classes/java/util/concurrent/Phaser.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/concurrent/Phaser.java	Tue Sep 24 15:19:35 2019 -0400
@@ -97,7 +97,7 @@
  *       associated recovery within handlers of those exceptions,
  *       often after invoking {@code forceTermination}.  Phasers may
  *       also be used by tasks executing in a {@link ForkJoinPool}.
- *       Progress is ensured if the pool's parallelismLevel can
+ *       Progress is ensured if the pool's parallelism level can
  *       accommodate the maximum number of simultaneously blocked
  *       parties.
  *
--- a/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1053,18 +1053,18 @@
 
     // Unsafe mechanics
     private static final Unsafe U = Unsafe.getUnsafe();
-    private static final long SEED = U.objectFieldOffset
-            (Thread.class, "threadLocalRandomSeed");
-    private static final long PROBE = U.objectFieldOffset
-            (Thread.class, "threadLocalRandomProbe");
-    private static final long SECONDARY = U.objectFieldOffset
-            (Thread.class, "threadLocalRandomSecondarySeed");
-    private static final long THREADLOCALS = U.objectFieldOffset
-            (Thread.class, "threadLocals");
-    private static final long INHERITABLETHREADLOCALS = U.objectFieldOffset
-            (Thread.class, "inheritableThreadLocals");
-    private static final long INHERITEDACCESSCONTROLCONTEXT = U.objectFieldOffset
-            (Thread.class, "inheritedAccessControlContext");
+    private static final long SEED
+        = U.objectFieldOffset(Thread.class, "threadLocalRandomSeed");
+    private static final long PROBE
+        = U.objectFieldOffset(Thread.class, "threadLocalRandomProbe");
+    private static final long SECONDARY
+        = U.objectFieldOffset(Thread.class, "threadLocalRandomSecondarySeed");
+    private static final long THREADLOCALS
+        = U.objectFieldOffset(Thread.class, "threadLocals");
+    private static final long INHERITABLETHREADLOCALS
+        = U.objectFieldOffset(Thread.class, "inheritableThreadLocals");
+    private static final long INHERITEDACCESSCONTROLCONTEXT
+        = U.objectFieldOffset(Thread.class, "inheritedAccessControlContext");
 
     /** Rarely-used holder for the second of a pair of Gaussians */
     private static final ThreadLocal<Double> nextLocalGaussian =
--- a/src/java.base/share/classes/java/util/concurrent/atomic/AtomicInteger.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/concurrent/atomic/AtomicInteger.java	Tue Sep 24 15:19:35 2019 -0400
@@ -38,6 +38,7 @@
 import java.lang.invoke.VarHandle;
 import java.util.function.IntBinaryOperator;
 import java.util.function.IntUnaryOperator;
+import jdk.internal.misc.Unsafe;
 
 /**
  * An {@code int} value that may be updated atomically.  See the
@@ -58,8 +59,9 @@
      * This class intended to be implemented using VarHandles, but there
      * are unresolved cyclic startup dependencies.
      */
-    private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
-    private static final long VALUE = U.objectFieldOffset(AtomicInteger.class, "value");
+    private static final Unsafe U = Unsafe.getUnsafe();
+    private static final long VALUE
+        = U.objectFieldOffset(AtomicInteger.class, "value");
 
     private volatile int value;
 
--- a/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLong.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLong.java	Tue Sep 24 15:19:35 2019 -0400
@@ -38,6 +38,7 @@
 import java.lang.invoke.VarHandle;
 import java.util.function.LongBinaryOperator;
 import java.util.function.LongUnaryOperator;
+import jdk.internal.misc.Unsafe;
 
 /**
  * A {@code long} value that may be updated atomically.  See the
@@ -72,8 +73,9 @@
      * This class intended to be implemented using VarHandles, but there
      * are unresolved cyclic startup dependencies.
      */
-    private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
-    private static final long VALUE = U.objectFieldOffset(AtomicLong.class, "value");
+    private static final Unsafe U = Unsafe.getUnsafe();
+    private static final long VALUE
+        = U.objectFieldOffset(AtomicLong.class, "value");
 
     private volatile long value;
 
--- a/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java	Tue Sep 24 15:19:35 2019 -0400
@@ -35,13 +35,12 @@
 
 package java.util.concurrent.locks;
 
-import java.lang.invoke.MethodHandles;
-import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Date;
 import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.AbstractQueuedSynchronizer.Node;
+import java.util.concurrent.ForkJoinPool;
+import jdk.internal.misc.Unsafe;
 
 /**
  * A version of {@link AbstractQueuedSynchronizer} in
@@ -73,23 +72,76 @@
      * keep it that way.
      */
 
-    /**
-     * Creates a new {@code AbstractQueuedLongSynchronizer} instance
-     * with initial synchronization state of zero.
-     */
-    protected AbstractQueuedLongSynchronizer() { }
+    // Node status bits, also used as argument and return values
+    static final int WAITING   = 1;          // must be 1
+    static final int CANCELLED = 0x80000000; // must be negative
+    static final int COND      = 2;          // in a condition wait
+
+    /** CLH Nodes */
+    abstract static class Node {
+        volatile Node prev;       // initially attached via casTail
+        volatile Node next;       // visibly nonnull when signallable
+        Thread waiter;            // visibly nonnull when enqueued
+        volatile int status;      // written by owner, atomic bit ops by others
+
+        // methods for atomic operations
+        final boolean casPrev(Node c, Node v) {  // for cleanQueue
+            return U.weakCompareAndSetReference(this, PREV, c, v);
+        }
+        final boolean casNext(Node c, Node v) {  // for cleanQueue
+            return U.weakCompareAndSetReference(this, NEXT, c, v);
+        }
+        final int getAndUnsetStatus(int v) {     // for signalling
+            return U.getAndBitwiseAndInt(this, STATUS, ~v);
+        }
+        final void setPrevRelaxed(Node p) {      // for off-queue assignment
+            U.putReference(this, PREV, p);
+        }
+        final void setStatusRelaxed(int s) {     // for off-queue assignment
+            U.putInt(this, STATUS, s);
+        }
+        final void clearStatus() {               // for reducing unneeded signals
+            U.putIntOpaque(this, STATUS, 0);
+        }
+
+        private static final long STATUS
+            = U.objectFieldOffset(Node.class, "status");
+        private static final long NEXT
+            = U.objectFieldOffset(Node.class, "next");
+        private static final long PREV
+            = U.objectFieldOffset(Node.class, "prev");
+    }
+
+    // Concrete classes tagged by type
+    static final class ExclusiveNode extends Node { }
+    static final class SharedNode extends Node { }
+
+    static final class ConditionNode extends Node
+        implements ForkJoinPool.ManagedBlocker {
+        ConditionNode nextWaiter;            // link to next waiting node
+
+        /**
+         * Allows Conditions to be used in ForkJoinPools without
+         * risking fixed pool exhaustion. This is usable only for
+         * untimed Condition waits, not timed versions.
+         */
+        public final boolean isReleasable() {
+            return status <= 1 || Thread.currentThread().isInterrupted();
+        }
+
+        public final boolean block() {
+            while (!isReleasable()) LockSupport.park(this);
+            return true;
+        }
+    }
 
     /**
-     * Head of the wait queue, lazily initialized.  Except for
-     * initialization, it is modified only via method setHead.  Note:
-     * If head exists, its waitStatus is guaranteed not to be
-     * CANCELLED.
+     * Head of the wait queue, lazily initialized.
      */
     private transient volatile Node head;
 
     /**
-     * Tail of the wait queue, lazily initialized.  Modified only via
-     * method enq to add new wait node.
+     * Tail of the wait queue. After initialization, modified only via casTail.
      */
     private transient volatile Node tail;
 
@@ -113,8 +165,7 @@
      * @param newState the new state value
      */
     protected final void setState(long newState) {
-        // See JDK-8180620: Clarify VarHandle mixed-access subtleties
-        STATE.setVolatile(this, newState);
+        state = newState;
     }
 
     /**
@@ -129,481 +180,234 @@
      *         value was not equal to the expected value.
      */
     protected final boolean compareAndSetState(long expect, long update) {
-        return STATE.compareAndSet(this, expect, update);
+        return U.compareAndSetLong(this, STATE, expect, update);
     }
 
     // Queuing utilities
 
-    /**
-     * The number of nanoseconds for which it is faster to spin
-     * rather than to use timed park. A rough estimate suffices
-     * to improve responsiveness with very short timeouts.
-     */
-    static final long SPIN_FOR_TIMEOUT_THRESHOLD = 1000L;
+    private boolean casTail(Node c, Node v) {
+        return U.compareAndSetReference(this, TAIL, c, v);
+    }
+
+    /** tries once to CAS a new dummy node for head */
+    private void tryInitializeHead() {
+        Node h = new ExclusiveNode();
+        if (U.compareAndSetReference(this, HEAD, null, h))
+            tail = h;
+    }
 
     /**
-     * Inserts node into queue, initializing if necessary. See picture above.
-     * @param node the node to insert
-     * @return node's predecessor
+     * Enqueues the node unless null. (Currently used only for
+     * ConditionNodes; other cases are interleaved with acquires.)
      */
-    private Node enq(Node node) {
-        for (;;) {
-            Node oldTail = tail;
-            if (oldTail != null) {
-                node.setPrevRelaxed(oldTail);
-                if (compareAndSetTail(oldTail, node)) {
-                    oldTail.next = node;
-                    return oldTail;
+    final void enqueue(Node node) {
+        if (node != null) {
+            for (;;) {
+                Node t = tail;
+                node.setPrevRelaxed(t);        // avoid unnecessary fence
+                if (t == null)                 // initialize
+                    tryInitializeHead();
+                else if (casTail(t, node)) {
+                    t.next = node;
+                    if (t.status < 0)          // wake up to clean link
+                        LockSupport.unpark(node.waiter);
+                    break;
                 }
-            } else {
-                initializeSyncQueue();
             }
         }
     }
 
+    /** Returns true if node is found in traversal from tail */
+    final boolean isEnqueued(Node node) {
+        for (Node t = tail; t != null; t = t.prev)
+            if (t == node)
+                return true;
+        return false;
+    }
+
     /**
-     * Creates and enqueues node for current thread and given mode.
+     * Wakes up the successor of given node, if one exists, and unsets its
+     * WAITING status to avoid park race. This may fail to wake up an
+     * eligible thread when one or more have been cancelled, but
+     * cancelAcquire ensures liveness.
+     */
+    private static void signalNext(Node h) {
+        Node s;
+        if (h != null && (s = h.next) != null && s.status != 0) {
+            s.getAndUnsetStatus(WAITING);
+            LockSupport.unpark(s.waiter);
+        }
+    }
+
+    /** Wakes up the given node if in shared mode */
+    private static void signalNextIfShared(Node h) {
+        Node s;
+        if (h != null && (s = h.next) != null &&
+            (s instanceof SharedNode) && s.status != 0) {
+            s.getAndUnsetStatus(WAITING);
+            LockSupport.unpark(s.waiter);
+        }
+    }
+
+    /**
+     * Main acquire method, invoked by all exported acquire methods.
      *
-     * @param mode Node.EXCLUSIVE for exclusive, Node.SHARED for shared
-     * @return the new node
+     * @param node null unless a reacquiring Condition
+     * @param arg the acquire argument
+     * @param shared true if shared mode else exclusive
+     * @param interruptible if abort and return negative on interrupt
+     * @param timed if true use timed waits
+     * @param time if timed, the System.nanoTime value to timeout
+     * @return positive if acquired, 0 if timed out, negative if interrupted
      */
-    private Node addWaiter(Node mode) {
-        Node node = new Node(mode);
+    final int acquire(Node node, long arg, boolean shared,
+                      boolean interruptible, boolean timed, long time) {
+        Thread current = Thread.currentThread();
+        byte spins = 0, postSpins = 0;   // retries upon unpark of first thread
+        boolean interrupted = false, first = false;
+        Node pred = null;                // predecessor of node when enqueued
+
+        /*
+         * Repeatedly:
+         *  Check if node now first
+         *    if so, ensure head stable, else ensure valid predecessor
+         *  if node is first or not yet enqueued, try acquiring
+         *  else if node not yet created, create it
+         *  else if not yet enqueued, try once to enqueue
+         *  else if woken from park, retry (up to postSpins times)
+         *  else if WAITING status not set, set and retry
+         *  else park and clear WAITING status, and check cancellation
+         */
 
         for (;;) {
-            Node oldTail = tail;
-            if (oldTail != null) {
-                node.setPrevRelaxed(oldTail);
-                if (compareAndSetTail(oldTail, node)) {
-                    oldTail.next = node;
-                    return node;
+            if (!first && (pred = (node == null) ? null : node.prev) != null &&
+                !(first = (head == pred))) {
+                if (pred.status < 0) {
+                    cleanQueue();           // predecessor cancelled
+                    continue;
+                } else if (pred.prev == null) {
+                    Thread.onSpinWait();    // ensure serialization
+                    continue;
+                }
+            }
+            if (first || pred == null) {
+                boolean acquired;
+                try {
+                    if (shared)
+                        acquired = (tryAcquireShared(arg) >= 0);
+                    else
+                        acquired = tryAcquire(arg);
+                } catch (Throwable ex) {
+                    cancelAcquire(node, interrupted, false);
+                    throw ex;
+                }
+                if (acquired) {
+                    if (first) {
+                        node.prev = null;
+                        head = node;
+                        pred.next = null;
+                        node.waiter = null;
+                        if (shared)
+                            signalNextIfShared(node);
+                        if (interrupted)
+                            current.interrupt();
+                    }
+                    return 1;
                 }
+            }
+            if (node == null) {                 // allocate; retry before enqueue
+                if (shared)
+                    node = new SharedNode();
+                else
+                    node = new ExclusiveNode();
+            } else if (pred == null) {          // try to enqueue
+                node.waiter = current;
+                Node t = tail;
+                node.setPrevRelaxed(t);         // avoid unnecessary fence
+                if (t == null)
+                    tryInitializeHead();
+                else if (!casTail(t, node))
+                    node.setPrevRelaxed(null);  // back out
+                else
+                    t.next = node;
+            } else if (first && spins != 0) {
+                --spins;                        // reduce unfairness on rewaits
+                Thread.onSpinWait();
+            } else if (node.status == 0) {
+                node.status = WAITING;          // enable signal and recheck
             } else {
-                initializeSyncQueue();
+                long nanos;
+                spins = postSpins = (byte)((postSpins << 1) | 1);
+                if (!timed)
+                    LockSupport.park(this);
+                else if ((nanos = time - System.nanoTime()) > 0L)
+                    LockSupport.parkNanos(this, nanos);
+                else
+                    break;
+                node.clearStatus();
+                if ((interrupted |= Thread.interrupted()) && interruptible)
+                    break;
+            }
+        }
+        return cancelAcquire(node, interrupted, interruptible);
+    }
+
+    /**
+     * Possibly repeatedly traverses from tail, unsplicing cancelled
+     * nodes until none are found.
+     */
+    private void cleanQueue() {
+        for (;;) {                               // restart point
+            for (Node q = tail, s = null, p, n;;) { // (p, q, s) triples
+                if (q == null || (p = q.prev) == null)
+                    return;                      // end of list
+                if (s == null ? tail != q : (s.prev != q || s.status < 0))
+                    break;                       // inconsistent
+                if (q.status < 0) {              // cancelled
+                    if ((s == null ? casTail(q, p) : s.casPrev(q, p)) &&
+                        q.prev == p) {
+                        p.casNext(q, s);         // OK if fails
+                        if (p.prev == null)
+                            signalNext(p);
+                    }
+                    break;
+                }
+                if ((n = p.next) != q) {         // help finish
+                    if (n != null && q.prev == p) {
+                        p.casNext(n, q);
+                        if (p.prev == null)
+                            signalNext(p);
+                    }
+                    break;
+                }
+                s = q;
+                q = q.prev;
             }
         }
     }
 
     /**
-     * Sets head of queue to be node, thus dequeuing. Called only by
-     * acquire methods.  Also nulls out unused fields for sake of GC
-     * and to suppress unnecessary signals and traversals.
-     *
-     * @param node the node
-     */
-    private void setHead(Node node) {
-        head = node;
-        node.thread = null;
-        node.prev = null;
-    }
-
-    /**
-     * Wakes up node's successor, if one exists.
-     *
-     * @param node the node
-     */
-    private void unparkSuccessor(Node node) {
-        /*
-         * If status is negative (i.e., possibly needing signal) try
-         * to clear in anticipation of signalling.  It is OK if this
-         * fails or if status is changed by waiting thread.
-         */
-        int ws = node.waitStatus;
-        if (ws < 0)
-            node.compareAndSetWaitStatus(ws, 0);
-
-        /*
-         * Thread to unpark is held in successor, which is normally
-         * just the next node.  But if cancelled or apparently null,
-         * traverse backwards from tail to find the actual
-         * non-cancelled successor.
-         */
-        Node s = node.next;
-        if (s == null || s.waitStatus > 0) {
-            s = null;
-            for (Node p = tail; p != node && p != null; p = p.prev)
-                if (p.waitStatus <= 0)
-                    s = p;
-        }
-        if (s != null)
-            LockSupport.unpark(s.thread);
-    }
-
-    /**
-     * Release action for shared mode -- signals successor and ensures
-     * propagation. (Note: For exclusive mode, release just amounts
-     * to calling unparkSuccessor of head if it needs signal.)
-     */
-    private void doReleaseShared() {
-        /*
-         * Ensure that a release propagates, even if there are other
-         * in-progress acquires/releases.  This proceeds in the usual
-         * way of trying to unparkSuccessor of head if it needs
-         * signal. But if it does not, status is set to PROPAGATE to
-         * ensure that upon release, propagation continues.
-         * Additionally, we must loop in case a new node is added
-         * while we are doing this. Also, unlike other uses of
-         * unparkSuccessor, we need to know if CAS to reset status
-         * fails, if so rechecking.
-         */
-        for (;;) {
-            Node h = head;
-            if (h != null && h != tail) {
-                int ws = h.waitStatus;
-                if (ws == Node.SIGNAL) {
-                    if (!h.compareAndSetWaitStatus(Node.SIGNAL, 0))
-                        continue;            // loop to recheck cases
-                    unparkSuccessor(h);
-                }
-                else if (ws == 0 &&
-                         !h.compareAndSetWaitStatus(0, Node.PROPAGATE))
-                    continue;                // loop on failed CAS
-            }
-            if (h == head)                   // loop if head changed
-                break;
-        }
-    }
-
-    /**
-     * Sets head of queue, and checks if successor may be waiting
-     * in shared mode, if so propagating if either propagate > 0 or
-     * PROPAGATE status was set.
-     *
-     * @param node the node
-     * @param propagate the return value from a tryAcquireShared
-     */
-    private void setHeadAndPropagate(Node node, long propagate) {
-        Node h = head; // Record old head for check below
-        setHead(node);
-        /*
-         * Try to signal next queued node if:
-         *   Propagation was indicated by caller,
-         *     or was recorded (as h.waitStatus either before
-         *     or after setHead) by a previous operation
-         *     (note: this uses sign-check of waitStatus because
-         *      PROPAGATE status may transition to SIGNAL.)
-         * and
-         *   The next node is waiting in shared mode,
-         *     or we don't know, because it appears null
-         *
-         * The conservatism in both of these checks may cause
-         * unnecessary wake-ups, but only when there are multiple
-         * racing acquires/releases, so most need signals now or soon
-         * anyway.
-         */
-        if (propagate > 0 || h == null || h.waitStatus < 0 ||
-            (h = head) == null || h.waitStatus < 0) {
-            Node s = node.next;
-            if (s == null || s.isShared())
-                doReleaseShared();
-        }
-    }
-
-    // Utilities for various versions of acquire
-
-    /**
      * Cancels an ongoing attempt to acquire.
      *
-     * @param node the node
-     */
-    private void cancelAcquire(Node node) {
-        // Ignore if node doesn't exist
-        if (node == null)
-            return;
-
-        node.thread = null;
-
-        // Skip cancelled predecessors
-        Node pred = node.prev;
-        while (pred.waitStatus > 0)
-            node.prev = pred = pred.prev;
-
-        // predNext is the apparent node to unsplice. CASes below will
-        // fail if not, in which case, we lost race vs another cancel
-        // or signal, so no further action is necessary, although with
-        // a possibility that a cancelled node may transiently remain
-        // reachable.
-        Node predNext = pred.next;
-
-        // Can use unconditional write instead of CAS here.
-        // After this atomic step, other Nodes can skip past us.
-        // Before, we are free of interference from other threads.
-        node.waitStatus = Node.CANCELLED;
-
-        // If we are the tail, remove ourselves.
-        if (node == tail && compareAndSetTail(node, pred)) {
-            pred.compareAndSetNext(predNext, null);
-        } else {
-            // If successor needs signal, try to set pred's next-link
-            // so it will get one. Otherwise wake it up to propagate.
-            int ws;
-            if (pred != head &&
-                ((ws = pred.waitStatus) == Node.SIGNAL ||
-                 (ws <= 0 && pred.compareAndSetWaitStatus(ws, Node.SIGNAL))) &&
-                pred.thread != null) {
-                Node next = node.next;
-                if (next != null && next.waitStatus <= 0)
-                    pred.compareAndSetNext(predNext, next);
-            } else {
-                unparkSuccessor(node);
-            }
-
-            node.next = node; // help GC
-        }
-    }
-
-    /**
-     * Checks and updates status for a node that failed to acquire.
-     * Returns true if thread should block. This is the main signal
-     * control in all acquire loops.  Requires that pred == node.prev.
-     *
-     * @param pred node's predecessor holding status
-     * @param node the node
-     * @return {@code true} if thread should block
-     */
-    private static boolean shouldParkAfterFailedAcquire(Node pred, Node node) {
-        int ws = pred.waitStatus;
-        if (ws == Node.SIGNAL)
-            /*
-             * This node has already set status asking a release
-             * to signal it, so it can safely park.
-             */
-            return true;
-        if (ws > 0) {
-            /*
-             * Predecessor was cancelled. Skip over predecessors and
-             * indicate retry.
-             */
-            do {
-                node.prev = pred = pred.prev;
-            } while (pred.waitStatus > 0);
-            pred.next = node;
-        } else {
-            /*
-             * waitStatus must be 0 or PROPAGATE.  Indicate that we
-             * need a signal, but don't park yet.  Caller will need to
-             * retry to make sure it cannot acquire before parking.
-             */
-            pred.compareAndSetWaitStatus(ws, Node.SIGNAL);
-        }
-        return false;
-    }
-
-    /**
-     * Convenience method to interrupt current thread.
-     */
-    static void selfInterrupt() {
-        Thread.currentThread().interrupt();
-    }
-
-    /**
-     * Convenience method to park and then check if interrupted.
-     *
-     * @return {@code true} if interrupted
-     */
-    private final boolean parkAndCheckInterrupt() {
-        LockSupport.park(this);
-        return Thread.interrupted();
-    }
-
-    /*
-     * Various flavors of acquire, varying in exclusive/shared and
-     * control modes.  Each is mostly the same, but annoyingly
-     * different.  Only a little bit of factoring is possible due to
-     * interactions of exception mechanics (including ensuring that we
-     * cancel if tryAcquire throws exception) and other control, at
-     * least not without hurting performance too much.
-     */
-
-    /**
-     * Acquires in exclusive uninterruptible mode for thread already in
-     * queue. Used by condition wait methods as well as acquire.
-     *
-     * @param node the node
-     * @param arg the acquire argument
-     * @return {@code true} if interrupted while waiting
-     */
-    final boolean acquireQueued(final Node node, long arg) {
-        boolean interrupted = false;
-        try {
-            for (;;) {
-                final Node p = node.predecessor();
-                if (p == head && tryAcquire(arg)) {
-                    setHead(node);
-                    p.next = null; // help GC
-                    return interrupted;
-                }
-                if (shouldParkAfterFailedAcquire(p, node))
-                    interrupted |= parkAndCheckInterrupt();
-            }
-        } catch (Throwable t) {
-            cancelAcquire(node);
-            if (interrupted)
-                selfInterrupt();
-            throw t;
-        }
-    }
-
-    /**
-     * Acquires in exclusive interruptible mode.
-     * @param arg the acquire argument
+     * @param node the node (may be null if cancelled before enqueuing)
+     * @param interrupted true if thread interrupted
+     * @param interruptible if should report interruption vs reset
      */
-    private void doAcquireInterruptibly(long arg)
-        throws InterruptedException {
-        final Node node = addWaiter(Node.EXCLUSIVE);
-        try {
-            for (;;) {
-                final Node p = node.predecessor();
-                if (p == head && tryAcquire(arg)) {
-                    setHead(node);
-                    p.next = null; // help GC
-                    return;
-                }
-                if (shouldParkAfterFailedAcquire(p, node) &&
-                    parkAndCheckInterrupt())
-                    throw new InterruptedException();
-            }
-        } catch (Throwable t) {
-            cancelAcquire(node);
-            throw t;
-        }
-    }
-
-    /**
-     * Acquires in exclusive timed mode.
-     *
-     * @param arg the acquire argument
-     * @param nanosTimeout max wait time
-     * @return {@code true} if acquired
-     */
-    private boolean doAcquireNanos(long arg, long nanosTimeout)
-            throws InterruptedException {
-        if (nanosTimeout <= 0L)
-            return false;
-        final long deadline = System.nanoTime() + nanosTimeout;
-        final Node node = addWaiter(Node.EXCLUSIVE);
-        try {
-            for (;;) {
-                final Node p = node.predecessor();
-                if (p == head && tryAcquire(arg)) {
-                    setHead(node);
-                    p.next = null; // help GC
-                    return true;
-                }
-                nanosTimeout = deadline - System.nanoTime();
-                if (nanosTimeout <= 0L) {
-                    cancelAcquire(node);
-                    return false;
-                }
-                if (shouldParkAfterFailedAcquire(p, node) &&
-                    nanosTimeout > SPIN_FOR_TIMEOUT_THRESHOLD)
-                    LockSupport.parkNanos(this, nanosTimeout);
-                if (Thread.interrupted())
-                    throw new InterruptedException();
-            }
-        } catch (Throwable t) {
-            cancelAcquire(node);
-            throw t;
+    private int cancelAcquire(Node node, boolean interrupted,
+                              boolean interruptible) {
+        if (node != null) {
+            node.waiter = null;
+            node.status = CANCELLED;
+            if (node.prev != null)
+                cleanQueue();
         }
-    }
-
-    /**
-     * Acquires in shared uninterruptible mode.
-     * @param arg the acquire argument
-     */
-    private void doAcquireShared(long arg) {
-        final Node node = addWaiter(Node.SHARED);
-        boolean interrupted = false;
-        try {
-            for (;;) {
-                final Node p = node.predecessor();
-                if (p == head) {
-                    long r = tryAcquireShared(arg);
-                    if (r >= 0) {
-                        setHeadAndPropagate(node, r);
-                        p.next = null; // help GC
-                        return;
-                    }
-                }
-                if (shouldParkAfterFailedAcquire(p, node))
-                    interrupted |= parkAndCheckInterrupt();
-            }
-        } catch (Throwable t) {
-            cancelAcquire(node);
-            throw t;
-        } finally {
-            if (interrupted)
-                selfInterrupt();
+        if (interrupted) {
+            if (interruptible)
+                return CANCELLED;
+            else
+                Thread.currentThread().interrupt();
         }
-    }
-
-    /**
-     * Acquires in shared interruptible mode.
-     * @param arg the acquire argument
-     */
-    private void doAcquireSharedInterruptibly(long arg)
-        throws InterruptedException {
-        final Node node = addWaiter(Node.SHARED);
-        try {
-            for (;;) {
-                final Node p = node.predecessor();
-                if (p == head) {
-                    long r = tryAcquireShared(arg);
-                    if (r >= 0) {
-                        setHeadAndPropagate(node, r);
-                        p.next = null; // help GC
-                        return;
-                    }
-                }
-                if (shouldParkAfterFailedAcquire(p, node) &&
-                    parkAndCheckInterrupt())
-                    throw new InterruptedException();
-            }
-        } catch (Throwable t) {
-            cancelAcquire(node);
-            throw t;
-        }
-    }
-
-    /**
-     * Acquires in shared timed mode.
-     *
-     * @param arg the acquire argument
-     * @param nanosTimeout max wait time
-     * @return {@code true} if acquired
-     */
-    private boolean doAcquireSharedNanos(long arg, long nanosTimeout)
-            throws InterruptedException {
-        if (nanosTimeout <= 0L)
-            return false;
-        final long deadline = System.nanoTime() + nanosTimeout;
-        final Node node = addWaiter(Node.SHARED);
-        try {
-            for (;;) {
-                final Node p = node.predecessor();
-                if (p == head) {
-                    long r = tryAcquireShared(arg);
-                    if (r >= 0) {
-                        setHeadAndPropagate(node, r);
-                        p.next = null; // help GC
-                        return true;
-                    }
-                }
-                nanosTimeout = deadline - System.nanoTime();
-                if (nanosTimeout <= 0L) {
-                    cancelAcquire(node);
-                    return false;
-                }
-                if (shouldParkAfterFailedAcquire(p, node) &&
-                    nanosTimeout > SPIN_FOR_TIMEOUT_THRESHOLD)
-                    LockSupport.parkNanos(this, nanosTimeout);
-                if (Thread.interrupted())
-                    throw new InterruptedException();
-            }
-        } catch (Throwable t) {
-            cancelAcquire(node);
-            throw t;
-        }
+        return 0;
     }
 
     // Main exported methods
@@ -756,9 +560,8 @@
      *        can represent anything you like.
      */
     public final void acquire(long arg) {
-        if (!tryAcquire(arg) &&
-            acquireQueued(addWaiter(Node.EXCLUSIVE), arg))
-            selfInterrupt();
+        if (!tryAcquire(arg))
+            acquire(null, arg, false, false, false, 0L);
     }
 
     /**
@@ -776,11 +579,10 @@
      * @throws InterruptedException if the current thread is interrupted
      */
     public final void acquireInterruptibly(long arg)
-            throws InterruptedException {
-        if (Thread.interrupted())
+        throws InterruptedException {
+        if (Thread.interrupted() ||
+            (!tryAcquire(arg) && acquire(null, arg, false, true, false, 0L) < 0))
             throw new InterruptedException();
-        if (!tryAcquire(arg))
-            doAcquireInterruptibly(arg);
     }
 
     /**
@@ -801,11 +603,20 @@
      * @throws InterruptedException if the current thread is interrupted
      */
     public final boolean tryAcquireNanos(long arg, long nanosTimeout)
-            throws InterruptedException {
-        if (Thread.interrupted())
-            throw new InterruptedException();
-        return tryAcquire(arg) ||
-            doAcquireNanos(arg, nanosTimeout);
+        throws InterruptedException {
+        if (!Thread.interrupted()) {
+            if (tryAcquire(arg))
+                return true;
+            if (nanosTimeout <= 0L)
+                return false;
+            int stat = acquire(null, arg, false, true, true,
+                               System.nanoTime() + nanosTimeout);
+            if (stat > 0)
+                return true;
+            if (stat == 0)
+                return false;
+        }
+        throw new InterruptedException();
     }
 
     /**
@@ -820,9 +631,7 @@
      */
     public final boolean release(long arg) {
         if (tryRelease(arg)) {
-            Node h = head;
-            if (h != null && h.waitStatus != 0)
-                unparkSuccessor(h);
+            signalNext(head);
             return true;
         }
         return false;
@@ -841,7 +650,7 @@
      */
     public final void acquireShared(long arg) {
         if (tryAcquireShared(arg) < 0)
-            doAcquireShared(arg);
+            acquire(null, arg, true, false, false, 0L);
     }
 
     /**
@@ -858,11 +667,11 @@
      * @throws InterruptedException if the current thread is interrupted
      */
     public final void acquireSharedInterruptibly(long arg)
-            throws InterruptedException {
-        if (Thread.interrupted())
+        throws InterruptedException {
+        if (Thread.interrupted() ||
+            (tryAcquireShared(arg) < 0 &&
+             acquire(null, arg, true, true, false, 0L) < 0))
             throw new InterruptedException();
-        if (tryAcquireShared(arg) < 0)
-            doAcquireSharedInterruptibly(arg);
     }
 
     /**
@@ -883,10 +692,19 @@
      */
     public final boolean tryAcquireSharedNanos(long arg, long nanosTimeout)
             throws InterruptedException {
-        if (Thread.interrupted())
-            throw new InterruptedException();
-        return tryAcquireShared(arg) >= 0 ||
-            doAcquireSharedNanos(arg, nanosTimeout);
+        if (!Thread.interrupted()) {
+            if (tryAcquireShared(arg) >= 0)
+                return true;
+            if (nanosTimeout <= 0L)
+                return false;
+            int stat = acquire(null, arg, true, true, true,
+                               System.nanoTime() + nanosTimeout);
+            if (stat > 0)
+                return true;
+            if (stat == 0)
+                return false;
+        }
+        throw new InterruptedException();
     }
 
     /**
@@ -900,7 +718,7 @@
      */
     public final boolean releaseShared(long arg) {
         if (tryReleaseShared(arg)) {
-            doReleaseShared();
+            signalNext(head);
             return true;
         }
         return false;
@@ -918,7 +736,7 @@
      */
     public final boolean hasQueuedThreads() {
         for (Node p = tail, h = head; p != h && p != null; p = p.prev)
-            if (p.waitStatus <= 0)
+            if (p.status >= 0)
                 return true;
         return false;
     }
@@ -948,45 +766,16 @@
      *         {@code null} if no threads are currently queued
      */
     public final Thread getFirstQueuedThread() {
-        // handle only fast path, else relay
-        return (head == tail) ? null : fullGetFirstQueuedThread();
-    }
-
-    /**
-     * Version of getFirstQueuedThread called when fastpath fails.
-     */
-    private Thread fullGetFirstQueuedThread() {
-        /*
-         * The first node is normally head.next. Try to get its
-         * thread field, ensuring consistent reads: If thread
-         * field is nulled out or s.prev is no longer head, then
-         * some other thread(s) concurrently performed setHead in
-         * between some of our reads. We try this twice before
-         * resorting to traversal.
-         */
-        Node h, s;
-        Thread st;
-        if (((h = head) != null && (s = h.next) != null &&
-             s.prev == head && (st = s.thread) != null) ||
-            ((h = head) != null && (s = h.next) != null &&
-             s.prev == head && (st = s.thread) != null))
-            return st;
-
-        /*
-         * Head's next field might not have been set yet, or may have
-         * been unset after setHead. So we must check to see if tail
-         * is actually first node. If not, we continue on, safely
-         * traversing from tail back to head to find first,
-         * guaranteeing termination.
-         */
-
-        Thread firstThread = null;
-        for (Node p = tail; p != null && p != head; p = p.prev) {
-            Thread t = p.thread;
-            if (t != null)
-                firstThread = t;
+        Thread first = null, w; Node h, s;
+        if ((h = head) != null && ((s = h.next) == null ||
+                                   (first = s.waiter) == null ||
+                                   s.prev == null)) {
+            // traverse from tail on stale reads
+            for (Node p = tail, q; p != null && (q = p.prev) != null; p = q)
+                if ((w = p.waiter) != null)
+                    first = w;
         }
-        return firstThread;
+        return first;
     }
 
     /**
@@ -1003,7 +792,7 @@
         if (thread == null)
             throw new NullPointerException();
         for (Node p = tail; p != null; p = p.prev)
-            if (p.thread == thread)
+            if (p.waiter == thread)
                 return true;
         return false;
     }
@@ -1019,10 +808,8 @@
      */
     final boolean apparentlyFirstQueuedIsExclusive() {
         Node h, s;
-        return (h = head) != null &&
-            (s = h.next)  != null &&
-            !s.isShared()         &&
-            s.thread != null;
+        return (h = head) != null && (s = h.next)  != null &&
+            !(s instanceof SharedNode) && s.waiter != null;
     }
 
     /**
@@ -1052,7 +839,7 @@
      * synchronizer might look like this:
      *
      * <pre> {@code
-     * protected boolean tryAcquire(int arg) {
+     * protected boolean tryAcquire(long arg) {
      *   if (isHeldExclusively()) {
      *     // A reentrant acquire; increment hold count
      *     return true;
@@ -1069,19 +856,12 @@
      * @since 1.7
      */
     public final boolean hasQueuedPredecessors() {
-        Node h, s;
-        if ((h = head) != null) {
-            if ((s = h.next) == null || s.waitStatus > 0) {
-                s = null; // traverse in case of concurrent cancellation
-                for (Node p = tail; p != h && p != null; p = p.prev) {
-                    if (p.waitStatus <= 0)
-                        s = p;
-                }
-            }
-            if (s != null && s.thread != Thread.currentThread())
-                return true;
-        }
-        return false;
+        Thread first = null; Node h, s;
+        if ((h = head) != null && ((s = h.next) == null ||
+                                   (first = s.waiter) == null ||
+                                   s.prev == null))
+            first = getFirstQueuedThread(); // retry via getFirstQueuedThread
+        return first != null && first != Thread.currentThread();
     }
 
     // Instrumentation and monitoring methods
@@ -1098,7 +878,7 @@
     public final int getQueueLength() {
         int n = 0;
         for (Node p = tail; p != null; p = p.prev) {
-            if (p.thread != null)
+            if (p.waiter != null)
                 ++n;
         }
         return n;
@@ -1118,7 +898,7 @@
     public final Collection<Thread> getQueuedThreads() {
         ArrayList<Thread> list = new ArrayList<>();
         for (Node p = tail; p != null; p = p.prev) {
-            Thread t = p.thread;
+            Thread t = p.waiter;
             if (t != null)
                 list.add(t);
         }
@@ -1136,8 +916,8 @@
     public final Collection<Thread> getExclusiveQueuedThreads() {
         ArrayList<Thread> list = new ArrayList<>();
         for (Node p = tail; p != null; p = p.prev) {
-            if (!p.isShared()) {
-                Thread t = p.thread;
+            if (!(p instanceof SharedNode)) {
+                Thread t = p.waiter;
                 if (t != null)
                     list.add(t);
             }
@@ -1156,8 +936,8 @@
     public final Collection<Thread> getSharedQueuedThreads() {
         ArrayList<Thread> list = new ArrayList<>();
         for (Node p = tail; p != null; p = p.prev) {
-            if (p.isShared()) {
-                Thread t = p.thread;
+            if (p instanceof SharedNode) {
+                Thread t = p.waiter;
                 if (t != null)
                     list.add(t);
             }
@@ -1180,117 +960,6 @@
             + (hasQueuedThreads() ? "non" : "") + "empty queue]";
     }
 
-
-    // Internal support methods for Conditions
-
-    /**
-     * Returns true if a node, always one that was initially placed on
-     * a condition queue, is now waiting to reacquire on sync queue.
-     * @param node the node
-     * @return true if is reacquiring
-     */
-    final boolean isOnSyncQueue(Node node) {
-        if (node.waitStatus == Node.CONDITION || node.prev == null)
-            return false;
-        if (node.next != null) // If has successor, it must be on queue
-            return true;
-        /*
-         * node.prev can be non-null, but not yet on queue because
-         * the CAS to place it on queue can fail. So we have to
-         * traverse from tail to make sure it actually made it.  It
-         * will always be near the tail in calls to this method, and
-         * unless the CAS failed (which is unlikely), it will be
-         * there, so we hardly ever traverse much.
-         */
-        return findNodeFromTail(node);
-    }
-
-    /**
-     * Returns true if node is on sync queue by searching backwards from tail.
-     * Called only when needed by isOnSyncQueue.
-     * @return true if present
-     */
-    private boolean findNodeFromTail(Node node) {
-        // We check for node first, since it's likely to be at or near tail.
-        // tail is known to be non-null, so we could re-order to "save"
-        // one null check, but we leave it this way to help the VM.
-        for (Node p = tail;;) {
-            if (p == node)
-                return true;
-            if (p == null)
-                return false;
-            p = p.prev;
-        }
-    }
-
-    /**
-     * Transfers a node from a condition queue onto sync queue.
-     * Returns true if successful.
-     * @param node the node
-     * @return true if successfully transferred (else the node was
-     * cancelled before signal)
-     */
-    final boolean transferForSignal(Node node) {
-        /*
-         * If cannot change waitStatus, the node has been cancelled.
-         */
-        if (!node.compareAndSetWaitStatus(Node.CONDITION, 0))
-            return false;
-
-        /*
-         * Splice onto queue and try to set waitStatus of predecessor to
-         * indicate that thread is (probably) waiting. If cancelled or
-         * attempt to set waitStatus fails, wake up to resync (in which
-         * case the waitStatus can be transiently and harmlessly wrong).
-         */
-        Node p = enq(node);
-        int ws = p.waitStatus;
-        if (ws > 0 || !p.compareAndSetWaitStatus(ws, Node.SIGNAL))
-            LockSupport.unpark(node.thread);
-        return true;
-    }
-
-    /**
-     * Transfers node, if necessary, to sync queue after a cancelled wait.
-     * Returns true if thread was cancelled before being signalled.
-     *
-     * @param node the node
-     * @return true if cancelled before the node was signalled
-     */
-    final boolean transferAfterCancelledWait(Node node) {
-        if (node.compareAndSetWaitStatus(Node.CONDITION, 0)) {
-            enq(node);
-            return true;
-        }
-        /*
-         * If we lost out to a signal(), then we can't proceed
-         * until it finishes its enq().  Cancelling during an
-         * incomplete transfer is both rare and transient, so just
-         * spin.
-         */
-        while (!isOnSyncQueue(node))
-            Thread.yield();
-        return false;
-    }
-
-    /**
-     * Invokes release with current state value; returns saved state.
-     * Cancels node and throws exception on failure.
-     * @param node the condition node for this wait
-     * @return previous sync state
-     */
-    final long fullyRelease(Node node) {
-        try {
-            long savedState = getState();
-            if (release(savedState))
-                return savedState;
-            throw new IllegalMonitorStateException();
-        } catch (Throwable t) {
-            node.waitStatus = Node.CANCELLED;
-            throw t;
-        }
-    }
-
     // Instrumentation methods for conditions
 
     /**
@@ -1384,112 +1053,38 @@
      *
      * <p>This class is Serializable, but all fields are transient,
      * so deserialized conditions have no waiters.
-     *
-     * @since 1.6
      */
     public class ConditionObject implements Condition, java.io.Serializable {
         private static final long serialVersionUID = 1173984872572414699L;
         /** First node of condition queue. */
-        private transient Node firstWaiter;
+        private transient ConditionNode firstWaiter;
         /** Last node of condition queue. */
-        private transient Node lastWaiter;
+        private transient ConditionNode lastWaiter;
 
         /**
          * Creates a new {@code ConditionObject} instance.
          */
         public ConditionObject() { }
 
-        // Internal methods
-
-        /**
-         * Adds a new waiter to wait queue.
-         * @return its new wait node
-         */
-        private Node addConditionWaiter() {
-            if (!isHeldExclusively())
-                throw new IllegalMonitorStateException();
-            Node t = lastWaiter;
-            // If lastWaiter is cancelled, clean out.
-            if (t != null && t.waitStatus != Node.CONDITION) {
-                unlinkCancelledWaiters();
-                t = lastWaiter;
-            }
-
-            Node node = new Node(Node.CONDITION);
-
-            if (t == null)
-                firstWaiter = node;
-            else
-                t.nextWaiter = node;
-            lastWaiter = node;
-            return node;
-        }
-
-        /**
-         * Removes and transfers nodes until hit non-cancelled one or
-         * null. Split out from signal in part to encourage compilers
-         * to inline the case of no waiters.
-         * @param first (non-null) the first node on condition queue
-         */
-        private void doSignal(Node first) {
-            do {
-                if ( (firstWaiter = first.nextWaiter) == null)
-                    lastWaiter = null;
-                first.nextWaiter = null;
-            } while (!transferForSignal(first) &&
-                     (first = firstWaiter) != null);
-        }
+        // Signalling methods
 
         /**
-         * Removes and transfers all nodes.
-         * @param first (non-null) the first node on condition queue
+         * Removes and transfers one or all waiters to sync queue.
          */
-        private void doSignalAll(Node first) {
-            lastWaiter = firstWaiter = null;
-            do {
-                Node next = first.nextWaiter;
-                first.nextWaiter = null;
-                transferForSignal(first);
+        private void doSignal(ConditionNode first, boolean all) {
+            while (first != null) {
+                ConditionNode next = first.nextWaiter;
+                if ((firstWaiter = next) == null)
+                    lastWaiter = null;
+                if ((first.getAndUnsetStatus(COND) & COND) != 0) {
+                    enqueue(first);
+                    if (!all)
+                        break;
+                }
                 first = next;
-            } while (first != null);
-        }
-
-        /**
-         * Unlinks cancelled waiter nodes from condition queue.
-         * Called only while holding lock. This is called when
-         * cancellation occurred during condition wait, and upon
-         * insertion of a new waiter when lastWaiter is seen to have
-         * been cancelled. This method is needed to avoid garbage
-         * retention in the absence of signals. So even though it may
-         * require a full traversal, it comes into play only when
-         * timeouts or cancellations occur in the absence of
-         * signals. It traverses all nodes rather than stopping at a
-         * particular target to unlink all pointers to garbage nodes
-         * without requiring many re-traversals during cancellation
-         * storms.
-         */
-        private void unlinkCancelledWaiters() {
-            Node t = firstWaiter;
-            Node trail = null;
-            while (t != null) {
-                Node next = t.nextWaiter;
-                if (t.waitStatus != Node.CONDITION) {
-                    t.nextWaiter = null;
-                    if (trail == null)
-                        firstWaiter = next;
-                    else
-                        trail.nextWaiter = next;
-                    if (next == null)
-                        lastWaiter = trail;
-                }
-                else
-                    trail = t;
-                t = next;
             }
         }
 
-        // public methods
-
         /**
          * Moves the longest-waiting thread, if one exists, from the
          * wait queue for this condition to the wait queue for the
@@ -1499,11 +1094,11 @@
          *         returns {@code false}
          */
         public final void signal() {
+            ConditionNode first = firstWaiter;
             if (!isHeldExclusively())
                 throw new IllegalMonitorStateException();
-            Node first = firstWaiter;
             if (first != null)
-                doSignal(first);
+                doSignal(first, false);
         }
 
         /**
@@ -1514,11 +1109,72 @@
          *         returns {@code false}
          */
         public final void signalAll() {
+            ConditionNode first = firstWaiter;
             if (!isHeldExclusively())
                 throw new IllegalMonitorStateException();
-            Node first = firstWaiter;
             if (first != null)
-                doSignalAll(first);
+                doSignal(first, true);
+        }
+
+        // Waiting methods
+
+        /**
+         * Adds node to condition list and releases lock.
+         *
+         * @param node the node
+         * @return savedState to reacquire after wait
+         */
+        private long enableWait(ConditionNode node) {
+            if (isHeldExclusively()) {
+                node.waiter = Thread.currentThread();
+                node.setStatusRelaxed(COND | WAITING);
+                ConditionNode last = lastWaiter;
+                if (last == null)
+                    firstWaiter = node;
+                else
+                    last.nextWaiter = node;
+                lastWaiter = node;
+                long savedState = getState();
+                if (release(savedState))
+                    return savedState;
+            }
+            node.status = CANCELLED; // lock not held or inconsistent
+            throw new IllegalMonitorStateException();
+        }
+
+        /**
+         * Returns true if a node that was initially placed on a condition
+         * queue is now ready to reacquire on sync queue.
+         * @param node the node
+         * @return true if is reacquiring
+         */
+        private boolean canReacquire(ConditionNode node) {
+            // check links, not status to avoid enqueue race
+            return node != null && node.prev != null && isEnqueued(node);
+        }
+
+        /**
+         * Unlinks the given node and other non-waiting nodes from
+         * condition queue unless already unlinked.
+         */
+        private void unlinkCancelledWaiters(ConditionNode node) {
+            if (node == null || node.nextWaiter != null || node == lastWaiter) {
+                ConditionNode w = firstWaiter, trail = null;
+                while (w != null) {
+                    ConditionNode next = w.nextWaiter;
+                    if ((w.status & COND) == 0) {
+                        w.nextWaiter = null;
+                        if (trail == null)
+                            firstWaiter = next;
+                        else
+                            trail.nextWaiter = next;
+                        if (next == null)
+                            lastWaiter = trail;
+                    } else
+                        trail = w;
+                    w = next;
+                }
+            }
         }
 
         /**
@@ -1533,51 +1189,27 @@
          * </ol>
          */
         public final void awaitUninterruptibly() {
-            Node node = addConditionWaiter();
-            long savedState = fullyRelease(node);
+            ConditionNode node = new ConditionNode();
+            long savedState = enableWait(node);
+            LockSupport.setCurrentBlocker(this); // for back-compatibility
             boolean interrupted = false;
-            while (!isOnSyncQueue(node)) {
-                LockSupport.park(this);
+            while (!canReacquire(node)) {
                 if (Thread.interrupted())
                     interrupted = true;
+                else if ((node.status & COND) != 0) {
+                    try {
+                        ForkJoinPool.managedBlock(node);
+                    } catch (InterruptedException ie) {
+                        interrupted = true;
+                    }
+                } else
+                    Thread.onSpinWait();    // awoke while enqueuing
             }
-            if (acquireQueued(node, savedState) || interrupted)
-                selfInterrupt();
-        }
-
-        /*
-         * For interruptible waits, we need to track whether to throw
-         * InterruptedException, if interrupted while blocked on
-         * condition, versus reinterrupt current thread, if
-         * interrupted while blocked waiting to re-acquire.
-         */
-
-        /** Mode meaning to reinterrupt on exit from wait */
-        private static final int REINTERRUPT =  1;
-        /** Mode meaning to throw InterruptedException on exit from wait */
-        private static final int THROW_IE    = -1;
-
-        /**
-         * Checks for interrupt, returning THROW_IE if interrupted
-         * before signalled, REINTERRUPT if after signalled, or
-         * 0 if not interrupted.
-         */
-        private int checkInterruptWhileWaiting(Node node) {
-            return Thread.interrupted() ?
-                (transferAfterCancelledWait(node) ? THROW_IE : REINTERRUPT) :
-                0;
-        }
-
-        /**
-         * Throws InterruptedException, reinterrupts current thread, or
-         * does nothing, depending on mode.
-         */
-        private void reportInterruptAfterWait(int interruptMode)
-            throws InterruptedException {
-            if (interruptMode == THROW_IE)
-                throw new InterruptedException();
-            else if (interruptMode == REINTERRUPT)
-                selfInterrupt();
+            LockSupport.setCurrentBlocker(null);
+            node.clearStatus();
+            acquire(node, savedState, false, false, false, 0L);
+            if (interrupted)
+                Thread.currentThread().interrupt();
         }
 
         /**
@@ -1596,20 +1228,33 @@
         public final void await() throws InterruptedException {
             if (Thread.interrupted())
                 throw new InterruptedException();
-            Node node = addConditionWaiter();
-            long savedState = fullyRelease(node);
-            int interruptMode = 0;
-            while (!isOnSyncQueue(node)) {
-                LockSupport.park(this);
-                if ((interruptMode = checkInterruptWhileWaiting(node)) != 0)
-                    break;
+            ConditionNode node = new ConditionNode();
+            long savedState = enableWait(node);
+            LockSupport.setCurrentBlocker(this); // for back-compatibility
+            boolean interrupted = false, cancelled = false;
+            while (!canReacquire(node)) {
+                if (interrupted |= Thread.interrupted()) {
+                    if (cancelled = (node.getAndUnsetStatus(COND) & COND) != 0)
+                        break;              // else interrupted after signal
+                } else if ((node.status & COND) != 0) {
+                    try {
+                        ForkJoinPool.managedBlock(node);
+                    } catch (InterruptedException ie) {
+                        interrupted = true;
+                    }
+                } else
+                    Thread.onSpinWait();    // awoke while enqueuing
             }
-            if (acquireQueued(node, savedState) && interruptMode != THROW_IE)
-                interruptMode = REINTERRUPT;
-            if (node.nextWaiter != null) // clean up if cancelled
-                unlinkCancelledWaiters();
-            if (interruptMode != 0)
-                reportInterruptAfterWait(interruptMode);
+            LockSupport.setCurrentBlocker(null);
+            node.clearStatus();
+            acquire(node, savedState, false, false, false, 0L);
+            if (interrupted) {
+                if (cancelled) {
+                    unlinkCancelledWaiters(node);
+                    throw new InterruptedException();
+                }
+                Thread.currentThread().interrupt();
+            }
         }
 
         /**
@@ -1629,32 +1274,29 @@
                 throws InterruptedException {
             if (Thread.interrupted())
                 throw new InterruptedException();
-            // We don't check for nanosTimeout <= 0L here, to allow
-            // awaitNanos(0) as a way to "yield the lock".
-            final long deadline = System.nanoTime() + nanosTimeout;
-            long initialNanos = nanosTimeout;
-            Node node = addConditionWaiter();
-            long savedState = fullyRelease(node);
-            int interruptMode = 0;
-            while (!isOnSyncQueue(node)) {
-                if (nanosTimeout <= 0L) {
-                    transferAfterCancelledWait(node);
-                    break;
-                }
-                if (nanosTimeout > SPIN_FOR_TIMEOUT_THRESHOLD)
-                    LockSupport.parkNanos(this, nanosTimeout);
-                if ((interruptMode = checkInterruptWhileWaiting(node)) != 0)
-                    break;
-                nanosTimeout = deadline - System.nanoTime();
+            ConditionNode node = new ConditionNode();
+            long savedState = enableWait(node);
+            long nanos = (nanosTimeout < 0L) ? 0L : nanosTimeout;
+            long deadline = System.nanoTime() + nanos;
+            boolean cancelled = false, interrupted = false;
+            while (!canReacquire(node)) {
+                if ((interrupted |= Thread.interrupted()) ||
+                    (nanos = deadline - System.nanoTime()) <= 0L) {
+                    if (cancelled = (node.getAndUnsetStatus(COND) & COND) != 0)
+                        break;
+                } else
+                    LockSupport.parkNanos(this, nanos);
             }
-            if (acquireQueued(node, savedState) && interruptMode != THROW_IE)
-                interruptMode = REINTERRUPT;
-            if (node.nextWaiter != null)
-                unlinkCancelledWaiters();
-            if (interruptMode != 0)
-                reportInterruptAfterWait(interruptMode);
+            node.clearStatus();
+            acquire(node, savedState, false, false, false, 0L);
+            if (cancelled) {
+                unlinkCancelledWaiters(node);
+                if (interrupted)
+                    throw new InterruptedException();
+            } else if (interrupted)
+                Thread.currentThread().interrupt();
             long remaining = deadline - System.nanoTime(); // avoid overflow
-            return (remaining <= initialNanos) ? remaining : Long.MIN_VALUE;
+            return (remaining <= nanosTimeout) ? remaining : Long.MIN_VALUE;
         }
 
         /**
@@ -1676,26 +1318,26 @@
             long abstime = deadline.getTime();
             if (Thread.interrupted())
                 throw new InterruptedException();
-            Node node = addConditionWaiter();
-            long savedState = fullyRelease(node);
-            boolean timedout = false;
-            int interruptMode = 0;
-            while (!isOnSyncQueue(node)) {
-                if (System.currentTimeMillis() >= abstime) {
-                    timedout = transferAfterCancelledWait(node);
-                    break;
-                }
-                LockSupport.parkUntil(this, abstime);
-                if ((interruptMode = checkInterruptWhileWaiting(node)) != 0)
-                    break;
+            ConditionNode node = new ConditionNode();
+            long savedState = enableWait(node);
+            boolean cancelled = false, interrupted = false;
+            while (!canReacquire(node)) {
+                if ((interrupted |= Thread.interrupted()) ||
+                    System.currentTimeMillis() >= abstime) {
+                    if (cancelled = (node.getAndUnsetStatus(COND) & COND) != 0)
+                        break;
+                } else
+                    LockSupport.parkUntil(this, abstime);
             }
-            if (acquireQueued(node, savedState) && interruptMode != THROW_IE)
-                interruptMode = REINTERRUPT;
-            if (node.nextWaiter != null)
-                unlinkCancelledWaiters();
-            if (interruptMode != 0)
-                reportInterruptAfterWait(interruptMode);
-            return !timedout;
+            node.clearStatus();
+            acquire(node, savedState, false, false, false, 0L);
+            if (cancelled) {
+                unlinkCancelledWaiters(node);
+                if (interrupted)
+                    throw new InterruptedException();
+            } else if (interrupted)
+                Thread.currentThread().interrupt();
+            return !cancelled;
         }
 
         /**
@@ -1717,31 +1359,28 @@
             long nanosTimeout = unit.toNanos(time);
             if (Thread.interrupted())
                 throw new InterruptedException();
-            // We don't check for nanosTimeout <= 0L here, to allow
-            // await(0, unit) as a way to "yield the lock".
-            final long deadline = System.nanoTime() + nanosTimeout;
-            Node node = addConditionWaiter();
-            long savedState = fullyRelease(node);
-            boolean timedout = false;
-            int interruptMode = 0;
-            while (!isOnSyncQueue(node)) {
-                if (nanosTimeout <= 0L) {
-                    timedout = transferAfterCancelledWait(node);
-                    break;
-                }
-                if (nanosTimeout > SPIN_FOR_TIMEOUT_THRESHOLD)
-                    LockSupport.parkNanos(this, nanosTimeout);
-                if ((interruptMode = checkInterruptWhileWaiting(node)) != 0)
-                    break;
-                nanosTimeout = deadline - System.nanoTime();
+            ConditionNode node = new ConditionNode();
+            long savedState = enableWait(node);
+            long nanos = (nanosTimeout < 0L) ? 0L : nanosTimeout;
+            long deadline = System.nanoTime() + nanos;
+            boolean cancelled = false, interrupted = false;
+            while (!canReacquire(node)) {
+                if ((interrupted |= Thread.interrupted()) ||
+                    (nanos = deadline - System.nanoTime()) <= 0L) {
+                    if (cancelled = (node.getAndUnsetStatus(COND) & COND) != 0)
+                        break;
+                } else
+                    LockSupport.parkNanos(this, nanos);
             }
-            if (acquireQueued(node, savedState) && interruptMode != THROW_IE)
-                interruptMode = REINTERRUPT;
-            if (node.nextWaiter != null)
-                unlinkCancelledWaiters();
-            if (interruptMode != 0)
-                reportInterruptAfterWait(interruptMode);
-            return !timedout;
+            node.clearStatus();
+            acquire(node, savedState, false, false, false, 0L);
+            if (cancelled) {
+                unlinkCancelledWaiters(node);
+                if (interrupted)
+                    throw new InterruptedException();
+            } else if (interrupted)
+                Thread.currentThread().interrupt();
+            return !cancelled;
         }
 
         //  support for instrumentation
@@ -1767,8 +1406,8 @@
         protected final boolean hasWaiters() {
             if (!isHeldExclusively())
                 throw new IllegalMonitorStateException();
-            for (Node w = firstWaiter; w != null; w = w.nextWaiter) {
-                if (w.waitStatus == Node.CONDITION)
+            for (ConditionNode w = firstWaiter; w != null; w = w.nextWaiter) {
+                if ((w.status & COND) != 0)
                     return true;
             }
             return false;
@@ -1787,8 +1426,8 @@
             if (!isHeldExclusively())
                 throw new IllegalMonitorStateException();
             int n = 0;
-            for (Node w = firstWaiter; w != null; w = w.nextWaiter) {
-                if (w.waitStatus == Node.CONDITION)
+            for (ConditionNode w = firstWaiter; w != null; w = w.nextWaiter) {
+                if ((w.status & COND) != 0)
                     ++n;
             }
             return n;
@@ -1807,9 +1446,9 @@
             if (!isHeldExclusively())
                 throw new IllegalMonitorStateException();
             ArrayList<Thread> list = new ArrayList<>();
-            for (Node w = firstWaiter; w != null; w = w.nextWaiter) {
-                if (w.waitStatus == Node.CONDITION) {
-                    Thread t = w.thread;
+            for (ConditionNode w = firstWaiter; w != null; w = w.nextWaiter) {
+                if ((w.status & COND) != 0) {
+                    Thread t = w.waiter;
                     if (t != null)
                         list.add(t);
                 }
@@ -1818,39 +1457,16 @@
         }
     }
 
-    // VarHandle mechanics
-    private static final VarHandle STATE;
-    private static final VarHandle HEAD;
-    private static final VarHandle TAIL;
+    // Unsafe
+    private static final Unsafe U = Unsafe.getUnsafe();
+    private static final long STATE
+        = U.objectFieldOffset(AbstractQueuedLongSynchronizer.class, "state");
+    private static final long HEAD
+        = U.objectFieldOffset(AbstractQueuedLongSynchronizer.class, "head");
+    private static final long TAIL
+        = U.objectFieldOffset(AbstractQueuedLongSynchronizer.class, "tail");
 
     static {
-        try {
-            MethodHandles.Lookup l = MethodHandles.lookup();
-            STATE = l.findVarHandle(AbstractQueuedLongSynchronizer.class, "state", long.class);
-            HEAD = l.findVarHandle(AbstractQueuedLongSynchronizer.class, "head", Node.class);
-            TAIL = l.findVarHandle(AbstractQueuedLongSynchronizer.class, "tail", Node.class);
-        } catch (ReflectiveOperationException e) {
-            throw new ExceptionInInitializerError(e);
-        }
-
-        // Reduce the risk of rare disastrous classloading in first call to
-        // LockSupport.park: https://bugs.openjdk.java.net/browse/JDK-8074773
         Class<?> ensureLoaded = LockSupport.class;
     }
-
-    /**
-     * Initializes head and tail fields on first contention.
-     */
-    private final void initializeSyncQueue() {
-        Node h;
-        if (HEAD.compareAndSet(this, null, (h = new Node())))
-            tail = h;
-    }
-
-    /**
-     * CASes tail field.
-     */
-    private final boolean compareAndSetTail(Node expect, Node update) {
-        return TAIL.compareAndSet(this, expect, update);
-    }
 }
--- a/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java	Tue Sep 24 15:19:35 2019 -0400
@@ -35,12 +35,12 @@
 
 package java.util.concurrent.locks;
 
-import java.lang.invoke.MethodHandles;
-import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Date;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.ForkJoinPool;
+import jdk.internal.misc.Unsafe;
 
 /**
  * Provides a framework for implementing blocking locks and related
@@ -312,265 +312,208 @@
      */
     protected AbstractQueuedSynchronizer() { }
 
-    /**
-     * Wait queue node class.
+    /*
+     * Overview.
      *
-     * <p>The wait queue is a variant of a "CLH" (Craig, Landin, and
+     * The wait queue is a variant of a "CLH" (Craig, Landin, and
      * Hagersten) lock queue. CLH locks are normally used for
-     * spinlocks.  We instead use them for blocking synchronizers, but
-     * use the same basic tactic of holding some of the control
-     * information about a thread in the predecessor of its node.  A
-     * "status" field in each node keeps track of whether a thread
-     * should block.  A node is signalled when its predecessor
-     * releases.  Each node of the queue otherwise serves as a
-     * specific-notification-style monitor holding a single waiting
-     * thread. The status field does NOT control whether threads are
-     * granted locks etc though.  A thread may try to acquire if it is
-     * first in the queue. But being first does not guarantee success;
-     * it only gives the right to contend.  So the currently released
-     * contender thread may need to rewait.
+     * spinlocks.  We instead use them for blocking synchronizers by
+     * including explicit ("prev" and "next") links plus a "status"
+     * field that allow nodes to signal successors when releasing
+     * locks, and handle cancellation due to interrupts and timeouts.
+     * The status field includes bits that track whether a thread
+     * needs a signal (using LockSupport.unpark). Despite these
+     * additions, we maintain most CLH locality properties.
+     *
+     * To enqueue into a CLH lock, you atomically splice it in as new
+     * tail. To dequeue, you set the head field, so the next eligible
+     * waiter becomes first.
      *
-     * <p>To enqueue into a CLH lock, you atomically splice it in as new
-     * tail. To dequeue, you just set the head field.
-     * <pre>
-     *      +------+  prev +-----+       +-----+
-     * head |      | <---- |     | <---- |     |  tail
-     *      +------+       +-----+       +-----+
-     * </pre>
+     *  +------+  prev +-------+       +------+
+     *  | head | <---- | first | <---- | tail |
+     *  +------+       +-------+       +------+
+     *
+     * Insertion into a CLH queue requires only a single atomic
+     * operation on "tail", so there is a simple point of demarcation
+     * from unqueued to queued. The "next" link of the predecessor is
+     * set by the enqueuing thread after successful CAS. Even though
+     * non-atomic, this suffices to ensure that any blocked thread is
+     * signalled by a predecessor when eligible (although in the case
+     * of cancellation, possibly with the assistance of a signal in
+     * method cleanQueue). Signalling is based in part on a
+     * Dekker-like scheme in which the to-be waiting thread indicates
+     * WAITING status, then retries acquiring, and then rechecks
+     * status before blocking. The signaller atomically clears WAITING
+     * status when unparking.
      *
-     * <p>Insertion into a CLH queue requires only a single atomic
-     * operation on "tail", so there is a simple atomic point of
-     * demarcation from unqueued to queued. Similarly, dequeuing
-     * involves only updating the "head". However, it takes a bit
-     * more work for nodes to determine who their successors are,
-     * in part to deal with possible cancellation due to timeouts
-     * and interrupts.
-     *
-     * <p>The "prev" links (not used in original CLH locks), are mainly
-     * needed to handle cancellation. If a node is cancelled, its
-     * successor is (normally) relinked to a non-cancelled
-     * predecessor. For explanation of similar mechanics in the case
-     * of spin locks, see the papers by Scott and Scherer at
-     * http://www.cs.rochester.edu/u/scott/synchronization/
+     * Dequeuing on acquire involves detaching (nulling) a node's
+     * "prev" node and then updating the "head". Other threads check
+     * if a node is or was dequeued by checking "prev" rather than
+     * head. We enforce the nulling then setting order by spin-waiting
+     * if necessary. Because of this, the lock algorithm is not itself
+     * strictly "lock-free" because an acquiring thread may need to
+     * wait for a previous acquire to make progress. When used with
+     * exclusive locks, such progress is required anyway. However
+     * Shared mode may (uncommonly) require a spin-wait before
+     * setting head field to ensure proper propagation. (Historical
+     * note: This allows some simplifications and efficiencies
+     * compared to previous versions of this class.)
      *
-     * <p>We also use "next" links to implement blocking mechanics.
-     * The thread id for each node is kept in its own node, so a
-     * predecessor signals the next node to wake up by traversing
-     * next link to determine which thread it is.  Determination of
-     * successor must avoid races with newly queued nodes to set
-     * the "next" fields of their predecessors.  This is solved
-     * when necessary by checking backwards from the atomically
-     * updated "tail" when a node's successor appears to be null.
-     * (Or, said differently, the next-links are an optimization
-     * so that we don't usually need a backward scan.)
+     * A node's predecessor can change due to cancellation while it is
+     * waiting, until the node is first in queue, at which point it
+     * cannot change. The acquire methods cope with this by rechecking
+     * "prev" before waiting. The prev and next fields are modified
+     * only via CAS by cancelled nodes in method cleanQueue. The
+     * unsplice strategy is reminiscent of Michael-Scott queues in
+     * that after a successful CAS to prev field, other threads help
+     * fix next fields.  Because cancellation often occurs in bunches
+     * that complicate decisions about necessary signals, each call to
+     * cleanQueue traverses the queue until a clean sweep. Nodes that
+     * become relinked as first are unconditionally unparked
+     * (sometimes unnecessarily, but those cases are not worth
+     * avoiding).
      *
-     * <p>Cancellation introduces some conservatism to the basic
-     * algorithms.  Since we must poll for cancellation of other
-     * nodes, we can miss noticing whether a cancelled node is
-     * ahead or behind us. This is dealt with by always unparking
-     * successors upon cancellation, allowing them to stabilize on
-     * a new predecessor, unless we can identify an uncancelled
-     * predecessor who will carry this responsibility.
+     * A thread may try to acquire if it is first (frontmost) in the
+     * queue, and sometimes before.  Being first does not guarantee
+     * success; it only gives the right to contend. We balance
+     * throughput, overhead, and fairness by allowing incoming threads
+     * to "barge" and acquire the synchronizer while in the process of
+     * enqueuing, in which case an awakened first thread may need to
+     * rewait.  To counteract possible repeated unlucky rewaits, we
+     * exponentially increase retries (up to 256) to acquire each time
+     * a thread is unparked. Except in this case, AQS locks do not
+     * spin; they instead interleave attempts to acquire with
+     * bookkeeping steps. (Users who want spinlocks can use
+     * tryAcquire.)
      *
-     * <p>CLH queues need a dummy header node to get started. But
+     * To improve garbage collectibility, fields of nodes not yet on
+     * list are null. (It is not rare to create and then throw away a
+     * node without using it.) Fields of nodes coming off the list are
+     * nulled out as soon as possible. This accentuates the challenge
+     * of externally determining the first waiting thread (as in
+     * method getFirstQueuedThread). This sometimes requires the
+     * fallback of traversing backwards from the atomically updated
+     * "tail" when fields appear null. (This is never needed in the
+     * process of signalling though.)
+     *
+     * CLH queues need a dummy header node to get started. But
      * we don't create them on construction, because it would be wasted
      * effort if there is never contention. Instead, the node
      * is constructed and head and tail pointers are set upon first
      * contention.
      *
-     * <p>Threads waiting on Conditions use the same nodes, but
-     * use an additional link. Conditions only need to link nodes
-     * in simple (non-concurrent) linked queues because they are
-     * only accessed when exclusively held.  Upon await, a node is
-     * inserted into a condition queue.  Upon signal, the node is
-     * transferred to the main queue.  A special value of status
-     * field is used to mark which queue a node is on.
+     * Shared mode operations differ from Exclusive in that an acquire
+     * signals the next waiter to try to acquire if it is also
+     * Shared. The tryAcquireShared API allows users to indicate the
+     * degree of propagation, but in most applications, it is more
+     * efficient to ignore this, allowing the successor to try
+     * acquiring in any case.
+     *
+     * Threads waiting on Conditions use nodes with an additional
+     * link to maintain the (FIFO) list of conditions. Conditions only
+     * need to link nodes in simple (non-concurrent) linked queues
+     * because they are only accessed when exclusively held.  Upon
+     * await, a node is inserted into a condition queue.  Upon signal,
+     * the node is enqueued on the main queue.  A special status field
+     * value is used to track and atomically trigger this.
      *
-     * <p>Thanks go to Dave Dice, Mark Moir, Victor Luchangco, Bill
+     * Accesses to fields head, tail, and state use full Volatile
+     * mode, along with CAS. Node fields status, prev and next also do
+     * so while threads may be signallable, but sometimes use weaker
+     * modes otherwise. Accesses to field "waiter" (the thread to be
+     * signalled) are always sandwiched between other atomic accesses
+     * so are used in Plain mode. We use jdk.internal Unsafe versions
+     * of atomic access methods rather than VarHandles to avoid
+     * potential VM bootstrap issues.
+     *
+     * Most of the above is performed by primary internal method
+     * acquire, that is invoked in some way by all exported acquire
+     * methods.  (It is usually easy for compilers to optimize
+     * call-site specializations when heavily used.)
+     *
+     * There are several arbitrary decisions about when and how to
+     * check interrupts in both acquire and await before and/or after
+     * blocking. The decisions are less arbitrary in implementation
+     * updates because some users appear to rely on original behaviors
+     * in ways that are racy and so (rarely) wrong in general but hard
+     * to justify changing.
+     *
+     * Thanks go to Dave Dice, Mark Moir, Victor Luchangco, Bill
      * Scherer and Michael Scott, along with members of JSR-166
      * expert group, for helpful ideas, discussions, and critiques
      * on the design of this class.
      */
-    static final class Node {
-        /** Marker to indicate a node is waiting in shared mode */
-        static final Node SHARED = new Node();
-        /** Marker to indicate a node is waiting in exclusive mode */
-        static final Node EXCLUSIVE = null;
+
+    // Node status bits, also used as argument and return values
+    static final int WAITING   = 1;          // must be 1
+    static final int CANCELLED = 0x80000000; // must be negative
+    static final int COND      = 2;          // in a condition wait
 
-        /** waitStatus value to indicate thread has cancelled. */
-        static final int CANCELLED =  1;
-        /** waitStatus value to indicate successor's thread needs unparking. */
-        static final int SIGNAL    = -1;
-        /** waitStatus value to indicate thread is waiting on condition. */
-        static final int CONDITION = -2;
-        /**
-         * waitStatus value to indicate the next acquireShared should
-         * unconditionally propagate.
-         */
-        static final int PROPAGATE = -3;
+    /** CLH Nodes */
+    abstract static class Node {
+        volatile Node prev;       // initially attached via casTail
+        volatile Node next;       // visibly nonnull when signallable
+        Thread waiter;            // visibly nonnull when enqueued
+        volatile int status;      // written by owner, atomic bit ops by others
 
-        /**
-         * Status field, taking on only the values:
-         *   SIGNAL:     The successor of this node is (or will soon be)
-         *               blocked (via park), so the current node must
-         *               unpark its successor when it releases or
-         *               cancels. To avoid races, acquire methods must
-         *               first indicate they need a signal,
-         *               then retry the atomic acquire, and then,
-         *               on failure, block.
-         *   CANCELLED:  This node is cancelled due to timeout or interrupt.
-         *               Nodes never leave this state. In particular,
-         *               a thread with cancelled node never again blocks.
-         *   CONDITION:  This node is currently on a condition queue.
-         *               It will not be used as a sync queue node
-         *               until transferred, at which time the status
-         *               will be set to 0. (Use of this value here has
-         *               nothing to do with the other uses of the
-         *               field, but simplifies mechanics.)
-         *   PROPAGATE:  A releaseShared should be propagated to other
-         *               nodes. This is set (for head node only) in
-         *               doReleaseShared to ensure propagation
-         *               continues, even if other operations have
-         *               since intervened.
-         *   0:          None of the above
-         *
-         * The values are arranged numerically to simplify use.
-         * Non-negative values mean that a node doesn't need to
-         * signal. So, most code doesn't need to check for particular
-         * values, just for sign.
-         *
-         * The field is initialized to 0 for normal sync nodes, and
-         * CONDITION for condition nodes.  It is modified using CAS
-         * (or when possible, unconditional volatile writes).
-         */
-        volatile int waitStatus;
+        // methods for atomic operations
+        final boolean casPrev(Node c, Node v) {  // for cleanQueue
+            return U.weakCompareAndSetReference(this, PREV, c, v);
+        }
+        final boolean casNext(Node c, Node v) {  // for cleanQueue
+            return U.weakCompareAndSetReference(this, NEXT, c, v);
+        }
+        final int getAndUnsetStatus(int v) {     // for signalling
+            return U.getAndBitwiseAndInt(this, STATUS, ~v);
+        }
+        final void setPrevRelaxed(Node p) {      // for off-queue assignment
+            U.putReference(this, PREV, p);
+        }
+        final void setStatusRelaxed(int s) {     // for off-queue assignment
+            U.putInt(this, STATUS, s);
+        }
+        final void clearStatus() {               // for reducing unneeded signals
+            U.putIntOpaque(this, STATUS, 0);
+        }
 
-        /**
-         * Link to predecessor node that current node/thread relies on
-         * for checking waitStatus. Assigned during enqueuing, and nulled
-         * out (for sake of GC) only upon dequeuing.  Also, upon
-         * cancellation of a predecessor, we short-circuit while
-         * finding a non-cancelled one, which will always exist
-         * because the head node is never cancelled: A node becomes
-         * head only as a result of successful acquire. A
-         * cancelled thread never succeeds in acquiring, and a thread only
-         * cancels itself, not any other node.
-         */
-        volatile Node prev;
+        private static final long STATUS
+            = U.objectFieldOffset(Node.class, "status");
+        private static final long NEXT
+            = U.objectFieldOffset(Node.class, "next");
+        private static final long PREV
+            = U.objectFieldOffset(Node.class, "prev");
+    }
 
-        /**
-         * Link to the successor node that the current node/thread
-         * unparks upon release. Assigned during enqueuing, adjusted
-         * when bypassing cancelled predecessors, and nulled out (for
-         * sake of GC) when dequeued.  The enq operation does not
-         * assign next field of a predecessor until after attachment,
-         * so seeing a null next field does not necessarily mean that
-         * node is at end of queue. However, if a next field appears
-         * to be null, we can scan prev's from the tail to
-         * double-check.  The next field of cancelled nodes is set to
-         * point to the node itself instead of null, to make life
-         * easier for isOnSyncQueue.
-         */
-        volatile Node next;
+    // Concrete classes tagged by type
+    static final class ExclusiveNode extends Node { }
+    static final class SharedNode extends Node { }
+
+    static final class ConditionNode extends Node
+        implements ForkJoinPool.ManagedBlocker {
+        ConditionNode nextWaiter;            // link to next waiting node
 
         /**
-         * The thread that enqueued this node.  Initialized on
-         * construction and nulled out after use.
-         */
-        volatile Thread thread;
-
-        /**
-         * Link to next node waiting on condition, or the special
-         * value SHARED.  Because condition queues are accessed only
-         * when holding in exclusive mode, we just need a simple
-         * linked queue to hold nodes while they are waiting on
-         * conditions. They are then transferred to the queue to
-         * re-acquire. And because conditions can only be exclusive,
-         * we save a field by using special value to indicate shared
-         * mode.
+         * Allows Conditions to be used in ForkJoinPools without
+         * risking fixed pool exhaustion. This is usable only for
+         * untimed Condition waits, not timed versions.
          */
-        Node nextWaiter;
-
-        /**
-         * Returns true if node is waiting in shared mode.
-         */
-        final boolean isShared() {
-            return nextWaiter == SHARED;
-        }
-
-        /**
-         * Returns previous node, or throws NullPointerException if null.
-         * Use when predecessor cannot be null.  The null check could
-         * be elided, but is present to help the VM.
-         *
-         * @return the predecessor of this node
-         */
-        final Node predecessor() {
-            Node p = prev;
-            if (p == null)
-                throw new NullPointerException();
-            else
-                return p;
+        public final boolean isReleasable() {
+            return status <= 1 || Thread.currentThread().isInterrupted();
         }
 
-        /** Establishes initial head or SHARED marker. */
-        Node() {}
-
-        /** Constructor used by addWaiter. */
-        Node(Node nextWaiter) {
-            this.nextWaiter = nextWaiter;
-            THREAD.set(this, Thread.currentThread());
-        }
-
-        /** Constructor used by addConditionWaiter. */
-        Node(int waitStatus) {
-            WAITSTATUS.set(this, waitStatus);
-            THREAD.set(this, Thread.currentThread());
-        }
-
-        /** CASes waitStatus field. */
-        final boolean compareAndSetWaitStatus(int expect, int update) {
-            return WAITSTATUS.compareAndSet(this, expect, update);
-        }
-
-        /** CASes next field. */
-        final boolean compareAndSetNext(Node expect, Node update) {
-            return NEXT.compareAndSet(this, expect, update);
-        }
-
-        final void setPrevRelaxed(Node p) {
-            PREV.set(this, p);
-        }
-
-        // VarHandle mechanics
-        private static final VarHandle NEXT;
-        private static final VarHandle PREV;
-        private static final VarHandle THREAD;
-        private static final VarHandle WAITSTATUS;
-        static {
-            try {
-                MethodHandles.Lookup l = MethodHandles.lookup();
-                NEXT = l.findVarHandle(Node.class, "next", Node.class);
-                PREV = l.findVarHandle(Node.class, "prev", Node.class);
-                THREAD = l.findVarHandle(Node.class, "thread", Thread.class);
-                WAITSTATUS = l.findVarHandle(Node.class, "waitStatus", int.class);
-            } catch (ReflectiveOperationException e) {
-                throw new ExceptionInInitializerError(e);
-            }
+        public final boolean block() {
+            while (!isReleasable()) LockSupport.park(this);
+            return true;
         }
     }
 
     /**
-     * Head of the wait queue, lazily initialized.  Except for
-     * initialization, it is modified only via method setHead.  Note:
-     * If head exists, its waitStatus is guaranteed not to be
-     * CANCELLED.
+     * Head of the wait queue, lazily initialized.
      */
     private transient volatile Node head;
 
     /**
-     * Tail of the wait queue, lazily initialized.  Modified only via
-     * method enq to add new wait node.
+     * Tail of the wait queue. After initialization, modified only via casTail.
      */
     private transient volatile Node tail;
 
@@ -609,481 +552,235 @@
      *         value was not equal to the expected value.
      */
     protected final boolean compareAndSetState(int expect, int update) {
-        return STATE.compareAndSet(this, expect, update);
+        return U.compareAndSetInt(this, STATE, expect, update);
     }
 
     // Queuing utilities
 
-    /**
-     * The number of nanoseconds for which it is faster to spin
-     * rather than to use timed park. A rough estimate suffices
-     * to improve responsiveness with very short timeouts.
-     */
-    static final long SPIN_FOR_TIMEOUT_THRESHOLD = 1000L;
+    private boolean casTail(Node c, Node v) {
+        return U.compareAndSetReference(this, TAIL, c, v);
+    }
+
+    /** tries once to CAS a new dummy node for head */
+    private void tryInitializeHead() {
+        Node h = new ExclusiveNode();
+        if (U.compareAndSetReference(this, HEAD, null, h))
+            tail = h;
+    }
 
     /**
-     * Inserts node into queue, initializing if necessary. See picture above.
-     * @param node the node to insert
-     * @return node's predecessor
+     * Enqueues the node unless null. (Currently used only for
+     * ConditionNodes; other cases are interleaved with acquires.)
      */
-    private Node enq(Node node) {
-        for (;;) {
-            Node oldTail = tail;
-            if (oldTail != null) {
-                node.setPrevRelaxed(oldTail);
-                if (compareAndSetTail(oldTail, node)) {
-                    oldTail.next = node;
-                    return oldTail;
+    final void enqueue(Node node) {
+        if (node != null) {
+            for (;;) {
+                Node t = tail;
+                node.setPrevRelaxed(t);        // avoid unnecessary fence
+                if (t == null)                 // initialize
+                    tryInitializeHead();
+                else if (casTail(t, node)) {
+                    t.next = node;
+                    if (t.status < 0)          // wake up to clean link
+                        LockSupport.unpark(node.waiter);
+                    break;
                 }
-            } else {
-                initializeSyncQueue();
             }
         }
     }
 
+    /** Returns true if node is found in traversal from tail */
+    final boolean isEnqueued(Node node) {
+        for (Node t = tail; t != null; t = t.prev)
+            if (t == node)
+                return true;
+        return false;
+    }
+
     /**
-     * Creates and enqueues node for current thread and given mode.
+     * Wakes up the successor of given node, if one exists, and unsets its
+     * WAITING status to avoid park race. This may fail to wake up an
+     * eligible thread when one or more have been cancelled, but
+     * cancelAcquire ensures liveness.
+     */
+    private static void signalNext(Node h) {
+        Node s;
+        if (h != null && (s = h.next) != null && s.status != 0) {
+            s.getAndUnsetStatus(WAITING);
+            LockSupport.unpark(s.waiter);
+        }
+    }
+
+    /** Wakes up the given node if in shared mode */
+    private static void signalNextIfShared(Node h) {
+        Node s;
+        if (h != null && (s = h.next) != null &&
+            (s instanceof SharedNode) && s.status != 0) {
+            s.getAndUnsetStatus(WAITING);
+            LockSupport.unpark(s.waiter);
+        }
+    }
+
+    /**
+     * Main acquire method, invoked by all exported acquire methods.
      *
-     * @param mode Node.EXCLUSIVE for exclusive, Node.SHARED for shared
-     * @return the new node
+     * @param node null unless a reacquiring Condition
+     * @param arg the acquire argument
+     * @param shared true if shared mode else exclusive
+     * @param interruptible if abort and return negative on interrupt
+     * @param timed if true use timed waits
+     * @param time if timed, the System.nanoTime value to timeout
+     * @return positive if acquired, 0 if timed out, negative if interrupted
      */
-    private Node addWaiter(Node mode) {
-        Node node = new Node(mode);
+    final int acquire(Node node, int arg, boolean shared,
+                      boolean interruptible, boolean timed, long time) {
+        Thread current = Thread.currentThread();
+        byte spins = 0, postSpins = 0;   // retries upon unpark of first thread
+        boolean interrupted = false, first = false;
+        Node pred = null;                // predecessor of node when enqueued
+
+        /*
+         * Repeatedly:
+         *  Check if node now first
+         *    if so, ensure head stable, else ensure valid predecessor
+         *  if node is first or not yet enqueued, try acquiring
+         *  else if node not yet created, create it
+         *  else if not yet enqueued, try once to enqueue
+         *  else if woken from park, retry (up to postSpins times)
+         *  else if WAITING status not set, set and retry
+         *  else park and clear WAITING status, and check cancellation
+         */
 
         for (;;) {
-            Node oldTail = tail;
-            if (oldTail != null) {
-                node.setPrevRelaxed(oldTail);
-                if (compareAndSetTail(oldTail, node)) {
-                    oldTail.next = node;
-                    return node;
+            if (!first && (pred = (node == null) ? null : node.prev) != null &&
+                !(first = (head == pred))) {
+                if (pred.status < 0) {
+                    cleanQueue();           // predecessor cancelled
+                    continue;
+                } else if (pred.prev == null) {
+                    Thread.onSpinWait();    // ensure serialization
+                    continue;
+                }
+            }
+            if (first || pred == null) {
+                boolean acquired;
+                try {
+                    if (shared)
+                        acquired = (tryAcquireShared(arg) >= 0);
+                    else
+                        acquired = tryAcquire(arg);
+                } catch (Throwable ex) {
+                    cancelAcquire(node, interrupted, false);
+                    throw ex;
+                }
+                if (acquired) {
+                    if (first) {
+                        node.prev = null;
+                        head = node;
+                        pred.next = null;
+                        node.waiter = null;
+                        if (shared)
+                            signalNextIfShared(node);
+                        if (interrupted)
+                            current.interrupt();
+                    }
+                    return 1;
                 }
+            }
+            if (node == null) {                 // allocate; retry before enqueue
+                if (shared)
+                    node = new SharedNode();
+                else
+                    node = new ExclusiveNode();
+            } else if (pred == null) {          // try to enqueue
+                node.waiter = current;
+                Node t = tail;
+                node.setPrevRelaxed(t);         // avoid unnecessary fence
+                if (t == null)
+                    tryInitializeHead();
+                else if (!casTail(t, node))
+                    node.setPrevRelaxed(null);  // back out
+                else
+                    t.next = node;
+            } else if (first && spins != 0) {
+                --spins;                        // reduce unfairness on rewaits
+                Thread.onSpinWait();
+            } else if (node.status == 0) {
+                node.status = WAITING;          // enable signal and recheck
             } else {
-                initializeSyncQueue();
+                long nanos;
+                spins = postSpins = (byte)((postSpins << 1) | 1);
+                if (!timed)
+                    LockSupport.park(this);
+                else if ((nanos = time - System.nanoTime()) > 0L)
+                    LockSupport.parkNanos(this, nanos);
+                else
+                    break;
+                node.clearStatus();
+                if ((interrupted |= Thread.interrupted()) && interruptible)
+                    break;
+            }
+        }
+        return cancelAcquire(node, interrupted, interruptible);
+    }
+
+    /**
+     * Possibly repeatedly traverses from tail, unsplicing cancelled
+     * nodes until none are found. Unparks nodes that may have been
+     * relinked to be next eligible acquirer.
+     */
+    private void cleanQueue() {
+        for (;;) {                               // restart point
+            for (Node q = tail, s = null, p, n;;) { // (p, q, s) triples
+                if (q == null || (p = q.prev) == null)
+                    return;                      // end of list
+                if (s == null ? tail != q : (s.prev != q || s.status < 0))
+                    break;                       // inconsistent
+                if (q.status < 0) {              // cancelled
+                    if ((s == null ? casTail(q, p) : s.casPrev(q, p)) &&
+                        q.prev == p) {
+                        p.casNext(q, s);         // OK if fails
+                        if (p.prev == null)
+                            signalNext(p);
+                    }
+                    break;
+                }
+                if ((n = p.next) != q) {         // help finish
+                    if (n != null && q.prev == p) {
+                        p.casNext(n, q);
+                        if (p.prev == null)
+                            signalNext(p);
+                    }
+                    break;
+                }
+                s = q;
+                q = q.prev;
             }
         }
     }
 
     /**
-     * Sets head of queue to be node, thus dequeuing. Called only by
-     * acquire methods.  Also nulls out unused fields for sake of GC
-     * and to suppress unnecessary signals and traversals.
-     *
-     * @param node the node
-     */
-    private void setHead(Node node) {
-        head = node;
-        node.thread = null;
-        node.prev = null;
-    }
-
-    /**
-     * Wakes up node's successor, if one exists.
-     *
-     * @param node the node
-     */
-    private void unparkSuccessor(Node node) {
-        /*
-         * If status is negative (i.e., possibly needing signal) try
-         * to clear in anticipation of signalling.  It is OK if this
-         * fails or if status is changed by waiting thread.
-         */
-        int ws = node.waitStatus;
-        if (ws < 0)
-            node.compareAndSetWaitStatus(ws, 0);
-
-        /*
-         * Thread to unpark is held in successor, which is normally
-         * just the next node.  But if cancelled or apparently null,
-         * traverse backwards from tail to find the actual
-         * non-cancelled successor.
-         */
-        Node s = node.next;
-        if (s == null || s.waitStatus > 0) {
-            s = null;
-            for (Node p = tail; p != node && p != null; p = p.prev)
-                if (p.waitStatus <= 0)
-                    s = p;
-        }
-        if (s != null)
-            LockSupport.unpark(s.thread);
-    }
-
-    /**
-     * Release action for shared mode -- signals successor and ensures
-     * propagation. (Note: For exclusive mode, release just amounts
-     * to calling unparkSuccessor of head if it needs signal.)
-     */
-    private void doReleaseShared() {
-        /*
-         * Ensure that a release propagates, even if there are other
-         * in-progress acquires/releases.  This proceeds in the usual
-         * way of trying to unparkSuccessor of head if it needs
-         * signal. But if it does not, status is set to PROPAGATE to
-         * ensure that upon release, propagation continues.
-         * Additionally, we must loop in case a new node is added
-         * while we are doing this. Also, unlike other uses of
-         * unparkSuccessor, we need to know if CAS to reset status
-         * fails, if so rechecking.
-         */
-        for (;;) {
-            Node h = head;
-            if (h != null && h != tail) {
-                int ws = h.waitStatus;
-                if (ws == Node.SIGNAL) {
-                    if (!h.compareAndSetWaitStatus(Node.SIGNAL, 0))
-                        continue;            // loop to recheck cases
-                    unparkSuccessor(h);
-                }
-                else if (ws == 0 &&
-                         !h.compareAndSetWaitStatus(0, Node.PROPAGATE))
-                    continue;                // loop on failed CAS
-            }
-            if (h == head)                   // loop if head changed
-                break;
-        }
-    }
-
-    /**
-     * Sets head of queue, and checks if successor may be waiting
-     * in shared mode, if so propagating if either propagate > 0 or
-     * PROPAGATE status was set.
-     *
-     * @param node the node
-     * @param propagate the return value from a tryAcquireShared
-     */
-    private void setHeadAndPropagate(Node node, int propagate) {
-        Node h = head; // Record old head for check below
-        setHead(node);
-        /*
-         * Try to signal next queued node if:
-         *   Propagation was indicated by caller,
-         *     or was recorded (as h.waitStatus either before
-         *     or after setHead) by a previous operation
-         *     (note: this uses sign-check of waitStatus because
-         *      PROPAGATE status may transition to SIGNAL.)
-         * and
-         *   The next node is waiting in shared mode,
-         *     or we don't know, because it appears null
-         *
-         * The conservatism in both of these checks may cause
-         * unnecessary wake-ups, but only when there are multiple
-         * racing acquires/releases, so most need signals now or soon
-         * anyway.
-         */
-        if (propagate > 0 || h == null || h.waitStatus < 0 ||
-            (h = head) == null || h.waitStatus < 0) {
-            Node s = node.next;
-            if (s == null || s.isShared())
-                doReleaseShared();
-        }
-    }
-
-    // Utilities for various versions of acquire
-
-    /**
      * Cancels an ongoing attempt to acquire.
      *
-     * @param node the node
-     */
-    private void cancelAcquire(Node node) {
-        // Ignore if node doesn't exist
-        if (node == null)
-            return;
-
-        node.thread = null;
-
-        // Skip cancelled predecessors
-        Node pred = node.prev;
-        while (pred.waitStatus > 0)
-            node.prev = pred = pred.prev;
-
-        // predNext is the apparent node to unsplice. CASes below will
-        // fail if not, in which case, we lost race vs another cancel
-        // or signal, so no further action is necessary, although with
-        // a possibility that a cancelled node may transiently remain
-        // reachable.
-        Node predNext = pred.next;
-
-        // Can use unconditional write instead of CAS here.
-        // After this atomic step, other Nodes can skip past us.
-        // Before, we are free of interference from other threads.
-        node.waitStatus = Node.CANCELLED;
-
-        // If we are the tail, remove ourselves.
-        if (node == tail && compareAndSetTail(node, pred)) {
-            pred.compareAndSetNext(predNext, null);
-        } else {
-            // If successor needs signal, try to set pred's next-link
-            // so it will get one. Otherwise wake it up to propagate.
-            int ws;
-            if (pred != head &&
-                ((ws = pred.waitStatus) == Node.SIGNAL ||
-                 (ws <= 0 && pred.compareAndSetWaitStatus(ws, Node.SIGNAL))) &&
-                pred.thread != null) {
-                Node next = node.next;
-                if (next != null && next.waitStatus <= 0)
-                    pred.compareAndSetNext(predNext, next);
-            } else {
-                unparkSuccessor(node);
-            }
-
-            node.next = node; // help GC
-        }
-    }
-
-    /**
-     * Checks and updates status for a node that failed to acquire.
-     * Returns true if thread should block. This is the main signal
-     * control in all acquire loops.  Requires that pred == node.prev.
-     *
-     * @param pred node's predecessor holding status
-     * @param node the node
-     * @return {@code true} if thread should block
-     */
-    private static boolean shouldParkAfterFailedAcquire(Node pred, Node node) {
-        int ws = pred.waitStatus;
-        if (ws == Node.SIGNAL)
-            /*
-             * This node has already set status asking a release
-             * to signal it, so it can safely park.
-             */
-            return true;
-        if (ws > 0) {
-            /*
-             * Predecessor was cancelled. Skip over predecessors and
-             * indicate retry.
-             */
-            do {
-                node.prev = pred = pred.prev;
-            } while (pred.waitStatus > 0);
-            pred.next = node;
-        } else {
-            /*
-             * waitStatus must be 0 or PROPAGATE.  Indicate that we
-             * need a signal, but don't park yet.  Caller will need to
-             * retry to make sure it cannot acquire before parking.
-             */
-            pred.compareAndSetWaitStatus(ws, Node.SIGNAL);
-        }
-        return false;
-    }
-
-    /**
-     * Convenience method to interrupt current thread.
-     */
-    static void selfInterrupt() {
-        Thread.currentThread().interrupt();
-    }
-
-    /**
-     * Convenience method to park and then check if interrupted.
-     *
-     * @return {@code true} if interrupted
-     */
-    private final boolean parkAndCheckInterrupt() {
-        LockSupport.park(this);
-        return Thread.interrupted();
-    }
-
-    /*
-     * Various flavors of acquire, varying in exclusive/shared and
-     * control modes.  Each is mostly the same, but annoyingly
-     * different.  Only a little bit of factoring is possible due to
-     * interactions of exception mechanics (including ensuring that we
-     * cancel if tryAcquire throws exception) and other control, at
-     * least not without hurting performance too much.
-     */
-
-    /**
-     * Acquires in exclusive uninterruptible mode for thread already in
-     * queue. Used by condition wait methods as well as acquire.
-     *
-     * @param node the node
-     * @param arg the acquire argument
-     * @return {@code true} if interrupted while waiting
-     */
-    final boolean acquireQueued(final Node node, int arg) {
-        boolean interrupted = false;
-        try {
-            for (;;) {
-                final Node p = node.predecessor();
-                if (p == head && tryAcquire(arg)) {
-                    setHead(node);
-                    p.next = null; // help GC
-                    return interrupted;
-                }
-                if (shouldParkAfterFailedAcquire(p, node))
-                    interrupted |= parkAndCheckInterrupt();
-            }
-        } catch (Throwable t) {
-            cancelAcquire(node);
-            if (interrupted)
-                selfInterrupt();
-            throw t;
-        }
-    }
-
-    /**
-     * Acquires in exclusive interruptible mode.
-     * @param arg the acquire argument
+     * @param node the node (may be null if cancelled before enqueuing)
+     * @param interrupted true if thread interrupted
+     * @param interruptible if should report interruption vs reset
      */
-    private void doAcquireInterruptibly(int arg)
-        throws InterruptedException {
-        final Node node = addWaiter(Node.EXCLUSIVE);
-        try {
-            for (;;) {
-                final Node p = node.predecessor();
-                if (p == head && tryAcquire(arg)) {
-                    setHead(node);
-                    p.next = null; // help GC
-                    return;
-                }
-                if (shouldParkAfterFailedAcquire(p, node) &&
-                    parkAndCheckInterrupt())
-                    throw new InterruptedException();
-            }
-        } catch (Throwable t) {
-            cancelAcquire(node);
-            throw t;
-        }
-    }
-
-    /**
-     * Acquires in exclusive timed mode.
-     *
-     * @param arg the acquire argument
-     * @param nanosTimeout max wait time
-     * @return {@code true} if acquired
-     */
-    private boolean doAcquireNanos(int arg, long nanosTimeout)
-            throws InterruptedException {
-        if (nanosTimeout <= 0L)
-            return false;
-        final long deadline = System.nanoTime() + nanosTimeout;
-        final Node node = addWaiter(Node.EXCLUSIVE);
-        try {
-            for (;;) {
-                final Node p = node.predecessor();
-                if (p == head && tryAcquire(arg)) {
-                    setHead(node);
-                    p.next = null; // help GC
-                    return true;
-                }
-                nanosTimeout = deadline - System.nanoTime();
-                if (nanosTimeout <= 0L) {
-                    cancelAcquire(node);
-                    return false;
-                }
-                if (shouldParkAfterFailedAcquire(p, node) &&
-                    nanosTimeout > SPIN_FOR_TIMEOUT_THRESHOLD)
-                    LockSupport.parkNanos(this, nanosTimeout);
-                if (Thread.interrupted())
-                    throw new InterruptedException();
-            }
-        } catch (Throwable t) {
-            cancelAcquire(node);
-            throw t;
+    private int cancelAcquire(Node node, boolean interrupted,
+                              boolean interruptible) {
+        if (node != null) {
+            node.waiter = null;
+            node.status = CANCELLED;
+            if (node.prev != null)
+                cleanQueue();
         }
-    }
-
-    /**
-     * Acquires in shared uninterruptible mode.
-     * @param arg the acquire argument
-     */
-    private void doAcquireShared(int arg) {
-        final Node node = addWaiter(Node.SHARED);
-        boolean interrupted = false;
-        try {
-            for (;;) {
-                final Node p = node.predecessor();
-                if (p == head) {
-                    int r = tryAcquireShared(arg);
-                    if (r >= 0) {
-                        setHeadAndPropagate(node, r);
-                        p.next = null; // help GC
-                        return;
-                    }
-                }
-                if (shouldParkAfterFailedAcquire(p, node))
-                    interrupted |= parkAndCheckInterrupt();
-            }
-        } catch (Throwable t) {
-            cancelAcquire(node);
-            throw t;
-        } finally {
-            if (interrupted)
-                selfInterrupt();
+        if (interrupted) {
+            if (interruptible)
+                return CANCELLED;
+            else
+                Thread.currentThread().interrupt();
         }
-    }
-
-    /**
-     * Acquires in shared interruptible mode.
-     * @param arg the acquire argument
-     */
-    private void doAcquireSharedInterruptibly(int arg)
-        throws InterruptedException {
-        final Node node = addWaiter(Node.SHARED);
-        try {
-            for (;;) {
-                final Node p = node.predecessor();
-                if (p == head) {
-                    int r = tryAcquireShared(arg);
-                    if (r >= 0) {
-                        setHeadAndPropagate(node, r);
-                        p.next = null; // help GC
-                        return;
-                    }
-                }
-                if (shouldParkAfterFailedAcquire(p, node) &&
-                    parkAndCheckInterrupt())
-                    throw new InterruptedException();
-            }
-        } catch (Throwable t) {
-            cancelAcquire(node);
-            throw t;
-        }
-    }
-
-    /**
-     * Acquires in shared timed mode.
-     *
-     * @param arg the acquire argument
-     * @param nanosTimeout max wait time
-     * @return {@code true} if acquired
-     */
-    private boolean doAcquireSharedNanos(int arg, long nanosTimeout)
-            throws InterruptedException {
-        if (nanosTimeout <= 0L)
-            return false;
-        final long deadline = System.nanoTime() + nanosTimeout;
-        final Node node = addWaiter(Node.SHARED);
-        try {
-            for (;;) {
-                final Node p = node.predecessor();
-                if (p == head) {
-                    int r = tryAcquireShared(arg);
-                    if (r >= 0) {
-                        setHeadAndPropagate(node, r);
-                        p.next = null; // help GC
-                        return true;
-                    }
-                }
-                nanosTimeout = deadline - System.nanoTime();
-                if (nanosTimeout <= 0L) {
-                    cancelAcquire(node);
-                    return false;
-                }
-                if (shouldParkAfterFailedAcquire(p, node) &&
-                    nanosTimeout > SPIN_FOR_TIMEOUT_THRESHOLD)
-                    LockSupport.parkNanos(this, nanosTimeout);
-                if (Thread.interrupted())
-                    throw new InterruptedException();
-            }
-        } catch (Throwable t) {
-            cancelAcquire(node);
-            throw t;
-        }
+        return 0;
     }
 
     // Main exported methods
@@ -1236,9 +933,8 @@
      *        can represent anything you like.
      */
     public final void acquire(int arg) {
-        if (!tryAcquire(arg) &&
-            acquireQueued(addWaiter(Node.EXCLUSIVE), arg))
-            selfInterrupt();
+        if (!tryAcquire(arg))
+            acquire(null, arg, false, false, false, 0L);
     }
 
     /**
@@ -1256,11 +952,10 @@
      * @throws InterruptedException if the current thread is interrupted
      */
     public final void acquireInterruptibly(int arg)
-            throws InterruptedException {
-        if (Thread.interrupted())
+        throws InterruptedException {
+        if (Thread.interrupted() ||
+            (!tryAcquire(arg) && acquire(null, arg, false, true, false, 0L) < 0))
             throw new InterruptedException();
-        if (!tryAcquire(arg))
-            doAcquireInterruptibly(arg);
     }
 
     /**
@@ -1281,11 +976,20 @@
      * @throws InterruptedException if the current thread is interrupted
      */
     public final boolean tryAcquireNanos(int arg, long nanosTimeout)
-            throws InterruptedException {
-        if (Thread.interrupted())
-            throw new InterruptedException();
-        return tryAcquire(arg) ||
-            doAcquireNanos(arg, nanosTimeout);
+        throws InterruptedException {
+        if (!Thread.interrupted()) {
+            if (tryAcquire(arg))
+                return true;
+            if (nanosTimeout <= 0L)
+                return false;
+            int stat = acquire(null, arg, false, true, true,
+                               System.nanoTime() + nanosTimeout);
+            if (stat > 0)
+                return true;
+            if (stat == 0)
+                return false;
+        }
+        throw new InterruptedException();
     }
 
     /**
@@ -1300,9 +1004,7 @@
      */
     public final boolean release(int arg) {
         if (tryRelease(arg)) {
-            Node h = head;
-            if (h != null && h.waitStatus != 0)
-                unparkSuccessor(h);
+            signalNext(head);
             return true;
         }
         return false;
@@ -1321,7 +1023,7 @@
      */
     public final void acquireShared(int arg) {
         if (tryAcquireShared(arg) < 0)
-            doAcquireShared(arg);
+            acquire(null, arg, true, false, false, 0L);
     }
 
     /**
@@ -1338,11 +1040,11 @@
      * @throws InterruptedException if the current thread is interrupted
      */
     public final void acquireSharedInterruptibly(int arg)
-            throws InterruptedException {
-        if (Thread.interrupted())
+        throws InterruptedException {
+        if (Thread.interrupted() ||
+            (tryAcquireShared(arg) < 0 &&
+             acquire(null, arg, true, true, false, 0L) < 0))
             throw new InterruptedException();
-        if (tryAcquireShared(arg) < 0)
-            doAcquireSharedInterruptibly(arg);
     }
 
     /**
@@ -1363,10 +1065,19 @@
      */
     public final boolean tryAcquireSharedNanos(int arg, long nanosTimeout)
             throws InterruptedException {
-        if (Thread.interrupted())
-            throw new InterruptedException();
-        return tryAcquireShared(arg) >= 0 ||
-            doAcquireSharedNanos(arg, nanosTimeout);
+        if (!Thread.interrupted()) {
+            if (tryAcquireShared(arg) >= 0)
+                return true;
+            if (nanosTimeout <= 0L)
+                return false;
+            int stat = acquire(null, arg, true, true, true,
+                               System.nanoTime() + nanosTimeout);
+            if (stat > 0)
+                return true;
+            if (stat == 0)
+                return false;
+        }
+        throw new InterruptedException();
     }
 
     /**
@@ -1380,7 +1091,7 @@
      */
     public final boolean releaseShared(int arg) {
         if (tryReleaseShared(arg)) {
-            doReleaseShared();
+            signalNext(head);
             return true;
         }
         return false;
@@ -1398,7 +1109,7 @@
      */
     public final boolean hasQueuedThreads() {
         for (Node p = tail, h = head; p != h && p != null; p = p.prev)
-            if (p.waitStatus <= 0)
+            if (p.status >= 0)
                 return true;
         return false;
     }
@@ -1428,45 +1139,16 @@
      *         {@code null} if no threads are currently queued
      */
     public final Thread getFirstQueuedThread() {
-        // handle only fast path, else relay
-        return (head == tail) ? null : fullGetFirstQueuedThread();
-    }
-
-    /**
-     * Version of getFirstQueuedThread called when fastpath fails.
-     */
-    private Thread fullGetFirstQueuedThread() {
-        /*
-         * The first node is normally head.next. Try to get its
-         * thread field, ensuring consistent reads: If thread
-         * field is nulled out or s.prev is no longer head, then
-         * some other thread(s) concurrently performed setHead in
-         * between some of our reads. We try this twice before
-         * resorting to traversal.
-         */
-        Node h, s;
-        Thread st;
-        if (((h = head) != null && (s = h.next) != null &&
-             s.prev == head && (st = s.thread) != null) ||
-            ((h = head) != null && (s = h.next) != null &&
-             s.prev == head && (st = s.thread) != null))
-            return st;
-
-        /*
-         * Head's next field might not have been set yet, or may have
-         * been unset after setHead. So we must check to see if tail
-         * is actually first node. If not, we continue on, safely
-         * traversing from tail back to head to find first,
-         * guaranteeing termination.
-         */
-
-        Thread firstThread = null;
-        for (Node p = tail; p != null && p != head; p = p.prev) {
-            Thread t = p.thread;
-            if (t != null)
-                firstThread = t;
+        Thread first = null, w; Node h, s;
+        if ((h = head) != null && ((s = h.next) == null ||
+                                   (first = s.waiter) == null ||
+                                   s.prev == null)) {
+            // traverse from tail on stale reads
+            for (Node p = tail, q; p != null && (q = p.prev) != null; p = q)
+                if ((w = p.waiter) != null)
+                    first = w;
         }
-        return firstThread;
+        return first;
     }
 
     /**
@@ -1483,7 +1165,7 @@
         if (thread == null)
             throw new NullPointerException();
         for (Node p = tail; p != null; p = p.prev)
-            if (p.thread == thread)
+            if (p.waiter == thread)
                 return true;
         return false;
     }
@@ -1499,10 +1181,8 @@
      */
     final boolean apparentlyFirstQueuedIsExclusive() {
         Node h, s;
-        return (h = head) != null &&
-            (s = h.next)  != null &&
-            !s.isShared()         &&
-            s.thread != null;
+        return (h = head) != null && (s = h.next)  != null &&
+            !(s instanceof SharedNode) && s.waiter != null;
     }
 
     /**
@@ -1549,19 +1229,12 @@
      * @since 1.7
      */
     public final boolean hasQueuedPredecessors() {
-        Node h, s;
-        if ((h = head) != null) {
-            if ((s = h.next) == null || s.waitStatus > 0) {
-                s = null; // traverse in case of concurrent cancellation
-                for (Node p = tail; p != h && p != null; p = p.prev) {
-                    if (p.waitStatus <= 0)
-                        s = p;
-                }
-            }
-            if (s != null && s.thread != Thread.currentThread())
-                return true;
-        }
-        return false;
+        Thread first = null; Node h, s;
+        if ((h = head) != null && ((s = h.next) == null ||
+                                   (first = s.waiter) == null ||
+                                   s.prev == null))
+            first = getFirstQueuedThread(); // retry via getFirstQueuedThread
+        return first != null && first != Thread.currentThread();
     }
 
     // Instrumentation and monitoring methods
@@ -1578,7 +1251,7 @@
     public final int getQueueLength() {
         int n = 0;
         for (Node p = tail; p != null; p = p.prev) {
-            if (p.thread != null)
+            if (p.waiter != null)
                 ++n;
         }
         return n;
@@ -1598,7 +1271,7 @@
     public final Collection<Thread> getQueuedThreads() {
         ArrayList<Thread> list = new ArrayList<>();
         for (Node p = tail; p != null; p = p.prev) {
-            Thread t = p.thread;
+            Thread t = p.waiter;
             if (t != null)
                 list.add(t);
         }
@@ -1616,8 +1289,8 @@
     public final Collection<Thread> getExclusiveQueuedThreads() {
         ArrayList<Thread> list = new ArrayList<>();
         for (Node p = tail; p != null; p = p.prev) {
-            if (!p.isShared()) {
-                Thread t = p.thread;
+            if (!(p instanceof SharedNode)) {
+                Thread t = p.waiter;
                 if (t != null)
                     list.add(t);
             }
@@ -1636,8 +1309,8 @@
     public final Collection<Thread> getSharedQueuedThreads() {
         ArrayList<Thread> list = new ArrayList<>();
         for (Node p = tail; p != null; p = p.prev) {
-            if (p.isShared()) {
-                Thread t = p.thread;
+            if (p instanceof SharedNode) {
+                Thread t = p.waiter;
                 if (t != null)
                     list.add(t);
             }
@@ -1660,117 +1333,6 @@
             + (hasQueuedThreads() ? "non" : "") + "empty queue]";
     }
 
-
-    // Internal support methods for Conditions
-
-    /**
-     * Returns true if a node, always one that was initially placed on
-     * a condition queue, is now waiting to reacquire on sync queue.
-     * @param node the node
-     * @return true if is reacquiring
-     */
-    final boolean isOnSyncQueue(Node node) {
-        if (node.waitStatus == Node.CONDITION || node.prev == null)
-            return false;
-        if (node.next != null) // If has successor, it must be on queue
-            return true;
-        /*
-         * node.prev can be non-null, but not yet on queue because
-         * the CAS to place it on queue can fail. So we have to
-         * traverse from tail to make sure it actually made it.  It
-         * will always be near the tail in calls to this method, and
-         * unless the CAS failed (which is unlikely), it will be
-         * there, so we hardly ever traverse much.
-         */
-        return findNodeFromTail(node);
-    }
-
-    /**
-     * Returns true if node is on sync queue by searching backwards from tail.
-     * Called only when needed by isOnSyncQueue.
-     * @return true if present
-     */
-    private boolean findNodeFromTail(Node node) {
-        // We check for node first, since it's likely to be at or near tail.
-        // tail is known to be non-null, so we could re-order to "save"
-        // one null check, but we leave it this way to help the VM.
-        for (Node p = tail;;) {
-            if (p == node)
-                return true;
-            if (p == null)
-                return false;
-            p = p.prev;
-        }
-    }
-
-    /**
-     * Transfers a node from a condition queue onto sync queue.
-     * Returns true if successful.
-     * @param node the node
-     * @return true if successfully transferred (else the node was
-     * cancelled before signal)
-     */
-    final boolean transferForSignal(Node node) {
-        /*
-         * If cannot change waitStatus, the node has been cancelled.
-         */
-        if (!node.compareAndSetWaitStatus(Node.CONDITION, 0))
-            return false;
-
-        /*
-         * Splice onto queue and try to set waitStatus of predecessor to
-         * indicate that thread is (probably) waiting. If cancelled or
-         * attempt to set waitStatus fails, wake up to resync (in which
-         * case the waitStatus can be transiently and harmlessly wrong).
-         */
-        Node p = enq(node);
-        int ws = p.waitStatus;
-        if (ws > 0 || !p.compareAndSetWaitStatus(ws, Node.SIGNAL))
-            LockSupport.unpark(node.thread);
-        return true;
-    }
-
-    /**
-     * Transfers node, if necessary, to sync queue after a cancelled wait.
-     * Returns true if thread was cancelled before being signalled.
-     *
-     * @param node the node
-     * @return true if cancelled before the node was signalled
-     */
-    final boolean transferAfterCancelledWait(Node node) {
-        if (node.compareAndSetWaitStatus(Node.CONDITION, 0)) {
-            enq(node);
-            return true;
-        }
-        /*
-         * If we lost out to a signal(), then we can't proceed
-         * until it finishes its enq().  Cancelling during an
-         * incomplete transfer is both rare and transient, so just
-         * spin.
-         */
-        while (!isOnSyncQueue(node))
-            Thread.yield();
-        return false;
-    }
-
-    /**
-     * Invokes release with current state value; returns saved state.
-     * Cancels node and throws exception on failure.
-     * @param node the condition node for this wait
-     * @return previous sync state
-     */
-    final int fullyRelease(Node node) {
-        try {
-            int savedState = getState();
-            if (release(savedState))
-                return savedState;
-            throw new IllegalMonitorStateException();
-        } catch (Throwable t) {
-            node.waitStatus = Node.CANCELLED;
-            throw t;
-        }
-    }
-
     // Instrumentation methods for conditions
 
     /**
@@ -1868,106 +1430,34 @@
     public class ConditionObject implements Condition, java.io.Serializable {
         private static final long serialVersionUID = 1173984872572414699L;
         /** First node of condition queue. */
-        private transient Node firstWaiter;
+        private transient ConditionNode firstWaiter;
         /** Last node of condition queue. */
-        private transient Node lastWaiter;
+        private transient ConditionNode lastWaiter;
 
         /**
          * Creates a new {@code ConditionObject} instance.
          */
         public ConditionObject() { }
 
-        // Internal methods
-
-        /**
-         * Adds a new waiter to wait queue.
-         * @return its new wait node
-         */
-        private Node addConditionWaiter() {
-            if (!isHeldExclusively())
-                throw new IllegalMonitorStateException();
-            Node t = lastWaiter;
-            // If lastWaiter is cancelled, clean out.
-            if (t != null && t.waitStatus != Node.CONDITION) {
-                unlinkCancelledWaiters();
-                t = lastWaiter;
-            }
-
-            Node node = new Node(Node.CONDITION);
-
-            if (t == null)
-                firstWaiter = node;
-            else
-                t.nextWaiter = node;
-            lastWaiter = node;
-            return node;
-        }
-
-        /**
-         * Removes and transfers nodes until hit non-cancelled one or
-         * null. Split out from signal in part to encourage compilers
-         * to inline the case of no waiters.
-         * @param first (non-null) the first node on condition queue
-         */
-        private void doSignal(Node first) {
-            do {
-                if ( (firstWaiter = first.nextWaiter) == null)
-                    lastWaiter = null;
-                first.nextWaiter = null;
-            } while (!transferForSignal(first) &&
-                     (first = firstWaiter) != null);
-        }
+        // Signalling methods
 
         /**
-         * Removes and transfers all nodes.
-         * @param first (non-null) the first node on condition queue
+         * Removes and transfers one or all waiters to sync queue.
          */
-        private void doSignalAll(Node first) {
-            lastWaiter = firstWaiter = null;
-            do {
-                Node next = first.nextWaiter;
-                first.nextWaiter = null;
-                transferForSignal(first);
+        private void doSignal(ConditionNode first, boolean all) {
+            while (first != null) {
+                ConditionNode next = first.nextWaiter;
+                if ((firstWaiter = next) == null)
+                    lastWaiter = null;
+                if ((first.getAndUnsetStatus(COND) & COND) != 0) {
+                    enqueue(first);
+                    if (!all)
+                        break;
+                }
                 first = next;
-            } while (first != null);
-        }
-
-        /**
-         * Unlinks cancelled waiter nodes from condition queue.
-         * Called only while holding lock. This is called when
-         * cancellation occurred during condition wait, and upon
-         * insertion of a new waiter when lastWaiter is seen to have
-         * been cancelled. This method is needed to avoid garbage
-         * retention in the absence of signals. So even though it may
-         * require a full traversal, it comes into play only when
-         * timeouts or cancellations occur in the absence of
-         * signals. It traverses all nodes rather than stopping at a
-         * particular target to unlink all pointers to garbage nodes
-         * without requiring many re-traversals during cancellation
-         * storms.
-         */
-        private void unlinkCancelledWaiters() {
-            Node t = firstWaiter;
-            Node trail = null;
-            while (t != null) {
-                Node next = t.nextWaiter;
-                if (t.waitStatus != Node.CONDITION) {
-                    t.nextWaiter = null;
-                    if (trail == null)
-                        firstWaiter = next;
-                    else
-                        trail.nextWaiter = next;
-                    if (next == null)
-                        lastWaiter = trail;
-                }
-                else
-                    trail = t;
-                t = next;
             }
         }
 
-        // public methods
-
         /**
          * Moves the longest-waiting thread, if one exists, from the
          * wait queue for this condition to the wait queue for the
@@ -1977,11 +1467,11 @@
          *         returns {@code false}
          */
         public final void signal() {
+            ConditionNode first = firstWaiter;
             if (!isHeldExclusively())
                 throw new IllegalMonitorStateException();
-            Node first = firstWaiter;
             if (first != null)
-                doSignal(first);
+                doSignal(first, false);
         }
 
         /**
@@ -1992,11 +1482,72 @@
          *         returns {@code false}
          */
         public final void signalAll() {
+            ConditionNode first = firstWaiter;
             if (!isHeldExclusively())
                 throw new IllegalMonitorStateException();
-            Node first = firstWaiter;
             if (first != null)
-                doSignalAll(first);
+                doSignal(first, true);
+        }
+
+        // Waiting methods
+
+        /**
+         * Adds node to condition list and releases lock.
+         *
+         * @param node the node
+         * @return savedState to reacquire after wait
+         */
+        private int enableWait(ConditionNode node) {
+            if (isHeldExclusively()) {
+                node.waiter = Thread.currentThread();
+                node.setStatusRelaxed(COND | WAITING);
+                ConditionNode last = lastWaiter;
+                if (last == null)
+                    firstWaiter = node;
+                else
+                    last.nextWaiter = node;
+                lastWaiter = node;
+                int savedState = getState();
+                if (release(savedState))
+                    return savedState;
+            }
+            node.status = CANCELLED; // lock not held or inconsistent
+            throw new IllegalMonitorStateException();
+        }
+
+        /**
+         * Returns true if a node that was initially placed on a condition
+         * queue is now ready to reacquire on sync queue.
+         * @param node the node
+         * @return true if is reacquiring
+         */
+        private boolean canReacquire(ConditionNode node) {
+            // check links, not status to avoid enqueue race
+            return node != null && node.prev != null && isEnqueued(node);
+        }
+
+        /**
+         * Unlinks the given node and other non-waiting nodes from
+         * condition queue unless already unlinked.
+         */
+        private void unlinkCancelledWaiters(ConditionNode node) {
+            if (node == null || node.nextWaiter != null || node == lastWaiter) {
+                ConditionNode w = firstWaiter, trail = null;
+                while (w != null) {
+                    ConditionNode next = w.nextWaiter;
+                    if ((w.status & COND) == 0) {
+                        w.nextWaiter = null;
+                        if (trail == null)
+                            firstWaiter = next;
+                        else
+                            trail.nextWaiter = next;
+                        if (next == null)
+                            lastWaiter = trail;
+                    } else
+                        trail = w;
+                    w = next;
+                }
+            }
         }
 
         /**
@@ -2011,51 +1562,27 @@
          * </ol>
          */
         public final void awaitUninterruptibly() {
-            Node node = addConditionWaiter();
-            int savedState = fullyRelease(node);
+            ConditionNode node = new ConditionNode();
+            int savedState = enableWait(node);
+            LockSupport.setCurrentBlocker(this); // for back-compatibility
             boolean interrupted = false;
-            while (!isOnSyncQueue(node)) {
-                LockSupport.park(this);
+            while (!canReacquire(node)) {
                 if (Thread.interrupted())
                     interrupted = true;
+                else if ((node.status & COND) != 0) {
+                    try {
+                        ForkJoinPool.managedBlock(node);
+                    } catch (InterruptedException ie) {
+                        interrupted = true;
+                    }
+                } else
+                    Thread.onSpinWait();    // awoke while enqueuing
             }
-            if (acquireQueued(node, savedState) || interrupted)
-                selfInterrupt();
-        }
-
-        /*
-         * For interruptible waits, we need to track whether to throw
-         * InterruptedException, if interrupted while blocked on
-         * condition, versus reinterrupt current thread, if
-         * interrupted while blocked waiting to re-acquire.
-         */
-
-        /** Mode meaning to reinterrupt on exit from wait */
-        private static final int REINTERRUPT =  1;
-        /** Mode meaning to throw InterruptedException on exit from wait */
-        private static final int THROW_IE    = -1;
-
-        /**
-         * Checks for interrupt, returning THROW_IE if interrupted
-         * before signalled, REINTERRUPT if after signalled, or
-         * 0 if not interrupted.
-         */
-        private int checkInterruptWhileWaiting(Node node) {
-            return Thread.interrupted() ?
-                (transferAfterCancelledWait(node) ? THROW_IE : REINTERRUPT) :
-                0;
-        }
-
-        /**
-         * Throws InterruptedException, reinterrupts current thread, or
-         * does nothing, depending on mode.
-         */
-        private void reportInterruptAfterWait(int interruptMode)
-            throws InterruptedException {
-            if (interruptMode == THROW_IE)
-                throw new InterruptedException();
-            else if (interruptMode == REINTERRUPT)
-                selfInterrupt();
+            LockSupport.setCurrentBlocker(null);
+            node.clearStatus();
+            acquire(node, savedState, false, false, false, 0L);
+            if (interrupted)
+                Thread.currentThread().interrupt();
         }
 
         /**
@@ -2074,20 +1601,33 @@
         public final void await() throws InterruptedException {
             if (Thread.interrupted())
                 throw new InterruptedException();
-            Node node = addConditionWaiter();
-            int savedState = fullyRelease(node);
-            int interruptMode = 0;
-            while (!isOnSyncQueue(node)) {
-                LockSupport.park(this);
-                if ((interruptMode = checkInterruptWhileWaiting(node)) != 0)
-                    break;
+            ConditionNode node = new ConditionNode();
+            int savedState = enableWait(node);
+            LockSupport.setCurrentBlocker(this); // for back-compatibility
+            boolean interrupted = false, cancelled = false;
+            while (!canReacquire(node)) {
+                if (interrupted |= Thread.interrupted()) {
+                    if (cancelled = (node.getAndUnsetStatus(COND) & COND) != 0)
+                        break;              // else interrupted after signal
+                } else if ((node.status & COND) != 0) {
+                    try {
+                        ForkJoinPool.managedBlock(node);
+                    } catch (InterruptedException ie) {
+                        interrupted = true;
+                    }
+                } else
+                    Thread.onSpinWait();    // awoke while enqueuing
             }
-            if (acquireQueued(node, savedState) && interruptMode != THROW_IE)
-                interruptMode = REINTERRUPT;
-            if (node.nextWaiter != null) // clean up if cancelled
-                unlinkCancelledWaiters();
-            if (interruptMode != 0)
-                reportInterruptAfterWait(interruptMode);
+            LockSupport.setCurrentBlocker(null);
+            node.clearStatus();
+            acquire(node, savedState, false, false, false, 0L);
+            if (interrupted) {
+                if (cancelled) {
+                    unlinkCancelledWaiters(node);
+                    throw new InterruptedException();
+                }
+                Thread.currentThread().interrupt();
+            }
         }
 
         /**
@@ -2107,32 +1647,29 @@
                 throws InterruptedException {
             if (Thread.interrupted())
                 throw new InterruptedException();
-            // We don't check for nanosTimeout <= 0L here, to allow
-            // awaitNanos(0) as a way to "yield the lock".
-            final long deadline = System.nanoTime() + nanosTimeout;
-            long initialNanos = nanosTimeout;
-            Node node = addConditionWaiter();
-            int savedState = fullyRelease(node);
-            int interruptMode = 0;
-            while (!isOnSyncQueue(node)) {
-                if (nanosTimeout <= 0L) {
-                    transferAfterCancelledWait(node);
-                    break;
-                }
-                if (nanosTimeout > SPIN_FOR_TIMEOUT_THRESHOLD)
-                    LockSupport.parkNanos(this, nanosTimeout);
-                if ((interruptMode = checkInterruptWhileWaiting(node)) != 0)
-                    break;
-                nanosTimeout = deadline - System.nanoTime();
+            ConditionNode node = new ConditionNode();
+            int savedState = enableWait(node);
+            long nanos = (nanosTimeout < 0L) ? 0L : nanosTimeout;
+            long deadline = System.nanoTime() + nanos;
+            boolean cancelled = false, interrupted = false;
+            while (!canReacquire(node)) {
+                if ((interrupted |= Thread.interrupted()) ||
+                    (nanos = deadline - System.nanoTime()) <= 0L) {
+                    if (cancelled = (node.getAndUnsetStatus(COND) & COND) != 0)
+                        break;
+                } else
+                    LockSupport.parkNanos(this, nanos);
             }
-            if (acquireQueued(node, savedState) && interruptMode != THROW_IE)
-                interruptMode = REINTERRUPT;
-            if (node.nextWaiter != null)
-                unlinkCancelledWaiters();
-            if (interruptMode != 0)
-                reportInterruptAfterWait(interruptMode);
+            node.clearStatus();
+            acquire(node, savedState, false, false, false, 0L);
+            if (cancelled) {
+                unlinkCancelledWaiters(node);
+                if (interrupted)
+                    throw new InterruptedException();
+            } else if (interrupted)
+                Thread.currentThread().interrupt();
             long remaining = deadline - System.nanoTime(); // avoid overflow
-            return (remaining <= initialNanos) ? remaining : Long.MIN_VALUE;
+            return (remaining <= nanosTimeout) ? remaining : Long.MIN_VALUE;
         }
 
         /**
@@ -2154,26 +1691,26 @@
             long abstime = deadline.getTime();
             if (Thread.interrupted())
                 throw new InterruptedException();
-            Node node = addConditionWaiter();
-            int savedState = fullyRelease(node);
-            boolean timedout = false;
-            int interruptMode = 0;
-            while (!isOnSyncQueue(node)) {
-                if (System.currentTimeMillis() >= abstime) {
-                    timedout = transferAfterCancelledWait(node);
-                    break;
-                }
-                LockSupport.parkUntil(this, abstime);
-                if ((interruptMode = checkInterruptWhileWaiting(node)) != 0)
-                    break;
+            ConditionNode node = new ConditionNode();
+            int savedState = enableWait(node);
+            boolean cancelled = false, interrupted = false;
+            while (!canReacquire(node)) {
+                if ((interrupted |= Thread.interrupted()) ||
+                    System.currentTimeMillis() >= abstime) {
+                    if (cancelled = (node.getAndUnsetStatus(COND) & COND) != 0)
+                        break;
+                } else
+                    LockSupport.parkUntil(this, abstime);
             }
-            if (acquireQueued(node, savedState) && interruptMode != THROW_IE)
-                interruptMode = REINTERRUPT;
-            if (node.nextWaiter != null)
-                unlinkCancelledWaiters();
-            if (interruptMode != 0)
-                reportInterruptAfterWait(interruptMode);
-            return !timedout;
+            node.clearStatus();
+            acquire(node, savedState, false, false, false, 0L);
+            if (cancelled) {
+                unlinkCancelledWaiters(node);
+                if (interrupted)
+                    throw new InterruptedException();
+            } else if (interrupted)
+                Thread.currentThread().interrupt();
+            return !cancelled;
         }
 
         /**
@@ -2195,31 +1732,28 @@
             long nanosTimeout = unit.toNanos(time);
             if (Thread.interrupted())
                 throw new InterruptedException();
-            // We don't check for nanosTimeout <= 0L here, to allow
-            // await(0, unit) as a way to "yield the lock".
-            final long deadline = System.nanoTime() + nanosTimeout;
-            Node node = addConditionWaiter();
-            int savedState = fullyRelease(node);
-            boolean timedout = false;
-            int interruptMode = 0;
-            while (!isOnSyncQueue(node)) {
-                if (nanosTimeout <= 0L) {
-                    timedout = transferAfterCancelledWait(node);
-                    break;
-                }
-                if (nanosTimeout > SPIN_FOR_TIMEOUT_THRESHOLD)
-                    LockSupport.parkNanos(this, nanosTimeout);
-                if ((interruptMode = checkInterruptWhileWaiting(node)) != 0)
-                    break;
-                nanosTimeout = deadline - System.nanoTime();
+            ConditionNode node = new ConditionNode();
+            int savedState = enableWait(node);
+            long nanos = (nanosTimeout < 0L) ? 0L : nanosTimeout;
+            long deadline = System.nanoTime() + nanos;
+            boolean cancelled = false, interrupted = false;
+            while (!canReacquire(node)) {
+                if ((interrupted |= Thread.interrupted()) ||
+                    (nanos = deadline - System.nanoTime()) <= 0L) {
+                    if (cancelled = (node.getAndUnsetStatus(COND) & COND) != 0)
+                        break;
+                } else
+                    LockSupport.parkNanos(this, nanos);
             }
-            if (acquireQueued(node, savedState) && interruptMode != THROW_IE)
-                interruptMode = REINTERRUPT;
-            if (node.nextWaiter != null)
-                unlinkCancelledWaiters();
-            if (interruptMode != 0)
-                reportInterruptAfterWait(interruptMode);
-            return !timedout;
+            node.clearStatus();
+            acquire(node, savedState, false, false, false, 0L);
+            if (cancelled) {
+                unlinkCancelledWaiters(node);
+                if (interrupted)
+                    throw new InterruptedException();
+            } else if (interrupted)
+                Thread.currentThread().interrupt();
+            return !cancelled;
         }
 
         //  support for instrumentation
@@ -2245,8 +1779,8 @@
         protected final boolean hasWaiters() {
             if (!isHeldExclusively())
                 throw new IllegalMonitorStateException();
-            for (Node w = firstWaiter; w != null; w = w.nextWaiter) {
-                if (w.waitStatus == Node.CONDITION)
+            for (ConditionNode w = firstWaiter; w != null; w = w.nextWaiter) {
+                if ((w.status & COND) != 0)
                     return true;
             }
             return false;
@@ -2265,8 +1799,8 @@
             if (!isHeldExclusively())
                 throw new IllegalMonitorStateException();
             int n = 0;
-            for (Node w = firstWaiter; w != null; w = w.nextWaiter) {
-                if (w.waitStatus == Node.CONDITION)
+            for (ConditionNode w = firstWaiter; w != null; w = w.nextWaiter) {
+                if ((w.status & COND) != 0)
                     ++n;
             }
             return n;
@@ -2285,9 +1819,9 @@
             if (!isHeldExclusively())
                 throw new IllegalMonitorStateException();
             ArrayList<Thread> list = new ArrayList<>();
-            for (Node w = firstWaiter; w != null; w = w.nextWaiter) {
-                if (w.waitStatus == Node.CONDITION) {
-                    Thread t = w.thread;
+            for (ConditionNode w = firstWaiter; w != null; w = w.nextWaiter) {
+                if ((w.status & COND) != 0) {
+                    Thread t = w.waiter;
                     if (t != null)
                         list.add(t);
                 }
@@ -2296,39 +1830,16 @@
         }
     }
 
-    // VarHandle mechanics
-    private static final VarHandle STATE;
-    private static final VarHandle HEAD;
-    private static final VarHandle TAIL;
+    // Unsafe
+    private static final Unsafe U = Unsafe.getUnsafe();
+    private static final long STATE
+        = U.objectFieldOffset(AbstractQueuedSynchronizer.class, "state");
+    private static final long HEAD
+        = U.objectFieldOffset(AbstractQueuedSynchronizer.class, "head");
+    private static final long TAIL
+        = U.objectFieldOffset(AbstractQueuedSynchronizer.class, "tail");
 
     static {
-        try {
-            MethodHandles.Lookup l = MethodHandles.lookup();
-            STATE = l.findVarHandle(AbstractQueuedSynchronizer.class, "state", int.class);
-            HEAD = l.findVarHandle(AbstractQueuedSynchronizer.class, "head", Node.class);
-            TAIL = l.findVarHandle(AbstractQueuedSynchronizer.class, "tail", Node.class);
-        } catch (ReflectiveOperationException e) {
-            throw new ExceptionInInitializerError(e);
-        }
-
-        // Reduce the risk of rare disastrous classloading in first call to
-        // LockSupport.park: https://bugs.openjdk.java.net/browse/JDK-8074773
         Class<?> ensureLoaded = LockSupport.class;
     }
-
-    /**
-     * Initializes head and tail fields on first contention.
-     */
-    private final void initializeSyncQueue() {
-        Node h;
-        if (HEAD.compareAndSet(this, null, (h = new Node())))
-            tail = h;
-    }
-
-    /**
-     * CASes tail field.
-     */
-    private final boolean compareAndSetTail(Node expect, Node update) {
-        return TAIL.compareAndSet(this, expect, update);
-    }
 }
--- a/src/java.base/share/classes/java/util/concurrent/locks/Lock.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/concurrent/locks/Lock.java	Tue Sep 24 15:19:35 2019 -0400
@@ -122,9 +122,8 @@
  * <p>All {@code Lock} implementations <em>must</em> enforce the same
  * memory synchronization semantics as provided by the built-in monitor
  * lock, as described in
- * <a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-17.html#jls-17.4">
  * Chapter 17 of
- * <cite>The Java&trade; Language Specification</cite></a>:
+ * <cite>The Java&trade; Language Specification</cite>:
  * <ul>
  * <li>A successful {@code lock} operation has the same memory
  * synchronization effects as a successful <em>Lock</em> action.
@@ -162,6 +161,7 @@
  * @see ReentrantLock
  * @see Condition
  * @see ReadWriteLock
+ * @jls 17.4 Memory Model
  *
  * @since 1.5
  * @author Doug Lea
--- a/src/java.base/share/classes/java/util/concurrent/locks/LockSupport.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/concurrent/locks/LockSupport.java	Tue Sep 24 15:19:35 2019 -0400
@@ -140,8 +140,25 @@
     private LockSupport() {} // Cannot be instantiated.
 
     private static void setBlocker(Thread t, Object arg) {
-        // Even though volatile, hotspot doesn't need a write barrier here.
-        U.putReference(t, PARKBLOCKER, arg);
+        U.putReferenceOpaque(t, PARKBLOCKER, arg);
+    }
+
+    /**
+     * Sets the object to be returned by invocations of {@link
+     * #getBlocker getBlocker} for the current thread. This method may
+     * be used before invoking the no-argument version of {@link
+     * LockSupport#park() park()} from non-public objects, allowing
+     * more helpful diagnostics, or retaining compatibility with
+     * previous implementations of blocking methods.  Previous values
+     * of the blocker are not automatically restored after blocking.
+     * To obtain the effects of {@code park(b}}, use {@code
+     * setCurrentBlocker(b); park(); setCurrentBlocker(null);}
+     *
+     * @param blocker the blocker object
+     * @since 14
+     */
+    public static void setCurrentBlocker(Object blocker) {
+        U.putReferenceOpaque(Thread.currentThread(), PARKBLOCKER, blocker);
     }
 
     /**
@@ -292,7 +309,7 @@
     public static Object getBlocker(Thread t) {
         if (t == null)
             throw new NullPointerException();
-        return U.getReferenceVolatile(t, PARKBLOCKER);
+        return U.getReferenceOpaque(t, PARKBLOCKER);
     }
 
     /**
@@ -394,24 +411,6 @@
     }
 
     /**
-     * Returns the pseudo-randomly initialized or updated secondary seed.
-     * Copied from ThreadLocalRandom due to package access restrictions.
-     */
-    static final int nextSecondarySeed() {
-        int r;
-        Thread t = Thread.currentThread();
-        if ((r = U.getInt(t, SECONDARY)) != 0) {
-            r ^= r << 13;   // xorshift
-            r ^= r >>> 17;
-            r ^= r << 5;
-        }
-        else if ((r = java.util.concurrent.ThreadLocalRandom.current().nextInt()) == 0)
-            r = 1; // avoid zero
-        U.putInt(t, SECONDARY, r);
-        return r;
-    }
-
-    /**
      * Returns the thread id for the given thread.  We must access
      * this directly rather than via method Thread.getId() because
      * getId() has been known to be overridden in ways that do not
@@ -423,11 +422,9 @@
 
     // Hotspot implementation via intrinsics API
     private static final Unsafe U = Unsafe.getUnsafe();
-    private static final long PARKBLOCKER = U.objectFieldOffset
-            (Thread.class, "parkBlocker");
-    private static final long SECONDARY = U.objectFieldOffset
-            (Thread.class, "threadLocalRandomSecondarySeed");
-    private static final long TID = U.objectFieldOffset
-            (Thread.class, "tid");
+    private static final long PARKBLOCKER
+        = U.objectFieldOffset(Thread.class, "parkBlocker");
+    private static final long TID
+        = U.objectFieldOffset(Thread.class, "tid");
 
 }
--- a/src/java.base/share/classes/java/util/concurrent/locks/ReentrantLock.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/concurrent/locks/ReentrantLock.java	Tue Sep 24 15:19:35 2019 -0400
@@ -119,39 +119,63 @@
         private static final long serialVersionUID = -5179523762034025860L;
 
         /**
-         * Performs non-fair tryLock.  tryAcquire is implemented in
-         * subclasses, but both need nonfair try for trylock method.
+         * Performs non-fair tryLock.
          */
         @ReservedStackAccess
-        final boolean nonfairTryAcquire(int acquires) {
-            final Thread current = Thread.currentThread();
+        final boolean tryLock() {
+            Thread current = Thread.currentThread();
             int c = getState();
             if (c == 0) {
-                if (compareAndSetState(0, acquires)) {
+                if (compareAndSetState(0, 1)) {
                     setExclusiveOwnerThread(current);
                     return true;
                 }
-            }
-            else if (current == getExclusiveOwnerThread()) {
-                int nextc = c + acquires;
-                if (nextc < 0) // overflow
+            } else if (getExclusiveOwnerThread() == current) {
+                if (++c < 0) // overflow
                     throw new Error("Maximum lock count exceeded");
-                setState(nextc);
+                setState(c);
                 return true;
             }
             return false;
         }
 
+        /**
+         * Checks for reentrancy and acquires if lock immediately
+         * available under fair vs nonfair rules. Locking methods
+         * perform initialTryLock check before relaying to
+         * corresponding AQS acquire methods.
+         */
+        abstract boolean initialTryLock();
+
+        @ReservedStackAccess
+        final void lock() {
+            if (!initialTryLock())
+                acquire(1);
+        }
+
+        @ReservedStackAccess
+        final void lockInterruptibly() throws InterruptedException {
+            if (Thread.interrupted())
+                throw new InterruptedException();
+            if (!initialTryLock())
+                acquireInterruptibly(1);
+        }
+
+        @ReservedStackAccess
+        final boolean tryLockNanos(long nanos) throws InterruptedException {
+            if (Thread.interrupted())
+                throw new InterruptedException();
+            return initialTryLock() || tryAcquireNanos(1, nanos);
+        }
+
         @ReservedStackAccess
         protected final boolean tryRelease(int releases) {
             int c = getState() - releases;
-            if (Thread.currentThread() != getExclusiveOwnerThread())
+            if (getExclusiveOwnerThread() != Thread.currentThread())
                 throw new IllegalMonitorStateException();
-            boolean free = false;
-            if (c == 0) {
-                free = true;
+            boolean free = (c == 0);
+            if (free)
                 setExclusiveOwnerThread(null);
-            }
             setState(c);
             return free;
         }
@@ -195,8 +219,31 @@
      */
     static final class NonfairSync extends Sync {
         private static final long serialVersionUID = 7316153563782823691L;
+
+        final boolean initialTryLock() {
+            Thread current = Thread.currentThread();
+            if (compareAndSetState(0, 1)) { // first attempt is unguarded
+                setExclusiveOwnerThread(current);
+                return true;
+            } else if (getExclusiveOwnerThread() == current) {
+                int c = getState() + 1;
+                if (c < 0) // overflow
+                    throw new Error("Maximum lock count exceeded");
+                setState(c);
+                return true;
+            } else
+                return false;
+        }
+
+        /**
+         * Acquire for non-reentrant cases after initialTryLock prescreen
+         */
         protected final boolean tryAcquire(int acquires) {
-            return nonfairTryAcquire(acquires);
+            if (getState() == 0 && compareAndSetState(0, acquires)) {
+                setExclusiveOwnerThread(Thread.currentThread());
+                return true;
+            }
+            return false;
         }
     }
 
@@ -205,26 +252,34 @@
      */
     static final class FairSync extends Sync {
         private static final long serialVersionUID = -3000897897090466540L;
+
         /**
-         * Fair version of tryAcquire.  Don't grant access unless
-         * recursive call or no waiters or is first.
+         * Acquires only if reentrant or queue is empty.
          */
-        @ReservedStackAccess
-        protected final boolean tryAcquire(int acquires) {
-            final Thread current = Thread.currentThread();
+        final boolean initialTryLock() {
+            Thread current = Thread.currentThread();
             int c = getState();
             if (c == 0) {
-                if (!hasQueuedPredecessors() &&
-                    compareAndSetState(0, acquires)) {
+                if (!hasQueuedThreads() && compareAndSetState(0, 1)) {
                     setExclusiveOwnerThread(current);
                     return true;
                 }
+            } else if (getExclusiveOwnerThread() == current) {
+                if (++c < 0) // overflow
+                    throw new Error("Maximum lock count exceeded");
+                setState(c);
+                return true;
             }
-            else if (current == getExclusiveOwnerThread()) {
-                int nextc = c + acquires;
-                if (nextc < 0)
-                    throw new Error("Maximum lock count exceeded");
-                setState(nextc);
+            return false;
+        }
+
+        /**
+         * Acquires only if thread is first waiter or empty
+         */
+        protected final boolean tryAcquire(int acquires) {
+            if (getState() == 0 && !hasQueuedPredecessors() &&
+                compareAndSetState(0, acquires)) {
+                setExclusiveOwnerThread(Thread.currentThread());
                 return true;
             }
             return false;
@@ -264,7 +319,7 @@
      * at which time the lock hold count is set to one.
      */
     public void lock() {
-        sync.acquire(1);
+        sync.lock();
     }
 
     /**
@@ -314,7 +369,7 @@
      * @throws InterruptedException if the current thread is interrupted
      */
     public void lockInterruptibly() throws InterruptedException {
-        sync.acquireInterruptibly(1);
+        sync.lockInterruptibly();
     }
 
     /**
@@ -344,7 +399,7 @@
      *         thread; and {@code false} otherwise
      */
     public boolean tryLock() {
-        return sync.nonfairTryAcquire(1);
+        return sync.tryLock();
     }
 
     /**
@@ -421,7 +476,7 @@
      */
     public boolean tryLock(long timeout, TimeUnit unit)
             throws InterruptedException {
-        return sync.tryAcquireNanos(1, unit.toNanos(timeout));
+        return sync.tryLockNanos(unit.toNanos(timeout));
     }
 
     /**
--- a/src/java.base/share/classes/java/util/concurrent/locks/StampedLock.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/concurrent/locks/StampedLock.java	Tue Sep 24 15:19:35 2019 -0400
@@ -35,9 +35,8 @@
 
 package java.util.concurrent.locks;
 
-import java.lang.invoke.MethodHandles;
-import java.lang.invoke.VarHandle;
 import java.util.concurrent.TimeUnit;
+import jdk.internal.misc.Unsafe;
 import jdk.internal.vm.annotation.ReservedStackAccess;
 
 /**
@@ -132,9 +131,8 @@
  *
  * <p><b>Memory Synchronization.</b> Methods with the effect of
  * successfully locking in any mode have the same memory
- * synchronization effects as a <em>Lock</em> action described in
- * <a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-17.html#jls-17.4">
- * Chapter 17 of <cite>The Java&trade; Language Specification</cite></a>.
+ * synchronization effects as a <em>Lock</em> action, as described in
+ * Chapter 17 of <cite>The Java&trade; Language Specification</cite>.
  * Methods successfully unlocking in write mode have the same memory
  * synchronization effects as an <em>Unlock</em> action.  In optimistic
  * read usages, actions prior to the most recent write mode unlock action
@@ -237,6 +235,7 @@
  *   }
  * }}</pre>
  *
+ * @jls 17.4 Memory Model
  * @since 1.8
  * @author Doug Lea
  */
@@ -264,122 +263,54 @@
      * updates.
      *
      * Waiters use a modified form of CLH lock used in
-     * AbstractQueuedSynchronizer (see its internal documentation for
-     * a fuller account), where each node is tagged (field mode) as
-     * either a reader or writer. Sets of waiting readers are grouped
-     * (linked) under a common node (field cowait) so act as a single
-     * node with respect to most CLH mechanics.  By virtue of the
-     * queue structure, wait nodes need not actually carry sequence
-     * numbers; we know each is greater than its predecessor.  This
-     * simplifies the scheduling policy to a mainly-FIFO scheme that
-     * incorporates elements of Phase-Fair locks (see Brandenburg &
-     * Anderson, especially http://www.cs.unc.edu/~bbb/diss/).  In
-     * particular, we use the phase-fair anti-barging rule: If an
-     * incoming reader arrives while read lock is held but there is a
-     * queued writer, this incoming reader is queued.  (This rule is
-     * responsible for some of the complexity of method acquireRead,
-     * but without it, the lock becomes highly unfair.) Method release
-     * does not (and sometimes cannot) itself wake up cowaiters. This
-     * is done by the primary thread, but helped by any other threads
-     * with nothing better to do in methods acquireRead and
-     * acquireWrite.
+     * AbstractQueuedSynchronizer (AQS; see its internal documentation
+     * for a fuller account), where each node is either a ReaderNode
+     * or WriterNode. Implementation of queued Writer mode is
+     * identical to AQS except for lock-state operations.  Sets of
+     * waiting readers are grouped (linked) under a common node (field
+     * cowaiters) so act as a single node with respect to most CLH
+     * mechanics.  This simplifies the scheduling policy to a
+     * mainly-FIFO scheme that incorporates elements of Phase-Fair
+     * locks (see Brandenburg & Anderson, especially
+     * http://www.cs.unc.edu/~bbb/diss/).  Method release does not
+     * itself wake up cowaiters. This is done by the primary thread,
+     * but helped by other cowaiters as they awaken.
      *
-     * These rules apply to threads actually queued. All tryLock forms
-     * opportunistically try to acquire locks regardless of preference
-     * rules, and so may "barge" their way in.  Randomized spinning is
-     * used in the acquire methods to reduce (increasingly expensive)
-     * context switching while also avoiding sustained memory
-     * thrashing among many threads.  We limit spins to the head of
-     * queue. If, upon wakening, a thread fails to obtain lock, and is
-     * still (or becomes) the first waiting thread (which indicates
-     * that some other thread barged and obtained lock), it escalates
-     * spins (up to MAX_HEAD_SPINS) to reduce the likelihood of
-     * continually losing to barging threads.
+     * These rules apply to threads actually queued. Threads may also
+     * try to acquire locks before or in the process of enqueueing
+     * regardless of preference rules, and so may "barge" their way
+     * in.  Methods writeLock and readLock (but not the other variants
+     * of each) first unconditionally try to CAS state, falling back
+     * to test-and-test-and-set retries on failure, slightly shrinking
+     * race windows on initial attempts, thus making success more
+     * likely. Also, when some threads cancel (via interrupt or
+     * timeout), phase-fairness is at best roughly approximated.
      *
      * Nearly all of these mechanics are carried out in methods
      * acquireWrite and acquireRead, that, as typical of such code,
      * sprawl out because actions and retries rely on consistent sets
      * of locally cached reads.
      *
-     * As noted in Boehm's paper (above), sequence validation (mainly
-     * method validate()) requires stricter ordering rules than apply
-     * to normal volatile reads (of "state").  To force orderings of
-     * reads before a validation and the validation itself in those
-     * cases where this is not already forced, we use acquireFence.
-     * Unlike in that paper, we allow writers to use plain writes.
-     * One would not expect reorderings of such writes with the lock
-     * acquisition CAS because there is a "control dependency", but it
-     * is theoretically possible, so we additionally add a
-     * storeStoreFence after lock acquisition CAS.
-     *
-     * ----------------------------------------------------------------
-     * Here's an informal proof that plain reads by _successful_
-     * readers see plain writes from preceding but not following
-     * writers (following Boehm and the C++ standard [atomics.fences]):
-     *
-     * Because of the total synchronization order of accesses to
-     * volatile long state containing the sequence number, writers and
-     * _successful_ readers can be globally sequenced.
-     *
-     * int x, y;
-     *
-     * Writer 1:
-     * inc sequence (odd - "locked")
-     * storeStoreFence();
-     * x = 1; y = 2;
-     * inc sequence (even - "unlocked")
-     *
-     * Successful Reader:
-     * read sequence (even)
-     * // must see writes from Writer 1 but not Writer 2
-     * r1 = x; r2 = y;
-     * acquireFence();
-     * read sequence (even - validated unchanged)
-     * // use r1 and r2
-     *
-     * Writer 2:
-     * inc sequence (odd - "locked")
-     * storeStoreFence();
-     * x = 3; y = 4;
-     * inc sequence (even - "unlocked")
-     *
-     * Visibility of writer 1's stores is normal - reader's initial
-     * read of state synchronizes with writer 1's final write to state.
-     * Lack of visibility of writer 2's plain writes is less obvious.
-     * If reader's read of x or y saw writer 2's write, then (assuming
-     * semantics of C++ fences) the storeStoreFence would "synchronize"
-     * with reader's acquireFence and reader's validation read must see
-     * writer 2's initial write to state and so validation must fail.
-     * But making this "proof" formal and rigorous is an open problem!
-     * ----------------------------------------------------------------
+     * For an explanation of the use of acquireFence, see
+     * http://gee.cs.oswego.edu/dl/html/j9mm.html as well as Boehm's
+     * paper (above). Note that sequence validation (mainly method
+     * validate()) requires stricter ordering rules than apply to
+     * normal volatile reads (of "state").  To ensure that writeLock
+     * acquisitions strictly precede subsequent writes in cases where
+     * this is not already forced, we use a storeStoreFence.
      *
      * The memory layout keeps lock state and queue pointers together
      * (normally on the same cache line). This usually works well for
      * read-mostly loads. In most other cases, the natural tendency of
-     * adaptive-spin CLH locks to reduce memory contention lessens
-     * motivation to further spread out contended locations, but might
-     * be subject to future improvements.
+     * CLH locks to reduce memory contention lessens motivation to
+     * further spread out contended locations, but might be subject to
+     * future improvements.
      */
 
     private static final long serialVersionUID = -6001602636862214147L;
 
-    /** Number of processors, for spin control */
-    private static final int NCPU = Runtime.getRuntime().availableProcessors();
-
-    /** Maximum number of retries before enqueuing on acquisition; at least 1 */
-    private static final int SPINS = (NCPU > 1) ? 1 << 6 : 1;
-
-    /** Maximum number of tries before blocking at head on acquisition */
-    private static final int HEAD_SPINS = (NCPU > 1) ? 1 << 10 : 1;
-
-    /** Maximum number of retries before re-blocking */
-    private static final int MAX_HEAD_SPINS = (NCPU > 1) ? 1 << 16 : 1;
-
-    /** The period for yielding when waiting for overflow spinlock */
-    private static final int OVERFLOW_YIELD_RATE = 7; // must be power 2 - 1
-
     /** The number of bits to use for reader count before overflowing */
-    private static final int LG_READERS = 7;
+    private static final int LG_READERS = 7; // 127 readers
 
     // Values for lock state and stamp operations
     private static final long RUNIT = 1L;
@@ -388,6 +319,8 @@
     private static final long RFULL = RBITS - 1L;
     private static final long ABITS = RBITS | WBIT;
     private static final long SBITS = ~RBITS; // note overlap with ABITS
+    // not writing and conservatively non-overflowing
+    private static final long RSAFE = ~(3L << (LG_READERS - 1));
 
     /*
      * 3 stamp modes can be distinguished by examining (m = stamp & ABITS):
@@ -408,29 +341,64 @@
     // Special value from cancelled acquire methods so caller can throw IE
     private static final long INTERRUPTED = 1L;
 
-    // Values for node status; order matters
-    private static final int WAITING   = -1;
-    private static final int CANCELLED =  1;
+    // Bits for Node.status
+    static final int WAITING   = 1;
+    static final int CANCELLED = 0x80000000; // must be negative
 
-    // Modes for nodes (int not boolean to allow arithmetic)
-    private static final int RMODE = 0;
-    private static final int WMODE = 1;
+    /** CLH nodes */
+    abstract static class Node {
+        volatile Node prev;       // initially attached via casTail
+        volatile Node next;       // visibly nonnull when signallable
+        Thread waiter;            // visibly nonnull when enqueued
+        volatile int status;      // written by owner, atomic bit ops by others
 
-    /** Wait nodes */
-    static final class WNode {
-        volatile WNode prev;
-        volatile WNode next;
-        volatile WNode cowait;    // list of linked readers
-        volatile Thread thread;   // non-null while possibly parked
-        volatile int status;      // 0, WAITING, or CANCELLED
-        final int mode;           // RMODE or WMODE
-        WNode(int m, WNode p) { mode = m; prev = p; }
+        // methods for atomic operations
+        final boolean casPrev(Node c, Node v) {  // for cleanQueue
+            return U.weakCompareAndSetReference(this, PREV, c, v);
+        }
+        final boolean casNext(Node c, Node v) {  // for cleanQueue
+            return U.weakCompareAndSetReference(this, NEXT, c, v);
+        }
+        final int getAndUnsetStatus(int v) {     // for signalling
+            return U.getAndBitwiseAndInt(this, STATUS, ~v);
+        }
+        final void setPrevRelaxed(Node p) {      // for off-queue assignment
+            U.putReference(this, PREV, p);
+        }
+        final void setStatusRelaxed(int s) {     // for off-queue assignment
+            U.putInt(this, STATUS, s);
+        }
+        final void clearStatus() {               // for reducing unneeded signals
+            U.putIntOpaque(this, STATUS, 0);
+        }
+
+        private static final long STATUS
+            = U.objectFieldOffset(Node.class, "status");
+        private static final long NEXT
+            = U.objectFieldOffset(Node.class, "next");
+        private static final long PREV
+            = U.objectFieldOffset(Node.class, "prev");
+    }
+
+    static final class WriterNode extends Node { // node for writers
+    }
+
+    static final class ReaderNode extends Node { // node for readers
+        volatile ReaderNode cowaiters;           // list of linked readers
+        final boolean casCowaiters(ReaderNode c, ReaderNode v) {
+            return U.weakCompareAndSetReference(this, COWAITERS, c, v);
+        }
+        final void setCowaitersRelaxed(ReaderNode p) {
+            U.putReference(this, COWAITERS, p);
+        }
+        private static final long COWAITERS
+            = U.objectFieldOffset(ReaderNode.class, "cowaiters");
     }
 
     /** Head of CLH queue */
-    private transient volatile WNode whead;
+    private transient volatile Node head;
     /** Tail (last) of CLH queue */
-    private transient volatile WNode wtail;
+    private transient volatile Node tail;
 
     // views
     transient ReadLockView readLockView;
@@ -449,18 +417,50 @@
         state = ORIGIN;
     }
 
-    private boolean casState(long expectedValue, long newValue) {
-        return STATE.compareAndSet(this, expectedValue, newValue);
+    // internal lock methods
+
+    private boolean casState(long expect, long update) {
+        return U.compareAndSetLong(this, STATE, expect, update);
+    }
+
+    @ReservedStackAccess
+    private long tryAcquireWrite() {
+        long s, nextState;
+        if (((s = state) & ABITS) == 0L && casState(s, nextState = s | WBIT)) {
+            U.storeStoreFence();
+            return nextState;
+        }
+        return 0L;
     }
 
-    private long tryWriteLock(long s) {
-        // assert (s & ABITS) == 0L;
-        long next;
-        if (casState(s, next = s | WBIT)) {
-            VarHandle.storeStoreFence();
-            return next;
+    @ReservedStackAccess
+    private long tryAcquireRead() {
+        for (long s, m, nextState;;) {
+            if ((m = (s = state) & ABITS) < RFULL) {
+                if (casState(s, nextState = s + RUNIT))
+                    return nextState;
+            }
+            else if (m == WBIT)
+                return 0L;
+            else if ((nextState = tryIncReaderOverflow(s)) != 0L)
+                return nextState;
         }
-        return 0L;
+    }
+
+    /**
+     * Returns an unlocked state, incrementing the version and
+     * avoiding special failure value 0L.
+     *
+     * @param s a write-locked state (or stamp)
+     */
+    private static long unlockWriteState(long s) {
+        return ((s += WBIT) == 0L) ? ORIGIN : s;
+    }
+
+    private long releaseWrite(long s) {
+        long nextState = state = unlockWriteState(s);
+        signalNext(head);
+        return nextState;
     }
 
     /**
@@ -471,8 +471,13 @@
      */
     @ReservedStackAccess
     public long writeLock() {
-        long next;
-        return ((next = tryWriteLock()) != 0L) ? next : acquireWrite(false, 0L);
+        // try unconditional CAS confirming weak read
+        long s = U.getLongOpaque(this, STATE) & ~ABITS, nextState;
+        if (casState(s, nextState = s | WBIT)) {
+            U.storeStoreFence();
+            return nextState;
+        }
+        return acquireWrite(false, false, 0L);
     }
 
     /**
@@ -481,10 +486,8 @@
      * @return a write stamp that can be used to unlock or convert mode,
      * or zero if the lock is not available
      */
-    @ReservedStackAccess
     public long tryWriteLock() {
-        long s;
-        return (((s = state) & ABITS) == 0L) ? tryWriteLock(s) : 0L;
+        return tryAcquireWrite();
     }
 
     /**
@@ -504,15 +507,14 @@
         throws InterruptedException {
         long nanos = unit.toNanos(time);
         if (!Thread.interrupted()) {
-            long next, deadline;
-            if ((next = tryWriteLock()) != 0L)
-                return next;
+            long nextState;
+            if ((nextState = tryAcquireWrite()) != 0L)
+                return nextState;
             if (nanos <= 0L)
                 return 0L;
-            if ((deadline = System.nanoTime() + nanos) == 0L)
-                deadline = 1L;
-            if ((next = acquireWrite(true, deadline)) != INTERRUPTED)
-                return next;
+            nextState = acquireWrite(true, true, System.nanoTime() + nanos);
+            if (nextState != INTERRUPTED)
+                return nextState;
         }
         throw new InterruptedException();
     }
@@ -527,12 +529,12 @@
      * @throws InterruptedException if the current thread is interrupted
      * before acquiring the lock
      */
-    @ReservedStackAccess
     public long writeLockInterruptibly() throws InterruptedException {
-        long next;
+        long nextState;
         if (!Thread.interrupted() &&
-            (next = acquireWrite(true, 0L)) != INTERRUPTED)
-            return next;
+            ((nextState = tryAcquireWrite()) != 0L ||
+             (nextState = acquireWrite(true, false, 0L)) != INTERRUPTED))
+            return nextState;
         throw new InterruptedException();
     }
 
@@ -544,13 +546,12 @@
      */
     @ReservedStackAccess
     public long readLock() {
-        long s, next;
-        // bypass acquireRead on common uncontended case
-        return (whead == wtail
-                && ((s = state) & ABITS) < RFULL
-                && casState(s, next = s + RUNIT))
-            ? next
-            : acquireRead(false, 0L);
+        // unconditionally optimistically try non-overflow case once
+        long s = U.getLongOpaque(this, STATE) & RSAFE, nextState;
+        if (casState(s, nextState = s + RUNIT))
+            return nextState;
+        else
+            return acquireRead(false, false, 0L);
     }
 
     /**
@@ -559,18 +560,8 @@
      * @return a read stamp that can be used to unlock or convert mode,
      * or zero if the lock is not available
      */
-    @ReservedStackAccess
     public long tryReadLock() {
-        long s, m, next;
-        while ((m = (s = state) & ABITS) != WBIT) {
-            if (m < RFULL) {
-                if (casState(s, next = s + RUNIT))
-                    return next;
-            }
-            else if ((next = tryIncReaderOverflow(s)) != 0L)
-                return next;
-        }
-        return 0L;
+        return tryAcquireRead();
     }
 
     /**
@@ -586,26 +577,18 @@
      * @throws InterruptedException if the current thread is interrupted
      * before acquiring the lock
      */
-    @ReservedStackAccess
     public long tryReadLock(long time, TimeUnit unit)
         throws InterruptedException {
-        long s, m, next, deadline;
         long nanos = unit.toNanos(time);
         if (!Thread.interrupted()) {
-            if ((m = (s = state) & ABITS) != WBIT) {
-                if (m < RFULL) {
-                    if (casState(s, next = s + RUNIT))
-                        return next;
-                }
-                else if ((next = tryIncReaderOverflow(s)) != 0L)
-                    return next;
-            }
+            long nextState;
+            if (tail == head && (nextState = tryAcquireRead()) != 0L)
+                return nextState;
             if (nanos <= 0L)
                 return 0L;
-            if ((deadline = System.nanoTime() + nanos) == 0L)
-                deadline = 1L;
-            if ((next = acquireRead(true, deadline)) != INTERRUPTED)
-                return next;
+            nextState = acquireRead(true, true, System.nanoTime() + nanos);
+            if (nextState != INTERRUPTED)
+                return nextState;
         }
         throw new InterruptedException();
     }
@@ -620,17 +603,12 @@
      * @throws InterruptedException if the current thread is interrupted
      * before acquiring the lock
      */
-    @ReservedStackAccess
     public long readLockInterruptibly() throws InterruptedException {
-        long s, next;
-        if (!Thread.interrupted()
-            // bypass acquireRead on common uncontended case
-            && ((whead == wtail
-                 && ((s = state) & ABITS) < RFULL
-                 && casState(s, next = s + RUNIT))
-                ||
-                (next = acquireRead(true, 0L)) != INTERRUPTED))
-            return next;
+        long nextState;
+        if (!Thread.interrupted() &&
+            ((nextState = tryAcquireRead()) != 0L ||
+             (nextState = acquireRead(true, false, 0L)) != INTERRUPTED))
+            return nextState;
         throw new InterruptedException();
     }
 
@@ -658,29 +636,11 @@
      * since issuance of the given stamp; else false
      */
     public boolean validate(long stamp) {
-        VarHandle.acquireFence();
+        U.loadFence();
         return (stamp & SBITS) == (state & SBITS);
     }
 
     /**
-     * Returns an unlocked state, incrementing the version and
-     * avoiding special failure value 0L.
-     *
-     * @param s a write-locked state (or stamp)
-     */
-    private static long unlockWriteState(long s) {
-        return ((s += WBIT) == 0L) ? ORIGIN : s;
-    }
-
-    private long unlockWriteInternal(long s) {
-        long next; WNode h;
-        STATE.setVolatile(this, next = unlockWriteState(s));
-        if ((h = whead) != null && h.status != 0)
-            release(h);
-        return next;
-    }
-
-    /**
      * If the lock state matches the given stamp, releases the
      * exclusive lock.
      *
@@ -692,7 +652,7 @@
     public void unlockWrite(long stamp) {
         if (state != stamp || (stamp & WBIT) == 0L)
             throw new IllegalMonitorStateException();
-        unlockWriteInternal(stamp);
+        releaseWrite(stamp);
     }
 
     /**
@@ -705,19 +665,20 @@
      */
     @ReservedStackAccess
     public void unlockRead(long stamp) {
-        long s, m; WNode h;
-        while (((s = state) & SBITS) == (stamp & SBITS)
-               && (stamp & RBITS) > 0L
-               && ((m = s & RBITS) > 0L)) {
-            if (m < RFULL) {
-                if (casState(s, s - RUNIT)) {
-                    if (m == RUNIT && (h = whead) != null && h.status != 0)
-                        release(h);
+        long s, m;
+        if ((stamp & RBITS) != 0L) {
+            while (((s = state) & SBITS) == (stamp & SBITS) &&
+                   ((m = s & RBITS) != 0L)) {
+                if (m < RFULL) {
+                    if (casState(s, s - RUNIT)) {
+                        if (m == RUNIT)
+                            signalNext(head);
+                        return;
+                    }
+                }
+                else if (tryDecReaderOverflow(s) != 0L)
                     return;
-                }
             }
-            else if (tryDecReaderOverflow(s) != 0L)
-                return;
         }
         throw new IllegalMonitorStateException();
     }
@@ -730,7 +691,6 @@
      * @throws IllegalMonitorStateException if the stamp does
      * not match the current state of this lock
      */
-    @ReservedStackAccess
     public void unlock(long stamp) {
         if ((stamp & WBIT) != 0L)
             unlockWrite(stamp);
@@ -751,26 +711,23 @@
      * @return a valid write stamp, or zero on failure
      */
     public long tryConvertToWriteLock(long stamp) {
-        long a = stamp & ABITS, m, s, next;
+        long a = stamp & ABITS, m, s, nextState;
         while (((s = state) & SBITS) == (stamp & SBITS)) {
             if ((m = s & ABITS) == 0L) {
                 if (a != 0L)
                     break;
-                if ((next = tryWriteLock(s)) != 0L)
-                    return next;
-            }
-            else if (m == WBIT) {
+                if (casState(s, nextState = s | WBIT)) {
+                    U.storeStoreFence();
+                    return nextState;
+                }
+            } else if (m == WBIT) {
                 if (a != m)
                     break;
                 return stamp;
-            }
-            else if (m == RUNIT && a != 0L) {
-                if (casState(s, next = s - RUNIT + WBIT)) {
-                    VarHandle.storeStoreFence();
-                    return next;
-                }
-            }
-            else
+            } else if (m == RUNIT && a != 0L) {
+                if (casState(s, nextState = s - RUNIT + WBIT))
+                    return nextState;
+            } else
                 break;
         }
         return 0L;
@@ -788,28 +745,21 @@
      * @return a valid read stamp, or zero on failure
      */
     public long tryConvertToReadLock(long stamp) {
-        long a, s, next; WNode h;
+        long a, s, nextState;
         while (((s = state) & SBITS) == (stamp & SBITS)) {
             if ((a = stamp & ABITS) >= WBIT) {
-                // write stamp
-                if (s != stamp)
+                if (s != stamp) // write stamp
                     break;
-                STATE.setVolatile(this, next = unlockWriteState(s) + RUNIT);
-                if ((h = whead) != null && h.status != 0)
-                    release(h);
-                return next;
-            }
-            else if (a == 0L) {
-                // optimistic read stamp
+                nextState = state = unlockWriteState(s) + RUNIT;
+                signalNext(head);
+                return nextState;
+            } else if (a == 0L) { // optimistic read stamp
                 if ((s & ABITS) < RFULL) {
-                    if (casState(s, next = s + RUNIT))
-                        return next;
-                }
-                else if ((next = tryIncReaderOverflow(s)) != 0L)
-                    return next;
-            }
-            else {
-                // already a read stamp
+                    if (casState(s, nextState = s + RUNIT))
+                        return nextState;
+                } else if ((nextState = tryIncReaderOverflow(s)) != 0L)
+                    return nextState;
+            } else { // already a read stamp
                 if ((s & ABITS) == 0L)
                     break;
                 return stamp;
@@ -829,29 +779,25 @@
      * @return a valid optimistic read stamp, or zero on failure
      */
     public long tryConvertToOptimisticRead(long stamp) {
-        long a, m, s, next; WNode h;
-        VarHandle.acquireFence();
+        long a, m, s, nextState;
+        U.loadFence();
         while (((s = state) & SBITS) == (stamp & SBITS)) {
             if ((a = stamp & ABITS) >= WBIT) {
-                // write stamp
-                if (s != stamp)
+                if (s != stamp)   // write stamp
                     break;
-                return unlockWriteInternal(s);
-            }
-            else if (a == 0L)
-                // already an optimistic read stamp
+                return releaseWrite(s);
+            } else if (a == 0L) { // already an optimistic read stamp
                 return stamp;
-            else if ((m = s & ABITS) == 0L) // invalid read stamp
+            } else if ((m = s & ABITS) == 0L) { // invalid read stamp
                 break;
-            else if (m < RFULL) {
-                if (casState(s, next = s - RUNIT)) {
-                    if (m == RUNIT && (h = whead) != null && h.status != 0)
-                        release(h);
-                    return next & SBITS;
+            } else if (m < RFULL) {
+                if (casState(s, nextState = s - RUNIT)) {
+                    if (m == RUNIT)
+                        signalNext(head);
+                    return nextState & SBITS;
                 }
-            }
-            else if ((next = tryDecReaderOverflow(s)) != 0L)
-                return next & SBITS;
+            } else if ((nextState = tryDecReaderOverflow(s)) != 0L)
+                return nextState & SBITS;
         }
         return 0L;
     }
@@ -867,7 +813,7 @@
     public boolean tryUnlockWrite() {
         long s;
         if (((s = state) & WBIT) != 0L) {
-            unlockWriteInternal(s);
+            releaseWrite(s);
             return true;
         }
         return false;
@@ -882,12 +828,12 @@
      */
     @ReservedStackAccess
     public boolean tryUnlockRead() {
-        long s, m; WNode h;
+        long s, m;
         while ((m = (s = state) & ABITS) != 0L && m < WBIT) {
             if (m < RFULL) {
                 if (casState(s, s - RUNIT)) {
-                    if (m == RUNIT && (h = whead) != null && h.status != 0)
-                        release(h);
+                    if (m == RUNIT)
+                        signalNext(head);
                     return true;
                 }
             }
@@ -1133,16 +1079,16 @@
         long s;
         if (((s = state) & WBIT) == 0L)
             throw new IllegalMonitorStateException();
-        unlockWriteInternal(s);
+        releaseWrite(s);
     }
 
     final void unstampedUnlockRead() {
-        long s, m; WNode h;
+        long s, m;
         while ((m = (s = state) & RBITS) > 0L) {
             if (m < RFULL) {
                 if (casState(s, s - RUNIT)) {
-                    if (m == RUNIT && (h = whead) != null && h.status != 0)
-                        release(h);
+                    if (m == RUNIT)
+                        signalNext(head);
                     return;
                 }
             }
@@ -1155,10 +1101,10 @@
     private void readObject(java.io.ObjectInputStream s)
         throws java.io.IOException, ClassNotFoundException {
         s.defaultReadObject();
-        STATE.setVolatile(this, ORIGIN); // reset to unlocked state
+        state = ORIGIN; // reset to unlocked state
     }
 
-    // internals
+    // overflow handling methods
 
     /**
      * Tries to increment readerOverflow by first setting state
@@ -1170,17 +1116,12 @@
      */
     private long tryIncReaderOverflow(long s) {
         // assert (s & ABITS) >= RFULL;
-        if ((s & ABITS) == RFULL) {
-            if (casState(s, s | RBITS)) {
-                ++readerOverflow;
-                STATE.setVolatile(this, s);
-                return s;
-            }
+        if ((s & ABITS) != RFULL)
+            Thread.onSpinWait();
+        else if (casState(s, s | RBITS)) {
+            ++readerOverflow;
+            return state = s;
         }
-        else if ((LockSupport.nextSecondarySeed() & OVERFLOW_YIELD_RATE) == 0)
-            Thread.yield();
-        else
-            Thread.onSpinWait();
         return 0L;
     }
 
@@ -1192,153 +1133,132 @@
      */
     private long tryDecReaderOverflow(long s) {
         // assert (s & ABITS) >= RFULL;
-        if ((s & ABITS) == RFULL) {
-            if (casState(s, s | RBITS)) {
-                int r; long next;
-                if ((r = readerOverflow) > 0) {
-                    readerOverflow = r - 1;
-                    next = s;
-                }
-                else
-                    next = s - RUNIT;
-                STATE.setVolatile(this, next);
-                return next;
+        if ((s & ABITS) != RFULL)
+            Thread.onSpinWait();
+        else if (casState(s, s | RBITS)) {
+            int r; long nextState;
+            if ((r = readerOverflow) > 0) {
+                readerOverflow = r - 1;
+                nextState = s;
             }
+            else
+                nextState = s - RUNIT;
+            return state = nextState;
         }
-        else if ((LockSupport.nextSecondarySeed() & OVERFLOW_YIELD_RATE) == 0)
-            Thread.yield();
-        else
-            Thread.onSpinWait();
         return 0L;
     }
 
+    // release methods
+
     /**
-     * Wakes up the successor of h (normally whead). This is normally
-     * just h.next, but may require traversal from wtail if next
-     * pointers are lagging. This may fail to wake up an acquiring
-     * thread when one or more have been cancelled, but the cancel
-     * methods themselves provide extra safeguards to ensure liveness.
+     * Wakes up the successor of given node, if one exists, and unsets its
+     * WAITING status to avoid park race. This may fail to wake up an
+     * eligible thread when one or more have been cancelled, but
+     * cancelAcquire ensures liveness.
      */
-    private void release(WNode h) {
-        if (h != null) {
-            WNode q; Thread w;
-            WSTATUS.compareAndSet(h, WAITING, 0);
-            if ((q = h.next) == null || q.status == CANCELLED) {
-                for (WNode t = wtail; t != null && t != h; t = t.prev)
-                    if (t.status <= 0)
-                        q = t;
-            }
-            if (q != null && (w = q.thread) != null)
-                LockSupport.unpark(w);
+    static final void signalNext(Node h) {
+        Node s;
+        if (h != null && (s = h.next) != null && s.status > 0) {
+            s.getAndUnsetStatus(WAITING);
+            LockSupport.unpark(s.waiter);
         }
     }
 
     /**
-     * See above for explanation.
+     * Removes and unparks all cowaiters of node, if it exists.
+     */
+    private static void signalCowaiters(ReaderNode node) {
+        if (node != null) {
+            for (ReaderNode c; (c = node.cowaiters) != null; ) {
+                if (node.casCowaiters(c, c.cowaiters))
+                    LockSupport.unpark(c.waiter);
+            }
+        }
+    }
+
+    // queue link methods
+    private boolean casTail(Node c, Node v) {
+        return U.compareAndSetReference(this, TAIL, c, v);
+    }
+
+    /** tries once to CAS a new dummy node for head */
+    private void tryInitializeHead() {
+        Node h = new WriterNode();
+        if (U.compareAndSetReference(this, HEAD, null, h))
+            tail = h;
+    }
+
+    /**
+     * For explanation, see above and AbstractQueuedSynchronizer
+     * internal documentation.
      *
      * @param interruptible true if should check interrupts and if so
      * return INTERRUPTED
-     * @param deadline if nonzero, the System.nanoTime value to timeout
-     * at (and return zero)
+     * @param timed if true use timed waits
+     * @param time the System.nanoTime value to timeout at (and return zero)
      * @return next state, or INTERRUPTED
      */
-    private long acquireWrite(boolean interruptible, long deadline) {
-        WNode node = null, p;
-        for (int spins = -1;;) { // spin while enqueuing
-            long m, s, ns;
-            if ((m = (s = state) & ABITS) == 0L) {
-                if ((ns = tryWriteLock(s)) != 0L)
-                    return ns;
+    private long acquireWrite(boolean interruptible, boolean timed, long time) {
+        byte spins = 0, postSpins = 0;   // retries upon unpark of first thread
+        boolean interrupted = false, first = false;
+        WriterNode node = null;
+        Node pred = null;
+        for (long s, nextState;;) {
+            if (!first && (pred = (node == null) ? null : node.prev) != null &&
+                !(first = (head == pred))) {
+                if (pred.status < 0) {
+                    cleanQueue();           // predecessor cancelled
+                    continue;
+                } else if (pred.prev == null) {
+                    Thread.onSpinWait();    // ensure serialization
+                    continue;
+                }
             }
-            else if (spins < 0)
-                spins = (m == WBIT && wtail == whead) ? SPINS : 0;
-            else if (spins > 0) {
+            if ((first || pred == null) && ((s = state) & ABITS) == 0L &&
+                casState(s, nextState = s | WBIT)) {
+                U.storeStoreFence();
+                if (first) {
+                    node.prev = null;
+                    head = node;
+                    pred.next = null;
+                    node.waiter = null;
+                    if (interrupted)
+                        Thread.currentThread().interrupt();
+                }
+                return nextState;
+            } else if (node == null) {          // retry before enqueuing
+                node = new WriterNode();
+            } else if (pred == null) {          // try to enqueue
+                Node t = tail;
+                node.setPrevRelaxed(t);
+                if (t == null)
+                    tryInitializeHead();
+                else if (!casTail(t, node))
+                    node.setPrevRelaxed(null);  // back out
+                else
+                    t.next = node;
+            } else if (first && spins != 0) {   // reduce unfairness
                 --spins;
                 Thread.onSpinWait();
-            }
-            else if ((p = wtail) == null) { // initialize queue
-                WNode hd = new WNode(WMODE, null);
-                if (WHEAD.weakCompareAndSet(this, null, hd))
-                    wtail = hd;
-            }
-            else if (node == null)
-                node = new WNode(WMODE, p);
-            else if (node.prev != p)
-                node.prev = p;
-            else if (WTAIL.weakCompareAndSet(this, p, node)) {
-                p.next = node;
-                break;
+            } else if (node.status == 0) {      // enable signal
+                if (node.waiter == null)
+                    node.waiter = Thread.currentThread();
+                node.status = WAITING;
+            } else {
+                long nanos;
+                spins = postSpins = (byte)((postSpins << 1) | 1);
+                if (!timed)
+                    LockSupport.park(this);
+                else if ((nanos = time - System.nanoTime()) > 0L)
+                    LockSupport.parkNanos(this, nanos);
+                else
+                    break;
+                node.clearStatus();
+                if ((interrupted |= Thread.interrupted()) && interruptible)
+                    break;
             }
         }
-
-        boolean wasInterrupted = false;
-        for (int spins = -1;;) {
-            WNode h, np, pp; int ps;
-            if ((h = whead) == p) {
-                if (spins < 0)
-                    spins = HEAD_SPINS;
-                else if (spins < MAX_HEAD_SPINS)
-                    spins <<= 1;
-                for (int k = spins; k > 0; --k) { // spin at head
-                    long s, ns;
-                    if (((s = state) & ABITS) == 0L) {
-                        if ((ns = tryWriteLock(s)) != 0L) {
-                            whead = node;
-                            node.prev = null;
-                            if (wasInterrupted)
-                                Thread.currentThread().interrupt();
-                            return ns;
-                        }
-                    }
-                    else
-                        Thread.onSpinWait();
-                }
-            }
-            else if (h != null) { // help release stale waiters
-                WNode c; Thread w;
-                while ((c = h.cowait) != null) {
-                    if (WCOWAIT.weakCompareAndSet(h, c, c.cowait) &&
-                        (w = c.thread) != null)
-                        LockSupport.unpark(w);
-                }
-            }
-            if (whead == h) {
-                if ((np = node.prev) != p) {
-                    if (np != null)
-                        (p = np).next = node;   // stale
-                }
-                else if ((ps = p.status) == 0)
-                    WSTATUS.compareAndSet(p, 0, WAITING);
-                else if (ps == CANCELLED) {
-                    if ((pp = p.prev) != null) {
-                        node.prev = pp;
-                        pp.next = node;
-                    }
-                }
-                else {
-                    long time; // 0 argument to park means no timeout
-                    if (deadline == 0L)
-                        time = 0L;
-                    else if ((time = deadline - System.nanoTime()) <= 0L)
-                        return cancelWaiter(node, node, false);
-                    Thread wt = Thread.currentThread();
-                    node.thread = wt;
-                    if (p.status < 0 && (p != h || (state & ABITS) != 0L) &&
-                        whead == h && node.prev == p) {
-                        if (time == 0L)
-                            LockSupport.park(this);
-                        else
-                            LockSupport.parkNanos(this, time);
-                    }
-                    node.thread = null;
-                    if (Thread.interrupted()) {
-                        if (interruptible)
-                            return cancelWaiter(node, node, true);
-                        wasInterrupted = true;
-                    }
-                }
-            }
-        }
+        return cancelAcquire(node, interrupted);
     }
 
     /**
@@ -1346,182 +1266,178 @@
      *
      * @param interruptible true if should check interrupts and if so
      * return INTERRUPTED
-     * @param deadline if nonzero, the System.nanoTime value to timeout
-     * at (and return zero)
+     * @param timed if true use timed waits
+     * @param time the System.nanoTime value to timeout at (and return zero)
      * @return next state, or INTERRUPTED
      */
-    private long acquireRead(boolean interruptible, long deadline) {
-        boolean wasInterrupted = false;
-        WNode node = null, p;
-        for (int spins = -1;;) {
-            WNode h;
-            if ((h = whead) == (p = wtail)) {
-                for (long m, s, ns;;) {
-                    if ((m = (s = state) & ABITS) < RFULL ?
-                        casState(s, ns = s + RUNIT) :
-                        (m < WBIT && (ns = tryIncReaderOverflow(s)) != 0L)) {
-                        if (wasInterrupted)
-                            Thread.currentThread().interrupt();
-                        return ns;
+    private long acquireRead(boolean interruptible, boolean timed, long time) {
+        boolean interrupted = false;
+        ReaderNode node = null;
+        /*
+         * Loop:
+         *   if empty, try to acquire
+         *   if tail is Reader, try to cowait; restart if leader stale or cancels
+         *   else try to create and enqueue node, and wait in 2nd loop below
+         */
+        for (;;) {
+            ReaderNode leader; long nextState;
+            Node tailPred = null, t = tail;
+            if ((t == null || (tailPred = t.prev) == null) &&
+                (nextState = tryAcquireRead()) != 0L) // try now if empty
+                return nextState;
+            else if (t == null)
+                tryInitializeHead();
+            else if (tailPred == null || !(t instanceof ReaderNode)) {
+                if (node == null)
+                    node = new ReaderNode();
+                if (tail == t) {
+                    node.setPrevRelaxed(t);
+                    if (casTail(t, node)) {
+                        t.next = node;
+                        break; // node is leader; wait in loop below
                     }
-                    else if (m >= WBIT) {
-                        if (spins > 0) {
-                            --spins;
-                            Thread.onSpinWait();
-                        }
-                        else {
-                            if (spins == 0) {
-                                WNode nh = whead, np = wtail;
-                                if ((nh == h && np == p) || (h = nh) != (p = np))
-                                    break;
-                            }
-                            spins = SPINS;
-                        }
+                    node.setPrevRelaxed(null);
+                }
+            } else if ((leader = (ReaderNode)t) == tail) { // try to cowait
+                for (boolean attached = false;;) {
+                    if (leader.status < 0 || leader.prev == null)
+                        break;
+                    else if (node == null)
+                        node = new ReaderNode();
+                    else if (node.waiter == null)
+                        node.waiter = Thread.currentThread();
+                    else if (!attached) {
+                        ReaderNode c = leader.cowaiters;
+                        node.setCowaitersRelaxed(c);
+                        attached = leader.casCowaiters(c, node);
+                        if (!attached)
+                            node.setCowaitersRelaxed(null);
+                    } else {
+                        long nanos = 0L;
+                        if (!timed)
+                            LockSupport.park(this);
+                        else if ((nanos = time - System.nanoTime()) > 0L)
+                            LockSupport.parkNanos(this, nanos);
+                        interrupted |= Thread.interrupted();
+                        if ((interrupted && interruptible) ||
+                            (timed && nanos <= 0L))
+                            return cancelCowaiter(node, leader, interrupted);
                     }
                 }
-            }
-            if (p == null) { // initialize queue
-                WNode hd = new WNode(WMODE, null);
-                if (WHEAD.weakCompareAndSet(this, null, hd))
-                    wtail = hd;
-            }
-            else if (node == null)
-                node = new WNode(RMODE, p);
-            else if (h == p || p.mode != RMODE) {
-                if (node.prev != p)
-                    node.prev = p;
-                else if (WTAIL.weakCompareAndSet(this, p, node)) {
-                    p.next = node;
-                    break;
-                }
-            }
-            else if (!WCOWAIT.compareAndSet(p, node.cowait = p.cowait, node))
-                node.cowait = null;
-            else {
-                for (;;) {
-                    WNode pp, c; Thread w;
-                    if ((h = whead) != null && (c = h.cowait) != null &&
-                        WCOWAIT.compareAndSet(h, c, c.cowait) &&
-                        (w = c.thread) != null) // help release
-                        LockSupport.unpark(w);
-                    if (Thread.interrupted()) {
-                        if (interruptible)
-                            return cancelWaiter(node, p, true);
-                        wasInterrupted = true;
-                    }
-                    if (h == (pp = p.prev) || h == p || pp == null) {
-                        long m, s, ns;
-                        do {
-                            if ((m = (s = state) & ABITS) < RFULL ?
-                                casState(s, ns = s + RUNIT) :
-                                (m < WBIT &&
-                                 (ns = tryIncReaderOverflow(s)) != 0L)) {
-                                if (wasInterrupted)
-                                    Thread.currentThread().interrupt();
-                                return ns;
-                            }
-                        } while (m < WBIT);
-                    }
-                    if (whead == h && p.prev == pp) {
-                        long time;
-                        if (pp == null || h == p || p.status > 0) {
-                            node = null; // throw away
-                            break;
-                        }
-                        if (deadline == 0L)
-                            time = 0L;
-                        else if ((time = deadline - System.nanoTime()) <= 0L) {
-                            if (wasInterrupted)
-                                Thread.currentThread().interrupt();
-                            return cancelWaiter(node, p, false);
-                        }
-                        Thread wt = Thread.currentThread();
-                        node.thread = wt;
-                        if ((h != pp || (state & ABITS) == WBIT) &&
-                            whead == h && p.prev == pp) {
-                            if (time == 0L)
-                                LockSupport.park(this);
-                            else
-                                LockSupport.parkNanos(this, time);
-                        }
-                        node.thread = null;
-                    }
-                }
+                if (node != null)
+                    node.waiter = null;
+                long ns = tryAcquireRead();
+                signalCowaiters(leader);
+                if (interrupted)
+                    Thread.currentThread().interrupt();
+                if (ns != 0L)
+                    return ns;
+                else
+                    node = null; // restart if stale, missed, or leader cancelled
             }
         }
 
-        for (int spins = -1;;) {
-            WNode h, np, pp; int ps;
-            if ((h = whead) == p) {
-                if (spins < 0)
-                    spins = HEAD_SPINS;
-                else if (spins < MAX_HEAD_SPINS)
-                    spins <<= 1;
-                for (int k = spins;;) { // spin at head
-                    long m, s, ns;
-                    if ((m = (s = state) & ABITS) < RFULL ?
-                        casState(s, ns = s + RUNIT) :
-                        (m < WBIT && (ns = tryIncReaderOverflow(s)) != 0L)) {
-                        WNode c; Thread w;
-                        whead = node;
-                        node.prev = null;
-                        while ((c = node.cowait) != null) {
-                            if (WCOWAIT.compareAndSet(node, c, c.cowait) &&
-                                (w = c.thread) != null)
-                                LockSupport.unpark(w);
-                        }
-                        if (wasInterrupted)
-                            Thread.currentThread().interrupt();
-                        return ns;
-                    }
-                    else if (m >= WBIT && --k <= 0)
-                        break;
-                    else
-                        Thread.onSpinWait();
+        // node is leader of a cowait group; almost same as acquireWrite
+        byte spins = 0, postSpins = 0;   // retries upon unpark of first thread
+        boolean first = false;
+        Node pred = null;
+        for (long nextState;;) {
+            if (!first && (pred = node.prev) != null &&
+                !(first = (head == pred))) {
+                if (pred.status < 0) {
+                    cleanQueue();           // predecessor cancelled
+                    continue;
+                } else if (pred.prev == null) {
+                    Thread.onSpinWait();    // ensure serialization
+                    continue;
                 }
             }
-            else if (h != null) {
-                WNode c; Thread w;
-                while ((c = h.cowait) != null) {
-                    if (WCOWAIT.compareAndSet(h, c, c.cowait) &&
-                        (w = c.thread) != null)
-                        LockSupport.unpark(w);
-                }
-            }
-            if (whead == h) {
-                if ((np = node.prev) != p) {
-                    if (np != null)
-                        (p = np).next = node;   // stale
-                }
-                else if ((ps = p.status) == 0)
-                    WSTATUS.compareAndSet(p, 0, WAITING);
-                else if (ps == CANCELLED) {
-                    if ((pp = p.prev) != null) {
-                        node.prev = pp;
-                        pp.next = node;
-                    }
+            if ((first || pred == null) &&
+                (nextState = tryAcquireRead()) != 0L) {
+                if (first) {
+                    node.prev = null;
+                    head = node;
+                    pred.next = null;
+                    node.waiter = null;
                 }
-                else {
-                    long time;
-                    if (deadline == 0L)
-                        time = 0L;
-                    else if ((time = deadline - System.nanoTime()) <= 0L)
-                        return cancelWaiter(node, node, false);
-                    Thread wt = Thread.currentThread();
-                    node.thread = wt;
-                    if (p.status < 0 &&
-                        (p != h || (state & ABITS) == WBIT) &&
-                        whead == h && node.prev == p) {
-                            if (time == 0L)
-                                LockSupport.park(this);
-                            else
-                                LockSupport.parkNanos(this, time);
+                signalCowaiters(node);
+                if (interrupted)
+                    Thread.currentThread().interrupt();
+                return nextState;
+            } else if (first && spins != 0) {
+                --spins;
+                Thread.onSpinWait();
+            } else if (node.status == 0) {
+                if (node.waiter == null)
+                    node.waiter = Thread.currentThread();
+                node.status = WAITING;
+            } else {
+                long nanos;
+                spins = postSpins = (byte)((postSpins << 1) | 1);
+                if (!timed)
+                    LockSupport.park(this);
+                else if ((nanos = time - System.nanoTime()) > 0L)
+                    LockSupport.parkNanos(this, nanos);
+                else
+                    break;
+                node.clearStatus();
+                if ((interrupted |= Thread.interrupted()) && interruptible)
+                    break;
+            }
+        }
+        return cancelAcquire(node, interrupted);
+    }
+
+    // Cancellation support
+
+    /**
+     * Possibly repeatedly traverses from tail, unsplicing cancelled
+     * nodes until none are found. Unparks nodes that may have been
+     * relinked to be next eligible acquirer.
+     */
+    private void cleanQueue() {
+        for (;;) {                               // restart point
+            for (Node q = tail, s = null, p, n;;) { // (p, q, s) triples
+                if (q == null || (p = q.prev) == null)
+                    return;                      // end of list
+                if (s == null ? tail != q : (s.prev != q || s.status < 0))
+                    break;                       // inconsistent
+                if (q.status < 0) {              // cancelled
+                    if ((s == null ? casTail(q, p) : s.casPrev(q, p)) &&
+                        q.prev == p) {
+                        p.casNext(q, s);         // OK if fails
+                        if (p.prev == null)
+                            signalNext(p);
                     }
-                    node.thread = null;
-                    if (Thread.interrupted()) {
-                        if (interruptible)
-                            return cancelWaiter(node, node, true);
-                        wasInterrupted = true;
+                    break;
+                }
+                if ((n = p.next) != q) {         // help finish
+                    if (n != null && q.prev == p && q.status >= 0) {
+                        p.casNext(n, q);
+                        if (p.prev == null)
+                            signalNext(p);
+                    }
+                    break;
+                }
+                s = q;
+                q = q.prev;
+            }
+        }
+    }
+
+    /**
+     * If leader exists, possibly repeatedly traverses cowaiters,
+     * unsplicing the given cancelled node until not found.
+     */
+    private void unlinkCowaiter(ReaderNode node, ReaderNode leader) {
+        if (leader != null) {
+            while (leader.prev != null && leader.status >= 0) {
+                for (ReaderNode p = leader, q; ; p = q) {
+                    if ((q = p.cowaiters) == null)
+                        return;
+                    if (q == node) {
+                        p.casCowaiters(q, q.cowaiters);
+                        break;  // recheck even if succeeded
                     }
                 }
             }
@@ -1530,105 +1446,53 @@
 
     /**
      * If node non-null, forces cancel status and unsplices it from
-     * queue if possible and wakes up any cowaiters (of the node, or
-     * group, as applicable), and in any case helps release current
-     * first waiter if lock is free. (Calling with null arguments
-     * serves as a conditional form of release, which is not currently
-     * needed but may be needed under possible future cancellation
-     * policies). This is a variant of cancellation methods in
-     * AbstractQueuedSynchronizer (see its detailed explanation in AQS
-     * internal documentation).
+     * queue, wakes up any cowaiters, and possibly wakes up successor
+     * to recheck status.
      *
-     * @param node if non-null, the waiter
-     * @param group either node or the group node is cowaiting with
+     * @param node the waiter (may be null if not yet enqueued)
      * @param interrupted if already interrupted
      * @return INTERRUPTED if interrupted or Thread.interrupted, else zero
      */
-    private long cancelWaiter(WNode node, WNode group, boolean interrupted) {
-        if (node != null && group != null) {
-            Thread w;
+    private long cancelAcquire(Node node, boolean interrupted) {
+        if (node != null) {
+            node.waiter = null;
             node.status = CANCELLED;
-            // unsplice cancelled nodes from group
-            for (WNode p = group, q; (q = p.cowait) != null;) {
-                if (q.status == CANCELLED) {
-                    WCOWAIT.compareAndSet(p, q, q.cowait);
-                    p = group; // restart
-                }
-                else
-                    p = q;
-            }
-            if (group == node) {
-                for (WNode r = group.cowait; r != null; r = r.cowait) {
-                    if ((w = r.thread) != null)
-                        LockSupport.unpark(w); // wake up uncancelled co-waiters
-                }
-                for (WNode pred = node.prev; pred != null; ) { // unsplice
-                    WNode succ, pp;        // find valid successor
-                    while ((succ = node.next) == null ||
-                           succ.status == CANCELLED) {
-                        WNode q = null;    // find successor the slow way
-                        for (WNode t = wtail; t != null && t != node; t = t.prev)
-                            if (t.status != CANCELLED)
-                                q = t;     // don't link if succ cancelled
-                        if (succ == q ||   // ensure accurate successor
-                            WNEXT.compareAndSet(node, succ, succ = q)) {
-                            if (succ == null && node == wtail)
-                                WTAIL.compareAndSet(this, node, pred);
-                            break;
-                        }
-                    }
-                    if (pred.next == node) // unsplice pred link
-                        WNEXT.compareAndSet(pred, node, succ);
-                    if (succ != null && (w = succ.thread) != null) {
-                        // wake up succ to observe new pred
-                        succ.thread = null;
-                        LockSupport.unpark(w);
-                    }
-                    if (pred.status != CANCELLED || (pp = pred.prev) == null)
-                        break;
-                    node.prev = pp;        // repeat if new pred wrong/cancelled
-                    WNEXT.compareAndSet(pp, pred, succ);
-                    pred = pp;
-                }
-            }
-        }
-        WNode h; // Possibly release first waiter
-        while ((h = whead) != null) {
-            long s; WNode q; // similar to release() but check eligibility
-            if ((q = h.next) == null || q.status == CANCELLED) {
-                for (WNode t = wtail; t != null && t != h; t = t.prev)
-                    if (t.status <= 0)
-                        q = t;
-            }
-            if (h == whead) {
-                if (q != null && h.status == 0 &&
-                    ((s = state) & ABITS) != WBIT && // waiter is eligible
-                    (s == 0L || q.mode == RMODE))
-                    release(h);
-                break;
-            }
+            cleanQueue();
+            if (node instanceof ReaderNode)
+                signalCowaiters((ReaderNode)node);
         }
         return (interrupted || Thread.interrupted()) ? INTERRUPTED : 0L;
     }
 
-    // VarHandle mechanics
-    private static final VarHandle STATE;
-    private static final VarHandle WHEAD;
-    private static final VarHandle WTAIL;
-    private static final VarHandle WNEXT;
-    private static final VarHandle WSTATUS;
-    private static final VarHandle WCOWAIT;
+    /**
+     * If node non-null, forces cancel status and unsplices from
+     * leader's cowaiters list unless/until it is also cancelled.
+     *
+     * @param node if non-null, the waiter
+     * @param leader if non-null, the node heading cowaiters list
+     * @param interrupted if already interrupted
+     * @return INTERRUPTED if interrupted or Thread.interrupted, else zero
+     */
+    private long cancelCowaiter(ReaderNode node, ReaderNode leader,
+                                boolean interrupted) {
+        if (node != null) {
+            node.waiter = null;
+            node.status = CANCELLED;
+            unlinkCowaiter(node, leader);
+        }
+        return (interrupted || Thread.interrupted()) ? INTERRUPTED : 0L;
+    }
+
+    // Unsafe
+    private static final Unsafe U = Unsafe.getUnsafe();
+    private static final long STATE
+        = U.objectFieldOffset(StampedLock.class, "state");
+    private static final long HEAD
+        = U.objectFieldOffset(StampedLock.class, "head");
+    private static final long TAIL
+        = U.objectFieldOffset(StampedLock.class, "tail");
+
     static {
-        try {
-            MethodHandles.Lookup l = MethodHandles.lookup();
-            STATE = l.findVarHandle(StampedLock.class, "state", long.class);
-            WHEAD = l.findVarHandle(StampedLock.class, "whead", WNode.class);
-            WTAIL = l.findVarHandle(StampedLock.class, "wtail", WNode.class);
-            WSTATUS = l.findVarHandle(WNode.class, "status", int.class);
-            WNEXT = l.findVarHandle(WNode.class, "next", WNode.class);
-            WCOWAIT = l.findVarHandle(WNode.class, "cowait", WNode.class);
-        } catch (ReflectiveOperationException e) {
-            throw new ExceptionInInitializerError(e);
-        }
+        Class<?> ensureLoaded = LockSupport.class;
     }
 }
--- a/src/java.base/share/classes/java/util/concurrent/package-info.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/concurrent/package-info.java	Tue Sep 24 15:19:35 2019 -0400
@@ -226,9 +226,8 @@
  *
  * <h2 id="MemoryVisibility">Memory Consistency Properties</h2>
  *
- * <a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-17.html#jls-17.4.5">
  * Chapter 17 of
- * <cite>The Java&trade; Language Specification</cite></a> defines the
+ * <cite>The Java&trade; Language Specification</cite> defines the
  * <i>happens-before</i> relation on memory operations such as reads and
  * writes of shared variables.  The results of a write by one thread are
  * guaranteed to be visible to a read by another thread only if the write
@@ -302,6 +301,8 @@
  *
  * </ul>
  *
+ * @jls 17.4.5 Happens-before Order
+ *
  * @since 1.5
  */
 package java.util.concurrent;
--- a/src/java.base/share/classes/java/util/jar/Attributes.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/jar/Attributes.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -148,7 +148,7 @@
      * @param name the attribute name
      * @param value the attribute value
      * @return the previous value of the attribute, or null if none
-     * @exception ClassCastException if the name is not a Attributes.Name
+     * @throws    ClassCastException if the name is not a Attributes.Name
      *            or the value is not a String
      */
     public Object put(Object name, Object value) {
@@ -169,7 +169,7 @@
      * @param name the attribute name as a string
      * @param value the attribute value
      * @return the previous value of the attribute, or null if none
-     * @exception IllegalArgumentException if the attribute name is invalid
+     * @throws    IllegalArgumentException if the attribute name is invalid
      */
     public String putValue(String name, String value) {
         return (String)put(Name.of(name), value);
@@ -213,7 +213,7 @@
      * Attributes to this Map. Duplicate mappings will be replaced.
      *
      * @param attr the Attributes to be stored in this map
-     * @exception ClassCastException if attr is not an Attributes
+     * @throws    ClassCastException if attr is not an Attributes
      */
     public void putAll(Map<?,?> attr) {
         // ## javac bug?
@@ -470,9 +470,9 @@
          * Constructs a new attribute name using the given string name.
          *
          * @param name the attribute string name
-         * @exception IllegalArgumentException if the attribute name was
+         * @throws    IllegalArgumentException if the attribute name was
          *            invalid
-         * @exception NullPointerException if the attribute name was null
+         * @throws    NullPointerException if the attribute name was null
          */
         public Name(String name) {
             this.hashCode = hash(name);
--- a/src/java.base/share/classes/java/util/jar/JarEntry.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/jar/JarEntry.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,12 +42,12 @@
     CodeSigner[] signers;
 
     /**
-     * Creates a new <code>JarEntry</code> for the specified JAR file
+     * Creates a new {@code JarEntry} for the specified JAR file
      * entry name.
      *
      * @param name the JAR file entry name
-     * @exception NullPointerException if the entry name is <code>null</code>
-     * @exception IllegalArgumentException if the entry name is longer than
+     * @throws    NullPointerException if the entry name is {@code null}
+     * @throws    IllegalArgumentException if the entry name is longer than
      *            0xFFFF bytes.
      */
     public JarEntry(String name) {
@@ -55,20 +55,20 @@
     }
 
     /**
-     * Creates a new <code>JarEntry</code> with fields taken from the
-     * specified <code>ZipEntry</code> object.
-     * @param ze the <code>ZipEntry</code> object to create the
-     *           <code>JarEntry</code> from
+     * Creates a new {@code JarEntry} with fields taken from the
+     * specified {@code ZipEntry} object.
+     * @param ze the {@code ZipEntry} object to create the
+     *           {@code JarEntry} from
      */
     public JarEntry(ZipEntry ze) {
         super(ze);
     }
 
     /**
-     * Creates a new <code>JarEntry</code> with fields taken from the
-     * specified <code>JarEntry</code> object.
+     * Creates a new {@code JarEntry} with fields taken from the
+     * specified {@code JarEntry} object.
      *
-     * @param je the <code>JarEntry</code> to copy
+     * @param je the {@code JarEntry} to copy
      */
     public JarEntry(JarEntry je) {
         this((ZipEntry)je);
@@ -78,11 +78,11 @@
     }
 
     /**
-     * Returns the <code>Manifest</code> <code>Attributes</code> for this
-     * entry, or <code>null</code> if none.
+     * Returns the {@code Manifest} {@code Attributes} for this
+     * entry, or {@code null} if none.
      *
-     * @return the <code>Manifest</code> <code>Attributes</code> for this
-     * entry, or <code>null</code> if none
+     * @return the {@code Manifest} {@code Attributes} for this
+     * entry, or {@code null} if none
      * @throws IOException  if an I/O error has occurred
      */
     public Attributes getAttributes() throws IOException {
@@ -90,11 +90,11 @@
     }
 
     /**
-     * Returns the <code>Certificate</code> objects for this entry, or
-     * <code>null</code> if none. This method can only be called once
-     * the <code>JarEntry</code> has been completely verified by reading
+     * Returns the {@code Certificate} objects for this entry, or
+     * {@code null} if none. This method can only be called once
+     * the {@code JarEntry} has been completely verified by reading
      * from the entry input stream until the end of the stream has been
-     * reached. Otherwise, this method will return <code>null</code>.
+     * reached. Otherwise, this method will return {@code null}.
      *
      * <p>The returned certificate array comprises all the signer certificates
      * that were used to verify this entry. Each signer certificate is
@@ -103,25 +103,25 @@
      * bottom-to-top (i.e., with the signer certificate first and the (root)
      * certificate authority last).
      *
-     * @return the <code>Certificate</code> objects for this entry, or
-     * <code>null</code> if none.
+     * @return the {@code Certificate} objects for this entry, or
+     * {@code null} if none.
      */
     public Certificate[] getCertificates() {
         return certs == null ? null : certs.clone();
     }
 
     /**
-     * Returns the <code>CodeSigner</code> objects for this entry, or
-     * <code>null</code> if none. This method can only be called once
-     * the <code>JarEntry</code> has been completely verified by reading
+     * Returns the {@code CodeSigner} objects for this entry, or
+     * {@code null} if none. This method can only be called once
+     * the {@code JarEntry} has been completely verified by reading
      * from the entry input stream until the end of the stream has been
-     * reached. Otherwise, this method will return <code>null</code>.
+     * reached. Otherwise, this method will return {@code null}.
      *
      * <p>The returned array comprises all the code signers that have signed
      * this entry.
      *
-     * @return the <code>CodeSigner</code> objects for this entry, or
-     * <code>null</code> if none.
+     * @return the {@code CodeSigner} objects for this entry, or
+     * {@code null} if none.
      *
      * @since 1.5
      */
--- a/src/java.base/share/classes/java/util/jar/JarInputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/jar/JarInputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,10 +31,10 @@
 import jdk.internal.util.jar.JarIndex;
 
 /**
- * The <code>JarInputStream</code> class is used to read the contents of
+ * The {@code JarInputStream} class is used to read the contents of
  * a JAR file from any input stream. It extends the class
- * <code>java.util.zip.ZipInputStream</code> with support for reading
- * an optional <code>Manifest</code> entry. The <code>Manifest</code>
+ * {@code java.util.zip.ZipInputStream} with support for reading
+ * an optional {@code Manifest} entry. The {@code Manifest}
  * can be used to store meta-information about the JAR file and its entries.
  *
  * @author  David Connelly
@@ -52,25 +52,25 @@
     private boolean tryManifest;
 
     /**
-     * Creates a new <code>JarInputStream</code> and reads the optional
+     * Creates a new {@code JarInputStream} and reads the optional
      * manifest. If a manifest is present, also attempts to verify
      * the signatures if the JarInputStream is signed.
      * @param in the actual input stream
-     * @exception IOException if an I/O error has occurred
+     * @throws    IOException if an I/O error has occurred
      */
     public JarInputStream(InputStream in) throws IOException {
         this(in, true);
     }
 
     /**
-     * Creates a new <code>JarInputStream</code> and reads the optional
+     * Creates a new {@code JarInputStream} and reads the optional
      * manifest. If a manifest is present and verify is true, also attempts
      * to verify the signatures if the JarInputStream is signed.
      *
      * @param in the actual input stream
      * @param verify whether or not to verify the JarInputStream if
      * it is signed.
-     * @exception IOException if an I/O error has occurred
+     * @throws    IOException if an I/O error has occurred
      */
     public JarInputStream(InputStream in, boolean verify) throws IOException {
         super(in);
@@ -116,11 +116,11 @@
     }
 
     /**
-     * Returns the <code>Manifest</code> for this JAR file, or
-     * <code>null</code> if none.
+     * Returns the {@code Manifest} for this JAR file, or
+     * {@code null} if none.
      *
-     * @return the <code>Manifest</code> for this JAR file, or
-     *         <code>null</code> if none.
+     * @return the {@code Manifest} for this JAR file, or
+     *         {@code null} if none.
      */
     public Manifest getManifest() {
         return man;
@@ -131,9 +131,9 @@
      * beginning of the entry data. If verification has been enabled,
      * any invalid signature detected while positioning the stream for
      * the next entry will result in an exception.
-     * @exception ZipException if a ZIP file error has occurred
-     * @exception IOException if an I/O error has occurred
-     * @exception SecurityException if any of the jar file entries
+     * @throws    ZipException if a ZIP file error has occurred
+     * @throws    IOException if an I/O error has occurred
+     * @throws    SecurityException if any of the jar file entries
      *         are incorrectly signed.
      */
     public ZipEntry getNextEntry() throws IOException {
@@ -170,9 +170,9 @@
      * any invalid signature detected while positioning the stream for
      * the next entry will result in an exception.
      * @return the next JAR file entry, or null if there are no more entries
-     * @exception ZipException if a ZIP file error has occurred
-     * @exception IOException if an I/O error has occurred
-     * @exception SecurityException if any of the jar file entries
+     * @throws    ZipException if a ZIP file error has occurred
+     * @throws    IOException if an I/O error has occurred
+     * @throws    SecurityException if any of the jar file entries
      *         are incorrectly signed.
      */
     public JarEntry getNextJarEntry() throws IOException {
@@ -181,24 +181,24 @@
 
     /**
      * Reads from the current JAR file entry into an array of bytes.
-     * If <code>len</code> is not zero, the method
+     * If {@code len} is not zero, the method
      * blocks until some input is available; otherwise, no
-     * bytes are read and <code>0</code> is returned.
+     * bytes are read and {@code 0} is returned.
      * If verification has been enabled, any invalid signature
      * on the current entry will be reported at some point before the
      * end of the entry is reached.
      * @param b the buffer into which the data is read
-     * @param off the start offset in the destination array <code>b</code>
+     * @param off the start offset in the destination array {@code b}
      * @param len the maximum number of bytes to read
      * @return the actual number of bytes read, or -1 if the end of the
      *         entry is reached
-     * @exception  NullPointerException If <code>b</code> is <code>null</code>.
-     * @exception  IndexOutOfBoundsException If <code>off</code> is negative,
-     * <code>len</code> is negative, or <code>len</code> is greater than
-     * <code>b.length - off</code>
-     * @exception ZipException if a ZIP file error has occurred
-     * @exception IOException if an I/O error has occurred
-     * @exception SecurityException if any of the jar file entries
+     * @throws     NullPointerException If {@code b} is {@code null}.
+     * @throws     IndexOutOfBoundsException If {@code off} is negative,
+     * {@code len} is negative, or {@code len} is greater than
+     * {@code b.length - off}
+     * @throws    ZipException if a ZIP file error has occurred
+     * @throws    IOException if an I/O error has occurred
+     * @throws    SecurityException if any of the jar file entries
      *         are incorrectly signed.
      */
     public int read(byte[] b, int off, int len) throws IOException {
@@ -215,13 +215,13 @@
     }
 
     /**
-     * Creates a new <code>JarEntry</code> (<code>ZipEntry</code>) for the
+     * Creates a new {@code JarEntry} ({@code ZipEntry}) for the
      * specified JAR file entry name. The manifest attributes of
      * the specified JAR file entry name will be copied to the new
      * <CODE>JarEntry</CODE>.
      *
      * @param name the name of the JAR/ZIP file entry
-     * @return the <code>JarEntry</code> object just created
+     * @return the {@code JarEntry} object just created
      */
     protected ZipEntry createZipEntry(String name) {
         JarEntry e = new JarEntry(name);
--- a/src/java.base/share/classes/java/util/jar/JarOutputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/jar/JarOutputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,11 +29,11 @@
 import java.io.*;
 
 /**
- * The <code>JarOutputStream</code> class is used to write the contents
+ * The {@code JarOutputStream} class is used to write the contents
  * of a JAR file to any output stream. It extends the class
- * <code>java.util.zip.ZipOutputStream</code> with support
- * for writing an optional <code>Manifest</code> entry. The
- * <code>Manifest</code> can be used to specify meta-information about
+ * {@code java.util.zip.ZipOutputStream} with support
+ * for writing an optional {@code Manifest} entry. The
+ * {@code Manifest} can be used to specify meta-information about
  * the JAR file and its entries.
  *
  * @author  David Connelly
@@ -46,13 +46,13 @@
     private static final int JAR_MAGIC = 0xCAFE;
 
     /**
-     * Creates a new <code>JarOutputStream</code> with the specified
-     * <code>Manifest</code>. The manifest is written as the first
+     * Creates a new {@code JarOutputStream} with the specified
+     * {@code Manifest}. The manifest is written as the first
      * entry to the output stream.
      *
      * @param out the actual output stream
-     * @param man the optional <code>Manifest</code>
-     * @exception IOException if an I/O error has occurred
+     * @param man the optional {@code Manifest}
+     * @throws    IOException if an I/O error has occurred
      */
     public JarOutputStream(OutputStream out, Manifest man) throws IOException {
         super(out);
@@ -66,9 +66,9 @@
     }
 
     /**
-     * Creates a new <code>JarOutputStream</code> with no manifest.
+     * Creates a new {@code JarOutputStream} with no manifest.
      * @param out the actual output stream
-     * @exception IOException if an I/O error has occurred
+     * @throws    IOException if an I/O error has occurred
      */
     public JarOutputStream(OutputStream out) throws IOException {
         super(out);
@@ -83,8 +83,8 @@
      * time.
      *
      * @param ze the ZIP/JAR entry to be written
-     * @exception ZipException if a ZIP error has occurred
-     * @exception IOException if an I/O error has occurred
+     * @throws    ZipException if a ZIP error has occurred
+     * @throws    IOException if an I/O error has occurred
      */
     public void putNextEntry(ZipEntry ze) throws IOException {
         if (firstEntry) {
--- a/src/java.base/share/classes/java/util/jar/Manifest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/jar/Manifest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -195,7 +195,7 @@
      * MainAttributes prior to invoking this method.
      *
      * @param out the output stream
-     * @exception IOException if an I/O error has occurred
+     * @throws    IOException if an I/O error has occurred
      * @see #getMainAttributes
      */
     public void write(OutputStream out) throws IOException {
@@ -276,7 +276,7 @@
      * manifest entries.
      *
      * @param is the input stream
-     * @exception IOException if an I/O error has occurred
+     * @throws    IOException if an I/O error has occurred
      */
     public void read(InputStream is) throws IOException {
         read(is, null);
--- a/src/java.base/share/classes/java/util/jar/Pack200.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/jar/Pack200.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -554,7 +554,7 @@
          * Closes its input but not its output.  (Pack200 archives are appendable.)
          * @param in a JarFile
          * @param out an OutputStream
-         * @exception IOException if an error is encountered.
+         * @throws    IOException if an error is encountered.
          */
         void pack(JarFile in, OutputStream out) throws IOException ;
 
@@ -570,7 +570,7 @@
          * @see #DEFLATE_HINT
          * @param in a JarInputStream
          * @param out an OutputStream
-         * @exception IOException if an error is encountered.
+         * @throws    IOException if an error is encountered.
          */
         void pack(JarInputStream in, OutputStream out) throws IOException ;
     }
@@ -673,7 +673,7 @@
          * Closes its input but not its output.  (The output can accumulate more elements.)
          * @param in an InputStream.
          * @param out a JarOutputStream.
-         * @exception IOException if an error is encountered.
+         * @throws    IOException if an error is encountered.
          */
         void unpack(InputStream in, JarOutputStream out) throws IOException;
 
@@ -684,7 +684,7 @@
          * Does not close its output.  (The output can accumulate more elements.)
          * @param in a File.
          * @param out a JarOutputStream.
-         * @exception IOException if an error is encountered.
+         * @throws    IOException if an error is encountered.
          */
         void unpack(File in, JarOutputStream out) throws IOException;
     }
--- a/src/java.base/share/classes/java/util/jar/package-info.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/jar/package-info.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
  *
  * <h2>Package Specification</h2>
  *
- * The <code>java.util.jar</code> package is based on the following
+ * The {@code java.util.jar} package is based on the following
  * specifications:
  *
  * <ul>
--- a/src/java.base/share/classes/java/util/regex/Matcher.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/regex/Matcher.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1803,4 +1803,4 @@
             throw new IllegalArgumentException("No group with name <" + name + ">");
         return parentPattern.namedGroups().get(name);
     }
-}
\ No newline at end of file
+}
--- a/src/java.base/share/classes/java/util/regex/Pattern.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/regex/Pattern.java	Tue Sep 24 15:19:35 2019 -0400
@@ -357,7 +357,7 @@
  * <a href="#UNIX_LINES">d</a> <a href="#MULTILINE">m</a> <a href="#DOTALL">s</a>
  * <a href="#UNICODE_CASE">u</a> <a href="#COMMENTS">x</a> <a href="#UNICODE_CHARACTER_CLASS">U</a>
  * on - off</td></tr>
- * <tr><th style="vertical-align:top; font-weight:normal" id="non_capture_group_flags"><code>(?idmsuxU-idmsuxU:</code><i>X</i>{@code )}&nbsp;&nbsp;</th>
+ * <tr><th style="vertical-align:top; font-weight:normal" id="non_capture_group_flags">{@code (?idmsuxU-idmsuxU:}<i>X</i>{@code )}&nbsp;&nbsp;</th>
  *     <td headers="matches special non_capture_group_flags"><i>X</i>, as a <a href="#cg">non-capturing group</a> with the
  *         given flags <a href="#CASE_INSENSITIVE">i</a> <a href="#UNIX_LINES">d</a>
  * <a href="#MULTILINE">m</a> <a href="#DOTALL">s</a> <a href="#UNICODE_CASE">u</a >
--- a/src/java.base/share/classes/java/util/regex/package-info.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/regex/package-info.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,7 +37,7 @@
  * interface in order to support matching against characters from a
  * wide variety of input sources. </p>
  *
- * <p> Unless otherwise noted, passing a <code>null</code> argument to a
+ * <p> Unless otherwise noted, passing a {@code null} argument to a
  * method in any class or interface in this package will cause a
  * {@link java.lang.NullPointerException NullPointerException} to be
  * thrown.
--- a/src/java.base/share/classes/java/util/spi/CalendarNameProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/spi/CalendarNameProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -190,9 +190,9 @@
 
     /**
      * Returns the string representation (display name) of the calendar
-     * <code>field value</code> in the given <code>style</code> and
-     * <code>locale</code>.  If no string representation is
-     * applicable, <code>null</code> is returned.
+     * {@code field value} in the given {@code style} and
+     * {@code locale}.  If no string representation is
+     * applicable, {@code null} is returned.
      *
      * <p>{@code field} is a {@code Calendar} field index, such as {@link
      * Calendar#MONTH}. The time zone fields, {@link Calendar#ZONE_OFFSET} and
--- a/src/java.base/share/classes/java/util/spi/CurrencyNameProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/spi/CurrencyNameProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,10 +63,10 @@
      * @param locale the desired locale
      * @return the symbol of the given currency code for the specified locale, or null if
      *     the symbol is not available for the locale
-     * @exception NullPointerException if <code>currencyCode</code> or
-     *     <code>locale</code> is null
-     * @exception IllegalArgumentException if <code>currencyCode</code> is not in
-     *     the form of three upper-case letters, or <code>locale</code> isn't
+     * @throws    NullPointerException if {@code currencyCode} or
+     *     {@code locale} is null
+     * @throws    IllegalArgumentException if {@code currencyCode} is not in
+     *     the form of three upper-case letters, or {@code locale} isn't
      *     one of the locales returned from
      *     {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
      *     getAvailableLocales()}.
@@ -84,13 +84,13 @@
      * @param locale the desired locale
      * @return the name for the currency that is appropriate for display to the
      *     user, or null if the name is not available for the locale
-     * @exception IllegalArgumentException if <code>currencyCode</code> is not in
-     *     the form of three upper-case letters, or <code>locale</code> isn't
+     * @throws    IllegalArgumentException if {@code currencyCode} is not in
+     *     the form of three upper-case letters, or {@code locale} isn't
      *     one of the locales returned from
      *     {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
      *     getAvailableLocales()}.
-     * @exception NullPointerException if <code>currencyCode</code> or
-     *     <code>locale</code> is <code>null</code>
+     * @throws    NullPointerException if {@code currencyCode} or
+     *     {@code locale} is {@code null}
      * @since 1.7
      */
     public String getDisplayName(String currencyCode, Locale locale) {
--- a/src/java.base/share/classes/java/util/spi/LocaleNameProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/spi/LocaleNameProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,10 +48,10 @@
      * Returns a localized name for the given <a href="http://www.rfc-editor.org/rfc/bcp/bcp47.txt">
      * IETF BCP47</a> language code and the given locale that is appropriate for
      * display to the user.
-     * For example, if <code>languageCode</code> is "fr" and <code>locale</code>
-     * is en_US, getDisplayLanguage() will return "French"; if <code>languageCode</code>
-     * is "en" and <code>locale</code> is fr_FR, getDisplayLanguage() will return "anglais".
-     * If the name returned cannot be localized according to <code>locale</code>,
+     * For example, if {@code languageCode} is "fr" and {@code locale}
+     * is en_US, getDisplayLanguage() will return "French"; if {@code languageCode}
+     * is "en" and {@code locale} is fr_FR, getDisplayLanguage() will return "anglais".
+     * If the name returned cannot be localized according to {@code locale},
      * (say, the provider does not have a Japanese name for Croatian),
      * this method returns null.
      * @param languageCode the language code string in the form of two to eight
@@ -59,9 +59,9 @@
      * @param locale the desired locale
      * @return the name of the given language code for the specified locale, or null if it's not
      *     available.
-     * @exception NullPointerException if <code>languageCode</code> or <code>locale</code> is null
-     * @exception IllegalArgumentException if <code>languageCode</code> is not in the form of
-     *     two or three lower-case letters, or <code>locale</code> isn't
+     * @throws    NullPointerException if {@code languageCode} or {@code locale} is null
+     * @throws    IllegalArgumentException if {@code languageCode} is not in the form of
+     *     two or three lower-case letters, or {@code locale} isn't
      *     one of the locales returned from
      *     {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
      *     getAvailableLocales()}.
@@ -73,10 +73,10 @@
      * Returns a localized name for the given <a href="http://www.rfc-editor.org/rfc/bcp/bcp47.txt">
      * IETF BCP47</a> script code and the given locale that is appropriate for
      * display to the user.
-     * For example, if <code>scriptCode</code> is "Latn" and <code>locale</code>
-     * is en_US, getDisplayScript() will return "Latin"; if <code>scriptCode</code>
-     * is "Cyrl" and <code>locale</code> is fr_FR, getDisplayScript() will return "cyrillique".
-     * If the name returned cannot be localized according to <code>locale</code>,
+     * For example, if {@code scriptCode} is "Latn" and {@code locale}
+     * is en_US, getDisplayScript() will return "Latin"; if {@code scriptCode}
+     * is "Cyrl" and {@code locale} is fr_FR, getDisplayScript() will return "cyrillique".
+     * If the name returned cannot be localized according to {@code locale},
      * (say, the provider does not have a Japanese name for Cyrillic),
      * this method returns null. The default implementation returns null.
      * @param scriptCode the four letter script code string in the form of title-case
@@ -86,9 +86,9 @@
      * @param locale the desired locale
      * @return the name of the given script code for the specified locale, or null if it's not
      *     available.
-     * @exception NullPointerException if <code>scriptCode</code> or <code>locale</code> is null
-     * @exception IllegalArgumentException if <code>scriptCode</code> is not in the form of
-     *     four title case letters, or <code>locale</code> isn't
+     * @throws    NullPointerException if {@code scriptCode} or {@code locale} is null
+     * @throws    IllegalArgumentException if {@code scriptCode} is not in the form of
+     *     four title case letters, or {@code locale} isn't
      *     one of the locales returned from
      *     {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
      *     getAvailableLocales()}.
@@ -103,10 +103,10 @@
      * Returns a localized name for the given <a href="http://www.rfc-editor.org/rfc/bcp/bcp47.txt">
      * IETF BCP47</a> region code (either ISO 3166 country code or UN M.49 area
      * codes) and the given locale that is appropriate for display to the user.
-     * For example, if <code>countryCode</code> is "FR" and <code>locale</code>
-     * is en_US, getDisplayCountry() will return "France"; if <code>countryCode</code>
-     * is "US" and <code>locale</code> is fr_FR, getDisplayCountry() will return "Etats-Unis".
-     * If the name returned cannot be localized according to <code>locale</code>,
+     * For example, if {@code countryCode} is "FR" and {@code locale}
+     * is en_US, getDisplayCountry() will return "France"; if {@code countryCode}
+     * is "US" and {@code locale} is fr_FR, getDisplayCountry() will return "Etats-Unis".
+     * If the name returned cannot be localized according to {@code locale},
      * (say, the provider does not have a Japanese name for Croatia),
      * this method returns null.
      * @param countryCode the country(region) code string in the form of two
@@ -115,9 +115,9 @@
      * @param locale the desired locale
      * @return the name of the given country code for the specified locale, or null if it's not
      *     available.
-     * @exception NullPointerException if <code>countryCode</code> or <code>locale</code> is null
-     * @exception IllegalArgumentException if <code>countryCode</code> is not in the form of
-     *     two upper-case letters or three digit letters, or <code>locale</code> isn't
+     * @throws    NullPointerException if {@code countryCode} or {@code locale} is null
+     * @throws    IllegalArgumentException if {@code countryCode} is not in the form of
+     *     two upper-case letters or three digit letters, or {@code locale} isn't
      *     one of the locales returned from
      *     {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
      *     getAvailableLocales()}.
@@ -128,14 +128,14 @@
     /**
      * Returns a localized name for the given variant code and the given locale that
      * is appropriate for display to the user.
-     * If the name returned cannot be localized according to <code>locale</code>,
+     * If the name returned cannot be localized according to {@code locale},
      * this method returns null.
      * @param variant the variant string
      * @param locale the desired locale
      * @return the name of the given variant string for the specified locale, or null if it's not
      *     available.
-     * @exception NullPointerException if <code>variant</code> or <code>locale</code> is null
-     * @exception IllegalArgumentException if <code>locale</code> isn't
+     * @throws    NullPointerException if {@code variant} or {@code locale} is null
+     * @throws    IllegalArgumentException if {@code locale} isn't
      *     one of the locales returned from
      *     {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
      *     getAvailableLocales()}.
@@ -154,8 +154,8 @@
      * @param locale the desired locale, not null.
      * @return the name of the given key string for the specified locale,
      *  or null if it's not available.
-     * @exception NullPointerException if {@code key} or {@code locale} is null
-     * @exception IllegalArgumentException if {@code locale} isn't
+     * @throws    NullPointerException if {@code key} or {@code locale} is null
+     * @throws    IllegalArgumentException if {@code locale} isn't
      *     one of the locales returned from
      *     {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
      *     getAvailableLocales()}.
@@ -179,8 +179,8 @@
      * @param locale the desired locale, not null.
      * @return the name of the given type string for the specified locale,
      *  or null if it's not available.
-     * @exception NullPointerException if {@code key}, {@code type} or {@code locale} is null
-     * @exception IllegalArgumentException if {@code locale} isn't
+     * @throws    NullPointerException if {@code key}, {@code type} or {@code locale} is null
+     * @throws    IllegalArgumentException if {@code locale} isn't
      *     one of the locales returned from
      *     {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
      *     getAvailableLocales()}.
--- a/src/java.base/share/classes/java/util/spi/LocaleServiceProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/spi/LocaleServiceProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -33,12 +33,12 @@
  * interfaces (SPIs).
  * <p>
  * Locale sensitive  service provider interfaces are interfaces that
- * correspond to locale sensitive classes in the <code>java.text</code>
- * and <code>java.util</code> packages. The interfaces enable the
+ * correspond to locale sensitive classes in the {@code java.text}
+ * and {@code java.util} packages. The interfaces enable the
  * construction of locale sensitive objects and the retrieval of
  * localized names for these packages. Locale sensitive factory methods
- * and methods for name retrieval in the <code>java.text</code> and
- * <code>java.util</code> packages use implementations of the provider
+ * and methods for name retrieval in the {@code java.text} and
+ * {@code java.util} packages use implementations of the provider
  * interfaces to offer support for locales beyond the set of locales
  * supported by the Java runtime environment itself.
  *
@@ -68,17 +68,17 @@
  * <pre>
  * META-INF/services/java.text.spi.DateFormatProvider
  * </pre>
- * And the file <code>java.text.spi.DateFormatProvider</code> should have
+ * And the file {@code java.text.spi.DateFormatProvider} should have
  * a line such as:
  * <pre>
- * <code>com.foo.DateFormatProviderImpl</code>
+ * {@code com.foo.DateFormatProviderImpl}
  * </pre>
  * which is the fully qualified class name of the class implementing
- * <code>DateFormatProvider</code>.
+ * {@code DateFormatProvider}.
  * <h3>Invocation of Locale Sensitive Services</h3>
  * <p>
  * Locale sensitive factory methods and methods for name retrieval in the
- * <code>java.text</code> and <code>java.util</code> packages invoke
+ * {@code java.text} and {@code java.util} packages invoke
  * service provider methods when needed to support the requested locale.
  * The methods first check whether the Java runtime environment itself
  * supports the requested locale, and use its support if available.
@@ -93,7 +93,7 @@
  * supports the requested locale, the methods go through a list of candidate
  * locales and repeat the availability check for each until a match is found.
  * The algorithm used for creating a list of candidate locales is same as
- * the one used by <code>ResourceBundle</code> by default (see
+ * the one used by {@code ResourceBundle} by default (see
  * {@link java.util.ResourceBundle.Control#getCandidateLocales getCandidateLocales}
  * for the details).  Even if a locale is resolved from the candidate list,
  * methods that return requested objects or names are invoked with the original
@@ -104,7 +104,7 @@
  * Providers of names (but not providers of other objects) are allowed to
  * return null for some name requests even for locales that they claim to
  * support by including them in their return value for
- * <code>getAvailableLocales</code>. Similarly, the Java runtime
+ * {@code getAvailableLocales}. Similarly, the Java runtime
  * environment itself may not have all names for all locales that it
  * supports. This is because the sets of objects for which names are
  * requested can be large and vary over time, so that it's not always
--- a/src/java.base/share/classes/java/util/spi/TimeZoneNameProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/spi/TimeZoneNameProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -57,7 +57,7 @@
      * "tzdata", and the specification of the data format is part of the zic.8
      * man page, which is contained in a file whose name starts with "tzcode".
      * <p>
-     * If <code>daylight</code> is true, the method should return a name
+     * If {@code daylight} is true, the method should return a name
      * appropriate for daylight saving time even if the specified time zone
      * has not observed daylight saving time in the past.
      *
@@ -68,11 +68,11 @@
      * @param locale the desired locale
      * @return the human-readable name of the given time zone in the
      *     given locale, or null if it's not available.
-     * @exception IllegalArgumentException if <code>style</code> is invalid,
-     *     or <code>locale</code> isn't one of the locales returned from
+     * @throws    IllegalArgumentException if {@code style} is invalid,
+     *     or {@code locale} isn't one of the locales returned from
      *     {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
      *     getAvailableLocales()}.
-     * @exception NullPointerException if <code>ID</code> or <code>locale</code>
+     * @throws    NullPointerException if {@code ID} or {@code locale}
      *     is null
      * @see java.util.TimeZone#getDisplayName(boolean, int, java.util.Locale)
      */
@@ -96,11 +96,11 @@
      * @param locale the desired locale
      * @return the human-readable generic name of the given time zone in the
      *     given locale, or {@code null} if it's not available.
-     * @exception IllegalArgumentException if <code>style</code> is invalid,
-     *     or <code>locale</code> isn't one of the locales returned from
+     * @throws    IllegalArgumentException if {@code style} is invalid,
+     *     or {@code locale} isn't one of the locales returned from
      *     {@link LocaleServiceProvider#getAvailableLocales()
      *     getAvailableLocales()}.
-     * @exception NullPointerException if <code>ID</code> or <code>locale</code>
+     * @throws    NullPointerException if {@code ID} or {@code locale}
      *     is {@code null}
      * @since 1.8
      */
--- a/src/java.base/share/classes/java/util/zip/CheckedInputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/zip/CheckedInputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -54,7 +54,7 @@
     /**
      * Reads a byte. Will block if no input is available.
      * @return the byte read, or -1 if the end of the stream is reached.
-     * @exception IOException if an I/O error has occurred
+     * @throws    IOException if an I/O error has occurred
      */
     public int read() throws IOException {
         int b = in.read();
@@ -65,19 +65,19 @@
     }
 
     /**
-     * Reads into an array of bytes. If <code>len</code> is not zero, the method
+     * Reads into an array of bytes. If {@code len} is not zero, the method
      * blocks until some input is available; otherwise, no
-     * bytes are read and <code>0</code> is returned.
+     * bytes are read and {@code 0} is returned.
      * @param buf the buffer into which the data is read
-     * @param off the start offset in the destination array <code>b</code>
+     * @param off the start offset in the destination array {@code b}
      * @param len the maximum number of bytes read
      * @return    the actual number of bytes read, or -1 if the end
      *            of the stream is reached.
-     * @exception  NullPointerException If <code>buf</code> is <code>null</code>.
-     * @exception  IndexOutOfBoundsException If <code>off</code> is negative,
-     * <code>len</code> is negative, or <code>len</code> is greater than
-     * <code>buf.length - off</code>
-     * @exception IOException if an I/O error has occurred
+     * @throws     NullPointerException If {@code buf} is {@code null}.
+     * @throws     IndexOutOfBoundsException If {@code off} is negative,
+     * {@code len} is negative, or {@code len} is greater than
+     * {@code buf.length - off}
+     * @throws    IOException if an I/O error has occurred
      */
     public int read(byte[] buf, int off, int len) throws IOException {
         len = in.read(buf, off, len);
@@ -91,7 +91,7 @@
      * Skips specified number of bytes of input.
      * @param n the number of bytes to skip
      * @return the actual number of bytes skipped
-     * @exception IOException if an I/O error has occurred
+     * @throws    IOException if an I/O error has occurred
      */
     public long skip(long n) throws IOException {
         byte[] buf = new byte[512];
--- a/src/java.base/share/classes/java/util/zip/CheckedOutputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/zip/CheckedOutputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -55,7 +55,7 @@
     /**
      * Writes a byte. Will block until the byte is actually written.
      * @param b the byte to be written
-     * @exception IOException if an I/O error has occurred
+     * @throws    IOException if an I/O error has occurred
      */
     public void write(int b) throws IOException {
         out.write(b);
@@ -68,7 +68,7 @@
      * @param b the data to be written
      * @param off the start offset of the data
      * @param len the number of bytes to be written
-     * @exception IOException if an I/O error has occurred
+     * @throws    IOException if an I/O error has occurred
      */
     public void write(byte[] b, int off, int len) throws IOException {
         out.write(b, off, len);
--- a/src/java.base/share/classes/java/util/zip/Deflater.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/zip/Deflater.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -364,7 +364,7 @@
      * effect only after that invocation.
      *
      * @param strategy the new compression strategy
-     * @exception IllegalArgumentException if the compression strategy is
+     * @throws    IllegalArgumentException if the compression strategy is
      *                                     invalid
      */
     public void setStrategy(int strategy) {
@@ -393,7 +393,7 @@
      * take effect only after that invocation.
      *
      * @param level the new compression level (0-9)
-     * @exception IllegalArgumentException if the compression level is invalid
+     * @throws    IllegalArgumentException if the compression level is invalid
      */
     public void setLevel(int level) {
         if ((level < 0 || level > 9) && level != DEFAULT_COMPRESSION) {
--- a/src/java.base/share/classes/java/util/zip/DeflaterOutputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/zip/DeflaterOutputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -101,7 +101,7 @@
      * @param out the output stream
      * @param def the compressor ("deflater")
      * @param size the output buffer size
-     * @exception IllegalArgumentException if {@code size <= 0}
+     * @throws    IllegalArgumentException if {@code size <= 0}
      */
     public DeflaterOutputStream(OutputStream out, Deflater def, int size) {
         this(out, def, size, false);
@@ -180,7 +180,7 @@
      * Writes a byte to the compressed output stream. This method will
      * block until the byte can be written.
      * @param b the byte to be written
-     * @exception IOException if an I/O error has occurred
+     * @throws    IOException if an I/O error has occurred
      */
     public void write(int b) throws IOException {
         byte[] buf = new byte[1];
@@ -194,7 +194,7 @@
      * @param b the data to be written
      * @param off the start offset of the data
      * @param len the length of the data
-     * @exception IOException if an I/O error has occurred
+     * @throws    IOException if an I/O error has occurred
      */
     public void write(byte[] b, int off, int len) throws IOException {
         if (def.finished()) {
@@ -217,7 +217,7 @@
      * Finishes writing compressed data to the output stream without closing
      * the underlying stream. Use this method when applying multiple filters
      * in succession to the same output stream.
-     * @exception IOException if an I/O error has occurred
+     * @throws    IOException if an I/O error has occurred
      */
     public void finish() throws IOException {
         if (!def.finished()) {
@@ -231,7 +231,7 @@
     /**
      * Writes remaining compressed data to the output stream and closes the
      * underlying stream.
-     * @exception IOException if an I/O error has occurred
+     * @throws    IOException if an I/O error has occurred
      */
     public void close() throws IOException {
         if (!closed) {
--- a/src/java.base/share/classes/java/util/zip/GZIPInputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/zip/GZIPInputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -69,10 +69,10 @@
      * @param in the input stream
      * @param size the input buffer size
      *
-     * @exception ZipException if a GZIP format error has occurred or the
+     * @throws    ZipException if a GZIP format error has occurred or the
      *                         compression method used is unsupported
-     * @exception IOException if an I/O error has occurred
-     * @exception IllegalArgumentException if {@code size <= 0}
+     * @throws    IOException if an I/O error has occurred
+     * @throws    IllegalArgumentException if {@code size <= 0}
      */
     public GZIPInputStream(InputStream in, int size) throws IOException {
         super(in, new Inflater(true), size);
@@ -84,30 +84,30 @@
      * Creates a new input stream with a default buffer size.
      * @param in the input stream
      *
-     * @exception ZipException if a GZIP format error has occurred or the
+     * @throws    ZipException if a GZIP format error has occurred or the
      *                         compression method used is unsupported
-     * @exception IOException if an I/O error has occurred
+     * @throws    IOException if an I/O error has occurred
      */
     public GZIPInputStream(InputStream in) throws IOException {
         this(in, 512);
     }
 
     /**
-     * Reads uncompressed data into an array of bytes. If <code>len</code> is not
+     * Reads uncompressed data into an array of bytes. If {@code len} is not
      * zero, the method will block until some input can be decompressed; otherwise,
-     * no bytes are read and <code>0</code> is returned.
+     * no bytes are read and {@code 0} is returned.
      * @param buf the buffer into which the data is read
-     * @param off the start offset in the destination array <code>b</code>
+     * @param off the start offset in the destination array {@code b}
      * @param len the maximum number of bytes read
      * @return  the actual number of bytes read, or -1 if the end of the
      *          compressed input stream is reached
      *
-     * @exception  NullPointerException If <code>buf</code> is <code>null</code>.
-     * @exception  IndexOutOfBoundsException If <code>off</code> is negative,
-     * <code>len</code> is negative, or <code>len</code> is greater than
-     * <code>buf.length - off</code>
-     * @exception ZipException if the compressed input data is corrupt.
-     * @exception IOException if an I/O error has occurred.
+     * @throws     NullPointerException If {@code buf} is {@code null}.
+     * @throws     IndexOutOfBoundsException If {@code off} is negative,
+     * {@code len} is negative, or {@code len} is greater than
+     * {@code buf.length - off}
+     * @throws    ZipException if the compressed input data is corrupt.
+     * @throws    IOException if an I/O error has occurred.
      *
      */
     public int read(byte[] buf, int off, int len) throws IOException {
@@ -130,7 +130,7 @@
     /**
      * Closes this input stream and releases any system resources associated
      * with the stream.
-     * @exception IOException if an I/O error has occurred
+     * @throws    IOException if an I/O error has occurred
      */
     public void close() throws IOException {
         if (!closed) {
--- a/src/java.base/share/classes/java/util/zip/GZIPOutputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/zip/GZIPOutputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -61,8 +61,8 @@
      *
      * @param out the output stream
      * @param size the output buffer size
-     * @exception IOException If an I/O error has occurred.
-     * @exception IllegalArgumentException if {@code size <= 0}
+     * @throws    IOException If an I/O error has occurred.
+     * @throws    IllegalArgumentException if {@code size <= 0}
      */
     public GZIPOutputStream(OutputStream out, int size) throws IOException {
         this(out, size, false);
@@ -80,8 +80,8 @@
      *        this instance flushes the compressor with flush mode
      *        {@link Deflater#SYNC_FLUSH} before flushing the output
      *        stream, otherwise only flushes the output stream
-     * @exception IOException If an I/O error has occurred.
-     * @exception IllegalArgumentException if {@code size <= 0}
+     * @throws    IOException If an I/O error has occurred.
+     * @throws    IllegalArgumentException if {@code size <= 0}
      *
      * @since 1.7
      */
@@ -104,7 +104,7 @@
      * the 2-argument constructor GZIPOutputStream(out, false).
      *
      * @param out the output stream
-     * @exception IOException If an I/O error has occurred.
+     * @throws    IOException If an I/O error has occurred.
      */
     public GZIPOutputStream(OutputStream out) throws IOException {
         this(out, 512, false);
@@ -122,7 +122,7 @@
      *        {@link Deflater#SYNC_FLUSH} before flushing the output
      *        stream, otherwise only flushes the output stream
      *
-     * @exception IOException If an I/O error has occurred.
+     * @throws    IOException If an I/O error has occurred.
      *
      * @since 1.7
      */
@@ -138,7 +138,7 @@
      * @param buf the data to be written
      * @param off the start offset of the data
      * @param len the length of the data
-     * @exception IOException If an I/O error has occurred.
+     * @throws    IOException If an I/O error has occurred.
      */
     public synchronized void write(byte[] buf, int off, int len)
         throws IOException
@@ -151,7 +151,7 @@
      * Finishes writing compressed data to the output stream without closing
      * the underlying stream. Use this method when applying multiple filters
      * in succession to the same output stream.
-     * @exception IOException if an I/O error has occurred
+     * @throws    IOException if an I/O error has occurred
      */
     public void finish() throws IOException {
         if (!def.finished()) {
--- a/src/java.base/share/classes/java/util/zip/InflaterInputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/zip/InflaterInputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -76,7 +76,7 @@
      * @param in the input stream
      * @param inf the decompressor ("inflater")
      * @param size the input buffer size
-     * @exception IllegalArgumentException if {@code size <= 0}
+     * @throws    IllegalArgumentException if {@code size <= 0}
      */
     public InflaterInputStream(InputStream in, Inflater inf, int size) {
         super(in);
@@ -116,7 +116,7 @@
      * Reads a byte of uncompressed data. This method will block until
      * enough input is available for decompression.
      * @return the byte read, or -1 if end of compressed input is reached
-     * @exception IOException if an I/O error has occurred
+     * @throws    IOException if an I/O error has occurred
      */
     public int read() throws IOException {
         ensureOpen();
@@ -124,20 +124,20 @@
     }
 
     /**
-     * Reads uncompressed data into an array of bytes. If <code>len</code> is not
+     * Reads uncompressed data into an array of bytes. If {@code len} is not
      * zero, the method will block until some input can be decompressed; otherwise,
-     * no bytes are read and <code>0</code> is returned.
+     * no bytes are read and {@code 0} is returned.
      * @param b the buffer into which the data is read
-     * @param off the start offset in the destination array <code>b</code>
+     * @param off the start offset in the destination array {@code b}
      * @param len the maximum number of bytes read
      * @return the actual number of bytes read, or -1 if the end of the
      *         compressed input is reached or a preset dictionary is needed
-     * @exception  NullPointerException If <code>b</code> is <code>null</code>.
-     * @exception  IndexOutOfBoundsException If <code>off</code> is negative,
-     * <code>len</code> is negative, or <code>len</code> is greater than
-     * <code>b.length - off</code>
-     * @exception ZipException if a ZIP format error has occurred
-     * @exception IOException if an I/O error has occurred
+     * @throws     NullPointerException If {@code b} is {@code null}.
+     * @throws     IndexOutOfBoundsException If {@code off} is negative,
+     * {@code len} is negative, or {@code len} is greater than
+     * {@code b.length - off}
+     * @throws    ZipException if a ZIP format error has occurred
+     * @throws    IOException if an I/O error has occurred
      */
     public int read(byte[] b, int off, int len) throws IOException {
         ensureOpen();
@@ -173,7 +173,7 @@
      * of bytes that could be read without blocking.
      *
      * @return     1 before EOF and 0 after EOF.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      *
      */
     public int available() throws IOException {
@@ -195,8 +195,8 @@
      * Skips specified number of bytes of uncompressed data.
      * @param n the number of bytes to skip
      * @return the actual number of bytes skipped.
-     * @exception IOException if an I/O error has occurred
-     * @exception IllegalArgumentException if {@code n < 0}
+     * @throws    IOException if an I/O error has occurred
+     * @throws    IllegalArgumentException if {@code n < 0}
      */
     public long skip(long n) throws IOException {
         if (n < 0) {
@@ -223,7 +223,7 @@
     /**
      * Closes this input stream and releases any system resources associated
      * with the stream.
-     * @exception IOException if an I/O error has occurred
+     * @throws    IOException if an I/O error has occurred
      */
     public void close() throws IOException {
         if (!closed) {
@@ -236,7 +236,7 @@
 
     /**
      * Fills input buffer with more data to decompress.
-     * @exception IOException if an I/O error has occurred
+     * @throws    IOException if an I/O error has occurred
      */
     protected void fill() throws IOException {
         ensureOpen();
@@ -248,13 +248,13 @@
     }
 
     /**
-     * Tests if this input stream supports the <code>mark</code> and
-     * <code>reset</code> methods. The <code>markSupported</code>
-     * method of <code>InflaterInputStream</code> returns
-     * <code>false</code>.
+     * Tests if this input stream supports the {@code mark} and
+     * {@code reset} methods. The {@code markSupported}
+     * method of {@code InflaterInputStream} returns
+     * {@code false}.
      *
-     * @return  a <code>boolean</code> indicating if this stream type supports
-     *          the <code>mark</code> and <code>reset</code> methods.
+     * @return  a {@code boolean} indicating if this stream type supports
+     *          the {@code mark} and {@code reset} methods.
      * @see     java.io.InputStream#mark(int)
      * @see     java.io.InputStream#reset()
      */
@@ -265,7 +265,7 @@
     /**
      * Marks the current position in this input stream.
      *
-     * <p> The <code>mark</code> method of <code>InflaterInputStream</code>
+     * <p> The {@code mark} method of {@code InflaterInputStream}
      * does nothing.
      *
      * @param   readlimit   the maximum limit of bytes that can be read before
@@ -277,13 +277,13 @@
 
     /**
      * Repositions this stream to the position at the time the
-     * <code>mark</code> method was last called on this input stream.
+     * {@code mark} method was last called on this input stream.
      *
-     * <p> The method <code>reset</code> for class
-     * <code>InflaterInputStream</code> does nothing except throw an
-     * <code>IOException</code>.
+     * <p> The method {@code reset} for class
+     * {@code InflaterInputStream} does nothing except throw an
+     * {@code IOException}.
      *
-     * @exception  IOException  if this method is invoked.
+     * @throws     IOException  if this method is invoked.
      * @see     java.io.InputStream#mark(int)
      * @see     java.io.IOException
      */
--- a/src/java.base/share/classes/java/util/zip/ZipException.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/zip/ZipException.java	Tue Sep 24 15:19:35 2019 -0400
@@ -41,7 +41,7 @@
     private static final long serialVersionUID = 8000196834066748623L;
 
     /**
-     * Constructs a <code>ZipException</code> with <code>null</code>
+     * Constructs a {@code ZipException} with {@code null}
      * as its error detail message.
      */
     public ZipException() {
@@ -49,7 +49,7 @@
     }
 
     /**
-     * Constructs a <code>ZipException</code> with the specified detail
+     * Constructs a {@code ZipException} with the specified detail
      * message.
      *
      * @param   s   the detail message.
--- a/src/java.base/share/classes/java/util/zip/ZipInputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/zip/ZipInputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -110,8 +110,8 @@
      * Reads the next ZIP file entry and positions the stream at the
      * beginning of the entry data.
      * @return the next ZIP file entry, or null if there are no more entries
-     * @exception ZipException if a ZIP file error has occurred
-     * @exception IOException if an I/O error has occurred
+     * @throws    ZipException if a ZIP file error has occurred
+     * @throws    IOException if an I/O error has occurred
      */
     public ZipEntry getNextEntry() throws IOException {
         ensureOpen();
@@ -133,8 +133,8 @@
     /**
      * Closes the current ZIP entry and positions the stream for reading the
      * next entry.
-     * @exception ZipException if a ZIP file error has occurred
-     * @exception IOException if an I/O error has occurred
+     * @throws    ZipException if a ZIP file error has occurred
+     * @throws    IOException if an I/O error has occurred
      */
     public void closeEntry() throws IOException {
         ensureOpen();
@@ -150,7 +150,7 @@
      * of bytes that could be read without blocking.
      *
      * @return     1 before EOF and 0 after EOF has reached for current entry.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws     IOException  if an I/O error occurs.
      *
      */
     public int available() throws IOException {
@@ -164,20 +164,20 @@
 
     /**
      * Reads from the current ZIP entry into an array of bytes.
-     * If <code>len</code> is not zero, the method
+     * If {@code len} is not zero, the method
      * blocks until some input is available; otherwise, no
-     * bytes are read and <code>0</code> is returned.
+     * bytes are read and {@code 0} is returned.
      * @param b the buffer into which the data is read
-     * @param off the start offset in the destination array <code>b</code>
+     * @param off the start offset in the destination array {@code b}
      * @param len the maximum number of bytes read
      * @return the actual number of bytes read, or -1 if the end of the
      *         entry is reached
-     * @exception  NullPointerException if <code>b</code> is <code>null</code>.
-     * @exception  IndexOutOfBoundsException if <code>off</code> is negative,
-     * <code>len</code> is negative, or <code>len</code> is greater than
-     * <code>b.length - off</code>
-     * @exception ZipException if a ZIP file error has occurred
-     * @exception IOException if an I/O error has occurred
+     * @throws     NullPointerException if {@code b} is {@code null}.
+     * @throws     IndexOutOfBoundsException if {@code off} is negative,
+     * {@code len} is negative, or {@code len} is greater than
+     * {@code b.length - off}
+     * @throws    ZipException if a ZIP file error has occurred
+     * @throws    IOException if an I/O error has occurred
      */
     public int read(byte[] b, int off, int len) throws IOException {
         ensureOpen();
@@ -231,9 +231,9 @@
      * Skips specified number of bytes in the current ZIP entry.
      * @param n the number of bytes to skip
      * @return the actual number of bytes skipped
-     * @exception ZipException if a ZIP file error has occurred
-     * @exception IOException if an I/O error has occurred
-     * @exception IllegalArgumentException if {@code n < 0}
+     * @throws    ZipException if a ZIP file error has occurred
+     * @throws    IOException if an I/O error has occurred
+     * @throws    IllegalArgumentException if {@code n < 0}
      */
     public long skip(long n) throws IOException {
         if (n < 0) {
@@ -260,7 +260,7 @@
     /**
      * Closes this input stream and releases any system resources associated
      * with the stream.
-     * @exception IOException if an I/O error has occurred
+     * @throws    IOException if an I/O error has occurred
      */
     public void close() throws IOException {
         if (!closed) {
@@ -327,7 +327,7 @@
     }
 
     /**
-     * Creates a new <code>ZipEntry</code> object for the specified
+     * Creates a new {@code ZipEntry} object for the specified
      * entry name.
      *
      * @param name the ZIP file entry name
--- a/src/java.base/share/classes/java/util/zip/ZipOutputStream.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/classes/java/util/zip/ZipOutputStream.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -140,8 +140,8 @@
 
     /**
      * Sets the ZIP file comment.
-     * @param comment the comment string
-     * @exception IllegalArgumentException if the length of the specified
+     * @param     comment the comment string
+     * @throws    IllegalArgumentException if the length of the specified
      *            ZIP file comment is greater than 0xFFFF bytes
      */
     public void setComment(String comment) {
@@ -156,8 +156,8 @@
      * Sets the default compression method for subsequent entries. This
      * default will be used whenever the compression method is not specified
      * for an individual ZIP file entry, and is initially set to DEFLATED.
-     * @param method the default compression method
-     * @exception IllegalArgumentException if the specified compression method
+     * @param     method the default compression method
+     * @throws    IllegalArgumentException if the specified compression method
      *            is invalid
      */
     public void setMethod(int method) {
@@ -170,8 +170,8 @@
     /**
      * Sets the compression level for subsequent entries which are DEFLATED.
      * The default setting is DEFAULT_COMPRESSION.
-     * @param level the compression level (0-9)
-     * @exception IllegalArgumentException if the compression level is invalid
+     * @param     level the compression level (0-9)
+     * @throws    IllegalArgumentException if the compression level is invalid
      */
     public void setLevel(int level) {
         def.setLevel(level);
@@ -183,9 +183,9 @@
      * The default compression method will be used if no compression method
      * was specified for the entry, and the current time will be used if
      * the entry has no set modification time.
-     * @param e the ZIP entry to be written
-     * @exception ZipException if a ZIP format error has occurred
-     * @exception IOException if an I/O error has occurred
+     * @param     e the ZIP entry to be written
+     * @throws    ZipException if a ZIP format error has occurred
+     * @throws    IOException if an I/O error has occurred
      */
     public void putNextEntry(ZipEntry e) throws IOException {
         ensureOpen();
@@ -242,8 +242,8 @@
     /**
      * Closes the current ZIP entry and positions the stream for writing
      * the next entry.
-     * @exception ZipException if a ZIP format error has occurred
-     * @exception IOException if an I/O error has occurred
+     * @throws    ZipException if a ZIP format error has occurred
+     * @throws    IOException if an I/O error has occurred
      */
     public void closeEntry() throws IOException {
         ensureOpen();
@@ -307,11 +307,11 @@
     /**
      * Writes an array of bytes to the current ZIP entry data. This method
      * will block until all the bytes are written.
-     * @param b the data to be written
-     * @param off the start offset in the data
-     * @param len the number of bytes that are written
-     * @exception ZipException if a ZIP file error has occurred
-     * @exception IOException if an I/O error has occurred
+     * @param     b the data to be written
+     * @param     off the start offset in the data
+     * @param     len the number of bytes that are written
+     * @throws    ZipException if a ZIP file error has occurred
+     * @throws    IOException if an I/O error has occurred
      */
     public synchronized void write(byte[] b, int off, int len)
         throws IOException
@@ -349,8 +349,8 @@
      * Finishes writing the contents of the ZIP output stream without closing
      * the underlying stream. Use this method when applying multiple filters
      * in succession to the same output stream.
-     * @exception ZipException if a ZIP file error has occurred
-     * @exception IOException if an I/O exception has occurred
+     * @throws    ZipException if a ZIP file error has occurred
+     * @throws    IOException if an I/O exception has occurred
      */
     public void finish() throws IOException {
         ensureOpen();
@@ -370,8 +370,8 @@
 
     /**
      * Closes the ZIP output stream as well as the stream being filtered.
-     * @exception ZipException if a ZIP file error has occurred
-     * @exception IOException if an I/O error has occurred
+     * @throws    ZipException if a ZIP file error has occurred
+     * @throws    IOException if an I/O error has occurred
      */
     public void close() throws IOException {
         if (!closed) {
--- a/src/java.base/share/native/libjava/ObjectInputStream.c	Tue Sep 24 14:12:08 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,175 +0,0 @@
-/*
- * Copyright (c) 1996, 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.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "jni.h"
-#include "jvm.h"
-#include "jni_util.h"
-#include "jlong.h"
-
-#include "java_lang_Float.h"
-#include "java_lang_Double.h"
-#include "java_io_ObjectInputStream.h"
-
-
-/*
- * Class:     java_io_ObjectInputStream
- * Method:    bytesToFloats
- * Signature: ([BI[FII)V
- *
- * Reconstitutes nfloats float values from their byte representations.  Byte
- * values are read from array src starting at offset srcpos; the resulting
- * float values are written to array dst starting at dstpos.
- */
-JNIEXPORT void JNICALL
-Java_java_io_ObjectInputStream_bytesToFloats(JNIEnv *env,
-                                             jclass this,
-                                             jbyteArray src,
-                                             jint srcpos,
-                                             jfloatArray dst,
-                                             jint dstpos,
-                                             jint nfloats)
-{
-    union {
-        int i;
-        float f;
-    } u;
-    jfloat *floats;
-    jbyte *bytes;
-    jsize dstend;
-    jint ival;
-
-    if (nfloats == 0)
-        return;
-
-    /* fetch source array */
-    if (src == NULL) {
-        JNU_ThrowNullPointerException(env, NULL);
-        return;
-    }
-    bytes = (*env)->GetPrimitiveArrayCritical(env, src, NULL);
-    if (bytes == NULL)          /* exception thrown */
-        return;
-
-    /* fetch dest array */
-    if (dst == NULL) {
-        (*env)->ReleasePrimitiveArrayCritical(env, src, bytes, JNI_ABORT);
-        JNU_ThrowNullPointerException(env, NULL);
-        return;
-    }
-    floats = (*env)->GetPrimitiveArrayCritical(env, dst, NULL);
-    if (floats == NULL) {       /* exception thrown */
-        (*env)->ReleasePrimitiveArrayCritical(env, src, bytes, JNI_ABORT);
-        return;
-    }
-
-    /* do conversion */
-    dstend = dstpos + nfloats;
-    for ( ; dstpos < dstend; dstpos++) {
-        ival = ((bytes[srcpos + 0] & 0xFF) << 24) +
-               ((bytes[srcpos + 1] & 0xFF) << 16) +
-               ((bytes[srcpos + 2] & 0xFF) << 8) +
-               ((bytes[srcpos + 3] & 0xFF) << 0);
-        u.i = (long) ival;
-        floats[dstpos] = (jfloat) u.f;
-        srcpos += 4;
-    }
-
-    (*env)->ReleasePrimitiveArrayCritical(env, src, bytes, JNI_ABORT);
-    (*env)->ReleasePrimitiveArrayCritical(env, dst, floats, 0);
-}
-
-/*
- * Class:     java_io_ObjectInputStream
- * Method:    bytesToDoubles
- * Signature: ([BI[DII)V
- *
- * Reconstitutes ndoubles double values from their byte representations.
- * Byte values are read from array src starting at offset srcpos; the
- * resulting double values are written to array dst starting at dstpos.
- */
-JNIEXPORT void JNICALL
-Java_java_io_ObjectInputStream_bytesToDoubles(JNIEnv *env,
-                                              jclass this,
-                                              jbyteArray src,
-                                              jint srcpos,
-                                              jdoubleArray dst,
-                                              jint dstpos,
-                                              jint ndoubles)
-
-{
-    union {
-        jlong l;
-        double d;
-    } u;
-    jdouble *doubles;
-    jbyte *bytes;
-    jsize dstend;
-    jlong lval;
-
-    if (ndoubles == 0)
-        return;
-
-    /* fetch source array */
-    if (src == NULL) {
-        JNU_ThrowNullPointerException(env, NULL);
-        return;
-    }
-    bytes = (*env)->GetPrimitiveArrayCritical(env, src, NULL);
-    if (bytes == NULL)          /* exception thrown */
-        return;
-
-    /* fetch dest array */
-    if (dst == NULL) {
-        (*env)->ReleasePrimitiveArrayCritical(env, src, bytes, JNI_ABORT);
-        JNU_ThrowNullPointerException(env, NULL);
-        return;
-    }
-    doubles = (*env)->GetPrimitiveArrayCritical(env, dst, NULL);
-    if (doubles == NULL) {      /* exception thrown */
-        (*env)->ReleasePrimitiveArrayCritical(env, src, bytes, JNI_ABORT);
-        return;
-    }
-
-    /* do conversion */
-    dstend = dstpos + ndoubles;
-    for ( ; dstpos < dstend; dstpos++) {
-        lval = (((jlong) bytes[srcpos + 0] & 0xFF) << 56) +
-               (((jlong) bytes[srcpos + 1] & 0xFF) << 48) +
-               (((jlong) bytes[srcpos + 2] & 0xFF) << 40) +
-               (((jlong) bytes[srcpos + 3] & 0xFF) << 32) +
-               (((jlong) bytes[srcpos + 4] & 0xFF) << 24) +
-               (((jlong) bytes[srcpos + 5] & 0xFF) << 16) +
-               (((jlong) bytes[srcpos + 6] & 0xFF) << 8) +
-               (((jlong) bytes[srcpos + 7] & 0xFF) << 0);
-        jlong_to_jdouble_bits(&lval);
-        u.l = lval;
-        doubles[dstpos] = (jdouble) u.d;
-        srcpos += 8;
-    }
-
-    (*env)->ReleasePrimitiveArrayCritical(env, src, bytes, JNI_ABORT);
-    (*env)->ReleasePrimitiveArrayCritical(env, dst, doubles, 0);
-}
-
--- a/src/java.base/share/native/libjava/ObjectOutputStream.c	Tue Sep 24 14:12:08 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,181 +0,0 @@
-/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "jni_util.h"
-#include "jdk_util.h"
-
-#include "java_lang_Float.h"
-#include "java_lang_Double.h"
-#include "java_io_ObjectOutputStream.h"
-
-/*
- * Class:     java_io_ObjectOutputStream
- * Method:    floatsToBytes
- * Signature: ([FI[BII)V
- *
- * Convert nfloats float values to their byte representations.  Float values
- * are read from array src starting at offset srcpos and written to array
- * dst starting at offset dstpos.
- */
-JNIEXPORT void JNICALL
-Java_java_io_ObjectOutputStream_floatsToBytes(JNIEnv *env,
-                                              jclass this,
-                                              jfloatArray src,
-                                              jint srcpos,
-                                              jbyteArray dst,
-                                              jint dstpos,
-                                              jint nfloats)
-{
-    union {
-        int i;
-        float f;
-    } u;
-    jfloat *floats;
-    jbyte *bytes;
-    jsize srcend;
-    jint ival;
-    float fval;
-
-    if (nfloats == 0)
-        return;
-
-    /* fetch source array */
-    if (src == NULL) {
-        JNU_ThrowNullPointerException(env, NULL);
-        return;
-    }
-    floats = (*env)->GetPrimitiveArrayCritical(env, src, NULL);
-    if (floats == NULL)         /* exception thrown */
-        return;
-
-    /* fetch dest array */
-    if (dst == NULL) {
-        (*env)->ReleasePrimitiveArrayCritical(env, src, floats, JNI_ABORT);
-        JNU_ThrowNullPointerException(env, NULL);
-        return;
-    }
-    bytes = (*env)->GetPrimitiveArrayCritical(env, dst, NULL);
-    if (bytes == NULL) {        /* exception thrown */
-        (*env)->ReleasePrimitiveArrayCritical(env, src, floats, JNI_ABORT);
-        return;
-    }
-
-    /* do conversion */
-    srcend = srcpos + nfloats;
-    for ( ; srcpos < srcend; srcpos++) {
-        fval = (float) floats[srcpos];
-        if (ISNANF(fval)) {          /* collapse NaNs */
-            ival = 0x7fc00000;
-        } else {
-            u.f = fval;
-            ival = (jint) u.i;
-        }
-        bytes[dstpos++] = (ival >> 24) & 0xFF;
-        bytes[dstpos++] = (ival >> 16) & 0xFF;
-        bytes[dstpos++] = (ival >> 8) & 0xFF;
-        bytes[dstpos++] = (ival >> 0) & 0xFF;
-    }
-
-    (*env)->ReleasePrimitiveArrayCritical(env, src, floats, JNI_ABORT);
-    (*env)->ReleasePrimitiveArrayCritical(env, dst, bytes, 0);
-}
-
-/*
- * Class:     java_io_ObjectOutputStream
- * Method:    doublesToBytes
- * Signature: ([DI[BII)V
- *
- * Convert ndoubles double values to their byte representations.  Double
- * values are read from array src starting at offset srcpos and written to
- * array dst starting at offset dstpos.
- */
-JNIEXPORT void JNICALL
-Java_java_io_ObjectOutputStream_doublesToBytes(JNIEnv *env,
-                                               jclass this,
-                                               jdoubleArray src,
-                                               jint srcpos,
-                                               jbyteArray dst,
-                                               jint dstpos,
-                                               jint ndoubles)
-{
-    union {
-        jlong l;
-        double d;
-    } u;
-    jdouble *doubles;
-    jbyte *bytes;
-    jsize srcend;
-    jdouble dval;
-    jlong lval;
-
-    if (ndoubles == 0)
-        return;
-
-    /* fetch source array */
-    if (src == NULL) {
-        JNU_ThrowNullPointerException(env, NULL);
-        return;
-    }
-    doubles = (*env)->GetPrimitiveArrayCritical(env, src, NULL);
-    if (doubles == NULL)                /* exception thrown */
-        return;
-
-    /* fetch dest array */
-    if (dst == NULL) {
-        (*env)->ReleasePrimitiveArrayCritical(env, src, doubles, JNI_ABORT);
-        JNU_ThrowNullPointerException(env, NULL);
-        return;
-    }
-    bytes = (*env)->GetPrimitiveArrayCritical(env, dst, NULL);
-    if (bytes == NULL) {        /* exception thrown */
-        (*env)->ReleasePrimitiveArrayCritical(env, src, doubles, JNI_ABORT);
-        return;
-    }
-
-    /* do conversion */
-    srcend = srcpos + ndoubles;
-    for ( ; srcpos < srcend; srcpos++) {
-        dval = doubles[srcpos];
-        if (ISNAND((double) dval)) {         /* collapse NaNs */
-            lval = jint_to_jlong(0x7ff80000);
-            lval = jlong_shl(lval, 32);
-        } else {
-            jdouble_to_jlong_bits(&dval);
-            u.d = (double) dval;
-            lval = u.l;
-        }
-        bytes[dstpos++] = (lval >> 56) & 0xFF;
-        bytes[dstpos++] = (lval >> 48) & 0xFF;
-        bytes[dstpos++] = (lval >> 40) & 0xFF;
-        bytes[dstpos++] = (lval >> 32) & 0xFF;
-        bytes[dstpos++] = (lval >> 24) & 0xFF;
-        bytes[dstpos++] = (lval >> 16) & 0xFF;
-        bytes[dstpos++] = (lval >> 8) & 0xFF;
-        bytes[dstpos++] = (lval >> 0) & 0xFF;
-    }
-
-    (*env)->ReleasePrimitiveArrayCritical(env, src, doubles, JNI_ABORT);
-    (*env)->ReleasePrimitiveArrayCritical(env, dst, bytes, 0);
-}
--- a/src/java.base/share/native/libjli/java.c	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/native/libjli/java.c	Tue Sep 24 15:19:35 2019 -0400
@@ -338,9 +338,6 @@
     /* Set the -Dsun.java.launcher pseudo property */
     SetJavaLauncherProp();
 
-    /* set the -Dsun.java.launcher.* platform properties */
-    SetJavaLauncherPlatformProps();
-
     return JVMInit(&ifn, threadStackSize, argc, argv, mode, what, ret);
 }
 /*
--- a/src/java.base/share/native/libjli/java.h	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/share/native/libjli/java.h	Tue Sep 24 15:19:35 2019 -0400
@@ -161,7 +161,6 @@
 int CallJavaMainInNewThread(jlong stack_size, void* args);
 
 /* sun.java.launcher.* platform properties. */
-void SetJavaLauncherPlatformProps(void);
 void SetJavaCommandLineProp(char* what, int argc, char** argv);
 void SetJavaLauncherProp(void);
 
--- a/src/java.base/unix/classes/sun/nio/ch/InheritedChannel.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/unix/classes/sun/nio/ch/InheritedChannel.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,6 +43,12 @@
     private static final int SOCK_STREAM        = 1;
     private static final int SOCK_DGRAM         = 2;
 
+    // socket address type
+    private static final int AF_UNKNOWN         = -1;
+    private static final int AF_INET            = 1;
+    private static final int AF_INET6           = 2;
+    private static final int AF_UNIX            = 3;
+
     // oflag values when opening a file
     private static final int O_RDONLY           = 0;
     private static final int O_WRONLY           = 1;
@@ -89,6 +95,20 @@
         }
     }
 
+    public static class InheritedUnixChannelImpl extends UnixDomainSocketChannelImpl {
+
+        InheritedUnixChannelImpl(FileDescriptor fd)
+            throws IOException
+        {
+            super(fd);
+        }
+
+        protected void implCloseSelectableChannel() throws IOException {
+            super.implCloseChannel();
+            detachIOStreams();
+        }
+    }
+
     public static class InheritedServerSocketChannelImpl extends
         ServerSocketChannelImpl {
 
@@ -160,7 +180,6 @@
             return null;
         }
 
-
         // Next we create a FileDescriptor for the dup'ed file descriptor
         // Have to use reflection and also make assumption on how FD
         // is implemented.
@@ -182,6 +201,17 @@
 
         Channel c;
         if (st == SOCK_STREAM) {
+            int family = addressFamily(fdVal);
+            if (family == AF_UNKNOWN)
+                return null;
+            if (family == AF_UNIX) {
+                if (isConnected(fdVal)) {
+                    return new InheritedUnixChannelImpl(fd);
+                } else {
+                    // listener. unsupported.
+                    return null;
+                }
+            }
             InetAddress ia = peerAddress0(fdVal);
             if (ia == null) {
                c = new InheritedServerSocketChannelImpl(provider, fd);
@@ -232,9 +262,13 @@
     private static native int open0(String path, int oflag) throws IOException;
     private static native void close0(int fd) throws IOException;
     private static native int soType0(int fd);
+    private static native int addressFamily(int fd);
     private static native InetAddress peerAddress0(int fd);
     private static native int peerPort0(int fd);
 
+    // return true if socket is connected to a peer
+    private static native boolean isConnected(int fd);
+
     static {
         IOUtil.load();
         initIDs();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/unix/classes/sun/nio/ch/UnixDomainSocketChannelImpl.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,266 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.nio.ch;
+
+import java.io.FileDescriptor;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.AsynchronousCloseException;
+import java.nio.channels.ByteChannel;
+import java.nio.channels.ClosedChannelException;
+import java.nio.channels.NotYetConnectedException;
+import java.nio.channels.spi.AbstractInterruptibleChannel;
+import java.util.Objects;
+import java.util.concurrent.locks.ReentrantLock;
+
+import static java.util.concurrent.TimeUnit.NANOSECONDS;
+
+class UnixDomainSocketChannelImpl
+    extends AbstractInterruptibleChannel
+    implements ByteChannel
+{
+    // Used to make native read and write calls
+    private static final NativeDispatcher nd = new SocketDispatcher();
+
+    // Our file descriptor object
+    private final FileDescriptor fd;
+    // Lock held by current reading or connecting thread
+    private final ReentrantLock readLock = new ReentrantLock();
+
+    // Lock held by current writing or connecting thread
+    private final ReentrantLock writeLock = new ReentrantLock();
+
+    // Lock for managing close state
+    private final Object stateLock = new Object();
+
+    // Channel state
+    private static final int ST_INUSE = 0;
+    private static final int ST_CLOSING = 1;
+    private static final int ST_CLOSED = 2;
+    private int state;
+
+    // IDs of native threads doing reads and writes, for signalling
+    private long readerThread;
+    private long writerThread;
+
+    UnixDomainSocketChannelImpl(FileDescriptor fd)
+        throws IOException
+    {
+        this.fd = fd;
+    }
+
+    /**
+     * Checks that the channel is open.
+     *
+     * @throws ClosedChannelException if channel is closed (or closing)
+     */
+    private void ensureOpen() throws ClosedChannelException {
+        if (!isOpen())
+            throw new ClosedChannelException();
+    }
+
+    /**
+     * Closes the socket if there are no I/O operations in progress
+     */
+    private boolean tryClose() throws IOException {
+        assert Thread.holdsLock(stateLock) && state == ST_CLOSING;
+        if (readerThread == 0 && writerThread == 0) {
+            state = ST_CLOSED;
+            nd.close(fd);
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * Complete closure of pre-closed socket (release the file descriptor)
+     */
+    private void tryFinishClose() {
+        try {
+            tryClose();
+        } catch (IOException ignore) { }
+    }
+
+    /**
+     * Marks the beginning of a read operation
+     *
+     * @throws ClosedChannelException if the channel is closed
+     * @throws NotYetConnectedException if the channel is not yet connected
+     */
+    private void beginRead() throws ClosedChannelException {
+        // set hook for Thread.interrupt
+        begin();
+        synchronized (stateLock) {
+            ensureOpen();
+            readerThread = NativeThread.current();
+        }
+    }
+
+    /**
+     * Marks the end of a read operation that may have blocked.
+     *
+     * @throws AsynchronousCloseException if the channel was closed due to this
+     * thread being interrupted on a blocking read operation.
+     */
+    private void endRead(boolean completed)
+        throws AsynchronousCloseException
+    {
+        synchronized (stateLock) {
+            readerThread = 0;
+            if (state == ST_CLOSING) {
+                tryFinishClose();
+            }
+        }
+        end(completed);
+    }
+
+    @Override
+    public int read(ByteBuffer buf) throws IOException {
+        Objects.requireNonNull(buf);
+
+        readLock.lock();
+        try {
+            int n = 0;
+            try {
+                beginRead();
+                n = IOUtil.read(fd, buf, -1, nd);
+                while (IOStatus.okayToRetry(n) && isOpen()) {
+                    park(Net.POLLIN, 0L);
+                    n = IOUtil.read(fd, buf, -1, nd);
+                }
+            } finally {
+                endRead(n > 0);
+            }
+            return n;
+        } finally {
+            readLock.unlock();
+        }
+    }
+
+    /**
+     * Marks the beginning of a write operation that might block.
+     *
+     * @throws ClosedChannelException if the channel is closed
+     * @throws NotYetConnectedException if the channel is not yet connected
+     */
+    private void beginWrite() throws ClosedChannelException {
+        begin();
+        synchronized (stateLock) {
+            // set hook for Thread.interrupt
+            ensureOpen();
+            writerThread = NativeThread.current();
+        }
+    }
+
+    /**
+     * Marks the end of a write operation that may have blocked.
+     *
+     * @throws AsynchronousCloseException if the channel was closed due to this
+     * thread being interrupted on a blocking write operation.
+     */
+    private void endWrite(boolean completed)
+        throws AsynchronousCloseException
+    {
+        synchronized (stateLock) {
+            writerThread = 0;
+            if (state == ST_CLOSING) {
+                tryFinishClose();
+            }
+        }
+        end(completed);
+    }
+
+    void park(int event, long nanos) throws IOException {
+        long millis;
+        if (nanos <= 0) {
+            millis = -1;
+        } else {
+            millis = NANOSECONDS.toMillis(nanos);
+        }
+        Net.poll(fd, event, millis);
+    }
+
+    @Override
+    public int write(ByteBuffer buf) throws IOException {
+        Objects.requireNonNull(buf);
+
+        writeLock.lock();
+        try {
+            int n = 0;
+            try {
+                beginWrite();
+                n = IOUtil.write(fd, buf, -1, nd);
+                while (IOStatus.okayToRetry(n) && isOpen()) {
+                    park(Net.POLLOUT, 0L);
+                    n = IOUtil.write(fd, buf, -1, nd);
+                }
+            } finally {
+                endWrite(n > 0);
+            }
+            return n;
+        } finally {
+            writeLock.unlock();
+        }
+    }
+
+    /**
+     * Closes this channel
+     *
+     * If there is an I/O operation in progress then the socket is pre-closed
+     * and the I/O threads signalled, in which case the final close is deferred
+     * until all I/O operations complete.
+     */
+    @Override
+    protected void implCloseChannel() throws IOException {
+        synchronized (stateLock) {
+            assert state == ST_INUSE;
+            state = ST_CLOSING;
+            if (!tryClose()) {
+                long reader = readerThread;
+                long writer = writerThread;
+                if (reader != 0 || writer != 0) {
+                    nd.preClose(fd);
+                    if (reader != 0)
+                        NativeThread.signal(reader);
+                    if (writer != 0)
+                        NativeThread.signal(writer);
+                }
+            }
+        }
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(this.getClass().getSuperclass().getName());
+        sb.append('[');
+        if (!isOpen())
+            sb.append("closed");
+        sb.append(']');
+        return sb.toString();
+    }
+}
--- a/src/java.base/unix/classes/sun/nio/fs/UnixNativeDispatcher.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/unix/classes/sun/nio/fs/UnixNativeDispatcher.java	Tue Sep 24 15:19:35 2019 -0400
@@ -33,7 +33,7 @@
     protected UnixNativeDispatcher() { }
 
     // returns a NativeBuffer containing the given path
-    private static NativeBuffer copyToNativeBuffer(UnixPath path) {
+    static NativeBuffer copyToNativeBuffer(UnixPath path) {
         byte[] cstr = path.getByteArrayForSysCalls();
         int size = cstr.length + 1;
         NativeBuffer buffer = NativeBuffers.getNativeBufferFromCache(size);
--- a/src/java.base/unix/native/libjava/TimeZone_md.c	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/unix/native/libjava/TimeZone_md.c	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,8 @@
 #include "jvm.h"
 #include "TimeZone_md.h"
 
+static char *isFileIdentical(char* buf, size_t size, char *pathname);
+
 #define SKIP_SPACE(p)   while (*p == ' ' || *p == '\t') p++;
 
 #define RESTARTABLE(_cmd, _result) do { \
@@ -72,6 +74,8 @@
 static const char *DEFAULT_ZONEINFO_FILE = "/usr/share/lib/zoneinfo/localtime";
 #endif /* defined(__linux__) || defined(_ALLBSD_SOURCE) */
 
+static const char popularZones[][4] = {"UTC", "GMT"};
+
 #if defined(_AIX)
 static const char *ETC_ENVIRONMENT_FILE = "/etc/environment";
 #endif
@@ -121,14 +125,27 @@
 findZoneinfoFile(char *buf, size_t size, const char *dir)
 {
     DIR *dirp = NULL;
-    struct stat64 statbuf;
     struct dirent *dp = NULL;
     char *pathname = NULL;
-    int fd = -1;
-    char *dbuf = NULL;
     char *tz = NULL;
     int res;
 
+    if (strcmp(dir, ZONEINFO_DIR) == 0) {
+        /* fast path for 1st iteration */
+        for (unsigned int i = 0; i < sizeof (popularZones) / sizeof (popularZones[0]); i++) {
+            pathname = getPathName(dir, popularZones[i]);
+            if (pathname == NULL) {
+                continue;
+            }
+            tz = isFileIdentical(buf, size, pathname);
+            free((void *) pathname);
+            pathname = NULL;
+            if (tz != NULL) {
+                return tz;
+            }
+        }
+    }
+
     dirp = opendir(dir);
     if (dirp == NULL) {
         return NULL;
@@ -162,58 +179,67 @@
         if (pathname == NULL) {
             break;
         }
-        RESTARTABLE(stat64(pathname, &statbuf), res);
-        if (res == -1) {
-            break;
-        }
 
-        if (S_ISDIR(statbuf.st_mode)) {
-            tz = findZoneinfoFile(buf, size, pathname);
-            if (tz != NULL) {
-                break;
-            }
-        } else if (S_ISREG(statbuf.st_mode) && (size_t)statbuf.st_size == size) {
-            dbuf = (char *) malloc(size);
-            if (dbuf == NULL) {
-                break;
-            }
-            RESTARTABLE(open(pathname, O_RDONLY), fd);
-            if (fd == -1) {
-                break;
-            }
-            RESTARTABLE(read(fd, dbuf, size), res);
-            if (res != (ssize_t) size) {
-                break;
-            }
-            if (memcmp(buf, dbuf, size) == 0) {
-                tz = getZoneName(pathname);
-                if (tz != NULL) {
-                    tz = strdup(tz);
-                }
-                break;
-            }
-            free((void *) dbuf);
-            dbuf = NULL;
-            (void) close(fd);
-            fd = -1;
-        }
+        tz = isFileIdentical(buf, size, pathname);
         free((void *) pathname);
         pathname = NULL;
+        if (tz != NULL) {
+           break;
+        }
     }
 
     if (dirp != NULL) {
         (void) closedir(dirp);
     }
-    if (pathname != NULL) {
-        free((void *) pathname);
+    return tz;
+}
+
+/*
+ * Checks if the file pointed to by pathname matches
+ * the data contents in buf.
+ * Returns a representation of the timezone file name
+ * if file match is found, otherwise NULL.
+ */
+static char *
+isFileIdentical(char *buf, size_t size, char *pathname)
+{
+    char *possibleMatch = NULL;
+    struct stat64 statbuf;
+    char *dbuf = NULL;
+    int fd = -1;
+    int res;
+
+    RESTARTABLE(stat64(pathname, &statbuf), res);
+    if (res == -1) {
+        return NULL;
     }
-    if (fd != -1) {
+
+    if (S_ISDIR(statbuf.st_mode)) {
+        possibleMatch  = findZoneinfoFile(buf, size, pathname);
+    } else if (S_ISREG(statbuf.st_mode) && (size_t)statbuf.st_size == size) {
+        dbuf = (char *) malloc(size);
+        if (dbuf == NULL) {
+            return NULL;
+        }
+        RESTARTABLE(open(pathname, O_RDONLY), fd);
+        if (fd == -1) {
+            goto freedata;
+        }
+        RESTARTABLE(read(fd, dbuf, size), res);
+        if (res != (ssize_t) size) {
+            goto freedata;
+        }
+        if (memcmp(buf, dbuf, size) == 0) {
+            possibleMatch = getZoneName(pathname);
+            if (possibleMatch != NULL) {
+                possibleMatch = strdup(possibleMatch);
+            }
+        }
+        freedata:
+        free((void *) dbuf);
         (void) close(fd);
     }
-    if (dbuf != NULL) {
-        free((void *) dbuf);
-    }
-    return tz;
+    return possibleMatch;
 }
 
 #if defined(__linux__) || defined(MACOSX)
--- a/src/java.base/unix/native/libjli/java_md_solinux.c	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/unix/native/libjli/java_md_solinux.c	Tue Sep 24 15:19:35 2019 -0400
@@ -790,16 +790,6 @@
 /* Coarse estimation of number of digits assuming the worst case is a 64-bit pid. */
 #define MAX_PID_STR_SZ   20
 
-void SetJavaLauncherPlatformProps() {
-   /* Linux only */
-#ifdef __linux__
-    const char *substr = "-Dsun.java.launcher.pid=";
-    char *pid_prop_str = (char *)JLI_MemAlloc(JLI_StrLen(substr) + MAX_PID_STR_SZ + 1);
-    sprintf(pid_prop_str, "%s%d", substr, getpid());
-    AddOption(pid_prop_str, NULL);
-#endif /* __linux__ */
-}
-
 int
 JVMInit(InvocationFunctions* ifn, jlong threadStackSize,
         int argc, char **argv,
--- a/src/java.base/unix/native/libnet/NetworkInterface.c	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/unix/native/libnet/NetworkInterface.c	Tue Sep 24 15:19:35 2019 -0400
@@ -1394,6 +1394,10 @@
 /** AIX **/
 #if defined(_AIX)
 
+/* seems getkerninfo is guarded by _KERNEL in the system headers */
+/* see net/proto_uipc.h */
+int getkerninfo(int, char *, int *, int32long64_t);
+
 /*
  * Opens a socket for further ioctl calls. Tries AF_INET socket first and
  * if it fails return AF_INET6 socket.
@@ -1613,7 +1617,7 @@
         return -1;
     }
 
-    if (getkerninfo(KINFO_NDD, nddp, &size, 0) < 0) {
+    if (getkerninfo(KINFO_NDD, (char*) nddp, &size, 0) < 0) {
         perror("getkerninfo 2");
         free(nddp);
         return -1;
--- a/src/java.base/unix/native/libnio/ch/InheritedChannel.c	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/unix/native/libnio/ch/InheritedChannel.c	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -82,6 +82,39 @@
 }
 
 JNIEXPORT jint JNICALL
+Java_sun_nio_ch_InheritedChannel_addressFamily(JNIEnv *env, jclass cla, jint fd)
+{
+    SOCKETADDRESS addr;
+    socklen_t addrlen = sizeof(addr);
+
+    if (getsockname(fd, (struct sockaddr *)&addr, &addrlen) < 0) {
+        return sun_nio_ch_InheritedChannel_AF_UNKNOWN;
+    }
+    if (addr.sa.sa_family == AF_INET) {
+        return sun_nio_ch_InheritedChannel_AF_INET;
+    }
+    if (addr.sa.sa_family == AF_INET6) {
+        return sun_nio_ch_InheritedChannel_AF_INET6;
+    }
+    if (addr.sa.sa_family == AF_UNIX) {
+        return sun_nio_ch_InheritedChannel_AF_UNIX;
+    }
+    return sun_nio_ch_InheritedChannel_AF_UNKNOWN;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_sun_nio_ch_InheritedChannel_isConnected(JNIEnv *env, jclass cla, jint fd)
+{
+    SOCKETADDRESS addr;
+    socklen_t addrlen = sizeof(addr);
+
+    if (getpeername(fd, (struct sockaddr *)&addr, &addrlen) < 0) {
+        return JNI_FALSE;
+    }
+    return JNI_TRUE;
+}
+
+JNIEXPORT jint JNICALL
 Java_sun_nio_ch_InheritedChannel_soType0(JNIEnv *env, jclass cla, jint fd)
 {
     int sotype;
--- a/src/java.base/windows/native/libjli/java_md.c	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.base/windows/native/libjli/java_md.c	Tue Sep 24 15:19:35 2019 -0400
@@ -803,9 +803,6 @@
     return rslt;
 }
 
-/* Unix only, empty on windows. */
-void SetJavaLauncherPlatformProps() {}
-
 /*
  * The implementation for finding classes from the bootstrap
  * class loader, refer to java.h
--- a/src/java.compiler/share/classes/javax/lang/model/package-info.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.compiler/share/classes/javax/lang/model/package-info.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,8 @@
  */
 
 /**
- * Classes and hierarchies of packages used to model the Java
+ * Types and hierarchies of packages comprising a {@index "Java language
+ * model"}, a model of the declarations and types of the Java
  * programming language.
  *
  * The members of this package and its subpackages are for use in
@@ -41,14 +42,14 @@
  * Languages and Applications, October 2004.
  * </blockquote>
  *
- * In particular, the model makes a distinction between static
+ * In particular, the model makes a distinction between declared
  * language constructs, like the {@linkplain javax.lang.model.element
  * element} representing {@code java.util.Set}, and the family of
  * {@linkplain javax.lang.model.type types} that may be associated
  * with an element, like the raw type {@code java.util.Set}, {@code
  * java.util.Set<String>}, and {@code java.util.Set<T>}.
  *
- * <p> Unless otherwise specified, methods in this package will throw
+ * <p>Unless otherwise specified, methods in this package will throw
  * a {@code NullPointerException} if given a {@code null} argument.
  *
  * @author Joseph D. Darcy
--- a/src/java.desktop/aix/native/libawt/porting_aix.c	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.desktop/aix/native/libawt/porting_aix.c	Tue Sep 24 15:19:35 2019 -0400
@@ -43,11 +43,10 @@
 
 static int dladdr_dont_reload(void* addr, Dl_info* info) {
   const struct ld_info* p = (struct ld_info*) dladdr_buffer;
-  info->dli_fbase = 0; info->dli_fname = 0;
-  info->dli_sname = 0; info->dli_saddr = 0;
+  memset((void *)info, 0, sizeof(Dl_info));
   for (;;) {
     if (addr >= p->ldinfo_textorg &&
-        addr < (((char*)p->ldinfo_textorg) + p->ldinfo_textsize)) {
+        addr < p->ldinfo_textorg + p->ldinfo_textsize) {
       info->dli_fname = p->ldinfo_filename;
       info->dli_fbase = p->ldinfo_textorg;
       return 1; /* [sic] */
--- a/src/java.desktop/unix/native/common/awt/fontpath.c	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.desktop/unix/native/common/awt/fontpath.c	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -887,9 +887,9 @@
     locale = (*env)->GetStringUTFChars(env, localeStr, 0);
 
     if ((libfontconfig = openFontConfig()) == NULL) {
-        (*env)->ReleaseStringUTFChars (env, fcNameStr, (const char*)fcName);
+        (*env)->ReleaseStringUTFChars(env, fcNameStr, (const char*)fcName);
         if (locale) {
-            (*env)->ReleaseStringUTFChars (env, localeStr,(const char*)locale);
+            (*env)->ReleaseStringUTFChars(env, localeStr,(const char*)locale);
         }
         return -1;
     }
@@ -918,9 +918,9 @@
         FcPatternGetInteger  == NULL ||
         FcPatternDestroy     == NULL) { /* problem with the library: return. */
 
-        (*env)->ReleaseStringUTFChars (env, fcNameStr, (const char*)fcName);
+        (*env)->ReleaseStringUTFChars(env, fcNameStr, (const char*)fcName);
         if (locale) {
-            (*env)->ReleaseStringUTFChars (env, localeStr,(const char*)locale);
+            (*env)->ReleaseStringUTFChars(env, localeStr,(const char*)locale);
         }
         closeFontConfig(libfontconfig, JNI_FALSE);
         return -1;
@@ -945,9 +945,9 @@
     }
     (*FcPatternDestroy)(pattern);
 
-    (*env)->ReleaseStringUTFChars (env, fcNameStr, (const char*)fcName);
+    (*env)->ReleaseStringUTFChars(env, fcNameStr, (const char*)fcName);
     if (locale) {
-        (*env)->ReleaseStringUTFChars (env, localeStr, (const char*)locale);
+        (*env)->ReleaseStringUTFChars(env, localeStr, (const char*)locale);
     }
     closeFontConfig(libfontconfig, JNI_TRUE);
 
@@ -1179,6 +1179,9 @@
         (*env)->DeleteLocalRef(env, fcNameStr);
         if (pattern == NULL) {
             closeFontConfig(libfontconfig, JNI_FALSE);
+            if (locale) {
+                (*env)->ReleaseStringUTFChars(env, localeStr, (const char*)locale);
+            }
             return;
         }
 
@@ -1196,6 +1199,9 @@
         if (fontset == NULL) {
             (*FcPatternDestroy)(pattern);
             closeFontConfig(libfontconfig, JNI_FALSE);
+            if (locale) {
+                (*env)->ReleaseStringUTFChars(env, localeStr, (const char*)locale);
+            }
             return;
         }
 
@@ -1227,6 +1233,9 @@
             (*FcPatternDestroy)(pattern);
             (*FcFontSetDestroy)(fontset);
             closeFontConfig(libfontconfig, JNI_FALSE);
+            if (locale) {
+                (*env)->ReleaseStringUTFChars(env, localeStr, (const char*)locale);
+            }
             return;
         }
         fontCount = 0;
@@ -1269,6 +1278,9 @@
                 (*FcPatternDestroy)(pattern);
                 (*FcFontSetDestroy)(fontset);
                 closeFontConfig(libfontconfig, JNI_FALSE);
+                if (locale) {
+                    (*env)->ReleaseStringUTFChars(env, localeStr, (const char*)locale);
+                }
                 return;
             }
 
@@ -1323,6 +1335,9 @@
                 (*FcPatternDestroy)(pattern);
                 (*FcFontSetDestroy)(fontset);
                 closeFontConfig(libfontconfig, JNI_FALSE);
+                if (locale) {
+                    (*env)->ReleaseStringUTFChars(env, localeStr, (const char*)locale);
+                }
                 return;
             }
             (*env)->SetObjectField(env,fcCompFontObj, fcAllFontsID, fcFontArr);
@@ -1384,7 +1399,7 @@
     /* release resources and close the ".so" */
 
     if (locale) {
-        (*env)->ReleaseStringUTFChars (env, localeStr, (const char*)locale);
+        (*env)->ReleaseStringUTFChars(env, localeStr, (const char*)locale);
     }
     closeFontConfig(libfontconfig, JNI_TRUE);
 }
--- a/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1130,6 +1130,9 @@
     const char *pLibName = env->GetStringUTFChars(libName, NULL);
     JNU_CHECK_EXCEPTION_RETURN(env, 0);
     HINSTANCE libHandle = (HINSTANCE)JDK_LoadSystemLibrary(pLibName);
+    if (pLibName != NULL) {
+        env->ReleaseStringUTFChars(libName, pLibName);
+    }
     if (libHandle != NULL) {
         UINT fuLoad = (useVGAColors && !IS_WINXP) ? LR_VGACOLOR : 0;
         return ptr_to_jlong(LoadImage(libHandle, MAKEINTRESOURCE(iconID),
--- a/src/java.instrument/share/native/libinstrument/JPLISAgent.c	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.instrument/share/native/libinstrument/JPLISAgent.c	Tue Sep 24 15:19:35 2019 -0400
@@ -1486,6 +1486,7 @@
             platformLen = convertUft8ToPlatformString((char*)utf8Chars, utf8Len, platformChars, MAXPATHLEN);
             if (platformLen < 0) {
                 createAndThrowInternalError(jnienv);
+                (*jnienv)->ReleaseStringUTFChars(jnienv, jarFile, utf8Chars);
                 return;
             }
 
--- a/src/java.naming/share/classes/com/sun/jndi/ldap/DefaultLdapDnsProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.naming/share/classes/com/sun/jndi/ldap/DefaultLdapDnsProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -76,7 +76,7 @@
         }
 
         LdapDnsProviderResult res = new LdapDnsProviderResult(domainName, endpoints);
-        if (res.getEndpoints().size() == 0 && res.getDomainName().isEmpty()) {
+        if (res.getEndpoints().isEmpty() && res.getDomainName().isEmpty()) {
             return Optional.empty();
         } else {
             return Optional.of(res);
--- a/src/java.naming/share/classes/com/sun/jndi/ldap/LdapDnsProviderService.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.naming/share/classes/com/sun/jndi/ldap/LdapDnsProviderService.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,8 @@
  * The {@code LdapDnsProviderService} is responsible for creating and providing
  * access to the registered {@code LdapDnsProvider}s. The {@link ServiceLoader}
  * is used to find and register any implementations of {@link LdapDnsProvider}.
+ *
+ * <p> Instances of this class are safe for use by multiple threads.
  */
 final class LdapDnsProviderService {
 
@@ -68,11 +70,11 @@
     }
 
     /**
-     * Retrieve the singleton static instance of LdapDnsProviderService.
+     * Retrieves the singleton instance of LdapDnsProviderService.
      */
     static LdapDnsProviderService getInstance() {
         if (service != null) return service;
-        synchronized(LOCK) {
+        synchronized (LOCK) {
             if (service != null) return service;
             service = new LdapDnsProviderService();
         }
@@ -80,7 +82,7 @@
     }
 
     /**
-     * Retrieve result from the first provider that successfully resolves
+     * Retrieves result from the first provider that successfully resolves
      * the endpoints. If no results are found when calling installed
      * subclasses of {@code LdapDnsProvider} then this method will fall back
      * to the {@code DefaultLdapDnsProvider}.
@@ -91,14 +93,15 @@
     LdapDnsProviderResult lookupEndpoints(String url, Hashtable<?,?> env)
         throws NamingException
     {
-        Iterator<LdapDnsProvider> iterator = providers.iterator();
+        LdapDnsProviderResult result = null;
         Hashtable<?, ?> envCopy = new Hashtable<>(env);
-        LdapDnsProviderResult result = null;
-
-        while (result == null && iterator.hasNext()) {
-            result = iterator.next().lookupEndpoints(url, envCopy)
-                    .filter(r -> r.getEndpoints().size() > 0)
-                    .orElse(null);
+        synchronized (LOCK) {
+            Iterator<LdapDnsProvider> iterator = providers.iterator();
+            while (result == null && iterator.hasNext()) {
+                result = iterator.next().lookupEndpoints(url, envCopy)
+                        .filter(r -> !r.getEndpoints().isEmpty())
+                        .orElse(null);
+            }
         }
 
         if (result == null) {
--- a/src/java.security.jgss/windows/native/libsspi_bridge/sspi.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.security.jgss/windows/native/libsspi_bridge/sspi.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -218,7 +218,7 @@
 static BOOLEAN
 has_oid(gss_const_OID_set set, gss_const_OID oid)
 {
-    for (int i = 0; i < set->count; i++) {
+    for (size_t i = 0; i < set->count; i++) {
         if (is_same_oid(&set->elements[i], oid)) {
             return TRUE;
         }
@@ -257,7 +257,7 @@
             return;
         }
         PP("gss_OID_set.count is %d", (int)mechs->count);
-        for (int i = 0; i < mechs->count; i++) {
+        for (size_t i = 0; i < mechs->count; i++) {
             show_oid(&mechs->elements[i]);
         }
     }
@@ -1584,7 +1584,7 @@
     if (set == NULL || *set == GSS_C_NO_OID_SET) {
         return GSS_S_COMPLETE;
     }
-    for (int i = 0; i < (*set)->count; i++) {
+    for (size_t i = 0; i < (*set)->count; i++) {
         delete[] (*set)->elements[i].elements;
     }
     delete[] (*set)->elements;
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java	Tue Sep 24 15:19:35 2019 -0400
@@ -3026,7 +3026,7 @@
                                 return XMLEvent.ENTITY_REFERENCE;
                             }
                         }
-                        //Wether it was character reference, entity reference or built-in entity
+                        //Whether it was character reference, entity reference or built-in entity
                         //set the next possible state to SCANNER_STATE_CONTENT
                         setScannerState(SCANNER_STATE_CONTENT);
                         fLastSectionWasEntityReference = true ;
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/AbstractSAXParser.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/AbstractSAXParser.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -78,6 +78,7 @@
  * @author Arnaud Le Hors, IBM
  * @author Andy Clark, IBM
  *
+ * @LastModified: Sep 2019
  */
 @SuppressWarnings("deprecation")
 public abstract class AbstractSAXParser
@@ -318,6 +319,13 @@
         // document's XML 1.0|1.1, that's how it'll stay
         fVersion = version;
         fStandalone = "yes".equals(standalone);
+        if (fContentHandler != null) {
+            try {
+                fContentHandler.declaration(version, encoding, standalone);
+            } catch (SAXException e) {
+                throw new XNIException(e);
+            }
+        }
     } // xmlDecl(String,String,String)
 
     /**
--- a/src/java.xml/share/classes/com/sun/xml/internal/stream/StaxXMLInputSource.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/com/sun/xml/internal/stream/StaxXMLInputSource.java	Tue Sep 24 15:19:35 2019 -0400
@@ -33,7 +33,7 @@
  *
  * @author  Neeraj
  *
- * This class wraps XMLInputSource and is also capable of telling wether application
+ * This class wraps XMLInputSource and is also capable of telling whether application
  * returned XMLStreamReader or not when XMLResolver.resolveEntity
  * was called.
  */
--- a/src/java.xml/share/classes/org/xml/sax/AttributeList.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/AttributeList.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,23 +23,11 @@
  * questions.
  */
 
-// SAX Attribute List Interface.
-// http://www.saxproject.org
-// No warranty; no copyright -- use this as you will.
-// $Id: AttributeList.java,v 1.3 2004/11/03 22:44:51 jsuttor Exp $
-
 package org.xml.sax;
 
 /**
  * Interface for an element's attribute specifications.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
  * <p>This is the original SAX1 interface for reporting an element's
  * attributes.  Unlike the new {@link org.xml.sax.Attributes Attributes}
  * interface, it does not support Namespace-related information.
--- a/src/java.xml/share/classes/org/xml/sax/Attributes.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/Attributes.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,25 +23,12 @@
  * questions.
  */
 
-// Attributes.java - attribute list with Namespace support
-// http://www.saxproject.org
-// Written by David Megginson
-// NO WARRANTY!  This class is in the public domain.
-// $Id: Attributes.java,v 1.2 2004/11/03 22:44:51 jsuttor Exp $
-
 package org.xml.sax;
 
 
 /**
  * Interface for a list of XML attributes.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
  * <p>This interface allows access to a list of attributes in
  * three different ways:</p>
  *
--- a/src/java.xml/share/classes/org/xml/sax/ContentHandler.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/ContentHandler.java	Tue Sep 24 15:19:35 2019 -0400
@@ -23,25 +23,12 @@
  * questions.
  */
 
-// ContentHandler.java - handle main document content.
-// http://www.saxproject.org
-// Written by David Megginson
-// NO WARRANTY!  This class is in the public domain.
-// $Id: ContentHandler.java,v 1.2 2004/11/03 22:44:51 jsuttor Exp $
-
 package org.xml.sax;
 
 
 /**
  * Receive notification of the logical content of a document.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
  * <p>This is the main interface that most SAX applications
  * implement: if the application needs to be informed of basic parsing
  * events, it implements this interface and registers an instance with
@@ -126,6 +113,29 @@
     public void startDocument ()
         throws SAXException;
 
+    /**
+     * Receives notification of the XML declaration.
+     *
+     * @implSpec
+     * The default implementation in the SAX API is to do nothing.
+     *
+     * @param version the version string as in the input document, null if not
+     * specified
+     * @param encoding the encoding string as in the input document, null if not
+     * specified
+     * @param standalone the standalone string as in the input document, null if
+     * not specified
+     *
+     * @throws SAXException if the application wants to report an error or
+     * interrupt the parsing process
+     *
+     * @since 14
+     */
+    default void declaration(String version, String encoding, String standalone)
+        throws SAXException
+    {
+        //no op
+    }
 
     /**
      * Receive notification of the end of a document.
--- a/src/java.xml/share/classes/org/xml/sax/DTDHandler.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/DTDHandler.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,23 +23,11 @@
  * questions.
  */
 
-// SAX DTD handler.
-// http://www.saxproject.org
-// No warranty; no copyright -- use this as you will.
-// $Id: DTDHandler.java,v 1.2 2004/11/03 22:44:51 jsuttor Exp $
-
 package org.xml.sax;
 
 /**
  * Receive notification of basic DTD-related events.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
  * <p>If a SAX application needs information about notations and
  * unparsed entities, then the application implements this
  * interface and registers an instance with the SAX parser using
--- a/src/java.xml/share/classes/org/xml/sax/DocumentHandler.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/DocumentHandler.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,23 +23,11 @@
  * questions.
  */
 
-// SAX document handler.
-// http://www.saxproject.org
-// No warranty; no copyright -- use this as you will.
-// $Id: DocumentHandler.java,v 1.2 2004/11/03 22:44:51 jsuttor Exp $
-
 package org.xml.sax;
 
 /**
  * Receive notification of general document events.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
  * <p>This was the main event-handling interface for SAX1; in
  * SAX2, it has been replaced by {@link org.xml.sax.ContentHandler
  * ContentHandler}, which provides Namespace support and reporting
--- a/src/java.xml/share/classes/org/xml/sax/EntityResolver.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/EntityResolver.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,11 +23,6 @@
  * questions.
  */
 
-// SAX entity resolver.
-// http://www.saxproject.org
-// No warranty; no copyright -- use this as you will.
-// $Id: EntityResolver.java,v 1.2 2004/11/03 22:44:52 jsuttor Exp $
-
 package org.xml.sax;
 
 import java.io.IOException;
@@ -36,13 +31,6 @@
 /**
  * Basic interface for resolving entities.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
  * <p>If a SAX application needs to implement customized handling
  * for external entities, it must implement this interface and
  * register an instance with the SAX driver using the
--- a/src/java.xml/share/classes/org/xml/sax/ErrorHandler.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/ErrorHandler.java	Tue Sep 24 15:19:35 2019 -0400
@@ -23,24 +23,12 @@
  * questions.
  */
 
-// SAX error handler.
-// http://www.saxproject.org
-// No warranty; no copyright -- use this as you will.
-// $Id: ErrorHandler.java,v 1.2 2004/11/03 22:44:52 jsuttor Exp $
-
 package org.xml.sax;
 
 
 /**
  * Basic interface for SAX error handlers.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
  * <p>If a SAX application needs to implement customized error
  * handling, it must implement this interface and then register an
  * instance with the XML reader using the
--- a/src/java.xml/share/classes/org/xml/sax/HandlerBase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/HandlerBase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,24 +23,12 @@
  * questions.
  */
 
-// SAX default handler base class.
-// http://www.saxproject.org
-// No warranty; no copyright -- use this as you will.
-// $Id: HandlerBase.java,v 1.2 2005/06/10 03:50:47 jeffsuttor Exp $
-
 package org.xml.sax;
 
 /**
  * Default base class for handlers.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p>This class implements the default behaviour for four SAX1
+ * <p>This class implements the default behavior for four SAX1
  * interfaces: EntityResolver, DTDHandler, DocumentHandler,
  * and ErrorHandler.  It is now obsolete, but is included in SAX2 to
  * support legacy SAX1 applications.  SAX2 applications should use
--- a/src/java.xml/share/classes/org/xml/sax/InputSource.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/InputSource.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,11 +23,6 @@
  * questions.
  */
 
-// SAX input source.
-// http://www.saxproject.org
-// No warranty; no copyright -- use this as you will.
-// $Id: InputSource.java,v 1.2 2004/11/03 22:55:32 jsuttor Exp $
-
 package org.xml.sax;
 
 import java.io.IOException;
@@ -37,13 +32,6 @@
 /**
  * A single input source for an XML entity.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
  * <p>This class allows a SAX application to encapsulate information
  * about an input source in a single object, which may include
  * a public identifier, a system identifier, a byte stream (possibly
--- a/src/java.xml/share/classes/org/xml/sax/Locator.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/Locator.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,24 +23,12 @@
  * questions.
  */
 
-// SAX locator interface for document events.
-// http://www.saxproject.org
-// No warranty; no copyright -- use this as you will.
-// $Id: Locator.java,v 1.2 2004/11/03 22:55:32 jsuttor Exp $
-
 package org.xml.sax;
 
 
 /**
  * Interface for associating a SAX event with a document location.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
  * <p>If a SAX parser provides location information to the SAX
  * application, it does so by implementing this interface and then
  * passing an instance to the application using the content
--- a/src/java.xml/share/classes/org/xml/sax/Parser.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/Parser.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,11 +23,6 @@
  * questions.
  */
 
-// SAX parser interface.
-// http://www.saxproject.org
-// No warranty; no copyright -- use this as you will.
-// $Id: Parser.java,v 1.2 2004/11/03 22:55:32 jsuttor Exp $
-
 package org.xml.sax;
 
 import java.io.IOException;
@@ -37,13 +32,6 @@
 /**
  * Basic interface for SAX (Simple API for XML) parsers.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
  * <p>This was the main event supplier interface for SAX1; it has
  * been replaced in SAX2 by {@link org.xml.sax.XMLReader XMLReader},
  * which includes Namespace support and sophisticated configurability
--- a/src/java.xml/share/classes/org/xml/sax/SAXException.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/SAXException.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,11 +23,6 @@
  * questions.
  */
 
-// SAX exception class.
-// http://www.saxproject.org
-// No warranty; no copyright -- use this as you will.
-// $Id: SAXException.java,v 1.3 2004/11/03 22:55:32 jsuttor Exp $
-
 package org.xml.sax;
 
 import java.io.IOException;
@@ -39,13 +34,6 @@
 /**
  * Encapsulate a general SAX error or warning.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
  * <p>This class can contain basic error or warning information from
  * either the XML parser or the application: a parser writer or
  * application writer can subclass it to provide additional
--- a/src/java.xml/share/classes/org/xml/sax/SAXNotRecognizedException.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/SAXNotRecognizedException.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,25 +23,12 @@
  * questions.
  */
 
-// SAXNotRecognizedException.java - unrecognized feature or value.
-// http://www.saxproject.org
-// Written by David Megginson
-// NO WARRANTY!  This class is in the Public Domain.
-// $Id: SAXNotRecognizedException.java,v 1.3 2004/11/03 22:55:32 jsuttor Exp $
-
 package org.xml.sax;
 
 
 /**
  * Exception class for an unrecognized identifier.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
  * <p>An XMLReader will throw this exception when it finds an
  * unrecognized feature or property identifier; SAX applications and
  * extensions may use this class for other, similar purposes.</p>
--- a/src/java.xml/share/classes/org/xml/sax/SAXNotSupportedException.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/SAXNotSupportedException.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,24 +23,11 @@
  * questions.
  */
 
-// SAXNotSupportedException.java - unsupported feature or value.
-// http://www.saxproject.org
-// Written by David Megginson
-// NO WARRANTY!  This class is in the Public Domain.
-// $Id: SAXNotSupportedException.java,v 1.4 2004/11/03 22:55:32 jsuttor Exp $
-
 package org.xml.sax;
 
 /**
  * Exception class for an unsupported operation.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
  * <p>An XMLReader will throw this exception when it recognizes a
  * feature or property identifier, but cannot perform the requested
  * operation (setting a state or value).  Other SAX2 applications and
--- a/src/java.xml/share/classes/org/xml/sax/SAXParseException.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/SAXParseException.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,23 +23,11 @@
  * questions.
  */
 
-// SAX exception class.
-// http://www.saxproject.org
-// No warranty; no copyright -- use this as you will.
-// $Id: SAXParseException.java,v 1.2 2004/11/03 22:55:32 jsuttor Exp $
-
 package org.xml.sax;
 
 /**
  * Encapsulate an XML parse error or warning.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
  * <p>This exception may include information for locating the error
  * in the original XML document, as if it came from a {@link Locator}
  * object.  Note that although the application
--- a/src/java.xml/share/classes/org/xml/sax/XMLFilter.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/XMLFilter.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,25 +23,12 @@
  * questions.
  */
 
-// XMLFilter.java - filter SAX2 events.
-// http://www.saxproject.org
-// Written by David Megginson
-// NO WARRANTY!  This class is in the Public Domain.
-// $Id: XMLFilter.java,v 1.2 2004/11/03 22:55:32 jsuttor Exp $
-
 package org.xml.sax;
 
 
 /**
  * Interface for an XML filter.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
  * <p>An XML filter is like an XML reader, except that it obtains its
  * events from another XML reader rather than a primary source like
  * an XML document or database.  Filters can modify a stream of
--- a/src/java.xml/share/classes/org/xml/sax/XMLReader.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/XMLReader.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,12 +23,6 @@
  * questions.
  */
 
-// XMLReader.java - read an XML document.
-// http://www.saxproject.org
-// Written by David Megginson
-// NO WARRANTY!  This class is in the Public Domain.
-// $Id: XMLReader.java,v 1.3 2004/11/03 22:55:32 jsuttor Exp $
-
 package org.xml.sax;
 
 import java.io.IOException;
@@ -37,17 +31,6 @@
 /**
  * Interface for reading an XML document using callbacks.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p><strong>Note:</strong> despite its name, this interface does
- * <em>not</em> extend the standard Java {@link java.io.Reader Reader}
- * interface, because reading XML is a fundamentally different activity
- * than reading character data.</p>
  *
  * <p>XMLReader is the interface that an XML parser's SAX2 driver must
  * implement.  This interface allows an application to set and
@@ -75,6 +58,11 @@
  * <p>There are adapters available to convert a SAX1 Parser to
  * a SAX2 XMLReader and vice-versa.</p>
  *
+ * @apiNote Despite its name, this interface does
+ * <em>not</em> extend the standard Java {@link java.io.Reader Reader}
+ * interface, because reading XML is a fundamentally different activity
+ * than reading character data.
+ *
  * @since 1.4, SAX 2.0
  * @author David Megginson
  * @see org.xml.sax.XMLFilter
--- a/src/java.xml/share/classes/org/xml/sax/ext/Attributes2.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/ext/Attributes2.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,11 +23,6 @@
  * questions.
  */
 
-// Attributes2.java - extended Attributes
-// http://www.saxproject.org
-// Public Domain: no warranty.
-// $Id: Attributes2.java,v 1.2 2004/11/03 22:49:07 jsuttor Exp $
-
 package org.xml.sax.ext;
 
 import org.xml.sax.Attributes;
@@ -35,18 +30,13 @@
 
 /**
  * SAX2 extension to augment the per-attribute information
- * provided though {@link Attributes}.
+ * provided through {@link Attributes}.
  * If an implementation supports this extension, the attributes
  * provided in {@link org.xml.sax.ContentHandler#startElement
  * ContentHandler.startElement() } will implement this interface,
  * and the <em>http://xml.org/sax/features/use-attributes2</em>
  * feature flag will have the value <em>true</em>.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
  * <p> XMLReader implementations are not required to support this
  * information, and it is not part of core-only SAX2 distributions.</p>
  *
--- a/src/java.xml/share/classes/org/xml/sax/ext/Attributes2Impl.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/ext/Attributes2Impl.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,11 +23,6 @@
  * questions.
  */
 
-// Attributes2Impl.java - extended AttributesImpl
-// http://www.saxproject.org
-// Public Domain: no warranty.
-// $Id: Attributes2Impl.java,v 1.3 2005/02/24 11:20:18 gg156739 Exp $
-
 package org.xml.sax.ext;
 
 import org.xml.sax.Attributes;
@@ -38,11 +33,6 @@
  * SAX2 extension helper for additional Attributes information,
  * implementing the {@link Attributes2} interface.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
  * <p>This is not part of core-only SAX2 distributions.</p>
  *
  * <p>The <em>specified</em> flag for each attribute will always
--- a/src/java.xml/share/classes/org/xml/sax/ext/DeclHandler.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/ext/DeclHandler.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,11 +23,6 @@
  * questions.
  */
 
-// DeclHandler.java - Optional handler for DTD declaration events.
-// http://www.saxproject.org
-// Public Domain: no warranty.
-// $Id: DeclHandler.java,v 1.2 2004/11/03 22:49:08 jsuttor Exp $
-
 package org.xml.sax.ext;
 
 import org.xml.sax.SAXException;
@@ -36,13 +31,6 @@
 /**
  * SAX2 extension handler for DTD declaration events.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
  * <p>This is an optional extension handler for SAX2 to provide more
  * complete information about DTD declarations in an XML document.
  * XML readers are not required to recognize this handler, and it
--- a/src/java.xml/share/classes/org/xml/sax/ext/DefaultHandler2.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/ext/DefaultHandler2.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,11 +23,6 @@
  * questions.
  */
 
-// DefaultHandler2.java - extended DefaultHandler
-// http://www.saxproject.org
-// Public Domain: no warranty.
-// $Id: DefaultHandler2.java,v 1.2 2004/11/03 22:49:08 jsuttor Exp $
-
 package org.xml.sax.ext;
 
 import java.io.IOException;
@@ -44,11 +39,6 @@
  * method the added handler methods just return.  Subclassers may
  * override everything on a method-by-method basis.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
  * <p> <em>Note:</em> this class might yet learn that the
  * <em>ContentHandler.setDocumentLocator()</em> call might be passed a
  * {@link Locator2} object, and that the
--- a/src/java.xml/share/classes/org/xml/sax/ext/EntityResolver2.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/ext/EntityResolver2.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,11 +23,6 @@
  * questions.
  */
 
-// EntityResolver2.java - Extended SAX entity resolver.
-// http://www.saxproject.org
-// No warranty; no copyright -- use this as you will.
-// $Id: EntityResolver2.java,v 1.2 2004/11/03 22:49:08 jsuttor Exp $
-
 package org.xml.sax.ext;
 
 import java.io.IOException;
@@ -48,11 +43,6 @@
  * method (in this interface) is used <em>instead of</em> the older (SAX 1.0)
  * {@link EntityResolver#resolveEntity EntityResolver.resolveEntity()} method.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
  * <p>If a SAX application requires the customized handling which this
  * interface defines for external entities, it must ensure that it uses
  * an XMLReader with the
--- a/src/java.xml/share/classes/org/xml/sax/ext/LexicalHandler.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/ext/LexicalHandler.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,11 +23,6 @@
  * questions.
  */
 
-// LexicalHandler.java - optional handler for lexical parse events.
-// http://www.saxproject.org
-// Public Domain: no warranty.
-// $Id: LexicalHandler.java,v 1.2 2004/11/03 22:49:08 jsuttor Exp $
-
 package org.xml.sax.ext;
 
 import org.xml.sax.SAXException;
@@ -35,13 +30,6 @@
 /**
  * SAX2 extension handler for lexical events.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
  * <p>This is an optional extension handler for SAX2 to provide
  * lexical information about an XML document, such as comments
  * and CDATA section boundaries.
--- a/src/java.xml/share/classes/org/xml/sax/ext/Locator2.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/ext/Locator2.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,11 +23,6 @@
  * questions.
  */
 
-// Locator2.java - extended Locator
-// http://www.saxproject.org
-// Public Domain: no warranty.
-// $Id: Locator2.java,v 1.2 2004/11/03 22:49:08 jsuttor Exp $
-
 package org.xml.sax.ext;
 
 import org.xml.sax.Locator;
@@ -35,7 +30,7 @@
 
 /**
  * SAX2 extension to augment the entity information provided
- * though a {@link Locator}.
+ * through a {@link Locator}.
  * If an implementation supports this extension, the Locator
  * provided in {@link org.xml.sax.ContentHandler#setDocumentLocator
  * ContentHandler.setDocumentLocator() } will implement this
@@ -43,11 +38,6 @@
  * <em>http://xml.org/sax/features/use-locator2</em> feature
  * flag will have the value <em>true</em>.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
  * <p> XMLReader implementations are not required to support this
  * information, and it is not part of core-only SAX2 distributions.</p>
  *
--- a/src/java.xml/share/classes/org/xml/sax/ext/Locator2Impl.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/ext/Locator2Impl.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,11 +23,6 @@
  * questions.
  */
 
-// Locator2Impl.java - extended LocatorImpl
-// http://www.saxproject.org
-// Public Domain: no warranty.
-// $Id: Locator2Impl.java,v 1.2 2004/11/03 22:49:08 jsuttor Exp $
-
 package org.xml.sax.ext;
 
 import org.xml.sax.Locator;
@@ -38,11 +33,6 @@
  * SAX2 extension helper for holding additional Entity information,
  * implementing the {@link Locator2} interface.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
  * <p> This is not part of core-only SAX2 distributions.</p>
  *
  * @since 1.5, SAX 2.0.2
--- a/src/java.xml/share/classes/org/xml/sax/ext/package-info.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/ext/package-info.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,9 +27,6 @@
  * Provides interfaces to SAX2 facilities that
  * conformant SAX drivers won't necessarily support.
  *
- * <p>
- * See <a target='_top' href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for more information about SAX.
  *
  * <p>
  * This package is independent of the SAX2 core, though the functionality
@@ -66,6 +63,10 @@
  * As an example, most validation systems can be cleanly layered on top
  * of parsers supporting the standardized SAX2 interfaces.
  *
+ * @apiNote The SAX API, originally developed at
+ * <a href="http://www.saxproject.org">the SAX Project</a>,
+ * has been defined by Java SE since 1.4.
+ *
  * @since 1.4
  */
 
--- a/src/java.xml/share/classes/org/xml/sax/helpers/AttributeListImpl.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/helpers/AttributeListImpl.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,11 +23,6 @@
  * questions.
  */
 
-// SAX default implementation for AttributeList.
-// http://www.saxproject.org
-// No warranty; no copyright -- use this as you will.
-// $Id: AttributeListImpl.java,v 1.2 2004/11/03 22:53:08 jsuttor Exp $
-
 package org.xml.sax.helpers;
 
 import java.util.ArrayList;
@@ -38,13 +33,6 @@
 /**
  * Default implementation for AttributeList.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
  * <p>AttributeList implements the deprecated SAX1 {@link
  * org.xml.sax.AttributeList AttributeList} interface, and has been
  * replaced by the new SAX2 {@link org.xml.sax.helpers.AttributesImpl
--- a/src/java.xml/share/classes/org/xml/sax/helpers/AttributesImpl.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/helpers/AttributesImpl.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,12 +23,6 @@
  * questions.
  */
 
-// AttributesImpl.java - default implementation of Attributes.
-// http://www.saxproject.org
-// Written by David Megginson
-// NO WARRANTY!  This class is in the public domain.
-// $Id: AttributesImpl.java,v 1.2 2004/11/03 22:53:08 jsuttor Exp $
-
 package org.xml.sax.helpers;
 
 import org.xml.sax.Attributes;
@@ -37,13 +31,6 @@
 /**
  * Default implementation of the Attributes interface.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
  * <p>This class provides a default implementation of the SAX2
  * {@link org.xml.sax.Attributes Attributes} interface, with the
  * addition of manipulators so that the list can be modified or
--- a/src/java.xml/share/classes/org/xml/sax/helpers/DefaultHandler.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/helpers/DefaultHandler.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,12 +23,6 @@
  * questions.
  */
 
-// DefaultHandler.java - default implementation of the core handlers.
-// http://www.saxproject.org
-// Written by David Megginson
-// NO WARRANTY!  This class is in the public domain.
-// $Id: DefaultHandler.java,v 1.3 2006/04/13 02:06:32 jeffsuttor Exp $
-
 package org.xml.sax.helpers;
 
 import java.io.IOException;
@@ -47,13 +41,6 @@
 /**
  * Default base class for SAX2 event handlers.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
  * <p>This class is available as a convenience base class for SAX2
  * applications: it provides default implementations for all of the
  * callbacks in the four core SAX2 handler classes:</p>
--- a/src/java.xml/share/classes/org/xml/sax/helpers/LocatorImpl.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/helpers/LocatorImpl.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,11 +23,6 @@
  * questions.
  */
 
-// SAX default implementation for Locator.
-// http://www.saxproject.org
-// No warranty; no copyright -- use this as you will.
-// $Id: LocatorImpl.java,v 1.2 2004/11/03 22:53:09 jsuttor Exp $
-
 package org.xml.sax.helpers;
 
 import org.xml.sax.Locator;
@@ -36,13 +31,6 @@
 /**
  * Provide an optional convenience implementation of Locator.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
  * <p>This class is available mainly for application writers, who
  * can use it to make a persistent snapshot of a locator at any
  * point during a document parse:</p>
--- a/src/java.xml/share/classes/org/xml/sax/helpers/NamespaceSupport.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/helpers/NamespaceSupport.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,12 +23,6 @@
  * questions.
  */
 
-// NamespaceSupport.java - generic Namespace support for SAX.
-// http://www.saxproject.org
-// Written by David Megginson
-// This class is in the Public Domain.  NO WARRANTY!
-// $Id: NamespaceSupport.java,v 1.5 2004/11/03 22:53:09 jsuttor Exp $
-
 package org.xml.sax.helpers;
 
 import java.util.ArrayList;
@@ -44,13 +38,6 @@
  * Encapsulate Namespace logic for use by applications using SAX,
  * or internally by SAX drivers.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
  * <p>This class encapsulates the logic of Namespace processing: it
  * tracks the declarations currently in force for each context and
  * automatically processes qualified XML names into their Namespace
--- a/src/java.xml/share/classes/org/xml/sax/helpers/NewInstance.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/helpers/NewInstance.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,13 +23,6 @@
  * questions.
  */
 
-// NewInstance.java - create a new instance of a class by name.
-// http://www.saxproject.org
-// Written by Edwin Goei, edwingo@apache.org
-// and by David Brownell, dbrownell@users.sourceforge.net
-// NO WARRANTY!  This class is in the Public Domain.
-// $Id: NewInstance.java,v 1.2 2005/06/10 03:50:50 jeffsuttor Exp $
-
 package org.xml.sax.helpers;
 
 import java.lang.reflect.InvocationTargetException;
@@ -38,12 +31,6 @@
 /**
  * Create a new instance of a class by name.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
  *
  * <p>This class contains a static method for creating an instance of a
  * class from an explicit class name.  It tries to use the thread's context
--- a/src/java.xml/share/classes/org/xml/sax/helpers/ParserAdapter.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/helpers/ParserAdapter.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,12 +23,6 @@
  * questions.
  */
 
-// ParserAdapter.java - adapt a SAX1 Parser to a SAX2 XMLReader.
-// http://www.saxproject.org
-// Written by David Megginson
-// NO WARRANTY!  This class is in the public domain.
-// $Id: ParserAdapter.java,v 1.3 2004/11/03 22:53:09 jsuttor Exp $
-
 package org.xml.sax.helpers;
 
 import java.io.IOException;
@@ -56,13 +50,6 @@
 /**
  * Adapt a SAX1 Parser as a SAX2 XMLReader.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
  * <p>This class wraps a SAX1 {@link org.xml.sax.Parser Parser}
  * and makes it act as a SAX2 {@link org.xml.sax.XMLReader XMLReader},
  * with feature, property, and Namespace support.  Note
--- a/src/java.xml/share/classes/org/xml/sax/helpers/ParserFactory.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/helpers/ParserFactory.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,11 +23,6 @@
  * questions.
  */
 
-// SAX parser factory.
-// http://www.saxproject.org
-// No warranty; no copyright -- use this as you will.
-// $Id: ParserFactory.java,v 1.2 2004/11/03 22:53:09 jsuttor Exp $
-
 package org.xml.sax.helpers;
 
 import jdk.xml.internal.SecuritySupport;
@@ -35,13 +30,6 @@
 /**
  * Java-specific class for dynamically loading SAX parsers.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
  * <p><strong>Note:</strong> This class is designed to work with the now-deprecated
  * SAX1 {@link org.xml.sax.Parser Parser} class.  SAX2 applications should use
  * {@link org.xml.sax.helpers.XMLReaderFactory XMLReaderFactory} instead.</p>
--- a/src/java.xml/share/classes/org/xml/sax/helpers/XMLFilterImpl.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/helpers/XMLFilterImpl.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,12 +23,6 @@
  * questions.
  */
 
-// XMLFilterImpl.java - base SAX2 filter implementation.
-// http://www.saxproject.org
-// Written by David Megginson
-// NO WARRANTY!  This class is in the Public Domain.
-// $Id: XMLFilterImpl.java,v 1.3 2004/11/03 22:53:09 jsuttor Exp $
-
 package org.xml.sax.helpers;
 
 import java.io.IOException;
@@ -51,13 +45,6 @@
 /**
  * Base class for deriving an XML filter.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
  * <p>This class is designed to sit between an {@link org.xml.sax.XMLReader
  * XMLReader} and the client application's event handlers.  By default, it
  * does nothing but pass requests up to the reader and events
--- a/src/java.xml/share/classes/org/xml/sax/helpers/XMLReaderAdapter.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/helpers/XMLReaderAdapter.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,12 +23,6 @@
  * questions.
  */
 
-// XMLReaderAdapter.java - adapt an SAX2 XMLReader to a SAX1 Parser
-// http://www.saxproject.org
-// Written by David Megginson
-// NO WARRANTY!  This class is in the public domain.
-// $Id: XMLReaderAdapter.java,v 1.3 2004/11/03 22:53:09 jsuttor Exp $
-
 package org.xml.sax.helpers;
 
 import java.io.IOException;
@@ -53,13 +47,6 @@
 /**
  * Adapt a SAX2 XMLReader as a SAX1 Parser.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
  * <p>This class wraps a SAX2 {@link org.xml.sax.XMLReader XMLReader}
  * and makes it act as a SAX1 {@link org.xml.sax.Parser Parser}.  The XMLReader
  * must support a true value for the
--- a/src/java.xml/share/classes/org/xml/sax/helpers/XMLReaderFactory.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/helpers/XMLReaderFactory.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,13 +23,6 @@
  * questions.
  */
 
-// XMLReaderFactory.java - factory for creating a new reader.
-// http://www.saxproject.org
-// Written by David Megginson
-// and by David Brownell
-// NO WARRANTY!  This class is in the Public Domain.
-// $Id: XMLReaderFactory.java,v 1.2.2.1 2005/07/31 22:48:08 jeffsuttor Exp $
-
 package org.xml.sax.helpers;
 
 import java.io.BufferedReader;
@@ -50,13 +43,6 @@
 /**
  * Factory for creating an XML reader.
  *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
  * <p>This class contains static methods for creating an XML reader
  * from an explicit class name, or based on runtime defaults:
  *
--- a/src/java.xml/share/classes/org/xml/sax/helpers/package-info.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/helpers/package-info.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,9 +28,9 @@
  * Provides helper classes, including
  * support for bootstrapping SAX-based applications.
  *
- * <p>
- * See <a target='_top' href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for more information about SAX.
+ * @apiNote The SAX API, originally developed at
+ * <a href="http://www.saxproject.org">the SAX Project</a>,
+ * has been defined by Java SE since 1.4.
  *
  * @since 1.4
  */
--- a/src/java.xml/share/classes/org/xml/sax/package-info.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/java.xml/share/classes/org/xml/sax/package-info.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,16 +24,10 @@
  */
 
 /**
- * Provides the core SAX APIs.
- * Some SAX1 APIs are deprecated to encourage integration of
- * namespace-awareness into designs of new applications
- * and into maintenance of existing infrastructure.
+ * Provides the interfaces for the Simple API for XML (SAX). Supports both
+ * the SAX1 and SAX2 APIs.
  *
  * <p>
- * See <a target='_top' href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for more information about SAX.
- *
- *
  * <h2> SAX2 Standard Feature Flags </h2>
  *
  * <p>
@@ -330,6 +324,9 @@
  * All of these standard properties are optional.
  * XMLReader implementations are not required to support them.
  *
+ * @apiNote The SAX API, originally developed at
+ * <a href="http://www.saxproject.org">the SAX Project</a>,
+ * has been defined by Java SE since 1.4.
  *
  * @since 1.4
  */
--- a/src/jdk.aot/share/classes/jdk.tools.jaotc.binformat/src/jdk/tools/jaotc/binformat/BinaryContainer.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.aot/share/classes/jdk.tools.jaotc.binformat/src/jdk/tools/jaotc/binformat/BinaryContainer.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.aot/share/classes/jdk.tools.jaotc.test/src/jdk/tools/jaotc/test/NativeOrderOutputStreamTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.aot/share/classes/jdk.tools.jaotc.test/src/jdk/tools/jaotc/test/NativeOrderOutputStreamTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,43 +32,40 @@
 
 package jdk.tools.jaotc.test;
 
-import jdk.tools.jaotc.utils.NativeOrderOutputStream;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
 import org.junit.Assert;
-import org.junit.Before;
 import org.junit.Test;
 
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
+import jdk.tools.jaotc.utils.NativeOrderOutputStream;
 
 public class NativeOrderOutputStreamTest {
 
-    private NativeOrderOutputStream target;
-
-    @Before
-    public void setup() {
-        target = new NativeOrderOutputStream();
-    }
-
     @Test
     public void shouldAdd4BytesForInt() {
+        NativeOrderOutputStream target = new NativeOrderOutputStream();
         target.putInt(5);
         Assert.assertEquals(4, target.position());
     }
 
     @Test
     public void shouldAdd8BytesForLong() {
+        NativeOrderOutputStream target = new NativeOrderOutputStream();
         target.putLong(8);
         Assert.assertEquals(8, target.position());
     }
 
     @Test
     public void shouldHaveCorrectSizeBeforePatch() {
+        NativeOrderOutputStream target = new NativeOrderOutputStream();
         target.patchableInt();
         Assert.assertEquals(4, target.position());
     }
 
     @Test
     public void shouldHaveCorrectSizeAfterPatch() {
+        NativeOrderOutputStream target = new NativeOrderOutputStream();
         NativeOrderOutputStream.PatchableInt patchableInt = target.patchableInt();
         patchableInt.set(12);
         Assert.assertEquals(4, target.position());
@@ -76,12 +73,13 @@
 
     @Test
     public void shouldSetCorrectValueInPatch() {
+        NativeOrderOutputStream target = new NativeOrderOutputStream();
         NativeOrderOutputStream.PatchableInt patchableInt = target.patchableInt();
         patchableInt.set(42);
-        Assert.assertEquals(42, getInt(0));
+        Assert.assertEquals(42, getInt(target, 0));
     }
 
-    private int getInt(int pos) {
+    private static int getInt(NativeOrderOutputStream target, int pos) {
         ByteBuffer buffer = ByteBuffer.wrap(target.array());
         buffer.order(ByteOrder.nativeOrder());
         return buffer.getInt(pos);
@@ -89,6 +87,7 @@
 
     @Test
     public void shouldPutArrayCorrectly() {
+        NativeOrderOutputStream target = new NativeOrderOutputStream();
         target.put(new byte[]{42, 5, 43, 44});
         Assert.assertEquals(4, target.position());
         Assert.assertEquals(42, target.array()[0]);
@@ -97,25 +96,28 @@
 
     @Test
     public void shouldOnlyPatchSlot() {
+        NativeOrderOutputStream target = new NativeOrderOutputStream();
         NativeOrderOutputStream.PatchableInt patchableInt = target.patchableInt();
         target.putInt(7);
         patchableInt.set(39);
-        Assert.assertEquals(39, getInt(0));
-        Assert.assertEquals(7, getInt(4));
+        Assert.assertEquals(39, getInt(target, 0));
+        Assert.assertEquals(7, getInt(target, 4));
     }
 
     @Test
     public void shouldBeAbleToPatchAnywhere() {
+        NativeOrderOutputStream target = new NativeOrderOutputStream();
         target.putInt(19);
         NativeOrderOutputStream.PatchableInt patchableInt = target.patchableInt();
         patchableInt.set(242);
 
-        Assert.assertEquals(19, getInt(0));
-        Assert.assertEquals(242, getInt(4));
+        Assert.assertEquals(19, getInt(target, 0));
+        Assert.assertEquals(242, getInt(target, 4));
     }
 
     @Test
     public void shouldHavePatchableAtRightOffset() {
+        NativeOrderOutputStream target = new NativeOrderOutputStream();
         target.putInt(27);
         Assert.assertEquals(4, target.position());
         NativeOrderOutputStream.PatchableInt patchableInt = target.patchableInt();
@@ -124,6 +126,7 @@
 
     @Test
     public void shouldAlign() {
+        NativeOrderOutputStream target = new NativeOrderOutputStream();
         target.putInt(9);
         target.align(16);
         target.put(new byte[]{3});
--- a/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/Collector.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/Collector.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,6 +40,7 @@
 import jdk.tools.jaotc.collect.directory.DirectorySourceProvider;
 import jdk.tools.jaotc.collect.jar.JarSourceProvider;
 import jdk.tools.jaotc.collect.module.ModuleSourceProvider;
+import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
 import jdk.vm.ci.meta.MetaAccessProvider;
 import jdk.vm.ci.meta.ResolvedJavaMethod;
 import jdk.vm.ci.meta.ResolvedJavaType;
@@ -92,6 +93,7 @@
         if (!main.filters.shouldCompileMethod(method)) {
             return;
         }
+        assert ((HotSpotResolvedObjectType) method.getDeclaringClass()).getFingerprint() != 0 : "no fingerprint for " + method.getDeclaringClass().getName();
 
         aotClass.addMethod(method);
         main.printer.printlnVerbose("  added " + method.getName() + method.getSignature().toMethodDescriptor());
--- a/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/MarkId.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/MarkId.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/MetadataBuilder.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/MetadataBuilder.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileManager.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileManager.java	Tue Sep 24 15:19:35 2019 -0400
@@ -198,6 +198,10 @@
         return locations.isDefaultBootClassPath();
     }
 
+    public boolean isDefaultSystemModulesPath() {
+        return locations.isDefaultSystemModulesPath();
+    }
+
     // <editor-fold defaultstate="collapsed" desc="Option handling">
     @Override @DefinedBy(Api.COMPILER)
     public boolean handleOption(String current, Iterator<String> remaining) {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java	Tue Sep 24 15:19:35 2019 -0400
@@ -94,6 +94,7 @@
 import com.sun.tools.javac.util.Pair;
 import com.sun.tools.javac.util.StringUtils;
 
+import static javax.tools.StandardLocation.SYSTEM_MODULES;
 import static javax.tools.StandardLocation.PLATFORM_CLASS_PATH;
 
 import static com.sun.tools.javac.main.Option.BOOT_CLASS_PATH;
@@ -185,6 +186,12 @@
         return h.isDefault();
     }
 
+    boolean isDefaultSystemModulesPath() {
+        SystemModulesLocationHandler h
+                = (SystemModulesLocationHandler) getHandler(SYSTEM_MODULES);
+        return !h.isExplicit();
+    }
+
     /**
      * Split a search path into its elements. Empty path elements will be ignored.
      *
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java	Tue Sep 24 15:19:35 2019 -0400
@@ -565,8 +565,13 @@
         boolean lintOptions = options.isUnset(Option.XLINT_CUSTOM, "-" + LintCategory.OPTIONS.option);
         if (lintOptions && source.compareTo(Source.DEFAULT) < 0 && !options.isSet(Option.RELEASE)) {
             if (fm instanceof BaseFileManager) {
-                if (((BaseFileManager) fm).isDefaultBootClassPath())
-                    log.warning(LintCategory.OPTIONS, Warnings.SourceNoBootclasspath(source.name));
+                if (source.compareTo(Source.JDK8) <= 0) {
+                    if (((BaseFileManager) fm).isDefaultBootClassPath())
+                        log.warning(LintCategory.OPTIONS, Warnings.SourceNoBootclasspath(source.name));
+                } else {
+                    if (((BaseFileManager) fm).isDefaultSystemModulesPath())
+                        log.warning(LintCategory.OPTIONS, Warnings.SourceNoSystemModulesPath(source.name));
+                }
             }
         }
 
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Tue Sep 24 15:19:35 2019 -0400
@@ -1866,6 +1866,10 @@
     bootstrap class path not set in conjunction with -source {0}
 
 # 0: string
+compiler.warn.source.no.system.modules.path=\
+    system modules path not set in conjunction with -source {0}
+
+# 0: string
 compiler.warn.option.obsolete.source=\
     source value {0} is obsolete and will be removed in a future release
 
--- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java	Tue Sep 24 15:19:35 2019 -0400
@@ -62,7 +62,6 @@
     private static final long serialVersionUID = -1354835039035306505L;
 
     static final Debug debug = Debug.getInstance("sunpkcs11");
-
     // the PKCS11 object through which we make the native calls
     final PKCS11 p11;
 
@@ -913,6 +912,25 @@
         createPoller();
     }
 
+    private static boolean isLegacy(CK_MECHANISM_INFO mechInfo)
+            throws PKCS11Exception {
+        // assume full support if no mech info available
+        // For vendor-specific mechanisms, often no mech info is provided
+        boolean partialSupport = false;
+
+        if (mechInfo != null) {
+            if ((mechInfo.flags & CKF_DECRYPT) != 0) {
+                // non-legacy cipher mechs should support encryption
+                partialSupport |= ((mechInfo.flags & CKF_ENCRYPT) == 0);
+            }
+            if ((mechInfo.flags & CKF_VERIFY) != 0) {
+                // non-legacy signature mechs should support signing
+                partialSupport |= ((mechInfo.flags & CKF_SIGN) == 0);
+            }
+        }
+        return partialSupport;
+    }
+
     // test if a token is present and initialize this provider for it if so.
     // does nothing if no token is found
     // called from constructor and by poller
@@ -946,24 +964,35 @@
         // return a CKM_DES_CBC_PAD.
         final Map<Descriptor,Integer> supportedAlgs =
                                         new HashMap<Descriptor,Integer>();
+
         for (int i = 0; i < supportedMechanisms.length; i++) {
             long longMech = supportedMechanisms[i];
-            boolean isEnabled = config.isEnabled(longMech);
+            CK_MECHANISM_INFO mechInfo = token.getMechanismInfo(longMech);
             if (showInfo) {
-                CK_MECHANISM_INFO mechInfo =
-                        p11.C_GetMechanismInfo(slotID, longMech);
                 System.out.println("Mechanism " +
-                        Functions.getMechanismName(longMech) + ":");
-                if (isEnabled == false) {
+                    Functions.getMechanismName(longMech) + ":");
+                System.out.println(mechInfo == null?
+                    (Constants.INDENT + "info n/a") :
+                    mechInfo);
+            }
+            if (!config.isEnabled(longMech)) {
+                if (showInfo) {
                     System.out.println("DISABLED in configuration");
                 }
-                System.out.println(mechInfo);
-            }
-            if (isEnabled == false) {
                 continue;
             }
+            if (isLegacy(mechInfo)) {
+                if (showInfo) {
+                    System.out.println("DISABLED due to legacy");
+                }
+                continue;
+            }
+
             // we do not know of mechs with the upper 32 bits set
             if (longMech >>> 32 != 0) {
+                if (showInfo) {
+                    System.out.println("DISABLED due to unknown mech value");
+                }
                 continue;
             }
             int mech = (int)longMech;
--- a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_convert.c	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_convert.c	Tue Sep 24 15:19:35 2019 -0400
@@ -1179,7 +1179,7 @@
         throwOutOfMemoryError(env, 0);
         return NULL;
     }
-    TRACE1("DEBUG jMechanismToCKMechanismPtr: allocated mech 0x%lX\n", ckpMech);
+    TRACE1("DEBUG jMechanismToCKMechanismPtr: allocated mech %p \n", ckpMech);
 
     ckpMech->mechanism = jLongToCKULong(jMechType);
 
--- a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_general.c	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_general.c	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 
 /* Copyright  (c) 2002 Graz University of Technology. All rights reserved.
@@ -98,7 +98,7 @@
 (JNIEnv *env, jclass thisClass, jlong ckpMechanism) {
     if (ckpMechanism != 0L) {
         freeCKMechanismPtr(jlong_to_ptr(ckpMechanism));
-        TRACE1("DEBUG PKCS11_freeMechanism: free pMech = %x\n", ckpMechanism);
+        TRACE1("DEBUG PKCS11_freeMechanism: free pMech = %lld\n", (long long int) ckpMechanism);
     }
     return 0L;
 }
@@ -232,7 +232,10 @@
 
     free(ckpInitArgs);
 
-    if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK) { return; }
+    if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK) {
+      TRACE1("DEBUG: C_Initialize had a bad return value %lu \n", (unsigned long) rv);
+      return;
+    }
 
     TRACE0("FINISHED\n");
 }
--- a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_objmgmt.c	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_objmgmt.c	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 
 /* Copyright  (c) 2002 Graz University of Technology. All rights reserved.
@@ -223,18 +223,18 @@
     if (ckpFunctions == NULL) { return; }
 
     TRACE0("DEBUG: C_GetAttributeValue");
-    TRACE1(", hSession=%u", jSessionHandle);
-    TRACE1(", hObject=%u", jObjectHandle);
+    TRACE1(", hSession=%lld", (long long) jSessionHandle);
+    TRACE1(", hObject=%lld", (long long) jObjectHandle);
     TRACE1(", pTemplate=%p", jTemplate);
     TRACE0(" ... ");
 
     ckSessionHandle = jLongToCKULong(jSessionHandle);
     ckObjectHandle = jLongToCKULong(jObjectHandle);
-    TRACE1("jAttributeArrayToCKAttributeArray now with jTemplate = %d", jTemplate);
+    TRACE1("jAttributeArrayToCKAttributeArray now with jTemplate = %p", jTemplate);
     jAttributeArrayToCKAttributeArray(env, jTemplate, &ckpAttributes, &ckAttributesLength);
     if ((*env)->ExceptionCheck(env)) { return; }
 
-    TRACE2("DEBUG: jAttributeArrayToCKAttributeArray finished with ckpAttribute = %d, Length = %d\n", ckpAttributes, ckAttributesLength);
+    TRACE2("DEBUG: jAttributeArrayToCKAttributeArray finished with ckpAttribute = %p, Length = %lu\n", ckpAttributes, (unsigned long) ckAttributesLength);
 
     /* first set all pValue to NULL, to get the needed buffer length */
     for(i = 0; i < ckAttributesLength; i++) {
@@ -345,7 +345,7 @@
     if (ckpFunctions == NULL) { return; }
 
     TRACE0("DEBUG: C_FindObjectsInit");
-    TRACE1(", hSession=%u", jSessionHandle);
+    TRACE1(", hSession=%lld", (long long int) jSessionHandle);
     TRACE1(", pTemplate=%p", jTemplate);
     TRACE0(" ... ");
 
--- a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_sessmgmt.c	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_sessmgmt.c	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 
 /* Copyright  (c) 2002 Graz University of Technology. All rights reserved.
@@ -117,8 +117,8 @@
 #endif /* NO_CALLBACKS */
 
     TRACE0("DEBUG: C_OpenSession");
-    TRACE1(", slotID=%u", ckSlotID);
-    TRACE1(", flags=%x", ckFlags);
+    TRACE1(", slotID=%lu", ckSlotID);
+    TRACE1(", flags=%lu", (unsigned long) ckFlags);
     TRACE0(" ... ");
 
     rv = (*ckpFunctions->C_OpenSession)(ckSlotID, ckFlags, ckpApplication, ckNotify, &ckSessionHandle);
@@ -136,7 +136,7 @@
     }
 
     TRACE0("got session");
-    TRACE1(", SessionHandle=%u", ckSessionHandle);
+    TRACE1(", SessionHandle=%lu", (unsigned long) ckSessionHandle);
     TRACE0(" ... ");
 
     jSessionHandle = ckULongToJLong(ckSessionHandle);
--- a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_util.c	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_util.c	Tue Sep 24 15:19:35 2019 -0400
@@ -719,16 +719,15 @@
         throwOutOfMemoryError(env, 0);
         return;
     }
-    TRACE1(", converting %d attributes", jLength);
+    TRACE1(", converting %lld attributes", (long long int) jLength);
     for (i=0; i<(*ckpLength); i++) {
-        TRACE1(", getting %d. attribute", i);
+        TRACE1(", getting %lu. attribute", i);
         jAttribute = (*env)->GetObjectArrayElement(env, jArray, i);
         if ((*env)->ExceptionCheck(env)) {
             freeCKAttributeArray(*ckpArray, i);
             return;
         }
-        TRACE1(", jAttribute = %d", jAttribute);
-        TRACE1(", converting %d. attribute", i);
+        TRACE1(", jAttribute , converting %lu. attribute", i);
         (*ckpArray)[i] = jAttributeToCKAttribute(env, jAttribute);
         if ((*env)->ExceptionCheck(env)) {
             freeCKAttributeArray(*ckpArray, i);
@@ -1116,7 +1115,7 @@
     if ((*env)->IsInstanceOf(env, jObject, jLongClass)) {
         ckpObject = jLongObjectToCKULongPtr(env, jObject);
         *ckpLength = sizeof(CK_ULONG);
-        TRACE1("<converted long value %X>", *((CK_ULONG *) ckpObject));
+        TRACE1("<converted long value %lu>", *((CK_ULONG *) ckpObject));
         return ckpObject;
     }
 
@@ -1126,7 +1125,7 @@
         ckpObject = jBooleanObjectToCKBBoolPtr(env, jObject);
         *ckpLength = sizeof(CK_BBOOL);
         TRACE0(" <converted boolean value ");
-        TRACE0((*((CK_BBOOL *) ckpObjectPtr) == TRUE) ? "TRUE>" : "FALSE>");
+        TRACE0((*((CK_BBOOL *) ckpObject) == TRUE) ? "TRUE>" : "FALSE>");
         return ckpObject;
     }
 
@@ -1177,7 +1176,7 @@
     if ((*env)->IsInstanceOf(env, jObject, jIntegerClass)) {
         ckpObject = jIntegerObjectToCKULongPtr(env, jObject);
         *ckpLength = sizeof(CK_ULONG);
-        TRACE1("<converted integer value %X>", *((CK_ULONG *) ckpObject));
+        TRACE1("<converted integer value %lu>", *((CK_ULONG *) ckpObject));
         return ckpObject;
     }
 
--- a/src/jdk.hotspot.agent/solaris/native/libsaproc/saproc.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.hotspot.agent/solaris/native/libsaproc/saproc.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -692,11 +692,15 @@
   char errMsg[ERR_MSG_SIZE];
   td_err_e te;
   CHECK_EXCEPTION;
+  if (cmdLine_cstr == NULL) {
+    return;
+  }
 
   // some older versions of libproc.so crash when trying to attach 32 bit
   // debugger to 64 bit core file. check and throw error.
 #ifndef _LP64
-  atoi(cmdLine_cstr);
+  errno = 0;
+  strtol(cmdLine_cstr, NULL, 10);
   if (errno) {
      // core file
      int core_fd;
@@ -706,6 +710,7 @@
             memcmp(&e32.e_ident[EI_MAG0], ELFMAG, SELFMAG) == 0 &&
             e32.e_type == ET_CORE && e32.e_ident[EI_CLASS] == ELFCLASS64) {
               close(core_fd);
+              env->ReleaseStringUTFChars(cmdLine, cmdLine_cstr);
               THROW_NEW_DEBUGGER_EXCEPTION("debuggee is 64 bit, use java -d64 for debugger");
         }
         close(core_fd);
@@ -718,6 +723,7 @@
   ps_prochandle_t* ph = proc_arg_grab(cmdLine_cstr, (isProcess? PR_ARG_PIDS : PR_ARG_CORES), PGRAB_FORCE, &gcode, NULL);
 
   env->ReleaseStringUTFChars(cmdLine, cmdLine_cstr);
+
   if (! ph) {
      if (gcode > 0 && gcode < sizeof(proc_arg_grab_errmsgs)/sizeof(const char*)) {
         snprintf(errMsg, ERR_MSG_SIZE, "Attach failed : %s", proc_arg_grab_errmsgs[gcode]);
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java	Tue Sep 24 15:19:35 2019 -0400
@@ -557,10 +557,10 @@
     native int getCountersSize();
 
     /**
-     * Attempt to change the size of the counters allocated for JVMCI. This requires a safepoint to
+     * Change the size of the counters allocated for JVMCI. This requires a safepoint to
      * safely reallocate the storage but it's advisable to increase the size in reasonable chunks.
      */
-    native boolean setCountersSize(int newSize);
+    native void setCountersSize(int newSize);
 
     /**
      * Determines if {@code metaspaceMethodData} is mature.
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java	Tue Sep 24 15:19:35 2019 -0400
@@ -812,14 +812,13 @@
     }
 
     /**
-     * Attempt to enlarge the number of per thread counters available. Requires a safepoint so
+     * Enlarge the number of per thread counters available. Requires a safepoint so
      * resizing should be rare to avoid performance effects.
      *
      * @param newSize
-     * @return false if the resizing failed
      */
-    public boolean setCountersSize(int newSize) {
-        return compilerToVm.setCountersSize(newSize);
+    public void setCountersSize(int newSize) {
+        compilerToVm.setCountersSize(newSize);
     }
 
     /**
--- a/src/jdk.internal.vm.compiler.management/share/classes/org.graalvm.compiler.hotspot.management/src/org/graalvm/compiler/hotspot/management/HotSpotGraalManagement.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler.management/share/classes/org.graalvm.compiler.hotspot.management/src/org/graalvm/compiler/hotspot/management/HotSpotGraalManagement.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler.management/share/classes/org.graalvm.compiler.hotspot.management/src/org/graalvm/compiler/hotspot/management/HotSpotGraalRuntimeMBean.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler.management/share/classes/org.graalvm.compiler.hotspot.management/src/org/graalvm/compiler/hotspot/management/HotSpotGraalRuntimeMBean.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler.management/share/classes/org.graalvm.compiler.hotspot.management/src/org/graalvm/compiler/hotspot/management/package-info.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler.management/share/classes/org.graalvm.compiler.hotspot.management/src/org/graalvm/compiler/hotspot/management/package-info.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/jdk.internal.vm.compiler.libgraal/src/jdk/internal/vm/compiler/libgraal/LibGraal.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/jdk.internal.vm.compiler.libgraal/src/jdk/internal/vm/compiler/libgraal/LibGraal.java	Tue Sep 24 15:19:35 2019 -0400
@@ -25,6 +25,7 @@
 package jdk.internal.vm.compiler.libgraal;
 
 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
+import jdk.vm.ci.hotspot.HotSpotSpeculationLog;
 import jdk.vm.ci.services.Services;
 
 /**
@@ -36,6 +37,10 @@
         return inLibGraal() || isolate != 0L;
     }
 
+    public static boolean isSupported() {
+        return true;
+    }
+
     public static boolean inLibGraal() {
         return Services.IS_IN_NATIVE_IMAGE;
     }
@@ -91,13 +96,17 @@
         return runtime.isCurrentThreadAttached();
     }
 
-    static boolean attachCurrentThread(HotSpotJVMCIRuntime runtime) {
-        return runtime.attachCurrentThread(false);
+    public static boolean attachCurrentThread(HotSpotJVMCIRuntime runtime, boolean isDaemon) {
+        return runtime.attachCurrentThread(isDaemon);
     }
 
-    static void detachCurrentThread(HotSpotJVMCIRuntime runtime) {
+    public static void detachCurrentThread(HotSpotJVMCIRuntime runtime) {
         runtime.detachCurrentThread();
     }
 
     static native long getCurrentIsolateThread(long iso);
+
+    public static long getFailedSpeculationsAddress(HotSpotSpeculationLog log) {
+        return log.getFailedSpeculationsAddress();
+    }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/jdk.internal.vm.compiler.libgraal/src/jdk/internal/vm/compiler/libgraal/LibGraalScope.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/jdk.internal.vm.compiler.libgraal/src/jdk/internal/vm/compiler/libgraal/LibGraalScope.java	Tue Sep 24 15:19:35 2019 -0400
@@ -77,7 +77,7 @@
         parent = currentScope.get();
         boolean top = false;
         if (parent == null) {
-            top = LibGraal.attachCurrentThread(runtime);
+            top = LibGraal.attachCurrentThread(runtime, false);
             isolateThread = LibGraal.getCurrentIsolateThread(LibGraal.isolate);
         } else {
             isolateThread = parent.isolateThread;
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.api.directives.test/src/org/graalvm/compiler/api/directives/test/BlackholeDirectiveTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.api.directives.test/src/org/graalvm/compiler/api/directives/test/BlackholeDirectiveTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.api.directives.test/src/org/graalvm/compiler/api/directives/test/ControlFlowAnchorDirectiveTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.api.directives.test/src/org/graalvm/compiler/api/directives/test/ControlFlowAnchorDirectiveTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.api.directives.test/src/org/graalvm/compiler/api/directives/test/IterationDirectiveTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.api.directives.test/src/org/graalvm/compiler/api/directives/test/IterationDirectiveTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.api.directives.test/src/org/graalvm/compiler/api/directives/test/OpaqueDirectiveTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.api.directives.test/src/org/graalvm/compiler/api/directives/test/OpaqueDirectiveTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.aarch64/src/org/graalvm/compiler/asm/aarch64/AArch64Assembler.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.aarch64/src/org/graalvm/compiler/asm/aarch64/AArch64Assembler.java	Tue Sep 24 15:19:35 2019 -0400
@@ -54,6 +54,7 @@
 import static org.graalvm.compiler.asm.aarch64.AArch64Assembler.Instruction.CSEL;
 import static org.graalvm.compiler.asm.aarch64.AArch64Assembler.Instruction.CSINC;
 import static org.graalvm.compiler.asm.aarch64.AArch64Assembler.Instruction.CSNEG;
+import static org.graalvm.compiler.asm.aarch64.AArch64Assembler.Instruction.DC;
 import static org.graalvm.compiler.asm.aarch64.AArch64Assembler.Instruction.DMB;
 import static org.graalvm.compiler.asm.aarch64.AArch64Assembler.Instruction.EON;
 import static org.graalvm.compiler.asm.aarch64.AArch64Assembler.Instruction.EOR;
@@ -673,6 +674,7 @@
 
         MRS(0xD5300000),
         MSR(0xD5100000),
+        DC(0xD5087000),
 
         BLR_NATIVE(0xc0000000),
 
@@ -709,6 +711,24 @@
         private final int op2;
     }
 
+    public enum DataCacheOperationType {
+        ZVA(0b011, 0b0100, 0b001);
+
+        DataCacheOperationType(int op1, int crm, int op2) {
+            this.op1 = op1;
+            this.crm = crm;
+            this.op2 = op2;
+        }
+
+        public int encoding() {
+            return op1 << 16 | crm << 8 | op2 << 5;
+        }
+
+        private final int op1;
+        private final int crm;
+        private final int op2;
+    }
+
     public enum ShiftType {
         LSL(0),
         LSR(1),
@@ -1015,7 +1035,7 @@
     }
 
     private static int getConditionalBranchImm(int imm21) {
-        assert NumUtil.isSignedNbit(21, imm21) && (imm21 & 0x3) == 0 : "Immediate has to be 21bit signed number and word aligned";
+        assert NumUtil.isSignedNbit(21, imm21) && (imm21 & 0x3) == 0 : String.format("Immediate has to be 21bit signed number and word aligned got value 0x%x", imm21);
         int imm = (imm21 & NumUtil.getNbitNumberInt(21)) >> 2;
         return imm << ConditionalBranchImmOffset;
     }
@@ -1231,7 +1251,7 @@
      * @param address all addressing modes allowed. May not be null.
      */
     public void str(int destSize, Register rt, AArch64Address address) {
-        assert rt.getRegisterCategory().equals(CPU);
+        assert rt.getRegisterCategory().equals(CPU) : rt;
         assert destSize == 8 || destSize == 16 || destSize == 32 || destSize == 64;
         int transferSize = NumUtil.log2Ceil(destSize / 8);
         loadStoreInstruction(STR, rt, address, General64, transferSize);
@@ -2961,6 +2981,10 @@
         emitInt(MRS.encoding | systemRegister.encoding() | rt(src));
     }
 
+    public void dc(DataCacheOperationType type, Register src) {
+        emitInt(DC.encoding | type.encoding() | rt(src));
+    }
+
     public void annotatePatchingImmediate(int pos, Instruction instruction, int operandSizeBits, int offsetBits, int shift) {
         if (codePatchingAnnotationConsumer != null) {
             codePatchingAnnotationConsumer.accept(new SingleInstructionAnnotation(pos, instruction, operandSizeBits, offsetBits, shift));
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.aarch64/src/org/graalvm/compiler/asm/aarch64/AArch64MacroAssembler.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.aarch64/src/org/graalvm/compiler/asm/aarch64/AArch64MacroAssembler.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1706,6 +1706,9 @@
                 Register reg = AArch64.cpuRegisters.get(regEncoding);
                 // 1 => 64; 0 => 32
                 int size = sizeEncoding * 32 + 32;
+                if (!NumUtil.isSignedNbit(21, branchOffset)) {
+                    throw new BranchTargetOutOfBoundsException(true, "Branch target %d out of bounds", branchOffset);
+                }
                 switch (type) {
                     case BRANCH_NONZERO:
                         super.cbnz(size, reg, branchOffset, branch);
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.amd64/src/org/graalvm/compiler/asm/amd64/AMD64AsmOptions.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.amd64/src/org/graalvm/compiler/asm/amd64/AMD64AsmOptions.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.amd64/src/org/graalvm/compiler/asm/amd64/AMD64Assembler.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.amd64/src/org/graalvm/compiler/asm/amd64/AMD64Assembler.java	Tue Sep 24 15:19:35 2019 -0400
@@ -27,6 +27,11 @@
 import static jdk.vm.ci.amd64.AMD64.CPU;
 import static jdk.vm.ci.amd64.AMD64.MASK;
 import static jdk.vm.ci.amd64.AMD64.XMM;
+import static jdk.vm.ci.amd64.AMD64.CPUFeature.AVX512BW;
+import static jdk.vm.ci.amd64.AMD64.CPUFeature.AVX512CD;
+import static jdk.vm.ci.amd64.AMD64.CPUFeature.AVX512DQ;
+import static jdk.vm.ci.amd64.AMD64.CPUFeature.AVX512F;
+import static jdk.vm.ci.amd64.AMD64.CPUFeature.AVX512VL;
 import static jdk.vm.ci.code.MemoryBarriers.STORE_LOAD;
 import static org.graalvm.compiler.asm.amd64.AMD64AsmOptions.UseAddressNop;
 import static org.graalvm.compiler.asm.amd64.AMD64AsmOptions.UseIntelNops;
@@ -55,6 +60,7 @@
 import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.OperandSize.WORD;
 import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.L128;
 import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.L256;
+import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.L512;
 import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.LZ;
 import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.M_0F;
 import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.M_0F38;
@@ -895,36 +901,90 @@
         }
     }
 
+    private enum EVEXFeatureAssertion {
+        AVX512F_ALL(EnumSet.of(AVX512F), EnumSet.of(AVX512F), EnumSet.of(AVX512F)),
+        AVX512F_128ONLY(EnumSet.of(AVX512F), null, null),
+        AVX512F_VL(EnumSet.of(AVX512F, AVX512VL), EnumSet.of(AVX512F, AVX512VL), EnumSet.of(AVX512F)),
+        AVX512CD_VL(EnumSet.of(AVX512F, AVX512CD, AVX512VL), EnumSet.of(AVX512F, AVX512CD, AVX512VL), EnumSet.of(AVX512F, AVX512CD)),
+        AVX512DQ_VL(EnumSet.of(AVX512F, AVX512DQ, AVX512VL), EnumSet.of(AVX512F, AVX512DQ, AVX512VL), EnumSet.of(AVX512F, AVX512DQ)),
+        AVX512BW_VL(EnumSet.of(AVX512F, AVX512BW, AVX512VL), EnumSet.of(AVX512F, AVX512BW, AVX512VL), EnumSet.of(AVX512F, AVX512BW));
+
+        private final EnumSet<CPUFeature> l128features;
+        private final EnumSet<CPUFeature> l256features;
+        private final EnumSet<CPUFeature> l512features;
+
+        EVEXFeatureAssertion(EnumSet<CPUFeature> l128features, EnumSet<CPUFeature> l256features, EnumSet<CPUFeature> l512features) {
+            this.l128features = l128features;
+            this.l256features = l256features;
+            this.l512features = l512features;
+        }
+
+        public boolean check(AMD64 arch, int l) {
+            switch (l) {
+                case L128:
+                    assert l128features != null && arch.getFeatures().containsAll(l128features) : "emitting illegal 128 bit instruction";
+                    break;
+                case L256:
+                    assert l256features != null && arch.getFeatures().containsAll(l256features) : "emitting illegal 256 bit instruction";
+                    break;
+                case L512:
+                    assert l512features != null && arch.getFeatures().containsAll(l512features) : "emitting illegal 512 bit instruction";
+                    break;
+            }
+            return true;
+        }
+
+        public boolean supports(EnumSet<CPUFeature> features, AVXSize avxSize) {
+            switch (avxSize) {
+                case XMM:
+                    return l128features != null && features.containsAll(l128features);
+                case YMM:
+                    return l256features != null && features.containsAll(l256features);
+                case ZMM:
+                    return l512features != null && features.containsAll(l512features);
+                default:
+                    throw GraalError.shouldNotReachHere();
+            }
+        }
+    }
+
     private enum VEXOpAssertion {
-        AVX1(CPUFeature.AVX, CPUFeature.AVX),
-        AVX1_2(CPUFeature.AVX, CPUFeature.AVX2),
-        AVX2(CPUFeature.AVX2, CPUFeature.AVX2),
-        AVX1_128ONLY(CPUFeature.AVX, null),
-        AVX1_256ONLY(null, CPUFeature.AVX),
-        AVX2_256ONLY(null, CPUFeature.AVX2),
-        XMM_CPU(CPUFeature.AVX, null, XMM, null, CPU, null),
-        XMM_XMM_CPU(CPUFeature.AVX, null, XMM, XMM, CPU, null),
-        CPU_XMM(CPUFeature.AVX, null, CPU, null, XMM, null),
-        AVX1_2_CPU_XMM(CPUFeature.AVX, CPUFeature.AVX2, CPU, null, XMM, null),
-        BMI1(CPUFeature.BMI1, null, CPU, CPU, CPU, null),
-        BMI2(CPUFeature.BMI2, null, CPU, CPU, CPU, null),
-        FMA(CPUFeature.FMA, null, XMM, XMM, XMM, null);
+        AVX1(CPUFeature.AVX, CPUFeature.AVX, null),
+        AVX1_2(CPUFeature.AVX, CPUFeature.AVX2, null),
+        AVX2(CPUFeature.AVX2, CPUFeature.AVX2, null),
+        AVX1_128ONLY(CPUFeature.AVX, null, null),
+        AVX1_256ONLY(null, CPUFeature.AVX, null),
+        AVX2_256ONLY(null, CPUFeature.AVX2, null),
+        XMM_CPU(CPUFeature.AVX, null, null, XMM, null, CPU, null),
+        XMM_XMM_CPU(CPUFeature.AVX, null, null, XMM, XMM, CPU, null),
+        CPU_XMM(CPUFeature.AVX, null, null, CPU, null, XMM, null),
+        AVX1_2_CPU_XMM(CPUFeature.AVX, CPUFeature.AVX2, null, CPU, null, XMM, null),
+        BMI1(CPUFeature.BMI1, null, null, CPU, CPU, CPU, null),
+        BMI2(CPUFeature.BMI2, null, null, CPU, CPU, CPU, null),
+        FMA(CPUFeature.FMA, null, null, XMM, XMM, XMM, null),
+
+        XMM_CPU_AVX512F_128ONLY(CPUFeature.AVX, null, EVEXFeatureAssertion.AVX512F_128ONLY, XMM, null, CPU, null),
+        AVX1_AVX512F_ALL(CPUFeature.AVX, CPUFeature.AVX, EVEXFeatureAssertion.AVX512F_ALL),
+        AVX1_AVX512F_VL(CPUFeature.AVX, CPUFeature.AVX, EVEXFeatureAssertion.AVX512F_VL);
 
         private final CPUFeature l128feature;
         private final CPUFeature l256feature;
+        private final EVEXFeatureAssertion l512features;
 
         private final RegisterCategory rCategory;
         private final RegisterCategory vCategory;
         private final RegisterCategory mCategory;
         private final RegisterCategory imm8Category;
 
-        VEXOpAssertion(CPUFeature l128feature, CPUFeature l256feature) {
-            this(l128feature, l256feature, XMM, XMM, XMM, XMM);
+        VEXOpAssertion(CPUFeature l128feature, CPUFeature l256feature, EVEXFeatureAssertion l512features) {
+            this(l128feature, l256feature, l512features, XMM, XMM, XMM, XMM);
         }
 
-        VEXOpAssertion(CPUFeature l128feature, CPUFeature l256feature, RegisterCategory rCategory, RegisterCategory vCategory, RegisterCategory mCategory, RegisterCategory imm8Category) {
+        VEXOpAssertion(CPUFeature l128feature, CPUFeature l256feature, EVEXFeatureAssertion l512features, RegisterCategory rCategory, RegisterCategory vCategory, RegisterCategory mCategory,
+                        RegisterCategory imm8Category) {
             this.l128feature = l128feature;
             this.l256feature = l256feature;
+            this.l512features = l512features;
             this.rCategory = rCategory;
             this.vCategory = vCategory;
             this.mCategory = mCategory;
@@ -940,13 +1000,12 @@
         }
 
         public boolean check(AMD64 arch, int l, Register r, Register v, Register m, Register imm8) {
-            switch (l) {
-                case L128:
-                    assert l128feature != null && arch.getFeatures().contains(l128feature) : "emitting illegal 128 bit instruction";
-                    break;
-                case L256:
-                    assert l256feature != null && arch.getFeatures().contains(l256feature) : "emitting illegal 256 bit instruction";
-                    break;
+            if (isAVX512Register(r) || isAVX512Register(v) || isAVX512Register(m) || l == L512) {
+                assert l512features != null && l512features.check(arch, l);
+            } else if (l == L128) {
+                assert l128feature != null && arch.getFeatures().contains(l128feature) : "emitting illegal 128 bit instruction";
+            } else if (l == L256) {
+                assert l256feature != null && arch.getFeatures().contains(l256feature) : "emitting illegal 256 bit instruction";
             }
             if (r != null) {
                 assert r.getRegisterCategory().equals(rCategory);
@@ -963,15 +1022,15 @@
             return true;
         }
 
-        public boolean supports(EnumSet<CPUFeature> features, AVXSize avxSize) {
-            switch (avxSize) {
-                case XMM:
-                    return l128feature != null && features.contains(l128feature);
-                case YMM:
-                    return l256feature != null && features.contains(l256feature);
-                default:
-                    throw GraalError.shouldNotReachHere();
+        public boolean supports(EnumSet<CPUFeature> features, AVXSize avxSize, boolean useZMMRegisters) {
+            if (useZMMRegisters || avxSize == AVXSize.ZMM) {
+                return l512features != null && l512features.supports(features, avxSize);
+            } else if (avxSize == AVXSize.XMM) {
+                return l128feature != null && features.contains(l128feature);
+            } else if (avxSize == AVXSize.YMM) {
+                return l256feature != null && features.contains(l256feature);
             }
+            throw GraalError.shouldNotReachHere();
         }
     }
 
@@ -987,23 +1046,41 @@
         private final String opcode;
         protected final VEXOpAssertion assertion;
 
-        protected VexOp(String opcode, int pp, int mmmmm, int w, int op, VEXOpAssertion assertion) {
+        protected final EVEXTuple evexTuple;
+        protected final int wEvex;
+
+        protected VexOp(String opcode, int pp, int mmmmm, int w, int op, VEXOpAssertion assertion, EVEXTuple evexTuple, int wEvex) {
             this.pp = pp;
             this.mmmmm = mmmmm;
             this.w = w;
             this.op = op;
             this.opcode = opcode;
             this.assertion = assertion;
+            this.evexTuple = evexTuple;
+            this.wEvex = wEvex;
+        }
+
+        protected VexOp(String opcode, int pp, int mmmmm, int w, int op, VEXOpAssertion assertion) {
+            this(opcode, pp, mmmmm, w, op, assertion, EVEXTuple.INVALID, WIG);
         }
 
         public final boolean isSupported(AMD64Assembler vasm, AVXSize size) {
-            return assertion.supports(((AMD64) vasm.target.arch).getFeatures(), size);
+            return isSupported(vasm, size, false);
+        }
+
+        public final boolean isSupported(AMD64Assembler vasm, AVXSize size, boolean useZMMRegisters) {
+            return assertion.supports(((AMD64) vasm.target.arch).getFeatures(), size, useZMMRegisters);
         }
 
         @Override
         public String toString() {
             return opcode;
         }
+
+        protected final int getDisp8Scale(boolean useEvex, AVXSize size) {
+            return useEvex ? evexTuple.getDisp8ScalingFactor(size) : DEFAULT_DISP8_SCALE;
+        }
+
     }
 
     /**
@@ -1011,21 +1088,17 @@
      */
     public static class VexRROp extends VexOp {
         // @formatter:off
-        public static final VexRROp VMASKMOVDQU = new VexRROp("VMASKMOVDQU", P_66, M_0F, WIG, 0xF7, VEXOpAssertion.AVX1_128ONLY);
+        public static final VexRROp VMASKMOVDQU = new VexRROp("VMASKMOVDQU", P_66, M_0F, WIG, 0xF7, VEXOpAssertion.AVX1_128ONLY, EVEXTuple.INVALID, WIG);
         // @formatter:on
 
-        protected VexRROp(String opcode, int pp, int mmmmm, int w, int op) {
-            this(opcode, pp, mmmmm, w, op, VEXOpAssertion.AVX1);
-        }
-
-        protected VexRROp(String opcode, int pp, int mmmmm, int w, int op, VEXOpAssertion assertion) {
-            super(opcode, pp, mmmmm, w, op, assertion);
+        protected VexRROp(String opcode, int pp, int mmmmm, int w, int op, VEXOpAssertion assertion, EVEXTuple evexTuple, int wEvex) {
+            super(opcode, pp, mmmmm, w, op, assertion, evexTuple, wEvex);
         }
 
         public void emit(AMD64Assembler asm, AVXSize size, Register dst, Register src) {
             assert assertion.check((AMD64) asm.target.arch, size, dst, null, src);
             assert op != 0x1A || op != 0x5A;
-            asm.vexPrefix(dst, Register.None, src, size, pp, mmmmm, w, false);
+            asm.vexPrefix(dst, Register.None, src, size, pp, mmmmm, w, wEvex, false);
             asm.emitByte(op);
             asm.emitModRM(dst, src);
         }
@@ -1077,18 +1150,22 @@
         // @formatter:on
 
         protected VexRMOp(String opcode, int pp, int mmmmm, int w, int op) {
-            this(opcode, pp, mmmmm, w, op, VEXOpAssertion.AVX1);
+            this(opcode, pp, mmmmm, w, op, VEXOpAssertion.AVX1, EVEXTuple.INVALID, WIG);
         }
 
         protected VexRMOp(String opcode, int pp, int mmmmm, int w, int op, VEXOpAssertion assertion) {
-            super(opcode, pp, mmmmm, w, op, assertion);
+            this(opcode, pp, mmmmm, w, op, assertion, EVEXTuple.INVALID, WIG);
+        }
+
+        protected VexRMOp(String opcode, int pp, int mmmmm, int w, int op, VEXOpAssertion assertion, EVEXTuple evexTuple, int wEvex) {
+            super(opcode, pp, mmmmm, w, op, assertion, evexTuple, wEvex);
         }
 
         public void emit(AMD64Assembler asm, AVXSize size, Register dst, AMD64Address src) {
             assert assertion.check((AMD64) asm.target.arch, size, dst, null, null);
-            asm.vexPrefix(dst, Register.None, src, size, pp, mmmmm, w, false);
+            boolean useEvex = asm.vexPrefix(dst, Register.None, src, size, pp, mmmmm, w, wEvex, false);
             asm.emitByte(op);
-            asm.emitOperandHelper(dst, src, 0);
+            asm.emitOperandHelper(dst, src, 0, getDisp8Scale(useEvex, size));
         }
     }
 
@@ -1100,39 +1177,45 @@
      */
     public static final class VexMoveOp extends VexRMOp {
         // @formatter:off
-        public static final VexMoveOp VMOVDQA = new VexMoveOp("VMOVDQA", P_66, M_0F, WIG, 0x6F, 0x7F);
-        public static final VexMoveOp VMOVDQU = new VexMoveOp("VMOVDQU", P_F3, M_0F, WIG, 0x6F, 0x7F);
-        public static final VexMoveOp VMOVAPS = new VexMoveOp("VMOVAPS", P_,   M_0F, WIG, 0x28, 0x29);
-        public static final VexMoveOp VMOVAPD = new VexMoveOp("VMOVAPD", P_66, M_0F, WIG, 0x28, 0x29);
-        public static final VexMoveOp VMOVUPS = new VexMoveOp("VMOVUPS", P_,   M_0F, WIG, 0x10, 0x11);
-        public static final VexMoveOp VMOVUPD = new VexMoveOp("VMOVUPD", P_66, M_0F, WIG, 0x10, 0x11);
-        public static final VexMoveOp VMOVSS  = new VexMoveOp("VMOVSS",  P_F3, M_0F, WIG, 0x10, 0x11);
-        public static final VexMoveOp VMOVSD  = new VexMoveOp("VMOVSD",  P_F2, M_0F, WIG, 0x10, 0x11);
-        public static final VexMoveOp VMOVD   = new VexMoveOp("VMOVD",   P_66, M_0F, W0,  0x6E, 0x7E, VEXOpAssertion.XMM_CPU);
-        public static final VexMoveOp VMOVQ   = new VexMoveOp("VMOVQ",   P_66, M_0F, W1,  0x6E, 0x7E, VEXOpAssertion.XMM_CPU);
+        public static final VexMoveOp VMOVDQA32 = new VexMoveOp("VMOVDQA32", P_66, M_0F, WIG, 0x6F, 0x7F, VEXOpAssertion.AVX1_AVX512F_VL,         EVEXTuple.FVM,       W0);
+        public static final VexMoveOp VMOVDQA64 = new VexMoveOp("VMOVDQA64", P_66, M_0F, WIG, 0x6F, 0x7F, VEXOpAssertion.AVX1_AVX512F_VL,         EVEXTuple.FVM,       W1);
+        public static final VexMoveOp VMOVDQU32 = new VexMoveOp("VMOVDQU32", P_F3, M_0F, WIG, 0x6F, 0x7F, VEXOpAssertion.AVX1_AVX512F_VL,         EVEXTuple.FVM,       W0);
+        public static final VexMoveOp VMOVDQU64 = new VexMoveOp("VMOVDQU64", P_F3, M_0F, WIG, 0x6F, 0x7F, VEXOpAssertion.AVX1_AVX512F_VL,         EVEXTuple.FVM,       W1);
+        public static final VexMoveOp VMOVAPS   = new VexMoveOp("VMOVAPS",   P_,   M_0F, WIG, 0x28, 0x29, VEXOpAssertion.AVX1_AVX512F_VL,         EVEXTuple.FVM,       W0);
+        public static final VexMoveOp VMOVAPD   = new VexMoveOp("VMOVAPD",   P_66, M_0F, WIG, 0x28, 0x29, VEXOpAssertion.AVX1_AVX512F_VL,         EVEXTuple.FVM,       W1);
+        public static final VexMoveOp VMOVUPS   = new VexMoveOp("VMOVUPS",   P_,   M_0F, WIG, 0x10, 0x11, VEXOpAssertion.AVX1_AVX512F_VL,         EVEXTuple.FVM,       W0);
+        public static final VexMoveOp VMOVUPD   = new VexMoveOp("VMOVUPD",   P_66, M_0F, WIG, 0x10, 0x11, VEXOpAssertion.AVX1_AVX512F_VL,         EVEXTuple.FVM,       W1);
+        public static final VexMoveOp VMOVSS    = new VexMoveOp("VMOVSS",    P_F3, M_0F, WIG, 0x10, 0x11, VEXOpAssertion.AVX1_AVX512F_ALL,        EVEXTuple.T1S_32BIT, W0);
+        public static final VexMoveOp VMOVSD    = new VexMoveOp("VMOVSD",    P_F2, M_0F, WIG, 0x10, 0x11, VEXOpAssertion.AVX1_AVX512F_ALL,        EVEXTuple.T1S_64BIT, W1);
+        public static final VexMoveOp VMOVD     = new VexMoveOp("VMOVD",     P_66, M_0F, W0,  0x6E, 0x7E, VEXOpAssertion.XMM_CPU_AVX512F_128ONLY, EVEXTuple.T1F_32BIT, W0);
+        public static final VexMoveOp VMOVQ     = new VexMoveOp("VMOVQ",     P_66, M_0F, W1,  0x6E, 0x7E, VEXOpAssertion.XMM_CPU_AVX512F_128ONLY, EVEXTuple.T1S_64BIT, W1);
         // @formatter:on
 
         private final int opReverse;
 
         private VexMoveOp(String opcode, int pp, int mmmmm, int w, int op, int opReverse) {
-            this(opcode, pp, mmmmm, w, op, opReverse, VEXOpAssertion.AVX1);
+            this(opcode, pp, mmmmm, w, op, opReverse, VEXOpAssertion.AVX1, EVEXTuple.INVALID, WIG);
         }
 
         private VexMoveOp(String opcode, int pp, int mmmmm, int w, int op, int opReverse, VEXOpAssertion assertion) {
-            super(opcode, pp, mmmmm, w, op, assertion);
+            this(opcode, pp, mmmmm, w, op, opReverse, assertion, EVEXTuple.INVALID, WIG);
+        }
+
+        private VexMoveOp(String opcode, int pp, int mmmmm, int w, int op, int opReverse, VEXOpAssertion assertion, EVEXTuple evexTuple, int wEvex) {
+            super(opcode, pp, mmmmm, w, op, assertion, evexTuple, wEvex);
             this.opReverse = opReverse;
         }
 
         public void emit(AMD64Assembler asm, AVXSize size, AMD64Address dst, Register src) {
             assert assertion.check((AMD64) asm.target.arch, size, src, null, null);
-            asm.vexPrefix(src, Register.None, dst, size, pp, mmmmm, w, false);
+            boolean useEvex = asm.vexPrefix(src, Register.None, dst, size, pp, mmmmm, w, wEvex, false);
             asm.emitByte(opReverse);
-            asm.emitOperandHelper(src, dst, 0);
+            asm.emitOperandHelper(src, dst, 0, getDisp8Scale(useEvex, size));
         }
 
         public void emitReverse(AMD64Assembler asm, AVXSize size, Register dst, Register src) {
             assert assertion.check((AMD64) asm.target.arch, size, src, null, dst);
-            asm.vexPrefix(src, Register.None, dst, size, pp, mmmmm, w, false);
+            asm.vexPrefix(src, Register.None, dst, size, pp, mmmmm, w, wEvex, false);
             asm.emitByte(opReverse);
             asm.emitModRM(src, dst);
         }
@@ -1160,7 +1243,7 @@
         @Override
         public void emit(AMD64Assembler asm, AVXSize size, Register dst, Register src, int imm8) {
             assert assertion.check((AMD64) asm.target.arch, size, dst, null, src);
-            asm.vexPrefix(dst, Register.None, src, size, pp, mmmmm, w, false);
+            asm.vexPrefix(dst, Register.None, src, size, pp, mmmmm, w, wEvex, false);
             asm.emitByte(op);
             asm.emitModRM(dst, src);
             asm.emitByte(imm8);
@@ -1168,9 +1251,9 @@
 
         public void emit(AMD64Assembler asm, AVXSize size, Register dst, AMD64Address src, int imm8) {
             assert assertion.check((AMD64) asm.target.arch, size, dst, null, null);
-            asm.vexPrefix(dst, Register.None, src, size, pp, mmmmm, w, false);
+            boolean useEvex = asm.vexPrefix(dst, Register.None, src, size, pp, mmmmm, w, wEvex, false);
             asm.emitByte(op);
-            asm.emitOperandHelper(dst, src, 1);
+            asm.emitOperandHelper(dst, src, 1, getDisp8Scale(useEvex, size));
             asm.emitByte(imm8);
         }
     }
@@ -1195,7 +1278,7 @@
         @Override
         public void emit(AMD64Assembler asm, AVXSize size, Register dst, Register src, int imm8) {
             assert assertion.check((AMD64) asm.target.arch, size, src, null, dst);
-            asm.vexPrefix(src, Register.None, dst, size, pp, mmmmm, w, false);
+            asm.vexPrefix(src, Register.None, dst, size, pp, mmmmm, w, wEvex, false);
             asm.emitByte(op);
             asm.emitModRM(src, dst);
             asm.emitByte(imm8);
@@ -1203,9 +1286,9 @@
 
         public void emit(AMD64Assembler asm, AVXSize size, AMD64Address dst, Register src, int imm8) {
             assert assertion.check((AMD64) asm.target.arch, size, src, null, null);
-            asm.vexPrefix(src, Register.None, dst, size, pp, mmmmm, w, false);
+            boolean useEvex = asm.vexPrefix(src, Register.None, dst, size, pp, mmmmm, w, wEvex, false);
             asm.emitByte(op);
-            asm.emitOperandHelper(src, dst, 1);
+            asm.emitOperandHelper(src, dst, 1, getDisp8Scale(useEvex, size));
             asm.emitByte(imm8);
         }
     }
@@ -1226,7 +1309,7 @@
 
         public void emit(AMD64Assembler asm, AVXSize size, Register dst, Register mask, Register src1, Register src2) {
             assert assertion.check((AMD64) asm.target.arch, size, dst, mask, src1, src2);
-            asm.vexPrefix(dst, src1, src2, size, pp, mmmmm, w, false);
+            asm.vexPrefix(dst, src1, src2, size, pp, mmmmm, w, wEvex, false);
             asm.emitByte(op);
             asm.emitModRM(dst, src2);
             asm.emitByte(mask.encoding() << 4);
@@ -1234,9 +1317,9 @@
 
         public void emit(AMD64Assembler asm, AVXSize size, Register dst, Register mask, Register src1, AMD64Address src2) {
             assert assertion.check((AMD64) asm.target.arch, size, dst, mask, src1, null);
-            asm.vexPrefix(dst, src1, src2, size, pp, mmmmm, w, false);
+            boolean useEvex = asm.vexPrefix(dst, src1, src2, size, pp, mmmmm, w, wEvex, false);
             asm.emitByte(op);
-            asm.emitOperandHelper(dst, src2, 0);
+            asm.emitOperandHelper(dst, src2, 0, getDisp8Scale(useEvex, size));
             asm.emitByte(mask.encoding() << 4);
         }
     }
@@ -1324,16 +1407,16 @@
 
         public void emit(AMD64Assembler asm, AVXSize size, Register dst, Register src1, Register src2) {
             assert assertion.check((AMD64) asm.target.arch, size, dst, src1, src2);
-            asm.vexPrefix(dst, src1, src2, size, pp, mmmmm, w, false);
+            asm.vexPrefix(dst, src1, src2, size, pp, mmmmm, w, wEvex, false);
             asm.emitByte(op);
             asm.emitModRM(dst, src2);
         }
 
         public void emit(AMD64Assembler asm, AVXSize size, Register dst, Register src1, AMD64Address src2) {
             assert assertion.check((AMD64) asm.target.arch, size, dst, src1, null);
-            asm.vexPrefix(dst, src1, src2, size, pp, mmmmm, w, false);
+            boolean useEvex = asm.vexPrefix(dst, src1, src2, size, pp, mmmmm, w, wEvex, false);
             asm.emitByte(op);
-            asm.emitOperandHelper(dst, src2, 0);
+            asm.emitOperandHelper(dst, src2, 0, getDisp8Scale(useEvex, size));
         }
     }
 
@@ -1353,7 +1436,7 @@
         public void emit(AMD64Assembler asm, AVXSize size, Register dst, Register src1, Register src2) {
             assert assertion.check((AMD64) asm.target.arch, LZ, dst, src1, src2, null);
             assert size == AVXSize.DWORD || size == AVXSize.QWORD;
-            asm.vexPrefix(dst, src1, src2, size, pp, mmmmm, size == AVXSize.DWORD ? W0 : W1, false);
+            asm.vexPrefix(dst, src1, src2, size, pp, mmmmm, size == AVXSize.DWORD ? W0 : W1, wEvex, false);
             asm.emitByte(op);
             asm.emitModRM(dst, src2);
         }
@@ -1362,7 +1445,7 @@
         public void emit(AMD64Assembler asm, AVXSize size, Register dst, Register src1, AMD64Address src2) {
             assert assertion.check((AMD64) asm.target.arch, LZ, dst, src1, null, null);
             assert size == AVXSize.DWORD || size == AVXSize.QWORD;
-            asm.vexPrefix(dst, src1, src2, size, pp, mmmmm, size == AVXSize.DWORD ? W0 : W1, false);
+            asm.vexPrefix(dst, src1, src2, size, pp, mmmmm, size == AVXSize.DWORD ? W0 : W1, wEvex, false);
             asm.emitByte(op);
             asm.emitOperandHelper(dst, src2, 0);
         }
@@ -1384,7 +1467,7 @@
         public void emit(AMD64Assembler asm, AVXSize size, Register dst, Register src1, Register src2) {
             assert assertion.check((AMD64) asm.target.arch, LZ, dst, src2, src1, null);
             assert size == AVXSize.DWORD || size == AVXSize.QWORD;
-            asm.vexPrefix(dst, src2, src1, size, pp, mmmmm, size == AVXSize.DWORD ? W0 : W1, false);
+            asm.vexPrefix(dst, src2, src1, size, pp, mmmmm, size == AVXSize.DWORD ? W0 : W1, wEvex, false);
             asm.emitByte(op);
             asm.emitModRM(dst, src1);
         }
@@ -1392,7 +1475,7 @@
         public void emit(AMD64Assembler asm, AVXSize size, Register dst, AMD64Address src1, Register src2) {
             assert assertion.check((AMD64) asm.target.arch, LZ, dst, src2, null, null);
             assert size == AVXSize.DWORD || size == AVXSize.QWORD;
-            asm.vexPrefix(dst, src2, src1, size, pp, mmmmm, size == AVXSize.DWORD ? W0 : W1, false);
+            asm.vexPrefix(dst, src2, src1, size, pp, mmmmm, size == AVXSize.DWORD ? W0 : W1, wEvex, false);
             asm.emitByte(op);
             asm.emitOperandHelper(dst, src1, 0);
         }
@@ -1414,7 +1497,7 @@
         @Override
         public void emit(AMD64Assembler asm, AVXSize size, Register dst, Register src) {
             assert assertion.check((AMD64) asm.target.arch, size, dst, null, null);
-            asm.vexPrefix(AMD64.cpuRegisters[ext], dst, src, size, pp, mmmmm, size == AVXSize.DWORD ? W0 : W1, false);
+            asm.vexPrefix(AMD64.cpuRegisters[ext], dst, src, size, pp, mmmmm, size == AVXSize.DWORD ? W0 : W1, wEvex, false);
             asm.emitByte(op);
             asm.emitModRM(ext, src);
         }
@@ -1422,7 +1505,7 @@
         @Override
         public void emit(AMD64Assembler asm, AVXSize size, Register dst, AMD64Address src) {
             assert assertion.check((AMD64) asm.target.arch, size, dst, null, null);
-            asm.vexPrefix(AMD64.cpuRegisters[ext], dst, src, size, pp, mmmmm, size == AVXSize.DWORD ? W0 : W1, false);
+            asm.vexPrefix(AMD64.cpuRegisters[ext], dst, src, size, pp, mmmmm, size == AVXSize.DWORD ? W0 : W1, wEvex, false);
             asm.emitByte(op);
             asm.emitOperandHelper(ext, src, 0);
         }
@@ -1455,7 +1538,7 @@
         @Override
         public void emit(AMD64Assembler asm, AVXSize size, Register dst, Register src, int imm8) {
             assert assertion.check((AMD64) asm.target.arch, size, null, dst, src);
-            asm.vexPrefix(null, dst, src, size, pp, mmmmm, w, false);
+            asm.vexPrefix(null, dst, src, size, pp, mmmmm, w, wEvex, false);
             asm.emitByte(immOp);
             asm.emitModRM(r, src);
             asm.emitByte(imm8);
@@ -1483,16 +1566,16 @@
 
         public void emit(AMD64Assembler asm, AVXSize size, Register dst, Register mask, AMD64Address src) {
             assert assertion.check((AMD64) asm.target.arch, size, dst, mask, null);
-            asm.vexPrefix(dst, mask, src, size, pp, mmmmm, w, false);
+            asm.vexPrefix(dst, mask, src, size, pp, mmmmm, w, wEvex, false);
             asm.emitByte(op);
             asm.emitOperandHelper(dst, src, 0);
         }
 
         public void emit(AMD64Assembler asm, AVXSize size, AMD64Address dst, Register mask, Register src) {
             assert assertion.check((AMD64) asm.target.arch, size, src, mask, null);
-            asm.vexPrefix(src, mask, dst, size, pp, mmmmm, w, false);
+            boolean useEvex = asm.vexPrefix(src, mask, dst, size, pp, mmmmm, w, wEvex, false);
             asm.emitByte(opReverse);
-            asm.emitOperandHelper(src, dst, 0);
+            asm.emitOperandHelper(src, dst, 0, getDisp8Scale(useEvex, size));
         }
     }
 
@@ -1518,7 +1601,7 @@
         public void emit(AMD64Assembler asm, AVXSize size, Register dst, Register src1, Register src2, int imm8) {
             assert assertion.check((AMD64) asm.target.arch, size, dst, src1, src2);
             assert (imm8 & 0xFF) == imm8;
-            asm.vexPrefix(dst, src1, src2, size, pp, mmmmm, w, false);
+            asm.vexPrefix(dst, src1, src2, size, pp, mmmmm, w, wEvex, false);
             asm.emitByte(op);
             asm.emitModRM(dst, src2);
             asm.emitByte(imm8);
@@ -1527,9 +1610,9 @@
         public void emit(AMD64Assembler asm, AVXSize size, Register dst, Register src1, AMD64Address src2, int imm8) {
             assert assertion.check((AMD64) asm.target.arch, size, dst, src1, null);
             assert (imm8 & 0xFF) == imm8;
-            asm.vexPrefix(dst, src1, src2, size, pp, mmmmm, w, false);
+            boolean useEvex = asm.vexPrefix(dst, src1, src2, size, pp, mmmmm, w, wEvex, false);
             asm.emitByte(op);
-            asm.emitOperandHelper(dst, src2, 1);
+            asm.emitOperandHelper(dst, src2, 1, getDisp8Scale(useEvex, size));
             asm.emitByte(imm8);
         }
     }
@@ -1631,7 +1714,7 @@
 
         public void emit(AMD64Assembler asm, AVXSize size, Register dst, Register src1, Register src2, Predicate p) {
             assert assertion.check((AMD64) asm.target.arch, size, dst, src1, src2);
-            asm.vexPrefix(dst, src1, src2, size, pp, mmmmm, w, false);
+            asm.vexPrefix(dst, src1, src2, size, pp, mmmmm, w, wEvex, false);
             asm.emitByte(op);
             asm.emitModRM(dst, src2);
             asm.emitByte(p.imm8);
@@ -1639,9 +1722,9 @@
 
         public void emit(AMD64Assembler asm, AVXSize size, Register dst, Register src1, AMD64Address src2, Predicate p) {
             assert assertion.check((AMD64) asm.target.arch, size, dst, src1, null);
-            asm.vexPrefix(dst, src1, src2, size, pp, mmmmm, w, false);
+            boolean useEvex = asm.vexPrefix(dst, src1, src2, size, pp, mmmmm, w, wEvex, false);
             asm.emitByte(op);
-            asm.emitOperandHelper(dst, src2, 1);
+            asm.emitOperandHelper(dst, src2, 1, getDisp8Scale(useEvex, size));
             asm.emitByte(p.imm8);
         }
     }
@@ -3748,12 +3831,12 @@
     }
 
     public final void vmovdqu(Register dst, AMD64Address src) {
-        VexMoveOp.VMOVDQU.emit(this, AVXSize.YMM, dst, src);
+        VexMoveOp.VMOVDQU32.emit(this, AVXSize.YMM, dst, src);
     }
 
     public final void vmovdqu(AMD64Address dst, Register src) {
         assert inRC(XMM, src);
-        VexMoveOp.VMOVDQU.emit(this, AVXSize.YMM, dst, src);
+        VexMoveOp.VMOVDQU32.emit(this, AVXSize.YMM, dst, src);
     }
 
     public final void vpmovzxbw(Register dst, AMD64Address src) {
@@ -3773,7 +3856,7 @@
         assert supports(CPUFeature.AVX512BW);
         assert inRC(MASK, src1) && inRC(MASK, src2);
         // Code: VEX.L0.66.0F.W1 98 /r
-        vexPrefix(src1, Register.None, src2, AVXSize.XMM, P_66, M_0F, W1, true);
+        vexPrefix(src1, Register.None, src2, AVXSize.XMM, P_66, M_0F, W1, W1, true);
         emitByte(0x98);
         emitModRM(src1, src2);
     }
@@ -3785,7 +3868,7 @@
         assert supports(CPUFeature.AVX512BW);
         assert inRC(MASK, src1) && inRC(MASK, src2);
         // Code: VEX.L0.0F.W1 98 /r
-        vexPrefix(src1, Register.None, src2, AVXSize.XMM, P_, M_0F, W1, true);
+        vexPrefix(src1, Register.None, src2, AVXSize.XMM, P_, M_0F, W1, W1, true);
         emitByte(0x98);
         emitModRM(src1, src2);
     }
@@ -3801,14 +3884,14 @@
                 // kmovd(KRegister dst, KRegister src):
                 // Insn: KMOVD k1, k2/m32
                 // Code: VEX.L0.66.0F.W1 90 /r
-                vexPrefix(dst, Register.None, src, AVXSize.XMM, P_66, M_0F, W1, true);
+                vexPrefix(dst, Register.None, src, AVXSize.XMM, P_66, M_0F, W1, W1, true);
                 emitByte(0x90);
                 emitModRM(dst, src);
             } else {
                 // kmovd(KRegister dst, Register src)
                 // Insn: KMOVD k1, r32
                 // Code: VEX.L0.F2.0F.W0 92 /r
-                vexPrefix(dst, Register.None, src, AVXSize.XMM, P_F2, M_0F, W0, true);
+                vexPrefix(dst, Register.None, src, AVXSize.XMM, P_F2, M_0F, W0, W0, true);
                 emitByte(0x92);
                 emitModRM(dst, src);
             }
@@ -3817,7 +3900,7 @@
                 // kmovd(Register dst, KRegister src)
                 // Insn: KMOVD r32, k1
                 // Code: VEX.L0.F2.0F.W0 93 /r
-                vexPrefix(dst, Register.None, src, AVXSize.XMM, P_F2, M_0F, W0, true);
+                vexPrefix(dst, Register.None, src, AVXSize.XMM, P_F2, M_0F, W0, W0, true);
                 emitByte(0x93);
                 emitModRM(dst, src);
             } else {
@@ -3837,14 +3920,14 @@
                 // kmovq(KRegister dst, KRegister src):
                 // Insn: KMOVQ k1, k2/m64
                 // Code: VEX.L0.0F.W1 90 /r
-                vexPrefix(dst, Register.None, src, AVXSize.XMM, P_, M_0F, W1, true);
+                vexPrefix(dst, Register.None, src, AVXSize.XMM, P_, M_0F, W1, W1, true);
                 emitByte(0x90);
                 emitModRM(dst, src);
             } else {
                 // kmovq(KRegister dst, Register src)
                 // Insn: KMOVQ k1, r64
                 // Code: VEX.L0.F2.0F.W1 92 /r
-                vexPrefix(dst, Register.None, src, AVXSize.XMM, P_F2, M_0F, W1, true);
+                vexPrefix(dst, Register.None, src, AVXSize.XMM, P_F2, M_0F, W1, W1, true);
                 emitByte(0x92);
                 emitModRM(dst, src);
             }
@@ -3853,7 +3936,7 @@
                 // kmovq(Register dst, KRegister src)
                 // Insn: KMOVQ r64, k1
                 // Code: VEX.L0.F2.0F.W1 93 /r
-                vexPrefix(dst, Register.None, src, AVXSize.XMM, P_F2, M_0F, W1, true);
+                vexPrefix(dst, Register.None, src, AVXSize.XMM, P_F2, M_0F, W1, W1, true);
                 emitByte(0x93);
                 emitModRM(dst, src);
             } else {
@@ -3868,7 +3951,7 @@
         assert supports(CPUFeature.AVX512BW);
         assert inRC(MASK, src1) && inRC(MASK, src2);
         // Code: VEX.L0.66.0F.W1 99 /r
-        vexPrefix(src1, Register.None, src2, AVXSize.XMM, P_66, M_0F, W1, true);
+        vexPrefix(src1, Register.None, src2, AVXSize.XMM, P_66, M_0F, W1, W1, true);
         emitByte(0x99);
         emitModRM(src1, src2);
     }
@@ -3878,7 +3961,7 @@
         assert inRC(XMM, dst);
         evexPrefix(dst, Register.None, Register.None, src, AVXSize.ZMM, P_F3, M_0F, W1, Z0, B0);
         emitByte(0x6F);
-        emitEVEXOperandHelper(dst, src, 0, EVEXTuple.FVM.getDisp8ScalingFactor(AVXSize.ZMM));
+        emitOperandHelper(dst, src, 0, EVEXTuple.FVM.getDisp8ScalingFactor(AVXSize.ZMM));
     }
 
     // Insn: VPMOVZXBW zmm1, m256
@@ -3889,7 +3972,7 @@
         // Code: EVEX.512.66.0F38.WIG 30 /r
         evexPrefix(dst, Register.None, Register.None, src, AVXSize.ZMM, P_66, M_0F38, WIG, Z0, B0);
         emitByte(0x30);
-        emitEVEXOperandHelper(dst, src, 0, EVEXTuple.HVM.getDisp8ScalingFactor(AVXSize.ZMM));
+        emitOperandHelper(dst, src, 0, EVEXTuple.HVM.getDisp8ScalingFactor(AVXSize.ZMM));
     }
 
     public final void evpcmpeqb(Register kdst, Register nds, AMD64Address src) {
@@ -3897,7 +3980,7 @@
         assert inRC(MASK, kdst) && inRC(XMM, nds);
         evexPrefix(kdst, Register.None, nds, src, AVXSize.ZMM, P_66, M_0F, WIG, Z0, B0);
         emitByte(0x74);
-        emitEVEXOperandHelper(kdst, src, 0, EVEXTuple.FVM.getDisp8ScalingFactor(AVXSize.ZMM));
+        emitOperandHelper(kdst, src, 0, EVEXTuple.FVM.getDisp8ScalingFactor(AVXSize.ZMM));
     }
 
     // Insn: VMOVDQU16 zmm1 {k1}{z}, zmm2/m512
@@ -3910,7 +3993,7 @@
         // Code: EVEX.512.F2.0F.W1 6F /r
         evexPrefix(dst, Register.None, Register.None, src, AVXSize.ZMM, P_F2, M_0F, W1, Z0, B0);
         emitByte(0x6F);
-        emitEVEXOperandHelper(dst, src, 0, EVEXTuple.FVM.getDisp8ScalingFactor(AVXSize.ZMM));
+        emitOperandHelper(dst, src, 0, EVEXTuple.FVM.getDisp8ScalingFactor(AVXSize.ZMM));
     }
 
     // Insn: VMOVDQU16 zmm1, k1:z, m512
@@ -3921,7 +4004,7 @@
         // Code: EVEX.512.F2.0F.W1 6F /r
         evexPrefix(dst, mask, Register.None, src, AVXSize.ZMM, P_F2, M_0F, W1, Z1, B0);
         emitByte(0x6F);
-        emitEVEXOperandHelper(dst, src, 0, EVEXTuple.FVM.getDisp8ScalingFactor(AVXSize.ZMM));
+        emitOperandHelper(dst, src, 0, EVEXTuple.FVM.getDisp8ScalingFactor(AVXSize.ZMM));
     }
 
     // Insn: VMOVDQU16 zmm2/m512 {k1}{z}, zmm1
@@ -3934,7 +4017,7 @@
         // Code: EVEX.512.F2.0F.W1 7F /r
         evexPrefix(src, Register.None, Register.None, dst, AVXSize.ZMM, P_F2, M_0F, W1, Z0, B0);
         emitByte(0x7F);
-        emitEVEXOperandHelper(src, dst, 0, EVEXTuple.FVM.getDisp8ScalingFactor(AVXSize.ZMM));
+        emitOperandHelper(src, dst, 0, EVEXTuple.FVM.getDisp8ScalingFactor(AVXSize.ZMM));
     }
 
     // Insn: VMOVDQU16 m512, k1, zmm1
@@ -3945,7 +4028,7 @@
         // Code: EVEX.512.F2.0F.W1 7F /r
         evexPrefix(src, mask, Register.None, dst, AVXSize.ZMM, P_F2, M_0F, W1, Z0, B0);
         emitByte(0x7F);
-        emitEVEXOperandHelper(src, dst, 0, EVEXTuple.FVM.getDisp8ScalingFactor(AVXSize.ZMM));
+        emitOperandHelper(src, dst, 0, EVEXTuple.FVM.getDisp8ScalingFactor(AVXSize.ZMM));
     }
 
     // Insn: VPBROADCASTW zmm1 {k1}{z}, reg
@@ -4000,7 +4083,7 @@
         // Code: EVEX.512.F3.0F38.W0 30 /r
         evexPrefix(src, Register.None, Register.None, dst, AVXSize.ZMM, P_F3, M_0F38, W0, Z0, B0);
         emitByte(0x30);
-        emitEVEXOperandHelper(src, dst, 0, EVEXTuple.HVM.getDisp8ScalingFactor(AVXSize.ZMM));
+        emitOperandHelper(src, dst, 0, EVEXTuple.HVM.getDisp8ScalingFactor(AVXSize.ZMM));
     }
 
     // Insn: VPMOVWB m256, k1, zmm2
@@ -4011,7 +4094,7 @@
         // Code: EVEX.512.F3.0F38.W0 30 /r
         evexPrefix(src, mask, Register.None, dst, AVXSize.ZMM, P_F3, M_0F38, W0, Z0, B0);
         emitByte(0x30);
-        emitEVEXOperandHelper(src, dst, 0, EVEXTuple.HVM.getDisp8ScalingFactor(AVXSize.ZMM));
+        emitOperandHelper(src, dst, 0, EVEXTuple.HVM.getDisp8ScalingFactor(AVXSize.ZMM));
     }
 
     // Insn: VPMOVZXBW zmm1 {k1}{z}, ymm2/m256
@@ -4024,7 +4107,7 @@
         // Code: EVEX.512.66.0F38.WIG 30 /r
         evexPrefix(dst, mask, Register.None, src, AVXSize.ZMM, P_66, M_0F38, WIG, Z0, B0);
         emitByte(0x30);
-        emitEVEXOperandHelper(dst, src, 0, EVEXTuple.HVM.getDisp8ScalingFactor(AVXSize.ZMM));
+        emitOperandHelper(dst, src, 0, EVEXTuple.HVM.getDisp8ScalingFactor(AVXSize.ZMM));
     }
 
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.amd64/src/org/graalvm/compiler/asm/amd64/AMD64BaseAssembler.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.amd64/src/org/graalvm/compiler/asm/amd64/AMD64BaseAssembler.java	Tue Sep 24 15:19:35 2019 -0400
@@ -32,11 +32,11 @@
 import static jdk.vm.ci.amd64.AMD64.rsp;
 import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.EVEXPrefixConfig.B0;
 import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.EVEXPrefixConfig.B1;
-import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.EVEXPrefixConfig.L512;
 import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.EVEXPrefixConfig.Z0;
 import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.EVEXPrefixConfig.Z1;
 import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.L128;
 import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.L256;
+import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.L512;
 import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.LZ;
 import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.M_0F;
 import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.M_0F38;
@@ -510,6 +510,8 @@
         emitModRM(reg.encoding & 0x07, rm);
     }
 
+    public static final int DEFAULT_DISP8_SCALE = 1;
+
     /**
      * Emits the ModR/M byte and optionally the SIB byte for one register and one memory operand.
      *
@@ -517,19 +519,19 @@
      */
     protected final void emitOperandHelper(Register reg, AMD64Address addr, boolean force4Byte, int additionalInstructionSize) {
         assert !reg.equals(Register.None);
-        emitOperandHelper(encode(reg), addr, force4Byte, additionalInstructionSize, 1);
+        emitOperandHelper(encode(reg), addr, force4Byte, additionalInstructionSize, DEFAULT_DISP8_SCALE);
     }
 
     protected final void emitOperandHelper(int reg, AMD64Address addr, int additionalInstructionSize) {
-        emitOperandHelper(reg, addr, false, additionalInstructionSize, 1);
+        emitOperandHelper(reg, addr, false, additionalInstructionSize, DEFAULT_DISP8_SCALE);
     }
 
     protected final void emitOperandHelper(Register reg, AMD64Address addr, int additionalInstructionSize) {
         assert !reg.equals(Register.None);
-        emitOperandHelper(encode(reg), addr, false, additionalInstructionSize, 1);
+        emitOperandHelper(encode(reg), addr, false, additionalInstructionSize, DEFAULT_DISP8_SCALE);
     }
 
-    protected final void emitEVEXOperandHelper(Register reg, AMD64Address addr, int additionalInstructionSize, int evexDisp8Scale) {
+    protected final void emitOperandHelper(Register reg, AMD64Address addr, int additionalInstructionSize, int evexDisp8Scale) {
         assert !reg.equals(Register.None);
         emitOperandHelper(encode(reg), addr, false, additionalInstructionSize, evexDisp8Scale);
     }
@@ -739,6 +741,7 @@
     public static final class VEXPrefixConfig {
         public static final int L128 = 0;
         public static final int L256 = 1;
+        public static final int L512 = 2;
         public static final int LZ = 0;
 
         public static final int W0 = 0;
@@ -936,18 +939,29 @@
         }
     }
 
-    public final void vexPrefix(Register dst, Register nds, Register src, AVXSize size, int pp, int mmmmm, int w, boolean checkAVX) {
-        emitVEX(getLFlag(size), pp, mmmmm, w, getRXB(dst, src), nds.isValid() ? nds.encoding() : 0, checkAVX);
+    public static boolean isAVX512Register(Register reg) {
+        return reg != null && reg.isValid() && AMD64.XMM.equals(reg.getRegisterCategory()) && reg.encoding > 15;
     }
 
-    public final void vexPrefix(Register dst, Register nds, AMD64Address src, AVXSize size, int pp, int mmmmm, int w, boolean checkAVX) {
+    public final boolean vexPrefix(Register dst, Register nds, Register src, AVXSize size, int pp, int mmmmm, int w, int wEvex, boolean checkAVX) {
+        if (isAVX512Register(dst) || isAVX512Register(nds) || isAVX512Register(src)) {
+            evexPrefix(dst, Register.None, nds, src, size, pp, mmmmm, wEvex, Z0, B0);
+            return true;
+        }
         emitVEX(getLFlag(size), pp, mmmmm, w, getRXB(dst, src), nds.isValid() ? nds.encoding() : 0, checkAVX);
+        return false;
+    }
+
+    public final boolean vexPrefix(Register dst, Register nds, AMD64Address src, AVXSize size, int pp, int mmmmm, int w, int wEvex, boolean checkAVX) {
+        if (isAVX512Register(dst) || isAVX512Register(nds)) {
+            evexPrefix(dst, Register.None, nds, src, size, pp, mmmmm, wEvex, Z0, B0);
+            return true;
+        }
+        emitVEX(getLFlag(size), pp, mmmmm, w, getRXB(dst, src), nds.isValid() ? nds.encoding() : 0, checkAVX);
+        return false;
     }
 
     protected static final class EVEXPrefixConfig {
-        public static final int L512 = 2;
-        public static final int LIG = 0;
-
         public static final int Z0 = 0x0;
         public static final int Z1 = 0x1;
 
@@ -967,6 +981,7 @@
      * Reference: Intel Software Developer's Manual Volume 2, Section 2.6.5
      */
     protected enum EVEXTuple {
+        INVALID(NOT_SUPPORTED_VECTOR_LENGTH, NOT_SUPPORTED_VECTOR_LENGTH, NOT_SUPPORTED_VECTOR_LENGTH),
         FV_NO_BROADCAST_32BIT(16, 32, 64),
         FV_BROADCAST_32BIT(4, 4, 4),
         FV_NO_BROADCAST_64BIT(16, 32, 64),
@@ -1154,7 +1169,7 @@
      * Helper method for emitting EVEX prefix in the form of RRRM. Because the memory addressing in
      * EVEX-encoded instructions employ a compressed displacement scheme when using disp8 form, the
      * user of this API should make sure to encode the operands using
-     * {@link #emitEVEXOperandHelper(Register, AMD64Address, int, int)}.
+     * {@link #emitOperandHelper(Register, AMD64Address, int, int)}.
      */
     protected final void evexPrefix(Register dst, Register mask, Register nds, AMD64Address src, AVXSize size, int pp, int mm, int w, int z, int b) {
         assert !mask.isValid() || inRC(MASK, mask);
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.amd64/src/org/graalvm/compiler/asm/amd64/AMD64MacroAssembler.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.amd64/src/org/graalvm/compiler/asm/amd64/AMD64MacroAssembler.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,12 +24,11 @@
 
 package org.graalvm.compiler.asm.amd64;
 
-import static jdk.vm.ci.amd64.AMD64.rbp;
-import static jdk.vm.ci.amd64.AMD64.rsp;
 import static org.graalvm.compiler.asm.amd64.AMD64AsmOptions.UseIncDec;
 import static org.graalvm.compiler.asm.amd64.AMD64AsmOptions.UseXmmLoadAndClearUpper;
 import static org.graalvm.compiler.asm.amd64.AMD64AsmOptions.UseXmmRegToRegMoveAll;
 
+import org.graalvm.compiler.asm.amd64.AVXKind.AVXSize;
 import org.graalvm.compiler.core.common.NumUtil;
 
 import jdk.vm.ci.amd64.AMD64;
@@ -84,20 +83,6 @@
         }
     }
 
-    public final void enter(int frameSize) {
-        if (NumUtil.isUShort(frameSize)) {
-            // Can use enter instruction only for frame size that fits in 16 bits.
-            emitByte(0xC8);
-            emitShort(frameSize);
-            emitByte(0x00);
-        } else {
-            // Fall back to manual sequence.
-            push(rbp);
-            movq(rbp, rsp);
-            decrementq(rsp, frameSize);
-        }
-    }
-
     public void incrementq(Register reg, int value) {
         if (value == Integer.MIN_VALUE) {
             addq(reg, value);
@@ -239,43 +224,76 @@
     public void movflt(Register dst, Register src) {
         assert dst.getRegisterCategory().equals(AMD64.XMM) && src.getRegisterCategory().equals(AMD64.XMM);
         if (UseXmmRegToRegMoveAll) {
-            movaps(dst, src);
+            if (isAVX512Register(dst) || isAVX512Register(src)) {
+                VexMoveOp.VMOVAPS.emit(this, AVXSize.XMM, dst, src);
+            } else {
+                movaps(dst, src);
+            }
         } else {
-            movss(dst, src);
+            if (isAVX512Register(dst) || isAVX512Register(src)) {
+                VexMoveOp.VMOVSS.emit(this, AVXSize.XMM, dst, src);
+            } else {
+                movss(dst, src);
+            }
         }
     }
 
     public void movflt(Register dst, AMD64Address src) {
         assert dst.getRegisterCategory().equals(AMD64.XMM);
-        movss(dst, src);
+        if (isAVX512Register(dst)) {
+            VexMoveOp.VMOVSS.emit(this, AVXSize.XMM, dst, src);
+        } else {
+            movss(dst, src);
+        }
     }
 
     public void movflt(AMD64Address dst, Register src) {
         assert src.getRegisterCategory().equals(AMD64.XMM);
-        movss(dst, src);
+        if (isAVX512Register(src)) {
+            VexMoveOp.VMOVSS.emit(this, AVXSize.XMM, dst, src);
+        } else {
+            movss(dst, src);
+        }
     }
 
     public void movdbl(Register dst, Register src) {
         assert dst.getRegisterCategory().equals(AMD64.XMM) && src.getRegisterCategory().equals(AMD64.XMM);
         if (UseXmmRegToRegMoveAll) {
-            movapd(dst, src);
+            if (isAVX512Register(dst) || isAVX512Register(src)) {
+                VexMoveOp.VMOVAPD.emit(this, AVXSize.XMM, dst, src);
+            } else {
+                movapd(dst, src);
+            }
         } else {
-            movsd(dst, src);
+            if (isAVX512Register(dst) || isAVX512Register(src)) {
+                VexMoveOp.VMOVSD.emit(this, AVXSize.XMM, dst, src);
+            } else {
+                movsd(dst, src);
+            }
         }
     }
 
     public void movdbl(Register dst, AMD64Address src) {
         assert dst.getRegisterCategory().equals(AMD64.XMM);
         if (UseXmmLoadAndClearUpper) {
-            movsd(dst, src);
+            if (isAVX512Register(dst)) {
+                VexMoveOp.VMOVSD.emit(this, AVXSize.XMM, dst, src);
+            } else {
+                movsd(dst, src);
+            }
         } else {
+            assert !isAVX512Register(dst);
             movlpd(dst, src);
         }
     }
 
     public void movdbl(AMD64Address dst, Register src) {
         assert src.getRegisterCategory().equals(AMD64.XMM);
-        movsd(dst, src);
+        if (isAVX512Register(src)) {
+            VexMoveOp.VMOVSD.emit(this, AVXSize.XMM, dst, src);
+        } else {
+            movsd(dst, src);
+        }
     }
 
     /**
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.sparc/src/org/graalvm/compiler/asm/sparc/SPARCAssembler.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.sparc/src/org/graalvm/compiler/asm/sparc/SPARCAssembler.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.test/src/org/graalvm/compiler/asm/test/AssemblerTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.test/src/org/graalvm/compiler/asm/test/AssemblerTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
 import org.graalvm.compiler.code.CompilationResult;
 import org.graalvm.compiler.code.DisassemblerProvider;
 import org.graalvm.compiler.core.common.CompilationIdentifier;
+import org.graalvm.compiler.core.common.alloc.RegisterAllocationConfig;
 import org.graalvm.compiler.core.gen.LIRGenerationProvider;
 import org.graalvm.compiler.core.target.Backend;
 import org.graalvm.compiler.debug.DebugContext;
@@ -91,7 +92,8 @@
             RegisterConfig registerConfig = codeCache.getRegisterConfig();
             CompilationIdentifier compilationId = backend.getCompilationIdentifier(method);
             StructuredGraph graph = new StructuredGraph.Builder(options, debug).method(method).compilationId(compilationId).build();
-            CallingConvention cc = ((LIRGenerationProvider) backend).newLIRGenerationResult(compilationId, null, null, graph, null).getCallingConvention();
+            RegisterAllocationConfig registerAllocationConfig = backend.newRegisterAllocationConfig(null, null);
+            CallingConvention cc = ((LIRGenerationProvider) backend).newLIRGenerationResult(compilationId, null, registerAllocationConfig, graph, null).getCallingConvention();
 
             CompilationResult compResult = new CompilationResult(graph.compilationId());
             byte[] targetCode = test.generateCode(compResult, codeCache.getTarget(), registerConfig, cc);
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm/src/org/graalvm/compiler/asm/Assembler.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm/src/org/graalvm/compiler/asm/Assembler.java	Tue Sep 24 15:19:35 2019 -0400
@@ -162,6 +162,10 @@
         return codeBuffer.close(trimmedCopy);
     }
 
+    public byte[] copy(int start, int end) {
+        return codeBuffer.copyData(start, end);
+    }
+
     private void checkAndClearLabelsWithPatches() throws InternalError {
         Label label = labelsWithPatches;
         while (label != null) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm/src/org/graalvm/compiler/asm/Buffer.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm/src/org/graalvm/compiler/asm/Buffer.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm/src/org/graalvm/compiler/asm/Label.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm/src/org/graalvm/compiler/asm/Label.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.code/src/org/graalvm/compiler/code/CompilationResult.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.code/src/org/graalvm/compiler/code/CompilationResult.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.code/src/org/graalvm/compiler/code/DataSection.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.code/src/org/graalvm/compiler/code/DataSection.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.code/src/org/graalvm/compiler/code/HexCodeFileDisassemblerProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.code/src/org/graalvm/compiler/code/HexCodeFileDisassemblerProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.aarch64.test/src/org/graalvm/compiler/core/aarch64/test/AArch64CbzTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.aarch64.test/src/org/graalvm/compiler/core/aarch64/test/AArch64CbzTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2018, Arm Limited. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -67,14 +67,6 @@
         }
     }
 
-    public static String objectEqualsNull(String s1, String s2) {
-        if (s1.equals(null)) {
-            return s1 + "abc";
-        } else {
-            return s2 + "abd";
-        }
-    }
-
     public static String objectEquals(String s1, String s2) {
         if (s1.equals(s2)) {
             return s1 + "abc";
@@ -112,13 +104,6 @@
     }
 
     @Test
-    public void testObjectEqualsNull() {
-        test("objectEqualsNull", "ab", "ac");
-        test("objectEqualsNull", "abc", "abc");
-        checkLIR("objectEqualsNull", predicate, 1);
-    }
-
-    @Test
     public void testObjectEquals() {
         test("objectEquals", "ab", "ac");
         test("objectEquals", "abc", "abc");
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.aarch64/src/org/graalvm/compiler/core/aarch64/AArch64LIRGenerator.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.aarch64/src/org/graalvm/compiler/core/aarch64/AArch64LIRGenerator.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -66,6 +66,7 @@
 import org.graalvm.compiler.lir.aarch64.AArch64Move.MembarOp;
 import org.graalvm.compiler.lir.aarch64.AArch64PauseOp;
 import org.graalvm.compiler.lir.aarch64.AArch64SpeculativeBarrier;
+import org.graalvm.compiler.lir.aarch64.AArch64ZeroMemoryOp;
 import org.graalvm.compiler.lir.gen.LIRGenerationResult;
 import org.graalvm.compiler.lir.gen.LIRGenerator;
 import org.graalvm.compiler.phases.util.Providers;
@@ -530,7 +531,7 @@
     }
 
     @Override
-    public Variable emitArrayEquals(JavaKind kind, Value array1, Value array2, Value length, int constantLength, boolean directPointers) {
+    public Variable emitArrayEquals(JavaKind kind, Value array1, Value array2, Value length, boolean directPointers) {
         Variable result = newVariable(LIRKind.value(AArch64Kind.DWORD));
         append(new AArch64ArrayEqualsOp(this, kind, result, array1, array2, asAllocatable(length), directPointers));
         return result;
@@ -583,4 +584,10 @@
     public void emitSpeculationFence() {
         append(new AArch64SpeculativeBarrier());
     }
+
+    @Override
+    public void emitZeroMemory(Value address, Value length) {
+        // Value address is 8-byte aligned; Value length is multiple of 8.
+        append(new AArch64ZeroMemoryOp(asAllocatable(address), asAllocatable(length), false, -1));
+    }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.aarch64/src/org/graalvm/compiler/core/aarch64/AArch64LoweringProviderMixin.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.aarch64/src/org/graalvm/compiler/core/aarch64/AArch64LoweringProviderMixin.java	Tue Sep 24 15:19:35 2019 -0400
@@ -35,7 +35,7 @@
     }
 
     @Override
-    default boolean supportBulkZeroing() {
-        return false;
+    default int bulkZeroingStride() {
+        return 8;
     }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.aarch64/src/org/graalvm/compiler/core/aarch64/AArch64ReadNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.aarch64/src/org/graalvm/compiler/core/aarch64/AArch64ReadNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2017, Red Hat Inc. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -72,6 +72,11 @@
         gen.setResult(this, arithgen.emitExtendMemory(isSigned, readKind, resultBits, (AArch64AddressValue) gen.operand(getAddress()), gen.state(this)));
     }
 
+    @Override
+    public Stamp getAccessStamp() {
+        return accessStamp;
+    }
+
     /**
      * replace a ReadNode with an AArch64-specific variant which knows how to merge a downstream
      * zero or sign extend into the read operation.
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.aarch64/src/org/graalvm/compiler/core/aarch64/AArch64SuitesCreator.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.aarch64/src/org/graalvm/compiler/core/aarch64/AArch64SuitesCreator.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.amd64.test/src/org/graalvm/compiler/core/amd64/test/AMD64MatchRuleTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.amd64.test/src/org/graalvm/compiler/core/amd64/test/AMD64MatchRuleTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.amd64/src/org/graalvm/compiler/core/amd64/AMD64ArithmeticLIRGenerator.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.amd64/src/org/graalvm/compiler/core/amd64/AMD64ArithmeticLIRGenerator.java	Tue Sep 24 15:19:35 2019 -0400
@@ -124,7 +124,6 @@
 import org.graalvm.compiler.lir.amd64.AMD64SignExtendOp;
 import org.graalvm.compiler.lir.amd64.AMD64Ternary;
 import org.graalvm.compiler.lir.amd64.AMD64Unary;
-import org.graalvm.compiler.lir.amd64.AMD64ZeroMemoryOp;
 import org.graalvm.compiler.lir.amd64.vector.AMD64VectorBinary;
 import org.graalvm.compiler.lir.amd64.vector.AMD64VectorBinary.AVXBinaryConstFloatOp;
 import org.graalvm.compiler.lir.amd64.vector.AMD64VectorBinary.AVXBinaryOp;
@@ -1130,12 +1129,6 @@
         return new AMD64MathPowOp().emitLIRWrapper(getLIRGen(), x, y);
     }
 
-    @Override
-    public void emitZeroMemory(Value address, Value length) {
-        RegisterValue lengthReg = moveToReg(AMD64.rcx, length);
-        getLIRGen().append(new AMD64ZeroMemoryOp(getAMD64LIRGen().asAddressValue(address), lengthReg));
-    }
-
     protected AMD64LIRGenerator getAMD64LIRGen() {
         return (AMD64LIRGenerator) getLIRGen();
     }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.amd64/src/org/graalvm/compiler/core/amd64/AMD64LIRGenerator.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.amd64/src/org/graalvm/compiler/core/amd64/AMD64LIRGenerator.java	Tue Sep 24 15:19:35 2019 -0400
@@ -48,7 +48,10 @@
 import org.graalvm.compiler.asm.amd64.AMD64Assembler.AMD64RMOp;
 import org.graalvm.compiler.asm.amd64.AMD64Assembler.ConditionFlag;
 import org.graalvm.compiler.asm.amd64.AMD64Assembler.SSEOp;
+import org.graalvm.compiler.asm.amd64.AMD64Assembler.VexRMOp;
 import org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.OperandSize;
+import org.graalvm.compiler.asm.amd64.AVXKind;
+import org.graalvm.compiler.asm.amd64.AVXKind.AVXSize;
 import org.graalvm.compiler.core.common.LIRKind;
 import org.graalvm.compiler.core.common.NumUtil;
 import org.graalvm.compiler.core.common.calc.Condition;
@@ -61,7 +64,7 @@
 import org.graalvm.compiler.lir.LIRValueUtil;
 import org.graalvm.compiler.lir.LabelRef;
 import org.graalvm.compiler.lir.StandardOp.JumpOp;
-import org.graalvm.compiler.lir.StandardOp.SaveRegistersOp;
+import org.graalvm.compiler.lir.StandardOp.ZapRegistersOp;
 import org.graalvm.compiler.lir.SwitchStrategy;
 import org.graalvm.compiler.lir.Variable;
 import org.graalvm.compiler.lir.amd64.AMD64AddressValue;
@@ -94,6 +97,8 @@
 import org.graalvm.compiler.lir.amd64.AMD64StringUTF16CompressOp;
 import org.graalvm.compiler.lir.amd64.AMD64ZapRegistersOp;
 import org.graalvm.compiler.lir.amd64.AMD64ZapStackOp;
+import org.graalvm.compiler.lir.amd64.AMD64ZeroMemoryOp;
+import org.graalvm.compiler.lir.amd64.vector.AMD64VectorCompareOp;
 import org.graalvm.compiler.lir.gen.LIRGenerationResult;
 import org.graalvm.compiler.lir.gen.LIRGenerator;
 import org.graalvm.compiler.lir.hashing.Hasher;
@@ -404,17 +409,30 @@
         return result;
     }
 
+    private static AVXSize getRegisterSize(Value a) {
+        AMD64Kind kind = (AMD64Kind) a.getPlatformKind();
+        if (kind.isXMM()) {
+            return AVXKind.getRegisterSize(kind);
+        } else {
+            return AVXSize.XMM;
+        }
+    }
+
     private void emitIntegerTest(Value a, Value b) {
-        assert ((AMD64Kind) a.getPlatformKind()).isInteger();
-        OperandSize size = a.getPlatformKind() == AMD64Kind.QWORD ? QWORD : DWORD;
-        if (isJavaConstant(b) && NumUtil.is32bit(asJavaConstant(b).asLong())) {
-            append(new AMD64BinaryConsumer.ConstOp(AMD64MIOp.TEST, size, asAllocatable(a), (int) asJavaConstant(b).asLong()));
-        } else if (isJavaConstant(a) && NumUtil.is32bit(asJavaConstant(a).asLong())) {
-            append(new AMD64BinaryConsumer.ConstOp(AMD64MIOp.TEST, size, asAllocatable(b), (int) asJavaConstant(a).asLong()));
-        } else if (isAllocatableValue(b)) {
-            append(new AMD64BinaryConsumer.Op(AMD64RMOp.TEST, size, asAllocatable(b), asAllocatable(a)));
+        if (a.getPlatformKind().getVectorLength() > 1) {
+            append(new AMD64VectorCompareOp(VexRMOp.VPTEST, getRegisterSize(a), asAllocatable(a), asAllocatable(b)));
         } else {
-            append(new AMD64BinaryConsumer.Op(AMD64RMOp.TEST, size, asAllocatable(a), asAllocatable(b)));
+            assert ((AMD64Kind) a.getPlatformKind()).isInteger();
+            OperandSize size = a.getPlatformKind() == AMD64Kind.QWORD ? QWORD : DWORD;
+            if (isJavaConstant(b) && NumUtil.is32bit(asJavaConstant(b).asLong())) {
+                append(new AMD64BinaryConsumer.ConstOp(AMD64MIOp.TEST, size, asAllocatable(a), (int) asJavaConstant(b).asLong()));
+            } else if (isJavaConstant(a) && NumUtil.is32bit(asJavaConstant(a).asLong())) {
+                append(new AMD64BinaryConsumer.ConstOp(AMD64MIOp.TEST, size, asAllocatable(b), (int) asJavaConstant(a).asLong()));
+            } else if (isAllocatableValue(b)) {
+                append(new AMD64BinaryConsumer.Op(AMD64RMOp.TEST, size, asAllocatable(b), asAllocatable(a)));
+            } else {
+                append(new AMD64BinaryConsumer.Op(AMD64RMOp.TEST, size, asAllocatable(a), asAllocatable(b)));
+            }
         }
     }
 
@@ -547,27 +565,20 @@
     }
 
     @Override
-    public Variable emitArrayEquals(JavaKind kind, Value array1, Value array2, Value length, int constantLength, boolean directPointers) {
+    public Variable emitArrayEquals(JavaKind kind, Value array1, Value array2, Value length, boolean directPointers) {
         Variable result = newVariable(LIRKind.value(AMD64Kind.DWORD));
-        append(new AMD64ArrayEqualsOp(this, kind, kind, result, array1, array2, asAllocatable(length), constantLength, directPointers, getMaxVectorSize()));
+        append(new AMD64ArrayEqualsOp(this, kind, kind, result, array1, array2, length, directPointers, getMaxVectorSize()));
         return result;
     }
 
     @Override
-    public Variable emitArrayEquals(JavaKind kind1, JavaKind kind2, Value array1, Value array2, Value length, int constantLength, boolean directPointers) {
+    public Variable emitArrayEquals(JavaKind kind1, JavaKind kind2, Value array1, Value array2, Value length, boolean directPointers) {
         Variable result = newVariable(LIRKind.value(AMD64Kind.DWORD));
-        append(new AMD64ArrayEqualsOp(this, kind1, kind2, result, array1, array2, asAllocatable(length), constantLength, directPointers, getMaxVectorSize()));
+        append(new AMD64ArrayEqualsOp(this, kind1, kind2, result, array1, array2, length, directPointers, getMaxVectorSize()));
         return result;
     }
 
     /**
-     * Return a conservative estimate of the page size for use by the String.indexOf intrinsic.
-     */
-    protected int getVMPageSize() {
-        return 4096;
-    }
-
-    /**
      * Return the maximum size of vector registers used in SSE/AVX instructions.
      */
     protected int getMaxVectorSize() {
@@ -661,7 +672,7 @@
     }
 
     @Override
-    public SaveRegistersOp createZapRegisters(Register[] zappedRegisters, JavaConstant[] zapValues) {
+    public ZapRegistersOp createZapRegisters(Register[] zappedRegisters, JavaConstant[] zapValues) {
         return new AMD64ZapRegistersOp(zappedRegisters, zapValues);
     }
 
@@ -674,4 +685,11 @@
     public void emitSpeculationFence() {
         append(new AMD64LFenceOp());
     }
+
+    @Override
+    public void emitZeroMemory(Value address, Value length) {
+        RegisterValue lengthReg = AMD64.rcx.asValue(length.getValueKind());
+        emitMove(lengthReg, length);
+        append(new AMD64ZeroMemoryOp(asAddressValue(address), lengthReg));
+    }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.amd64/src/org/graalvm/compiler/core/amd64/AMD64LoweringProviderMixin.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.amd64/src/org/graalvm/compiler/core/amd64/AMD64LoweringProviderMixin.java	Tue Sep 24 15:19:35 2019 -0400
@@ -35,7 +35,7 @@
     }
 
     @Override
-    default boolean supportBulkZeroing() {
-        return true;
+    default int bulkZeroingStride() {
+        return 1;
     }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.amd64/src/org/graalvm/compiler/core/amd64/AMD64NodeMatchRules.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.amd64/src/org/graalvm/compiler/core/amd64/AMD64NodeMatchRules.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/Fields.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/Fields.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/FieldsScanner.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/FieldsScanner.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/GraalOptions.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/GraalOptions.java	Tue Sep 24 15:19:35 2019 -0400
@@ -63,7 +63,7 @@
     public static final OptionKey<Integer> MaximumInliningSize = new OptionKey<>(300);
 
     @Option(help = "If the previous low-level graph size of the method exceeds the threshold, it is not inlined.", type = OptionType.Expert)
-    public static final OptionKey<Integer> SmallCompiledLowLevelGraphSize = new OptionKey<>(300);
+    public static final OptionKey<Integer> SmallCompiledLowLevelGraphSize = new OptionKey<>(330);
 
     @Option(help = "", type = OptionType.Expert)
     public static final OptionKey<Double> LimitInlinedInvokes = new OptionKey<>(5.0);
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/LIRKind.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/LIRKind.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/SpeculativeExecutionAttacksMitigations.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/SpeculativeExecutionAttacksMitigations.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/calc/CanonicalCondition.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/calc/CanonicalCondition.java	Tue Sep 24 15:19:35 2019 -0400
@@ -51,4 +51,8 @@
     public boolean foldCondition(PrimitiveConstant lp, PrimitiveConstant rp, boolean unorderedIsTrue) {
         return asCondition().foldCondition(lp, rp, unorderedIsTrue);
     }
+
+    public boolean isUnsigned() {
+        return this == BT;
+    }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/cfg/AbstractBlockBase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/cfg/AbstractBlockBase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/cfg/CFGVerifier.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/cfg/CFGVerifier.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/cfg/Loop.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/cfg/Loop.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/spi/ForeignCallsProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/spi/ForeignCallsProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/type/AbstractObjectStamp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/type/AbstractObjectStamp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/type/AbstractPointerStamp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/type/AbstractPointerStamp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -112,14 +112,14 @@
         return pointer.asAlwaysNull();
     }
 
-    public Stamp asNonNull() {
+    public AbstractPointerStamp asNonNull() {
         if (isEmpty()) {
             return this;
         }
         return copyWith(true, false);
     }
 
-    public Stamp asMaybeNull() {
+    public AbstractPointerStamp asMaybeNull() {
         if (isEmpty()) {
             return this;
         }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/type/FloatStamp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/type/FloatStamp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/type/IllegalStamp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/type/IllegalStamp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/type/IntegerStamp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/type/IntegerStamp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/type/PrimitiveStamp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/type/PrimitiveStamp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/type/Stamp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/type/Stamp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/type/VoidStamp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/type/VoidStamp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/util/TypeReader.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/util/TypeReader.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/util/TypeWriter.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/util/TypeWriter.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/util/UnsafeArrayTypeReader.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/util/UnsafeArrayTypeReader.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/util/UnsignedLong.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/util/UnsignedLong.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.match.processor/src/org/graalvm/compiler/core/match/processor/MatchProcessor.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.match.processor/src/org/graalvm/compiler/core/match/processor/MatchProcessor.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.sparc/src/org/graalvm/compiler/core/sparc/SPARCLIRGenerator.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.sparc/src/org/graalvm/compiler/core/sparc/SPARCLIRGenerator.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -420,7 +420,7 @@
     }
 
     @Override
-    public Variable emitArrayEquals(JavaKind kind, Value array1, Value array2, Value length, int constantLength, boolean directPointers) {
+    public Variable emitArrayEquals(JavaKind kind, Value array1, Value array2, Value length, boolean directPointers) {
         Variable result = newVariable(LIRKind.value(SPARCKind.WORD));
         append(new SPARCArrayEqualsOp(this, kind, result, load(array1), load(array2), asAllocatable(length), directPointers));
         return result;
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.sparc/src/org/graalvm/compiler/core/sparc/SPARCNodeMatchRules.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.sparc/src/org/graalvm/compiler/core/sparc/SPARCNodeMatchRules.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.sparc/src/org/graalvm/compiler/core/sparc/SparcLoweringProviderMixin.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.sparc/src/org/graalvm/compiler/core/sparc/SparcLoweringProviderMixin.java	Tue Sep 24 15:19:35 2019 -0400
@@ -35,7 +35,7 @@
     }
 
     @Override
-    default boolean supportBulkZeroing() {
-        return false;
+    default int bulkZeroingStride() {
+        return 0;
     }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/BasePhaseBinaryGraphTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/BasePhaseBinaryGraphTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CanonicalizedConversionTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CanonicalizedConversionTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CheckGraalInvariants.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CheckGraalInvariants.java	Tue Sep 24 15:19:35 2019 -0400
@@ -77,6 +77,8 @@
 import org.graalvm.compiler.phases.util.Providers;
 import org.graalvm.compiler.runtime.RuntimeProvider;
 import org.graalvm.compiler.serviceprovider.JavaVersionUtil;
+import org.graalvm.compiler.test.AddExports;
+import org.graalvm.compiler.test.ModuleSupport;
 import jdk.internal.vm.compiler.word.LocationIdentity;
 import org.junit.Assert;
 import org.junit.Assume;
@@ -98,8 +100,15 @@
  * global invariants such as using {@link Object#equals(Object)} to compare certain types instead of
  * identity comparisons.
  */
+@AddExports("jdk.internal.vm.ci/*=jdk.aot")
 public class CheckGraalInvariants extends GraalCompilerTest {
 
+    /**
+     * Magic token to denote the classes in the Java runtime image (i.e. in the {@code jrt:/} file
+     * system).
+     */
+    public static final String JRT_CLASS_PATH_ENTRY = "<jrt>";
+
     private static boolean shouldVerifyEquals(ResolvedJavaMethod m) {
         if (m.getName().equals("identityEquals")) {
             ResolvedJavaType c = m.getDeclaringClass();
@@ -119,6 +128,9 @@
     public static class InvariantsTool {
 
         protected boolean shouldProcess(String classpathEntry) {
+            if (classpathEntry.equals(JRT_CLASS_PATH_ENTRY)) {
+                return true;
+            }
             if (classpathEntry.endsWith(".jar")) {
                 String name = new File(classpathEntry).getName();
                 return name.contains("jvmci") || name.contains("graal") || name.contains("jdk.internal.vm.compiler");
@@ -131,7 +143,7 @@
             if (JavaVersionUtil.JAVA_SPEC <= 8) {
                 bootclasspath = System.getProperty("sun.boot.class.path");
             } else {
-                bootclasspath = System.getProperty("jdk.module.path") + File.pathSeparatorChar + System.getProperty("jdk.module.upgrade.path");
+                bootclasspath = JRT_CLASS_PATH_ENTRY;
             }
             return bootclasspath;
         }
@@ -208,19 +220,8 @@
         for (String path : bootclasspath.split(File.pathSeparator)) {
             if (tool.shouldProcess(path)) {
                 try {
-                    final ZipFile zipFile = new ZipFile(new File(path));
-                    for (final Enumeration<? extends ZipEntry> entry = zipFile.entries(); entry.hasMoreElements();) {
-                        final ZipEntry zipEntry = entry.nextElement();
-                        String name = zipEntry.getName();
-                        if (name.endsWith(".class") && !name.startsWith("META-INF/versions/")) {
-                            String className = name.substring(0, name.length() - ".class".length()).replace('/', '.');
-                            if (isInNativeImage(className)) {
-                                /*
-                                 * Native Image is an external tool and does not need to follow the
-                                 * Graal invariants.
-                                 */
-                                continue;
-                            }
+                    if (path.equals(JRT_CLASS_PATH_ENTRY)) {
+                        for (String className : ModuleSupport.getJRTGraalClassNames()) {
                             if (isGSON(className)) {
                                 /*
                                  * GSON classes are compiled with old JDK
@@ -229,6 +230,29 @@
                             }
                             classNames.add(className);
                         }
+                    } else {
+                        final ZipFile zipFile = new ZipFile(new File(path));
+                        for (final Enumeration<? extends ZipEntry> entry = zipFile.entries(); entry.hasMoreElements();) {
+                            final ZipEntry zipEntry = entry.nextElement();
+                            String name = zipEntry.getName();
+                            if (name.endsWith(".class") && !name.startsWith("META-INF/versions/")) {
+                                String className = name.substring(0, name.length() - ".class".length()).replace('/', '.');
+                                if (isInNativeImage(className)) {
+                                    /*
+                                     * Native Image is an external tool and does not need to follow
+                                     * the Graal invariants.
+                                     */
+                                    continue;
+                                }
+                                if (isGSON(className)) {
+                                    /*
+                                     * GSON classes are compiled with old JDK
+                                     */
+                                    continue;
+                                }
+                                classNames.add(className);
+                            }
+                        }
                     }
                 } catch (IOException ex) {
                     Assert.fail(ex.toString());
@@ -314,8 +338,12 @@
 
                 ResolvedJavaType type = metaAccess.lookupJavaType(c);
                 List<ResolvedJavaMethod> methods = new ArrayList<>();
-                methods.addAll(Arrays.asList(type.getDeclaredMethods()));
-                methods.addAll(Arrays.asList(type.getDeclaredConstructors()));
+                try {
+                    methods.addAll(Arrays.asList(type.getDeclaredMethods()));
+                    methods.addAll(Arrays.asList(type.getDeclaredConstructors()));
+                } catch (Throwable e) {
+                    errors.add(String.format("Error while checking %s:%n%s", className, printStackTraceToString(e)));
+                }
                 ResolvedJavaMethod clinit = type.getClassInitializer();
                 if (clinit != null) {
                     methods.add(clinit);
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CompareCanonicalizerTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CompareCanonicalizerTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CompareCanonicalizerTest2.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CompareCanonicalizerTest2.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CompareCanonicalizerTest3.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CompareCanonicalizerTest3.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ConditionalEliminationTest10.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ConditionalEliminationTest10.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ConditionalEliminationTest13.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ConditionalEliminationTest13.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ConditionalEliminationTest14.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ConditionalEliminationTest14.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ConditionalEliminationTest15.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ConditionalEliminationTest15.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ConditionalEliminationTest2.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ConditionalEliminationTest2.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ConditionalEliminationTestBase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ConditionalEliminationTestBase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ConditionalNodeTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ConditionalNodeTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CopyOfVirtualizationTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CopyOfVirtualizationTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CountedLoopTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CountedLoopTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -70,21 +70,24 @@
     /**
      * Get a property of an induction variable.
      */
-    private static int get(@SuppressWarnings("unused") IVProperty property, @SuppressWarnings("unused") StaticIVProperty staticProperty, @SuppressWarnings("unused") IVPredicate constantCheck,
-                    int iv) {
+    @SuppressWarnings("unused")
+    private static int get(IVProperty property, StaticIVProperty staticProperty, IVPredicate constantCheck, int iv) {
         return iv;
     }
 
-    private static int get(@SuppressWarnings("unused") IVProperty property, int iv) {
+    @SuppressWarnings("unused")
+    private static int get(IVProperty property, int iv) {
         return iv;
     }
 
-    private static long get(@SuppressWarnings("unused") IVProperty property, @SuppressWarnings("unused") StaticIVProperty staticProperty, @SuppressWarnings("unused") IVPredicate constantCheck,
+    @SuppressWarnings("unused")
+    private static long get(IVProperty property, StaticIVProperty staticProperty, IVPredicate constantCheck,
                     long iv) {
         return iv;
     }
 
-    private static long get(@SuppressWarnings("unused") IVProperty property, long iv) {
+    @SuppressWarnings("unused")
+    private static long get(IVProperty property, long iv) {
         return iv;
     }
 
@@ -150,12 +153,12 @@
 
     @Test
     public void increment5() {
-        testCounted("incrementSnippet", 256, 256, 1);
+        testRemovableCounted("incrementSnippet", 256, 256, 1);
     }
 
     @Test
     public void increment6() {
-        testCounted("incrementSnippet", 257, 256, 1);
+        testRemovableCounted("incrementSnippet", 257, 256, 1);
     }
 
     @Test
@@ -207,7 +210,7 @@
 
     @Test
     public void incrementEq6() {
-        testCounted("incrementEqSnippet", 257, 256, 1);
+        testRemovableCounted("incrementEqSnippet", 257, 256, 1);
     }
 
     @Test
@@ -220,6 +223,16 @@
         testCounted("incrementEqSnippet", -10, Integer.MAX_VALUE - 2, 2);
     }
 
+    @Test
+    public void incrementEq9() {
+        testCounted("incrementEqSnippet", 0, 0, 1);
+    }
+
+    @Test
+    public void incrementEq10() {
+        testCounted("incrementEqSnippet", 0, 0, 3);
+    }
+
     public static Result decrementSnippet(int start, int limit, int step) {
         int i;
         int dec = ((step - 1) & 0xFFFF) + 1; // make sure this value is always strictly positive
@@ -286,7 +299,7 @@
 
     @Test
     public void decrementEq4() {
-        testCounted("decrementEqSnippet", -10, 0, Integer.MAX_VALUE);
+        testRemovableCounted("decrementEqSnippet", -10, 0, Integer.MAX_VALUE);
     }
 
     @Test
@@ -299,6 +312,16 @@
         testCounted("decrementEqSnippet", Integer.MAX_VALUE, -10, 2);
     }
 
+    @Test
+    public void decrementEq7() {
+        testCounted("decrementEqSnippet", 10, 10, 1);
+    }
+
+    @Test
+    public void decrementEq8() {
+        testCounted("decrementEqSnippet", 10, 10, 3);
+    }
+
     public static Result twoVariablesSnippet() {
         Result ret = new Result();
         int j = 0;
@@ -384,45 +407,175 @@
 
     @Test
     public void incrementLong5() {
-        testCounted("incrementLongSnippet", 256L, 256L, 1L);
+        testRemovableCounted("incrementLongSnippet", 256L, 256L, 1L);
     }
 
     @Test
     public void incrementLong6() {
-        testCounted("incrementLongSnippet", 257L, 256L, 1L);
+        testRemovableCounted("incrementLongSnippet", 257L, 256L, 1L);
+    }
+
+    public static Result incrementUnsignedSnippet(int start, int limit, int step) {
+        int i;
+        int inc = ((step - 1) & 0xFFFF) + 1; // make sure this value is always strictly positive
+        Result ret = new Result();
+        for (i = start; Integer.compareUnsigned(i, limit) < 0; i += inc) {
+            GraalDirectives.controlFlowAnchor();
+            ret.extremum = get(InductionVariable::extremumNode, InductionVariable::constantExtremum, InductionVariable::isConstantExtremum, i);
+        }
+        ret.exitValue = get(InductionVariable::exitValueNode, i);
+        return ret;
+    }
+
+    @Test
+    public void incrementUnsigned1() {
+        testCounted("incrementUnsignedSnippet", 0, 256, 1);
+    }
+
+    @Test
+    public void incrementUnsigned2() {
+        testCounted("incrementUnsignedSnippet", 0, 256, 2);
+    }
+
+    @Test
+    public void incrementUnsigned3() {
+        testCounted("incrementUnsignedSnippet", 0, 256, 3);
+    }
+
+    @Test
+    public void incrementUnsigned4() {
+        testCounted("incrementUnsignedSnippet", 1, Integer.MAX_VALUE + 10, Integer.MAX_VALUE);
+    }
+
+    @Test
+    public void incrementUnsigned5() {
+        testRemovableCounted("incrementUnsignedSnippet", 256, 256, 1);
+    }
+
+    @Test
+    public void incrementUnsigned6() {
+        testRemovableCounted("incrementUnsignedSnippet", 257, 256, 1);
+    }
+
+    @Test
+    public void incrementUnsigned7() {
+        testCounted("incrementUnsignedSnippet", 0, Integer.MAX_VALUE + 10, 1);
+    }
+
+    @Test
+    public void incrementUnsigned8a() {
+        testCounted("incrementUnsignedSnippet", 0, Integer.MAX_VALUE + 11, 2);
+    }
+
+    @Test
+    public void incrementUnsigned8b() {
+        testCounted("incrementUnsignedSnippet", 0, Integer.MAX_VALUE + 10, 2);
+    }
+
+    @Test
+    public void incrementUnsigned9() {
+        testCounted("incrementUnsignedSnippet", Integer.MAX_VALUE - 1, Integer.MAX_VALUE + 10, 1);
+    }
+
+    @Test
+    public void incrementUnsigned10() {
+        testCounted("incrementUnsignedSnippet", Integer.MAX_VALUE - 1, Integer.MAX_VALUE + 10, 2);
+    }
+
+    public static Result decrementUnsignedSnippet(int start, int limit, int step) {
+        int dec = ((step - 1) & 0xFFFF) + 1; // make sure this value is always strictly positive
+        Result ret = new Result();
+        int i;
+        for (i = start; Integer.compareUnsigned(i, limit) > 0; i -= dec) {
+            GraalDirectives.controlFlowAnchor();
+            ret.extremum = get(InductionVariable::extremumNode, InductionVariable::constantExtremum, InductionVariable::isConstantExtremum, i);
+        }
+        ret.exitValue = get(InductionVariable::exitValueNode, i);
+        return ret;
+    }
+
+    @Test
+    public void decrementUnsigned1() {
+        testCounted("decrementUnsignedSnippet", 256, 0, 1);
+    }
+
+    @Test
+    public void decrementUnsigned2() {
+        testCounted("decrementUnsignedSnippet", 256, 0, 2);
+    }
+
+    @Test
+    public void decrementUnsigned3() {
+        testCounted("decrementUnsignedSnippet", 256, 2, 3);
+    }
+
+    @Test
+    public void decrementUnsigned5() {
+        testRemovableCounted("decrementUnsignedSnippet", 256, 256, 1);
+    }
+
+    @Test
+    public void decrementUnsigned6() {
+        testRemovableCounted("decrementUnsignedSnippet", 256, 257, 1);
+    }
+
+    @Test
+    public void decrementUnsigned7() {
+        testCounted("decrementUnsignedSnippet", Integer.MAX_VALUE + 10, 0, 1);
+    }
+
+    @Test
+    public void decrementUnsigned8() {
+        testCounted("decrementUnsignedSnippet", Integer.MAX_VALUE + 11, 0, 2);
+    }
+
+    @Test
+    public void decrementUnsigned9() {
+        testCounted("decrementUnsignedSnippet", Integer.MAX_VALUE + 10, Integer.MAX_VALUE - 1, 1);
+    }
+
+    @Test
+    public void decrementUnsigned10() {
+        testCounted("decrementUnsignedSnippet", Integer.MAX_VALUE + 10, Integer.MAX_VALUE - 1, 2);
     }
 
     @NodeInfo(cycles = CYCLES_IGNORED, size = SIZE_IGNORED)
     private static class IVPropertyNode extends FloatingNode implements LIRLowerable {
-
         public static final NodeClass<IVPropertyNode> TYPE = NodeClass.create(IVPropertyNode.class);
 
         private final IVProperty property;
         private final StaticIVProperty staticProperty;
         private final IVPredicate staticCheck;
+        private final boolean loopCanBeRemoved;
         @Input private ValueNode iv;
 
-        protected IVPropertyNode(IVProperty property, StaticIVProperty staticProperty, IVPredicate staticCheck, ValueNode iv) {
+        protected IVPropertyNode(IVProperty property, StaticIVProperty staticProperty, IVPredicate staticCheck, ValueNode iv, boolean loopCanBeRemoved) {
             super(TYPE, iv.stamp(NodeView.DEFAULT).unrestricted());
             this.property = property;
             this.staticProperty = staticProperty;
             this.staticCheck = staticCheck;
             this.iv = iv;
+            this.loopCanBeRemoved = loopCanBeRemoved;
         }
 
         public void rewrite(LoopsData loops) {
             InductionVariable inductionVariable = loops.getInductionVariable(iv);
-            assert inductionVariable != null;
-            assertTrue(inductionVariable.getLoop().isCounted(), "must be counted");
             ValueNode node = null;
-            if (staticCheck != null) {
-                assert staticProperty != null;
-                if (staticCheck.test(inductionVariable)) {
-                    node = ConstantNode.forLong(staticProperty.get(inductionVariable), graph());
+            if (inductionVariable == null) {
+                assert loopCanBeRemoved;
+                assert loops.loops().isEmpty();
+                node = iv;
+            } else {
+                assertTrue(inductionVariable.getLoop().isCounted(), "must be counted");
+                if (staticCheck != null) {
+                    assert staticProperty != null;
+                    if (staticCheck.test(inductionVariable)) {
+                        node = ConstantNode.forLong(staticProperty.get(inductionVariable), graph());
+                    }
                 }
-            }
-            if (node == null) {
-                node = property.get(inductionVariable);
+                if (node == null) {
+                    node = property.get(inductionVariable);
+                }
             }
             replaceAtUsagesAndDelete(node);
         }
@@ -450,7 +603,7 @@
                     property = getSnippetReflection().asObject(IVProperty.class, arg1.asJavaConstant());
                 }
                 if (property != null) {
-                    b.addPush(ivKind, new IVPropertyNode(property, null, null, arg2));
+                    b.addPush(ivKind, new IVPropertyNode(property, null, null, arg2, loopCanBeRemoved));
                     return true;
                 } else {
                     return false;
@@ -473,7 +626,7 @@
                     staticCheck = getSnippetReflection().asObject(IVPredicate.class, arg3.asJavaConstant());
                 }
                 if (property != null && staticProperty != null && staticCheck != null) {
-                    b.addPush(ivKind, new IVPropertyNode(property, staticProperty, staticCheck, arg4));
+                    b.addPush(ivKind, new IVPropertyNode(property, staticProperty, staticCheck, arg4, loopCanBeRemoved));
                     return true;
                 } else {
                     return false;
@@ -499,6 +652,7 @@
     }
 
     private Object[] argsToBind;
+    private boolean loopCanBeRemoved;
 
     @Override
     protected Object[] getArgumentToBind() {
@@ -506,9 +660,32 @@
     }
 
     public void testCounted(String snippetName, Object... args) {
+        this.loopCanBeRemoved = false;
         test(snippetName, args);
-        argsToBind = args;
+        this.argsToBind = args;
         test(snippetName, args);
-        argsToBind = null;
+        this.argsToBind = null;
+    }
+
+    public void testCounted(String snippetName, Object start, Object limit, Object step) {
+        testCounted(false, snippetName, start, limit, step);
+    }
+
+    public void testRemovableCounted(String snippetName, Object start, Object limit, Object step) {
+        testCounted(true, snippetName, start, limit, step);
+    }
+
+    public void testCounted(boolean removable, String snippetName, Object start, Object limit, Object step) {
+        this.loopCanBeRemoved = removable;
+        Object[] args = {start, limit, step};
+        test(snippetName, args);
+        this.argsToBind = args;
+        test(snippetName, args);
+        this.argsToBind = new Object[]{NO_BIND, NO_BIND, step};
+        test(snippetName, args);
+        this.argsToBind = new Object[]{start, NO_BIND, step};
+        test(snippetName, args);
+        this.argsToBind = null;
+        this.loopCanBeRemoved = false;
     }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CustomizedBytecodePatternTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CustomizedBytecodePatternTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -58,7 +58,7 @@
                 loadedClass = (Class<?>) defineClass.invoke(lookUp, gen);
             }
         } catch (Exception e) {
-            throw new ClassNotFoundException();
+            throw new ClassNotFoundException(className, e);
         }
         return loadedClass;
     }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/DumpPathTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/DumpPathTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
 import java.nio.file.DirectoryStream;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.nio.file.Paths;
 
 import jdk.internal.vm.compiler.collections.EconomicMap;
 import org.graalvm.compiler.debug.DebugOptions;
@@ -49,22 +50,20 @@
     @Test
     public void testDump() throws IOException {
         assumeManagementLibraryIsLoadable();
-        Path dumpDirectoryPath = Files.createTempDirectory("DumpPathTest");
-        String[] extensions = new String[]{".cfg", ".bgv", ".graph-strings"};
-        EconomicMap<OptionKey<?>, Object> overrides = OptionValues.newOptionMap();
-        overrides.put(DebugOptions.DumpPath, dumpDirectoryPath.toString());
-        overrides.put(DebugOptions.PrintCFG, true);
-        overrides.put(DebugOptions.PrintGraph, PrintGraphTarget.File);
-        overrides.put(DebugOptions.PrintCanonicalGraphStrings, true);
-        overrides.put(DebugOptions.Dump, "*");
+        try (TemporaryDirectory temp = new TemporaryDirectory(Paths.get("."), "DumpPathTest")) {
+            String[] extensions = new String[]{".cfg", ".bgv", ".graph-strings"};
+            EconomicMap<OptionKey<?>, Object> overrides = OptionValues.newOptionMap();
+            overrides.put(DebugOptions.DumpPath, temp.toString());
+            overrides.put(DebugOptions.PrintCFG, true);
+            overrides.put(DebugOptions.PrintGraph, PrintGraphTarget.File);
+            overrides.put(DebugOptions.PrintCanonicalGraphStrings, true);
+            overrides.put(DebugOptions.Dump, "*");
 
-        // Generate dump files.
-        test(new OptionValues(getInitialOptions(), overrides), "snippet");
-        // Check that IGV files got created, in the right place.
-        checkForFiles(dumpDirectoryPath, extensions);
-
-        // Clean up the generated files.
-        removeDirectory(dumpDirectoryPath);
+            // Generate dump files.
+            test(new OptionValues(getInitialOptions(), overrides), "snippet");
+            // Check that IGV files got created, in the right place.
+            checkForFiles(temp.path, extensions);
+        }
     }
 
     /**
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/EnumSwitchTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/EnumSwitchTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +24,6 @@
 
 package org.graalvm.compiler.core.test;
 
-import org.junit.Test;
-
 import org.graalvm.compiler.nodes.StructuredGraph;
 import org.graalvm.compiler.nodes.extended.IntegerSwitchNode;
 import org.graalvm.compiler.nodes.java.LoadIndexedNode;
@@ -33,6 +31,8 @@
 import org.graalvm.compiler.phases.Phase;
 import org.graalvm.compiler.phases.common.RemoveValueProxyPhase;
 import org.graalvm.compiler.phases.tiers.Suites;
+import org.junit.Assume;
+import org.junit.Test;
 
 public class EnumSwitchTest extends GraalCompilerTest {
 
@@ -145,6 +145,7 @@
         ret.getHighTier().prependPhase(new Phase() {
             @Override
             protected void run(StructuredGraph graph) {
+                Assume.assumeTrue(graph.getNodes().filter(LoadIndexedNode.class).first().array().isConstant());
                 /* Array load from the enum switch map. */
                 assertTrue(graph.getNodes().filter(LoadIndexedNode.class).count() == 1);
                 /* The actual switch. */
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/FinalizableSubclassTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/FinalizableSubclassTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/FindUniqueConcreteMethodBugTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/FindUniqueConcreteMethodBugTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/FloatingReadTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/FloatingReadTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/GraalCompilerTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/GraalCompilerTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -43,6 +43,7 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.EnumMap;
+import java.util.HashMap;
 import java.util.List;
 import java.util.ListIterator;
 import java.util.Map;
@@ -62,7 +63,6 @@
 import org.graalvm.compiler.core.target.Backend;
 import org.graalvm.compiler.debug.DebugContext;
 import org.graalvm.compiler.debug.DebugDumpHandler;
-import org.graalvm.compiler.debug.DebugDumpScope;
 import org.graalvm.compiler.debug.DebugHandlersFactory;
 import org.graalvm.compiler.debug.GraalError;
 import org.graalvm.compiler.debug.TTY;
@@ -74,6 +74,7 @@
 import org.graalvm.compiler.java.GraphBuilderPhase;
 import org.graalvm.compiler.lir.asm.CompilationResultBuilderFactory;
 import org.graalvm.compiler.lir.phases.LIRSuites;
+import org.graalvm.compiler.loop.phases.ConvertDeoptimizeToGuardPhase;
 import org.graalvm.compiler.nodeinfo.NodeInfo;
 import org.graalvm.compiler.nodeinfo.NodeSize;
 import org.graalvm.compiler.nodeinfo.Verbosity;
@@ -111,7 +112,6 @@
 import org.graalvm.compiler.phases.Phase;
 import org.graalvm.compiler.phases.PhaseSuite;
 import org.graalvm.compiler.phases.common.CanonicalizerPhase;
-import org.graalvm.compiler.loop.phases.ConvertDeoptimizeToGuardPhase;
 import org.graalvm.compiler.phases.common.inlining.InliningPhase;
 import org.graalvm.compiler.phases.common.inlining.info.InlineInfo;
 import org.graalvm.compiler.phases.common.inlining.policy.GreedyInliningPolicy;
@@ -124,12 +124,12 @@
 import org.graalvm.compiler.phases.util.Providers;
 import org.graalvm.compiler.printer.GraalDebugHandlersFactory;
 import org.graalvm.compiler.runtime.RuntimeProvider;
-import org.graalvm.compiler.serviceprovider.JavaVersionUtil;
 import org.graalvm.compiler.test.AddExports;
 import org.graalvm.compiler.test.GraalTest;
-import org.graalvm.compiler.test.JLModule;
+import org.graalvm.compiler.test.ModuleSupport;
 import org.junit.After;
 import org.junit.Assert;
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.internal.AssumptionViolatedException;
 
@@ -195,9 +195,7 @@
      * as of JDK 9.
      */
     protected final void exportPackage(Class<?> moduleMember, String packageName) {
-        if (JavaVersionUtil.JAVA_SPEC > 8) {
-            JLModule.exportPackageTo(moduleMember, packageName, getClass());
-        }
+        ModuleSupport.exportPackageTo(moduleMember, packageName, getClass());
     }
 
     /**
@@ -344,6 +342,13 @@
         return ret;
     }
 
+    private static final ThreadLocal<HashMap<ResolvedJavaMethod, InstalledCode>> cache = ThreadLocal.withInitial(HashMap::new);
+
+    @BeforeClass
+    public static void resetCache() {
+        cache.get().clear();
+    }
+
     public GraalCompilerTest() {
         this.backend = Graal.getRequiredCapability(RuntimeProvider.class).getHostBackend();
         this.providers = getBackend().getProviders();
@@ -923,8 +928,6 @@
         }
     }
 
-    private Map<ResolvedJavaMethod, InstalledCode> cache = new ConcurrentHashMap<>();
-
     /**
      * Gets installed code for a given method, compiling it first if necessary. The graph is parsed
      * {@link #parseEager eagerly}.
@@ -976,7 +979,7 @@
     protected InstalledCode getCode(final ResolvedJavaMethod installedCodeOwner, StructuredGraph graph, boolean forceCompile, boolean installAsDefault, OptionValues options) {
         boolean useCache = !forceCompile && getArgumentToBind() == null;
         if (useCache && graph == null) {
-            InstalledCode cached = cache.get(installedCodeOwner);
+            InstalledCode cached = cache.get().get(installedCodeOwner);
             if (cached != null) {
                 if (cached.isValid()) {
                     return cached;
@@ -991,7 +994,7 @@
             StructuredGraph graphToCompile = graph == null ? parseForCompile(installedCodeOwner, id, options) : graph;
             DebugContext debug = graphToCompile.getDebug();
 
-            try (AllocSpy spy = AllocSpy.open(installedCodeOwner); DebugContext.Scope ds = debug.scope("Compiling", new DebugDumpScope(id.toString(CompilationIdentifier.Verbosity.ID), true))) {
+            try (AllocSpy spy = AllocSpy.open(installedCodeOwner); DebugContext.Scope ds = debug.scope("Compiling", graph)) {
                 CompilationPrinter printer = CompilationPrinter.begin(options, id, installedCodeOwner, INVOCATION_ENTRY_BCI);
                 CompilationResult compResult = compile(installedCodeOwner, graphToCompile, new CompilationResult(graphToCompile.compilationId()), id, options);
                 printer.finish(compResult);
@@ -1023,7 +1026,7 @@
             }
 
             if (useCache) {
-                cache.put(installedCodeOwner, installedCode);
+                cache.get().put(installedCodeOwner, installedCode);
             }
             return installedCode;
         }
@@ -1322,6 +1325,8 @@
         }
     }
 
+    protected static final Object NO_BIND = new Object();
+
     protected void bindArguments(StructuredGraph graph, Object[] argsToBind) {
         ResolvedJavaMethod m = graph.method();
         Object receiver = isStatic(m.getModifiers()) ? null : this;
@@ -1329,9 +1334,12 @@
         JavaType[] parameterTypes = m.toParameterTypes();
         assert parameterTypes.length == args.length;
         for (ParameterNode param : graph.getNodes(ParameterNode.TYPE)) {
-            JavaConstant c = getSnippetReflection().forBoxed(parameterTypes[param.index()].getJavaKind(), args[param.index()]);
-            ConstantNode replacement = ConstantNode.forConstant(c, getMetaAccess(), graph);
-            param.replaceAtUsages(replacement);
+            Object arg = args[param.index()];
+            if (arg != NO_BIND) {
+                JavaConstant c = getSnippetReflection().forBoxed(parameterTypes[param.index()].getJavaKind(), arg);
+                ConstantNode replacement = ConstantNode.forConstant(c, getMetaAccess(), graph);
+                param.replaceAtUsages(replacement);
+            }
         }
     }
 
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/GraphEncoderTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/GraphEncoderTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/GraphPrinterTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.graalvm.compiler.core.test;
+
+import org.graalvm.compiler.printer.CanonicalStringGraphPrinter;
+import org.junit.Test;
+
+import jdk.vm.ci.meta.JavaConstant;
+
+/**
+ * Tests related to graph printing.
+ */
+public class GraphPrinterTest extends GraalCompilerTest {
+
+    /**
+     * Tests that a self-recursive object does not cause stack overflow when formatted as a string.
+     */
+    @Test
+    public void testGraphPrinterDoesNotStackOverflow() {
+        CanonicalStringGraphPrinter printer = new CanonicalStringGraphPrinter(getSnippetReflection());
+        Object[] topArray = {null};
+        Object[] parent = topArray;
+        Object[] lastArray = null;
+        for (int i = 0; i < 5; i++) {
+            lastArray = new Object[1];
+            parent[0] = lastArray;
+            parent = lastArray;
+        }
+        lastArray[0] = topArray;
+        JavaConstant constant = getSnippetReflection().forObject(topArray);
+        printer.format(constant);
+    }
+}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/GraphResetDebugTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/GraphResetDebugTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/GuardPrioritiesTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/GuardPrioritiesTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/IfCanonicalizerTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/IfCanonicalizerTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ImplicitNullCheckTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ImplicitNullCheckTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/IntegerEqualsCanonicalizerTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/IntegerEqualsCanonicalizerTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/LockEliminationTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/LockEliminationTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/LoopFullUnrollTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/LoopFullUnrollTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/LoopUnswitchTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/LoopUnswitchTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/MergeCanonicalizerTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/MergeCanonicalizerTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/NestedLoopTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/NestedLoopTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/NewInstanceTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/NewInstanceTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/NodePropertiesTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/NodePropertiesTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/OptionsVerifierTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/OptionsVerifierTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,30 +26,19 @@
 
 import static java.lang.String.format;
 
-import java.io.ByteArrayOutputStream;
-import java.io.File;
 import java.io.IOException;
-import java.io.InputStream;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Executable;
 import java.lang.reflect.Method;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.nio.file.Files;
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
 import java.util.Set;
 
 import org.graalvm.compiler.options.OptionDescriptor;
 import org.graalvm.compiler.options.OptionDescriptors;
 import org.graalvm.compiler.options.OptionKey;
 import org.graalvm.compiler.options.OptionsParser;
-import org.graalvm.compiler.serviceprovider.JavaVersionUtil;
+import org.graalvm.compiler.serviceprovider.GraalServices;
 import org.junit.Test;
 import org.objectweb.asm.ClassReader;
 import org.objectweb.asm.ClassVisitor;
@@ -67,87 +56,26 @@
 
     @Test
     public void verifyOptions() throws IOException {
-        try (Classpath cp = new Classpath()) {
-            HashSet<Class<?>> checked = new HashSet<>();
-            for (OptionDescriptors opts : OptionsParser.getOptionsLoader()) {
-                for (OptionDescriptor desc : opts) {
-                    OptionsVerifier.checkClass(desc.getDeclaringClass(), desc, checked, cp);
-                }
-            }
-        }
-    }
-
-    static class Classpath implements AutoCloseable {
-        private final Map<String, Object> entries = new LinkedHashMap<>();
-
-        Classpath() throws IOException {
-            List<String> names = new ArrayList<>(Arrays.asList(System.getProperty("java.class.path").split(File.pathSeparator)));
-            if (JavaVersionUtil.JAVA_SPEC <= 8) {
-                names.addAll(Arrays.asList(System.getProperty("sun.boot.class.path").split(File.pathSeparator)));
-            } else {
-                names.addAll(Arrays.asList(System.getProperty("jdk.module.path").split(File.pathSeparator)));
-            }
-            for (String n : names) {
-                File path = new File(n);
-                if (path.exists()) {
-                    if (path.isDirectory()) {
-                        entries.put(n, path);
-                    } else if (n.endsWith(".jar") || n.endsWith(".zip")) {
-                        URL url = new URL("jar", "", "file:" + n + "!/");
-                        entries.put(n, new URLClassLoader(new URL[]{url}));
-                    }
-                }
+        HashSet<Class<?>> checked = new HashSet<>();
+        for (OptionDescriptors opts : OptionsParser.getOptionsLoader()) {
+            for (OptionDescriptor desc : opts) {
+                OptionsVerifier.checkClass(desc.getDeclaringClass(), desc, checked);
             }
         }
-
-        @Override
-        public void close() throws IOException {
-            for (Object e : entries.values()) {
-                if (e instanceof URLClassLoader) {
-                    ((URLClassLoader) e).close();
-                }
-            }
-        }
-
-        public byte[] getInputStream(String classFilePath) throws IOException {
-            for (Object e : entries.values()) {
-                if (e instanceof File) {
-                    File path = new File((File) e, classFilePath.replace('/', File.separatorChar));
-                    if (path.exists()) {
-                        return Files.readAllBytes(path.toPath());
-                    }
-                } else {
-                    assert e instanceof URLClassLoader;
-                    URLClassLoader ucl = (URLClassLoader) e;
-                    try (InputStream in = ucl.getResourceAsStream(classFilePath)) {
-                        if (in != null) {
-                            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
-                            int nRead;
-                            byte[] data = new byte[1024];
-                            while ((nRead = in.read(data, 0, data.length)) != -1) {
-                                buffer.write(data, 0, nRead);
-                            }
-                            return buffer.toByteArray();
-                        }
-                    }
-                }
-            }
-            return null;
-        }
     }
 
     static final class OptionsVerifier extends ClassVisitor {
 
-        public static void checkClass(Class<?> cls, OptionDescriptor option, Set<Class<?>> checked, Classpath cp) throws IOException {
+        public static void checkClass(Class<?> cls, OptionDescriptor option, Set<Class<?>> checked) throws IOException {
             if (!checked.contains(cls)) {
                 checked.add(cls);
                 Class<?> superclass = cls.getSuperclass();
                 if (superclass != null && !superclass.equals(Object.class)) {
-                    checkClass(superclass, option, checked, cp);
+                    checkClass(superclass, option, checked);
                 }
 
-                String classFilePath = cls.getName().replace('.', '/') + ".class";
-                ClassReader cr = new ClassReader(Objects.requireNonNull(cp.getInputStream(classFilePath), "Could not find class file for " + cls.getName()));
+                GraalServices.getClassfileAsStream(cls);
+                ClassReader cr = new ClassReader(GraalServices.getClassfileAsStream(cls));
 
                 ClassVisitor cv = new OptionsVerifier(cls, option);
                 cr.accept(cv, 0);
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/PushNodesThroughPiTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/PushNodesThroughPiTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/PushThroughIfTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/PushThroughIfTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ReadAfterCheckCastTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ReadAfterCheckCastTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ReassociateAndCanonicalTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ReassociateAndCanonicalTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ReferenceGetLoopTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ReferenceGetLoopTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ScalarTypeSystemTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ScalarTypeSystemTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/SchedulingTest2.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/SchedulingTest2.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/StampCanonicalizerTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/StampCanonicalizerTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/StraighteningTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/StraighteningTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/SubprocessTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.graalvm.compiler.core.test;
+
+import static org.graalvm.compiler.test.SubprocessUtil.getVMCommandLine;
+import static org.graalvm.compiler.test.SubprocessUtil.java;
+import static org.graalvm.compiler.test.SubprocessUtil.withoutDebuggerArguments;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.graalvm.compiler.test.SubprocessUtil;
+import org.junit.Assume;
+import org.junit.Before;
+
+public abstract class SubprocessTest extends GraalCompilerTest {
+
+    @Before
+    public void checkJavaAgent() {
+        Assume.assumeFalse("Java Agent found -> skipping", SubprocessUtil.isJavaAgentAttached());
+    }
+
+    public void launchSubprocess(Runnable runnable) throws InterruptedException, IOException {
+        String recursionPropName = getClass().getSimpleName() + ".Subprocess";
+        if (Boolean.getBoolean(recursionPropName)) {
+            runnable.run();
+        } else {
+            List<String> vmArgs = withoutDebuggerArguments(getVMCommandLine());
+            vmArgs.addAll(SubprocessUtil.getPackageOpeningOptions());
+            vmArgs.add("-D" + recursionPropName + "=true");
+            configSubprocess(vmArgs);
+            SubprocessUtil.Subprocess proc = java(vmArgs, "com.oracle.mxtool.junit.MxJUnitWrapper", getClass().getName());
+            assertTrue(proc.exitCode == 0, proc.toString() + " failed with exit code " + proc.exitCode);
+        }
+    }
+
+    @SuppressWarnings("unused")
+    public void configSubprocess(List<String> vmArgs) {
+    }
+
+}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/SwitchCanonicalizerTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/SwitchCanonicalizerTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -120,7 +120,7 @@
     private void shouldFoldSwitch(String methodName) {
         StructuredGraph graph = parseForCompile(getResolvedJavaMethod(methodName));
         new CanonicalizerPhase().apply(graph, getDefaultHighTierContext());
-        assertFalse(graph.hasNode(IntegerSwitchNode.TYPE));
+        assertTrue(graph.getNodes().filter(IntegerSwitchNode.class).isEmpty());
     }
 
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/SwitchDyingLoopTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/SwitchDyingLoopTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -75,11 +75,11 @@
         StructuredGraph graph = parseEager("snippet", StructuredGraph.AllowAssumptions.YES);
         // there should be 1 loop and 1 switch
         assertThat(graph.getNodes(LoopBeginNode.TYPE), hasCount(1));
-        assertThat(graph.getNodes(IntegerSwitchNode.TYPE), hasCount(1));
+        assertThat(graph.getNodes().filter(IntegerSwitchNode.class), hasCount(1));
         canonicalizerPhase.apply(graph, highTierContext);
         // after canonicalization, the loop and switch should still be there
         assertThat(graph.getNodes(LoopBeginNode.TYPE), hasCount(1));
-        assertThat(graph.getNodes(IntegerSwitchNode.TYPE), hasCount(1));
+        assertThat(graph.getNodes().filter(IntegerSwitchNode.class), hasCount(1));
         // add stamp to `a` so that paths leading to continue can be trimmed
         ParameterNode parameter = graph.getParameter(0);
         assertNotNull(parameter);
@@ -87,6 +87,6 @@
         canonicalizerPhase.apply(graph, highTierContext);
         // the loop should have disappeared and there should still be a switch
         assertThat(graph.getNodes(LoopBeginNode.TYPE), isEmpty());
-        assertThat(graph.getNodes(IntegerSwitchNode.TYPE), hasCount(1));
+        assertThat(graph.getNodes().filter(IntegerSwitchNode.class), hasCount(1));
     }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/TypeSystemTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/TypeSystemTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/TypeWriterTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/TypeWriterTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/UnbalancedMonitorsTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/UnbalancedMonitorsTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/UnsafeReadEliminationTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/UnsafeReadEliminationTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/UnsafeVirtualizationTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/UnsafeVirtualizationTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/UnusedArray.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/UnusedArray.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/VerifyBailoutUsage.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/VerifyBailoutUsage.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/VerifyCallerSensitiveMethods.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/VerifyCallerSensitiveMethods.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/VerifyDebugUsage.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/VerifyDebugUsage.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -150,7 +150,8 @@
                     "org.graalvm.compiler.core.test.VerifyDebugUsageTest$ValidDumpUsagePhase.run",
                     "org.graalvm.compiler.core.test.VerifyDebugUsageTest$InvalidConcatDumpUsagePhase.run",
                     "org.graalvm.compiler.core.test.VerifyDebugUsageTest$InvalidDumpUsagePhase.run",
-                    "org.graalvm.compiler.hotspot.SymbolicSnippetEncoder.verifySnippetEncodeDecode"));
+                    "org.graalvm.compiler.hotspot.SymbolicSnippetEncoder.verifySnippetEncodeDecode",
+                    "org.graalvm.compiler.truffle.compiler.phases.inlining.CallTree.dumpBasic"));
 
     /**
      * The set of methods allowed to call a {@code Debug.dump(...)} method with the {@code level}
@@ -167,7 +168,8 @@
                     "org.graalvm.compiler.replacements.ReplacementsImpl$GraphMaker.makeGraph",
                     "org.graalvm.compiler.replacements.SnippetTemplate.instantiate",
                     "org.graalvm.compiler.replacements.SnippetTemplate.<init>",
-                    "org.graalvm.compiler.hotspot.SymbolicSnippetEncoder.verifySnippetEncodeDecode"));
+                    "org.graalvm.compiler.hotspot.SymbolicSnippetEncoder.verifySnippetEncodeDecode",
+                    "org.graalvm.compiler.truffle.compiler.phases.inlining.CallTree.dumpInfo"));
 
     private void verifyParameters(StructuredGraph callerGraph, MethodCallTargetNode debugCallTarget, List<? extends ValueNode> args, ResolvedJavaType stringType, int startArgIdx,
                     int varArgsIndex) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/VerifyFoldableMethods.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/VerifyFoldableMethods.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/VerifyGetOptionsUsage.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/VerifyGetOptionsUsage.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/VerifyGraphAddUsage.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/VerifyGraphAddUsage.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/VerifyInstanceOfUsage.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/VerifyInstanceOfUsage.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/VerifySystemPropertyUsage.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/VerifySystemPropertyUsage.java	Tue Sep 24 15:19:35 2019 -0400
@@ -96,6 +96,10 @@
             // * its JDK substitutions to mimic required JDK semantics
             // * native-image for config info
             return;
+        } else if (packageName.startsWith("jdk.tools.jaotc")) {
+            // Workaround since jdk.internal.vm.ci/jdk.vm.ci.services is not exported to jdk.aot.
+            // The jaotc launcher dynamically adds these exports.
+            return;
         }
         for (MethodCallTargetNode t : graph.getNodes(MethodCallTargetNode.TYPE)) {
             ResolvedJavaMethod callee = t.targetMethod();
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/VerifyUpdateUsages.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/VerifyUpdateUsages.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/VerifyUsageWithEquals.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/VerifyUsageWithEquals.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/VerifyVirtualizableUsage.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/VerifyVirtualizableUsage.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/backend/BackendTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/backend/BackendTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/deopt/CompiledMethodTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/deopt/CompiledMethodTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -71,7 +71,7 @@
             }
         }
 
-        InstalledCode compiledMethod = getCode(javaMethod, graph);
+        InstalledCode compiledMethod = getCode(javaMethod, graph, true);
         try {
             Object result = compiledMethod.executeVarargs("1", "2", "3");
             if (!"1-2-3".equals(result)) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/deopt/RethrowDeoptMaterializeTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/deopt/RethrowDeoptMaterializeTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/deopt/SynchronizedMethodDeoptimizationTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/deopt/SynchronizedMethodDeoptimizationTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ea/EATestBase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ea/EATestBase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ea/EscapeAnalysisTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ea/EscapeAnalysisTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,6 +40,7 @@
 import org.graalvm.compiler.nodes.virtual.CommitAllocationNode;
 import org.graalvm.compiler.phases.common.CanonicalizerPhase;
 import org.graalvm.compiler.phases.schedule.SchedulePhase;
+import org.graalvm.compiler.test.SubprocessUtil;
 import org.graalvm.compiler.virtual.phases.ea.PartialEscapePhase;
 import org.junit.Assert;
 import org.junit.Assume;
@@ -413,8 +414,11 @@
      */
     @Test
     public void testNewNode() {
-        // Trackking of creation interferes with escape analysis
+        // Tracking of creation interferes with escape analysis
         Assume.assumeFalse(Node.TRACK_CREATION_POSITION);
+        // JaCoco can add escaping allocations (e.g. allocation of coverage recording data
+        // structures)
+        Assume.assumeFalse("JaCoCo found -> skipping", SubprocessUtil.isJaCoCoAttached());
         testEscapeAnalysis("testNewNodeSnippet", null, false);
     }
 
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ea/PoorMansEATest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ea/PoorMansEATest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ea/UnsafeCompareAndSwapVirtualizationTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ea/UnsafeCompareAndSwapVirtualizationTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,7 +46,7 @@
     @Test
     public void bothVirtualNoMatchTest() {
         testEscapeAnalysis("bothVirtualNoMatch", JavaConstant.INT_0, true);
-        assertTrue(graph.getNodes(LogicCompareAndSwapNode.TYPE).isEmpty());
+        assertTrue(graph.getNodes().filter(LogicCompareAndSwapNode.class).isEmpty());
     }
 
     public static boolean bothVirtualMatch() {
@@ -58,7 +58,7 @@
     @Test
     public void bothVirtualMatchTest() {
         testEscapeAnalysis("bothVirtualMatch", JavaConstant.INT_1, true);
-        assertTrue(graph.getNodes(LogicCompareAndSwapNode.TYPE).isEmpty());
+        assertTrue(graph.getNodes().filter(LogicCompareAndSwapNode.class).isEmpty());
     }
 
     public static boolean expectedVirtualMatch() {
@@ -70,7 +70,7 @@
     @Test
     public void expectedVirtualMatchTest() {
         testEscapeAnalysis("expectedVirtualMatch", JavaConstant.INT_1, true);
-        assertTrue(graph.getNodes(LogicCompareAndSwapNode.TYPE).isEmpty());
+        assertTrue(graph.getNodes().filter(LogicCompareAndSwapNode.class).isEmpty());
     }
 
     public static boolean expectedVirtualNoMatch() {
@@ -82,7 +82,7 @@
     @Test
     public void expectedVirtualNoMatchTest() {
         testEscapeAnalysis("expectedVirtualNoMatch", JavaConstant.INT_0, true);
-        assertTrue(graph.getNodes(LogicCompareAndSwapNode.TYPE).isEmpty());
+        assertTrue(graph.getNodes().filter(LogicCompareAndSwapNode.class).isEmpty());
     }
 
     public static boolean bothNonVirtualNoMatch() {
@@ -93,7 +93,7 @@
     @Test
     public void bothNonVirtualNoMatchTest() {
         testEscapeAnalysis("bothNonVirtualNoMatch", JavaConstant.INT_0, true);
-        assertTrue(graph.getNodes(LogicCompareAndSwapNode.TYPE).isEmpty());
+        assertTrue(graph.getNodes().filter(LogicCompareAndSwapNode.class).isEmpty());
     }
 
     public static boolean bothNonVirtualMatch() {
@@ -104,7 +104,7 @@
     @Test
     public void bothNonVirtualMatchTest() {
         testEscapeAnalysis("bothNonVirtualMatch", JavaConstant.INT_1, true);
-        assertTrue(graph.getNodes(LogicCompareAndSwapNode.TYPE).isEmpty());
+        assertTrue(graph.getNodes().filter(LogicCompareAndSwapNode.class).isEmpty());
     }
 
     public static boolean onlyInitialValueVirtualNoMatch() {
@@ -115,7 +115,7 @@
     @Test
     public void onlyInitialValueVirtualNoMatchTest() {
         testEscapeAnalysis("onlyInitialValueVirtualNoMatch", JavaConstant.INT_0, true);
-        assertTrue(graph.getNodes(LogicCompareAndSwapNode.TYPE).isEmpty());
+        assertTrue(graph.getNodes().filter(LogicCompareAndSwapNode.class).isEmpty());
     }
 
     public static boolean onlyInitialValueVirtualMatch() {
@@ -127,7 +127,7 @@
     @Test
     public void onlyInitialValueVirtualMatchTest() {
         testEscapeAnalysis("onlyInitialValueVirtualMatch", JavaConstant.INT_1, true);
-        assertTrue(graph.getNodes(LogicCompareAndSwapNode.TYPE).isEmpty());
+        assertTrue(graph.getNodes().filter(LogicCompareAndSwapNode.class).isEmpty());
     }
 
     public static boolean bothVirtualNoMatchArray() {
@@ -138,6 +138,6 @@
     @Test
     public void bothVirtualNoMatchArrayTest() {
         testEscapeAnalysis("bothVirtualNoMatchArray", JavaConstant.INT_0, true);
-        assertTrue(graph.getNodes(LogicCompareAndSwapNode.TYPE).isEmpty());
+        assertTrue(graph.getNodes().filter(LogicCompareAndSwapNode.class).isEmpty());
     }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/inlining/NestedLoopEffectsPhaseComplexityTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/inlining/NestedLoopEffectsPhaseComplexityTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/inlining/PolymorphicInliningTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,367 +0,0 @@
-/*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package org.graalvm.compiler.core.test.inlining;
-
-import static org.graalvm.compiler.test.SubprocessUtil.getVMCommandLine;
-import static org.graalvm.compiler.test.SubprocessUtil.java;
-import static org.graalvm.compiler.test.SubprocessUtil.withoutDebuggerArguments;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.graalvm.compiler.core.test.GraalCompilerTest;
-import org.graalvm.compiler.debug.DebugContext;
-import org.graalvm.compiler.debug.DebugDumpScope;
-import org.graalvm.compiler.graph.Node;
-import org.graalvm.compiler.nodes.DeoptimizeNode;
-import org.graalvm.compiler.nodes.InvokeNode;
-import org.graalvm.compiler.nodes.StructuredGraph;
-import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
-import org.graalvm.compiler.nodes.StructuredGraph.Builder;
-import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration;
-import org.graalvm.compiler.nodes.java.TypeSwitchNode;
-import org.graalvm.compiler.phases.OptimisticOptimizations;
-import org.graalvm.compiler.phases.PhaseSuite;
-import org.graalvm.compiler.phases.common.CanonicalizerPhase;
-import org.graalvm.compiler.phases.common.DeadCodeEliminationPhase;
-import org.graalvm.compiler.phases.tiers.HighTierContext;
-import org.graalvm.compiler.test.SubprocessUtil;
-import org.junit.Assert;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.Test;
-
-import jdk.vm.ci.meta.ResolvedJavaMethod;
-
-public class PolymorphicInliningTest extends GraalCompilerTest {
-
-    @Before
-    public void checkJavaAgent() {
-        Assume.assumeFalse("Java Agent found -> skipping", SubprocessUtil.isJavaAgentAttached());
-    }
-
-    @Test
-    public void testInSubprocess() throws InterruptedException, IOException {
-        String recursionPropName = getClass().getName() + ".recursion";
-        if (Boolean.getBoolean(recursionPropName)) {
-            testPolymorphicInlining();
-            testPolymorphicNotInlining();
-            testMegamorphicInlining();
-            testMegamorphicNotInlining();
-        } else {
-            List<String> vmArgs = withoutDebuggerArguments(getVMCommandLine());
-            NotInlinableSubClass.class.getCanonicalName();
-            vmArgs.add("-XX:CompileCommand=dontinline,org/graalvm/compiler/core/test/inlining/PolymorphicInliningTest$NotInlinableSubClass.publicOverriddenMethod");
-            vmArgs.add("-D" + recursionPropName + "=true");
-            SubprocessUtil.Subprocess proc = java(vmArgs, "com.oracle.mxtool.junit.MxJUnitWrapper", getClass().getName());
-            if (proc.exitCode != 0) {
-                Assert.fail(String.format("non-zero exit code %d for command:%n%s", proc.exitCode, proc));
-            }
-        }
-    }
-
-    public int polymorphicCallsite(SuperClass receiver) {
-        return receiver.publicOverriddenMethod();
-    }
-
-    public void testPolymorphicInlining() {
-        for (int i = 0; i < 10000; i++) {
-            if (i % 2 == 0) {
-                polymorphicCallsite(Receivers.subClassA);
-            } else {
-                polymorphicCallsite(Receivers.subClassB);
-            }
-        }
-        StructuredGraph graph = getGraph("polymorphicCallsite", false);
-        // This callsite should be inlined with a TypeCheckedInliningViolated deoptimization.
-        assertTrue(getNodeCount(graph, InvokeNode.class) == 0);
-        assertTrue(getNodeCount(graph, TypeSwitchNode.class) == 1);
-        assertTrue(getNodeCount(graph, DeoptimizeNode.class) >= 1);
-    }
-
-    /**
-     * This snippet is identical to {@link #polymorphicCallsite(SuperClass)}, and is for avoiding
-     * interference of the receiver type profile from different unit tests.
-     */
-    public int polymorphicCallsite1(SuperClass receiver) {
-        return receiver.publicOverriddenMethod();
-    }
-
-    public void testPolymorphicNotInlining() {
-        for (int i = 0; i < 10000; i++) {
-            if (i % 2 == 0) {
-                polymorphicCallsite1(Receivers.subClassA);
-            } else {
-                polymorphicCallsite1(Receivers.notInlinableSubClass);
-            }
-        }
-        StructuredGraph graph = getGraph("polymorphicCallsite1", false);
-        // This callsite should not be inlined due to one of the potential callee method is not
-        // inlinable.
-        assertTrue(getNodeCount(graph, InvokeNode.class) == 1);
-        assertTrue(getNodeCount(graph, TypeSwitchNode.class) == 0);
-    }
-
-    /**
-     * This snippet is identical to {@link #polymorphicCallsite(SuperClass)}, and is for avoiding
-     * interference of the receiver type profile from different unit tests.
-     */
-    public int polymorphicCallsite2(SuperClass receiver) {
-        return receiver.publicOverriddenMethod();
-    }
-
-    public void testMegamorphicInlining() {
-        // Construct a receiver type profile that exceeds the max type width (by default 8 in JVMCI,
-        // specified by -XX:TypeProfileWidth).
-        for (int i = 0; i < 2000; i++) {
-            // Ensure the following receiver type is within the type profile.
-            polymorphicCallsite2(Receivers.subClassA);
-        }
-        for (int i = 0; i < 10000; i++) {
-            switch (i % 20) {
-                case 0:
-                case 1:
-                case 2:
-                case 3:
-                case 4:
-                case 5:
-                case 6:
-                case 7:
-                    // Probability: 40%
-                    // Ensure the probability is greater than
-                    // GraalOptions.MegamorphicInliningMinMethodProbability (by default 0.33D);
-                    polymorphicCallsite2(Receivers.subClassA);
-                    break;
-                case 8:
-                    polymorphicCallsite2(Receivers.subClassB);
-                    break;
-                case 9:
-                    polymorphicCallsite2(Receivers.subClassC);
-                    break;
-                case 10:
-                    polymorphicCallsite2(Receivers.subClassD);
-                    break;
-                case 11:
-                    polymorphicCallsite2(Receivers.subClassE);
-                    break;
-                case 12:
-                    polymorphicCallsite2(Receivers.subClassF);
-                    break;
-                case 13:
-                    polymorphicCallsite2(Receivers.subClassG);
-                    break;
-                case 14:
-                    polymorphicCallsite2(Receivers.subClassH);
-                    break;
-                default:
-                    // Probability: 25%
-                    polymorphicCallsite2(Receivers.notInlinableSubClass);
-                    break;
-            }
-        }
-        StructuredGraph graph = getGraph("polymorphicCallsite2", false);
-        // This callsite should be inlined with a fallback invocation.
-        assertTrue(getNodeCount(graph, InvokeNode.class) == 1);
-        assertTrue(getNodeCount(graph, TypeSwitchNode.class) == 1);
-    }
-
-    /**
-     * This snippet is identical to {@link #polymorphicCallsite(SuperClass)}, and is for avoiding
-     * interference of the receiver type profile from different unit tests.
-     */
-    public int polymorphicCallsite3(SuperClass receiver) {
-        return receiver.publicOverriddenMethod();
-    }
-
-    public void testMegamorphicNotInlining() {
-        for (int i = 0; i < 10000; i++) {
-            switch (i % 10) {
-                case 0:
-                case 1:
-                    polymorphicCallsite3(Receivers.subClassA);
-                    break;
-                case 2:
-                    polymorphicCallsite3(Receivers.subClassB);
-                    break;
-                case 3:
-                    polymorphicCallsite3(Receivers.subClassC);
-                    break;
-                case 4:
-                    polymorphicCallsite3(Receivers.subClassD);
-                    break;
-                case 5:
-                    polymorphicCallsite3(Receivers.subClassE);
-                    break;
-                case 6:
-                    polymorphicCallsite3(Receivers.subClassF);
-                    break;
-                case 7:
-                    polymorphicCallsite3(Receivers.subClassG);
-                    break;
-                case 8:
-                    polymorphicCallsite3(Receivers.subClassH);
-                    break;
-                default:
-                    polymorphicCallsite3(Receivers.notInlinableSubClass);
-                    break;
-            }
-        }
-        StructuredGraph graph = getGraph("polymorphicCallsite3", false);
-        // This callsite should not be inlined due to non of the potential callee method exceeds the
-        // probability specified by GraalOptions.MegamorphicInliningMinMethodProbability.
-        assertTrue(getNodeCount(graph, InvokeNode.class) == 1);
-        assertTrue(getNodeCount(graph, TypeSwitchNode.class) == 0);
-    }
-
-    @SuppressWarnings("try")
-    private StructuredGraph getGraph(final String snippet, final boolean eagerInfopointMode) {
-        DebugContext debug = getDebugContext();
-        try (DebugContext.Scope s = debug.scope("InliningTest", new DebugDumpScope(snippet, true))) {
-            ResolvedJavaMethod method = getResolvedJavaMethod(snippet);
-            Builder builder = builder(method, AllowAssumptions.YES, debug);
-            StructuredGraph graph = eagerInfopointMode ? parse(builder, getDebugGraphBuilderSuite()) : parse(builder, getEagerGraphBuilderSuite());
-            try (DebugContext.Scope s2 = debug.scope("Inlining", graph)) {
-                PhaseSuite<HighTierContext> graphBuilderSuite = eagerInfopointMode
-                                ? getCustomGraphBuilderSuite(GraphBuilderConfiguration.getDefault(getDefaultGraphBuilderPlugins()).withFullInfopoints(true))
-                                : getDefaultGraphBuilderSuite();
-                HighTierContext context = new HighTierContext(getProviders(), graphBuilderSuite, OptimisticOptimizations.ALL);
-                debug.dump(DebugContext.BASIC_LEVEL, graph, "Graph");
-                new CanonicalizerPhase().apply(graph, context);
-                createInliningPhase().apply(graph, context);
-                debug.dump(DebugContext.BASIC_LEVEL, graph, "Graph");
-                new CanonicalizerPhase().apply(graph, context);
-                new DeadCodeEliminationPhase().apply(graph);
-                return graph;
-            }
-        } catch (Throwable e) {
-            throw debug.handle(e);
-        }
-    }
-
-    private static int getNodeCount(StructuredGraph graph, Class<? extends Node> nodeClass) {
-        return graph.getNodes().filter(nodeClass).count();
-    }
-
-    private static final class Receivers {
-        static final SubClassA subClassA = new SubClassA();
-        static final SubClassB subClassB = new SubClassB();
-        static final SubClassC subClassC = new SubClassC();
-        static final SubClassD subClassD = new SubClassD();
-        static final SubClassE subClassE = new SubClassE();
-        static final SubClassF subClassF = new SubClassF();
-        static final SubClassG subClassG = new SubClassG();
-        static final SubClassH subClassH = new SubClassH();
-
-        static final NotInlinableSubClass notInlinableSubClass = new NotInlinableSubClass();
-    }
-
-    private abstract static class SuperClass {
-
-        public abstract int publicOverriddenMethod();
-
-    }
-
-    private static class SubClassA extends SuperClass {
-
-        @Override
-        public int publicOverriddenMethod() {
-            return 'A';
-        }
-
-    }
-
-    private static class SubClassB extends SuperClass {
-
-        @Override
-        public int publicOverriddenMethod() {
-            return 'B';
-        }
-
-    }
-
-    private static class SubClassC extends SuperClass {
-
-        @Override
-        public int publicOverriddenMethod() {
-            return 'C';
-        }
-
-    }
-
-    private static class SubClassD extends SuperClass {
-
-        @Override
-        public int publicOverriddenMethod() {
-            return 'D';
-        }
-
-    }
-
-    private static class SubClassE extends SuperClass {
-
-        @Override
-        public int publicOverriddenMethod() {
-            return 'E';
-        }
-
-    }
-
-    private static class SubClassF extends SuperClass {
-
-        @Override
-        public int publicOverriddenMethod() {
-            return 'F';
-        }
-
-    }
-
-    private static class SubClassG extends SuperClass {
-
-        @Override
-        public int publicOverriddenMethod() {
-            return 'G';
-        }
-
-    }
-
-    private static class SubClassH extends SuperClass {
-
-        @Override
-        public int publicOverriddenMethod() {
-            return 'H';
-        }
-
-    }
-
-    private static final class NotInlinableSubClass extends SuperClass {
-
-        @Override
-        public int publicOverriddenMethod() {
-            return 'X';
-        }
-
-    }
-
-}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/tutorial/StaticAnalysis.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/tutorial/StaticAnalysis.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/tutorial/StaticAnalysisTests.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/tutorial/StaticAnalysisTests.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/CompilationPrinter.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/CompilationPrinter.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -99,15 +99,15 @@
     public void finish(CompilationResult result) {
         if (id != null) {
             final long stop = System.nanoTime();
-            final long duration = (stop - start) / 1000000;
+            final long duration = (stop - start) / 1000;
             final int targetCodeSize = result != null ? result.getTargetCodeSize() : -1;
             final int bytecodeSize = result != null ? result.getBytecodeSize() : 0;
             if (allocatedBytesBefore == -1) {
-                TTY.println(getMethodDescription() + String.format(" | %4dms %5dB %5dB", duration, bytecodeSize, targetCodeSize));
+                TTY.println(getMethodDescription() + String.format(" | %4dus %5dB bytecodes %5dB codesize", duration, bytecodeSize, targetCodeSize));
             } else {
                 final long allocatedBytesAfter = getCurrentThreadAllocatedBytes();
                 final long allocatedKBytes = (allocatedBytesAfter - allocatedBytesBefore) / 1024;
-                TTY.println(getMethodDescription() + String.format(" | %4dms %5dB %5dB %5dkB", duration, bytecodeSize, targetCodeSize, allocatedKBytes));
+                TTY.println(getMethodDescription() + String.format(" | %4dus %5dB bytecodes %5dB codesize %5dkB allocated", duration, bytecodeSize, targetCodeSize, allocatedKBytes));
             }
         }
     }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/CompilationWrapper.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/CompilationWrapper.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,7 @@
 import static org.graalvm.compiler.core.GraalCompilerOptions.CompilationFailureAction;
 import static org.graalvm.compiler.core.GraalCompilerOptions.ExitVMOnException;
 import static org.graalvm.compiler.core.GraalCompilerOptions.MaxCompilationProblemsPerAction;
+import static org.graalvm.compiler.core.common.GraalOptions.TrackNodeSourcePosition;
 import static org.graalvm.compiler.debug.DebugContext.VERBOSE_LEVEL;
 import static org.graalvm.compiler.debug.DebugOptions.Dump;
 import static org.graalvm.compiler.debug.DebugOptions.DumpPath;
@@ -274,7 +275,8 @@
                 OptionValues retryOptions = new OptionValues(initialOptions,
                                 Dump, ":" + VERBOSE_LEVEL,
                                 MethodFilter, null,
-                                DumpPath, dumpPath.getPath());
+                                DumpPath, dumpPath.getPath(),
+                                TrackNodeSourcePosition, true);
 
                 ByteArrayOutputStream logBaos = new ByteArrayOutputStream();
                 PrintStream ps = new PrintStream(logBaos);
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/GraalCompilerOptions.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/GraalCompilerOptions.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/LIRGenerationPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/LIRGenerationPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/gen/DebugInfoBuilder.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/gen/DebugInfoBuilder.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/gen/LIRCompilerBackend.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/gen/LIRCompilerBackend.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -145,7 +145,8 @@
             LIR lir = new LIR(schedule.getCFG(), linearScanOrder, codeEmittingOrder, graph.getOptions(), graph.getDebug());
 
             LIRGenerationProvider lirBackend = (LIRGenerationProvider) backend;
-            LIRGenerationResult lirGenRes = lirBackend.newLIRGenerationResult(graph.compilationId(), lir, registerConfig, graph, stub);
+            RegisterAllocationConfig registerAllocationConfig = backend.newRegisterAllocationConfig(registerConfig, allocationRestrictedTo);
+            LIRGenerationResult lirGenRes = lirBackend.newLIRGenerationResult(graph.compilationId(), lir, registerAllocationConfig, graph, stub);
             LIRGeneratorTool lirGen = lirBackend.newLIRGenerator(lirGenRes);
             NodeLIRBuilderTool nodeLirGen = lirBackend.newNodeLIRBuilder(graph, lirGen);
 
@@ -156,7 +157,7 @@
             try (DebugContext.Scope s = debug.scope("LIRStages", nodeLirGen, lirGenRes, lir)) {
                 // Dump LIR along with HIR (the LIR is looked up from context)
                 debug.dump(DebugContext.BASIC_LEVEL, graph.getLastSchedule(), "After LIR generation");
-                LIRGenerationResult result = emitLowLevel(backend.getTarget(), lirGenRes, lirGen, lirSuites, backend.newRegisterAllocationConfig(registerConfig, allocationRestrictedTo));
+                LIRGenerationResult result = emitLowLevel(backend.getTarget(), lirGenRes, lirGen, lirSuites, registerAllocationConfig);
                 return result;
             } catch (Throwable e) {
                 throw debug.handle(e);
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/gen/LIRGenerationProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/gen/LIRGenerationProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
 
 import org.graalvm.compiler.code.CompilationResult;
 import org.graalvm.compiler.core.common.CompilationIdentifier;
+import org.graalvm.compiler.core.common.alloc.RegisterAllocationConfig;
 import org.graalvm.compiler.lir.LIR;
 import org.graalvm.compiler.lir.asm.CompilationResultBuilder;
 import org.graalvm.compiler.lir.asm.CompilationResultBuilderFactory;
@@ -35,7 +36,6 @@
 import org.graalvm.compiler.nodes.StructuredGraph;
 import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
 
-import jdk.vm.ci.code.RegisterConfig;
 import jdk.vm.ci.meta.ResolvedJavaMethod;
 
 /**
@@ -46,7 +46,7 @@
 
     LIRGenerationResult newLIRGenerationResult(CompilationIdentifier compilationId,
                     LIR lir,
-                    RegisterConfig registerConfig,
+                    RegisterAllocationConfig registerAllocationConfig,
                     StructuredGraph graph,
                     Object stub);
 
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/gen/NodeMatchRules.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/gen/NodeMatchRules.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/match/MatchContext.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/match/MatchContext.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/match/MatchPattern.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/match/MatchPattern.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/match/MatchStatement.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/match/MatchStatement.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/match/MatchableNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/match/MatchableNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/phases/EconomyLowTier.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/phases/EconomyLowTier.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/phases/EconomyMidTier.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/phases/EconomyMidTier.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/phases/GraphChangeMonitoringPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/phases/GraphChangeMonitoringPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/phases/HighTier.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/phases/HighTier.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/phases/LowTier.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/phases/LowTier.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,6 @@
 import org.graalvm.compiler.phases.common.ExpandLogicPhase;
 import org.graalvm.compiler.phases.common.FixReadsPhase;
 import org.graalvm.compiler.phases.common.LoweringPhase;
-import org.graalvm.compiler.phases.common.OptimizeDivPhase;
 import org.graalvm.compiler.phases.common.ProfileCompiledMethodsPhase;
 import org.graalvm.compiler.phases.common.PropagateDeoptimizeProbabilityPhase;
 import org.graalvm.compiler.phases.common.UseTrappingNullChecksPhase;
@@ -73,8 +72,6 @@
 
         appendPhase(new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.LOW_TIER));
 
-        appendPhase(new OptimizeDivPhase());
-
         appendPhase(new ExpandLogicPhase());
 
         appendPhase(new FixReadsPhase(true,
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/phases/MidTier.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/phases/MidTier.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -55,6 +55,7 @@
 import org.graalvm.compiler.phases.common.LockEliminationPhase;
 import org.graalvm.compiler.phases.common.LoopSafepointInsertionPhase;
 import org.graalvm.compiler.phases.common.LoweringPhase;
+import org.graalvm.compiler.phases.common.OptimizeDivPhase;
 import org.graalvm.compiler.phases.common.VerifyHeapAtReturnPhase;
 import org.graalvm.compiler.phases.common.WriteBarrierAdditionPhase;
 import org.graalvm.compiler.phases.tiers.MidTierContext;
@@ -93,6 +94,8 @@
 
         appendPhase(new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.MID_TIER));
 
+        appendPhase(new OptimizeDivPhase());
+
         appendPhase(new FrameStateAssignmentPhase());
 
         LoopPolicies loopPolicies = createLoopPolicies();
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/target/Backend.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/target/Backend.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/DebugContext.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/DebugContext.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/DebugOptions.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/DebugOptions.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/GlobalMetrics.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/GlobalMetrics.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -86,7 +86,9 @@
             EconomicMap<MetricKey, Long> map = asKeyValueMap();
             String metricsFile = DebugOptions.AggregatedMetricsFile.getValue(options);
             boolean csv = metricsFile != null && (metricsFile.endsWith(".csv") || metricsFile.endsWith(".CSV"));
-            try (PrintStream p = metricsFile == null ? DebugContext.DEFAULT_LOG_STREAM : new PrintStream(Files.newOutputStream(Paths.get(metricsFile)))) {
+            PrintStream p = null;
+            try {
+                p = metricsFile == null ? DebugContext.DEFAULT_LOG_STREAM : new PrintStream(Files.newOutputStream(Paths.get(metricsFile)));
                 if (!csv) {
                     if (!map.isEmpty()) {
                         p.println("++ Aggregated Metrics ++");
@@ -110,6 +112,11 @@
                 }
             } catch (IOException e) {
                 e.printStackTrace();
+            } finally {
+                // Don't close DEFAULT_LOG_STREAM
+                if (metricsFile != null && p != null) {
+                    p.close();
+                }
             }
         }
 
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/IgvDumpChannel.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/IgvDumpChannel.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/MemUseTrackerKey.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/MemUseTrackerKey.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/PathUtilities.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/PathUtilities.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/TTY.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/TTY.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/Edges.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/Edges.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/Graph.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/Graph.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/IterableNodeType.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/IterableNodeType.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +27,8 @@
 /**
  * A marker for a node type supporting {@linkplain Graph#getNodes(NodeClass) fast iteration} of its
  * instances in a graph. The support for fast iteration comes with a memory cost (e.g., extra data
- * structures {@link Graph}) so only node types for which fast iteration provides a compilation
- * performance benefit should implement this interface.
+ * structures {@link Graph}) and additional bookkeeping when adding nodes, so only node types for
+ * which fast iteration provides a compilation performance benefit should implement this interface.
  */
 public interface IterableNodeType {
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/Node.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/Node.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -936,6 +936,12 @@
         }
     }
 
+    public void replaceAllInputs(Node oldInput, Node newInput) {
+        while (nodeClass.replaceFirstInput(this, oldInput, newInput)) {
+            updateUsages(oldInput, newInput);
+        }
+    }
+
     public void replaceFirstInput(Node oldInput, Node newInput, InputType type) {
         for (Position pos : inputPositions()) {
             if (pos.getInputType() == type && pos.get(this) == oldInput) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/NodeClass.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/NodeClass.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1217,8 +1217,8 @@
                     return false;
                 }
             } else {
-                Object v1 = Edges.getNodeListUnsafe(node, offset);
-                Object v2 = Edges.getNodeListUnsafe(other, offset);
+                NodeList<Node> v1 = Edges.getNodeListUnsafe(node, offset);
+                NodeList<Node> v2 = Edges.getNodeListUnsafe(other, offset);
                 if (!Objects.equals(v1, v2)) {
                     return false;
                 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/NodeList.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/NodeList.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -108,6 +108,20 @@
         }
     }
 
+    /**
+     * Removes null values from the list.
+     */
+    public void trim() {
+        int newSize = 0;
+        for (int i = 0; i < nodes.length; ++i) {
+            if (nodes[i] != null) {
+                nodes[newSize] = nodes[i];
+                newSize++;
+            }
+        }
+        size = newSize;
+    }
+
     public boolean isList() {
         return true;
     }
@@ -143,7 +157,7 @@
     @SuppressWarnings("unchecked")
     @Override
     public boolean add(Node node) {
-        assert node == null || !node.isDeleted();
+        assert node == null || !node.isDeleted() : node;
         self.incModCount();
         incModCount();
         int length = nodes.length;
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/NodeMap.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/NodeMap.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/NodeSourcePosition.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/NodeSourcePosition.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64HotSpotBackend.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64HotSpotBackend.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,7 +44,6 @@
 import org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler.ScratchRegister;
 import org.graalvm.compiler.code.CompilationResult;
 import org.graalvm.compiler.core.aarch64.AArch64NodeMatchRules;
-import org.graalvm.compiler.core.common.CompilationIdentifier;
 import org.graalvm.compiler.core.common.LIRKind;
 import org.graalvm.compiler.core.common.alloc.RegisterAllocationConfig;
 import org.graalvm.compiler.core.common.spi.ForeignCallLinkage;
@@ -89,7 +88,6 @@
 import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.meta.JavaType;
 import jdk.vm.ci.meta.ResolvedJavaMethod;
-
 import sun.misc.Unsafe;
 
 /**
@@ -101,7 +99,8 @@
         super(config, runtime, providers);
     }
 
-    private FrameMapBuilder newFrameMapBuilder(RegisterConfig registerConfig) {
+    @Override
+    protected FrameMapBuilder newFrameMapBuilder(RegisterConfig registerConfig) {
         RegisterConfig registerConfigNonNull = registerConfig == null ? getCodeCache().getRegisterConfig() : registerConfig;
         FrameMap frameMap = new AArch64FrameMap(getCodeCache(), registerConfigNonNull, this);
         return new AArch64FrameMapBuilder(frameMap, getCodeCache(), registerConfigNonNull);
@@ -113,12 +112,6 @@
     }
 
     @Override
-    public LIRGenerationResult newLIRGenerationResult(CompilationIdentifier compilationId, LIR lir, RegisterConfig registerConfig, StructuredGraph graph, Object stub) {
-        return new HotSpotLIRGenerationResult(compilationId, lir, newFrameMapBuilder(registerConfig), makeCallingConvention(graph, (Stub) stub), stub,
-                        config.requiresReservedStackCheck(graph.getMethods()));
-    }
-
-    @Override
     public NodeLIRBuilderTool newNodeLIRBuilder(StructuredGraph graph, LIRGeneratorTool lirGen) {
         return new AArch64HotSpotNodeLIRBuilder(graph, lirGen, new AArch64NodeMatchRules(lirGen));
     }
@@ -284,8 +277,7 @@
         }
 
         if (stub != null) {
-            EconomicSet<Register> destroyedCallerRegisters = gatherDestroyedCallerRegisters(lir);
-            updateStub(stub, destroyedCallerRegisters, gen.getCalleeSaveInfo(), frameMap);
+            updateStub(stub, gen, frameMap);
         }
         return crb;
     }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64HotSpotBackendFactory.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64HotSpotBackendFactory.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2018, Red Hat Inc. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -155,7 +155,8 @@
                 replacements = createReplacements(target, p, snippetReflection, bytecodeProvider);
             }
             try (InitTimer rt = timer("create GraphBuilderPhase plugins")) {
-                plugins = createGraphBuilderPlugins(compilerConfiguration, config, constantReflection, foreignCalls, metaAccess, snippetReflection, replacements, wordTypes, graalRuntime.getOptions());
+                plugins = createGraphBuilderPlugins(graalRuntime, compilerConfiguration, config, constantReflection, foreignCalls, metaAccess, snippetReflection, replacements, wordTypes,
+                                graalRuntime.getOptions());
                 replacements.setGraphBuilderPlugins(plugins);
             }
             try (InitTimer rt = timer("create Suites provider")) {
@@ -170,11 +171,27 @@
         }
     }
 
-    protected Plugins createGraphBuilderPlugins(CompilerConfiguration compilerConfiguration, GraalHotSpotVMConfig config, HotSpotConstantReflectionProvider constantReflection,
-                    HotSpotHostForeignCallsProvider foreignCalls, HotSpotMetaAccessProvider metaAccess, HotSpotSnippetReflectionProvider snippetReflection,
-                    HotSpotReplacementsImpl replacements, HotSpotWordTypes wordTypes, OptionValues options) {
-        Plugins plugins = HotSpotGraphBuilderPlugins.create(compilerConfiguration, config, wordTypes, metaAccess, constantReflection, snippetReflection, foreignCalls, replacements, options);
-        AArch64GraphBuilderPlugins.register(plugins, replacements.getDefaultReplacementBytecodeProvider(), false, //
+    protected Plugins createGraphBuilderPlugins(HotSpotGraalRuntimeProvider graalRuntime,
+                    CompilerConfiguration compilerConfiguration,
+                    GraalHotSpotVMConfig config,
+                    HotSpotConstantReflectionProvider constantReflection,
+                    HotSpotHostForeignCallsProvider foreignCalls,
+                    HotSpotMetaAccessProvider metaAccess,
+                    HotSpotSnippetReflectionProvider snippetReflection,
+                    HotSpotReplacementsImpl replacements,
+                    HotSpotWordTypes wordTypes,
+                    OptionValues options) {
+        Plugins plugins = HotSpotGraphBuilderPlugins.create(graalRuntime,
+                        compilerConfiguration,
+                        config,
+                        wordTypes,
+                        metaAccess,
+                        constantReflection,
+                        snippetReflection,
+                        foreignCalls,
+                        replacements,
+                        options);
+        AArch64GraphBuilderPlugins.register(plugins, replacements.getDefaultReplacementBytecodeProvider(), false,
                         /* registerMathPlugins */true);
         return plugins;
     }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64HotSpotForeignCallsProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64HotSpotForeignCallsProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,7 +30,7 @@
 import static jdk.vm.ci.meta.Value.ILLEGAL;
 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.JUMP_ADDRESS;
 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Reexecutability.NOT_REEXECUTABLE;
-import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.PRESERVES_REGISTERS;
+import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.DESTROYS_ALL_CALLER_SAVE_REGISTERS;
 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.LEAF;
 import static org.graalvm.compiler.hotspot.replacements.CRC32CSubstitutions.UPDATE_BYTES_CRC32C;
 import static org.graalvm.compiler.hotspot.replacements.CRC32Substitutions.UPDATE_BYTES_CRC32;
@@ -76,15 +76,17 @@
         RegisterValue exception = r0.asValue(LIRKind.reference(word));
         RegisterValue exceptionPc = r3.asValue(LIRKind.value(word));
         CallingConvention exceptionCc = new CallingConvention(0, ILLEGAL, exception, exceptionPc);
-        register(new HotSpotForeignCallLinkageImpl(HotSpotBackend.EXCEPTION_HANDLER, 0L, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE, exceptionCc, null, any()));
-        register(new HotSpotForeignCallLinkageImpl(HotSpotBackend.EXCEPTION_HANDLER_IN_CALLER, JUMP_ADDRESS, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE, exceptionCc, null, any()));
+        register(new HotSpotForeignCallLinkageImpl(HotSpotBackend.EXCEPTION_HANDLER, 0L, DESTROYS_ALL_CALLER_SAVE_REGISTERS, LEAF, NOT_REEXECUTABLE, exceptionCc, null, any()));
+        register(new HotSpotForeignCallLinkageImpl(HotSpotBackend.EXCEPTION_HANDLER_IN_CALLER, JUMP_ADDRESS, DESTROYS_ALL_CALLER_SAVE_REGISTERS, LEAF, NOT_REEXECUTABLE, exceptionCc,
+                        null,
+                        any()));
 
         // These stubs do callee saving
         if (config.useCRC32Intrinsics) {
-            registerForeignCall(UPDATE_BYTES_CRC32, config.updateBytesCRC32Stub, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE, any());
+            registerForeignCall(UPDATE_BYTES_CRC32, config.updateBytesCRC32Stub, NativeCall, LEAF, NOT_REEXECUTABLE, any());
         }
         if (config.useCRC32CIntrinsics) {
-            registerForeignCall(UPDATE_BYTES_CRC32C, config.updateBytesCRC32C, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE, any());
+            registerForeignCall(UPDATE_BYTES_CRC32C, config.updateBytesCRC32C, NativeCall, LEAF, NOT_REEXECUTABLE, any());
         }
 
         super.initialize(providers, options);
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64HotSpotJumpToExceptionHandlerInCallerOp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64HotSpotJumpToExceptionHandlerInCallerOp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64HotSpotLIRGenerator.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64HotSpotLIRGenerator.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2018, Red Hat Inc. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -38,6 +38,7 @@
 import static org.graalvm.compiler.lir.LIRValueUtil.asConstant;
 import static org.graalvm.compiler.lir.LIRValueUtil.isConstantValue;
 
+import java.util.EnumSet;
 import java.util.function.Function;
 
 import org.graalvm.compiler.asm.Label;
@@ -48,6 +49,7 @@
 import org.graalvm.compiler.core.aarch64.AArch64LIRGenerator;
 import org.graalvm.compiler.core.aarch64.AArch64LIRKindTool;
 import org.graalvm.compiler.core.common.CompressEncoding;
+import org.graalvm.compiler.core.common.GraalOptions;
 import org.graalvm.compiler.core.common.LIRKind;
 import org.graalvm.compiler.core.common.calc.Condition;
 import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor;
@@ -68,7 +70,7 @@
 import org.graalvm.compiler.lir.LIRFrameState;
 import org.graalvm.compiler.lir.LIRInstruction;
 import org.graalvm.compiler.lir.LabelRef;
-import org.graalvm.compiler.lir.StandardOp.SaveRegistersOp;
+import org.graalvm.compiler.lir.StandardOp.ZapRegistersOp;
 import org.graalvm.compiler.lir.SwitchStrategy;
 import org.graalvm.compiler.lir.Variable;
 import org.graalvm.compiler.lir.VirtualStackSlot;
@@ -82,6 +84,7 @@
 import org.graalvm.compiler.lir.aarch64.AArch64PrefetchOp;
 import org.graalvm.compiler.lir.aarch64.AArch64RestoreRegistersOp;
 import org.graalvm.compiler.lir.aarch64.AArch64SaveRegistersOp;
+import org.graalvm.compiler.lir.aarch64.AArch64ZeroMemoryOp;
 import org.graalvm.compiler.lir.gen.LIRGenerationResult;
 import org.graalvm.compiler.options.OptionValues;
 
@@ -167,10 +170,9 @@
     /**
      * @param savedRegisters the registers saved by this operation which may be subject to pruning
      * @param savedRegisterLocations the slots to which the registers are saved
-     * @param supportsRemove determines if registers can be pruned
      */
-    protected AArch64SaveRegistersOp emitSaveRegisters(Register[] savedRegisters, AllocatableValue[] savedRegisterLocations, boolean supportsRemove) {
-        AArch64SaveRegistersOp save = new AArch64SaveRegistersOp(savedRegisters, savedRegisterLocations, supportsRemove);
+    protected AArch64SaveRegistersOp emitSaveRegisters(Register[] savedRegisters, AllocatableValue[] savedRegisterLocations) {
+        AArch64SaveRegistersOp save = new AArch64SaveRegistersOp(savedRegisters, savedRegisterLocations);
         append(save);
         return save;
     }
@@ -182,7 +184,7 @@
         PlatformKind kind = target().arch.getLargestStorableKind(register.getRegisterCategory());
         if (kind.getVectorLength() > 1) {
             // we don't use vector registers, so there is no need to save them
-            kind = AArch64Kind.QWORD;
+            kind = AArch64Kind.DOUBLE;
         }
         return getResult().getFrameMapBuilder().allocateSpillSlot(LIRKind.value(kind));
     }
@@ -190,15 +192,14 @@
     /**
      * Adds a node to the graph that saves all allocatable registers to the stack.
      *
-     * @param supportsRemove determines if registers can be pruned
      * @return the register save node
      */
-    private AArch64SaveRegistersOp emitSaveAllRegisters(Register[] savedRegisters, boolean supportsRemove) {
+    private AArch64SaveRegistersOp emitSaveAllRegisters(Register[] savedRegisters) {
         AllocatableValue[] savedRegisterLocations = new AllocatableValue[savedRegisters.length];
         for (int i = 0; i < savedRegisters.length; i++) {
             savedRegisterLocations[i] = allocateSaveRegisterLocation(savedRegisters[i]);
         }
-        return emitSaveRegisters(savedRegisters, savedRegisterLocations, supportsRemove);
+        return emitSaveRegisters(savedRegisters, savedRegisterLocations);
     }
 
     protected void emitRestoreRegisters(AArch64SaveRegistersOp save) {
@@ -347,11 +348,9 @@
 
         AArch64SaveRegistersOp save = null;
         Stub stub = getStub();
-        if (destroysRegisters) {
-            if (stub != null && stub.preservesRegisters()) {
-                Register[] savedRegisters = getRegisterConfig().getAllocatableRegisters().toArray();
-                save = emitSaveAllRegisters(savedRegisters, true);
-            }
+        if (destroysRegisters && stub != null && stub.shouldSaveRegistersAroundCalls()) {
+            Register[] savedRegisters = getRegisterConfig().getAllocatableRegisters().toArray();
+            save = emitSaveAllRegisters(savedRegisters);
         }
 
         Variable result;
@@ -379,19 +378,15 @@
             result = super.emitForeignCall(hotspotLinkage, debugInfo, args);
         }
 
-        if (destroysRegisters) {
-            if (stub != null) {
-                if (stub.preservesRegisters()) {
-                    HotSpotLIRGenerationResult generationResult = getResult();
-                    LIRFrameState key = currentRuntimeCallInfo;
-                    if (key == null) {
-                        key = LIRFrameState.NO_STATE;
-                    }
-                    assert !generationResult.getCalleeSaveInfo().containsKey(key);
-                    generationResult.getCalleeSaveInfo().put(key, save);
-                    emitRestoreRegisters(save);
-                }
+        if (save != null) {
+            HotSpotLIRGenerationResult generationResult = getResult();
+            LIRFrameState key = currentRuntimeCallInfo;
+            if (key == null) {
+                key = LIRFrameState.NO_STATE;
             }
+            assert !generationResult.getCalleeSaveInfo().containsKey(key);
+            generationResult.getCalleeSaveInfo().put(key, save);
+            emitRestoreRegisters(save);
         }
 
         return result;
@@ -539,7 +534,7 @@
     }
 
     @Override
-    public SaveRegistersOp createZapRegisters(Register[] zappedRegisters, JavaConstant[] zapValues) {
+    public ZapRegistersOp createZapRegisters(Register[] zappedRegisters, JavaConstant[] zapValues) {
         throw GraalError.unimplemented();
     }
 
@@ -547,4 +542,28 @@
     public LIRInstruction createZapArgumentSpace(StackSlot[] zappedStack, JavaConstant[] zapValues) {
         throw GraalError.unimplemented();
     }
+
+    @Override
+    public void emitZeroMemory(Value address, Value length) {
+        int dczidValue = config.psrInfoDczidValue;
+        EnumSet<AArch64.Flag> flags = ((AArch64) target().arch).getFlags();
+
+        // ARMv8-A architecture reference manual D12.2.35 Data Cache Zero ID register says:
+        // * BS, bits [3:0] indicate log2 of the DC ZVA block size in (4-byte) words.
+        // * DZP, bit [4] of indicates whether use of DC ZVA instruction is prohibited.
+        int zvaLength = 4 << (dczidValue & 0xF);
+        boolean isDcZvaProhibited = ((dczidValue & 0x10) != 0);
+
+        // Use DC ZVA if it's not prohibited and AArch64 HotSpot flag UseBlockZeroing is on.
+        boolean useDcZva = !isDcZvaProhibited && flags.contains(AArch64.Flag.UseBlockZeroing);
+
+        // Set zva length negative (unknown at compile-time) for AOT compilation, since the value
+        // could be different on different AArch64 CPU implementations.
+        if (GraalOptions.ImmutableCode.getValue(getResult().getLIR().getOptions())) {
+            useDcZva = false;
+        }
+
+        // Value address is 8-byte aligned; Value length is multiple of 8.
+        append(new AArch64ZeroMemoryOp(asAllocatable(address), asAllocatable(length), useDcZva, zvaLength));
+    }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64HotSpotLoweringProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64HotSpotLoweringProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64IndirectCallOp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64IndirectCallOp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64.test/src/org/graalvm/compiler/hotspot/amd64/test/StubAVXTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64.test/src/org/graalvm/compiler/hotspot/amd64/test/StubAVXTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
 
 package org.graalvm.compiler.hotspot.amd64.test;
 
+import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.COMPUTES_REGISTERS_KILLED;
 import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.REG;
 
 import org.graalvm.compiler.api.replacements.Snippet;
@@ -234,7 +235,8 @@
     public void test() {
         HotSpotProviders providers = (HotSpotProviders) getProviders();
         HotSpotForeignCallsProviderImpl foreignCalls = (HotSpotForeignCallsProviderImpl) providers.getForeignCalls();
-        HotSpotForeignCallLinkage linkage = foreignCalls.registerStubCall(TEST_STUB, HotSpotForeignCallLinkage.Transition.LEAF_NO_VZERO, HotSpotForeignCallLinkage.Reexecutability.REEXECUTABLE);
+        HotSpotForeignCallLinkage linkage = foreignCalls.registerStubCall(TEST_STUB, HotSpotForeignCallLinkage.Transition.LEAF_NO_VZERO, HotSpotForeignCallLinkage.Reexecutability.REEXECUTABLE,
+                        COMPUTES_REGISTERS_KILLED);
         linkage.setCompiledStub(new TestStub(getInitialOptions(), providers, linkage));
         runTest("testStub");
     }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64.test/src/org/graalvm/compiler/hotspot/amd64/test/UnaryMathStubTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64.test/src/org/graalvm/compiler/hotspot/amd64/test/UnaryMathStubTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64ArrayIndexOfStub.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64ArrayIndexOfStub.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotBackend.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotBackend.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,7 +40,6 @@
 import org.graalvm.compiler.asm.amd64.AMD64MacroAssembler;
 import org.graalvm.compiler.code.CompilationResult;
 import org.graalvm.compiler.core.amd64.AMD64NodeMatchRules;
-import org.graalvm.compiler.core.common.CompilationIdentifier;
 import org.graalvm.compiler.core.common.LIRKind;
 import org.graalvm.compiler.core.common.alloc.RegisterAllocationConfig;
 import org.graalvm.compiler.core.gen.LIRGenerationProvider;
@@ -91,7 +90,8 @@
         super(config, runtime, providers);
     }
 
-    private FrameMapBuilder newFrameMapBuilder(RegisterConfig registerConfig) {
+    @Override
+    protected FrameMapBuilder newFrameMapBuilder(RegisterConfig registerConfig) {
         RegisterConfig registerConfigNonNull = registerConfig == null ? getCodeCache().getRegisterConfig() : registerConfig;
         FrameMap frameMap = new AMD64FrameMap(getCodeCache(), registerConfigNonNull, this);
         return new AMD64FrameMapBuilder(frameMap, getCodeCache(), registerConfigNonNull);
@@ -103,12 +103,6 @@
     }
 
     @Override
-    public LIRGenerationResult newLIRGenerationResult(CompilationIdentifier compilationId, LIR lir, RegisterConfig registerConfig, StructuredGraph graph, Object stub) {
-        return new HotSpotLIRGenerationResult(compilationId, lir, newFrameMapBuilder(registerConfig), makeCallingConvention(graph, (Stub) stub), stub,
-                        config.requiresReservedStackCheck(graph.getMethods()));
-    }
-
-    @Override
     public NodeLIRBuilderTool newNodeLIRBuilder(StructuredGraph graph, LIRGeneratorTool lirGen) {
         return new AMD64HotSpotNodeLIRBuilder(graph, lirGen, new AMD64NodeMatchRules(lirGen));
     }
@@ -219,8 +213,7 @@
         }
 
         if (stub != null) {
-            EconomicSet<Register> destroyedCallerRegisters = gatherDestroyedCallerRegisters(lir);
-            updateStub(stub, destroyedCallerRegisters, gen.getCalleeSaveInfo(), frameMap);
+            updateStub(stub, gen, frameMap);
         }
 
         return crb;
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotBackendFactory.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotBackendFactory.java	Tue Sep 24 15:19:35 2019 -0400
@@ -148,7 +148,8 @@
                 replacements = createReplacements(target, p, snippetReflection, bytecodeProvider);
             }
             try (InitTimer rt = timer("create GraphBuilderPhase plugins")) {
-                plugins = createGraphBuilderPlugins(compilerConfiguration, config, target, constantReflection, foreignCalls, metaAccess, snippetReflection, replacements, wordTypes, options);
+                plugins = createGraphBuilderPlugins(graalRuntime, compilerConfiguration, config, target, constantReflection, foreignCalls, metaAccess, snippetReflection, replacements, wordTypes,
+                                options);
                 replacements.setGraphBuilderPlugins(plugins);
             }
             try (InitTimer rt = timer("create Suites provider")) {
@@ -163,10 +164,28 @@
         }
     }
 
-    protected Plugins createGraphBuilderPlugins(CompilerConfiguration compilerConfiguration, GraalHotSpotVMConfig config, TargetDescription target,
-                    HotSpotConstantReflectionProvider constantReflection, HotSpotHostForeignCallsProvider foreignCalls, HotSpotMetaAccessProvider metaAccess,
-                    HotSpotSnippetReflectionProvider snippetReflection, HotSpotReplacementsImpl replacements, HotSpotWordTypes wordTypes, OptionValues options) {
-        Plugins plugins = HotSpotGraphBuilderPlugins.create(compilerConfiguration, config, wordTypes, metaAccess, constantReflection, snippetReflection, foreignCalls, replacements, options);
+    protected Plugins createGraphBuilderPlugins(HotSpotGraalRuntimeProvider graalRuntime,
+                    CompilerConfiguration compilerConfiguration,
+                    GraalHotSpotVMConfig config,
+                    TargetDescription target,
+                    HotSpotConstantReflectionProvider constantReflection,
+                    HotSpotHostForeignCallsProvider foreignCalls,
+                    HotSpotMetaAccessProvider metaAccess,
+                    HotSpotSnippetReflectionProvider snippetReflection,
+                    HotSpotReplacementsImpl replacements,
+                    HotSpotWordTypes wordTypes,
+                    OptionValues options) {
+        Plugins plugins = HotSpotGraphBuilderPlugins.create(
+                        graalRuntime,
+                        compilerConfiguration,
+                        config,
+                        wordTypes,
+                        metaAccess,
+                        constantReflection,
+                        snippetReflection,
+                        foreignCalls,
+                        replacements,
+                        options);
         AMD64GraphBuilderPlugins.register(plugins, replacements.getDefaultReplacementBytecodeProvider(), (AMD64) target.arch, false, JavaVersionUtil.JAVA_SPEC >= 9, config.useFMAIntrinsics);
         return plugins;
     }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotForeignCallsProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotForeignCallsProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -34,7 +34,8 @@
 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.JUMP_ADDRESS;
 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Reexecutability.NOT_REEXECUTABLE;
 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Reexecutability.REEXECUTABLE;
-import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.PRESERVES_REGISTERS;
+import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.COMPUTES_REGISTERS_KILLED;
+import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.DESTROYS_ALL_CALLER_SAVE_REGISTERS;
 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.LEAF;
 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.LEAF_NO_VZERO;
 import static org.graalvm.compiler.hotspot.replacements.CRC32CSubstitutions.UPDATE_BYTES_CRC32C;
@@ -89,79 +90,80 @@
         RegisterValue exception = rax.asValue(LIRKind.reference(word));
         RegisterValue exceptionPc = rdx.asValue(LIRKind.value(word));
         CallingConvention exceptionCc = new CallingConvention(0, ILLEGAL, exception, exceptionPc);
-        register(new HotSpotForeignCallLinkageImpl(EXCEPTION_HANDLER, 0L, PRESERVES_REGISTERS, LEAF_NO_VZERO, NOT_REEXECUTABLE, exceptionCc, null, any()));
-        register(new HotSpotForeignCallLinkageImpl(EXCEPTION_HANDLER_IN_CALLER, JUMP_ADDRESS, PRESERVES_REGISTERS, LEAF_NO_VZERO, NOT_REEXECUTABLE, exceptionCc, null, any()));
+        register(new HotSpotForeignCallLinkageImpl(EXCEPTION_HANDLER, 0L, DESTROYS_ALL_CALLER_SAVE_REGISTERS, LEAF_NO_VZERO, NOT_REEXECUTABLE, exceptionCc, null, any()));
+        register(new HotSpotForeignCallLinkageImpl(EXCEPTION_HANDLER_IN_CALLER, JUMP_ADDRESS, DESTROYS_ALL_CALLER_SAVE_REGISTERS, LEAF_NO_VZERO, NOT_REEXECUTABLE, exceptionCc, null,
+                        any()));
 
         if (config.useCRC32Intrinsics) {
             // This stub does callee saving
-            registerForeignCall(UPDATE_BYTES_CRC32, config.updateBytesCRC32Stub, NativeCall, PRESERVES_REGISTERS, LEAF_NO_VZERO, NOT_REEXECUTABLE, any());
+            registerForeignCall(UPDATE_BYTES_CRC32, config.updateBytesCRC32Stub, NativeCall, LEAF_NO_VZERO, NOT_REEXECUTABLE, any());
         }
         if (config.useCRC32CIntrinsics) {
-            registerForeignCall(UPDATE_BYTES_CRC32C, config.updateBytesCRC32C, NativeCall, PRESERVES_REGISTERS, LEAF_NO_VZERO, NOT_REEXECUTABLE, any());
+            registerForeignCall(UPDATE_BYTES_CRC32C, config.updateBytesCRC32C, NativeCall, LEAF_NO_VZERO, NOT_REEXECUTABLE, any());
         }
 
         link(new AMD64ArrayIndexOfStub(AMD64ArrayIndexOf.STUB_INDEX_OF_TWO_CONSECUTIVE_BYTES, options, providers,
-                        registerStubCall(AMD64ArrayIndexOf.STUB_INDEX_OF_TWO_CONSECUTIVE_BYTES, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+                        registerStubCall(AMD64ArrayIndexOf.STUB_INDEX_OF_TWO_CONSECUTIVE_BYTES, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
         link(new AMD64ArrayIndexOfStub(AMD64ArrayIndexOf.STUB_INDEX_OF_TWO_CONSECUTIVE_CHARS, options, providers,
-                        registerStubCall(AMD64ArrayIndexOf.STUB_INDEX_OF_TWO_CONSECUTIVE_CHARS, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+                        registerStubCall(AMD64ArrayIndexOf.STUB_INDEX_OF_TWO_CONSECUTIVE_CHARS, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
         link(new AMD64ArrayIndexOfStub(AMD64ArrayIndexOf.STUB_INDEX_OF_TWO_CONSECUTIVE_CHARS_COMPACT, options, providers,
-                        registerStubCall(AMD64ArrayIndexOf.STUB_INDEX_OF_TWO_CONSECUTIVE_CHARS_COMPACT, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+                        registerStubCall(AMD64ArrayIndexOf.STUB_INDEX_OF_TWO_CONSECUTIVE_CHARS_COMPACT, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
         link(new AMD64ArrayIndexOfStub(AMD64ArrayIndexOf.STUB_INDEX_OF_1_BYTE, options, providers,
-                        registerStubCall(AMD64ArrayIndexOf.STUB_INDEX_OF_1_BYTE, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+                        registerStubCall(AMD64ArrayIndexOf.STUB_INDEX_OF_1_BYTE, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
         link(new AMD64ArrayIndexOfStub(AMD64ArrayIndexOf.STUB_INDEX_OF_2_BYTES, options, providers,
-                        registerStubCall(AMD64ArrayIndexOf.STUB_INDEX_OF_2_BYTES, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+                        registerStubCall(AMD64ArrayIndexOf.STUB_INDEX_OF_2_BYTES, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
         link(new AMD64ArrayIndexOfStub(AMD64ArrayIndexOf.STUB_INDEX_OF_3_BYTES, options, providers,
-                        registerStubCall(AMD64ArrayIndexOf.STUB_INDEX_OF_3_BYTES, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+                        registerStubCall(AMD64ArrayIndexOf.STUB_INDEX_OF_3_BYTES, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
         link(new AMD64ArrayIndexOfStub(AMD64ArrayIndexOf.STUB_INDEX_OF_4_BYTES, options, providers,
-                        registerStubCall(AMD64ArrayIndexOf.STUB_INDEX_OF_4_BYTES, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+                        registerStubCall(AMD64ArrayIndexOf.STUB_INDEX_OF_4_BYTES, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
         link(new AMD64ArrayIndexOfStub(AMD64ArrayIndexOf.STUB_INDEX_OF_1_CHAR, options, providers,
-                        registerStubCall(AMD64ArrayIndexOf.STUB_INDEX_OF_1_CHAR, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+                        registerStubCall(AMD64ArrayIndexOf.STUB_INDEX_OF_1_CHAR, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
         link(new AMD64ArrayIndexOfStub(AMD64ArrayIndexOf.STUB_INDEX_OF_2_CHARS, options, providers,
-                        registerStubCall(AMD64ArrayIndexOf.STUB_INDEX_OF_2_CHARS, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+                        registerStubCall(AMD64ArrayIndexOf.STUB_INDEX_OF_2_CHARS, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
         link(new AMD64ArrayIndexOfStub(AMD64ArrayIndexOf.STUB_INDEX_OF_3_CHARS, options, providers,
-                        registerStubCall(AMD64ArrayIndexOf.STUB_INDEX_OF_3_CHARS, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+                        registerStubCall(AMD64ArrayIndexOf.STUB_INDEX_OF_3_CHARS, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
         link(new AMD64ArrayIndexOfStub(AMD64ArrayIndexOf.STUB_INDEX_OF_4_CHARS, options, providers,
-                        registerStubCall(AMD64ArrayIndexOf.STUB_INDEX_OF_4_CHARS, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+                        registerStubCall(AMD64ArrayIndexOf.STUB_INDEX_OF_4_CHARS, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
         link(new AMD64ArrayIndexOfStub(AMD64ArrayIndexOf.STUB_INDEX_OF_1_CHAR_COMPACT, options, providers,
-                        registerStubCall(AMD64ArrayIndexOf.STUB_INDEX_OF_1_CHAR_COMPACT, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+                        registerStubCall(AMD64ArrayIndexOf.STUB_INDEX_OF_1_CHAR_COMPACT, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
         link(new AMD64ArrayIndexOfStub(AMD64ArrayIndexOf.STUB_INDEX_OF_2_CHARS_COMPACT, options, providers,
-                        registerStubCall(AMD64ArrayIndexOf.STUB_INDEX_OF_2_CHARS_COMPACT, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+                        registerStubCall(AMD64ArrayIndexOf.STUB_INDEX_OF_2_CHARS_COMPACT, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
         link(new AMD64ArrayIndexOfStub(AMD64ArrayIndexOf.STUB_INDEX_OF_3_CHARS_COMPACT, options, providers,
-                        registerStubCall(AMD64ArrayIndexOf.STUB_INDEX_OF_3_CHARS_COMPACT, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+                        registerStubCall(AMD64ArrayIndexOf.STUB_INDEX_OF_3_CHARS_COMPACT, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
         link(new AMD64ArrayIndexOfStub(AMD64ArrayIndexOf.STUB_INDEX_OF_4_CHARS_COMPACT, options, providers,
-                        registerStubCall(AMD64ArrayIndexOf.STUB_INDEX_OF_4_CHARS_COMPACT, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+                        registerStubCall(AMD64ArrayIndexOf.STUB_INDEX_OF_4_CHARS_COMPACT, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
 
         link(new AMD64ArrayEqualsStub(AMD64ArrayEqualsStub.STUB_BOOLEAN_ARRAY_EQUALS, options, providers,
-                        registerStubCall(AMD64ArrayEqualsStub.STUB_BOOLEAN_ARRAY_EQUALS, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+                        registerStubCall(AMD64ArrayEqualsStub.STUB_BOOLEAN_ARRAY_EQUALS, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
         link(new AMD64ArrayEqualsStub(AMD64ArrayEqualsStub.STUB_BYTE_ARRAY_EQUALS, options, providers,
-                        registerStubCall(AMD64ArrayEqualsStub.STUB_BYTE_ARRAY_EQUALS, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+                        registerStubCall(AMD64ArrayEqualsStub.STUB_BYTE_ARRAY_EQUALS, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
         link(new AMD64ArrayEqualsStub(AMD64ArrayEqualsStub.STUB_CHAR_ARRAY_EQUALS, options, providers,
-                        registerStubCall(AMD64ArrayEqualsStub.STUB_CHAR_ARRAY_EQUALS, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+                        registerStubCall(AMD64ArrayEqualsStub.STUB_CHAR_ARRAY_EQUALS, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
         link(new AMD64ArrayEqualsStub(AMD64ArrayEqualsStub.STUB_SHORT_ARRAY_EQUALS, options, providers,
-                        registerStubCall(AMD64ArrayEqualsStub.STUB_SHORT_ARRAY_EQUALS, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+                        registerStubCall(AMD64ArrayEqualsStub.STUB_SHORT_ARRAY_EQUALS, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
         link(new AMD64ArrayEqualsStub(AMD64ArrayEqualsStub.STUB_INT_ARRAY_EQUALS, options, providers,
-                        registerStubCall(AMD64ArrayEqualsStub.STUB_INT_ARRAY_EQUALS, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+                        registerStubCall(AMD64ArrayEqualsStub.STUB_INT_ARRAY_EQUALS, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
         link(new AMD64ArrayEqualsStub(AMD64ArrayEqualsStub.STUB_LONG_ARRAY_EQUALS, options, providers,
-                        registerStubCall(AMD64ArrayEqualsStub.STUB_LONG_ARRAY_EQUALS, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+                        registerStubCall(AMD64ArrayEqualsStub.STUB_LONG_ARRAY_EQUALS, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
         link(new AMD64ArrayEqualsStub(AMD64ArrayEqualsStub.STUB_FLOAT_ARRAY_EQUALS, options, providers,
-                        registerStubCall(AMD64ArrayEqualsStub.STUB_FLOAT_ARRAY_EQUALS, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+                        registerStubCall(AMD64ArrayEqualsStub.STUB_FLOAT_ARRAY_EQUALS, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
         link(new AMD64ArrayEqualsStub(AMD64ArrayEqualsStub.STUB_DOUBLE_ARRAY_EQUALS, options, providers,
-                        registerStubCall(AMD64ArrayEqualsStub.STUB_DOUBLE_ARRAY_EQUALS, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+                        registerStubCall(AMD64ArrayEqualsStub.STUB_DOUBLE_ARRAY_EQUALS, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
         link(new AMD64ArrayEqualsStub(AMD64ArrayEqualsStub.STUB_BYTE_ARRAY_EQUALS_DIRECT, options, providers,
-                        registerStubCall(AMD64ArrayEqualsStub.STUB_BYTE_ARRAY_EQUALS_DIRECT, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+                        registerStubCall(AMD64ArrayEqualsStub.STUB_BYTE_ARRAY_EQUALS_DIRECT, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
         link(new AMD64ArrayEqualsStub(AMD64ArrayEqualsStub.STUB_CHAR_ARRAY_EQUALS_DIRECT, options, providers,
-                        registerStubCall(AMD64ArrayEqualsStub.STUB_CHAR_ARRAY_EQUALS_DIRECT, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+                        registerStubCall(AMD64ArrayEqualsStub.STUB_CHAR_ARRAY_EQUALS_DIRECT, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
         link(new AMD64ArrayEqualsStub(AMD64ArrayEqualsStub.STUB_CHAR_ARRAY_EQUALS_BYTE_ARRAY, options, providers,
-                        registerStubCall(AMD64ArrayEqualsStub.STUB_CHAR_ARRAY_EQUALS_BYTE_ARRAY, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+                        registerStubCall(AMD64ArrayEqualsStub.STUB_CHAR_ARRAY_EQUALS_BYTE_ARRAY, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
 
         link(new AMD64ArrayCompareToStub(AMD64ArrayCompareToStub.STUB_BYTE_ARRAY_COMPARE_TO_BYTE_ARRAY, options, providers,
-                        registerStubCall(AMD64ArrayCompareToStub.STUB_BYTE_ARRAY_COMPARE_TO_BYTE_ARRAY, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+                        registerStubCall(AMD64ArrayCompareToStub.STUB_BYTE_ARRAY_COMPARE_TO_BYTE_ARRAY, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
         link(new AMD64ArrayCompareToStub(AMD64ArrayCompareToStub.STUB_BYTE_ARRAY_COMPARE_TO_CHAR_ARRAY, options, providers,
-                        registerStubCall(AMD64ArrayCompareToStub.STUB_BYTE_ARRAY_COMPARE_TO_CHAR_ARRAY, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+                        registerStubCall(AMD64ArrayCompareToStub.STUB_BYTE_ARRAY_COMPARE_TO_CHAR_ARRAY, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
         link(new AMD64ArrayCompareToStub(AMD64ArrayCompareToStub.STUB_CHAR_ARRAY_COMPARE_TO_BYTE_ARRAY, options, providers,
-                        registerStubCall(AMD64ArrayCompareToStub.STUB_CHAR_ARRAY_COMPARE_TO_BYTE_ARRAY, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+                        registerStubCall(AMD64ArrayCompareToStub.STUB_CHAR_ARRAY_COMPARE_TO_BYTE_ARRAY, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
         link(new AMD64ArrayCompareToStub(AMD64ArrayCompareToStub.STUB_CHAR_ARRAY_COMPARE_TO_CHAR_ARRAY, options, providers,
-                        registerStubCall(AMD64ArrayCompareToStub.STUB_CHAR_ARRAY_COMPARE_TO_CHAR_ARRAY, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+                        registerStubCall(AMD64ArrayCompareToStub.STUB_CHAR_ARRAY_COMPARE_TO_CHAR_ARRAY, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
 
         super.initialize(providers, options);
     }
@@ -174,13 +176,13 @@
     @Override
     protected void registerMathStubs(GraalHotSpotVMConfig hotSpotVMConfig, HotSpotProviders providers, OptionValues options) {
         if (GraalArithmeticStubs.getValue(options)) {
-            link(new AMD64MathStub(SIN, options, providers, registerStubCall(SIN.foreignCallDescriptor, LEAF, REEXECUTABLE, NO_LOCATIONS)));
-            link(new AMD64MathStub(COS, options, providers, registerStubCall(COS.foreignCallDescriptor, LEAF, REEXECUTABLE, NO_LOCATIONS)));
-            link(new AMD64MathStub(TAN, options, providers, registerStubCall(TAN.foreignCallDescriptor, LEAF, REEXECUTABLE, NO_LOCATIONS)));
-            link(new AMD64MathStub(EXP, options, providers, registerStubCall(EXP.foreignCallDescriptor, LEAF, REEXECUTABLE, NO_LOCATIONS)));
-            link(new AMD64MathStub(LOG, options, providers, registerStubCall(LOG.foreignCallDescriptor, LEAF, REEXECUTABLE, NO_LOCATIONS)));
-            link(new AMD64MathStub(LOG10, options, providers, registerStubCall(LOG10.foreignCallDescriptor, LEAF, REEXECUTABLE, NO_LOCATIONS)));
-            link(new AMD64MathStub(POW, options, providers, registerStubCall(POW.foreignCallDescriptor, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+            link(new AMD64MathStub(SIN, options, providers, registerStubCall(SIN.foreignCallDescriptor, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
+            link(new AMD64MathStub(COS, options, providers, registerStubCall(COS.foreignCallDescriptor, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
+            link(new AMD64MathStub(TAN, options, providers, registerStubCall(TAN.foreignCallDescriptor, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
+            link(new AMD64MathStub(EXP, options, providers, registerStubCall(EXP.foreignCallDescriptor, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
+            link(new AMD64MathStub(LOG, options, providers, registerStubCall(LOG.foreignCallDescriptor, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
+            link(new AMD64MathStub(LOG10, options, providers, registerStubCall(LOG10.foreignCallDescriptor, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
+            link(new AMD64MathStub(POW, options, providers, registerStubCall(POW.foreignCallDescriptor, LEAF, REEXECUTABLE, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
         } else {
             super.registerMathStubs(hotSpotVMConfig, providers, options);
         }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotJumpToExceptionHandlerInCallerOp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotJumpToExceptionHandlerInCallerOp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotLIRGenerator.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotLIRGenerator.java	Tue Sep 24 15:19:35 2019 -0400
@@ -299,7 +299,7 @@
              * machine instruction actually zeros _all_ XMM registers which is fine since we know
              * that their upper half is not used.
              */
-            append(new AMD64VZeroUpper(arguments));
+            append(new AMD64VZeroUpper(arguments, getRegisterConfig()));
         }
         super.emitForeignCallOp(linkage, result, arguments, temps, info);
     }
@@ -307,10 +307,9 @@
     /**
      * @param savedRegisters the registers saved by this operation which may be subject to pruning
      * @param savedRegisterLocations the slots to which the registers are saved
-     * @param supportsRemove determines if registers can be pruned
      */
-    protected AMD64SaveRegistersOp emitSaveRegisters(Register[] savedRegisters, AllocatableValue[] savedRegisterLocations, boolean supportsRemove) {
-        AMD64SaveRegistersOp save = new AMD64SaveRegistersOp(savedRegisters, savedRegisterLocations, supportsRemove);
+    protected AMD64SaveRegistersOp emitSaveRegisters(Register[] savedRegisters, AllocatableValue[] savedRegisterLocations) {
+        AMD64SaveRegistersOp save = new AMD64SaveRegistersOp(savedRegisters, savedRegisterLocations);
         append(save);
         return save;
     }
@@ -330,15 +329,19 @@
     /**
      * Adds a node to the graph that saves all allocatable registers to the stack.
      *
-     * @param supportsRemove determines if registers can be pruned
      * @return the register save node
      */
-    private AMD64SaveRegistersOp emitSaveAllRegisters(Register[] savedRegisters, boolean supportsRemove) {
+    private AMD64SaveRegistersOp emitSaveAllRegisters() {
+        Register[] savedRegisters = getSaveableRegisters();
         AllocatableValue[] savedRegisterLocations = new AllocatableValue[savedRegisters.length];
         for (int i = 0; i < savedRegisters.length; i++) {
             savedRegisterLocations[i] = allocateSaveRegisterLocation(savedRegisters[i]);
         }
-        return emitSaveRegisters(savedRegisters, savedRegisterLocations, supportsRemove);
+        return emitSaveRegisters(savedRegisters, savedRegisterLocations);
+    }
+
+    protected Register[] getSaveableRegisters() {
+        return getResult().getRegisterAllocationConfig().getAllocatableRegisters().toArray();
     }
 
     protected void emitRestoreRegisters(AMD64SaveRegistersOp save) {
@@ -369,11 +372,8 @@
 
         AMD64SaveRegistersOp save = null;
         Stub stub = getStub();
-        if (destroysRegisters) {
-            if (stub != null && stub.preservesRegisters()) {
-                Register[] savedRegisters = getRegisterConfig().getAllocatableRegisters().toArray();
-                save = emitSaveAllRegisters(savedRegisters, true);
-            }
+        if (destroysRegisters && stub != null && stub.shouldSaveRegistersAroundCalls()) {
+            save = emitSaveAllRegisters();
         }
 
         Variable result;
@@ -392,19 +392,15 @@
             result = super.emitForeignCall(hotspotLinkage, debugInfo, args);
         }
 
-        if (destroysRegisters) {
-            if (stub != null) {
-                if (stub.preservesRegisters()) {
-                    HotSpotLIRGenerationResult generationResult = getResult();
-                    LIRFrameState key = currentRuntimeCallInfo;
-                    if (key == null) {
-                        key = LIRFrameState.NO_STATE;
-                    }
-                    assert !generationResult.getCalleeSaveInfo().containsKey(key);
-                    generationResult.getCalleeSaveInfo().put(key, save);
-                    emitRestoreRegisters(save);
-                }
+        if (save != null) {
+            HotSpotLIRGenerationResult generationResult = getResult();
+            LIRFrameState key = currentRuntimeCallInfo;
+            if (key == null) {
+                key = LIRFrameState.NO_STATE;
             }
+            assert !generationResult.getCalleeSaveInfo().containsKey(key);
+            generationResult.getCalleeSaveInfo().put(key, save);
+            emitRestoreRegisters(save);
         }
 
         return result;
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotStrategySwitchOp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotStrategySwitchOp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64X87MathIntrinsicNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64X87MathIntrinsicNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64X87MathSnippets.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64X87MathSnippets.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.jdk9.test/src/org/graalvm/compiler/hotspot/jdk9/test/MathDoubleFMATest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.jdk9.test/src/org/graalvm/compiler/hotspot/jdk9/test/MathDoubleFMATest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -34,7 +34,6 @@
 import org.graalvm.compiler.core.test.GraalCompilerTest;
 import org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider;
 import org.graalvm.compiler.runtime.RuntimeProvider;
-import org.graalvm.compiler.test.AddExports;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -44,7 +43,6 @@
 
 import jdk.vm.ci.amd64.AMD64;
 
-@AddExports({"java.base/java.lang"})
 @RunWith(Parameterized.class)
 public final class MathDoubleFMATest extends GraalCompilerTest {
 
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.jdk9.test/src/org/graalvm/compiler/hotspot/jdk9/test/MathFMAConstantInputTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.jdk9.test/src/org/graalvm/compiler/hotspot/jdk9/test/MathFMAConstantInputTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -27,13 +27,11 @@
 import static org.junit.Assume.assumeTrue;
 
 import org.graalvm.compiler.core.test.GraalCompilerTest;
-import org.graalvm.compiler.test.AddExports;
 import org.junit.Before;
 import org.junit.Test;
 
 import jdk.vm.ci.amd64.AMD64;
 
-@AddExports({"java.base/java.lang"})
 public final class MathFMAConstantInputTest extends GraalCompilerTest {
 
     @Before
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.jdk9.test/src/org/graalvm/compiler/hotspot/jdk9/test/MathFloatFMATest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.jdk9.test/src/org/graalvm/compiler/hotspot/jdk9/test/MathFloatFMATest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -34,7 +34,6 @@
 import org.graalvm.compiler.core.test.GraalCompilerTest;
 import org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider;
 import org.graalvm.compiler.runtime.RuntimeProvider;
-import org.graalvm.compiler.test.AddExports;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -44,7 +43,6 @@
 
 import jdk.vm.ci.amd64.AMD64;
 
-@AddExports({"java.base/java.lang"})
 @RunWith(Parameterized.class)
 public final class MathFloatFMATest extends GraalCompilerTest {
 
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.jdk9.test/src/org/graalvm/compiler/hotspot/jdk9/test/StringUTF16ToBytesGetCharsTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.jdk9.test/src/org/graalvm/compiler/hotspot/jdk9/test/StringUTF16ToBytesGetCharsTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.lir.test/src/org/graalvm/compiler/hotspot/lir/test/BenchmarkCounterOverflowTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.lir.test/src/org/graalvm/compiler/hotspot/lir/test/BenchmarkCounterOverflowTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -106,6 +106,7 @@
         List<String> vmArgs = withoutDebuggerArguments(getVMCommandLine());
         vmArgs.add("-XX:JVMCICounterSize=1");
         vmArgs.add("-Dgraal." + BenchmarkCounters.Options.AbortOnBenchmarkCounterOverflow.getName() + "=true");
+        vmArgs.addAll(SubprocessUtil.getPackageOpeningOptions());
         vmArgs.add("-D" + SUBPROCESS_PROPERTY + "=true");
 
         // Disable increment range checks (e.g. HotSpotCounterOp.checkIncrements())
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.sparc/src/org/graalvm/compiler/hotspot/sparc/SPARCHotSpotBackend.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.sparc/src/org/graalvm/compiler/hotspot/sparc/SPARCHotSpotBackend.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,7 +48,6 @@
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
-import jdk.internal.vm.compiler.collections.EconomicMap;
 import jdk.internal.vm.compiler.collections.EconomicSet;
 import jdk.internal.vm.compiler.collections.Equivalence;
 import org.graalvm.compiler.asm.Assembler;
@@ -60,7 +59,6 @@
 import org.graalvm.compiler.code.CompilationResult;
 import org.graalvm.compiler.code.DataSection;
 import org.graalvm.compiler.code.DataSection.Data;
-import org.graalvm.compiler.core.common.CompilationIdentifier;
 import org.graalvm.compiler.core.common.alloc.RegisterAllocationConfig;
 import org.graalvm.compiler.core.common.cfg.AbstractBlockBase;
 import org.graalvm.compiler.core.gen.LIRGenerationProvider;
@@ -77,9 +75,7 @@
 import org.graalvm.compiler.hotspot.stubs.Stub;
 import org.graalvm.compiler.lir.InstructionValueConsumer;
 import org.graalvm.compiler.lir.LIR;
-import org.graalvm.compiler.lir.LIRFrameState;
 import org.graalvm.compiler.lir.LIRInstruction;
-import org.graalvm.compiler.lir.StandardOp.SaveRegistersOp;
 import org.graalvm.compiler.lir.asm.CompilationResultBuilder;
 import org.graalvm.compiler.lir.asm.CompilationResultBuilderFactory;
 import org.graalvm.compiler.lir.asm.DataBuilder;
@@ -135,7 +131,8 @@
         }
     }
 
-    private FrameMapBuilder newFrameMapBuilder(RegisterConfig registerConfig) {
+    @Override
+    protected FrameMapBuilder newFrameMapBuilder(RegisterConfig registerConfig) {
         RegisterConfig registerConfigNonNull = registerConfig == null ? getCodeCache().getRegisterConfig() : registerConfig;
         FrameMap frameMap = new SPARCFrameMap(getCodeCache(), registerConfigNonNull, this);
         return new SPARCFrameMapBuilder(frameMap, getCodeCache(), registerConfigNonNull);
@@ -147,12 +144,6 @@
     }
 
     @Override
-    public LIRGenerationResult newLIRGenerationResult(CompilationIdentifier compilationId, LIR lir, RegisterConfig registerConfig, StructuredGraph graph, Object stub) {
-        return new HotSpotLIRGenerationResult(compilationId, lir, newFrameMapBuilder(registerConfig), makeCallingConvention(graph, (Stub) stub), stub,
-                        config.requiresReservedStackCheck(graph.getMethods()));
-    }
-
-    @Override
     public NodeLIRBuilderTool newNodeLIRBuilder(StructuredGraph graph, LIRGeneratorTool lirGen) {
         return new SPARCHotSpotNodeLIRBuilder(graph, lirGen, new SPARCNodeMatchRules(lirGen));
     }
@@ -246,10 +237,7 @@
         }
 
         if (stub != null) {
-            // Even on sparc we need to save floating point registers
-            EconomicSet<Register> destroyedCallerRegisters = gatherDestroyedCallerRegisters(lir);
-            EconomicMap<LIRFrameState, SaveRegistersOp> calleeSaveInfo = gen.getCalleeSaveInfo();
-            updateStub(stub, destroyedCallerRegisters, calleeSaveInfo, frameMap);
+            updateStub(stub, gen, frameMap);
         }
         assert registerSizePredictionValidator(crb, debug);
         return crb;
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.sparc/src/org/graalvm/compiler/hotspot/sparc/SPARCHotSpotBackendFactory.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.sparc/src/org/graalvm/compiler/hotspot/sparc/SPARCHotSpotBackendFactory.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -105,7 +105,8 @@
         HotSpotSnippetReflectionProvider snippetReflection = createSnippetReflection(runtime, constantReflection, wordTypes);
         BytecodeProvider bytecodeProvider = createBytecodeProvider(metaAccess, snippetReflection);
         HotSpotReplacementsImpl replacements = createReplacements(target, p, snippetReflection, bytecodeProvider);
-        Plugins plugins = createGraphBuilderPlugins(compilerConfiguration, config, metaAccess, constantReflection, foreignCalls, snippetReflection, replacements, wordTypes, runtime.getOptions());
+        Plugins plugins = createGraphBuilderPlugins(runtime, compilerConfiguration, config, metaAccess, constantReflection, foreignCalls, snippetReflection, replacements, wordTypes,
+                        runtime.getOptions());
         replacements.setGraphBuilderPlugins(plugins);
         HotSpotSuitesProvider suites = createSuites(config, runtime, compilerConfiguration, plugins, replacements);
         HotSpotProviders providers = new HotSpotProviders(metaAccess, codeCache, constantReflection, constantFieldProvider, foreignCalls, lowerer, replacements, suites, registers,
@@ -115,10 +116,27 @@
         return createBackend(config, runtime, providers);
     }
 
-    protected Plugins createGraphBuilderPlugins(CompilerConfiguration compilerConfiguration, GraalHotSpotVMConfig config, HotSpotMetaAccessProvider metaAccess,
-                    HotSpotConstantReflectionProvider constantReflection, HotSpotForeignCallsProvider foreignCalls,
-                    HotSpotSnippetReflectionProvider snippetReflection, HotSpotReplacementsImpl replacements, HotSpotWordTypes wordTypes, OptionValues options) {
-        Plugins plugins = HotSpotGraphBuilderPlugins.create(compilerConfiguration, config, wordTypes, metaAccess, constantReflection, snippetReflection, foreignCalls, replacements, options);
+    protected Plugins createGraphBuilderPlugins(HotSpotGraalRuntimeProvider graalRuntime,
+                    CompilerConfiguration compilerConfiguration,
+                    GraalHotSpotVMConfig config,
+                    HotSpotMetaAccessProvider metaAccess,
+                    HotSpotConstantReflectionProvider constantReflection,
+                    HotSpotForeignCallsProvider foreignCalls,
+                    HotSpotSnippetReflectionProvider snippetReflection,
+                    HotSpotReplacementsImpl replacements,
+                    HotSpotWordTypes wordTypes,
+                    OptionValues options) {
+        Plugins plugins = HotSpotGraphBuilderPlugins.create(
+                        graalRuntime,
+                        compilerConfiguration,
+                        config,
+                        wordTypes,
+                        metaAccess,
+                        constantReflection,
+                        snippetReflection,
+                        foreignCalls,
+                        replacements,
+                        options);
         SPARCGraphBuilderPlugins.register(plugins, replacements.getDefaultReplacementBytecodeProvider(), false);
         return plugins;
     }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.sparc/src/org/graalvm/compiler/hotspot/sparc/SPARCHotSpotForeignCallsProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.sparc/src/org/graalvm/compiler/hotspot/sparc/SPARCHotSpotForeignCallsProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,8 +33,8 @@
 import static org.graalvm.compiler.hotspot.HotSpotBackend.EXCEPTION_HANDLER;
 import static org.graalvm.compiler.hotspot.HotSpotBackend.EXCEPTION_HANDLER_IN_CALLER;
 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.JUMP_ADDRESS;
+import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.DESTROYS_ALL_CALLER_SAVE_REGISTERS;
 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Reexecutability.NOT_REEXECUTABLE;
-import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.PRESERVES_REGISTERS;
 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.LEAF_NO_VZERO;
 import static org.graalvm.compiler.hotspot.replacements.CRC32CSubstitutions.UPDATE_BYTES_CRC32C;
 import static org.graalvm.compiler.hotspot.replacements.CRC32Substitutions.UPDATE_BYTES_CRC32;
@@ -84,16 +84,18 @@
         RegisterValue incomingExceptionPc = i1.asValue(LIRKind.value(word));
         CallingConvention outgoingExceptionCc = new CallingConvention(0, ILLEGAL, outgoingException, outgoingExceptionPc);
         CallingConvention incomingExceptionCc = new CallingConvention(0, ILLEGAL, incomingException, incomingExceptionPc);
-        register(new HotSpotForeignCallLinkageImpl(EXCEPTION_HANDLER, 0L, PRESERVES_REGISTERS, LEAF_NO_VZERO, NOT_REEXECUTABLE, outgoingExceptionCc, incomingExceptionCc, any()));
-        register(new HotSpotForeignCallLinkageImpl(EXCEPTION_HANDLER_IN_CALLER, JUMP_ADDRESS, PRESERVES_REGISTERS, LEAF_NO_VZERO, NOT_REEXECUTABLE, outgoingExceptionCc,
+        register(new HotSpotForeignCallLinkageImpl(EXCEPTION_HANDLER, 0L, DESTROYS_ALL_CALLER_SAVE_REGISTERS, LEAF_NO_VZERO, NOT_REEXECUTABLE, outgoingExceptionCc,
+                        incomingExceptionCc,
+                        any()));
+        register(new HotSpotForeignCallLinkageImpl(EXCEPTION_HANDLER_IN_CALLER, JUMP_ADDRESS, DESTROYS_ALL_CALLER_SAVE_REGISTERS, LEAF_NO_VZERO, NOT_REEXECUTABLE, outgoingExceptionCc,
                         incomingExceptionCc, any()));
 
         if (config.useCRC32Intrinsics) {
             // This stub does callee saving
-            registerForeignCall(UPDATE_BYTES_CRC32, config.updateBytesCRC32Stub, NativeCall, PRESERVES_REGISTERS, LEAF_NO_VZERO, NOT_REEXECUTABLE, any());
+            registerForeignCall(UPDATE_BYTES_CRC32, config.updateBytesCRC32Stub, NativeCall, LEAF_NO_VZERO, NOT_REEXECUTABLE, any());
         }
         if (config.useCRC32CIntrinsics) {
-            registerForeignCall(UPDATE_BYTES_CRC32C, config.updateBytesCRC32C, NativeCall, PRESERVES_REGISTERS, LEAF_NO_VZERO, NOT_REEXECUTABLE, any());
+            registerForeignCall(UPDATE_BYTES_CRC32C, config.updateBytesCRC32C, NativeCall, LEAF_NO_VZERO, NOT_REEXECUTABLE, any());
         }
 
         super.initialize(providers, options);
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.sparc/src/org/graalvm/compiler/hotspot/sparc/SPARCHotSpotLIRGenerator.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.sparc/src/org/graalvm/compiler/hotspot/sparc/SPARCHotSpotLIRGenerator.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
 import static jdk.vm.ci.sparc.SPARCKind.XWORD;
 import static org.graalvm.compiler.lir.LIRValueUtil.asConstant;
 import static org.graalvm.compiler.lir.LIRValueUtil.isConstantValue;
+import static org.graalvm.compiler.lir.StandardOp.ZapRegistersOp;
 
 import org.graalvm.compiler.asm.sparc.SPARCAssembler;
 import org.graalvm.compiler.core.common.CompressEncoding;
@@ -53,7 +54,6 @@
 import org.graalvm.compiler.lir.LIRFrameState;
 import org.graalvm.compiler.lir.LIRInstruction;
 import org.graalvm.compiler.lir.LabelRef;
-import org.graalvm.compiler.lir.StandardOp.SaveRegistersOp;
 import org.graalvm.compiler.lir.SwitchStrategy;
 import org.graalvm.compiler.lir.Variable;
 import org.graalvm.compiler.lir.VirtualStackSlot;
@@ -349,10 +349,9 @@
     /**
      * @param savedRegisters the registers saved by this operation which may be subject to pruning
      * @param savedRegisterLocations the slots to which the registers are saved
-     * @param supportsRemove determines if registers can be pruned
      */
-    protected SPARCSaveRegistersOp emitSaveRegisters(Register[] savedRegisters, AllocatableValue[] savedRegisterLocations, boolean supportsRemove) {
-        SPARCSaveRegistersOp save = new SPARCSaveRegistersOp(savedRegisters, savedRegisterLocations, supportsRemove);
+    protected SPARCSaveRegistersOp emitSaveRegisters(Register[] savedRegisters, AllocatableValue[] savedRegisterLocations) {
+        SPARCSaveRegistersOp save = new SPARCSaveRegistersOp(savedRegisters, savedRegisterLocations);
         append(save);
         return save;
     }
@@ -402,7 +401,7 @@
     }
 
     @Override
-    public SaveRegistersOp createZapRegisters(Register[] zappedRegisters, JavaConstant[] zapValues) {
+    public ZapRegistersOp createZapRegisters(Register[] zappedRegisters, JavaConstant[] zapValues) {
         throw GraalError.unimplemented();
     }
 
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.sparc/src/org/graalvm/compiler/hotspot/sparc/SPARCHotSpotLoweringProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.sparc/src/org/graalvm/compiler/hotspot/sparc/SPARCHotSpotLoweringProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.sparc/src/org/graalvm/compiler/hotspot/sparc/SPARCHotSpotMove.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.sparc/src/org/graalvm/compiler/hotspot/sparc/SPARCHotSpotMove.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/AheadOfTimeCompilationTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/AheadOfTimeCompilationTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -179,7 +179,7 @@
         StructuredGraph result = compile("getBoxedBoolean", true);
 
         assertDeepEquals(0, result.getNodes().filter(FloatingReadNode.class).count());
-        assertDeepEquals(0, result.getNodes(PiNode.TYPE).count());
+        assertDeepEquals(0, result.getNodes().filter(PiNode.class).count());
         assertDeepEquals(1, getConstantNodes(result).count());
         ConstantNode constant = getConstantNodes(result).first();
         assertDeepEquals(JavaKind.Object, constant.getStackKind());
@@ -192,7 +192,7 @@
     public void testBoxedBoolean() {
         StructuredGraph result = compile("getBoxedBoolean", false);
         assertDeepEquals(0, result.getNodes().filter(FloatingReadNode.class).count());
-        assertDeepEquals(0, result.getNodes(PiNode.TYPE).count());
+        assertDeepEquals(0, result.getNodes().filter(PiNode.class).count());
         assertDeepEquals(1, getConstantNodes(result).count());
         ConstantNode constant = getConstantNodes(result).first();
         assertDeepEquals(JavaKind.Object, constant.getStackKind());
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/ArrayCopyIntrinsificationTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/ArrayCopyIntrinsificationTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CRC32CSubstitutionsTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CRC32CSubstitutionsTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CompilationWrapperTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CompilationWrapperTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
 
 package org.graalvm.compiler.hotspot.test;
 
+import static org.graalvm.compiler.test.SubprocessUtil.getPackageOpeningOptions;
 import static org.graalvm.compiler.test.SubprocessUtil.getVMCommandLine;
 import static org.graalvm.compiler.test.SubprocessUtil.withoutDebuggerArguments;
 
@@ -50,6 +51,13 @@
  */
 public class CompilationWrapperTest extends GraalCompilerTest {
 
+    private static List<String> join(List<String> l1, List<String> l2) {
+        ArrayList<String> result = new ArrayList<>(l1.size() + l2.size());
+        result.addAll(l1);
+        result.addAll(l2);
+        return result;
+    }
+
     /**
      * Tests compilation requested by the VM.
      */
@@ -152,10 +160,11 @@
     public void testTruffleCompilation1() throws IOException, InterruptedException {
         assumeManagementLibraryIsLoadable();
         testHelper(Collections.emptyList(),
-                        Arrays.asList(
-                                        "-Dgraal.CompilationFailureAction=ExitVM",
-                                        "-Dgraal.TrufflePerformanceWarningsAreFatal=true",
-                                        "-Dgraal.CrashAt=root test1"),
+                        join(getPackageOpeningOptions(),
+                                        Arrays.asList(
+                                                        "-Dgraal.CompilationFailureAction=ExitVM",
+                                                        "-Dgraal.TrufflePerformanceWarningsAreFatal=true",
+                                                        "-Dgraal.CrashAt=root test1")),
                         "org.graalvm.compiler.truffle.test.SLTruffleGraalTestSuite", "test");
     }
 
@@ -168,10 +177,11 @@
                         new Probe("Exiting VM due to TruffleCompilationExceptionsAreFatal=true", 1),
         };
         testHelper(Arrays.asList(probes),
-                        Arrays.asList(
-                                        "-Dgraal.CompilationFailureAction=Silent",
-                                        "-Dgraal.TruffleCompilationExceptionsAreFatal=true",
-                                        "-Dgraal.CrashAt=root test1"),
+                        join(getPackageOpeningOptions(),
+                                        Arrays.asList(
+                                                        "-Dgraal.CompilationFailureAction=Silent",
+                                                        "-Dgraal.TruffleCompilationExceptionsAreFatal=true",
+                                                        "-Dgraal.CrashAt=root test1")),
                         "org.graalvm.compiler.truffle.test.SLTruffleGraalTestSuite", "test");
     }
 
@@ -185,10 +195,11 @@
                         new Probe("Exiting VM due to TrufflePerformanceWarningsAreFatal=true", 1),
         };
         testHelper(Arrays.asList(probes),
-                        Arrays.asList(
-                                        "-Dgraal.CompilationFailureAction=Silent",
-                                        "-Dgraal.TrufflePerformanceWarningsAreFatal=true",
-                                        "-Dgraal.CrashAt=root test1:PermanentBailout"),
+                        join(getPackageOpeningOptions(),
+                                        Arrays.asList(
+                                                        "-Dgraal.CompilationFailureAction=Silent",
+                                                        "-Dgraal.TrufflePerformanceWarningsAreFatal=true",
+                                                        "-Dgraal.CrashAt=root test1:PermanentBailout")),
                         "org.graalvm.compiler.truffle.test.SLTruffleGraalTestSuite", "test");
     }
 
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CompileTheWorld.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CompileTheWorld.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,7 +30,10 @@
 import static org.graalvm.compiler.core.GraalCompilerOptions.CompilationFailureAction;
 import static org.graalvm.compiler.core.test.ReflectionOptionDescriptors.extractEntries;
 import static org.graalvm.compiler.debug.MemUseTrackerKey.getCurrentThreadAllocatedBytes;
+import static org.graalvm.compiler.hotspot.CompilationTask.CompilationTime;
+import static org.graalvm.compiler.hotspot.CompilationTask.CompiledAndInstalledBytecodes;
 import static org.graalvm.compiler.hotspot.test.CompileTheWorld.Options.DESCRIPTORS;
+import static org.graalvm.compiler.hotspot.test.CompileTheWorld.Options.InvalidateInstalledCode;
 import static sun.misc.Unsafe.ARRAY_BYTE_BASE_OFFSET;
 
 import java.io.ByteArrayOutputStream;
@@ -81,12 +84,15 @@
 import org.graalvm.compiler.core.phases.HighTier;
 import org.graalvm.compiler.core.test.ReflectionOptionDescriptors;
 import org.graalvm.compiler.debug.DebugOptions;
+import org.graalvm.compiler.debug.GlobalMetrics;
 import org.graalvm.compiler.debug.GraalError;
 import org.graalvm.compiler.debug.MethodFilter;
+import org.graalvm.compiler.debug.MetricKey;
 import org.graalvm.compiler.debug.TTY;
 import org.graalvm.compiler.hotspot.CompilationTask;
 import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig;
 import org.graalvm.compiler.hotspot.HotSpotGraalCompiler;
+import org.graalvm.compiler.hotspot.HotSpotGraalRuntime;
 import org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider;
 import org.graalvm.compiler.hotspot.test.CompileTheWorld.LibGraalParams.StackTraceBuffer;
 import org.graalvm.compiler.options.OptionDescriptors;
@@ -95,6 +101,7 @@
 import org.graalvm.compiler.options.OptionsParser;
 import org.graalvm.compiler.serviceprovider.GraalUnsafeAccess;
 import org.graalvm.compiler.serviceprovider.JavaVersionUtil;
+import org.graalvm.compiler.test.ModuleSupport;
 import jdk.internal.vm.compiler.libgraal.LibGraal;
 import jdk.internal.vm.compiler.libgraal.LibGraalScope;
 import jdk.internal.vm.compiler.libgraal.OptionsEncoder;
@@ -116,6 +123,10 @@
  */
 public final class CompileTheWorld {
 
+    static {
+        ModuleSupport.exportAndOpenAllPackagesToUnnamed("jdk.internal.vm.compiler");
+    }
+
     /**
      * Magic token to denote that JDK classes are to be compiled. For JDK 8, the classes in
      * {@code rt.jar} are compiled. Otherwise the classes in the Java runtime image are compiled.
@@ -383,7 +394,7 @@
                         Options.MaxClasses.getValue(harnessOptions),
                         Options.MethodFilter.getValue(harnessOptions),
                         Options.ExcludeMethodFilter.getValue(harnessOptions),
-                        Options.Verbose.getValue(harnessOptions),
+                        Options.Verbose.hasBeenSet(harnessOptions) ? Options.Verbose.getValue(harnessOptions) : !Options.MultiThreaded.getValue(harnessOptions),
                         harnessOptions,
                         new OptionValues(compilerOptions, parseOptions(Options.Config.getValue(harnessOptions))));
     }
@@ -419,13 +430,6 @@
         }
     }
 
-    private AutoCloseable enterCompilation() {
-        if (!LibGraal.isAvailable()) {
-            return null;
-        }
-        return new LibGraalParams(compilerOptions);
-    }
-
     public void println() {
         println("");
     }
@@ -672,7 +676,7 @@
     @SuppressWarnings("try")
     private void compile(String classPath, LibGraalParams libgraal) throws IOException {
         final String[] entries = classPath.split(File.pathSeparator);
-        long start = System.currentTimeMillis();
+        long start = System.nanoTime();
         Map<Thread, StackTraceElement[]> initialThreads = Thread.getAllStackTraces();
 
         if (libgraal == null) {
@@ -802,7 +806,7 @@
                         // Are we compiling this class?
                         if (classFileCounter >= compileStartAt) {
 
-                            long start0 = System.currentTimeMillis();
+                            long start0 = System.nanoTime();
                             // Compile each constructor/method in the class.
                             for (Constructor<?> constructor : javaClass.getDeclaredConstructors()) {
                                 HotSpotResolvedJavaMethod javaMethod = (HotSpotResolvedJavaMethod) metaAccess.lookupJavaMethod(constructor);
@@ -822,7 +826,7 @@
                             if (clinit != null && canBeCompiled(clinit, clinit.getModifiers())) {
                                 compileMethod(clinit, libgraal);
                             }
-                            println("CompileTheWorld (%d) : %s (%d ms)", classFileCounter, className, System.currentTimeMillis() - start0);
+                            println("CompileTheWorld (%d) : %s (%d us)", classFileCounter, className, (System.nanoTime() - start0) / 1000);
                         }
                     } catch (Throwable t) {
                         if (isClassIncluded(className)) {
@@ -838,9 +842,11 @@
             startThreads();
         }
         int wakeups = 0;
-        while (threadPool.getCompletedTaskCount() != threadPool.getTaskCount()) {
+        long lastCompletedTaskCount = 0;
+        for (long completedTaskCount = threadPool.getCompletedTaskCount(); completedTaskCount != threadPool.getTaskCount(); completedTaskCount = threadPool.getCompletedTaskCount()) {
             if (wakeups % 15 == 0) {
-                TTY.println("CompileTheWorld : Waiting for " + (threadPool.getTaskCount() - threadPool.getCompletedTaskCount()) + " compiles");
+                TTY.printf("CompileTheWorld : Waiting for %d compiles, just completed %d compiles%n", threadPool.getTaskCount() - completedTaskCount, completedTaskCount - lastCompletedTaskCount);
+                lastCompletedTaskCount = completedTaskCount;
             }
             try {
                 threadPool.awaitTermination(1, TimeUnit.SECONDS);
@@ -848,19 +854,32 @@
             } catch (InterruptedException e) {
             }
         }
+        threadPool.shutdown();
         threadPool = null;
 
-        long elapsedTime = System.currentTimeMillis() - start;
+        long elapsedTime = System.nanoTime() - start;
 
         println();
         int compiledClasses = classFileCounter > compileStartAt ? classFileCounter - compileStartAt : 0;
         if (Options.MultiThreaded.getValue(harnessOptions)) {
             TTY.println("CompileTheWorld : Done (%d classes, %d methods, %d ms elapsed, %d ms compile time, %d bytes of memory used)", compiledClasses, compiledMethodsCounter.get(), elapsedTime,
-                            compileTime.get(), memoryUsed.get());
+                            compileTime.get() / 1000000, memoryUsed.get());
         } else {
             TTY.println("CompileTheWorld : Done (%d classes, %d methods, %d ms, %d bytes of memory used)", compiledClasses, compiledMethodsCounter.get(), compileTime.get(), memoryUsed.get());
         }
 
+        GlobalMetrics metricValues = ((HotSpotGraalRuntime) compiler.getGraalRuntime()).getMetricValues();
+        EconomicMap<MetricKey, Long> map = metricValues.asKeyValueMap();
+        Long compiledAndInstalledBytecodes = map.get(CompiledAndInstalledBytecodes);
+        Long compilationTime = map.get(CompilationTime);
+        if (compiledAndInstalledBytecodes != null && compilationTime != null) {
+            TTY.println("CompileTheWorld : Aggregate compile speed %d bytecodes per second (%d / %d)", (int) (compiledAndInstalledBytecodes / (compilationTime / 1000000000.0)),
+                            compiledAndInstalledBytecodes, compilationTime);
+        }
+
+        metricValues.print(compilerOptions);
+        metricValues.clear();
+
         // Apart from the main thread, there should be only be daemon threads
         // alive now. If not, then a class initializer has probably started
         // a thread that could cause a deadlock while trying to exit the VM.
@@ -926,6 +945,10 @@
 
     private static final Unsafe UNSAFE = GraalUnsafeAccess.getUnsafe();
 
+    /**
+     * Implemented by
+     * {@code com.oracle.svm.graal.hotspot.libgraal.LibGraalEntryPoints.compileMethod}.
+     */
     static native long compileMethodInLibgraal(long isolateThread,
                     long methodHandle,
                     boolean useProfilingInfo,
@@ -942,7 +965,7 @@
     @SuppressWarnings("try")
     private void compileMethod(HotSpotResolvedJavaMethod method, int counter, LibGraalParams libgraal) {
         try {
-            long start = System.currentTimeMillis();
+            long start = System.nanoTime();
             long allocatedAtStart = getCurrentThreadAllocatedBytes();
             // For more stable CTW execution, disable use of profiling information
             boolean useProfilingInfo = false;
@@ -973,8 +996,8 @@
                         byte[] data = new byte[length];
                         UNSAFE.copyMemory(null, stackTraceBufferAddress + Integer.BYTES, data, ARRAY_BYTE_BASE_OFFSET, length);
                         String stackTrace = new String(data).trim();
-                        println("CompileTheWorld (%d) : Error compiling method: %s", counter, method.format("%H.%n(%p):%r"));
-                        println(stackTrace);
+                        println(true, String.format("CompileTheWorld (%d) : Error compiling method: %s", counter, method.format("%H.%n(%p):%r")));
+                        println(true, stackTrace);
                     }
                 }
             } else {
@@ -986,12 +1009,12 @@
             }
 
             // Invalidate the generated code so the code cache doesn't fill up
-            if (installedCode != null) {
+            if (installedCode != null && InvalidateInstalledCode.getValue(compilerOptions)) {
                 installedCode.invalidate();
             }
 
             memoryUsed.getAndAdd(getCurrentThreadAllocatedBytes() - allocatedAtStart);
-            compileTime.getAndAdd(System.currentTimeMillis() - start);
+            compileTime.getAndAdd(System.nanoTime() - start);
             compiledMethodsCounter.incrementAndGet();
         } catch (Throwable t) {
             // Catch everything and print a message
@@ -1048,12 +1071,13 @@
         public static final OptionKey<String> Config = new OptionKey<>(null);
         public static final OptionKey<Boolean> MultiThreaded = new OptionKey<>(false);
         public static final OptionKey<Integer> Threads = new OptionKey<>(0);
+        public static final OptionKey<Boolean> InvalidateInstalledCode = new OptionKey<>(false);
 
         // @formatter:off
         static final ReflectionOptionDescriptors DESCRIPTORS = new ReflectionOptionDescriptors(Options.class,
                            "Help", "List options and their help messages and then exit.",
                       "Classpath", "Class path denoting methods to compile. Default is to compile boot classes.",
-                        "Verbose", "Verbose operation.",
+                        "Verbose", "Verbose operation. Default is !MultiThreaded.",
                    "LimitModules", "Comma separated list of module names to which compilation should be limited. " +
                                    "Module names can be prefixed with \"~\" to exclude the named module.",
                      "Iterations", "The number of iterations to perform.",
@@ -1098,6 +1122,11 @@
 
             CompileTheWorld ctw = new CompileTheWorld(jvmciRuntime, compiler, harnessOptions, graalRuntime.getOptions());
             ctw.compile();
+            if (iterations > 1) {
+                // Force a GC to encourage reclamation of nmethods when their InstalledCode
+                // reference has been dropped.
+                System.gc();
+            }
         }
         // This is required as non-daemon threads can be started by class initializers
         System.exit(0);
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CompileTheWorldTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CompileTheWorldTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CompressedOopTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CompressedOopTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/ConstantPoolSubstitutionsTests.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/ConstantPoolSubstitutionsTests.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
 
 package org.graalvm.compiler.hotspot.test;
 
-import static org.graalvm.compiler.test.JLModule.uncheckedAddExports;
+import static org.graalvm.compiler.serviceprovider.JavaVersionUtil.JAVA_SPEC;
 
 import java.lang.reflect.Method;
 
@@ -36,7 +36,7 @@
 import org.graalvm.compiler.nodes.StructuredGraph;
 import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
 import org.graalvm.compiler.serviceprovider.JavaVersionUtil;
-import org.graalvm.compiler.test.JLModule;
+import org.graalvm.compiler.test.ModuleSupport;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.objectweb.asm.ClassWriter;
@@ -109,19 +109,12 @@
     }
 
     /**
-     * This test uses some API hidden by the JDK9 module system.
+     * This test uses some non-public API.
      */
     private static void addExports(Class<?> c) {
-        if (JavaVersionUtil.JAVA_SPEC > 8) {
-            Object javaBaseModule = JLModule.fromClass(String.class);
-            Object cModule = JLModule.fromClass(c);
-            uncheckedAddExports(javaBaseModule, "jdk.internal.reflect", cModule);
-            if (JavaVersionUtil.JAVA_SPEC <= 11) {
-                uncheckedAddExports(javaBaseModule, "jdk.internal.misc", cModule);
-            } else {
-                uncheckedAddExports(javaBaseModule, "jdk.internal.access", cModule);
-            }
-        }
+        String packageName = JAVA_SPEC <= 11 ? "jdk.internal.misc" : "jdk.internal.access";
+        ModuleSupport.exportPackageTo(String.class, packageName, c);
+        ModuleSupport.exportPackageTo(String.class, "jdk.internal.reflect", c);
     }
 
     @Test
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/EliminateRedundantInitializationPhaseTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/EliminateRedundantInitializationPhaseTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
 package org.graalvm.compiler.hotspot.test;
 
 import org.graalvm.compiler.core.test.GraalCompilerTest;
-import org.graalvm.compiler.hotspot.meta.HotSpotClassInitializationPlugin;
+import org.graalvm.compiler.hotspot.meta.HotSpotAOTClassInitializationPlugin;
 import org.graalvm.compiler.hotspot.nodes.aot.InitializeKlassNode;
 import org.graalvm.compiler.hotspot.phases.aot.EliminateRedundantInitializationPhase;
 import org.graalvm.compiler.nodes.StructuredGraph;
@@ -39,7 +39,7 @@
     @Override
     protected Plugins getDefaultGraphBuilderPlugins() {
         Plugins plugins = super.getDefaultGraphBuilderPlugins();
-        plugins.setClassInitializationPlugin(new HotSpotClassInitializationPlugin());
+        plugins.setClassInitializationPlugin(new HotSpotAOTClassInitializationPlugin());
         return plugins;
     }
 
@@ -219,6 +219,8 @@
 
     @Test
     public void test12() {
+        // Force initialization of SomeClass
+        SomeClass.inlinedMethod();
         test("invokestaticInlined", 1, 1);
     }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/GraalOSRTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/GraalOSRTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/GraalOSRTestBase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/GraalOSRTestBase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/HotSpotClassInitializationTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.graalvm.compiler.hotspot.test;
+
+import static org.junit.Assert.assertNotEquals;
+
+import org.graalvm.compiler.api.directives.GraalDirectives;
+import org.graalvm.compiler.graph.Node;
+import org.graalvm.compiler.hotspot.nodes.KlassBeingInitializedCheckNode;
+import org.graalvm.compiler.nodes.DeoptimizeNode;
+import org.graalvm.compiler.nodes.StructuredGraph;
+import org.graalvm.compiler.nodes.java.LoadFieldNode;
+import org.graalvm.compiler.nodes.java.NewInstanceNode;
+import org.junit.Assert;
+import org.junit.Assume;
+import org.junit.Before;
+import org.junit.Test;
+
+import jdk.vm.ci.code.InstalledCode;
+import jdk.vm.ci.code.InvalidInstalledCodeException;
+import jdk.vm.ci.meta.DeoptimizationReason;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+
+public class HotSpotClassInitializationTest extends HotSpotGraalCompilerTest {
+
+    static HotSpotClassInitializationTest instance;
+
+    static class InvokeStatic {
+        static {
+            instance.test(InvokeStatic.class, "m");
+        }
+
+        static boolean m() {
+            double value = 123;
+            doOtherWork(value);
+            return GraalDirectives.inCompiledCode();
+        }
+
+        static double doOtherWork(double value) {
+            return value;
+        }
+
+        static int field;
+    }
+
+    static class GetStatic {
+        static class Inner {
+            static int N = 5000;
+
+            static {
+                instance.test(GetStatic.class, "m", LoadFieldNode.class);
+            }
+        }
+
+        static {
+            @SuppressWarnings("unused")
+            int n = Inner.N;
+        }
+
+        @SuppressWarnings("unused")
+        static boolean m() {
+            double value = 123 * Inner.N;
+            return GraalDirectives.inCompiledCode();
+        }
+
+        static double field;
+    }
+
+    static class NewInstance {
+        static {
+            instance.test(NewInstance.class, "m", NewInstanceNode.class);
+        }
+
+        @SuppressWarnings("unused")
+        static boolean m() {
+            Object o = new NewInstance();
+            return GraalDirectives.inCompiledCode();
+        }
+
+        static double field;
+    }
+
+    @Before
+    public void checkAssumptions() {
+        // cannot be BeforeClass because we need a runtime and BeforeClass must be static
+        Assume.assumeTrue("init_thread field must be visible", runtime().getVMConfig().instanceKlassInitThreadOffset != -1);
+    }
+
+    @SafeVarargs
+    final void test(Class<?> testClass, String methodName, Class<? extends Node>... nodeTypes) {
+        ResolvedJavaMethod method = getResolvedJavaMethod(testClass, methodName);
+        StructuredGraph graph = parseProfiled(method, StructuredGraph.AllowAssumptions.NO);
+        for (DeoptimizeNode d : graph.getNodes().filter(DeoptimizeNode.class)) {
+            assertNotEquals("No unresolved deopts expected", d.getReason(), DeoptimizationReason.Unresolved);
+        }
+        assertTrue("A dynamic check should have been emitted", graph.getNodes().filter(KlassBeingInitializedCheckNode.class).count() == 1);
+
+        // Ensure that all expected nodes exist.
+        for (Class<? extends Node> nodeType : nodeTypes) {
+            assertTrue("expected node of type " + nodeType, graph.getNodes().filter(nodeType).count() == 1);
+        }
+
+        // Ensure that execution remains in the compiled code to the return point
+        InstalledCode code = instance.getCode(method, graph);
+        try {
+            boolean result = (boolean) code.executeVarargs();
+            Assert.assertEquals("should have completed in compiled code", result, true);
+        } catch (InvalidInstalledCodeException e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    public void testInvokeStatic() {
+        GraalDirectives.inCompiledCode();
+        instance = this;
+        InvokeStatic.field = 0;
+        instance = null;
+    }
+
+    @Test
+    public void testGetStatic() {
+        GraalDirectives.inCompiledCode();
+        instance = this;
+        GetStatic.field = 0;
+        instance = null;
+    }
+
+    @Test
+    public void testNewInstance() {
+        GraalDirectives.inCompiledCode();
+        instance = this;
+        NewInstance.field = 0;
+        instance = null;
+    }
+
+}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/HotSpotCryptoSubstitutionTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/HotSpotCryptoSubstitutionTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/HotSpotGraalCompilerTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/HotSpotGraalCompilerTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/HotSpotGraalManagementTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/HotSpotGraalManagementTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/HotSpotInvokeDynamicPluginTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/HotSpotInvokeDynamicPluginTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
 import java.util.function.IntPredicate;
 
 import org.graalvm.compiler.core.common.GraalOptions;
-import org.graalvm.compiler.hotspot.meta.HotSpotClassInitializationPlugin;
+import org.graalvm.compiler.hotspot.meta.HotSpotAOTClassInitializationPlugin;
 import org.graalvm.compiler.hotspot.meta.HotSpotInvokeDynamicPlugin;
 import org.graalvm.compiler.hotspot.nodes.aot.ResolveDynamicConstantNode;
 import org.graalvm.compiler.hotspot.nodes.aot.ResolveDynamicStubCall;
@@ -59,7 +59,7 @@
     @Override
     protected Plugins getDefaultGraphBuilderPlugins() {
         Plugins plugins = super.getDefaultGraphBuilderPlugins();
-        plugins.setClassInitializationPlugin(new HotSpotClassInitializationPlugin());
+        plugins.setClassInitializationPlugin(new HotSpotAOTClassInitializationPlugin());
         plugins.setInvokeDynamicPlugin(new HotSpotInvokeDynamicPlugin() {
             @Override
             public boolean isResolvedDynamicInvoke(GraphBuilderContext builder, int index, int opcode) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/HotSpotLazyInitializationTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/HotSpotLazyInitializationTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
 package org.graalvm.compiler.hotspot.test;
 
 import org.graalvm.compiler.core.test.GraalCompilerTest;
-import org.graalvm.compiler.hotspot.meta.HotSpotClassInitializationPlugin;
+import org.graalvm.compiler.hotspot.meta.HotSpotAOTClassInitializationPlugin;
 import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
 import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins;
 import org.junit.Assert;
@@ -36,7 +36,7 @@
 
 public class HotSpotLazyInitializationTest extends GraalCompilerTest {
 
-    HotSpotClassInitializationPlugin classInitPlugin = new HotSpotClassInitializationPlugin();
+    HotSpotAOTClassInitializationPlugin classInitPlugin = new HotSpotAOTClassInitializationPlugin();
 
     @Override
     protected Plugins getDefaultGraphBuilderPlugins() {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/HotSpotMethodSubstitutionTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/HotSpotMethodSubstitutionTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/HsErrLogTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/HsErrLogTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -57,6 +57,8 @@
         List<String> args = new ArrayList<>();
         if (JavaVersionUtil.JAVA_SPEC <= 8) {
             args.add("-XX:-UseJVMCIClassLoader");
+        } else {
+            args.add("--add-exports=jdk.internal.vm.compiler/org.graalvm.compiler.api.directives=ALL-UNNAMED");
         }
         args.add("-XX:+UseJVMCICompiler");
         args.add("-XX:CompileOnly=" + Crasher.class.getName() + "::tryCrash");
@@ -90,7 +92,7 @@
             }
         }
 
-        Assert.fail("Could not find " + re.pattern());
+        Assert.fail(String.format("Could not find %s%n%s", re.pattern(), proc));
     }
 
     private static void checkHsErr(File hsErrPath) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/JVMCIInfopointErrorTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/JVMCIInfopointErrorTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/LoadJavaMirrorWithKlassTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/LoadJavaMirrorWithKlassTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/MemoryUsageBenchmark.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/MemoryUsageBenchmark.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/ObjectHashCodeInliningTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/ObjectHashCodeInliningTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -24,15 +24,21 @@
 
 package org.graalvm.compiler.hotspot.test;
 
-import jdk.vm.ci.meta.ResolvedJavaMethod;
 import org.graalvm.compiler.core.test.GraalCompilerTest;
+import org.graalvm.compiler.java.BytecodeParserOptions;
 import org.graalvm.compiler.nodes.StructuredGraph;
 import org.graalvm.compiler.nodes.extended.ForeignCallNode;
 import org.graalvm.compiler.nodes.java.MethodCallTargetNode;
 import org.graalvm.compiler.nodes.memory.ReadNode;
-import org.junit.Assume;
+import org.graalvm.compiler.options.OptionValues;
 import org.junit.Test;
 
+import jdk.vm.ci.meta.JavaTypeProfile;
+import jdk.vm.ci.meta.JavaTypeProfile.ProfiledType;
+import jdk.vm.ci.meta.MetaAccessProvider;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.meta.TriState;
+
 public class ObjectHashCodeInliningTest extends GraalCompilerTest {
 
     public static int getHash(Object obj) {
@@ -40,18 +46,21 @@
     }
 
     @Test
-    public void testInstallCodeInvalidation() {
-        for (int i = 0; i < 100000; i++) {
-            getHash(i % 10 == 0 ? new Object() : "");
-        }
+    public void testGetHash() {
+        MetaAccessProvider metaAccess = getMetaAccess();
+        ProfiledType[] injectedProfile = {
+                        new ProfiledType(metaAccess.lookupJavaType(String.class), 0.9D),
+                        new ProfiledType(metaAccess.lookupJavaType(Object.class), 0.1D)};
 
         ResolvedJavaMethod method = getResolvedJavaMethod("getHash");
-        StructuredGraph graph = parseForCompile(method);
+        StructuredGraph graph = parseForCompile(method,
+                        new OptionValues(getInitialOptions(), BytecodeParserOptions.InlineDuringParsing, false, BytecodeParserOptions.InlineIntrinsicsDuringParsing, false));
         for (MethodCallTargetNode callTargetNode : graph.getNodes(MethodCallTargetNode.TYPE)) {
             if ("Object.hashCode".equals(callTargetNode.targetName())) {
-                Assume.assumeTrue(callTargetNode.getProfile() != null);
+                callTargetNode.setJavaTypeProfile(new JavaTypeProfile(TriState.FALSE, 0.0D, injectedProfile));
             }
         }
+
         compile(method, graph);
     }
 
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/OptionsInFileTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/OptionsInFileTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/PolymorphicInliningTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,179 @@
+/*
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.graalvm.compiler.hotspot.test;
+
+import org.graalvm.compiler.core.test.GraalCompilerTest;
+import org.graalvm.compiler.graph.Node;
+import org.graalvm.compiler.java.BytecodeParserOptions;
+import org.graalvm.compiler.nodes.AbstractDeoptimizeNode;
+import org.graalvm.compiler.nodes.InvokeNode;
+import org.graalvm.compiler.nodes.StructuredGraph;
+import org.graalvm.compiler.nodes.java.MethodCallTargetNode;
+import org.graalvm.compiler.nodes.java.TypeSwitchNode;
+import org.graalvm.compiler.options.OptionValues;
+import org.junit.Before;
+import org.junit.Test;
+
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
+import jdk.vm.ci.meta.JavaTypeProfile;
+import jdk.vm.ci.meta.JavaTypeProfile.ProfiledType;
+import jdk.vm.ci.meta.MetaAccessProvider;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.meta.TriState;
+
+public class PolymorphicInliningTest extends GraalCompilerTest {
+
+    @Before
+    public void initializeNotInlinableMethod() {
+        ((HotSpotResolvedJavaMethod) getResolvedJavaMethod(NotInlinableSubClass.class, "foo")).setNotInlinableOrCompilable();
+        // Resolve classes
+        new A().foo();
+        new B().foo();
+        new NotInlinableSubClass().foo();
+    }
+
+    public int snippet(SuperClass receiver) {
+        return receiver.foo();
+    }
+
+    @Test
+    public void testBimorphicInlined() {
+        ResolvedJavaMethod method = getResolvedJavaMethod("snippet");
+        StructuredGraph graph = parseForCompile(method, disableInlineDuringParsing());
+
+        MetaAccessProvider metaAccess = getMetaAccess();
+        ProfiledType[] injectedProfile = {
+                        new ProfiledType(metaAccess.lookupJavaType(A.class), 0.5D),
+                        new ProfiledType(metaAccess.lookupJavaType(B.class), 0.5D)};
+        injectTypeProfile(graph, "PolymorphicInliningTest$SuperClass.foo", new JavaTypeProfile(TriState.FALSE, 0.0D, injectedProfile));
+
+        createInliningPhase().apply(graph, getDefaultHighTierContext());
+
+        // This callsite should be inlined with a TypeCheckedInliningViolated deoptimization.
+        assertTrue(getNodeCount(graph, InvokeNode.class) == 0);
+        assertTrue(getNodeCount(graph, TypeSwitchNode.class) == 1);
+        assertTrue(getNodeCount(graph, AbstractDeoptimizeNode.class) == 1);
+    }
+
+    @Test
+    public void testBimorphicNotInlined() {
+        ResolvedJavaMethod method = getResolvedJavaMethod("snippet");
+        StructuredGraph graph = parseForCompile(method, disableInlineDuringParsing());
+
+        MetaAccessProvider metaAccess = getMetaAccess();
+        ProfiledType[] injectedProfile = {
+                        new ProfiledType(metaAccess.lookupJavaType(A.class), 0.8D),
+                        new ProfiledType(metaAccess.lookupJavaType(NotInlinableSubClass.class), 0.2D)};
+        injectTypeProfile(graph, "PolymorphicInliningTest$SuperClass.foo", new JavaTypeProfile(TriState.FALSE, 0.0D, injectedProfile));
+
+        createInliningPhase().apply(graph, getDefaultHighTierContext());
+
+        // This callsite is not inlined due to one of the potential callee method is not inlinable.
+        assertTrue(getNodeCount(graph, InvokeNode.class) == 1);
+        assertTrue(getNodeCount(graph, TypeSwitchNode.class) == 0);
+        assertTrue(getNodeCount(graph, AbstractDeoptimizeNode.class) == 0);
+    }
+
+    @Test
+    public void testMegamorphicInlined() {
+        ResolvedJavaMethod method = getResolvedJavaMethod("snippet");
+        StructuredGraph graph = parseForCompile(method, disableInlineDuringParsing());
+
+        MetaAccessProvider metaAccess = getMetaAccess();
+        ProfiledType[] injectedProfile = {
+                        new ProfiledType(metaAccess.lookupJavaType(A.class), 0.79D),
+                        new ProfiledType(metaAccess.lookupJavaType(NotInlinableSubClass.class), 0.2D)};
+        injectTypeProfile(graph, "PolymorphicInliningTest$SuperClass.foo", new JavaTypeProfile(TriState.FALSE, 0.01D, injectedProfile));
+
+        createInliningPhase().apply(graph, getDefaultHighTierContext());
+
+        assertTrue(getNodeCount(graph, InvokeNode.class) == 1);
+        assertTrue(getNodeCount(graph, TypeSwitchNode.class) == 1);
+        assertTrue(getNodeCount(graph, AbstractDeoptimizeNode.class) == 0);
+    }
+
+    @Test
+    public void testMegamorphicNotInlined() {
+        ResolvedJavaMethod method = getResolvedJavaMethod("snippet");
+        StructuredGraph graph = parseForCompile(method, disableInlineDuringParsing());
+
+        MetaAccessProvider metaAccess = getMetaAccess();
+        ProfiledType[] injectedProfile = {
+                        new ProfiledType(metaAccess.lookupJavaType(A.class), 0.3D),
+                        new ProfiledType(metaAccess.lookupJavaType(B.class), 0.3D),
+                        new ProfiledType(metaAccess.lookupJavaType(NotInlinableSubClass.class), 0.3D)};
+        injectTypeProfile(graph, "PolymorphicInliningTest$SuperClass.foo", new JavaTypeProfile(TriState.FALSE, 0.1D, injectedProfile));
+
+        createInliningPhase().apply(graph, getDefaultHighTierContext());
+
+        // This callsite should not be inlined due to non of the potential callee method exceeds the
+        // probability specified by GraalOptions.MegamorphicInliningMinMethodProbability.
+        assertTrue(getNodeCount(graph, InvokeNode.class) == 1);
+        assertTrue(getNodeCount(graph, TypeSwitchNode.class) == 0);
+        assertTrue(getNodeCount(graph, AbstractDeoptimizeNode.class) == 0);
+    }
+
+    private static OptionValues disableInlineDuringParsing() {
+        return new OptionValues(getInitialOptions(), BytecodeParserOptions.InlineDuringParsing, false, BytecodeParserOptions.InlineIntrinsicsDuringParsing, false);
+    }
+
+    private static void injectTypeProfile(StructuredGraph graph, String targetMethod, JavaTypeProfile profile) {
+        for (MethodCallTargetNode callTargetNode : graph.getNodes(MethodCallTargetNode.TYPE)) {
+            if (targetMethod.equals(callTargetNode.targetName())) {
+                callTargetNode.setJavaTypeProfile(profile);
+            }
+        }
+    }
+
+    private static int getNodeCount(StructuredGraph graph, Class<? extends Node> nodeClass) {
+        return graph.getNodes().filter(nodeClass).count();
+    }
+
+    private abstract static class SuperClass {
+        abstract int foo();
+    }
+
+    private static class A extends SuperClass {
+        @Override
+        public int foo() {
+            return 'A';
+        }
+    }
+
+    private static class B extends SuperClass {
+        @Override
+        public int foo() {
+            return 'B';
+        }
+    }
+
+    private static class NotInlinableSubClass extends SuperClass {
+        @Override
+        public int foo() {
+            return 'X';
+        }
+    }
+
+}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/ReplaceConstantNodesPhaseTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/ReplaceConstantNodesPhaseTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
 
 import org.graalvm.compiler.core.common.GraalOptions;
 import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig;
-import org.graalvm.compiler.hotspot.meta.HotSpotClassInitializationPlugin;
+import org.graalvm.compiler.hotspot.meta.HotSpotAOTClassInitializationPlugin;
 import org.graalvm.compiler.hotspot.nodes.aot.InitializeKlassNode;
 import org.graalvm.compiler.hotspot.nodes.aot.LoadConstantIndirectlyNode;
 import org.graalvm.compiler.hotspot.nodes.aot.ResolveConstantNode;
@@ -50,7 +50,7 @@
     @Override
     protected Plugins getDefaultGraphBuilderPlugins() {
         Plugins plugins = super.getDefaultGraphBuilderPlugins();
-        plugins.setClassInitializationPlugin(new HotSpotClassInitializationPlugin());
+        plugins.setClassInitializationPlugin(new HotSpotAOTClassInitializationPlugin());
         return plugins;
     }
 
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/ReservedStackAccessTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/ReservedStackAccessTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,12 +25,11 @@
 package org.graalvm.compiler.hotspot.test;
 
 import java.io.IOException;
+import java.util.List;
 import java.util.concurrent.locks.ReentrantLock;
-import java.util.List;
 
 import org.graalvm.compiler.test.SubprocessUtil;
 import org.graalvm.compiler.test.SubprocessUtil.Subprocess;
-
 import org.junit.Assume;
 import org.junit.Before;
 import org.junit.Test;
@@ -73,6 +72,7 @@
         vmArgs.add("-XX:+UseJVMCICompiler");
         vmArgs.add("-Dgraal.Inline=false");
         vmArgs.add("-XX:CompileCommand=exclude,java/util/concurrent/locks/AbstractOwnableSynchronizer.setExclusiveOwnerThread");
+        vmArgs.addAll(SubprocessUtil.getPackageOpeningOptions());
 
         // Avoid SOE in HotSpotJVMCIRuntime.adjustCompilationLevel
         vmArgs.add("-Dgraal.CompileGraalWithC1Only=false");
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/TestIntrinsicCompiles.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/TestIntrinsicCompiles.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/WriteBarrierAdditionTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/WriteBarrierAdditionTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,18 +28,16 @@
 
 import java.lang.ref.WeakReference;
 
-import org.graalvm.compiler.api.replacements.Fold;
+import org.graalvm.compiler.api.test.Graal;
 import org.graalvm.compiler.debug.DebugContext;
 import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig;
-import org.graalvm.compiler.hotspot.GraalHotSpotVMConfigBase;
+import org.graalvm.compiler.hotspot.HotSpotBackend;
 import org.graalvm.compiler.nodes.StructuredGraph;
 import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
 import org.graalvm.compiler.nodes.gc.G1PostWriteBarrier;
 import org.graalvm.compiler.nodes.gc.G1PreWriteBarrier;
 import org.graalvm.compiler.nodes.gc.G1ReferentFieldReadBarrier;
 import org.graalvm.compiler.nodes.gc.SerialWriteBarrier;
-import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins;
-import org.graalvm.compiler.nodes.graphbuilderconf.NodeIntrinsicPluginFactory;
 import org.graalvm.compiler.nodes.memory.HeapAccess.BarrierType;
 import org.graalvm.compiler.nodes.memory.ReadNode;
 import org.graalvm.compiler.nodes.memory.WriteNode;
@@ -54,7 +52,7 @@
 import org.graalvm.compiler.phases.common.inlining.policy.InlineEverythingPolicy;
 import org.graalvm.compiler.phases.tiers.HighTierContext;
 import org.graalvm.compiler.phases.tiers.MidTierContext;
-import org.graalvm.compiler.replacements.NodeIntrinsificationProvider;
+import org.graalvm.compiler.runtime.RuntimeProvider;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -161,29 +159,18 @@
     static Container con = new Container();
 
     /**
-     * Expected 4 barriers for the Serial GC and 9 for G1 (1 ref + 4 pre + 4 post). In this test, we
-     * load the correct offset of the WeakReference object so naturally we assert the presence of
-     * the pre barrier.
+     * Expected 0 barrier for the Serial GC and 1 for G1. In this test, we load the correct offset
+     * of the WeakReference object so naturally we assert the presence of the pre barrier.
      */
     @Test
     public void test5() throws Exception {
         testHelper("test5Snippet", config.useG1GC ? 1 : 0);
     }
 
-    @Override
-    protected void registerInvocationPlugins(InvocationPlugins invocationPlugins) {
-        NodeIntrinsicPluginFactory.InjectionProvider injection = new NodeIntrinsificationProvider(getMetaAccess(), getSnippetReflection(), getProviders().getForeignCalls(), null);
-        new PluginFactory_WriteBarrierAdditionTest().registerPlugins(invocationPlugins, injection);
-        super.registerInvocationPlugins(invocationPlugins);
-    }
+    private static final boolean useCompressedOops = ((HotSpotBackend) Graal.getRequiredCapability(RuntimeProvider.class).getHostBackend()).getRuntime().getVMConfig().useCompressedOops;
 
-    @Fold
-    public static boolean useCompressedOops(@Fold.InjectedParameter GraalHotSpotVMConfig config) {
-        return config.useCompressedOops;
-    }
-
-    public static Object test5Snippet() throws Exception {
-        return UNSAFE.getObject(wr, useCompressedOops(GraalHotSpotVMConfigBase.INJECTED_VMCONFIG) ? 12L : 16L);
+    public Object test5Snippet() {
+        return UNSAFE.getObject(wr, useCompressedOops ? 12L : 16L);
     }
 
     /**
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/BootstrapWatchDog.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/BootstrapWatchDog.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/CompilationCounters.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/CompilationCounters.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/CompilationTask.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/CompilationTask.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -278,7 +278,7 @@
     /**
      * Time spent in compilation.
      */
-    private static final TimerKey CompilationTime = DebugContext.timer("CompilationTime").doc("Time spent in compilation and code installation.");
+    public static final TimerKey CompilationTime = DebugContext.timer("CompilationTime").doc("Time spent in compilation and code installation.");
 
     /**
      * Counts the number of compiled {@linkplain CompilationResult#getBytecodeSize() bytecodes}.
@@ -289,7 +289,7 @@
      * Counts the number of compiled {@linkplain CompilationResult#getBytecodeSize() bytecodes} for
      * which {@linkplain CompilationResult#getTargetCode()} code was installed.
      */
-    private static final CounterKey CompiledAndInstalledBytecodes = DebugContext.counter("CompiledAndInstalledBytecodes");
+    public static final CounterKey CompiledAndInstalledBytecodes = DebugContext.counter("CompiledAndInstalledBytecodes");
 
     /**
      * Counts the number of installed {@linkplain CompilationResult#getTargetCodeSize()} bytes.
@@ -303,8 +303,8 @@
 
     public HotSpotCompilationRequestResult runCompilation(OptionValues initialOptions) {
         OptionValues options = filterOptions(initialOptions);
-        SnippetReflectionProvider snippetReflection = compiler.getGraalRuntime().getHostProviders().getSnippetReflection();
-        try (DebugContext debug = DebugContext.create(options, new GraalDebugHandlersFactory(snippetReflection))) {
+        HotSpotGraalRuntimeProvider graalRuntime = compiler.getGraalRuntime();
+        try (DebugContext debug = graalRuntime.openDebugContext(options, compilationId, getMethod(), compiler.getDebugHandlersFactories(), DebugContext.DEFAULT_LOG_STREAM)) {
             return runCompilation(debug);
         }
     }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/CompilationWatchDog.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/CompilationWatchDog.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/CompilerConfigurationFactory.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/CompilerConfigurationFactory.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,6 @@
 
 import static jdk.vm.ci.common.InitTimer.timer;
 
-import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -52,6 +51,7 @@
 
 import jdk.vm.ci.code.Architecture;
 import jdk.vm.ci.common.InitTimer;
+import jdk.vm.ci.services.Services;
 
 /**
  * A factory that creates the {@link CompilerConfiguration} the compiler will use. Each factory must
@@ -247,7 +247,7 @@
     }
 
     private static void printConfigInfo(CompilerConfigurationFactory factory) {
-        URL location = factory.getClass().getResource(factory.getClass().getSimpleName() + ".class");
+        Object location = Services.IS_IN_NATIVE_IMAGE ? "JVMCI native library" : factory.getClass().getResource(factory.getClass().getSimpleName() + ".class");
         TTY.printf("Using compiler configuration '%s' provided by %s loaded from %s%n", factory.name, factory.getClass().getName(), location);
     }
 
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/GraalHotSpotVMConfig.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/GraalHotSpotVMConfig.java	Tue Sep 24 15:19:35 2019 -0400
@@ -54,6 +54,7 @@
 
     private final CompressEncoding oopEncoding;
     private final CompressEncoding klassEncoding;
+    private final String markWord = versioned.markWordFieldType;
 
     public CompressEncoding getOopEncoding() {
         return oopEncoding;
@@ -208,46 +209,18 @@
     public final int stackBias = getConstant("STACK_BIAS", Integer.class);
     public final int vmPageSize = getFieldValue("CompilerToVM::Data::vm_page_size", Integer.class, "int");
 
-    public final int markOffset = getFieldOffset("oopDesc::_mark", Integer.class, "markWord");
+    public final int markOffset = getFieldOffset("oopDesc::_mark", Integer.class, markWord);
     public final int hubOffset = getFieldOffset("oopDesc::_metadata._klass", Integer.class, "Klass*");
 
-    public final int prototypeMarkWordOffset = getFieldOffset("Klass::_prototype_header", Integer.class, "markWord");
+    public final int prototypeMarkWordOffset = getFieldOffset("Klass::_prototype_header", Integer.class, markWord);
     public final int subklassOffset = getFieldOffset("Klass::_subklass", Integer.class, "Klass*");
     public final int nextSiblingOffset = getFieldOffset("Klass::_next_sibling", Integer.class, "Klass*");
     public final int superCheckOffsetOffset = getFieldOffset("Klass::_super_check_offset", Integer.class, "juint");
     public final int secondarySuperCacheOffset = getFieldOffset("Klass::_secondary_super_cache", Integer.class, "Klass*");
     public final int secondarySupersOffset = getFieldOffset("Klass::_secondary_supers", Integer.class, "Array<Klass*>*");
 
-    public final boolean classMirrorIsHandle;
-    public final int classMirrorOffset;
-    {
-        String name = "Klass::_java_mirror";
-        int offset = -1;
-        boolean isHandle = false;
-        try {
-            offset = getFieldOffset(name, Integer.class, "oop");
-        } catch (JVMCIError e) {
-
-        }
-        if (offset == -1) {
-            try {
-                offset = getFieldOffset(name, Integer.class, "jobject");
-                isHandle = true;
-            } catch (JVMCIError e) {
-                try {
-                    // JDK-8186777
-                    offset = getFieldOffset(name, Integer.class, "OopHandle");
-                    isHandle = true;
-                } catch (JVMCIError e2) {
-                }
-            }
-        }
-        if (offset == -1) {
-            throw new JVMCIError("cannot get offset of field " + name + " with type oop, jobject or OopHandle");
-        }
-        classMirrorOffset = offset;
-        classMirrorIsHandle = isHandle;
-    }
+    public final boolean classMirrorIsHandle = versioned.classMirrorIsHandle;
+    public final int classMirrorOffset = versioned.classMirrorOffset;
 
     public final int klassSuperKlassOffset = getFieldOffset("Klass::_super", Integer.class, "Klass*");
     public final int klassModifierFlagsOffset = getFieldOffset("Klass::_modifier_flags", Integer.class, "jint");
@@ -276,12 +249,14 @@
     public final int vtableEntryMethodOffset = getFieldOffset("vtableEntry::_method", Integer.class, "Method*");
 
     public final int instanceKlassInitStateOffset = getFieldOffset("InstanceKlass::_init_state", Integer.class, "u1");
+    public final int instanceKlassInitThreadOffset = getFieldOffset("InstanceKlass::_init_thread", Integer.class, "Thread*", -1);
     public final int instanceKlassConstantsOffset = getFieldOffset("InstanceKlass::_constants", Integer.class, "ConstantPool*");
     public final int instanceKlassFieldsOffset = getFieldOffset("InstanceKlass::_fields", Integer.class, "Array<u2>*");
     public final int klassVtableStartOffset = getFieldValue("CompilerToVM::Data::Klass_vtable_start_offset", Integer.class, "int");
     public final int klassVtableLengthOffset = getFieldValue("CompilerToVM::Data::Klass_vtable_length_offset", Integer.class, "int");
 
     public final int instanceKlassStateLinked = getConstant("InstanceKlass::linked", Integer.class);
+    public final int instanceKlassStateBeingInitialized = getConstant("InstanceKlass::being_initialized", Integer.class, -1);
     public final int instanceKlassStateFullyInitialized = getConstant("InstanceKlass::fully_initialized", Integer.class);
 
     public final int arrayOopDescSize = getFieldValue("CompilerToVM::Data::sizeof_arrayOopDesc", Integer.class, "int");
@@ -445,17 +420,17 @@
 
     public final int osThreadInterruptedOffset = getFieldOffset("OSThread::_interrupted", Integer.class, "jint");
 
-    public final long markWordHashShift = getConstant("markWord::hash_shift", Long.class);
+    public final long markWordHashShift = getConstant(markWordField("hash_shift"), Long.class);
 
-    public final int biasedLockMaskInPlace = getConstant("markWord::biased_lock_mask_in_place", Integer.class);
-    public final int ageMaskInPlace = getConstant("markWord::age_mask_in_place", Integer.class);
-    public final int epochMaskInPlace = getConstant("markWord::epoch_mask_in_place", Integer.class);
-    public final long markWordHashMask = getConstant("markWord::hash_mask", Long.class);
-    public final long markWordHashMaskInPlace = getConstant("markWord::hash_mask_in_place", Long.class);
+    public final int biasedLockMaskInPlace = getConstant(markWordField("biased_lock_mask_in_place"), Integer.class);
+    public final int ageMaskInPlace = getConstant(markWordField("age_mask_in_place"), Integer.class);
+    public final int epochMaskInPlace = getConstant(markWordField("epoch_mask_in_place"), Integer.class);
+    public final long markWordHashMask = getConstant(markWordField("hash_mask"), Long.class);
+    public final long markWordHashMaskInPlace = getConstant(markWordField("hash_mask_in_place"), Long.class);
 
-    public final int unlockedMask = getConstant("markWord::unlocked_value", Integer.class);
-    public final int monitorMask = getConstant("markWord::monitor_value", Integer.class, -1);
-    public final int biasedLockPattern = getConstant("markWord::biased_lock_pattern", Integer.class);
+    public final int unlockedMask = getConstant(markWordField("unlocked_value"), Integer.class);
+    public final int monitorMask = getConstant(markWordField("monitor_value"), Integer.class, -1);
+    public final int biasedLockPattern = getConstant(markWordField("biased_lock_pattern"), Integer.class);
 
     // This field has no type in vmStructs.cpp
     public final int objectMonitorOwner = getFieldOffset("ObjectMonitor::_owner", Integer.class, null, -1);
@@ -464,18 +439,18 @@
     public final int objectMonitorEntryList = getFieldOffset("ObjectMonitor::_EntryList", Integer.class, "ObjectWaiter*", -1);
     public final int objectMonitorSucc = getFieldOffset("ObjectMonitor::_succ", Integer.class, "Thread*", -1);
 
-    public final int markWordNoHashInPlace = getConstant("markWord::no_hash_in_place", Integer.class);
-    public final int markWordNoLockInPlace = getConstant("markWord::no_lock_in_place", Integer.class);
+    public final int markWordNoHashInPlace = getConstant(markWordField("no_hash_in_place"), Integer.class);
+    public final int markWordNoLockInPlace = getConstant(markWordField("no_lock_in_place"), Integer.class);
 
     /**
-     * See {@code markWord::prototype()}.
+     * See {@code markOopDesc::prototype()}/{@code markWord::prototype()}.
      */
     public long arrayPrototypeMarkWord() {
         return markWordNoHashInPlace | markWordNoLockInPlace;
     }
 
     /**
-     * See {@code markWord::copy_set_hash()}.
+     * See {@code markOopDesc::copy_set_hash()}/{@code markWord::copy_set_hash()}.
      */
     public long tlabIntArrayMarkWord() {
         long tmp = arrayPrototypeMarkWord() & (~markWordHashMaskInPlace);
@@ -483,15 +458,19 @@
         return tmp;
     }
 
+    private String markWordField(String simpleName) {
+        return versioned.markWordClassName + "::" + simpleName;
+    }
+
     /**
      * Mark word right shift to get identity hash code.
      */
-    public final int identityHashCodeShift = getConstant("markWord::hash_shift", Integer.class);
+    public final int identityHashCodeShift = getConstant(markWordField("hash_shift"), Integer.class);
 
     /**
      * Identity hash code value when uninitialized.
      */
-    public final int uninitializedIdentityHashCodeValue = getConstant("markWord::no_hash", Integer.class);
+    public final int uninitializedIdentityHashCodeValue = getConstant(markWordField("no_hash"), Integer.class);
 
     public final int methodAccessFlagsOffset = getFieldOffset("Method::_access_flags", Integer.class, "AccessFlags");
     public final int methodConstMethodOffset = getFieldOffset("Method::_constMethod", Integer.class, "ConstMethod*");
@@ -565,7 +544,7 @@
     public final int arrayKlassOffset = getFieldValue("java_lang_Class::_array_klass_offset", Integer.class, "int");
 
     public final int basicLockSize = getFieldValue("CompilerToVM::Data::sizeof_BasicLock", Integer.class, "int");
-    public final int basicLockDisplacedHeaderOffset = getFieldOffset("BasicLock::_displaced_header", Integer.class, "markWord");
+    public final int basicLockDisplacedHeaderOffset = getFieldOffset("BasicLock::_displaced_header", Integer.class, markWord);
 
     public final int threadPollingPageOffset = getFieldOffset("Thread::_polling_page", Integer.class, "address", -1);
     public final int threadAllocatedBytesOffset = getFieldOffset("Thread::_allocated_bytes", Integer.class, "jlong");
@@ -622,6 +601,12 @@
 
     public final boolean tlabStats = getFlag("TLABStats", Boolean.class);
 
+    // We set 0x10 as default value to disable DC ZVA if this field is not present in HotSpot.
+    // ARMv8-A architecture reference manual D12.2.35 Data Cache Zero ID register says:
+    // * BS, bits [3:0] indicate log2 of the DC ZVA block size in (4-byte) words.
+    // * DZP, bit [4] of indicates whether use of DC ZVA instruction is prohibited.
+    public final int psrInfoDczidValue = getFieldValue("VM_Version::_psr_info.dczid_el0", Integer.class, "uint32_t", 0x10);
+
     // FIXME This is only temporary until the GC code is changed.
     public final boolean inlineContiguousAllocationSupported = getFieldValue("CompilerToVM::Data::_supports_inline_contig_alloc", Boolean.class);
     public final long heapEndAddress = getFieldValue("CompilerToVM::Data::_heap_end_addr", Long.class, "HeapWord**");
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/GraalHotSpotVMConfigVersioned.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/GraalHotSpotVMConfigVersioned.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
  *
  * Fields are grouped according to the most recent JBS issue showing why they are versioned.
  *
- * JDK Version: 12+
+ * JDK Version: 14+
  */
 final class GraalHotSpotVMConfigVersioned extends HotSpotVMConfigAccess {
 
@@ -81,4 +81,12 @@
     // JDK-8015774
     long codeCacheLowBound = getFieldValue("CodeCache::_low_bound", Long.class, "address");
     long codeCacheHighBound = getFieldValue("CodeCache::_high_bound", Long.class, "address");
+
+    // JDK-8229258
+    String markWordClassName = "markWord";
+    String markWordFieldType = "markWord";
+
+    // JDK-8186777
+    int classMirrorOffset = getFieldOffset("Klass::_java_mirror", Integer.class, "OopHandle");
+    boolean classMirrorIsHandle = true;
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotBackend.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotBackend.java	Tue Sep 24 15:19:35 2019 -0400
@@ -61,6 +61,7 @@
 import org.graalvm.compiler.lir.LIRInstruction.OperandFlag;
 import org.graalvm.compiler.lir.LIRInstruction.OperandMode;
 import org.graalvm.compiler.lir.StandardOp.LabelOp;
+import org.graalvm.compiler.lir.StandardOp.RestoreRegistersOp;
 import org.graalvm.compiler.lir.StandardOp.SaveRegistersOp;
 import org.graalvm.compiler.lir.ValueConsumer;
 import org.graalvm.compiler.lir.asm.CompilationResultBuilder;
@@ -76,15 +77,16 @@
 import org.graalvm.compiler.word.Word;
 import jdk.internal.vm.compiler.word.Pointer;
 
+import jdk.vm.ci.code.CallingConvention;
 import jdk.vm.ci.code.CompilationRequest;
 import jdk.vm.ci.code.CompiledCode;
 import jdk.vm.ci.code.Register;
-import jdk.vm.ci.code.RegisterSaveLayout;
 import jdk.vm.ci.code.StackSlot;
 import jdk.vm.ci.code.ValueUtil;
 import jdk.vm.ci.hotspot.HotSpotCompilationRequest;
 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
+import jdk.vm.ci.meta.AllocatableValue;
 import jdk.vm.ci.meta.ResolvedJavaMethod;
 import jdk.vm.ci.meta.Value;
 import jdk.vm.ci.runtime.JVMCICompiler;
@@ -425,10 +427,12 @@
     /**
      * Finds all the registers that are defined by some given LIR.
      *
-     * @param lir the LIR to examine
+     * @param gen the result to examine
      * @return the registers that are defined by or used as temps for any instruction in {@code lir}
      */
-    protected final EconomicSet<Register> gatherDestroyedCallerRegisters(LIR lir) {
+    private EconomicSet<Register> gatherDestroyedCallerRegisters(HotSpotLIRGenerationResult gen) {
+        LIR lir = gen.getLIR();
+        final EconomicSet<Register> preservedRegisters = EconomicSet.create(Equivalence.IDENTITY);
         final EconomicSet<Register> destroyedRegisters = EconomicSet.create(Equivalence.IDENTITY);
         ValueConsumer defConsumer = new ValueConsumer() {
 
@@ -436,22 +440,46 @@
             public void visitValue(Value value, OperandMode mode, EnumSet<OperandFlag> flags) {
                 if (ValueUtil.isRegister(value)) {
                     final Register reg = ValueUtil.asRegister(value);
-                    destroyedRegisters.add(reg);
+                    if (!preservedRegisters.contains(reg)) {
+                        destroyedRegisters.add(reg);
+                    }
                 }
             }
         };
+        boolean sawSaveRegisters = false;
         for (AbstractBlockBase<?> block : lir.codeEmittingOrder()) {
             if (block == null) {
                 continue;
             }
+            // Ignore the effects of instructions bracketed by save/restore
+            SaveRegistersOp save = null;
             for (LIRInstruction op : lir.getLIRforBlock(block)) {
                 if (op instanceof LabelOp) {
                     // Don't consider this as a definition
+                } else if (op instanceof SaveRegistersOp) {
+                    save = (SaveRegistersOp) op;
+                    sawSaveRegisters = true;
+                    preservedRegisters.addAll(save.getSaveableRegisters());
+                } else if (op instanceof RestoreRegistersOp) {
+                    save = null;
+                    preservedRegisters.clear();
                 } else {
                     op.visitEachTemp(defConsumer);
                     op.visitEachOutput(defConsumer);
                 }
             }
+            assert save == null : "missing RestoreRegistersOp";
+        }
+
+        if (sawSaveRegisters) {
+            // The return value must be killed so it can be propagated out
+            CallingConvention cc = gen.getCallingConvention();
+            AllocatableValue returnValue = cc.getReturn();
+            if (returnValue != null) {
+                if (ValueUtil.isRegister(returnValue)) {
+                    destroyedRegisters.add(ValueUtil.asRegister(returnValue));
+                }
+            }
         }
         return translateToCallerRegisters(destroyedRegisters);
     }
@@ -464,30 +492,35 @@
     protected abstract EconomicSet<Register> translateToCallerRegisters(EconomicSet<Register> calleeRegisters);
 
     /**
-     * Updates a given stub with respect to the registers it destroys.
-     * <p>
-     * Any entry in {@code calleeSaveInfo} that {@linkplain SaveRegistersOp#supportsRemove()
-     * supports} pruning will have {@code destroyedRegisters}
-     * {@linkplain SaveRegistersOp#remove(EconomicSet) removed} as these registers are declared as
-     * temporaries in the stub's {@linkplain ForeignCallLinkage linkage} (and thus will be saved by
-     * the stub's caller).
+     * Updates a given stub with respect to the registers it destroys by
+     * {@link #gatherDestroyedCallerRegisters(HotSpotLIRGenerationResult) computing the destroyed
+     * registers} and removing those registers from the {@linkplain SaveRegistersOp SaveRegistersOp}
+     * as these registers are declared as temporaries in the stub's {@linkplain ForeignCallLinkage
+     * linkage} (and thus will be saved by the stub's caller).
      *
      * @param stub the stub to update
-     * @param destroyedRegisters the registers destroyed by the stub
-     * @param calleeSaveInfo a map from debug infos to the operations that provide their
-     *            {@linkplain RegisterSaveLayout callee-save information}
+     * @param gen the HotSpotLIRGenerationResult being emitted
      * @param frameMap used to {@linkplain FrameMap#offsetForStackSlot(StackSlot) convert} a virtual
-     *            slot to a frame slot index
      */
-    protected void updateStub(Stub stub, EconomicSet<Register> destroyedRegisters, EconomicMap<LIRFrameState, SaveRegistersOp> calleeSaveInfo, FrameMap frameMap) {
+    protected void updateStub(Stub stub, HotSpotLIRGenerationResult gen, FrameMap frameMap) {
+        EconomicSet<Register> destroyedRegisters = gatherDestroyedCallerRegisters(gen);
+        EconomicMap<LIRFrameState, SaveRegistersOp> calleeSaveInfo = gen.getCalleeSaveInfo();
+
+        if (stub.getLinkage().needsDebugInfo() && calleeSaveInfo.isEmpty()) {
+            // This call is a safepoint but no register saving was done so we must ensure that all
+            // registers appear to be killed. The Native ABI may allow caller save registers but
+            // for HotSpot they must be described in a RegisterMap so they are accessible.
+            for (Register r : frameMap.getRegisterConfig().getCallerSaveRegisters()) {
+                destroyedRegisters.add(r);
+            }
+        }
+
         stub.initDestroyedCallerRegisters(destroyedRegisters);
 
         MapCursor<LIRFrameState, SaveRegistersOp> cursor = calleeSaveInfo.getEntries();
         while (cursor.advance()) {
             SaveRegistersOp save = cursor.getValue();
-            if (save.supportsRemove()) {
-                save.remove(destroyedRegisters);
-            }
+            save.remove(destroyedRegisters);
             if (cursor.getKey() != LIRFrameState.NO_STATE) {
                 cursor.getKey().debugInfo().setCalleeSaveInfo(save.getMap(frameMap));
             }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotBackendFactory.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotBackendFactory.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotCompiledCodeBuilder.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotCompiledCodeBuilder.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotForeignCallLinkage.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotForeignCallLinkage.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,13 +24,13 @@
 
 package org.graalvm.compiler.hotspot;
 
-import jdk.vm.ci.meta.InvokeTarget;
-
 import org.graalvm.compiler.core.common.spi.ForeignCallLinkage;
 import org.graalvm.compiler.core.target.Backend;
 import org.graalvm.compiler.hotspot.stubs.Stub;
 import jdk.internal.vm.compiler.word.LocationIdentity;
 
+import jdk.vm.ci.meta.InvokeTarget;
+
 /**
  * The details required to link a HotSpot runtime or stub call.
  */
@@ -42,8 +42,8 @@
      * {@linkplain ForeignCallLinkage#getTemporaries() temporary} registers.
      */
     enum RegisterEffect {
-        DESTROYS_REGISTERS,
-        PRESERVES_REGISTERS
+        DESTROYS_ALL_CALLER_SAVE_REGISTERS,
+        COMPUTES_REGISTERS_KILLED
     }
 
     /**
@@ -118,6 +118,8 @@
 
     void setCompiledStub(Stub stub);
 
+    RegisterEffect getEffect();
+
     /**
      * Determines if this is a call to a compiled {@linkplain Stub stub}.
      */
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotForeignCallLinkageImpl.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotForeignCallLinkageImpl.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
 package org.graalvm.compiler.hotspot;
 
 import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
-import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.DESTROYS_REGISTERS;
+import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.DESTROYS_ALL_CALLER_SAVE_REGISTERS;
 
 import jdk.internal.vm.compiler.collections.EconomicSet;
 import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor;
@@ -184,6 +184,11 @@
     }
 
     @Override
+    public RegisterEffect getEffect() {
+        return effect;
+    }
+
+    @Override
     public LocationIdentity[] getKilledLocations() {
         return killedLocations;
     }
@@ -268,7 +273,7 @@
 
     @Override
     public boolean destroysRegisters() {
-        return effect == DESTROYS_REGISTERS;
+        return effect == DESTROYS_ALL_CALLER_SAVE_REGISTERS;
     }
 
     @Override
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalCompiler.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalCompiler.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalJVMCIServiceLocator.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalJVMCIServiceLocator.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalOptionValues.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalOptionValues.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalRuntime.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalRuntime.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -113,6 +113,11 @@
     private final String runtimeName;
     private final String compilerConfigurationName;
     private final HotSpotBackend hostBackend;
+
+    public GlobalMetrics getMetricValues() {
+        return metricValues;
+    }
+
     private final GlobalMetrics metricValues = new GlobalMetrics();
     private final List<SnippetCounter.Group> snippetCounterGroups;
     private final HotSpotGC garbageCollector;
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalServices.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalServices.java	Tue Sep 24 15:19:35 2019 -0400
@@ -25,6 +25,8 @@
 package org.graalvm.compiler.hotspot;
 
 import jdk.vm.ci.hotspot.HotSpotMetaData;
+import jdk.vm.ci.hotspot.HotSpotSpeculationLog;
+import jdk.vm.ci.meta.SpeculationLog;
 
 /**
  * JDK 13 version of {@code HotSpotGraalServices}.
@@ -51,4 +53,8 @@
     public static void exit(int status) {
         System.exit(status);
     }
+
+    public static SpeculationLog newHotSpotSpeculationLog(long cachedFailedSpeculationsAddress) {
+        return new HotSpotSpeculationLog(cachedFailedSpeculationsAddress);
+    }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotHostBackend.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotHostBackend.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,21 +30,28 @@
 
 import java.util.Collections;
 
+import org.graalvm.compiler.core.common.CompilationIdentifier;
 import org.graalvm.compiler.core.common.NumUtil;
+import org.graalvm.compiler.core.common.alloc.RegisterAllocationConfig;
 import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor;
+import org.graalvm.compiler.core.gen.LIRGenerationProvider;
 import org.graalvm.compiler.debug.DebugHandlersFactory;
 import org.graalvm.compiler.hotspot.meta.HotSpotHostForeignCallsProvider;
 import org.graalvm.compiler.hotspot.meta.HotSpotLoweringProvider;
 import org.graalvm.compiler.hotspot.meta.HotSpotProviders;
 import org.graalvm.compiler.hotspot.stubs.Stub;
+import org.graalvm.compiler.lir.LIR;
 import org.graalvm.compiler.lir.asm.CompilationResultBuilder;
+import org.graalvm.compiler.lir.framemap.FrameMapBuilder;
 import org.graalvm.compiler.lir.framemap.ReferenceMapBuilder;
+import org.graalvm.compiler.lir.gen.LIRGenerationResult;
 import org.graalvm.compiler.nodes.StructuredGraph;
 import org.graalvm.compiler.options.OptionValues;
 import org.graalvm.compiler.printer.GraalDebugHandlersFactory;
 import org.graalvm.compiler.word.Word;
 
 import jdk.vm.ci.code.CallingConvention;
+import jdk.vm.ci.code.RegisterConfig;
 import jdk.vm.ci.common.InitTimer;
 import jdk.vm.ci.hotspot.HotSpotCallingConventionType;
 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
@@ -55,7 +62,7 @@
 /**
  * Common functionality of HotSpot host backends.
  */
-public abstract class HotSpotHostBackend extends HotSpotBackend {
+public abstract class HotSpotHostBackend extends HotSpotBackend implements LIRGenerationProvider {
 
     /**
      * Descriptor for {@code SharedRuntime::deopt_blob()->unpack()}.
@@ -155,4 +162,12 @@
         return new HotSpotReferenceMapBuilder(totalFrameSize, config.maxOopMapStackOffset, uncompressedReferenceSize);
     }
 
+    @Override
+    public LIRGenerationResult newLIRGenerationResult(CompilationIdentifier compilationId, LIR lir, RegisterAllocationConfig registerAllocationConfig, StructuredGraph graph, Object stub) {
+        return new HotSpotLIRGenerationResult(compilationId, lir, newFrameMapBuilder(registerAllocationConfig.getRegisterConfig()), registerAllocationConfig, makeCallingConvention(graph, (Stub) stub),
+                        stub,
+                        config.requiresReservedStackCheck(graph.getMethods()));
+    }
+
+    protected abstract FrameMapBuilder newFrameMapBuilder(RegisterConfig registerConfig);
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotLIRGenerationResult.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotLIRGenerationResult.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
 import jdk.internal.vm.compiler.collections.EconomicMap;
 import jdk.internal.vm.compiler.collections.Equivalence;
 import org.graalvm.compiler.core.common.CompilationIdentifier;
+import org.graalvm.compiler.core.common.alloc.RegisterAllocationConfig;
 import org.graalvm.compiler.hotspot.stubs.Stub;
 import org.graalvm.compiler.lir.LIR;
 import org.graalvm.compiler.lir.LIRFrameState;
@@ -56,9 +57,9 @@
      */
     private EconomicMap<LIRFrameState, SaveRegistersOp> calleeSaveInfo = EconomicMap.create(Equivalence.IDENTITY_WITH_SYSTEM_HASHCODE);
 
-    public HotSpotLIRGenerationResult(CompilationIdentifier compilationId, LIR lir, FrameMapBuilder frameMapBuilder, CallingConvention callingConvention, Object stub,
-                    boolean requiresReservedStackAccessCheck) {
-        super(compilationId, lir, frameMapBuilder, callingConvention);
+    public HotSpotLIRGenerationResult(CompilationIdentifier compilationId, LIR lir, FrameMapBuilder frameMapBuilder, RegisterAllocationConfig registerAllocationConfig,
+                    CallingConvention callingConvention, Object stub, boolean requiresReservedStackAccessCheck) {
+        super(compilationId, lir, frameMapBuilder, registerAllocationConfig, callingConvention);
         this.stub = stub;
         this.requiresReservedStackAccessCheck = requiresReservedStackAccessCheck;
     }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotReplacementsImpl.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotReplacementsImpl.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotTTYStreamProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotTTYStreamProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -53,7 +53,8 @@
 
         // @formatter:off
         @Option(help = "File to which logging is sent.  A %p in the name will be replaced with a string identifying " +
-                       "the process, usually the process id and %t will be replaced by System.currentTimeMillis().", type = OptionType.Expert)
+                       "the process, usually the process id and %t will be replaced by System.currentTimeMillis().  " +
+                       "Using %o as filename sends logging to System.out whereas %e sends logging to System.err.", type = OptionType.Expert)
         public static final LogStreamOptionKey LogFile = new LogStreamOptionKey();
         // @formatter:on
     }
@@ -77,7 +78,8 @@
         /**
          * @return {@code nameTemplate} with all instances of %p replaced by
          *         {@link GraalServices#getExecutionID()} and %t by
-         *         {@link System#currentTimeMillis()}
+         *         {@link System#currentTimeMillis()}. Checks %o and %e are not combined with any
+         *         other characters.
          */
         private static String makeFilename(String nameTemplate) {
             String name = nameTemplate;
@@ -87,6 +89,13 @@
             if (name.contains("%t")) {
                 name = name.replaceAll("%t", String.valueOf(System.currentTimeMillis()));
             }
+
+            for (String subst : new String[]{"%o", "%e"}) {
+                if (name.contains(subst) && !name.equals(subst)) {
+                    throw new IllegalArgumentException("LogFile substitution " + subst + " cannot be combined with any other characters");
+                }
+            }
+
             return name;
         }
 
@@ -106,19 +115,29 @@
                             String nameTemplate = LogStreamOptionKey.this.getValue(defaultOptions());
                             if (nameTemplate != null) {
                                 String name = makeFilename(nameTemplate);
-                                try {
-                                    final boolean enableAutoflush = true;
-                                    FileOutputStream result = new FileOutputStream(name);
-                                    if (!Services.IS_IN_NATIVE_IMAGE) {
-                                        printVMConfig(enableAutoflush, result);
-                                    } else {
-                                        // There are no VM arguments for the libgraal library.
-                                    }
-                                    lazy = result;
-                                    return lazy;
-                                } catch (FileNotFoundException e) {
-                                    throw new RuntimeException("couldn't open file: " + name, e);
+                                switch (name) {
+                                    case "%o":
+                                        lazy = System.out;
+                                        break;
+                                    case "%e":
+                                        lazy = System.err;
+                                        break;
+                                    default:
+                                        try {
+                                            final boolean enableAutoflush = true;
+                                            FileOutputStream result = new FileOutputStream(name);
+                                            if (!Services.IS_IN_NATIVE_IMAGE) {
+                                                printVMConfig(enableAutoflush, result);
+                                            } else {
+                                                // There are no VM arguments for the libgraal
+                                                // library.
+                                            }
+                                            lazy = result;
+                                        } catch (FileNotFoundException e) {
+                                            throw new RuntimeException("couldn't open file: " + name, e);
+                                        }
                                 }
+                                return lazy;
                             }
 
                             lazy = HotSpotJVMCIRuntime.runtime().getLogStream();
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/SymbolicSnippetEncoder.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/SymbolicSnippetEncoder.java	Tue Sep 24 15:19:35 2019 -0400
@@ -345,7 +345,7 @@
                         IntrinsicContext.CompilationContext context, EncodedGraph encodedGraph) {
             super(providers.getCodeCache().getTarget().arch, result, providers, null,
                             replacements.getGraphBuilderPlugins().getInvocationPlugins(), new InlineInvokePlugin[0], parameterPlugin,
-                            null, null, null);
+                            null, null, null, null);
             this.method = method;
             this.encodedGraph = encodedGraph;
             intrinsic = new IntrinsicContext(method, null, replacements.getDefaultReplacementBytecodeProvider(), context, false);
@@ -790,7 +790,11 @@
         @Override
         public JavaConstant readFieldValue(ResolvedJavaField field, JavaConstant receiver) {
             JavaConstant javaConstant = constantReflection.readFieldValue(field, receiver);
-            if (!safeConstants.contains(receiver) && !field.getDeclaringClass().getName().contains("graalvm") && !field.getDeclaringClass().getName().contains("jdk/vm/ci/") &&
+            if (!safeConstants.contains(receiver) &&
+                            !field.getDeclaringClass().getName().contains("graalvm") &&
+                            !field.getDeclaringClass().getName().contains("jdk/vm/ci/") &&
+                            !field.getDeclaringClass().getName().contains("jdk/internal/vm/compiler") &&
+
                             !field.getName().equals("TYPE")) {
                 // Only permit constant reflection on compiler classes. This is necessary primarily
                 // because of the boxing snippets which are compiled as snippets but are really just
@@ -1045,7 +1049,7 @@
         public boolean canDeferPlugin(GeneratedInvocationPlugin plugin) {
             // Fold is always deferred but NodeIntrinsics may have to wait if all their arguments
             // aren't constant yet.
-            return plugin.getSource().equals(Fold.class) || plugin.getSource().equals(Node.NodeIntrinsic.class);
+            return plugin.isGeneratedFromFoldOrNodeIntrinsic();
         }
 
         @Override
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/debug/BenchmarkCounters.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/debug/BenchmarkCounters.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/lir/HotSpotZapRegistersPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/lir/HotSpotZapRegistersPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,23 +28,28 @@
 
 import java.util.ArrayList;
 
+import jdk.internal.vm.compiler.collections.EconomicSet;
+import jdk.internal.vm.compiler.collections.Equivalence;
 import org.graalvm.compiler.core.common.cfg.AbstractBlockBase;
 import org.graalvm.compiler.debug.DebugContext;
 import org.graalvm.compiler.debug.Indent;
 import org.graalvm.compiler.hotspot.HotSpotLIRGenerationResult;
 import org.graalvm.compiler.hotspot.stubs.Stub;
 import org.graalvm.compiler.lir.LIR;
-import org.graalvm.compiler.lir.LIRFrameState;
 import org.graalvm.compiler.lir.LIRInsertionBuffer;
 import org.graalvm.compiler.lir.LIRInstruction;
-import org.graalvm.compiler.lir.StandardOp.SaveRegistersOp;
+import org.graalvm.compiler.lir.StandardOp.ZapRegistersOp;
+import org.graalvm.compiler.lir.ValueConsumer;
 import org.graalvm.compiler.lir.gen.DiagnosticLIRGeneratorTool;
 import org.graalvm.compiler.lir.gen.DiagnosticLIRGeneratorTool.ZapRegistersAfterInstruction;
 import org.graalvm.compiler.lir.gen.DiagnosticLIRGeneratorTool.ZapStackArgumentSpaceBeforeInstruction;
 import org.graalvm.compiler.lir.gen.LIRGenerationResult;
 import org.graalvm.compiler.lir.phases.PostAllocationOptimizationPhase;
 
+import jdk.vm.ci.code.CallingConvention;
+import jdk.vm.ci.code.Register;
 import jdk.vm.ci.code.TargetDescription;
+import jdk.vm.ci.code.ValueUtil;
 import jdk.vm.ci.meta.AllocatableValue;
 
 /**
@@ -58,9 +63,10 @@
     @Override
     protected void run(TargetDescription target, LIRGenerationResult lirGenRes, PostAllocationOptimizationContext context) {
         Stub stub = ((HotSpotLIRGenerationResult) lirGenRes).getStub();
-        boolean zapRegisters = stub != null && !stub.preservesRegisters();
+        boolean zapRegisters = stub == null;
         boolean zapStack = false;
-        for (AllocatableValue arg : lirGenRes.getCallingConvention().getArguments()) {
+        CallingConvention callingConvention = lirGenRes.getCallingConvention();
+        for (AllocatableValue arg : callingConvention.getArguments()) {
             if (isStackSlot(arg)) {
                 zapStack = true;
                 break;
@@ -68,21 +74,25 @@
         }
         if (zapRegisters || zapStack) {
             LIR lir = lirGenRes.getLIR();
-            processLIR(context.diagnosticLirGenTool, (HotSpotLIRGenerationResult) lirGenRes, lir, zapRegisters, zapStack);
+            EconomicSet<Register> allocatableRegisters = EconomicSet.create(Equivalence.IDENTITY);
+            for (Register r : lirGenRes.getFrameMap().getRegisterConfig().getAllocatableRegisters()) {
+                allocatableRegisters.add(r);
+            }
+            processLIR(context.diagnosticLirGenTool, lir, allocatableRegisters, zapRegisters, zapStack);
         }
     }
 
-    private static void processLIR(DiagnosticLIRGeneratorTool diagnosticLirGenTool, HotSpotLIRGenerationResult res, LIR lir, boolean zapRegisters, boolean zapStack) {
+    private static void processLIR(DiagnosticLIRGeneratorTool diagnosticLirGenTool, LIR lir, EconomicSet<Register> allocatableRegisters, boolean zapRegisters, boolean zapStack) {
         LIRInsertionBuffer buffer = new LIRInsertionBuffer();
         for (AbstractBlockBase<?> block : lir.codeEmittingOrder()) {
             if (block != null) {
-                processBlock(diagnosticLirGenTool, res, lir, buffer, block, zapRegisters, zapStack);
+                processBlock(diagnosticLirGenTool, lir, allocatableRegisters, buffer, block, zapRegisters, zapStack);
             }
         }
     }
 
     @SuppressWarnings("try")
-    private static void processBlock(DiagnosticLIRGeneratorTool diagnosticLirGenTool, HotSpotLIRGenerationResult res, LIR lir, LIRInsertionBuffer buffer, AbstractBlockBase<?> block,
+    private static void processBlock(DiagnosticLIRGeneratorTool diagnosticLirGenTool, LIR lir, EconomicSet<Register> allocatableRegisters, LIRInsertionBuffer buffer, AbstractBlockBase<?> block,
                     boolean zapRegisters, boolean zapStack) {
         DebugContext debug = lir.getDebug();
         try (Indent indent = debug.logAndIndent("Process block %s", block)) {
@@ -97,31 +107,30 @@
                     }
                 }
                 if (zapRegisters && inst instanceof ZapRegistersAfterInstruction) {
-                    LIRFrameState state = getLIRState(inst);
-                    if (state != null) {
-                        SaveRegistersOp zap = diagnosticLirGenTool.createZapRegisters();
-                        SaveRegistersOp old = res.getCalleeSaveInfo().put(state, zap);
-                        assert old == null : "Already another SaveRegisterOp registered! " + old;
-                        buffer.append(index + 1, (LIRInstruction) zap);
-                        debug.log("Insert ZapRegister after %s", inst);
-                    }
+                    final EconomicSet<Register> destroyedRegisters = EconomicSet.create(Equivalence.IDENTITY);
+                    ValueConsumer tempConsumer = (value, mode, flags) -> {
+                        if (ValueUtil.isRegister(value)) {
+                            final Register reg = ValueUtil.asRegister(value);
+                            if (allocatableRegisters.contains(reg)) {
+                                destroyedRegisters.add(reg);
+                            }
+                        }
+                    };
+                    ValueConsumer defConsumer = (value, mode, flags) -> {
+                        if (ValueUtil.isRegister(value)) {
+                            final Register reg = ValueUtil.asRegister(value);
+                            destroyedRegisters.remove(reg);
+                        }
+                    };
+                    inst.visitEachTemp(tempConsumer);
+                    inst.visitEachOutput(defConsumer);
+
+                    ZapRegistersOp zap = diagnosticLirGenTool.createZapRegisters(destroyedRegisters.toArray(new Register[destroyedRegisters.size()]));
+                    buffer.append(index + 1, (LIRInstruction) zap);
+                    debug.log("Insert ZapRegister after %s", inst);
                 }
             }
             buffer.finish();
         }
     }
-
-    /**
-     * Returns the {@link LIRFrameState} of an instruction.
-     */
-    private static LIRFrameState getLIRState(LIRInstruction inst) {
-        final LIRFrameState[] lirState = {null};
-        inst.forEachState(state -> {
-            assert lirState[0] == null : "Multiple states: " + inst;
-            lirState[0] = state;
-        });
-        assert lirState[0] != null : "No state: " + inst;
-        return lirState[0];
-    }
-
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/AddressLoweringHotSpotSuitesProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/AddressLoweringHotSpotSuitesProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2017, Red Hat Inc. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/DefaultHotSpotLoweringProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/DefaultHotSpotLoweringProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -63,6 +63,7 @@
 import org.graalvm.compiler.hotspot.nodes.HotSpotCompressionNode;
 import org.graalvm.compiler.hotspot.nodes.HotSpotDirectCallTargetNode;
 import org.graalvm.compiler.hotspot.nodes.HotSpotIndirectCallTargetNode;
+import org.graalvm.compiler.hotspot.nodes.KlassBeingInitializedCheckNode;
 import org.graalvm.compiler.hotspot.nodes.aot.InitializeKlassNode;
 import org.graalvm.compiler.hotspot.nodes.aot.ResolveConstantNode;
 import org.graalvm.compiler.hotspot.nodes.aot.ResolveDynamicConstantNode;
@@ -405,6 +406,8 @@
                 }
             } else if (n instanceof ProfileNode) {
                 profileSnippets.lower((ProfileNode) n, tool);
+            } else if (n instanceof KlassBeingInitializedCheckNode) {
+                newObjectSnippets.lower((KlassBeingInitializedCheckNode) n, registers, tool);
             } else {
                 super.lower(n, tool);
             }
@@ -713,6 +716,7 @@
 
         StructuredGraph graph = node.graph();
         ForeignCallNode foreignCallNode = graph.add(new ForeignCallNode(foreignCalls, descriptor, node.stamp(NodeView.DEFAULT), node.getArguments()));
+        foreignCallNode.setStateAfter(node.stateAfter());
         graph.replaceFixedWithFixed(node, foreignCallNode);
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotAOTClassInitializationPlugin.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.graalvm.compiler.hotspot.meta;
+
+import java.util.function.Supplier;
+
+import org.graalvm.compiler.core.common.type.ObjectStamp;
+import org.graalvm.compiler.core.common.type.Stamp;
+import org.graalvm.compiler.core.common.type.StampFactory;
+import org.graalvm.compiler.hotspot.nodes.aot.InitializeKlassNode;
+import org.graalvm.compiler.hotspot.nodes.aot.ResolveConstantNode;
+import org.graalvm.compiler.nodes.ConstantNode;
+import org.graalvm.compiler.nodes.DeoptimizingFixedWithNextNode;
+import org.graalvm.compiler.nodes.FrameState;
+import org.graalvm.compiler.nodes.ValueNode;
+import org.graalvm.compiler.nodes.graphbuilderconf.ClassInitializationPlugin;
+import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext;
+
+import jdk.vm.ci.hotspot.HotSpotConstantPool;
+import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
+import jdk.vm.ci.meta.ConstantPool;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.meta.ResolvedJavaType;
+
+public final class HotSpotAOTClassInitializationPlugin implements ClassInitializationPlugin {
+    private static boolean shouldApply(GraphBuilderContext builder, ResolvedJavaType type) {
+        if (!builder.parsingIntrinsic()) {
+            if (!type.isArray()) {
+                ResolvedJavaMethod method = builder.getGraph().method();
+                ResolvedJavaType methodHolder = method.getDeclaringClass();
+                // We can elide initialization nodes if type >=: methodHolder.
+                // The type is already initialized by either "new" or "invokestatic".
+
+                // Emit initialization node if type is an interface since:
+                // JLS 12.4: Before a class is initialized, its direct superclass must be
+                // initialized, but interfaces implemented by the class are not
+                // initialized and a class or interface type T will be initialized
+                // immediately before the first occurrence of accesses listed
+                // in JLS 12.4.1.
+
+                return !type.isAssignableFrom(methodHolder) || type.isInterface();
+            } else if (!type.getComponentType().isPrimitive()) {
+                // Always apply to object array types
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public boolean apply(GraphBuilderContext builder, ResolvedJavaType type, Supplier<FrameState> frameState, ValueNode[] classInit) {
+        if (shouldApply(builder, type)) {
+            Stamp hubStamp = builder.getStampProvider().createHubStamp((ObjectStamp) StampFactory.objectNonNull());
+            ConstantNode hub = builder.append(ConstantNode.forConstant(hubStamp, ((HotSpotResolvedObjectType) type).klass(), builder.getMetaAccess(), builder.getGraph()));
+            DeoptimizingFixedWithNextNode result = builder.append(type.isArray() ? new ResolveConstantNode(hub) : new InitializeKlassNode(hub));
+            result.setStateBefore(frameState.get());
+            if (classInit != null) {
+                classInit[0] = result;
+            }
+            return true;
+        }
+        return false;
+    }
+
+    @Override
+    public boolean supportsLazyInitialization(ConstantPool cp) {
+        return true;
+    }
+
+    @Override
+    public void loadReferencedType(GraphBuilderContext builder, ConstantPool cp, int cpi, int opcode) {
+        ((HotSpotConstantPool) cp).loadReferencedType(cpi, opcode, false);
+    }
+}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotClassInitializationPlugin.java	Tue Sep 24 14:12:08 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package org.graalvm.compiler.hotspot.meta;
-
-import java.util.function.Supplier;
-
-import org.graalvm.compiler.core.common.type.ObjectStamp;
-import org.graalvm.compiler.core.common.type.Stamp;
-import org.graalvm.compiler.core.common.type.StampFactory;
-import org.graalvm.compiler.hotspot.nodes.aot.InitializeKlassNode;
-import org.graalvm.compiler.hotspot.nodes.aot.ResolveConstantNode;
-import org.graalvm.compiler.nodes.ConstantNode;
-import org.graalvm.compiler.nodes.DeoptimizingFixedWithNextNode;
-import org.graalvm.compiler.nodes.FrameState;
-import org.graalvm.compiler.nodes.ValueNode;
-import org.graalvm.compiler.nodes.graphbuilderconf.ClassInitializationPlugin;
-import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext;
-
-import jdk.vm.ci.hotspot.HotSpotConstantPool;
-import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
-import jdk.vm.ci.meta.ConstantPool;
-import jdk.vm.ci.meta.ResolvedJavaMethod;
-import jdk.vm.ci.meta.ResolvedJavaType;
-
-public final class HotSpotClassInitializationPlugin implements ClassInitializationPlugin {
-    private static boolean shouldApply(GraphBuilderContext builder, ResolvedJavaType type) {
-        if (!builder.parsingIntrinsic()) {
-            if (!type.isArray()) {
-                ResolvedJavaMethod method = builder.getGraph().method();
-                ResolvedJavaType methodHolder = method.getDeclaringClass();
-                // We can elide initialization nodes if type >=: methodHolder.
-                // The type is already initialized by either "new" or "invokestatic".
-
-                // Emit initialization node if type is an interface since:
-                // JLS 12.4: Before a class is initialized, its direct superclass must be
-                // initialized, but interfaces implemented by the class are not
-                // initialized and a class or interface type T will be initialized
-                // immediately before the first occurrence of accesses listed
-                // in JLS 12.4.1.
-
-                return !type.isAssignableFrom(methodHolder) || type.isInterface();
-            } else if (!type.getComponentType().isPrimitive()) {
-                // Always apply to object array types
-                return true;
-            }
-        }
-        return false;
-    }
-
-    @Override
-    public boolean apply(GraphBuilderContext builder, ResolvedJavaType type, Supplier<FrameState> frameState, ValueNode[] classInit) {
-        if (shouldApply(builder, type)) {
-            Stamp hubStamp = builder.getStampProvider().createHubStamp((ObjectStamp) StampFactory.objectNonNull());
-            ConstantNode hub = builder.append(ConstantNode.forConstant(hubStamp, ((HotSpotResolvedObjectType) type).klass(), builder.getMetaAccess(), builder.getGraph()));
-            DeoptimizingFixedWithNextNode result = builder.append(type.isArray() ? new ResolveConstantNode(hub) : new InitializeKlassNode(hub));
-            result.setStateBefore(frameState.get());
-            if (classInit != null) {
-                classInit[0] = result;
-            }
-            return true;
-        }
-        return false;
-    }
-
-    @Override
-    public boolean supportsLazyInitialization(ConstantPool cp) {
-        // jdk.vm.ci.hotspot.HotSpotConstantPool is final, so we can
-        // directly compare Classes.
-        return (cp instanceof HotSpotConstantPool);
-    }
-
-    @Override
-    public void loadReferencedType(GraphBuilderContext builder, ConstantPool cp, int cpi, int opcode) {
-        if (cp instanceof HotSpotConstantPool) {
-            ((HotSpotConstantPool) cp).loadReferencedType(cpi, opcode, false);
-        } else {
-            cp.loadReferencedType(cpi, opcode);
-        }
-    }
-
-}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotForeignCallsProviderImpl.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotForeignCallsProviderImpl.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
 
 import static jdk.vm.ci.hotspot.HotSpotCallingConventionType.JavaCall;
 import static jdk.vm.ci.hotspot.HotSpotCallingConventionType.JavaCallee;
-import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.PRESERVES_REGISTERS;
+import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.DESTROYS_ALL_CALLER_SAVE_REGISTERS;
 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.SAFEPOINT;
 
 import java.util.ArrayList;
@@ -114,13 +114,14 @@
                     ForeignCallDescriptor descriptor,
                     Transition transition,
                     Reexecutability reexecutability,
+                    RegisterEffect effect,
                     LocationIdentity... killedLocations) {
         return register(HotSpotForeignCallLinkageImpl.create(metaAccess,
                         codeCache,
                         wordTypes,
                         this,
                         descriptor,
-                        0L, PRESERVES_REGISTERS,
+                        0L, effect,
                         JavaCall,
                         JavaCallee,
                         transition,
@@ -129,13 +130,13 @@
     }
 
     /**
-     * Creates and registers the linkage for a foreign call.
+     * Creates and registers the linkage for a foreign call. All foreign calls are assumed to have
+     * the effect {@link RegisterEffect#DESTROYS_ALL_CALLER_SAVE_REGISTERS} since they are outside
+     * of Graal's knowledge.
      *
      * @param descriptor the signature of the foreign call
      * @param address the address of the code to call (must be non-zero)
      * @param outgoingCcType outgoing (caller) calling convention type
-     * @param effect specifies if the call destroys or preserves all registers (apart from
-     *            temporaries which are always destroyed)
      * @param transition specifies if this is a {@linkplain Transition#LEAF leaf} call
      * @param reexecutability specifies if the foreign call can be re-executed without (meaningful)
      *            side effects. Deoptimization will not return to a point before a foreign call that
@@ -146,7 +147,6 @@
                     ForeignCallDescriptor descriptor,
                     long address,
                     CallingConvention.Type outgoingCcType,
-                    RegisterEffect effect,
                     Transition transition,
                     Reexecutability reexecutability,
                     LocationIdentity... killedLocations) {
@@ -159,7 +159,7 @@
                         this,
                         descriptor,
                         address,
-                        effect,
+                        DESTROYS_ALL_CALLER_SAVE_REGISTERS,
                         outgoingCcType,
                         null, // incomingCcType
                         transition,
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotGraalConstantFieldProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotGraalConstantFieldProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotGraphBuilderPlugins.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotGraphBuilderPlugins.java	Tue Sep 24 15:19:35 2019 -0400
@@ -46,6 +46,7 @@
 import org.graalvm.compiler.core.common.type.TypeReference;
 import org.graalvm.compiler.debug.GraalError;
 import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig;
+import org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider;
 import org.graalvm.compiler.hotspot.nodes.CurrentJavaThreadNode;
 import org.graalvm.compiler.hotspot.replacements.AESCryptSubstitutions;
 import org.graalvm.compiler.hotspot.replacements.ArraysSupportSubstitutions;
@@ -128,10 +129,17 @@
      * @param foreignCalls
      * @param options
      */
-    public static Plugins create(CompilerConfiguration compilerConfiguration, GraalHotSpotVMConfig config, HotSpotWordTypes wordTypes, MetaAccessProvider metaAccess,
-                    ConstantReflectionProvider constantReflection, SnippetReflectionProvider snippetReflection, ForeignCallsProvider foreignCalls, ReplacementsImpl replacements,
+    public static Plugins create(HotSpotGraalRuntimeProvider graalRuntime,
+                    CompilerConfiguration compilerConfiguration,
+                    GraalHotSpotVMConfig config,
+                    HotSpotWordTypes wordTypes,
+                    MetaAccessProvider metaAccess,
+                    ConstantReflectionProvider constantReflection,
+                    SnippetReflectionProvider snippetReflection,
+                    ForeignCallsProvider foreignCalls,
+                    ReplacementsImpl replacements,
                     OptionValues options) {
-        InvocationPlugins invocationPlugins = new HotSpotInvocationPlugins(config, compilerConfiguration);
+        InvocationPlugins invocationPlugins = new HotSpotInvocationPlugins(graalRuntime, config, compilerConfiguration);
 
         Plugins plugins = new Plugins(invocationPlugins);
         NodeIntrinsificationProvider nodeIntrinsificationProvider = new NodeIntrinsificationProvider(metaAccess, snippetReflection, foreignCalls, wordTypes);
@@ -149,10 +157,14 @@
         }
 
         if (GeneratePIC.getValue(options)) {
-            plugins.setClassInitializationPlugin(new HotSpotClassInitializationPlugin());
+            plugins.setClassInitializationPlugin(new HotSpotAOTClassInitializationPlugin());
             if (TieredAOT.getValue(options)) {
                 plugins.setProfilingPlugin(new HotSpotAOTProfilingPlugin());
             }
+        } else {
+            if (config.instanceKlassInitThreadOffset != -1) {
+                plugins.setClassInitializationPlugin(new HotSpotJITClassInitializationPlugin());
+            }
         }
 
         invocationPlugins.defer(new Runnable() {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotHostForeignCallsProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotHostForeignCallsProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -69,8 +69,7 @@
 import static org.graalvm.compiler.hotspot.HotSpotBackend.WRONG_METHOD_HANDLER;
 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Reexecutability.NOT_REEXECUTABLE;
 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Reexecutability.REEXECUTABLE;
-import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.DESTROYS_REGISTERS;
-import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.PRESERVES_REGISTERS;
+import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.DESTROYS_ALL_CALLER_SAVE_REGISTERS;
 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.LEAF;
 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.LEAF_NO_VZERO;
 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.SAFEPOINT;
@@ -216,7 +215,7 @@
         String name = kind + (aligned ? "Aligned" : "") + (disjoint ? "Disjoint" : "") + (uninit ? "Uninit" : "") + "Arraycopy" + (killAny ? "KillAny" : "");
         ForeignCallDescriptor desc = new ForeignCallDescriptor(name, void.class, Word.class, Word.class, Word.class);
         LocationIdentity killed = killAny ? LocationIdentity.any() : NamedLocationIdentity.getArrayLocation(kind);
-        registerForeignCall(desc, routine, NativeCall, DESTROYS_REGISTERS, LEAF_NO_VZERO, NOT_REEXECUTABLE, killed);
+        registerForeignCall(desc, routine, NativeCall, LEAF_NO_VZERO, NOT_REEXECUTABLE, killed);
         return desc;
     }
 
@@ -231,7 +230,7 @@
         // return: 0 = success, n = number of copied elements xor'd with -1.
         ForeignCallDescriptor desc = new ForeignCallDescriptor(name, int.class, Word.class, Word.class, Word.class, Word.class, Word.class);
         LocationIdentity killed = NamedLocationIdentity.any();
-        registerForeignCall(desc, routine, NativeCall, DESTROYS_REGISTERS, LEAF_NO_VZERO, NOT_REEXECUTABLE, killed);
+        registerForeignCall(desc, routine, NativeCall, LEAF_NO_VZERO, NOT_REEXECUTABLE, killed);
         checkcastArraycopyDescriptors[uninit ? 1 : 0] = desc;
     }
 
@@ -271,28 +270,28 @@
 
     public void initialize(HotSpotProviders providers, OptionValues options) {
         GraalHotSpotVMConfig c = runtime.getVMConfig();
-        registerForeignCall(DEOPTIMIZATION_HANDLER, c.handleDeoptStub, NativeCall, PRESERVES_REGISTERS, LEAF_NO_VZERO, REEXECUTABLE, NO_LOCATIONS);
-        registerForeignCall(UNCOMMON_TRAP_HANDLER, c.uncommonTrapStub, NativeCall, PRESERVES_REGISTERS, LEAF_NO_VZERO, REEXECUTABLE, NO_LOCATIONS);
-        registerForeignCall(IC_MISS_HANDLER, c.inlineCacheMissStub, NativeCall, PRESERVES_REGISTERS, LEAF_NO_VZERO, REEXECUTABLE, NO_LOCATIONS);
+        registerForeignCall(DEOPTIMIZATION_HANDLER, c.handleDeoptStub, NativeCall, LEAF_NO_VZERO, REEXECUTABLE, NO_LOCATIONS);
+        registerForeignCall(UNCOMMON_TRAP_HANDLER, c.uncommonTrapStub, NativeCall, LEAF_NO_VZERO, REEXECUTABLE, NO_LOCATIONS);
+        registerForeignCall(IC_MISS_HANDLER, c.inlineCacheMissStub, NativeCall, LEAF_NO_VZERO, REEXECUTABLE, NO_LOCATIONS);
 
         if (c.enableStackReservedZoneAddress != 0) {
             assert c.throwDelayedStackOverflowErrorEntry != 0 : "both must exist";
-            registerForeignCall(ENABLE_STACK_RESERVED_ZONE, c.enableStackReservedZoneAddress, NativeCall, DESTROYS_REGISTERS, LEAF_NO_VZERO, REEXECUTABLE, NO_LOCATIONS);
-            registerForeignCall(THROW_DELAYED_STACKOVERFLOW_ERROR, c.throwDelayedStackOverflowErrorEntry, NativeCall, DESTROYS_REGISTERS, LEAF_NO_VZERO, REEXECUTABLE, NO_LOCATIONS);
+            registerForeignCall(ENABLE_STACK_RESERVED_ZONE, c.enableStackReservedZoneAddress, NativeCall, LEAF_NO_VZERO, REEXECUTABLE, NO_LOCATIONS);
+            registerForeignCall(THROW_DELAYED_STACKOVERFLOW_ERROR, c.throwDelayedStackOverflowErrorEntry, NativeCall, LEAF_NO_VZERO, REEXECUTABLE, NO_LOCATIONS);
         }
 
-        registerForeignCall(JAVA_TIME_MILLIS, c.javaTimeMillisAddress, NativeCall, DESTROYS_REGISTERS, LEAF_NO_VZERO, REEXECUTABLE, NO_LOCATIONS);
-        registerForeignCall(JAVA_TIME_NANOS, c.javaTimeNanosAddress, NativeCall, DESTROYS_REGISTERS, LEAF_NO_VZERO, REEXECUTABLE, NO_LOCATIONS);
+        registerForeignCall(JAVA_TIME_MILLIS, c.javaTimeMillisAddress, NativeCall, LEAF_NO_VZERO, REEXECUTABLE, NO_LOCATIONS);
+        registerForeignCall(JAVA_TIME_NANOS, c.javaTimeNanosAddress, NativeCall, LEAF_NO_VZERO, REEXECUTABLE, NO_LOCATIONS);
 
         registerMathStubs(c, providers, options);
 
-        registerForeignCall(ARITHMETIC_FREM, c.fremAddress, NativeCall, DESTROYS_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS);
-        registerForeignCall(ARITHMETIC_DREM, c.dremAddress, NativeCall, DESTROYS_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS);
+        registerForeignCall(ARITHMETIC_FREM, c.fremAddress, NativeCall, LEAF, REEXECUTABLE, NO_LOCATIONS);
+        registerForeignCall(ARITHMETIC_DREM, c.dremAddress, NativeCall, LEAF, REEXECUTABLE, NO_LOCATIONS);
 
-        registerForeignCall(LOAD_AND_CLEAR_EXCEPTION, c.loadAndClearExceptionAddress, NativeCall, DESTROYS_REGISTERS, LEAF_NO_VZERO, NOT_REEXECUTABLE, any());
+        registerForeignCall(LOAD_AND_CLEAR_EXCEPTION, c.loadAndClearExceptionAddress, NativeCall, LEAF_NO_VZERO, NOT_REEXECUTABLE, any());
 
-        registerForeignCall(EXCEPTION_HANDLER_FOR_PC, c.exceptionHandlerForPcAddress, NativeCall, DESTROYS_REGISTERS, SAFEPOINT, REEXECUTABLE, any());
-        registerForeignCall(EXCEPTION_HANDLER_FOR_RETURN_ADDRESS, c.exceptionHandlerForReturnAddressAddress, NativeCall, DESTROYS_REGISTERS, SAFEPOINT, REEXECUTABLE, any());
+        registerForeignCall(EXCEPTION_HANDLER_FOR_PC, c.exceptionHandlerForPcAddress, NativeCall, SAFEPOINT, REEXECUTABLE, any());
+        registerForeignCall(EXCEPTION_HANDLER_FOR_RETURN_ADDRESS, c.exceptionHandlerForReturnAddressAddress, NativeCall, SAFEPOINT, REEXECUTABLE, any());
 
         CreateExceptionStub.registerForeignCalls(c, this);
 
@@ -300,8 +299,8 @@
          * This message call is registered twice, where the second one must only be used for calls
          * that do not return, i.e., that exit the VM.
          */
-        registerForeignCall(VM_MESSAGE_C, c.vmMessageAddress, NativeCall, DESTROYS_REGISTERS, SAFEPOINT, REEXECUTABLE, NO_LOCATIONS);
-        registerForeignCall(ASSERTION_VM_MESSAGE_C, c.vmMessageAddress, NativeCall, PRESERVES_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS);
+        registerForeignCall(VM_MESSAGE_C, c.vmMessageAddress, NativeCall, SAFEPOINT, REEXECUTABLE, NO_LOCATIONS);
+        registerForeignCall(ASSERTION_VM_MESSAGE_C, c.vmMessageAddress, NativeCall, LEAF, REEXECUTABLE, NO_LOCATIONS);
 
         linkForeignCall(options, providers, NEW_INSTANCE, c.newInstanceAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, TLAB_TOP_LOCATION, TLAB_END_LOCATION);
         linkForeignCall(options, providers, NEW_ARRAY, c.newArrayAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, TLAB_TOP_LOCATION, TLAB_END_LOCATION);
@@ -316,17 +315,25 @@
         }
 
         link(new ExceptionHandlerStub(options, providers, foreignCalls.get(EXCEPTION_HANDLER)));
-        link(new UnwindExceptionToCallerStub(options, providers, registerStubCall(UNWIND_EXCEPTION_TO_CALLER, SAFEPOINT, NOT_REEXECUTABLE, any())));
-        link(new VerifyOopStub(options, providers, registerStubCall(VERIFY_OOP, LEAF_NO_VZERO, REEXECUTABLE, NO_LOCATIONS)));
+        link(new UnwindExceptionToCallerStub(options, providers,
+                        registerStubCall(UNWIND_EXCEPTION_TO_CALLER, SAFEPOINT, NOT_REEXECUTABLE, DESTROYS_ALL_CALLER_SAVE_REGISTERS, any())));
+        link(new VerifyOopStub(options, providers, registerStubCall(VERIFY_OOP, LEAF_NO_VZERO, REEXECUTABLE, DESTROYS_ALL_CALLER_SAVE_REGISTERS, NO_LOCATIONS)));
 
         EnumMap<BytecodeExceptionKind, ForeignCallDescriptor> exceptionRuntimeCalls = DefaultHotSpotLoweringProvider.RuntimeCalls.runtimeCalls;
-        link(new ArrayStoreExceptionStub(options, providers, registerStubCall(exceptionRuntimeCalls.get(BytecodeExceptionKind.ARRAY_STORE), SAFEPOINT, REEXECUTABLE, any())));
-        link(new ClassCastExceptionStub(options, providers, registerStubCall(exceptionRuntimeCalls.get(BytecodeExceptionKind.CLASS_CAST), SAFEPOINT, REEXECUTABLE, any())));
-        link(new NullPointerExceptionStub(options, providers, registerStubCall(exceptionRuntimeCalls.get(BytecodeExceptionKind.NULL_POINTER), SAFEPOINT, REEXECUTABLE, any())));
-        link(new OutOfBoundsExceptionStub(options, providers, registerStubCall(exceptionRuntimeCalls.get(BytecodeExceptionKind.OUT_OF_BOUNDS), SAFEPOINT, REEXECUTABLE, any())));
-        link(new DivisionByZeroExceptionStub(options, providers, registerStubCall(exceptionRuntimeCalls.get(BytecodeExceptionKind.DIVISION_BY_ZERO), SAFEPOINT, REEXECUTABLE, any())));
-        link(new IntegerExactOverflowExceptionStub(options, providers, registerStubCall(exceptionRuntimeCalls.get(BytecodeExceptionKind.INTEGER_EXACT_OVERFLOW), SAFEPOINT, REEXECUTABLE, any())));
-        link(new LongExactOverflowExceptionStub(options, providers, registerStubCall(exceptionRuntimeCalls.get(BytecodeExceptionKind.LONG_EXACT_OVERFLOW), SAFEPOINT, REEXECUTABLE, any())));
+        link(new ArrayStoreExceptionStub(options, providers,
+                        registerStubCall(exceptionRuntimeCalls.get(BytecodeExceptionKind.ARRAY_STORE), SAFEPOINT, NOT_REEXECUTABLE, DESTROYS_ALL_CALLER_SAVE_REGISTERS, any())));
+        link(new ClassCastExceptionStub(options, providers,
+                        registerStubCall(exceptionRuntimeCalls.get(BytecodeExceptionKind.CLASS_CAST), SAFEPOINT, NOT_REEXECUTABLE, DESTROYS_ALL_CALLER_SAVE_REGISTERS, any())));
+        link(new NullPointerExceptionStub(options, providers,
+                        registerStubCall(exceptionRuntimeCalls.get(BytecodeExceptionKind.NULL_POINTER), SAFEPOINT, NOT_REEXECUTABLE, DESTROYS_ALL_CALLER_SAVE_REGISTERS, any())));
+        link(new OutOfBoundsExceptionStub(options, providers,
+                        registerStubCall(exceptionRuntimeCalls.get(BytecodeExceptionKind.OUT_OF_BOUNDS), SAFEPOINT, NOT_REEXECUTABLE, DESTROYS_ALL_CALLER_SAVE_REGISTERS, any())));
+        link(new DivisionByZeroExceptionStub(options, providers,
+                        registerStubCall(exceptionRuntimeCalls.get(BytecodeExceptionKind.DIVISION_BY_ZERO), SAFEPOINT, NOT_REEXECUTABLE, DESTROYS_ALL_CALLER_SAVE_REGISTERS, any())));
+        link(new IntegerExactOverflowExceptionStub(options, providers,
+                        registerStubCall(exceptionRuntimeCalls.get(BytecodeExceptionKind.INTEGER_EXACT_OVERFLOW), SAFEPOINT, NOT_REEXECUTABLE, DESTROYS_ALL_CALLER_SAVE_REGISTERS, any())));
+        link(new LongExactOverflowExceptionStub(options, providers,
+                        registerStubCall(exceptionRuntimeCalls.get(BytecodeExceptionKind.LONG_EXACT_OVERFLOW), SAFEPOINT, NOT_REEXECUTABLE, DESTROYS_ALL_CALLER_SAVE_REGISTERS, any())));
 
         linkForeignCall(options, providers, IDENTITY_HASHCODE, c.identityHashCodeAddress, PREPEND_THREAD, SAFEPOINT, NOT_REEXECUTABLE, MARK_WORD_LOCATION);
         linkForeignCall(options, providers, REGISTER_FINALIZER, c.registerFinalizerAddress, PREPEND_THREAD, SAFEPOINT, NOT_REEXECUTABLE, any());
@@ -344,7 +351,7 @@
         linkForeignCall(options, providers, VALIDATE_OBJECT, c.validateObject, PREPEND_THREAD, LEAF_NO_VZERO, REEXECUTABLE, NO_LOCATIONS);
 
         if (GeneratePIC.getValue(options)) {
-            registerForeignCall(WRONG_METHOD_HANDLER, c.handleWrongMethodStub, NativeCall, PRESERVES_REGISTERS, LEAF_NO_VZERO, REEXECUTABLE, NO_LOCATIONS);
+            registerForeignCall(WRONG_METHOD_HANDLER, c.handleWrongMethodStub, NativeCall, LEAF_NO_VZERO, REEXECUTABLE, NO_LOCATIONS);
             CompilerRuntimeHotSpotVMConfig cr = new CompilerRuntimeHotSpotVMConfig(HotSpotJVMCIRuntime.runtime().getConfigStore());
             linkForeignCall(options, providers, RESOLVE_STRING_BY_SYMBOL, cr.resolveStringBySymbol, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, TLAB_TOP_LOCATION, TLAB_END_LOCATION);
             linkForeignCall(options, providers, RESOLVE_DYNAMIC_INVOKE, cr.resolveDynamicInvoke, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, any());
@@ -371,45 +378,45 @@
         registerCheckcastArraycopyDescriptor(true, c.checkcastArraycopyUninit);
         registerCheckcastArraycopyDescriptor(false, c.checkcastArraycopy);
 
-        registerForeignCall(GENERIC_ARRAYCOPY, c.genericArraycopy, NativeCall, DESTROYS_REGISTERS, LEAF_NO_VZERO, NOT_REEXECUTABLE, NamedLocationIdentity.any());
-        registerForeignCall(UNSAFE_ARRAYCOPY, c.unsafeArraycopy, NativeCall, DESTROYS_REGISTERS, LEAF_NO_VZERO, NOT_REEXECUTABLE, NamedLocationIdentity.any());
+        registerForeignCall(GENERIC_ARRAYCOPY, c.genericArraycopy, NativeCall, LEAF_NO_VZERO, NOT_REEXECUTABLE, NamedLocationIdentity.any());
+        registerForeignCall(UNSAFE_ARRAYCOPY, c.unsafeArraycopy, NativeCall, LEAF_NO_VZERO, NOT_REEXECUTABLE, NamedLocationIdentity.any());
 
         if (c.useMultiplyToLenIntrinsic()) {
-            registerForeignCall(MULTIPLY_TO_LEN, c.multiplyToLen, NativeCall, DESTROYS_REGISTERS, LEAF_NO_VZERO, NOT_REEXECUTABLE,
+            registerForeignCall(MULTIPLY_TO_LEN, c.multiplyToLen, NativeCall, LEAF_NO_VZERO, NOT_REEXECUTABLE,
                             NamedLocationIdentity.getArrayLocation(JavaKind.Int));
         }
 
         if (c.useSHA1Intrinsics()) {
-            registerForeignCall(SHA_IMPL_COMPRESS, c.sha1ImplCompress, NativeCall, DESTROYS_REGISTERS, LEAF, NOT_REEXECUTABLE, NamedLocationIdentity.any());
-            registerForeignCall(SHA_IMPL_COMPRESS_MB, c.sha1ImplCompressMultiBlock, NativeCall, DESTROYS_REGISTERS, LEAF, NOT_REEXECUTABLE, NamedLocationIdentity.any());
+            registerForeignCall(SHA_IMPL_COMPRESS, c.sha1ImplCompress, NativeCall, LEAF, NOT_REEXECUTABLE, NamedLocationIdentity.any());
+            registerForeignCall(SHA_IMPL_COMPRESS_MB, c.sha1ImplCompressMultiBlock, NativeCall, LEAF, NOT_REEXECUTABLE, NamedLocationIdentity.any());
         }
         if (c.useSHA256Intrinsics()) {
-            registerForeignCall(SHA2_IMPL_COMPRESS, c.sha256ImplCompress, NativeCall, DESTROYS_REGISTERS, LEAF, NOT_REEXECUTABLE, NamedLocationIdentity.any());
-            registerForeignCall(SHA2_IMPL_COMPRESS_MB, c.sha256ImplCompressMultiBlock, NativeCall, DESTROYS_REGISTERS, LEAF, NOT_REEXECUTABLE, NamedLocationIdentity.any());
+            registerForeignCall(SHA2_IMPL_COMPRESS, c.sha256ImplCompress, NativeCall, LEAF, NOT_REEXECUTABLE, NamedLocationIdentity.any());
+            registerForeignCall(SHA2_IMPL_COMPRESS_MB, c.sha256ImplCompressMultiBlock, NativeCall, LEAF, NOT_REEXECUTABLE, NamedLocationIdentity.any());
         }
         if (c.useSHA512Intrinsics()) {
-            registerForeignCall(SHA5_IMPL_COMPRESS, c.sha512ImplCompress, NativeCall, DESTROYS_REGISTERS, LEAF, NOT_REEXECUTABLE, NamedLocationIdentity.any());
-            registerForeignCall(SHA5_IMPL_COMPRESS_MB, c.sha512ImplCompressMultiBlock, NativeCall, DESTROYS_REGISTERS, LEAF, NOT_REEXECUTABLE, NamedLocationIdentity.any());
+            registerForeignCall(SHA5_IMPL_COMPRESS, c.sha512ImplCompress, NativeCall, LEAF, NOT_REEXECUTABLE, NamedLocationIdentity.any());
+            registerForeignCall(SHA5_IMPL_COMPRESS_MB, c.sha512ImplCompressMultiBlock, NativeCall, LEAF, NOT_REEXECUTABLE, NamedLocationIdentity.any());
         }
         if (c.useGHASHIntrinsics()) {
-            registerForeignCall(GHASH_PROCESS_BLOCKS, c.ghashProcessBlocks, NativeCall, DESTROYS_REGISTERS, LEAF, NOT_REEXECUTABLE, NamedLocationIdentity.any());
+            registerForeignCall(GHASH_PROCESS_BLOCKS, c.ghashProcessBlocks, NativeCall, LEAF, NOT_REEXECUTABLE, NamedLocationIdentity.any());
         }
         if (c.useBase64Intrinsics()) {
-            registerForeignCall(BASE64_ENCODE_BLOCK, c.base64EncodeBlock, NativeCall, DESTROYS_REGISTERS, LEAF, NOT_REEXECUTABLE, NamedLocationIdentity.any());
+            registerForeignCall(BASE64_ENCODE_BLOCK, c.base64EncodeBlock, NativeCall, LEAF, NOT_REEXECUTABLE, NamedLocationIdentity.any());
         }
         if (c.useMulAddIntrinsic()) {
-            registerForeignCall(MUL_ADD, c.mulAdd, NativeCall, DESTROYS_REGISTERS, LEAF_NO_VZERO, NOT_REEXECUTABLE, NamedLocationIdentity.getArrayLocation(JavaKind.Int));
+            registerForeignCall(MUL_ADD, c.mulAdd, NativeCall, LEAF_NO_VZERO, NOT_REEXECUTABLE, NamedLocationIdentity.getArrayLocation(JavaKind.Int));
         }
         if (c.useMontgomeryMultiplyIntrinsic()) {
-            registerForeignCall(MONTGOMERY_MULTIPLY, c.montgomeryMultiply, NativeCall, DESTROYS_REGISTERS, LEAF_NO_VZERO, NOT_REEXECUTABLE,
+            registerForeignCall(MONTGOMERY_MULTIPLY, c.montgomeryMultiply, NativeCall, LEAF_NO_VZERO, NOT_REEXECUTABLE,
                             NamedLocationIdentity.getArrayLocation(JavaKind.Int));
         }
         if (c.useMontgomerySquareIntrinsic()) {
-            registerForeignCall(MONTGOMERY_SQUARE, c.montgomerySquare, NativeCall, DESTROYS_REGISTERS, LEAF_NO_VZERO, NOT_REEXECUTABLE,
+            registerForeignCall(MONTGOMERY_SQUARE, c.montgomerySquare, NativeCall, LEAF_NO_VZERO, NOT_REEXECUTABLE,
                             NamedLocationIdentity.getArrayLocation(JavaKind.Int));
         }
         if (c.useSquareToLenIntrinsic()) {
-            registerForeignCall(SQUARE_TO_LEN, c.squareToLen, NativeCall, DESTROYS_REGISTERS, LEAF_NO_VZERO, NOT_REEXECUTABLE, NamedLocationIdentity.getArrayLocation(JavaKind.Int));
+            registerForeignCall(SQUARE_TO_LEN, c.squareToLen, NativeCall, LEAF_NO_VZERO, NOT_REEXECUTABLE, NamedLocationIdentity.getArrayLocation(JavaKind.Int));
         }
 
         if (c.useAESIntrinsics) {
@@ -420,11 +427,11 @@
              */
             try {
                 // These stubs do callee saving
-                registerForeignCall(ENCRYPT_BLOCK, c.aescryptEncryptBlockStub, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE,
+                registerForeignCall(ENCRYPT_BLOCK, c.aescryptEncryptBlockStub, NativeCall, LEAF, NOT_REEXECUTABLE,
                                 NamedLocationIdentity.getArrayLocation(JavaKind.Byte));
-                registerForeignCall(DECRYPT_BLOCK, c.aescryptDecryptBlockStub, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE,
+                registerForeignCall(DECRYPT_BLOCK, c.aescryptDecryptBlockStub, NativeCall, LEAF, NOT_REEXECUTABLE,
                                 NamedLocationIdentity.getArrayLocation(JavaKind.Byte));
-                registerForeignCall(DECRYPT_BLOCK_WITH_ORIGINAL_KEY, c.aescryptDecryptBlockStub, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE,
+                registerForeignCall(DECRYPT_BLOCK_WITH_ORIGINAL_KEY, c.aescryptDecryptBlockStub, NativeCall, LEAF, NOT_REEXECUTABLE,
                                 NamedLocationIdentity.getArrayLocation(JavaKind.Byte));
             } catch (GraalError e) {
                 if (!(e.getCause() instanceof ClassNotFoundException)) {
@@ -433,11 +440,11 @@
             }
             try {
                 // These stubs do callee saving
-                registerForeignCall(ENCRYPT, c.cipherBlockChainingEncryptAESCryptStub, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE,
+                registerForeignCall(ENCRYPT, c.cipherBlockChainingEncryptAESCryptStub, NativeCall, LEAF, NOT_REEXECUTABLE,
                                 NamedLocationIdentity.getArrayLocation(JavaKind.Byte));
-                registerForeignCall(DECRYPT, c.cipherBlockChainingDecryptAESCryptStub, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE,
+                registerForeignCall(DECRYPT, c.cipherBlockChainingDecryptAESCryptStub, NativeCall, LEAF, NOT_REEXECUTABLE,
                                 NamedLocationIdentity.getArrayLocation(JavaKind.Byte));
-                registerForeignCall(DECRYPT_WITH_ORIGINAL_KEY, c.cipherBlockChainingDecryptAESCryptStub, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE,
+                registerForeignCall(DECRYPT_WITH_ORIGINAL_KEY, c.cipherBlockChainingDecryptAESCryptStub, NativeCall, LEAF, NOT_REEXECUTABLE,
                                 NamedLocationIdentity.getArrayLocation(JavaKind.Byte));
             } catch (GraalError e) {
                 if (!(e.getCause() instanceof ClassNotFoundException)) {
@@ -448,13 +455,13 @@
 
         if (c.useAESCTRIntrinsics) {
             assert (c.counterModeAESCrypt != 0L);
-            registerForeignCall(COUNTERMODE_IMPL_CRYPT, c.counterModeAESCrypt, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE,
+            registerForeignCall(COUNTERMODE_IMPL_CRYPT, c.counterModeAESCrypt, NativeCall, LEAF, NOT_REEXECUTABLE,
                             NamedLocationIdentity.any());
         }
 
         if (c.useVectorizedMismatchIntrinsic) {
             assert (c.vectorizedMismatch != 0L);
-            registerForeignCall(VECTORIZED_MISMATCHED, c.vectorizedMismatch, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE,
+            registerForeignCall(VECTORIZED_MISMATCHED, c.vectorizedMismatch, NativeCall, LEAF, NOT_REEXECUTABLE,
                             NamedLocationIdentity.any());
 
         }
@@ -467,12 +474,12 @@
 
     @SuppressWarnings("unused")
     protected void registerMathStubs(GraalHotSpotVMConfig hotSpotVMConfig, HotSpotProviders providers, OptionValues options) {
-        registerForeignCall(SIN.foreignCallDescriptor, hotSpotVMConfig.arithmeticSinAddress, NativeCall, DESTROYS_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS);
-        registerForeignCall(COS.foreignCallDescriptor, hotSpotVMConfig.arithmeticCosAddress, NativeCall, DESTROYS_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS);
-        registerForeignCall(TAN.foreignCallDescriptor, hotSpotVMConfig.arithmeticTanAddress, NativeCall, DESTROYS_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS);
-        registerForeignCall(EXP.foreignCallDescriptor, hotSpotVMConfig.arithmeticExpAddress, NativeCall, DESTROYS_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS);
-        registerForeignCall(LOG.foreignCallDescriptor, hotSpotVMConfig.arithmeticLogAddress, NativeCall, DESTROYS_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS);
-        registerForeignCall(LOG10.foreignCallDescriptor, hotSpotVMConfig.arithmeticLog10Address, NativeCall, DESTROYS_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS);
-        registerForeignCall(POW.foreignCallDescriptor, hotSpotVMConfig.arithmeticPowAddress, NativeCall, DESTROYS_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS);
+        registerForeignCall(SIN.foreignCallDescriptor, hotSpotVMConfig.arithmeticSinAddress, NativeCall, LEAF, REEXECUTABLE, NO_LOCATIONS);
+        registerForeignCall(COS.foreignCallDescriptor, hotSpotVMConfig.arithmeticCosAddress, NativeCall, LEAF, REEXECUTABLE, NO_LOCATIONS);
+        registerForeignCall(TAN.foreignCallDescriptor, hotSpotVMConfig.arithmeticTanAddress, NativeCall, LEAF, REEXECUTABLE, NO_LOCATIONS);
+        registerForeignCall(EXP.foreignCallDescriptor, hotSpotVMConfig.arithmeticExpAddress, NativeCall, LEAF, REEXECUTABLE, NO_LOCATIONS);
+        registerForeignCall(LOG.foreignCallDescriptor, hotSpotVMConfig.arithmeticLogAddress, NativeCall, LEAF, REEXECUTABLE, NO_LOCATIONS);
+        registerForeignCall(LOG10.foreignCallDescriptor, hotSpotVMConfig.arithmeticLog10Address, NativeCall, LEAF, REEXECUTABLE, NO_LOCATIONS);
+        registerForeignCall(POW.foreignCallDescriptor, hotSpotVMConfig.arithmeticPowAddress, NativeCall, LEAF, REEXECUTABLE, NO_LOCATIONS);
     }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotInvocationPlugins.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotInvocationPlugins.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,9 +30,11 @@
 import java.util.function.Predicate;
 
 import org.graalvm.compiler.core.common.GraalOptions;
+import org.graalvm.compiler.debug.GraalError;
 import org.graalvm.compiler.graph.Node;
 import org.graalvm.compiler.graph.iterators.NodeIterable;
 import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig;
+import org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider;
 import org.graalvm.compiler.hotspot.phases.AheadOfTimeVerificationPhase;
 import org.graalvm.compiler.nodes.ConstantNode;
 import org.graalvm.compiler.nodes.FrameState;
@@ -50,10 +52,12 @@
  * Extension of {@link InvocationPlugins} that disables plugins based on runtime configuration.
  */
 final class HotSpotInvocationPlugins extends InvocationPlugins {
+    private final HotSpotGraalRuntimeProvider graalRuntime;
     private final GraalHotSpotVMConfig config;
     private final Predicate<ResolvedJavaType> intrinsificationPredicate;
 
-    HotSpotInvocationPlugins(GraalHotSpotVMConfig config, CompilerConfiguration compilerConfiguration) {
+    HotSpotInvocationPlugins(HotSpotGraalRuntimeProvider graalRuntime, GraalHotSpotVMConfig config, CompilerConfiguration compilerConfiguration) {
+        this.graalRuntime = graalRuntime;
         this.config = config;
         this.intrinsificationPredicate = runtime().getIntrinsificationTrustPredicate(compilerConfiguration.getClass());
     }
@@ -106,6 +110,13 @@
 
     @Override
     public boolean canBeIntrinsified(ResolvedJavaType declaringClass) {
-        return intrinsificationPredicate.test(declaringClass);
+        if (!intrinsificationPredicate.test(declaringClass)) {
+            if (graalRuntime.isBootstrapping()) {
+                throw GraalError.shouldNotReachHere("Class declaring a method for which a Graal intrinsic is available should be trusted for intrinsification: " + declaringClass.toJavaName());
+            }
+            return false;
+        }
+        return true;
+
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotJITClassInitializationPlugin.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.graalvm.compiler.hotspot.meta;
+
+import static org.graalvm.compiler.bytecode.Bytecodes.GETSTATIC;
+import static org.graalvm.compiler.bytecode.Bytecodes.INVOKESTATIC;
+import static org.graalvm.compiler.bytecode.Bytecodes.NEW;
+import static org.graalvm.compiler.bytecode.Bytecodes.PUTSTATIC;
+
+import java.util.function.Supplier;
+
+import org.graalvm.compiler.hotspot.nodes.KlassBeingInitializedCheckNode;
+import org.graalvm.compiler.hotspot.nodes.type.KlassPointerStamp;
+import org.graalvm.compiler.nodes.ConstantNode;
+import org.graalvm.compiler.nodes.FrameState;
+import org.graalvm.compiler.nodes.ValueNode;
+import org.graalvm.compiler.nodes.graphbuilderconf.ClassInitializationPlugin;
+import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext;
+
+import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
+import jdk.vm.ci.meta.ConstantPool;
+import jdk.vm.ci.meta.ResolvedJavaType;
+
+public final class HotSpotJITClassInitializationPlugin implements ClassInitializationPlugin {
+    @Override
+    public boolean apply(GraphBuilderContext builder, ResolvedJavaType type, Supplier<FrameState> frameState, ValueNode[] classInit) {
+        if (!type.isInitialized() && (type.isInstanceClass() || type.isInterface())) {
+            int code = builder.getCode().getCode()[builder.bci()] & 0xff;
+            switch (code) {
+                case INVOKESTATIC:
+                case GETSTATIC:
+                case PUTSTATIC:
+                case NEW:
+                    ValueNode typeConstant = ConstantNode.forConstant(KlassPointerStamp.klass(), ((HotSpotResolvedObjectType) type).klass(), builder.getMetaAccess());
+                    builder.add(new KlassBeingInitializedCheckNode(typeConstant));
+                    return true;
+                default:
+
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public boolean supportsLazyInitialization(ConstantPool cp) {
+        return false;
+    }
+
+    @Override
+    public void loadReferencedType(GraphBuilderContext builder, ConstantPool cp, int cpi, int opcode) {
+        cp.loadReferencedType(cpi, opcode);
+    }
+
+}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotProviders.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotProviders.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotStampProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotStampProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +24,8 @@
 
 package org.graalvm.compiler.hotspot.meta;
 
+import org.graalvm.compiler.core.common.type.AbstractPointerStamp;
 import org.graalvm.compiler.core.common.type.ObjectStamp;
-import org.graalvm.compiler.core.common.type.Stamp;
 import org.graalvm.compiler.hotspot.nodes.type.KlassPointerStamp;
 import org.graalvm.compiler.hotspot.nodes.type.MethodPointerStamp;
 import org.graalvm.compiler.nodes.spi.StampProvider;
@@ -33,12 +33,12 @@
 public class HotSpotStampProvider implements StampProvider {
 
     @Override
-    public Stamp createHubStamp(ObjectStamp object) {
+    public AbstractPointerStamp createHubStamp(ObjectStamp object) {
         return KlassPointerStamp.klassNonNull();
     }
 
     @Override
-    public Stamp createMethodStamp() {
+    public AbstractPointerStamp createMethodStamp() {
         return MethodPointerStamp.methodNonNull();
     }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotSuitesProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotSuitesProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotUnsafeSubstitutions.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotUnsafeSubstitutions.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotWordOperationPlugin.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotWordOperationPlugin.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/nodes/AllocaNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/nodes/AllocaNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/nodes/DimensionsNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/nodes/DimensionsNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/nodes/KlassBeingInitializedCheckNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.graalvm.compiler.hotspot.nodes;
+
+import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_4;
+import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_16;
+
+import org.graalvm.compiler.core.common.type.StampFactory;
+import org.graalvm.compiler.graph.NodeClass;
+import org.graalvm.compiler.nodeinfo.NodeInfo;
+import org.graalvm.compiler.nodes.DeoptimizingFixedWithNextNode;
+import org.graalvm.compiler.nodes.ValueNode;
+import org.graalvm.compiler.nodes.spi.Lowerable;
+import org.graalvm.compiler.nodes.spi.LoweringTool;
+
+@NodeInfo(cycles = CYCLES_4, size = SIZE_16)
+public class KlassBeingInitializedCheckNode extends DeoptimizingFixedWithNextNode implements Lowerable {
+    public static final NodeClass<KlassBeingInitializedCheckNode> TYPE = NodeClass.create(KlassBeingInitializedCheckNode.class);
+
+    @Input protected ValueNode klass;
+
+    public KlassBeingInitializedCheckNode(ValueNode klass) {
+        super(TYPE, StampFactory.forVoid());
+        this.klass = klass;
+    }
+
+    public ValueNode getKlass() {
+        return klass;
+    }
+
+    @Override
+    public boolean canDeoptimize() {
+        return true;
+    }
+
+    @Override
+    public void lower(LoweringTool tool) {
+        tool.getLowerer().lower(this, tool);
+    }
+}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/nodes/MonitorCounterNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/nodes/MonitorCounterNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/nodes/type/KlassPointerStamp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/nodes/type/KlassPointerStamp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/phases/AheadOfTimeVerificationPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/phases/AheadOfTimeVerificationPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/phases/LoadJavaMirrorWithKlassPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/phases/LoadJavaMirrorWithKlassPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/phases/aot/AOTInliningPolicy.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/phases/aot/AOTInliningPolicy.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/phases/aot/EliminateRedundantInitializationPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/phases/aot/EliminateRedundantInitializationPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/phases/aot/ReplaceConstantNodesPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/phases/aot/ReplaceConstantNodesPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
 import java.util.List;
 
 import jdk.internal.vm.compiler.collections.EconomicMap;
+import jdk.internal.vm.compiler.collections.Equivalence;
 import org.graalvm.compiler.core.common.cfg.BlockMap;
 import org.graalvm.compiler.core.common.type.ObjectStamp;
 import org.graalvm.compiler.core.common.type.Stamp;
@@ -318,7 +319,7 @@
         NodeMap<Block> nodeToBlock = schedule.getNodeToBlockMap();
         BlockMap<List<Node>> blockToNodes = schedule.getBlockToNodesMap();
 
-        EconomicMap<Block, Node> blockToExisting = EconomicMap.create();
+        EconomicMap<Block, Node> blockToExisting = EconomicMap.create(Equivalence.IDENTITY);
         for (Node n : node.usages().filter(n -> isReplacementNode(n))) {
             blockToExisting.put(nodeToBlock.get(n), n);
         }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/phases/profiling/FinalizeProfileNodesPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/phases/profiling/FinalizeProfileNodesPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/AssertionSnippets.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/AssertionSnippets.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,8 @@
 
 package org.graalvm.compiler.hotspot.replacements;
 
+import static org.graalvm.compiler.api.directives.GraalDirectives.SLOWPATH_PROBABILITY;
+import static org.graalvm.compiler.api.directives.GraalDirectives.injectBranchProbability;
 import static org.graalvm.compiler.replacements.SnippetTemplate.DEFAULT_REPLACER;
 import static org.graalvm.compiler.replacements.nodes.CStringConstant.cstring;
 
@@ -58,14 +60,14 @@
 
     @Snippet
     public static void assertion(boolean condition, @ConstantParameter String message) {
-        if (!condition) {
+        if (injectBranchProbability(SLOWPATH_PROBABILITY, !condition)) {
             vmMessageC(ASSERTION_VM_MESSAGE_C, true, cstring(message), 0L, 0L, 0L);
         }
     }
 
     @Snippet
     public static void stubAssertion(boolean condition, @ConstantParameter String message) {
-        if (!condition) {
+        if (injectBranchProbability(SLOWPATH_PROBABILITY, !condition)) {
             vmMessageC(ASSERTION_VM_MESSAGE_C, true, cstring(message), 0L, 0L, 0L);
         }
     }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/HotSpotClassSubstitutions.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/HotSpotClassSubstitutions.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/HotSpotReplacementsUtil.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/HotSpotReplacementsUtil.java	Tue Sep 24 15:19:35 2019 -0400
@@ -51,6 +51,7 @@
 import org.graalvm.compiler.nodes.ValueNode;
 import org.graalvm.compiler.nodes.extended.ForeignCallNode;
 import org.graalvm.compiler.nodes.extended.LoadHubNode;
+import org.graalvm.compiler.nodes.extended.LoadHubOrNullNode;
 import org.graalvm.compiler.nodes.extended.RawLoadNode;
 import org.graalvm.compiler.nodes.extended.StoreHubNode;
 import org.graalvm.compiler.nodes.graphbuilderconf.IntrinsicContext;
@@ -777,29 +778,50 @@
     @NodeIntrinsic(value = LoadHubNode.class)
     public static native KlassPointer loadHubIntrinsic(Object object);
 
-    public static final LocationIdentity CLASS_STATE_LOCATION = NamedLocationIdentity.mutable("ClassState");
+    @NodeIntrinsic(value = LoadHubOrNullNode.class)
+    public static native KlassPointer loadHubOrNullIntrinsic(Object object);
+
+    static final LocationIdentity CLASS_INIT_STATE_LOCATION = NamedLocationIdentity.mutable("ClassInitState");
+
+    static final LocationIdentity CLASS_INIT_THREAD_LOCATION = NamedLocationIdentity.mutable("ClassInitThread");
 
     @Fold
-    public static int instanceKlassInitStateOffset(@InjectedParameter GraalHotSpotVMConfig config) {
+    static int instanceKlassInitStateOffset(@InjectedParameter GraalHotSpotVMConfig config) {
         return config.instanceKlassInitStateOffset;
     }
 
     @Fold
+    static int instanceKlassInitThreadOffset(@InjectedParameter GraalHotSpotVMConfig config) {
+        assert config.instanceKlassInitThreadOffset != -1;
+        return config.instanceKlassInitThreadOffset;
+    }
+
+    @Fold
     public static int instanceKlassStateFullyInitialized(@InjectedParameter GraalHotSpotVMConfig config) {
         return config.instanceKlassStateFullyInitialized;
     }
 
+    @Fold
+    public static int instanceKlassStateBeingInitialized(@InjectedParameter GraalHotSpotVMConfig config) {
+        assert config.instanceKlassStateBeingInitialized != -1;
+        return config.instanceKlassStateBeingInitialized;
+    }
+
     /**
      *
      * @param hub the hub of an InstanceKlass
      * @return true is the InstanceKlass represented by hub is fully initialized
      */
     public static boolean isInstanceKlassFullyInitialized(KlassPointer hub) {
-        return readInstanceKlassState(hub) == instanceKlassStateFullyInitialized(INJECTED_VMCONFIG);
+        return readInstanceKlassInitState(hub) == instanceKlassStateFullyInitialized(INJECTED_VMCONFIG);
     }
 
-    private static byte readInstanceKlassState(KlassPointer hub) {
-        return hub.readByte(instanceKlassInitStateOffset(INJECTED_VMCONFIG), CLASS_STATE_LOCATION);
+    static byte readInstanceKlassInitState(KlassPointer hub) {
+        return hub.readByte(instanceKlassInitStateOffset(INJECTED_VMCONFIG), CLASS_INIT_STATE_LOCATION);
+    }
+
+    static Word readInstanceKlassInitThread(KlassPointer hub) {
+        return hub.readWord(instanceKlassInitThreadOffset(INJECTED_VMCONFIG), CLASS_INIT_THREAD_LOCATION);
     }
 
     public static final LocationIdentity KLASS_MODIFIER_FLAGS_LOCATION = NamedLocationIdentity.immutable("Klass::_modifier_flags");
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/InstanceOfSnippets.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/InstanceOfSnippets.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,7 @@
 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.PRIMARY_SUPERS_LOCATION;
 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.SECONDARY_SUPER_CACHE_LOCATION;
 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.loadHubIntrinsic;
+import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.loadHubOrNullIntrinsic;
 import static org.graalvm.compiler.hotspot.replacements.HotspotSnippetsOptions.TypeCheckMaxHints;
 import static org.graalvm.compiler.hotspot.replacements.HotspotSnippetsOptions.TypeCheckMinProfileHitProbability;
 import static org.graalvm.compiler.hotspot.replacements.TypeCheckSnippetUtils.checkSecondarySubType;
@@ -136,12 +137,7 @@
      */
     @Snippet
     public static Object instanceofExact(Object object, KlassPointer exactHub, Object trueValue, Object falseValue, @ConstantParameter Counters counters) {
-        if (probability(NOT_FREQUENT_PROBABILITY, object == null)) {
-            counters.isNull.inc();
-            return falseValue;
-        }
-        GuardingNode anchorNode = SnippetAnchorNode.anchor();
-        KlassPointer objectHub = loadHubIntrinsic(PiNode.piCastNonNull(object, anchorNode));
+        KlassPointer objectHub = loadHubOrNullIntrinsic(object);
         if (probability(LIKELY_PROBABILITY, objectHub.notEqual(exactHub))) {
             counters.exactMiss.inc();
             return falseValue;
@@ -224,7 +220,7 @@
 
     @Snippet
     public static Object isAssignableFrom(@NonNullParameter Class<?> thisClassNonNull, Class<?> otherClass, Object trueValue, Object falseValue, @ConstantParameter Counters counters) {
-        if (otherClass == null) {
+        if (BranchProbabilityNode.probability(BranchProbabilityNode.DEOPT_PROBABILITY, otherClass == null)) {
             DeoptimizeNode.deopt(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.NullCheckException);
             return false;
         }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/MonitorSnippets.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/MonitorSnippets.java	Tue Sep 24 15:19:35 2019 -0400
@@ -113,6 +113,7 @@
 import org.graalvm.compiler.nodes.StructuredGraph;
 import org.graalvm.compiler.nodes.ValueNode;
 import org.graalvm.compiler.nodes.debug.DynamicCounterNode;
+import org.graalvm.compiler.nodes.extended.BranchProbabilityNode;
 import org.graalvm.compiler.nodes.extended.ForeignCallNode;
 import org.graalvm.compiler.nodes.extended.MembarNode;
 import org.graalvm.compiler.nodes.java.MethodCallTargetNode;
@@ -474,7 +475,7 @@
     public static void monitorenterStub(Object object, @ConstantParameter int lockDepth, @ConstantParameter boolean trace) {
         verifyOop(object);
         incCounter();
-        if (object == null) {
+        if (BranchProbabilityNode.probability(BranchProbabilityNode.DEOPT_PROBABILITY, object == null)) {
             DeoptimizeNode.deopt(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.NullCheckException);
         }
         // BeginLockScope nodes do not read from object so a use of object
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/NewObjectSnippets.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/NewObjectSnippets.java	Tue Sep 24 15:19:35 2019 -0400
@@ -24,6 +24,7 @@
 
 package org.graalvm.compiler.hotspot.replacements;
 
+import static jdk.vm.ci.meta.DeoptimizationAction.InvalidateRecompile;
 import static jdk.vm.ci.meta.DeoptimizationAction.None;
 import static jdk.vm.ci.meta.DeoptimizationReason.RuntimeConstraint;
 import static org.graalvm.compiler.core.common.GraalOptions.GeneratePIC;
@@ -38,7 +39,7 @@
 import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_MULTI_ARRAY;
 import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_MULTI_ARRAY_OR_NULL;
 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.CLASS_ARRAY_KLASS_LOCATION;
-import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.CLASS_STATE_LOCATION;
+import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.CLASS_INIT_STATE_LOCATION;
 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.HUB_WRITE_LOCATION;
 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.MARK_WORD_LOCATION;
 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.PROTOTYPE_MARK_WORD_LOCATION;
@@ -54,6 +55,7 @@
 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.arrayLengthOffset;
 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.initializeObjectHeader;
 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.instanceHeaderSize;
+import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.instanceKlassStateBeingInitialized;
 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.isInstanceKlassFullyInitialized;
 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.layoutHelperHeaderSizeMask;
 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.layoutHelperHeaderSizeShift;
@@ -61,6 +63,8 @@
 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.layoutHelperLog2ElementSizeShift;
 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.loadKlassFromObject;
 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.prototypeMarkWordOffset;
+import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.readInstanceKlassInitState;
+import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.readInstanceKlassInitThread;
 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.readLayoutHelper;
 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.readTlabEnd;
 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.readTlabTop;
@@ -73,9 +77,11 @@
 import static org.graalvm.compiler.hotspot.replacements.HotspotSnippetsOptions.ProfileAllocationsContext;
 import static org.graalvm.compiler.nodes.PiArrayNode.piArrayCastToSnippetReplaceeStamp;
 import static org.graalvm.compiler.nodes.PiNode.piCastToSnippetReplaceeStamp;
+import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.DEOPT_PROBABILITY;
 import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.FAST_PATH_PROBABILITY;
 import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.FREQUENT_PROBABILITY;
 import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.SLOW_PATH_PROBABILITY;
+import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.VERY_FAST_PATH_PROBABILITY;
 import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.probability;
 import static org.graalvm.compiler.replacements.ReplacementsUtil.REPLACEMENTS_ASSERTIONS_ENABLED;
 import static org.graalvm.compiler.replacements.ReplacementsUtil.runtimeAssert;
@@ -99,6 +105,7 @@
 import org.graalvm.compiler.hotspot.meta.HotSpotProviders;
 import org.graalvm.compiler.hotspot.meta.HotSpotRegistersProvider;
 import org.graalvm.compiler.hotspot.nodes.DimensionsNode;
+import org.graalvm.compiler.hotspot.nodes.KlassBeingInitializedCheckNode;
 import org.graalvm.compiler.hotspot.nodes.aot.LoadConstantIndirectlyFixedNode;
 import org.graalvm.compiler.hotspot.nodes.aot.LoadConstantIndirectlyNode;
 import org.graalvm.compiler.hotspot.nodes.type.KlassPointerStamp;
@@ -112,6 +119,7 @@
 import org.graalvm.compiler.nodes.ValueNode;
 import org.graalvm.compiler.nodes.debug.DynamicCounterNode;
 import org.graalvm.compiler.nodes.debug.VerifyHeapNode;
+import org.graalvm.compiler.nodes.extended.BranchProbabilityNode;
 import org.graalvm.compiler.nodes.extended.ForeignCallNode;
 import org.graalvm.compiler.nodes.extended.MembarNode;
 import org.graalvm.compiler.nodes.java.DynamicNewArrayNode;
@@ -290,12 +298,12 @@
                     @ConstantParameter boolean emitMemoryBarrier,
                     @ConstantParameter Register threadRegister,
                     @ConstantParameter Counters counters) {
-        if (probability(SLOW_PATH_PROBABILITY, type == null)) {
+        if (probability(DEOPT_PROBABILITY, type == null)) {
             DeoptimizeNode.deopt(None, RuntimeConstraint);
         }
         Class<?> nonNullType = PiNode.piCastNonNullClass(type, SnippetAnchorNode.anchor());
 
-        if (probability(SLOW_PATH_PROBABILITY, DynamicNewInstanceNode.throwsInstantiationException(type, classClass))) {
+        if (probability(DEOPT_PROBABILITY, DynamicNewInstanceNode.throwsInstantiationException(type, classClass))) {
             DeoptimizeNode.deopt(None, RuntimeConstraint);
         }
 
@@ -312,7 +320,7 @@
         if (probability(FAST_PATH_PROBABILITY, !hub.isNull())) {
             KlassPointer nonNullHub = ClassGetHubNode.piCastNonNull(hub, SnippetAnchorNode.anchor());
 
-            if (probability(FAST_PATH_PROBABILITY, isInstanceKlassFullyInitialized(nonNullHub))) {
+            if (probability(VERY_FAST_PATH_PROBABILITY, isInstanceKlassFullyInitialized(nonNullHub))) {
                 int layoutHelper = readLayoutHelper(nonNullHub);
                 /*
                  * src/share/vm/oops/klass.hpp: For instances, layout helper is a positive number,
@@ -351,12 +359,12 @@
                     @ConstantParameter Register threadRegister,
                     @ConstantParameter boolean maybeUnroll,
                     @ConstantParameter String typeContext,
-                    @ConstantParameter boolean useBulkZeroing,
+                    @ConstantParameter int bulkZeroingStride,
                     @ConstantParameter Counters counters) {
         // Primitive array types are eagerly pre-resolved. We can use a floating load.
         KlassPointer picHub = LoadConstantIndirectlyNode.loadKlass(hub);
         return allocateArrayImpl(picHub, length, prototypeMarkWord, headerSize, log2ElementSize, fillContents,
-                        emitMemoryBarrier, threadRegister, maybeUnroll, typeContext, useBulkZeroing, counters);
+                        emitMemoryBarrier, threadRegister, maybeUnroll, typeContext, bulkZeroingStride, counters);
     }
 
     @Snippet
@@ -370,12 +378,12 @@
                     @ConstantParameter Register threadRegister,
                     @ConstantParameter boolean maybeUnroll,
                     @ConstantParameter String typeContext,
-                    @ConstantParameter boolean useBulkZeroing,
+                    @ConstantParameter int bulkZeroingStride,
                     @ConstantParameter Counters counters) {
         // Array type would be resolved by dominating resolution.
         KlassPointer picHub = LoadConstantIndirectlyFixedNode.loadKlass(hub);
         return allocateArrayImpl(picHub, length, prototypeMarkWord, headerSize, log2ElementSize, fillContents,
-                        emitMemoryBarrier, threadRegister, maybeUnroll, typeContext, useBulkZeroing, counters);
+                        emitMemoryBarrier, threadRegister, maybeUnroll, typeContext, bulkZeroingStride, counters);
     }
 
     @Snippet
@@ -389,7 +397,7 @@
                     @ConstantParameter Register threadRegister,
                     @ConstantParameter boolean maybeUnroll,
                     @ConstantParameter String typeContext,
-                    @ConstantParameter boolean useBulkZeroing,
+                    @ConstantParameter int bulkZeroingStride,
                     @ConstantParameter Counters counters) {
         Object result = allocateArrayImpl(hub,
                         length,
@@ -400,7 +408,7 @@
                         emitMemoryBarrier, threadRegister,
                         maybeUnroll,
                         typeContext,
-                        useBulkZeroing,
+                        bulkZeroingStride,
                         counters);
         return piArrayCastToSnippetReplaceeStamp(verifyOop(result), length);
     }
@@ -424,7 +432,7 @@
                     Register threadRegister,
                     boolean maybeUnroll,
                     String typeContext,
-                    boolean useBulkZeroing,
+                    int bulkZeroingStride,
                     Counters counters) {
         Object result;
         long allocationSize = arrayAllocationSize(length, headerSize, log2ElementSize);
@@ -440,7 +448,7 @@
             if (theCounters != null && theCounters.arrayLoopInit != null) {
                 theCounters.arrayLoopInit.inc();
             }
-            result = formatArray(hub, allocationSize, length, headerSize, top, prototypeMarkWord, fillContents, emitMemoryBarrier, maybeUnroll, useBulkZeroing, counters);
+            result = formatArray(hub, allocationSize, length, headerSize, top, prototypeMarkWord, fillContents, emitMemoryBarrier, maybeUnroll, bulkZeroingStride, counters);
         } else {
             result = newArrayStub(hub, length);
         }
@@ -484,7 +492,7 @@
      * Deoptimizes if {@code obj == null} otherwise returns {@code obj}.
      */
     private static Object nonNullOrDeopt(Object obj) {
-        if (obj == null) {
+        if (BranchProbabilityNode.probability(BranchProbabilityNode.DEOPT_PROBABILITY, obj == null)) {
             DeoptimizeNode.deopt(None, RuntimeConstraint);
         }
         return obj;
@@ -505,11 +513,11 @@
                     @ConstantParameter Register threadRegister,
                     @ConstantParameter JavaKind knownElementKind,
                     @ConstantParameter int knownLayoutHelper,
-                    @ConstantParameter boolean useBulkZeroing,
+                    @ConstantParameter int bulkZeroingStride,
                     Word prototypeMarkWord,
                     @ConstantParameter Counters counters) {
         Object result = allocateArrayDynamicImpl(elementType, voidClass, length, fillContents, emitMemoryBarrier, threadRegister, knownElementKind,
-                        knownLayoutHelper, useBulkZeroing, prototypeMarkWord, counters);
+                        knownLayoutHelper, bulkZeroingStride, prototypeMarkWord, counters);
         return result;
     }
 
@@ -521,7 +529,7 @@
                     Register threadRegister,
                     JavaKind knownElementKind,
                     int knownLayoutHelper,
-                    boolean useBulkZeroing,
+                    int bulkZeroingStride,
                     Word prototypeMarkWord,
                     Counters counters) {
         /*
@@ -534,12 +542,12 @@
         }
 
         KlassPointer klass = loadKlassFromObject(elementType, arrayKlassOffset(INJECTED_VMCONFIG), CLASS_ARRAY_KLASS_LOCATION);
-        if (klass.isNull()) {
+        if (probability(DEOPT_PROBABILITY, klass.isNull())) {
             DeoptimizeNode.deopt(None, RuntimeConstraint);
         }
         KlassPointer nonNullKlass = ClassGetHubNode.piCastNonNull(klass, SnippetAnchorNode.anchor());
 
-        if (length < 0) {
+        if (probability(DEOPT_PROBABILITY, length < 0)) {
             DeoptimizeNode.deopt(None, RuntimeConstraint);
         }
         int layoutHelper;
@@ -566,7 +574,7 @@
         int log2ElementSize = (layoutHelper >> layoutHelperLog2ElementSizeShift(INJECTED_VMCONFIG)) & layoutHelperLog2ElementSizeMask(INJECTED_VMCONFIG);
 
         Object result = allocateArrayImpl(nonNullKlass, length, prototypeMarkWord, headerSize, log2ElementSize, fillContents,
-                        emitMemoryBarrier, threadRegister, false, "dynamic type", useBulkZeroing, counters);
+                        emitMemoryBarrier, threadRegister, false, "dynamic type", bulkZeroingStride, counters);
         return piArrayCastToSnippetReplaceeStamp(verifyOop(result), length);
     }
 
@@ -614,21 +622,21 @@
      * Zero uninitialized memory in a newly allocated object, unrolling as necessary and ensuring
      * that stores are aligned.
      *
-     * @param size number of bytes to zero
      * @param memory beginning of object which is being zeroed
-     * @param constantSize is {@code size} known to be constant in the snippet
-     * @param startOffset offset to begin zeroing. May not be word aligned.
+     * @param startOffset offset to begin zeroing (inclusive). May not be word aligned.
+     * @param endOffset offset to stop zeroing (exclusive). May not be word aligned.
+     * @param isEndOffsetConstant is {@code endOffset} known to be constant in the snippet
      * @param manualUnroll maximally unroll zeroing
-     * @param useBulkZeroing apply bulk zeroing
+     * @param bulkZeroingStride stride of bulk zeroing supported by the backend
      */
-    private static void zeroMemory(long size, Word memory, boolean constantSize, int startOffset, boolean manualUnroll,
-                    boolean useBulkZeroing, Counters counters) {
-        fillMemory(0, size, memory, constantSize, startOffset, manualUnroll, useBulkZeroing, counters);
+    private static void zeroMemory(Word memory, int startOffset, long endOffset, boolean isEndOffsetConstant, boolean manualUnroll,
+                    int bulkZeroingStride, Counters counters) {
+        fillMemory(0, memory, startOffset, endOffset, isEndOffsetConstant, manualUnroll, bulkZeroingStride, counters);
     }
 
-    private static void fillMemory(long value, long size, Word memory, boolean constantSize, int startOffset, boolean manualUnroll,
-                    boolean useBulkZeroing, Counters counters) {
-        ReplacementsUtil.runtimeAssert((size & 0x7) == 0, "unaligned object size");
+    private static void fillMemory(long value, Word memory, int startOffset, long offsetLimit, boolean constantOffsetLimit, boolean manualUnroll,
+                    int bulkZeroingStride, Counters counters) {
+        ReplacementsUtil.runtimeAssert((offsetLimit & 0x7) == 0, "unaligned object size");
         int offset = startOffset;
         if ((offset & 0x7) != 0) {
             memory.writeInt(offset, (int) value, LocationIdentity.init());
@@ -636,8 +644,8 @@
         }
         ReplacementsUtil.runtimeAssert((offset & 0x7) == 0, "unaligned offset");
         Counters theCounters = counters;
-        if (manualUnroll && ((size - offset) / 8) <= MAX_UNROLLED_OBJECT_ZEROING_STORES) {
-            ReplacementsUtil.staticAssert(!constantSize, "size shouldn't be constant at instantiation time");
+        if (manualUnroll && ((offsetLimit - offset) / 8) <= MAX_UNROLLED_OBJECT_ZEROING_STORES) {
+            ReplacementsUtil.staticAssert(!constantOffsetLimit, "size shouldn't be constant at instantiation time");
             // This case handles arrays of constant length. Instead of having a snippet variant for
             // each length, generate a chain of stores of maximum length. Once it's inlined the
             // break statement will trim excess stores.
@@ -647,7 +655,7 @@
 
             explodeLoop();
             for (int i = 0; i < MAX_UNROLLED_OBJECT_ZEROING_STORES; i++, offset += 8) {
-                if (offset == size) {
+                if (offset == offsetLimit) {
                     break;
                 }
                 memory.initializeLong(offset, value, LocationIdentity.init());
@@ -655,13 +663,13 @@
         } else {
             // Use Word instead of int to avoid extension to long in generated code
             Word off = WordFactory.signed(offset);
-            if (useBulkZeroing && value == 0 && probability(SLOW_PATH_PROBABILITY, (size - offset) >= getMinimalBulkZeroingSize(INJECTED_OPTIONVALUES))) {
+            if (bulkZeroingStride > 0 && value == 0 && probability(SLOW_PATH_PROBABILITY, (offsetLimit - offset) >= getMinimalBulkZeroingSize(INJECTED_OPTIONVALUES))) {
                 if (theCounters != null && theCounters.instanceBulkInit != null) {
                     theCounters.instanceBulkInit.inc();
                 }
-                ZeroMemoryNode.zero(memory.add(off), size - offset, LocationIdentity.init());
+                ZeroMemoryNode.zero(memory.add(off), offsetLimit - offset, LocationIdentity.init());
             } else {
-                if (constantSize && ((size - offset) / 8) <= MAX_UNROLLED_OBJECT_ZEROING_STORES) {
+                if (constantOffsetLimit && ((offsetLimit - offset) / 8) <= MAX_UNROLLED_OBJECT_ZEROING_STORES) {
                     if (theCounters != null && theCounters.instanceSeqInit != null) {
                         theCounters.instanceSeqInit.inc();
                     }
@@ -671,7 +679,7 @@
                         theCounters.instanceLoopInit.inc();
                     }
                 }
-                for (; off.rawValue() < size; off = off.add(8)) {
+                for (; off.rawValue() < offsetLimit; off = off.add(8)) {
                     memory.initializeLong(off, value, LocationIdentity.init());
                 }
             }
@@ -687,14 +695,15 @@
      * Fill uninitialized memory with garbage value in a newly allocated object, unrolling as
      * necessary and ensuring that stores are aligned.
      *
-     * @param size number of bytes to zero
      * @param memory beginning of object which is being zeroed
-     * @param constantSize is {@code  size} known to be constant in the snippet
-     * @param startOffset offset to begin zeroing. May not be word aligned.
+     * @param startOffset offset to begin filling garbage value (inclusive). May not be word
+     *            aligned.
+     * @param endOffset offset to stop filling garbage value (exclusive). May not be word aligned.
+     * @param isEndOffsetConstant is {@code  endOffset} known to be constant in the snippet
      * @param manualUnroll maximally unroll zeroing
      */
-    private static void fillWithGarbage(long size, Word memory, boolean constantSize, int startOffset, boolean manualUnroll, Counters counters) {
-        fillMemory(0xfefefefefefefefeL, size, memory, constantSize, startOffset, manualUnroll, false, counters);
+    private static void fillWithGarbage(Word memory, int startOffset, long endOffset, boolean isEndOffsetConstant, boolean manualUnroll, Counters counters) {
+        fillMemory(0xfefefefefefefefeL, memory, startOffset, endOffset, isEndOffsetConstant, manualUnroll, 0, counters);
     }
 
     /**
@@ -711,9 +720,9 @@
         Word prototypeMarkWord = useBiasedLocking(INJECTED_VMCONFIG) ? hub.readWord(prototypeMarkWordOffset(INJECTED_VMCONFIG), PROTOTYPE_MARK_WORD_LOCATION) : compileTimePrototypeMarkWord;
         initializeObjectHeader(memory, prototypeMarkWord, hub);
         if (fillContents) {
-            zeroMemory(size, memory, constantSize, instanceHeaderSize(INJECTED_VMCONFIG), false, false, counters);
+            zeroMemory(memory, instanceHeaderSize(INJECTED_VMCONFIG), size, constantSize, false, 0, counters);
         } else if (REPLACEMENTS_ASSERTIONS_ENABLED) {
-            fillWithGarbage(size, memory, constantSize, instanceHeaderSize(INJECTED_VMCONFIG), false, counters);
+            fillWithGarbage(memory, instanceHeaderSize(INJECTED_VMCONFIG), size, constantSize, false, counters);
         }
         if (emitMemoryBarrier) {
             MembarNode.memoryBarrier(MemoryBarriers.STORE_STORE, LocationIdentity.init());
@@ -733,6 +742,19 @@
         }
     }
 
+    @Snippet
+    private static void threadBeingInitializedCheck(@ConstantParameter Register threadRegister, KlassPointer klass) {
+        int state = readInstanceKlassInitState(klass);
+        if (state != instanceKlassStateBeingInitialized(INJECTED_VMCONFIG)) {
+            // The klass is no longer being initialized so force recompilation
+            DeoptimizeNode.deopt(InvalidateRecompile, RuntimeConstraint);
+        } else if (registerAsWord(threadRegister) != readInstanceKlassInitThread(klass)) {
+            // The klass is being initialized but this isn't the initializing thread so
+            // so deopt and allow execution to resume in the interpreter where it should block.
+            DeoptimizeNode.deopt(None, RuntimeConstraint);
+        }
+    }
+
     /**
      * Formats some allocated memory with an object header and zeroes out the rest.
      */
@@ -745,7 +767,7 @@
                     boolean fillContents,
                     boolean emitMemoryBarrier,
                     boolean maybeUnroll,
-                    boolean useBulkZeroing,
+                    int bulkZeroingStride,
                     Counters counters) {
         memory.writeInt(arrayLengthOffset(INJECTED_VMCONFIG), length, LocationIdentity.init());
         /*
@@ -754,9 +776,9 @@
          */
         initializeObjectHeader(memory, prototypeMarkWord, hub);
         if (fillContents) {
-            zeroMemory(allocationSize, memory, false, headerSize, maybeUnroll, useBulkZeroing, counters);
+            zeroMemory(memory, headerSize, allocationSize, false, maybeUnroll, bulkZeroingStride, counters);
         } else if (REPLACEMENTS_ASSERTIONS_ENABLED) {
-            fillWithGarbage(allocationSize, memory, false, headerSize, maybeUnroll, counters);
+            fillWithGarbage(memory, headerSize, allocationSize, false, maybeUnroll, counters);
         }
         if (emitMemoryBarrier) {
             MembarNode.memoryBarrier(MemoryBarriers.STORE_STORE, LocationIdentity.init());
@@ -795,10 +817,11 @@
         private final SnippetInfo allocateArrayDynamic = snippet(NewObjectSnippets.class, "allocateArrayDynamic", MARK_WORD_LOCATION, HUB_WRITE_LOCATION, TLAB_TOP_LOCATION,
                         TLAB_END_LOCATION);
         private final SnippetInfo allocateInstanceDynamic = snippet(NewObjectSnippets.class, "allocateInstanceDynamic", MARK_WORD_LOCATION, HUB_WRITE_LOCATION, TLAB_TOP_LOCATION,
-                        TLAB_END_LOCATION, PROTOTYPE_MARK_WORD_LOCATION, CLASS_STATE_LOCATION);
+                        TLAB_END_LOCATION, PROTOTYPE_MARK_WORD_LOCATION, CLASS_INIT_STATE_LOCATION);
         private final SnippetInfo newmultiarray = snippet(NewObjectSnippets.class, "newmultiarray", TLAB_TOP_LOCATION, TLAB_END_LOCATION);
         private final SnippetInfo newmultiarrayPIC = snippet(NewObjectSnippets.class, "newmultiarrayPIC", TLAB_TOP_LOCATION, TLAB_END_LOCATION);
         private final SnippetInfo verifyHeap = snippet(NewObjectSnippets.class, "verifyHeap");
+        private final SnippetInfo threadBeingInitializedCheck = snippet(NewObjectSnippets.class, "threadBeingInitializedCheck");
         private final GraalHotSpotVMConfig config;
         private final Counters counters;
 
@@ -874,7 +897,7 @@
             args.addConst("threadRegister", registers.getThreadRegister());
             args.addConst("maybeUnroll", length.isConstant());
             args.addConst("typeContext", ProfileAllocations.getValue(localOptions) ? arrayType.toJavaName(false) : "");
-            args.addConst("useBulkZeroing", tool.getLowerer().supportBulkZeroing());
+            args.addConst("bulkZeroingStride", tool.getLowerer().bulkZeroingStride());
             args.addConst("counters", counters);
             SnippetTemplate template = template(newArrayNode, args);
             graph.getDebug().log("Lowering allocateArray in %s: node=%s, template=%s, arguments=%s", graph, newArrayNode, template, args);
@@ -918,7 +941,7 @@
             } else {
                 args.addConst("knownLayoutHelper", 0);
             }
-            args.addConst("useBulkZeroing", tool.getLowerer().supportBulkZeroing());
+            args.addConst("bulkZeroingStride", tool.getLowerer().bulkZeroingStride());
             args.add("prototypeMarkWord", lookupArrayClass(tool, JavaKind.Object).prototypeMarkWord());
             args.addConst("counters", counters);
             SnippetTemplate template = template(newArrayNode, args);
@@ -965,5 +988,14 @@
                 GraphUtil.removeFixedWithUnusedInputs(verifyHeapNode);
             }
         }
+
+        public void lower(KlassBeingInitializedCheckNode verifyHeapNode, HotSpotRegistersProvider registers, LoweringTool tool) {
+            Arguments args = new Arguments(threadBeingInitializedCheck, verifyHeapNode.graph().getGuardsStage(), tool.getLoweringStage());
+            args.addConst("threadRegister", registers.getThreadRegister());
+            args.add("klass", verifyHeapNode.getKlass());
+
+            SnippetTemplate template = template(verifyHeapNode, args);
+            template.instantiate(providers.getMetaAccess(), verifyHeapNode, DEFAULT_REPLACER, args);
+        }
     }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/ObjectCloneNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/ObjectCloneNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/SHA2Substitutions.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/SHA2Substitutions.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/SHA5Substitutions.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/SHA5Substitutions.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/SHASubstitutions.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/SHASubstitutions.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/StringUTF16Substitutions.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/StringUTF16Substitutions.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/ThreadSubstitutions.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/ThreadSubstitutions.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/UnsafeLoadSnippets.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/UnsafeLoadSnippets.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/CreateExceptionStub.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/CreateExceptionStub.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,6 @@
 
 import static jdk.vm.ci.hotspot.HotSpotCallingConventionType.NativeCall;
 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Reexecutability.REEXECUTABLE;
-import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.DESTROYS_REGISTERS;
 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.SAFEPOINT;
 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.clearPendingException;
 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.registerAsWord;
@@ -106,8 +105,8 @@
     private static native void throwClassCastException(@ConstantNodeParameter ForeignCallDescriptor d, Word thread, Word type, KlassPointer objKlass, KlassPointer targetKlass);
 
     public static void registerForeignCalls(GraalHotSpotVMConfig c, HotSpotForeignCallsProviderImpl foreignCalls) {
-        foreignCalls.registerForeignCall(THROW_AND_POST_JVMTI_EXCEPTION, c.throwAndPostJvmtiExceptionAddress, NativeCall, DESTROYS_REGISTERS, SAFEPOINT, REEXECUTABLE, any());
-        foreignCalls.registerForeignCall(THROW_KLASS_EXTERNAL_NAME_EXCEPTION, c.throwKlassExternalNameExceptionAddress, NativeCall, DESTROYS_REGISTERS, SAFEPOINT, REEXECUTABLE, any());
-        foreignCalls.registerForeignCall(THROW_CLASS_CAST_EXCEPTION, c.throwClassCastExceptionAddress, NativeCall, DESTROYS_REGISTERS, SAFEPOINT, REEXECUTABLE, any());
+        foreignCalls.registerForeignCall(THROW_AND_POST_JVMTI_EXCEPTION, c.throwAndPostJvmtiExceptionAddress, NativeCall, SAFEPOINT, REEXECUTABLE, any());
+        foreignCalls.registerForeignCall(THROW_KLASS_EXTERNAL_NAME_EXCEPTION, c.throwKlassExternalNameExceptionAddress, NativeCall, SAFEPOINT, REEXECUTABLE, any());
+        foreignCalls.registerForeignCall(THROW_CLASS_CAST_EXCEPTION, c.throwClassCastExceptionAddress, NativeCall, SAFEPOINT, REEXECUTABLE, any());
     }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/ExceptionHandlerStub.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/ExceptionHandlerStub.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -71,16 +71,6 @@
         super("exceptionHandler", options, providers, linkage);
     }
 
-    /**
-     * This stub is called when returning to a method to handle an exception thrown by a callee. It
-     * is not used for routing implicit exceptions. Therefore, it does not need to save any
-     * registers as HotSpot uses a caller save convention.
-     */
-    @Override
-    public boolean preservesRegisters() {
-        return false;
-    }
-
     @Override
     protected Object getConstantParameterValue(int index, String name) {
         if (index == 2) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/ForeignCallStub.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/ForeignCallStub.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +28,8 @@
 import static jdk.vm.ci.hotspot.HotSpotCallingConventionType.JavaCall;
 import static jdk.vm.ci.hotspot.HotSpotCallingConventionType.JavaCallee;
 import static jdk.vm.ci.hotspot.HotSpotCallingConventionType.NativeCall;
-import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.DESTROYS_REGISTERS;
-import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.PRESERVES_REGISTERS;
+import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.COMPUTES_REGISTERS_KILLED;
+import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.DESTROYS_ALL_CALLER_SAVE_REGISTERS;
 import static org.graalvm.compiler.nodes.CallTargetNode.InvokeKind.Static;
 import static org.graalvm.compiler.nodes.ConstantNode.forBoolean;
 
@@ -112,14 +112,14 @@
     public ForeignCallStub(OptionValues options, HotSpotJVMCIRuntime runtime, HotSpotProviders providers, long address, ForeignCallDescriptor descriptor, boolean prependThread,
                     Transition transition, Reexecutability reexecutability, LocationIdentity... killedLocations) {
         super(options, providers, HotSpotForeignCallLinkageImpl.create(providers.getMetaAccess(), providers.getCodeCache(), providers.getWordTypes(), providers.getForeignCalls(), descriptor, 0L,
-                        PRESERVES_REGISTERS, JavaCall, JavaCallee, transition, reexecutability, killedLocations));
+                        COMPUTES_REGISTERS_KILLED, JavaCall, JavaCallee, transition, reexecutability, killedLocations));
         this.jvmciRuntime = runtime;
         this.prependThread = prependThread;
         MetaAccessProvider metaAccess = providers.getMetaAccess();
         Class<?>[] targetParameterTypes = createTargetParameters(descriptor);
         ForeignCallDescriptor targetSig = new ForeignCallDescriptor(descriptor.getName() + ":C", descriptor.getResultType(), targetParameterTypes);
         target = HotSpotForeignCallLinkageImpl.create(metaAccess, providers.getCodeCache(), providers.getWordTypes(), providers.getForeignCalls(), targetSig, address,
-                        DESTROYS_REGISTERS, NativeCall, NativeCall, transition, reexecutability, killedLocations);
+                        DESTROYS_ALL_CALLER_SAVE_REGISTERS, NativeCall, NativeCall, transition, reexecutability, killedLocations);
     }
 
     /**
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/OutOfBoundsExceptionStub.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/OutOfBoundsExceptionStub.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/SnippetStub.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/SnippetStub.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/Stub.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/Stub.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -121,12 +121,8 @@
         return destroyedCallerRegisters;
     }
 
-    /**
-     * Determines if this stub preserves all registers apart from those it
-     * {@linkplain #getDestroyedCallerRegisters() destroys}.
-     */
-    public boolean preservesRegisters() {
-        return true;
+    public boolean shouldSaveRegistersAroundCalls() {
+        return linkage.getEffect() == HotSpotForeignCallLinkage.RegisterEffect.COMPUTES_REGISTERS_KILLED;
     }
 
     protected final OptionValues options;
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/StubUtil.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/StubUtil.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/UnwindExceptionToCallerStub.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/UnwindExceptionToCallerStub.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -64,15 +64,6 @@
         super("unwindExceptionToCaller", options, providers, linkage);
     }
 
-    /**
-     * The current frame is unwound by this stub. Therefore, it does not need to save any registers
-     * as HotSpot uses a caller save convention.
-     */
-    @Override
-    public boolean preservesRegisters() {
-        return false;
-    }
-
     @Override
     protected Object getConstantParameterValue(int index, String name) {
         if (index == 2) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/BciBlockMapping.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/BciBlockMapping.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/BytecodeParser.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/BytecodeParser.java	Tue Sep 24 15:19:35 2019 -0400
@@ -271,6 +271,7 @@
 import jdk.internal.vm.compiler.collections.Equivalence;
 import jdk.internal.vm.compiler.collections.UnmodifiableEconomicMap;
 import org.graalvm.compiler.api.replacements.Fold;
+import org.graalvm.compiler.api.replacements.MethodSubstitution;
 import org.graalvm.compiler.api.replacements.Snippet;
 import org.graalvm.compiler.bytecode.Bytecode;
 import org.graalvm.compiler.bytecode.BytecodeDisassembler;
@@ -363,12 +364,13 @@
 import org.graalvm.compiler.nodes.calc.IntegerBelowNode;
 import org.graalvm.compiler.nodes.calc.IntegerEqualsNode;
 import org.graalvm.compiler.nodes.calc.IntegerLessThanNode;
+import org.graalvm.compiler.nodes.calc.IntegerNormalizeCompareNode;
 import org.graalvm.compiler.nodes.calc.IsNullNode;
 import org.graalvm.compiler.nodes.calc.LeftShiftNode;
 import org.graalvm.compiler.nodes.calc.MulNode;
 import org.graalvm.compiler.nodes.calc.NarrowNode;
 import org.graalvm.compiler.nodes.calc.NegateNode;
-import org.graalvm.compiler.nodes.calc.NormalizeCompareNode;
+import org.graalvm.compiler.nodes.calc.FloatNormalizeCompareNode;
 import org.graalvm.compiler.nodes.calc.ObjectEqualsNode;
 import org.graalvm.compiler.nodes.calc.OrNode;
 import org.graalvm.compiler.nodes.calc.RemNode;
@@ -810,8 +812,9 @@
         this.parent = parent;
 
         ClassInitializationPlugin classInitializationPlugin = graphBuilderConfig.getPlugins().getClassInitializationPlugin();
-        if (classInitializationPlugin != null && graphBuilderConfig.eagerResolving()) {
-            uninitializedIsError = eagerInitializing = !classInitializationPlugin.supportsLazyInitialization(constantPool);
+        if (classInitializationPlugin != null && graphBuilderConfig.eagerResolving() && classInitializationPlugin.supportsLazyInitialization(constantPool)) {
+            eagerInitializing = false;
+            uninitializedIsError = false;
         } else {
             eagerInitializing = graphBuilderConfig.eagerResolving();
             uninitializedIsError = graphBuilderConfig.unresolvedIsError();
@@ -1331,7 +1334,11 @@
     }
 
     protected ValueNode genNormalizeCompare(ValueNode x, ValueNode y, boolean isUnorderedLess) {
-        return NormalizeCompareNode.create(x, y, isUnorderedLess, JavaKind.Int, getConstantReflection());
+        return FloatNormalizeCompareNode.create(x, y, isUnorderedLess, JavaKind.Int, getConstantReflection());
+    }
+
+    protected ValueNode genIntegerNormalizeCompare(ValueNode x, ValueNode y) {
+        return IntegerNormalizeCompareNode.create(x, y, false, JavaKind.Int, getConstantReflection());
     }
 
     protected ValueNode genFloatConvert(FloatConvert op, ValueNode input) {
@@ -2482,7 +2489,8 @@
                         : (calleeIntrinsicContext != null ? new IntrinsicScope(this, targetMethod, args)
                                         : new InliningScope(this, targetMethod, args))) {
             BytecodeParser parser = graphBuilderInstance.createBytecodeParser(graph, this, targetMethod, INVOCATION_ENTRY_BCI, calleeIntrinsicContext);
-            FrameStateBuilder startFrameState = new FrameStateBuilder(parser, parser.code, graph, graphBuilderConfig.retainLocalVariables());
+            boolean targetIsSubstitution = targetMethod.isAnnotationPresent(MethodSubstitution.class);
+            FrameStateBuilder startFrameState = new FrameStateBuilder(parser, parser.code, graph, graphBuilderConfig.retainLocalVariables() && !targetIsSubstitution);
             if (!targetMethod.isStatic()) {
                 args[0] = nullCheckedValue(args[0]);
             }
@@ -2945,7 +2953,17 @@
                  * placeholder that later can be replaced with a MergeNode when we see this block
                  * again.
                  */
-                if (canReuseInstruction && (block.getPredecessorCount() == 1 || !controlFlowSplit) && !block.isLoopHeader() && (currentBlock.loops & ~block.loops) == 0) {
+                if (canReuseInstruction && (block.getPredecessorCount() == 1 || !controlFlowSplit) && !block.isLoopHeader() && (currentBlock.loops & ~block.loops) == 0 &&
+                                currentBlock.getJsrScope() == block.getJsrScope()) {
+                    /*
+                     * If we know that no BeginNode is necessary, then we can avoid allocating and
+                     * later removing that node. This is strictly a performance optimization:
+                     * unnecessary BeginNode are allowed and will be removed later on. We need to be
+                     * careful though because the predecessor information is not always enough: when
+                     * the loop level changes, we always need a BeginNode. Also, JSR scope changes
+                     * required a BeginNode because the predecessors coming from RET bytecodes are
+                     * not reflected in the predecessor count.
+                     */
                     setFirstInstruction(block, lastInstr);
                     lastInstr = null;
                 } else {
@@ -4005,12 +4023,18 @@
         frameState.push(kind, append(v));
     }
 
-    private void genCompareOp(JavaKind kind, boolean isUnorderedLess) {
+    private void genFloatCompareOp(JavaKind kind, boolean isUnorderedLess) {
         ValueNode y = frameState.pop(kind);
         ValueNode x = frameState.pop(kind);
         frameState.push(JavaKind.Int, append(genNormalizeCompare(x, y, isUnorderedLess)));
     }
 
+    private void genIntegerCompareOp(JavaKind kind) {
+        ValueNode y = frameState.pop(kind);
+        ValueNode x = frameState.pop(kind);
+        frameState.push(JavaKind.Int, append(genIntegerNormalizeCompare(x, y)));
+    }
+
     private void genFloatConvert(FloatConvert op, JavaKind from, JavaKind to) {
         ValueNode input = frameState.pop(from);
         frameState.push(to, append(genFloatConvert(op, input)));
@@ -5085,11 +5109,11 @@
             case I2B            : genSignExtend(JavaKind.Byte, JavaKind.Int); break;
             case I2S            : genSignExtend(JavaKind.Short, JavaKind.Int); break;
             case I2C            : genZeroExtend(JavaKind.Char, JavaKind.Int); break;
-            case LCMP           : genCompareOp(JavaKind.Long, false); break;
-            case FCMPL          : genCompareOp(JavaKind.Float, true); break;
-            case FCMPG          : genCompareOp(JavaKind.Float, false); break;
-            case DCMPL          : genCompareOp(JavaKind.Double, true); break;
-            case DCMPG          : genCompareOp(JavaKind.Double, false); break;
+            case LCMP           : genIntegerCompareOp(JavaKind.Long); break;
+            case FCMPL          : genFloatCompareOp(JavaKind.Float, true); break;
+            case FCMPG          : genFloatCompareOp(JavaKind.Float, false); break;
+            case DCMPL          : genFloatCompareOp(JavaKind.Double, true); break;
+            case DCMPG          : genFloatCompareOp(JavaKind.Double, false); break;
             case IFEQ           : genIfZero(Condition.EQ); break;
             case IFNE           : genIfZero(Condition.NE); break;
             case IFLT           : genIfZero(Condition.LT); break;
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/FrameStateBuilder.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/FrameStateBuilder.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/GraphBuilderPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/GraphBuilderPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/JsrScope.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/JsrScope.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,46 +24,110 @@
 
 package org.graalvm.compiler.java;
 
-public class JsrScope {
+import org.graalvm.compiler.bytecode.Bytecodes;
 
+/**
+ * Represents a subroutine entered via {@link Bytecodes#JSR} and exited via {@link Bytecodes#RET}.
+ */
+public final class JsrScope {
+
+    /**
+     * The scope outside of any JSR/RET subroutine.
+     */
     public static final JsrScope EMPTY_SCOPE = new JsrScope();
 
-    private final long scope;
+    private final char returnAddress;
+
+    private final JsrScope parent;
 
-    private JsrScope(long scope) {
-        this.scope = scope;
+    private JsrScope(int returnBci, JsrScope parent) {
+        this.returnAddress = (char) returnBci;
+        this.parent = parent;
     }
 
-    public JsrScope() {
-        this.scope = 0;
+    private JsrScope() {
+        this.returnAddress = 0;
+        this.parent = null;
     }
 
     public int nextReturnAddress() {
-        return (int) (scope & 0xffff);
+        return returnAddress;
     }
 
-    public JsrScope push(int jsrReturnBci) {
-        if ((scope & 0xffff000000000000L) != 0) {
-            throw new JsrNotSupportedBailout("only four jsr nesting levels are supported");
+    /**
+     * Enters a new subroutine from the current scope represented by this object.
+     *
+     * @param returnBci the bytecode address returned to when leaving the new scope
+     * @return an object representing the newly entered scope
+     */
+    public JsrScope push(int returnBci) {
+        if (returnBci == 0) {
+            throw new IllegalArgumentException("A bytecode subroutine cannot have a return address of 0");
         }
-        return new JsrScope((scope << 16) | jsrReturnBci);
+        if (returnBci < 1 || returnBci > 0xFFFF) {
+            throw new IllegalArgumentException("Bytecode subroutine return address cannot be encoded as a char: " + returnBci);
+        }
+        return new JsrScope(returnBci, this);
+    }
+
+    /**
+     * Determines if this is the scope outside of any JSR/RET subroutine.
+     */
+    public boolean isEmpty() {
+        return returnAddress == 0;
     }
 
-    public boolean isEmpty() {
-        return scope == 0;
+    /**
+     * Gets the ancestry of this scope starting with the {@link #returnAddress} of this scope's most
+     * distant ancestor and ending with the {@link #returnAddress} of this object.
+     *
+     * @return a String where each character is a 16-bit BCI. This value can be converted to an
+     *         {@code int[]} with {@code value.chars().toArray()}.
+     */
+    public String getAncestry() {
+        StringBuilder sb = new StringBuilder();
+        for (JsrScope s = this; s != null; s = s.parent) {
+            if (!s.isEmpty()) {
+                sb.append(s.returnAddress);
+            }
+        }
+        return sb.reverse().toString();
     }
 
+    /**
+     * Determines if the {@linkplain #getAncestry() ancestry} of this scope is a prefix of the
+     * ancestry of {@code other}.
+     */
     public boolean isPrefixOf(JsrScope other) {
-        return (scope & other.scope) == scope;
+        if (isEmpty()) {
+            return true;
+        }
+        String ancestry = getAncestry();
+        String otherAncestry = other.getAncestry();
+        return otherAncestry.startsWith(ancestry);
     }
 
+    /**
+     * Gets this scope's parent.
+     *
+     * @return this scope's parent or {@link #EMPTY_SCOPE} if this is the {@link #EMPTY_SCOPE}
+     */
     public JsrScope pop() {
-        return new JsrScope(scope >>> 16);
+        if (isEmpty()) {
+            return this;
+        }
+        return parent;
     }
 
     @Override
     public int hashCode() {
-        return (int) (scope ^ (scope >>> 32));
+        int hc = returnAddress;
+        JsrScope ancestor = parent;
+        while (ancestor != null) {
+            hc = hc ^ ancestor.returnAddress;
+            ancestor = ancestor.parent;
+        }
+        return hc;
     }
 
     @Override
@@ -71,19 +135,38 @@
         if (this == obj) {
             return true;
         }
-        return obj != null && getClass() == obj.getClass() && scope == ((JsrScope) obj).scope;
+        if (obj != null && getClass() == obj.getClass()) {
+            JsrScope ancestor = this;
+            JsrScope otherAncestor = (JsrScope) obj;
+            while (ancestor != null) {
+                if (otherAncestor == null) {
+                    return false;
+                }
+                if (otherAncestor.returnAddress != ancestor.returnAddress) {
+                    return false;
+                }
+                ancestor = ancestor.parent;
+                otherAncestor = otherAncestor.parent;
+            }
+            if (otherAncestor == null) {
+                return true;
+            }
+        }
+        return false;
     }
 
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
-        long tmp = scope;
-        sb.append(" [");
-        while (tmp != 0) {
-            sb.append(", ").append(tmp & 0xffff);
-            tmp = tmp >>> 16;
+
+        for (JsrScope ancestor = this; ancestor != null; ancestor = ancestor.parent) {
+            if (!ancestor.isEmpty()) {
+                if (sb.length() != 0) {
+                    sb.append(", ");
+                }
+                sb.append((int) ancestor.returnAddress);
+            }
         }
-        sb.append(']');
-        return sb.toString();
+        return "[" + sb + "]";
     }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.jtt/src/org/graalvm/compiler/jtt/jdk/System_currentTimeMillis02.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.jtt/src/org/graalvm/compiler/jtt/jdk/System_currentTimeMillis02.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.jtt/src/org/graalvm/compiler/jtt/jdk/System_nanoTime02.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.jtt/src/org/graalvm/compiler/jtt/jdk/System_nanoTime02.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.jtt/src/org/graalvm/compiler/jtt/lang/Math_log10.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.jtt/src/org/graalvm/compiler/jtt/lang/Math_log10.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.jtt/src/org/graalvm/compiler/jtt/lang/UnaryMath.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.jtt/src/org/graalvm/compiler/jtt/lang/UnaryMath.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.jtt/src/org/graalvm/compiler/jtt/optimize/IfNodeCanonicalizationsTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.jtt/src/org/graalvm/compiler/jtt/optimize/IfNodeCanonicalizationsTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.jtt/src/org/graalvm/compiler/jtt/optimize/NestedLoop_EA.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.jtt/src/org/graalvm/compiler/jtt/optimize/NestedLoop_EA.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.jtt/src/org/graalvm/compiler/jtt/threads/SynchronizedLoopExit01.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.jtt/src/org/graalvm/compiler/jtt/threads/SynchronizedLoopExit01.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.aarch64/src/org/graalvm/compiler/lir/aarch64/AArch64ArithmeticLIRGeneratorTool.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.aarch64/src/org/graalvm/compiler/lir/aarch64/AArch64ArithmeticLIRGeneratorTool.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.aarch64/src/org/graalvm/compiler/lir/aarch64/AArch64Call.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.aarch64/src/org/graalvm/compiler/lir/aarch64/AArch64Call.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2018, Red Hat Inc. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.aarch64/src/org/graalvm/compiler/lir/aarch64/AArch64Compare.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.aarch64/src/org/graalvm/compiler/lir/aarch64/AArch64Compare.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.aarch64/src/org/graalvm/compiler/lir/aarch64/AArch64ControlFlow.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.aarch64/src/org/graalvm/compiler/lir/aarch64/AArch64ControlFlow.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,6 +45,7 @@
 import org.graalvm.compiler.core.common.calc.Condition;
 import org.graalvm.compiler.debug.GraalError;
 import org.graalvm.compiler.lir.ConstantValue;
+import org.graalvm.compiler.lir.LIRInstruction;
 import org.graalvm.compiler.lir.LIRInstructionClass;
 import org.graalvm.compiler.lir.LabelRef;
 import org.graalvm.compiler.lir.Opcode;
@@ -148,10 +149,25 @@
             assert kind.isInteger();
             int size = kind.getSizeInBytes() * Byte.SIZE;
 
-            if (negate) {
-                masm.cbnz(size, asRegister(this.value), target.label());
+            Label label = target.label();
+            boolean isFarBranch = isFarBranch(this, 21, crb, masm, label);
+            boolean useCbnz;
+            if (isFarBranch) {
+                useCbnz = !negate;
+                label = new Label();
             } else {
-                masm.cbz(size, asRegister(this.value), target.label());
+                useCbnz = negate;
+            }
+
+            if (useCbnz) {
+                masm.cbnz(size, asRegister(this.value), label);
+            } else {
+                masm.cbz(size, asRegister(this.value), label);
+            }
+
+            if (isFarBranch) {
+                masm.jmp(target.label());
+                masm.bind(label);
             }
         }
     }
@@ -172,20 +188,7 @@
         protected void emitBranch(CompilationResultBuilder crb, AArch64MacroAssembler masm, LabelRef target, boolean negate) {
             ConditionFlag cond = negate ? ConditionFlag.NE : ConditionFlag.EQ;
             Label label = target.label();
-            boolean isFarBranch;
-
-            if (label.isBound()) {
-                // The label.position() is a byte based index. The TBZ instruction has 14 bits for
-                // the offset and AArch64 instruction is 4 bytes aligned. So TBZ can encode 16 bits
-                // signed offset.
-                isFarBranch = !NumUtil.isSignedNbit(16, masm.position() - label.position());
-            } else {
-                // Max range of tbz is +-2^13 instructions. We estimate that each LIR instruction
-                // emits 2 AArch64 instructions on average. Thus we test for maximum 2^12 LIR
-                // instruction offset.
-                int maxLIRDistance = (1 << 12);
-                isFarBranch = !crb.labelWithinRange(this, label, maxLIRDistance);
-            }
+            boolean isFarBranch = isFarBranch(this, 14, crb, masm, label);
 
             if (isFarBranch) {
                 cond = cond.negate();
@@ -392,4 +395,20 @@
         }
     }
 
+    private static boolean isFarBranch(LIRInstruction instruction, int offsetBits, CompilationResultBuilder crb, AArch64MacroAssembler masm, Label label) {
+        boolean isFarBranch;
+        if (label.isBound()) {
+            // The label.position() is a byte based index. The instruction instruction has
+            // offsetBits bits for the offset and AArch64 instruction is 4 bytes aligned. So
+            // instruction can encode offsetBits+2 bits signed offset.
+            isFarBranch = !NumUtil.isSignedNbit(offsetBits + 2, masm.position() - label.position());
+        } else {
+            // Max range of instruction is 2^offsetBits instructions. We estimate that each LIR
+            // instruction emits 2 AArch64 instructions on average. Thus we test for maximum
+            // 2^(offsetBits-2) LIR instruction offset.
+            int maxLIRDistance = (1 << (offsetBits - 2));
+            isFarBranch = !crb.labelWithinRange(instruction, label, maxLIRDistance);
+        }
+        return isFarBranch;
+    }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.aarch64/src/org/graalvm/compiler/lir/aarch64/AArch64Move.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.aarch64/src/org/graalvm/compiler/lir/aarch64/AArch64Move.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -549,7 +549,7 @@
         try (ScratchRegister addrReg = masm.getScratchRegister()) {
             StackSlot slot = (StackSlot) result;
             AArch64Address resultAddress = loadStackSlotAddress(crb, masm, slot, addrReg.getRegister());
-            if (constant.isDefaultForKind() || constant.isNull()) {
+            if (constant.isNull() && !crb.mustReplaceWithUncompressedNullRegister(constant)) {
                 emitStore(crb, masm, (AArch64Kind) result.getPlatformKind(), resultAddress, zr.asValue(LIRKind.combine(result)));
             } else {
                 try (ScratchRegister sc = masm.getScratchRegister()) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.aarch64/src/org/graalvm/compiler/lir/aarch64/AArch64RestoreRegistersOp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.aarch64/src/org/graalvm/compiler/lir/aarch64/AArch64RestoreRegistersOp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2018, Red Hat Inc. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -25,9 +25,9 @@
 
 package org.graalvm.compiler.lir.aarch64;
 
-import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.STACK;
 import static jdk.vm.ci.code.ValueUtil.asStackSlot;
 import static jdk.vm.ci.code.ValueUtil.isStackSlot;
+import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.STACK;
 
 import java.util.Arrays;
 
@@ -35,6 +35,7 @@
 import org.graalvm.compiler.lir.LIRInstructionClass;
 import org.graalvm.compiler.lir.LIRValueUtil;
 import org.graalvm.compiler.lir.Opcode;
+import org.graalvm.compiler.lir.StandardOp;
 import org.graalvm.compiler.lir.asm.CompilationResultBuilder;
 
 import jdk.vm.ci.code.Register;
@@ -45,7 +46,7 @@
  * Restores registers from stack slots.
  */
 @Opcode("RESTORE_REGISTER")
-public class AArch64RestoreRegistersOp extends AArch64LIRInstruction {
+public class AArch64RestoreRegistersOp extends AArch64LIRInstruction implements StandardOp.RestoreRegistersOp {
     public static final LIRInstructionClass<AArch64RestoreRegistersOp> TYPE = LIRInstructionClass.create(AArch64RestoreRegistersOp.class);
 
     /**
@@ -70,7 +71,7 @@
     }
 
     protected Register[] getSavedRegisters() {
-        return save.savedRegisters;
+        return save.getSavedRegisters();
     }
 
     protected void restoreRegister(CompilationResultBuilder crb, AArch64MacroAssembler masm, Register result, StackSlot input) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.aarch64/src/org/graalvm/compiler/lir/aarch64/AArch64SaveRegistersOp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.aarch64/src/org/graalvm/compiler/lir/aarch64/AArch64SaveRegistersOp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,21 +26,15 @@
 
 import static jdk.vm.ci.code.ValueUtil.asStackSlot;
 import static jdk.vm.ci.code.ValueUtil.isStackSlot;
-import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.STACK;
-
-import java.util.Arrays;
 
 import jdk.internal.vm.compiler.collections.EconomicSet;
 import org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler;
 import org.graalvm.compiler.lir.LIRInstructionClass;
-import org.graalvm.compiler.lir.LIRValueUtil;
 import org.graalvm.compiler.lir.Opcode;
 import org.graalvm.compiler.lir.StandardOp.SaveRegistersOp;
 import org.graalvm.compiler.lir.asm.CompilationResultBuilder;
-import org.graalvm.compiler.lir.framemap.FrameMap;
 
 import jdk.vm.ci.code.Register;
-import jdk.vm.ci.code.RegisterSaveLayout;
 import jdk.vm.ci.code.StackSlot;
 import jdk.vm.ci.meta.AllocatableValue;
 
@@ -48,41 +42,17 @@
  * Saves registers to stack slots.
  */
 @Opcode("SAVE_REGISTER")
-public class AArch64SaveRegistersOp extends AArch64LIRInstruction implements SaveRegistersOp {
+public class AArch64SaveRegistersOp extends SaveRegistersOp {
     public static final LIRInstructionClass<AArch64SaveRegistersOp> TYPE = LIRInstructionClass.create(AArch64SaveRegistersOp.class);
 
     /**
-     * The registers (potentially) saved by this operation.
-     */
-    protected final Register[] savedRegisters;
-
-    /**
-     * The slots to which the registers are saved.
-     */
-    @Def(STACK) protected final AllocatableValue[] slots;
-
-    /**
-     * Specifies if {@link #remove(EconomicSet)} should have an effect.
-     */
-    protected final boolean supportsRemove;
-
-    /**
      *
      * @param savedRegisters the registers saved by this operation which may be subject to
      *            {@linkplain #remove(EconomicSet) pruning}
      * @param savedRegisterLocations the slots to which the registers are saved
-     * @param supportsRemove determines if registers can be {@linkplain #remove(EconomicSet) pruned}
      */
-    public AArch64SaveRegistersOp(Register[] savedRegisters, AllocatableValue[] savedRegisterLocations, boolean supportsRemove) {
-        this(TYPE, savedRegisters, savedRegisterLocations, supportsRemove);
-    }
-
-    public AArch64SaveRegistersOp(LIRInstructionClass<? extends AArch64SaveRegistersOp> c, Register[] savedRegisters, AllocatableValue[] savedRegisterLocations, boolean supportsRemove) {
-        super(c);
-        assert Arrays.asList(savedRegisterLocations).stream().allMatch(LIRValueUtil::isVirtualStackSlot);
-        this.savedRegisters = savedRegisters;
-        this.slots = savedRegisterLocations;
-        this.supportsRemove = supportsRemove;
+    public AArch64SaveRegistersOp(Register[] savedRegisters, AllocatableValue[] savedRegisterLocations) {
+        super(TYPE, savedRegisters, savedRegisterLocations);
     }
 
     protected void saveRegister(CompilationResultBuilder crb, AArch64MacroAssembler masm, StackSlot result, Register input) {
@@ -90,7 +60,8 @@
     }
 
     @Override
-    public void emitCode(CompilationResultBuilder crb, AArch64MacroAssembler masm) {
+    public void emitCode(CompilationResultBuilder crb) {
+        AArch64MacroAssembler masm = (AArch64MacroAssembler) crb.asm;
         for (int i = 0; i < savedRegisters.length; i++) {
             if (savedRegisters[i] != null) {
                 assert isStackSlot(slots[i]) : "not a StackSlot: " + slots[i];
@@ -98,73 +69,4 @@
             }
         }
     }
-
-    public AllocatableValue[] getSlots() {
-        return slots;
-    }
-
-    @Override
-    public boolean supportsRemove() {
-        return supportsRemove;
-    }
-
-    @Override
-    public int remove(EconomicSet<Register> doNotSave) {
-        if (!supportsRemove) {
-            throw new UnsupportedOperationException();
-        }
-        return prune(doNotSave, savedRegisters);
-    }
-
-    static int prune(EconomicSet<Register> toRemove, Register[] registers) {
-        int pruned = 0;
-        for (int i = 0; i < registers.length; i++) {
-            if (registers[i] != null) {
-                if (toRemove.contains(registers[i])) {
-                    registers[i] = null;
-                    pruned++;
-                }
-            }
-        }
-        return pruned;
-    }
-
-    @Override
-    public RegisterSaveLayout getMap(FrameMap frameMap) {
-        int total = 0;
-        for (int i = 0; i < savedRegisters.length; i++) {
-            if (savedRegisters[i] != null) {
-                total++;
-            }
-        }
-        Register[] keys = new Register[total];
-        int[] values = new int[total];
-        if (total != 0) {
-            int mapIndex = 0;
-            for (int i = 0; i < savedRegisters.length; i++) {
-                if (savedRegisters[i] != null) {
-                    keys[mapIndex] = savedRegisters[i];
-                    assert isStackSlot(slots[i]) : "not a StackSlot: " + slots[i];
-                    StackSlot slot = asStackSlot(slots[i]);
-                    values[mapIndex] = indexForStackSlot(frameMap, slot);
-                    mapIndex++;
-                }
-            }
-            assert mapIndex == total;
-        }
-        return new RegisterSaveLayout(keys, values);
-    }
-
-    /**
-     * Computes the index of a stack slot relative to slot 0. This is also the bit index of stack
-     * slots in the reference map.
-     *
-     * @param slot a stack slot
-     * @return the index of the stack slot
-     */
-    private static int indexForStackSlot(FrameMap frameMap, StackSlot slot) {
-        assert frameMap.offsetForStackSlot(slot) % frameMap.getTarget().wordSize == 0;
-        int value = frameMap.offsetForStackSlot(slot) / frameMap.getTarget().wordSize;
-        return value;
-    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.aarch64/src/org/graalvm/compiler/lir/aarch64/AArch64ZeroMemoryOp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, Arm Limited and affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.graalvm.compiler.lir.aarch64;
+
+import static jdk.vm.ci.aarch64.AArch64.zr;
+import static jdk.vm.ci.code.ValueUtil.asRegister;
+import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.REG;
+
+import org.graalvm.compiler.asm.Label;
+import org.graalvm.compiler.asm.aarch64.AArch64Address;
+import org.graalvm.compiler.asm.aarch64.AArch64Assembler;
+import org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler;
+import org.graalvm.compiler.lir.LIRInstructionClass;
+import org.graalvm.compiler.lir.Opcode;
+import org.graalvm.compiler.lir.asm.CompilationResultBuilder;
+
+import jdk.vm.ci.code.CodeUtil;
+import jdk.vm.ci.code.Register;
+import jdk.vm.ci.meta.AllocatableValue;
+
+/**
+ * Zero a chunk of memory on AArch64.
+ */
+@Opcode("ZERO_MEMORY")
+public final class AArch64ZeroMemoryOp extends AArch64LIRInstruction {
+    public static final LIRInstructionClass<AArch64ZeroMemoryOp> TYPE = LIRInstructionClass.create(AArch64ZeroMemoryOp.class);
+
+    @Use({REG}) protected AllocatableValue addressValue;
+    @Use({REG}) protected AllocatableValue lengthValue;
+
+    private final boolean useDcZva;
+    private final int zvaLength;
+
+    /**
+     * Constructor of AArch64ZeroMemoryOp.
+     *
+     * @param address allocatable 8-byte aligned base address of the memory chunk.
+     * @param length allocatable length of the memory chunk, the value must be multiple of 8.
+     * @param useDcZva is DC ZVA instruction is able to use.
+     * @param zvaLength the ZVA length info of current AArch64 CPU, negative value indicates length
+     *            is unknown at compile time.
+     */
+    public AArch64ZeroMemoryOp(AllocatableValue address, AllocatableValue length, boolean useDcZva, int zvaLength) {
+        super(TYPE);
+        this.addressValue = address;
+        this.lengthValue = length;
+        this.useDcZva = useDcZva;
+        this.zvaLength = zvaLength;
+    }
+
+    @Override
+    protected void emitCode(CompilationResultBuilder crb, AArch64MacroAssembler masm) {
+        Register base = asRegister(addressValue);
+        Register size = asRegister(lengthValue);
+        if (useDcZva && zvaLength > 0) {
+            // From ARMv8-A architecture reference manual D12.2.35 Data Cache Zero ID register:
+            // A valid ZVA length should be a power-of-2 value in [4, 2048]
+            assert (CodeUtil.isPowerOf2(zvaLength) && 4 <= zvaLength && zvaLength <= 2048);
+            emitZeroMemoryWithDc(masm, base, size, zvaLength);
+        } else {
+            // Use store pair instructions (STP) to zero memory as a fallback.
+            emitZeroMemoryWithStp(masm, base, size);
+        }
+    }
+
+    /**
+     * Zero a chunk of memory with DC ZVA instructions.
+     *
+     * @param masm the AArch64 macro assembler.
+     * @param base base an 8-byte aligned address of the memory chunk to be zeroed.
+     * @param size size of the memory chunk to be zeroed, in bytes, must be multiple of 8.
+     * @param zvaLength the ZVA length info of current AArch64 CPU.
+     */
+    private static void emitZeroMemoryWithDc(AArch64MacroAssembler masm, Register base, Register size, int zvaLength) {
+        Label preLoop = new Label();
+        Label zvaLoop = new Label();
+        Label postLoop = new Label();
+        Label tail = new Label();
+        Label done = new Label();
+
+        try (AArch64MacroAssembler.ScratchRegister sc1 = masm.getScratchRegister()) {
+            Register rscratch1 = sc1.getRegister();
+
+            // Count number of bytes to be pre-zeroed to align base address with ZVA length.
+            masm.neg(64, rscratch1, base);
+            masm.and(64, rscratch1, rscratch1, zvaLength - 1);
+
+            // Is size less than number of bytes to be pre-zeroed? Jump to POST_LOOP if so.
+            masm.cmp(64, size, rscratch1);
+            masm.branchConditionally(AArch64Assembler.ConditionFlag.LE, postLoop);
+            masm.sub(64, size, size, rscratch1);
+
+            // Pre-ZVA loop.
+            masm.bind(preLoop);
+            masm.subs(64, rscratch1, rscratch1, 8);
+            masm.branchConditionally(AArch64Assembler.ConditionFlag.LT, zvaLoop);
+            masm.str(64, zr, AArch64Address.createPostIndexedImmediateAddress(base, 8));
+            masm.jmp(preLoop);
+
+            // ZVA loop.
+            masm.bind(zvaLoop);
+            masm.subs(64, size, size, zvaLength);
+            masm.branchConditionally(AArch64Assembler.ConditionFlag.LT, tail);
+            masm.dc(AArch64Assembler.DataCacheOperationType.ZVA, base);
+            masm.add(64, base, base, zvaLength);
+            masm.jmp(zvaLoop);
+
+            // Handle bytes after ZVA loop.
+            masm.bind(tail);
+            masm.add(64, size, size, zvaLength);
+
+            // Post-ZVA loop.
+            masm.bind(postLoop);
+            masm.subs(64, size, size, 8);
+            masm.branchConditionally(AArch64Assembler.ConditionFlag.LT, done);
+            masm.str(64, zr, AArch64Address.createPostIndexedImmediateAddress(base, 8));
+            masm.jmp(postLoop);
+
+            // Done.
+            masm.bind(done);
+        }
+    }
+
+    /**
+     * Zero a chunk of memory with STP instructions.
+     *
+     * @param masm the AArch64 macro assembler.
+     * @param base base an 8-byte aligned address of the memory chunk to be zeroed.
+     * @param size size of the memory chunk to be zeroed, in bytes, must be multiple of 8.
+     */
+    private static void emitZeroMemoryWithStp(AArch64MacroAssembler masm, Register base, Register size) {
+        Label loop = new Label();
+        Label tail = new Label();
+        Label done = new Label();
+
+        // Jump to DONE if size is zero.
+        masm.cbz(64, size, done);
+
+        // Is base address already 16-byte aligned? Jump to LDP loop if so.
+        masm.tbz(base, 3, loop);
+        masm.sub(64, size, size, 8);
+        masm.str(64, zr, AArch64Address.createPostIndexedImmediateAddress(base, 8));
+
+        // The STP loop that zeros 16 bytes in each iteration.
+        masm.bind(loop);
+        masm.subs(64, size, size, 16);
+        masm.branchConditionally(AArch64Assembler.ConditionFlag.LT, tail);
+        masm.stp(64, zr, zr, AArch64Address.createPostIndexedImmediateAddress(base, 2));
+        masm.jmp(loop);
+
+        // We may need to zero the tail 8 bytes of the memory chunk.
+        masm.bind(tail);
+        masm.adds(64, size, size, 16);
+        masm.branchConditionally(AArch64Assembler.ConditionFlag.EQ, done);
+        masm.str(64, zr, AArch64Address.createPostIndexedImmediateAddress(base, 8));
+
+        // Done.
+        masm.bind(done);
+    }
+}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64ArrayCompareToOp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64ArrayCompareToOp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -155,7 +155,7 @@
         AMD64Address.Scale scale2 = null;
 
         // if (ae != StrIntrinsicNode::LL) {
-        if (kind1 == JavaKind.Byte && kind2 == JavaKind.Byte) {
+        if (!(kind1 == JavaKind.Byte && kind2 == JavaKind.Byte)) {
             stride2x2 = 0x20;
         }
 
@@ -531,7 +531,7 @@
             masm.notq(cnt1);
             masm.bsfq(cnt2, cnt1);
             // if (ae != StrIntrinsicNode::LL) {
-            if (kind1 != JavaKind.Byte && kind2 != JavaKind.Byte) {
+            if (!(kind1 == JavaKind.Byte && kind2 == JavaKind.Byte)) {
                 // Divide diff by 2 to get number of chars
                 masm.sarl(cnt2, 1);
             }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64ArrayEqualsOp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64ArrayEqualsOp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,13 +24,14 @@
 
 package org.graalvm.compiler.lir.amd64;
 
-import jdk.vm.ci.amd64.AMD64;
-import jdk.vm.ci.amd64.AMD64.CPUFeature;
-import jdk.vm.ci.amd64.AMD64Kind;
-import jdk.vm.ci.code.Register;
-import jdk.vm.ci.code.TargetDescription;
-import jdk.vm.ci.meta.JavaKind;
-import jdk.vm.ci.meta.Value;
+import static jdk.vm.ci.code.ValueUtil.asRegister;
+import static org.graalvm.compiler.asm.amd64.AMD64Assembler.AMD64BinaryArithmetic.XOR;
+import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.CONST;
+import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.ILLEGAL;
+import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.REG;
+
+import java.util.Objects;
+
 import org.graalvm.compiler.asm.Label;
 import org.graalvm.compiler.asm.amd64.AMD64Address;
 import org.graalvm.compiler.asm.amd64.AMD64Address.Scale;
@@ -43,16 +44,18 @@
 import org.graalvm.compiler.core.common.LIRKind;
 import org.graalvm.compiler.debug.GraalError;
 import org.graalvm.compiler.lir.LIRInstructionClass;
+import org.graalvm.compiler.lir.LIRValueUtil;
 import org.graalvm.compiler.lir.Opcode;
 import org.graalvm.compiler.lir.asm.CompilationResultBuilder;
 import org.graalvm.compiler.lir.gen.LIRGeneratorTool;
 
-import static jdk.vm.ci.code.ValueUtil.asRegister;
-import static org.graalvm.compiler.asm.amd64.AMD64Assembler.AMD64BinaryArithmetic.XOR;
-import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.ILLEGAL;
-import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.REG;
-
-import java.util.Objects;
+import jdk.vm.ci.amd64.AMD64;
+import jdk.vm.ci.amd64.AMD64.CPUFeature;
+import jdk.vm.ci.amd64.AMD64Kind;
+import jdk.vm.ci.code.Register;
+import jdk.vm.ci.code.TargetDescription;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.Value;
 
 /**
  * Emits code which compares two arrays of the same length. If the CPU supports any vector
@@ -73,13 +76,12 @@
     private final Scale arrayIndexScale1;
     private final Scale arrayIndexScale2;
     private final AVXKind.AVXSize vectorSize;
-    private final int constantLength;
     private final boolean signExtend;
 
     @Def({REG}) private Value resultValue;
     @Alive({REG}) private Value array1Value;
     @Alive({REG}) private Value array2Value;
-    @Alive({REG}) private Value lengthValue;
+    @Alive({REG, CONST}) private Value lengthValue;
     @Temp({REG, ILLEGAL}) private Value temp1;
     @Temp({REG, ILLEGAL}) private Value temp2;
     @Temp({REG}) private Value temp3;
@@ -94,7 +96,7 @@
     @Temp({REG, ILLEGAL}) private Value vectorTemp4;
 
     public AMD64ArrayEqualsOp(LIRGeneratorTool tool, JavaKind kind1, JavaKind kind2, Value result, Value array1, Value array2, Value length,
-                    int constantLength, boolean directPointers, int maxVectorSize) {
+                    boolean directPointers, int maxVectorSize) {
         super(TYPE);
         this.kind1 = kind1;
         this.kind2 = kind2;
@@ -107,7 +109,6 @@
         this.arrayIndexScale1 = Objects.requireNonNull(Scale.fromInt(tool.getProviders().getMetaAccess().getArrayIndexScale(kind1)));
         this.arrayIndexScale2 = Objects.requireNonNull(Scale.fromInt(tool.getProviders().getMetaAccess().getArrayIndexScale(kind2)));
         this.vectorSize = ((AMD64) tool.target().arch).getFeatures().contains(CPUFeature.AVX2) && (maxVectorSize < 0 || maxVectorSize >= 32) ? AVXKind.AVXSize.YMM : AVXKind.AVXSize.XMM;
-        this.constantLength = constantLength;
 
         this.resultValue = result;
         this.array1Value = array1;
@@ -162,7 +163,11 @@
     }
 
     private boolean canGenerateConstantLengthCompare(TargetDescription target) {
-        return constantLength >= 0 && kind1.isNumericInteger() && (kind1 == kind2 || getElementsPerVector(AVXKind.AVXSize.XMM) <= constantLength) && supportsSSE41(target);
+        return LIRValueUtil.isJavaConstant(lengthValue) && kind1.isNumericInteger() && (kind1 == kind2 || getElementsPerVector(AVXKind.AVXSize.XMM) <= constantLength()) && supportsSSE41(target);
+    }
+
+    private int constantLength() {
+        return LIRValueUtil.asJavaConstant(lengthValue).asInt();
     }
 
     @Override
@@ -183,7 +188,11 @@
             masm.leaq(array2, new AMD64Address(asRegister(array2Value), arrayBaseOffset2));
             Register length = asRegister(temp3);
             // Get array length.
-            masm.movl(length, asRegister(lengthValue));
+            if (LIRValueUtil.isJavaConstant(lengthValue)) {
+                masm.movl(length, constantLength());
+            } else {
+                masm.movl(length, asRegister(lengthValue));
+            }
             // copy
             masm.movl(result, length);
             emitArrayCompare(crb, masm, result, array1, array2, length, trueLabel, falseLabel);
@@ -716,10 +725,10 @@
 
     private boolean constantLengthCompareNeedsTmpArrayPointers() {
         AVXKind.AVXSize vSize = vectorSize;
-        if (constantLength < getElementsPerVector(vectorSize)) {
+        if (constantLength() < getElementsPerVector(vectorSize)) {
             vSize = AVXKind.AVXSize.XMM;
         }
-        int vectorCount = constantLength & ~(2 * getElementsPerVector(vSize) - 1);
+        int vectorCount = constantLength() & ~(2 * getElementsPerVector(vSize) - 1);
         return vectorCount > 0;
     }
 
@@ -733,7 +742,7 @@
                     AMD64MacroAssembler asm,
                     Register[] tmpVectors,
                     Label noMatch) {
-        if (constantLength == 0) {
+        if (constantLength() == 0) {
             // do nothing
             return;
         }
@@ -741,13 +750,13 @@
         Register arrayPtr2 = asRegister(array2Value);
         Register tmp = asRegister(temp3);
         AVXKind.AVXSize vSize = vectorSize;
-        if (constantLength < getElementsPerVector(vectorSize)) {
+        if (constantLength() < getElementsPerVector(vectorSize)) {
             vSize = AVXKind.AVXSize.XMM;
         }
         int elementsPerVector = getElementsPerVector(vSize);
-        if (elementsPerVector > constantLength) {
+        if (elementsPerVector > constantLength()) {
             assert kind1 == kind2;
-            int byteLength = constantLength << arrayIndexScale1.log2;
+            int byteLength = constantLength() << arrayIndexScale1.log2;
             // array is shorter than any vector register, use regular XOR instructions
             int movSize = (byteLength < 2) ? 1 : ((byteLength < 4) ? 2 : ((byteLength < 8) ? 4 : 8));
             emitMovBytes(asm, tmp, new AMD64Address(arrayPtr1, arrayBaseOffset1), movSize);
@@ -760,8 +769,8 @@
             }
         } else {
             int elementsPerVectorLoop = 2 * elementsPerVector;
-            int tailCount = constantLength & (elementsPerVectorLoop - 1);
-            int vectorCount = constantLength & ~(elementsPerVectorLoop - 1);
+            int tailCount = constantLength() & (elementsPerVectorLoop - 1);
+            int vectorCount = constantLength() & ~(elementsPerVectorLoop - 1);
             int bytesPerVector = vSize.getBytes();
             if (vectorCount > 0) {
                 Label loopBegin = new Label();
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64ArrayIndexOfOp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64ArrayIndexOfOp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -564,7 +564,7 @@
     private void emitArrayLoad(AMD64MacroAssembler asm, AVXKind.AVXSize vectorSize, Register vecDst, Register arrayPtr, Register index, int offset, boolean alignedLoad) {
         AMD64Address src = new AMD64Address(arrayPtr, index, arrayIndexScale, offset);
         if (asm.supports(CPUFeature.AVX)) {
-            VexMoveOp loadOp = alignedLoad ? VexMoveOp.VMOVDQA : VexMoveOp.VMOVDQU;
+            VexMoveOp loadOp = alignedLoad ? VexMoveOp.VMOVDQA32 : VexMoveOp.VMOVDQU32;
             loadOp.emit(asm, vectorSize, vecDst, src);
         } else {
             // SSE
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64Binary.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64Binary.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64BinaryConsumer.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64BinaryConsumer.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64MathCosOp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64MathCosOp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2016, Intel Corporation. All rights reserved.
  * Intel Math Library (LIBM) Source Code
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64MathExpOp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64MathExpOp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2016, Intel Corporation. All rights reserved.
  * Intel Math Library (LIBM) Source Code
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64MathIntrinsicBinaryOp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64MathIntrinsicBinaryOp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64MathIntrinsicUnaryOp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64MathIntrinsicUnaryOp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64MathLog10Op.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64MathLog10Op.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2016, Intel Corporation. All rights reserved.
  * Intel Math Library (LIBM) Source Code
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64MathLogOp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64MathLogOp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2016, Intel Corporation. All rights reserved.
  * Intel Math Library (LIBM) Source Code
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64MathPowOp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64MathPowOp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2016, Intel Corporation. All rights reserved.
  * Intel Math Library (LIBM) Source Code
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64MathSinOp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64MathSinOp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2016, Intel Corporation. All rights reserved.
  * Intel Math Library (LIBM) Source Code
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64MathTanOp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64MathTanOp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2016, Intel Corporation. All rights reserved.
  * Intel Math Library (LIBM) Source Code
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64Move.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64Move.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64RestoreRegistersOp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64RestoreRegistersOp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,9 +24,9 @@
 
 package org.graalvm.compiler.lir.amd64;
 
-import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.STACK;
 import static jdk.vm.ci.code.ValueUtil.asStackSlot;
 import static jdk.vm.ci.code.ValueUtil.isStackSlot;
+import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.STACK;
 
 import java.util.Arrays;
 
@@ -34,6 +34,7 @@
 import org.graalvm.compiler.lir.LIRInstructionClass;
 import org.graalvm.compiler.lir.LIRValueUtil;
 import org.graalvm.compiler.lir.Opcode;
+import org.graalvm.compiler.lir.StandardOp;
 import org.graalvm.compiler.lir.asm.CompilationResultBuilder;
 
 import jdk.vm.ci.amd64.AMD64Kind;
@@ -45,7 +46,7 @@
  * Restores registers from stack slots.
  */
 @Opcode("RESTORE_REGISTER")
-public class AMD64RestoreRegistersOp extends AMD64LIRInstruction {
+public class AMD64RestoreRegistersOp extends AMD64LIRInstruction implements StandardOp.RestoreRegistersOp {
     public static final LIRInstructionClass<AMD64RestoreRegistersOp> TYPE = LIRInstructionClass.create(AMD64RestoreRegistersOp.class);
 
     /**
@@ -70,7 +71,7 @@
     }
 
     protected Register[] getSavedRegisters() {
-        return save.savedRegisters;
+        return save.getSavedRegisters();
     }
 
     protected void restoreRegister(CompilationResultBuilder crb, AMD64MacroAssembler masm, Register result, StackSlot input) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64SaveRegistersOp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64SaveRegistersOp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,22 +26,17 @@
 
 import static jdk.vm.ci.code.ValueUtil.asStackSlot;
 import static jdk.vm.ci.code.ValueUtil.isStackSlot;
-import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.STACK;
-
-import java.util.Arrays;
 
 import jdk.internal.vm.compiler.collections.EconomicSet;
 import org.graalvm.compiler.asm.amd64.AMD64MacroAssembler;
 import org.graalvm.compiler.lir.LIRInstructionClass;
-import org.graalvm.compiler.lir.LIRValueUtil;
 import org.graalvm.compiler.lir.Opcode;
 import org.graalvm.compiler.lir.StandardOp.SaveRegistersOp;
+import org.graalvm.compiler.lir.amd64.vector.AMD64VectorMove;
 import org.graalvm.compiler.lir.asm.CompilationResultBuilder;
-import org.graalvm.compiler.lir.framemap.FrameMap;
 
 import jdk.vm.ci.amd64.AMD64Kind;
 import jdk.vm.ci.code.Register;
-import jdk.vm.ci.code.RegisterSaveLayout;
 import jdk.vm.ci.code.StackSlot;
 import jdk.vm.ci.meta.AllocatableValue;
 
@@ -49,41 +44,21 @@
  * Saves registers to stack slots.
  */
 @Opcode("SAVE_REGISTER")
-public class AMD64SaveRegistersOp extends AMD64LIRInstruction implements SaveRegistersOp {
+public class AMD64SaveRegistersOp extends SaveRegistersOp {
     public static final LIRInstructionClass<AMD64SaveRegistersOp> TYPE = LIRInstructionClass.create(AMD64SaveRegistersOp.class);
 
     /**
-     * The registers (potentially) saved by this operation.
-     */
-    protected final Register[] savedRegisters;
-
-    /**
-     * The slots to which the registers are saved.
-     */
-    @Def(STACK) protected final AllocatableValue[] slots;
-
-    /**
-     * Specifies if {@link #remove(EconomicSet)} should have an effect.
-     */
-    protected final boolean supportsRemove;
-
-    /**
      *
      * @param savedRegisters the registers saved by this operation which may be subject to
      *            {@linkplain #remove(EconomicSet) pruning}
      * @param savedRegisterLocations the slots to which the registers are saved
-     * @param supportsRemove determines if registers can be {@linkplain #remove(EconomicSet) pruned}
      */
-    public AMD64SaveRegistersOp(Register[] savedRegisters, AllocatableValue[] savedRegisterLocations, boolean supportsRemove) {
-        this(TYPE, savedRegisters, savedRegisterLocations, supportsRemove);
+    public AMD64SaveRegistersOp(Register[] savedRegisters, AllocatableValue[] savedRegisterLocations) {
+        super(TYPE, savedRegisters, savedRegisterLocations);
     }
 
-    public AMD64SaveRegistersOp(LIRInstructionClass<? extends AMD64SaveRegistersOp> c, Register[] savedRegisters, AllocatableValue[] savedRegisterLocations, boolean supportsRemove) {
-        super(c);
-        assert Arrays.asList(savedRegisterLocations).stream().allMatch(LIRValueUtil::isVirtualStackSlot);
-        this.savedRegisters = savedRegisters;
-        this.slots = savedRegisterLocations;
-        this.supportsRemove = supportsRemove;
+    protected AMD64SaveRegistersOp(LIRInstructionClass<AMD64VectorMove.SaveRegistersOp> type, Register[] savedRegisters, AllocatableValue[] slots) {
+        super(type, savedRegisters, slots);
     }
 
     protected void saveRegister(CompilationResultBuilder crb, AMD64MacroAssembler masm, StackSlot result, Register input) {
@@ -91,7 +66,8 @@
     }
 
     @Override
-    public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) {
+    public void emitCode(CompilationResultBuilder crb) {
+        AMD64MacroAssembler masm = (AMD64MacroAssembler) crb.asm;
         for (int i = 0; i < savedRegisters.length; i++) {
             if (savedRegisters[i] != null) {
                 assert isStackSlot(slots[i]) : "not a StackSlot: " + slots[i];
@@ -99,73 +75,4 @@
             }
         }
     }
-
-    public AllocatableValue[] getSlots() {
-        return slots;
-    }
-
-    @Override
-    public boolean supportsRemove() {
-        return supportsRemove;
-    }
-
-    @Override
-    public int remove(EconomicSet<Register> doNotSave) {
-        if (!supportsRemove) {
-            throw new UnsupportedOperationException();
-        }
-        return prune(doNotSave, savedRegisters);
-    }
-
-    static int prune(EconomicSet<Register> toRemove, Register[] registers) {
-        int pruned = 0;
-        for (int i = 0; i < registers.length; i++) {
-            if (registers[i] != null) {
-                if (toRemove.contains(registers[i])) {
-                    registers[i] = null;
-                    pruned++;
-                }
-            }
-        }
-        return pruned;
-    }
-
-    @Override
-    public RegisterSaveLayout getMap(FrameMap frameMap) {
-        int total = 0;
-        for (int i = 0; i < savedRegisters.length; i++) {
-            if (savedRegisters[i] != null) {
-                total++;
-            }
-        }
-        Register[] keys = new Register[total];
-        int[] values = new int[total];
-        if (total != 0) {
-            int mapIndex = 0;
-            for (int i = 0; i < savedRegisters.length; i++) {
-                if (savedRegisters[i] != null) {
-                    keys[mapIndex] = savedRegisters[i];
-                    assert isStackSlot(slots[i]) : "not a StackSlot: " + slots[i];
-                    StackSlot slot = asStackSlot(slots[i]);
-                    values[mapIndex] = indexForStackSlot(frameMap, slot);
-                    mapIndex++;
-                }
-            }
-            assert mapIndex == total;
-        }
-        return new RegisterSaveLayout(keys, values);
-    }
-
-    /**
-     * Computes the index of a stack slot relative to slot 0. This is also the bit index of stack
-     * slots in the reference map.
-     *
-     * @param slot a stack slot
-     * @return the index of the stack slot
-     */
-    private static int indexForStackSlot(FrameMap frameMap, StackSlot slot) {
-        assert frameMap.offsetForStackSlot(slot) % frameMap.getTarget().wordSize == 0;
-        int value = frameMap.offsetForStackSlot(slot) / frameMap.getTarget().wordSize;
-        return value;
-    }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64StringLatin1InflateOp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64StringLatin1InflateOp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64StringUTF16CompressOp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64StringUTF16CompressOp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64VZeroUpper.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64VZeroUpper.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
 import static jdk.vm.ci.code.ValueUtil.asRegister;
 import static jdk.vm.ci.code.ValueUtil.isRegister;
 
+import java.util.ArrayList;
 import java.util.BitSet;
 
 import org.graalvm.compiler.asm.amd64.AMD64MacroAssembler;
@@ -35,6 +36,7 @@
 
 import jdk.vm.ci.amd64.AMD64;
 import jdk.vm.ci.code.Register;
+import jdk.vm.ci.code.RegisterConfig;
 import jdk.vm.ci.code.RegisterValue;
 import jdk.vm.ci.meta.Value;
 
@@ -44,30 +46,27 @@
 
     @Temp protected final RegisterValue[] xmmRegisters;
 
-    public AMD64VZeroUpper(Value[] exclude) {
+    public AMD64VZeroUpper(Value[] exclude, RegisterConfig registerConfig) {
         super(TYPE);
-        xmmRegisters = initRegisterValues(exclude);
+        xmmRegisters = initRegisterValues(exclude, registerConfig);
     }
 
-    private static RegisterValue[] initRegisterValues(Value[] exclude) {
+    private static RegisterValue[] initRegisterValues(Value[] exclude, RegisterConfig registerConfig) {
         BitSet skippedRegs = new BitSet();
-        int numSkipped = 0;
         if (exclude != null) {
             for (Value value : exclude) {
                 if (isRegister(value) && asRegister(value).getRegisterCategory().equals(AMD64.XMM)) {
                     skippedRegs.set(asRegister(value).number);
-                    numSkipped++;
                 }
             }
         }
-        RegisterValue[] regs = new RegisterValue[AMD64.xmmRegistersAVX512.length - numSkipped];
-        for (int i = 0, j = 0; i < AMD64.xmmRegistersAVX512.length; i++) {
-            Register reg = AMD64.xmmRegistersAVX512[i];
-            if (!skippedRegs.get(reg.number)) {
-                regs[j++] = reg.asValue();
+        ArrayList<RegisterValue> regs = new ArrayList<>();
+        for (Register r : registerConfig.getCallerSaveRegisters()) {
+            if (r.getRegisterCategory().equals(AMD64.XMM) && !skippedRegs.get(r.number)) {
+                regs.add(r.asValue());
             }
         }
-        return regs;
+        return regs.toArray(new RegisterValue[regs.size()]);
     }
 
     @Override
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64ZapRegistersOp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64ZapRegistersOp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,26 +24,21 @@
 
 package org.graalvm.compiler.lir.amd64;
 
-import static org.graalvm.compiler.lir.amd64.AMD64SaveRegistersOp.prune;
-
-import jdk.internal.vm.compiler.collections.EconomicSet;
 import org.graalvm.compiler.asm.amd64.AMD64MacroAssembler;
 import org.graalvm.compiler.lir.LIRInstructionClass;
 import org.graalvm.compiler.lir.Opcode;
-import org.graalvm.compiler.lir.StandardOp.SaveRegistersOp;
+import org.graalvm.compiler.lir.StandardOp;
 import org.graalvm.compiler.lir.asm.CompilationResultBuilder;
-import org.graalvm.compiler.lir.framemap.FrameMap;
 
 import jdk.vm.ci.amd64.AMD64Kind;
 import jdk.vm.ci.code.Register;
-import jdk.vm.ci.code.RegisterSaveLayout;
 import jdk.vm.ci.meta.JavaConstant;
 
 /**
  * Writes well known garbage values to registers.
  */
 @Opcode("ZAP_REGISTER")
-public final class AMD64ZapRegistersOp extends AMD64LIRInstruction implements SaveRegistersOp {
+public final class AMD64ZapRegistersOp extends AMD64LIRInstruction implements StandardOp.ZapRegistersOp {
     public static final LIRInstructionClass<AMD64ZapRegistersOp> TYPE = LIRInstructionClass.create(AMD64ZapRegistersOp.class);
 
     /**
@@ -71,19 +66,4 @@
             }
         }
     }
-
-    @Override
-    public boolean supportsRemove() {
-        return true;
-    }
-
-    @Override
-    public int remove(EconomicSet<Register> doNotSave) {
-        return prune(doNotSave, zappedRegisters);
-    }
-
-    @Override
-    public RegisterSaveLayout getMap(FrameMap frameMap) {
-        return new RegisterSaveLayout(new Register[0], new int[0]);
-    }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/vector/AMD64VectorCompareOp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/vector/AMD64VectorCompareOp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,12 +44,18 @@
     public static final LIRInstructionClass<AMD64VectorCompareOp> TYPE = LIRInstructionClass.create(AMD64VectorCompareOp.class);
 
     @Opcode private final VexRMOp opcode;
+    private final AVXSize size;
     @Use({REG}) protected AllocatableValue x;
     @Use({REG, STACK}) protected AllocatableValue y;
 
     public AMD64VectorCompareOp(VexRMOp opcode, AllocatableValue x, AllocatableValue y) {
+        this(opcode, AVXSize.XMM, x, y);
+    }
+
+    public AMD64VectorCompareOp(VexRMOp opcode, AVXSize size, AllocatableValue x, AllocatableValue y) {
         super(TYPE);
         this.opcode = opcode;
+        this.size = size;
         this.x = x;
         this.y = y;
     }
@@ -57,9 +63,9 @@
     @Override
     public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) {
         if (isRegister(y)) {
-            opcode.emit(masm, AVXSize.XMM, asRegister(x), asRegister(y));
+            opcode.emit(masm, size, asRegister(x), asRegister(y));
         } else {
-            opcode.emit(masm, AVXSize.XMM, asRegister(x), (AMD64Address) crb.asAddress(y));
+            opcode.emit(masm, size, asRegister(x), (AMD64Address) crb.asAddress(y));
         }
     }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/vector/AMD64VectorMove.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/vector/AMD64VectorMove.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@
 import static jdk.vm.ci.code.ValueUtil.isRegister;
 import static jdk.vm.ci.code.ValueUtil.isStackSlot;
 import static org.graalvm.compiler.asm.amd64.AMD64Assembler.VexMoveOp.VMOVD;
-import static org.graalvm.compiler.asm.amd64.AMD64Assembler.VexMoveOp.VMOVDQU;
+import static org.graalvm.compiler.asm.amd64.AMD64Assembler.VexMoveOp.VMOVDQU32;
 import static org.graalvm.compiler.asm.amd64.AMD64Assembler.VexMoveOp.VMOVQ;
 import static org.graalvm.compiler.asm.amd64.AMD64Assembler.VexMoveOp.VMOVSD;
 import static org.graalvm.compiler.asm.amd64.AMD64Assembler.VexMoveOp.VMOVSS;
@@ -266,8 +266,8 @@
     public static class SaveRegistersOp extends AMD64SaveRegistersOp {
         public static final LIRInstructionClass<SaveRegistersOp> TYPE = LIRInstructionClass.create(SaveRegistersOp.class);
 
-        public SaveRegistersOp(Register[] savedRegisters, AllocatableValue[] slots, boolean supportsRemove) {
-            super(TYPE, savedRegisters, slots, supportsRemove);
+        public SaveRegistersOp(Register[] savedRegisters, AllocatableValue[] slots) {
+            super(TYPE, savedRegisters, slots);
         }
 
         @Override
@@ -334,7 +334,7 @@
             case DOUBLE:
                 return VMOVUPD;
             default:
-                return VMOVDQU;
+                return VMOVDQU32;
         }
     }
 
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.sparc/src/org/graalvm/compiler/lir/sparc/SPARCSaveRegistersOp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.sparc/src/org/graalvm/compiler/lir/sparc/SPARCSaveRegistersOp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,23 +26,17 @@
 
 import static jdk.vm.ci.code.ValueUtil.asStackSlot;
 import static jdk.vm.ci.code.ValueUtil.isStackSlot;
-import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.STACK;
 import static org.graalvm.compiler.lir.sparc.SPARCDelayedControlTransfer.DUMMY;
 
-import java.util.Arrays;
-
 import jdk.internal.vm.compiler.collections.EconomicSet;
 import org.graalvm.compiler.asm.sparc.SPARCAddress;
 import org.graalvm.compiler.asm.sparc.SPARCMacroAssembler;
 import org.graalvm.compiler.lir.LIRInstructionClass;
-import org.graalvm.compiler.lir.LIRValueUtil;
 import org.graalvm.compiler.lir.Opcode;
 import org.graalvm.compiler.lir.StandardOp.SaveRegistersOp;
 import org.graalvm.compiler.lir.asm.CompilationResultBuilder;
-import org.graalvm.compiler.lir.framemap.FrameMap;
 
 import jdk.vm.ci.code.Register;
-import jdk.vm.ci.code.RegisterSaveLayout;
 import jdk.vm.ci.code.RegisterValue;
 import jdk.vm.ci.code.StackSlot;
 import jdk.vm.ci.meta.AllocatableValue;
@@ -52,42 +46,26 @@
  * Saves registers to stack slots.
  */
 @Opcode("SAVE_REGISTER")
-public class SPARCSaveRegistersOp extends SPARCLIRInstruction implements SaveRegistersOp {
+public class SPARCSaveRegistersOp extends SaveRegistersOp implements SPARCLIRInstructionMixin {
     public static final LIRInstructionClass<SPARCSaveRegistersOp> TYPE = LIRInstructionClass.create(SPARCSaveRegistersOp.class);
     public static final Register RETURN_REGISTER_STORAGE = SPARC.d62;
     public static final SizeEstimate SIZE = SizeEstimate.create(32);
-    /**
-     * The registers (potentially) saved by this operation.
-     */
-    protected final Register[] savedRegisters;
-
-    /**
-     * The slots to which the registers are saved.
-     */
-    @Def(STACK) protected final AllocatableValue[] slots;
-
-    /**
-     * Specifies if {@link #remove(EconomicSet)} should have an effect.
-     */
-    protected final boolean supportsRemove;
+    private final SPARCLIRInstructionMixinStore store;
 
     /**
      *
      * @param savedRegisters the registers saved by this operation which may be subject to
      *            {@linkplain #remove(EconomicSet) pruning}
      * @param savedRegisterLocations the slots to which the registers are saved
-     * @param supportsRemove determines if registers can be {@linkplain #remove(EconomicSet) pruned}
      */
-    public SPARCSaveRegistersOp(Register[] savedRegisters, AllocatableValue[] savedRegisterLocations, boolean supportsRemove) {
-        super(TYPE, SIZE);
-        assert Arrays.asList(savedRegisterLocations).stream().allMatch(LIRValueUtil::isVirtualStackSlot);
-        this.savedRegisters = savedRegisters;
-        this.slots = savedRegisterLocations;
-        this.supportsRemove = supportsRemove;
+    public SPARCSaveRegistersOp(Register[] savedRegisters, AllocatableValue[] savedRegisterLocations) {
+        super(TYPE, savedRegisters, savedRegisterLocations);
+        this.store = new SPARCLIRInstructionMixinStore(SIZE);
     }
 
     @Override
-    public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) {
+    public void emitCode(CompilationResultBuilder crb) {
+        SPARCMacroAssembler masm = (SPARCMacroAssembler) crb.asm;
         // Can be used with VIS3
         // new Movxtod(SPARC.i0, RETURN_REGISTER_STORAGE).emit(masm);
         // We abuse the first stackslot for transferring i0 to return_register_storage
@@ -109,72 +87,8 @@
         }
     }
 
-    public AllocatableValue[] getSlots() {
-        return slots;
-    }
-
     @Override
-    public boolean supportsRemove() {
-        return supportsRemove;
-    }
-
-    @Override
-    public int remove(EconomicSet<Register> doNotSave) {
-        if (!supportsRemove) {
-            throw new UnsupportedOperationException();
-        }
-        return prune(doNotSave, savedRegisters);
-    }
-
-    static int prune(EconomicSet<Register> toRemove, Register[] registers) {
-        int pruned = 0;
-        for (int i = 0; i < registers.length; i++) {
-            if (registers[i] != null) {
-                if (toRemove.contains(registers[i])) {
-                    registers[i] = null;
-                    pruned++;
-                }
-            }
-        }
-        return pruned;
-    }
-
-    @Override
-    public RegisterSaveLayout getMap(FrameMap frameMap) {
-        int total = 0;
-        for (int i = 0; i < savedRegisters.length; i++) {
-            if (savedRegisters[i] != null) {
-                total++;
-            }
-        }
-        Register[] keys = new Register[total];
-        int[] values = new int[total];
-        if (total != 0) {
-            int mapIndex = 0;
-            for (int i = 0; i < savedRegisters.length; i++) {
-                if (savedRegisters[i] != null) {
-                    keys[mapIndex] = savedRegisters[i];
-                    assert isStackSlot(slots[i]) : "not a StackSlot: " + slots[i];
-                    StackSlot slot = asStackSlot(slots[i]);
-                    values[mapIndex] = indexForStackSlot(frameMap, slot);
-                    mapIndex++;
-                }
-            }
-            assert mapIndex == total;
-        }
-        return new RegisterSaveLayout(keys, values);
-    }
-
-    /**
-     * Computes the index of a stack slot relative to slot 0. This is also the bit index of stack
-     * slots in the reference map.
-     *
-     * @param slot a stack slot
-     * @return the index of the stack slot
-     */
-    private static int indexForStackSlot(FrameMap frameMap, StackSlot slot) {
-        assert frameMap.offsetForStackSlot(slot) % frameMap.getTarget().wordSize == 0;
-        int value = frameMap.offsetForStackSlot(slot) / frameMap.getTarget().wordSize;
-        return value;
+    public SPARCLIRInstructionMixinStore getSPARCLIRInstructionStore() {
+        return store;
     }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/BailoutAndRestartBackendException.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/BailoutAndRestartBackendException.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/LIR.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/LIR.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/LIRInstructionVerifier.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.graalvm.compiler.lir;
+
+public interface LIRInstructionVerifier {
+
+    boolean isEnabled();
+
+    void verify(LIRInstruction op, byte[] emittedCode);
+
+}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/LIRVerifier.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/LIRVerifier.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/StandardOp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/StandardOp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,8 @@
 
 package org.graalvm.compiler.lir;
 
+import static jdk.vm.ci.code.ValueUtil.asStackSlot;
+import static jdk.vm.ci.code.ValueUtil.isStackSlot;
 import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.CONST;
 import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.HINT;
 import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.OUTGOING;
@@ -31,9 +33,11 @@
 import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.STACK;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.EnumSet;
 
 import jdk.internal.vm.compiler.collections.EconomicSet;
+import jdk.internal.vm.compiler.collections.Equivalence;
 import org.graalvm.compiler.asm.Label;
 import org.graalvm.compiler.core.common.GraalOptions;
 import org.graalvm.compiler.core.common.cfg.AbstractBlockBase;
@@ -300,22 +304,41 @@
      * {@linkplain #remove(EconomicSet) pruned} and a mapping from registers to the frame slots in
      * which they are saved can be {@linkplain #getMap(FrameMap) retrieved}.
      */
-    public interface SaveRegistersOp {
+    public abstract static class SaveRegistersOp extends LIRInstruction {
+        public static final LIRInstructionClass<SaveRegistersOp> TYPE = LIRInstructionClass.create(SaveRegistersOp.class);
+
+        /**
+         * The registers (potentially) saved by this operation.
+         */
+        protected final Register[] savedRegisters;
 
         /**
-         * Determines if the {@link #remove(EconomicSet)} operation is supported for this object.
+         * The slots to which the registers are saved.
          */
-        boolean supportsRemove();
+        @Def(STACK) protected final AllocatableValue[] slots;
+
+        /**
+         *
+         * @param savedRegisters the registers saved by this operation which may be subject to
+         *            {@linkplain #remove(EconomicSet) pruning}
+         * @param savedRegisterLocations the slots to which the registers are saved
+         */
+        protected SaveRegistersOp(LIRInstructionClass<? extends SaveRegistersOp> c, Register[] savedRegisters, AllocatableValue[] savedRegisterLocations) {
+            super(c);
+            assert Arrays.asList(savedRegisterLocations).stream().allMatch(LIRValueUtil::isVirtualStackSlot);
+            this.savedRegisters = savedRegisters;
+            this.slots = savedRegisterLocations;
+        }
 
         /**
          * Prunes {@code doNotSave} from the registers saved by this operation.
          *
          * @param doNotSave registers that should not be saved by this operation
          * @return the number of registers pruned
-         * @throws UnsupportedOperationException if removal is not {@linkplain #supportsRemove()
-         *             supported}
          */
-        int remove(EconomicSet<Register> doNotSave);
+        public int remove(EconomicSet<Register> doNotSave) {
+            return prune(doNotSave, savedRegisters);
+        }
 
         /**
          * Gets a map from the saved registers saved by this operation to the frame slots in which
@@ -324,8 +347,89 @@
          * @param frameMap used to {@linkplain FrameMap#offsetForStackSlot(StackSlot) convert} a
          *            virtual slot to a frame slot index
          */
-        RegisterSaveLayout getMap(FrameMap frameMap);
+
+        public RegisterSaveLayout getMap(FrameMap frameMap) {
+            int total = 0;
+            for (int i = 0; i < savedRegisters.length; i++) {
+                if (savedRegisters[i] != null) {
+                    total++;
+                }
+            }
+            Register[] keys = new Register[total];
+            int[] values = new int[total];
+            if (total != 0) {
+                int mapIndex = 0;
+                for (int i = 0; i < savedRegisters.length; i++) {
+                    if (savedRegisters[i] != null) {
+                        keys[mapIndex] = savedRegisters[i];
+                        assert isStackSlot(slots[i]) : "not a StackSlot: " + slots[i];
+                        StackSlot slot = asStackSlot(slots[i]);
+                        values[mapIndex] = indexForStackSlot(frameMap, slot);
+                        mapIndex++;
+                    }
+                }
+                assert mapIndex == total;
+            }
+            return new RegisterSaveLayout(keys, values);
+        }
+
+        public Register[] getSavedRegisters() {
+            return savedRegisters;
+        }
+
+        public EconomicSet<Register> getSaveableRegisters() {
+            EconomicSet<Register> registers = EconomicSet.create(Equivalence.IDENTITY);
+            for (Register r : savedRegisters) {
+                registers.add(r);
+            }
+            return registers;
+        }
+
+        public AllocatableValue[] getSlots() {
+            return slots;
+        }
 
+        @Override
+        public abstract void emitCode(CompilationResultBuilder crb);
+
+        static int prune(EconomicSet<Register> toRemove, Register[] registers) {
+            int pruned = 0;
+            for (int i = 0; i < registers.length; i++) {
+                if (registers[i] != null) {
+                    if (toRemove.contains(registers[i])) {
+                        registers[i] = null;
+                        pruned++;
+                    }
+                }
+            }
+            return pruned;
+        }
+
+        /**
+         * Computes the index of a stack slot relative to slot 0. This is also the bit index of
+         * stack slots in the reference map.
+         *
+         * @param slot a stack slot
+         * @return the index of the stack slot
+         */
+        private static int indexForStackSlot(FrameMap frameMap, StackSlot slot) {
+            assert frameMap.offsetForStackSlot(slot) % frameMap.getTarget().wordSize == 0;
+            int value = frameMap.offsetForStackSlot(slot) / frameMap.getTarget().wordSize;
+            return value;
+        }
+    }
+
+    /**
+     * Marker interface for an operation that restores the registers saved by
+     * {@link SaveRegistersOp}.
+     */
+    public interface RestoreRegistersOp {
+    }
+
+    /**
+     * Marker interface for an operation that kills some set register and stack locations.
+     */
+    public interface ZapRegistersOp {
     }
 
     /**
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/lsra/LinearScanLifetimeAnalysisPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/lsra/LinearScanLifetimeAnalysisPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/lsra/LinearScanWalker.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/lsra/LinearScanWalker.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/asm/CompilationResultBuilder.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/asm/CompilationResultBuilder.java	Tue Sep 24 15:19:35 2019 -0400
@@ -41,6 +41,7 @@
 import org.graalvm.compiler.asm.Label;
 import org.graalvm.compiler.code.CompilationResult;
 import org.graalvm.compiler.code.CompilationResult.CodeAnnotation;
+import org.graalvm.compiler.code.CompilationResult.JumpTable;
 import org.graalvm.compiler.code.DataSection.Data;
 import org.graalvm.compiler.code.DataSection.RawData;
 import org.graalvm.compiler.core.common.NumUtil;
@@ -53,6 +54,7 @@
 import org.graalvm.compiler.lir.LIR;
 import org.graalvm.compiler.lir.LIRFrameState;
 import org.graalvm.compiler.lir.LIRInstruction;
+import org.graalvm.compiler.lir.LIRInstructionVerifier;
 import org.graalvm.compiler.lir.LabelRef;
 import org.graalvm.compiler.lir.StandardOp.LabelHoldingOp;
 import org.graalvm.compiler.lir.framemap.FrameMap;
@@ -60,6 +62,7 @@
 import org.graalvm.compiler.options.OptionKey;
 import org.graalvm.compiler.options.OptionType;
 import org.graalvm.compiler.options.OptionValues;
+import org.graalvm.compiler.serviceprovider.GraalServices;
 
 import jdk.vm.ci.code.BailoutException;
 import jdk.vm.ci.code.CodeCacheProvider;
@@ -85,6 +88,16 @@
  */
 public class CompilationResultBuilder {
 
+    private static final List<LIRInstructionVerifier> LIR_INSTRUCTION_VERIFIERS = new ArrayList<>();
+
+    static {
+        for (LIRInstructionVerifier verifier : GraalServices.load(LIRInstructionVerifier.class)) {
+            if (verifier.isEnabled()) {
+                LIR_INSTRUCTION_VERIFIERS.add(verifier);
+            }
+        }
+    }
+
     public static class Options {
         @Option(help = "Include the LIR as comments with the final assembly.", type = OptionType.Debug) //
         public static final OptionKey<Boolean> PrintLIRWithAssembly = new OptionKey<>(false);
@@ -561,7 +574,7 @@
                 if (beforeOp != null) {
                     beforeOp.accept(op);
                 }
-                emitOp(this, op);
+                emitOp(op);
                 if (afterOp != null) {
                     afterOp.accept(op);
                 }
@@ -571,12 +584,29 @@
         }
     }
 
-    private static void emitOp(CompilationResultBuilder crb, LIRInstruction op) {
+    private void emitOp(LIRInstruction op) {
         try {
-            int start = crb.asm.position();
-            op.emitCode(crb);
+            int start = asm.position();
+            op.emitCode(this);
             if (op.getPosition() != null) {
-                crb.recordSourceMapping(start, crb.asm.position(), op.getPosition());
+                recordSourceMapping(start, asm.position(), op.getPosition());
+            }
+            if (LIR_INSTRUCTION_VERIFIERS.size() > 0 && start < asm.position()) {
+                int end = asm.position();
+                for (CodeAnnotation codeAnnotation : compilationResult.getCodeAnnotations()) {
+                    if (codeAnnotation instanceof JumpTable) {
+                        // Skip jump table. Here we assume the jump table is at the tail of the
+                        // emitted code.
+                        int jumpTableStart = codeAnnotation.position;
+                        if (jumpTableStart >= start && jumpTableStart < end) {
+                            end = jumpTableStart;
+                        }
+                    }
+                }
+                byte[] emittedCode = asm.copy(start, end);
+                for (LIRInstructionVerifier verifier : LIR_INSTRUCTION_VERIFIERS) {
+                    verifier.verify(op, emittedCode);
+                }
             }
         } catch (BailoutException e) {
             throw e;
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/asm/CompilationResultBuilderFactory.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/asm/CompilationResultBuilderFactory.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/constopt/ConstantLoadOptimization.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/constopt/ConstantLoadOptimization.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/dfa/LocationMarkerPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/dfa/LocationMarkerPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/framemap/FrameMap.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/framemap/FrameMap.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/framemap/FrameMapBuilder.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/framemap/FrameMapBuilder.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/framemap/FrameMapBuilderImpl.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/framemap/FrameMapBuilderImpl.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/framemap/VirtualStackSlotRange.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/framemap/VirtualStackSlotRange.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/gen/ArithmeticLIRGeneratorTool.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/gen/ArithmeticLIRGeneratorTool.java	Tue Sep 24 15:19:35 2019 -0400
@@ -137,8 +137,4 @@
         throw GraalError.unimplemented("No specialized implementation available");
     }
 
-    @SuppressWarnings("unused")
-    default void emitZeroMemory(Value address, Value length) {
-        throw GraalError.unimplemented("Bulk zeroing is not supported on this platform");
-    }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/gen/DiagnosticLIRGeneratorTool.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/gen/DiagnosticLIRGeneratorTool.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
 
 import org.graalvm.compiler.lir.LIRInstruction;
 import org.graalvm.compiler.lir.StandardOp.SaveRegistersOp;
+import org.graalvm.compiler.lir.StandardOp.ZapRegistersOp;
+
 import jdk.vm.ci.code.Register;
 import jdk.vm.ci.code.RegisterConfig;
 import jdk.vm.ci.code.StackSlot;
@@ -41,25 +43,31 @@
      * Creates a {@link SaveRegistersOp} that fills a given set of registers with known garbage
      * value.
      *
-     * The set of registers actually touched might be {@link SaveRegistersOp#remove reduced} later.
-     *
      * @param zappedRegisters registers to be zapped
      * @param zapValues values used for zapping
      *
      * @see DiagnosticLIRGeneratorTool#createZapRegisters()
      */
-    SaveRegistersOp createZapRegisters(Register[] zappedRegisters, JavaConstant[] zapValues);
+    ZapRegistersOp createZapRegisters(Register[] zappedRegisters, JavaConstant[] zapValues);
 
     /**
-     * Creates a {@link SaveRegistersOp} that fills all
+     * Creates a {@link SaveRegistersOp} that fills a given set of registers with a
+     * {@link LIRGenerator#zapValueForKind known garbage value}.
+     *
+     * @param zappedRegisters registers to be zapped
+     *
+     * @see DiagnosticLIRGeneratorTool#createZapRegisters()
+     */
+    ZapRegistersOp createZapRegisters(Register[] zappedRegisters);
+
+    /**
+     * Creates a {@link ZapRegistersOp} that fills all
      * {@link RegisterConfig#getAllocatableRegisters() allocatable registers} with a
      * {@link LIRGenerator#zapValueForKind known garbage value}.
      *
-     * The set of registers actually touched might be {@link SaveRegistersOp#remove reduced} later.
-     *
      * @see DiagnosticLIRGeneratorTool#createZapRegisters(Register[], JavaConstant[])
      */
-    SaveRegistersOp createZapRegisters();
+    ZapRegistersOp createZapRegisters();
 
     /**
      * Marker interface for {@link LIRInstruction instructions} that should be succeeded with a
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/gen/LIRGenerationResult.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/gen/LIRGenerationResult.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
 import jdk.internal.vm.compiler.collections.Equivalence;
 import org.graalvm.compiler.core.common.CompilationIdentifier;
 import org.graalvm.compiler.core.common.CompilationIdentifier.Verbosity;
+import org.graalvm.compiler.core.common.alloc.RegisterAllocationConfig;
 import org.graalvm.compiler.debug.DebugContext;
 import org.graalvm.compiler.lir.LIR;
 import org.graalvm.compiler.lir.LIRInstruction;
@@ -42,6 +43,7 @@
     private final LIR lir;
     private final FrameMapBuilder frameMapBuilder;
     private FrameMap frameMap;
+    private final RegisterAllocationConfig registerAllocationConfig;
     private final CallingConvention callingConvention;
     /**
      * Records whether the code being generated makes at least one foreign call.
@@ -57,13 +59,18 @@
      */
     private EconomicMap<LIRInstruction, String> comments;
 
-    public LIRGenerationResult(CompilationIdentifier compilationId, LIR lir, FrameMapBuilder frameMapBuilder, CallingConvention callingConvention) {
+    public LIRGenerationResult(CompilationIdentifier compilationId, LIR lir, FrameMapBuilder frameMapBuilder, RegisterAllocationConfig registerAllocationConfig, CallingConvention callingConvention) {
         this.lir = lir;
         this.frameMapBuilder = frameMapBuilder;
+        this.registerAllocationConfig = registerAllocationConfig;
         this.callingConvention = callingConvention;
         this.compilationId = compilationId;
     }
 
+    public RegisterAllocationConfig getRegisterAllocationConfig() {
+        return registerAllocationConfig;
+    }
+
     /**
      * Adds a comment to a {@link LIRInstruction}. Existing comments are replaced.
      */
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/gen/LIRGenerator.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/gen/LIRGenerator.java	Tue Sep 24 15:19:35 2019 -0400
@@ -59,7 +59,7 @@
 import org.graalvm.compiler.lir.StandardOp;
 import org.graalvm.compiler.lir.StandardOp.BlockEndOp;
 import org.graalvm.compiler.lir.StandardOp.LabelOp;
-import org.graalvm.compiler.lir.StandardOp.SaveRegistersOp;
+import org.graalvm.compiler.lir.StandardOp.ZapRegistersOp;
 import org.graalvm.compiler.lir.SwitchStrategy;
 import org.graalvm.compiler.lir.Variable;
 import org.graalvm.compiler.lir.hashing.Hasher;
@@ -604,11 +604,16 @@
     }
 
     @Override
-    public abstract SaveRegistersOp createZapRegisters(Register[] zappedRegisters, JavaConstant[] zapValues);
+    public abstract ZapRegistersOp createZapRegisters(Register[] zappedRegisters, JavaConstant[] zapValues);
 
     @Override
-    public SaveRegistersOp createZapRegisters() {
+    public ZapRegistersOp createZapRegisters() {
         Register[] zappedRegisters = getResult().getFrameMap().getRegisterConfig().getAllocatableRegisters().toArray();
+        return createZapRegisters(zappedRegisters);
+    }
+
+    @Override
+    public ZapRegistersOp createZapRegisters(Register[] zappedRegisters) {
         JavaConstant[] zapValues = new JavaConstant[zappedRegisters.length];
         for (int i = 0; i < zappedRegisters.length; i++) {
             PlatformKind kind = target().arch.getLargestStorableKind(zappedRegisters[i].getRegisterCategory());
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/gen/LIRGeneratorTool.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/gen/LIRGeneratorTool.java	Tue Sep 24 15:19:35 2019 -0400
@@ -279,10 +279,10 @@
         throw GraalError.unimplemented("String.compareTo substitution is not implemented on this architecture");
     }
 
-    Variable emitArrayEquals(JavaKind kind, Value array1, Value array2, Value length, int constantLength, boolean directPointers);
+    Variable emitArrayEquals(JavaKind kind, Value array1, Value array2, Value length, boolean directPointers);
 
     @SuppressWarnings("unused")
-    default Variable emitArrayEquals(JavaKind kind1, JavaKind kind2, Value array1, Value array2, Value length, int constantLength, boolean directPointers) {
+    default Variable emitArrayEquals(JavaKind kind1, JavaKind kind2, Value array1, Value array2, Value length, boolean directPointers) {
         throw GraalError.unimplemented("Array.equals with different types substitution is not implemented on this architecture");
     }
 
@@ -353,4 +353,9 @@
     default Value emitReadReturnAddress(Stamp wordStamp, int returnAddressSize) {
         return emitMove(StackSlot.get(getLIRKind(wordStamp), -returnAddressSize, true));
     }
+
+    @SuppressWarnings("unused")
+    default void emitZeroMemory(Value address, Value length) {
+        throw GraalError.unimplemented("Bulk zeroing is not implemented on this architecture");
+    }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/ssa/SSAVerifier.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/ssa/SSAVerifier.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/stackslotalloc/LSStackSlotAllocator.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/stackslotalloc/LSStackSlotAllocator.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/stackslotalloc/SimpleStackSlotAllocator.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/stackslotalloc/SimpleStackSlotAllocator.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop.phases/src/org/graalvm/compiler/loop/phases/ContextlessLoopPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop.phases/src/org/graalvm/compiler/loop/phases/ContextlessLoopPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop.phases/src/org/graalvm/compiler/loop/phases/ConvertDeoptimizeToGuardPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop.phases/src/org/graalvm/compiler/loop/phases/ConvertDeoptimizeToGuardPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop.phases/src/org/graalvm/compiler/loop/phases/LoopFullUnrollPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop.phases/src/org/graalvm/compiler/loop/phases/LoopFullUnrollPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop.phases/src/org/graalvm/compiler/loop/phases/LoopPartialUnrollPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop.phases/src/org/graalvm/compiler/loop/phases/LoopPartialUnrollPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop.phases/src/org/graalvm/compiler/loop/phases/LoopPeelingPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop.phases/src/org/graalvm/compiler/loop/phases/LoopPeelingPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop.phases/src/org/graalvm/compiler/loop/phases/LoopPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop.phases/src/org/graalvm/compiler/loop/phases/LoopPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop.phases/src/org/graalvm/compiler/loop/phases/LoopSafepointEliminationPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop.phases/src/org/graalvm/compiler/loop/phases/LoopSafepointEliminationPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,18 +40,24 @@
     @Override
     protected void run(StructuredGraph graph, MidTierContext context) {
         LoopsData loops = new LoopsData(graph);
-        if (context.getOptimisticOptimizations().useLoopLimitChecks(graph.getOptions()) && graph.getGuardsStage().allowsFloatingGuards()) {
-            loops.detectedCountedLoops();
-            for (LoopEx loop : loops.countedLoops()) {
-                if (loop.loop().getChildren().isEmpty() && loop.counted().getStamp().getBits() <= 32) {
-                    boolean hasSafepoint = false;
-                    for (LoopEndNode loopEnd : loop.loopBegin().loopEnds()) {
-                        hasSafepoint |= loopEnd.canSafepoint();
+        loops.detectedCountedLoops();
+        for (LoopEx loop : loops.countedLoops()) {
+            if (loop.loop().getChildren().isEmpty() && loop.counted().getStamp().getBits() <= 32) {
+                boolean hasSafepoint = false;
+                for (LoopEndNode loopEnd : loop.loopBegin().loopEnds()) {
+                    hasSafepoint |= loopEnd.canSafepoint();
+                }
+                if (hasSafepoint) {
+                    if (!loop.counted().counterNeverOverflows()) {
+                        // Counter can overflow, need to create a guard.
+                        if (context.getOptimisticOptimizations().useLoopLimitChecks(graph.getOptions()) && graph.getGuardsStage().allowsFloatingGuards()) {
+                            loop.counted().createOverFlowGuard();
+                        } else {
+                            // Cannot disable this safepoint, because the loop could overflow.
+                            continue;
+                        }
                     }
-                    if (hasSafepoint) {
-                        loop.counted().createOverFlowGuard();
-                        loop.loopBegin().disableSafepoint();
-                    }
+                    loop.loopBegin().disableSafepoint();
                 }
             }
         }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop.phases/src/org/graalvm/compiler/loop/phases/LoopTransformations.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop.phases/src/org/graalvm/compiler/loop/phases/LoopTransformations.java	Tue Sep 24 15:19:35 2019 -0400
@@ -62,10 +62,10 @@
 import org.graalvm.compiler.nodes.calc.AddNode;
 import org.graalvm.compiler.nodes.calc.CompareNode;
 import org.graalvm.compiler.nodes.calc.ConditionalNode;
-import org.graalvm.compiler.nodes.calc.IntegerLessThanNode;
 import org.graalvm.compiler.nodes.extended.OpaqueNode;
 import org.graalvm.compiler.nodes.extended.SwitchNode;
 import org.graalvm.compiler.nodes.spi.CoreProviders;
+import org.graalvm.compiler.nodes.util.IntegerHelper;
 import org.graalvm.compiler.phases.common.CanonicalizerPhase;
 
 public abstract class LoopTransformations {
@@ -359,11 +359,12 @@
         ValueNode newLimit = AddNode.add(preCounted.getStart(), preCounted.getCounter().strideNode(), NodeView.DEFAULT);
         // Fetch the variable we are not replacing and configure the one we are
         ValueNode ub = preCounted.getLimit();
+        IntegerHelper helper = preCounted.getCounterIntegerHelper();
         LogicNode entryCheck;
         if (preCounted.getDirection() == Direction.Up) {
-            entryCheck = IntegerLessThanNode.create(newLimit, ub, NodeView.DEFAULT);
+            entryCheck = helper.createCompareNode(newLimit, ub, NodeView.DEFAULT);
         } else {
-            entryCheck = IntegerLessThanNode.create(ub, newLimit, NodeView.DEFAULT);
+            entryCheck = helper.createCompareNode(ub, newLimit, NodeView.DEFAULT);
         }
         newLimit = ConditionalNode.create(entryCheck, newLimit, ub, NodeView.DEFAULT);
         // Re-wire the condition with the new limit
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop.test/src/org/graalvm/compiler/loop/test/LoopPartialUnrollTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop.test/src/org/graalvm/compiler/loop/test/LoopPartialUnrollTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -143,6 +143,35 @@
     }
 
     @Test
+    @Ignore
+    public void testUnsignedLoopCarried() {
+        for (int i = -1; i < 64; i++) {
+            for (int j = 0; j < 64; j++) {
+                test("testUnsignedLoopCarriedSnippet", i, j);
+            }
+        }
+        test("testUnsignedLoopCarriedSnippet", -1 - 32, -1);
+        test("testUnsignedLoopCarriedSnippet", -1 - 4, -1);
+        test("testUnsignedLoopCarriedSnippet", -1 - 32, 0);
+    }
+
+    public static int testUnsignedLoopCarriedSnippet(int start, int end) {
+        int a = 0;
+        int b = 0;
+        int c = 0;
+
+        for (int i = start; branchProbability(0.99, Integer.compareUnsigned(i, end) < 0); i++) {
+            int t1 = volatileInt;
+            int t2 = a + b;
+            c = b;
+            b = a;
+            a = t1 + t2;
+        }
+
+        return c;
+    }
+
+    @Test
     public void testLoopCarried2() {
         for (int i = -1; i < 64; i++) {
             for (int j = -1; j < 64; j++) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop/src/org/graalvm/compiler/loop/CountedLoopInfo.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop/src/org/graalvm/compiler/loop/CountedLoopInfo.java	Tue Sep 24 15:19:35 2019 -0400
@@ -29,7 +29,6 @@
 import static org.graalvm.compiler.nodes.calc.BinaryArithmeticNode.add;
 import static org.graalvm.compiler.nodes.calc.BinaryArithmeticNode.sub;
 
-import org.graalvm.compiler.core.common.NumUtil;
 import org.graalvm.compiler.core.common.type.IntegerStamp;
 import org.graalvm.compiler.core.common.type.Stamp;
 import org.graalvm.compiler.core.common.util.UnsignedLong;
@@ -44,10 +43,12 @@
 import org.graalvm.compiler.nodes.StructuredGraph;
 import org.graalvm.compiler.nodes.ValueNode;
 import org.graalvm.compiler.nodes.calc.ConditionalNode;
-import org.graalvm.compiler.nodes.calc.IntegerLessThanNode;
 import org.graalvm.compiler.nodes.calc.NegateNode;
 import org.graalvm.compiler.nodes.extended.GuardingNode;
 import org.graalvm.compiler.nodes.util.GraphUtil;
+import org.graalvm.compiler.nodes.util.IntegerHelper;
+import org.graalvm.compiler.nodes.util.SignedIntegerHelper;
+import org.graalvm.compiler.nodes.util.UnsignedIntegerHelper;
 
 import jdk.vm.ci.meta.DeoptimizationAction;
 import jdk.vm.ci.meta.DeoptimizationReason;
@@ -61,8 +62,9 @@
     private boolean oneOff;
     private AbstractBeginNode body;
     private IfNode ifNode;
+    private final boolean unsigned;
 
-    CountedLoopInfo(LoopEx loop, InductionVariable iv, IfNode ifNode, ValueNode end, boolean oneOff, AbstractBeginNode body) {
+    CountedLoopInfo(LoopEx loop, InductionVariable iv, IfNode ifNode, ValueNode end, boolean oneOff, AbstractBeginNode body, boolean unsigned) {
         assert iv.direction() != null;
         this.loop = loop;
         this.iv = iv;
@@ -70,6 +72,7 @@
         this.oneOff = oneOff;
         this.body = body;
         this.ifNode = ifNode;
+        this.unsigned = unsigned;
     }
 
     /**
@@ -85,6 +88,10 @@
         return maxTripCountNode(false);
     }
 
+    public boolean isUnsignedCheck() {
+        return this.unsigned;
+    }
+
     /**
      * Returns a node that computes the maximum trip count of this loop. That is the trip count of
      * this loop assuming it is not exited by an other exit than the {@linkplain #getLimitTest()
@@ -127,7 +134,10 @@
             return graph.addOrUniqueWithInputs(div);
         }
         ConstantNode zero = ConstantNode.forIntegerStamp(stamp, 0);
-        LogicNode noEntryCheck = IntegerLessThanNode.create(max, min, NodeView.DEFAULT);
+        // This check is "wide": it looks like min <= max
+        // That's OK even if the loop is strict (`!isLimitIncluded()`)
+        // because in this case, `div` will be zero when min == max
+        LogicNode noEntryCheck = getCounterIntegerHelper().createCompareNode(max, min, NodeView.DEFAULT);
         return graph.addOrUniqueWithInputs(ConditionalNode.create(noEntryCheck, zero, div, NodeView.DEFAULT));
     }
 
@@ -152,15 +162,16 @@
         long initValue = iv.constantInit();
         long range;
         long absStride;
+        IntegerHelper helper = getCounterIntegerHelper(64);
         if (iv.direction() == Direction.Up) {
-            if (endValue < initValue) {
+            if (helper.compare(endValue, initValue) < 0) {
                 return 0;
             }
             range = endValue - iv.constantInit();
             absStride = iv.constantStride();
         } else {
             assert iv.direction() == Direction.Down;
-            if (initValue < endValue) {
+            if (helper.compare(initValue, endValue) < 0) {
                 return 0;
             }
             range = iv.constantInit() - endValue;
@@ -173,6 +184,21 @@
         return Long.divideUnsigned(denominator, absStride);
     }
 
+    public IntegerHelper getCounterIntegerHelper() {
+        IntegerStamp stamp = (IntegerStamp) iv.valueNode().stamp(NodeView.DEFAULT);
+        return getCounterIntegerHelper(stamp.getBits());
+    }
+
+    public IntegerHelper getCounterIntegerHelper(int bits) {
+        IntegerHelper helper;
+        if (isUnsignedCheck()) {
+            helper = new UnsignedIntegerHelper(bits);
+        } else {
+            helper = new SignedIntegerHelper(bits);
+        }
+        return helper;
+    }
+
     public boolean isExactTripCount() {
         return loop.loop().getNaturalExits().size() == 1;
     }
@@ -246,12 +272,13 @@
         ValueNode strideNode = iv.strideNode();
         IntegerStamp strideStamp = (IntegerStamp) strideNode.stamp(NodeView.DEFAULT);
         GraphUtil.tryKillUnused(strideNode);
+        IntegerHelper integerHelper = getCounterIntegerHelper();
         if (getDirection() == Direction.Up) {
-            long max = NumUtil.maxValue(endStamp.getBits());
-            return endStamp.upperBound() <= max - (strideStamp.upperBound() - 1) - (oneOff ? 1 : 0);
+            long max = integerHelper.maxValue();
+            return integerHelper.compare(endStamp.upperBound(), max - (strideStamp.upperBound() - 1) - (oneOff ? 1 : 0)) <= 0;
         } else if (getDirection() == Direction.Down) {
-            long min = NumUtil.minValue(endStamp.getBits());
-            return min + (1 - strideStamp.lowerBound()) + (oneOff ? 1 : 0) <= endStamp.lowerBound();
+            long min = integerHelper.minValue();
+            return integerHelper.compare(min + (1 - strideStamp.lowerBound()) + (oneOff ? 1 : 0), endStamp.lowerBound()) <= 0;
         }
         return false;
     }
@@ -264,22 +291,23 @@
         }
         try (DebugCloseable position = loop.loopBegin().withNodeSourcePosition()) {
             IntegerStamp stamp = (IntegerStamp) iv.valueNode().stamp(NodeView.DEFAULT);
+            IntegerHelper integerHelper = getCounterIntegerHelper();
             StructuredGraph graph = iv.valueNode().graph();
             LogicNode cond; // we use a negated guard with a < condition to achieve a >=
             ConstantNode one = ConstantNode.forIntegerStamp(stamp, 1, graph);
             if (iv.direction() == Direction.Up) {
-                ValueNode v1 = sub(ConstantNode.forIntegerStamp(stamp, NumUtil.maxValue(stamp.getBits())), sub(iv.strideNode(), one));
+                ValueNode v1 = sub(ConstantNode.forIntegerStamp(stamp, integerHelper.maxValue()), sub(iv.strideNode(), one));
                 if (oneOff) {
                     v1 = sub(v1, one);
                 }
-                cond = graph.addOrUniqueWithInputs(IntegerLessThanNode.create(v1, end, NodeView.DEFAULT));
+                cond = graph.addOrUniqueWithInputs(integerHelper.createCompareNode(v1, end, NodeView.DEFAULT));
             } else {
                 assert iv.direction() == Direction.Down;
-                ValueNode v1 = add(ConstantNode.forIntegerStamp(stamp, NumUtil.minValue(stamp.getBits())), sub(one, iv.strideNode()));
+                ValueNode v1 = add(ConstantNode.forIntegerStamp(stamp, integerHelper.minValue()), sub(one, iv.strideNode()));
                 if (oneOff) {
                     v1 = add(v1, one);
                 }
-                cond = graph.addOrUniqueWithInputs(IntegerLessThanNode.create(end, v1, NodeView.DEFAULT));
+                cond = graph.addOrUniqueWithInputs(integerHelper.createCompareNode(end, v1, NodeView.DEFAULT));
             }
             assert graph.getGuardsStage().allowsFloatingGuards();
             overflowGuard = graph.unique(new GuardNode(cond, AbstractBeginNode.prevBegin(loop.entryPoint()), DeoptimizationReason.LoopLimitCheck, DeoptimizationAction.InvalidateRecompile, true,
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop/src/org/graalvm/compiler/loop/DefaultLoopPolicies.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop/src/org/graalvm/compiler/loop/DefaultLoopPolicies.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop/src/org/graalvm/compiler/loop/LoopEx.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop/src/org/graalvm/compiler/loop/LoopEx.java	Tue Sep 24 15:19:35 2019 -0400
@@ -61,9 +61,6 @@
 import org.graalvm.compiler.nodes.calc.AddNode;
 import org.graalvm.compiler.nodes.calc.BinaryArithmeticNode;
 import org.graalvm.compiler.nodes.calc.CompareNode;
-import org.graalvm.compiler.nodes.calc.IntegerBelowNode;
-import org.graalvm.compiler.nodes.calc.IntegerEqualsNode;
-import org.graalvm.compiler.nodes.calc.IntegerLessThanNode;
 import org.graalvm.compiler.nodes.calc.LeftShiftNode;
 import org.graalvm.compiler.nodes.calc.MulNode;
 import org.graalvm.compiler.nodes.calc.NegateNode;
@@ -211,6 +208,7 @@
         return count != 0;
     }
 
+    @SuppressWarnings("fallthrough")
     public boolean detectCounted() {
         if (countedLoopChecked) {
             return isCounted();
@@ -231,27 +229,24 @@
                 negated = true;
             }
             LogicNode ifTest = ifNode.condition();
-            if (!(ifTest instanceof IntegerLessThanNode) && !(ifTest instanceof IntegerEqualsNode)) {
-                if (ifTest instanceof IntegerBelowNode) {
-                    ifTest.getDebug().log("Ignored potential Counted loop at %s with |<|", loopBegin);
-                }
+            if (!(ifTest instanceof CompareNode)) {
                 return false;
             }
-            CompareNode lessThan = (CompareNode) ifTest;
+            CompareNode compare = (CompareNode) ifTest;
             Condition condition = null;
             InductionVariable iv = null;
             ValueNode limit = null;
-            if (isOutsideLoop(lessThan.getX())) {
-                iv = getInductionVariables().get(lessThan.getY());
+            if (isOutsideLoop(compare.getX())) {
+                iv = getInductionVariables().get(compare.getY());
                 if (iv != null) {
-                    condition = lessThan.condition().asCondition().mirror();
-                    limit = lessThan.getX();
+                    condition = compare.condition().asCondition().mirror();
+                    limit = compare.getX();
                 }
-            } else if (isOutsideLoop(lessThan.getY())) {
-                iv = getInductionVariables().get(lessThan.getX());
+            } else if (isOutsideLoop(compare.getY())) {
+                iv = getInductionVariables().get(compare.getX());
                 if (iv != null) {
-                    condition = lessThan.condition().asCondition();
-                    limit = lessThan.getY();
+                    condition = compare.condition().asCondition();
+                    limit = compare.getY();
                 }
             }
             if (condition == null) {
@@ -261,21 +256,34 @@
                 condition = condition.negate();
             }
             boolean oneOff = false;
+            boolean unsigned = false;
             switch (condition) {
                 case EQ:
-                    return false;
-                case NE: {
-                    if (!iv.isConstantStride() || Math.abs(iv.constantStride()) != 1) {
+                    if (iv.initNode() == limit) {
+                        // allow "single iteration" case
+                        oneOff = true;
+                    } else {
                         return false;
                     }
+                    break;
+                case NE: {
                     IntegerStamp initStamp = (IntegerStamp) iv.initNode().stamp(NodeView.DEFAULT);
                     IntegerStamp limitStamp = (IntegerStamp) limit.stamp(NodeView.DEFAULT);
+                    IntegerStamp counterStamp = (IntegerStamp) iv.valueNode().stamp(NodeView.DEFAULT);
                     if (iv.direction() == Direction.Up) {
-                        if (initStamp.upperBound() > limitStamp.lowerBound()) {
+                        if (limitStamp.asConstant() != null && limitStamp.asConstant().asLong() == counterStamp.upperBound()) {
+                            // signed: i < MAX_INT
+                        } else if (limitStamp.asConstant() != null && limitStamp.asConstant().asLong() == counterStamp.unsignedUpperBound()) {
+                            unsigned = true;
+                        } else if (!iv.isConstantStride() || Math.abs(iv.constantStride()) != 1 || initStamp.upperBound() > limitStamp.lowerBound()) {
                             return false;
                         }
                     } else if (iv.direction() == Direction.Down) {
-                        if (initStamp.lowerBound() < limitStamp.upperBound()) {
+                        if (limitStamp.asConstant() != null && limitStamp.asConstant().asLong() == counterStamp.lowerBound()) {
+                            // signed: MIN_INT > i
+                        } else if (limitStamp.asConstant() != null && limitStamp.asConstant().asLong() == counterStamp.unsignedLowerBound()) {
+                            unsigned = true;
+                        } else if (!iv.isConstantStride() || Math.abs(iv.constantStride()) != 1 || initStamp.lowerBound() < limitStamp.upperBound()) {
                             return false;
                         }
                     } else {
@@ -283,23 +291,31 @@
                     }
                     break;
                 }
+                case BE:
+                    unsigned = true; // fall through
                 case LE:
                     oneOff = true;
                     if (iv.direction() != Direction.Up) {
                         return false;
                     }
                     break;
+                case BT:
+                    unsigned = true; // fall through
                 case LT:
                     if (iv.direction() != Direction.Up) {
                         return false;
                     }
                     break;
+                case AE:
+                    unsigned = true; // fall through
                 case GE:
                     oneOff = true;
                     if (iv.direction() != Direction.Down) {
                         return false;
                     }
                     break;
+                case AT:
+                    unsigned = true; // fall through
                 case GT:
                     if (iv.direction() != Direction.Down) {
                         return false;
@@ -308,7 +324,7 @@
                 default:
                     throw GraalError.shouldNotReachHere(condition.toString());
             }
-            counted = new CountedLoopInfo(this, iv, ifNode, limit, oneOff, negated ? ifNode.falseSuccessor() : ifNode.trueSuccessor());
+            counted = new CountedLoopInfo(this, iv, ifNode, limit, oneOff, negated ? ifNode.falseSuccessor() : ifNode.trueSuccessor(), unsigned);
             return true;
         }
         return false;
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop/src/org/graalvm/compiler/loop/LoopFragmentInside.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop/src/org/graalvm/compiler/loop/LoopFragmentInside.java	Tue Sep 24 15:19:35 2019 -0400
@@ -71,8 +71,7 @@
 import org.graalvm.compiler.nodes.extended.OpaqueNode;
 import org.graalvm.compiler.nodes.memory.MemoryPhiNode;
 import org.graalvm.compiler.nodes.util.GraphUtil;
-
-import jdk.vm.ci.code.CodeUtil;
+import org.graalvm.compiler.nodes.util.IntegerHelper;
 
 public class LoopFragmentInside extends LoopFragment {
 
@@ -206,18 +205,19 @@
                 ValueNode limit = counted.getLimit();
                 int bits = ((IntegerStamp) limit.stamp(NodeView.DEFAULT)).getBits();
                 ValueNode newLimit = SubNode.create(limit, opaque, NodeView.DEFAULT);
+                IntegerHelper helper = counted.getCounterIntegerHelper();
                 LogicNode overflowCheck;
                 ConstantNode extremum;
                 if (counted.getDirection() == InductionVariable.Direction.Up) {
                     // limit - counterStride could overflow negatively if limit - min <
                     // counterStride
-                    extremum = ConstantNode.forIntegerBits(bits, CodeUtil.minValue(bits));
+                    extremum = ConstantNode.forIntegerBits(bits, helper.minValue());
                     overflowCheck = IntegerBelowNode.create(SubNode.create(limit, extremum, NodeView.DEFAULT), opaque, NodeView.DEFAULT);
                 } else {
                     assert counted.getDirection() == InductionVariable.Direction.Down;
                     // limit - counterStride could overflow if max - limit < -counterStride
                     // i.e., counterStride < limit - max
-                    extremum = ConstantNode.forIntegerBits(bits, CodeUtil.maxValue(bits));
+                    extremum = ConstantNode.forIntegerBits(bits, helper.maxValue());
                     overflowCheck = IntegerBelowNode.create(opaque, SubNode.create(limit, extremum, NodeView.DEFAULT), NodeView.DEFAULT);
                 }
                 newLimit = ConditionalNode.create(overflowCheck, extremum, newLimit, NodeView.DEFAULT);
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.microbenchmarks/src/org/graalvm/compiler/microbenchmarks/graal/ConditionalEliminationBenchmark.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.microbenchmarks/src/org/graalvm/compiler/microbenchmarks/graal/ConditionalEliminationBenchmark.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.microbenchmarks/src/org/graalvm/compiler/microbenchmarks/lir/GraalCompilerState.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.microbenchmarks/src/org/graalvm/compiler/microbenchmarks/lir/GraalCompilerState.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,6 +45,7 @@
 import org.graalvm.compiler.core.LIRGenerationPhase.LIRGenerationContext;
 import org.graalvm.compiler.core.common.CompilationIdentifier;
 import org.graalvm.compiler.core.common.alloc.ComputeBlockOrder;
+import org.graalvm.compiler.core.common.alloc.RegisterAllocationConfig;
 import org.graalvm.compiler.core.common.cfg.AbstractBlockBase;
 import org.graalvm.compiler.core.gen.LIRCompilerBackend;
 import org.graalvm.compiler.core.gen.LIRGenerationProvider;
@@ -377,7 +378,8 @@
 
         LIR lir = new LIR(cfg, linearScanOrder, codeEmittingOrder, getGraphOptions(), getGraphDebug());
         LIRGenerationProvider lirBackend = (LIRGenerationProvider) request.backend;
-        lirGenRes = lirBackend.newLIRGenerationResult(graph.compilationId(), lir, registerConfig, request.graph, stub);
+        RegisterAllocationConfig registerAllocationConfig = request.backend.newRegisterAllocationConfig(registerConfig, null);
+        lirGenRes = lirBackend.newLIRGenerationResult(graph.compilationId(), lir, registerAllocationConfig, request.graph, stub);
         lirGenTool = lirBackend.newLIRGenerator(lirGenRes);
         nodeLirGen = lirBackend.newNodeLIRBuilder(request.graph, lirGenTool);
     }
@@ -441,7 +443,7 @@
     }
 
     protected AllocationContext createAllocationContext() {
-        return new AllocationContext(lirGenTool.getSpillMoveFactory(), request.backend.newRegisterAllocationConfig(registerConfig, null));
+        return new AllocationContext(lirGenTool.getSpillMoveFactory(), lirGenRes.getRegisterAllocationConfig());
     }
 
     /**
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes.test/src/org/graalvm/compiler/nodes/test/IfNodeCanonicalizationTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes.test/src/org/graalvm/compiler/nodes/test/IfNodeCanonicalizationTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes.test/src/org/graalvm/compiler/nodes/test/LoopPhiCanonicalizerTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes.test/src/org/graalvm/compiler/nodes/test/LoopPhiCanonicalizerTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes.test/src/org/graalvm/compiler/nodes/test/PrimitiveStampBoundaryTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes.test/src/org/graalvm/compiler/nodes/test/PrimitiveStampBoundaryTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes.test/src/org/graalvm/compiler/nodes/test/ShortCircuitOrNodeTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes.test/src/org/graalvm/compiler/nodes/test/ShortCircuitOrNodeTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/AbstractFixedGuardNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/AbstractFixedGuardNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/CallTargetNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/CallTargetNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/ComputeObjectAddressNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/ComputeObjectAddressNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/ControlSplitNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/ControlSplitNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,6 @@
 package org.graalvm.compiler.nodes;
 
 import org.graalvm.compiler.core.common.type.Stamp;
-import org.graalvm.compiler.graph.IterableNodeType;
 import org.graalvm.compiler.graph.NodeClass;
 import org.graalvm.compiler.nodeinfo.NodeInfo;
 
@@ -34,7 +33,7 @@
  * (ie. have more than one successor).
  */
 @NodeInfo
-public abstract class ControlSplitNode extends FixedNode implements IterableNodeType {
+public abstract class ControlSplitNode extends FixedNode {
     public static final NodeClass<ControlSplitNode> TYPE = NodeClass.create(ControlSplitNode.class);
 
     protected ControlSplitNode(NodeClass<? extends ControlSplitNode> c, Stamp stamp) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/DeoptimizingNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/DeoptimizingNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/FixedGuardNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/FixedGuardNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/FrameState.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/FrameState.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/GraphEncoder.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/GraphEncoder.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/IfNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/IfNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -49,6 +49,7 @@
 import org.graalvm.compiler.debug.DebugCloseable;
 import org.graalvm.compiler.debug.DebugContext;
 import org.graalvm.compiler.debug.GraalError;
+import org.graalvm.compiler.graph.IterableNodeType;
 import org.graalvm.compiler.graph.Node;
 import org.graalvm.compiler.graph.NodeClass;
 import org.graalvm.compiler.graph.NodeSourcePosition;
@@ -61,11 +62,12 @@
 import org.graalvm.compiler.nodes.calc.AddNode;
 import org.graalvm.compiler.nodes.calc.CompareNode;
 import org.graalvm.compiler.nodes.calc.ConditionalNode;
+import org.graalvm.compiler.nodes.calc.FloatNormalizeCompareNode;
 import org.graalvm.compiler.nodes.calc.IntegerBelowNode;
 import org.graalvm.compiler.nodes.calc.IntegerEqualsNode;
 import org.graalvm.compiler.nodes.calc.IntegerLessThanNode;
+import org.graalvm.compiler.nodes.calc.IntegerNormalizeCompareNode;
 import org.graalvm.compiler.nodes.calc.IsNullNode;
-import org.graalvm.compiler.nodes.calc.NormalizeCompareNode;
 import org.graalvm.compiler.nodes.calc.ObjectEqualsNode;
 import org.graalvm.compiler.nodes.extended.UnboxNode;
 import org.graalvm.compiler.nodes.java.InstanceOfNode;
@@ -90,9 +92,12 @@
  * of a comparison.
  */
 @NodeInfo(cycles = CYCLES_1, size = SIZE_2, sizeRationale = "2 jmps")
-public final class IfNode extends ControlSplitNode implements Simplifiable, LIRLowerable, SwitchFoldable {
+public final class IfNode extends ControlSplitNode implements Simplifiable, LIRLowerable, IterableNodeType, SwitchFoldable {
     public static final NodeClass<IfNode> TYPE = NodeClass.create(IfNode.class);
 
+    private static final int MAX_USAGE_COLOR_SET_SIZE = 64;
+    private static final int MAX_FRAMESTATE_SEARCH_DEPTH = 4;
+
     private static final CounterKey CORRECTED_PROBABILITIES = DebugContext.counter("CorrectedProbabilities");
 
     @Successor AbstractBeginNode trueSuccessor;
@@ -346,7 +351,7 @@
         }
     }
 
-    private boolean isUnboxedFrom(MetaAccessProvider meta, NodeView view, ValueNode x, ValueNode src) {
+    private static boolean isUnboxedFrom(MetaAccessProvider meta, NodeView view, ValueNode x, ValueNode src) {
         if (x == src) {
             return true;
         } else if (x instanceof UnboxNode) {
@@ -1118,6 +1123,9 @@
                         return null;
                     }
                     boolean unsigned = cond1.isUnsigned() || cond2.isUnsigned();
+                    boolean floatingPoint = x.stamp(NodeView.from(tool)) instanceof FloatStamp;
+                    assert !floatingPoint || y.stamp(NodeView.from(tool)) instanceof FloatStamp;
+                    assert !(floatingPoint && unsigned);
 
                     long expected1 = expectedConstantForNormalize(cond1);
                     long expected2 = expectedConstantForNormalize(cond2);
@@ -1134,26 +1142,22 @@
                         // cannot be expressed by NormalizeCompareNode
                         return null;
                     }
-                    if (unsigned) {
-                        // for unsigned comparisons, we need to add MIN_VALUE (see
-                        // Long.compareUnsigned)
-                        ValueNode minValue = graph().unique(ConstantNode.forIntegerStamp(x.stamp,
-                                        x.stamp.getStackKind().getMinValue()));
-                        x = graph().unique(new AddNode(x, minValue));
-                        y = graph().unique(new AddNode(y, minValue));
+                    if (floatingPoint) {
+                        boolean unorderedLess = false;
+                        if (((FloatStamp) x.stamp).canBeNaN() || ((FloatStamp) y.stamp).canBeNaN()) {
+                            // we may encounter NaNs, check the unordered value
+                            // (following the original condition's "unorderedIsTrue" path)
+                            long unorderedValue = condition1.unorderedIsTrue() ? c1 : condition2.unorderedIsTrue() ? c2 : c3;
+                            if (unorderedValue == 0) {
+                                // returning "0" for unordered is not possible
+                                return null;
+                            }
+                            unorderedLess = unorderedValue == -1;
+                        }
+                        return graph().unique(new FloatNormalizeCompareNode(x, y, stackKind, unorderedLess));
+                    } else {
+                        return graph().unique(new IntegerNormalizeCompareNode(x, y, stackKind, unsigned));
                     }
-                    boolean unorderedLess = false;
-                    if (x.stamp instanceof FloatStamp && (((FloatStamp) x.stamp).canBeNaN() || ((FloatStamp) y.stamp).canBeNaN())) {
-                        // we may encounter NaNs, check the unordered value
-                        // (following the original condition's "unorderedIsTrue" path)
-                        long unorderedValue = condition1.unorderedIsTrue() ? c1 : condition2.unorderedIsTrue() ? c2 : c3;
-                        if (unorderedValue == 0) {
-                            // returning "0" for unordered is not possible
-                            return null;
-                        }
-                        unorderedLess = unorderedValue == -1;
-                    }
-                    return graph().unique(new NormalizeCompareNode(x, y, stackKind, unorderedLess));
                 }
             }
         }
@@ -1171,6 +1175,15 @@
         }
     }
 
+    public enum NodeColor {
+        NONE,
+        CONDITION_USAGE,
+        TRUE_BRANCH,
+        FALSE_BRANCH,
+        PHI_MIXED,
+        MIXED
+    }
+
     /**
      * Take an if that is immediately dominated by a merge with a single phi and split off any paths
      * where the test would be statically decidable creating a new merge below the appropriate side
@@ -1189,28 +1202,73 @@
             return false;
         }
         if (merge.getUsageCount() != 1 || merge.phis().count() != 1) {
+            // Don't trigger with multiple phis. Would require more rewiring.
+            // Most of the time the additional phis are memory phis that are removed after
+            // fixed read phase.
             return false;
         }
         if (graph().getGuardsStage().areFrameStatesAtSideEffects() && merge.stateAfter() == null) {
             return false;
         }
-        PhiNode phi = merge.phis().first();
-        if (phi.getUsageCount() != 1) {
-            /*
-             * For simplicity the below code assumes assumes the phi goes dead at the end so skip
-             * this case.
-             */
+
+        PhiNode generalPhi = merge.phis().first();
+        if (!(generalPhi instanceof ValuePhiNode)) {
             return false;
         }
 
+        ValuePhiNode phi = (ValuePhiNode) generalPhi;
+
+        EconomicMap<Node, NodeColor> coloredNodes = EconomicMap.create(Equivalence.IDENTITY, 8);
+
         /*
          * Check that the condition uses the phi and that there is only one user of the condition
          * expression.
          */
-        if (!conditionUses(condition(), phi)) {
+        if (!conditionUses(condition(), phi, coloredNodes)) {
+            return false;
+        }
+
+        if (!mayRemoveSplit(merge)) {
             return false;
         }
 
+        LogicNode[] results = new LogicNode[merge.forwardEndCount()];
+        boolean success = false;
+        for (int i = 0; i < results.length; ++i) {
+            ValueNode value = phi.valueAt(i);
+            LogicNode curResult = computeCondition(tool, condition, phi, value);
+            if (curResult != condition) {
+                for (Node n : curResult.inputs()) {
+                    if (n instanceof ConstantNode || n instanceof ParameterNode || n instanceof FixedNode) {
+                        // Constant inputs or parameters or fixed nodes are OK.
+                    } else if (n == value) {
+                        // References to the value itself are also OK.
+                    } else {
+                        // Input may cause scheduling issues.
+                        curResult = condition;
+                        break;
+                    }
+                }
+                success = true;
+            }
+            results[i] = curResult;
+        }
+
+        if (!success) {
+            return false;
+        }
+
+        for (Node usage : phi.usages()) {
+            if (usage == merge.stateAfter()) {
+                // This usage can be ignored, because it is directly in the state after.
+            } else {
+                NodeColor color = colorUsage(coloredNodes, usage, merge, this.trueSuccessor(), this.falseSuccessor());
+                if (color == NodeColor.MIXED) {
+                    return false;
+                }
+            }
+        }
+
         /*
          * We could additionally filter for the case that at least some of the Phi inputs or one of
          * the condition inputs are constants but there are cases where a non-constant is
@@ -1220,23 +1278,27 @@
         /* Each successor of the if gets a new merge if needed. */
         MergeNode trueMerge = null;
         MergeNode falseMerge = null;
-
+        int i = 0;
         for (EndNode end : merge.forwardEnds().snapshot()) {
-            Node value = phi.valueAt(end);
-            LogicNode result = computeCondition(tool, condition, phi, value);
+            ValueNode value = phi.valueAt(end);
+            LogicNode result = results[i++];
             if (result instanceof LogicConstantNode) {
-                merge.removeEnd(end);
                 if (((LogicConstantNode) result).getValue()) {
                     if (trueMerge == null) {
-                        trueMerge = insertMerge(trueSuccessor(), merge.stateAfter());
+                        trueMerge = insertMerge(trueSuccessor(), phi, merge.stateAfter(), tool);
+                        replaceNodesInBranch(coloredNodes, NodeColor.TRUE_BRANCH, phi, trueMerge.phis().first());
                     }
+                    trueMerge.phis().first().addInput(value);
                     trueMerge.addForwardEnd(end);
                 } else {
                     if (falseMerge == null) {
-                        falseMerge = insertMerge(falseSuccessor(), merge.stateAfter());
+                        falseMerge = insertMerge(falseSuccessor(), phi, merge.stateAfter(), tool);
+                        replaceNodesInBranch(coloredNodes, NodeColor.FALSE_BRANCH, phi, falseMerge.phis().first());
                     }
+                    falseMerge.phis().first().addInput(value);
                     falseMerge.addForwardEnd(end);
                 }
+                merge.removeEnd(end);
             } else if (result != condition) {
                 // Build a new IfNode using the new condition
                 BeginNode trueBegin = graph().add(new BeginNode());
@@ -1250,28 +1312,29 @@
                 }
                 IfNode newIfNode = graph().add(new IfNode(result, trueBegin, falseBegin, trueSuccessorProbability));
                 newIfNode.setNodeSourcePosition(getNodeSourcePosition());
-                merge.removeEnd(end);
-                ((FixedWithNextNode) end.predecessor()).setNext(newIfNode);
 
                 if (trueMerge == null) {
-                    trueMerge = insertMerge(trueSuccessor(), merge.stateAfter());
+                    trueMerge = insertMerge(trueSuccessor(), phi, merge.stateAfter(), tool);
+                    replaceNodesInBranch(coloredNodes, NodeColor.TRUE_BRANCH, phi, trueMerge.phis().first());
                 }
+                trueMerge.phis().first().addInput(value);
                 trueBegin.setNext(graph().add(new EndNode()));
                 trueMerge.addForwardEnd((EndNode) trueBegin.next());
 
                 if (falseMerge == null) {
-                    falseMerge = insertMerge(falseSuccessor(), merge.stateAfter());
+                    falseMerge = insertMerge(falseSuccessor(), phi, merge.stateAfter(), tool);
+                    replaceNodesInBranch(coloredNodes, NodeColor.FALSE_BRANCH, phi, falseMerge.phis().first());
                 }
+                falseMerge.phis().first().addInput(value);
                 falseBegin.setNext(graph().add(new EndNode()));
                 falseMerge.addForwardEnd((EndNode) falseBegin.next());
 
+                merge.removeEnd(end);
+                ((FixedWithNextNode) end.predecessor()).setNext(newIfNode);
                 end.safeDelete();
             }
         }
 
-        transferProxies(trueSuccessor(), trueMerge);
-        transferProxies(falseSuccessor(), falseMerge);
-
         cleanupMerge(merge);
         cleanupMerge(trueMerge);
         cleanupMerge(falseMerge);
@@ -1279,14 +1342,122 @@
         return true;
     }
 
+    private static void replaceNodesInBranch(EconomicMap<Node, NodeColor> coloredNodes, NodeColor branch, ValuePhiNode phi, ValueNode newValue) {
+        for (Node n : phi.usages().snapshot()) {
+            if (coloredNodes.get(n) == branch) {
+                n.replaceAllInputs(phi, newValue);
+            } else if (coloredNodes.get(n) == NodeColor.PHI_MIXED) {
+                assert n instanceof PhiNode;
+                PhiNode phiNode = (PhiNode) n;
+                AbstractMergeNode merge = phiNode.merge();
+                for (int i = 0; i < merge.forwardEndCount(); ++i) {
+                    if (phiNode.valueAt(i) == phi && coloredNodes.get(merge.forwardEndAt(i)) == branch) {
+                        phiNode.setValueAt(i, newValue);
+                    }
+                }
+            }
+        }
+    }
+
+    private NodeColor colorUsage(EconomicMap<Node, NodeColor> coloredNodes, Node node, MergeNode merge, AbstractBeginNode trueSucc, AbstractBeginNode falseSucc) {
+        NodeColor color = coloredNodes.get(node);
+        if (color == null) {
+
+            if (coloredNodes.size() >= MAX_USAGE_COLOR_SET_SIZE) {
+                return NodeColor.MIXED;
+            }
+
+            coloredNodes.put(node, NodeColor.MIXED);
+
+            if (node == merge) {
+                color = NodeColor.MIXED;
+            } else if (node == trueSucc) {
+                color = NodeColor.TRUE_BRANCH;
+            } else if (node == falseSucc) {
+                color = NodeColor.FALSE_BRANCH;
+            } else {
+                if (node instanceof AbstractMergeNode) {
+                    AbstractMergeNode mergeNode = (AbstractMergeNode) node;
+                    NodeColor combinedColor = null;
+                    for (int i = 0; i < mergeNode.forwardEndCount(); ++i) {
+                        NodeColor curColor = colorUsage(coloredNodes, mergeNode.forwardEndAt(i), merge, trueSucc, falseSucc);
+                        if (combinedColor == null) {
+                            combinedColor = curColor;
+                        } else if (combinedColor != curColor) {
+                            combinedColor = NodeColor.MIXED;
+                            break;
+                        }
+                    }
+                    color = combinedColor;
+                } else if (node instanceof StartNode) {
+                    color = NodeColor.MIXED;
+                } else if (node instanceof FixedNode) {
+                    FixedNode fixedNode = (FixedNode) node;
+                    Node predecessor = fixedNode.predecessor();
+                    assert predecessor != null : fixedNode;
+                    color = colorUsage(coloredNodes, predecessor, merge, trueSucc, falseSucc);
+                } else if (node instanceof PhiNode) {
+                    PhiNode phiNode = (PhiNode) node;
+                    AbstractMergeNode phiMerge = phiNode.merge();
+
+                    if (phiMerge instanceof LoopBeginNode) {
+                        color = colorUsage(coloredNodes, phiMerge, merge, trueSucc, falseSucc);
+                    } else {
+
+                        for (int i = 0; i < phiMerge.forwardEndCount(); ++i) {
+                            NodeColor curColor = colorUsage(coloredNodes, phiMerge.forwardEndAt(i), merge, trueSucc, falseSucc);
+                            if (curColor != NodeColor.TRUE_BRANCH && curColor != NodeColor.FALSE_BRANCH) {
+                                color = NodeColor.MIXED;
+                                break;
+                            }
+                        }
+
+                        if (color == null) {
+                            // Each of the inputs to the phi are either coming unambigously from
+                            // true or false branch.
+                            color = NodeColor.PHI_MIXED;
+                            assert node instanceof PhiNode;
+                        }
+                    }
+                } else {
+                    NodeColor combinedColor = null;
+                    for (Node n : node.usages()) {
+                        if (n != node) {
+                            NodeColor curColor = colorUsage(coloredNodes, n, merge, trueSucc, falseSucc);
+                            if (combinedColor == null) {
+                                combinedColor = curColor;
+                            } else if (combinedColor != curColor) {
+                                combinedColor = NodeColor.MIXED;
+                                break;
+                            }
+                        }
+                    }
+                    if (combinedColor == NodeColor.PHI_MIXED) {
+                        combinedColor = NodeColor.MIXED;
+                    }
+                    if (combinedColor == null) {
+                        // Floating node without usages => association unclear.
+                        combinedColor = NodeColor.MIXED;
+                    }
+                    color = combinedColor;
+                }
+            }
+
+            assert color != null : node;
+            coloredNodes.put(node, color);
+        }
+        return color;
+    }
+
     /**
      * @param condition
      * @param phi
+     * @param coloredNodes
      * @return true if the passed in {@code condition} uses {@code phi} and the condition is only
      *         used once. Since the phi will go dead the condition using it will also have to be
      *         dead after the optimization.
      */
-    private static boolean conditionUses(LogicNode condition, PhiNode phi) {
+    private static boolean conditionUses(LogicNode condition, PhiNode phi, EconomicMap<Node, NodeColor> coloredNodes) {
         if (!condition.hasExactlyOneUsage()) {
             return false;
         }
@@ -1299,14 +1470,20 @@
                  * condition.
                  */
                 ShortCircuitOrNode orNode = (ShortCircuitOrNode) condition;
-                return (conditionUses(orNode.x, phi) || conditionUses(orNode.y, phi));
+                return (conditionUses(orNode.x, phi, coloredNodes) || conditionUses(orNode.y, phi, coloredNodes));
             }
         } else if (condition instanceof Canonicalizable.Unary<?>) {
             Canonicalizable.Unary<?> unary = (Canonicalizable.Unary<?>) condition;
-            return unary.getValue() == phi;
+            if (unary.getValue() == phi) {
+                coloredNodes.put(condition, NodeColor.CONDITION_USAGE);
+                return true;
+            }
         } else if (condition instanceof Canonicalizable.Binary<?>) {
             Canonicalizable.Binary<?> binary = (Canonicalizable.Binary<?>) condition;
-            return binary.getX() == phi || binary.getY() == phi;
+            if (binary.getX() == phi || binary.getY() == phi) {
+                coloredNodes.put(condition, NodeColor.CONDITION_USAGE);
+                return true;
+            }
         }
         return false;
     }
@@ -1343,10 +1520,8 @@
             }
         } else if (condition instanceof Canonicalizable.Binary<?>) {
             Canonicalizable.Binary<Node> compare = (Canonicalizable.Binary<Node>) condition;
-            if (compare.getX() == phi) {
-                return (LogicNode) compare.canonical(tool, value, compare.getY());
-            } else if (compare.getY() == phi) {
-                return (LogicNode) compare.canonical(tool, compare.getX(), value);
+            if (compare.getX() == phi || compare.getY() == phi) {
+                return (LogicNode) compare.canonical(tool, compare.getX() == phi ? value : compare.getX(), compare.getY() == phi ? value : compare.getY());
             }
         } else if (condition instanceof Canonicalizable.Unary<?>) {
             Canonicalizable.Unary<Node> compare = (Canonicalizable.Unary<Node>) condition;
@@ -1360,15 +1535,6 @@
         return condition;
     }
 
-    private static void transferProxies(AbstractBeginNode successor, MergeNode falseMerge) {
-        if (successor instanceof LoopExitNode && falseMerge != null) {
-            LoopExitNode loopExitNode = (LoopExitNode) successor;
-            for (ProxyNode proxy : loopExitNode.proxies().snapshot()) {
-                proxy.replaceFirstInput(successor, falseMerge);
-            }
-        }
-    }
-
     private void cleanupMerge(MergeNode merge) {
         if (merge != null && merge.isAlive()) {
             if (merge.forwardEndCount() == 0) {
@@ -1380,30 +1546,31 @@
     }
 
     @SuppressWarnings("try")
-    private MergeNode insertMerge(AbstractBeginNode begin, FrameState stateAfter) {
+    private MergeNode insertMerge(AbstractBeginNode begin, ValuePhiNode oldPhi, FrameState stateAfter, SimplifierTool tool) {
         MergeNode merge = graph().add(new MergeNode());
-        if (!begin.anchored().isEmpty()) {
-            Object before = begin.anchored().snapshot();
-            begin.replaceAtUsages(InputType.Guard, merge);
-            begin.replaceAtUsages(InputType.Anchor, merge);
-            assert begin.anchored().isEmpty() : before + " " + begin.anchored().snapshot();
+
+        AbstractBeginNode newBegin;
+        try (DebugCloseable position = begin.withNodeSourcePosition()) {
+            newBegin = graph().add(new BeginNode());
+            begin.replaceAtPredecessor(newBegin);
+            newBegin.setNext(begin);
         }
 
-        AbstractBeginNode theBegin = begin;
-        if (begin instanceof LoopExitNode) {
-            // Insert an extra begin to make it easier.
-            try (DebugCloseable position = begin.withNodeSourcePosition()) {
-                theBegin = graph().add(new BeginNode());
-                begin.replaceAtPredecessor(theBegin);
-                theBegin.setNext(begin);
-            }
+        FixedNode next = newBegin.next();
+        next.replaceAtPredecessor(merge);
+        newBegin.setNext(graph().add(new EndNode()));
+        merge.addForwardEnd((EndNode) newBegin.next());
+
+        ValuePhiNode phi = begin.graph().addOrUnique(new ValuePhiNode(oldPhi.stamp(NodeView.DEFAULT), merge));
+        phi.addInput(oldPhi);
+
+        if (stateAfter != null) {
+            FrameState newState = stateAfter.duplicate();
+            newState.replaceAllInputs(oldPhi, phi);
+            merge.setStateAfter(newState);
         }
-        FixedNode next = theBegin.next();
-        next.replaceAtPredecessor(merge);
-        theBegin.setNext(graph().add(new EndNode()));
-        merge.addForwardEnd((EndNode) theBegin.next());
-        merge.setStateAfter(stateAfter);
         merge.setNext(next);
+        tool.addToWorkList(begin);
         return merge;
     }
 
@@ -1481,14 +1648,49 @@
         // Ensure phi is used by at most the comparison and the merge's frame state (if any)
         ValuePhiNode phi = (ValuePhiNode) singleUsage;
         NodeIterable<Node> phiUsages = phi.usages();
-        if (phiUsages.count() > 2) {
+        for (Node usage : phiUsages) {
+            if (usage == compare) {
+                continue;
+            }
+            if (usage == merge.stateAfter()) {
+                continue;
+            }
+            // Checkstyle: stop
+            // @formatter:off
+            //
+            // We also want to allow the usage to be on the loop-proxy if one of the branches is a
+            // loop exit.
+            //
+            // This pattern:
+            //
+            //      if------->cond
+            //     /  \
+            // begin  begin
+            //   |      |
+            //  end    end        C1 V2
+            //     \  /            \ /
+            //     merge---------->phi<------    C1
+            //       |              ^        \  /
+            //       if-------------|-------->==
+            //      /  \            |
+            //     A    B<--------Proxy
+            //
+            // Must be simplified to:
+            //
+            //       if---------------------->cond
+            //      /  \
+            //     A    B<--------Proxy------>V2
+            //
+            // @formatter:on
+            // Checkstyle: resume
+            if (usage instanceof ValueProxyNode) {
+                ValueProxyNode proxy = (ValueProxyNode) usage;
+                if (proxy.proxyPoint() == trueSuccessor || proxy.proxyPoint() == falseSuccessor) {
+                    continue;
+                }
+            }
             return false;
         }
-        for (Node usage : phiUsages) {
-            if (usage != compare && usage != merge.stateAfter()) {
-                return false;
-            }
-        }
 
         List<EndNode> mergePredecessors = merge.cfgPredecessors().snapshot();
         assert phi.valueCount() == merge.forwardEndCount();
@@ -1499,8 +1701,7 @@
             return false;
         }
 
-        // Sanity check that both ends are not followed by a merge without frame state.
-        if (!checkFrameState(trueSuccessor()) && !checkFrameState(falseSuccessor())) {
+        if (!mayRemoveSplit(merge)) {
             return false;
         }
 
@@ -1527,8 +1728,8 @@
         assert !ends.hasNext();
         assert falseEnds.size() + trueEnds.size() == xs.length;
 
-        connectEnds(falseEnds, phiValues, oldFalseSuccessor, merge, tool);
-        connectEnds(trueEnds, phiValues, oldTrueSuccessor, merge, tool);
+        connectEnds(falseEnds, phi, phiValues, oldFalseSuccessor, merge, tool);
+        connectEnds(trueEnds, phi, phiValues, oldTrueSuccessor, merge, tool);
 
         if (this.trueSuccessorProbability == 0.0) {
             for (AbstractEndNode endNode : trueEnds) {
@@ -1562,7 +1763,16 @@
         return true;
     }
 
-    private void propagateZeroProbability(FixedNode startNode) {
+    private boolean mayRemoveSplit(AbstractMergeNode merge) {
+
+        if (merge.stateAfter() != null && (!checkFrameState(trueSuccessor, MAX_FRAMESTATE_SEARCH_DEPTH) || !checkFrameState(trueSuccessor, MAX_FRAMESTATE_SEARCH_DEPTH))) {
+            return false;
+        }
+
+        return true;
+    }
+
+    private static void propagateZeroProbability(FixedNode startNode) {
         Node prev = null;
         for (FixedNode node : GraphUtil.predecessorIterable(startNode)) {
             if (node instanceof IfNode) {
@@ -1598,7 +1808,14 @@
         }
     }
 
-    private static boolean checkFrameState(FixedNode start) {
+    /**
+     * Snippet lowerings may produce patterns without a frame state on the merge. We need to take
+     * extra care when optimizing these patterns.
+     */
+    private static boolean checkFrameState(FixedNode start, int maxDepth) {
+        if (maxDepth == 0) {
+            return false;
+        }
         FixedNode node = start;
         while (true) {
             if (node instanceof AbstractMergeNode) {
@@ -1618,7 +1835,7 @@
             if (node instanceof ControlSplitNode) {
                 ControlSplitNode controlSplitNode = (ControlSplitNode) node;
                 for (Node succ : controlSplitNode.cfgSuccessors()) {
-                    if (checkFrameState((FixedNode) succ)) {
+                    if (checkFrameState((FixedNode) succ, maxDepth - 1)) {
                         return true;
                     }
                 }
@@ -1632,6 +1849,7 @@
             } else if (node instanceof ControlSinkNode) {
                 return true;
             } else {
+                assert false : "unexpected node";
                 return false;
             }
         }
@@ -1642,13 +1860,27 @@
      * end. If {@code ends} is not empty, then {@code successor} is added to {@code tool}'s
      * {@linkplain SimplifierTool#addToWorkList(org.graalvm.compiler.graph.Node) work list}.
      *
+     * @param phi the original single-usage phi of the preceding merge
+     * @param phiValues the values of the phi at the merge, keyed by the merge ends
      * @param oldMerge the merge being removed
-     * @param phiValues the values of the phi at the merge, keyed by the merge ends
      */
-    private void connectEnds(List<EndNode> ends, EconomicMap<AbstractEndNode, ValueNode> phiValues, AbstractBeginNode successor, AbstractMergeNode oldMerge, SimplifierTool tool) {
+    private void connectEnds(List<EndNode> ends, ValuePhiNode phi, EconomicMap<AbstractEndNode, ValueNode> phiValues, AbstractBeginNode successor, AbstractMergeNode oldMerge, SimplifierTool tool) {
         if (!ends.isEmpty()) {
+            // If there was a value proxy usage, then the proxy needs a new value.
+            ValueProxyNode valueProxy = null;
+            if (successor instanceof LoopExitNode) {
+                for (Node usage : phi.usages()) {
+                    if (usage instanceof ValueProxyNode && ((ValueProxyNode) usage).proxyPoint() == successor) {
+                        valueProxy = (ValueProxyNode) usage;
+                    }
+                }
+            }
+            final ValueProxyNode proxy = valueProxy;
             if (ends.size() == 1) {
                 AbstractEndNode end = ends.get(0);
+                if (proxy != null) {
+                    phi.replaceAtUsages(phiValues.get(end), n -> n == proxy);
+                }
                 ((FixedWithNextNode) end.predecessor()).setNext(successor);
                 oldMerge.removeEnd(end);
                 GraphUtil.killCFG(end);
@@ -1660,6 +1892,10 @@
                 PhiNode oldPhi = (PhiNode) oldMerge.usages().first();
                 PhiNode newPhi = graph().addWithoutUnique(new ValuePhiNode(oldPhi.stamp(view), newMerge));
 
+                if (proxy != null) {
+                    phi.replaceAtUsages(newPhi, n -> n == proxy);
+                }
+
                 for (EndNode end : ends) {
                     newPhi.addInput(phiValues.get(end));
                     newMerge.addForwardEnd(end);
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/Invoke.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/Invoke.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/InvokeNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/InvokeNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/InvokeWithExceptionNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/InvokeWithExceptionNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
 
 import org.graalvm.compiler.core.common.type.Stamp;
 import org.graalvm.compiler.debug.DebugCloseable;
+import org.graalvm.compiler.graph.IterableNodeType;
 import org.graalvm.compiler.graph.Node;
 import org.graalvm.compiler.graph.NodeClass;
 import org.graalvm.compiler.nodeinfo.NodeInfo;
@@ -50,7 +51,7 @@
 import jdk.vm.ci.code.BytecodeFrame;
 
 @NodeInfo(nameTemplate = "Invoke!#{p#targetMethod/s}", allowedUsageTypes = {Memory}, cycles = CYCLES_UNKNOWN, size = SIZE_UNKNOWN)
-public final class InvokeWithExceptionNode extends ControlSplitNode implements Invoke, MemoryCheckpoint.Single, LIRLowerable, UncheckedInterfaceProvider {
+public final class InvokeWithExceptionNode extends ControlSplitNode implements Invoke, IterableNodeType, MemoryCheckpoint.Single, LIRLowerable, UncheckedInterfaceProvider {
     public static final NodeClass<InvokeWithExceptionNode> TYPE = NodeClass.create(InvokeWithExceptionNode.class);
 
     private static final double EXCEPTION_PROBA = 1e-5;
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/LogicNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/LogicNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/LoopBeginNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/LoopBeginNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/LoopExitNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/LoopExitNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/PiNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/PiNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,6 @@
 import org.graalvm.compiler.core.common.type.StampFactory;
 import org.graalvm.compiler.core.common.type.TypeReference;
 import org.graalvm.compiler.debug.DebugContext;
-import org.graalvm.compiler.graph.IterableNodeType;
 import org.graalvm.compiler.graph.Node;
 import org.graalvm.compiler.graph.NodeClass;
 import org.graalvm.compiler.graph.spi.Canonicalizable;
@@ -65,7 +64,7 @@
  * also the scheduling restriction enforced by the guard, will go away.
  */
 @NodeInfo(cycles = CYCLES_0, size = SIZE_0)
-public class PiNode extends FloatingGuardedNode implements LIRLowerable, Virtualizable, IterableNodeType, Canonicalizable, ValueProxy {
+public class PiNode extends FloatingGuardedNode implements LIRLowerable, Virtualizable, Canonicalizable, ValueProxy {
 
     public static final NodeClass<PiNode> TYPE = NodeClass.create(PiNode.class);
     @Input ValueNode object;
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/SimplifyingGraphDecoder.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/SimplifyingGraphDecoder.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/StructuredGraph.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/StructuredGraph.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/ValueNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/ValueNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +38,7 @@
 import jdk.vm.ci.meta.Constant;
 import jdk.vm.ci.meta.JavaConstant;
 import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.SerializableConstant;
 
 /**
  * This class represents a value within the graph, including local variables, phis, and all other
@@ -166,6 +167,19 @@
         }
     }
 
+    public final boolean isSerializableConstant() {
+        return isConstant() && asConstant() instanceof SerializableConstant;
+    }
+
+    public final SerializableConstant asSerializableConstant() {
+        Constant value = asConstant();
+        if (value instanceof SerializableConstant) {
+            return (SerializableConstant) value;
+        } else {
+            return null;
+        }
+    }
+
     @Override
     public ValueNode asNode() {
         return this;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/AbstractNormalizeCompareNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.graalvm.compiler.nodes.calc;
+
+import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_2;
+
+import org.graalvm.compiler.core.common.calc.CanonicalCondition;
+import org.graalvm.compiler.core.common.type.Stamp;
+import org.graalvm.compiler.core.common.type.StampFactory;
+import org.graalvm.compiler.graph.IterableNodeType;
+import org.graalvm.compiler.graph.NodeClass;
+import org.graalvm.compiler.nodeinfo.NodeCycles;
+import org.graalvm.compiler.nodeinfo.NodeInfo;
+import org.graalvm.compiler.nodes.ConstantNode;
+import org.graalvm.compiler.nodes.LogicConstantNode;
+import org.graalvm.compiler.nodes.LogicNode;
+import org.graalvm.compiler.nodes.NodeView;
+import org.graalvm.compiler.nodes.ValueNode;
+import org.graalvm.compiler.options.OptionValues;
+
+import jdk.vm.ci.meta.ConstantReflectionProvider;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.MetaAccessProvider;
+
+/**
+ * Returns -1, 0, or 1 if either x &lt; y, x == y, or x &gt; y.
+ */
+@NodeInfo(cycles = NodeCycles.CYCLES_2, size = SIZE_2)
+public abstract class AbstractNormalizeCompareNode extends BinaryNode implements IterableNodeType {
+    public static final NodeClass<AbstractNormalizeCompareNode> TYPE = NodeClass.create(AbstractNormalizeCompareNode.class);
+
+    public AbstractNormalizeCompareNode(NodeClass<? extends BinaryNode> c, JavaKind kind, ValueNode x, ValueNode y) {
+        super(c, StampFactory.forInteger(kind, -1, 1), x, y);
+    }
+
+    @Override
+    public boolean inferStamp() {
+        return false;
+    }
+
+    @Override
+    public Stamp foldStamp(Stamp stampX, Stamp stampY) {
+        return stamp(NodeView.DEFAULT);
+    }
+
+    protected static ValueNode tryConstantFold(ValueNode x, ValueNode y, boolean isUnorderedLess, boolean unsigned, JavaKind kind, ConstantReflectionProvider constantReflection) {
+        LogicNode result = CompareNode.tryConstantFold(CanonicalCondition.EQ, x, y, null, false);
+        if (result instanceof LogicConstantNode) {
+            LogicConstantNode logicConstantNode = (LogicConstantNode) result;
+            LogicNode resultLT = CompareNode.tryConstantFold(unsigned ? CanonicalCondition.BT : CanonicalCondition.LT, x, y, constantReflection, isUnorderedLess);
+            if (resultLT instanceof LogicConstantNode) {
+                LogicConstantNode logicConstantNodeLT = (LogicConstantNode) resultLT;
+                if (logicConstantNodeLT.getValue()) {
+                    return ConstantNode.forIntegerKind(kind, -1);
+                } else if (logicConstantNode.getValue()) {
+                    return ConstantNode.forIntegerKind(kind, 0);
+                } else {
+                    return ConstantNode.forIntegerKind(kind, 1);
+                }
+            }
+        }
+        return null;
+    }
+
+    public abstract LogicNode createEqualComparison();
+
+    public abstract LogicNode createEqualComparison(ConstantReflectionProvider constantReflection, MetaAccessProvider metaAccess, OptionValues options, Integer smallestCompareWidth, NodeView view);
+
+    public LogicNode createLowerComparison() {
+        return createLowerComparison(false);
+    }
+
+    public LogicNode createLowerComparison(ConstantReflectionProvider constantReflection, MetaAccessProvider metaAccess, OptionValues options, Integer smallestCompareWidth, NodeView view) {
+        return createLowerComparison(false, constantReflection, metaAccess, options, smallestCompareWidth, view);
+    }
+
+    public abstract LogicNode createLowerComparison(boolean swapInputs);
+
+    public abstract LogicNode createLowerComparison(boolean swapInputs, ConstantReflectionProvider constantReflection, MetaAccessProvider metaAccess, OptionValues options,
+                    Integer smallestCompareWidth, NodeView view);
+}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/CompareNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/CompareNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -184,17 +184,25 @@
                     realCondition = realCondition.mirror();
                 }
                 return optimizeConditional(constant, (ConditionalNode) nonConstant, constantReflection, realCondition, unorderedIsTrue);
-            } else if (nonConstant instanceof NormalizeCompareNode) {
-                return optimizeNormalizeCompare(constantReflection, metaAccess, options, smallestCompareWidth, constant, (NormalizeCompareNode) nonConstant, mirrored, view);
+            } else if (nonConstant instanceof AbstractNormalizeCompareNode) {
+                return optimizeNormalizeCompare(constantReflection, metaAccess, options, smallestCompareWidth, constant, (AbstractNormalizeCompareNode) nonConstant, mirrored, view);
             } else if (nonConstant instanceof ConvertNode) {
                 ConvertNode convert = (ConvertNode) nonConstant;
                 boolean multiUsage = (convert.asNode().hasMoreThanOneUsage() && convert.getValue().hasExactlyOneUsage());
-                if ((convert instanceof ZeroExtendNode || convert instanceof SignExtendNode) && multiUsage) {
-                    // Do not perform for zero or sign extend if it could introduce
+                if (convert instanceof IntegerConvertNode && multiUsage) {
+                    // Do not perform for integer convers if it could introduce
                     // new live values.
                     return null;
                 }
 
+                if (convert instanceof NarrowNode) {
+                    NarrowNode narrowNode = (NarrowNode) convert;
+                    if (narrowNode.getInputBits() > 32 && !constant.isDefaultForKind()) {
+                        // Avoid large integer constants.
+                        return null;
+                    }
+                }
+
                 boolean supported = true;
                 if (convert.getValue().stamp(view) instanceof IntegerStamp) {
                     IntegerStamp intStamp = (IntegerStamp) convert.getValue().stamp(view);
@@ -233,7 +241,7 @@
 
         @SuppressWarnings("unused")
         protected LogicNode optimizeNormalizeCompare(ConstantReflectionProvider constantReflection, MetaAccessProvider metaAccess, OptionValues options, Integer smallestCompareWidth,
-                        Constant constant, NormalizeCompareNode normalizeNode, boolean mirrored, NodeView view) {
+                        Constant constant, AbstractNormalizeCompareNode normalizeNode, boolean mirrored, NodeView view) {
             throw new PermanentBailoutException("NormalizeCompareNode connected to %s (%s %s %s)", this, constant, normalizeNode, mirrored);
         }
 
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/ConditionalNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/ConditionalNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -214,8 +214,7 @@
                     // (value & 1) == 0 ? 0 : 1
                     // (value & 1) == 1 ? 1 : 0
                     IntegerTestNode integerTestNode = (IntegerTestNode) condition;
-                    if (integerTestNode.getY().isConstant()) {
-                        assert integerTestNode.getX().stamp(view) instanceof IntegerStamp;
+                    if (integerTestNode.getY().isConstant() && integerTestNode.getX().stamp(view) instanceof IntegerStamp) {
                         long testY = integerTestNode.getY().asJavaConstant().asLong();
                         if (testY == 1 && constTrueValue == 0 && constFalseValue == 1) {
                             return IntegerConvertNode.convertUnsigned(AndNode.create(integerTestNode.getX(), integerTestNode.getY(), view), stamp, view);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/FloatNormalizeCompareNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.graalvm.compiler.nodes.calc;
+
+import org.graalvm.compiler.graph.NodeClass;
+import org.graalvm.compiler.graph.spi.CanonicalizerTool;
+import org.graalvm.compiler.nodeinfo.NodeInfo;
+import org.graalvm.compiler.nodes.LogicNode;
+import org.graalvm.compiler.nodes.NodeView;
+import org.graalvm.compiler.nodes.ValueNode;
+import org.graalvm.compiler.options.OptionValues;
+
+import jdk.vm.ci.meta.ConstantReflectionProvider;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.MetaAccessProvider;
+
+/**
+ * If the comparison is undecided (one of the inputs is NaN), the result is 1 if isUnorderedLess is
+ * false and -1 if isUnorderedLess is true.
+ */
+@NodeInfo
+public final class FloatNormalizeCompareNode extends AbstractNormalizeCompareNode {
+    public static final NodeClass<FloatNormalizeCompareNode> TYPE = NodeClass.create(FloatNormalizeCompareNode.class);
+    protected final boolean isUnorderedLess;
+
+    public FloatNormalizeCompareNode(ValueNode x, ValueNode y, JavaKind kind, boolean isUnorderedLess) {
+        super(TYPE, kind, x, y);
+        this.isUnorderedLess = isUnorderedLess;
+    }
+
+    public static ValueNode create(ValueNode x, ValueNode y, boolean isUnorderedLess, JavaKind kind, ConstantReflectionProvider constantReflection) {
+        ValueNode result = tryConstantFold(x, y, isUnorderedLess, false, kind, constantReflection);
+        if (result != null) {
+            return result;
+        }
+
+        return new FloatNormalizeCompareNode(x, y, kind, isUnorderedLess);
+    }
+
+    @Override
+    public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) {
+        NodeView view = NodeView.from(tool);
+        ValueNode result = tryConstantFold(x, y, isUnorderedLess, false, stamp(view).getStackKind(), tool.getConstantReflection());
+        if (result != null) {
+            return result;
+        }
+        return this;
+    }
+
+    public boolean isUnorderedLess() {
+        return isUnorderedLess;
+    }
+
+    @Override
+    public LogicNode createEqualComparison() {
+        return FloatEqualsNode.create(x, y, NodeView.DEFAULT);
+    }
+
+    @Override
+    public LogicNode createEqualComparison(ConstantReflectionProvider constantReflection, MetaAccessProvider metaAccess, OptionValues options, Integer smallestCompareWidth, NodeView view) {
+        return FloatEqualsNode.create(constantReflection, metaAccess, options, smallestCompareWidth, x, y, NodeView.DEFAULT);
+    }
+
+    @Override
+    public LogicNode createLowerComparison(boolean swapInputs) {
+        ValueNode a = swapInputs ? y : x;
+        ValueNode b = swapInputs ? x : y;
+        return FloatLessThanNode.create(a, b, isUnorderedLess() ^ swapInputs, NodeView.DEFAULT);
+    }
+
+    @Override
+    public LogicNode createLowerComparison(boolean swapInputs, ConstantReflectionProvider constantReflection, MetaAccessProvider metaAccess, OptionValues options, Integer smallestCompareWidth,
+                    NodeView view) {
+        ValueNode a = swapInputs ? y : x;
+        ValueNode b = swapInputs ? x : y;
+        return FloatLessThanNode.create(constantReflection, metaAccess, options, smallestCompareWidth, a, b, isUnorderedLess() ^ swapInputs, NodeView.DEFAULT);
+    }
+}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/IntegerConvertNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/IntegerConvertNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -69,7 +69,7 @@
         this.getReverseOp = getReverseOp;
         this.inputBits = inputBits;
         this.resultBits = resultBits;
-        assert ((PrimitiveStamp) input.stamp(NodeView.DEFAULT)).getBits() == inputBits;
+        assert PrimitiveStamp.getBits(input.stamp(NodeView.DEFAULT)) == 0 || PrimitiveStamp.getBits(input.stamp(NodeView.DEFAULT)) == inputBits;
     }
 
     public int getInputBits() {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/IntegerDivRemNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/IntegerDivRemNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -29,6 +29,7 @@
 
 import org.graalvm.compiler.core.common.type.IntegerStamp;
 import org.graalvm.compiler.core.common.type.Stamp;
+import org.graalvm.compiler.graph.IterableNodeType;
 import org.graalvm.compiler.graph.NodeClass;
 import org.graalvm.compiler.nodeinfo.InputType;
 import org.graalvm.compiler.nodeinfo.NodeInfo;
@@ -39,7 +40,7 @@
 import org.graalvm.compiler.nodes.spi.LoweringTool;
 
 @NodeInfo(cycles = CYCLES_32, size = SIZE_1)
-public abstract class IntegerDivRemNode extends FixedBinaryNode implements Lowerable {
+public abstract class IntegerDivRemNode extends FixedBinaryNode implements Lowerable, IterableNodeType {
 
     public static final NodeClass<IntegerDivRemNode> TYPE = NodeClass.create(IntegerDivRemNode.class);
 
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/IntegerEqualsNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/IntegerEqualsNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -109,30 +109,15 @@
     public static class IntegerEqualsOp extends CompareOp {
         @Override
         protected LogicNode optimizeNormalizeCompare(ConstantReflectionProvider constantReflection, MetaAccessProvider metaAccess, OptionValues options, Integer smallestCompareWidth,
-                        Constant constant, NormalizeCompareNode normalizeNode, boolean mirrored, NodeView view) {
+                        Constant constant, AbstractNormalizeCompareNode normalizeNode, boolean mirrored, NodeView view) {
             PrimitiveConstant primitive = (PrimitiveConstant) constant;
-            ValueNode a = normalizeNode.getX();
-            ValueNode b = normalizeNode.getY();
             long cst = primitive.asLong();
-
             if (cst == 0) {
-                if (normalizeNode.getX().getStackKind() == JavaKind.Double || normalizeNode.getX().getStackKind() == JavaKind.Float) {
-                    return FloatEqualsNode.create(constantReflection, metaAccess, options, smallestCompareWidth, a, b, view);
-                } else {
-                    return IntegerEqualsNode.create(constantReflection, metaAccess, options, smallestCompareWidth, a, b, view);
-                }
+                return normalizeNode.createEqualComparison(constantReflection, metaAccess, options, smallestCompareWidth, view);
             } else if (cst == 1) {
-                if (normalizeNode.getX().getStackKind() == JavaKind.Double || normalizeNode.getX().getStackKind() == JavaKind.Float) {
-                    return FloatLessThanNode.create(b, a, !normalizeNode.isUnorderedLess, view);
-                } else {
-                    return IntegerLessThanNode.create(constantReflection, metaAccess, options, smallestCompareWidth, b, a, view);
-                }
+                return normalizeNode.createLowerComparison(true, constantReflection, metaAccess, options, smallestCompareWidth, view);
             } else if (cst == -1) {
-                if (normalizeNode.getX().getStackKind() == JavaKind.Double || normalizeNode.getX().getStackKind() == JavaKind.Float) {
-                    return FloatLessThanNode.create(a, b, normalizeNode.isUnorderedLess, view);
-                } else {
-                    return IntegerLessThanNode.create(constantReflection, metaAccess, options, smallestCompareWidth, a, b, view);
-                }
+                return normalizeNode.createLowerComparison(false, constantReflection, metaAccess, options, smallestCompareWidth, view);
             } else {
                 return LogicConstantNode.contradiction();
             }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/IntegerLessThanNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/IntegerLessThanNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -114,7 +114,7 @@
 
         @Override
         protected LogicNode optimizeNormalizeCompare(ConstantReflectionProvider constantReflection, MetaAccessProvider metaAccess, OptionValues options, Integer smallestCompareWidth,
-                        Constant constant, NormalizeCompareNode normalizeNode, boolean mirrored, NodeView view) {
+                        Constant constant, AbstractNormalizeCompareNode normalizeNode, boolean mirrored, NodeView view) {
             PrimitiveConstant primitive = (PrimitiveConstant) constant;
             /* @formatter:off
              * a NC b < c  (not mirrored)
@@ -136,25 +136,14 @@
              *  We can handle mirroring by swapping a & b and negating the constant.
              *  @formatter:on
              */
-            ValueNode a = mirrored ? normalizeNode.getY() : normalizeNode.getX();
-            ValueNode b = mirrored ? normalizeNode.getX() : normalizeNode.getY();
             long cst = mirrored ? -primitive.asLong() : primitive.asLong();
 
             if (cst == 0) {
-                if (normalizeNode.getX().getStackKind() == JavaKind.Double || normalizeNode.getX().getStackKind() == JavaKind.Float) {
-                    return FloatLessThanNode.create(constantReflection, metaAccess, options, smallestCompareWidth, a, b, mirrored ^ normalizeNode.isUnorderedLess, view);
-                } else {
-                    return IntegerLessThanNode.create(constantReflection, metaAccess, options, smallestCompareWidth, a, b, view);
-                }
+                return normalizeNode.createLowerComparison(mirrored, constantReflection, metaAccess, options, smallestCompareWidth, view);
             } else if (cst == 1) {
                 // a <= b <=> !(a > b)
-                LogicNode compare;
-                if (normalizeNode.getX().getStackKind() == JavaKind.Double || normalizeNode.getX().getStackKind() == JavaKind.Float) {
-                    // since we negate, we have to reverse the unordered result
-                    compare = FloatLessThanNode.create(constantReflection, metaAccess, options, smallestCompareWidth, b, a, mirrored == normalizeNode.isUnorderedLess, view);
-                } else {
-                    compare = IntegerLessThanNode.create(constantReflection, metaAccess, options, smallestCompareWidth, b, a, view);
-                }
+                // since we negate, we have to reverse the unordered result
+                LogicNode compare = normalizeNode.createLowerComparison(!mirrored, constantReflection, metaAccess, options, smallestCompareWidth, view);
                 return LogicNegationNode.create(compare);
             } else if (cst <= -1) {
                 return LogicConstantNode.contradiction();
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/IntegerLowerThanNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/IntegerLowerThanNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/IntegerNormalizeCompareNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.graalvm.compiler.nodes.calc;
+
+import org.graalvm.compiler.graph.NodeClass;
+import org.graalvm.compiler.graph.spi.CanonicalizerTool;
+import org.graalvm.compiler.nodeinfo.NodeInfo;
+import org.graalvm.compiler.nodes.LogicNode;
+import org.graalvm.compiler.nodes.NodeView;
+import org.graalvm.compiler.nodes.ValueNode;
+import org.graalvm.compiler.options.OptionValues;
+
+import jdk.vm.ci.meta.ConstantReflectionProvider;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.MetaAccessProvider;
+
+@NodeInfo
+public final class IntegerNormalizeCompareNode extends AbstractNormalizeCompareNode {
+    public static final NodeClass<IntegerNormalizeCompareNode> TYPE = NodeClass.create(IntegerNormalizeCompareNode.class);
+    protected final boolean unsigned;
+
+    public IntegerNormalizeCompareNode(ValueNode x, ValueNode y, JavaKind kind, boolean unsigned) {
+        super(TYPE, kind, x, y);
+        this.unsigned = unsigned;
+    }
+
+    public static ValueNode create(ValueNode x, ValueNode y, boolean unsigned, JavaKind kind, ConstantReflectionProvider constantReflection) {
+        ValueNode result = tryConstantFold(x, y, false, unsigned, kind, constantReflection);
+        if (result != null) {
+            return result;
+        }
+
+        return new IntegerNormalizeCompareNode(x, y, kind, unsigned);
+    }
+
+    @Override
+    public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) {
+        NodeView view = NodeView.from(tool);
+        ValueNode result = tryConstantFold(x, y, false, unsigned, stamp(view).getStackKind(), tool.getConstantReflection());
+        if (result != null) {
+            return result;
+        }
+        return this;
+    }
+
+    @Override
+    public LogicNode createLowerComparison(boolean swapInputs) {
+        ValueNode a = swapInputs ? y : x;
+        ValueNode b = swapInputs ? x : y;
+        if (unsigned) {
+            return IntegerBelowNode.create(a, b, NodeView.DEFAULT);
+        } else {
+            return IntegerLessThanNode.create(a, b, NodeView.DEFAULT);
+        }
+    }
+
+    @Override
+    public LogicNode createLowerComparison(boolean swapInputs, ConstantReflectionProvider constantReflection, MetaAccessProvider metaAccess, OptionValues options, Integer smallestCompareWidth,
+                    NodeView view) {
+        ValueNode a = swapInputs ? y : x;
+        ValueNode b = swapInputs ? x : y;
+        if (unsigned) {
+            return IntegerBelowNode.create(constantReflection, metaAccess, options, smallestCompareWidth, a, b, NodeView.DEFAULT);
+        } else {
+            return IntegerLessThanNode.create(constantReflection, metaAccess, options, smallestCompareWidth, a, b, NodeView.DEFAULT);
+        }
+    }
+
+    @Override
+    public LogicNode createEqualComparison() {
+        return IntegerEqualsNode.create(x, y, NodeView.DEFAULT);
+    }
+
+    @Override
+    public LogicNode createEqualComparison(ConstantReflectionProvider constantReflection, MetaAccessProvider metaAccess, OptionValues options, Integer smallestCompareWidth, NodeView view) {
+        return IntegerEqualsNode.create(constantReflection, metaAccess, options, smallestCompareWidth, x, y, view);
+    }
+}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/IntegerTestNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/IntegerTestNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
 import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_2;
 import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_2;
 
+import java.nio.ByteBuffer;
+
 import org.graalvm.compiler.core.common.type.IntegerStamp;
 import org.graalvm.compiler.core.common.type.Stamp;
 import org.graalvm.compiler.graph.NodeClass;
@@ -35,6 +37,7 @@
 import org.graalvm.compiler.nodeinfo.NodeInfo;
 import org.graalvm.compiler.nodes.BinaryOpLogicNode;
 import org.graalvm.compiler.nodes.LogicConstantNode;
+import org.graalvm.compiler.nodes.LogicNode;
 import org.graalvm.compiler.nodes.NodeView;
 import org.graalvm.compiler.nodes.ValueNode;
 
@@ -53,11 +56,27 @@
         super(TYPE, x, y);
     }
 
-    @Override
-    public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) {
-        NodeView view = NodeView.from(tool);
+    public static LogicNode create(ValueNode x, ValueNode y, NodeView view) {
+        LogicNode value = canonical(x, y, view);
+        if (value != null) {
+            return value;
+        }
+        return new IntegerTestNode(x, y);
+    }
+
+    private static LogicNode canonical(ValueNode forX, ValueNode forY, NodeView view) {
         if (forX.isConstant() && forY.isConstant()) {
-            return LogicConstantNode.forBoolean((forX.asJavaConstant().asLong() & forY.asJavaConstant().asLong()) == 0);
+            if (forX.isJavaConstant() && forY.isJavaConstant()) {
+                return LogicConstantNode.forBoolean((forX.asJavaConstant().asLong() & forY.asJavaConstant().asLong()) == 0);
+            }
+            if (forX.isSerializableConstant() && forY.isSerializableConstant()) {
+                int bufSize = Math.min(forX.asSerializableConstant().getSerializedSize(), forX.asSerializableConstant().getSerializedSize());
+                ByteBuffer xBuf = ByteBuffer.allocate(bufSize);
+                ByteBuffer yBuf = ByteBuffer.allocate(bufSize);
+                forX.asSerializableConstant().serialize(xBuf);
+                forY.asSerializableConstant().serialize(yBuf);
+                return serializableToConst(xBuf, yBuf, bufSize);
+            }
         }
         if (forX.stamp(view) instanceof IntegerStamp && forY.stamp(view) instanceof IntegerStamp) {
             IntegerStamp xStamp = (IntegerStamp) forX.stamp(view);
@@ -68,7 +87,22 @@
                 return LogicConstantNode.contradiction();
             }
         }
-        return this;
+        return null;
+    }
+
+    @Override
+    public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) {
+        ValueNode value = canonical(forX, forY, NodeView.from(tool));
+        return value != null ? value : this;
+    }
+
+    private static LogicNode serializableToConst(ByteBuffer xBuf, ByteBuffer yBuf, int bufSize) {
+        for (int i = 0; i < bufSize; i++) {
+            if ((xBuf.get(i) & yBuf.get(i)) != 0) {
+                return LogicConstantNode.contradiction();
+            }
+        }
+        return LogicConstantNode.tautology();
     }
 
     @Override
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/IsNullNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/IsNullNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/NarrowNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/NarrowNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,12 +26,14 @@
 
 import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_1;
 
+import org.graalvm.compiler.core.common.calc.CanonicalCondition;
 import org.graalvm.compiler.core.common.type.ArithmeticOpTable;
 import org.graalvm.compiler.core.common.type.ArithmeticOpTable.IntegerConvertOp;
 import org.graalvm.compiler.core.common.type.ArithmeticOpTable.IntegerConvertOp.Narrow;
 import org.graalvm.compiler.core.common.type.ArithmeticOpTable.IntegerConvertOp.SignExtend;
 import org.graalvm.compiler.core.common.type.IntegerStamp;
 import org.graalvm.compiler.core.common.type.PrimitiveStamp;
+import org.graalvm.compiler.core.common.type.Stamp;
 import org.graalvm.compiler.graph.NodeClass;
 import org.graalvm.compiler.graph.spi.CanonicalizerTool;
 import org.graalvm.compiler.lir.gen.ArithmeticLIRGeneratorTool;
@@ -75,10 +77,33 @@
 
     @Override
     public boolean isLossless() {
+        return checkLossless(this.getResultBits());
+    }
+
+    private boolean checkLossless(int bits) {
+        Stamp valueStamp = this.getValue().stamp(NodeView.DEFAULT);
+        if (bits > 0 && valueStamp instanceof IntegerStamp) {
+            IntegerStamp integerStamp = (IntegerStamp) valueStamp;
+            long valueUpMask = integerStamp.upMask();
+            if ((valueUpMask & CodeUtil.mask(bits)) == valueUpMask) {
+                return true;
+            }
+        }
         return false;
     }
 
     @Override
+    public boolean preservesOrder(CanonicalCondition cond) {
+        switch (cond) {
+            case LT:
+                // Must guarantee that also sign bit does not flip.
+                return checkLossless(this.getResultBits() - 1);
+            default:
+                return checkLossless(this.getResultBits());
+        }
+    }
+
+    @Override
     public ValueNode canonical(CanonicalizerTool tool, ValueNode forValue) {
         NodeView view = NodeView.from(tool);
         ValueNode ret = super.canonical(tool, forValue);
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/NormalizeCompareNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package org.graalvm.compiler.nodes.calc;
-
-import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_2;
-
-import org.graalvm.compiler.core.common.calc.CanonicalCondition;
-import org.graalvm.compiler.core.common.type.Stamp;
-import org.graalvm.compiler.core.common.type.StampFactory;
-import org.graalvm.compiler.graph.IterableNodeType;
-import org.graalvm.compiler.graph.NodeClass;
-import org.graalvm.compiler.graph.spi.CanonicalizerTool;
-import org.graalvm.compiler.nodeinfo.NodeCycles;
-import org.graalvm.compiler.nodeinfo.NodeInfo;
-import org.graalvm.compiler.nodes.ConstantNode;
-import org.graalvm.compiler.nodes.LogicConstantNode;
-import org.graalvm.compiler.nodes.LogicNode;
-import org.graalvm.compiler.nodes.NodeView;
-import org.graalvm.compiler.nodes.ValueNode;
-
-import jdk.vm.ci.meta.ConstantReflectionProvider;
-import jdk.vm.ci.meta.JavaKind;
-
-/**
- * Returns -1, 0, or 1 if either x &lt; y, x == y, or x &gt; y. If the comparison is undecided (one
- * of the inputs is NaN), the result is 1 if isUnorderedLess is false and -1 if isUnorderedLess is
- * true.
- */
-@NodeInfo(cycles = NodeCycles.CYCLES_2, size = SIZE_2)
-public final class NormalizeCompareNode extends BinaryNode implements IterableNodeType {
-
-    public static final NodeClass<NormalizeCompareNode> TYPE = NodeClass.create(NormalizeCompareNode.class);
-    protected final boolean isUnorderedLess;
-
-    public NormalizeCompareNode(ValueNode x, ValueNode y, JavaKind kind, boolean isUnorderedLess) {
-        super(TYPE, StampFactory.forInteger(kind, -1, 1), x, y);
-        this.isUnorderedLess = isUnorderedLess;
-    }
-
-    public static ValueNode create(ValueNode x, ValueNode y, boolean isUnorderedLess, JavaKind kind, ConstantReflectionProvider constantReflection) {
-        ValueNode result = tryConstantFold(x, y, isUnorderedLess, kind, constantReflection);
-        if (result != null) {
-            return result;
-        }
-
-        return new NormalizeCompareNode(x, y, kind, isUnorderedLess);
-    }
-
-    protected static ValueNode tryConstantFold(ValueNode x, ValueNode y, boolean isUnorderedLess, JavaKind kind, ConstantReflectionProvider constantReflection) {
-        LogicNode result = CompareNode.tryConstantFold(CanonicalCondition.EQ, x, y, null, false);
-        if (result instanceof LogicConstantNode) {
-            LogicConstantNode logicConstantNode = (LogicConstantNode) result;
-            LogicNode resultLT = CompareNode.tryConstantFold(CanonicalCondition.LT, x, y, constantReflection, isUnorderedLess);
-            if (resultLT instanceof LogicConstantNode) {
-                LogicConstantNode logicConstantNodeLT = (LogicConstantNode) resultLT;
-                if (logicConstantNodeLT.getValue()) {
-                    return ConstantNode.forIntegerKind(kind, -1);
-                } else if (logicConstantNode.getValue()) {
-                    return ConstantNode.forIntegerKind(kind, 0);
-                } else {
-                    return ConstantNode.forIntegerKind(kind, 1);
-                }
-            }
-        }
-        return null;
-    }
-
-    @Override
-    public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) {
-        NodeView view = NodeView.from(tool);
-        ValueNode result = tryConstantFold(x, y, isUnorderedLess, stamp(view).getStackKind(), tool.getConstantReflection());
-        if (result != null) {
-            return result;
-        }
-        return this;
-    }
-
-    @Override
-    public boolean inferStamp() {
-        return false;
-    }
-
-    @Override
-    public Stamp foldStamp(Stamp stampX, Stamp stampY) {
-        return stamp(NodeView.DEFAULT);
-    }
-
-    public boolean isUnorderedLess() {
-        return isUnorderedLess;
-    }
-}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/PointerEqualsNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/PointerEqualsNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/ReinterpretNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/ReinterpretNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/cfg/Block.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/cfg/Block.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/cfg/ControlFlowGraph.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/cfg/ControlFlowGraph.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/ArrayRangeWrite.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/ArrayRangeWrite.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/BranchProbabilityNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/BranchProbabilityNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -74,6 +74,8 @@
     public static final double VERY_FAST_PATH_PROBABILITY = 0.999;
     public static final double VERY_SLOW_PATH_PROBABILITY = 1 - VERY_FAST_PATH_PROBABILITY;
 
+    public static final double DEOPT_PROBABILITY = 0.0;
+
     /*
      * This probability may seem excessive, but it makes a difference in long running loops. Lets
      * say a loop is executed 100k times and it has a few null checks with probability 0.999. As
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/ForeignCallNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/ForeignCallNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/GuardedUnsafeLoadNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/GuardedUnsafeLoadNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/IntegerSwitchNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/IntegerSwitchNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/JavaWriteNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/JavaWriteNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/LoadHubNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/LoadHubNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
 import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_2;
 import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_1;
 
+import org.graalvm.compiler.core.common.type.AbstractPointerStamp;
 import org.graalvm.compiler.core.common.type.ObjectStamp;
 import org.graalvm.compiler.core.common.type.Stamp;
 import org.graalvm.compiler.core.common.type.TypeReference;
@@ -62,13 +63,17 @@
         return value;
     }
 
-    private static Stamp hubStamp(StampProvider stampProvider, ValueNode value) {
+    private static AbstractPointerStamp hubStamp(StampProvider stampProvider, ValueNode value) {
         assert value.stamp(NodeView.DEFAULT) instanceof ObjectStamp;
         return stampProvider.createHubStamp(((ObjectStamp) value.stamp(NodeView.DEFAULT)));
     }
 
     public static ValueNode create(ValueNode value, StampProvider stampProvider, MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection) {
-        Stamp stamp = hubStamp(stampProvider, value);
+        final AbstractPointerStamp stamp = hubStamp(stampProvider, value);
+        return create(value, stamp, metaAccess, constantReflection);
+    }
+
+    public static ValueNode create(ValueNode value, AbstractPointerStamp stamp, MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection) {
         ValueNode synonym = findSynonym(value, stamp, metaAccess, constantReflection);
         if (synonym != null) {
             return synonym;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/LoadHubOrNullNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.graalvm.compiler.nodes.extended;
+
+import static org.graalvm.compiler.core.common.GraalOptions.GeneratePIC;
+import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_2;
+import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_1;
+
+import org.graalvm.compiler.core.common.type.AbstractPointerStamp;
+import org.graalvm.compiler.core.common.type.ObjectStamp;
+import org.graalvm.compiler.core.common.type.Stamp;
+import org.graalvm.compiler.core.common.type.TypeReference;
+import org.graalvm.compiler.graph.NodeClass;
+import org.graalvm.compiler.graph.spi.Canonicalizable;
+import org.graalvm.compiler.graph.spi.CanonicalizerTool;
+import org.graalvm.compiler.nodeinfo.NodeInfo;
+import org.graalvm.compiler.nodes.ConstantNode;
+import org.graalvm.compiler.nodes.NodeView;
+import org.graalvm.compiler.nodes.ValueNode;
+import org.graalvm.compiler.nodes.calc.FloatingNode;
+import org.graalvm.compiler.nodes.spi.Lowerable;
+import org.graalvm.compiler.nodes.spi.LoweringTool;
+import org.graalvm.compiler.nodes.spi.StampProvider;
+import org.graalvm.compiler.nodes.spi.Virtualizable;
+import org.graalvm.compiler.nodes.spi.VirtualizerTool;
+import org.graalvm.compiler.nodes.type.StampTool;
+
+import jdk.vm.ci.meta.ConstantReflectionProvider;
+import jdk.vm.ci.meta.MetaAccessProvider;
+
+/**
+ * Loads an object's hub, or null if the object is null.
+ */
+@NodeInfo(cycles = CYCLES_2, size = SIZE_1)
+public final class LoadHubOrNullNode extends FloatingNode implements Lowerable, Canonicalizable, Virtualizable {
+
+    public static final NodeClass<LoadHubOrNullNode> TYPE = NodeClass.create(LoadHubOrNullNode.class);
+    @Input ValueNode value;
+
+    public ValueNode getValue() {
+        return value;
+    }
+
+    private static AbstractPointerStamp hubStamp(StampProvider stampProvider, ValueNode value) {
+        assert value.stamp(NodeView.DEFAULT) instanceof ObjectStamp;
+        return stampProvider.createHubStamp(((ObjectStamp) value.stamp(NodeView.DEFAULT))).asMaybeNull();
+    }
+
+    public static ValueNode create(ValueNode value, StampProvider stampProvider, MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection) {
+        AbstractPointerStamp stamp = hubStamp(stampProvider, value);
+        return create(value, stamp, metaAccess, constantReflection);
+    }
+
+    public static ValueNode create(ValueNode value, AbstractPointerStamp stamp, MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection) {
+        ValueNode synonym = findSynonym(value, stamp, metaAccess, constantReflection);
+        if (synonym != null) {
+            return synonym;
+        }
+        return new LoadHubOrNullNode(stamp, value);
+    }
+
+    public LoadHubOrNullNode(@InjectedNodeParameter StampProvider stampProvider, ValueNode value) {
+        this(hubStamp(stampProvider, value), value);
+    }
+
+    public LoadHubOrNullNode(Stamp stamp, ValueNode value) {
+        super(TYPE, stamp);
+        this.value = value;
+    }
+
+    @Override
+    public void lower(LoweringTool tool) {
+        tool.getLowerer().lower(this, tool);
+    }
+
+    @Override
+    public ValueNode canonical(CanonicalizerTool tool) {
+        if (!GeneratePIC.getValue(tool.getOptions())) {
+            NodeView view = NodeView.from(tool);
+            MetaAccessProvider metaAccess = tool.getMetaAccess();
+            ValueNode curValue = getValue();
+            ValueNode newNode = findSynonym(curValue, (AbstractPointerStamp) stamp(view), metaAccess, tool.getConstantReflection());
+            if (newNode != null) {
+                return newNode;
+            }
+        }
+        return this;
+    }
+
+    public static ValueNode findSynonym(ValueNode curValue, AbstractPointerStamp stamp, MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection) {
+        if (StampTool.isPointerNonNull(stamp)) {
+            return LoadHubNode.create(curValue, stamp.asNonNull(), metaAccess, constantReflection);
+        }
+        return null;
+    }
+
+    @Override
+    public void virtualize(VirtualizerTool tool) {
+        if (!GeneratePIC.getValue(tool.getOptions())) {
+            ValueNode alias = tool.getAlias(getValue());
+            TypeReference type = StampTool.typeReferenceOrNull(alias);
+            if (type != null && type.isExact()) {
+                tool.replaceWithValue(ConstantNode.forConstant(stamp(NodeView.DEFAULT), tool.getConstantReflection().asObjectHub(type.getType()), tool.getMetaAccess(), graph()));
+            }
+        }
+    }
+}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/MultiGuardNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/MultiGuardNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,8 @@
 import org.graalvm.compiler.graph.Node;
 import org.graalvm.compiler.graph.NodeClass;
 import org.graalvm.compiler.graph.NodeInputList;
+import org.graalvm.compiler.graph.spi.Canonicalizable;
+import org.graalvm.compiler.graph.spi.CanonicalizerTool;
 import org.graalvm.compiler.graph.spi.Simplifiable;
 import org.graalvm.compiler.graph.spi.SimplifierTool;
 import org.graalvm.compiler.nodeinfo.NodeInfo;
@@ -43,7 +45,7 @@
 import org.graalvm.compiler.nodes.util.GraphUtil;
 
 @NodeInfo(allowedUsageTypes = Guard, cycles = CYCLES_0, size = SIZE_0)
-public final class MultiGuardNode extends FloatingNode implements GuardingNode, LIRLowerable, Simplifiable, Node.ValueNumberable {
+public final class MultiGuardNode extends FloatingNode implements GuardingNode, LIRLowerable, Simplifiable, Canonicalizable, Node.ValueNumberable {
     public static final NodeClass<MultiGuardNode> TYPE = NodeClass.create(MultiGuardNode.class);
 
     @OptionalInput(Guard) NodeInputList<ValueNode> guards;
@@ -58,6 +60,20 @@
     }
 
     @Override
+    public Node canonical(CanonicalizerTool tool) {
+        // Make sure there are no nulls remaining in the set of guards references.
+        guards.trim();
+        if (guards.size() == 0) {
+            // No guards left => can delete the multi-guard.
+            return null;
+        } else if (guards.size() == 1) {
+            // Only a single guard left => replace multi-guard with that single guard.
+            return guards.get(0);
+        }
+        return this;
+    }
+
+    @Override
     public void simplify(SimplifierTool tool) {
         if (usages().filter(node -> node instanceof ValueAnchorNode).isNotEmpty()) {
             /*
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/SwitchNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/SwitchNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/graphbuilderconf/GeneratedInvocationPlugin.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/graphbuilderconf/GeneratedInvocationPlugin.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -109,4 +109,8 @@
             throw new GraalError(e);
         }
     }
+
+    public final boolean isGeneratedFromFoldOrNodeIntrinsic() {
+        return getSource().equals(Fold.class) || getSource().equals(NodeIntrinsic.class);
+    }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/graphbuilderconf/GraphBuilderConfiguration.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/graphbuilderconf/GraphBuilderConfiguration.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/graphbuilderconf/GraphBuilderContext.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/graphbuilderconf/GraphBuilderContext.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -258,6 +258,13 @@
     }
 
     /**
+     * Determines if a graph builder plugin is enabled under current context.
+     */
+    default boolean isPluginEnabled(GraphBuilderPlugin plugin) {
+        return parsingIntrinsic() || !(plugin instanceof GeneratedInvocationPlugin && ((GeneratedInvocationPlugin) plugin).isGeneratedFromFoldOrNodeIntrinsic());
+    }
+
+    /**
      * Gets the intrinsic of the current parsing context or {@code null} if not
      * {@link #parsingIntrinsic() parsing an intrinsic}.
      */
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/graphbuilderconf/GraphBuilderTool.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/graphbuilderconf/GraphBuilderTool.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/graphbuilderconf/InlineInvokePlugin.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/graphbuilderconf/InlineInvokePlugin.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/graphbuilderconf/IntrinsicContext.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/graphbuilderconf/IntrinsicContext.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/graphbuilderconf/InvocationPlugins.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/graphbuilderconf/InvocationPlugins.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -702,8 +702,10 @@
                 }
                 if (res != null) {
                     // A decorator plugin is trusted since it does not replace
-                    // the method it intrinsifies.
-                    if (res.isDecorator() || canBeIntrinsified(declaringClass)) {
+                    // the method it intrinsifies. A GeneratedInvocationPlugin
+                    // is trusted since it only exists for @NodeIntrinsics and
+                    // @Fold annotated methods (i.e., trusted Graal code).
+                    if (res.isDecorator() || res instanceof GeneratedInvocationPlugin || canBeIntrinsified(declaringClass)) {
                         return res;
                     }
                 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/graphbuilderconf/MethodSubstitutionPlugin.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/graphbuilderconf/MethodSubstitutionPlugin.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/AbstractNewObjectNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/AbstractNewObjectNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/ArrayLengthNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/ArrayLengthNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/LoadIndexedNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/LoadIndexedNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/MonitorExitNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/MonitorExitNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/NewArrayNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/NewArrayNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/NewInstanceNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/NewInstanceNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/StoreFieldNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/StoreFieldNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/StoreIndexedNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/StoreIndexedNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/TypeSwitchNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/TypeSwitchNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/AbstractWriteNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/AbstractWriteNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/FixedAccessNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/FixedAccessNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,6 @@
 package org.graalvm.compiler.nodes.memory;
 
 import org.graalvm.compiler.core.common.type.Stamp;
-import org.graalvm.compiler.graph.IterableNodeType;
 import org.graalvm.compiler.graph.NodeClass;
 import org.graalvm.compiler.nodeinfo.InputType;
 import org.graalvm.compiler.nodeinfo.NodeInfo;
@@ -40,7 +39,7 @@
  * does not include a null check on the object.
  */
 @NodeInfo
-public abstract class FixedAccessNode extends DeoptimizingFixedWithNextNode implements Access, IterableNodeType {
+public abstract class FixedAccessNode extends DeoptimizingFixedWithNextNode implements Access {
     public static final NodeClass<FixedAccessNode> TYPE = NodeClass.create(FixedAccessNode.class);
 
     @OptionalInput(InputType.Guard) protected GuardingNode guard;
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/HeapAccess.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/HeapAccess.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/address/IndexAddressNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/memory/address/IndexAddressNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/spi/DelegatingReplacements.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/spi/DelegatingReplacements.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/spi/LoweringProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/spi/LoweringProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -53,7 +53,8 @@
     Integer smallestCompareWidth();
 
     /**
-     * Indicates whether the target platform supports bulk zeroing instruction.
+     * Returns the granularity in terms of bytes that this target platform's bulk zeroing supports.
+     * Returns 0 to indicate that this target platform does not support bulk zeroing instruction.
      */
-    boolean supportBulkZeroing();
+    int bulkZeroingStride();
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/spi/LoweringTool.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/spi/LoweringTool.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/spi/Replacements.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/spi/Replacements.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/spi/StampProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/spi/StampProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +24,8 @@
 
 package org.graalvm.compiler.nodes.spi;
 
+import org.graalvm.compiler.core.common.type.AbstractPointerStamp;
 import org.graalvm.compiler.core.common.type.ObjectStamp;
-import org.graalvm.compiler.core.common.type.Stamp;
 import org.graalvm.compiler.nodes.extended.LoadHubNode;
 
 /**
@@ -36,10 +36,10 @@
     /**
      * Create the stamp of the {@link LoadHubNode hub} of an object.
      */
-    Stamp createHubStamp(ObjectStamp object);
+    AbstractPointerStamp createHubStamp(ObjectStamp object);
 
     /**
      * Create the stamp of a pointer to a method.
      */
-    Stamp createMethodStamp();
+    AbstractPointerStamp createMethodStamp();
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/type/NarrowOopStamp.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/type/NarrowOopStamp.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/util/GraphUtil.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/util/GraphUtil.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/util/IntegerHelper.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.graalvm.compiler.nodes.util;
+
+import org.graalvm.compiler.core.common.type.IntegerStamp;
+import org.graalvm.compiler.nodes.LogicNode;
+import org.graalvm.compiler.nodes.NodeView;
+import org.graalvm.compiler.nodes.ValueNode;
+
+public abstract class IntegerHelper {
+    protected final int bits;
+
+    protected IntegerHelper(int bits) {
+        this.bits = bits;
+    }
+
+    public abstract long upperBound(IntegerStamp stamp);
+
+    public abstract long lowerBound(IntegerStamp stamp);
+
+    public int compare(long a, long b) {
+        return rawCompare(cast(a), cast(b));
+    }
+
+    public boolean isGreater(long a, long b) {
+        return compare(a, b) > 0;
+    }
+
+    public boolean isSmaller(long a, long b) {
+        return compare(a, b) < 0;
+    }
+
+    public boolean isGreaterEqual(long a, long b) {
+        return compare(a, b) >= 0;
+    }
+
+    public boolean isSmallerEqual(long a, long b) {
+        return compare(a, b) <= 0;
+    }
+
+    public long min(long a, long b) {
+        return rawMin(cast(a), cast(b));
+    }
+
+    public long max(long a, long b) {
+        return rawMax(cast(a), cast(b));
+    }
+
+    public abstract long cast(long a);
+
+    public abstract long minValue();
+
+    public abstract long maxValue();
+
+    public abstract IntegerStamp stamp(long min, long max);
+
+    public abstract LogicNode createCompareNode(ValueNode x, ValueNode y, NodeView view);
+
+    protected abstract int rawCompare(long a, long b);
+
+    protected abstract long rawMin(long a, long b);
+
+    protected abstract long rawMax(long a, long b);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/util/SignedIntegerHelper.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.graalvm.compiler.nodes.util;
+
+import org.graalvm.compiler.core.common.NumUtil;
+import org.graalvm.compiler.core.common.type.IntegerStamp;
+import org.graalvm.compiler.core.common.type.StampFactory;
+import org.graalvm.compiler.nodes.LogicNode;
+import org.graalvm.compiler.nodes.NodeView;
+import org.graalvm.compiler.nodes.ValueNode;
+import org.graalvm.compiler.nodes.calc.IntegerLessThanNode;
+
+import jdk.vm.ci.code.CodeUtil;
+
+public class SignedIntegerHelper extends IntegerHelper {
+    public SignedIntegerHelper(int bits) {
+        super(bits);
+    }
+
+    @Override
+    public long upperBound(IntegerStamp stamp) {
+        assert stamp.getBits() == bits;
+        return stamp.upperBound();
+    }
+
+    @Override
+    public long lowerBound(IntegerStamp stamp) {
+        assert stamp.getBits() == bits;
+        return stamp.lowerBound();
+    }
+
+    @Override
+    protected int rawCompare(long a, long b) {
+        return Long.compare(a, b);
+    }
+
+    @Override
+    protected long rawMin(long a, long b) {
+        return Math.min(a, b);
+    }
+
+    @Override
+    protected long rawMax(long a, long b) {
+        return Math.max(a, b);
+    }
+
+    @Override
+    public long cast(long a) {
+        return CodeUtil.signExtend(a, bits);
+    }
+
+    @Override
+    public long minValue() {
+        return NumUtil.minValue(bits);
+    }
+
+    @Override
+    public long maxValue() {
+        return NumUtil.maxValue(bits);
+    }
+
+    @Override
+    public IntegerStamp stamp(long min, long max) {
+        return StampFactory.forInteger(bits, cast(min), cast(max));
+    }
+
+    @Override
+    public LogicNode createCompareNode(ValueNode x, ValueNode y, NodeView view) {
+        return IntegerLessThanNode.create(x, y, view);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/util/UnsignedIntegerHelper.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.graalvm.compiler.nodes.util;
+
+import org.graalvm.compiler.core.common.NumUtil;
+import org.graalvm.compiler.core.common.type.IntegerStamp;
+import org.graalvm.compiler.core.common.type.StampFactory;
+import org.graalvm.compiler.nodes.LogicNode;
+import org.graalvm.compiler.nodes.NodeView;
+import org.graalvm.compiler.nodes.ValueNode;
+import org.graalvm.compiler.nodes.calc.IntegerBelowNode;
+
+import jdk.vm.ci.code.CodeUtil;
+
+public class UnsignedIntegerHelper extends IntegerHelper {
+    public UnsignedIntegerHelper(int bits) {
+        super(bits);
+    }
+
+    @Override
+    public long upperBound(IntegerStamp stamp) {
+        assert stamp.getBits() == bits;
+        return stamp.unsignedUpperBound();
+    }
+
+    @Override
+    public long lowerBound(IntegerStamp stamp) {
+        assert stamp.getBits() == bits;
+        return stamp.unsignedLowerBound();
+    }
+
+    @Override
+    protected int rawCompare(long a, long b) {
+        return Long.compareUnsigned(a, b);
+    }
+
+    @Override
+    protected long rawMin(long a, long b) {
+        return NumUtil.minUnsigned(a, b);
+    }
+
+    @Override
+    protected long rawMax(long a, long b) {
+        return NumUtil.maxUnsigned(a, b);
+    }
+
+    @Override
+    public long cast(long a) {
+        return CodeUtil.zeroExtend(a, bits);
+    }
+
+    @Override
+    public long minValue() {
+        return 0;
+    }
+
+    @Override
+    public long maxValue() {
+        return NumUtil.maxValueUnsigned(bits);
+    }
+
+    @Override
+    public IntegerStamp stamp(long min, long max) {
+        return StampFactory.forUnsignedInteger(bits, min, max);
+    }
+
+    @Override
+    public LogicNode createCompareNode(ValueNode x, ValueNode y, NodeView view) {
+        return IntegerBelowNode.create(x, y, view);
+    }
+}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.options.processor/src/org/graalvm/compiler/options/processor/OptionProcessor.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.options.processor/src/org/graalvm/compiler/options/processor/OptionProcessor.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.options/src/org/graalvm/compiler/options/ModuleSupport.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.graalvm.compiler.options;
+
+import java.util.ServiceLoader;
+
+public class ModuleSupport {
+
+    static Iterable<OptionDescriptors> getOptionsLoader() {
+        /*
+         * The Graal module (i.e., jdk.internal.vm.compiler) is loaded by the platform class loader
+         * as of JDK 9. Modules that depend on and extend Graal are loaded by the app class loader.
+         * As such, we need to start the provider search at the app class loader instead of the
+         * platform class loader.
+         */
+        return ServiceLoader.load(OptionDescriptors.class, ClassLoader.getSystemClassLoader());
+    }
+}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.options/src/org/graalvm/compiler/options/Option.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.options/src/org/graalvm/compiler/options/Option.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.options/src/org/graalvm/compiler/options/OptionDescriptor.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.options/src/org/graalvm/compiler/options/OptionDescriptor.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.options/src/org/graalvm/compiler/options/OptionKey.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.options/src/org/graalvm/compiler/options/OptionKey.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.options/src/org/graalvm/compiler/options/OptionValues.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.options/src/org/graalvm/compiler/options/OptionValues.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.options/src/org/graalvm/compiler/options/OptionsParser.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.options/src/org/graalvm/compiler/options/OptionsParser.java	Tue Sep 24 15:19:35 2019 -0400
@@ -36,8 +36,6 @@
 import jdk.internal.vm.compiler.collections.EconomicMap;
 import jdk.internal.vm.compiler.collections.MapCursor;
 
-import jdk.vm.ci.services.Services;
-
 /**
  * This class contains methods for parsing Graal options and matching them against a set of
  * {@link OptionDescriptors}. The {@link OptionDescriptors} are loaded via a {@link ServiceLoader}.
@@ -53,26 +51,12 @@
         if (IS_IN_NATIVE_IMAGE || cachedOptionDescriptors != null) {
             return cachedOptionDescriptors;
         }
-        boolean java8OrEarlier = Services.getSavedProperties().get("java.specification.version").compareTo("1.9") < 0;
-        ClassLoader loader;
-        if (java8OrEarlier) {
-            // On JDK 8, Graal and its extensions are loaded by same class loader.
-            loader = OptionDescriptors.class.getClassLoader();
-        } else {
-            /*
-             * The Graal module (i.e., jdk.internal.vm.compiler) is loaded by the platform class
-             * loader as of JDK 9. Modules that depend on and extend Graal are loaded by the app
-             * class loader. As such, we need to start the provider search at the app class loader
-             * instead of the platform class loader.
-             */
-            loader = ClassLoader.getSystemClassLoader();
-        }
-        return ServiceLoader.load(OptionDescriptors.class, loader);
+        return ModuleSupport.getOptionsLoader();
     }
 
-    public static void setCachedOptionDescriptors(List<OptionDescriptors> cachedOptionDescriptors) {
+    public static void setCachedOptionDescriptors(List<OptionDescriptors> list) {
         assert IS_BUILDING_NATIVE_IMAGE : "Used to pre-initialize the option descriptors during native image generation";
-        OptionsParser.cachedOptionDescriptors = cachedOptionDescriptors;
+        OptionsParser.cachedOptionDescriptors = list;
     }
 
     /**
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/AddressLoweringByUsePhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/AddressLoweringByUsePhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2017, Red Hat Inc. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -69,7 +69,7 @@
             AddressNode lowered;
             if (node instanceof ReadNode) {
                 ReadNode readNode = (ReadNode) node;
-                Stamp stamp = readNode.stamp(NodeView.DEFAULT);
+                Stamp stamp = readNode.getAccessStamp();
                 address = readNode.getAddress();
                 lowered = lowering.lower(readNode, stamp, address);
             } else if (node instanceof JavaReadNode) {
@@ -79,12 +79,12 @@
                 lowered = lowering.lower(javaReadNode, stamp, address);
             } else if (node instanceof FloatingReadNode) {
                 FloatingReadNode floatingReadNode = (FloatingReadNode) node;
-                Stamp stamp = floatingReadNode.stamp(NodeView.DEFAULT);
+                Stamp stamp = floatingReadNode.getAccessStamp();
                 address = floatingReadNode.getAddress();
                 lowered = lowering.lower(floatingReadNode, stamp, address);
             } else if (node instanceof AbstractWriteNode) {
                 AbstractWriteNode abstractWriteNode = (AbstractWriteNode) node;
-                Stamp stamp = abstractWriteNode.value().stamp(NodeView.DEFAULT);
+                Stamp stamp = abstractWriteNode.getAccessStamp();
                 address = abstractWriteNode.getAddress();
                 lowered = lowering.lower(abstractWriteNode, stamp, address);
             } else if (node instanceof PrefetchAllocateNode) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/CanonicalizerPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/CanonicalizerPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/ConditionalEliminationPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/ConditionalEliminationPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -309,7 +309,7 @@
             this.conditions = new ArrayDeque<>();
             tool = GraphUtil.getDefaultSimplifier(context.getMetaAccess(), context.getConstantReflection(), context.getConstantFieldProvider(), false, graph.getAssumptions(), graph.getOptions(),
                             context.getLowerer());
-            mergeMaps = EconomicMap.create();
+            mergeMaps = EconomicMap.create(Equivalence.IDENTITY);
         }
 
         protected void processConditionAnchor(ConditionAnchorNode node) {
@@ -616,7 +616,7 @@
                         Stamp newStamp = infoElement.getStamp();
                         if (phi.stamp(NodeView.DEFAULT).tryImproveWith(newStamp) != null) {
                             if (mergeMap == null) {
-                                mergeMap = EconomicMap.create();
+                                mergeMap = EconomicMap.create(Equivalence.IDENTITY);
                                 mergeMaps.put(merge, mergeMap);
                             }
 
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/DeoptimizationGroupingPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/DeoptimizationGroupingPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/ExpandLogicPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/ExpandLogicPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -24,7 +24,6 @@
 
 package org.graalvm.compiler.phases.common;
 
-import org.graalvm.compiler.core.common.type.FloatStamp;
 import org.graalvm.compiler.core.common.type.Stamp;
 import org.graalvm.compiler.debug.DebugCloseable;
 import org.graalvm.compiler.debug.GraalError;
@@ -42,12 +41,8 @@
 import org.graalvm.compiler.nodes.ShortCircuitOrNode;
 import org.graalvm.compiler.nodes.StructuredGraph;
 import org.graalvm.compiler.nodes.ValueNode;
+import org.graalvm.compiler.nodes.calc.AbstractNormalizeCompareNode;
 import org.graalvm.compiler.nodes.calc.ConditionalNode;
-import org.graalvm.compiler.nodes.calc.FloatEqualsNode;
-import org.graalvm.compiler.nodes.calc.FloatLessThanNode;
-import org.graalvm.compiler.nodes.calc.IntegerEqualsNode;
-import org.graalvm.compiler.nodes.calc.IntegerLessThanNode;
-import org.graalvm.compiler.nodes.calc.NormalizeCompareNode;
 import org.graalvm.compiler.phases.Phase;
 
 public class ExpandLogicPhase extends Phase {
@@ -61,7 +56,7 @@
         }
         assert graph.getNodes(ShortCircuitOrNode.TYPE).isEmpty();
 
-        for (NormalizeCompareNode logic : graph.getNodes(NormalizeCompareNode.TYPE)) {
+        for (AbstractNormalizeCompareNode logic : graph.getNodes(AbstractNormalizeCompareNode.TYPE)) {
             try (DebugCloseable context = logic.withNodeSourcePosition()) {
                 processNormalizeCompareNode(logic);
             }
@@ -69,23 +64,12 @@
         graph.setAfterExpandLogic();
     }
 
-    private static void processNormalizeCompareNode(NormalizeCompareNode normalize) {
-        LogicNode equalComp;
-        LogicNode lessComp;
+    private static void processNormalizeCompareNode(AbstractNormalizeCompareNode normalize) {
         StructuredGraph graph = normalize.graph();
-        ValueNode x = normalize.getX();
-        ValueNode y = normalize.getY();
-        if (x.stamp(NodeView.DEFAULT) instanceof FloatStamp) {
-            equalComp = graph.addOrUniqueWithInputs(FloatEqualsNode.create(x, y, NodeView.DEFAULT));
-            lessComp = graph.addOrUniqueWithInputs(FloatLessThanNode.create(x, y, normalize.isUnorderedLess(), NodeView.DEFAULT));
-        } else {
-            equalComp = graph.addOrUniqueWithInputs(IntegerEqualsNode.create(x, y, NodeView.DEFAULT));
-            lessComp = graph.addOrUniqueWithInputs(IntegerLessThanNode.create(x, y, NodeView.DEFAULT));
-        }
-
+        LogicNode equalComp = graph.addOrUniqueWithInputs(normalize.createEqualComparison());
+        LogicNode lessComp = graph.addOrUniqueWithInputs(normalize.createLowerComparison());
         Stamp stamp = normalize.stamp(NodeView.DEFAULT);
-        ConditionalNode equalValue = graph.unique(
-                        new ConditionalNode(equalComp, ConstantNode.forIntegerStamp(stamp, 0, graph), ConstantNode.forIntegerStamp(stamp, 1, graph)));
+        ConditionalNode equalValue = graph.unique(new ConditionalNode(equalComp, ConstantNode.forIntegerStamp(stamp, 0, graph), ConstantNode.forIntegerStamp(stamp, 1, graph)));
         ConditionalNode value = graph.unique(new ConditionalNode(lessComp, ConstantNode.forIntegerStamp(stamp, -1, graph), equalValue));
         normalize.replaceAtUsagesAndDelete(value);
     }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/FixReadsPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/FixReadsPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
 package org.graalvm.compiler.phases.common;
 
 import jdk.internal.vm.compiler.collections.EconomicMap;
+import jdk.internal.vm.compiler.collections.Equivalence;
 import jdk.internal.vm.compiler.collections.MapCursor;
 import org.graalvm.compiler.core.common.GraalOptions;
 import org.graalvm.compiler.core.common.cfg.BlockMap;
@@ -209,7 +210,7 @@
             this.schedule = schedule;
             this.metaAccess = metaAccess;
             blockActionStart = new BlockMap<>(schedule.getCFG());
-            endMaps = EconomicMap.create();
+            endMaps = EconomicMap.create(Equivalence.IDENTITY);
             stampMap = graph.createNodeMap();
             undoOperations = new NodeStack();
             replaceConstantInputs = replaceInputsWithConstants && GraalOptions.ReplaceInputsWithConstantsBasedOnStamps.getValue(graph.getOptions());
@@ -310,7 +311,7 @@
 
                 if (currentEndMap == null || !currentEndMap.isEmpty()) {
 
-                    EconomicMap<ValueNode, Stamp> endMap = EconomicMap.create();
+                    EconomicMap<ValueNode, Stamp> endMap = EconomicMap.create(Equivalence.IDENTITY);
 
                     // Process phis
                     for (ValuePhiNode phi : merge.valuePhis()) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/FrameStateAssignmentPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/FrameStateAssignmentPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -86,7 +86,7 @@
 
             if (node instanceof DeoptimizingNode.DeoptDuring) {
                 DeoptimizingNode.DeoptDuring deopt = (DeoptimizingNode.DeoptDuring) node;
-                if (deopt.canDeoptimize()) {
+                if (deopt.canDeoptimize() && deopt.stateDuring() == null) {
                     GraalError.guarantee(currentState != null, "no FrameState at DeoptimizingNode %s", deopt);
                     deopt.computeStateDuring(currentState);
                 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/IncrementalCanonicalizerPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/IncrementalCanonicalizerPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/LoweringPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/LoweringPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/NodeCounterPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/NodeCounterPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/OptimizeDivPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/OptimizeDivPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -49,12 +49,12 @@
 
     @Override
     protected void run(StructuredGraph graph) {
-        for (IntegerDivRemNode rem : graph.getNodes().filter(IntegerDivRemNode.class)) {
+        for (IntegerDivRemNode rem : graph.getNodes(IntegerDivRemNode.TYPE)) {
             if (rem instanceof SignedRemNode && divByNonZeroConstant(rem)) {
                 optimizeRem(rem);
             }
         }
-        for (IntegerDivRemNode div : graph.getNodes().filter(IntegerDivRemNode.class)) {
+        for (IntegerDivRemNode div : graph.getNodes(IntegerDivRemNode.TYPE)) {
             if (div instanceof SignedDivNode && divByNonZeroConstant(div)) {
                 optimizeSignedDiv((SignedDivNode) div);
             }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/PropagateDeoptimizeProbabilityPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/PropagateDeoptimizeProbabilityPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
 
 import jdk.internal.vm.compiler.collections.EconomicMap;
 import jdk.internal.vm.compiler.collections.EconomicSet;
+import jdk.internal.vm.compiler.collections.Equivalence;
 import jdk.internal.vm.compiler.collections.MapCursor;
 import org.graalvm.compiler.graph.NodeStack;
 import org.graalvm.compiler.nodes.AbstractBeginNode;
@@ -52,7 +53,7 @@
         if (graph.hasNode(AbstractDeoptimizeNode.TYPE)) {
 
             NodeStack stack = new NodeStack();
-            EconomicMap<ControlSplitNode, EconomicSet<AbstractBeginNode>> reachableSplits = EconomicMap.create();
+            EconomicMap<ControlSplitNode, EconomicSet<AbstractBeginNode>> reachableSplits = EconomicMap.create(Equivalence.IDENTITY);
 
             // Mark all control flow nodes that are post-dominated by a deoptimization.
             for (AbstractDeoptimizeNode d : graph.getNodes(AbstractDeoptimizeNode.TYPE)) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/RemoveValueProxyPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/RemoveValueProxyPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/UseTrappingNullChecksPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/UseTrappingNullChecksPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,6 +45,7 @@
 import org.graalvm.compiler.nodes.FixedNode;
 import org.graalvm.compiler.nodes.IfNode;
 import org.graalvm.compiler.nodes.LogicNode;
+import org.graalvm.compiler.nodes.LoopExitNode;
 import org.graalvm.compiler.nodes.StructuredGraph;
 import org.graalvm.compiler.nodes.ValueNode;
 import org.graalvm.compiler.nodes.ValuePhiNode;
@@ -165,7 +166,8 @@
 
     private static void tryUseTrappingNullCheck(AbstractDeoptimizeNode deopt, Node predecessor, DeoptimizationReason deoptimizationReason, Speculation speculation, long implicitNullCheckLimit) {
         assert predecessor != null;
-        if (deoptimizationReason != DeoptimizationReason.NullCheckException && deoptimizationReason != DeoptimizationReason.UnreachedCode) {
+        if (deoptimizationReason != DeoptimizationReason.NullCheckException && deoptimizationReason != DeoptimizationReason.UnreachedCode &&
+                        deoptimizationReason != DeoptimizationReason.TypeCheckedInliningViolated) {
             deopt.getDebug().log(DebugContext.INFO_LEVEL, "Not a null check or unreached %s", predecessor);
             return;
         }
@@ -174,17 +176,23 @@
             deopt.getDebug().log(DebugContext.INFO_LEVEL, "Has a speculation %s", predecessor);
             return;
         }
-        if (predecessor instanceof AbstractMergeNode) {
-            AbstractMergeNode merge = (AbstractMergeNode) predecessor;
+
+        // Skip over loop exit nodes.
+        Node pred = predecessor;
+        while (pred instanceof LoopExitNode) {
+            pred = pred.predecessor();
+        }
+        if (pred instanceof AbstractMergeNode) {
+            AbstractMergeNode merge = (AbstractMergeNode) pred;
             if (merge.phis().isEmpty()) {
                 for (AbstractEndNode end : merge.cfgPredecessors().snapshot()) {
                     checkPredecessor(deopt, end.predecessor(), deoptimizationReason, implicitNullCheckLimit);
                 }
             }
-        } else if (predecessor instanceof AbstractBeginNode) {
-            checkPredecessor(deopt, predecessor, deoptimizationReason, implicitNullCheckLimit);
+        } else if (pred instanceof AbstractBeginNode) {
+            checkPredecessor(deopt, pred, deoptimizationReason, implicitNullCheckLimit);
         } else {
-            deopt.getDebug().log(DebugContext.INFO_LEVEL, "Not a Begin or Merge %s", predecessor);
+            deopt.getDebug().log(DebugContext.INFO_LEVEL, "Not a Begin or Merge %s", pred);
         }
     }
 
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/inlining/InliningUtil.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/inlining/InliningUtil.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -728,7 +728,7 @@
         FrameState stateAtReturn = invoke.stateAfter();
         FrameState outerFrameState = null;
         JavaKind invokeReturnKind = invoke.asNode().getStackKind();
-        EconomicMap<Node, Node> replacements = EconomicMap.create();
+        EconomicMap<Node, Node> replacements = EconomicMap.create(Equivalence.IDENTITY);
         for (FrameState original : inlineGraph.getNodes(FrameState.TYPE)) {
             FrameState frameState = (FrameState) duplicates.get(original);
             if (frameState != null && frameState.isAlive()) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/inlining/info/elem/InlineableGraph.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/inlining/info/elem/InlineableGraph.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/inlining/policy/AbstractInliningPolicy.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/inlining/policy/AbstractInliningPolicy.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/inlining/policy/GreedyInliningPolicy.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/inlining/policy/GreedyInliningPolicy.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/inlining/policy/InlineEverythingPolicy.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/inlining/policy/InlineEverythingPolicy.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/inlining/policy/InlineMethodSubstitutionsPolicy.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/inlining/policy/InlineMethodSubstitutionsPolicy.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/inlining/policy/InliningPolicy.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/inlining/policy/InliningPolicy.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/util/EconomicSetNodeEventListener.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/util/EconomicSetNodeEventListener.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/PhaseSuite.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/PhaseSuite.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/VerifyPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/VerifyPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/graph/ReentrantBlockIterator.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/graph/ReentrantBlockIterator.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/tiers/HighTierContext.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/tiers/HighTierContext.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/tiers/LowTierContext.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/tiers/LowTierContext.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/tiers/MidTierContext.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/tiers/MidTierContext.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/util/GraphOrder.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/util/GraphOrder.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -158,7 +158,7 @@
     public static boolean assertSchedulableGraph(final StructuredGraph graph) {
         assert graph.getGuardsStage() != GuardsStage.AFTER_FSA : "Cannot use the BlockIteratorClosure after FrameState Assignment, HIR Loop Data Structures are no longer valid.";
         try (DebugContext.Scope s = graph.getDebug().scope("AssertSchedulableGraph")) {
-            final SchedulePhase schedulePhase = new SchedulePhase(SchedulingStrategy.LATEST_OUT_OF_LOOPS, true);
+            final SchedulePhase schedulePhase = new SchedulePhase(getSchedulingPolicy(graph), true);
             final EconomicMap<LoopBeginNode, NodeBitMap> loopEntryStates = EconomicMap.create(Equivalence.IDENTITY);
             schedulePhase.apply(graph, false);
             final ScheduleResult schedule = graph.getLastSchedule();
@@ -216,11 +216,11 @@
                                             }
                                         }
                                     }
-
                                     // loop contents are only accessible via proxies at the exit
                                     currentState.clearAll();
                                     currentState.markAll(loopEntryStates.get(((LoopExitNode) node).loopBegin()));
                                 }
+
                                 // Loop proxies aren't scheduled, so they need to be added
                                 // explicitly
                                 currentState.markAll(((LoopExitNode) node).proxies());
@@ -297,4 +297,14 @@
         }
         return true;
     }
+
+    /*
+     * Complexity of verification for LATEST_OUT_OF_LOOPS with value proxies exceeds the benefits.
+     * The problem are floating values that can be scheduled before the loop and have proxies only
+     * on some use edges after the loop. These values, which are hard to detect, get scheduled
+     * before the loop exit and are not visible in the state after the loop exit.
+     */
+    private static SchedulingStrategy getSchedulingPolicy(StructuredGraph graph) {
+        return graph.hasValueProxies() ? SchedulingStrategy.EARLIEST : SchedulingStrategy.LATEST_OUT_OF_LOOPS;
+    }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/util/Providers.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/util/Providers.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/BinaryGraphPrinter.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/BinaryGraphPrinter.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/CFGPrinterObserver.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/CFGPrinterObserver.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/GraalDebugHandlersFactory.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/GraalDebugHandlersFactory.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/GraphPrinter.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/GraphPrinter.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +28,11 @@
 import java.io.IOException;
 import java.lang.reflect.Array;
 import java.util.Arrays;
+import java.util.Collections;
+import java.util.IdentityHashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import org.graalvm.compiler.api.replacements.SnippetReflectionProvider;
 import org.graalvm.compiler.debug.DebugContext;
@@ -106,7 +109,7 @@
 
     /**
      * Use the real {@link Object#toString()} method for {@link JavaConstant JavaConstants} that are
-     * wrapping trusted types, other just return the results of {@link JavaConstant#toString()}.
+     * wrapping trusted types, otherwise just return the result of {@link JavaConstant#toString()}.
      */
     @Override
     default String format(JavaConstant constant) {
@@ -122,7 +125,8 @@
                 } catch (Throwable ex) {
                 }
                 if (obj != null) {
-                    return GraphPrinter.constantToString(obj);
+                    Set<Object> visited = Collections.newSetFromMap(new IdentityHashMap<>());
+                    return GraphPrinter.constantToString(obj, visited);
                 }
             }
         }
@@ -180,49 +184,61 @@
         return s;
     }
 
-    static String constantToString(Object value) {
-        Class<?> c = value.getClass();
-        String suffix = "";
-        if (c.isArray()) {
-            return constantArrayToString(value);
-        } else if (value instanceof Enum) {
-            return ((Enum<?>) value).name();
-        } else if (isToStringTrusted(c)) {
-            try {
-                return value.toString();
-            } catch (Throwable t) {
-                suffix = "[toString error: " + t.getClass().getName() + "]";
-                if (isToStringTrusted(t.getClass())) {
-                    try {
-                        suffix = "[toString error: " + t + "]";
-                    } catch (Throwable t2) {
-                        // No point in going further
+    static String constantToString(Object value, Set<Object> visited) {
+        if (!visited.contains(value)) {
+            Class<?> c = value.getClass();
+            String suffix = "";
+            if (c.isArray()) {
+                return constantArrayToString(value, visited);
+            }
+            visited.add(value);
+            if (value instanceof Enum) {
+                return ((Enum<?>) value).name();
+            } else if (isToStringTrusted(c)) {
+                try {
+                    return value.toString();
+                } catch (Throwable t) {
+                    suffix = "[toString error: " + t.getClass().getName() + "]";
+                    if (isToStringTrusted(t.getClass())) {
+                        try {
+                            suffix = "[toString error: " + t + "]";
+                        } catch (Throwable t2) {
+                            // No point in going further
+                        }
                     }
                 }
             }
+            return MetaUtil.getSimpleName(c, true) + "@" + Integer.toHexString(System.identityHashCode(value)) + suffix;
+        } else {
+            return "...";
         }
-        return MetaUtil.getSimpleName(c, true) + "@" + Integer.toHexString(System.identityHashCode(value)) + suffix;
+
     }
 
-    static String constantArrayToString(Object array) {
-        Class<?> componentType = array.getClass().getComponentType();
-        assert componentType != null;
-        int arrayLength = Array.getLength(array);
-        StringBuilder buf = new StringBuilder(MetaUtil.getSimpleName(componentType, true)).append('[').append(arrayLength).append("]{");
-        int length = arrayLength;
-        boolean primitive = componentType.isPrimitive();
-        for (int i = 0; i < length; i++) {
-            if (primitive) {
-                buf.append(Array.get(array, i));
-            } else {
-                Object o = ((Object[]) array)[i];
-                buf.append(o == null ? "null" : constantToString(o));
+    static String constantArrayToString(Object array, Set<Object> visited) {
+        if (!visited.contains(array)) {
+            visited.add(array);
+            Class<?> componentType = array.getClass().getComponentType();
+            assert componentType != null;
+            int arrayLength = Array.getLength(array);
+            StringBuilder buf = new StringBuilder(MetaUtil.getSimpleName(componentType, true)).append('[').append(arrayLength).append("]{");
+            int length = arrayLength;
+            boolean primitive = componentType.isPrimitive();
+            for (int i = 0; i < length; i++) {
+                if (primitive) {
+                    buf.append(Array.get(array, i));
+                } else {
+                    Object o = ((Object[]) array)[i];
+                    buf.append(o == null ? "null" : constantToString(o, visited));
+                }
+                if (i != length - 1) {
+                    buf.append(", ");
+                }
             }
-            if (i != length - 1) {
-                buf.append(", ");
-            }
+            return buf.append('}').toString();
+        } else {
+            return "...";
         }
-        return buf.append('}').toString();
     }
 
     @SuppressWarnings("try")
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/GraphPrinterDumpHandler.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/GraphPrinterDumpHandler.java	Tue Sep 24 15:19:35 2019 -0400
@@ -37,13 +37,14 @@
 import java.util.Map;
 import java.util.WeakHashMap;
 
+import org.graalvm.compiler.core.common.CompilationIdentifier;
 import org.graalvm.compiler.debug.DebugContext;
 import org.graalvm.compiler.debug.DebugDumpHandler;
 import org.graalvm.compiler.debug.DebugDumpScope;
 import org.graalvm.compiler.debug.DebugOptions;
+import org.graalvm.compiler.debug.DebugOptions.PrintGraphTarget;
 import org.graalvm.compiler.debug.GraalError;
 import org.graalvm.compiler.debug.TTY;
-import org.graalvm.compiler.debug.DebugOptions.PrintGraphTarget;
 import org.graalvm.compiler.graph.Graph;
 import org.graalvm.compiler.nodes.StructuredGraph;
 import org.graalvm.compiler.options.OptionValues;
@@ -66,6 +67,7 @@
     private final GraphPrinterSupplier printerSupplier;
     protected GraphPrinter printer;
     private List<String> previousInlineContext;
+    private CompilationIdentifier previousCompilationID = CompilationIdentifier.INVALID_COMPILATION_ID;
     private int[] dumpIds = {};
     private int failuresCount;
     private Map<Graph, List<String>> inlineContextMap;
@@ -136,6 +138,22 @@
             // Get all current JavaMethod instances in the context.
             List<String> inlineContext = getInlineContext(graph);
 
+            if (graph instanceof StructuredGraph) {
+                CompilationIdentifier compilationID = ((StructuredGraph) graph).compilationId();
+                // If the graph to be dumped is with an invalid compilation id, it is likely derived
+                // from inlining.
+                if (compilationID != CompilationIdentifier.INVALID_COMPILATION_ID) {
+                    if (previousCompilationID != CompilationIdentifier.INVALID_COMPILATION_ID && !compilationID.equals(previousCompilationID)) {
+                        // Compilation ID does not match, close existing scopes.
+                        for (int inlineDepth = previousInlineContext.size() - 1; inlineDepth >= 0; --inlineDepth) {
+                            closeScope(debug, inlineDepth);
+                        }
+                        previousInlineContext = new ArrayList<>();
+                    }
+                    previousCompilationID = compilationID;
+                }
+            }
+
             if (!inlineContext.equals(previousInlineContext)) {
                 Map<Object, Object> properties = new HashMap<>();
                 properties.put("graph", graph.toString());
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.aarch64/src/org/graalvm/compiler/replacements/aarch64/AArch64GraphBuilderPlugins.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.aarch64/src/org/graalvm/compiler/replacements/aarch64/AArch64GraphBuilderPlugins.java	Tue Sep 24 15:19:35 2019 -0400
@@ -45,17 +45,24 @@
 import org.graalvm.compiler.nodes.java.AtomicReadAndWriteNode;
 import org.graalvm.compiler.nodes.memory.address.AddressNode;
 import org.graalvm.compiler.nodes.memory.address.OffsetAddressNode;
+import org.graalvm.compiler.replacements.TargetGraphBuilderPlugins;
 import org.graalvm.compiler.replacements.nodes.BinaryMathIntrinsicNode;
 import org.graalvm.compiler.replacements.nodes.UnaryMathIntrinsicNode;
 import org.graalvm.compiler.replacements.nodes.UnaryMathIntrinsicNode.UnaryOperation;
 import org.graalvm.compiler.serviceprovider.JavaVersionUtil;
 import jdk.internal.vm.compiler.word.LocationIdentity;
 
+import jdk.vm.ci.code.Architecture;
 import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.meta.ResolvedJavaMethod;
 import sun.misc.Unsafe;
 
-public class AArch64GraphBuilderPlugins {
+public class AArch64GraphBuilderPlugins implements TargetGraphBuilderPlugins {
+    @Override
+    public void register(Plugins plugins, BytecodeProvider replacementsBytecodeProvider, Architecture arch, boolean explicitUnsafeNullChecks, boolean registerMathPlugins,
+                    boolean emitJDK9StringSubstitutions, boolean useFMAIntrinsics) {
+        register(plugins, replacementsBytecodeProvider, explicitUnsafeNullChecks, registerMathPlugins, emitJDK9StringSubstitutions);
+    }
 
     public static void register(Plugins plugins, BytecodeProvider bytecodeProvider, boolean explicitUnsafeNullChecks,
                     boolean registerMathPlugins) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.aarch64/src/org/graalvm/compiler/replacements/aarch64/AArch64IntegerArithmeticSnippets.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.aarch64/src/org/graalvm/compiler/replacements/aarch64/AArch64IntegerArithmeticSnippets.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2018, Red Hat Inc. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -44,6 +44,7 @@
 import org.graalvm.compiler.nodes.calc.SignedRemNode;
 import org.graalvm.compiler.nodes.calc.UnsignedDivNode;
 import org.graalvm.compiler.nodes.calc.UnsignedRemNode;
+import org.graalvm.compiler.nodes.extended.BranchProbabilityNode;
 import org.graalvm.compiler.nodes.spi.LoweringTool;
 import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
 import org.graalvm.compiler.options.OptionValues;
@@ -183,14 +184,14 @@
     }
 
     private static void checkForZero(int y) {
-        if (y == 0) {
+        if (BranchProbabilityNode.probability(BranchProbabilityNode.DEOPT_PROBABILITY, y == 0)) {
             // "/ by zero"
             DeoptimizeNode.deopt(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.ArithmeticException);
         }
     }
 
     private static void checkForZero(long y) {
-        if (y == 0) {
+        if (BranchProbabilityNode.probability(BranchProbabilityNode.DEOPT_PROBABILITY, y == 0)) {
             // "/ by zero"
             DeoptimizeNode.deopt(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.ArithmeticException);
         }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.amd64/src/org/graalvm/compiler/replacements/amd64/AMD64ArrayIndexOf.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.amd64/src/org/graalvm/compiler/replacements/amd64/AMD64ArrayIndexOf.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.amd64/src/org/graalvm/compiler/replacements/amd64/AMD64ArrayIndexOfNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.amd64/src/org/graalvm/compiler/replacements/amd64/AMD64ArrayIndexOfNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.amd64/src/org/graalvm/compiler/replacements/amd64/AMD64GraphBuilderPlugins.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.amd64/src/org/graalvm/compiler/replacements/amd64/AMD64GraphBuilderPlugins.java	Tue Sep 24 15:19:35 2019 -0400
@@ -54,6 +54,7 @@
 import org.graalvm.compiler.replacements.StandardGraphBuilderPlugins.UnsafeAccessPlugin;
 import org.graalvm.compiler.replacements.StandardGraphBuilderPlugins.UnsafeGetPlugin;
 import org.graalvm.compiler.replacements.StandardGraphBuilderPlugins.UnsafePutPlugin;
+import org.graalvm.compiler.replacements.TargetGraphBuilderPlugins;
 import org.graalvm.compiler.replacements.nodes.BinaryMathIntrinsicNode;
 import org.graalvm.compiler.replacements.nodes.BinaryMathIntrinsicNode.BinaryOperation;
 import org.graalvm.compiler.replacements.nodes.BitCountNode;
@@ -64,11 +65,17 @@
 
 import jdk.vm.ci.amd64.AMD64;
 import jdk.vm.ci.amd64.AMD64.CPUFeature;
+import jdk.vm.ci.code.Architecture;
 import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.meta.ResolvedJavaMethod;
 import sun.misc.Unsafe;
 
-public class AMD64GraphBuilderPlugins {
+public class AMD64GraphBuilderPlugins implements TargetGraphBuilderPlugins {
+    @Override
+    public void register(Plugins plugins, BytecodeProvider replacementsBytecodeProvider, Architecture architecture, boolean explicitUnsafeNullChecks,
+                    boolean registerMathPlugins, boolean emitJDK9StringSubstitutions, boolean useFMAIntrinsics) {
+        register(plugins, replacementsBytecodeProvider, (AMD64) architecture, explicitUnsafeNullChecks, emitJDK9StringSubstitutions, useFMAIntrinsics);
+    }
 
     public static void register(Plugins plugins, BytecodeProvider replacementsBytecodeProvider, AMD64 arch, boolean explicitUnsafeNullChecks, boolean emitJDK9StringSubstitutions,
                     boolean useFMAIntrinsics) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.amd64/src/org/graalvm/compiler/replacements/amd64/AMD64StringLatin1Substitutions.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.amd64/src/org/graalvm/compiler/replacements/amd64/AMD64StringLatin1Substitutions.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -134,8 +134,6 @@
         }
         if (targetCount == 1) {
             return AMD64ArrayIndexOf.indexOf1Byte(source, sourceCount, fromIndex, target[0]);
-        } else if (targetCount == 2) {
-            return AMD64ArrayIndexOf.indexOfTwoConsecutiveBytes(source, sourceCount, fromIndex, target[0], target[1]);
         } else {
             int haystackLength = sourceCount - (targetCount - 2);
             int offset = fromIndex;
@@ -147,7 +145,7 @@
                 offset = indexOfResult;
                 Pointer cmpSourcePointer = byteOffsetPointer(source, offset);
                 Pointer targetPointer = pointer(target);
-                if (ArrayRegionEqualsNode.regionEquals(cmpSourcePointer, targetPointer, targetCount, JavaKind.Byte)) {
+                if (targetCount == 2 || ArrayRegionEqualsNode.regionEquals(cmpSourcePointer, targetPointer, targetCount, JavaKind.Byte)) {
                     return offset;
                 }
                 offset++;
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.amd64/src/org/graalvm/compiler/replacements/amd64/AMD64StringSubstitutions.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.amd64/src/org/graalvm/compiler/replacements/amd64/AMD64StringSubstitutions.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -85,8 +85,6 @@
 
         if (targetCount == 1) {
             return AMD64ArrayIndexOf.indexOf1Char(source, sourceCount, totalOffset, target[targetOffset]);
-        } else if (targetCount == 2) {
-            return AMD64ArrayIndexOf.indexOfTwoConsecutiveChars(source, sourceCount, totalOffset, target[targetOffset], target[targetOffset + 1]);
         } else {
             int haystackLength = sourceCount - (targetCount - 2);
             while (totalOffset < haystackLength) {
@@ -95,10 +93,14 @@
                     return -1;
                 }
                 totalOffset = indexOfResult;
-                Pointer cmpSourcePointer = Word.objectToTrackedPointer(source).add(charArrayBaseOffset(INJECTED)).add(totalOffset * charArrayIndexScale(INJECTED));
-                Pointer targetPointer = Word.objectToTrackedPointer(target).add(charArrayBaseOffset(INJECTED)).add(targetOffset * charArrayIndexScale(INJECTED));
-                if (ArrayRegionEqualsNode.regionEquals(cmpSourcePointer, targetPointer, targetCount, JavaKind.Char)) {
+                if (targetCount == 2) {
                     return totalOffset;
+                } else {
+                    Pointer cmpSourcePointer = Word.objectToTrackedPointer(source).add(charArrayBaseOffset(INJECTED)).add(totalOffset * charArrayIndexScale(INJECTED));
+                    Pointer targetPointer = Word.objectToTrackedPointer(target).add(charArrayBaseOffset(INJECTED)).add(targetOffset * charArrayIndexScale(INJECTED));
+                    if (ArrayRegionEqualsNode.regionEquals(cmpSourcePointer, targetPointer, targetCount, JavaKind.Char)) {
+                        return totalOffset;
+                    }
                 }
                 totalOffset++;
             }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.amd64/src/org/graalvm/compiler/replacements/amd64/AMD64StringUTF16Substitutions.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.amd64/src/org/graalvm/compiler/replacements/amd64/AMD64StringUTF16Substitutions.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -122,8 +122,6 @@
         ReplacementsUtil.runtimeAssert(sourceCount >= targetCount, "StringUTF16.indexOfUnsafe invalid args: sourceCount < targetCount");
         if (targetCount == 1) {
             return AMD64ArrayIndexOf.indexOf1Char(source, sourceCount, fromIndex, StringUTF16Substitutions.getChar(target, 0));
-        } else if (targetCount == 2) {
-            return AMD64ArrayIndexOf.indexOfTwoConsecutiveChars(source, sourceCount, fromIndex, StringUTF16Substitutions.getChar(target, 0), StringUTF16Substitutions.getChar(target, 1));
         } else {
             int haystackLength = sourceCount - (targetCount - 2);
             int offset = fromIndex;
@@ -136,7 +134,7 @@
                 offset = indexOfResult;
                 Pointer cmpSourcePointer = charOffsetPointer(source, offset);
                 Pointer targetPointer = pointer(target);
-                if (ArrayRegionEqualsNode.regionEquals(cmpSourcePointer, targetPointer, targetCount, JavaKind.Char)) {
+                if (targetCount == 2 || ArrayRegionEqualsNode.regionEquals(cmpSourcePointer, targetPointer, targetCount, JavaKind.Char)) {
                     return offset;
                 }
                 offset++;
@@ -153,8 +151,6 @@
         ReplacementsUtil.runtimeAssert(sourceCount >= targetCount, "StringUTF16.indexOfLatin1Unsafe invalid args: sourceCount < targetCount");
         if (targetCount == 1) {
             return AMD64ArrayIndexOf.indexOf1Char(source, sourceCount, fromIndex, (char) Byte.toUnsignedInt(target[0]));
-        } else if (targetCount == 2) {
-            return AMD64ArrayIndexOf.indexOfTwoConsecutiveChars(source, sourceCount, fromIndex, (char) Byte.toUnsignedInt(target[0]), (char) Byte.toUnsignedInt(target[1]));
         } else {
             int haystackLength = sourceCount - (targetCount - 2);
             int offset = fromIndex;
@@ -166,7 +162,7 @@
                 offset = indexOfResult;
                 Pointer cmpSourcePointer = charOffsetPointer(source, offset);
                 Pointer targetPointer = pointer(target);
-                if (ArrayRegionEqualsNode.regionEquals(cmpSourcePointer, targetPointer, targetCount, JavaKind.Char, JavaKind.Byte)) {
+                if (targetCount == 2 || ArrayRegionEqualsNode.regionEquals(cmpSourcePointer, targetPointer, targetCount, JavaKind.Char, JavaKind.Byte)) {
                     return offset;
                 }
                 offset++;
@@ -185,9 +181,7 @@
      */
     @MethodSubstitution
     public static int compress(char[] src, int srcIndex, byte[] dest, int destIndex, int len) {
-        if (len < 0 || srcIndex < 0 || (srcIndex + len > src.length) || destIndex < 0 || (destIndex + len > dest.length)) {
-            DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.BoundsCheckException);
-        }
+        checkLimits(src.length, srcIndex, dest.length, destIndex, len);
 
         Pointer srcPointer = Word.objectToTrackedPointer(src).add(charArrayBaseOffset(INJECTED)).add(srcIndex * charArrayIndexScale(INJECTED));
         Pointer destPointer = Word.objectToTrackedPointer(dest).add(byteArrayBaseOffset(INJECTED)).add(destIndex * byteArrayIndexScale(INJECTED));
@@ -208,13 +202,17 @@
      */
     @MethodSubstitution
     public static int compress(byte[] src, int srcIndex, byte[] dest, int destIndex, int len) {
-        if (len < 0 || srcIndex < 0 || (srcIndex * 2 + len * 2 > src.length) || destIndex < 0 || (destIndex + len > dest.length)) {
-            DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.BoundsCheckException);
-        }
+        checkLimits(src.length >> 1, srcIndex, dest.length, destIndex, len);
 
         Pointer srcPointer = Word.objectToTrackedPointer(src).add(byteArrayBaseOffset(INJECTED)).add(srcIndex * 2 * byteArrayIndexScale(INJECTED));
         Pointer destPointer = Word.objectToTrackedPointer(dest).add(byteArrayBaseOffset(INJECTED)).add(destIndex * byteArrayIndexScale(INJECTED));
         return AMD64StringUTF16CompressNode.compress(srcPointer, destPointer, len, JavaKind.Byte);
     }
 
+    private static void checkLimits(int srcLen, int srcIndex, int destLen, int destIndex, int len) {
+        if (len < 0 || srcIndex < 0 || (srcIndex + len > srcLen) || destIndex < 0 || (destIndex + len > destLen)) {
+            DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.BoundsCheckException);
+        }
+    }
+
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.processor/src/org/graalvm/compiler/replacements/processor/GeneratedFoldPlugin.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.processor/src/org/graalvm/compiler/replacements/processor/GeneratedFoldPlugin.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.processor/src/org/graalvm/compiler/replacements/processor/GeneratedPlugin.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.processor/src/org/graalvm/compiler/replacements/processor/GeneratedPlugin.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -73,6 +73,9 @@
         out.printf("\n");
         out.printf("    @Override\n");
         out.printf("    public boolean execute(GraphBuilderContext b, ResolvedJavaMethod targetMethod, InvocationPlugin.Receiver receiver, ValueNode[] args) {\n");
+        out.printf("        if (!b.isPluginEnabled(this)) {\n");
+        out.printf("            return false;\n");
+        out.printf("        }\n");
         InjectedDependencies deps = createExecute(processor, out);
         out.printf("    }\n");
         out.printf("    @Override\n");
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/ArraysSubstitutionsTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/ArraysSubstitutionsTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/DeoptimizeOnExceptionTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/DeoptimizeOnExceptionTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/DeoptimizeOnIntegerExactTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/DeoptimizeOnIntegerExactTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/DerivedOopTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/DerivedOopTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/FoldTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/FoldTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/IntegerExactExceptionTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/IntegerExactExceptionTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/IntegerExactFoldTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/IntegerExactFoldTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/InvokerSignatureMismatchTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/InvokerSignatureMismatchTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -27,69 +27,47 @@
 import static org.graalvm.compiler.test.SubprocessUtil.getVMCommandLine;
 import static org.graalvm.compiler.test.SubprocessUtil.withoutDebuggerArguments;
 
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+
+import org.graalvm.compiler.core.test.CustomizedBytecodePatternTest;
+import org.graalvm.compiler.serviceprovider.JavaVersionUtil;
+import org.graalvm.compiler.test.SubprocessUtil;
+import org.graalvm.compiler.test.SubprocessUtil.Subprocess;
 import org.junit.Test;
 import org.objectweb.asm.ClassWriter;
 import org.objectweb.asm.MethodVisitor;
 import org.objectweb.asm.Type;
 
-import java.io.File;
-import java.lang.invoke.MethodHandles;
-import java.util.List;
+public class InvokerSignatureMismatchTest extends CustomizedBytecodePatternTest {
 
-import org.graalvm.compiler.core.test.CustomizedBytecodePatternTest;
-import org.graalvm.compiler.test.SubprocessUtil;
-import org.graalvm.compiler.test.SubprocessUtil.Subprocess;
-
-import jdk.vm.ci.meta.ResolvedJavaMethod;
-
-public class InvokerSignatureMismatchTest {
-
+    @SuppressWarnings("try")
     @Test
     public void test() throws Throwable {
         List<String> args = withoutDebuggerArguments(getVMCommandLine());
-        String classPath = System.getProperty("java.class.path");
-        classPath = classPath + File.pathSeparator + TestISMBL.class.getProtectionDomain().getCodeSource().getLocation().getPath();
-        args.add("-Xbootclasspath/a:" + classPath);
-        args.add("-XX:-TieredCompilation");
-        args.add("-XX:+EnableJVMCI");
-        args.add("-XX:+UseJVMCICompiler");
-
-        args.add(TestISMBL.class.getName());
-        Subprocess proc = SubprocessUtil.java(args);
-        if (proc.exitCode != 0) {
-            System.out.println(proc);
-        }
-    }
-}
-
-class TestISMBL extends CustomizedBytecodePatternTest {
+        try (TemporaryDirectory temp = new TemporaryDirectory(null, getClass().getSimpleName())) {
+            if (JavaVersionUtil.JAVA_SPEC > 8) {
+                args.add("--class-path=" + temp);
+                args.add("--patch-module=java.base=" + temp);
+            } else {
+                args.add("-Xbootclasspath/a:" + temp);
+            }
+            args.add("-XX:-TieredCompilation");
+            args.add("-XX:+UnlockExperimentalVMOptions");
+            args.add("-XX:+EnableJVMCI");
+            args.add("-XX:+UseJVMCICompiler");
 
-    public static void main(String[] args) {
-        try {
-            new TestISMBL().test();
-        } catch (Throwable e) {
-            e.printStackTrace();
-            System.exit(1);
-        }
-        System.exit(0);
-    }
+            Path invokeDir = Files.createDirectories(temp.path.resolve(Paths.get("java", "lang", "invoke")));
+            Files.write(temp.path.resolve("ISMTest.class"), generateClass("ISMTest"));
+            Files.write(invokeDir.resolve("MethodHandleHelper.class"), generateClass("java/lang/invoke/MethodHandleHelper"));
 
-    private void test() throws Throwable {
-        getClass("java/lang/invoke/MHHelper");
-        Class<?> testClass = getClass("ISMTest");
-
-        ResolvedJavaMethod mL = getResolvedJavaMethod(testClass, "mainLink");
-        ResolvedJavaMethod mI = getResolvedJavaMethod(testClass, "mainInvoke");
-        executeActual(mL, null, 100);
-        executeActual(mI, null, 100);
-    }
-
-    @Override
-    protected Class<?> getClass(String className) throws ClassNotFoundException {
-        if (className.equals("java/lang/invoke/MHHelper")) {
-            return super.getClassBL(className, MethodHandles.lookup());
-        } else {
-            return super.getClass(className);
+            args.add("ISMTest");
+            Subprocess proc = SubprocessUtil.java(args);
+            if (proc.exitCode != 0) {
+                throw new AssertionError(proc.toString());
+            }
         }
     }
 
@@ -99,7 +77,7 @@
         ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
         cw.visit(52, ACC_SUPER | ACC_PUBLIC, className, null, "java/lang/Object", null);
 
-        if (className.equals("java/lang/invoke/MHHelper")) {
+        if (className.equals("java/lang/invoke/MethodHandleHelper")) {
             MethodVisitor internalMemberName = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "internalMemberName", "(Ljava/lang/invoke/MethodHandle;)Ljava/lang/Object;", null, exceptions);
             internalMemberName.visitCode();
             internalMemberName.visitVarInsn(ALOAD, 0);
@@ -149,12 +127,12 @@
             MethodVisitor mainLink = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "mainLink", "(I)I", null, exceptions);
             mainLink.visitCode();
             mainLink.visitFieldInsn(GETSTATIC, className, "INT_MH", "Ljava/lang/invoke/MethodHandle;");
-            mainLink.visitMethodInsn(INVOKESTATIC, "java/lang/invoke/MHHelper", "internalMemberName", "(Ljava/lang/invoke/MethodHandle;)Ljava/lang/Object;", false);
+            mainLink.visitMethodInsn(INVOKESTATIC, "java/lang/invoke/MethodHandleHelper", "internalMemberName", "(Ljava/lang/invoke/MethodHandle;)Ljava/lang/Object;", false);
             mainLink.visitVarInsn(ASTORE, 1);
             mainLink.visitVarInsn(ILOAD, 0);
             mainLink.visitInsn(I2F);
             mainLink.visitVarInsn(ALOAD, 1);
-            mainLink.visitMethodInsn(INVOKESTATIC, "java/lang/invoke/MHHelper", "linkToStatic", "(FLjava/lang/Object;)I", false);
+            mainLink.visitMethodInsn(INVOKESTATIC, "java/lang/invoke/MethodHandleHelper", "linkToStatic", "(FLjava/lang/Object;)I", false);
             mainLink.visitInsn(IRETURN);
             mainLink.visitMaxs(1, 1);
             mainLink.visitEnd();
@@ -164,7 +142,7 @@
             mainInvoke.visitFieldInsn(GETSTATIC, className, "INT_MH", "Ljava/lang/invoke/MethodHandle;");
             mainInvoke.visitVarInsn(ILOAD, 0);
             mainInvoke.visitInsn(I2F);
-            mainInvoke.visitMethodInsn(INVOKESTATIC, "java/lang/invoke/MHHelper", "invokeBasicI", "(Ljava/lang/invoke/MethodHandle;F)I", false);
+            mainInvoke.visitMethodInsn(INVOKESTATIC, "java/lang/invoke/MethodHandleHelper", "invokeBasicI", "(Ljava/lang/invoke/MethodHandle;F)I", false);
             mainInvoke.visitInsn(IRETURN);
             mainInvoke.visitMaxs(1, 1);
             mainInvoke.visitEnd();
@@ -177,6 +155,19 @@
             bodyI.visitInsn(IRETURN);
             bodyI.visitMaxs(1, 1);
             bodyI.visitEnd();
+
+            MethodVisitor main = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "main", "([Ljava/lang/String;)V", null, exceptions);
+            main.visitCode();
+            main.visitIntInsn(SIPUSH, 100);
+            main.visitMethodInsn(INVOKESTATIC, "ISMTest", "mainLink", "(I)I", false);
+            main.visitInsn(POP);
+            main.visitIntInsn(SIPUSH, 100);
+            main.visitMethodInsn(INVOKESTATIC, "ISMTest", "mainInvoke", "(I)I", false);
+            main.visitInsn(POP);
+            main.visitInsn(RETURN);
+            main.visitMaxs(1, 1);
+            main.visitEnd();
+
         }
         cw.visitEnd();
         return cw.toByteArray();
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/MethodSubstitutionTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/MethodSubstitutionTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/PEGraphDecoderTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/PEGraphDecoderTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
 
 import static org.graalvm.compiler.nodes.graphbuilderconf.InlineInvokePlugin.InlineInfo.createStandardInlineInfo;
 
+import jdk.internal.vm.compiler.collections.EconomicMap;
 import org.graalvm.compiler.core.common.type.StampFactory;
 import org.graalvm.compiler.core.test.GraalCompilerTest;
 import org.graalvm.compiler.debug.DebugContext;
@@ -138,7 +139,7 @@
             registerPlugins(graphBuilderConfig.getPlugins().getInvocationPlugins());
             targetGraph = new StructuredGraph.Builder(getInitialOptions(), debug, AllowAssumptions.YES).method(testMethod).build();
             CachingPEGraphDecoder decoder = new CachingPEGraphDecoder(getTarget().arch, targetGraph, getProviders(), graphBuilderConfig, OptimisticOptimizations.NONE, AllowAssumptions.YES,
-                            null, null, new InlineInvokePlugin[]{new InlineAll()}, null, null, null, null, null);
+                            null, null, new InlineInvokePlugin[]{new InlineAll()}, null, null, null, null, null, null, EconomicMap.create());
 
             decoder.decode(testMethod, false, false);
             debug.dump(DebugContext.BASIC_LEVEL, targetGraph, "Target Graph");
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/ReplacementsParseTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/ReplacementsParseTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/SnippetsTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/SnippetsTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/StandardMethodSubstitutionsTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/StandardMethodSubstitutionsTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/StringCompareToAVX512Test.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.graalvm.compiler.replacements.test;
+
+import org.graalvm.compiler.core.test.GraalCompilerTest;
+import org.junit.Test;
+
+// JDK-8228903
+public final class StringCompareToAVX512Test extends GraalCompilerTest {
+
+    public static int compareTo(String str1, String str2) {
+        return str1.compareTo(str2);
+    }
+
+    @Test
+    public void testLatin1VsUtf16BadStride() {
+        String latin1 = "000000001111111122222222333333334444444455555555666666667777777\u0099888888889";
+        String utf16 = "000000001111111122222222333333334444444455555555666666667777777\u0699888888889";
+        test("compareTo", latin1, utf16);
+        test("compareTo", utf16, latin1);
+    }
+
+    @Test
+    public void testLatin1VsUtf16BadStride2() {
+        String latin1 = "00000000111111112222222233333333444444445555555566666666777777778888888\u008799999999AAAAAAAAB";
+        String utf16 = "00000000111111112222222233333333444444445555555566666666777777778888888\u058799999999AAAAAAAAB";
+        test("compareTo", latin1, utf16);
+        test("compareTo", utf16, latin1);
+    }
+
+    @Test
+    public void testLatin1VsUtf16FalseEquality() {
+        // java.lang.AssertionError: expected:<-1536> but was:<0>
+        String latin1 = "00000000111111112222222233333333\u0099444444455555555";
+        String utf16 = "00000000111111112222222233333333\u0699xxxxxxxxxxxxxxx";
+        test("compareTo", latin1, utf16);
+        test("compareTo", utf16, latin1);
+    }
+
+    @Test
+    public void testLatin1BeyondRange() {
+        StringBuilder latin1Builder = new StringBuilder();
+        for (int j = 0; j <= 255; ++j) {
+            latin1Builder.append((char) j);
+        }
+        String latin1 = latin1Builder.toString();
+        test("compareTo", latin1, String.valueOf(latin1.toCharArray()));
+    }
+}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/StringCompareToTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/StringCompareToTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/StringCompressInflateTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/StringCompressInflateTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/StringIndexOfCharTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/StringIndexOfCharTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,11 +32,8 @@
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 
-@RunWith(value = Parameterized.class)
+@RunWith(Parameterized.class)
 public class StringIndexOfCharTest extends GraalCompilerTest {
-    @Parameterized.Parameter(value = 0) public String sourceString;
-    @Parameterized.Parameter(value = 1) public int constantChar;
-    @Parameterized.Parameter(value = 2) public int fromIndex;
 
     @Parameterized.Parameters(name = "{0},{1},{2}")
     public static Collection<Object[]> data() {
@@ -68,6 +65,16 @@
         return tests;
     }
 
+    private final String sourceString;
+    private final int constantChar;
+    private final int fromIndex;
+
+    public StringIndexOfCharTest(String sourceString, int constantChar, int fromIndex) {
+        this.sourceString = sourceString;
+        this.constantChar = constantChar;
+        this.fromIndex = fromIndex;
+    }
+
     public int testStringIndexOf(String a, int b) {
         return a.indexOf(b);
     }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/StringIndexOfConstantTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/StringIndexOfConstantTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,10 @@
 
 public class StringIndexOfConstantTest extends StringIndexOfTestBase {
 
+    public StringIndexOfConstantTest(String sourceString, String constantString) {
+        super(sourceString, constantString);
+    }
+
     /*
      * These test definitions could live in the superclass except that the mx junit individual test
      * runner can't find tests in superclasses.
@@ -87,6 +91,7 @@
     @Override
     protected InstalledCode getCode(final ResolvedJavaMethod installedCodeOwner, StructuredGraph graph0, boolean ignoreForceCompile, boolean ignoreInstallAsDefault, OptionValues options) {
         // Force recompile if constant binding should be done
-        return super.getCode(installedCodeOwner, graph0, /* forceCompile */true, /* installAsDefault */false, options);
+        return super.getCode(installedCodeOwner, graph0,
+                        /* forceCompile */ true, /* installAsDefault */ false, options);
     }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/StringIndexOfTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/StringIndexOfTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,11 +27,15 @@
 import org.junit.Test;
 
 public class StringIndexOfTest extends StringIndexOfTestBase {
+
+    public StringIndexOfTest(String sourceString, String constantString) {
+        super(sourceString, constantString);
+    }
+
     /*
      * These test definitions could live in the superclass except that the mx junit individual test
      * runner can't find tests in superclasses.
      */
-
     @Override
     @Test
     public void testStringIndexOfConstant() {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/StringIndexOfTestBase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/StringIndexOfTestBase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,19 +26,18 @@
 
 import static org.junit.Assume.assumeFalse;
 
+import java.util.ArrayList;
+import java.util.Collection;
+
 import org.graalvm.compiler.core.test.GraalCompilerTest;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 
-import java.util.ArrayList;
-import java.util.Collection;
 import jdk.vm.ci.aarch64.AArch64;
 
 @RunWith(value = Parameterized.class)
 public abstract class StringIndexOfTestBase extends GraalCompilerTest {
-    @Parameterized.Parameter(value = 0) public String sourceString;
-    @Parameterized.Parameter(value = 1) public String constantString;
 
     @Parameterized.Parameters(name = "{0},{1}")
     public static Collection<Object[]> data() {
@@ -91,6 +90,14 @@
         }
     }
 
+    protected final String sourceString;
+    protected final String constantString;
+
+    public StringIndexOfTestBase(String sourceString, String constantString) {
+        this.sourceString = sourceString;
+        this.constantString = constantString;
+    }
+
     public int testStringIndexOf(String a, String b) {
         return a.indexOf(b);
     }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/StringSubstitutionTestBase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/StringSubstitutionTestBase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/StringSubstitutionsTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/StringSubstitutionsTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/SubstitutionNodeSourcePositionTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/SubstitutionNodeSourcePositionTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/SubstitutionsTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/SubstitutionsTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/classfile/ClassfileBytecodeProviderTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/classfile/ClassfileBytecodeProviderTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -87,6 +87,7 @@
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
 
+import org.graalvm.compiler.test.ModuleSupport;
 import org.graalvm.compiler.test.SubprocessUtil;
 import org.junit.Assert;
 import org.junit.Assume;
@@ -146,6 +147,12 @@
      */
     private static final int CLASSES_PER_JAR = 250;
 
+    /**
+     * Magic token to denote the classes in the Java runtime image (i.e. in the {@code jrt:/} file
+     * system).
+     */
+    public static final String JRT_CLASS_PATH_ENTRY = "<jrt>";
+
     @Test
     public void test() {
         RuntimeProvider rt = Graal.getRequiredCapability(RuntimeProvider.class);
@@ -153,42 +160,62 @@
         MetaAccessProvider metaAccess = providers.getMetaAccess();
 
         Assume.assumeTrue(VerifyPhase.class.desiredAssertionStatus());
-
-        String propertyName = JavaVersionUtil.JAVA_SPEC <= 8 ? "sun.boot.class.path" : "jdk.module.path";
-        String bootclasspath = System.getProperty(propertyName);
-        Assert.assertNotNull("Cannot find value of " + propertyName, bootclasspath);
+        String bootclasspath;
+        if (JavaVersionUtil.JAVA_SPEC <= 8) {
+            String propertyName = "sun.boot.class.path";
+            bootclasspath = System.getProperty(propertyName);
+            Assert.assertNotNull("Cannot find value of " + propertyName, bootclasspath);
+        } else {
+            bootclasspath = JRT_CLASS_PATH_ENTRY;
+        }
 
         for (String path : bootclasspath.split(File.pathSeparator)) {
             if (shouldProcess(path)) {
                 try {
-                    final ZipFile zipFile = new ZipFile(new File(path));
-                    int index = 0;
-                    int step = zipFile.size() > CLASSES_PER_JAR ? zipFile.size() / CLASSES_PER_JAR : 1;
-                    for (final Enumeration<? extends ZipEntry> entry = zipFile.entries(); entry.hasMoreElements();) {
-                        final ZipEntry zipEntry = entry.nextElement();
-                        if ((index % step) == 0) {
-                            String name = zipEntry.getName();
-                            if (name.endsWith(".class") && !name.equals("module-info.class") && !name.startsWith("META-INF/versions/")) {
-                                String className = name.substring(0, name.length() - ".class".length()).replace('/', '.');
-                                if (isInNativeImage(className)) {
-                                    /*
-                                     * Native image requires non-graalsdk classes to be present in
-                                     * the classpath.
-                                     */
-                                    continue;
-                                }
-                                if (isGSON(className)) {
-                                    /* uses old class format */
-                                    continue;
-                                }
-                                try {
-                                    checkClass(metaAccess, getSnippetReflection(), className);
-                                } catch (ClassNotFoundException e) {
-                                    throw new AssertionError(e);
+                    if (path.equals(JRT_CLASS_PATH_ENTRY)) {
+                        for (String className : ModuleSupport.getJRTGraalClassNames()) {
+                            if (isGSON(className)) {
+                                /*
+                                 * GSON classes are compiled with old JDK
+                                 */
+                                continue;
+                            }
+                            try {
+                                checkClass(metaAccess, getSnippetReflection(), className);
+                            } catch (ClassNotFoundException e) {
+                                throw new AssertionError(e);
+                            }
+                        }
+                    } else {
+                        final ZipFile zipFile = new ZipFile(new File(path));
+                        int index = 0;
+                        int step = zipFile.size() > CLASSES_PER_JAR ? zipFile.size() / CLASSES_PER_JAR : 1;
+                        for (final Enumeration<? extends ZipEntry> entry = zipFile.entries(); entry.hasMoreElements();) {
+                            final ZipEntry zipEntry = entry.nextElement();
+                            if ((index % step) == 0) {
+                                String name = zipEntry.getName();
+                                if (name.endsWith(".class") && !name.equals("module-info.class") && !name.startsWith("META-INF/versions/")) {
+                                    String className = name.substring(0, name.length() - ".class".length()).replace('/', '.');
+                                    if (isInNativeImage(className)) {
+                                        /*
+                                         * Native image requires non-graalsdk classes to be present
+                                         * in the classpath.
+                                         */
+                                        continue;
+                                    }
+                                    if (isGSON(className)) {
+                                        /* uses old class format */
+                                        continue;
+                                    }
+                                    try {
+                                        checkClass(metaAccess, getSnippetReflection(), className);
+                                    } catch (ClassNotFoundException e) {
+                                        throw new AssertionError(e);
+                                    }
                                 }
                             }
+                            index++;
                         }
-                        index++;
                     }
                 } catch (IOException ex) {
                     Assert.fail(ex.toString());
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/classfile/RedefineIntrinsicTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/classfile/RedefineIntrinsicTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -55,6 +55,7 @@
 import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Registration;
 import org.graalvm.compiler.replacements.test.ReplacementsTest;
 import org.graalvm.compiler.serviceprovider.JavaVersionUtil;
+import org.graalvm.compiler.test.SubprocessUtil;
 import org.graalvm.compiler.test.SubprocessUtil.Subprocess;
 import org.junit.Assert;
 import org.junit.Test;
@@ -116,6 +117,7 @@
         } else {
             List<String> vmArgs = withoutDebuggerArguments(getVMCommandLine());
             vmArgs.add("-D" + recursionPropName + "=true");
+            vmArgs.addAll(SubprocessUtil.getPackageOpeningOptions());
             vmArgs.add("-Djdk.attach.allowAttachSelf=true");
             Subprocess proc = java(vmArgs, "com.oracle.mxtool.junit.MxJUnitWrapper", getClass().getName());
             if (proc.exitCode != 0) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/ArraySubstitutions.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/ArraySubstitutions.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,7 @@
 import org.graalvm.compiler.api.replacements.ClassSubstitution;
 import org.graalvm.compiler.api.replacements.MethodSubstitution;
 import org.graalvm.compiler.nodes.DeoptimizeNode;
+import org.graalvm.compiler.nodes.extended.BranchProbabilityNode;
 import org.graalvm.compiler.nodes.java.ArrayLengthNode;
 
 import jdk.vm.ci.meta.DeoptimizationAction;
@@ -44,7 +45,7 @@
 
     @MethodSubstitution
     public static int getLength(Object array) {
-        if (!array.getClass().isArray()) {
+        if (BranchProbabilityNode.probability(BranchProbabilityNode.DEOPT_PROBABILITY, !array.getClass().isArray())) {
             DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
         }
         return ArrayLengthNode.arrayLength(array);
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/CachingPEGraphDecoder.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/CachingPEGraphDecoder.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -71,17 +71,17 @@
     public CachingPEGraphDecoder(Architecture architecture, StructuredGraph graph, Providers providers, GraphBuilderConfiguration graphBuilderConfig, OptimisticOptimizations optimisticOpts,
                     AllowAssumptions allowAssumptions, LoopExplosionPlugin loopExplosionPlugin, InvocationPlugins invocationPlugins, InlineInvokePlugin[] inlineInvokePlugins,
                     ParameterPlugin parameterPlugin,
-                    NodePlugin[] nodePlugins, ResolvedJavaMethod callInlinedMethod, SourceLanguagePositionProvider sourceLanguagePositionProvider,
-                    BasePhase<? super CoreProviders> postParsingPhase) {
+                    NodePlugin[] nodePlugins, ResolvedJavaMethod callInlinedMethod, ResolvedJavaMethod callInlinedAgnosticMethod, SourceLanguagePositionProvider sourceLanguagePositionProvider,
+                    BasePhase<? super CoreProviders> postParsingPhase, EconomicMap<ResolvedJavaMethod, EncodedGraph> graphCache) {
         super(architecture, graph, providers, loopExplosionPlugin,
-                        invocationPlugins, inlineInvokePlugins, parameterPlugin, nodePlugins, callInlinedMethod, sourceLanguagePositionProvider);
+                        invocationPlugins, inlineInvokePlugins, parameterPlugin, nodePlugins, callInlinedMethod, callInlinedAgnosticMethod, sourceLanguagePositionProvider);
 
         this.providers = providers;
         this.graphBuilderConfig = graphBuilderConfig;
         this.optimisticOpts = optimisticOpts;
         this.allowAssumptions = allowAssumptions;
+        this.graphCache = graphCache;
         this.postParsingPhase = postParsingPhase;
-        this.graphCache = EconomicMap.create();
     }
 
     protected GraphBuilderPhase.Instance createGraphBuilderPhaseInstance(IntrinsicContext initialIntrinsicContext) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/ConstantBindingParameterPlugin.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/ConstantBindingParameterPlugin.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/ConstantStringIndexOfSnippets.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/ConstantStringIndexOfSnippets.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/DefaultJavaLoweringProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/DefaultJavaLoweringProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,11 +43,13 @@
 import java.util.BitSet;
 import java.util.List;
 
+import jdk.vm.ci.meta.JavaConstant;
 import org.graalvm.compiler.api.directives.GraalDirectives;
 import org.graalvm.compiler.api.replacements.Snippet;
 import org.graalvm.compiler.api.replacements.SnippetReflectionProvider;
 import org.graalvm.compiler.core.common.LIRKind;
 import org.graalvm.compiler.core.common.spi.ForeignCallsProvider;
+import org.graalvm.compiler.core.common.type.AbstractPointerStamp;
 import org.graalvm.compiler.core.common.type.IntegerStamp;
 import org.graalvm.compiler.core.common.type.ObjectStamp;
 import org.graalvm.compiler.core.common.type.Stamp;
@@ -60,14 +62,20 @@
 import org.graalvm.compiler.nodeinfo.InputType;
 import org.graalvm.compiler.nodes.CompressionNode.CompressionOp;
 import org.graalvm.compiler.nodes.ConstantNode;
+import org.graalvm.compiler.nodes.EndNode;
 import org.graalvm.compiler.nodes.FieldLocationIdentity;
 import org.graalvm.compiler.nodes.FixedNode;
+import org.graalvm.compiler.nodes.FixedWithNextNode;
+import org.graalvm.compiler.nodes.IfNode;
 import org.graalvm.compiler.nodes.LogicNode;
+import org.graalvm.compiler.nodes.MergeNode;
 import org.graalvm.compiler.nodes.NamedLocationIdentity;
 import org.graalvm.compiler.nodes.NodeView;
+import org.graalvm.compiler.nodes.PhiNode;
 import org.graalvm.compiler.nodes.PiNode;
 import org.graalvm.compiler.nodes.StructuredGraph;
 import org.graalvm.compiler.nodes.ValueNode;
+import org.graalvm.compiler.nodes.ValuePhiNode;
 import org.graalvm.compiler.nodes.calc.AddNode;
 import org.graalvm.compiler.nodes.calc.ConditionalNode;
 import org.graalvm.compiler.nodes.calc.IntegerBelowNode;
@@ -91,6 +99,7 @@
 import org.graalvm.compiler.nodes.extended.JavaWriteNode;
 import org.graalvm.compiler.nodes.extended.LoadArrayComponentHubNode;
 import org.graalvm.compiler.nodes.extended.LoadHubNode;
+import org.graalvm.compiler.nodes.extended.LoadHubOrNullNode;
 import org.graalvm.compiler.nodes.extended.MembarNode;
 import org.graalvm.compiler.nodes.extended.RawLoadNode;
 import org.graalvm.compiler.nodes.extended.RawStoreNode;
@@ -210,6 +219,8 @@
                 lowerArrayLengthNode((ArrayLengthNode) n, tool);
             } else if (n instanceof LoadHubNode) {
                 lowerLoadHubNode((LoadHubNode) n, tool);
+            } else if (n instanceof LoadHubOrNullNode) {
+                lowerLoadHubOrNullNode((LoadHubOrNullNode) n, tool);
             } else if (n instanceof LoadArrayComponentHubNode) {
                 lowerLoadArrayComponentHubNode((LoadArrayComponentHubNode) n);
             } else if (n instanceof MonitorEnterNode) {
@@ -558,6 +569,36 @@
         loadHub.replaceAtUsagesAndDelete(hub);
     }
 
+    protected void lowerLoadHubOrNullNode(LoadHubOrNullNode loadHubOrNullNode, LoweringTool tool) {
+        StructuredGraph graph = loadHubOrNullNode.graph();
+        if (tool.getLoweringStage() != LoweringTool.StandardLoweringStage.LOW_TIER) {
+            return;
+        }
+        if (graph.getGuardsStage().allowsFloatingGuards()) {
+            return;
+        }
+        final FixedWithNextNode predecessor = tool.lastFixedNode();
+        final ValueNode value = loadHubOrNullNode.getValue();
+        AbstractPointerStamp stamp = (AbstractPointerStamp) value.stamp(NodeView.DEFAULT);
+        final LogicNode isNull = graph.addOrUniqueWithInputs(IsNullNode.create(value));
+        final EndNode trueEnd = graph.add(new EndNode());
+        final EndNode falseEnd = graph.add(new EndNode());
+        final IfNode ifNode = graph.add(new IfNode(isNull, trueEnd, falseEnd, 0.5));
+        final MergeNode merge = graph.add(new MergeNode());
+        merge.addForwardEnd(trueEnd);
+        merge.addForwardEnd(falseEnd);
+        final AbstractPointerStamp hubStamp = (AbstractPointerStamp) loadHubOrNullNode.stamp(NodeView.DEFAULT);
+        ValueNode nullHub = ConstantNode.forConstant(hubStamp.asAlwaysNull(), JavaConstant.NULL_POINTER, tool.getMetaAccess(), graph);
+        final ValueNode nonNullValue = graph.addOrUniqueWithInputs(PiNode.create(value, stamp.asNonNull(), ifNode.falseSuccessor()));
+        ValueNode hub = createReadHub(graph, nonNullValue, tool);
+        ValueNode[] values = new ValueNode[]{nullHub, hub};
+        final PhiNode hubPhi = graph.unique(new ValuePhiNode(hubStamp, merge, values));
+        final FixedNode oldNext = predecessor.next();
+        predecessor.setNext(ifNode);
+        merge.setNext(oldNext);
+        loadHubOrNullNode.replaceAtUsagesAndDelete(hubPhi);
+    }
+
     protected void lowerLoadArrayComponentHubNode(LoadArrayComponentHubNode loadHub) {
         StructuredGraph graph = loadHub.graph();
         ValueNode hub = createReadArrayComponentHub(graph, loadHub.getValue(), loadHub);
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/GraphKit.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/GraphKit.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/InlineDuringParsingPlugin.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/InlineDuringParsingPlugin.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/IntrinsicGraphBuilder.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/IntrinsicGraphBuilder.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/MethodHandlePlugin.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/MethodHandlePlugin.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -98,7 +98,7 @@
                     inlineEverything = args.length != argumentsList.size();
                 }
                 ResolvedJavaMethod targetMethod = callTarget.targetMethod();
-                if (inlineEverything && !targetMethod.hasBytecodes()) {
+                if (inlineEverything && !targetMethod.hasBytecodes() && !b.getReplacements().hasSubstitution(targetMethod, b.bci())) {
                     // we need to force-inline but we can not, leave the invoke as-is
                     return false;
                 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/PEGraphDecoder.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/PEGraphDecoder.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -274,7 +274,7 @@
                     int count = 0;
                     PEGraphDecoder.PEMethodScope scope = methodScope;
                     while (scope != null) {
-                        if (scope.method.equals(callInlinedMethod)) {
+                        if (scope.method.equals(callInlinedMethod) || scope.method.equals(callInlinedAgnosticMethod)) {
                             count++;
                         }
                         scope = scope.caller;
@@ -301,7 +301,7 @@
          */
         @Override
         public boolean canDeferPlugin(GeneratedInvocationPlugin plugin) {
-            return plugin.getSource().equals(Fold.class) || plugin.getSource().equals(Node.NodeIntrinsic.class);
+            return plugin.isGeneratedFromFoldOrNodeIntrinsic();
         }
 
         @Override
@@ -585,18 +585,20 @@
     private final EconomicMap<SpecialCallTargetCacheKey, Object> specialCallTargetCache;
     private final EconomicMap<ResolvedJavaMethod, Object> invocationPluginCache;
     private final ResolvedJavaMethod callInlinedMethod;
+    private final ResolvedJavaMethod callInlinedAgnosticMethod;
     protected final SourceLanguagePositionProvider sourceLanguagePositionProvider;
 
     public PEGraphDecoder(Architecture architecture, StructuredGraph graph, CoreProviders providers, LoopExplosionPlugin loopExplosionPlugin, InvocationPlugins invocationPlugins,
                     InlineInvokePlugin[] inlineInvokePlugins,
                     ParameterPlugin parameterPlugin,
-                    NodePlugin[] nodePlugins, ResolvedJavaMethod callInlinedMethod, SourceLanguagePositionProvider sourceLanguagePositionProvider) {
+                    NodePlugin[] nodePlugins, ResolvedJavaMethod callInlinedMethod, ResolvedJavaMethod callInlinedAgnosticMethod, SourceLanguagePositionProvider sourceLanguagePositionProvider) {
         super(architecture, graph, providers, true);
         this.loopExplosionPlugin = loopExplosionPlugin;
         this.invocationPlugins = invocationPlugins;
         this.inlineInvokePlugins = inlineInvokePlugins;
         this.parameterPlugin = parameterPlugin;
         this.nodePlugins = nodePlugins;
+        this.callInlinedAgnosticMethod = callInlinedAgnosticMethod;
         this.specialCallTargetCache = EconomicMap.create(Equivalence.DEFAULT);
         this.invocationPluginCache = EconomicMap.create(Equivalence.DEFAULT);
         this.callInlinedMethod = callInlinedMethod;
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/ReplacementsImpl.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/ReplacementsImpl.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/SnippetCounter.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/SnippetCounter.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/SnippetCounterNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/SnippetCounterNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/SnippetTemplate.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/SnippetTemplate.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/StandardGraphBuilderPlugins.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/StandardGraphBuilderPlugins.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/TargetGraphBuilderPlugins.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.graalvm.compiler.replacements;
+
+import org.graalvm.compiler.bytecode.BytecodeProvider;
+import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins;
+
+import jdk.vm.ci.code.Architecture;
+
+public interface TargetGraphBuilderPlugins {
+    void register(Plugins plugins, BytecodeProvider replacementsBytecodeProvider, Architecture arch, boolean explicitUnsafeNullChecks, boolean registerMathPlugins, boolean emitJDK9StringSubstitutions,
+                    boolean useFMAIntrinsics);
+}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/arraycopy/ArrayCopyCallNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/arraycopy/ArrayCopyCallNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/arraycopy/ArrayCopySnippets.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/arraycopy/ArrayCopySnippets.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,10 +25,12 @@
 package org.graalvm.compiler.replacements.arraycopy;
 
 import static jdk.vm.ci.services.Services.IS_BUILDING_NATIVE_IMAGE;
+import static org.graalvm.compiler.core.common.GraalOptions.GeneratePIC;
 import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.FREQUENT_PROBABILITY;
 import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.LIKELY_PROBABILITY;
 import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.NOT_FREQUENT_PROBABILITY;
 import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.SLOW_PATH_PROBABILITY;
+import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.DEOPT_PROBABILITY;
 import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.probability;
 
 import java.util.EnumMap;
@@ -210,7 +212,7 @@
             Object nonNullDest = PiNode.asNonNullObject(dest);
             Pointer srcKlass = loadHub(nonNullSrc);
             Pointer destKlass = loadHub(nonNullDest);
-            if (probability(LIKELY_PROBABILITY, srcKlass == destKlass)) {
+            if (probability(LIKELY_PROBABILITY, srcKlass == destKlass) || probability(LIKELY_PROBABILITY, nonNullDest.getClass() == Object[].class)) {
                 // no storecheck required.
                 counters.objectCheckcastSameTypeCounter.inc();
                 counters.objectCheckcastSameTypeCopiedCounter.add(length);
@@ -222,15 +224,7 @@
                 counters.objectCheckcastDifferentTypeCounter.inc();
                 counters.objectCheckcastDifferentTypeCopiedCounter.add(length);
 
-                int copiedElements = CheckcastArrayCopyCallNode.checkcastArraycopy(nonNullSrc, srcPos, nonNullDest, destPos, length, superCheckOffset, destElemKlass, false);
-                if (probability(SLOW_PATH_PROBABILITY, copiedElements != 0)) {
-                    /*
-                     * the stub doesn't throw the ArrayStoreException, but returns the number of
-                     * copied elements (xor'd with -1).
-                     */
-                    copiedElements ^= -1;
-                    System.arraycopy(nonNullSrc, srcPos + copiedElements, nonNullDest, destPos + copiedElements, length - copiedElements);
-                }
+                System.arraycopy(nonNullSrc, srcPos, nonNullDest, destPos, length);
             }
         }
     }
@@ -261,12 +255,27 @@
         }
     }
 
+    /**
+     * Writing this as individual if statements to avoid a merge without a frame state.
+     */
     private static void checkLimits(Object src, int srcPos, Object dest, int destPos, int length, Counters counters) {
-        if (probability(SLOW_PATH_PROBABILITY, srcPos < 0) ||
-                        probability(SLOW_PATH_PROBABILITY, destPos < 0) ||
-                        probability(SLOW_PATH_PROBABILITY, length < 0) ||
-                        probability(SLOW_PATH_PROBABILITY, srcPos > ArrayLengthNode.arrayLength(src) - length) ||
-                        probability(SLOW_PATH_PROBABILITY, destPos > ArrayLengthNode.arrayLength(dest) - length)) {
+        if (probability(DEOPT_PROBABILITY, srcPos < 0)) {
+            counters.checkAIOOBECounter.inc();
+            DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
+        }
+        if (probability(DEOPT_PROBABILITY, destPos < 0)) {
+            counters.checkAIOOBECounter.inc();
+            DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
+        }
+        if (probability(DEOPT_PROBABILITY, length < 0)) {
+            counters.checkAIOOBECounter.inc();
+            DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
+        }
+        if (probability(DEOPT_PROBABILITY, srcPos > ArrayLengthNode.arrayLength(src) - length)) {
+            counters.checkAIOOBECounter.inc();
+            DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
+        }
+        if (probability(DEOPT_PROBABILITY, destPos > ArrayLengthNode.arrayLength(dest) - length)) {
             counters.checkAIOOBECounter.inc();
             DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
         }
@@ -279,13 +288,13 @@
         } else if (arrayTypeCheck == ArrayCopyTypeCheck.HUB_BASED_ARRAY_TYPE_CHECK) {
             Pointer srcHub = loadHub(nonNullSrc);
             Pointer destHub = loadHub(nonNullDest);
-            if (probability(SLOW_PATH_PROBABILITY, srcHub != destHub)) {
+            if (probability(DEOPT_PROBABILITY, srcHub != destHub)) {
                 DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
             }
         } else if (arrayTypeCheck == ArrayCopyTypeCheck.LAYOUT_HELPER_BASED_ARRAY_TYPE_CHECK) {
             Pointer srcHub = loadHub(nonNullSrc);
             Pointer destHub = loadHub(nonNullDest);
-            if (probability(SLOW_PATH_PROBABILITY, getReadLayoutHelper(srcHub) != getReadLayoutHelper(destHub))) {
+            if (probability(DEOPT_PROBABILITY, getReadLayoutHelper(srcHub) != getReadLayoutHelper(destHub))) {
                 DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
             }
         } else {
@@ -413,6 +422,10 @@
                     snippetInfo = arraycopyGenericSnippet;
                     // no need for additional type check to avoid duplicated work
                     arrayTypeCheck = ArrayCopyTypeCheck.NO_ARRAY_TYPE_CHECK;
+                } else if (GeneratePIC.getValue(options)) {
+                    // use generic copying for AOT compilation
+                    snippetInfo = arraycopyGenericSnippet;
+                    arrayTypeCheck = ArrayCopyTypeCheck.NO_ARRAY_TYPE_CHECK;
                 } else if (srcComponentType != null && destComponentType != null) {
                     if (!srcComponentType.isPrimitive() && !destComponentType.isPrimitive()) {
                         // it depends on the array content if the copy succeeds - we need
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/classfile/ClassfileBytecodeProvider.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/classfile/ClassfileBytecodeProvider.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/ArrayEqualsNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/ArrayEqualsNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -232,12 +232,7 @@
                 return;
             }
         }
-
-        int constantLength = -1;
-        if (length.isConstant()) {
-            constantLength = length.asJavaConstant().asInt();
-        }
-        Value result = gen.getLIRGeneratorTool().emitArrayEquals(kind, gen.operand(array1), gen.operand(array2), gen.operand(length), constantLength, false);
+        Value result = gen.getLIRGeneratorTool().emitArrayEquals(kind, gen.operand(array1), gen.operand(array2), gen.operand(length), false);
         gen.setResult(this, result);
     }
 
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/ArrayRegionEqualsNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/ArrayRegionEqualsNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -110,16 +110,11 @@
                 return;
             }
         }
-
-        int constantLength = -1;
-        if (length.isConstant()) {
-            constantLength = length.asJavaConstant().asInt();
-        }
         Value result;
         if (kind1 == kind2) {
-            result = gen.getLIRGeneratorTool().emitArrayEquals(kind1, gen.operand(array1), gen.operand(array2), gen.operand(length), constantLength, true);
+            result = gen.getLIRGeneratorTool().emitArrayEquals(kind1, gen.operand(array1), gen.operand(array2), gen.operand(length), true);
         } else {
-            result = gen.getLIRGeneratorTool().emitArrayEquals(kind1, kind2, gen.operand(array1), gen.operand(array2), gen.operand(length), constantLength, true);
+            result = gen.getLIRGeneratorTool().emitArrayEquals(kind1, kind2, gen.operand(array1), gen.operand(array2), gen.operand(length), true);
         }
         gen.setResult(this, result);
     }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/BasicArrayCopyNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/BasicArrayCopyNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -144,7 +144,8 @@
     }
 
     private static boolean checkBounds(int position, int length, VirtualObjectNode virtualObject) {
-        return position >= 0 && position + length <= virtualObject.entryCount();
+        assert length >= 0;
+        return position >= 0 && position <= virtualObject.entryCount() - length;
     }
 
     private static boolean checkEntryTypes(int srcPos, int length, VirtualObjectNode src, ResolvedJavaType destComponentType, VirtualizerTool tool) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/BasicObjectCloneNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/BasicObjectCloneNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/MacroNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/MacroNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/MethodHandleNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/MethodHandleNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/ReadRegisterNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/ReadRegisterNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/WriteRegisterNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/WriteRegisterNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/ZeroMemoryNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/ZeroMemoryNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -60,7 +60,7 @@
 
     @Override
     public void generate(NodeLIRBuilderTool gen) {
-        gen.getLIRGeneratorTool().getArithmetic().emitZeroMemory(gen.operand(getAddress()), gen.operand(length));
+        gen.getLIRGeneratorTool().emitZeroMemory(gen.operand(getAddress()), gen.operand(length));
     }
 
     @Override
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/arithmetic/IntegerAddExactNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/arithmetic/IntegerAddExactNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -33,6 +33,7 @@
 import org.graalvm.compiler.core.common.type.IntegerStamp;
 import org.graalvm.compiler.core.common.type.Stamp;
 import org.graalvm.compiler.core.common.type.StampFactory;
+import org.graalvm.compiler.graph.IterableNodeType;
 import org.graalvm.compiler.graph.NodeClass;
 import org.graalvm.compiler.graph.spi.CanonicalizerTool;
 import org.graalvm.compiler.nodeinfo.InputType;
@@ -53,7 +54,7 @@
  * case the addition would overflow the 32 bit range.
  */
 @NodeInfo(cycles = CYCLES_2, size = SIZE_2)
-public final class IntegerAddExactNode extends AddNode implements GuardedNode, IntegerExactArithmeticNode {
+public final class IntegerAddExactNode extends AddNode implements GuardedNode, IntegerExactArithmeticNode, IterableNodeType {
     public static final NodeClass<IntegerAddExactNode> TYPE = NodeClass.create(IntegerAddExactNode.class);
 
     @Input(InputType.Guard) protected GuardingNode guard;
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/arithmetic/IntegerExactArithmeticSplitNode.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/arithmetic/IntegerExactArithmeticSplitNode.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.serviceprovider/src/org/graalvm/compiler/serviceprovider/GraalServices.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.serviceprovider/src/org/graalvm/compiler/serviceprovider/GraalServices.java	Tue Sep 24 15:19:35 2019 -0400
@@ -89,13 +89,8 @@
             synchronized (servicesCache) {
                 ArrayList<S> providersList = new ArrayList<>();
                 for (S provider : providers) {
-                    /*
-                     * When building libgraal, we want providers that comes from the Graal community
-                     * and enterprise modules but not those available on the native-image class
-                     * path.
-                     */
                     Module module = provider.getClass().getModule();
-                    if (module.isNamed()) {
+                    if (isHotSpotGraalModule(module.getName())) {
                         providersList.add(provider);
                     }
                 }
@@ -108,8 +103,29 @@
         return providers;
     }
 
+    /**
+     * Determines if the module named by {@code name} is part of Graal when it is configured as a
+     * HotSpot JIT compiler.
+     */
+    private static boolean isHotSpotGraalModule(String name) {
+        if (name != null) {
+            return name.equals("jdk.internal.vm.compiler") ||
+                            name.equals("jdk.internal.vm.compiler.management") ||
+                            name.equals("com.oracle.graal.graal_enterprise");
+        }
+        return false;
+    }
+
     protected static <S> Iterable<S> load0(Class<S> service) {
-        Iterable<S> iterable = ServiceLoader.load(service);
+        Module module = GraalServices.class.getModule();
+        // Graal cannot know all the services used by another module
+        // (e.g. enterprise) so dynamically register the service use now.
+        if (!module.canUse(service)) {
+            module.addUses(service);
+        }
+
+        ModuleLayer layer = module.getLayer();
+        Iterable<S> iterable = ServiceLoader.load(layer, service);
         return new Iterable<>() {
             @Override
             public Iterator<S> iterator() {
@@ -220,6 +236,10 @@
      * trusted code.
      */
     public static boolean isToStringTrusted(Class<?> c) {
+        if (IS_IN_NATIVE_IMAGE) {
+            return true;
+        }
+
         Module module = c.getModule();
         Module jvmciModule = JVMCI_MODULE;
         assert jvmciModule.getPackages().contains("jdk.vm.ci.runtime");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.serviceprovider/src/org/graalvm/compiler/serviceprovider/SpeculationEncodingAdapter.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.graalvm.compiler.serviceprovider;
+
+import java.util.ArrayList;
+
+import jdk.vm.ci.code.BytecodePosition;
+
+class SpeculationEncodingAdapter implements SpeculationReasonGroup.SpeculationContextObject.Visitor {
+    private ArrayList<Object> objects;
+
+    SpeculationEncodingAdapter() {
+        this.objects = null;
+    }
+
+    Object[] flatten(Object[] context) {
+        boolean flatten = false;
+        for (Object c : context) {
+            if (c instanceof SpeculationReasonGroup.SpeculationContextObject || (c != null && c.getClass() == BytecodePosition.class)) {
+                // Needs extra work to flatten the representation
+                flatten = true;
+                break;
+            }
+        }
+        if (!flatten) {
+            return context;
+        }
+        objects = new ArrayList<>();
+        for (Object c : context) {
+            if (c instanceof SpeculationReasonGroup.SpeculationContextObject) {
+                SpeculationReasonGroup.SpeculationContextObject sco = (SpeculationReasonGroup.SpeculationContextObject) c;
+                // These are compiler objects which all have the same class
+                // loader so the class name uniquely identifies the class.
+                objects.add(c.getClass().getName());
+                sco.accept(this);
+            } else if (c != null && c.getClass() == BytecodePosition.class) {
+                BytecodePosition p = (BytecodePosition) c;
+                objects.add(c.getClass().getName());
+                while (p != null) {
+                    visitInt(p.getBCI());
+                    objects.add(p.getMethod());
+                    p = p.getCaller();
+                }
+            } else {
+                objects.add(c);
+            }
+        }
+        return objects.toArray();
+    }
+
+    @Override
+    public void visitBoolean(boolean v) {
+        objects.add((byte) (v ? 1 : 0));
+    }
+
+    @Override
+    public void visitByte(byte v) {
+        objects.add(v);
+    }
+
+    @Override
+    public void visitChar(char v) {
+        objects.add(v);
+    }
+
+    @Override
+    public void visitShort(short v) {
+        objects.add(v);
+    }
+
+    @Override
+    public void visitInt(int v) {
+        objects.add(v);
+    }
+
+    @Override
+    public void visitLong(long v) {
+        objects.add(v);
+    }
+
+    @Override
+    public void visitFloat(float v) {
+        objects.add(Float.floatToRawIntBits(v));
+    }
+
+    @Override
+    public void visitDouble(double v) {
+        objects.add(Double.doubleToRawLongBits(v));
+    }
+
+    @Override
+    public void visitObject(Object v) {
+        if (v == null) {
+            objects.add(0);
+        } else {
+            objects.add(v);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.serviceprovider/src/org/graalvm/compiler/serviceprovider/UnencodedSpeculationReason.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.graalvm.compiler.serviceprovider;
+
+import java.util.Arrays;
+
+import jdk.vm.ci.meta.SpeculationLog.SpeculationReason;
+
+/**
+ * An implementation of {@link SpeculationReason} based on direct, unencoded values.
+ */
+public final class UnencodedSpeculationReason implements SpeculationReason {
+    final int groupId;
+    final String groupName;
+    final Object[] context;
+
+    UnencodedSpeculationReason(int groupId, String groupName, Object[] context) {
+        this.groupId = groupId;
+        this.groupName = groupName;
+        this.context = context;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof UnencodedSpeculationReason) {
+            UnencodedSpeculationReason that = (UnencodedSpeculationReason) obj;
+            return this.groupId == that.groupId && Arrays.equals(this.context, that.context);
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return groupId + Arrays.hashCode(this.context);
+    }
+
+    @Override
+    public String toString() {
+        return String.format("%s@%d%s", groupName, groupId, Arrays.toString(context));
+    }
+}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/ExportingClassLoader.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/ExportingClassLoader.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,23 +24,17 @@
 
 package org.graalvm.compiler.test;
 
-import org.graalvm.compiler.serviceprovider.JavaVersionUtil;
-
 /**
  * A class loader that exports all packages in the module defining the class loader to all classes
  * in the unnamed module associated with the loader.
  */
 public class ExportingClassLoader extends ClassLoader {
     public ExportingClassLoader() {
-        if (JavaVersionUtil.JAVA_SPEC > 8) {
-            JLModule.fromClass(getClass()).exportAllPackagesTo(JLModule.getUnnamedModuleFor(this));
-        }
+        ModuleSupport.exportAllPackagesTo(getClass(), this);
     }
 
     public ExportingClassLoader(ClassLoader parent) {
         super(parent);
-        if (JavaVersionUtil.JAVA_SPEC > 8) {
-            JLModule.fromClass(getClass()).exportAllPackagesTo(JLModule.getUnnamedModuleFor(this));
-        }
+        ModuleSupport.exportAllPackagesTo(getClass(), this);
     }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/GraalTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/GraalTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +35,10 @@
 import java.nio.file.FileVisitResult;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.nio.file.SimpleFileVisitor;
 import java.nio.file.attribute.BasicFileAttributes;
+import java.nio.file.attribute.FileAttribute;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -458,7 +460,7 @@
         Runtime.getRuntime().addShutdownHook(new Thread("GlobalMetricsPrinter") {
             @Override
             public void run() {
-                globalMetrics.print(new OptionValues(OptionValues.newOptionMap()));
+                // globalMetrics.print(new OptionValues(OptionValues.newOptionMap()));
             }
         });
     }
@@ -506,6 +508,30 @@
         return createTimeout(milliseconds, TimeUnit.MILLISECONDS);
     }
 
+    public static class TemporaryDirectory implements AutoCloseable {
+
+        public final Path path;
+        private IOException closeException;
+
+        public TemporaryDirectory(Path dir, String prefix, FileAttribute<?>... attrs) throws IOException {
+            path = Files.createTempDirectory(dir == null ? Paths.get(".") : dir, prefix, attrs);
+        }
+
+        @Override
+        public void close() {
+            closeException = removeDirectory(path);
+        }
+
+        public IOException getCloseException() {
+            return closeException;
+        }
+
+        @Override
+        public String toString() {
+            return path.toString();
+        }
+    }
+
     /**
      * Tries to recursively remove {@code directory}. If it fails with an {@link IOException}, the
      * exception's {@code toString()} is printed to {@link System#err} and the exception is
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/JLModule.java	Tue Sep 24 14:12:08 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,221 +0,0 @@
-/*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package org.graalvm.compiler.test;
-
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Method;
-import java.util.Set;
-
-import org.graalvm.compiler.serviceprovider.JavaVersionUtil;
-
-/**
- * Facade for the {@code java.lang.Module} class introduced in JDK9 that allows tests to be
- * developed against JDK8 but use module logic if deployed on JDK9.
- */
-public class JLModule {
-
-    static {
-        if (JavaVersionUtil.JAVA_SPEC <= 8) {
-            throw new AssertionError("Use of " + JLModule.class + " only allowed if " + GraalTest.class.getName() + ".JDK8OrEarlier is false");
-        }
-    }
-
-    private final Object realModule;
-
-    public JLModule(Object module) {
-        this.realModule = module;
-    }
-
-    private static final Class<?> moduleClass;
-    private static final Method getModuleMethod;
-    private static final Method getUnnamedModuleMethod;
-    private static final Method getPackagesMethod;
-    private static final Method isExportedMethod;
-    private static final Method isExported2Method;
-    private static final Method addExportsMethod;
-    /**
-     * {@code jdk.internal.module.Modules.addExports(Module, String, Module)}.
-     */
-    private static final Method modulesAddExportsMethod;
-
-    /**
-     * {@code jdk.internal.module.Modules.addOpens(Module, String, Module)}.
-     */
-    private static final Method modulesAddOpensMethod;
-
-    static {
-        try {
-            moduleClass = Class.forName("java.lang.Module");
-            Class<?> modulesClass = Class.forName("jdk.internal.module.Modules");
-            getModuleMethod = Class.class.getMethod("getModule");
-            getUnnamedModuleMethod = ClassLoader.class.getMethod("getUnnamedModule");
-            getPackagesMethod = moduleClass.getMethod("getPackages");
-            isExportedMethod = moduleClass.getMethod("isExported", String.class);
-            isExported2Method = moduleClass.getMethod("isExported", String.class, moduleClass);
-            addExportsMethod = moduleClass.getMethod("addExports", String.class, moduleClass);
-            modulesAddExportsMethod = modulesClass.getDeclaredMethod("addExports", moduleClass, String.class, moduleClass);
-            modulesAddOpensMethod = modulesClass.getDeclaredMethod("addOpens", moduleClass, String.class, moduleClass);
-        } catch (Exception e) {
-            throw new AssertionError(e);
-        }
-    }
-
-    public static JLModule fromClass(Class<?> cls) {
-        try {
-            return new JLModule(getModuleMethod.invoke(cls));
-        } catch (Exception e) {
-            throw new AssertionError(e);
-        }
-    }
-
-    public static JLModule getUnnamedModuleFor(ClassLoader cl) {
-        try {
-            return new JLModule(getUnnamedModuleMethod.invoke(cl));
-        } catch (Exception e) {
-            throw new AssertionError(e);
-        }
-    }
-
-    /**
-     * Exports all packages in this module to a given module.
-     */
-    public void exportAllPackagesTo(JLModule module) {
-        if (this != module) {
-            for (String pkg : getPackages()) {
-                // Export all JVMCI packages dynamically instead
-                // of requiring a long list of -XaddExports
-                // options on the JVM command line.
-                if (!isExported(pkg, module)) {
-                    addExports(pkg, module);
-                }
-            }
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    public Set<String> getPackages() {
-        try {
-            return (Set<String>) getPackagesMethod.invoke(realModule);
-        } catch (Exception e) {
-            throw new AssertionError(e);
-        }
-    }
-
-    public boolean isExported(String pn) {
-        try {
-            return (Boolean) isExportedMethod.invoke(realModule, pn);
-        } catch (Exception e) {
-            throw new AssertionError(e);
-        }
-    }
-
-    public boolean isExported(String pn, JLModule other) {
-        try {
-            return (Boolean) isExported2Method.invoke(realModule, pn, other.realModule);
-        } catch (Exception e) {
-            throw new AssertionError(e);
-        }
-    }
-
-    public void addExports(String pn, JLModule other) {
-        try {
-            addExportsMethod.invoke(realModule, pn, other.realModule);
-        } catch (Exception e) {
-            throw new AssertionError(e);
-        }
-    }
-
-    private static Object unbox(Object obj) {
-        if (obj instanceof JLModule) {
-            return ((JLModule) obj).realModule;
-        }
-        return obj;
-    }
-
-    /**
-     * Updates module m1 to export a package to module m2. Same as m1.addExports(pn, m2) but without
-     * a caller check
-     */
-    public static void uncheckedAddExports(Object m1, String pn, Object m2) {
-        try {
-            modulesAddExportsMethod.invoke(null, unbox(m1), pn, unbox(m2));
-        } catch (Exception e) {
-            throw new AssertionError(e);
-        }
-    }
-
-    /**
-     * Opens all packages in {@code moduleMember}'s module for deep reflection (i.e., allow
-     * {@link AccessibleObject#setAccessible(boolean)} to be called for any class/method/field) by
-     * {@code requestor}'s module.
-     */
-    public static void openAllPackagesForReflectionTo(Class<?> moduleMember, Class<?> requestor) {
-        try {
-            Object moduleToOpen = getModuleMethod.invoke(moduleMember);
-            Object requestorModule = getModuleMethod.invoke(requestor);
-            if (moduleToOpen != requestorModule) {
-                String[] packages = (String[]) getPackagesMethod.invoke(moduleToOpen);
-                for (String pkg : packages) {
-                    modulesAddOpensMethod.invoke(moduleToOpen, pkg, requestorModule);
-                }
-            }
-        } catch (Exception e) {
-            throw new AssertionError(e);
-        }
-    }
-
-    /**
-     * Opens {@code declaringClass}'s package to allow a method declared in {@code accessor} to call
-     * {@link AccessibleObject#setAccessible(boolean)} on an {@link AccessibleObject} representing a
-     * field or method declared by {@code declaringClass}.
-     */
-    public static void openForReflectionTo(Class<?> declaringClass, Class<?> accessor) {
-        try {
-            Object moduleToOpen = getModuleMethod.invoke(declaringClass);
-            Object accessorModule = getModuleMethod.invoke(accessor);
-            if (moduleToOpen != accessorModule) {
-                modulesAddOpensMethod.invoke(null, moduleToOpen, declaringClass.getPackage().getName(), accessorModule);
-            }
-        } catch (Exception e) {
-            throw new AssertionError(e);
-        }
-    }
-
-    /**
-     * Exports the package named {@code packageName} declared in {@code moduleMember}'s module to
-     * {@code requestor}'s module.
-     */
-    public static void exportPackageTo(Class<?> moduleMember, String packageName, Class<?> requestor) {
-        try {
-            Object moduleToExport = getModuleMethod.invoke(moduleMember);
-            Object requestorModule = getModuleMethod.invoke(requestor);
-            if (moduleToExport != requestorModule) {
-                modulesAddExportsMethod.invoke(null, moduleToExport, packageName, requestorModule);
-            }
-        } catch (Exception e) {
-            throw new AssertionError(e);
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/ModuleSupport.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.graalvm.compiler.test;
+
+import java.io.IOException;
+import java.lang.module.ModuleDescriptor.Requires;
+import java.net.URI;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.graalvm.compiler.debug.DebugOptions;
+
+import jdk.internal.module.Modules;
+
+public class ModuleSupport {
+
+    public static void exportPackageTo(Class<?> moduleMember, String packageName, Class<?> requestor) {
+        Module moduleToExport = moduleMember.getModule();
+        Module requestorModule = requestor.getModule();
+        if (moduleToExport != requestorModule) {
+            Modules.addExports(moduleToExport, packageName, requestorModule);
+        }
+    }
+
+    public static void exportAllPackagesTo(Class<?> moduleMember, Class<?> requestor) {
+        Module moduleToExport = moduleMember.getModule();
+        Module requestorModule = requestor.getModule();
+        if (moduleToExport != requestorModule) {
+            for (String packageName : moduleToExport.getPackages()) {
+                Modules.addExports(moduleToExport, packageName, requestorModule);
+            }
+        }
+    }
+
+    public static void exportAllPackagesTo(Class<?> moduleMember, ClassLoader cl) {
+        Module moduleToExport = moduleMember.getModule();
+        Module unnamedModule = cl.getUnnamedModule();
+        for (String packageName : moduleToExport.getPackages()) {
+            Modules.addExports(moduleToExport, packageName, unnamedModule);
+        }
+    }
+
+    @SuppressWarnings("unused")
+    public static void exportAndOpenAllPackagesToUnnamed(String name) {
+        Module module = ModuleLayer.boot().findModule(name).orElseThrow();
+        Set<String> packages = module.getPackages();
+        for (String pkg : packages) {
+            Modules.addExportsToAllUnnamed(module, pkg);
+            Modules.addOpensToAllUnnamed(module, pkg);
+        }
+    }
+
+    public static List<String> getJRTGraalClassNames() throws IOException {
+        List<String> classNames = new ArrayList<>();
+        FileSystem fs = FileSystems.newFileSystem(URI.create("jrt:/"), Collections.emptyMap());
+        Module graalModule = DebugOptions.class.getModule();
+        Set<String> graalModuleSet = new HashSet<>();
+        graalModuleSet.add(graalModule.getName());
+        for (Module module : graalModule.getLayer().modules()) {
+            if (requires(module, graalModule)) {
+                graalModuleSet.add(module.getName());
+            }
+        }
+
+        Path top = fs.getPath("/modules/");
+        Files.find(top, Integer.MAX_VALUE,
+                        (path, attrs) -> attrs.isRegularFile()).forEach(p -> {
+                            int nameCount = p.getNameCount();
+                            if (nameCount > 2) {
+                                String base = p.getName(nameCount - 1).toString();
+                                if (base.endsWith(".class") && !base.equals("module-info.class")) {
+                                    String module = p.getName(1).toString();
+                                    if (graalModuleSet.contains(module)) {
+                                        // Strip module prefix and convert to dotted
+                                        // form
+                                        String className = p.subpath(2, nameCount).toString().replace('/', '.');
+                                        // Strip ".class" suffix
+                                        className = className.replace('/', '.').substring(0, className.length() - ".class".length());
+                                        classNames.add(className);
+                                    }
+                                }
+                            }
+                        });
+        return classNames;
+    }
+
+    private static boolean requires(Module module, Module graalModule) {
+        ModuleLayer graalLayer = graalModule.getLayer();
+        for (Requires r : module.getDescriptor().requires()) {
+            if (r.name().equals(graalModule.getName())) {
+                return true;
+            }
+            Module dep = graalLayer.findModule(r.name()).get();
+            if (requires(dep, graalModule)) {
+                return true;
+            }
+        }
+        return false;
+    }
+}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/SubprocessUtil.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/SubprocessUtil.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
 import java.util.Formatter;
 import java.util.List;
 import java.util.Map;
+import java.util.function.Predicate;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -102,6 +103,26 @@
     }
 
     /**
+     * Gets the command line options to do the same package opening and exporting specified by the
+     * {@code --open-packages} option to the {@code mx unittest} command.
+     *
+     * Properties defined in {@code com.oracle.mxtool.junit.MxJUnitWrapper}.
+     */
+    public static List<String> getPackageOpeningOptions() {
+        List<String> result = new ArrayList<>();
+        String[] actions = {"opens", "exports"};
+        for (String action : actions) {
+            String opens = System.getProperty("com.oracle.mxtool.junit." + action);
+            if (opens != null && !opens.isEmpty()) {
+                for (String value : opens.split(System.lineSeparator())) {
+                    result.add("--add-" + action + "=" + value);
+                }
+            }
+        }
+        return result;
+    }
+
+    /**
      * Gets the command line used to start the current Java VM, including all VM arguments, but not
      * including the main class or any Java arguments. This can be used to spawn an identical VM,
      * but running different Java code.
@@ -117,10 +138,30 @@
     }
 
     /**
-     * Detects whether a java agent is attached.
+     * Detects whether a Java agent matching {@code agentPredicate} is specified in the VM
+     * arguments.
+     *
+     * @param agentPredicate a predicate that is given the value of a {@code -javaagent} VM argument
+     */
+    public static boolean isJavaAgentAttached(Predicate<String> agentPredicate) {
+        return SubprocessUtil.getVMCommandLine().stream().//
+                        filter(args -> args.startsWith("-javaagent:")).//
+                        map(s -> s.substring("-javaagent:".length())).//
+                        anyMatch(agentPredicate);
+    }
+
+    /**
+     * Detects whether a Java agent is specified in the VM arguments.
      */
     public static boolean isJavaAgentAttached() {
-        return SubprocessUtil.getVMCommandLine().stream().anyMatch(args -> args.startsWith("-javaagent"));
+        return isJavaAgentAttached(javaAgentValue -> true);
+    }
+
+    /**
+     * Detects whether the JaCoCo Java agent is specified in the VM arguments.
+     */
+    public static boolean isJaCoCoAttached() {
+        return isJavaAgentAttached(s -> s.toLowerCase().contains("jacoco"));
     }
 
     /**
@@ -278,7 +319,11 @@
         while (i < commandLine.size()) {
             String s = commandLine.get(i);
             if (s.charAt(0) != '-') {
-                return i;
+                // https://bugs.openjdk.java.net/browse/JDK-8027634
+                if (isJava8OrEarlier || s.charAt(0) != '@') {
+                    return i;
+                }
+                i++;
             } else if (hasArg(s)) {
                 i += 2;
             } else {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/EarlyReadEliminationPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/EarlyReadEliminationPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/EffectsClosure.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/EffectsClosure.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -357,6 +357,12 @@
                     lastMergedState = mergeProcessor.newState;
                     for (Block block : loop.getBlocks()) {
                         blockEffects.get(block).clear();
+                        if (block.isLoopHeader()) {
+                            final GraphEffectList loopEffects = loopMergeEffects.get(block.getLoop());
+                            if (loopEffects != null) {
+                                loopEffects.clear();
+                            }
+                        }
                     }
                 }
             }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/EffectsPhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/EffectsPhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/GraphEffectList.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/GraphEffectList.java	Tue Sep 24 15:19:35 2019 -0400
@@ -132,7 +132,7 @@
      */
     public void initializePhiInput(PhiNode node, int index, ValueNode value) {
         add("set phi input", (graph, obsoleteNodes) -> {
-            assert node.isAlive() && index >= 0;
+            assert node.isAlive() && index >= 0 : node;
             node.initializeValueAt(index, graph.addOrUniqueWithInputs(value));
         });
     }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/PEReadEliminationClosure.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/PEReadEliminationClosure.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/PartialEscapeClosure.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/PartialEscapeClosure.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/PartialEscapePhase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/PartialEscapePhase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/VirtualizerToolImpl.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/VirtualizerToolImpl.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.word/src/org/graalvm/compiler/word/Word.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.word/src/org/graalvm/compiler/word/Word.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.word/src/org/graalvm/compiler/word/WordOperationPlugin.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.word/src/org/graalvm/compiler/word/WordOperationPlugin.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.word/src/org/graalvm/compiler/word/WordTypes.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.word/src/org/graalvm/compiler/word/WordTypes.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.graphio/src/org/graalvm/graphio/GraphOutput.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.graphio/src/org/graalvm/graphio/GraphOutput.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.graphio/src/org/graalvm/graphio/GraphProtocol.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.graphio/src/org/graalvm/graphio/GraphProtocol.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.graphio/src/org/graalvm/graphio/ProtocolImpl.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.graphio/src/org/graalvm/graphio/ProtocolImpl.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.graphio/src/org/graalvm/graphio/package-info.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.graphio/src/org/graalvm/graphio/package-info.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,6 +1,5 @@
-
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.util.test/src/org/graalvm/util/test/CollectionSizeTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.util.test/src/org/graalvm/util/test/CollectionSizeTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java	Tue Sep 24 15:19:35 2019 -0400
@@ -110,7 +110,8 @@
 
         String tagText =  ch.getText(itt.getSearchTerm());
         if (tagText.charAt(0) == '"' && tagText.charAt(tagText.length() - 1) == '"') {
-            tagText = tagText.substring(1, tagText.length() - 1);
+            tagText = tagText.substring(1, tagText.length() - 1)
+                             .replaceAll("\\s+", " ");
         }
         String desc = ch.getText(itt.getDescription());
 
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Links.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Links.java	Tue Sep 24 15:19:35 2019 -0400
@@ -312,7 +312,7 @@
      * @return a valid HTML name
      */
     public String getName(String name) {
-        return name.replaceAll(" +", "");
+        return name.replaceAll("\\s+", "");
     }
 
 }
--- a/src/jdk.jcmd/linux/classes/sun/tools/ProcessHelper.java	Tue Sep 24 14:12:08 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.tools;
-
-import java.io.IOException;
-import java.io.UncheckedIOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.jar.Attributes;
-import java.util.jar.JarFile;
-import java.util.stream.Stream;
-
-/**
- * A helper class that retrieves the main class name for
- * a running Java process using the proc filesystem (procfs)
- */
-public class ProcessHelper implements sun.tools.common.ProcessHelper {
-
-
-    private static final String CMD_PREFIX = "cmd:";
-    private static final ProcessHelper INSTANCE = new ProcessHelper();
-
-    public static ProcessHelper getInstance() {
-        return INSTANCE;
-    }
-
-    /**
-     * Gets the main class name for the given Java process by parsing the
-     * process command line. If the application was started with the <em>-jar</em>
-     * option this method returns the name of the jar file. If the application
-     * was started with <em>-m</em> or <em>--module</em> option, the method returns
-     * the module name and the main class name.
-     * @param pid - process ID (pid)
-     * @return the main class name or null if the process no longer exists or
-     * was started with a native launcher (e.g. jcmd etc)
-     */
-
-    public String getMainClass(String pid) {
-        String cmdLine = getCommandLine(pid);
-        if (cmdLine == null) {
-            return null;
-        }
-        if (cmdLine.startsWith(CMD_PREFIX)) {
-            cmdLine = cmdLine.substring(CMD_PREFIX.length());
-        }
-        String[] parts = cmdLine.split("\0");
-        String mainClass = null;
-
-        if(parts.length == 0) {
-            return null;
-        }
-
-        // Check the executable
-        String[] executablePath = parts[0].split("/");
-        if (executablePath.length > 0) {
-            String binaryName = executablePath[executablePath.length - 1];
-            if (!"java".equals(binaryName)) {
-                // Skip the process if it is not started with java launcher
-                return null;
-            }
-        }
-
-        // To be consistent with the behavior on other platforms, if -jar, -m, or --module
-        // options are used then just return the value (the path to the jar file or module
-        // name with a main class). Otherwise, the main class name is the first part that
-        // is not a Java option (doesn't start with '-' and is not a classpath or a module
-        // whitespace option).
-
-        for (int i = 1; i < parts.length && mainClass == null; i++) {
-            if (i < parts.length - 1) {
-                if (parts[i].equals("-m") || parts[i].equals("--module") || parts[i].equals("-jar")) {
-                    return parts[i + 1];
-                }
-            }
-
-            if (parts[i].startsWith("--module=")) {
-                return parts[i].substring("--module=".length());
-            }
-
-            // If this is a classpath or a module whitespace option then skip the next part
-            // (the classpath or the option value itself)
-            if (parts[i].equals("-cp") || parts[i].equals("-classpath") ||  parts[i].equals("--class-path") ||
-                    isModuleWhiteSpaceOption(parts[i])) {
-                i++;
-                continue;
-            }
-            // Skip all other Java options
-            if (parts[i].startsWith("-")) {
-                continue;
-            }
-
-            // If it is a source-file mode then return null
-            if (parts[i].endsWith(".java")) {
-                return null;
-            }
-
-            mainClass = parts[i];
-        }
-        return mainClass;
-
-    }
-
-    private static String getCommandLine(String pid) {
-        try (Stream<String> lines =
-                     Files.lines(Paths.get("/proc/" + pid + "/cmdline"))) {
-            return lines.findFirst().orElse(null);
-        } catch (IOException | UncheckedIOException e) {
-            return null;
-        }
-    }
-
-    private static boolean isModuleWhiteSpaceOption(String option) {
-        return option.equals("-p") ||
-                option.equals("--module-path") ||
-                option.equals("--upgrade-module-path") ||
-                option.equals("--add-modules") ||
-                option.equals("--limit-modules") ||
-                option.equals("--add-exports") ||
-                option.equals("--add-opens") ||
-                option.equals("--add-reads") ||
-                option.equals("--patch-module");
-    }
-
-}
-
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.jcmd/linux/classes/sun/tools/common/ProcessHelper.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.tools.common;
+
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.stream.Stream;
+
+/**
+ * A helper class that retrieves the main class name for
+ * a running Java process using the proc filesystem (procfs)
+ */
+final class ProcessHelper {
+
+    private static final String CMD_PREFIX = "cmd:";
+
+    /**
+     * Gets the main class name for the given Java process by parsing the
+     * process command line. If the application was started with the <em>-jar</em>
+     * option this method returns the name of the jar file. If the application
+     * was started with <em>-m</em> or <em>--module</em> option, the method returns
+     * the module name and the main class name.
+     * @param pid - process ID (pid)
+     * @return the main class name or null if the process no longer exists or
+     * was started with a native launcher (e.g. jcmd etc)
+     */
+    static String getMainClass(String pid) {
+        String cmdLine = getCommandLine(pid);
+        if (cmdLine == null) {
+            return null;
+        }
+        if (cmdLine.startsWith(CMD_PREFIX)) {
+            cmdLine = cmdLine.substring(CMD_PREFIX.length());
+        }
+        String[] parts = cmdLine.split("\0");
+        String mainClass = null;
+
+        if (parts.length == 0) {
+            return null;
+        }
+
+        // Check the executable
+        String[] executablePath = parts[0].split("/");
+        if (executablePath.length > 0) {
+            String binaryName = executablePath[executablePath.length - 1];
+            if (!"java".equals(binaryName)) {
+                // Skip the process if it is not started with java launcher
+                return null;
+            }
+        }
+
+        // To be consistent with the behavior on other platforms, if -jar, -m, or --module
+        // options are used then just return the value (the path to the jar file or module
+        // name with a main class). Otherwise, the main class name is the first part that
+        // is not a Java option (doesn't start with '-' and is not a classpath or a module
+        // whitespace option).
+
+        for (int i = 1; i < parts.length && mainClass == null; i++) {
+            if (i < parts.length - 1) {
+                if (parts[i].equals("-m") || parts[i].equals("--module") || parts[i].equals("-jar")) {
+                    return parts[i + 1];
+                }
+            }
+
+            if (parts[i].startsWith("--module=")) {
+                return parts[i].substring("--module=".length());
+            }
+
+            // If this is a classpath or a module whitespace option then skip the next part
+            // (the classpath or the option value itself)
+            if (parts[i].equals("-cp") || parts[i].equals("-classpath") ||  parts[i].equals("--class-path") ||
+                    isModuleWhiteSpaceOption(parts[i])) {
+                i++;
+                continue;
+            }
+            // Skip all other Java options
+            if (parts[i].startsWith("-")) {
+                continue;
+            }
+
+            // If it is a source-file mode then return null
+            if (parts[i].endsWith(".java")) {
+                return null;
+            }
+
+            mainClass = parts[i];
+        }
+        return mainClass;
+    }
+
+    private static String getCommandLine(String pid) {
+        try (Stream<String> lines =
+                     Files.lines(Paths.get("/proc/" + pid + "/cmdline"))) {
+            return lines.findFirst().orElse(null);
+        } catch (IOException | UncheckedIOException e) {
+            return null;
+        }
+    }
+
+    private static boolean isModuleWhiteSpaceOption(String option) {
+        return option.equals("-p") ||
+               option.equals("--module-path") ||
+               option.equals("--upgrade-module-path") ||
+               option.equals("--add-modules") ||
+               option.equals("--limit-modules") ||
+               option.equals("--add-exports") ||
+               option.equals("--add-opens") ||
+               option.equals("--add-reads") ||
+               option.equals("--patch-module");
+    }
+}
--- a/src/jdk.jcmd/share/classes/sun/tools/common/ProcessArgumentMatcher.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.jcmd/share/classes/sun/tools/common/ProcessArgumentMatcher.java	Tue Sep 24 15:19:35 2019 -0400
@@ -79,15 +79,10 @@
 
     private static boolean check(VirtualMachineDescriptor vmd, String excludeClass, String partialMatch) {
 
-        String mainClass = null;
+        // Try to get the main class name using (platform specific) ProcessHelper
+        String mainClass = ProcessHelper.getMainClass(vmd.id());
 
-        // Get the main class name using platform specific helper
-        ProcessHelper helper = ProcessHelper.platformProcessHelper();
-        if (helper != null) {
-            mainClass = helper.getMainClass(vmd.id());
-        }
-
-        // If the main class name is still unset then retrieve it with the attach mechanism
+        // If the main class name could not be retrieved by ProcessHelper, get it with the attach mechanism
         if (mainClass == null) {
             try {
                 VmIdentifier vmId = new VmIdentifier(vmd.id());
--- a/src/jdk.jcmd/share/classes/sun/tools/common/ProcessHelper.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.jcmd/share/classes/sun/tools/common/ProcessHelper.java	Tue Sep 24 15:19:35 2019 -0400
@@ -25,33 +25,12 @@
 
 package sun.tools.common;
 
-import java.lang.reflect.Method;
-
 /**
  * A helper class to retrieve the main class name for a running
- * Java process.
+ * Java process. Default implementation returns null. Platform specific
+ * implementation currently available for Linux only.
  */
-
-public interface ProcessHelper {
-
-    /**
-     * Returns an instance of the ProcessHelper class.
-     *
-     * @return ProcessHelper object or null if not supported on this platform.
-     */
-    public static ProcessHelper platformProcessHelper() {
-        try {
-            Class<?> c = Class.forName("sun.tools.ProcessHelper");
-            @SuppressWarnings("unchecked")
-            Method m = c.getMethod("getInstance");
-            return (ProcessHelper) m.invoke(null);
-        } catch (ClassNotFoundException e) {
-            return null;
-        } catch (ReflectiveOperationException e) {
-            throw new InternalError(e);
-        }
-    }
-
+final class ProcessHelper {
 
     /**
      * Returns the main class name for the given Java process
@@ -59,6 +38,7 @@
      * @param pid - process ID (pid)
      * @return main class name or null if the main class could not be retrieved
      */
-
-    String getMainClass(String pid);
+    static String getMainClass(String pid) {
+        return null;
+    }
 }
--- a/src/jdk.jdwp.agent/share/native/libjdwp/transport.c	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/transport.c	Tue Sep 24 15:19:35 2019 -0400
@@ -49,6 +49,15 @@
 
 static struct jdwpTransportCallback callback = {jvmtiAllocate, jvmtiDeallocate};
 
+static void freeTransportInfo(TransportInfo *info) {
+    if (info) {
+        jvmtiDeallocate(info->name);
+        jvmtiDeallocate(info->address);
+        jvmtiDeallocate(info->allowed_peers);
+        jvmtiDeallocate(info);
+    }
+}
+
 /*
  * Print the last transport error
  */
@@ -345,12 +354,14 @@
 
     LOG_MISC(("Begin accept thread"));
 
-    info = (TransportInfo*)(void*)arg;
+    info = (TransportInfo*)arg;
     t = info->transport;
     rc = (*t)->Accept(t, info->timeout, 0);
 
     /* System property no longer needed */
     setTransportProperty(jni_env, NULL);
+    /* TransportInfo data no longer needed */
+    freeTransportInfo(info);
 
     if (rc != JDWPTRANSPORT_ERROR_NONE) {
         /*
@@ -371,10 +382,14 @@
 static void JNICALL
 attachThread(jvmtiEnv* jvmti_env, JNIEnv* jni_env, void* arg)
 {
-    TransportInfo *info = (TransportInfo*)(void*)arg;
+    TransportInfo *info = (TransportInfo*)arg;
+    jdwpTransportEnv *t = info->transport;
+
+    /* TransportInfo data no longer needed */
+    freeTransportInfo(info);
 
     LOG_MISC(("Begin attach thread"));
-    connectionInitiated(info->transport);
+    connectionInitiated(t);
     LOG_MISC(("End attach thread"));
 }
 
@@ -484,7 +499,7 @@
     if (info->transport == NULL) {
         serror = loadTransport(name, info);
         if (serror != JDWP_ERROR(NONE)) {
-            jvmtiDeallocate(info);
+            freeTransportInfo(info);
             return serror;
         }
     }
@@ -577,6 +592,9 @@
             goto handleError;
         }
 
+        /* reset info - it will be deallocated by acceptThread */
+        info = NULL;
+
         launchCommand = debugInit_launchOnInit();
         if (launchCommand != NULL) {
             serror = launch(launchCommand, name, retAddress);
@@ -592,10 +610,7 @@
         return JDWP_ERROR(NONE);
 
 handleError:
-        jvmtiDeallocate(info->name);
-        jvmtiDeallocate(info->address);
-        jvmtiDeallocate(info->allowed_peers);
-        jvmtiDeallocate(info);
+        freeTransportInfo(info);
     } else {
         /*
          * Note that we don't attempt to do a launch here. Launching
@@ -614,7 +629,7 @@
              /* The name, address and allowed_peers fields in 'info'
               * are not allocated in the non-server case so
               * they do not need to be freed. */
-             jvmtiDeallocate(info);
+             freeTransportInfo(info);
              return serror;
          }
 
--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/Repository.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/Repository.java	Tue Sep 24 15:19:35 2019 -0400
@@ -56,6 +56,11 @@
     }
 
     public synchronized void setBasePath(SafePath baseLocation) throws Exception {
+
+        if(baseLocation.equals(this.baseLocation)) {
+            Logger.log(LogTag.JFR, LogLevel.INFO, "Same base repository path " + baseLocation.toString() + " is set");
+            return;
+        }
         // Probe to see if repository can be created, needed for fail fast
         // during JVM startup or JFR.configure
         this.repository = createRepository(baseLocation);
--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/SecuritySupport.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/SecuritySupport.java	Tue Sep 24 15:19:35 2019 -0400
@@ -171,6 +171,19 @@
         public String toString() {
             return text;
         }
+
+        @Override
+        public boolean equals(Object other) {
+            if(other != null && other instanceof SafePath){
+                return this.toPath().equals(((SafePath) other).toPath());
+            }
+            return false;
+        }
+
+        @Override
+        public int hashCode() {
+            return this.toPath().hashCode();
+        }
     }
 
     private interface RunnableWithCheckedException {
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/doubleconv/BignumDtoa.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/doubleconv/BignumDtoa.java	Tue Sep 24 15:19:35 2019 -0400
@@ -280,7 +280,7 @@
 
     // Let v = numerator / denominator < 10.
     // Then we generate 'count' digits of d = x.xxxxx... (without the decimal point)
-    // from left to right. Once 'count' digits have been produced we decide wether
+    // from left to right. Once 'count' digits have been produced we decide whether
     // to round up or down. Remainders of exactly .5 round upwards. Numbers such
     // as 9.999999 propagate a carry all the way, and change the
     // exponent (decimal_point), when rounding upwards.
--- a/test/hotspot/gtest/gc/z/test_zForwarding.cpp	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/hotspot/gtest/gc/z/test_zForwarding.cpp	Tue Sep 24 15:19:35 2019 -0400
@@ -40,19 +40,19 @@
 public:
   // Helper functions
 
-  static bool is_power_of_2(uint32_t value) {
+  static bool is_power_of_2(size_t value) {
     return ::is_power_of_2((intptr_t)value);
   }
 
   class SequenceToFromIndex : AllStatic {
   public:
-    static uintptr_t even(uint32_t sequence_number) {
+    static uintptr_t even(size_t sequence_number) {
       return sequence_number * 2;
     }
-    static uintptr_t odd(uint32_t sequence_number) {
+    static uintptr_t odd(size_t sequence_number) {
       return even(sequence_number) + 1;
     }
-    static uintptr_t one_to_one(uint32_t sequence_number) {
+    static uintptr_t one_to_one(size_t sequence_number) {
       return sequence_number;
     }
   };
@@ -64,10 +64,10 @@
   }
 
   static void find_empty(ZForwarding* forwarding) {
-    uint32_t size = forwarding->_entries.length();
-    uint32_t entries_to_check = size * 2;
+    size_t size = forwarding->_entries.length();
+    size_t entries_to_check = size * 2;
 
-    for (uint32_t i = 0; i < entries_to_check; i++) {
+    for (size_t i = 0; i < entries_to_check; i++) {
       uintptr_t from_index = SequenceToFromIndex::one_to_one(i);
 
       EXPECT_FALSE(forwarding->find(from_index).populated()) << CAPTURE2(from_index, size);
@@ -75,11 +75,11 @@
   }
 
   static void find_full(ZForwarding* forwarding) {
-    uint32_t size = forwarding->_entries.length();
-    uint32_t entries_to_populate = size;
+    size_t size = forwarding->_entries.length();
+    size_t entries_to_populate = size;
 
     // Populate
-    for (uint32_t i = 0; i < entries_to_populate; i++) {
+    for (size_t i = 0; i < entries_to_populate; i++) {
       uintptr_t from_index = SequenceToFromIndex::one_to_one(i);
 
       ZForwardingCursor cursor;
@@ -90,7 +90,7 @@
     }
 
     // Verify
-    for (uint32_t i = 0; i < entries_to_populate; i++) {
+    for (size_t i = 0; i < entries_to_populate; i++) {
       uintptr_t from_index = SequenceToFromIndex::one_to_one(i);
 
       ZForwardingEntry entry = forwarding->find(from_index);
@@ -102,11 +102,11 @@
   }
 
   static void find_every_other(ZForwarding* forwarding) {
-    uint32_t size = forwarding->_entries.length();
-    uint32_t entries_to_populate = size / 2;
+    size_t size = forwarding->_entries.length();
+    size_t entries_to_populate = size / 2;
 
     // Populate even from indices
-    for (uint32_t i = 0; i < entries_to_populate; i++) {
+    for (size_t i = 0; i < entries_to_populate; i++) {
       uintptr_t from_index = SequenceToFromIndex::even(i);
 
       ZForwardingCursor cursor;
@@ -117,7 +117,7 @@
     }
 
     // Verify populated even indices
-    for (uint32_t i = 0; i < entries_to_populate; i++) {
+    for (size_t i = 0; i < entries_to_populate; i++) {
       uintptr_t from_index = SequenceToFromIndex::even(i);
 
       ZForwardingCursor cursor;
@@ -132,7 +132,7 @@
     //
     // This check could be done on a larger range of sequence numbers,
     // but currently entries_to_populate is used.
-    for (uint32_t i = 0; i < entries_to_populate; i++) {
+    for (size_t i = 0; i < entries_to_populate; i++) {
       uintptr_t from_index = SequenceToFromIndex::odd(i);
 
       ZForwardingEntry entry = forwarding->find(from_index);
@@ -158,7 +158,7 @@
     page.mark_object(ZAddress::marked(object), dummy, dummy);
 
     const uint32_t live_objects = size;
-    const uint32_t live_bytes = live_objects * object_size;
+    const size_t live_bytes = live_objects * object_size;
     page.inc_live_atomic(live_objects, live_bytes);
 
     // Setup forwarding
--- a/test/hotspot/jtreg/ProblemList-graal.txt	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/hotspot/jtreg/ProblemList-graal.txt	Tue Sep 24 15:19:35 2019 -0400
@@ -43,8 +43,6 @@
 
 compiler/unsafe/UnsafeGetConstantField.java                     8181833   generic-all
 compiler/unsafe/UnsafeGetStableArrayElement.java                8181833   generic-all
-compiler/unsafe/UnsafeOffHeapBooleanTest.java                   8181833   generic-all
-compiler/unsafe/UnsafeOnHeapBooleanTest.java                    8181833   generic-all
 
 compiler/whitebox/ClearMethodStateTest.java                     8181831   generic-all
 compiler/whitebox/EnqueueMethodForCompilationTest.java          8181831   generic-all
@@ -242,7 +240,6 @@
 org.graalvm.compiler.core.test.OptionsVerifierTest                               8205081
 org.graalvm.compiler.hotspot.test.CompilationWrapperTest                         8205081
 org.graalvm.compiler.replacements.test.classfile.ClassfileBytecodeProviderTest   8205081
-org.graalvm.compiler.debug.test.DebugContextTest                                 8205081
 
 org.graalvm.compiler.core.test.deopt.CompiledMethodTest          8202955
 
--- a/test/hotspot/jtreg/ProblemList.txt	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/hotspot/jtreg/ProblemList.txt	Tue Sep 24 15:19:35 2019 -0400
@@ -41,6 +41,7 @@
 # :hotspot_compiler
 
 compiler/ciReplay/TestSAServer.java 8029528 generic-all
+compiler/codecache/jmx/PoolsIndependenceTest.java 8167015 generic-all
 compiler/codecache/stress/OverloadCompileQueueTest.java 8166554 generic-all
 compiler/codegen/Test6896617.java 8193479 generic-all
 compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java 8225370 generic-all
@@ -90,6 +91,7 @@
 # :hotspot_runtime
 
 runtime/jni/terminatedThread/TestTerminatedThread.java 8219652 aix-ppc64
+runtime/ReservedStack/ReservedStackTest.java 8231031 generic-all
 
 #############################################################################
 
@@ -167,7 +169,7 @@
 vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses021/TestDescription.java 8065773 generic-all
 vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses023/TestDescription.java 8065773 generic-all
 
-vmTestbase/nsk/jdb/eval/eval001/eval001.java 8212117 generic-all
+vmTestbase/nsk/jdb/eval/eval001/eval001.java 8221503 generic-all
 
 vmTestbase/metaspace/gc/firstGC_10m/TestDescription.java 8208250 generic-all
 vmTestbase/metaspace/gc/firstGC_50m/TestDescription.java 8208250 generic-all
@@ -204,4 +206,16 @@
 
 vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn001/forceEarlyReturn001.java 7199837 generic-all
 
+vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SynchronizerLockingThreads/SynchronizerLockingThreads001/TestDescription.java 8231032 generic-all
+vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SynchronizerLockingThreads/SynchronizerLockingThreads002/TestDescription.java 8231032 generic-all
+vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SynchronizerLockingThreads/SynchronizerLockingThreads003/TestDescription.java 8231032 generic-all
+vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SynchronizerLockingThreads/SynchronizerLockingThreads004/TestDescription.java 8231032 generic-all
+vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SynchronizerLockingThreads/SynchronizerLockingThreads005/TestDescription.java 8231032 generic-all
+
+vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi001/Multi001.java 8231032 generic-all
+vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi002/TestDescription.java 8231032 generic-all
+vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi003/TestDescription.java 8231032 generic-all
+vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi004/TestDescription.java 8231032 generic-all
+vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi005/TestDescription.java 8231032 generic-all
+
 #############################################################################
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/codecache/stress/UnexpectedDeoptimizationAllTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 UnexpectedDeoptimizationAllTest
+ * @key stress
+ * @summary stressing code cache by forcing unexpected deoptimizations of all methods
+ * @library /test/lib /
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ *
+ * @build sun.hotspot.WhiteBox compiler.codecache.stress.Helper compiler.codecache.stress.TestCaseImpl
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:-DeoptimizeRandom
+ *                   -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method
+ *                   -XX:-SegmentedCodeCache
+ *                   compiler.codecache.stress.UnexpectedDeoptimizationAllTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:-DeoptimizeRandom
+ *                   -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method
+ *                   -XX:+SegmentedCodeCache
+ *                   compiler.codecache.stress.UnexpectedDeoptimizationAllTest
+ */
+
+package compiler.codecache.stress;
+
+public class UnexpectedDeoptimizationAllTest implements Runnable {
+
+    public static void main(String[] args) {
+        new CodeCacheStressRunner(new UnexpectedDeoptimizationAllTest()).runTest();
+    }
+
+    @Override
+    public void run() {
+        Helper.WHITE_BOX.deoptimizeAll();
+        try {
+            Thread.sleep(10);
+        } catch (Exception e) {
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/loopstripmining/DeadNodesInOuterLoopAtLoopCloning.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2019, 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 8230061
+ * @summary loop unrolling breaks when outer strip mined loop contains dead node
+ *
+ * @run main/othervm -Xmx1G DeadNodesInOuterLoopAtLoopCloning
+ *
+ */
+
+public class DeadNodesInOuterLoopAtLoopCloning {
+
+    public static final int N = 400;
+
+    public static long instanceCount=-2288355609708559532L;
+
+    public static double checkSum(double[] a) {
+        double sum = 0;
+        for (int j = 0; j < a.length; j++) {
+            sum += (a[j] / (j + 1) + a[j] % (j + 1));
+        }
+        return sum;
+    }
+
+    public static int iMeth(double d1) {
+
+        int i4=6022, i5=-211, i6=-15841, iArr[]=new int[N];
+        double d2=-8.78129, dArr[]=new double[N];
+
+        i5 = 1;
+        do {
+            i6 = 1;
+            while (++i6 < 5) {
+                i4 = -933;
+                i4 *= i4;
+                dArr[i5 + 1] = i4;
+                i4 -= i4;
+                d2 = 1;
+                do {
+                    iArr[(int)(d2 + 1)] += (int)instanceCount;
+                    try {
+                        i4 = (i4 % -51430);
+                        i4 = (iArr[i6] % 31311);
+                        iArr[i6 + 1] = (24197 / i5);
+                    } catch (ArithmeticException a_e) {}
+                    i4 -= (int)instanceCount;
+                    i4 <<= i5;
+                    i4 &= 12;
+                } while (++d2 < 1);
+            }
+        } while (++i5 < 320);
+        long meth_res = Double.doubleToLongBits(checkSum(dArr));
+        return (int)meth_res;
+    }
+
+    public static void main(String[] strArr) {
+        DeadNodesInOuterLoopAtLoopCloning _instance = new DeadNodesInOuterLoopAtLoopCloning();
+        for (int i = 0; i < 10 * 320; i++ ) {
+            _instance.iMeth(0.8522);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/print/PrintCompileQueue.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2019, Loongson Technology Co. Ltd. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8230943
+ * @summary possible deadlock was detected when ran with -XX:+CIPrintCompileQueue
+ * @run main/othervm -Xcomp -XX:+UnlockDiagnosticVMOptions -XX:+CIPrintCompileQueue
+ *                   compiler.print.PrintCompileQueue
+ *
+ */
+
+package compiler.print;
+
+public class PrintCompileQueue {
+    public static void main(String[] args) {
+        System.out.println("Passed");
+    }
+}
--- a/test/hotspot/jtreg/gc/g1/TestGCLogMessages.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/hotspot/jtreg/gc/g1/TestGCLogMessages.java	Tue Sep 24 15:19:35 2019 -0400
@@ -128,8 +128,7 @@
         new LogMessageWithLevel("CLDG Roots", Level.TRACE),
         new LogMessageWithLevel("JVMTI Roots", Level.TRACE),
         new LogMessageWithLevel("CM RefProcessor Roots", Level.TRACE),
-        new LogMessageWithLevel("Wait For Strong CLD", Level.TRACE),
-        new LogMessageWithLevel("Weak CLD Roots", Level.TRACE),
+        new LogMessageWithLevel("Wait For Strong Roots", Level.TRACE),
         // Redirty Cards
         new LogMessageWithLevel("Redirty Cards", Level.DEBUG),
         new LogMessageWithLevel("Parallel Redirty", Level.TRACE),
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/CheckUnhandledOops/TestVerifyOops.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8231058
+ * @requires vm.debug & (os.arch != "sparc") & (os.arch != "sparcv9")
+ * @run main/othervm -XX:+VerifyOops TestVerifyOops
+ */
+
+public class TestVerifyOops {
+
+    public static void main(String[] args) {
+        System.out.println("Test passed");
+    }
+}
--- a/test/hotspot/jtreg/runtime/cds/appcds/ParallelLoadTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/hotspot/jtreg/runtime/cds/appcds/ParallelLoadTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -33,29 +33,52 @@
  * @run driver ParallelLoadTest
  */
 
+import java.io.File;
+
 public class ParallelLoadTest {
     public static final int MAX_CLASSES = 40;
 
+    /* For easy stress testing, do this:
+
+       i=0; while jtreg -DParallelLoadTest.app.loops=100 -DParallelLoadTest.boot.loops=100 \
+           ParallelLoadTest.java; do i=$(expr $i + 1); echo =====$i; done
+
+     */
+
+    private static final int APP_LOOPS  = Integer.parseInt(System.getProperty("ParallelLoadTest.app.loops", "1"));
+    private static final int BOOT_LOOPS = Integer.parseInt(System.getProperty("ParallelLoadTest.boot.loops", "1"));
+
     public static void main(String[] args) throws Exception {
-        JarBuilder.build("parallel_load", getClassList(true));
-        String appJar = TestCommon.getTestJar("parallel_load.jar");
-        TestCommon.test(appJar, getClassList(false), "ParallelLoad");
+        JarBuilder.build("parallel_load_app", "ParallelLoad", "ParallelLoadThread", "ParallelLoadWatchdog");
+        JarBuilder.build("parallel_load_classes", getClassList());
+        String appJar     = TestCommon.getTestJar("parallel_load_app.jar");
+        String classesJar = TestCommon.getTestJar("parallel_load_classes.jar");
+
+        // (1) Load the classes from app class loader
+        String CP = appJar + File.pathSeparator + classesJar;
+        TestCommon.testDump(CP, getClassList());
+        for (int i = 0; i < APP_LOOPS; i++) {
+            TestCommon.run("-cp", CP,  "ParallelLoad").assertNormalExit();
+        }
+
+        // (2) Load the classes from boot class loader
+        String bootcp = "-Xbootclasspath/a:" + classesJar;
+        TestCommon.testDump(appJar, getClassList(), bootcp);
+        for (int i = 0; i < BOOT_LOOPS; i++) {
+            TestCommon.run(bootcp, "-cp", appJar,
+                           // "-Xlog:class+load=debug",
+                           "ParallelLoad").assertNormalExit();
+        }
     }
 
-    private static String[] getClassList(boolean includeWatchdog) {
-        int extra = includeWatchdog ? 3 : 2;
-        String[] classList = new String[MAX_CLASSES + extra];
+    private static String[] getClassList() {
+        String[] classList = new String[MAX_CLASSES];
 
         int i;
-        for (i=0; i<MAX_CLASSES; i++) {
+        for (i = 0; i < MAX_CLASSES; i++) {
             classList[i] = "ParallelClass" + i;
         }
 
-        classList[i++] = "ParallelLoad";
-        classList[i++] = "ParallelLoadThread";
-        if (includeWatchdog)
-            classList[i++] = "ParallelLoadWatchdog";
-
         return classList;
     }
 }
--- a/test/hotspot/jtreg/runtime/cds/appcds/TestCommon.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/hotspot/jtreg/runtime/cds/appcds/TestCommon.java	Tue Sep 24 15:19:35 2019 -0400
@@ -218,7 +218,7 @@
                 if (!mainModuleSpecified && !patchModuleSpecified) {
                     // If you have an empty classpath, you cannot specify a classlist!
                     if (opts.classList != null && opts.classList.length > 0) {
-                        throw new RuntimeException("test.dynamic.dump not supported empty classpath with non-empty classlist");
+                        throw new RuntimeException("test.dynamic.dump is not supported with an empty classpath while the classlist is not empty");
                     }
                     cmd.add("-version");
                 }
--- a/test/hotspot/jtreg/runtime/cds/appcds/test-classes/ParallelLoad.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/hotspot/jtreg/runtime/cds/appcds/test-classes/ParallelLoad.java	Tue Sep 24 15:19:35 2019 -0400
@@ -25,6 +25,7 @@
 import java.io.*;
 import java.net.*;
 import java.lang.reflect.Field;
+import java.util.concurrent.atomic.AtomicInteger;
 
 
 // This test helper is parameterized by:
@@ -78,7 +79,7 @@
             if ("FINGERPRINT_MODE".equals(args[1])) {
                 mode = FINGERPRINT_MODE;
                 classLoaders = new ClassLoader[NUM_THREADS];
-                for (int i=0; i<NUM_THREADS; i++) {
+                for (int i = 0; i < NUM_THREADS; i++) {
                     URL url = new File(customJar).toURI().toURL();
                     URL[] urls = new URL[] {url};
                     classLoaders[i] = new URLClassLoader(urls);
@@ -93,7 +94,7 @@
         System.out.println("Start Parallel Load ...");
 
         Thread thread[] = new Thread[NUM_THREADS];
-        for (int i=0; i<NUM_THREADS; i++) {
+        for (int i = 0; i < NUM_THREADS; i++) {
             Thread t = new ParallelLoadThread(i);
             t.start();
             thread[i] = t;
@@ -103,7 +104,7 @@
         watchdog.setDaemon(true);
         watchdog.start();
 
-        for (int i=0; i<NUM_THREADS; i++) {
+        for (int i = 0; i < NUM_THREADS; i++) {
             thread[i].join();
         }
         System.out.println("Parallel Load ... done");
@@ -128,8 +129,13 @@
 
 
 class ParallelLoadThread extends Thread {
-    static int num_ready[] = new int[ParallelLoad.MAX_CLASSES];
-    static Object lock = new Object();
+    static AtomicInteger num_ready[];
+    static {
+        num_ready = new AtomicInteger[ParallelLoad.MAX_CLASSES];
+        for (int i = 0; i < ParallelLoad.MAX_CLASSES; i++) {
+            num_ready[i] = new AtomicInteger();
+        }
+    }
     static String transformMode =
         System.getProperty("appcds.parallel.transform.mode", "none");
 
@@ -153,35 +159,36 @@
     }
 
     private void run0() throws Throwable {
-        for (int i=0; i<ParallelLoad.MAX_CLASSES; i++) {
-            synchronized(lock) {
-                num_ready[i] ++;
-                while (num_ready[i] < ParallelLoad.NUM_THREADS) {
-                    lock.wait();
-                }
-                lock.notifyAll();
+        for (int i = 0;  i < ParallelLoad.MAX_CLASSES; i++) {
+            String className = "ParallelClass" + i;
+            if (transformMode.equals("cflh")) {
+                className = "ParallelClassTr" + i;
             }
-            log("this = %s %d", this, i);
-            String className = "ParallelClass" + i;
-            if (transformMode.equals("cflh"))
-                className = "ParallelClassTr" + i;
-
             Class clazz = null;
 
-            switch (ParallelLoad.loaderType) {
-            case ParallelLoad.SYSTEM_LOADER:
-                clazz = Class.forName(className);
-                break;
-            case ParallelLoad.SINGLE_CUSTOM_LOADER:
-                clazz = ParallelLoad.classLoaders[0].loadClass(className);
-                break;
-            case ParallelLoad.MULTI_CUSTOM_LOADER:
-                clazz = ParallelLoad.classLoaders[thread_id].loadClass(className);
-                break;
+            // Spin until every thread is ready to proceed
+            num_ready[i].incrementAndGet();
+            while (num_ready[i].intValue() < ParallelLoad.NUM_THREADS) {
+                ;
             }
 
-            log("clazz = %s", clazz);
-            testTransformation(clazz);
+            {   // Avoid logging in this block so the threads can proceed without
+                // waiting for the stdout lock, etc.
+                switch (ParallelLoad.loaderType) {
+                case ParallelLoad.SYSTEM_LOADER:
+                    clazz = Class.forName(className);
+                    break;
+                case ParallelLoad.SINGLE_CUSTOM_LOADER:
+                    clazz = ParallelLoad.classLoaders[0].loadClass(className);
+                    break;
+                case ParallelLoad.MULTI_CUSTOM_LOADER:
+                    clazz = ParallelLoad.classLoaders[thread_id].loadClass(className);
+                    break;
+                }
+                testTransformation(clazz);
+            }
+
+            log("thread[%d] t = %s, c = %s, l = %s", thread_id, this, clazz, clazz.getClassLoader());
         }
     }
 
--- a/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java	Tue Sep 24 15:19:35 2019 -0400
@@ -98,8 +98,8 @@
             : ProcessTools.executeProcess("sh", "-c", "ulimit -c unlimited && "
                     + ProcessTools.getCommandLine(pb));
         File core;
-        String pattern = Platform.isWindows() ? "mdmp" : "core";
-        File[] cores = new File(".").listFiles((dir, name) -> name.contains(pattern));
+        String pattern = Platform.isWindows() ? ".*\\.mdmp" : "core(\\.\\d+)?";
+        File[] cores = new File(".").listFiles((dir, name) -> name.matches(pattern));
         if (cores.length == 0) {
             // /cores/core.$pid might be generated on macosx by default
             String pid = output.firstMatch("^(\\d+)" + pidSeparator, 1);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jaxp/javax/xml/jaxp/unittest/sax/DeclarationTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,222 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 sax;
+
+import java.io.File;
+import java.io.StringReader;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import org.testng.Assert;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+
+
+/*
+ * @test
+ * @bug 8230814
+ * @run testng sax.DeclarationTest
+ * @summary Test SAX Parser's handling of XML Declarations.
+ */
+public class DeclarationTest {
+    static String SRC_DIR = System.getProperty("test.src");
+    final static String XML_NO_DECLARATION = "<a>abc</a>";
+    final static String XML_NO_STANDALONE = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?><a>abc</a>";
+    final static String XML_STANDALONE_N = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" standalone=\"no\" ?><a>abc</a>";
+    final static String XML_STANDALONE_Y = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" standalone=\"yes\" ?><a>abc</a>";
+
+    /**
+     * Provides XML strings for testing XML declaration.
+     *
+     * Fields:
+     * XML string, expected version, encoding and standalone strings
+     *
+     * @return data array for the test
+     * @throws Exception
+     */
+    @DataProvider(name = "default")
+    public Object[][] forDefaultHandler() throws Exception {
+        return new Object[][] {
+            { XML_NO_DECLARATION, null, null, null},
+            { XML_NO_STANDALONE, null, null, null},
+            { XML_STANDALONE_Y, null, null, null},
+            { XML_STANDALONE_N, null, null, null},
+        };
+    }
+
+    /**
+     * Provides XML strings for testing XML declaration.
+     *
+     * Fields:
+     * XML string, expected version, encoding and standalone strings
+     *
+     * @return data array for the test
+     * @throws Exception
+     */
+    @DataProvider(name = "sax-data")
+    public Object[][] xmlSAXData() throws Exception {
+        return new Object[][] {
+            { XML_NO_DECLARATION, null, null, null},
+            { XML_NO_STANDALONE, "1.0", "ISO-8859-1", null},
+            { XML_STANDALONE_Y, "1.0", "ISO-8859-1", "yes"},
+            { XML_STANDALONE_N, "1.0", "ISO-8859-1", "no"},
+        };
+    }
+
+
+    /**
+     * Provides XML files for testing XML declaration.
+     *
+     * Fields:
+     * Source files, expected version, encoding and standalone strings
+     *
+     * @return data array for the test
+     * @throws Exception
+     */
+    @DataProvider(name = "sax-data-files")
+    public Object[][] xmlSAXDataFiles() throws Exception {
+        return new Object[][] {
+            //the source contains no declaration
+            { new File(SRC_DIR + "/../transform/SourceTest.xml"), null, null, null},
+            //<?xml version="1.0" encoding="UTF-8"?>
+            { new File(SRC_DIR + "/toys.xml"), "1.0", "UTF-8", null},
+            //<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+            { new File(SRC_DIR + "/../dom/ElementTraversal.xml"), "1.0", "UTF-8", "no"},
+            // <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+            { new File(SRC_DIR + "/../validation/Bug6449797.xsd"), "1.0", "UTF-8", "yes"},
+            //<?xml version="1.0" standalone="no" ?>
+            { new File(SRC_DIR + "/../transform/5368141.xml"), "1.0", null, "no"},
+
+            //<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+            { new File(SRC_DIR + "/../transform/Bug6206491.xml"), "1.0", "ISO-8859-1", "no"},
+            //<?xml version="1.0" encoding="ISO-8859-1"?>
+            { new File(SRC_DIR + "/../transform/Bug6206491.xsl"), "1.0", "ISO-8859-1", null},
+
+        };
+    }
+
+    /**
+     * Verifies that the default handler does nothing.
+     * @param xml xml string
+     * @param version expected version string
+     * @param encoding expected encoding string
+     * @param standalone expected standalone string
+     * @throws Exception if the test fails
+     */
+    @Test(dataProvider = "default")
+    public void testDefault(String xml, String version, String encoding, String standalone)
+            throws Exception {
+        DefaultImpl h = new DefaultImpl();
+        parseAndVerify(xml, h, version, encoding, standalone);
+    }
+
+    /**
+     * Verifies that the SAX Parser returns the information of XML declaration
+     * through the ContentHandler interface.
+     * @param xml xml string
+     * @param version expected version string
+     * @param encoding expected encoding string
+     * @param standalone expected standalone string
+     * @throws Exception if the test fails
+     */
+    @Test(dataProvider = "sax-data")
+    public void test(String xml, String version, String encoding, String standalone)
+            throws Exception {
+        NewMethodImpl h = new NewMethodImpl();
+        parseAndVerify(xml, h, version, encoding, standalone);
+    }
+
+    /**
+     * Verifies that the SAX Parser returns the information of XML declaration
+     * through the ContentHandler interface.
+     * @param xml xml files
+     * @param version expected version string
+     * @param encoding expected encoding string
+     * @param standalone expected standalone string
+     * @throws Exception if the test fails
+     */
+    @Test(dataProvider = "sax-data-files")
+    public void testFiles(File xml, String version, String encoding, String standalone)
+            throws Exception {
+        SAXParser parser = SAXParserFactory.newDefaultInstance().newSAXParser();
+        NewMethodImpl h = new NewMethodImpl();
+        parser.parse(xml, h);
+        Assert.assertEquals(h.version, version);
+        Assert.assertEquals(h.encoding, encoding);
+        Assert.assertEquals(h.standalone, standalone);
+    }
+
+    /**
+     * Verifies the ContentHandler's XML Declaration feature by parsing an XML
+     * string content.
+     * @param xml xml string
+     * @param version expected version string
+     * @param encoding expected encoding string
+     * @param standalone expected standalone string
+     * @throws Exception if the test fails
+     */
+    private void parseAndVerify(String xml, DefaultImpl h,
+            String version, String encoding, String standalone)
+            throws Exception {
+        XMLReader r = SAXParserFactory.newDefaultInstance().newSAXParser().getXMLReader();
+        r.setContentHandler(h);
+        r.parse(new InputSource(new StringReader(xml)));
+        Assert.assertEquals(h.version, version);
+        Assert.assertEquals(h.encoding, encoding);
+        Assert.assertEquals(h.standalone, standalone);
+    }
+
+    class DefaultImpl extends DefaultHandler{
+        boolean startDocumentInvoked = false;
+        String version, encoding, standalone;
+
+        public void startDocument() throws SAXException {
+            super.startDocument();
+            startDocumentInvoked = true;
+        }
+    }
+
+    class NewMethodImpl extends DefaultImpl {
+
+        public void startDocument() throws SAXException {
+            super.startDocument();
+        }
+
+        @Override
+        public void declaration(String version, String encoding, String standalone)
+                throws SAXException
+        {
+            super.declaration(version, encoding, standalone);
+            Assert.assertTrue(startDocumentInvoked, "declaration follows startDocument");
+            this.version = version;
+            this.encoding = encoding;
+            this.standalone = standalone;
+        }
+    }
+}
--- a/test/jdk/ProblemList.txt	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/ProblemList.txt	Tue Sep 24 15:19:35 2019 -0400
@@ -564,6 +564,8 @@
 javax/management/monitor/DerivedGaugeMonitorTest.java         8042211 generic-all
 javax/management/remote/mandatory/connection/MultiThreadDeadLockTest.java 8042215 generic-all
 
+java/lang/management/ThreadMXBean/LockedSynchronizers.java 8231032 generic-all
+
 ############################################################################
 
 # jdk_io
@@ -650,8 +652,6 @@
 # jdk_security
 
 sun/security/pkcs11/ec/TestKeyFactory.java                      8026976 generic-all
-sun/security/pkcs11/Secmod/AddTrustedCert.java                  8180837 generic-all
-sun/security/pkcs11/tls/TestKeyMaterial.java                    8180837 generic-all
 sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java            8161536 generic-all
 
 sun/security/tools/keytool/ListKeychainStore.sh                 8156889 macosx-all
@@ -872,8 +872,6 @@
 
 com/sun/jndi/ldap/DeadSSLLdapTimeoutTest.java                   8169942 linux-i586,macosx-all,windows-x64
 
-com/sun/jndi/ldap/LdapTimeoutTest.java                          8151678 generic-all
-
 com/sun/jndi/dns/ConfigTests/PortUnreachable.java               7164518 macosx-all
 
 javax/rmi/ssl/SSLSocketParametersTest.sh                        8162906 generic-all
@@ -887,6 +885,7 @@
 jdk/jfr/event/io/EvilInstrument.java                            8221331    generic-all
 jdk/jfr/event/runtime/TestNetworkUtilizationEvent.java          8228990,8229370    generic-all
 jdk/jfr/event/compiler/TestCodeSweeper.java                     8225209    generic-all
+jdk/jfr/jcmd/TestJcmdConfigure.java                             8231317    windows-x64
 
 ############################################################################
 
--- a/test/jdk/com/sun/jndi/ldap/LdapTimeoutTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/com/sun/jndi/ldap/LdapTimeoutTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,424 +21,487 @@
  * questions.
  */
 
-/**
+/*
  * @test
- * @run main/othervm LdapTimeoutTest
- * @bug 7094377 8000487 6176036 7056489
+ * @library /test/lib
+ *          lib/
+ * @run testng/othervm LdapTimeoutTest
+ * @bug 7094377 8000487 6176036 7056489 8151678
  * @summary Timeout tests for ldap
  */
 
+import org.testng.Assert;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.directory.InitialDirContext;
+import javax.naming.directory.SearchControls;
+import java.io.IOException;
+import java.io.OutputStream;
 import java.net.Socket;
-import java.net.ServerSocket;
-import java.net.SocketTimeoutException;
-import java.io.*;
-import javax.naming.*;
-import javax.naming.directory.*;
+import java.util.ArrayList;
+import java.util.Hashtable;
 import java.util.List;
-import java.util.Hashtable;
-import java.util.ArrayList;
+import java.util.Objects;
 import java.util.concurrent.Callable;
+import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
-import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Future;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.FutureTask;
+import java.util.concurrent.SynchronousQueue;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
-import java.util.concurrent.TimeUnit;
-import javax.net.ssl.SSLHandshakeException;
 
+import static java.lang.String.format;
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
 import static java.util.concurrent.TimeUnit.NANOSECONDS;
+import static jdk.test.lib.Utils.adjustTimeout;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.expectThrows;
 
+public class LdapTimeoutTest {
+
+    // ------ configure test timeouts here ------
 
-abstract class LdapTest implements Callable {
+    /*
+     * Practical representation of an infinite timeout.
+     */
+    private static final long INFINITY_MILLIS = adjustTimeout(20_000);
+    /*
+     * The acceptable variation in timeout measurements.
+     */
+    private static final long TOLERANCE       = adjustTimeout( 3_500);
 
-    Hashtable env;
-    TestServer server;
-    ScheduledExecutorService killSwitchPool;
-    boolean passed = false;
-    private int HANGING_TEST_TIMEOUT = 20_000;
+    private static final long CONNECT_MILLIS  = adjustTimeout( 3_000);
+    private static final long READ_MILLIS     = adjustTimeout(10_000);
+
+    static {
+        // a series of checks to make sure this timeouts configuration is
+        // consistent and the timeouts do not overlap
 
-    public LdapTest (TestServer server, Hashtable env) {
-        this.server = server;
-        this.env = env;
+        assert (TOLERANCE >= 0);
+        // context creation
+        assert (2 * CONNECT_MILLIS + TOLERANCE < READ_MILLIS);
+        // context creation immediately followed by search
+        assert (2 * CONNECT_MILLIS + READ_MILLIS + TOLERANCE < INFINITY_MILLIS);
+    }
+
+    @BeforeTest
+    public void beforeTest() {
+        startAuxiliaryDiagnosticOutput();
     }
 
-    public LdapTest(TestServer server, Hashtable env,
-            ScheduledExecutorService killSwitchPool)
-    {
-        this(server, env);
-        this.killSwitchPool = killSwitchPool;
+    /*
+     * These are timeout tests and they are run in parallel to reduce the total
+     * amount of run time.
+     *
+     * Currently it doesn't seem possible to instruct JTREG to run TestNG test
+     * methods in parallel. That said, this JTREG test is still
+     * a "TestNG-flavored" test for the sake of having org.testng.Assert
+     * capability.
+     */
+    @Test
+    public void test() throws Exception {
+        List<Future<?>> futures = new ArrayList<>();
+        ExecutorService executorService = Executors.newCachedThreadPool();
+        try {
+            futures.add(executorService.submit(() -> { test1(); return null; }));
+            futures.add(executorService.submit(() -> { test2(); return null; }));
+            futures.add(executorService.submit(() -> { test3(); return null; }));
+            futures.add(executorService.submit(() -> { test4(); return null; }));
+            futures.add(executorService.submit(() -> { test5(); return null; }));
+            futures.add(executorService.submit(() -> { test6(); return null; }));
+            futures.add(executorService.submit(() -> { test7(); return null; }));
+        } finally {
+            executorService.shutdown();
+        }
+        int failedCount = 0;
+        for (var f : futures) {
+            try {
+                f.get();
+            } catch (ExecutionException e) {
+                failedCount++;
+                e.getCause().printStackTrace(System.out);
+            }
+        }
+        if (failedCount > 0)
+            throw new RuntimeException(failedCount + " (sub)tests failed");
+    }
+
+    static void test1() throws Exception {
+        Hashtable<Object, Object> env = new Hashtable<>();
+        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
+        // Here and in the other tests it's important to close the server as
+        // calling `thread.interrupt` from assertion may not be enough
+        // (depending on where the blocking call has stuck)
+        try (TestServer server = new NotBindableServer()) {
+            env.put(Context.PROVIDER_URL, urlTo(server));
+            server.start();
+            // Here and in the other tests joining done purely to reduce timing
+            // jitter. Commenting out or removing that should not make the test
+            // incorrect. (ServerSocket can accept connection as soon as it is
+            // bound, not need to call `accept` before that.)
+            server.starting().join();
+            assertIncompletion(INFINITY_MILLIS, () -> new InitialDirContext(env));
+        }
     }
 
-    public abstract void performOp(InitialContext ctx) throws NamingException;
-    public abstract void handleNamingException(
-        NamingException e, long start, long end);
+    static void test2() throws Exception {
+        Hashtable<Object, Object> env = new Hashtable<>();
+        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
+        env.put("com.sun.jndi.ldap.connect.timeout", String.valueOf(CONNECT_MILLIS));
+        try (TestServer server = new BindableButNotReadableServer()) {
+            env.put(Context.PROVIDER_URL, urlTo(server));
+            server.start();
+            server.starting().join();
+            InitialDirContext ctx = new InitialDirContext(env);
+            SearchControls scl = new SearchControls();
+            scl.setSearchScope(SearchControls.SUBTREE_SCOPE);
+            assertIncompletion(INFINITY_MILLIS,
+                               () -> ctx.search("ou=People,o=JNDITutorial", "(objectClass=*)", scl));
+        }
+    }
 
-    public void pass() {
-        this.passed = true;
+    static void test3() throws Exception {
+        Hashtable<Object, Object> env = new Hashtable<>();
+        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
+        try (TestServer server = new BindableButNotReadableServer()) {
+            env.put(Context.PROVIDER_URL, urlTo(server));
+            server.start();
+            server.starting().join();
+            InitialDirContext ctx = new InitialDirContext(env);
+            SearchControls scl = new SearchControls();
+            scl.setSearchScope(SearchControls.SUBTREE_SCOPE);
+            assertIncompletion(INFINITY_MILLIS,
+                               () -> ctx.search("ou=People,o=JNDITutorial", "(objectClass=*)", scl));
+        }
     }
 
-    public void fail() {
-        throw new RuntimeException("Test failed");
+    static void test4() throws Exception {
+        Hashtable<Object, Object> env = new Hashtable<>();
+        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
+        env.put("com.sun.jndi.ldap.connect.timeout", String.valueOf(CONNECT_MILLIS));
+        env.put("com.sun.jndi.ldap.read.timeout", String.valueOf(READ_MILLIS));
+        try (TestServer server = new NotBindableServer()) {
+            env.put(Context.PROVIDER_URL, urlTo(server));
+            server.start();
+            server.starting().join();
+            Assert.ThrowingRunnable completion =
+                    () -> assertCompletion(CONNECT_MILLIS,
+                                           2 * CONNECT_MILLIS + TOLERANCE,
+                                           () -> new InitialDirContext(env));
+            NamingException e = expectThrows(NamingException.class, completion);
+            String msg = e.getMessage();
+            assertTrue(msg != null && msg.contains("timeout")
+                               && msg.contains(String.valueOf(CONNECT_MILLIS)),
+                       msg);
+        }
     }
 
-    public void fail(Exception e) {
-        throw new RuntimeException("Test failed", e);
+    static void test5() throws Exception {
+        Hashtable<Object, Object> env = new Hashtable<>();
+        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
+        env.put("com.sun.jndi.ldap.connect.timeout", String.valueOf(CONNECT_MILLIS));
+        env.put("com.sun.jndi.ldap.read.timeout", String.valueOf(READ_MILLIS));
+        try (TestServer server = new BindableButNotReadableServer()) {
+            env.put(Context.PROVIDER_URL, urlTo(server));
+            server.start();
+            server.starting().join();
+            InitialDirContext ctx = new InitialDirContext(env);
+            SearchControls scl = new SearchControls();
+            scl.setSearchScope(SearchControls.SUBTREE_SCOPE);
+            Assert.ThrowingRunnable completion =
+                    () -> assertCompletion(READ_MILLIS,
+                                           READ_MILLIS + TOLERANCE,
+                                           () -> ctx.search("ou=People,o=JNDITutorial", "(objectClass=*)", scl));
+            NamingException e = expectThrows(NamingException.class, completion);
+            String msg = e.getMessage();
+            assertTrue(msg != null && msg.contains("timeout")
+                               && msg.contains(String.valueOf(READ_MILLIS)),
+                       msg);
+        }
     }
 
-    boolean shutItDown(InitialContext ctx) {
-        try {
-            if (ctx != null) ctx.close();
-            return true;
-        } catch (NamingException ex) {
-            return false;
+    static void test6() throws Exception {
+        Hashtable<Object, Object> env = new Hashtable<>();
+        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
+        env.put("com.sun.jndi.ldap.connect.timeout", String.valueOf(CONNECT_MILLIS));
+        env.put("com.sun.jndi.ldap.read.timeout", String.valueOf(READ_MILLIS));
+        try (TestServer server = new NotBindableServer()) {
+            env.put(Context.PROVIDER_URL, urlTo(server));
+            server.start();
+            server.starting().join();
+            Assert.ThrowingRunnable completion =
+                    () -> assertCompletion(CONNECT_MILLIS,
+                                           2 * CONNECT_MILLIS + TOLERANCE,
+                                           () -> new InitialDirContext(env));
+            NamingException e = expectThrows(NamingException.class, completion);
+            String msg = e.getMessage();
+            assertTrue(msg != null && msg.contains("timeout")
+                               && msg.contains(String.valueOf(CONNECT_MILLIS)),
+                       msg);
         }
     }
 
-    public Boolean call() {
-        InitialContext ctx = null;
-        ScheduledFuture killer = null;
-        long start = System.nanoTime();
-
-        try {
-            while(!server.accepting())
-                Thread.sleep(200); // allow the server to start up
-            Thread.sleep(200); // to be sure
-
-            // if this is a hanging test, scheduled a thread to
-            // interrupt after a certain time
-            if (killSwitchPool != null) {
-                final Thread current = Thread.currentThread();
-                killer = killSwitchPool.schedule(
-                    new Callable<Void>() {
-                        public Void call() throws Exception {
-                            current.interrupt();
-                            return null;
-                        }
-                    }, HANGING_TEST_TIMEOUT, MILLISECONDS);
-            }
-
-            env.put(Context.PROVIDER_URL, "ldap://localhost:" +
-                    server.getLocalPort());
-
-            try {
-                ctx = new InitialDirContext(env);
-                performOp(ctx);
-                fail();
-            } catch (NamingException e) {
-                long end = System.nanoTime();
-                System.out.println(this.getClass().toString() + " - elapsed: "
-                        + NANOSECONDS.toMillis(end - start));
-                handleNamingException(e, start, end);
-            } finally {
-                if (killer != null && !killer.isDone())
-                    killer.cancel(true);
-                shutItDown(ctx);
-                server.close();
-            }
-            return passed;
-        } catch (IOException|InterruptedException e) {
-            throw new RuntimeException(e);
+    static void test7() throws Exception {
+        // 8000487: Java JNDI connection library on ldap conn is
+        // not honoring configured timeout
+        Hashtable<Object, Object> env = new Hashtable<>();
+        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
+        env.put("com.sun.jndi.ldap.connect.timeout", String.valueOf(CONNECT_MILLIS));
+        env.put("com.sun.jndi.ldap.read.timeout", String.valueOf(READ_MILLIS));
+        env.put(Context.SECURITY_AUTHENTICATION, "simple");
+        env.put(Context.SECURITY_PRINCIPAL, "user");
+        env.put(Context.SECURITY_CREDENTIALS, "password");
+        try (TestServer server = new NotBindableServer()) {
+            env.put(Context.PROVIDER_URL, urlTo(server));
+            server.start();
+            server.starting().join();
+            Assert.ThrowingRunnable completion =
+                    () -> assertCompletion(CONNECT_MILLIS,
+                                           2 * CONNECT_MILLIS + TOLERANCE,
+                                           () -> new InitialDirContext(env));
+            NamingException e = expectThrows(NamingException.class, completion);
+            String msg = e.getMessage();
+            assertTrue(msg != null && msg.contains("timeout")
+                               && msg.contains(String.valueOf(CONNECT_MILLIS)),
+                       msg);
         }
     }
-}
-
-abstract class ReadServerTest extends LdapTest {
-
-    public ReadServerTest(Hashtable env) throws IOException {
-        super(new BindableServer(), env);
-    }
-
-    public ReadServerTest(Hashtable env,
-                          ScheduledExecutorService killSwitchPool)
-            throws IOException
-    {
-        super(new BindableServer(), env, killSwitchPool);
-    }
-
-    public void performOp(InitialContext ctx) throws NamingException {
-        SearchControls scl = new SearchControls();
-        scl.setSearchScope(SearchControls.SUBTREE_SCOPE);
-        NamingEnumeration<SearchResult> answer = ((InitialDirContext)ctx)
-            .search("ou=People,o=JNDITutorial", "(objectClass=*)", scl);
-    }
-}
-
-abstract class DeadServerTest extends LdapTest {
-
-    public DeadServerTest(Hashtable env) throws IOException {
-        super(new DeadServer(), env);
-    }
-
-    public DeadServerTest(Hashtable env,
-                          ScheduledExecutorService killSwitchPool)
-            throws IOException
-    {
-        super(new DeadServer(), env, killSwitchPool);
-    }
-
-    public void performOp(InitialContext ctx) throws NamingException {}
-}
-
-class DeadServerNoTimeoutTest extends DeadServerTest {
-
-    public DeadServerNoTimeoutTest(Hashtable env,
-                                   ScheduledExecutorService killSwitchPool)
-            throws IOException
-    {
-        super(env, killSwitchPool);
-    }
-
-    public void handleNamingException(NamingException e, long start, long end) {
-        if (e instanceof InterruptedNamingException) Thread.interrupted();
-
-        if (NANOSECONDS.toMillis(end - start) < LdapTimeoutTest.MIN_TIMEOUT) {
-            System.err.printf("DeadServerNoTimeoutTest fail: timeout should be " +
-                              "at least %s ms, actual time is %s ms%n",
-                              LdapTimeoutTest.MIN_TIMEOUT,
-                              NANOSECONDS.toMillis(end - start));
-            fail();
-        } else {
-            pass();
-        }
-    }
-}
-
-class DeadServerTimeoutTest extends DeadServerTest {
-
-    public DeadServerTimeoutTest(Hashtable env) throws IOException {
-        super(env);
-    }
 
-    public void handleNamingException(NamingException e, long start, long end)
-    {
-        // non SSL connect will timeout via readReply using connectTimeout
-        if (NANOSECONDS.toMillis(end - start) < 2_900) {
-            pass();
-        } else {
-            System.err.println("Fail: Waited too long");
-            fail();
-        }
-    }
-}
+    // ------ test stub servers ------
+
+    static class TestServer extends BaseLdapServer {
 
-
-class ReadServerNoTimeoutTest extends ReadServerTest {
+        private final CompletableFuture<Void> starting = new CompletableFuture<>();
 
-    public ReadServerNoTimeoutTest(Hashtable env,
-                                   ScheduledExecutorService killSwitchPool)
-            throws IOException
-    {
-        super(env, killSwitchPool);
-    }
-
-    public void handleNamingException(NamingException e, long start, long end) {
-        if (e instanceof InterruptedNamingException) Thread.interrupted();
+        TestServer() throws IOException { }
 
-        if (NANOSECONDS.toMillis(end - start) < LdapTimeoutTest.MIN_TIMEOUT) {
-            System.err.printf("ReadServerNoTimeoutTest fail: timeout should be " +
-                              "at least %s ms, actual time is %s ms%n",
-                              LdapTimeoutTest.MIN_TIMEOUT,
-                              NANOSECONDS.toMillis(end - start));
-            fail();
-        } else {
-            pass();
+        @Override
+        protected void beforeAcceptingConnections() {
+            starting.completeAsync(() -> null);
         }
-    }
-}
 
-class ReadServerTimeoutTest extends ReadServerTest {
-
-    public ReadServerTimeoutTest(Hashtable env) throws IOException {
-        super(env);
-    }
-
-    public void handleNamingException(NamingException e, long start, long end) {
-        System.out.println("ReadServerTimeoutTest: end-start=" + NANOSECONDS.toMillis(end - start));
-        if (NANOSECONDS.toMillis(end - start) < 2_500) {
-            fail();
-        } else {
-            pass();
+        public CompletableFuture<Void> starting() {
+            return starting.copy();
         }
     }
-}
+
+    static class BindableButNotReadableServer extends TestServer {
+
+        BindableButNotReadableServer() throws IOException { }
 
-class TestServer extends Thread {
-    ServerSocket serverSock;
-    boolean accepting = false;
-
-    public TestServer() throws IOException {
-        this.serverSock = new ServerSocket(0);
-        start();
-    }
+        private static final byte[] bindResponse = {
+                0x30, 0x0C, 0x02, 0x01, 0x01, 0x61, 0x07, 0x0A,
+                0x01, 0x00, 0x04, 0x00, 0x04, 0x00
+        };
 
-    public int getLocalPort() {
-        return serverSock.getLocalPort();
-    }
-
-    public boolean accepting() {
-        return accepting;
-    }
-
-    public void close() throws IOException {
-        serverSock.close();
-    }
-}
-
-class BindableServer extends TestServer {
-
-    public BindableServer() throws IOException {
-        super();
+        @Override
+        protected void handleRequest(Socket socket,
+                                     LdapMessage msg,
+                                     OutputStream out)
+                throws IOException {
+            switch (msg.getOperation()) {
+                case BIND_REQUEST:
+                    out.write(bindResponse);
+                    out.flush();
+                default:
+                    break;
+            }
+        }
     }
 
-    private byte[] bindResponse = {
-        0x30, 0x0C, 0x02, 0x01, 0x01, 0x61, 0x07, 0x0A,
-        0x01, 0x00, 0x04, 0x00, 0x04, 0x00
-    };
+    static class NotBindableServer extends TestServer {
 
-    public void run() {
-        try {
-            accepting = true;
-            Socket socket = serverSock.accept();
-            InputStream in = socket.getInputStream();
-            OutputStream out = socket.getOutputStream();
-
-            // Read the LDAP BindRequest
-            while (in.read() != -1) {
-                in.skip(in.available());
-                break;
-            }
+        NotBindableServer() throws IOException { }
 
-            // Write an LDAP BindResponse
-            out.write(bindResponse);
-            out.flush();
-        } catch (IOException e) {
-            // ignore
-        }
-    }
-}
-
-class DeadServer extends TestServer {
-
-    public DeadServer() throws IOException {
-        super();
-    }
-
-    public void run() {
-        while(true) {
+        @Override
+        protected void beforeConnectionHandled(Socket socket) {
             try {
-                accepting = true;
-                Socket socket = serverSock.accept();
-            } catch (Exception e) {
-                break;
+                TimeUnit.DAYS.sleep(Integer.MAX_VALUE);
+            } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
             }
         }
     }
-}
 
-public class LdapTimeoutTest {
+    // ------ timeouts check utilities ------
 
-    private static final ExecutorService testPool =
-        Executors.newFixedThreadPool(3);
-    private static final ScheduledExecutorService killSwitchPool =
-        Executors.newScheduledThreadPool(3);
-    public static int MIN_TIMEOUT = 18_000;
+    /*
+     * Asserts that the specified executable yields a result or an exception
+     * within the specified time frame. Interrupts the executable
+     * unconditionally.
+     *
+     * If the executable yields a result or an exception within the specified
+     * time frame, the result will be returned and the exception will be
+     * rethrown respectively in a transparent fashion as if the executable was
+     * executed directly.
+     */
+    public static <T> T assertCompletion(long loMillis,
+                                         long hiMillis,
+                                         Callable<T> code)
+            throws Throwable {
+        if (loMillis < 0 || hiMillis < 0 || loMillis > hiMillis) {
+            throw new IllegalArgumentException("loMillis=" + loMillis +
+                                                       ", hiMillis=" + hiMillis);
+        }
+        Objects.requireNonNull(code);
 
-    static Hashtable createEnv() {
-        Hashtable env = new Hashtable(11);
-        env.put(Context.INITIAL_CONTEXT_FACTORY,
-            "com.sun.jndi.ldap.LdapCtxFactory");
-        return env;
-    }
+        // this queue acts both as an exchange point and a barrier
+        SynchronousQueue<Long> startTime = new SynchronousQueue<>();
+
+        Callable<T> wrappedTask = () -> {
+            // by the time this value reaches the "stopwatch" thread it might be
+            // well outdated and that's okay, we will adjust the wait time
+            startTime.put(System.nanoTime());
+            return code.call();
+        };
 
-    public static void main(String[] args) throws Exception {
+        FutureTask<T> task = new FutureTask<>(wrappedTask);
+        Thread t = new Thread(task);
+        t.start();
 
-        InitialContext ctx = null;
-        List<Future> results = new ArrayList<>();
+        final long startNanos;
+        try {
+            startNanos = startTime.take(); // (1) wait for the initial time mark
+        } catch (Throwable e) {
+            t.interrupt();
+            throw e;
+        }
+
+        final long waitTime = hiMillis -
+                NANOSECONDS.toMillis(System.nanoTime() - startNanos); // (2) adjust wait time
 
         try {
-            // run the DeadServerTest with no timeouts set
-            // this should get stuck indefinitely, so we need to kill
-            // it after a timeout
-            System.out.println("Running connect timeout test with 20s kill switch");
-            Hashtable env = createEnv();
-            results.add(
-                    testPool.submit(new DeadServerNoTimeoutTest(env, killSwitchPool)));
-
-            // run the ReadServerTest with connect timeout set
-            // this should get stuck indefinitely so we need to kill
-            // it after a timeout
-            System.out.println("Running read timeout test with 10ms connect timeout & 20s kill switch");
-            Hashtable env1 = createEnv();
-            env1.put("com.sun.jndi.ldap.connect.timeout", "10");
-            results.add(testPool.submit(
-                    new ReadServerNoTimeoutTest(env1, killSwitchPool)));
-
-            // run the ReadServerTest with no timeouts set
-            // this should get stuck indefinitely, so we need to kill
-            // it after a timeout
-            System.out.println("Running read timeout test with 20s kill switch");
-            Hashtable env2 = createEnv();
-            results.add(testPool.submit(
-                    new ReadServerNoTimeoutTest(env2, killSwitchPool)));
-
-            // run the DeadServerTest with connect / read timeouts set
-            // this should exit after the connect timeout expires
-            System.out.println("Running connect timeout test with 10ms connect timeout, 3000ms read timeout");
-            Hashtable env3 = createEnv();
-            env3.put("com.sun.jndi.ldap.connect.timeout", "10");
-            env3.put("com.sun.jndi.ldap.read.timeout", "3000");
-            results.add(testPool.submit(new DeadServerTimeoutTest(env3)));
-
-
-            // run the ReadServerTest with connect / read timeouts set
-            // this should exit after the connect timeout expires
-            //
-            // NOTE: commenting this test out as it is failing intermittently.
-            //
-            // System.out.println("Running read timeout test with 10ms connect timeout, 3000ms read timeout");
-            // Hashtable env4 = createEnv();
-            // env4.put("com.sun.jndi.ldap.connect.timeout", "10");
-            // env4.put("com.sun.jndi.ldap.read.timeout", "3000");
-            // results.add(testPool.submit(new ReadServerTimeoutTest(env4)));
-
-            // run the DeadServerTest with connect timeout set
-            // this should exit after the connect timeout expires
-            System.out.println("Running connect timeout test with 10ms connect timeout");
-            Hashtable env5 = createEnv();
-            env5.put("com.sun.jndi.ldap.connect.timeout", "10");
-            results.add(testPool.submit(new DeadServerTimeoutTest(env5)));
-
-            // 8000487: Java JNDI connection library on ldap conn is
-            // not honoring configured timeout
-            System.out.println("Running simple auth connection test");
-            Hashtable env6 = createEnv();
-            env6.put("com.sun.jndi.ldap.connect.timeout", "10");
-            env6.put("com.sun.jndi.ldap.read.timeout", "3000");
-            env6.put(Context.SECURITY_AUTHENTICATION, "simple");
-            env6.put(Context.SECURITY_PRINCIPAL, "user");
-            env6.put(Context.SECURITY_CREDENTIALS, "password");
-            results.add(testPool.submit(new DeadServerTimeoutTest(env6)));
-
-            boolean testFailed = false;
-            for (Future test : results) {
-                while (!test.isDone()) {
-                    if ((Boolean) test.get() == false)
-                        testFailed = true;
-                }
+            T r = task.get(waitTime, MILLISECONDS); // (3) wait for the task to complete
+            long elapsed = NANOSECONDS.toMillis(System.nanoTime() - startNanos);
+            if (elapsed < loMillis || elapsed > hiMillis) {
+                throw new RuntimeException(format(
+                        "After %s ms. (waitTime %s ms.) returned result '%s'", elapsed, waitTime, r));
             }
-
-            if (testFailed) {
-                throw new AssertionError("some tests failed");
+            return r;
+        } catch (ExecutionException e) {
+            long elapsed = NANOSECONDS.toMillis(System.nanoTime() - startNanos);
+            if (elapsed < loMillis || elapsed > hiMillis) {
+                throw new RuntimeException(format(
+                        "After %s ms. (waitTime %s ms.) thrown exception", elapsed, waitTime), e);
             }
-
+            throw e.getCause();
+        } catch (TimeoutException e) {
+            // We trust timed get not to throw TimeoutException prematurely
+            // (i.e. before the wait time elapses)
+            long elapsed = NANOSECONDS.toMillis(System.nanoTime() - startNanos);
+            throw new RuntimeException(format(
+                    "After %s ms. (waitTime %s ms.) is incomplete", elapsed, waitTime));
         } finally {
-            LdapTimeoutTest.killSwitchPool.shutdown();
-            LdapTimeoutTest.testPool.shutdown();
+            t.interrupt();
         }
     }
 
+    /*
+     * Asserts that the specified executable yields no result and no exception
+     * for at least the specified amount of time. Interrupts the executable
+     * unconditionally.
+     */
+    public static void assertIncompletion(long millis, Callable<?> code)
+            throws Exception
+    {
+        if (millis < 0) {
+            throw new IllegalArgumentException("millis=" + millis);
+        }
+        Objects.requireNonNull(code);
+
+        // this queue acts both as an exchange point and a barrier
+        SynchronousQueue<Long> startTime = new SynchronousQueue<>();
+
+        Callable<?> wrappedTask = () -> {
+            // by the time this value reaches the "stopwatch" thread it might be
+            // well outdated and that's okay, we will adjust the wait time
+            startTime.put(System.nanoTime());
+            return code.call();
+        };
+
+        FutureTask<?> task = new FutureTask<>(wrappedTask);
+        Thread t = new Thread(task);
+        t.start();
+
+        final long startNanos;
+        try {
+            startNanos = startTime.take(); // (1) wait for the initial time mark
+        } catch (Throwable e) {
+            t.interrupt();
+            throw e;
+        }
+
+        final long waitTime = millis -
+                NANOSECONDS.toMillis(System.nanoTime() - startNanos); // (2) adjust wait time
+
+        try {
+            Object r = task.get(waitTime, MILLISECONDS); // (3) wait for the task to complete
+            long elapsed = NANOSECONDS.toMillis(System.nanoTime() - startNanos);
+            if (elapsed < waitTime) {
+                throw new RuntimeException(format(
+                        "After %s ms. (waitTime %s ms.) returned result '%s'", elapsed, waitTime, r));
+            }
+        } catch (ExecutionException e) {
+            long elapsed = NANOSECONDS.toMillis(System.nanoTime() - startNanos);
+            if (elapsed < waitTime) {
+                throw new RuntimeException(format(
+                        "After %s ms. (waitTime %s ms.) thrown exception", elapsed, waitTime), e);
+            }
+        } catch (TimeoutException expected) {
+        } finally {
+            t.interrupt();
+        }
+    }
+
+    // ------ miscellaneous utilities ------
+
+    private static String urlTo(TestServer server) {
+        String hostAddress = server.getInetAddress().getHostAddress();
+        String addr;
+        if (hostAddress.contains(":")) { // IPv6
+            addr = '[' + hostAddress + ']';
+        } else {                         // IPv4
+            addr = hostAddress;
+        }
+        return "ldap://" + addr + ":" + server.getPort();
+    }
+
+    /*
+     * A diagnostic aid that might help with debugging timeout issues. The idea
+     * is to continuously measure accuracy and responsiveness of the system that
+     * runs this test. If the system is overwhelmed (with something else), it
+     * might affect the test run. At the very least we will have traces of that
+     * in the logs.
+     *
+     * This utility does not automatically scale up test timeouts, it simply
+     * gathers information.
+     */
+    private static void startAuxiliaryDiagnosticOutput() {
+        System.out.printf("Starting diagnostic output (probe)%n");
+        Thread t = new Thread(() -> {
+            for (int i = 0; ; i = ((i % 20) + 1)) {
+                // 500, 1_000, 1_500, ..., 9_500, 10_000, 500, 1_000, ...
+                long expected = i * 500;
+                long start = System.nanoTime();
+                try {
+                    MILLISECONDS.sleep(expected);
+                } catch (InterruptedException e) {
+                    return;
+                }
+                long stop = System.nanoTime();
+                long actual = NANOSECONDS.toMillis(stop - start);
+                System.out.printf("(probe) expected [ms.]: %s, actual [ms.]: %s%n",
+                                  expected, actual);
+
+            }
+        }, "probe");
+        t.setDaemon(true);
+        t.start();
+    }
 }
-
--- a/test/jdk/com/sun/jndi/ldap/lib/BaseLdapServer.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/com/sun/jndi/ldap/lib/BaseLdapServer.java	Tue Sep 24 15:19:35 2019 -0400
@@ -35,7 +35,6 @@
 import java.util.Objects;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
-import java.util.concurrent.RejectedExecutionException;
 
 import static java.lang.System.Logger.Level.INFO;
 
@@ -44,6 +43,7 @@
  *
  * Override the following methods to provide customized behavior
  *
+ *     * beforeAcceptingConnections
  *     * beforeConnectionHandled
  *     * handleRequest
  *
@@ -83,6 +83,7 @@
         logger().log(INFO, "Server is accepting connections at port {0}",
                      getPort());
         try {
+            beforeAcceptingConnections();
             while (isRunning()) {
                 Socket socket = serverSocket.accept();
                 logger().log(INFO, "Accepted new connection at {0}", socket);
@@ -97,10 +98,10 @@
                 }
                 connectionsPool.submit(() -> handleConnection(socket));
             }
-        } catch (IOException | RejectedExecutionException e) {
+        } catch (Throwable t) {
             if (isRunning()) {
                 throw new RuntimeException(
-                        "Unexpected exception while accepting connections", e);
+                        "Unexpected exception while accepting connections", t);
             }
         } finally {
             logger().log(INFO, "Server stopped accepting connections at port {0}",
@@ -109,6 +110,13 @@
     }
 
     /*
+     * Called once immediately preceding the server accepting connections.
+     *
+     * Override to customize the behavior.
+     */
+    protected void beforeAcceptingConnections() { }
+
+    /*
      * A "Template Method" describing how a connection (represented by a socket)
      * is handled.
      *
@@ -240,12 +248,25 @@
     /**
      * Returns the local port this server is listening at.
      *
+     * This method can be called at any time.
+     *
      * @return the port this server is listening at
      */
     public int getPort() {
         return serverSocket.getLocalPort();
     }
 
+    /**
+     * Returns the address this server is listening at.
+     *
+     * This method can be called at any time.
+     *
+     * @return the address
+     */
+    public InetAddress getInetAddress() {
+        return serverSocket.getInetAddress();
+    }
+
     /*
      * Returns a flag to indicate whether this server is running or not.
      *
--- a/test/jdk/java/awt/GradientPaint/LinearColorSpaceGradientTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/awt/GradientPaint/LinearColorSpaceGradientTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -30,7 +30,7 @@
  * @test
  * @key headful
  * @bug 8023483
- * @summary tests wether the colorspace-parameter is applied correctly when
+ * @summary tests whether the colorspace-parameter is applied correctly when
  *          creating a gradient.
  * @author ceisserer
  */
--- a/test/jdk/java/awt/Graphics2D/DrawString/XRenderElt254TextTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/awt/Graphics2D/DrawString/XRenderElt254TextTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -33,7 +33,7 @@
  * @test
  * @key headful
  * @bug 8028722
- * @summary tests wether drawString with 254 characters causes the xrender
+ * @summary tests whether drawString with 254 characters causes the xrender
  *          pipeline to hang.
  * @author ceisserer
  */
--- a/test/jdk/java/net/httpclient/websocket/Abort.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/net/httpclient/websocket/Abort.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,6 @@
  *       Abort
  */
 
-import org.testng.annotations.AfterTest;
 import org.testng.annotations.Test;
 
 import java.io.IOException;
@@ -56,38 +55,35 @@
     private static final Class<IllegalArgumentException> IAE = IllegalArgumentException.class;
     private static final Class<IOException> IOE = IOException.class;
 
-    private DummyWebSocketServer server;
-    private WebSocket webSocket;
-
-    @AfterTest
-    public void cleanup() {
-        server.close();
-        webSocket.abort();
-    }
 
     @Test
     public void onOpenThenAbort() throws Exception {
         int[] bytes = new int[]{
                 0x88, 0x00, // opcode=close
         };
-        server = Support.serverWithCannedData(bytes);
-        server.open();
-        // messages are available
-        MockListener listener = new MockListener() {
-            @Override
-            protected void onOpen0(WebSocket webSocket) {
-                // unbounded request
-                webSocket.request(Long.MAX_VALUE);
+        try (var server = Support.serverWithCannedData(bytes)) {
+            server.open();
+            // messages are available
+            MockListener listener = new MockListener() {
+                @Override
+                protected void onOpen0(WebSocket webSocket) {
+                    // unbounded request
+                    webSocket.request(Long.MAX_VALUE);
+                    webSocket.abort();
+                }
+            };
+            var webSocket = newHttpClient().newWebSocketBuilder()
+                    .buildAsync(server.getURI(), listener)
+                    .join();
+            try {
+                TimeUnit.SECONDS.sleep(5);
+                List<MockListener.Invocation> inv = listener.invocationsSoFar();
+                // no more invocations after onOpen as WebSocket was aborted
+                assertEquals(inv, List.of(MockListener.Invocation.onOpen(webSocket)));
+            } finally {
                 webSocket.abort();
             }
-        };
-        webSocket = newHttpClient().newWebSocketBuilder()
-                .buildAsync(server.getURI(), listener)
-                .join();
-        TimeUnit.SECONDS.sleep(5);
-        List<MockListener.Invocation> inv = listener.invocationsSoFar();
-        // no more invocations after onOpen as WebSocket was aborted
-        assertEquals(inv, List.of(MockListener.Invocation.onOpen(webSocket)));
+        }
     }
 
     @Test
@@ -96,33 +92,38 @@
                 0x81, 0x00, // opcode=text, fin=true
                 0x88, 0x00, // opcode=close
         };
-        server = Support.serverWithCannedData(bytes);
-        server.open();
-        MockListener listener = new MockListener() {
-            @Override
-            protected void onOpen0(WebSocket webSocket) {
-                // unbounded request
-                webSocket.request(Long.MAX_VALUE);
-            }
+        try (var server = Support.serverWithCannedData(bytes)) {
+            server.open();
+            MockListener listener = new MockListener() {
+                @Override
+                protected void onOpen0(WebSocket webSocket) {
+                    // unbounded request
+                    webSocket.request(Long.MAX_VALUE);
+                }
 
-            @Override
-            protected CompletionStage<?> onText0(WebSocket webSocket,
-                                                 CharSequence message,
-                                                 boolean last) {
+                @Override
+                protected CompletionStage<?> onText0(WebSocket webSocket,
+                                                     CharSequence message,
+                                                     boolean last) {
+                    webSocket.abort();
+                    return super.onText0(webSocket, message, last);
+                }
+            };
+            var webSocket = newHttpClient().newWebSocketBuilder()
+                    .buildAsync(server.getURI(), listener)
+                    .join();
+            try {
+                TimeUnit.SECONDS.sleep(5);
+                List<MockListener.Invocation> inv = listener.invocationsSoFar();
+                // no more invocations after onOpen, onBinary as WebSocket was aborted
+                List<MockListener.Invocation> expected = List.of(
+                        MockListener.Invocation.onOpen(webSocket),
+                        MockListener.Invocation.onText(webSocket, "", true));
+                assertEquals(inv, expected);
+            } finally {
                 webSocket.abort();
-                return super.onText0(webSocket, message, last);
             }
-        };
-        webSocket = newHttpClient().newWebSocketBuilder()
-                .buildAsync(server.getURI(), listener)
-                .join();
-        TimeUnit.SECONDS.sleep(5);
-        List<MockListener.Invocation> inv = listener.invocationsSoFar();
-        // no more invocations after onOpen, onBinary as WebSocket was aborted
-        List<MockListener.Invocation> expected = List.of(
-                MockListener.Invocation.onOpen(webSocket),
-                MockListener.Invocation.onText(webSocket, "", true));
-        assertEquals(inv, expected);
+        }
     }
 
     @Test
@@ -131,33 +132,38 @@
                 0x82, 0x00, // opcode=binary, fin=true
                 0x88, 0x00, // opcode=close
         };
-        server = Support.serverWithCannedData(bytes);
-        server.open();
-        MockListener listener = new MockListener() {
-            @Override
-            protected void onOpen0(WebSocket webSocket) {
-                // unbounded request
-                webSocket.request(Long.MAX_VALUE);
-            }
+        try (var server = Support.serverWithCannedData(bytes)) {
+            server.open();
+            MockListener listener = new MockListener() {
+                @Override
+                protected void onOpen0(WebSocket webSocket) {
+                    // unbounded request
+                    webSocket.request(Long.MAX_VALUE);
+                }
 
-            @Override
-            protected CompletionStage<?> onBinary0(WebSocket webSocket,
-                                                   ByteBuffer message,
-                                                   boolean last) {
+                @Override
+                protected CompletionStage<?> onBinary0(WebSocket webSocket,
+                                                       ByteBuffer message,
+                                                       boolean last) {
+                    webSocket.abort();
+                    return super.onBinary0(webSocket, message, last);
+                }
+            };
+            var webSocket = newHttpClient().newWebSocketBuilder()
+                    .buildAsync(server.getURI(), listener)
+                    .join();
+            try {
+                TimeUnit.SECONDS.sleep(5);
+                List<MockListener.Invocation> inv = listener.invocationsSoFar();
+                // no more invocations after onOpen, onBinary as WebSocket was aborted
+                List<MockListener.Invocation> expected = List.of(
+                        MockListener.Invocation.onOpen(webSocket),
+                        MockListener.Invocation.onBinary(webSocket, ByteBuffer.allocate(0), true));
+                assertEquals(inv, expected);
+            } finally {
                 webSocket.abort();
-                return super.onBinary0(webSocket, message, last);
             }
-        };
-        webSocket = newHttpClient().newWebSocketBuilder()
-                .buildAsync(server.getURI(), listener)
-                .join();
-        TimeUnit.SECONDS.sleep(5);
-        List<MockListener.Invocation> inv = listener.invocationsSoFar();
-        // no more invocations after onOpen, onBinary as WebSocket was aborted
-        List<MockListener.Invocation> expected = List.of(
-                MockListener.Invocation.onOpen(webSocket),
-                MockListener.Invocation.onBinary(webSocket, ByteBuffer.allocate(0), true));
-        assertEquals(inv, expected);
+        }
     }
 
     @Test
@@ -166,32 +172,37 @@
                 0x89, 0x00, // opcode=ping
                 0x88, 0x00, // opcode=close
         };
-        server = Support.serverWithCannedData(bytes);
-        server.open();
-        MockListener listener = new MockListener() {
-            @Override
-            protected void onOpen0(WebSocket webSocket) {
-                // unbounded request
-                webSocket.request(Long.MAX_VALUE);
-            }
+        try (var server = Support.serverWithCannedData(bytes)) {
+            server.open();
+            MockListener listener = new MockListener() {
+                @Override
+                protected void onOpen0(WebSocket webSocket) {
+                    // unbounded request
+                    webSocket.request(Long.MAX_VALUE);
+                }
 
-            @Override
-            protected CompletionStage<?> onPing0(WebSocket webSocket,
-                                                 ByteBuffer message) {
+                @Override
+                protected CompletionStage<?> onPing0(WebSocket webSocket,
+                                                     ByteBuffer message) {
+                    webSocket.abort();
+                    return super.onPing0(webSocket, message);
+                }
+            };
+            var webSocket = newHttpClient().newWebSocketBuilder()
+                    .buildAsync(server.getURI(), listener)
+                    .join();
+            try {
+                TimeUnit.SECONDS.sleep(5);
+                List<MockListener.Invocation> inv = listener.invocationsSoFar();
+                // no more invocations after onOpen, onPing as WebSocket was aborted
+                List<MockListener.Invocation> expected = List.of(
+                        MockListener.Invocation.onOpen(webSocket),
+                        MockListener.Invocation.onPing(webSocket, ByteBuffer.allocate(0)));
+                assertEquals(inv, expected);
+            } finally {
                 webSocket.abort();
-                return super.onPing0(webSocket, message);
             }
-        };
-        webSocket = newHttpClient().newWebSocketBuilder()
-                .buildAsync(server.getURI(), listener)
-                .join();
-        TimeUnit.SECONDS.sleep(5);
-        List<MockListener.Invocation> inv = listener.invocationsSoFar();
-        // no more invocations after onOpen, onPing as WebSocket was aborted
-        List<MockListener.Invocation> expected = List.of(
-                MockListener.Invocation.onOpen(webSocket),
-                MockListener.Invocation.onPing(webSocket, ByteBuffer.allocate(0)));
-        assertEquals(inv, expected);
+        }
     }
 
     @Test
@@ -200,32 +211,37 @@
                 0x8a, 0x00, // opcode=pong
                 0x88, 0x00, // opcode=close
         };
-        server = Support.serverWithCannedData(bytes);
-        server.open();
-        MockListener listener = new MockListener() {
-            @Override
-            protected void onOpen0(WebSocket webSocket) {
-                // unbounded request
-                webSocket.request(Long.MAX_VALUE);
-            }
+        try (var server = Support.serverWithCannedData(bytes)) {
+            server.open();
+            MockListener listener = new MockListener() {
+                @Override
+                protected void onOpen0(WebSocket webSocket) {
+                    // unbounded request
+                    webSocket.request(Long.MAX_VALUE);
+                }
 
-            @Override
-            protected CompletionStage<?> onPong0(WebSocket webSocket,
-                                                 ByteBuffer message) {
+                @Override
+                protected CompletionStage<?> onPong0(WebSocket webSocket,
+                                                     ByteBuffer message) {
+                    webSocket.abort();
+                    return super.onPong0(webSocket, message);
+                }
+            };
+            var webSocket = newHttpClient().newWebSocketBuilder()
+                    .buildAsync(server.getURI(), listener)
+                    .join();
+            try {
+                TimeUnit.SECONDS.sleep(5);
+                List<MockListener.Invocation> inv = listener.invocationsSoFar();
+                // no more invocations after onOpen, onPong as WebSocket was aborted
+                List<MockListener.Invocation> expected = List.of(
+                        MockListener.Invocation.onOpen(webSocket),
+                        MockListener.Invocation.onPong(webSocket, ByteBuffer.allocate(0)));
+                assertEquals(inv, expected);
+            } finally {
                 webSocket.abort();
-                return super.onPong0(webSocket, message);
             }
-        };
-        webSocket = newHttpClient().newWebSocketBuilder()
-                .buildAsync(server.getURI(), listener)
-                .join();
-        TimeUnit.SECONDS.sleep(5);
-        List<MockListener.Invocation> inv = listener.invocationsSoFar();
-        // no more invocations after onOpen, onPong as WebSocket was aborted
-        List<MockListener.Invocation> expected = List.of(
-                MockListener.Invocation.onOpen(webSocket),
-                MockListener.Invocation.onPong(webSocket, ByteBuffer.allocate(0)));
-        assertEquals(inv, expected);
+        }
     }
 
     @Test
@@ -234,33 +250,38 @@
                 0x88, 0x00, // opcode=close
                 0x8a, 0x00, // opcode=pong
         };
-        server = Support.serverWithCannedData(bytes);
-        server.open();
-        MockListener listener = new MockListener() {
-            @Override
-            protected void onOpen0(WebSocket webSocket) {
-                // unbounded request
-                webSocket.request(Long.MAX_VALUE);
-            }
+        try (var server = Support.serverWithCannedData(bytes)) {
+            server.open();
+            MockListener listener = new MockListener() {
+                @Override
+                protected void onOpen0(WebSocket webSocket) {
+                    // unbounded request
+                    webSocket.request(Long.MAX_VALUE);
+                }
 
-            @Override
-            protected CompletionStage<?> onClose0(WebSocket webSocket,
-                                                  int statusCode,
-                                                  String reason) {
+                @Override
+                protected CompletionStage<?> onClose0(WebSocket webSocket,
+                                                      int statusCode,
+                                                      String reason) {
+                    webSocket.abort();
+                    return super.onClose0(webSocket, statusCode, reason);
+                }
+            };
+            var webSocket = newHttpClient().newWebSocketBuilder()
+                    .buildAsync(server.getURI(), listener)
+                    .join();
+            try {
+                TimeUnit.SECONDS.sleep(5);
+                List<MockListener.Invocation> inv = listener.invocationsSoFar();
+                // no more invocations after onOpen, onClose
+                List<MockListener.Invocation> expected = List.of(
+                        MockListener.Invocation.onOpen(webSocket),
+                        MockListener.Invocation.onClose(webSocket, 1005, ""));
+                assertEquals(inv, expected);
+            } finally {
                 webSocket.abort();
-                return super.onClose0(webSocket, statusCode, reason);
             }
-        };
-        webSocket = newHttpClient().newWebSocketBuilder()
-                .buildAsync(server.getURI(), listener)
-                .join();
-        TimeUnit.SECONDS.sleep(5);
-        List<MockListener.Invocation> inv = listener.invocationsSoFar();
-        // no more invocations after onOpen, onClose
-        List<MockListener.Invocation> expected = List.of(
-                MockListener.Invocation.onOpen(webSocket),
-                MockListener.Invocation.onClose(webSocket, 1005, ""));
-        assertEquals(inv, expected);
+        }
     }
 
     @Test
@@ -271,32 +292,37 @@
         int[] bytes = new int[badPingHeader.length + 128 + closeMessage.length];
         System.arraycopy(badPingHeader, 0, bytes, 0, badPingHeader.length);
         System.arraycopy(closeMessage, 0, bytes, badPingHeader.length + 128, closeMessage.length);
-        server = Support.serverWithCannedData(bytes);
-        server.open();
-        MockListener listener = new MockListener() {
-            @Override
-            protected void onOpen0(WebSocket webSocket) {
-                // unbounded request
-                webSocket.request(Long.MAX_VALUE);
-            }
+        try (var server = Support.serverWithCannedData(bytes)) {
+            server.open();
+            MockListener listener = new MockListener() {
+                @Override
+                protected void onOpen0(WebSocket webSocket) {
+                    // unbounded request
+                    webSocket.request(Long.MAX_VALUE);
+                }
 
-            @Override
-            protected void onError0(WebSocket webSocket, Throwable error) {
+                @Override
+                protected void onError0(WebSocket webSocket, Throwable error) {
+                    webSocket.abort();
+                    super.onError0(webSocket, error);
+                }
+            };
+            var webSocket = newHttpClient().newWebSocketBuilder()
+                    .buildAsync(server.getURI(), listener)
+                    .join();
+            try {
+                TimeUnit.SECONDS.sleep(5);
+                List<MockListener.Invocation> inv = listener.invocationsSoFar();
+                // no more invocations after onOpen, onError
+                List<MockListener.Invocation> expected = List.of(
+                        MockListener.Invocation.onOpen(webSocket),
+                        MockListener.Invocation.onError(webSocket, ProtocolException.class));
+                System.out.println("actual invocations:" + Arrays.toString(inv.toArray()));
+                assertEquals(inv, expected);
+            } finally {
                 webSocket.abort();
-                super.onError0(webSocket, error);
             }
-        };
-        webSocket = newHttpClient().newWebSocketBuilder()
-                .buildAsync(server.getURI(), listener)
-                .join();
-        TimeUnit.SECONDS.sleep(5);
-        List<MockListener.Invocation> inv = listener.invocationsSoFar();
-        // no more invocations after onOpen, onError
-        List<MockListener.Invocation> expected = List.of(
-                MockListener.Invocation.onOpen(webSocket),
-                MockListener.Invocation.onError(webSocket, ProtocolException.class));
-        System.out.println("actual invocations:" + Arrays.toString(inv.toArray()));
-        assertEquals(inv, expected);
+        }
     }
 
     @Test
@@ -352,65 +378,70 @@
                 0x82, 0x00, // opcode=binary, fin=true
                 0x88, 0x00, // opcode=close
         };
-        server = Support.serverWithCannedData(bytes);
-        server.open();
+        try (var server = Support.serverWithCannedData(bytes)) {
+            server.open();
 
-        WebSocket ws = newHttpClient()
-                .newWebSocketBuilder()
-                .buildAsync(server.getURI(), listener)
-                .join();
-        for (int i = 0; i < 3; i++) {
-            System.out.printf("iteration #%s%n", i);
-            // after the first abort() each consecutive one must be a no-op,
-            // moreover, query methods should continue to return consistent
-            // values
-            for (int j = 0; j < 3; j++) {
-                System.out.printf("abort #%s%n", j);
+            WebSocket ws = newHttpClient()
+                    .newWebSocketBuilder()
+                    .buildAsync(server.getURI(), listener)
+                    .join();
+            try {
+                for (int i = 0; i < 3; i++) {
+                    System.out.printf("iteration #%s%n", i);
+                    // after the first abort() each consecutive one must be a no-op,
+                    // moreover, query methods should continue to return consistent
+                    // values
+                    for (int j = 0; j < 3; j++) {
+                        System.out.printf("abort #%s%n", j);
+                        ws.abort();
+                        assertTrue(ws.isInputClosed());
+                        assertTrue(ws.isOutputClosed());
+                        assertEquals(ws.getSubprotocol(), "");
+                    }
+                    // at this point valid requests MUST be a no-op:
+                    for (int j = 0; j < 3; j++) {
+                        System.out.printf("request #%s%n", j);
+                        ws.request(1);
+                        ws.request(2);
+                        ws.request(8);
+                        ws.request(Integer.MAX_VALUE);
+                        ws.request(Long.MAX_VALUE);
+                        // invalid requests MUST throw IAE:
+                        assertThrows(IAE, () -> ws.request(Integer.MIN_VALUE));
+                        assertThrows(IAE, () -> ws.request(Long.MIN_VALUE));
+                        assertThrows(IAE, () -> ws.request(-1));
+                        assertThrows(IAE, () -> ws.request(0));
+                    }
+                }
+                // even though there is a bunch of messages readily available on the
+                // wire we shouldn't have received any of them as we aborted before
+                // the first request
+                try {
+                    messageReceived.get(5, TimeUnit.SECONDS);
+                    fail();
+                } catch (TimeoutException expected) {
+                    System.out.println("Finished waiting");
+                }
+                for (int i = 0; i < 3; i++) {
+                    System.out.printf("send #%s%n", i);
+                    Support.assertFails(IOE, ws.sendText("text!", false));
+                    Support.assertFails(IOE, ws.sendText("text!", true));
+                    Support.assertFails(IOE, ws.sendBinary(ByteBuffer.allocate(16), false));
+                    Support.assertFails(IOE, ws.sendBinary(ByteBuffer.allocate(16), true));
+                    Support.assertFails(IOE, ws.sendPing(ByteBuffer.allocate(16)));
+                    Support.assertFails(IOE, ws.sendPong(ByteBuffer.allocate(16)));
+                    Support.assertFails(IOE, ws.sendClose(NORMAL_CLOSURE, "a reason"));
+                    assertThrows(NPE, () -> ws.sendText(null, false));
+                    assertThrows(NPE, () -> ws.sendText(null, true));
+                    assertThrows(NPE, () -> ws.sendBinary(null, false));
+                    assertThrows(NPE, () -> ws.sendBinary(null, true));
+                    assertThrows(NPE, () -> ws.sendPing(null));
+                    assertThrows(NPE, () -> ws.sendPong(null));
+                    assertThrows(NPE, () -> ws.sendClose(NORMAL_CLOSURE, null));
+                }
+            } finally {
                 ws.abort();
-                assertTrue(ws.isInputClosed());
-                assertTrue(ws.isOutputClosed());
-                assertEquals(ws.getSubprotocol(), "");
             }
-            // at this point valid requests MUST be a no-op:
-            for (int j = 0; j < 3; j++) {
-                System.out.printf("request #%s%n", j);
-                ws.request(1);
-                ws.request(2);
-                ws.request(8);
-                ws.request(Integer.MAX_VALUE);
-                ws.request(Long.MAX_VALUE);
-                // invalid requests MUST throw IAE:
-                assertThrows(IAE, () -> ws.request(Integer.MIN_VALUE));
-                assertThrows(IAE, () -> ws.request(Long.MIN_VALUE));
-                assertThrows(IAE, () -> ws.request(-1));
-                assertThrows(IAE, () -> ws.request(0));
-            }
-        }
-        // even though there is a bunch of messages readily available on the
-        // wire we shouldn't have received any of them as we aborted before
-        // the first request
-        try {
-            messageReceived.get(5, TimeUnit.SECONDS);
-            fail();
-        } catch (TimeoutException expected) {
-            System.out.println("Finished waiting");
-        }
-        for (int i = 0; i < 3; i++) {
-            System.out.printf("send #%s%n", i);
-            Support.assertFails(IOE, ws.sendText("text!", false));
-            Support.assertFails(IOE, ws.sendText("text!", true));
-            Support.assertFails(IOE, ws.sendBinary(ByteBuffer.allocate(16), false));
-            Support.assertFails(IOE, ws.sendBinary(ByteBuffer.allocate(16), true));
-            Support.assertFails(IOE, ws.sendPing(ByteBuffer.allocate(16)));
-            Support.assertFails(IOE, ws.sendPong(ByteBuffer.allocate(16)));
-            Support.assertFails(IOE, ws.sendClose(NORMAL_CLOSURE, "a reason"));
-            assertThrows(NPE, () -> ws.sendText(null, false));
-            assertThrows(NPE, () -> ws.sendText(null, true));
-            assertThrows(NPE, () -> ws.sendBinary(null, false));
-            assertThrows(NPE, () -> ws.sendBinary(null, true));
-            assertThrows(NPE, () -> ws.sendPing(null));
-            assertThrows(NPE, () -> ws.sendPong(null));
-            assertThrows(NPE, () -> ws.sendClose(NORMAL_CLOSURE, null));
         }
     }
 }
--- a/test/jdk/java/net/httpclient/websocket/AutomaticPong.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/net/httpclient/websocket/AutomaticPong.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +28,6 @@
  *      -Djdk.internal.httpclient.websocket.debug=true
  *       AutomaticPong
  */
-
-import org.testng.annotations.AfterTest;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
@@ -46,16 +44,6 @@
 import static org.testng.Assert.fail;
 
 public class AutomaticPong {
-
-    private DummyWebSocketServer server;
-    private WebSocket webSocket;
-
-    @AfterTest
-    public void cleanup() {
-        server.close();
-        webSocket.abort();
-    }
-
     /*
      * The sendClose method has been invoked and a Ping comes from the server.
      * Naturally, the client cannot reply with a Pong (the output has been
@@ -72,32 +60,36 @@
                 0x89, 0x06, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x3f, // ping hello?
                 0x88, 0x00,                                     // close
         };
-        server = Support.serverWithCannedData(bytes);
-        server.open();
-        MockListener listener = new MockListener() {
-            @Override
-            protected void onOpen0(WebSocket webSocket) {
-                /* request nothing */
+        try (var server = Support.serverWithCannedData(bytes)) {
+            server.open();
+            MockListener listener = new MockListener() {
+                @Override
+                protected void onOpen0(WebSocket webSocket) {
+                    /* request nothing */
+                }
+            };
+            var webSocket = newHttpClient()
+                    .newWebSocketBuilder()
+                    .buildAsync(server.getURI(), listener)
+                    .join();
+            try {
+                webSocket.sendClose(WebSocket.NORMAL_CLOSURE, "ok").join();
+                // now request all messages available
+                webSocket.request(Long.MAX_VALUE);
+                List<MockListener.Invocation> actual = listener.invocations();
+                ByteBuffer hello = ByteBuffer.wrap("hello?".getBytes(StandardCharsets.UTF_8));
+                ByteBuffer empty = ByteBuffer.allocate(0);
+                List<MockListener.Invocation> expected = List.of(
+                        MockListener.Invocation.onOpen(webSocket),
+                        MockListener.Invocation.onPing(webSocket, empty),
+                        MockListener.Invocation.onPing(webSocket, hello),
+                        MockListener.Invocation.onClose(webSocket, 1005, "")
+                );
+                assertEquals(actual, expected);
+            } finally {
+                webSocket.abort();
             }
-        };
-        webSocket = newHttpClient()
-                .newWebSocketBuilder()
-                .buildAsync(server.getURI(), listener)
-                .join();
-
-        webSocket.sendClose(WebSocket.NORMAL_CLOSURE, "ok").join();
-        // now request all messages available
-        webSocket.request(Long.MAX_VALUE);
-        List<MockListener.Invocation> actual = listener.invocations();
-        ByteBuffer hello = ByteBuffer.wrap("hello?".getBytes(StandardCharsets.UTF_8));
-        ByteBuffer empty = ByteBuffer.allocate(0);
-        List<MockListener.Invocation> expected = List.of(
-                MockListener.Invocation.onOpen(webSocket),
-                MockListener.Invocation.onPing(webSocket, empty),
-                MockListener.Invocation.onPing(webSocket, hello),
-                MockListener.Invocation.onClose(webSocket, 1005, "")
-        );
-        assertEquals(actual, expected);
+        }
     }
 
     /*
@@ -131,84 +123,100 @@
         .write(buffer);
         buffer.putChar((char) 1000);
         buffer.flip();
-        server = Support.serverWithCannedData(buffer.array());
-        server.open();
-        MockListener listener = new MockListener();
-        webSocket = newHttpClient()
-                .newWebSocketBuilder()
-                .buildAsync(server.getURI(), listener)
-                .join();
-        List<MockListener.Invocation> inv = listener.invocations();
-        assertEquals(inv.size(), nPings + 2); // n * onPing + onOpen + onClose
+        try (var server = Support.serverWithCannedData(buffer.array())) {
+            server.open();
+            MockListener listener = new MockListener();
+            var webSocket = newHttpClient()
+                    .newWebSocketBuilder()
+                    .buildAsync(server.getURI(), listener)
+                    .join();
+            try {
+                List<MockListener.Invocation> inv = listener.invocations();
+                assertEquals(inv.size(), nPings + 2); // n * onPing + onOpen + onClose
+
+                ByteBuffer data = server.read();
+                Frame.Reader reader = new Frame.Reader();
+
+                Frame.Consumer consumer = new Frame.Consumer() {
 
-        ByteBuffer data = server.read();
-        Frame.Reader reader = new Frame.Reader();
+                    ByteBuffer number = ByteBuffer.allocate(4);
+                    Frame.Masker masker = new Frame.Masker();
+                    int i = -1;
+                    boolean closed;
+
+                    @Override
+                    public void fin(boolean value) {
+                        assertTrue(value);
+                    }
 
-        Frame.Consumer consumer = new Frame.Consumer() {
+                    @Override
+                    public void rsv1(boolean value) {
+                        assertFalse(value);
+                    }
+
+                    @Override
+                    public void rsv2(boolean value) {
+                        assertFalse(value);
+                    }
+
+                    @Override
+                    public void rsv3(boolean value) {
+                        assertFalse(value);
+                    }
 
-            ByteBuffer number = ByteBuffer.allocate(4);
-            Frame.Masker masker = new Frame.Masker();
-            int i = -1;
-            boolean closed;
+                    @Override
+                    public void opcode(Frame.Opcode value) {
+                        if (value == Frame.Opcode.CLOSE) {
+                            closed = true;
+                            return;
+                        }
+                        assertEquals(value, Frame.Opcode.PONG);
+                    }
 
-            @Override
-            public void fin(boolean value) { assertTrue(value); }
+                    @Override
+                    public void mask(boolean value) {
+                        assertTrue(value);
+                    }
 
-            @Override
-            public void rsv1(boolean value) { assertFalse(value); }
+                    @Override
+                    public void payloadLen(long value) {
+                        if (!closed)
+                            assertEquals(value, 4);
+                    }
+
+                    @Override
+                    public void maskingKey(int value) {
+                        masker.mask(value);
+                    }
 
-            @Override
-            public void rsv2(boolean value) { assertFalse(value); }
-
-            @Override
-            public void rsv3(boolean value) { assertFalse(value); }
+                    @Override
+                    public void payloadData(ByteBuffer src) {
+                        masker.transferMasking(src, number);
+                        if (closed) {
+                            return;
+                        }
+                        number.flip();
+                        int n = number.getInt();
+                        System.out.printf("pong number=%s%n", n);
+                        number.clear();
+                        // a Pong with the number less than the maximum of Pongs already
+                        // received MUST never be received
+                        if (i >= n) {
+                            fail(String.format("i=%s, n=%s", i, n));
+                        }
+                        i = n;
+                    }
 
-            @Override
-            public void opcode(Frame.Opcode value) {
-                if (value == Frame.Opcode.CLOSE) {
-                    closed = true;
-                    return;
+                    @Override
+                    public void endFrame() {
+                    }
+                };
+                while (data.hasRemaining()) {
+                    reader.readFrame(data, consumer);
                 }
-                assertEquals(value, Frame.Opcode.PONG);
-            }
-
-            @Override
-            public void mask(boolean value) { assertTrue(value); }
-
-            @Override
-            public void payloadLen(long value) {
-                if (!closed)
-                    assertEquals(value, 4);
-            }
-
-            @Override
-            public void maskingKey(int value) {
-                masker.mask(value);
+            } finally {
+                webSocket.abort();
             }
-
-            @Override
-            public void payloadData(ByteBuffer src) {
-                masker.transferMasking(src, number);
-                if (closed) {
-                    return;
-                }
-                number.flip();
-                int n = number.getInt();
-                System.out.printf("pong number=%s%n", n);
-                number.clear();
-                // a Pong with the number less than the maximum of Pongs already
-                // received MUST never be received
-                if (i >= n) {
-                    fail(String.format("i=%s, n=%s", i, n));
-                }
-                i = n;
-            }
-
-            @Override
-            public void endFrame() { }
-        };
-        while (data.hasRemaining()) {
-            reader.readFrame(data, consumer);
         }
     }
 
--- a/test/jdk/java/net/httpclient/websocket/SendTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/net/httpclient/websocket/SendTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,6 @@
  *       SendTest
  */
 
-import org.testng.annotations.AfterTest;
 import org.testng.annotations.Test;
 
 import java.io.IOException;
@@ -46,40 +45,35 @@
 
     private static final Class<NullPointerException> NPE = NullPointerException.class;
 
-    private DummyWebSocketServer server;
-    private WebSocket webSocket;
-
-    @AfterTest
-    public void cleanup() {
-        server.close();
-        webSocket.abort();
-    }
-
     @Test
     public void sendMethodsThrowNPE() throws IOException {
-        server = new DummyWebSocketServer();
-        server.open();
-        webSocket = newBuilder().proxy(NO_PROXY).build().newWebSocketBuilder()
-                .buildAsync(server.getURI(), new WebSocket.Listener() { })
-                .join();
+        try (var server = new DummyWebSocketServer()) {
+            server.open();
+            var webSocket = newBuilder().proxy(NO_PROXY).build().newWebSocketBuilder()
+                    .buildAsync(server.getURI(), new WebSocket.Listener() { })
+                    .join();
+            try {
+                assertThrows(NPE, () -> webSocket.sendText(null, false));
+                assertThrows(NPE, () -> webSocket.sendText(null, true));
+                assertThrows(NPE, () -> webSocket.sendBinary(null, false));
+                assertThrows(NPE, () -> webSocket.sendBinary(null, true));
+                assertThrows(NPE, () -> webSocket.sendPing(null));
+                assertThrows(NPE, () -> webSocket.sendPong(null));
+                assertThrows(NPE, () -> webSocket.sendClose(NORMAL_CLOSURE, null));
 
-        assertThrows(NPE, () -> webSocket.sendText(null, false));
-        assertThrows(NPE, () -> webSocket.sendText(null, true));
-        assertThrows(NPE, () -> webSocket.sendBinary(null, false));
-        assertThrows(NPE, () -> webSocket.sendBinary(null, true));
-        assertThrows(NPE, () -> webSocket.sendPing(null));
-        assertThrows(NPE, () -> webSocket.sendPong(null));
-        assertThrows(NPE, () -> webSocket.sendClose(NORMAL_CLOSURE, null));
+                webSocket.abort();
 
-        webSocket.abort();
-
-        assertThrows(NPE, () -> webSocket.sendText(null, false));
-        assertThrows(NPE, () -> webSocket.sendText(null, true));
-        assertThrows(NPE, () -> webSocket.sendBinary(null, false));
-        assertThrows(NPE, () -> webSocket.sendBinary(null, true));
-        assertThrows(NPE, () -> webSocket.sendPing(null));
-        assertThrows(NPE, () -> webSocket.sendPong(null));
-        assertThrows(NPE, () -> webSocket.sendClose(NORMAL_CLOSURE, null));
+                assertThrows(NPE, () -> webSocket.sendText(null, false));
+                assertThrows(NPE, () -> webSocket.sendText(null, true));
+                assertThrows(NPE, () -> webSocket.sendBinary(null, false));
+                assertThrows(NPE, () -> webSocket.sendBinary(null, true));
+                assertThrows(NPE, () -> webSocket.sendPing(null));
+                assertThrows(NPE, () -> webSocket.sendPong(null));
+                assertThrows(NPE, () -> webSocket.sendClose(NORMAL_CLOSURE, null));
+            } finally {
+                webSocket.abort();
+            }
+        }
     }
 
     // TODO: request in onClose/onError
@@ -88,14 +82,20 @@
 
     @Test
     public void sendCloseCompleted() throws IOException {
-        server = new DummyWebSocketServer();
-        server.open();
-        webSocket = newBuilder().proxy(NO_PROXY).build().newWebSocketBuilder()
-                .buildAsync(server.getURI(), new WebSocket.Listener() { })
-                .join();
-        webSocket.sendClose(NORMAL_CLOSURE, "").join();
-        assertTrue(webSocket.isOutputClosed());
-        assertEquals(webSocket.getSubprotocol(), "");
-        webSocket.request(1); // No exceptions must be thrown
+        try (var server = new DummyWebSocketServer()) {
+            server.open();
+            var webSocket = newBuilder().proxy(NO_PROXY).build().newWebSocketBuilder()
+                    .buildAsync(server.getURI(), new WebSocket.Listener() { })
+                    .join();
+            try {
+                webSocket.sendClose(NORMAL_CLOSURE, "").join();
+                assertTrue(webSocket.isOutputClosed());
+                assertEquals(webSocket.getSubprotocol(), "");
+                webSocket.request(1); // No exceptions must be thrown
+            } finally {
+                webSocket.abort();
+            }
+        }
     }
 }
+
--- a/test/jdk/java/net/httpclient/websocket/WebSocketTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/net/httpclient/websocket/WebSocketTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -29,7 +29,6 @@
  *       WebSocketTest
  */
 
-import org.testng.annotations.AfterTest;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
@@ -73,150 +72,150 @@
         Support.assertCompletesExceptionally(clazz, stage);
     }
 
-    private DummyWebSocketServer server;
-    private WebSocket webSocket;
-
-    @AfterTest
-    public void cleanup() {
-        System.out.println("AFTER TEST");
-        if (server != null)
-            server.close();
-        if (webSocket != null)
-            webSocket.abort();
-    }
-
     @Test
     public void illegalArgument() throws IOException {
-        server = new DummyWebSocketServer();
-        server.open();
-        webSocket = newBuilder().proxy(NO_PROXY).build()
-                .newWebSocketBuilder()
-                .buildAsync(server.getURI(), new WebSocket.Listener() { })
-                .join();
+        try (var server = new DummyWebSocketServer()) {
+            server.open();
+            var webSocket = newBuilder().proxy(NO_PROXY).build()
+                    .newWebSocketBuilder()
+                    .buildAsync(server.getURI(), new WebSocket.Listener() { })
+                    .join();
+            try {
+                assertFails(IAE, webSocket.sendPing(ByteBuffer.allocate(126)));
+                assertFails(IAE, webSocket.sendPing(ByteBuffer.allocate(127)));
+                assertFails(IAE, webSocket.sendPing(ByteBuffer.allocate(128)));
+                assertFails(IAE, webSocket.sendPing(ByteBuffer.allocate(129)));
+                assertFails(IAE, webSocket.sendPing(ByteBuffer.allocate(256)));
 
-        assertFails(IAE, webSocket.sendPing(ByteBuffer.allocate(126)));
-        assertFails(IAE, webSocket.sendPing(ByteBuffer.allocate(127)));
-        assertFails(IAE, webSocket.sendPing(ByteBuffer.allocate(128)));
-        assertFails(IAE, webSocket.sendPing(ByteBuffer.allocate(129)));
-        assertFails(IAE, webSocket.sendPing(ByteBuffer.allocate(256)));
+                assertFails(IAE, webSocket.sendPong(ByteBuffer.allocate(126)));
+                assertFails(IAE, webSocket.sendPong(ByteBuffer.allocate(127)));
+                assertFails(IAE, webSocket.sendPong(ByteBuffer.allocate(128)));
+                assertFails(IAE, webSocket.sendPong(ByteBuffer.allocate(129)));
+                assertFails(IAE, webSocket.sendPong(ByteBuffer.allocate(256)));
 
-        assertFails(IAE, webSocket.sendPong(ByteBuffer.allocate(126)));
-        assertFails(IAE, webSocket.sendPong(ByteBuffer.allocate(127)));
-        assertFails(IAE, webSocket.sendPong(ByteBuffer.allocate(128)));
-        assertFails(IAE, webSocket.sendPong(ByteBuffer.allocate(129)));
-        assertFails(IAE, webSocket.sendPong(ByteBuffer.allocate(256)));
+                assertFails(IOE, webSocket.sendText(Support.incompleteString(), true));
+                assertFails(IOE, webSocket.sendText(Support.incompleteString(), false));
+                assertFails(IOE, webSocket.sendText(Support.malformedString(), true));
+                assertFails(IOE, webSocket.sendText(Support.malformedString(), false));
 
-        assertFails(IOE, webSocket.sendText(Support.incompleteString(), true));
-        assertFails(IOE, webSocket.sendText(Support.incompleteString(), false));
-        assertFails(IOE, webSocket.sendText(Support.malformedString(), true));
-        assertFails(IOE, webSocket.sendText(Support.malformedString(), false));
+                assertFails(IAE, webSocket.sendClose(NORMAL_CLOSURE, Support.stringWithNBytes(124)));
+                assertFails(IAE, webSocket.sendClose(NORMAL_CLOSURE, Support.stringWithNBytes(125)));
+                assertFails(IAE, webSocket.sendClose(NORMAL_CLOSURE, Support.stringWithNBytes(128)));
+                assertFails(IAE, webSocket.sendClose(NORMAL_CLOSURE, Support.stringWithNBytes(256)));
+                assertFails(IAE, webSocket.sendClose(NORMAL_CLOSURE, Support.stringWithNBytes(257)));
+                assertFails(IAE, webSocket.sendClose(NORMAL_CLOSURE, Support.stringWith2NBytes((123 / 2) + 1)));
+                assertFails(IAE, webSocket.sendClose(NORMAL_CLOSURE, Support.malformedString()));
+                assertFails(IAE, webSocket.sendClose(NORMAL_CLOSURE, Support.incompleteString()));
 
-        assertFails(IAE, webSocket.sendClose(NORMAL_CLOSURE, Support.stringWithNBytes(124)));
-        assertFails(IAE, webSocket.sendClose(NORMAL_CLOSURE, Support.stringWithNBytes(125)));
-        assertFails(IAE, webSocket.sendClose(NORMAL_CLOSURE, Support.stringWithNBytes(128)));
-        assertFails(IAE, webSocket.sendClose(NORMAL_CLOSURE, Support.stringWithNBytes(256)));
-        assertFails(IAE, webSocket.sendClose(NORMAL_CLOSURE, Support.stringWithNBytes(257)));
-        assertFails(IAE, webSocket.sendClose(NORMAL_CLOSURE, Support.stringWith2NBytes((123 / 2) + 1)));
-        assertFails(IAE, webSocket.sendClose(NORMAL_CLOSURE, Support.malformedString()));
-        assertFails(IAE, webSocket.sendClose(NORMAL_CLOSURE, Support.incompleteString()));
+                assertFails(IAE, webSocket.sendClose(-2, "a reason"));
+                assertFails(IAE, webSocket.sendClose(-1, "a reason"));
+                assertFails(IAE, webSocket.sendClose(0, "a reason"));
+                assertFails(IAE, webSocket.sendClose(1, "a reason"));
+                assertFails(IAE, webSocket.sendClose(500, "a reason"));
+                assertFails(IAE, webSocket.sendClose(998, "a reason"));
+                assertFails(IAE, webSocket.sendClose(999, "a reason"));
+                assertFails(IAE, webSocket.sendClose(1002, "a reason"));
+                assertFails(IAE, webSocket.sendClose(1003, "a reason"));
+                assertFails(IAE, webSocket.sendClose(1006, "a reason"));
+                assertFails(IAE, webSocket.sendClose(1007, "a reason"));
+                assertFails(IAE, webSocket.sendClose(1009, "a reason"));
+                assertFails(IAE, webSocket.sendClose(1010, "a reason"));
+                assertFails(IAE, webSocket.sendClose(1012, "a reason"));
+                assertFails(IAE, webSocket.sendClose(1013, "a reason"));
+                assertFails(IAE, webSocket.sendClose(1015, "a reason"));
+                assertFails(IAE, webSocket.sendClose(5000, "a reason"));
+                assertFails(IAE, webSocket.sendClose(32768, "a reason"));
+                assertFails(IAE, webSocket.sendClose(65535, "a reason"));
+                assertFails(IAE, webSocket.sendClose(65536, "a reason"));
+                assertFails(IAE, webSocket.sendClose(Integer.MAX_VALUE, "a reason"));
+                assertFails(IAE, webSocket.sendClose(Integer.MIN_VALUE, "a reason"));
 
-        assertFails(IAE, webSocket.sendClose(-2, "a reason"));
-        assertFails(IAE, webSocket.sendClose(-1, "a reason"));
-        assertFails(IAE, webSocket.sendClose(0, "a reason"));
-        assertFails(IAE, webSocket.sendClose(1, "a reason"));
-        assertFails(IAE, webSocket.sendClose(500, "a reason"));
-        assertFails(IAE, webSocket.sendClose(998, "a reason"));
-        assertFails(IAE, webSocket.sendClose(999, "a reason"));
-        assertFails(IAE, webSocket.sendClose(1002, "a reason"));
-        assertFails(IAE, webSocket.sendClose(1003, "a reason"));
-        assertFails(IAE, webSocket.sendClose(1006, "a reason"));
-        assertFails(IAE, webSocket.sendClose(1007, "a reason"));
-        assertFails(IAE, webSocket.sendClose(1009, "a reason"));
-        assertFails(IAE, webSocket.sendClose(1010, "a reason"));
-        assertFails(IAE, webSocket.sendClose(1012, "a reason"));
-        assertFails(IAE, webSocket.sendClose(1013, "a reason"));
-        assertFails(IAE, webSocket.sendClose(1015, "a reason"));
-        assertFails(IAE, webSocket.sendClose(5000, "a reason"));
-        assertFails(IAE, webSocket.sendClose(32768, "a reason"));
-        assertFails(IAE, webSocket.sendClose(65535, "a reason"));
-        assertFails(IAE, webSocket.sendClose(65536, "a reason"));
-        assertFails(IAE, webSocket.sendClose(Integer.MAX_VALUE, "a reason"));
-        assertFails(IAE, webSocket.sendClose(Integer.MIN_VALUE, "a reason"));
+                assertThrows(IAE, () -> webSocket.request(Integer.MIN_VALUE));
+                assertThrows(IAE, () -> webSocket.request(Long.MIN_VALUE));
+                assertThrows(IAE, () -> webSocket.request(-1));
+                assertThrows(IAE, () -> webSocket.request(0));
 
-        assertThrows(IAE, () -> webSocket.request(Integer.MIN_VALUE));
-        assertThrows(IAE, () -> webSocket.request(Long.MIN_VALUE));
-        assertThrows(IAE, () -> webSocket.request(-1));
-        assertThrows(IAE, () -> webSocket.request(0));
-
-        server.close();
+            } finally {
+                webSocket.abort();
+            }
+        }
     }
 
     @Test
     public void partialBinaryThenText() throws IOException {
-        server = new DummyWebSocketServer();
-        server.open();
-        webSocket = newBuilder().proxy(NO_PROXY).build().newWebSocketBuilder()
-                .buildAsync(server.getURI(), new WebSocket.Listener() { })
-                .join();
-        webSocket.sendBinary(ByteBuffer.allocate(16), false).join();
-        assertFails(ISE, webSocket.sendText("text", false));
-        assertFails(ISE, webSocket.sendText("text", true));
-        // Pings & Pongs are fine
-        webSocket.sendPing(ByteBuffer.allocate(125)).join();
-        webSocket.sendPong(ByteBuffer.allocate(125)).join();
-        server.close();
+        try (var server = new DummyWebSocketServer()) {
+            server.open();
+            var webSocket = newBuilder().proxy(NO_PROXY).build().newWebSocketBuilder()
+                    .buildAsync(server.getURI(), new WebSocket.Listener() { })
+                    .join();
+            try {
+                webSocket.sendBinary(ByteBuffer.allocate(16), false).join();
+                assertFails(ISE, webSocket.sendText("text", false));
+                assertFails(ISE, webSocket.sendText("text", true));
+                // Pings & Pongs are fine
+                webSocket.sendPing(ByteBuffer.allocate(125)).join();
+                webSocket.sendPong(ByteBuffer.allocate(125)).join();
+            } finally {
+                webSocket.abort();
+            }
+        }
     }
 
     @Test
     public void partialTextThenBinary() throws IOException {
-        server = new DummyWebSocketServer();
-        server.open();
-        webSocket = newBuilder().proxy(NO_PROXY).build().newWebSocketBuilder()
-                .buildAsync(server.getURI(), new WebSocket.Listener() { })
-                .join();
-
-        webSocket.sendText("text", false).join();
-        assertFails(ISE, webSocket.sendBinary(ByteBuffer.allocate(16), false));
-        assertFails(ISE, webSocket.sendBinary(ByteBuffer.allocate(16), true));
-        // Pings & Pongs are fine
-        webSocket.sendPing(ByteBuffer.allocate(125)).join();
-        webSocket.sendPong(ByteBuffer.allocate(125)).join();
-        server.close();
+        try (var server = new DummyWebSocketServer()) {
+            server.open();
+            var webSocket = newBuilder().proxy(NO_PROXY).build().newWebSocketBuilder()
+                    .buildAsync(server.getURI(), new WebSocket.Listener() { })
+                    .join();
+            try {
+                webSocket.sendText("text", false).join();
+                assertFails(ISE, webSocket.sendBinary(ByteBuffer.allocate(16), false));
+                assertFails(ISE, webSocket.sendBinary(ByteBuffer.allocate(16), true));
+                // Pings & Pongs are fine
+                webSocket.sendPing(ByteBuffer.allocate(125)).join();
+                webSocket.sendPong(ByteBuffer.allocate(125)).join();
+            } finally {
+                webSocket.abort();
+            }
+        }
     }
 
     @Test
     public void sendMethodsThrowIOE1() throws IOException {
-        server = new DummyWebSocketServer();
-        server.open();
-        webSocket = newBuilder().proxy(NO_PROXY).build()
-                .newWebSocketBuilder()
-                .buildAsync(server.getURI(), new WebSocket.Listener() { })
-                .join();
+        try (var server = new DummyWebSocketServer()) {
+            server.open();
+            var webSocket = newBuilder().proxy(NO_PROXY).build()
+                    .newWebSocketBuilder()
+                    .buildAsync(server.getURI(), new WebSocket.Listener() { })
+                    .join();
+            try {
+                webSocket.sendClose(NORMAL_CLOSURE, "ok").join();
 
-        webSocket.sendClose(NORMAL_CLOSURE, "ok").join();
-
-        assertFails(IOE, webSocket.sendClose(WebSocket.NORMAL_CLOSURE, "ok"));
+                assertFails(IOE, webSocket.sendClose(WebSocket.NORMAL_CLOSURE, "ok"));
 
-        assertFails(IOE, webSocket.sendText("", true));
-        assertFails(IOE, webSocket.sendText("", false));
-        assertFails(IOE, webSocket.sendText("abc", true));
-        assertFails(IOE, webSocket.sendText("abc", false));
-        assertFails(IOE, webSocket.sendBinary(ByteBuffer.allocate(0), true));
-        assertFails(IOE, webSocket.sendBinary(ByteBuffer.allocate(0), false));
-        assertFails(IOE, webSocket.sendBinary(ByteBuffer.allocate(1), true));
-        assertFails(IOE, webSocket.sendBinary(ByteBuffer.allocate(1), false));
+                assertFails(IOE, webSocket.sendText("", true));
+                assertFails(IOE, webSocket.sendText("", false));
+                assertFails(IOE, webSocket.sendText("abc", true));
+                assertFails(IOE, webSocket.sendText("abc", false));
+                assertFails(IOE, webSocket.sendBinary(ByteBuffer.allocate(0), true));
+                assertFails(IOE, webSocket.sendBinary(ByteBuffer.allocate(0), false));
+                assertFails(IOE, webSocket.sendBinary(ByteBuffer.allocate(1), true));
+                assertFails(IOE, webSocket.sendBinary(ByteBuffer.allocate(1), false));
 
-        assertFails(IOE, webSocket.sendPing(ByteBuffer.allocate(125)));
-        assertFails(IOE, webSocket.sendPing(ByteBuffer.allocate(124)));
-        assertFails(IOE, webSocket.sendPing(ByteBuffer.allocate(1)));
-        assertFails(IOE, webSocket.sendPing(ByteBuffer.allocate(0)));
+                assertFails(IOE, webSocket.sendPing(ByteBuffer.allocate(125)));
+                assertFails(IOE, webSocket.sendPing(ByteBuffer.allocate(124)));
+                assertFails(IOE, webSocket.sendPing(ByteBuffer.allocate(1)));
+                assertFails(IOE, webSocket.sendPing(ByteBuffer.allocate(0)));
 
-        assertFails(IOE, webSocket.sendPong(ByteBuffer.allocate(125)));
-        assertFails(IOE, webSocket.sendPong(ByteBuffer.allocate(124)));
-        assertFails(IOE, webSocket.sendPong(ByteBuffer.allocate(1)));
-        assertFails(IOE, webSocket.sendPong(ByteBuffer.allocate(0)));
-
-        server.close();
+                assertFails(IOE, webSocket.sendPong(ByteBuffer.allocate(125)));
+                assertFails(IOE, webSocket.sendPong(ByteBuffer.allocate(124)));
+                assertFails(IOE, webSocket.sendPong(ByteBuffer.allocate(1)));
+                assertFails(IOE, webSocket.sendPong(ByteBuffer.allocate(0)));
+            } finally {
+                webSocket.abort();
+            }
+        }
     }
 
     @DataProvider(name = "sequence")
@@ -251,150 +250,153 @@
     public void listenerSequentialOrder(int[] binary, long requestSize)
             throws IOException
     {
-
-        server = Support.serverWithCannedData(binary);
-        server.open();
+        try (var server = Support.serverWithCannedData(binary)) {
+            server.open();
 
-        CompletableFuture<Void> violation = new CompletableFuture<>();
+            CompletableFuture<Void> violation = new CompletableFuture<>();
 
-        MockListener listener = new MockListener(requestSize) {
+            MockListener listener = new MockListener(requestSize) {
 
-            final AtomicBoolean guard = new AtomicBoolean();
+                final AtomicBoolean guard = new AtomicBoolean();
 
-            private <T> T checkRunExclusively(Supplier<T> action) {
-                if (guard.getAndSet(true)) {
-                    violation.completeExceptionally(new RuntimeException());
-                }
-                try {
-                    return action.get();
-                } finally {
-                    if (!guard.getAndSet(false)) {
+                private <T> T checkRunExclusively(Supplier<T> action) {
+                    if (guard.getAndSet(true)) {
                         violation.completeExceptionally(new RuntimeException());
                     }
+                    try {
+                        return action.get();
+                    } finally {
+                        if (!guard.getAndSet(false)) {
+                            violation.completeExceptionally(new RuntimeException());
+                        }
+                    }
                 }
-            }
 
-            @Override
-            public void onOpen(WebSocket webSocket) {
-                checkRunExclusively(() -> {
-                    super.onOpen(webSocket);
-                    return null;
-                });
-            }
+                @Override
+                public void onOpen(WebSocket webSocket) {
+                    checkRunExclusively(() -> {
+                        super.onOpen(webSocket);
+                        return null;
+                    });
+                }
 
-            @Override
-            public CompletionStage<?> onText(WebSocket webSocket,
-                                             CharSequence data,
-                                             boolean last) {
-                return checkRunExclusively(
-                        () -> super.onText(webSocket, data, last));
-            }
+                @Override
+                public CompletionStage<?> onText(WebSocket webSocket,
+                                                 CharSequence data,
+                                                 boolean last) {
+                    return checkRunExclusively(
+                            () -> super.onText(webSocket, data, last));
+                }
 
-            @Override
-            public CompletionStage<?> onBinary(WebSocket webSocket,
-                                               ByteBuffer data,
-                                               boolean last) {
-                return checkRunExclusively(
-                        () -> super.onBinary(webSocket, data, last));
-            }
+                @Override
+                public CompletionStage<?> onBinary(WebSocket webSocket,
+                                                   ByteBuffer data,
+                                                   boolean last) {
+                    return checkRunExclusively(
+                            () -> super.onBinary(webSocket, data, last));
+                }
 
-            @Override
-            public CompletionStage<?> onPing(WebSocket webSocket,
-                                             ByteBuffer message) {
-                return checkRunExclusively(
-                        () -> super.onPing(webSocket, message));
-            }
+                @Override
+                public CompletionStage<?> onPing(WebSocket webSocket,
+                                                 ByteBuffer message) {
+                    return checkRunExclusively(
+                            () -> super.onPing(webSocket, message));
+                }
 
-            @Override
-            public CompletionStage<?> onPong(WebSocket webSocket,
-                                             ByteBuffer message) {
-                return checkRunExclusively(
-                        () -> super.onPong(webSocket, message));
-            }
+                @Override
+                public CompletionStage<?> onPong(WebSocket webSocket,
+                                                 ByteBuffer message) {
+                    return checkRunExclusively(
+                            () -> super.onPong(webSocket, message));
+                }
 
-            @Override
-            public CompletionStage<?> onClose(WebSocket webSocket,
-                                              int statusCode,
-                                              String reason) {
-                return checkRunExclusively(
-                        () -> super.onClose(webSocket, statusCode, reason));
-            }
+                @Override
+                public CompletionStage<?> onClose(WebSocket webSocket,
+                                                  int statusCode,
+                                                  String reason) {
+                    return checkRunExclusively(
+                            () -> super.onClose(webSocket, statusCode, reason));
+                }
 
-            @Override
-            public void onError(WebSocket webSocket, Throwable error) {
-                checkRunExclusively(() -> {
-                    super.onError(webSocket, error);
-                    return null;
-                });
-            }
-        };
+                @Override
+                public void onError(WebSocket webSocket, Throwable error) {
+                    checkRunExclusively(() -> {
+                        super.onError(webSocket, error);
+                        return null;
+                    });
+                }
+            };
 
-        webSocket = newBuilder().proxy(NO_PROXY).build().newWebSocketBuilder()
-                .buildAsync(server.getURI(), listener)
-                .join();
-
-
-        listener.invocations();
-        violation.complete(null); // won't affect if completed exceptionally
-        violation.join();
-
-        server.close();
+            var webSocket = newBuilder().proxy(NO_PROXY).build().newWebSocketBuilder()
+                    .buildAsync(server.getURI(), listener)
+                    .join();
+            try {
+                listener.invocations();
+                violation.complete(null); // won't affect if completed exceptionally
+                violation.join();
+            } finally {
+                webSocket.abort();
+            }
+        }
     }
 
     @Test
     public void sendMethodsThrowIOE2() throws Exception {
-        server = Support.serverWithCannedData(0x88, 0x00);
-        server.open();
-        CompletableFuture<Void> onCloseCalled = new CompletableFuture<>();
-        CompletableFuture<Void> canClose = new CompletableFuture<>();
+        try (var server = Support.serverWithCannedData(0x88, 0x00)) {
+            server.open();
+
+            CompletableFuture<Void> onCloseCalled = new CompletableFuture<>();
+            CompletableFuture<Void> canClose = new CompletableFuture<>();
 
-        WebSocket.Listener listener = new WebSocket.Listener() {
-            @Override
-            public CompletionStage<?> onClose(WebSocket webSocket,
-                                              int statusCode,
-                                              String reason) {
-                System.out.printf("onClose(%s, '%s')%n", statusCode, reason);
-                onCloseCalled.complete(null);
-                return canClose;
-            }
+            WebSocket.Listener listener = new WebSocket.Listener() {
+                @Override
+                public CompletionStage<?> onClose(WebSocket webSocket,
+                                                  int statusCode,
+                                                  String reason) {
+                    System.out.printf("onClose(%s, '%s')%n", statusCode, reason);
+                    onCloseCalled.complete(null);
+                    return canClose;
+                }
 
-            @Override
-            public void onError(WebSocket webSocket, Throwable error) {
-                System.out.println("onError(" + error + ")");
-                onCloseCalled.completeExceptionally(error);
-            }
-        };
-
-        webSocket = newBuilder().proxy(NO_PROXY).build().newWebSocketBuilder()
-                .buildAsync(server.getURI(), listener)
-                .join();
+                @Override
+                public void onError(WebSocket webSocket, Throwable error) {
+                    System.out.println("onError(" + error + ")");
+                    onCloseCalled.completeExceptionally(error);
+                }
+            };
 
-        onCloseCalled.join();      // Wait for onClose to be called
-        canClose.complete(null);   // Signal to the WebSocket it can close the output
-        TimeUnit.SECONDS.sleep(5); // Give canClose some time to reach the WebSocket
+            var webSocket = newBuilder().proxy(NO_PROXY).build().newWebSocketBuilder()
+                    .buildAsync(server.getURI(), listener)
+                    .join();
+            try {
+                onCloseCalled.join();      // Wait for onClose to be called
+                canClose.complete(null);   // Signal to the WebSocket it can close the output
+                TimeUnit.SECONDS.sleep(5); // Give canClose some time to reach the WebSocket
 
-        assertFails(IOE, webSocket.sendClose(WebSocket.NORMAL_CLOSURE, "ok"));
+                assertFails(IOE, webSocket.sendClose(WebSocket.NORMAL_CLOSURE, "ok"));
 
-        assertFails(IOE, webSocket.sendText("", true));
-        assertFails(IOE, webSocket.sendText("", false));
-        assertFails(IOE, webSocket.sendText("abc", true));
-        assertFails(IOE, webSocket.sendText("abc", false));
-        assertFails(IOE, webSocket.sendBinary(ByteBuffer.allocate(0), true));
-        assertFails(IOE, webSocket.sendBinary(ByteBuffer.allocate(0), false));
-        assertFails(IOE, webSocket.sendBinary(ByteBuffer.allocate(1), true));
-        assertFails(IOE, webSocket.sendBinary(ByteBuffer.allocate(1), false));
+                assertFails(IOE, webSocket.sendText("", true));
+                assertFails(IOE, webSocket.sendText("", false));
+                assertFails(IOE, webSocket.sendText("abc", true));
+                assertFails(IOE, webSocket.sendText("abc", false));
+                assertFails(IOE, webSocket.sendBinary(ByteBuffer.allocate(0), true));
+                assertFails(IOE, webSocket.sendBinary(ByteBuffer.allocate(0), false));
+                assertFails(IOE, webSocket.sendBinary(ByteBuffer.allocate(1), true));
+                assertFails(IOE, webSocket.sendBinary(ByteBuffer.allocate(1), false));
 
-        assertFails(IOE, webSocket.sendPing(ByteBuffer.allocate(125)));
-        assertFails(IOE, webSocket.sendPing(ByteBuffer.allocate(124)));
-        assertFails(IOE, webSocket.sendPing(ByteBuffer.allocate(1)));
-        assertFails(IOE, webSocket.sendPing(ByteBuffer.allocate(0)));
+                assertFails(IOE, webSocket.sendPing(ByteBuffer.allocate(125)));
+                assertFails(IOE, webSocket.sendPing(ByteBuffer.allocate(124)));
+                assertFails(IOE, webSocket.sendPing(ByteBuffer.allocate(1)));
+                assertFails(IOE, webSocket.sendPing(ByteBuffer.allocate(0)));
 
-        assertFails(IOE, webSocket.sendPong(ByteBuffer.allocate(125)));
-        assertFails(IOE, webSocket.sendPong(ByteBuffer.allocate(124)));
-        assertFails(IOE, webSocket.sendPong(ByteBuffer.allocate(1)));
-        assertFails(IOE, webSocket.sendPong(ByteBuffer.allocate(0)));
-
-        server.close();
+                assertFails(IOE, webSocket.sendPong(ByteBuffer.allocate(125)));
+                assertFails(IOE, webSocket.sendPong(ByteBuffer.allocate(124)));
+                assertFails(IOE, webSocket.sendPong(ByteBuffer.allocate(1)));
+                assertFails(IOE, webSocket.sendPong(ByteBuffer.allocate(0)));
+            } finally {
+                webSocket.abort();
+            }
+        }
     }
 
     // Used to verify a server requiring Authentication
@@ -458,74 +460,76 @@
         };
         CompletableFuture<List<byte[]>> actual = new CompletableFuture<>();
 
-        server = serverSupplier.apply(binary);
-        server.open();
-
-        WebSocket.Listener listener = new WebSocket.Listener() {
+        try (var server = serverSupplier.apply(binary)) {
+            server.open();
 
-            List<byte[]> collectedBytes = new ArrayList<>();
-            ByteBuffer buffer = ByteBuffer.allocate(1024);
+            WebSocket.Listener listener = new WebSocket.Listener() {
 
-            @Override
-            public CompletionStage<?> onBinary(WebSocket webSocket,
-                                               ByteBuffer message,
-                                               boolean last) {
-                System.out.printf("onBinary(%s, %s)%n", message, last);
-                webSocket.request(1);
+                List<byte[]> collectedBytes = new ArrayList<>();
+                ByteBuffer buffer = ByteBuffer.allocate(1024);
 
-                append(message);
-                if (last) {
-                    buffer.flip();
-                    byte[] bytes = new byte[buffer.remaining()];
-                    buffer.get(bytes);
-                    buffer.clear();
-                    processWholeBinary(bytes);
-                }
-                return null;
-            }
+                @Override
+                public CompletionStage<?> onBinary(WebSocket webSocket,
+                                                   ByteBuffer message,
+                                                   boolean last) {
+                    System.out.printf("onBinary(%s, %s)%n", message, last);
+                    webSocket.request(1);
 
-            private void append(ByteBuffer message) {
-                if (buffer.remaining() < message.remaining()) {
-                    assert message.remaining() > 0;
-                    int cap = (buffer.capacity() + message.remaining()) * 2;
-                    ByteBuffer b = ByteBuffer.allocate(cap);
-                    b.put(buffer.flip());
-                    buffer = b;
+                    append(message);
+                    if (last) {
+                        buffer.flip();
+                        byte[] bytes = new byte[buffer.remaining()];
+                        buffer.get(bytes);
+                        buffer.clear();
+                        processWholeBinary(bytes);
+                    }
+                    return null;
                 }
-                buffer.put(message);
-            }
 
-            private void processWholeBinary(byte[] bytes) {
-                String stringBytes = new String(bytes, UTF_8);
-                System.out.println("processWholeBinary: " + stringBytes);
-                collectedBytes.add(bytes);
-            }
+                private void append(ByteBuffer message) {
+                    if (buffer.remaining() < message.remaining()) {
+                        assert message.remaining() > 0;
+                        int cap = (buffer.capacity() + message.remaining()) * 2;
+                        ByteBuffer b = ByteBuffer.allocate(cap);
+                        b.put(buffer.flip());
+                        buffer = b;
+                    }
+                    buffer.put(message);
+                }
 
-            @Override
-            public CompletionStage<?> onClose(WebSocket webSocket,
-                                              int statusCode,
-                                              String reason) {
-                actual.complete(collectedBytes);
-                return null;
-            }
+                private void processWholeBinary(byte[] bytes) {
+                    String stringBytes = new String(bytes, UTF_8);
+                    System.out.println("processWholeBinary: " + stringBytes);
+                    collectedBytes.add(bytes);
+                }
 
-            @Override
-            public void onError(WebSocket webSocket, Throwable error) {
-                actual.completeExceptionally(error);
-            }
-        };
+                @Override
+                public CompletionStage<?> onClose(WebSocket webSocket,
+                                                  int statusCode,
+                                                  String reason) {
+                    actual.complete(collectedBytes);
+                    return null;
+                }
+
+                @Override
+                public void onError(WebSocket webSocket, Throwable error) {
+                    actual.completeExceptionally(error);
+                }
+            };
 
-        webSocket = newBuilder()
-                .proxy(NO_PROXY)
-                .authenticator(new WSAuthenticator())
-                .build().newWebSocketBuilder()
-                .buildAsync(server.getURI(), listener)
-                .join();
-
-        List<byte[]> a = actual.join();
-        assertEquals(a, expected);
-
-        server.close();
+            var webSocket = newBuilder()
+                    .proxy(NO_PROXY)
+                    .authenticator(new WSAuthenticator())
+                    .build().newWebSocketBuilder()
+                    .buildAsync(server.getURI(), listener)
+                    .join();
+            try {
+                List<byte[]> a = actual.join();
+                assertEquals(a, expected);
+            } finally {
+                webSocket.abort();
+            }
+        }
     }
 
     @Test(dataProvider = "servers")
@@ -554,59 +558,61 @@
         };
         CompletableFuture<List<String>> actual = new CompletableFuture<>();
 
-        server = serverSupplier.apply(binary);
-        server.open();
+        try (var server = serverSupplier.apply(binary)) {
+            server.open();
+
+            WebSocket.Listener listener = new WebSocket.Listener() {
+
+                List<String> collectedStrings = new ArrayList<>();
+                StringBuilder text = new StringBuilder();
 
-        WebSocket.Listener listener = new WebSocket.Listener() {
-
-            List<String> collectedStrings = new ArrayList<>();
-            StringBuilder text = new StringBuilder();
+                @Override
+                public CompletionStage<?> onText(WebSocket webSocket,
+                                                 CharSequence message,
+                                                 boolean last) {
+                    System.out.printf("onText(%s, %s)%n", message, last);
+                    webSocket.request(1);
+                    text.append(message);
+                    if (last) {
+                        String str = text.toString();
+                        text.setLength(0);
+                        processWholeText(str);
+                    }
+                    return null;
+                }
 
-            @Override
-            public CompletionStage<?> onText(WebSocket webSocket,
-                                             CharSequence message,
-                                             boolean last) {
-                System.out.printf("onText(%s, %s)%n", message, last);
-                webSocket.request(1);
-                text.append(message);
-                if (last) {
-                    String str = text.toString();
-                    text.setLength(0);
-                    processWholeText(str);
+                private void processWholeText(String string) {
+                    System.out.println(string);
+                    collectedStrings.add(string);
+                }
+
+                @Override
+                public CompletionStage<?> onClose(WebSocket webSocket,
+                                                  int statusCode,
+                                                  String reason) {
+                    actual.complete(collectedStrings);
+                    return null;
                 }
-                return null;
-            }
+
+                @Override
+                public void onError(WebSocket webSocket, Throwable error) {
+                    actual.completeExceptionally(error);
+                }
+            };
 
-            private void processWholeText(String string) {
-                System.out.println(string);
-                collectedStrings.add(string);
+            var webSocket = newBuilder()
+                    .proxy(NO_PROXY)
+                    .authenticator(new WSAuthenticator())
+                    .build().newWebSocketBuilder()
+                    .buildAsync(server.getURI(), listener)
+                    .join();
+            try {
+                List<String> a = actual.join();
+                assertEquals(a, expected);
+            } finally {
+                webSocket.abort();
             }
-
-            @Override
-            public CompletionStage<?> onClose(WebSocket webSocket,
-                                              int statusCode,
-                                              String reason) {
-                actual.complete(collectedStrings);
-                return null;
-            }
-
-            @Override
-            public void onError(WebSocket webSocket, Throwable error) {
-                actual.completeExceptionally(error);
-            }
-        };
-
-        webSocket = newBuilder()
-                .proxy(NO_PROXY)
-                .authenticator(new WSAuthenticator())
-                .build().newWebSocketBuilder()
-                .buildAsync(server.getURI(), listener)
-                .join();
-
-        List<String> a = actual.join();
-        assertEquals(a, expected);
-
-        server.close();
+        }
     }
 
     /*
@@ -639,73 +645,75 @@
         };
         CompletableFuture<List<String>> actual = new CompletableFuture<>();
 
-        server = serverSupplier.apply(binary);
-        server.open();
+        try (var server = serverSupplier.apply(binary)) {
+            server.open();
 
-        WebSocket.Listener listener = new WebSocket.Listener() {
+            WebSocket.Listener listener = new WebSocket.Listener() {
 
-            List<CharSequence> parts = new ArrayList<>();
-            /*
-             * A CompletableFuture which will complete once the current
-             * message has been fully assembled. Until then the listener
-             * returns this instance for every call.
-             */
-            CompletableFuture<?> currentCf = new CompletableFuture<>();
-            List<String> collected = new ArrayList<>();
+                List<CharSequence> parts = new ArrayList<>();
+                /*
+                 * A CompletableFuture which will complete once the current
+                 * message has been fully assembled. Until then the listener
+                 * returns this instance for every call.
+                 */
+                CompletableFuture<?> currentCf = new CompletableFuture<>();
+                List<String> collected = new ArrayList<>();
 
-            @Override
-            public CompletionStage<?> onText(WebSocket webSocket,
-                                             CharSequence message,
-                                             boolean last) {
-                parts.add(message);
-                if (!last) {
-                    webSocket.request(1);
-                } else {
-                    this.currentCf.thenRun(() -> webSocket.request(1));
-                    CompletableFuture<?> refCf = this.currentCf;
-                    processWholeMessage(new ArrayList<>(parts), refCf);
-                    currentCf = new CompletableFuture<>();
-                    parts.clear();
-                    return refCf;
+                @Override
+                public CompletionStage<?> onText(WebSocket webSocket,
+                                                 CharSequence message,
+                                                 boolean last) {
+                    parts.add(message);
+                    if (!last) {
+                        webSocket.request(1);
+                    } else {
+                        this.currentCf.thenRun(() -> webSocket.request(1));
+                        CompletableFuture<?> refCf = this.currentCf;
+                        processWholeMessage(new ArrayList<>(parts), refCf);
+                        currentCf = new CompletableFuture<>();
+                        parts.clear();
+                        return refCf;
+                    }
+                    return currentCf;
                 }
-                return currentCf;
-            }
 
-            @Override
-            public CompletionStage<?> onClose(WebSocket webSocket,
-                                              int statusCode,
-                                              String reason) {
-                actual.complete(collected);
-                return null;
-            }
+                @Override
+                public CompletionStage<?> onClose(WebSocket webSocket,
+                                                  int statusCode,
+                                                  String reason) {
+                    actual.complete(collected);
+                    return null;
+                }
 
-            @Override
-            public void onError(WebSocket webSocket, Throwable error) {
-                actual.completeExceptionally(error);
-            }
+                @Override
+                public void onError(WebSocket webSocket, Throwable error) {
+                    actual.completeExceptionally(error);
+                }
 
-            public void processWholeMessage(List<CharSequence> data,
-                                            CompletableFuture<?> cf) {
-                StringBuilder b = new StringBuilder();
-                data.forEach(b::append);
-                String s = b.toString();
-                System.out.println(s);
-                cf.complete(null);
-                collected.add(s);
-            }
-        };
+                public void processWholeMessage(List<CharSequence> data,
+                                                CompletableFuture<?> cf) {
+                    StringBuilder b = new StringBuilder();
+                    data.forEach(b::append);
+                    String s = b.toString();
+                    System.out.println(s);
+                    cf.complete(null);
+                    collected.add(s);
+                }
+            };
 
-        webSocket = newBuilder()
-                .proxy(NO_PROXY)
-                .authenticator(new WSAuthenticator())
-                .build().newWebSocketBuilder()
-                .buildAsync(server.getURI(), listener)
-                .join();
-
-        List<String> a = actual.join();
-        assertEquals(a, expected);
-
-        server.close();
+            var webSocket = newBuilder()
+                    .proxy(NO_PROXY)
+                    .authenticator(new WSAuthenticator())
+                    .build().newWebSocketBuilder()
+                    .buildAsync(server.getURI(), listener)
+                    .join();
+            try {
+                List<String> a = actual.join();
+                assertEquals(a, expected);
+            } finally {
+                webSocket.abort();
+            }
+        }
     }
 
     // -- authentication specific tests
@@ -725,6 +733,7 @@
                     .newWebSocketBuilder()
                     .buildAsync(server.getURI(), new WebSocket.Listener() { })
                     .join();
+            webSocket.abort();
         }
     }
 
@@ -745,6 +754,7 @@
                     .header("Authorization", hv)
                     .buildAsync(server.getURI(), new WebSocket.Listener() { })
                     .join();
+            webSocket.abort();
         }
     }
 
@@ -763,6 +773,7 @@
 
             try {
                 var webSocket = cf.join();
+                silentAbort(webSocket);
                 fail("Expected exception not thrown");
             } catch (CompletionException expected) {
                 WebSocketHandshakeException e = (WebSocketHandshakeException)expected.getCause();
@@ -783,7 +794,7 @@
 
             Authenticator authenticator = new Authenticator() {
                 @Override protected PasswordAuthentication getPasswordAuthentication() {
-                    return new PasswordAuthentication("BAD"+USERNAME, "".toCharArray());
+                    return new PasswordAuthentication("BAD" + USERNAME, "".toCharArray());
                 }
             };
 
@@ -796,10 +807,16 @@
 
             try {
                 var webSocket = cf.join();
+                silentAbort(webSocket);
                 fail("Expected exception not thrown");
             } catch (CompletionException expected) {
                 System.out.println("caught expected exception:" + expected);
             }
         }
     }
+    private static void silentAbort(WebSocket ws) {
+        try {
+            ws.abort();
+        } catch (Throwable t) { }
+    }
 }
--- a/test/jdk/java/nio/channels/Selector/WakeupSpeed.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/nio/channels/Selector/WakeupSpeed.java	Tue Sep 24 15:19:35 2019 -0400
@@ -23,7 +23,7 @@
 
 /* @test
  * @bug 4467968
- * @summary Tests wether wakeup makes the next select() call return immediately
+ * @summary Tests whether wakeup makes the next select() call return immediately
  */
 
 import java.io.IOException;
--- a/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/InheritedChannelTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/InheritedChannelTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -25,7 +25,7 @@
  * @test
  * @bug 4673940 4930794 8211842
  * @summary Unit tests for inetd feature
- * @requires (os.family == "linux" | os.family == "solaris")
+ * @requires (os.family == "linux" | os.family == "solaris" | os.family == "mac")
  * @library /test/lib
  * @build jdk.test.lib.Utils
  *        jdk.test.lib.Asserts
@@ -33,7 +33,8 @@
  *        jdk.test.lib.JDKToolLauncher
  *        jdk.test.lib.Platform
  *        jdk.test.lib.process.*
- *        UnixSocketTest StateTest StateTestService EchoTest EchoService CloseTest Launcher Util
+ *        UnixSocketTest StateTest StateTestService EchoTest EchoService
+ *        UnixDomainChannelTest CloseTest Launcher Util
  * @run testng/othervm/native InheritedChannelTest
  * @key intermittent
  */
@@ -73,7 +74,8 @@
 
     @DataProvider
     public Object[][] testCases() {
-        return new Object[][]{
+        return new Object[][] {
+            { "UnixDomainChannelTest", List.of(UnixDomainChannelTest.class.getName())},
             { "UnixSocketTest", List.of(UnixSocketTest.class.getName())},
             { "StateTest", List.of(StateTest.class.getName()) },
             { "EchoTest",  List.of(EchoTest.class.getName())  },
@@ -83,6 +85,7 @@
             // Note that the system properties are arguments to StateTest and not options.
             // These system properties are passed to the launched service as options:
             // java [-options] class [args...]
+
             { "StateTest run with " + POLICY_PASS, List.of(StateTest.class.getName(),
                                                            "-Djava.security.manager",
                                                            "-Djava.security.policy="
@@ -97,7 +100,7 @@
         };
     }
 
-    @Test(dataProvider = "testCases")
+    @Test(dataProvider = "testCases", timeOut=30000)
     public void test(String desc, List<String> opts) throws Throwable {
         String pathVar = Platform.sharedLibraryPathVariableName();
         System.out.println(pathVar + "=" + libraryPath);
--- a/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/Launcher.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/Launcher.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,4 @@
 /*
- * 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
@@ -75,6 +74,15 @@
         return socks[1];
     }
 
+    /**
+     * Launch specified class with an AF_UNIX socket created externally, and one String arg to child VM
+     */
+    public static void launchWithUnixDomainSocket(String className, UnixDomainSocket socket, String arg) throws IOException {
+        String[] args = new String[1];
+        args[0] = arg;
+        launch(className, null, args, socket.fd());
+    }
+
     /*
      * Launch 'java' with specified class with the specified arguments (may be null).
      * The launched process will inherit a connected TCP socket. The remote endpoint
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/UnixDomainChannelTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.nio.channels.*;
+import java.nio.ByteBuffer;
+import java.io.IOException;
+import static java.nio.charset.StandardCharsets.ISO_8859_1;
+
+/*
+ * Make sure that System.inheritedChannel returns null when given a UNIX domain socket
+ */
+
+public class UnixDomainChannelTest {
+
+    public static class Child {
+        public static void main(String[] args) throws Exception {
+            // we just want to make sure that System.inheritedChannel either
+            // returns a connected channel, or null if it is given a listener
+            Channel channel = System.inheritedChannel();
+            String result = channel == null ? "N" : "Y";
+            if (args[0].equals("test1") || args[0].equals("test2")) {
+                // socket is writeable
+                ByteChannel bc = (ByteChannel)channel;
+                ByteBuffer buf = ByteBuffer.wrap(result.getBytes(ISO_8859_1));
+                bc.write(buf);
+            } else { // test3
+                // in this case the socket is a listener
+                // we can't write to it. So, use UnixDatagramSocket
+                // to accept a writeable socket
+                UnixDomainSocket listener = new UnixDomainSocket(0); // fd 0
+                UnixDomainSocket sock = listener.accept();
+                sock.write((int)result.charAt(0));
+            }
+        }
+    }
+
+    static boolean passed = true;
+
+    public static void main(String args[]) throws Exception {
+        test1();
+        test2();
+        test3();
+        if (!passed)
+            throw new RuntimeException();
+    }
+
+    private static void closeAll(UnixDomainSocket... sockets) {
+        for (UnixDomainSocket sock : sockets) {
+            sock.close();
+        }
+    }
+
+    // Test with a named connected socket
+    private static void test1() throws Exception {
+        UnixDomainSocket listener = new UnixDomainSocket();
+        listener.bind("foo.socket");
+        UnixDomainSocket sock1 = new UnixDomainSocket();
+        sock1.connect("foo.socket");
+        UnixDomainSocket sock2 = listener.accept();
+
+        Launcher.launchWithUnixDomainSocket("UnixDomainChannelTest$Child", sock2, "test1");
+        int c = sock1.read();
+        if (c != 'Y') {
+            System.err.printf("test1: failed %d d\n", c );
+            passed = false;
+        }
+        closeAll(listener, sock1, sock2);
+    }
+
+    // Test with unnamed socketpair
+    private static void test2() throws Exception {
+        UnixDomainSocket[] pair = UnixDomainSocket.socketpair();
+        System.out.println("test2: launching child");
+        Launcher.launchWithUnixDomainSocket("UnixDomainChannelTest$Child", pair[0], "test2");
+        if (pair[1].read() != 'Y') {
+            System.err.println("test2: failed");
+            passed = false;
+        }
+        closeAll(pair[0], pair[1]);
+    }
+
+    // Test with a named listener
+    private static void test3() throws Exception {
+        UnixDomainSocket listener = new UnixDomainSocket();
+        listener.bind("foo.socket");
+        UnixDomainSocket sock1 = new UnixDomainSocket();
+        System.out.println("test3: launching child");
+        Launcher.launchWithUnixDomainSocket("UnixDomainChannelTest$Child", listener, "test3");
+        sock1.connect("foo.socket");
+        if (sock1.read() != 'N') {
+            System.err.println("test3: failed");
+            passed = false;
+        }
+        closeAll(listener, sock1);
+    }
+
+}
--- a/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/UnixDomainSocket.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/UnixDomainSocket.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019 Oracle and/or its affiliates. All rights reserved.
  * 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,21 +37,44 @@
     }
 
     private final int fd;
+    private volatile String name;
+
+    public UnixDomainSocket() throws IOException {
+        this.fd = create();
+    }
+
+    public void bind(String name) throws IOException {
+        bind0(fd, name);
+        this.name = name;
+    }
+
+    public UnixDomainSocket accept() throws IOException {
+        int newsock = accept0(fd);
+        return new UnixDomainSocket(newsock);
+    }
 
     public UnixDomainSocket(int fd) {
         this.fd = fd;
     }
 
+    public void connect(String dest) throws IOException {
+        connect0(fd, dest);
+    }
+
     public int read() throws IOException {
         return read0(fd);
     }
 
+    public String name() {
+        return name;
+    }
+
     public void write(int w) throws IOException {
         write0(fd, w);
     }
 
     public void close() {
-        close0(fd);
+        close0(fd, name); // close0 will unlink name if non-null
     }
 
     public int fd() {
@@ -62,11 +85,16 @@
         return "UnixDomainSocket: fd=" + Integer.toString(fd);
     }
 
+    private static native int create() throws IOException;
+    private static native void bind0(int fd, String name) throws IOException;
+    private static native int accept0(int fd) throws IOException;
+    private static native int connect0(int fd, String name) throws IOException;
+
     /* read and write bytes with UNIX domain sockets */
 
     private static native int read0(int fd) throws IOException;
     private static native void write0(int fd, int w) throws IOException;
-    private static native void close0(int fd);
+    private static native void close0(int fd, String name);
     private static native void init();
     public static native UnixDomainSocket[] socketpair();
 }
--- a/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/libInheritedChannel.c	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/libInheritedChannel.c	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +26,10 @@
  */
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/types.h>
 #include <sys/socket.h>
+#include <sys/un.h>
 #include <unistd.h>
 #include <dirent.h>
 #include <sys/stat.h>
@@ -147,19 +149,18 @@
 
     /*
      * We need to close all file descriptors except for serviceFd. To
-     * get the list of open file descriptos we read through /proc/self/fd
+     * get the list of open file descriptos we read through /proc/self/fd (/dev/fd)
      * but to open this requires a file descriptor. We could use a specific
      * file descriptor and fdopendir but Linux doesn't seem to support
      * fdopendir. Instead we use opendir and make an assumption on the
      * file descriptor that is used (by opening & closing a file).
      */
-    thisFd = open("/dev/null", O_RDONLY);
+    thisFd = open("/dev/fd", O_RDONLY);
     if (thisFd < 0) {
         _exit(-1);
     }
-    close(thisFd);
 
-    if ((dp = opendir("/proc/self/fd")) == NULL) {
+    if ((dp = fdopendir(thisFd)) == NULL) {
         _exit(-1);
     }
 
@@ -216,6 +217,65 @@
     return result;
 }
 
+JNIEXPORT jint JNICALL Java_UnixDomainSocket_create
+  (JNIEnv *env, jclass cls)
+{
+    int sock = socket(AF_UNIX, SOCK_STREAM, 0);
+    if (sock == -1) {
+        ThrowException(env, "java/io/IOException", "socket create error");
+    }
+    return sock;
+}
+
+JNIEXPORT void JNICALL Java_UnixDomainSocket_bind0
+  (JNIEnv *env, jclass cls, jint sock, jstring name)
+{
+    struct sockaddr_un addr;
+    const char *nameUtf = (*env)->GetStringUTFChars(env, name, NULL);
+    int ret = -1;
+    unlink(nameUtf);
+    memset(&addr, 0, sizeof(addr));
+    addr.sun_family = AF_UNIX;
+    strncpy(addr.sun_path, nameUtf, strlen(nameUtf));
+    ret = bind(sock, (const struct sockaddr*)&addr, sizeof(addr));
+    if (ret == -1) {
+        ThrowException(env, "java/io/IOException", "socket bind error");
+    }
+    ret = listen(sock, 5);
+    if (ret == -1) {
+        ThrowException(env, "java/io/IOException", "socket bind error");
+    }
+    (*env)->ReleaseStringUTFChars(env, name, nameUtf);
+}
+
+JNIEXPORT jint JNICALL Java_UnixDomainSocket_accept0
+  (JNIEnv *env, jclass cls, jint sock)
+{
+    struct sockaddr_storage addr;
+    socklen_t len = sizeof(addr);
+    int ret = accept(sock, (struct sockaddr *)&addr, &len);
+    if (ret == -1)
+        ThrowException(env, "java/io/IOException", "socket accept error");
+    return ret;
+}
+
+JNIEXPORT void JNICALL Java_UnixDomainSocket_connect0
+  (JNIEnv *env, jclass cls, jint fd, jstring name)
+{
+    struct sockaddr_un addr;
+    const char *nameUtf = (*env)->GetStringUTFChars(env, name, NULL);
+    int ret = -1;
+    memset(&addr, 0, sizeof(addr));
+    addr.sun_family = AF_UNIX;
+    strncpy(addr.sun_path, nameUtf, strlen(nameUtf));
+    ret = connect(fd, (const struct sockaddr*)&addr, sizeof(addr));
+    if (ret == -1) {
+        ThrowException(env, "java/io/IOException", "socket connect error");
+    }
+    (*env)->ReleaseStringUTFChars(env, name, nameUtf);
+}
+
+
 JNIEXPORT jint JNICALL Java_UnixDomainSocket_read0
   (JNIEnv *env, jclass cls, jint fd)
 {
@@ -243,7 +303,12 @@
 }
 
 JNIEXPORT void JNICALL Java_UnixDomainSocket_close0
-  (JNIEnv *env, jclass cls, jint fd)
+  (JNIEnv *env, jclass cls, jint fd, jstring name)
 {
     close(fd);
+    if (name != NULL) {
+        const char *nameUtf = (*env)->GetStringUTFChars(env, name, NULL);
+        unlink(nameUtf);
+        (*env)->ReleaseStringUTFChars(env, name, nameUtf);
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/nio/file/etc/MacVolumesTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8231254
+ * @requires os.family == "mac"
+ * @summary Check access and basic NIO APIs on APFS for macOS version >= 10.15
+ */
+import java.io.BufferedReader;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.IOException;
+import java.io.Reader;
+import java.nio.ByteBuffer;
+import java.nio.channels.SeekableByteChannel;
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.StandardOpenOption;
+import java.nio.file.attribute.FileTime;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.Random;
+
+public class MacVolumesTest {
+    private static final String SYSTEM_VOLUME = "/";
+    private static final String DATA_VOLUME = "/System/Volumes/Data";
+    private static final String FIRMLINKS = "/usr/share/firmlinks";
+
+    private static final void checkSystemVolume() throws IOException {
+        System.out.format("--- Checking system volume %s ---%n", SYSTEM_VOLUME);
+        Path root = Path.of(SYSTEM_VOLUME);
+        if (!Files.getFileStore(root).isReadOnly()) {
+            throw new RuntimeException("Root volume is not read-only");
+        }
+
+        Path tempDir;
+        try {
+            tempDir = Files.createTempDirectory(root, "tempDir");
+            throw new RuntimeException("Created temporary directory in root");
+        } catch (IOException ignore) {
+        }
+
+        Path tempFile;
+        try {
+            tempFile = Files.createTempFile(root, "tempFile", null);
+            throw new RuntimeException("Created temporary file in root");
+        } catch (IOException ignore) {
+        }
+
+        Path path = null;
+        Path etc = Path.of(SYSTEM_VOLUME, "etc");
+        if (Files.isWritable(etc)) {
+            throw new RuntimeException("System path " + etc + " is writable");
+        }
+        try (DirectoryStream<Path> ds = Files.newDirectoryStream(etc)) {
+            Iterator<Path> paths = ds.iterator();
+            while (paths.hasNext()) {
+                Path p = paths.next();
+                if (Files.isReadable(p) && Files.isRegularFile(p)) {
+                    path = p;
+                    break;
+                }
+            }
+        }
+        if (path == null) {
+            System.err.println("No root test file found: skipping file test");
+            return;
+        }
+        System.out.format("Using root test file %s%n", path);
+
+        if (Files.isWritable(path)) {
+            throw new RuntimeException("Test file " + path + " is writable");
+        }
+
+        FileTime creationTime =
+            (FileTime)Files.getAttribute(path, "basic:creationTime");
+        System.out.format("%s creation time: %s%n", path, creationTime);
+
+        long size = Files.size(path);
+        int capacity = (int)Math.min(1024, size);
+        ByteBuffer buf = ByteBuffer.allocate(capacity);
+        try (SeekableByteChannel sbc = Files.newByteChannel(path)) {
+            int n = sbc.read(buf);
+            System.out.format("Read %d bytes from %s%n", n, path);
+        }
+    }
+
+    private static final void checkDataVolume() throws IOException {
+        System.out.format("--- Checking data volume %s ---%n", DATA_VOLUME);
+        Path data = Path.of(DATA_VOLUME, "tmp");
+        if (Files.getFileStore(data).isReadOnly()) {
+            throw new RuntimeException("Data volume is read-only");
+        }
+
+        Path tempDir = Files.createTempDirectory(data, "tempDir");
+        tempDir.toFile().deleteOnExit();
+        System.out.format("Temporary directory: %s%n", tempDir);
+        if (!Files.isWritable(tempDir)) {
+            throw new RuntimeException("Temporary directory is not writable");
+        }
+
+        Path tempFile = Files.createTempFile(tempDir, "tempFile", null);
+        tempFile.toFile().deleteOnExit();
+        System.out.format("Temporary file: %s%n", tempFile);
+        if (!Files.isWritable(tempFile)) {
+            throw new RuntimeException("Temporary file is not writable");
+        }
+
+        byte[] bytes = new byte[42];
+        new Random().nextBytes(bytes);
+        try (SeekableByteChannel sbc = Files.newByteChannel(tempFile,
+            StandardOpenOption.WRITE)) {
+            ByteBuffer src = ByteBuffer.wrap(bytes);
+            if (sbc.write(src) != bytes.length) {
+                throw new RuntimeException("Incorrect number of bytes written");
+            }
+        }
+
+        try (SeekableByteChannel sbc = Files.newByteChannel(tempFile)) {
+            ByteBuffer dst = ByteBuffer.allocate(bytes.length);
+            if (sbc.read(dst) != bytes.length) {
+                throw new RuntimeException("Incorrect number of bytes read");
+            }
+            if (!Arrays.equals(dst.array(), bytes)) {
+                throw new RuntimeException("Bytes read != bytes written");
+            }
+        }
+    }
+
+    static void checkFirmlinks() throws IOException {
+        System.out.format("--- Checking firmlinks %s ---%n", FIRMLINKS);
+        Path firmlinks = Path.of(FIRMLINKS);
+        if (!Files.exists(firmlinks)) {
+            System.err.format("%s does not exist: skipping firmlinks test%n",
+                firmlinks);
+            return;
+        } else if (!Files.isReadable(firmlinks)) {
+            throw new RuntimeException(String.format("%s is not readable",
+                firmlinks));
+        }
+
+        try (BufferedReader br = Files.newBufferedReader(firmlinks)) {
+            String line;
+            while ((line = br.readLine()) != null) {
+                String file = line.split("\\s")[0];
+                Path path = Path.of(file);
+                if (!Files.exists(path)) {
+                    System.err.format("Firmlink %s does not exist: skipping%n",
+                        file);
+                    continue;
+                }
+                if (Files.getFileStore(path).isReadOnly()) {
+                    String msg = String.format("%s is read-only%n", file);
+                    throw new RuntimeException(msg);
+                } else {
+                    System.out.format("Firmlink %s OK%n", file);
+                }
+            }
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        String[] osv = System.getProperty("os.version").split("\\.");
+        int major = Integer.valueOf(osv[0]);
+        int minor = Integer.valueOf(osv[1]);
+        if (major < 10 || (major == 10 && minor < 15)) {
+            System.out.format("macOS version %d.%d too old: skipping test%n",
+                major, minor);
+            return;
+        }
+
+        // Check system volume for read-only.
+        checkSystemVolume();
+
+        // Check data volume for read-write.
+        checkDataVolume();
+
+        // Check firmlinks for read-write.
+        checkFirmlinks();
+    }
+}
--- a/test/jdk/java/text/Format/DecimalFormat/FormatMicroBenchmark.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/text/Format/DecimalFormat/FormatMicroBenchmark.java	Tue Sep 24 15:19:35 2019 -0400
@@ -87,7 +87,7 @@
  *
  *  Note  that these benchmarks  will provide numbers  without any knowledge of
  *  the  implementation of DecimalFormat class. So  to check regression any run
- *  should be compared to another reference run with  a previous JDK, wether or
+ *  should be compared to another reference run with  a previous JDK, whether or
  *  not this previous reference JDK contains fast-path implementation.
  *
  *  The eight benchmarks below are dedicated to measure throughput on different
--- a/test/jdk/java/util/Map/Get.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/Map/Get.java	Tue Sep 24 15:19:35 2019 -0400
@@ -120,8 +120,8 @@
     //--------------------- Infrastructure ---------------------------
     static volatile int passed = 0, failed = 0;
     static void pass() { passed++; }
-    static void fail() { failed++; (new Error("Failure")).printStackTrace(System.err); }
-    static void fail(String msg) { failed++; (new Error("Failure: " + msg)).printStackTrace(System.err); }
+    static void fail() { failed++; new Error("Failure").printStackTrace(System.err); }
+    static void fail(String msg) { failed++; new Error("Failure: " + msg).printStackTrace(System.err); }
     static void unexpected(String msg, Throwable t) { System.err.println("Unexpected: " + msg); unexpected(t); }
     static void unexpected(Throwable t) { failed++; t.printStackTrace(System.err); }
     static void check(boolean cond) { if (cond) pass(); else fail(); }
--- a/test/jdk/java/util/concurrent/BlockingQueue/OfferDrainToLoops.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/BlockingQueue/OfferDrainToLoops.java	Tue Sep 24 15:19:35 2019 -0400
@@ -34,6 +34,7 @@
 /*
  * @test
  * @bug 6805775 6815766
+ * @library /test/lib
  * @run main OfferDrainToLoops 100
  * @summary Test concurrent offer vs. drainTo
  */
@@ -47,10 +48,12 @@
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.LinkedTransferQueue;
 import java.util.concurrent.atomic.AtomicLong;
+import jdk.test.lib.Utils;
 
 @SuppressWarnings({"unchecked", "rawtypes", "deprecation"})
 public class OfferDrainToLoops {
-    final long testDurationMillisDefault = 10L * 1000L;
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
+    final long testDurationMillisDefault = 10_000L;
     final long testDurationMillis;
 
     OfferDrainToLoops(String[] args) {
@@ -76,7 +79,6 @@
         System.out.println(q.getClass().getSimpleName());
         final long testDurationNanos = testDurationMillis * 1000L * 1000L;
         final long quittingTimeNanos = System.nanoTime() + testDurationNanos;
-        final long timeoutMillis = 10L * 1000L;
         final SplittableRandom rnd = new SplittableRandom();
 
         // Poor man's bounded buffer.
@@ -155,13 +157,13 @@
                 }}};
 
         for (Thread thread : new Thread[] { offerer, drainer, scanner }) {
-            thread.join(timeoutMillis + testDurationMillis);
+            thread.join(LONG_DELAY_MS + testDurationMillis);
             if (thread.isAlive()) {
                 System.err.printf("Hung thread: %s%n", thread.getName());
                 failed++;
                 for (StackTraceElement e : thread.getStackTrace())
                     System.err.println(e);
-                thread.join(timeoutMillis);
+                thread.join(LONG_DELAY_MS);
             }
         }
     }
--- a/test/jdk/java/util/concurrent/ConcurrentHashMap/MapCheck.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/ConcurrentHashMap/MapCheck.java	Tue Sep 24 15:19:35 2019 -0400
@@ -537,7 +537,7 @@
         static void printStats() {
             for (Iterator it = accum.entrySet().iterator(); it.hasNext(); ) {
                 Map.Entry e = (Map.Entry)(it.next());
-                Stats stats = ((Stats)(e.getValue()));
+                Stats stats = (Stats)(e.getValue());
                 int n = stats.number;
                 double t;
                 if (n > 0)
--- a/test/jdk/java/util/concurrent/ConcurrentHashMap/MapLoops.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/ConcurrentHashMap/MapLoops.java	Tue Sep 24 15:19:35 2019 -0400
@@ -99,8 +99,8 @@
             nops = Integer.parseInt(args[5]);
 
         // normalize probabilities wrt random number generator
-        removesPerMaxRandom = (int)(((double)premove/100.0 * 0x7FFFFFFFL));
-        insertsPerMaxRandom = (int)(((double)pinsert/100.0 * 0x7FFFFFFFL));
+        removesPerMaxRandom = (int)((double)premove/100.0 * 0x7FFFFFFFL);
+        insertsPerMaxRandom = (int)((double)pinsert/100.0 * 0x7FFFFFFFL);
 
         System.out.print("Class: " + mapClass.getName());
         System.out.print(" threads: " + maxThreads);
@@ -172,7 +172,7 @@
         long time = timer.getTime();
         long tpo = time / (i * (long)nops);
         System.out.print(LoopHelpers.rightJustify(tpo) + " ns per op");
-        double secs = (double)(time) / 1000000000.0;
+        double secs = (double)time / 1000000000.0;
         System.out.println("\t " + secs + "s run time");
         map.clear();
     }
--- a/test/jdk/java/util/concurrent/ConcurrentHashMap/ToArray.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/ConcurrentHashMap/ToArray.java	Tue Sep 24 15:19:35 2019 -0400
@@ -24,37 +24,40 @@
 /*
  * @test
  * @bug 4486658 8010293
- * @summary thread safety of toArray methods of subCollections
+ * @summary thread safety of toArray methods of collection views
  * @author Martin Buchholz
  */
 
+import java.util.List;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.stream.Collectors;
 import java.util.stream.IntStream;
 
 public class ToArray {
 
     public static void main(String[] args) throws Throwable {
-        // Execute a number of times to increase the probability of
-        // failure if there is an issue
-        for (int i = 0; i < 16; i++) {
+        final int runsPerTest = Integer.getInteger("jsr166.runsPerTest", 1);
+        final int reps = 10 * runsPerTest;
+        for (int i = reps; i--> 0; )
             executeTest();
-        }
     }
 
     static void executeTest() throws Throwable {
-        final Throwable[] throwable = new Throwable[1];
         final ConcurrentHashMap<Integer, Integer> m = new ConcurrentHashMap<>();
-
-        // Number of workers equal to the number of processors
-        // Each worker will put globally unique keys into the map
-        final int nWorkers = Runtime.getRuntime().availableProcessors();
+        final ThreadLocalRandom rnd = ThreadLocalRandom.current();
+        final int nCPU = Runtime.getRuntime().availableProcessors();
+        final int minWorkers = 2;
+        final int maxWorkers = Math.max(minWorkers, Math.min(32, nCPU));
+        final int nWorkers = rnd.nextInt(minWorkers, maxWorkers + 1);
         final int sizePerWorker = 1024;
         final int maxSize = nWorkers * sizePerWorker;
 
-        // The foreman keeps checking that the size of the arrays
-        // obtained from the key and value sets is never less than the
-        // previously observed size and is never greater than the maximum size
+        // The foreman busy-checks that the size of the arrays obtained
+        // from the keys and values views grows monotonically until it
+        // reaches the maximum size.
+
         // NOTE: these size constraints are not specific to toArray and are
         // applicable to any form of traversal of the collection views
         CompletableFuture<?> foreman = CompletableFuture.runAsync(new Runnable() {
@@ -62,44 +65,37 @@
 
             private boolean checkProgress(Object[] a) {
                 int size = a.length;
-                if (size < prevSize) throw new RuntimeException("WRONG WAY");
-                if (size > maxSize) throw new RuntimeException("OVERSHOOT");
-                if (size == maxSize) return true;
+                if (size < prevSize || size > maxSize)
+                    throw new AssertionError(
+                        String.format("prevSize=%d size=%d maxSize=%d",
+                                      prevSize, size, maxSize));
                 prevSize = size;
-                return false;
+                return size == maxSize;
             }
 
-            @Override
             public void run() {
-                try {
-                    Integer[] empty = new Integer[0];
-                    while (true) {
-                        if (checkProgress(m.values().toArray())) return;
-                        if (checkProgress(m.keySet().toArray())) return;
-                        if (checkProgress(m.values().toArray(empty))) return;
-                        if (checkProgress(m.keySet().toArray(empty))) return;
-                    }
-                }
-                catch (Throwable t) {
-                    throwable[0] = t;
-                }
+                Integer[] empty = new Integer[0];
+                for (;;)
+                    if (checkProgress(m.values().toArray())
+                        & checkProgress(m.keySet().toArray())
+                        & checkProgress(m.values().toArray(empty))
+                        & checkProgress(m.keySet().toArray(empty)))
+                        return;
             }
         });
 
-        // Create workers
-        // Each worker will put globally unique keys into the map
-        CompletableFuture<?>[] workers = IntStream.range(0, nWorkers).
-                mapToObj(w -> CompletableFuture.runAsync(() -> {
-                    for (int i = 0, o = w * sizePerWorker; i < sizePerWorker; i++)
-                        m.put(o + i, i);
-                })).
-                toArray(CompletableFuture<?>[]::new);
+        // Each worker puts globally unique keys into the map
+        List<CompletableFuture<?>> workers =
+            IntStream.range(0, nWorkers)
+            .mapToObj(w -> (Runnable) () -> {
+                for (int i = 0, o = w * sizePerWorker; i < sizePerWorker; i++)
+                    m.put(o + i, i);
+            })
+            .map(CompletableFuture::runAsync)
+            .collect(Collectors.toList());
 
-        // Wait for workers and then foreman to complete
-        CompletableFuture.allOf(workers).join();
+        // Wait for workers and foreman to complete
+        workers.forEach(CompletableFuture<?>::join);
         foreman.join();
-
-        if (throwable[0] != null)
-            throw throwable[0];
     }
 }
--- a/test/jdk/java/util/concurrent/ConcurrentQueues/OfferRemoveLoops.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/ConcurrentQueues/OfferRemoveLoops.java	Tue Sep 24 15:19:35 2019 -0400
@@ -25,7 +25,8 @@
  * @test
  * @bug 6316155 6595669 6871697 6868712
  * @summary Test concurrent offer vs. remove
- * @run main OfferRemoveLoops 300
+ * @library /test/lib
+ * @run main OfferRemoveLoops 100
  * @author Martin Buchholz
  */
 
@@ -43,10 +44,12 @@
 import java.util.concurrent.LinkedTransferQueue;
 import java.util.concurrent.PriorityBlockingQueue;
 import java.util.concurrent.Semaphore;
+import jdk.test.lib.Utils;
 
 @SuppressWarnings({"unchecked", "rawtypes", "deprecation"})
 public class OfferRemoveLoops {
-    final long testDurationMillisDefault = 10L * 1000L;
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
+    final long testDurationMillisDefault = 10_000L;
     final long testDurationMillis;
 
     OfferRemoveLoops(String[] args) {
@@ -75,7 +78,6 @@
         System.err.println(q.getClass().getSimpleName());
         final long testDurationNanos = testDurationMillis * 1000L * 1000L;
         final long quittingTimeNanos = System.nanoTime() + testDurationNanos;
-        final long timeoutMillis = 10L * 1000L;
         final int maxChunkSize = 1042;
         final int maxQueueSize = 10 * maxChunkSize;
         final CountDownLatch done = new CountDownLatch(3);
@@ -156,7 +158,7 @@
                 done.countDown();
             }};
 
-        if (! done.await(timeoutMillis + testDurationMillis, MILLISECONDS)) {
+        if (! done.await(LONG_DELAY_MS + testDurationMillis, MILLISECONDS)) {
             for (Thread thread : new Thread[] { offerer, remover, scanner }) {
                 if (thread.isAlive()) {
                     System.err.printf("Hung thread: %s%n", thread.getName());
--- a/test/jdk/java/util/concurrent/CountDownLatch/Basic.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/CountDownLatch/Basic.java	Tue Sep 24 15:19:35 2019 -0400
@@ -23,70 +23,57 @@
 
 /*
  * @test
- * @bug 6332435
+ * @bug 6332435 8221168
  * @summary Basic tests for CountDownLatch
  * @library /test/lib
  * @author Seetharam Avadhanam, Martin Buchholz
  */
 
 import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Supplier;
 import jdk.test.lib.Utils;
 
 public class Basic {
     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
 
-    interface AwaiterFactory {
-        Awaiter getAwaiter();
-    }
-
     abstract static class Awaiter extends Thread {
-        private volatile Throwable result = null;
-        protected void result(Throwable result) { this.result = result; }
-        public Throwable result() { return this.result; }
-    }
-
-    private void toTheStartingGate(CountDownLatch gate) {
-        try {
-            gate.await();
-        }
-        catch (Throwable t) { fail(t); }
+        volatile Throwable exception;
+        volatile boolean interrupted;
+        abstract void realRun() throws Exception;
+        public final void run() {
+            try { realRun(); }
+            catch (Throwable ex) { exception = ex; }
+            interrupted = Thread.interrupted();
+        };
     }
 
-    private Awaiter awaiter(final CountDownLatch latch,
-                            final CountDownLatch gate) {
-        return new Awaiter() { public void run() {
-            System.out.println("without millis: " + latch.toString());
-            gate.countDown();
-
-            try {
+    static Awaiter awaiter(CountDownLatch latch,
+                           CountDownLatch gate) {
+        return new Awaiter() {
+            public void realRun() throws InterruptedException {
+                gate.countDown();
                 latch.await();
-                System.out.println("without millis - ComingOut");
-            }
-            catch (Throwable result) { result(result); }}};
+            }};
     }
 
-    private Awaiter awaiter(final CountDownLatch latch,
-                            final CountDownLatch gate,
-                            final long millis) {
-        return new Awaiter() { public void run() {
-            System.out.println("with millis: "+latch.toString());
-            gate.countDown();
-
-            try {
-                latch.await(millis, TimeUnit.MILLISECONDS);
-                System.out.println("with millis - ComingOut");
-            }
-            catch (Throwable result) { result(result); }}};
+    static Awaiter awaiter(CountDownLatch latch,
+                           CountDownLatch gate,
+                           long timeoutMillis) {
+        return new Awaiter() {
+            public void realRun() throws InterruptedException {
+                gate.countDown();
+                latch.await(timeoutMillis, TimeUnit.MILLISECONDS);
+            }};
     }
 
-    AwaiterFactory awaiterFactory(CountDownLatch latch, CountDownLatch gate) {
-        return () -> awaiter(latch, gate);
-    }
-
-    AwaiterFactory timedAwaiterFactory(CountDownLatch latch, CountDownLatch gate) {
-        return () -> awaiter(latch, gate, LONG_DELAY_MS);
+    static Supplier<Awaiter> randomAwaiterSupplier(
+            CountDownLatch latch, CountDownLatch gate) {
+        return () -> (ThreadLocalRandom.current().nextBoolean())
+            ? awaiter(latch, gate)
+            : awaiter(latch, gate, LONG_DELAY_MS);
     }
 
     //----------------------------------------------------------------
@@ -94,28 +81,24 @@
     //----------------------------------------------------------------
     public static void normalUse() throws Throwable {
         int count = 0;
-        Basic test = new Basic();
         CountDownLatch latch = new CountDownLatch(3);
         Awaiter[] a = new Awaiter[12];
 
         for (int i = 0; i < 3; i++) {
             CountDownLatch gate = new CountDownLatch(4);
-            AwaiterFactory factory1 = test.awaiterFactory(latch, gate);
-            AwaiterFactory factory2 = test.timedAwaiterFactory(latch, gate);
-            a[count] = factory1.getAwaiter(); a[count++].start();
-            a[count] = factory1.getAwaiter(); a[count++].start();
-            a[count] = factory2.getAwaiter(); a[count++].start();
-            a[count] = factory2.getAwaiter(); a[count++].start();
-            test.toTheStartingGate(gate);
-            System.out.println("Main Thread: " + latch.toString());
+            Supplier<Awaiter> s = randomAwaiterSupplier(latch, gate);
+            a[count] = s.get(); a[count++].start();
+            a[count] = s.get(); a[count++].start();
+            a[count] = s.get(); a[count++].start();
+            a[count] = s.get(); a[count++].start();
+            gate.await();
             latch.countDown();
             checkCount(latch, 2-i);
         }
-        for (int i = 0; i < 12; i++)
-            a[i].join();
-
-        for (int i = 0; i < 12; i++)
-            checkResult(a[i], null);
+        for (Awaiter awaiter : a)
+            awaiter.join();
+        for (Awaiter awaiter : a)
+            checkException(awaiter, null);
     }
 
     //----------------------------------------------------------------
@@ -123,38 +106,38 @@
     //----------------------------------------------------------------
     public static void threadInterrupted() throws Throwable {
         int count = 0;
-        Basic test = new Basic();
         CountDownLatch latch = new CountDownLatch(3);
         Awaiter[] a = new Awaiter[12];
 
         for (int i = 0; i < 3; i++) {
             CountDownLatch gate = new CountDownLatch(4);
-            AwaiterFactory factory1 = test.awaiterFactory(latch, gate);
-            AwaiterFactory factory2 = test.timedAwaiterFactory(latch, gate);
-            a[count] = factory1.getAwaiter(); a[count++].start();
-            a[count] = factory1.getAwaiter(); a[count++].start();
-            a[count] = factory2.getAwaiter(); a[count++].start();
-            a[count] = factory2.getAwaiter(); a[count++].start();
+            Supplier<Awaiter> s = randomAwaiterSupplier(latch, gate);
+            a[count] = s.get(); a[count++].start();
+            a[count] = s.get(); a[count++].start();
+            a[count] = s.get(); a[count++].start();
+            a[count] = s.get(); a[count++].start();
+            gate.await();
             a[count-1].interrupt();
-            test.toTheStartingGate(gate);
-            System.out.println("Main Thread: " + latch.toString());
             latch.countDown();
             checkCount(latch, 2-i);
         }
-        for (int i = 0; i < 12; i++)
-            a[i].join();
-
-        for (int i = 0; i < 12; i++)
-            checkResult(a[i],
-                        (i % 4) == 3 ? InterruptedException.class : null);
+        for (Awaiter awaiter : a)
+            awaiter.join();
+        for (int i = 0; i < a.length; i++) {
+            Awaiter awaiter = a[i];
+            Throwable ex = awaiter.exception;
+            if ((i % 4) == 3 && !awaiter.interrupted)
+                checkException(awaiter, InterruptedException.class);
+            else
+                checkException(awaiter, null);
+        }
     }
 
     //----------------------------------------------------------------
     // One thread timed out
     //----------------------------------------------------------------
     public static void timeOut() throws Throwable {
-        int count =0;
-        Basic test = new Basic();
+        int count = 0;
         CountDownLatch latch = new CountDownLatch(3);
         Awaiter[] a = new Awaiter[12];
 
@@ -162,54 +145,56 @@
 
         for (int i = 0; i < 3; i++) {
             CountDownLatch gate = new CountDownLatch(4);
-            AwaiterFactory factory1 = test.awaiterFactory(latch, gate);
-            AwaiterFactory factory2 = test.timedAwaiterFactory(latch, gate);
-            a[count] = test.awaiter(latch, gate, timeout[i]); a[count++].start();
-            a[count] = factory1.getAwaiter(); a[count++].start();
-            a[count] = factory2.getAwaiter(); a[count++].start();
-            a[count] = factory2.getAwaiter(); a[count++].start();
-            test.toTheStartingGate(gate);
-            System.out.println("Main Thread: " + latch.toString());
+            Supplier<Awaiter> s = randomAwaiterSupplier(latch, gate);
+            a[count] = awaiter(latch, gate, timeout[i]); a[count++].start();
+            a[count] = s.get(); a[count++].start();
+            a[count] = s.get(); a[count++].start();
+            a[count] = s.get(); a[count++].start();
+            gate.await();
             latch.countDown();
             checkCount(latch, 2-i);
         }
-        for (int i = 0; i < 12; i++)
-            a[i].join();
-
-        for (int i = 0; i < 12; i++)
-            checkResult(a[i], null);
+        for (Awaiter awaiter : a)
+            awaiter.join();
+        for (Awaiter awaiter : a)
+            checkException(awaiter, null);
     }
 
     public static void main(String[] args) throws Throwable {
-        normalUse();
-        threadInterrupted();
-        timeOut();
+        try {
+            normalUse();
+        } catch (Throwable ex) { fail(ex); }
+        try {
+            threadInterrupted();
+        } catch (Throwable ex) { fail(ex); }
+        try {
+            timeOut();
+        } catch (Throwable ex) { fail(ex); }
+
         if (failures.get() > 0L)
             throw new AssertionError(failures.get() + " failures");
     }
 
-    private static final AtomicInteger failures = new AtomicInteger(0);
+    static final AtomicInteger failures = new AtomicInteger(0);
 
-    private static void fail(String msg) {
+    static void fail(String msg) {
         fail(new AssertionError(msg));
     }
 
-    private static void fail(Throwable t) {
+    static void fail(Throwable t) {
         t.printStackTrace();
         failures.getAndIncrement();
     }
 
-    private static void checkCount(CountDownLatch b, int expected) {
+    static void checkCount(CountDownLatch b, int expected) {
         if (b.getCount() != expected)
             fail("Count = " + b.getCount() +
                  ", expected = " + expected);
     }
 
-    private static void checkResult(Awaiter a, Class c) {
-        Throwable t = a.result();
-        if (! ((t == null && c == null) || c.isInstance(t))) {
-            System.out.println("Mismatch: " + t + ", " + c.getName());
-            failures.getAndIncrement();
-        }
+    static void checkException(Awaiter awaiter, Class<? extends Throwable> c) {
+        Throwable ex = awaiter.exception;
+        if (! ((ex == null && c == null) || c.isInstance(ex)))
+            fail("Expected: " + c + ", got: " + ex);
     }
 }
--- a/test/jdk/java/util/concurrent/CyclicBarrier/Basic.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/CyclicBarrier/Basic.java	Tue Sep 24 15:19:35 2019 -0400
@@ -37,6 +37,7 @@
 import java.util.concurrent.BrokenBarrierException;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicInteger;
 import jdk.test.lib.Utils;
@@ -293,37 +294,42 @@
      * Handling of extra interrupts while waiting - tests for bug 6366811
      */
     private static void testInterrupts() {
-        final int N = 10;
+        final int N = ThreadLocalRandom.current().nextInt(2, 10);
         final CyclicBarrier startingGate = new CyclicBarrier(N+1);
 
         /**
          * A version of Awaiter that also records interrupted state.
          */
         class Waiter extends CheckedThread {
-            private boolean timed;
-            private CyclicBarrier barrier;
-            private CountDownLatch doneSignal;
-            private Throwable throwable;
-            private boolean interrupted;
+            private final boolean timed;
+            private final CyclicBarrier barrier;
+            private final CountDownLatch doneSignal;
+            volatile Throwable throwable;
+            volatile boolean interruptStatusSetAfterAwait;
 
-            public Waiter(boolean timed,
-                          CountDownLatch doneSignal,
-                          CyclicBarrier barrier) {
-                this.timed = timed;
+            public Waiter(CountDownLatch doneSignal, CyclicBarrier barrier) {
+                this.timed = ThreadLocalRandom.current().nextBoolean();
                 this.doneSignal = doneSignal;
                 this.barrier = barrier;
             }
-            Throwable throwable() { return this.throwable; }
-            boolean interruptBit() { return this.interrupted; }
+
             void realRun() throws Throwable {
                 startingGate.await(LONG_DELAY_MS, MILLISECONDS);
+
                 try {
                     if (timed) barrier.await(LONG_DELAY_MS, MILLISECONDS);
-                    else barrier.await(); }
-                catch (Throwable throwable) { this.throwable = throwable; }
+                    else barrier.await();
+                } catch (Throwable throwable) {
+                    this.throwable = throwable;
+                }
 
-                try { doneSignal.await(LONG_DELAY_MS, MILLISECONDS); }
-                catch (InterruptedException e) { interrupted = true; }
+                try {
+                    check(doneSignal.await(LONG_DELAY_MS, MILLISECONDS));
+                    if (Thread.interrupted())
+                        interruptStatusSetAfterAwait = true;
+                } catch (InterruptedException e) {
+                    interruptStatusSetAfterAwait = true;
+                }
             }
         }
 
@@ -352,7 +358,7 @@
                 } catch (Throwable t) { unexpected(t); }
             }};
             for (int i = 0; i < N; i++) {
-                Waiter waiter = new Waiter(i < N/2, doneSignal, barrier);
+                Waiter waiter = new Waiter(doneSignal, barrier);
                 waiter.start();
                 waiters.add(waiter);
             }
@@ -360,16 +366,14 @@
             while (barrier.getNumberWaiting() < N) Thread.yield();
             barrier.await();
             doneSignal.countDown();
-            int countInterrupted = 0;
-            int countInterruptedException = 0;
-            int countBrokenBarrierException = 0;
+            int countInterruptStatusSetAfterAwait = 0;
             for (Waiter waiter : waiters) {
                 waiter.join();
-                equal(waiter.throwable(), null);
-                if (waiter.interruptBit())
-                    countInterrupted++;
+                equal(waiter.throwable, null);
+                if (waiter.interruptStatusSetAfterAwait)
+                    countInterruptStatusSetAfterAwait++;
             }
-            equal(countInterrupted, N/2);
+            equal(countInterruptStatusSetAfterAwait, N/2);
             check(! barrier.isBroken());
         } catch (Throwable t) { unexpected(t); }
 
@@ -381,31 +385,33 @@
             final CyclicBarrier barrier = new CyclicBarrier(N+1);
             final List<Waiter> waiters = new ArrayList<>(N);
             for (int i = 0; i < N; i++) {
-                Waiter waiter = new Waiter(i < N/2, doneSignal, barrier);
+                Waiter waiter = new Waiter(doneSignal, barrier);
                 waiter.start();
                 waiters.add(waiter);
             }
             startingGate.await(LONG_DELAY_MS, MILLISECONDS);
             while (barrier.getNumberWaiting() < N) Thread.yield();
-            for (int i = 0; i < N/2; i++)
-                waiters.get(i).interrupt();
+            for (int i = 0; i < N/2; i++) {
+                Thread waiter = waiters.get(i);
+                waiter.interrupt();
+            }
             doneSignal.countDown();
-            int countInterrupted = 0;
             int countInterruptedException = 0;
             int countBrokenBarrierException = 0;
+            int countInterruptStatusSetAfterAwait = 0;
             for (Waiter waiter : waiters) {
                 waiter.join();
-                if (waiter.throwable() instanceof InterruptedException)
+                if (waiter.throwable instanceof InterruptedException)
                     countInterruptedException++;
-                if (waiter.throwable() instanceof BrokenBarrierException)
+                if (waiter.throwable instanceof BrokenBarrierException)
                     countBrokenBarrierException++;
-                if (waiter.interruptBit())
-                    countInterrupted++;
+                if (waiter.interruptStatusSetAfterAwait)
+                    countInterruptStatusSetAfterAwait++;
             }
-            equal(countInterrupted, N/2-1);
             equal(countInterruptedException, 1);
             equal(countBrokenBarrierException, N-1);
             checkBroken(barrier);
+            equal(countInterruptStatusSetAfterAwait, N/2-1);
             reset(barrier);
         } catch (Throwable t) { unexpected(t); }
     }
--- a/test/jdk/java/util/concurrent/FutureTask/BlockingTaskExecutor.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/FutureTask/BlockingTaskExecutor.java	Tue Sep 24 15:19:35 2019 -0400
@@ -103,7 +103,7 @@
      */
     static class NotificationReceiver {
         /** Has the notifiee been notified? */
-        boolean notified = false;
+        boolean notified;
 
         /**
          * Notify the notification receiver.
--- a/test/jdk/java/util/concurrent/FutureTask/CancelledFutureLoops.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/FutureTask/CancelledFutureLoops.java	Tue Sep 24 15:19:35 2019 -0400
@@ -130,7 +130,7 @@
             long endTime = System.nanoTime();
             long time = endTime - timer.startTime;
             if (print) {
-                double secs = (double)(time) / 1000000000.0;
+                double secs = (double)time / 1000000000.0;
                 System.out.println("\t " + secs + "s run time");
             }
 
--- a/test/jdk/java/util/concurrent/FutureTask/DoneTimedGetLoops.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/FutureTask/DoneTimedGetLoops.java	Tue Sep 24 15:19:35 2019 -0400
@@ -33,6 +33,7 @@
 
 /*
  * @test
+ * @library /test/lib
  * @run main DoneTimedGetLoops 300
  * @summary isDone returning true guarantees that subsequent timed get
  * will never throw TimeoutException.
@@ -42,10 +43,12 @@
 import java.util.concurrent.FutureTask;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicReference;
+import jdk.test.lib.Utils;
 
 @SuppressWarnings({"unchecked", "rawtypes", "deprecation"})
 public class DoneTimedGetLoops {
-    final long testDurationMillisDefault = 10L * 1000L;
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
+    final long testDurationMillisDefault = 10_000L;
     final long testDurationMillis;
 
     static class PublicFutureTask extends FutureTask<Boolean> {
@@ -63,7 +66,6 @@
     void test(String[] args) throws Throwable {
         final long testDurationNanos = testDurationMillis * 1000L * 1000L;
         final long quittingTimeNanos = System.nanoTime() + testDurationNanos;
-        final long timeoutMillis = 10L * 1000L;
 
         final AtomicReference<PublicFutureTask> normalRef
             = new AtomicReference<>();
@@ -136,13 +138,13 @@
                  setterException,
                  doneTimedGetNormal,
                  doneTimedGetAbnormal }) {
-            thread.join(timeoutMillis + testDurationMillis);
+            thread.join(LONG_DELAY_MS + testDurationMillis);
             if (thread.isAlive()) {
                 System.err.printf("Hung thread: %s%n", thread.getName());
                 failed++;
                 for (StackTraceElement e : thread.getStackTrace())
                     System.err.println(e);
-                thread.join(timeoutMillis);
+                thread.join(LONG_DELAY_MS);
             }
         }
     }
--- a/test/jdk/java/util/concurrent/Phaser/FickleRegister.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/Phaser/FickleRegister.java	Tue Sep 24 15:19:35 2019 -0400
@@ -43,7 +43,7 @@
 
 public class FickleRegister {
     final AtomicLong count = new AtomicLong(0);
-    final long testDurationMillisDefault = 10L * 1000L;
+    final long testDurationMillisDefault = 10_000L;
     final long testDurationMillis;
     final long quittingTimeNanos;
     final int chunkSize = 1000;
--- a/test/jdk/java/util/concurrent/Phaser/TieredArriveLoops.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/Phaser/TieredArriveLoops.java	Tue Sep 24 15:19:35 2019 -0400
@@ -40,7 +40,7 @@
 import java.util.concurrent.Phaser;
 
 public class TieredArriveLoops {
-    final long testDurationMillisDefault = 10L * 1000L;
+    final long testDurationMillisDefault = 10_000L;
     final long testDurationMillis;
     final long quittingTimeNanos;
 
--- a/test/jdk/java/util/concurrent/ScheduledThreadPoolExecutor/GCRetention.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/ScheduledThreadPoolExecutor/GCRetention.java	Tue Sep 24 15:19:35 2019 -0400
@@ -86,7 +86,7 @@
                     if (q.remove(1000) != null)
                         break;
                     System.out.printf(
-                        "%d/%d unqueued references remaining%n", j, n);
+                        "%d/%d unqueued references remaining%n", j + 1, n);
                 }
             }
         }
--- a/test/jdk/java/util/concurrent/TimeUnit/Basic.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/TimeUnit/Basic.java	Tue Sep 24 15:19:35 2019 -0400
@@ -24,6 +24,7 @@
 /* @test
  * @bug 5057341 6363898
  * @summary Basic tests for TimeUnit
+ * @library /test/lib
  * @author Martin Buchholz
  */
 
@@ -39,12 +40,20 @@
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.List;
 import java.io.ObjectOutputStream;
 import java.io.ObjectInputStream;
 import java.util.Arrays;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+import jdk.test.lib.Utils;
 
 public class Basic {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
+
     private static void realMain(String[] args) throws Throwable {
 
         for (TimeUnit u : TimeUnit.values()) {
@@ -71,18 +80,33 @@
         equal(1000L, MILLISECONDS.toMicros(1));
         equal(1000L, MICROSECONDS.toNanos(1));
 
-        long t0 = System.nanoTime();
-        MILLISECONDS.sleep(3); /* See windows bug 6313903, might not sleep */
-        long elapsedMillis = (System.nanoTime() - t0)/(1000L * 1000L);
-        System.out.printf("elapsed=%d%n", elapsedMillis);
-        check(elapsedMillis >= 0);
-        /* Might not sleep on windows: check(elapsedMillis >= 3); */
-        check(elapsedMillis < 1000);
+        //----------------------------------------------------------------
+        // TimeUnit.sleep sleeps for at least the specified time.
+        // TimeUnit.sleep(x, unit) for x <= 0 does not sleep at all.
+        //----------------------------------------------------------------
+        ThreadLocalRandom rnd = ThreadLocalRandom.current();
+        int maxTimeoutMillis = rnd.nextInt(1, 12);
+        List<CompletableFuture<?>> workers =
+            IntStream.range(-1, maxTimeoutMillis + 1)
+            .mapToObj(timeoutMillis -> (Runnable) () -> {
+                try {
+                    long startTime = System.nanoTime();
+                    MILLISECONDS.sleep(timeoutMillis);
+                    long elapsedNanos = System.nanoTime() - startTime;
+                    long timeoutNanos = MILLISECONDS.toNanos(timeoutMillis);
+                    check(elapsedNanos >= timeoutNanos);
+                } catch (InterruptedException fail) {
+                    throw new AssertionError(fail);
+                }})
+            .map(CompletableFuture::runAsync)
+            .collect(Collectors.toList());
+
+        workers.forEach(CompletableFuture<?>::join);
 
         //----------------------------------------------------------------
         // Tests for serialized form compatibility with previous release
         //----------------------------------------------------------------
-        byte[] serializedForm = /* Generated using tiger */
+        byte[] serializedForm = /* Generated using JDK 5 */
             {-84, -19, 0, 5, '~', 'r', 0, 29, 'j', 'a', 'v', 'a', '.',
              'u', 't', 'i', 'l', '.', 'c', 'o', 'n', 'c', 'u', 'r', 'r', 'e',
              'n', 't', '.', 'T', 'i', 'm', 'e', 'U', 'n', 'i', 't', 0, 0,
--- a/test/jdk/java/util/concurrent/atomic/DoubleAdderDemo.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/atomic/DoubleAdderDemo.java	Tue Sep 24 15:19:35 2019 -0400
@@ -103,8 +103,8 @@
         long total = (long)nthreads * incs;
         if (sum != (double)total)
             throw new Error(sum + " != " + total);
-        double secs = (double)time / (1000L * 1000 * 1000);
-        long rate = total * (1000L) / time;
+        double secs = (double)time / 1000_000_000L;
+        long rate = total * 1000L / time;
         System.out.printf("threads:%3d  Time: %7.3fsec  Incs per microsec: %4d\n",
                           nthreads, secs, rate);
     }
--- a/test/jdk/java/util/concurrent/locks/Lock/CheckedLockLoops.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/locks/Lock/CheckedLockLoops.java	Tue Sep 24 15:19:35 2019 -0400
@@ -136,7 +136,7 @@
             long time = timer.getTime();
             long tpi = time / (iters * nthreads);
             System.out.print("\t" + LoopHelpers.rightJustify(tpi) + " ns per update");
-            //                double secs = (double)(time) / 1000000000.0;
+            //                double secs = (double)time / 1000000000.0;
             //                System.out.print("\t " + secs + "s run time");
             System.out.println();
 
--- a/test/jdk/java/util/concurrent/locks/Lock/FlakyMutex.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/locks/Lock/FlakyMutex.java	Tue Sep 24 15:19:35 2019 -0400
@@ -49,31 +49,51 @@
     static class MyRuntimeException extends RuntimeException {}
 
     static void checkThrowable(Throwable t) {
-        check((t instanceof MyError) ||
+        if (!((t instanceof MyError) ||
               (t instanceof MyException) ||
-              (t instanceof MyRuntimeException));
+              (t instanceof MyRuntimeException)))
+            unexpected(t);
     }
 
     static void realMain(String[] args) throws Throwable {
-        final int nThreads = 3;
+        final ThreadLocalRandom rndMain = ThreadLocalRandom.current();
+        final int nCpus = Runtime.getRuntime().availableProcessors();
+        final int maxThreads = Math.min(4, nCpus);
+        final int nThreads = rndMain.nextInt(1, maxThreads + 1);
         final int iterations = 10_000;
         final CyclicBarrier startingGate = new CyclicBarrier(nThreads);
+        final ExecutorService es = Executors.newFixedThreadPool(nThreads);
         final FlakyMutex mutex = new FlakyMutex();
-        final ExecutorService es = Executors.newFixedThreadPool(nThreads);
         final Runnable task = () -> {
             try {
+                ThreadLocalRandom rnd = ThreadLocalRandom.current();
                 startingGate.await();
                 for (int i = 0; i < iterations; i++) {
                     for (;;) {
-                        try { mutex.lock(); break; }
-                        catch (Throwable t) { checkThrowable(t); }
+                        try {
+                            if (rnd.nextBoolean())
+                                mutex.lock();
+                            else
+                                mutex.lockInterruptibly();
+                            break;
+                        } catch (Throwable t) { checkThrowable(t); }
                     }
 
-                    try { check(! mutex.tryLock()); }
-                    catch (Throwable t) { checkThrowable(t); }
+                    if (rnd.nextBoolean()) {
+                        try {
+                            check(! mutex.tryLock());
+                        } catch (Throwable t) { checkThrowable(t); }
+                    }
 
-                    try { check(! mutex.tryLock(1, TimeUnit.MICROSECONDS)); }
-                    catch (Throwable t) { checkThrowable(t); }
+                    if (rnd.nextInt(10) == 0) {
+                        try {
+                            check(! mutex.tryLock(1, TimeUnit.MICROSECONDS));
+                        } catch (Throwable t) { checkThrowable(t); }
+                    }
+
+                    if (rnd.nextBoolean()) {
+                        check(mutex.isLocked());
+                    }
 
                     mutex.unlock();
                 }
@@ -146,7 +166,11 @@
         if (x == null ? y == null : x.equals(y)) pass();
         else fail(x + " not equal to " + y);}
     public static void main(String[] args) throws Throwable {
-        try {realMain(args);} catch (Throwable t) {unexpected(t);}
+        int runsPerTest = Integer.getInteger("jsr166.runsPerTest", 1);
+        try {
+            for (int i = runsPerTest; i--> 0; )
+                realMain(args);
+        } catch (Throwable t) { unexpected(t); }
         System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
         if (failed > 0) throw new AssertionError("Some tests failed");}
     @SuppressWarnings("unchecked")
--- a/test/jdk/java/util/concurrent/locks/Lock/TimedAcquireLeak.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/locks/Lock/TimedAcquireLeak.java	Tue Sep 24 15:19:35 2019 -0400
@@ -42,6 +42,8 @@
 import java.io.Reader;
 import java.lang.ref.ReferenceQueue;
 import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Collections;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.Callable;
 import java.util.concurrent.CountDownLatch;
@@ -72,9 +74,9 @@
         return new File(bin, programName).getPath();
     }
 
-    static final String java = javaProgramPath("java");
-    static final String jmap = javaProgramPath("jmap");
-    static final String jps  = javaProgramPath("jps");
+    static final String javaPath = javaProgramPath("java");
+    static final String jmapPath = javaProgramPath("jmap");
+    static final String jpsPath  = javaProgramPath("jps");
 
     static String outputOf(Reader r) throws IOException {
         final StringBuilder sb = new StringBuilder();
@@ -159,7 +161,11 @@
 
     static String match(String s, String regex, int group) {
         Matcher matcher = Pattern.compile(regex).matcher(s);
-        matcher.find();
+        if (! matcher.find()) {
+            String msg = String.format(
+                "match failed: s=%s regex=%s", s, regex);
+            throw new AssertionError(msg);
+        }
         return matcher.group(group);
     }
 
@@ -171,21 +177,20 @@
 
     static int objectsInUse(final Process child,
                             final String childPid,
-                            final String className) {
-        final String regex =
-            "(?m)^ *[0-9]+: +([0-9]+) +[0-9]+ +\\Q"+className+"\\E(?:$| )";
-        final Callable<Integer> objectsInUse =
-            new Callable<Integer>() { public Integer call() {
-                Integer i = Integer.parseInt(
-                    match(commandOutputOf(jmap, "-histo:live", childPid),
-                          regex, 1));
-                if (i > 100)
-                    System.out.print(
-                        commandOutputOf(jmap,
-                                        "-dump:file=dump,format=b",
-                                        childPid));
-                return i;
-            }};
+                            final String classNameRegex) {
+        String regex =
+            "(?m)^ *[0-9]+: +([0-9]+) +[0-9]+ +"+classNameRegex+"(?:$| )";
+        Callable<Integer> objectsInUse = () -> {
+            int i = Integer.parseInt(
+                match(commandOutputOf(jmapPath, "-histo:live", childPid),
+                      regex, 1));
+            if (i > 100)
+                System.out.print(
+                    commandOutputOf(jmapPath,
+                                    "-dump:file=dump,format=b",
+                                    childPid));
+            return i;
+        };
         try { return rendezvousParent(child, objectsInUse); }
         catch (Throwable t) { unexpected(t); return -1; }
     }
@@ -196,26 +201,27 @@
             return;
 
         final String childClassName = Job.class.getName();
-        final String classToCheckForLeaks = Job.classToCheckForLeaks();
-        final String uniqueID =
-            String.valueOf(ThreadLocalRandom.current().nextInt(Integer.MAX_VALUE));
+        final String classNameRegex = Job.classNameRegexToCheckForLeaks();
+        final String uniqueID = String.valueOf(
+            ThreadLocalRandom.current().nextInt(Integer.MAX_VALUE));
 
-        final String[] jobCmd = {
-            java, "-Xmx8m", "-XX:+UsePerfData",
-            "-classpath", System.getProperty("test.class.path"),
-            childClassName, uniqueID
-        };
+        final ArrayList<String> jobCmd = new ArrayList<>();
+        Collections.addAll(
+            jobCmd, javaPath, "-Xmx8m", "-XX:+UsePerfData",
+            "-classpath", System.getProperty("test.class.path"));
+        Collections.addAll(jobCmd, Utils.getTestJavaOpts());
+        Collections.addAll(jobCmd, childClassName, uniqueID);
         final Process p = new ProcessBuilder(jobCmd).start();
         // Ensure subprocess jvm has started, so that jps can find it
         p.getInputStream().read();
         sendByte(p.getOutputStream());
 
         final String childPid =
-            match(commandOutputOf(jps, "-m"),
+            match(commandOutputOf(jpsPath, "-m"),
                   "(?m)^ *([0-9]+) +\\Q"+childClassName+"\\E *"+uniqueID+"$", 1);
 
-        final int n0 = objectsInUse(p, childPid, classToCheckForLeaks);
-        final int n1 = objectsInUse(p, childPid, classToCheckForLeaks);
+        final int n0 = objectsInUse(p, childPid, classNameRegex);
+        final int n1 = objectsInUse(p, childPid, classNameRegex);
         equal(p.waitFor(), 0);
         equal(p.exitValue(), 0);
         failed += p.exitValue();
@@ -226,7 +232,7 @@
         // implementation, and needing occasional adjustment.
         System.out.printf("%d -> %d%n", n0, n1);
         // Almost always n0 == n1
-        // Maximum jitter observed in practice is 10 -> 17
+        // Maximum jitter observed in practice is 7
         check(Math.abs(n1 - n0) < 10);
         check(n1 < 25);
         drainers.shutdown();
@@ -244,9 +250,9 @@
     // - in between calls to rendezvousChild, run code that may leak.
     //----------------------------------------------------------------
     public static class Job {
-        static String classToCheckForLeaks() {
+        static String classNameRegexToCheckForLeaks() {
             return
-                "java.util.concurrent.locks.AbstractQueuedSynchronizer$Node";
+                "\\Qjava.util.concurrent.locks.AbstractQueuedSynchronizer$\\E[A-Za-z]+";
         }
 
         public static void main(String[] args) throws Throwable {
--- a/test/jdk/java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java	Tue Sep 24 15:19:35 2019 -0400
@@ -93,7 +93,7 @@
             barrier.await();
             if (print) {
                 long time = timer.getTime();
-                double secs = (double)(time) / 1000000000.0;
+                double secs = (double)time / 1000000000.0;
                 System.out.println("\t " + secs + "s run time");
             }
 
--- a/test/jdk/java/util/concurrent/locks/ReentrantLock/LockOncePerThreadLoops.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/locks/ReentrantLock/LockOncePerThreadLoops.java	Tue Sep 24 15:19:35 2019 -0400
@@ -94,7 +94,7 @@
             barrier.await();
             if (print) {
                 long time = timer.getTime();
-                double secs = (double)(time) / 1000000000.0;
+                double secs = (double)time / 1000000000.0;
                 System.out.println("\t " + secs + "s run time");
             }
 
--- a/test/jdk/java/util/concurrent/locks/ReentrantLock/SimpleReentrantLockLoops.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/locks/ReentrantLock/SimpleReentrantLockLoops.java	Tue Sep 24 15:19:35 2019 -0400
@@ -95,7 +95,7 @@
                 long time = timer.getTime();
                 long tpi = time / ((long)iters * nthreads);
                 System.out.print("\t" + LoopHelpers.rightJustify(tpi) + " ns per lock");
-                double secs = (double)(time) / 1000000000.0;
+                double secs = (double)time / 1000000000.0;
                 System.out.println("\t " + secs + "s run time");
             }
 
--- a/test/jdk/java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java	Tue Sep 24 15:19:35 2019 -0400
@@ -96,7 +96,7 @@
             barrier.await();
             if (print) {
                 long time = timer.getTime();
-                double secs = (double)(time) / 1000000000.0;
+                double secs = (double)time / 1000000000.0;
                 System.out.println("\t " + secs + "s run time");
             }
 
--- a/test/jdk/java/util/concurrent/locks/ReentrantReadWriteLock/MapLoops.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/locks/ReentrantReadWriteLock/MapLoops.java	Tue Sep 24 15:19:35 2019 -0400
@@ -91,8 +91,8 @@
             premove = Integer.parseInt(args[4]);
 
         // normalize probabilities wrt random number generator
-        removesPerMaxRandom = (int)(((double)premove/100.0 * 0x7FFFFFFFL));
-        insertsPerMaxRandom = (int)(((double)pinsert/100.0 * 0x7FFFFFFFL));
+        removesPerMaxRandom = (int)((double)premove/100.0 * 0x7FFFFFFFL);
+        insertsPerMaxRandom = (int)((double)pinsert/100.0 * 0x7FFFFFFFL);
 
         System.out.println("Using " + mapClass.getName());
 
@@ -125,7 +125,7 @@
             long time = timer.getTime();
             long tpo = time / (i * (long)nops);
             System.out.print(LoopHelpers.rightJustify(tpo) + " ns per op");
-            double secs = (double)(time) / 1000000000.0;
+            double secs = (double)time / 1000000000.0;
             System.out.println("\t " + secs + "s run time");
             map.clear();
         }
--- a/test/jdk/java/util/concurrent/tck/AbstractQueuedLongSynchronizerTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/tck/AbstractQueuedLongSynchronizerTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -39,7 +39,7 @@
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashSet;
-import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.locks.AbstractQueuedLongSynchronizer;
 import java.util.concurrent.locks.AbstractQueuedLongSynchronizer.ConditionObject;
 
@@ -1286,19 +1286,31 @@
     /**
      * Tests scenario for
      * JDK-8191937: Lost interrupt in AbstractQueuedSynchronizer when tryAcquire methods throw
+     * ant -Djsr166.tckTestClass=AbstractQueuedLongSynchronizerTest -Djsr166.methodFilter=testInterruptedFailingAcquire -Djsr166.runsPerTest=10000 tck
      */
-    public void testInterruptedFailingAcquire() throws InterruptedException {
-        final RuntimeException ex = new RuntimeException();
+    public void testInterruptedFailingAcquire() throws Throwable {
+        class PleaseThrow extends RuntimeException {}
+        final PleaseThrow ex = new PleaseThrow();
+        final AtomicBoolean thrown = new AtomicBoolean();
 
         // A synchronizer only offering a choice of failure modes
         class Sync extends AbstractQueuedLongSynchronizer {
-            boolean pleaseThrow;
+            volatile boolean pleaseThrow;
+            void maybeThrow() {
+                if (pleaseThrow) {
+                    // assert: tryAcquire methods can throw at most once
+                    if (! thrown.compareAndSet(false, true))
+                        throw new AssertionError();
+                    throw ex;
+                }
+            }
+
             @Override protected boolean tryAcquire(long ignored) {
-                if (pleaseThrow) throw ex;
+                maybeThrow();
                 return false;
             }
             @Override protected long tryAcquireShared(long ignored) {
-                if (pleaseThrow) throw ex;
+                maybeThrow();
                 return -1;
             }
             @Override protected boolean tryRelease(long ignored) {
@@ -1310,30 +1322,87 @@
         }
 
         final Sync s = new Sync();
+        final boolean acquireInterruptibly = randomBoolean();
+        final Action[] uninterruptibleAcquireActions = {
+            () -> s.acquire(1),
+            () -> s.acquireShared(1),
+        };
+        final long nanosTimeout = MILLISECONDS.toNanos(2 * LONG_DELAY_MS);
+        final Action[] interruptibleAcquireActions = {
+            () -> s.acquireInterruptibly(1),
+            () -> s.acquireSharedInterruptibly(1),
+            () -> s.tryAcquireNanos(1, nanosTimeout),
+            () -> s.tryAcquireSharedNanos(1, nanosTimeout),
+        };
+        final Action[] releaseActions = {
+            () -> s.release(1),
+            () -> s.releaseShared(1),
+        };
+        final Action acquireAction = acquireInterruptibly
+            ? chooseRandomly(interruptibleAcquireActions)
+            : chooseRandomly(uninterruptibleAcquireActions);
+        final Action releaseAction
+            = chooseRandomly(releaseActions);
 
+        // From os_posix.cpp:
+        //
+        // NOTE that since there is no "lock" around the interrupt and
+        // is_interrupted operations, there is the possibility that the
+        // interrupted flag (in osThread) will be "false" but that the
+        // low-level events will be in the signaled state. This is
+        // intentional. The effect of this is that Object.wait() and
+        // LockSupport.park() will appear to have a spurious wakeup, which
+        // is allowed and not harmful, and the possibility is so rare that
+        // it is not worth the added complexity to add yet another lock.
         final Thread thread = newStartedThread(new CheckedRunnable() {
-            public void realRun() {
+            public void realRun() throws Throwable {
                 try {
-                    if (ThreadLocalRandom.current().nextBoolean())
-                        s.acquire(1);
-                    else
-                        s.acquireShared(1);
+                    acquireAction.run();
                     shouldThrow();
-                } catch (Throwable t) {
-                    assertSame(ex, t);
-                    assertTrue(Thread.interrupted());
+                } catch (InterruptedException possible) {
+                    assertTrue(acquireInterruptibly);
+                    assertFalse(Thread.interrupted());
+                } catch (PleaseThrow possible) {
+                    awaitInterrupted();
                 }
             }});
-        waitForThreadToEnterWaitState(thread);
-        assertSame(thread, s.getFirstQueuedThread());
-        assertTrue(s.hasQueuedPredecessors());
-        assertTrue(s.hasQueuedThreads());
-        assertEquals(1, s.getQueueLength());
+        for (long startTime = 0L;; ) {
+            waitForThreadToEnterWaitState(thread);
+            if (s.getFirstQueuedThread() == thread
+                && s.hasQueuedPredecessors()
+                && s.hasQueuedThreads()
+                && s.getQueueLength() == 1
+                && s.hasContended())
+                break;
+            if (startTime == 0L)
+                startTime = System.nanoTime();
+            else if (millisElapsedSince(startTime) > LONG_DELAY_MS)
+                fail("timed out waiting for AQS state: "
+                     + "thread state=" + thread.getState()
+                     + ", queued threads=" + s.getQueuedThreads());
+            Thread.yield();
+        }
 
         s.pleaseThrow = true;
-        thread.interrupt();
-        s.release(1);
+        // release and interrupt, in random order
+        if (randomBoolean()) {
+            thread.interrupt();
+            releaseAction.run();
+        } else {
+            releaseAction.run();
+            thread.interrupt();
+        }
         awaitTermination(thread);
+
+        if (! acquireInterruptibly)
+            assertTrue(thrown.get());
+
+        assertNull(s.getFirstQueuedThread());
+        assertFalse(s.hasQueuedPredecessors());
+        assertFalse(s.hasQueuedThreads());
+        assertEquals(0, s.getQueueLength());
+        assertTrue(s.getQueuedThreads().isEmpty());
+        assertTrue(s.hasContended());
     }
 
 }
--- a/test/jdk/java/util/concurrent/tck/AbstractQueuedSynchronizerTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/tck/AbstractQueuedSynchronizerTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -40,7 +40,7 @@
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashSet;
-import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.locks.AbstractQueuedSynchronizer;
 import java.util.concurrent.locks.AbstractQueuedSynchronizer.ConditionObject;
 
@@ -1337,19 +1337,31 @@
     /**
      * Tests scenario for
      * JDK-8191937: Lost interrupt in AbstractQueuedSynchronizer when tryAcquire methods throw
+     * ant -Djsr166.tckTestClass=AbstractQueuedSynchronizerTest -Djsr166.methodFilter=testInterruptedFailingAcquire -Djsr166.runsPerTest=10000 tck
      */
-    public void testInterruptedFailingAcquire() throws InterruptedException {
-        final RuntimeException ex = new RuntimeException();
+    public void testInterruptedFailingAcquire() throws Throwable {
+        class PleaseThrow extends RuntimeException {}
+        final PleaseThrow ex = new PleaseThrow();
+        final AtomicBoolean thrown = new AtomicBoolean();
 
         // A synchronizer only offering a choice of failure modes
         class Sync extends AbstractQueuedSynchronizer {
-            boolean pleaseThrow;
+            volatile boolean pleaseThrow;
+            void maybeThrow() {
+                if (pleaseThrow) {
+                    // assert: tryAcquire methods can throw at most once
+                    if (! thrown.compareAndSet(false, true))
+                        throw new AssertionError();
+                    throw ex;
+                }
+            }
+
             @Override protected boolean tryAcquire(int ignored) {
-                if (pleaseThrow) throw ex;
+                maybeThrow();
                 return false;
             }
             @Override protected int tryAcquireShared(int ignored) {
-                if (pleaseThrow) throw ex;
+                maybeThrow();
                 return -1;
             }
             @Override protected boolean tryRelease(int ignored) {
@@ -1361,30 +1373,87 @@
         }
 
         final Sync s = new Sync();
+        final boolean acquireInterruptibly = randomBoolean();
+        final Action[] uninterruptibleAcquireActions = {
+            () -> s.acquire(1),
+            () -> s.acquireShared(1),
+        };
+        final long nanosTimeout = MILLISECONDS.toNanos(2 * LONG_DELAY_MS);
+        final Action[] interruptibleAcquireActions = {
+            () -> s.acquireInterruptibly(1),
+            () -> s.acquireSharedInterruptibly(1),
+            () -> s.tryAcquireNanos(1, nanosTimeout),
+            () -> s.tryAcquireSharedNanos(1, nanosTimeout),
+        };
+        final Action[] releaseActions = {
+            () -> s.release(1),
+            () -> s.releaseShared(1),
+        };
+        final Action acquireAction = acquireInterruptibly
+            ? chooseRandomly(interruptibleAcquireActions)
+            : chooseRandomly(uninterruptibleAcquireActions);
+        final Action releaseAction
+            = chooseRandomly(releaseActions);
 
+        // From os_posix.cpp:
+        //
+        // NOTE that since there is no "lock" around the interrupt and
+        // is_interrupted operations, there is the possibility that the
+        // interrupted flag (in osThread) will be "false" but that the
+        // low-level events will be in the signaled state. This is
+        // intentional. The effect of this is that Object.wait() and
+        // LockSupport.park() will appear to have a spurious wakeup, which
+        // is allowed and not harmful, and the possibility is so rare that
+        // it is not worth the added complexity to add yet another lock.
         final Thread thread = newStartedThread(new CheckedRunnable() {
-            public void realRun() {
+            public void realRun() throws Throwable {
                 try {
-                    if (ThreadLocalRandom.current().nextBoolean())
-                        s.acquire(1);
-                    else
-                        s.acquireShared(1);
+                    acquireAction.run();
                     shouldThrow();
-                } catch (Throwable t) {
-                    assertSame(ex, t);
-                    assertTrue(Thread.interrupted());
+                } catch (InterruptedException possible) {
+                    assertTrue(acquireInterruptibly);
+                    assertFalse(Thread.interrupted());
+                } catch (PleaseThrow possible) {
+                    awaitInterrupted();
                 }
             }});
-        waitForThreadToEnterWaitState(thread);
-        assertSame(thread, s.getFirstQueuedThread());
-        assertTrue(s.hasQueuedPredecessors());
-        assertTrue(s.hasQueuedThreads());
-        assertEquals(1, s.getQueueLength());
+        for (long startTime = 0L;; ) {
+            waitForThreadToEnterWaitState(thread);
+            if (s.getFirstQueuedThread() == thread
+                && s.hasQueuedPredecessors()
+                && s.hasQueuedThreads()
+                && s.getQueueLength() == 1
+                && s.hasContended())
+                break;
+            if (startTime == 0L)
+                startTime = System.nanoTime();
+            else if (millisElapsedSince(startTime) > LONG_DELAY_MS)
+                fail("timed out waiting for AQS state: "
+                     + "thread state=" + thread.getState()
+                     + ", queued threads=" + s.getQueuedThreads());
+            Thread.yield();
+        }
 
         s.pleaseThrow = true;
-        thread.interrupt();
-        s.release(1);
+        // release and interrupt, in random order
+        if (randomBoolean()) {
+            thread.interrupt();
+            releaseAction.run();
+        } else {
+            releaseAction.run();
+            thread.interrupt();
+        }
         awaitTermination(thread);
+
+        if (! acquireInterruptibly)
+            assertTrue(thrown.get());
+
+        assertNull(s.getFirstQueuedThread());
+        assertFalse(s.hasQueuedPredecessors());
+        assertFalse(s.hasQueuedThreads());
+        assertEquals(0, s.getQueueLength());
+        assertTrue(s.getQueuedThreads().isEmpty());
+        assertTrue(s.hasContended());
     }
 
 }
--- a/test/jdk/java/util/concurrent/tck/ArrayBlockingQueueTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/tck/ArrayBlockingQueueTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -61,7 +61,7 @@
         class Implementation implements CollectionImplementation {
             public Class<?> klazz() { return ArrayBlockingQueue.class; }
             public Collection emptyCollection() {
-                boolean fair = ThreadLocalRandom.current().nextBoolean();
+                boolean fair = randomBoolean();
                 return populatedQueue(0, SIZE, 2 * SIZE, fair);
             }
             public Object makeElement(int i) { return i; }
@@ -367,7 +367,7 @@
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.WAITING);
         t.interrupt();
         awaitTermination(t);
         assertEquals(SIZE, q.size());
@@ -409,7 +409,7 @@
         assertEquals(0, q.take());
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.WAITING);
         t.interrupt();
         awaitTermination(t);
         assertEquals(0, q.remainingCapacity());
@@ -431,21 +431,21 @@
 
                 Thread.currentThread().interrupt();
                 try {
-                    q.offer(new Object(), 2 * LONG_DELAY_MS, MILLISECONDS);
+                    q.offer(new Object(), randomTimeout(), randomTimeUnit());
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
 
                 pleaseInterrupt.countDown();
                 try {
-                    q.offer(new Object(), 2 * LONG_DELAY_MS, MILLISECONDS);
+                    q.offer(new Object(), LONGER_DELAY_MS, MILLISECONDS);
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING);
         t.interrupt();
         awaitTermination(t);
     }
@@ -486,7 +486,7 @@
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.WAITING);
         t.interrupt();
         awaitTermination(t);
     }
@@ -539,29 +539,26 @@
         final CountDownLatch pleaseInterrupt = new CountDownLatch(1);
         Thread t = newStartedThread(new CheckedRunnable() {
             public void realRun() throws InterruptedException {
-                long startTime = System.nanoTime();
                 for (int i = 0; i < SIZE; i++)
                     assertEquals(i, (int) q.poll(LONG_DELAY_MS, MILLISECONDS));
 
                 Thread.currentThread().interrupt();
                 try {
-                    q.poll(LONG_DELAY_MS, MILLISECONDS);
+                    q.poll(randomTimeout(), randomTimeUnit());
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
 
                 pleaseInterrupt.countDown();
                 try {
-                    q.poll(LONG_DELAY_MS, MILLISECONDS);
+                    q.poll(LONGER_DELAY_MS, MILLISECONDS);
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
-
-                assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING);
         t.interrupt();
         awaitTermination(t);
         checkEmpty(q);
--- a/test/jdk/java/util/concurrent/tck/BlockingQueueTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/tck/BlockingQueueTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -253,7 +253,7 @@
 
                 Thread.currentThread().interrupt();
                 try {
-                    q.poll(LONG_DELAY_MS, MILLISECONDS);
+                    q.poll(randomTimeout(), randomTimeUnit());
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
@@ -274,7 +274,7 @@
         assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
 
         barrier.await();
-        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING);
         t.interrupt();
         awaitTermination(t);
     }
@@ -296,7 +296,7 @@
             }});
 
         await(threadStarted);
-        assertThreadBlocks(t, Thread.State.WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.WAITING);
         t.interrupt();
         awaitTermination(t);
     }
@@ -325,19 +325,19 @@
      */
     public void testTimedPollFromEmptyBlocksInterruptibly() {
         final BlockingQueue q = emptyCollection();
-        final CountDownLatch threadStarted = new CountDownLatch(1);
+        final CountDownLatch pleaseInterrupt = new CountDownLatch(1);
         Thread t = newStartedThread(new CheckedRunnable() {
             public void realRun() {
-                threadStarted.countDown();
+                pleaseInterrupt.countDown();
                 try {
-                    q.poll(2 * LONG_DELAY_MS, MILLISECONDS);
+                    q.poll(LONGER_DELAY_MS, MILLISECONDS);
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
             }});
 
-        await(threadStarted);
-        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
+        await(pleaseInterrupt);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING);
         t.interrupt();
         awaitTermination(t);
     }
@@ -352,7 +352,7 @@
             public void realRun() {
                 Thread.currentThread().interrupt();
                 try {
-                    q.poll(2 * LONG_DELAY_MS, MILLISECONDS);
+                    q.poll(LONGER_DELAY_MS, MILLISECONDS);
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
--- a/test/jdk/java/util/concurrent/tck/ConcurrentLinkedDequeTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/tck/ConcurrentLinkedDequeTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -940,7 +940,7 @@
     }
 
     void runAsync(Runnable r1, Runnable r2) {
-        boolean b = ThreadLocalRandom.current().nextBoolean();
+        boolean b = randomBoolean();
         CompletableFuture<Void> f1 = CompletableFuture.runAsync(b ? r1 : r2);
         CompletableFuture<Void> f2 = CompletableFuture.runAsync(b ? r2 : r1);
         f1.join();
@@ -1003,10 +1003,6 @@
         }
     }
 
-    <T> T chooseRandomly(T... choices) {
-        return choices[ThreadLocalRandom.current().nextInt(choices.length)];
-    }
-
     /**
      * Non-traversing Deque operations (that return null) are linearizable.
      * Don't return null when the deque is observably never empty.
--- a/test/jdk/java/util/concurrent/tck/CountDownLatchTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/tck/CountDownLatchTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -36,6 +36,7 @@
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
 
 import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ThreadLocalRandom;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
@@ -99,7 +100,7 @@
         assertEquals(2, l.getCount());
         l.countDown();
         assertEquals(1, l.getCount());
-        assertThreadBlocks(t, Thread.State.WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.WAITING);
         l.countDown();
         assertEquals(0, l.getCount());
         awaitTermination(t);
@@ -124,7 +125,7 @@
         assertEquals(2, l.getCount());
         l.countDown();
         assertEquals(1, l.getCount());
-        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING);
         l.countDown();
         assertEquals(0, l.getCount());
         awaitTermination(t);
@@ -156,7 +157,7 @@
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.WAITING);
         t.interrupt();
         awaitTermination(t);
     }
@@ -165,29 +166,30 @@
      * timed await throws InterruptedException if interrupted before counted down
      */
     public void testTimedAwait_Interruptible() {
-        final CountDownLatch l = new CountDownLatch(1);
+        final int initialCount = ThreadLocalRandom.current().nextInt(1, 3);
+        final CountDownLatch l = new CountDownLatch(initialCount);
         final CountDownLatch pleaseInterrupt = new CountDownLatch(1);
         Thread t = newStartedThread(new CheckedRunnable() {
             public void realRun() throws InterruptedException {
                 Thread.currentThread().interrupt();
                 try {
-                    l.await(LONG_DELAY_MS, MILLISECONDS);
+                    l.await(randomTimeout(), randomTimeUnit());
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
 
                 pleaseInterrupt.countDown();
                 try {
-                    l.await(LONG_DELAY_MS, MILLISECONDS);
+                    l.await(LONGER_DELAY_MS, MILLISECONDS);
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
 
-                assertEquals(1, l.getCount());
+                assertEquals(initialCount, l.getCount());
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING);
         t.interrupt();
         awaitTermination(t);
     }
@@ -200,7 +202,11 @@
         Thread t = newStartedThread(new CheckedRunnable() {
             public void realRun() throws InterruptedException {
                 assertEquals(1, l.getCount());
+
+                long startTime = System.nanoTime();
                 assertFalse(l.await(timeoutMillis(), MILLISECONDS));
+                assertTrue(millisElapsedSince(startTime) >= timeoutMillis());
+
                 assertEquals(1, l.getCount());
             }});
 
--- a/test/jdk/java/util/concurrent/tck/CyclicBarrierTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/tck/CyclicBarrierTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -42,7 +42,6 @@
 import java.util.concurrent.Executors;
 import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.TimeoutException;
-import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import junit.framework.Test;
@@ -323,34 +322,6 @@
     }
 
     /**
-     * All threads block while a barrier is broken.
-     */
-    public void testReset_Leakage() throws InterruptedException {
-        final CyclicBarrier c = new CyclicBarrier(2);
-        final AtomicBoolean done = new AtomicBoolean();
-        Thread t = newStartedThread(new CheckedRunnable() {
-            public void realRun() {
-                while (!done.get()) {
-                    try {
-                        while (c.isBroken())
-                            c.reset();
-
-                        c.await();
-                        shouldThrow();
-                    }
-                    catch (BrokenBarrierException | InterruptedException ok) {}
-                }}});
-
-        for (int i = 0; i < 4; i++) {
-            delay(timeoutMillis());
-            t.interrupt();
-        }
-        done.set(true);
-        t.interrupt();
-        awaitTermination(t);
-    }
-
-    /**
      * Reset of a non-broken barrier does not break barrier
      */
     public void testResetWithoutBreakage() throws Exception {
@@ -505,7 +476,7 @@
         final ExecutorService e = Executors.newFixedThreadPool(nTasks);
         final Runnable awaiter = () -> {
             try {
-                if (ThreadLocalRandom.current().nextBoolean())
+                if (randomBoolean())
                     barrier.await();
                 else
                     barrier.await(LONG_DELAY_MS, MILLISECONDS);
--- a/test/jdk/java/util/concurrent/tck/DelayQueueTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/tck/DelayQueueTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -332,7 +332,7 @@
     }
 
     /**
-     * timed offer does not time out
+     * Queue is unbounded, so timed offer never times out
      */
     public void testTimedOffer() throws InterruptedException {
         final DelayQueue q = new DelayQueue();
@@ -384,7 +384,7 @@
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.WAITING);
         t.interrupt();
         awaitTermination(t);
     }
@@ -436,30 +436,27 @@
         final DelayQueue q = populatedQueue(SIZE);
         Thread t = newStartedThread(new CheckedRunnable() {
             public void realRun() throws InterruptedException {
-                long startTime = System.nanoTime();
                 for (int i = 0; i < SIZE; i++)
                     assertEquals(new PDelay(i),
                                  ((PDelay)q.poll(LONG_DELAY_MS, MILLISECONDS)));
 
                 Thread.currentThread().interrupt();
                 try {
-                    q.poll(LONG_DELAY_MS, MILLISECONDS);
+                    q.poll(randomTimeout(), randomTimeUnit());
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
 
                 pleaseInterrupt.countDown();
                 try {
-                    q.poll(LONG_DELAY_MS, MILLISECONDS);
+                    q.poll(LONGER_DELAY_MS, MILLISECONDS);
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
-
-                assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING);
         t.interrupt();
         awaitTermination(t);
         checkEmpty(q);
--- a/test/jdk/java/util/concurrent/tck/DoubleAccumulatorTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/tck/DoubleAccumulatorTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -156,7 +156,7 @@
             = new DoubleAccumulator((x, y) -> x + y, 0.0);
         final int nThreads = ThreadLocalRandom.current().nextInt(1, 5);
         final Phaser phaser = new Phaser(nThreads + 1);
-        final int incs = 1_000_000;
+        final int incs = expensiveTests ? 1_000_000 : 100_000;
         final double total = nThreads * incs/2.0 * (incs - 1); // Gauss
         final Runnable task = () -> {
             phaser.arriveAndAwaitAdvance();
--- a/test/jdk/java/util/concurrent/tck/ForkJoinPool9Test.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/tck/ForkJoinPool9Test.java	Tue Sep 24 15:19:35 2019 -0400
@@ -38,7 +38,6 @@
 import java.util.concurrent.ForkJoinPool;
 import java.util.concurrent.ForkJoinTask;
 import java.util.concurrent.Future;
-import java.util.concurrent.ThreadLocalRandom;
 import java.util.stream.Stream;
 
 import junit.framework.Test;
@@ -81,7 +80,7 @@
             Thread currentThread = Thread.currentThread();
 
             Stream.of(systemClassLoader, null).forEach(cl -> {
-                if (ThreadLocalRandom.current().nextBoolean())
+                if (randomBoolean())
                     // should always be permitted, without effect
                     currentThread.setContextClassLoader(cl);
                 });
--- a/test/jdk/java/util/concurrent/tck/ForkJoinTask8Test.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/tck/ForkJoinTask8Test.java	Tue Sep 24 15:19:35 2019 -0400
@@ -559,6 +559,8 @@
                 AsyncFib f = new AsyncFib(8);
                 assertSame(f, f.fork());
                 helpQuiesce();
+                while (!f.isDone()) // wait out race
+                    ;
                 assertEquals(0, getQueuedTaskCount());
                 f.checkCompletedNormally();
             }};
--- a/test/jdk/java/util/concurrent/tck/ForkJoinTaskTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/tck/ForkJoinTaskTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -526,6 +526,8 @@
                 AsyncFib f = new AsyncFib(8);
                 assertSame(f, f.fork());
                 helpQuiesce();
+                while (!f.isDone()) // wait out race
+                    ;
                 assertEquals(21, f.number);
                 assertEquals(0, getQueuedTaskCount());
                 checkCompletedNormally(f);
--- a/test/jdk/java/util/concurrent/tck/FutureTaskTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/tck/FutureTaskTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -747,7 +747,7 @@
     /**
      * get is interruptible
      */
-    public void testGet_interruptible() {
+    public void testGet_Interruptible() {
         final CountDownLatch pleaseInterrupt = new CountDownLatch(1);
         final FutureTask task = new FutureTask(new NoOpCallable());
         Thread t = newStartedThread(new CheckedRunnable() {
@@ -776,27 +776,28 @@
     /**
      * timed get is interruptible
      */
-    public void testTimedGet_interruptible() {
+    public void testTimedGet_Interruptible() {
         final CountDownLatch pleaseInterrupt = new CountDownLatch(1);
         final FutureTask task = new FutureTask(new NoOpCallable());
         Thread t = newStartedThread(new CheckedRunnable() {
             public void realRun() throws Exception {
                 Thread.currentThread().interrupt();
                 try {
-                    task.get(2*LONG_DELAY_MS, MILLISECONDS);
+                    task.get(randomTimeout(), randomTimeUnit());
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
 
                 pleaseInterrupt.countDown();
                 try {
-                    task.get(2*LONG_DELAY_MS, MILLISECONDS);
+                    task.get(LONGER_DELAY_MS, MILLISECONDS);
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
             }});
 
         await(pleaseInterrupt);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING);
         t.interrupt();
         awaitTermination(t);
         checkNotDone(task);
--- a/test/jdk/java/util/concurrent/tck/JSR166TestCase.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/tck/JSR166TestCase.java	Tue Sep 24 15:19:35 2019 -0400
@@ -311,12 +311,13 @@
     static volatile TestCase currentTestCase;
     // static volatile int currentRun = 0;
     static {
-        Runnable checkForWedgedTest = new Runnable() { public void run() {
+        Runnable wedgedTestDetector = new Runnable() { public void run() {
             // Avoid spurious reports with enormous runsPerTest.
             // A single test case run should never take more than 1 second.
             // But let's cap it at the high end too ...
-            final int timeoutMinutes =
-                Math.min(15, Math.max(runsPerTest / 60, 1));
+            final int timeoutMinutesMin = Math.max(runsPerTest / 60, 1)
+                * Math.max((int) delayFactor, 1);
+            final int timeoutMinutes = Math.min(15, timeoutMinutesMin);
             for (TestCase lastTestCase = currentTestCase;;) {
                 try { MINUTES.sleep(timeoutMinutes); }
                 catch (InterruptedException unexpected) { break; }
@@ -336,7 +337,7 @@
                 }
                 lastTestCase = currentTestCase;
             }}};
-        Thread thread = new Thread(checkForWedgedTest, "checkForWedgedTest");
+        Thread thread = new Thread(wedgedTestDetector, "WedgedTestDetector");
         thread.setDaemon(true);
         thread.start();
     }
@@ -380,7 +381,7 @@
             // Never report first run of any test; treat it as a
             // warmup run, notably to trigger all needed classloading,
             if (i > 0)
-                System.out.printf("%n%s: %d%n", toString(), elapsedMillis);
+                System.out.printf("%s: %d%n", toString(), elapsedMillis);
         }
     }
 
@@ -683,6 +684,12 @@
     public static long MEDIUM_DELAY_MS;
     public static long LONG_DELAY_MS;
 
+    /**
+     * A delay significantly longer than LONG_DELAY_MS.
+     * Use this in a thread that is waited for via awaitTermination(Thread).
+     */
+    public static long LONGER_DELAY_MS;
+
     private static final long RANDOM_TIMEOUT;
     private static final long RANDOM_EXPIRED_TIMEOUT;
     private static final TimeUnit RANDOM_TIMEUNIT;
@@ -711,6 +718,20 @@
     static TimeUnit randomTimeUnit() { return RANDOM_TIMEUNIT; }
 
     /**
+     * Returns a random boolean; a "coin flip".
+     */
+    static boolean randomBoolean() {
+        return ThreadLocalRandom.current().nextBoolean();
+    }
+
+    /**
+     * Returns a random element from given choices.
+     */
+    <T> T chooseRandomly(T... choices) {
+        return choices[ThreadLocalRandom.current().nextInt(choices.length)];
+    }
+
+    /**
      * Returns the shortest timed delay. This can be scaled up for
      * slow machines using the jsr166.delay.factor system property,
      * or via jtreg's -timeoutFactor: flag.
@@ -728,6 +749,7 @@
         SMALL_DELAY_MS  = SHORT_DELAY_MS * 5;
         MEDIUM_DELAY_MS = SHORT_DELAY_MS * 10;
         LONG_DELAY_MS   = SHORT_DELAY_MS * 200;
+        LONGER_DELAY_MS = 2 * LONG_DELAY_MS;
     }
 
     private static final long TIMEOUT_DELAY_MS
@@ -766,8 +788,8 @@
      */
     public void threadRecordFailure(Throwable t) {
         System.err.println(t);
-        dumpTestThreads();
-        threadFailure.compareAndSet(null, t);
+        if (threadFailure.compareAndSet(null, t))
+            dumpTestThreads();
     }
 
     public void setUp() {
@@ -1088,6 +1110,39 @@
         }
     }
 
+    /** Returns true if thread info might be useful in a thread dump. */
+    static boolean threadOfInterest(ThreadInfo info) {
+        final String name = info.getThreadName();
+        String lockName;
+        if (name == null)
+            return true;
+        if (name.equals("Signal Dispatcher")
+            || name.equals("WedgedTestDetector"))
+            return false;
+        if (name.equals("Reference Handler")) {
+            // Reference Handler stacktrace changed in JDK-8156500
+            StackTraceElement[] stackTrace; String methodName;
+            if ((stackTrace = info.getStackTrace()) != null
+                && stackTrace.length > 0
+                && (methodName = stackTrace[0].getMethodName()) != null
+                && methodName.equals("waitForReferencePendingList"))
+                return false;
+            // jdk8 Reference Handler stacktrace
+            if ((lockName = info.getLockName()) != null
+                && lockName.startsWith("java.lang.ref"))
+                return false;
+        }
+        if ((name.equals("Finalizer") || name.equals("Common-Cleaner"))
+            && (lockName = info.getLockName()) != null
+            && lockName.startsWith("java.lang.ref"))
+            return false;
+        if (name.startsWith("ForkJoinPool.commonPool-worker")
+            && (lockName = info.getLockName()) != null
+            && lockName.startsWith("java.util.concurrent.ForkJoinPool"))
+            return false;
+        return true;
+    }
+
     /**
      * A debugging tool to print stack traces of most threads, as jstack does.
      * Uninteresting threads are filtered out.
@@ -1104,23 +1159,9 @@
 
         ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
         System.err.println("------ stacktrace dump start ------");
-        for (ThreadInfo info : threadMXBean.dumpAllThreads(true, true)) {
-            final String name = info.getThreadName();
-            String lockName;
-            if ("Signal Dispatcher".equals(name))
-                continue;
-            if ("Reference Handler".equals(name)
-                && (lockName = info.getLockName()) != null
-                && lockName.startsWith("java.lang.ref.Reference$Lock"))
-                continue;
-            if ("Finalizer".equals(name)
-                && (lockName = info.getLockName()) != null
-                && lockName.startsWith("java.lang.ref.ReferenceQueue$Lock"))
-                continue;
-            if ("checkForWedgedTest".equals(name))
-                continue;
-            System.err.print(info);
-        }
+        for (ThreadInfo info : threadMXBean.dumpAllThreads(true, true))
+            if (threadOfInterest(info))
+                System.err.print(info);
         System.err.println("------ stacktrace dump end ------");
 
         if (sm != null) System.setSecurityManager(sm);
@@ -1393,6 +1434,20 @@
     }
 
     /**
+     * Spin-waits up to LONG_DELAY_MS milliseconds for the current thread to
+     * be interrupted.  Clears the interrupt status before returning.
+     */
+    void awaitInterrupted() {
+        for (long startTime = 0L; !Thread.interrupted(); ) {
+            if (startTime == 0L)
+                startTime = System.nanoTime();
+            else if (millisElapsedSince(startTime) > LONG_DELAY_MS)
+                fail("timed out waiting for thread interrupt");
+            Thread.yield();
+        }
+    }
+
+    /**
      * Returns the number of milliseconds since time given by
      * startNanoTime, which must have been previously returned from a
      * call to {@link System#nanoTime()}.
@@ -1401,19 +1456,6 @@
         return NANOSECONDS.toMillis(System.nanoTime() - startNanoTime);
     }
 
-//     void assertTerminatesPromptly(long timeoutMillis, Runnable r) {
-//         long startTime = System.nanoTime();
-//         try {
-//             r.run();
-//         } catch (Throwable fail) { threadUnexpectedException(fail); }
-//         if (millisElapsedSince(startTime) > timeoutMillis/2)
-//             throw new AssertionError("did not return promptly");
-//     }
-
-//     void assertTerminatesPromptly(Runnable r) {
-//         assertTerminatesPromptly(LONG_DELAY_MS/2, r);
-//     }
-
     /**
      * Checks that timed f.get() returns the expected value, and does not
      * wait for the timeout to elapse before returning.
@@ -1448,15 +1490,21 @@
      * to terminate (using {@link Thread#join(long)}), else interrupts
      * the thread (in the hope that it may terminate later) and fails.
      */
-    void awaitTermination(Thread t, long timeoutMillis) {
+    void awaitTermination(Thread thread, long timeoutMillis) {
         try {
-            t.join(timeoutMillis);
+            thread.join(timeoutMillis);
         } catch (InterruptedException fail) {
             threadUnexpectedException(fail);
-        } finally {
-            if (t.getState() != Thread.State.TERMINATED) {
-                t.interrupt();
-                threadFail("timed out waiting for thread to terminate");
+        }
+        if (thread.getState() != Thread.State.TERMINATED) {
+            String detail = String.format(
+                    "timed out waiting for thread to terminate, thread=%s, state=%s" ,
+                    thread, thread.getState());
+            try {
+                threadFail(detail);
+            } finally {
+                // Interrupt thread __after__ having reported its stack trace
+                thread.interrupt();
             }
         }
     }
--- a/test/jdk/java/util/concurrent/tck/LinkedBlockingDequeTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/tck/LinkedBlockingDequeTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -631,7 +631,7 @@
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.WAITING);
         t.interrupt();
         awaitTermination(t);
         assertEquals(SIZE, q.size());
@@ -673,7 +673,7 @@
         assertEquals(0, q.take());
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.WAITING);
         t.interrupt();
         awaitTermination(t);
         assertEquals(0, q.remainingCapacity());
@@ -690,26 +690,27 @@
                 q.put(new Object());
                 q.put(new Object());
                 long startTime = System.nanoTime();
+
                 assertFalse(q.offer(new Object(), timeoutMillis(), MILLISECONDS));
                 assertTrue(millisElapsedSince(startTime) >= timeoutMillis());
 
                 Thread.currentThread().interrupt();
                 try {
-                    q.offer(new Object(), 2 * LONG_DELAY_MS, MILLISECONDS);
+                    q.offer(new Object(), randomTimeout(), randomTimeUnit());
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
 
                 pleaseInterrupt.countDown();
                 try {
-                    q.offer(new Object(), 2 * LONG_DELAY_MS, MILLISECONDS);
+                    q.offer(new Object(), LONGER_DELAY_MS, MILLISECONDS);
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING);
         t.interrupt();
         awaitTermination(t);
     }
@@ -750,7 +751,7 @@
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.WAITING);
         t.interrupt();
         awaitTermination(t);
     }
@@ -802,29 +803,26 @@
         final CountDownLatch pleaseInterrupt = new CountDownLatch(1);
         Thread t = newStartedThread(new CheckedRunnable() {
             public void realRun() throws InterruptedException {
-                long startTime = System.nanoTime();
                 for (int i = 0; i < SIZE; i++)
                     assertEquals(i, (int) q.poll(LONG_DELAY_MS, MILLISECONDS));
 
                 Thread.currentThread().interrupt();
                 try {
-                    q.poll(LONG_DELAY_MS, MILLISECONDS);
+                    q.poll(randomTimeout(), randomTimeUnit());
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
 
                 pleaseInterrupt.countDown();
                 try {
-                    q.poll(LONG_DELAY_MS, MILLISECONDS);
+                    q.poll(LONGER_DELAY_MS, MILLISECONDS);
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
-
-                assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING);
         t.interrupt();
         awaitTermination(t);
         checkEmpty(q);
@@ -883,7 +881,7 @@
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.WAITING);
         t.interrupt();
         awaitTermination(t);
         assertEquals(SIZE, q.size());
@@ -918,7 +916,7 @@
         assertEquals(capacity - 1, q.take());
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.WAITING);
         t.interrupt();
         awaitTermination(t);
         assertEquals(0, q.remainingCapacity());
@@ -935,26 +933,27 @@
                 q.putFirst(new Object());
                 q.putFirst(new Object());
                 long startTime = System.nanoTime();
+
                 assertFalse(q.offerFirst(new Object(), timeoutMillis(), MILLISECONDS));
                 assertTrue(millisElapsedSince(startTime) >= timeoutMillis());
 
                 Thread.currentThread().interrupt();
                 try {
-                    q.offerFirst(new Object(), 2 * LONG_DELAY_MS, MILLISECONDS);
+                    q.offerFirst(new Object(), randomTimeout(), randomTimeUnit());
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
 
                 pleaseInterrupt.countDown();
                 try {
-                    q.offerFirst(new Object(), 2 * LONG_DELAY_MS, MILLISECONDS);
+                    q.offerFirst(new Object(), LONGER_DELAY_MS, MILLISECONDS);
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING);
         t.interrupt();
         awaitTermination(t);
     }
@@ -986,7 +985,7 @@
             }});
 
         await(threadStarted);
-        assertThreadBlocks(t, Thread.State.WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.WAITING);
         t.interrupt();
         awaitTermination(t);
     }
@@ -1027,7 +1026,7 @@
             }});
 
         await(threadStarted);
-        assertThreadBlocks(t, Thread.State.WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.WAITING);
         t.interrupt();
         awaitTermination(t);
     }
@@ -1077,7 +1076,7 @@
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.WAITING);
         t.interrupt();
         awaitTermination(t);
     }
@@ -1118,29 +1117,26 @@
         final CountDownLatch pleaseInterrupt = new CountDownLatch(1);
         Thread t = newStartedThread(new CheckedRunnable() {
             public void realRun() throws InterruptedException {
-                long startTime = System.nanoTime();
                 for (int i = 0; i < SIZE; i++)
                     assertEquals(i, q.pollFirst(LONG_DELAY_MS, MILLISECONDS));
 
                 Thread.currentThread().interrupt();
                 try {
-                    q.pollFirst(LONG_DELAY_MS, MILLISECONDS);
+                    q.pollFirst(randomTimeout(), randomTimeUnit());
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
 
                 pleaseInterrupt.countDown();
                 try {
-                    q.pollFirst(LONG_DELAY_MS, MILLISECONDS);
+                    q.pollFirst(LONGER_DELAY_MS, MILLISECONDS);
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
-
-                assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING);
         t.interrupt();
         awaitTermination(t);
     }
@@ -1164,7 +1160,7 @@
 
                 Thread.currentThread().interrupt();
                 try {
-                    q.pollFirst(LONG_DELAY_MS, MILLISECONDS);
+                    q.pollFirst(randomTimeout(), randomTimeUnit());
                     shouldThrow();
                 } catch (InterruptedException success) {}
 
@@ -1174,6 +1170,7 @@
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
+
                 assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
             }});
 
@@ -1182,7 +1179,7 @@
         assertTrue(q.offerFirst(zero, LONG_DELAY_MS, MILLISECONDS));
         assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
         barrier.await();
-        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING);
         t.interrupt();
         awaitTermination(t);
     }
@@ -1240,7 +1237,7 @@
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.WAITING);
         t.interrupt();
         awaitTermination(t);
         assertEquals(SIZE, q.size());
@@ -1282,7 +1279,7 @@
         assertEquals(0, q.take());
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.WAITING);
         t.interrupt();
         awaitTermination(t);
         assertEquals(0, q.remainingCapacity());
@@ -1299,24 +1296,25 @@
                 q.putLast(new Object());
                 q.putLast(new Object());
                 long startTime = System.nanoTime();
+
                 assertFalse(q.offerLast(new Object(), timeoutMillis(), MILLISECONDS));
                 assertTrue(millisElapsedSince(startTime) >= timeoutMillis());
 
                 Thread.currentThread().interrupt();
                 try {
-                    q.offerLast(new Object(), 2 * LONG_DELAY_MS, MILLISECONDS);
+                    q.offerLast(new Object(), randomTimeout(), randomTimeUnit());
                     shouldThrow();
                 } catch (InterruptedException success) {}
 
                 pleaseInterrupt.countDown();
                 try {
-                    q.offerLast(new Object(), 2 * LONG_DELAY_MS, MILLISECONDS);
+                    q.offerLast(new Object(), LONGER_DELAY_MS, MILLISECONDS);
                     shouldThrow();
                 } catch (InterruptedException success) {}
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING);
         t.interrupt();
         awaitTermination(t);
     }
@@ -1358,7 +1356,7 @@
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.WAITING);
         t.interrupt();
         awaitTermination(t);
     }
@@ -1399,30 +1397,27 @@
         final CountDownLatch pleaseInterrupt = new CountDownLatch(1);
         Thread t = newStartedThread(new CheckedRunnable() {
             public void realRun() throws InterruptedException {
-                long startTime = System.nanoTime();
                 for (int i = 0; i < SIZE; i++)
                     assertEquals(SIZE - i - 1,
                                  q.pollLast(LONG_DELAY_MS, MILLISECONDS));
 
                 Thread.currentThread().interrupt();
                 try {
-                    q.pollLast(LONG_DELAY_MS, MILLISECONDS);
+                    q.pollLast(randomTimeout(), randomTimeUnit());
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
 
                 pleaseInterrupt.countDown();
                 try {
-                    q.pollLast(LONG_DELAY_MS, MILLISECONDS);
+                    q.pollLast(LONGER_DELAY_MS, MILLISECONDS);
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
-
-                assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING);
         t.interrupt();
         awaitTermination(t);
         checkEmpty(q);
@@ -1447,7 +1442,7 @@
 
                 Thread.currentThread().interrupt();
                 try {
-                    q.poll(LONG_DELAY_MS, MILLISECONDS);
+                    q.poll(randomTimeout(), randomTimeUnit());
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
@@ -1468,7 +1463,7 @@
         assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
 
         barrier.await();
-        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING);
         t.interrupt();
         awaitTermination(t);
     }
--- a/test/jdk/java/util/concurrent/tck/LinkedBlockingQueueTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/tck/LinkedBlockingQueueTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -318,7 +318,7 @@
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.WAITING);
         t.interrupt();
         awaitTermination(t);
         assertEquals(SIZE, q.size());
@@ -360,7 +360,7 @@
         assertEquals(0, q.take());
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.WAITING);
         t.interrupt();
         awaitTermination(t);
         assertEquals(0, q.remainingCapacity());
@@ -376,28 +376,28 @@
             public void realRun() throws InterruptedException {
                 q.put(new Object());
                 q.put(new Object());
+                long startTime = System.nanoTime();
 
-                long startTime = System.nanoTime();
                 assertFalse(q.offer(new Object(), timeoutMillis(), MILLISECONDS));
                 assertTrue(millisElapsedSince(startTime) >= timeoutMillis());
 
                 Thread.currentThread().interrupt();
                 try {
-                    q.offer(new Object(), 2 * LONG_DELAY_MS, MILLISECONDS);
+                    q.offer(new Object(), randomTimeout(), randomTimeUnit());
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
 
                 pleaseInterrupt.countDown();
                 try {
-                    q.offer(new Object(), 2 * LONG_DELAY_MS, MILLISECONDS);
+                    q.offer(new Object(), LONGER_DELAY_MS, MILLISECONDS);
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING);
         t.interrupt();
         awaitTermination(t);
     }
@@ -438,7 +438,7 @@
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.WAITING);
         t.interrupt();
         awaitTermination(t);
     }
@@ -490,29 +490,26 @@
         final CountDownLatch pleaseInterrupt = new CountDownLatch(1);
         Thread t = newStartedThread(new CheckedRunnable() {
             public void realRun() throws InterruptedException {
-                long startTime = System.nanoTime();
                 for (int i = 0; i < SIZE; i++)
                     assertEquals(i, (int) q.poll(LONG_DELAY_MS, MILLISECONDS));
 
                 Thread.currentThread().interrupt();
                 try {
-                    q.poll(LONG_DELAY_MS, MILLISECONDS);
+                    q.poll(randomTimeout(), randomTimeUnit());
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
 
                 pleaseInterrupt.countDown();
                 try {
-                    q.poll(LONG_DELAY_MS, MILLISECONDS);
+                    q.poll(LONGER_DELAY_MS, MILLISECONDS);
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
-
-                assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING);
         t.interrupt();
         awaitTermination(t);
         checkEmpty(q);
--- a/test/jdk/java/util/concurrent/tck/LinkedTransferQueueTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/tck/LinkedTransferQueueTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -254,7 +254,7 @@
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.WAITING);
         t.interrupt();
         awaitTermination(t);
     }
@@ -308,29 +308,26 @@
         final CountDownLatch pleaseInterrupt = new CountDownLatch(1);
         Thread t = newStartedThread(new CheckedRunnable() {
             public void realRun() throws InterruptedException {
-                long startTime = System.nanoTime();
                 for (int i = 0; i < SIZE; i++)
                     assertEquals(i, (int) q.poll(LONG_DELAY_MS, MILLISECONDS));
 
                 Thread.currentThread().interrupt();
                 try {
-                    q.poll(LONG_DELAY_MS, MILLISECONDS);
+                    q.poll(randomTimeout(), randomTimeUnit());
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
 
                 pleaseInterrupt.countDown();
                 try {
-                    q.poll(LONG_DELAY_MS, MILLISECONDS);
+                    q.poll(LONGER_DELAY_MS, MILLISECONDS);
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
-
-                assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING);
         t.interrupt();
         awaitTermination(t);
         checkEmpty(q);
@@ -344,16 +341,14 @@
         final BlockingQueue<Integer> q = populatedQueue(SIZE);
         Thread t = newStartedThread(new CheckedRunnable() {
             public void realRun() throws InterruptedException {
-                long startTime = System.nanoTime();
                 Thread.currentThread().interrupt();
                 for (int i = 0; i < SIZE; ++i)
-                    assertEquals(i, (int) q.poll(LONG_DELAY_MS, MILLISECONDS));
+                    assertEquals(i, (int) q.poll(randomTimeout(), randomTimeUnit()));
                 try {
-                    q.poll(LONG_DELAY_MS, MILLISECONDS);
+                    q.poll(randomTimeout(), randomTimeUnit());
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
-                assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
             }});
 
         awaitTermination(t);
@@ -982,25 +977,23 @@
 
         Thread t = newStartedThread(new CheckedRunnable() {
             public void realRun() throws InterruptedException {
-                long startTime = System.nanoTime();
                 Thread.currentThread().interrupt();
                 try {
-                    q.tryTransfer(new Object(), LONG_DELAY_MS, MILLISECONDS);
+                    q.tryTransfer(new Object(), randomTimeout(), randomTimeUnit());
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
 
                 pleaseInterrupt.countDown();
                 try {
-                    q.tryTransfer(new Object(), LONG_DELAY_MS, MILLISECONDS);
+                    q.tryTransfer(new Object(), LONGER_DELAY_MS, MILLISECONDS);
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
-                assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING);
         t.interrupt();
         awaitTermination(t);
         checkEmpty(q);
--- a/test/jdk/java/util/concurrent/tck/LongAccumulatorTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/tck/LongAccumulatorTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -150,7 +150,7 @@
             = new LongAccumulator((x, y) -> x + y, 0L);
         final int nThreads = ThreadLocalRandom.current().nextInt(1, 5);
         final Phaser phaser = new Phaser(nThreads + 1);
-        final int incs = 1_000_000;
+        final int incs = expensiveTests ? 1_000_000 : 100_000;
         final long total = nThreads * incs/2L * (incs - 1); // Gauss
         final Runnable task = () -> {
             phaser.arriveAndAwaitAdvance();
--- a/test/jdk/java/util/concurrent/tck/MapTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/tck/MapTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -122,6 +122,7 @@
      */
     public void testBug8186171() {
         if (!impl.supportsSetValue()) return;
+        if (!atLeastJava10()) return; // jdk9 is no longer maintained
         final ThreadLocalRandom rnd = ThreadLocalRandom.current();
         final boolean permitsNullValues = impl.permitsNullValues();
         final Object v1 = (permitsNullValues && rnd.nextBoolean())
--- a/test/jdk/java/util/concurrent/tck/PhaserTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/tck/PhaserTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -480,7 +480,7 @@
     /**
      * awaitAdvanceInterruptibly blocks interruptibly
      */
-    public void testAwaitAdvanceInterruptibly_interruptible() throws InterruptedException {
+    public void testAwaitAdvanceInterruptibly_Interruptible() throws InterruptedException {
         final Phaser phaser = new Phaser(1);
         final CountDownLatch pleaseInterrupt = new CountDownLatch(2);
 
@@ -505,14 +505,14 @@
             public void realRun() throws TimeoutException {
                 Thread.currentThread().interrupt();
                 try {
-                    phaser.awaitAdvanceInterruptibly(0, 2*LONG_DELAY_MS, MILLISECONDS);
+                    phaser.awaitAdvanceInterruptibly(0, randomTimeout(), randomTimeUnit());
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
 
                 pleaseInterrupt.countDown();
                 try {
-                    phaser.awaitAdvanceInterruptibly(0, 2*LONG_DELAY_MS, MILLISECONDS);
+                    phaser.awaitAdvanceInterruptibly(0, LONGER_DELAY_MS, MILLISECONDS);
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
@@ -520,8 +520,8 @@
 
         await(pleaseInterrupt);
         assertState(phaser, 0, 1, 1);
-        assertThreadBlocks(t1, Thread.State.WAITING);
-        assertThreadBlocks(t2, Thread.State.TIMED_WAITING);
+        if (randomBoolean()) assertThreadBlocks(t1, Thread.State.WAITING);
+        if (randomBoolean()) assertThreadBlocks(t2, Thread.State.TIMED_WAITING);
         t1.interrupt();
         t2.interrupt();
         awaitTermination(t1);
--- a/test/jdk/java/util/concurrent/tck/PriorityBlockingQueueTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/tck/PriorityBlockingQueueTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -346,7 +346,7 @@
     }
 
     /**
-     * timed offer does not time out
+     * Queue is unbounded, so timed offer never times out
      */
     public void testTimedOffer() {
         final PriorityBlockingQueue q = new PriorityBlockingQueue(2);
@@ -397,7 +397,7 @@
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.WAITING);
         t.interrupt();
         awaitTermination(t);
     }
@@ -449,29 +449,26 @@
         final CountDownLatch pleaseInterrupt = new CountDownLatch(1);
         Thread t = newStartedThread(new CheckedRunnable() {
             public void realRun() throws InterruptedException {
-                long startTime = System.nanoTime();
                 for (int i = 0; i < SIZE; i++)
                     assertEquals(i, (int) q.poll(LONG_DELAY_MS, MILLISECONDS));
 
                 Thread.currentThread().interrupt();
                 try {
-                    q.poll(LONG_DELAY_MS, MILLISECONDS);
+                    q.poll(randomTimeout(), randomTimeUnit());
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
 
                 pleaseInterrupt.countDown();
                 try {
-                    q.poll(LONG_DELAY_MS, MILLISECONDS);
+                    q.poll(LONGER_DELAY_MS, MILLISECONDS);
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
-
-                assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING);
         t.interrupt();
         awaitTermination(t);
     }
--- a/test/jdk/java/util/concurrent/tck/ScheduledExecutorSubclassTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/tck/ScheduledExecutorSubclassTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -707,7 +707,7 @@
         Runnable waiter = new CheckedRunnable() { public void realRun() {
             threadsStarted.countDown();
             try {
-                MILLISECONDS.sleep(2 * LONG_DELAY_MS);
+                MILLISECONDS.sleep(LONGER_DELAY_MS);
             } catch (InterruptedException success) {}
             ran.getAndIncrement();
         }};
--- a/test/jdk/java/util/concurrent/tck/ScheduledExecutorTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/tck/ScheduledExecutorTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -666,7 +666,7 @@
         Runnable waiter = new CheckedRunnable() { public void realRun() {
             threadsStarted.countDown();
             try {
-                MILLISECONDS.sleep(2 * LONG_DELAY_MS);
+                MILLISECONDS.sleep(LONGER_DELAY_MS);
             } catch (InterruptedException success) {}
             ran.getAndIncrement();
         }};
--- a/test/jdk/java/util/concurrent/tck/SemaphoreTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/tck/SemaphoreTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -38,7 +38,6 @@
 import java.util.Collection;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Semaphore;
-import java.util.concurrent.ThreadLocalRandom;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
@@ -220,24 +219,22 @@
     /**
      * timed tryAcquire times out
      */
-    public void testTryAcquire_timeout() {
-        final boolean fair = ThreadLocalRandom.current().nextBoolean();
+    public void testTryAcquire_timeout() throws InterruptedException {
+        final boolean fair = randomBoolean();
         final Semaphore s = new Semaphore(0, fair);
         final long startTime = System.nanoTime();
-        try { assertFalse(s.tryAcquire(timeoutMillis(), MILLISECONDS)); }
-        catch (InterruptedException e) { threadUnexpectedException(e); }
+        assertFalse(s.tryAcquire(timeoutMillis(), MILLISECONDS));
         assertTrue(millisElapsedSince(startTime) >= timeoutMillis());
     }
 
     /**
      * timed tryAcquire(N) times out
      */
-    public void testTryAcquireN_timeout() {
-        final boolean fair = ThreadLocalRandom.current().nextBoolean();
+    public void testTryAcquireN_timeout() throws InterruptedException {
+        final boolean fair = randomBoolean();
         final Semaphore s = new Semaphore(2, fair);
         final long startTime = System.nanoTime();
-        try { assertFalse(s.tryAcquire(3, timeoutMillis(), MILLISECONDS)); }
-        catch (InterruptedException e) { threadUnexpectedException(e); }
+        assertFalse(s.tryAcquire(3, timeoutMillis(), MILLISECONDS));
         assertTrue(millisElapsedSince(startTime) >= timeoutMillis());
     }
 
--- a/test/jdk/java/util/concurrent/tck/SynchronousQueueTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/tck/SynchronousQueueTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -45,7 +45,6 @@
 import java.util.concurrent.Executors;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.SynchronousQueue;
-import java.util.concurrent.ThreadLocalRandom;
 
 import junit.framework.Test;
 
@@ -166,7 +165,7 @@
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.WAITING);
         t.interrupt();
         awaitTermination(t);
         assertEquals(0, q.remainingCapacity());
@@ -207,7 +206,7 @@
         catch (InterruptedException e) { threadUnexpectedException(e); }
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.WAITING);
         t.interrupt();
         awaitTermination(t);
         assertEquals(0, q.remainingCapacity());
@@ -217,32 +216,33 @@
      * timed offer times out if elements not taken
      */
     public void testTimedOffer() {
-        final boolean fair = ThreadLocalRandom.current().nextBoolean();
+        final boolean fair = randomBoolean();
         final SynchronousQueue q = new SynchronousQueue(fair);
         final CountDownLatch pleaseInterrupt = new CountDownLatch(1);
         Thread t = newStartedThread(new CheckedRunnable() {
             public void realRun() throws InterruptedException {
                 long startTime = System.nanoTime();
+
                 assertFalse(q.offer(new Object(), timeoutMillis(), MILLISECONDS));
                 assertTrue(millisElapsedSince(startTime) >= timeoutMillis());
 
                 Thread.currentThread().interrupt();
                 try {
-                    q.offer(new Object(), 2 * LONG_DELAY_MS, MILLISECONDS);
+                    q.offer(new Object(), randomTimeout(), randomTimeUnit());
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
 
                 pleaseInterrupt.countDown();
                 try {
-                    q.offer(new Object(), 2 * LONG_DELAY_MS, MILLISECONDS);
+                    q.offer(new Object(), LONGER_DELAY_MS, MILLISECONDS);
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING);
         t.interrupt();
         awaitTermination(t);
     }
@@ -272,7 +272,7 @@
      * timed poll with nonzero timeout times out if no active putter
      */
     public void testTimedPoll() {
-        final boolean fair = ThreadLocalRandom.current().nextBoolean();
+        final boolean fair = randomBoolean();
         final SynchronousQueue q = new SynchronousQueue(fair);
         final long startTime = System.nanoTime();
         try { assertNull(q.poll(timeoutMillis(), MILLISECONDS)); }
@@ -285,7 +285,7 @@
      * after offer succeeds; on interruption throws
      */
     public void testTimedPollWithOffer() {
-        final boolean fair = ThreadLocalRandom.current().nextBoolean();
+        final boolean fair = randomBoolean();
         final SynchronousQueue q = new SynchronousQueue(fair);
         final CountDownLatch pleaseOffer = new CountDownLatch(1);
         final CountDownLatch pleaseInterrupt = new CountDownLatch(1);
@@ -301,7 +301,7 @@
 
                 Thread.currentThread().interrupt();
                 try {
-                    q.poll(LONG_DELAY_MS, MILLISECONDS);
+                    q.poll(randomTimeout(), randomTimeUnit());
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
@@ -323,7 +323,7 @@
         assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING);
         t.interrupt();
         awaitTermination(t);
     }
--- a/test/jdk/java/util/concurrent/tck/ThreadPoolExecutorSubclassTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/tck/ThreadPoolExecutorSubclassTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -796,7 +796,7 @@
         Runnable waiter = new CheckedRunnable() { public void realRun() {
             threadsStarted.countDown();
             try {
-                MILLISECONDS.sleep(2 * LONG_DELAY_MS);
+                MILLISECONDS.sleep(LONGER_DELAY_MS);
             } catch (InterruptedException success) {}
             ran.getAndIncrement();
         }};
@@ -1669,7 +1669,7 @@
             l.add(latchAwaitingStringTask(latch));
             l.add(null);
             try {
-                e.invokeAny(l, randomTimeout(), MILLISECONDS);
+                e.invokeAny(l, randomTimeout(), randomTimeUnit());
                 shouldThrow();
             } catch (NullPointerException success) {}
             latch.countDown();
--- a/test/jdk/java/util/concurrent/tck/ThreadPoolExecutorTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/tck/ThreadPoolExecutorTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -699,7 +699,7 @@
         Runnable waiter = new CheckedRunnable() { public void realRun() {
             threadsStarted.countDown();
             try {
-                MILLISECONDS.sleep(2 * LONG_DELAY_MS);
+                MILLISECONDS.sleep(LONGER_DELAY_MS);
             } catch (InterruptedException success) {}
             ran.getAndIncrement();
         }};
--- a/test/jdk/java/util/concurrent/tck/TimeUnitTest.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/java/util/concurrent/tck/TimeUnitTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -56,243 +56,56 @@
         return new TestSuite(TimeUnitTest.class);
     }
 
-    // (loops to 88888 check increments at all time divisions.)
-
-    /**
-     * convert correctly converts sample values across the units
-     */
-    public void testConvert() {
-        for (long t = 0; t < 88888; ++t) {
-            assertEquals(t*60*60*24,
-                         SECONDS.convert(t, DAYS));
-            assertEquals(t*60*60,
-                         SECONDS.convert(t, HOURS));
-            assertEquals(t*60,
-                         SECONDS.convert(t, MINUTES));
-            assertEquals(t,
-                         SECONDS.convert(t, SECONDS));
-            assertEquals(t,
-                         SECONDS.convert(1000L*t, MILLISECONDS));
-            assertEquals(t,
-                         SECONDS.convert(1000000L*t, MICROSECONDS));
-            assertEquals(t,
-                         SECONDS.convert(1000000000L*t, NANOSECONDS));
-
-            assertEquals(1000L*t*60*60*24,
-                         MILLISECONDS.convert(t, DAYS));
-            assertEquals(1000L*t*60*60,
-                         MILLISECONDS.convert(t, HOURS));
-            assertEquals(1000L*t*60,
-                         MILLISECONDS.convert(t, MINUTES));
-            assertEquals(1000L*t,
-                         MILLISECONDS.convert(t, SECONDS));
-            assertEquals(t,
-                         MILLISECONDS.convert(t, MILLISECONDS));
-            assertEquals(t,
-                         MILLISECONDS.convert(1000L*t, MICROSECONDS));
-            assertEquals(t,
-                         MILLISECONDS.convert(1000000L*t, NANOSECONDS));
-
-            assertEquals(1000000L*t*60*60*24,
-                         MICROSECONDS.convert(t, DAYS));
-            assertEquals(1000000L*t*60*60,
-                         MICROSECONDS.convert(t, HOURS));
-            assertEquals(1000000L*t*60,
-                         MICROSECONDS.convert(t, MINUTES));
-            assertEquals(1000000L*t,
-                         MICROSECONDS.convert(t, SECONDS));
-            assertEquals(1000L*t,
-                         MICROSECONDS.convert(t, MILLISECONDS));
-            assertEquals(t,
-                         MICROSECONDS.convert(t, MICROSECONDS));
-            assertEquals(t,
-                         MICROSECONDS.convert(1000L*t, NANOSECONDS));
-
-            assertEquals(1000000000L*t*60*60*24,
-                         NANOSECONDS.convert(t, DAYS));
-            assertEquals(1000000000L*t*60*60,
-                         NANOSECONDS.convert(t, HOURS));
-            assertEquals(1000000000L*t*60,
-                         NANOSECONDS.convert(t, MINUTES));
-            assertEquals(1000000000L*t,
-                         NANOSECONDS.convert(t, SECONDS));
-            assertEquals(1000000L*t,
-                         NANOSECONDS.convert(t, MILLISECONDS));
-            assertEquals(1000L*t,
-                         NANOSECONDS.convert(t, MICROSECONDS));
-            assertEquals(t,
-                         NANOSECONDS.convert(t, NANOSECONDS));
+    void testConversion(TimeUnit x, TimeUnit y, long n, long expected) {
+        assertEquals(expected, x.convert(n, y));
+        switch (x) {
+        case NANOSECONDS:  assertEquals(expected, y.toNanos(n));   break;
+        case MICROSECONDS: assertEquals(expected, y.toMicros(n));  break;
+        case MILLISECONDS: assertEquals(expected, y.toMillis(n));  break;
+        case SECONDS:      assertEquals(expected, y.toSeconds(n)); break;
+        case MINUTES:      assertEquals(expected, y.toMinutes(n)); break;
+        case HOURS:        assertEquals(expected, y.toHours(n));   break;
+        case DAYS:         assertEquals(expected, y.toDays(n));    break;
+        default: throw new AssertionError();
         }
 
-        for (TimeUnit x : TimeUnit.values()) {
-            long[] zs = {
-                0, 1, -1,
-                Integer.MAX_VALUE, Integer.MIN_VALUE,
-                Long.MAX_VALUE, Long.MIN_VALUE,
-            };
-            for (long z : zs) assertEquals(z, x.convert(z, x));
-        }
+        if (n > 0) testConversion(x, y, -n, -expected);
     }
 
-    /**
-     * toNanos correctly converts sample values in different units to
-     * nanoseconds
-     */
-    public void testToNanos() {
-        for (long t = 0; t < 88888; ++t) {
-            assertEquals(t*1000000000L*60*60*24,
-                         DAYS.toNanos(t));
-            assertEquals(t*1000000000L*60*60,
-                         HOURS.toNanos(t));
-            assertEquals(t*1000000000L*60,
-                         MINUTES.toNanos(t));
-            assertEquals(1000000000L*t,
-                         SECONDS.toNanos(t));
-            assertEquals(1000000L*t,
-                         MILLISECONDS.toNanos(t));
-            assertEquals(1000L*t,
-                         MICROSECONDS.toNanos(t));
-            assertEquals(t,
-                         NANOSECONDS.toNanos(t));
+    void testConversion(TimeUnit x, TimeUnit y) {
+        long ratio = x.toNanos(1)/y.toNanos(1);
+        assertTrue(ratio > 0);
+        long[] ns = { 0, 1, 2, Long.MAX_VALUE/ratio, Long.MIN_VALUE/ratio };
+        for (long n : ns) {
+            testConversion(y, x, n, n * ratio);
+            long[] ks = { n * ratio, n * ratio + 1, n * ratio - 1 };
+            for (long k : ks) {
+                testConversion(x, y, k, k / ratio);
+            }
         }
     }
 
     /**
-     * toMicros correctly converts sample values in different units to
-     * microseconds
-     */
-    public void testToMicros() {
-        for (long t = 0; t < 88888; ++t) {
-            assertEquals(t*1000000L*60*60*24,
-                         DAYS.toMicros(t));
-            assertEquals(t*1000000L*60*60,
-                         HOURS.toMicros(t));
-            assertEquals(t*1000000L*60,
-                         MINUTES.toMicros(t));
-            assertEquals(1000000L*t,
-                         SECONDS.toMicros(t));
-            assertEquals(1000L*t,
-                         MILLISECONDS.toMicros(t));
-            assertEquals(t,
-                         MICROSECONDS.toMicros(t));
-            assertEquals(t,
-                         NANOSECONDS.toMicros(t*1000L));
-        }
-    }
-
-    /**
-     * toMillis correctly converts sample values in different units to
-     * milliseconds
+     * Conversion methods correctly convert sample values
      */
-    public void testToMillis() {
-        for (long t = 0; t < 88888; ++t) {
-            assertEquals(t*1000L*60*60*24,
-                         DAYS.toMillis(t));
-            assertEquals(t*1000L*60*60,
-                         HOURS.toMillis(t));
-            assertEquals(t*1000L*60,
-                         MINUTES.toMillis(t));
-            assertEquals(1000L*t,
-                         SECONDS.toMillis(t));
-            assertEquals(t,
-                         MILLISECONDS.toMillis(t));
-            assertEquals(t,
-                         MICROSECONDS.toMillis(t*1000L));
-            assertEquals(t,
-                         NANOSECONDS.toMillis(t*1000000L));
-        }
-    }
-
-    /**
-     * toSeconds correctly converts sample values in different units to
-     * seconds
-     */
-    public void testToSeconds() {
-        for (long t = 0; t < 88888; ++t) {
-            assertEquals(t*60*60*24,
-                         DAYS.toSeconds(t));
-            assertEquals(t*60*60,
-                         HOURS.toSeconds(t));
-            assertEquals(t*60,
-                         MINUTES.toSeconds(t));
-            assertEquals(t,
-                         SECONDS.toSeconds(t));
-            assertEquals(t,
-                         MILLISECONDS.toSeconds(t*1000L));
-            assertEquals(t,
-                         MICROSECONDS.toSeconds(t*1000000L));
-            assertEquals(t,
-                         NANOSECONDS.toSeconds(t*1000000000L));
-        }
-    }
+    public void testConversions() {
+        // Sanity check
+        assertEquals(1, NANOSECONDS.toNanos(1));
+        assertEquals(1000L * NANOSECONDS.toNanos(1), MICROSECONDS.toNanos(1));
+        assertEquals(1000L * MICROSECONDS.toNanos(1), MILLISECONDS.toNanos(1));
+        assertEquals(1000L * MILLISECONDS.toNanos(1), SECONDS.toNanos(1));
+        assertEquals(60L * SECONDS.toNanos(1), MINUTES.toNanos(1));
+        assertEquals(60L * MINUTES.toNanos(1), HOURS.toNanos(1));
+        assertEquals(24L * HOURS.toNanos(1), DAYS.toNanos(1));
 
-    /**
-     * toMinutes correctly converts sample values in different units to
-     * minutes
-     */
-    public void testToMinutes() {
-        for (long t = 0; t < 88888; ++t) {
-            assertEquals(t*60*24,
-                         DAYS.toMinutes(t));
-            assertEquals(t*60,
-                         HOURS.toMinutes(t));
-            assertEquals(t,
-                         MINUTES.toMinutes(t));
-            assertEquals(t,
-                         SECONDS.toMinutes(t*60));
-            assertEquals(t,
-                         MILLISECONDS.toMinutes(t*1000L*60));
-            assertEquals(t,
-                         MICROSECONDS.toMinutes(t*1000000L*60));
-            assertEquals(t,
-                         NANOSECONDS.toMinutes(t*1000000000L*60));
+        for (TimeUnit x : TimeUnit.values()) {
+            assertEquals(x.toNanos(1), NANOSECONDS.convert(1, x));
         }
-    }
 
-    /**
-     * toHours correctly converts sample values in different units to
-     * hours
-     */
-    public void testToHours() {
-        for (long t = 0; t < 88888; ++t) {
-            assertEquals(t*24,
-                         DAYS.toHours(t));
-            assertEquals(t,
-                         HOURS.toHours(t));
-            assertEquals(t,
-                         MINUTES.toHours(t*60));
-            assertEquals(t,
-                         SECONDS.toHours(t*60*60));
-            assertEquals(t,
-                         MILLISECONDS.toHours(t*1000L*60*60));
-            assertEquals(t,
-                         MICROSECONDS.toHours(t*1000000L*60*60));
-            assertEquals(t,
-                         NANOSECONDS.toHours(t*1000000000L*60*60));
-        }
-    }
-
-    /**
-     * toDays correctly converts sample values in different units to
-     * days
-     */
-    public void testToDays() {
-        for (long t = 0; t < 88888; ++t) {
-            assertEquals(t,
-                         DAYS.toDays(t));
-            assertEquals(t,
-                         HOURS.toDays(t*24));
-            assertEquals(t,
-                         MINUTES.toDays(t*60*24));
-            assertEquals(t,
-                         SECONDS.toDays(t*60*60*24));
-            assertEquals(t,
-                         MILLISECONDS.toDays(t*1000L*60*60*24));
-            assertEquals(t,
-                         MICROSECONDS.toDays(t*1000000L*60*60*24));
-            assertEquals(t,
-                         NANOSECONDS.toDays(t*1000000000L*60*60*24));
-        }
+        for (TimeUnit x : TimeUnit.values())
+            for (TimeUnit y : TimeUnit.values())
+                if (x.toNanos(1) >= y.toNanos(1))
+                    testConversion(x, y);
     }
 
     /**
@@ -494,14 +307,21 @@
      * toString returns name of unit
      */
     public void testToString() {
+        assertEquals("NANOSECONDS", NANOSECONDS.toString());
+        assertEquals("MICROSECONDS", MICROSECONDS.toString());
+        assertEquals("MILLISECONDS", MILLISECONDS.toString());
         assertEquals("SECONDS", SECONDS.toString());
+        assertEquals("MINUTES", MINUTES.toString());
+        assertEquals("HOURS", HOURS.toString());
+        assertEquals("DAYS", DAYS.toString());
     }
 
     /**
      * name returns name of unit
      */
     public void testName() {
-        assertEquals("SECONDS", SECONDS.name());
+        for (TimeUnit x : TimeUnit.values())
+            assertEquals(x.toString(), x.name());
     }
 
     /**
@@ -512,10 +332,8 @@
         Thread t = newStartedThread(new CheckedRunnable() {
             public void realRun() throws InterruptedException {
                 Object o = new Object();
-                TimeUnit tu = MILLISECONDS;
-
                 try {
-                    tu.timedWait(o, LONG_DELAY_MS);
+                    MILLISECONDS.timedWait(o, LONGER_DELAY_MS);
                     threadShouldThrow();
                 } catch (IllegalMonitorStateException success) {}
             }});
@@ -531,12 +349,11 @@
         Thread t = newStartedThread(new CheckedRunnable() {
             public void realRun() throws InterruptedException {
                 Object o = new Object();
-                TimeUnit tu = MILLISECONDS;
 
                 Thread.currentThread().interrupt();
                 try {
                     synchronized (o) {
-                        tu.timedWait(o, LONG_DELAY_MS);
+                        MILLISECONDS.timedWait(o, LONGER_DELAY_MS);
                     }
                     shouldThrow();
                 } catch (InterruptedException success) {}
@@ -545,7 +362,7 @@
                 pleaseInterrupt.countDown();
                 try {
                     synchronized (o) {
-                        tu.timedWait(o, LONG_DELAY_MS);
+                        MILLISECONDS.timedWait(o, LONGER_DELAY_MS);
                     }
                     shouldThrow();
                 } catch (InterruptedException success) {}
@@ -553,7 +370,7 @@
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING);
         t.interrupt();
         awaitTermination(t);
     }
@@ -565,28 +382,27 @@
         final CountDownLatch pleaseInterrupt = new CountDownLatch(1);
         final Thread s = newStartedThread(new CheckedInterruptedRunnable() {
             public void realRun() throws InterruptedException {
-                Thread.sleep(LONG_DELAY_MS);
+                Thread.sleep(LONGER_DELAY_MS);
             }});
         final Thread t = newStartedThread(new CheckedRunnable() {
             public void realRun() throws InterruptedException {
-                TimeUnit tu = MILLISECONDS;
                 Thread.currentThread().interrupt();
                 try {
-                    tu.timedJoin(s, LONG_DELAY_MS);
+                    MILLISECONDS.timedJoin(s, LONGER_DELAY_MS);
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
 
                 pleaseInterrupt.countDown();
                 try {
-                    tu.timedJoin(s, LONG_DELAY_MS);
+                    MILLISECONDS.timedJoin(s, LONGER_DELAY_MS);
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING);
         t.interrupt();
         awaitTermination(t);
         s.interrupt();
@@ -594,35 +410,46 @@
     }
 
     /**
-     * timedSleep throws InterruptedException when interrupted
+     * timeUnit.sleep throws InterruptedException when interrupted
      */
     public void testTimedSleep_Interruptible() {
         final CountDownLatch pleaseInterrupt = new CountDownLatch(1);
         Thread t = newStartedThread(new CheckedRunnable() {
             public void realRun() throws InterruptedException {
-                TimeUnit tu = MILLISECONDS;
                 Thread.currentThread().interrupt();
                 try {
-                    tu.sleep(LONG_DELAY_MS);
+                    MILLISECONDS.sleep(LONGER_DELAY_MS);
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
 
                 pleaseInterrupt.countDown();
                 try {
-                    tu.sleep(LONG_DELAY_MS);
+                    MILLISECONDS.sleep(LONGER_DELAY_MS);
                     shouldThrow();
                 } catch (InterruptedException success) {}
                 assertFalse(Thread.interrupted());
             }});
 
         await(pleaseInterrupt);
-        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
+        if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING);
         t.interrupt();
         awaitTermination(t);
     }
 
     /**
+     * timeUnit.sleep(x) for x <= 0 does not sleep at all.
+     */
+    public void testTimedSleep_nonPositive() throws InterruptedException {
+        boolean interrupt = randomBoolean();
+        if (interrupt) Thread.currentThread().interrupt();
+        randomTimeUnit().sleep(0L);
+        randomTimeUnit().sleep(-1L);
+        randomTimeUnit().sleep(Long.MIN_VALUE);
+        if (interrupt) assertTrue(Thread.interrupted());
+    }
+
+    /**
      * a deserialized/reserialized unit is the same instance
      */
     public void testSerialization() throws Exception {
--- a/test/jdk/jdk/jfr/event/gc/collection/TestG1ParallelPhases.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/jdk/jfr/event/gc/collection/TestG1ParallelPhases.java	Tue Sep 24 15:19:35 2019 -0400
@@ -98,8 +98,7 @@
             "CLDGRoots",
             "JVMTIRoots",
             "CMRefRoots",
-            "WaitForStrongCLD",
-            "WeakCLDRoots",
+            "WaitForStrongRoots",
             "MergeER",
             "MergeHCC",
             "MergeRS",
--- a/test/jdk/jdk/jfr/jcmd/TestJcmdConfigure.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/jdk/jfr/jcmd/TestJcmdConfigure.java	Tue Sep 24 15:19:35 2019 -0400
@@ -26,9 +26,12 @@
 package jdk.jfr.jcmd;
 
 import java.nio.file.Files;
+import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.List;
 
+import jdk.jfr.internal.Repository;
+import jdk.jfr.internal.SecuritySupport.SafePath;
 import jdk.jfr.internal.Options;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.Utils;
@@ -40,7 +43,7 @@
  * @requires vm.hasJFR
  * @library /test/lib /test/jdk
  * @modules jdk.jfr/jdk.jfr.internal
- * @run main/othervm jdk.jfr.jcmd.TestJcmdConfigure
+ * @run main/othervm -Xlog:jfr=info:file=jfr_info.txt jdk.jfr.jcmd.TestJcmdConfigure
  */
 public class TestJcmdConfigure {
 
@@ -53,6 +56,13 @@
     private static final String SAMPLE_THREADS = "samplethreads";
     private static final String UNSUPPORTED_OPTION = "unsupportedoption";
 
+    private static final String REPOSITORYPATH_1 = "./repo1";
+    private static final String REPOSITORYPATH_2 = "./repo2";
+
+    private static final String REPOSITORYPATH_SETTING_1 = "repositorypath="+REPOSITORYPATH_1;
+    private static final String REPOSITORYPATH_SETTING_2 = "repositorypath="+REPOSITORYPATH_2;
+    private static final String JFR_UNIFIED_LOG_FILE = "jfr_info.txt";
+
     public static void main(String[] args) throws Exception {
         //
         // Simple sanity tests against what is available in Java,
@@ -76,6 +86,8 @@
         testNegative(UNSUPPORTED_OPTION, 100000);
         testNegative(MAX_CHUNK_SIZE, -500);
 
+        testRepository();
+
         if (!testExceptions.isEmpty()) {
             for (Exception e : testExceptions) {
                 System.out.println("Error: " + e.getMessage());
@@ -118,4 +130,28 @@
             default: throw new RuntimeException("Unknown option " + name);
         }
     }
+
+    private static void testRepository(){
+        final String findWhat = "[info][jfr] Same base repository path " + REPOSITORYPATH_1 + " is set";
+
+        try {
+            JcmdHelper.jcmd("JFR.configure", REPOSITORYPATH_SETTING_1);
+            SafePath initialPath = Repository.getRepository().getRepositoryPath();
+
+            JcmdHelper.jcmd("JFR.configure", REPOSITORYPATH_SETTING_1);
+            SafePath samePath = Repository.getRepository().getRepositoryPath();
+            Asserts.assertTrue(samePath.equals(initialPath));
+
+            List<String> lines = Files.readAllLines(Paths.get(JFR_UNIFIED_LOG_FILE));
+            Asserts.assertTrue(lines.stream().anyMatch(l->l.contains(findWhat)));
+
+            JcmdHelper.jcmd("JFR.configure", REPOSITORYPATH_SETTING_2);
+            SafePath changedPath = Repository.getRepository().getRepositoryPath();
+
+            Asserts.assertFalse(changedPath.equals(initialPath));
+
+        } catch(Exception e) {
+            testExceptions.add(e);
+        }
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/jdk/nio/zipfs/LargeEntriesTest.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,541 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+import org.testng.annotations.*;
+
+import java.io.*;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.FileSystem;
+import java.nio.file.*;
+import java.security.SecureRandom;
+import java.util.Arrays;
+import java.util.Map;
+import java.util.function.Consumer;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import static java.lang.Boolean.TRUE;
+import static java.lang.String.format;
+import static java.util.stream.Collectors.joining;
+import static org.testng.Assert.*;
+
+/**
+ * @test
+ * @bug 8230870
+ * @summary Test ZIP Filesystem behavior with ~64k entries
+ * @modules jdk.zipfs
+ * @run testng LargeEntriesTest
+ */
+public class LargeEntriesTest {
+
+    private static final Path HERE = Path.of(".");
+
+    /**
+     * Number of ZIP entries which results in the use of ZIP64
+     */
+    private static final int ZIP64_ENTRIES = 65535;
+
+    /**
+     * Classes and MANIFEST attribute used for invoking Main via java -jar
+     */
+    private static final String MANIFEST_MAIN_CLASS = "LargeEntriesTest$Main";
+    private static final String MAIN_CLASS = "LargeEntriesTest$Main.class";
+    private static final String THIS_CLASS = "LargeEntriesTest.class";
+
+    /**
+     * Number of entries included in the JAR file including  META-INF,
+     * MANIFEST.MF, and the classes associated with this test
+     */
+    private static final int ADDITIONAL_JAR_ENTRIES = 4;
+
+    /**
+     * Value used for creating the required entries in a ZIP or JAR file
+     */
+    private static final String ZIP_FILE_VALUE = "US Open 2019";
+    private static final byte[] ZIP_FILE_ENTRY =
+            ZIP_FILE_VALUE.getBytes(StandardCharsets.UTF_8);
+
+    /**
+     * Location of the classes to be added to the JAR file
+     */
+    static final Path TEST_CLASSES = Paths.get(System.getProperty("test.classes", "."));
+
+    private static final SecureRandom random = new SecureRandom();
+
+    /**
+     * Fields used for timing runs
+     */
+    private static int testNumberRunning;
+    private static long runningTestTime;
+    private static long startTestRunTime;
+    private static final double NANOS_IN_SECOND = 1_000_000_000.0;
+
+    @BeforeTest(enabled = false)
+    public void beforeTest() {
+        startTestRunTime = System.nanoTime();
+    }
+
+    @AfterTest(enabled = false)
+    public void afterTest() {
+        long endTestRunTime = System.nanoTime();
+        long duration = endTestRunTime - startTestRunTime;
+        System.out.printf("#### Completed test run, total running time: %.4f in seconds%n",
+                duration / NANOS_IN_SECOND);
+    }
+
+    @BeforeMethod(enabled = false)
+    public static void beforeMethod() {
+        runningTestTime = System.nanoTime();
+        System.out.printf("**** Starting test number: %s%n", testNumberRunning);
+    }
+
+    @AfterMethod(enabled = false)
+    public void afterMethod() {
+        long endRunningTestTime = System.nanoTime();
+        long duration = endRunningTestTime - runningTestTime;
+        System.out.printf("**** Completed test number: %s, Time: %.4f%n",
+                testNumberRunning, duration / NANOS_IN_SECOND);
+        testNumberRunning++;
+    }
+
+    /**
+     * Validate that you can create a ZIP file with and without compression
+     * and that the ZIP file is created using ZIP64 if there are 65535 or
+     * more entries.
+     *
+     * @param env         Properties used for creating the ZIP Filesystem
+     * @param compression Indicates whether the files are DEFLATED(default)
+     *                    or STORED
+     * @throws Exception If an error occurs during the creation, verification or
+     *                   deletion of the ZIP file
+     */
+    @Test(dataProvider = "zipfsMap", enabled = true)
+    public void testZip(Map<String, String> env, int compression) throws Exception {
+
+        System.out.printf("ZIP FS Map = %s, Compression mode= %s%n ",
+                formatMap(env), compression);
+
+        for (int entries = ZIP64_ENTRIES - 1; entries < ZIP64_ENTRIES + 2; entries++) {
+            Path zipfile = generatePath(HERE, "test", ".zip");
+            Files.deleteIfExists(zipfile);
+            createZipFile(zipfile, env, entries);
+            verify(zipfile, compression, entries,
+                    isTrue(env, "forceZIP64End"), 0);
+            Files.deleteIfExists(zipfile);
+        }
+    }
+
+    /**
+     * Validate that when the forceZIP64End property is set to true,
+     * that ZIP64 is used.
+     *
+     * @param env         Properties used for creating the ZIP Filesystem
+     * @param compression Indicates whether the files are DEFLATED(default)
+     *                    or STORED
+     * @throws Exception If an error occurs during the creation, verification or
+     *                   deletion of the ZIP file
+     */
+    @Test(dataProvider = "zip64Map", enabled = true)
+    public void testForceZIP64End(Map<String, String> env, int compression) throws Exception {
+
+        System.out.printf("ZIP FS Map = %s, Compression mode= %s%n ",
+                formatMap(env), compression);
+
+        // Generate a ZIP file path
+        Path zipfile = generatePath(HERE, "test", ".zip");
+        Files.deleteIfExists(zipfile);
+        createZipFile(zipfile, env, 1);
+        verify(zipfile, compression, 1, isTrue(env, "forceZIP64End"), 0);
+        Files.deleteIfExists(zipfile);
+    }
+
+    /**
+     * Validate that you can create a JAR file with and without compression
+     * and that the JAR file is created using ZIP64 if there are 65535 or
+     * more entries.
+     *
+     * @param env         Properties used for creating the ZIP Filesystem
+     * @param compression Indicates whether the files are DEFLATED(default)
+     *                    or STORED
+     * @throws Exception If an error occurs during the creation, verification or
+     *                   deletion of the JAR file
+     */
+    @Test(dataProvider = "zipfsMap", enabled = true)
+    public void testJar(Map<String, String> env, int compression) throws Exception {
+        for (int entries = ZIP64_ENTRIES - 1; entries < ZIP64_ENTRIES + 2; entries++) {
+            Path jar = generatePath(HERE, "test", ".jar");
+
+            Files.deleteIfExists(jar);
+            createJarFile(jar, env, entries);
+
+            // Now run the Main-Class specified the Manifest
+            runJar(jar.getFileName().toString()).assertSuccess()
+                    .validate(r -> assertTrue(r.output.matches("\\AMain\\Z")));
+
+            verify(jar, compression, entries, isTrue(env, "forceZIP64End"),
+                    ADDITIONAL_JAR_ENTRIES);
+            Files.deleteIfExists(jar);
+        }
+    }
+
+    /**
+     * Create a ZIP File System using the specified properties and a ZIP file
+     * with the specified number of entries
+     *
+     * @param zipFile Path to the ZIP File to create
+     * @param env     Properties used for creating the ZIP Filesystem
+     * @param entries Number of entries to add to the ZIP File
+     * @throws IOException If an error occurs while creating the ZIP file
+     */
+    private void createZipFile(Path zipFile, Map<String, String> env,
+                               int entries) throws IOException {
+        System.out.printf("Creating file = %s%n", zipFile);
+        try (FileSystem zipfs =
+                     FileSystems.newFileSystem(zipFile, env)) {
+
+            for (int i = 0; i < entries; i++) {
+                Files.writeString(zipfs.getPath("Entry-" + i), ZIP_FILE_VALUE);
+            }
+        }
+    }
+
+    /**
+     * Create a ZIP File System using the specified properties and a JAR file
+     * with the specified number of entries
+     *
+     * @param zipFile Path to the JAR File to create
+     * @param env     Properties used for creating the ZIP Filesystem
+     * @param entries Number of entries to add to the JAR File
+     * @throws IOException If an error occurs while creating the JAR file
+     */
+    private void createJarFile(Path zipFile, Map<String, String> env,
+                               int entries) throws IOException {
+        System.out.printf("Creating file = %s%n", zipFile);
+        String jdkVendor = System.getProperty("java.vendor");
+        String jdkVersion = System.getProperty("java.version");
+        String manifest = "Manifest-Version: 1.0"
+                + System.lineSeparator()
+                + "Main-Class: " + MANIFEST_MAIN_CLASS
+                + System.lineSeparator()
+                + "Created-By: " + jdkVersion + " (" + jdkVendor + ")";
+
+        try (FileSystem zipfs =
+                     FileSystems.newFileSystem(zipFile, env);
+             InputStream in = new ByteArrayInputStream(manifest.getBytes())) {
+
+            // Get ZIP FS path to META-INF/MANIFEST.MF
+            Path metadir = zipfs.getPath("/", "META-INF");
+            Path manifestFile = metadir.resolve("MANIFEST.MF");
+
+            // Create META-INF directory if it does not already exist and
+            // add the MANIFEST.MF file
+            if (!Files.exists(metadir))
+                Files.createDirectory(zipfs.getPath("/", "META-INF"));
+            Files.copy(in, manifestFile);
+
+            // Add the needed test classes
+            Path target = zipfs.getPath("/");
+            Files.copy(TEST_CLASSES.resolve(MAIN_CLASS),
+                    target.resolve(MAIN_CLASS));
+            Files.copy(TEST_CLASSES.resolve(THIS_CLASS),
+                    target.resolve(THIS_CLASS));
+
+            // Add the remaining entries that are required
+            for (int i = ADDITIONAL_JAR_ENTRIES; i < entries; i++) {
+                Files.writeString(zipfs.getPath("Entry-" + i), ZIP_FILE_VALUE);
+            }
+        }
+    }
+
+    /*
+     * DataProvider used to validate that you can create a ZIP file with and
+     * without compression.
+     */
+    @DataProvider(name = "zipfsMap")
+    private Object[][] zipfsMap() {
+        return new Object[][]{
+                {Map.of("create", "true"), ZipEntry.DEFLATED},
+                {Map.of("create", "true", "noCompression", "true"),
+                        ZipEntry.STORED},
+                {Map.of("create", "true", "noCompression", "false"),
+                        ZipEntry.DEFLATED}
+        };
+    }
+
+    /*
+     * DataProvider used to validate that you can create a ZIP file with/without
+     * ZIP64 format extensions
+     */
+    @DataProvider(name = "zip64Map")
+    private Object[][] zip64Map() {
+        return new Object[][]{
+                {Map.of("create", "true", "forceZIP64End", "true"),
+                        ZipEntry.DEFLATED},
+                {Map.of("create", "true", "noCompression", "true",
+                        "forceZIP64End", "true"), ZipEntry.STORED},
+                {Map.of("create", "true", "noCompression", "false",
+                        "forceZIP64End", "false"), ZipEntry.DEFLATED},
+                {Map.of("create", "true", "noCompression", "true",
+                        "forceZIP64End", "false"), ZipEntry.STORED}
+        };
+    }
+
+    /**
+     * Verify that the given path is a ZIP file containing the
+     * expected entries.
+     *
+     * @param zipfile       ZIP file to be validated
+     * @param method        Expected Compression method: STORED or DEFLATED
+     * @param entries       Number of expected entries
+     * @param isZip64Forced true if ZIP64 use is being forced; false otherwise
+     * @param start         Starting number for verifying entries
+     * @throws Exception If an error occurs while examining the ZIP file
+     */
+    private static void verify(Path zipfile, int method, int entries,
+                               boolean isZip64Forced, int start) throws Exception {
+        // check entries with ZIP API
+        try (ZipFile zf = new ZipFile(zipfile.toFile())) {
+            // check entry count
+            assertEquals(entries, zf.size());
+
+            // check compression method and content of each entry
+            for (int i = start; i < entries; i++) {
+                ZipEntry ze = zf.getEntry("Entry-" + i);
+                assertNotNull(ze);
+                assertEquals(method, ze.getMethod());
+                try (InputStream is = zf.getInputStream(ze)) {
+                    byte[] bytes = is.readAllBytes();
+                    assertTrue(Arrays.equals(bytes, ZIP_FILE_ENTRY));
+                }
+            }
+        }
+        // check entries with FileSystem API
+        try (FileSystem fs = FileSystems.newFileSystem(zipfile)) {
+
+            // check entry count
+            Path top = fs.getPath("/");
+            long count = Files.find(top, Integer.MAX_VALUE, (path, attrs) ->
+                    attrs.isRegularFile() || (attrs.isDirectory() &&
+                            path.getFileName() != null &&
+                            path.getFileName().toString().equals("META-INF")))
+                    .count();
+            assertEquals(entries, count);
+
+            // check content of each entry
+            for (int i = start; i < entries; i++) {
+                Path file = fs.getPath("Entry-" + i);
+                byte[] bytes = Files.readAllBytes(file);
+                assertTrue(Arrays.equals(bytes, ZIP_FILE_ENTRY));
+            }
+        }
+
+        // Check for a ZIP64 End of Central Directory Locator
+        boolean foundZip64 = usesZip64(zipfile.toFile());
+
+        // Is ZIP64 required?
+        boolean requireZip64 = entries >= ZIP64_ENTRIES || isZip64Forced;
+        System.out.printf(" isZip64Forced = %s, foundZip64= %s, requireZip64= %s%n",
+                isZip64Forced, foundZip64, requireZip64);
+        assertEquals(requireZip64, foundZip64);
+
+
+    }
+
+    /**
+     * Determine if the specified property name=true/"true"
+     *
+     * @param env  ZIP Filesystem Map
+     * @param name property to validate
+     * @return true if the property value is set to true/"true"; false otherwise
+     */
+    private static boolean isTrue(Map<String, ?> env, String name) {
+        return "true".equals(env.get(name)) || TRUE.equals(env.get(name));
+    }
+
+    /**
+     * Check to see if the ZIP64 End of Central Directory Locator has been found
+     *
+     * @param b byte array to check for the locator in
+     * @param n starting offset for the search
+     * @return true if the Zip64 End of Central Directory Locator is found; false
+     * otherwise
+     */
+    private static boolean end64SigAt(byte[] b, int n) {
+        return b[n] == 'P' & b[n + 1] == 'K' & b[n + 2] == 6 & b[n + 3] == 6;
+    }
+
+    /**
+     * Utility method that checks the ZIP file for the use of the ZIP64
+     * End of Central Directory Locator
+     *
+     * @param zipFile ZIP file to check
+     * @return true if the ZIP64 End of Central Directory Locator is found; false
+     * otherwise
+     * * @throws Exception If an error occurs while traversing the file
+     */
+    private static boolean usesZip64(File zipFile) throws Exception {
+
+        try (RandomAccessFile raf = new RandomAccessFile(zipFile, "r")) {
+            byte[] buf = new byte[4096];
+            long seeklen = raf.length() - buf.length;
+
+            if (seeklen < 0)
+                seeklen = 0;
+            raf.seek(seeklen);
+            raf.read(buf);
+            for (int i = 0; i < buf.length - 4; i++) {
+                // Is there a ZIP64 End of Central Directory Locator?
+                if (end64SigAt(buf, i)) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Generate a temporary file Path
+     *
+     * @param dir    Directory used to create the path
+     * @param prefix The prefix string used to create the path
+     * @param suffix The suffix string used to create the path
+     * @return Path that was generated
+     */
+    private static Path generatePath(Path dir, String prefix, String suffix) {
+        long n = random.nextLong();
+        String s = prefix + Long.toUnsignedString(n) + suffix;
+        Path name = dir.getFileSystem().getPath(s);
+        // the generated name should be a simple file name
+        if (name.getParent() != null)
+            throw new IllegalArgumentException("Invalid prefix or suffix");
+        return dir.resolve(name);
+    }
+
+    /**
+     * Utility method to return a formatted String of the key:value entries for
+     * a Map
+     *
+     * @param env Map to format
+     * @return Formatted string of the Map entries
+     */
+    private static String formatMap(Map<String, String> env) {
+        return env.entrySet().stream()
+                .map(e -> format("(%s:%s)", e.getKey(), e.getValue()))
+                .collect(joining(", "));
+    }
+
+    /**
+     * Validates that a jar created using ZIP FS can be used by the java
+     * tool to run a program specified in the Main-Class Manifest attribute
+     *
+     * @param jarFile Name of the JAR file to specify to the -jar option
+     * @return A Result object representing the return code and output from the
+     * program that was invoked
+     */
+    private static Result runJar(String jarFile) {
+        String javaHome = System.getProperty("java.home");
+        String java = Paths.get(javaHome, "bin", "java").toString();
+        String[] cmd = {java, "-jar", jarFile};
+        String output;
+        ProcessBuilder pb = new ProcessBuilder(cmd);
+        Process p;
+        try {
+            p = pb.start();
+            output = toString(p.getInputStream(), p.getErrorStream());
+            p.waitFor();
+        } catch (IOException | InterruptedException e) {
+            throw new RuntimeException(
+                    format("Error invoking: '%s', Exception= %s", pb.command(), e));
+        }
+
+        return new Result(p.exitValue(), output);
+    }
+
+    /**
+     * Utility method to combine the output and error streams for the Process
+     * started by ProcessBuilder
+     *
+     * @param is  Process Outputstream
+     * @param is2 Process ErrorStream
+     * @return String representing the combination of the OutputStream & ErrorStream
+     * @throws IOException If an error occurs while combining the streams
+     */
+    private static String toString(InputStream is, InputStream is2) throws IOException {
+        try (ByteArrayOutputStream dst = new ByteArrayOutputStream();
+             InputStream concatenated = new SequenceInputStream(is, is2)) {
+            concatenated.transferTo(dst);
+            return new String(dst.toByteArray(), StandardCharsets.UTF_8);
+        }
+    }
+
+    /**
+     * Wrapper class used to verify the results from a ProcessBuilder invocation
+     */
+    private static class Result {
+        final int ec;         // Return code for command that was executed
+        final String output;  // Output from the command that was executed
+
+        /**
+         * Constructor
+         *
+         * @param ec     Return code from the ProcessBuilder invocation
+         * @param output ProcessBuilder output to be validated
+         */
+        private Result(int ec, String output) {
+            this.ec = ec;
+            this.output = output;
+        }
+
+        /**
+         * Validate that the command that was executed completed successfully
+         *
+         * @return This Result object
+         */
+        Result assertSuccess() {
+            assertEquals(ec, 0, format("Expected ec 0, received: %s, output [%s]", ec, output));
+            return this;
+        }
+
+        /**
+         * Validate that the expected result is received
+         *
+         * @param r The operation to perform
+         * @return This Result object
+         */
+        Result validate(Consumer<Result> r) {
+            r.accept(this);
+            return this;
+        }
+    }
+
+    /**
+     * Trivial class used to validate that a JAR created using ZIP FS
+     * can be successfully executed
+     */
+    public static class Main {
+        public static void main(String[] args) {
+            System.out.print("Main");
+        }
+    }
+}
--- a/test/jdk/sun/security/pkcs11/PKCS11Test.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/sun/security/pkcs11/PKCS11Test.java	Tue Sep 24 15:19:35 2019 -0400
@@ -39,6 +39,7 @@
 import java.security.InvalidAlgorithmParameterException;
 import java.security.KeyPairGenerator;
 import java.security.NoSuchProviderException;
+import java.security.Policy;
 import java.security.Provider;
 import java.security.ProviderException;
 import java.security.Security;
@@ -879,6 +880,9 @@
         case "MacOSX-x86_64-64":
             return fetchNssLib(MACOSX_X64.class);
 
+        case "Linux-amd64-64":
+            return fetchNssLib(LINUX_X64.class);
+
         default:
             return null;
         }
@@ -900,6 +904,7 @@
                         + "\nPlease make sure the artifact is available.");
             }
         }
+        Policy.setPolicy(null); // Clear the policy created by JIB if any
         return path;
     }
 
@@ -923,4 +928,11 @@
             revision = "3.46",
             extension = "zip")
     private static class MACOSX_X64 { }
+
+    @Artifact(
+            organization = "jpg.tests.jdk.nsslib",
+            name = "nsslib-linux_x64",
+            revision = "3.46",
+            extension = "zip")
+    private static class LINUX_X64 { }
 }
--- a/test/jdk/sun/security/pkcs11/Secmod/AddTrustedCert.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/sun/security/pkcs11/Secmod/AddTrustedCert.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +67,13 @@
         String configName = BASE + SEP + "nss.cfg";
         Provider p = getSunPKCS11(configName);
 
+        if (improperNSSVersion(p)) {
+            System.out.println(
+                    "Skip test due to improper NSS version in [3.28, 3.35). "
+                    + "See JDK-8180837 for more detatils.");
+            return;
+        }
+
         System.out.println(p);
         Security.addProvider(p);
 
@@ -125,4 +132,13 @@
         System.out.println("OK");
     }
 
+    private static boolean improperNSSVersion(Provider p) {
+        double nssVersion = getNSSVersion();
+        if (p.getName().equalsIgnoreCase("SunPKCS11-NSSKeyStore")
+                && nssVersion >= 3.28 && nssVersion < 3.35) {
+            return true;
+        }
+
+        return false;
+    }
 }
--- a/test/jdk/sun/security/pkcs11/tls/TestKeyMaterial.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/sun/security/pkcs11/tls/TestKeyMaterial.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,13 +36,16 @@
 import java.io.BufferedReader;
 import java.nio.file.Files;
 import java.nio.file.Paths;
+import java.security.InvalidAlgorithmParameterException;
 import java.security.Provider;
-import java.security.InvalidAlgorithmParameterException;
+import java.security.ProviderException;
 import java.util.Arrays;
+
 import javax.crypto.KeyGenerator;
 import javax.crypto.SecretKey;
 import javax.crypto.spec.IvParameterSpec;
 import javax.crypto.spec.SecretKeySpec;
+
 import sun.security.internal.spec.TlsKeyMaterialParameterSpec;
 import sun.security.internal.spec.TlsKeyMaterialSpec;
 
@@ -51,6 +54,7 @@
     private static final int PREFIX_LENGTH = "km-master:  ".length();
 
     public static void main(String[] args) throws Exception {
+        System.out.println("NSS Version: " + getNSSVersion());
         main(new TestKeyMaterial(), args);
     }
 
@@ -154,10 +158,26 @@
                         match(lineNumber, serverMacBytes, result.getServerMacKey(), "");
                     } catch (InvalidAlgorithmParameterException iape) {
                         // SSLv3 support is removed in S12
-                        if (major == 3 && minor == 0) {
-                            System.out.println("Skip testing SSLv3");
-                            continue;
+                        if (provider.getName().indexOf("Solaris") != -1) {
+                            if (major == 3 && minor == 0) {
+                                System.out.println("Skip testing SSLv3 on Solaris");
+                                continue;
+                            }
                         }
+                        throw iape;
+                    } catch (ProviderException pe) {
+                        if (provider.getName().indexOf("NSS") != -1) {
+                            Throwable t = pe.getCause();
+                            if (expandedKeyLength != 0
+                                    && t.getMessage().indexOf(
+                                            "CKR_MECHANISM_PARAM_INVALID") != -1) {
+                                // NSS removed support for export-grade cipher suites in 3.28,
+                                // see https://bugzilla.mozilla.org/show_bug.cgi?id=1252849
+                                System.out.println("Ignore known NSS failure on CKR_MECHANISM_PARAM_INVALID");
+                                continue;
+                            }
+                        }
+                        throw pe;
                     }
                } else {
                     throw new Exception("Unknown line: " + line);
--- a/test/jdk/sun/tools/jcmd/TestProcessHelper.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/sun/tools/jcmd/TestProcessHelper.java	Tue Sep 24 15:19:35 2019 -0400
@@ -21,16 +21,13 @@
  * questions.
  */
 
-import jdk.internal.module.ModuleInfoWriter;
-import jdk.test.lib.JDKToolFinder;
-import jdk.test.lib.process.ProcessTools;
-import jdk.test.lib.util.JarUtils;
-import sun.tools.common.ProcessHelper;
-
 import java.io.File;
 import java.io.IOException;
 import java.io.OutputStream;
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
 import java.lang.module.ModuleDescriptor;
+import java.lang.reflect.Method;
 import java.nio.file.FileSystems;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -44,6 +41,11 @@
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
+import jdk.internal.module.ModuleInfoWriter;
+import jdk.test.lib.JDKToolFinder;
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.util.JarUtils;
+
 /*
  * @test
  * @bug 8205654
@@ -52,15 +54,13 @@
  *
  * @requires os.family == "linux"
  * @library /test/lib
- * @modules jdk.jcmd/sun.tools.common
+ * @modules jdk.jcmd/sun.tools.common:+open
  *          java.base/jdk.internal.module
  * @build test.TestProcess
  * @run main/othervm TestProcessHelper
  */
 public class TestProcessHelper {
 
-    private ProcessHelper PROCESS_HELPER = ProcessHelper.platformProcessHelper();
-
     private static final String TEST_PROCESS_MAIN_CLASS_NAME = "TestProcess";
     private static final String TEST_PROCESS_MAIN_CLASS_PACKAGE = "test";
     private static final String TEST_PROCESS_MAIN_CLASS = TEST_PROCESS_MAIN_CLASS_PACKAGE + "."
@@ -89,6 +89,29 @@
 
     private static final String[] PATCH_MODULE_OPTIONS = {"--patch-module", null};
 
+    private static final MethodHandle MH_GET_MAIN_CLASS = resolveMainClassMH();
+
+    private static MethodHandle resolveMainClassMH() {
+        try {
+            Method getMainClassMethod = Class
+                .forName("sun.tools.common.ProcessHelper")
+                .getDeclaredMethod("getMainClass", String.class);
+            getMainClassMethod.setAccessible(true);
+            return MethodHandles.lookup().unreflect(getMainClassMethod);
+        } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | IllegalAccessException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    private static String callGetMainClass(Process p) {
+        try {
+            return (String)MH_GET_MAIN_CLASS.invoke(Long.toString(p.pid()));
+        } catch (Throwable e) {
+            throw new RuntimeException(e);
+        }
+
+    }
+
     public static void main(String[] args) throws Exception {
         new TestProcessHelper().runTests();
     }
@@ -188,7 +211,27 @@
     }
 
     private void checkMainClass(Process p, String expectedMainClass) {
-        String mainClass = PROCESS_HELPER.getMainClass(Long.toString(p.pid()));
+        String mainClass = callGetMainClass(p);
+        // getMainClass() may return null, e.g. due to timing issues.
+        // Attempt some limited retries.
+        if (mainClass == null) {
+            System.err.println("Main class returned by ProcessHelper was null.");
+            // sleep time doubles each round, altogether, wait no longer than 1 sec
+            final int MAX_RETRIES = 10;
+            int retrycount = 0;
+            long sleepms = 1;
+            while (retrycount < MAX_RETRIES && mainClass == null) {
+                System.err.println("Retry " + retrycount + ", sleeping for " + sleepms + "ms.");
+                try {
+                    Thread.sleep(sleepms);
+                } catch (InterruptedException e) {
+                    // ignore
+                }
+                mainClass = callGetMainClass(p);
+                retrycount++;
+                sleepms *= 2;
+            }
+        }
         p.destroyForcibly();
         if (!expectedMainClass.equals(mainClass)) {
             throw new RuntimeException("Main class is wrong: " + mainClass);
--- a/test/jdk/tools/launcher/TestSpecialArgs.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/jdk/tools/launcher/TestSpecialArgs.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -132,11 +132,9 @@
          *       Code to create env variable not executed.
          * 4) give and invalid value and check to make sure JVM commented
          */
-        String launcherPidString = "launcher.pid=";
         String envVarPidString = "TRACER_MARKER: NativeMemoryTracking: env var is NMT_LEVEL_";
         String NMT_Option_Value = "off";
         String myClassName = "helloworld";
-        boolean haveLauncherPid = false;
 
         // === Run the tests ===
         // ---Test 1a
@@ -163,46 +161,6 @@
             throw new RuntimeException("Error: env Var Pid in tracking info is empty string");
         }
 
-        /*
-         * On Linux, Launcher Tracking will print the PID.  Use this info
-         * to validate what we got as the PID in the Launcher itself.
-         * Linux is the only one that prints this, and trying to get it
-         * here for win is awful.  So let the linux test make sure we get
-         * the valid pid, and for non-linux, just make sure pid string is
-         * non-zero.
-         */
-        if (isLinux) {
-            // get what the test says is the launcher pid
-            String launcherPid = null;
-            for (String line : tr.testOutput) {
-                int index = line.indexOf(launcherPidString);
-                if (index >= 0) {
-                    int sindex = index + launcherPidString.length();
-                    int tindex = sindex + line.substring(sindex).indexOf("'");
-                    System.out.println("DEBUG INFO: sindex = " + sindex);
-                    System.out.println("DEBUG INFO: searching substring: " + line.substring(sindex));
-                    System.out.println("DEBUG INFO: tindex = " + tindex);
-                    // DEBUG INFO
-                    System.out.println(tr);
-                    launcherPid = line.substring(sindex, tindex);
-                    break;
-                }
-            }
-            if (launcherPid == null) {
-                System.out.println(tr);
-                throw new RuntimeException("Error: failed to find launcher Pid in launcher tracking info");
-            }
-
-            // did we create the env var with the correct pid?
-            if (!launcherPid.equals(envVarPid)) {
-                System.out.println(tr);
-                System.out.println("Error: wrong pid in creating env var");
-                System.out.println("Error Info: launcherPid = " + launcherPid);
-                System.out.println("Error Info: envVarPid   = " + envVarPid);
-                throw new RuntimeException("Error: wrong pid in creating env var");
-            }
-        }
-
         // --- Test 1b
         if (!tr.contains("NativeMemoryTracking: got value " + NMT_Option_Value)) {
             System.out.println(tr);
--- a/test/langtools/ProblemList.txt	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/langtools/ProblemList.txt	Tue Sep 24 15:19:35 2019 -0400
@@ -54,6 +54,7 @@
 tools/javac/warnings/suppress/TypeAnnotations.java                              8057683    generic-all    improve ordering of errors with type annotations
 tools/javac/modules/SourceInSymlinkTest.java                                    8180263    windows-all    fails when run on a subst drive
 tools/javac/importscope/T8193717.java                                           8203925    generic-all    the test requires too much memory
+tools/javac/options/BCPOrSystemNotSpecified.java                                8231179    windows-all    fails when creating a test bootclasspath
 
 ###########################################################################
 #
--- a/test/langtools/jdk/javadoc/doclet/testSearchScript/TestSearchScript.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/langtools/jdk/javadoc/doclet/testSearchScript/TestSearchScript.java	Tue Sep 24 15:19:35 2019 -0400
@@ -149,11 +149,12 @@
         checkSearch(inv, "operty", List.of());
 
         // search tag
-        checkSearch(inv, "search tag", List.of("search tag"));
-        checkSearch(inv, "search   tag", List.of("search tag"));
-        checkSearch(inv, "search ", List.of("search tag"));
-        checkSearch(inv, "tag", List.of("search tag"));
-        checkSearch(inv, "sea", List.of("search tag"));
+        checkSearch(inv, "search tag", List.of("multiline search tag", "search tag"));
+        checkSearch(inv, "search   tag", List.of("multiline search tag", "search tag"));
+        checkSearch(inv, "search ", List.of("multiline search tag", "search tag"));
+        checkSearch(inv, "tag", List.of("multiline search tag", "search tag"));
+        checkSearch(inv, "sea", List.of("multiline search tag", "search tag"));
+        checkSearch(inv, "multi", List.of("multiline search tag"));
         checkSearch(inv, "ear", List.of());
     }
 
@@ -244,7 +245,7 @@
                 List.of("listpkg.List.of(E, E, E, E)", "listpkg.List.of(E, E, E, E, E)"));
         checkSearch(inv, "l . o (e,e,e,",
                 List.of("listpkg.List.of(E, E, E, E)", "listpkg.List.of(E, E, E, E, E)"));
-        checkSearch(inv, "search    \tt", List.of("search tag"));
+        checkSearch(inv, "search    \tt", List.of("other search tag"));
         checkSearch(inv, "sear ch", List.of());
         checkSearch(inv, "( e ..", List.of("listpkg.List.of(E...)"));
         checkSearch(inv, "( i [ ]", List.of("listpkg.Nolist.withArrayArg(int[])"));
--- a/test/langtools/jdk/javadoc/doclet/testSearchScript/listpkg/Nolist.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/langtools/jdk/javadoc/doclet/testSearchScript/listpkg/Nolist.java	Tue Sep 24 15:19:35 2019 -0400
@@ -27,9 +27,8 @@
 import java.util.Map;
 
 /**
- * Example class containing "list" but not matching at any word boundary.
- *
- * {@index "search tag"}.
+ * Example class containing "list" but not matching at any word boundary. {@index "other
+ * search tag"}.
  */
 public class Nolist {
 
--- a/test/langtools/jdk/javadoc/doclet/testSearchScript/mapmodule/mappkg/Map.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/langtools/jdk/javadoc/doclet/testSearchScript/mapmodule/mappkg/Map.java	Tue Sep 24 15:19:35 2019 -0400
@@ -25,6 +25,13 @@
 
 import java.util.Iterator;
 
+/**
+ * Map interface.
+ *
+ * {@index "multiline
+ *          search
+ *          tag"}
+ */
 public interface Map {
     public void put(Object key, Object value);
     public boolean contains(Object key);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/diags/examples/SourceNoSystemModulesPath.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.source.no.system.modules.path
+// options: -source 9
+
+class SourceNoSystemModulesPath { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/options/BCPOrSystemNotSpecified.java	Tue Sep 24 15:19:35 2019 -0400
@@ -0,0 +1,217 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8228460
+ * @summary Verify --system is required rather than -bootclasspath for -source 9.
+ * @library /tools/lib
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
+ * @build toolbox.ToolBox toolbox.JavacTask toolbox.TestRunner
+ * @run main BCPOrSystemNotSpecified
+ */
+
+import java.io.IOException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.List;
+
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.util.EnumSet;
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardLocation;
+import javax.tools.ToolProvider;
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.Task.Expect;
+import toolbox.TestRunner;
+import toolbox.ToolBox;
+
+public class BCPOrSystemNotSpecified extends TestRunner {
+
+    private final ToolBox tb = new ToolBox();
+    private final String fileSep = System.getProperty("file.separator");
+
+    public BCPOrSystemNotSpecified() {
+        super(System.err);
+    }
+
+    public static void main(String... args) throws Exception {
+        new BCPOrSystemNotSpecified().runTests();
+    }
+
+    @Test
+    public void testSource8(Path base) throws IOException {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src,
+                          "package test; public class Test { } ");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        List<String> log;
+        List<String> expected = Arrays.asList(
+                "- compiler.warn.source.no.bootclasspath: 8",
+                "1 warning"
+        );
+
+        log = new JavacTask(tb)
+                .options("-XDrawDiagnostics", "-source", "8")
+                .outdir(classes)
+                .files(tb.findJavaFiles(src))
+                .run(Expect.SUCCESS)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        if (!expected.equals(log)) {
+            throw new AssertionError("Unexpected output: " + log);
+        }
+
+        Path bcp = base.resolve("bcp");
+
+        prepareBCP(bcp);
+
+        new JavacTask(tb)
+                .options("-XDrawDiagnostics",
+                         "-source", "8",
+                         "-bootclasspath", bcp.toAbsolutePath().toString(),
+                         "-Werror")
+                .outdir(classes)
+                .files(tb.findJavaFiles(src))
+                .run(Expect.SUCCESS)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        if (!expected.equals(log)) {
+            throw new AssertionError("Unexpected output: " + log);
+        }
+    }
+
+    @Test
+    public void testSource9(Path base) throws IOException {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src,
+                          "package test; public class Test { } ");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        List<String> log;
+        List<String> expected = Arrays.asList(
+                "- compiler.warn.source.no.system.modules.path: 9",
+                "1 warning"
+        );
+
+        log = new JavacTask(tb)
+                .options("-XDrawDiagnostics",
+                         "-source", "9")
+                .outdir(classes)
+                .files(tb.findJavaFiles(src))
+                .run(Expect.SUCCESS)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        if (!expected.equals(log)) {
+            throw new AssertionError("Unexpected output: " + log);
+        }
+
+        Path bcp = base.resolve("bcp");
+
+        prepareBCP(bcp);
+
+        log = new JavacTask(tb)
+                .options("-XDrawDiagnostics",
+                         "-source", "9",
+                         "-bootclasspath", bcp.toAbsolutePath().toString())
+                .outdir(classes)
+                .files(tb.findJavaFiles(src))
+                .run(Expect.SUCCESS)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        if (!expected.equals(log)) {
+            throw new AssertionError("Unexpected output: " + log);
+        }
+
+        new JavacTask(tb)
+                .options("-XDrawDiagnostics",
+                         "-source", "9",
+                         "--system", "none",
+                         "--module-path", bcp.toAbsolutePath().toString(),
+                         "-Werror")
+                .outdir(classes)
+                .files(tb.findJavaFiles(src))
+                .run(Expect.SUCCESS)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        if (!expected.equals(log)) {
+            throw new AssertionError("Unexpected output: " + log);
+        }
+
+        new JavacTask(tb)
+                .options("-XDrawDiagnostics",
+                         "-source", "9",
+                         "--system", System.getProperty("java.home"),
+                         "-Werror")
+                .outdir(classes)
+                .files(tb.findJavaFiles(src))
+                .run(Expect.SUCCESS)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        if (!expected.equals(log)) {
+            throw new AssertionError("Unexpected output: " + log);
+        }
+    }
+
+    protected void runTests() throws Exception {
+        runTests(m -> new Object[] { Paths.get(m.getName()).toAbsolutePath() });
+    }
+
+    private void prepareBCP(Path target) throws IOException {
+        try (JavaFileManager jfm = ToolProvider.getSystemJavaCompiler()
+                                               .getStandardFileManager(null, null, null)) {
+            for (String pack : new String[] {"", "java.lang", "java.lang.annotation"}) {
+                JavaFileManager.Location javaBase =
+                        jfm.getLocationForModule(StandardLocation.SYSTEM_MODULES,
+                                                 "java.base");
+                for (JavaFileObject file : jfm.list(javaBase,
+                                                    pack,
+                                                    EnumSet.of(JavaFileObject.Kind.CLASS),
+                                                    false)) {
+                    Path targetDir = target.resolve(pack.replace(".", fileSep));
+                    Files.createDirectories(targetDir);
+                    try (InputStream in = file.openInputStream()) {
+                        String sourcePath = file.getName();
+                        int sepPos = sourcePath.lastIndexOf(fileSep);
+                        String fileName = sourcePath.substring(sepPos + 1);
+                        Files.copy(in, targetDir.resolve(fileName));
+                    }
+                }
+            }
+        }
+    }
+}
--- a/test/langtools/tools/javac/var_implicit_lambda/VarInImplicitLambdaNegTest01_source10.out	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/langtools/tools/javac/var_implicit_lambda/VarInImplicitLambdaNegTest01_source10.out	Tue Sep 24 15:19:35 2019 -0400
@@ -1,4 +1,4 @@
-- compiler.warn.source.no.bootclasspath: 10
+- compiler.warn.source.no.system.modules.path: 10
 VarInImplicitLambdaNegTest01.java:12:36: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.var.syntax.in.implicit.lambda), 10, 11
 VarInImplicitLambdaNegTest01.java:15:28: compiler.err.invalid.lambda.parameter.declaration: (compiler.misc.implicit.and.explicit.not.allowed)
 VarInImplicitLambdaNegTest01.java:17:52: compiler.err.restricted.type.not.allowed.here: var
--- a/test/lib/jdk/test/lib/Platform.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/lib/jdk/test/lib/Platform.java	Tue Sep 24 15:19:35 2019 -0400
@@ -265,7 +265,6 @@
                     return false;
                 }
             } catch (PrivilegedActionException e) {
-                @SuppressWarnings("unchecked")
                 IOException t = (IOException) e.getException();
                 throw t;
             }
@@ -289,7 +288,6 @@
                     return false;
                 }
             } catch (PrivilegedActionException e) {
-                @SuppressWarnings("unchecked")
                 IOException t = (IOException) e.getException();
                 throw t;
             }
--- a/test/lib/jdk/test/lib/Utils.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/lib/jdk/test/lib/Utils.java	Tue Sep 24 15:19:35 2019 -0400
@@ -25,6 +25,7 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.lang.annotation.Annotation;
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.net.MalformedURLException;
@@ -749,13 +750,14 @@
     // until the method main() is found; the class containing that method is the
     // main test class and will be returned as the name of the test.
     // Special handling is used for testng tests.
+    @SuppressWarnings("unchecked")
     public static String getTestName() {
         String result = null;
         // If we are using testng, then we should be able to load the "Test" annotation.
-        Class testClassAnnotation;
+        Class<? extends Annotation> testClassAnnotation;
 
         try {
-            testClassAnnotation = Class.forName("org.testng.annotations.Test");
+            testClassAnnotation = (Class<? extends Annotation>)Class.forName("org.testng.annotations.Test");
         } catch (ClassNotFoundException e) {
             testClassAnnotation = null;
         }
@@ -776,7 +778,7 @@
             // annotation. If present, then use the name of this class.
             if (testClassAnnotation != null) {
                 try {
-                    Class c = Class.forName(className);
+                    Class<?> c = Class.forName(className);
                     if (c.isAnnotationPresent(testClassAnnotation)) {
                         result = className;
                         break;
--- a/test/lib/jdk/test/lib/process/ProcessTools.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/lib/jdk/test/lib/process/ProcessTools.java	Tue Sep 24 15:19:35 2019 -0400
@@ -495,7 +495,6 @@
             return AccessController.doPrivileged(
                 (PrivilegedExceptionAction<Process>) () -> pb.start());
         } catch (PrivilegedActionException e) {
-            @SuppressWarnings("unchecked")
             IOException t = (IOException) e.getException();
             throw t;
         }
--- a/test/lib/jdk/test/lib/process/StreamPumper.java	Tue Sep 24 14:12:08 2019 -0400
+++ b/test/lib/jdk/test/lib/process/StreamPumper.java	Tue Sep 24 15:19:35 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -144,7 +144,9 @@
             }
 
         } catch (IOException e) {
-            e.printStackTrace();
+            if (!e.getMessage().equalsIgnoreCase("stream closed")) {
+                e.printStackTrace();
+            }
         } finally {
             for (OutputStream out : outStreams) {
                 try {