changeset 46394:c5bfe8f7bb1e

Merge
author iveresov
date Wed, 19 Apr 2017 03:21:41 +0000
parents d497d892ab11 cb3afb654b77
children ab5b504181d8
files hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/JLRModule.java hotspot/test/runtime/SharedArchiveFile/CDSTestUtils.java hotspot/test/runtime/modules/java.base/java/lang/reflect/ModuleHelper.java jdk/src/java.base/share/classes/java/lang/reflect/Layer.java jdk/src/java.base/share/classes/java/lang/reflect/LayerInstantiationException.java jdk/src/java.base/share/classes/java/lang/reflect/Module.java jdk/src/java.base/share/classes/java/lang/reflect/WeakPairMap.java jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangReflectModuleAccess.java jdk/test/java/lang/reflect/Layer/BasicLayerTest.java jdk/test/java/lang/reflect/Layer/LayerAndLoadersTest.java jdk/test/java/lang/reflect/Layer/LayerControllerTest.java jdk/test/java/lang/reflect/Layer/layertest/Test.java jdk/test/java/lang/reflect/Layer/src/m1/module-info.java jdk/test/java/lang/reflect/Layer/src/m1/p/Main.java jdk/test/java/lang/reflect/Layer/src/m1/p/Service.java jdk/test/java/lang/reflect/Layer/src/m2/module-info.java jdk/test/java/lang/reflect/Layer/src/m2/q/Hello.java jdk/test/java/lang/reflect/Layer/src/m3/module-info.java jdk/test/java/lang/reflect/Layer/src/m3/w/Hello.java jdk/test/java/lang/reflect/Layer/src/m4/impl/ServiceImpl.java jdk/test/java/lang/reflect/Layer/src/m4/module-info.java jdk/test/java/lang/reflect/Module/AddExportsTest.java jdk/test/java/lang/reflect/Module/AnnotationsTest.java jdk/test/java/lang/reflect/Module/BasicModuleTest.java jdk/test/java/lang/reflect/Module/WithSecurityManager.java jdk/test/java/lang/reflect/Module/access/AccessTest.java jdk/test/java/lang/reflect/Module/access/src/target/module-info.java jdk/test/java/lang/reflect/Module/access/src/target/p1/Helper.java jdk/test/java/lang/reflect/Module/access/src/target/p1/Public.java jdk/test/java/lang/reflect/Module/access/src/target/p2/NonPublic.java jdk/test/java/lang/reflect/Module/access/src/target/q1/Public.java jdk/test/java/lang/reflect/Module/access/src/target/q2/NonPublic.java jdk/test/java/lang/reflect/Module/access/src/test/module-info.java jdk/test/java/lang/reflect/Module/access/src/test/test/Main.java jdk/test/java/lang/reflect/Module/addXXX/Driver.java jdk/test/java/lang/reflect/Module/addXXX/m1/module-info.java jdk/test/java/lang/reflect/Module/addXXX/m1/p1/C.java jdk/test/java/lang/reflect/Module/addXXX/m2/module-info.java jdk/test/java/lang/reflect/Module/addXXX/m2/p2/C.java jdk/test/java/lang/reflect/Module/addXXX/m2/p2/internal/C.java jdk/test/java/lang/reflect/Module/addXXX/m3/module-info.java jdk/test/java/lang/reflect/Module/addXXX/m3/p3/C.java jdk/test/java/lang/reflect/Module/addXXX/m4/module-info.java jdk/test/java/lang/reflect/Module/addXXX/m4/p4/C.java jdk/test/java/lang/reflect/Module/addXXX/test/module-info.java jdk/test/java/lang/reflect/Module/addXXX/test/test/C.java jdk/test/java/lang/reflect/Module/addXXX/test/test/Main.java jdk/test/java/lang/reflect/Module/addXXX/test/test/Service.java jdk/test/java/lang/reflect/Module/allow.policy jdk/test/java/lang/reflect/Module/annotation/Basic.java jdk/test/java/lang/reflect/Module/annotation/src/m/module-info.java jdk/test/java/lang/reflect/Module/annotation/src/m/p/annotation/Bar.java jdk/test/java/lang/reflect/Module/annotation/src/m/p/annotation/Baz.java jdk/test/java/lang/reflect/Module/annotation/src/m/p/annotation/Foo.java jdk/test/java/lang/reflect/WeakPairMap/Driver.java jdk/test/java/lang/reflect/WeakPairMap/java.base/java/lang/reflect/WeakPairMapTest.java
diffstat 732 files changed, 15623 insertions(+), 11576 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Tue Apr 18 20:17:22 2017 -0700
+++ b/.hgtags	Wed Apr 19 03:21:41 2017 +0000
@@ -1,3 +1,4 @@
+3965b747cfe1e6cbd66b8739da5a1ea6ec6985e9 jdk-9+165
 d16aebbb56d37f12e0c0b0a4fb427db65e1fb1a8 jdk-9+162
 18c41483a082e097ac2f5f983c1226ed94aa4215 jdk-9+163
 32db52c675e7d5bc413605d2e89b68b608b19be0 jdk-9+164
@@ -411,3 +412,4 @@
 74116beae88a8f17a80301aa6c83865c82f10ece jdk-10+1
 4a79ad46e578112fce68f1af9dd931025cc235cb jdk-10+2
 d1cab6c7e608479be4ebfad48a25b0ed48600f62 jdk-10+3
+02253db2ace1422f576f58502fc7831ead77424b jdk-10+4
--- a/.hgtags-top-repo	Tue Apr 18 20:17:22 2017 -0700
+++ b/.hgtags-top-repo	Wed Apr 19 03:21:41 2017 +0000
@@ -408,3 +408,4 @@
 21b063d75b3edbffb9bebc8872d990920c4ae1e5 jdk-9+162
 c38c6b270ccc8e2b86d1631bcf42248241b54d2c jdk-9+163
 7810f75d016a52e32295c4233009de5ca90e31af jdk-9+164
+aff4f339acd40942d3dab499846b52acd87b3af1 jdk-9+165
--- a/common/conf/jib-profiles.js	Tue Apr 18 20:17:22 2017 -0700
+++ b/common/conf/jib-profiles.js	Wed Apr 19 03:21:41 2017 +0000
@@ -882,7 +882,7 @@
         jtreg: {
             server: "javare",
             revision: "4.2",
-            build_number: "b05",
+            build_number: "b07",
             checksum_file: "MD5_VALUES",
             file: "jtreg_bin-4.2.zip",
             environment_name: "JT_HOME",
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/doc/testing.html	Wed Apr 19 03:21:41 2017 +0000
@@ -0,0 +1,112 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  <meta http-equiv="Content-Style-Type" content="text/css" />
+  <meta name="generator" content="pandoc" />
+  <title>Testing OpenJDK</title>
+  <style type="text/css">code{white-space: pre;}</style>
+  <link rel="stylesheet" href="http://openjdk.java.net/page.css" type="text/css" />
+  <style type="text/css">pre, code, tt { color: #1d6ae5; }</style>
+  <style type="text/css">pre { font-size: 10pt; }</style>
+</head>
+<body>
+<div id="header">
+<h1 class="title">Testing OpenJDK</h1>
+</div>
+<div id="TOC">
+<ul>
+<li><a href="#using-the-run-test-framework">Using the run-test framework</a></li>
+<li><a href="#test-selection">Test selection</a><ul>
+<li><a href="#jtreg">JTreg</a></li>
+<li><a href="#gtest">Gtest</a></li>
+</ul></li>
+<li><a href="#test-results-and-summary">Test results and summary</a></li>
+<li><a href="#test-suite-control">Test suite control</a><ul>
+<li><a href="#jtreg-keywords">JTreg keywords</a></li>
+<li><a href="#gtest-keywords">Gtest keywords</a></li>
+</ul></li>
+</ul>
+</div>
+<h2 id="using-the-run-test-framework">Using 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>Some example command-lines:</p>
+<pre><code>$ make run-test-tier1
+$ make run-test-jdk_lang JTREG=&quot;JOBS=8&quot;
+$ make run-test TEST=jdk_lang
+$ make run-test-only TEST=&quot;gtest:LogTagSet gtest:LogTagSetDescriptions&quot; GTEST=&quot;REPEAT=-1&quot;
+$ make run-test TEST=&quot;hotspot/test:hotspot_gc&quot; JTREG=&quot;JOBS=1;TIMEOUT=8;VM_OTIONS=-XshowSettings -Xlog:gc+ref=debug&quot;
+$ make run-test TEST=&quot;jtreg:hotspot/test:hotspot_gc hotspot/test/native_sanity/JniVersion.java&quot;</code></pre>
+<h2 id="test-selection">Test selection</h2>
+<p>All functionality is available using the run-test 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, run-test-only 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 run-test-tier1</code> is equivalent to <code>make run-test TEST=&quot;tier1&quot;</code>, but the latter is more tab-completion friendly. For more complex test runs, the <code>run-test TEST=&quot;x&quot;</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:jdk/test:tier1 jtreg:langtools/test:tier1 jtreg:nashorn/test:tier1 jtreg:jaxp/test: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 test groups can be specified either without a test root, e.g. <code>:tier1</code> (or <code>tier1</code>, the initial colon is optional), or with, e.g. <code>hotspot/test:tier1</code>, <code>jdk/test:jdk_util</code>.</p>
+<p>When specified without a test root, all matching groups from all tests roots will be added. Otherwise, only the group from the specified test root will be added.</p>
+<p>Individual JTreg tests or directories containing JTreg tests can also be specified, like <code>hotspot/test/native_sanity/JniVersion.java</code> or <code>hotspot/test/native_sanity</code>. You can also specify an absolute path, to point to a JTreg test outside the source tree.</p>
+<p>As long as the test groups or test paths can be uniquely resolved, you do not need to enter the <code>jtreg:</code> prefix. If this is not possible, or if you want to use a fully qualified test descriptor, add <code>jtreg:</code>, e.g. <code>jtreg:hotspot/test/native_sanity</code>.</p>
+<h3 id="gtest">Gtest</h3>
+<p>Since the Hotspot Gtest suite is so quick, the default is to run all tests. This is specified by just <code>gtest</code>, or as a fully qualified test descriptor <code>gtest:all</code>.</p>
+<p>If you want, you can single out an individual test or a group of tests, for instance <code>gtest:LogDecorations</code> or <code>gtest:LogDecorations.level_test_vm</code>. This can be particularly useful if you want to run a shaky test repeatedly.</p>
+<h2 id="test-results-and-summary">Test results and summary</h2>
+<p>At the end of the test run, a summary of all tests run will be presented. This will have a consistent look, regardless of what test suites were used. This is a sample summary:</p>
+<pre><code>==============================
+Test summary
+==============================
+   TEST                                          TOTAL  PASS  FAIL ERROR
+&gt;&gt; jtreg:jdk/test:tier1                           1867  1865     2     0 &lt;&lt;
+   jtreg:langtools/test:tier1                     4711  4711     0     0
+   jtreg:nashorn/test:tier1                        133   133     0     0
+==============================
+TEST FAILURE</code></pre>
+<p>Tests where the number of TOTAL tests does not equal the number of PASSed tests will be considered a test failure. These are marked with the <code>&gt;&gt; ... &lt;&lt;</code> marker for easy identification.</p>
+<p>The classification of non-passed tests differs a bit between test suites. In the summary, ERROR is used as a catch-all for tests that neither passed nor are classified as failed by the framework. This might indicate test framework error, timeout or other problems.</p>
+<p>In case of test failures, <code>make run-test</code> will exit with a non-zero exit value.</p>
+<p>All tests have their result stored in <code>build/$BUILD/test-result/$TEST_ID</code>, where TEST_ID is a path-safe conversion from the fully qualified test descriptor, e.g. for <code>jtreg:jdk/test:tier1</code> the TEST_ID is <code>jtreg_jdk_test_tier1</code>. This path is also printed in the log at the end of the test run.</p>
+<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=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=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=8&quot;</code> would give an error, while <code>JTREG_TMIEOUT=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_OTIONS=-XshowSettings -Xlog:gc+ref=debug&quot;</code>.</p>
+<p>(Other ways are possible, e.g. using backslash: <code>JTREG=JOBS=1\;TIMEOUT=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_OTIONS=-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="jtreg-keywords">JTreg keywords</h3>
+<h4 id="jobs">JOBS</h4>
+<p>The test concurrency (<code>-concurrency</code>).</p>
+<p>Defaults to TEST_JOBS (if set by <code>--with-test-jobs=</code>), otherwise it defaults to JOBS, except for Hotspot, where the default is <em>number of CPU cores/2</em>, but never more than 12.</p>
+<h4 id="timeout">TIMEOUT</h4>
+<p>The timeout factor (<code>-timeoutFactor</code>).</p>
+<p>Defaults to 4.</p>
+<h4 id="test_mode">TEST_MODE</h4>
+<p>The test mode (<code>-agentvm</code>, <code>-samevm</code> or <code>-othervm</code>).</p>
+<p>Defaults to <code>-agentvm</code>.</p>
+<h4 id="assert">ASSERT</h4>
+<p>Enable asserts (<code>-ea -esa</code>, or none).</p>
+<p>Set to <code>true</code> or <code>false</code>. If true, adds <code>-ea -esa</code>. Defaults to true, except for hotspot.</p>
+<h4 id="verbose">VERBOSE</h4>
+<p>The verbosity level (<code>-verbose</code>).</p>
+<p>Defaults to <code>fail,error,summary</code>.</p>
+<h4 id="retain">RETAIN</h4>
+<p>What test data to retain (<code>-retain</code>).</p>
+<p>Defaults to <code>fail,error</code>.</p>
+<h4 id="max_mem">MAX_MEM</h4>
+<p>Limit memory consumption (<code>-Xmx</code> and <code>-vmoption:-Xmx</code>, or none).</p>
+<p>Limit memory consumption for JTreg test framework and VM under test. Set to 0 to disable the limits.</p>
+<p>Defaults to 512m, except for hotspot, where it defaults to 0 (no limit).</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>
+<h4 id="java_options">JAVA_OPTIONS</h4>
+<p>Additional Java options to JTreg (<code>-javaoption</code>).</p>
+<h4 id="vm_options">VM_OPTIONS</h4>
+<p>Additional VM options to JTreg (<code>-vmoption</code>).</p>
+<h3 id="gtest-keywords">Gtest keywords</h3>
+<h4 id="repeat">REPEAT</h4>
+<p>The number of times to repeat the tests (<code>--gtest_repeat</code>).</p>
+<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>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/doc/testing.md	Wed Apr 19 03:21:41 2017 +0000
@@ -0,0 +1,207 @@
+% Testing OpenJDK
+
+## Using the run-test framework
+
+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.
+
+Some example command-lines:
+
+    $ make run-test-tier1
+    $ make run-test-jdk_lang JTREG="JOBS=8"
+    $ make run-test TEST=jdk_lang
+    $ make run-test-only TEST="gtest:LogTagSet gtest:LogTagSetDescriptions" GTEST="REPEAT=-1"
+    $ make run-test TEST="hotspot/test:hotspot_gc" JTREG="JOBS=1;TIMEOUT=8;VM_OTIONS=-XshowSettings -Xlog:gc+ref=debug"
+    $ make run-test TEST="jtreg:hotspot/test:hotspot_gc hotspot/test/native_sanity/JniVersion.java"
+
+## Test selection
+
+All functionality is available using the run-test make target. In this use
+case, the test or tests to be executed is controlled using the `TEST` variable.
+To speed up subsequent test runs with no source code changes, run-test-only can
+be used instead, which do not depend on the source and test image build.
+
+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 `make run-test-tier1` is equivalent to `make run-test
+TEST="tier1"`, but the latter is more tab-completion friendly. For more complex
+test runs, the `run-test TEST="x"` solution needs to be used.
+
+The test specifications given in `TEST` is parsed into fully qualified test
+descriptors, which clearly and unambigously show which tests will be run. As an
+example, `:tier1` will expand to `jtreg:jdk/test:tier1
+jtreg:langtools/test:tier1 jtreg:nashorn/test:tier1 jtreg:jaxp/test:tier1`. You
+can always submit a list of fully qualified test descriptors in the `TEST`
+variable if you want to shortcut the parser.
+
+### JTreg
+
+JTreg test groups can be specified either without a test root, e.g. `:tier1`
+(or `tier1`, the initial colon is optional), or with, e.g.
+`hotspot/test:tier1`, `jdk/test:jdk_util`.
+
+When specified without a test root, all matching groups from all tests roots
+will be added. Otherwise, only the group from the specified test root will be
+added.
+
+Individual JTreg tests or directories containing JTreg tests can also be
+specified, like `hotspot/test/native_sanity/JniVersion.java` or
+`hotspot/test/native_sanity`. You can also specify an absolute path, to point
+to a JTreg test outside the source tree.
+
+As long as the test groups or test paths can be uniquely resolved, you do not
+need to enter the `jtreg:` prefix. If this is not possible, or if you want to
+use a fully qualified test descriptor, add `jtreg:`, e.g.
+`jtreg:hotspot/test/native_sanity`.
+
+### Gtest
+
+Since the Hotspot Gtest suite is so quick, the default is to run all tests.
+This is specified by just `gtest`, or as a fully qualified test descriptor
+`gtest:all`.
+
+If you want, you can single out an individual test or a group of tests, for
+instance `gtest:LogDecorations` or `gtest:LogDecorations.level_test_vm`. This
+can be particularly useful if you want to run a shaky test repeatedly.
+
+## Test results and summary
+
+At the end of the test run, a summary of all tests run will be presented. This
+will have a consistent look, regardless of what test suites were used. This is
+a sample summary:
+
+    ==============================
+    Test summary
+    ==============================
+       TEST                                          TOTAL  PASS  FAIL ERROR
+    >> jtreg:jdk/test:tier1                           1867  1865     2     0 <<
+       jtreg:langtools/test:tier1                     4711  4711     0     0
+       jtreg:nashorn/test:tier1                        133   133     0     0
+    ==============================
+    TEST FAILURE
+
+Tests where the number of TOTAL tests does not equal the number of PASSed tests
+will be considered a test failure. These are marked with the `>> ... <<` marker
+for easy identification.
+
+The classification of non-passed tests differs a bit between test suites. In
+the summary, ERROR is used as a catch-all for tests that neither passed nor are
+classified as failed by the framework. This might indicate test framework
+error, timeout or other problems.
+
+In case of test failures, `make run-test` will exit with a non-zero exit value.
+
+All tests have their result stored in `build/$BUILD/test-result/$TEST_ID`,
+where TEST_ID is a path-safe conversion from the fully qualified test
+descriptor, e.g. for `jtreg:jdk/test:tier1` the TEST_ID is
+`jtreg_jdk_test_tier1`. This path is also printed in the log at the end of the
+test run.
+
+Additional work data is stored in `build/$BUILD/test-support/$TEST_ID`. For
+some frameworks, this directory might contain information that is useful in
+determining the cause of a failed test.
+
+## Test suite control
+
+It is possible to control various aspects of the test suites using make control
+variables.
+
+These variables use a keyword=value approach to allow multiple values to be
+set. So, for instance, `JTREG="JOBS=1;TIMEOUT=8"` will set the JTreg
+concurrency level to 1 and the timeout factor to 8. This is equivalent to
+setting `JTREG_JOBS=1 JTREG_TIMEOUT=8`, but using the keyword format means that
+the `JTREG` variable is parsed and verified for correctness, so
+`JTREG="TMIEOUT=8"` would give an error, while `JTREG_TMIEOUT=8` would just
+pass unnoticed.
+
+To separate multiple keyword=value pairs, use `;` (semicolon). Since the shell
+normally eats `;`, the recommended usage is to write the assignment inside
+qoutes, e.g. `JTREG="...;..."`. This will also make sure spaces are preserved,
+as in `JTREG="VM_OTIONS=-XshowSettings -Xlog:gc+ref=debug"`.
+
+(Other ways are possible, e.g. using backslash: `JTREG=JOBS=1\;TIMEOUT=8`.
+Also, as a special technique, the string `%20` will be replaced with space for
+certain options, e.g. `JTREG=VM_OTIONS=-XshowSettings%20-Xlog:gc+ref=debug`.
+This can be useful if you have layers of scripts and have trouble getting
+proper quoting of command line arguments through.)
+
+As far as possible, the names of the keywords have been standardized between
+test suites.
+
+### JTreg keywords
+
+#### JOBS
+The test concurrency (`-concurrency`).
+
+Defaults to TEST_JOBS (if set by `--with-test-jobs=`), otherwise it defaults to
+JOBS, except for Hotspot, where the default is *number of CPU cores/2*, but
+never more than 12.
+
+#### TIMEOUT
+The timeout factor (`-timeoutFactor`).
+
+Defaults to 4.
+
+#### TEST_MODE
+The test mode (`-agentvm`, `-samevm` or `-othervm`).
+
+Defaults to `-agentvm`.
+
+#### ASSERT
+Enable asserts (`-ea -esa`, or none).
+
+Set to `true` or `false`. If true, adds `-ea -esa`. Defaults to true, except
+for hotspot.
+
+#### VERBOSE
+The verbosity level (`-verbose`).
+
+Defaults to `fail,error,summary`.
+
+#### RETAIN
+What test data to retain (`-retain`).
+
+Defaults to `fail,error`.
+
+#### MAX_MEM
+Limit memory consumption (`-Xmx` and `-vmoption:-Xmx`, or none).
+
+Limit memory consumption for JTreg test framework and VM under test. Set to 0
+to disable the limits.
+
+Defaults to 512m, except for hotspot, where it defaults to 0 (no limit).
+
+#### OPTIONS
+Additional options to the JTreg test framework.
+
+Use `JTREG="OPTIONS=--help all"` to see all available JTreg options.
+
+#### JAVA_OPTIONS
+Additional Java options to JTreg (`-javaoption`).
+
+#### VM_OPTIONS
+Additional VM options to JTreg (`-vmoption`).
+
+### Gtest keywords
+
+#### REPEAT
+The number of times to repeat the tests (`--gtest_repeat`).
+
+Default is 1. Set to -1 to repeat indefinitely. This can be especially useful
+combined with `OPTIONS=--gtest_break_on_failure` to reproduce an intermittent
+problem.
+
+#### OPTIONS
+Additional options to the Gtest test framework.
+
+Use `GTEST="OPTIONS=--help"` to see all available Gtest options.
+
+---
+# Override some definitions in http://openjdk.java.net/page.css that are
+# unsuitable for this document.
+header-includes:
+ - '<style type="text/css">pre, code, tt { color: #1d6ae5; }</style>'
+ - '<style type="text/css">pre { font-size: 10pt; }</style>'
+---
--- a/corba/.hgtags	Tue Apr 18 20:17:22 2017 -0700
+++ b/corba/.hgtags	Wed Apr 19 03:21:41 2017 +0000
@@ -408,3 +408,4 @@
 18ffcf99a3b4a10457853d94190e825bdf07e39b jdk-9+162
 493011dee80e51c2a2b064d049183c047df36d80 jdk-9+163
 965bbae3072702f7c0d95c240523b65e6bb19261 jdk-9+164
+a510b2201154abdd12ede42788086b5283bfb9a6 jdk-9+165
--- a/hotspot/.hgtags	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/.hgtags	Wed Apr 19 03:21:41 2017 +0000
@@ -568,3 +568,4 @@
 b01c519b715ef6f785d0631adee0a6537cf6c12e jdk-9+162
 983fe207555724d98f4876991e1cbafbcf2733e8 jdk-9+163
 0af429be8bbaeaaf0cb838e9af28c953dda6a9c8 jdk-9+164
+c92c6416ca03b1464d5ed99cf6201e52b5ba0a70 jdk-9+165
--- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Wed Apr 19 03:21:41 2017 +0000
@@ -917,7 +917,7 @@
     break;
 
   case 0x62: // EVEX_4bytes
-    assert((UseAVX > 0), "shouldn't have EVEX prefix");
+    assert(VM_Version::supports_evex(), "shouldn't have EVEX prefix");
     assert(ip == inst+1, "no prefixes allowed");
     // no EVEX collisions, all instructions that have 0x62 opcodes
     // have EVEX versions and are subopcodes of 0x66
--- a/hotspot/src/cpu/x86/vm/nativeInst_x86.cpp	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/cpu/x86/vm/nativeInst_x86.cpp	Wed Apr 19 03:21:41 2017 +0000
@@ -365,6 +365,10 @@
     NOT_LP64(assert((0xC0 & ubyte_at(1)) == 0xC0, "shouldn't have LDS and LES instructions"));
     return 3;
   }
+  if (instr_0 == instruction_EVEX_prefix_4bytes) {
+    assert(VM_Version::supports_evex(), "shouldn't have EVEX prefix");
+    return 4;
+  }
 
   // First check to see if we have a (prefixed or not) xor
   if (instr_0 >= instruction_prefix_wide_lo && // 0x40
--- a/hotspot/src/cpu/x86/vm/nativeInst_x86.hpp	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/cpu/x86/vm/nativeInst_x86.hpp	Wed Apr 19 03:21:41 2017 +0000
@@ -356,6 +356,7 @@
 
     instruction_VEX_prefix_2bytes       = Assembler::VEX_2bytes,
     instruction_VEX_prefix_3bytes       = Assembler::VEX_3bytes,
+    instruction_EVEX_prefix_4bytes      = Assembler::EVEX_4bytes,
 
     instruction_size                    = 4,
     instruction_offset                  = 0,
--- a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantReflectionProvider.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantReflectionProvider.java	Wed Apr 19 03:21:41 2017 +0000
@@ -179,11 +179,14 @@
         if (hotspotField.isStatic()) {
             HotSpotResolvedJavaType holder = (HotSpotResolvedJavaType) hotspotField.getDeclaringClass();
             if (holder.isInitialized()) {
-                return memoryAccess.readUnsafeConstant(hotspotField.getJavaKind(), HotSpotObjectConstantImpl.forObject(holder.mirror()), hotspotField.offset());
+                return memoryAccess.readFieldValue(hotspotField, holder.mirror());
             }
         } else {
-            if (receiver.isNonNull() && hotspotField.isInObject(((HotSpotObjectConstantImpl) receiver).object())) {
-                return memoryAccess.readUnsafeConstant(hotspotField.getJavaKind(), receiver, hotspotField.offset());
+            if (receiver.isNonNull()) {
+                Object object = ((HotSpotObjectConstantImpl) receiver).object();
+                if (hotspotField.isInObject(object)) {
+                    return memoryAccess.readFieldValue(hotspotField, object);
+                }
             }
         }
         return null;
--- a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProvider.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProvider.java	Wed Apr 19 03:21:41 2017 +0000
@@ -31,6 +31,10 @@
  */
 public interface HotSpotMemoryAccessProvider extends MemoryAccessProvider {
 
+    /**
+     * @throws IllegalArgumentException if the address computed from {@code base} and
+     *             {@code displacement} does not denote a location holding a narrow oop
+     */
     JavaConstant readNarrowOopConstant(Constant base, long displacement);
 
     Constant readKlassPointerConstant(Constant base, long displacement);
--- a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java	Wed Apr 19 03:21:41 2017 +0000
@@ -22,13 +22,21 @@
  */
 package jdk.vm.ci.hotspot;
 
+import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayBaseOffset;
+import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayIndexScale;
 import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE;
 
+import java.lang.reflect.Array;
+
+import jdk.vm.ci.common.JVMCIError;
 import jdk.vm.ci.meta.Constant;
 import jdk.vm.ci.meta.JavaConstant;
 import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.meta.MemoryAccessProvider;
+import jdk.vm.ci.meta.MetaAccessProvider;
 import jdk.vm.ci.meta.PrimitiveConstant;
+import jdk.vm.ci.meta.ResolvedJavaField;
+import jdk.vm.ci.meta.ResolvedJavaType;
 
 /**
  * HotSpot implementation of {@link MemoryAccessProvider}.
@@ -41,12 +49,93 @@
         this.runtime = runtime;
     }
 
-    private static Object asObject(Constant base) {
+    /**
+     * Gets the object boxed by {@code base} that is about to have a value of kind {@code kind} read
+     * from it at the offset {@code displacement}.
+     *
+     * @param base constant value containing the base address for a pending read
+     * @return {@code null} if {@code base} does not box an object otherwise the object boxed in
+     *         {@code base}
+     */
+    private Object asObject(Constant base, JavaKind kind, long displacement) {
         if (base instanceof HotSpotObjectConstantImpl) {
-            return ((HotSpotObjectConstantImpl) base).object();
+            HotSpotObjectConstantImpl constant = (HotSpotObjectConstantImpl) base;
+            HotSpotResolvedObjectType type = constant.getType();
+            Object object = constant.object();
+            checkRead(kind, displacement, type, object);
+            return object;
+        }
+        return null;
+    }
+
+    /**
+     * Offset of injected {@code java.lang.Class::oop_size} field. No need to make {@code volatile}
+     * as initialization is idempotent.
+     */
+    private long oopSizeOffset;
+
+    private static int computeOopSizeOffset(HotSpotJVMCIRuntimeProvider runtime) {
+        MetaAccessProvider metaAccess = runtime.getHostJVMCIBackend().getMetaAccess();
+        ResolvedJavaType staticType = metaAccess.lookupJavaType(Class.class);
+        for (ResolvedJavaField f : staticType.getInstanceFields(false)) {
+            if (f.getName().equals("oop_size")) {
+                int offset = ((HotSpotResolvedJavaField) f).offset();
+                assert offset != 0 : "not expecting offset of java.lang.Class::oop_size to be 0";
+                return offset;
+            }
+        }
+        throw new JVMCIError("Could not find injected java.lang.Class::oop_size field");
+    }
+
+    private boolean checkRead(JavaKind kind, long displacement, HotSpotResolvedObjectType type, Object object) {
+        if (type.isArray()) {
+            ResolvedJavaType componentType = type.getComponentType();
+            JavaKind componentKind = componentType.getJavaKind();
+            final int headerSize = getArrayBaseOffset(componentKind);
+            int sizeOfElement = getArrayIndexScale(componentKind);
+            int length = Array.getLength(object);
+            long arrayEnd = headerSize + (sizeOfElement * length);
+            boolean aligned = ((displacement - headerSize) % sizeOfElement) == 0;
+            if (displacement < 0 || displacement > (arrayEnd - sizeOfElement) || (kind == JavaKind.Object && !aligned)) {
+                int index = (int) ((displacement - headerSize) / sizeOfElement);
+                throw new AssertionError("Unsafe array access: reading element of kind " + kind +
+                                " at offset " + displacement + " (index ~ " + index + ") in " +
+                                type.toJavaName() + " object of length " + length);
+            }
+        } else if (kind != JavaKind.Object) {
+            long size;
+            if (object instanceof Class) {
+                if (oopSizeOffset == 0) {
+                    oopSizeOffset = computeOopSizeOffset(runtime);
+                }
+                int wordSize = runtime.getHostJVMCIBackend().getCodeCache().getTarget().wordSize;
+                size = UNSAFE.getInt(object, oopSizeOffset) * wordSize;
+            } else {
+                size = Math.abs(type.instanceSize());
+            }
+            int bytesToRead = kind.getByteCount();
+            if (displacement + bytesToRead > size || displacement < 0) {
+                throw new IllegalArgumentException("Unsafe access: reading " + bytesToRead + " bytes at offset " + displacement + " in " +
+                                type.toJavaName() + " object of size " + size);
+            }
         } else {
-            return null;
+            ResolvedJavaField field = type.findInstanceFieldWithOffset(displacement, JavaKind.Object);
+            if (field == null && object instanceof Class) {
+                // Read of a static field
+                MetaAccessProvider metaAccess = runtime.getHostJVMCIBackend().getMetaAccess();
+                HotSpotResolvedObjectTypeImpl staticFieldsHolder = (HotSpotResolvedObjectTypeImpl) metaAccess.lookupJavaType((Class<?>) object);
+                field = staticFieldsHolder.findStaticFieldWithOffset(displacement, JavaKind.Object);
+            }
+            if (field == null) {
+                throw new IllegalArgumentException("Unsafe object access: field not found for read of kind Object" +
+                                " at offset " + displacement + " in " + type.toJavaName() + " object");
+            }
+            if (field.getJavaKind() != JavaKind.Object) {
+                throw new IllegalArgumentException("Unsafe object access: field " + field.format("%H.%n:%T") + " not of expected kind Object" +
+                                " at offset " + displacement + " in " + type.toJavaName() + " object");
+            }
         }
+        return true;
     }
 
     private boolean isValidObjectFieldDisplacement(Constant base, long displacement) {
@@ -77,8 +166,8 @@
         throw new IllegalArgumentException(String.valueOf(base));
     }
 
-    private static long readRawValue(Constant baseConstant, long displacement, int bits) {
-        Object base = asObject(baseConstant);
+    private long readRawValue(Constant baseConstant, long displacement, JavaKind kind, int bits) {
+        Object base = asObject(baseConstant, kind, displacement);
         if (base != null) {
             switch (bits) {
                 case Byte.SIZE:
@@ -123,9 +212,8 @@
 
     private Object readRawObject(Constant baseConstant, long initialDisplacement, boolean compressed) {
         long displacement = initialDisplacement;
-
         Object ret;
-        Object base = asObject(baseConstant);
+        Object base = asObject(baseConstant, JavaKind.Object, displacement);
         if (base == null) {
             assert !compressed;
             displacement += asRawPointer(baseConstant);
@@ -138,34 +226,43 @@
         return ret;
     }
 
-    /**
-     * Reads a value of this kind using a base address and a displacement. No bounds checking or
-     * type checking is performed. Returns {@code null} if the value is not available at this point.
-     *
-     * @param baseConstant the base address from which the value is read.
-     * @param displacement the displacement within the object in bytes
-     * @return the read value encapsulated in a {@link JavaConstant} object, or {@code null} if the
-     *         value cannot be read.
-     * @throws IllegalArgumentException if {@code kind} is {@code null}, {@link JavaKind#Void}, not
-     *             {@link JavaKind#Object} or not {@linkplain JavaKind#isPrimitive() primitive} kind
-     */
-    JavaConstant readUnsafeConstant(JavaKind kind, JavaConstant baseConstant, long displacement) {
-        if (kind == null) {
-            throw new IllegalArgumentException("null JavaKind");
-        }
-        if (kind == JavaKind.Object) {
-            Object o = readRawObject(baseConstant, displacement, runtime.getConfig().useCompressedOops);
+    JavaConstant readFieldValue(HotSpotResolvedJavaField field, Object obj) {
+        assert obj != null;
+        assert !field.isStatic() || obj instanceof Class;
+        long displacement = field.offset();
+        assert checkRead(field.getJavaKind(), displacement, (HotSpotResolvedObjectType) runtime.getHostJVMCIBackend().getMetaAccess().lookupJavaType(obj.getClass()), obj);
+        if (field.getJavaKind() == JavaKind.Object) {
+            Object o = UNSAFE.getObject(obj, displacement);
             return HotSpotObjectConstantImpl.forObject(o);
         } else {
-            int bits = kind.getByteCount() * Byte.SIZE;
-            return readPrimitiveConstant(kind, baseConstant, displacement, bits);
+            JavaKind kind = field.getJavaKind();
+            switch (kind) {
+                case Boolean:
+                    return JavaConstant.forBoolean(UNSAFE.getBoolean(obj, displacement));
+                case Byte:
+                    return JavaConstant.forByte(UNSAFE.getByte(obj, displacement));
+                case Char:
+                    return JavaConstant.forChar(UNSAFE.getChar(obj, displacement));
+                case Short:
+                    return JavaConstant.forShort(UNSAFE.getShort(obj, displacement));
+                case Int:
+                    return JavaConstant.forInt(UNSAFE.getInt(obj, displacement));
+                case Long:
+                    return JavaConstant.forLong(UNSAFE.getLong(obj, displacement));
+                case Float:
+                    return JavaConstant.forFloat(UNSAFE.getFloat(obj, displacement));
+                case Double:
+                    return JavaConstant.forDouble(UNSAFE.getDouble(obj, displacement));
+                default:
+                    throw new IllegalArgumentException("Unsupported kind: " + kind);
+            }
         }
     }
 
     @Override
     public JavaConstant readPrimitiveConstant(JavaKind kind, Constant baseConstant, long initialDisplacement, int bits) {
         try {
-            long rawValue = readRawValue(baseConstant, initialDisplacement, bits);
+            long rawValue = readRawValue(baseConstant, initialDisplacement, kind, bits);
             switch (kind) {
                 case Boolean:
                     return JavaConstant.forBoolean(rawValue != 0);
@@ -193,6 +290,10 @@
 
     @Override
     public JavaConstant readObjectConstant(Constant base, long displacement) {
+        if (base instanceof HotSpotObjectConstantImpl) {
+            Object o = readRawObject(base, displacement, runtime.getConfig().useCompressedOops);
+            return HotSpotObjectConstantImpl.forObject(o);
+        }
         if (!isValidObjectFieldDisplacement(base, displacement)) {
             return null;
         }
--- a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java	Wed Apr 19 03:21:41 2017 +0000
@@ -847,6 +847,15 @@
     @Override
     public ResolvedJavaField findInstanceFieldWithOffset(long offset, JavaKind expectedEntryKind) {
         ResolvedJavaField[] declaredFields = getInstanceFields(true);
+        return findFieldWithOffset(offset, expectedEntryKind, declaredFields);
+    }
+
+    public ResolvedJavaField findStaticFieldWithOffset(long offset, JavaKind expectedEntryKind) {
+        ResolvedJavaField[] declaredFields = getStaticFields();
+        return findFieldWithOffset(offset, expectedEntryKind, declaredFields);
+    }
+
+    private static ResolvedJavaField findFieldWithOffset(long offset, JavaKind expectedEntryKind, ResolvedJavaField[] declaredFields) {
         for (ResolvedJavaField field : declaredFields) {
             HotSpotResolvedJavaField resolvedField = (HotSpotResolvedJavaField) field;
             long resolvedFieldOffset = resolvedField.offset();
--- a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MemoryAccessProvider.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MemoryAccessProvider.java	Wed Apr 19 03:21:41 2017 +0000
@@ -35,9 +35,9 @@
      * @param displacement the displacement within the object in bytes
      * @param bits the number of bits to read from memory
      * @return the read value encapsulated in a {@link JavaConstant} object of {@link JavaKind} kind
-     * @throws IllegalArgumentException if {@code kind} is {@link JavaKind#Void} or not
-     *             {@linkplain JavaKind#isPrimitive() primitive} kind or {@code bits} is not 8, 16,
-     *             32 or 64
+     * @throws IllegalArgumentException if the read is out of bounds of the object or {@code kind}
+     *             is {@link JavaKind#Void} or not {@linkplain JavaKind#isPrimitive() primitive}
+     *             kind or {@code bits} is not 8, 16, 32 or 64
      */
     JavaConstant readPrimitiveConstant(JavaKind kind, Constant base, long displacement, int bits) throws IllegalArgumentException;
 
@@ -46,9 +46,9 @@
      *
      * @param base the base address from which the value is read
      * @param displacement the displacement within the object in bytes
-     * @return the read value encapsulated in a {@link Constant} object or {@code null} if the
-     *         address computed from {@code base} and {@code displacement} does not denote a
-     *         location holding an {@code Object} value
+     * @return the read value encapsulated in a {@link Constant} object
+     * @throws IllegalArgumentException if the address computed from {@code base} and
+     *             {@code displacement} does not denote a location holding an {@code Object} value
      */
     JavaConstant readObjectConstant(Constant base, long displacement);
 }
--- a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.services/src/jdk/vm/ci/services/Services.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.services/src/jdk/vm/ci/services/Services.java	Wed Apr 19 03:21:41 2017 +0000
@@ -28,6 +28,7 @@
 import java.util.Iterator;
 import java.util.ServiceConfigurationError;
 import java.util.ServiceLoader;
+import java.util.Set;
 
 /**
  * A mechanism for accessing service providers via JVMCI.
@@ -108,7 +109,7 @@
             Object jvmci = invoke(getModule, Services.class);
             Object requestorModule = invoke(getModule, requestor);
             if (jvmci != requestorModule) {
-                String[] packages = invoke(getPackages, jvmci);
+                Set<String> packages = invoke(getPackages, jvmci);
                 for (String pkg : packages) {
                     // Export all JVMCI packages dynamically instead
                     // of requiring a long list of --add-exports
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/util/ModuleAPI.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/util/ModuleAPI.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -64,27 +64,27 @@
     public static final ModuleAPI addOpens;
 
     /**
-     * {@code java.lang.reflect.Module.getResourceAsStream(String)}.
+     * {@code java.lang.Module.getResourceAsStream(String)}.
      */
     public static final ModuleAPI getResourceAsStream;
 
     /**
-     * {@code java.lang.reflect.Module.getPackages()}.
+     * {@code java.lang.Module.getPackages()}.
      */
     public static final ModuleAPI getPackages;
 
     /**
-     * {@code java.lang.reflect.Module.canRead(Module)}.
+     * {@code java.lang.Module.canRead(Module)}.
      */
     public static final ModuleAPI canRead;
 
     /**
-     * {@code java.lang.reflect.Module.isExported(String)}.
+     * {@code java.lang.Module.isExported(String)}.
      */
     public static final ModuleAPI isExported;
 
     /**
-     * {@code java.lang.reflect.Module.isExported(String, Module)}.
+     * {@code java.lang.Module.isExported(String, Module)}.
      */
     public static final ModuleAPI isExportedTo;
 
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/ExportingClassLoader.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/ExportingClassLoader.java	Wed Apr 19 03:21:41 2017 +0000
@@ -29,14 +29,14 @@
 public class ExportingClassLoader extends ClassLoader {
     public ExportingClassLoader() {
         if (!GraalTest.Java8OrEarlier) {
-            JLRModule.fromClass(getClass()).exportAllPackagesTo(JLRModule.getUnnamedModuleFor(this));
+            JLModule.fromClass(getClass()).exportAllPackagesTo(JLModule.getUnnamedModuleFor(this));
         }
     }
 
     public ExportingClassLoader(ClassLoader parent) {
         super(parent);
         if (!GraalTest.Java8OrEarlier) {
-            JLRModule.fromClass(getClass()).exportAllPackagesTo(JLRModule.getUnnamedModuleFor(this));
+            JLModule.fromClass(getClass()).exportAllPackagesTo(JLModule.getUnnamedModuleFor(this));
         }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/JLModule.java	Wed Apr 19 03:21:41 2017 +0000
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.graalvm.compiler.test;
+
+import java.lang.reflect.Method;
+import java.util.Set;
+
+/**
+ * Facade for the {@code java.lang.Module} class introduced in JDK9 that allows tests to be
+ * developed against JDK8 but use module logic if deployed on JDK9.
+ */
+public class JLModule {
+
+    static {
+        if (GraalTest.Java8OrEarlier) {
+            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;
+    static {
+        try {
+            moduleClass = Class.forName("java.lang.Module");
+            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);
+        } 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);
+                }
+            }
+        }
+    }
+
+    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);
+        }
+    }
+}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/JLRModule.java	Tue Apr 18 20:17:22 2017 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package org.graalvm.compiler.test;
-
-import java.lang.reflect.Method;
-
-/**
- * Facade for the {@code java.lang.reflect.Module} class introduced in JDK9 that allows tests to be
- * developed against JDK8 but use module logic if deployed on JDK9.
- */
-public class JLRModule {
-
-    static {
-        if (GraalTest.Java8OrEarlier) {
-            throw new AssertionError("Use of " + JLRModule.class + " only allowed if " + GraalTest.class.getName() + ".JDK8OrEarlier is false");
-        }
-    }
-
-    private final Object realModule;
-
-    public JLRModule(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;
-    static {
-        try {
-            moduleClass = Class.forName("java.lang.reflect.Module");
-            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);
-        } catch (Exception e) {
-            throw new AssertionError(e);
-        }
-    }
-
-    public static JLRModule fromClass(Class<?> cls) {
-        try {
-            return new JLRModule(getModuleMethod.invoke(cls));
-        } catch (Exception e) {
-            throw new AssertionError(e);
-        }
-    }
-
-    public static JLRModule getUnnamedModuleFor(ClassLoader cl) {
-        try {
-            return new JLRModule(getUnnamedModuleMethod.invoke(cl));
-        } catch (Exception e) {
-            throw new AssertionError(e);
-        }
-    }
-
-    /**
-     * Exports all packages in this module to a given module.
-     */
-    public void exportAllPackagesTo(JLRModule 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);
-                }
-            }
-        }
-    }
-
-    public String[] getPackages() {
-        try {
-            return (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, JLRModule other) {
-        try {
-            return (Boolean) isExported2Method.invoke(realModule, pn, other.realModule);
-        } catch (Exception e) {
-            throw new AssertionError(e);
-        }
-    }
-
-    public void addExports(String pn, JLRModule other) {
-        try {
-            addExportsMethod.invoke(realModule, pn, other.realModule);
-        } catch (Exception e) {
-            throw new AssertionError(e);
-        }
-    }
-}
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp	Wed Apr 19 03:21:41 2017 +0000
@@ -5416,7 +5416,7 @@
   ModuleEntry* module_entry = ik->module();
   assert(module_entry != NULL, "module_entry should always be set");
 
-  // Obtain java.lang.reflect.Module
+  // Obtain java.lang.Module
   Handle module_handle(THREAD, JNIHandles::resolve(module_entry->module()));
 
   // Allocate mirror and initialize static fields
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp	Wed Apr 19 03:21:41 2017 +0000
@@ -772,13 +772,13 @@
   InstanceKlass::cast(k)->do_local_static_fields(&initialize_static_field, mirror, CHECK);
 }
 
-// Set the java.lang.reflect.Module module field in the java_lang_Class mirror
+// Set the java.lang.Module module field in the java_lang_Class mirror
 void java_lang_Class::set_mirror_module_field(Klass* k, Handle mirror, Handle module, TRAPS) {
   if (module.is_null()) {
     // During startup, the module may be NULL only if java.base has not been defined yet.
-    // Put the class on the fixup_module_list to patch later when the java.lang.reflect.Module
+    // Put the class on the fixup_module_list to patch later when the java.lang.Module
     // for java.base is known.
-    assert(!Universe::is_module_initialized(), "Incorrect java.lang.reflect.Module pre module system initialization");
+    assert(!Universe::is_module_initialized(), "Incorrect java.lang.Module pre module system initialization");
 
     bool javabase_was_defined = false;
     {
@@ -809,7 +809,7 @@
     assert(Universe::is_module_initialized() ||
            (ModuleEntryTable::javabase_defined() &&
             (module() == JNIHandles::resolve(ModuleEntryTable::javabase_moduleEntry()->module()))),
-           "Incorrect java.lang.reflect.Module specification while creating mirror");
+           "Incorrect java.lang.Module specification while creating mirror");
     set_module(mirror(), module());
   }
 }
@@ -2802,27 +2802,27 @@
 }
 
 
-int java_lang_reflect_Module::loader_offset;
-int java_lang_reflect_Module::name_offset;
-int java_lang_reflect_Module::_module_entry_offset = -1;
-
-Handle java_lang_reflect_Module::create(Handle loader, Handle module_name, TRAPS) {
+int java_lang_Module::loader_offset;
+int java_lang_Module::name_offset;
+int java_lang_Module::_module_entry_offset = -1;
+
+Handle java_lang_Module::create(Handle loader, Handle module_name, TRAPS) {
   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
 
-  Symbol* name = vmSymbols::java_lang_reflect_Module();
+  Symbol* name = vmSymbols::java_lang_Module();
   Klass* k = SystemDictionary::resolve_or_fail(name, true, CHECK_NH);
   InstanceKlass* ik = InstanceKlass::cast(k);
-  Handle jlrmh = ik->allocate_instance_handle(CHECK_NH);
+  Handle jlmh = ik->allocate_instance_handle(CHECK_NH);
   JavaValue result(T_VOID);
-  JavaCalls::call_special(&result, jlrmh, ik,
+  JavaCalls::call_special(&result, jlmh, ik,
                           vmSymbols::object_initializer_name(),
-                          vmSymbols::java_lang_reflect_module_init_signature(),
+                          vmSymbols::java_lang_module_init_signature(),
                           loader, module_name, CHECK_NH);
-  return jlrmh;
-}
-
-void java_lang_reflect_Module::compute_offsets() {
-  Klass* k = SystemDictionary::reflect_Module_klass();
+  return jlmh;
+}
+
+void java_lang_Module::compute_offsets() {
+  Klass* k = SystemDictionary::Module_klass();
   if(NULL != k) {
     compute_offset(loader_offset,  k, vmSymbols::loader_name(),  vmSymbols::classloader_signature());
     compute_offset(name_offset,    k, vmSymbols::name_name(),    vmSymbols::string_signature());
@@ -2831,27 +2831,27 @@
 }
 
 
-oop java_lang_reflect_Module::loader(oop module) {
+oop java_lang_Module::loader(oop module) {
   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
   return module->obj_field(loader_offset);
 }
 
-void java_lang_reflect_Module::set_loader(oop module, oop value) {
+void java_lang_Module::set_loader(oop module, oop value) {
   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
   module->obj_field_put(loader_offset, value);
 }
 
-oop java_lang_reflect_Module::name(oop module) {
+oop java_lang_Module::name(oop module) {
   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
   return module->obj_field(name_offset);
 }
 
-void java_lang_reflect_Module::set_name(oop module, oop value) {
+void java_lang_Module::set_name(oop module, oop value) {
   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
   module->obj_field_put(name_offset, value);
 }
 
-ModuleEntry* java_lang_reflect_Module::module_entry(oop module, TRAPS) {
+ModuleEntry* java_lang_Module::module_entry(oop module, TRAPS) {
   assert(_module_entry_offset != -1, "Uninitialized module_entry_offset");
   assert(module != NULL, "module can't be null");
   assert(module->is_oop(), "module must be oop");
@@ -2860,7 +2860,7 @@
   if (module_entry == NULL) {
     // If the inject field containing the ModuleEntry* is null then return the
     // class loader's unnamed module.
-    oop loader = java_lang_reflect_Module::loader(module);
+    oop loader = java_lang_Module::loader(module);
     Handle h_loader = Handle(THREAD, loader);
     ClassLoaderData* loader_cld = SystemDictionary::register_loader(h_loader, CHECK_NULL);
     return loader_cld->unnamed_module();
@@ -2868,7 +2868,7 @@
   return module_entry;
 }
 
-void java_lang_reflect_Module::set_module_entry(oop module, ModuleEntry* module_entry) {
+void java_lang_Module::set_module_entry(oop module, ModuleEntry* module_entry) {
   assert(_module_entry_offset != -1, "Uninitialized module_entry_offset");
   assert(module != NULL, "module can't be null");
   assert(module->is_oop(), "module must be oop");
@@ -3873,7 +3873,7 @@
   reflect_ConstantPool::compute_offsets();
   reflect_UnsafeStaticFieldAccessorImpl::compute_offsets();
   java_lang_reflect_Parameter::compute_offsets();
-  java_lang_reflect_Module::compute_offsets();
+  java_lang_Module::compute_offsets();
   java_lang_StackFrameInfo::compute_offsets();
   java_lang_LiveStackFrameInfo::compute_offsets();
 
--- a/hotspot/src/share/vm/classfile/javaClasses.hpp	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/share/vm/classfile/javaClasses.hpp	Wed Apr 19 03:21:41 2017 +0000
@@ -749,9 +749,9 @@
 };
 
 #define MODULE_INJECTED_FIELDS(macro)                            \
-  macro(java_lang_reflect_Module, module_entry, intptr_signature, false)
+  macro(java_lang_Module, module_entry, intptr_signature, false)
 
-class java_lang_reflect_Module {
+class java_lang_Module {
   private:
     static int loader_offset;
     static int name_offset;
--- a/hotspot/src/share/vm/classfile/javaClasses.inline.hpp	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/share/vm/classfile/javaClasses.inline.hpp	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -162,8 +162,8 @@
   return obj != NULL && is_subclass(obj->klass());
 }
 
-inline bool java_lang_reflect_Module::is_instance(oop obj) {
-  return obj != NULL && obj->klass() == SystemDictionary::reflect_Module_klass();
+inline bool java_lang_Module::is_instance(oop obj) {
+  return obj != NULL && obj->klass() == SystemDictionary::Module_klass();
 }
 
 inline int Backtrace::merge_bci_and_version(int bci, int version) {
--- a/hotspot/src/share/vm/classfile/moduleEntry.cpp	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/share/vm/classfile/moduleEntry.cpp	Wed Apr 19 03:21:41 2017 +0000
@@ -235,7 +235,7 @@
 
   // Store pointer to the ModuleEntry in the unnamed module's java.lang.Module
   // object.
-  java_lang_reflect_Module::set_module_entry(module, unnamed_module);
+  java_lang_Module::set_module_entry(module, unnamed_module);
 
   return unnamed_module;
 }
@@ -424,27 +424,27 @@
     fatal("Unable to finalize module definition for " JAVA_BASE_NAME);
   }
 
-  // Set java.lang.reflect.Module, version and location for java.base
+  // Set java.lang.Module, version and location for java.base
   ModuleEntry* jb_module = javabase_moduleEntry();
   assert(jb_module != NULL, JAVA_BASE_NAME " ModuleEntry not defined");
   jb_module->set_version(version);
   jb_module->set_location(location);
   // Once java.base's ModuleEntry _module field is set with the known
-  // java.lang.reflect.Module, java.base is considered "defined" to the VM.
+  // java.lang.Module, java.base is considered "defined" to the VM.
   jb_module->set_module(boot_loader_data->add_handle(module_handle));
 
-  // Store pointer to the ModuleEntry for java.base in the java.lang.reflect.Module object.
-  java_lang_reflect_Module::set_module_entry(module_handle(), jb_module);
+  // Store pointer to the ModuleEntry for java.base in the java.lang.Module object.
+  java_lang_Module::set_module_entry(module_handle(), jb_module);
 }
 
-// Within java.lang.Class instances there is a java.lang.reflect.Module field
-// that must be set with the defining module.  During startup, prior to java.base's
-// definition, classes needing their module field set are added to the fixup_module_list.
-// Their module field is set once java.base's java.lang.reflect.Module is known to the VM.
+// Within java.lang.Class instances there is a java.lang.Module field that must
+// be set with the defining module.  During startup, prior to java.base's definition,
+// classes needing their module field set are added to the fixup_module_list.
+// Their module field is set once java.base's java.lang.Module is known to the VM.
 void ModuleEntryTable::patch_javabase_entries(Handle module_handle) {
   if (module_handle.is_null()) {
     fatal("Unable to patch the module field of classes loaded prior to "
-          JAVA_BASE_NAME "'s definition, invalid java.lang.reflect.Module");
+          JAVA_BASE_NAME "'s definition, invalid java.lang.Module");
   }
 
   // Do the fixups for the basic primitive types
--- a/hotspot/src/share/vm/classfile/moduleEntry.hpp	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/share/vm/classfile/moduleEntry.hpp	Wed Apr 19 03:21:41 2017 +0000
@@ -45,7 +45,7 @@
 // A ModuleEntry describes a module that has been defined by a call to JVM_DefineModule.
 // It contains:
 //   - Symbol* containing the module's name.
-//   - pointer to the java.lang.reflect.Module for this module.
+//   - pointer to the java.lang.Module for this module.
 //   - pointer to the java.security.ProtectionDomain shared by classes defined to this module.
 //   - ClassLoaderData*, class loader of this module.
 //   - a growable array containg other module entries that this module can read.
@@ -55,7 +55,7 @@
 // data structure.
 class ModuleEntry : public HashtableEntry<Symbol*, mtModule> {
 private:
-  jobject _module;                     // java.lang.reflect.Module
+  jobject _module;                     // java.lang.Module
   jobject _pd;                         // java.security.ProtectionDomain, cached
                                        // for shared classes from this module
   ClassLoaderData* _loader_data;
--- a/hotspot/src/share/vm/classfile/modules.cpp	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/share/vm/classfile/modules.cpp	Wed Apr 19 03:21:41 2017 +0000
@@ -62,7 +62,7 @@
 }
 
 static char* get_module_name(oop module, TRAPS) {
-  oop name_oop = java_lang_reflect_Module::name(module);
+  oop name_oop = java_lang_Module::name(module);
   if (name_oop == NULL) {
     THROW_MSG_NULL(vmSymbols::java_lang_NullPointerException(), "Null module name");
   }
@@ -98,11 +98,11 @@
 
 static ModuleEntry* get_module_entry(jobject module, TRAPS) {
   Handle module_h(THREAD, JNIHandles::resolve(module));
-  if (!java_lang_reflect_Module::is_instance(module_h())) {
+  if (!java_lang_Module::is_instance(module_h())) {
     THROW_MSG_NULL(vmSymbols::java_lang_IllegalArgumentException(),
-                   "module is not an instance of type java.lang.reflect.Module");
+                   "module is not an instance of type java.lang.Module");
   }
-  return java_lang_reflect_Module::module_entry(module_h(), CHECK_NULL);
+  return java_lang_Module::module_entry(module_h(), CHECK_NULL);
 }
 
 static PackageEntry* get_package_entry(ModuleEntry* module_entry, const char* package_name, TRAPS) {
@@ -175,7 +175,7 @@
   }
 
   // Validate java_base's loader is the boot loader.
-  oop loader = java_lang_reflect_Module::loader(module_handle());
+  oop loader = java_lang_Module::loader(module_handle());
   if (loader != NULL) {
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
               "Class loader must be the boot class loader");
@@ -228,7 +228,7 @@
   // Only the thread that actually defined the base module will get here,
   // so no locking is needed.
 
-  // Patch any previously loaded class's module field with java.base's java.lang.reflect.Module.
+  // Patch any previously loaded class's module field with java.base's java.lang.Module.
   ModuleEntryTable::patch_javabase_entries(module_handle);
 
   log_debug(modules)("define_javabase_module(): Definition of module: "
@@ -278,9 +278,9 @@
   }
 
   Handle module_handle(THREAD, JNIHandles::resolve(module));
-  if (!java_lang_reflect_Module::is_instance(module_handle())) {
+  if (!java_lang_Module::is_instance(module_handle())) {
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
-              "module is not an instance of type java.lang.reflect.Module");
+              "module is not an instance of type java.lang.Module");
   }
 
   char* module_name = get_module_name(module_handle(), CHECK);
@@ -297,7 +297,7 @@
 
   const char* module_version = get_module_version(version);
 
-  oop loader = java_lang_reflect_Module::loader(module_handle());
+  oop loader = java_lang_Module::loader(module_handle());
   // Make sure loader is not the jdk.internal.reflect.DelegatingClassLoader.
   if (loader != java_lang_ClassLoader::non_reflection_class_loader(loader)) {
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
@@ -413,8 +413,8 @@
           pkg_list->at(y)->decrement_refcount();
         }
 
-        // Store pointer to ModuleEntry record in java.lang.reflect.Module object.
-        java_lang_reflect_Module::set_module_entry(module_handle(), module_entry);
+        // Store pointer to ModuleEntry record in java.lang.Module object.
+        java_lang_Module::set_module_entry(module_handle(), module_entry);
       }
     }
   }  // Release the lock
@@ -456,20 +456,20 @@
     THROW_MSG(vmSymbols::java_lang_NullPointerException(), "Null module object");
   }
   Handle module_handle(THREAD, JNIHandles::resolve(module));
-  if (!java_lang_reflect_Module::is_instance(module_handle())) {
+  if (!java_lang_Module::is_instance(module_handle())) {
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
-              "module is not an instance of type java.lang.reflect.Module");
+              "module is not an instance of type java.lang.Module");
   }
 
   // Ensure that this is an unnamed module
-  oop name = java_lang_reflect_Module::name(module_handle());
+  oop name = java_lang_Module::name(module_handle());
   if (name != NULL) {
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
-              "boot loader's unnamed module's java.lang.reflect.Module has a name");
+              "boot loader's unnamed module's java.lang.Module has a name");
   }
 
   // Validate java_base's loader is the boot loader.
-  oop loader = java_lang_reflect_Module::loader(module_handle());
+  oop loader = java_lang_Module::loader(module_handle());
   if (loader != NULL) {
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
               "Class loader must be the boot class loader");
@@ -483,8 +483,8 @@
   ModuleEntry* unnamed_module = boot_loader_data->unnamed_module();
   assert(unnamed_module != NULL, "boot loader's unnamed ModuleEntry not defined");
   unnamed_module->set_module(boot_loader_data->add_handle(module_handle));
-  // Store pointer to the ModuleEntry in the unnamed module's java.lang.reflect.Module object.
-  java_lang_reflect_Module::set_module_entry(module_handle(), unnamed_module);
+  // Store pointer to the ModuleEntry in the unnamed module's java.lang.Module object.
+  java_lang_Module::set_module_entry(module_handle(), unnamed_module);
 }
 
 void Modules::add_module_exports(jobject from_module, const char* package_name, jobject to_module, TRAPS) {
@@ -614,13 +614,13 @@
   oop module = java_lang_Class::module(mirror);
 
   assert(module != NULL, "java.lang.Class module field not set");
-  assert(java_lang_reflect_Module::is_instance(module), "module is not an instance of type java.lang.reflect.Module");
+  assert(java_lang_Module::is_instance(module), "module is not an instance of type java.lang.Module");
 
   if (log_is_enabled(Debug, modules)) {
     ResourceMark rm(THREAD);
     outputStream* logst = Log(modules)::debug_stream();
     Klass* klass = java_lang_Class::as_Klass(mirror);
-    oop module_name = java_lang_reflect_Module::name(module);
+    oop module_name = java_lang_Module::name(module);
     if (module_name != NULL) {
       logst->print("get_module(): module ");
       java_lang_String::print(module_name, tty);
--- a/hotspot/src/share/vm/classfile/modules.hpp	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/share/vm/classfile/modules.hpp	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -54,12 +54,12 @@
                             jstring location, const char* const* packages,
                             jsize num_packages, TRAPS);
 
-  // Provides the java.lang.reflect.Module for the unnamed module defined
+  // Provides the java.lang.Module for the unnamed module defined
   // to the boot loader.
   //
   //  IllegalArgumentExceptions are thrown for the following :
   //  * Module has a name
-  //  * Module is not a subclass of java.lang.reflect.Module
+  //  * Module is not a subclass of java.lang.Module
   //  * Module's class loader is not the boot loader
   //  NullPointerExceptions are thrown if module is null.
   static void set_bootloader_unnamed_module(jobject module, TRAPS);
@@ -95,10 +95,10 @@
   // module does not exist.
   static void add_reads_module(jobject from_module, jobject to_module, TRAPS);
 
-  // Return the java.lang.reflect.Module object for this class object.
+  // Return the java.lang.Module object for this class object.
   static jobject get_module(jclass clazz, TRAPS);
 
-  // Return the java.lang.reflect.Module object for this class loader and package.
+  // Return the java.lang.Module object for this class loader and package.
   // Returns NULL if the class loader has not loaded any classes in the package.
   // The package should contain /'s, not .'s, as in java/lang, not java.lang.
   // NullPointerException is thrown if package is null.
@@ -107,7 +107,7 @@
   static jobject get_named_module(Handle h_loader, const char* package, TRAPS);
 
   // If package is defined by loader, return the
-  // java.lang.reflect.Module object for the module in which the package is defined.
+  // java.lang.Module object for the module in which the package is defined.
   // Returns NULL if package is invalid or not defined by loader.
   static jobject get_module(Symbol* package_name, Handle h_loader, TRAPS);
 
--- a/hotspot/src/share/vm/classfile/systemDictionary.hpp	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp	Wed Apr 19 03:21:41 2017 +0000
@@ -133,9 +133,9 @@
   do_klass(Thread_klass,                                java_lang_Thread,                          Pre                 ) \
   do_klass(ThreadGroup_klass,                           java_lang_ThreadGroup,                     Pre                 ) \
   do_klass(Properties_klass,                            java_util_Properties,                      Pre                 ) \
+  do_klass(Module_klass,                                java_lang_Module,                          Pre                 ) \
   do_klass(reflect_AccessibleObject_klass,              java_lang_reflect_AccessibleObject,        Pre                 ) \
   do_klass(reflect_Field_klass,                         java_lang_reflect_Field,                   Pre                 ) \
-  do_klass(reflect_Module_klass,                        java_lang_reflect_Module,                  Pre                 ) \
   do_klass(reflect_Parameter_klass,                     java_lang_reflect_Parameter,               Opt                 ) \
   do_klass(reflect_Method_klass,                        java_lang_reflect_Method,                  Pre                 ) \
   do_klass(reflect_Constructor_klass,                   java_lang_reflect_Constructor,             Pre                 ) \
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp	Wed Apr 19 03:21:41 2017 +0000
@@ -56,6 +56,7 @@
   template(java_lang_Object,                          "java/lang/Object")                         \
   template(java_lang_Class,                           "java/lang/Class")                          \
   template(java_lang_Package,                         "java/lang/Package")                        \
+  template(java_lang_Module,                          "java/lang/Module")                         \
   template(java_lang_String,                          "java/lang/String")                         \
   template(java_lang_StringLatin1,                    "java/lang/StringLatin1")                   \
   template(java_lang_StringUTF16,                     "java/lang/StringUTF16")                    \
@@ -90,7 +91,6 @@
   template(java_lang_reflect_Method,                  "java/lang/reflect/Method")                 \
   template(java_lang_reflect_Constructor,             "java/lang/reflect/Constructor")            \
   template(java_lang_reflect_Field,                   "java/lang/reflect/Field")                  \
-  template(java_lang_reflect_Module,                  "java/lang/reflect/Module")                 \
   template(java_lang_reflect_Parameter,               "java/lang/reflect/Parameter")              \
   template(java_lang_reflect_Array,                   "java/lang/reflect/Array")                  \
   template(java_lang_StringBuffer,                    "java/lang/StringBuffer")                   \
@@ -136,7 +136,7 @@
   template(initPhase1_name,                           "initPhase1")                               \
   template(initPhase2_name,                           "initPhase2")                               \
   template(initPhase3_name,                           "initPhase3")                               \
-  template(java_lang_reflect_module_init_signature,   "(Ljava/lang/ClassLoader;Ljava/lang/String;)V") \
+  template(java_lang_module_init_signature,           "(Ljava/lang/ClassLoader;Ljava/lang/String;)V") \
                                                                                                   \
   /* class file format tags */                                                                    \
   template(tag_source_file,                           "SourceFile")                               \
@@ -450,7 +450,7 @@
   template(getModule_name,                            "getModule")                                \
   template(input_stream_void_signature,               "(Ljava/io/InputStream;)V")                 \
   template(definePackage_name,                        "definePackage")                            \
-  template(definePackage_signature,                   "(Ljava/lang/String;Ljava/lang/reflect/Module;)Ljava/lang/Package;") \
+  template(definePackage_signature,                   "(Ljava/lang/String;Ljava/lang/Module;)Ljava/lang/Package;") \
   template(defineOrCheckPackage_name,                 "defineOrCheckPackage")                     \
   template(defineOrCheckPackage_signature,            "(Ljava/lang/String;Ljava/util/jar/Manifest;Ljava/net/URL;)Ljava/lang/Package;") \
   template(fileToEncodedURL_name,                     "fileToEncodedURL")                         \
@@ -532,7 +532,7 @@
   template(void_class_signature,                      "()Ljava/lang/Class;")                                      \
   template(void_class_array_signature,                "()[Ljava/lang/Class;")                                     \
   template(void_string_signature,                     "()Ljava/lang/String;")                                     \
-  template(void_module_signature,                     "()Ljava/lang/reflect/Module;")                             \
+  template(void_module_signature,                     "()Ljava/lang/Module;")                                     \
   template(object_array_object_signature,             "([Ljava/lang/Object;)Ljava/lang/Object;")                  \
   template(object_object_array_object_signature,      "(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;")\
   template(exception_void_signature,                  "(Ljava/lang/Exception;)V")                                 \
@@ -552,7 +552,7 @@
   template(reference_signature,                       "Ljava/lang/ref/Reference;")                                \
   template(sun_misc_Cleaner_signature,                "Lsun/misc/Cleaner;")                                       \
   template(executable_signature,                      "Ljava/lang/reflect/Executable;")                           \
-  template(module_signature,                          "Ljava/lang/reflect/Module;")                               \
+  template(module_signature,                          "Ljava/lang/Module;")                                       \
   template(concurrenthashmap_signature,               "Ljava/util/concurrent/ConcurrentHashMap;")                 \
   template(String_StringBuilder_signature,            "(Ljava/lang/String;)Ljava/lang/StringBuilder;")            \
   template(int_StringBuilder_signature,               "(I)Ljava/lang/StringBuilder;")                             \
@@ -642,16 +642,16 @@
   template(jdk_internal_module_Modules,                "jdk/internal/module/Modules")                             \
   template(jdk_internal_vm_VMSupport,                  "jdk/internal/vm/VMSupport")                               \
   template(addReads_name,                              "addReads")                                                \
-  template(addReads_signature,                         "(Ljava/lang/reflect/Module;Ljava/lang/reflect/Module;)V") \
+  template(addReads_signature,                         "(Ljava/lang/Module;Ljava/lang/Module;)V")                 \
   template(addExports_name,                            "addExports")                                              \
   template(addOpens_name,                              "addOpens")                                                \
-  template(addExports_signature,                       "(Ljava/lang/reflect/Module;Ljava/lang/String;Ljava/lang/reflect/Module;)V") \
+  template(addExports_signature,                       "(Ljava/lang/Module;Ljava/lang/String;Ljava/lang/Module;)V") \
   template(addUses_name,                               "addUses")                                                 \
-  template(addUses_signature,                          "(Ljava/lang/reflect/Module;Ljava/lang/Class;)V")          \
+  template(addUses_signature,                          "(Ljava/lang/Module;Ljava/lang/Class;)V")                  \
   template(addProvides_name,                           "addProvides")                                             \
-  template(addProvides_signature,                      "(Ljava/lang/reflect/Module;Ljava/lang/Class;Ljava/lang/Class;)V") \
+  template(addProvides_signature,                      "(Ljava/lang/Module;Ljava/lang/Class;Ljava/lang/Class;)V") \
   template(transformedByAgent_name,                    "transformedByAgent")                                      \
-  template(transformedByAgent_signature,               "(Ljava/lang/reflect/Module;)V")                           \
+  template(transformedByAgent_signature,               "(Ljava/lang/Module;)V")                                   \
   template(appendToClassPathForInstrumentation_name,   "appendToClassPathForInstrumentation")                     \
   do_alias(appendToClassPathForInstrumentation_signature, string_void_signature)                                  \
   template(serializePropertiesToByteArray_name,        "serializePropertiesToByteArray")                          \
--- a/hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -54,8 +54,26 @@
   }
 }
 
+void GCTaskThread::add_task_timestamp(const char* name, jlong t_entry, jlong t_exit) {
+  if (_time_stamp_index < GCTaskTimeStampEntries) {
+    GCTaskTimeStamp* time_stamp = time_stamp_at(_time_stamp_index);
+    time_stamp->set_name(name);
+    time_stamp->set_entry_time(t_entry);
+    time_stamp->set_exit_time(t_exit);
+  } else {
+    if (_time_stamp_index ==  GCTaskTimeStampEntries) {
+      log_warning(gc, task, time)("GC-thread %u: Too many timestamps, ignoring future ones. "
+                                  "Increase GCTaskTimeStampEntries to get more info.",
+                                  id());
+    }
+    // Let _time_stamp_index keep counting to give the user an idea about how many
+    // are needed.
+  }
+  _time_stamp_index++;
+}
+
 GCTaskTimeStamp* GCTaskThread::time_stamp_at(uint index) {
-  guarantee(index < GCTaskTimeStampEntries, "increase GCTaskTimeStampEntries");
+  assert(index < GCTaskTimeStampEntries, "Precondition");
   if (_time_stamps == NULL) {
     // We allocate the _time_stamps array lazily since logging can be enabled dynamically
     GCTaskTimeStamp* time_stamps = NEW_C_HEAP_ARRAY(GCTaskTimeStamp, GCTaskTimeStampEntries, mtGC);
@@ -65,7 +83,6 @@
       FREE_C_HEAP_ARRAY(GCTaskTimeStamp, time_stamps);
     }
   }
-
   return &(_time_stamps[index]);
 }
 
@@ -75,8 +92,11 @@
   // Since _time_stamps is now lazily allocated we need to check that it
   // has in fact been allocated when calling this function.
   if (_time_stamps != NULL) {
-    log_debug(gc, task, time)("GC-Thread %u entries: %d", id(), _time_stamp_index);
-    for(uint i=0; i<_time_stamp_index; i++) {
+    log_debug(gc, task, time)("GC-Thread %u entries: %d%s", id(),
+                              _time_stamp_index,
+                              _time_stamp_index >= GCTaskTimeStampEntries ? " (overflow)" : "");
+    const uint max_index = MIN2(_time_stamp_index, GCTaskTimeStampEntries);
+    for (uint i = 0; i < max_index; i++) {
       GCTaskTimeStamp* time_stamp = time_stamp_at(i);
       log_debug(gc, task, time)("\t[ %s " JLONG_FORMAT " " JLONG_FORMAT " ]",
                                 time_stamp->name(),
@@ -144,16 +164,7 @@
 
         if (log_is_enabled(Debug, gc, task, time)) {
           timer.update();
-
-          GCTaskTimeStamp* time_stamp = time_stamp_at(_time_stamp_index);
-
-          time_stamp->set_name(name);
-          time_stamp->set_entry_time(entry_time);
-          time_stamp->set_exit_time(timer.ticks());
-
-          // Update the index after we have set up the entry correctly since
-          // GCTaskThread::print_task_time_stamps() may read this value concurrently.
-          _time_stamp_index++;
+          add_task_timestamp(name, entry_time, timer.ticks());
         }
       } else {
         // idle tasks complete outside the normal accounting
--- a/hotspot/src/share/vm/gc/parallel/gcTaskThread.hpp	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/share/vm/gc/parallel/gcTaskThread.hpp	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -45,6 +45,7 @@
   uint _time_stamp_index;
 
   GCTaskTimeStamp* time_stamp_at(uint index);
+  void add_task_timestamp(const char* name, jlong t_entry, jlong t_exit);
 
   bool _is_working;                     // True if participating in GC tasks
 
@@ -92,16 +93,16 @@
  private:
   jlong  _entry_time;
   jlong  _exit_time;
-  char*  _name;
+  const char*  _name;
 
  public:
   jlong entry_time()              { return _entry_time; }
   jlong exit_time()               { return _exit_time; }
-  const char* name() const        { return (const char*)_name; }
+  const char* name() const        { return _name; }
 
   void set_entry_time(jlong time) { _entry_time = time; }
   void set_exit_time(jlong time)  { _exit_time = time; }
-  void set_name(char* name)       { _name = name; }
+  void set_name(const char* name) { _name = name; }
 };
 
 #endif // SHARE_VM_GC_PARALLEL_GCTASKTHREAD_HPP
--- a/hotspot/src/share/vm/oops/constMethod.hpp	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/share/vm/oops/constMethod.hpp	Wed Apr 19 03:21:41 2017 +0000
@@ -359,7 +359,9 @@
   }
 
   // Sizing
-  static int header_size() { return sizeof(ConstMethod)/wordSize; }
+  static int header_size() {
+    return align_size_up(sizeof(ConstMethod), wordSize) / wordSize;
+  }
 
   // Size needed
   static int size(int code_size, InlineTableSizes* sizes);
--- a/hotspot/src/share/vm/oops/constantPool.hpp	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/share/vm/oops/constantPool.hpp	Wed Apr 19 03:21:41 2017 +0000
@@ -705,7 +705,9 @@
   }
 
   // Sizing (in words)
-  static int header_size()             { return sizeof(ConstantPool)/wordSize; }
+  static int header_size()             {
+    return align_size_up(sizeof(ConstantPool), wordSize) / wordSize;
+  }
   static int size(int length)          { return align_metadata_size(header_size() + length); }
   int size() const                     { return size(length()); }
 #if INCLUDE_SERVICES
--- a/hotspot/src/share/vm/oops/cpCache.hpp	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/share/vm/oops/cpCache.hpp	Wed Apr 19 03:21:41 2017 +0000
@@ -359,7 +359,9 @@
                                                    return (TosState)((_flags >> tos_state_shift) & tos_state_mask); }
 
   // Code generation support
-  static WordSize size()                         { return in_WordSize(sizeof(ConstantPoolCacheEntry) / wordSize); }
+  static WordSize size()                         {
+    return in_WordSize(align_size_up(sizeof(ConstantPoolCacheEntry), wordSize) / wordSize);
+  }
   static ByteSize size_in_bytes()                { return in_ByteSize(sizeof(ConstantPoolCacheEntry)); }
   static ByteSize indices_offset()               { return byte_offset_of(ConstantPoolCacheEntry, _indices); }
   static ByteSize f1_offset()                    { return byte_offset_of(ConstantPoolCacheEntry, _f1); }
--- a/hotspot/src/share/vm/oops/klass.cpp	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/share/vm/oops/klass.cpp	Wed Apr 19 03:21:41 2017 +0000
@@ -532,7 +532,7 @@
     } else {
       module_entry = ModuleEntryTable::javabase_moduleEntry();
     }
-    // Obtain java.lang.reflect.Module, if available
+    // Obtain java.lang.Module, if available
     Handle module_handle(THREAD, ((module_entry != NULL) ? JNIHandles::resolve(module_entry->module()) : (oop)NULL));
     java_lang_Class::create_mirror(this, loader, module_handle, protection_domain, CHECK);
   }
--- a/hotspot/src/share/vm/oops/method.hpp	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/share/vm/oops/method.hpp	Wed Apr 19 03:21:41 2017 +0000
@@ -666,7 +666,9 @@
 #endif
 
   // sizing
-  static int header_size()                       { return sizeof(Method)/wordSize; }
+  static int header_size()                       {
+    return align_size_up(sizeof(Method), wordSize) / wordSize;
+  }
   static int size(bool is_native);
   int size() const                               { return method_size(); }
 #if INCLUDE_SERVICES
--- a/hotspot/src/share/vm/oops/methodCounters.hpp	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/share/vm/oops/methodCounters.hpp	Wed Apr 19 03:21:41 2017 +0000
@@ -116,7 +116,9 @@
 
   AOT_ONLY(Method* method() const { return _method; })
 
-  static int size() { return sizeof(MethodCounters) / wordSize; }
+  static int size() {
+    return align_size_up(sizeof(MethodCounters), wordSize) / wordSize;
+  }
 
   bool is_klass() const { return false; }
 
--- a/hotspot/src/share/vm/prims/jvmti.xml	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/share/vm/prims/jvmti.xml	Wed Apr 19 03:21:41 2017 +0000
@@ -6516,7 +6516,7 @@
     <function id="GetNamedModule" num="40" since="9">
       <synopsis>Get Named Module</synopsis>
       <description>
-        Return the <code>java.lang.reflect.Module</code> object for a named
+        Return the <code>java.lang.Module</code> object for a named
         module defined to a class loader that contains a given package.
         The module is returned via <code>module_ptr</code>.
         <p/>
@@ -6554,7 +6554,7 @@
         <param id="module_ptr">
           <outptr><jobject/></outptr>
           <description>
-            On return, points to a <code>java.lang.reflect.Module</code> object
+            On return, points to a <code>java.lang.Module</code> object
             or points to <code>NULL</code>.
           </description>
         </param>
@@ -6599,6 +6599,10 @@
         <error id="JVMTI_ERROR_INVALID_MODULE">
           If <paramlink id="to_module"></paramlink> is not a module object.
         </error>
+        <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
+          if the module cannot be modified.
+          See <functionlink id="IsModifiableModule"/>.
+        </error>
       </errors>
     </function>
 
@@ -6633,7 +6637,7 @@
           <description>
             The module the package is exported to.
             If the <code>to_module</code> is not a subclass of
-            <code>java.lang.reflect.Module</code> this function returns
+            <code>java.lang.Module</code> this function returns
             <errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>.
           </description>
         </param>
@@ -6649,6 +6653,10 @@
           If the package <paramlink id="pkg_name"></paramlink>
           does not belong to the module.
         </error>
+        <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
+          if the module cannot be modified.
+          See <functionlink id="IsModifiableModule"/>.
+        </error>
       </errors>
     </function>
 
@@ -6684,7 +6692,7 @@
           <description>
             The module with the package to open.
             If the <code>to_module</code> is not a subclass of
-            <code>java.lang.reflect.Module</code> this function returns
+            <code>java.lang.Module</code> this function returns
             <errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>.
           </description>
         </param>
@@ -6700,6 +6708,10 @@
           If the package <paramlink id="pkg_name"></paramlink>
           does not belong to the module.
         </error>
+        <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
+          if the module cannot be modified.
+          See <functionlink id="IsModifiableModule"/>.
+        </error>
       </errors>
     </function>
 
@@ -6737,6 +6749,10 @@
         <error id="JVMTI_ERROR_INVALID_CLASS">
           If <paramlink id="service"></paramlink> is not a class object.
         </error>
+        <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
+          if the module cannot be modified.
+          See <functionlink id="IsModifiableModule"/>.
+        </error>
       </errors>
     </function>
 
@@ -6783,6 +6799,44 @@
         <error id="JVMTI_ERROR_INVALID_CLASS">
           If <paramlink id="impl_class"></paramlink> is not a class object.
         </error>
+        <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
+          if the module cannot be modified.
+          See <functionlink id="IsModifiableModule"/>.
+        </error>
+      </errors>
+    </function>
+
+    <function id="IsModifiableModule" num="99" since="9">
+      <synopsis>Is Modifiable Module</synopsis>
+      <description>
+        Determines whether a module is modifiable.
+        If a module is modifiable then this module can be updated with
+        <functionlink id="AddModuleReads"/>, <functionlink id="AddModuleExports"/>,
+        <functionlink id="AddModuleOpens"/>, <functionlink id="AddModuleUses"/>,
+        and <functionlink id="AddModuleProvides"/>. If a module is not modifiable
+        then the module can not be updated with these functions.
+      </description>
+      <origin>new</origin>
+      <capabilities>
+      </capabilities>
+      <parameters>
+        <param id="module">
+          <ptrtype><jobject/></ptrtype>
+          <description>
+            The module to query.
+          </description>
+        </param>
+        <param id="is_modifiable_module_ptr">
+          <outptr><jboolean/></outptr>
+          <description>
+            On return, points to the boolean result of this function.
+          </description>
+        </param>
+      </parameters>
+      <errors>
+        <error id="JVMTI_ERROR_INVALID_MODULE">
+          If <paramlink id="module"></paramlink> is not a module object.
+        </error>
       </errors>
     </function>
 
@@ -7803,6 +7857,10 @@
 	  A method in the new class version has different modifiers
 	  than its counterpart in the old class version.
 	</error>
+        <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
+          A module cannot be modified.
+          See <functionlink id="IsModifiableModule"/>.
+        </error>
       </errors>
     </function>
 
@@ -11567,6 +11625,9 @@
     <errorid id="JVMTI_ERROR_UNMODIFIABLE_CLASS" num="79">
       The class cannot be modified.
     </errorid>
+    <errorid id="JVMTI_ERROR_UNMODIFIABLE_MODULE" num="80">
+      The module cannot be modified.
+    </errorid>
     <errorid id="JVMTI_ERROR_NOT_AVAILABLE" num="98">
       The functionality is not available in this virtual machine.
     </errorid>
@@ -14736,6 +14797,7 @@
        - Add new functions:
           - GetAllModules
           - AddModuleReads, AddModuleExports, AddModuleOpens, AddModuleUses, AddModuleProvides
+          - IsModifiableModule
       Clarified can_redefine_any_classes, can_retransform_any_classes and IsModifiableClass API to
       disallow some implementation defined classes.
   </change>
--- a/hotspot/src/share/vm/prims/jvmtiEnv.cpp	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiEnv.cpp	Wed Apr 19 03:21:41 2017 +0000
@@ -235,12 +235,12 @@
 
   // check module
   Handle h_module(THREAD, JNIHandles::resolve(module));
-  if (!java_lang_reflect_Module::is_instance(h_module())) {
+  if (!java_lang_Module::is_instance(h_module())) {
     return JVMTI_ERROR_INVALID_MODULE;
   }
   // check to_module
   Handle h_to_module(THREAD, JNIHandles::resolve(to_module));
-  if (!java_lang_reflect_Module::is_instance(h_to_module())) {
+  if (!java_lang_Module::is_instance(h_to_module())) {
     return JVMTI_ERROR_INVALID_MODULE;
   }
   return JvmtiExport::add_module_reads(h_module, h_to_module, THREAD);
@@ -257,12 +257,12 @@
 
   // check module
   Handle h_module(THREAD, JNIHandles::resolve(module));
-  if (!java_lang_reflect_Module::is_instance(h_module())) {
+  if (!java_lang_Module::is_instance(h_module())) {
     return JVMTI_ERROR_INVALID_MODULE;
   }
   // check to_module
   Handle h_to_module(THREAD, JNIHandles::resolve(to_module));
-  if (!java_lang_reflect_Module::is_instance(h_to_module())) {
+  if (!java_lang_Module::is_instance(h_to_module())) {
     return JVMTI_ERROR_INVALID_MODULE;
   }
   return JvmtiExport::add_module_exports(h_module, h_pkg, h_to_module, THREAD);
@@ -279,12 +279,12 @@
 
   // check module
   Handle h_module(THREAD, JNIHandles::resolve(module));
-  if (!java_lang_reflect_Module::is_instance(h_module())) {
+  if (!java_lang_Module::is_instance(h_module())) {
     return JVMTI_ERROR_INVALID_MODULE;
   }
   // check to_module
   Handle h_to_module(THREAD, JNIHandles::resolve(to_module));
-  if (!java_lang_reflect_Module::is_instance(h_to_module())) {
+  if (!java_lang_Module::is_instance(h_to_module())) {
     return JVMTI_ERROR_INVALID_MODULE;
   }
   return JvmtiExport::add_module_opens(h_module, h_pkg, h_to_module, THREAD);
@@ -299,7 +299,7 @@
 
   // check module
   Handle h_module(THREAD, JNIHandles::resolve(module));
-  if (!java_lang_reflect_Module::is_instance(h_module())) {
+  if (!java_lang_Module::is_instance(h_module())) {
     return JVMTI_ERROR_INVALID_MODULE;
   }
   // check service
@@ -321,7 +321,7 @@
 
   // check module
   Handle h_module(THREAD, JNIHandles::resolve(module));
-  if (!java_lang_reflect_Module::is_instance(h_module())) {
+  if (!java_lang_Module::is_instance(h_module())) {
     return JVMTI_ERROR_INVALID_MODULE;
   }
   // check service
@@ -339,6 +339,22 @@
   return JvmtiExport::add_module_provides(h_module, h_service, h_impl_class, THREAD);
 } /* end AddModuleProvides */
 
+// module - pre-checked for NULL
+// is_modifiable_class_ptr - pre-checked for NULL
+jvmtiError
+JvmtiEnv::IsModifiableModule(jobject module, jboolean* is_modifiable_module_ptr) {
+  JavaThread* THREAD = JavaThread::current();
+
+  // check module
+  Handle h_module(THREAD, JNIHandles::resolve(module));
+  if (!java_lang_Module::is_instance(h_module())) {
+    return JVMTI_ERROR_INVALID_MODULE;
+  }
+
+  *is_modifiable_module_ptr = JNI_TRUE;
+  return JVMTI_ERROR_NONE;
+} /* end IsModifiableModule */
+
 
   //
   // Class functions
--- a/hotspot/src/share/vm/runtime/globals.hpp	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Wed Apr 19 03:21:41 2017 +0000
@@ -1453,9 +1453,9 @@
           "Number of threads concurrent gc will use")                       \
           constraint(ConcGCThreadsConstraintFunc,AfterErgo)                 \
                                                                             \
-  product(uintx, GCTaskTimeStampEntries, 200,                               \
+  product(uint, GCTaskTimeStampEntries, 200,                                \
           "Number of time stamp entries per gc worker thread")              \
-          range(1, max_uintx)                                               \
+          range(1, max_jint)                                                \
                                                                             \
   product(bool, AlwaysTenure, false,                                        \
           "Always tenure objects in eden (ParallelGC only)")                \
--- a/hotspot/src/share/vm/runtime/reflection.cpp	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/share/vm/runtime/reflection.cpp	Wed Apr 19 03:21:41 2017 +0000
@@ -587,9 +587,9 @@
           current_class_name, module_from_name, new_class_name,
           module_to_name, module_from_name, module_to_name);
       } else {
-        jobject jlrm = module_to->module();
-        assert(jlrm != NULL, "Null jlrm in module_to ModuleEntry");
-        intptr_t identity_hash = JNIHandles::resolve(jlrm)->identity_hash();
+        jobject jlm = module_to->module();
+        assert(jlm != NULL, "Null jlm in module_to ModuleEntry");
+        intptr_t identity_hash = JNIHandles::resolve(jlm)->identity_hash();
         size_t len = 160 + strlen(current_class_name) + 2*strlen(module_from_name) +
           strlen(new_class_name) + 2*sizeof(uintx);
         msg = NEW_RESOURCE_ARRAY(char, len);
@@ -614,9 +614,9 @@
           current_class_name, module_from_name, new_class_name,
           module_to_name, module_to_name, package_name, module_from_name);
       } else {
-        jobject jlrm = module_from->module();
-        assert(jlrm != NULL, "Null jlrm in module_from ModuleEntry");
-        intptr_t identity_hash = JNIHandles::resolve(jlrm)->identity_hash();
+        jobject jlm = module_from->module();
+        assert(jlm != NULL, "Null jlm in module_from ModuleEntry");
+        intptr_t identity_hash = JNIHandles::resolve(jlm)->identity_hash();
         size_t len = 170 + strlen(current_class_name) + strlen(new_class_name) +
           2*strlen(module_to_name) + strlen(package_name) + 2*sizeof(uintx);
         msg = NEW_RESOURCE_ARRAY(char, len);
--- a/hotspot/src/share/vm/runtime/thread.cpp	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Wed Apr 19 03:21:41 2017 +0000
@@ -3462,7 +3462,7 @@
                                       java_lang_Thread::RUNNABLE);
 
   // The VM creates objects of this class.
-  initialize_class(vmSymbols::java_lang_reflect_Module(), CHECK);
+  initialize_class(vmSymbols::java_lang_Module(), CHECK);
 
   // The VM preresolves methods to these classes. Make sure that they get initialized
   initialize_class(vmSymbols::java_lang_reflect_Method(), CHECK);
--- a/hotspot/test/TEST.ROOT	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/TEST.ROOT	Wed Apr 19 03:21:41 2017 +0000
@@ -50,8 +50,8 @@
     vm.cpu.features \
     vm.debug
 
-# Tests using jtreg 4.2 b04 features
-requiredVersion=4.2 b04
+# Tests using jtreg 4.2 b07 features
+requiredVersion=4.2 b07
 
 # Path to libraries in the topmost test directory. This is needed so @library
 # does not need ../../ notation to reach them
--- a/hotspot/test/compiler/c2/cr7200264/TestDriver.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/compiler/c2/cr7200264/TestDriver.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.regex.Pattern;
 
 import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
@@ -45,7 +44,7 @@
     }
 
     private List<String> executeApplication() throws Throwable {
-        OutputAnalyzer outputAnalyzer = ProcessTools.executeTestJvmAllArgs(
+        OutputAnalyzer outputAnalyzer = ProcessTools.executeTestJvm(
             "-Xbatch",
             "-XX:-TieredCompilation",
             "-XX:+PrintCompilation",
--- a/hotspot/test/compiler/compilercontrol/share/scenario/Executor.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/compiler/compilercontrol/share/scenario/Executor.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -25,6 +25,7 @@
 
 import compiler.compilercontrol.share.actions.BaseAction;
 import jdk.test.lib.Asserts;
+import jdk.test.lib.management.InputArguments;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.dcmd.CommandExecutor;
@@ -38,6 +39,7 @@
 import java.net.ServerSocket;
 import java.net.Socket;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
@@ -97,9 +99,13 @@
                 // Start separate thread to connect with test VM
                 new Thread(() -> connectTestVM(serverSocket)).start();
             }
-            // Start test VM
-            output = ProcessTools.executeTestJvmAllArgs(
-                    vmOptions.toArray(new String[vmOptions.size()]));
+            // Start a test VM using vm flags from @run and from vm options
+            String[] vmInputArgs = InputArguments.getVmInputArgs();
+            String[] cmds = Arrays.copyOf(vmInputArgs,
+                    vmInputArgs.length + vmOptions.size());
+            System.arraycopy(vmOptions.toArray(), 0, cmds, vmInputArgs.length,
+                    vmOptions.size());
+            output = ProcessTools.executeTestJvm(cmds);
         } catch (Throwable thr) {
             throw new Error("Execution failed: " + thr.getMessage(), thr);
         }
--- a/hotspot/test/compiler/jvmci/common/CTVMUtilities.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/compiler/jvmci/common/CTVMUtilities.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -41,7 +41,6 @@
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
-import java.lang.reflect.Module;
 import java.lang.reflect.Parameter;
 import java.util.HashMap;
 import java.util.Map;
--- a/hotspot/test/compiler/jvmci/compilerToVM/DebugOutputTest.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/compiler/jvmci/compilerToVM/DebugOutputTest.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -30,11 +30,9 @@
  * @modules java.base/jdk.internal.misc
  * @modules jdk.internal.vm.ci/jdk.vm.ci.hotspot
  * @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
- * @run main/othervm compiler.jvmci.compilerToVM.DebugOutputTest
+ * @run driver compiler.jvmci.compilerToVM.DebugOutputTest
  */
 
- // as soon as CODETOOLS-7901589 fixed, '@run main/othervm' should be replaced w/ '@run driver'
-
 package compiler.jvmci.compilerToVM;
 
 import jdk.test.lib.process.OutputAnalyzer;
@@ -42,8 +40,11 @@
 import jdk.vm.ci.hotspot.CompilerToVMHelper;
 
 import java.util.Arrays;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 
 public class DebugOutputTest {
+    private static final String VM_CI_MODULE = "jdk.internal.vm.ci";
     public static void main(String[] args) {
         new DebugOutputTest().test();
     }
@@ -53,10 +54,18 @@
             System.out.println(testCase);
             OutputAnalyzer oa;
             try {
-                oa = ProcessTools.executeTestJvmAllArgs(
+                Path patch = Paths.get(System.getProperty("test.patch.path"));
+                Path jvmciPath = patch.resolve(VM_CI_MODULE).toAbsolutePath();
+                if (!jvmciPath.toFile().exists()) {
+                    throw new Error("TESTBUG: patch for " + VM_CI_MODULE + " : "
+                            + jvmciPath.toString() + " does not exist");
+                }
+                oa = ProcessTools.executeTestJvm(
                         "-XX:+UnlockExperimentalVMOptions",
                         "-XX:+EnableJVMCI",
-                        "-Xbootclasspath/a:.",
+                        "--add-exports", "java.base/jdk.internal.misc=ALL-UNNAMED",
+                        "--add-exports", "jdk.internal.vm.ci/jdk.vm.ci.hotspot=ALL-UNNAMED",
+                        "--patch-module", VM_CI_MODULE + "=" + jvmciPath.toString(),
                         DebugOutputTest.Worker.class.getName(),
                         testCase.name());
                } catch (Throwable e) {
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderData.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderData.java	Wed Apr 19 03:21:41 2017 +0000
@@ -27,6 +27,7 @@
 
 import org.testng.annotations.DataProvider;
 
+import sun.hotspot.WhiteBox;
 import jdk.internal.misc.Unsafe;
 import jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider;
 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider;
@@ -36,6 +37,10 @@
 import jdk.vm.ci.meta.JavaConstant;
 import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.runtime.JVMCI;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
 
 public class MemoryAccessProviderData {
     private static final Unsafe UNSAFE = Unsafe.getUnsafe();
@@ -43,6 +48,18 @@
     private static final TestClass TEST_OBJECT = new TestClass();
     private static final JavaConstant TEST_CONSTANT = CONSTANT_REFLECTION.forObject(TEST_OBJECT);
     private static final JavaConstant TEST_CLASS_CONSTANT = CONSTANT_REFLECTION.forObject(TestClass.class);
+    private static KindData[] PRIMITIVE_KIND_DATA = {
+        new KindData(JavaKind.Boolean, TEST_OBJECT),
+        new KindData(JavaKind.Byte, TEST_OBJECT),
+        new KindData(JavaKind.Char, TEST_OBJECT),
+        new KindData(JavaKind.Short, TEST_OBJECT),
+        new KindData(JavaKind.Int, TEST_OBJECT),
+        new KindData(JavaKind.Float, TEST_OBJECT),
+        new KindData(JavaKind.Long, TEST_OBJECT),
+        new KindData(JavaKind.Double, TEST_OBJECT)
+    };
+    private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
+
 
     @DataProvider(name = "positiveObject")
     public static Object[][] getPositiveObjectJavaKind() {
@@ -54,51 +71,40 @@
 
     @DataProvider(name = "positivePrimitive")
     public static Object[][] getPositivePrimitiveJavaKinds() {
-        Field booleanField;
-        Field byteField;
-        Field shortField;
-        Field intField;
-        Field longField;
-        Field floatField;
-        Field doubleField;
-        Field charField;
-        try {
-            booleanField = MemoryAccessProviderData.TestClass.class.getDeclaredField("booleanField");
-            byteField = MemoryAccessProviderData.TestClass.class.getDeclaredField("byteField");
-            shortField = MemoryAccessProviderData.TestClass.class.getDeclaredField("shortField");
-            intField = MemoryAccessProviderData.TestClass.class.getDeclaredField("intField");
-            longField = MemoryAccessProviderData.TestClass.class.getDeclaredField("longField");
-            floatField = MemoryAccessProviderData.TestClass.class.getDeclaredField("floatField");
-            doubleField = MemoryAccessProviderData.TestClass.class.getDeclaredField("doubleField");
-            charField = MemoryAccessProviderData.TestClass.class.getDeclaredField("charField");
-        } catch (NoSuchFieldException e) {
-            throw new Error("TESTBUG: can't find test field " + e, e);
+        List<Object[]> result = new ArrayList<>();
+        for (KindData k : PRIMITIVE_KIND_DATA) {
+            result.add(new Object[] {k.kind, TEST_CONSTANT, k.instanceFieldOffset, k.instanceFieldValue, Math.max(8, k.kind.getBitCount())});
+            result.add(new Object[] {k.kind, TEST_CLASS_CONSTANT, k.staticFieldOffset, k.staticFieldValue, Math.max(8, k.kind.getBitCount())});
         }
-        long booleanFieldOffset = UNSAFE.objectFieldOffset(booleanField);
-        long byteFieldOffset = UNSAFE.objectFieldOffset(byteField);
-        long shortFieldOffset = UNSAFE.objectFieldOffset(shortField);
-        long intFieldOffset = UNSAFE.objectFieldOffset(intField);
-        long longFieldOffset = UNSAFE.objectFieldOffset(longField);
-        long floatFieldOffset = UNSAFE.objectFieldOffset(floatField);
-        long doubleFieldOffset = UNSAFE.objectFieldOffset(doubleField);
-        long charFieldOffset = UNSAFE.objectFieldOffset(charField);
-        return new Object[][]{
-                        new Object[]{JavaKind.Boolean, TEST_CONSTANT, booleanFieldOffset,
-                                        JavaConstant.forBoolean(TEST_OBJECT.booleanField), 8},
-                        new Object[]{JavaKind.Byte, TEST_CONSTANT, byteFieldOffset,
-                                        JavaConstant.forByte(TEST_OBJECT.byteField), 8},
-                        new Object[]{JavaKind.Short, TEST_CONSTANT, shortFieldOffset,
-                                        JavaConstant.forShort(TEST_OBJECT.shortField), 16},
-                        new Object[]{JavaKind.Int, TEST_CONSTANT, intFieldOffset,
-                                        JavaConstant.forInt(TEST_OBJECT.intField), 32},
-                        new Object[]{JavaKind.Long, TEST_CONSTANT, longFieldOffset,
-                                        JavaConstant.forLong(TEST_OBJECT.longField), 64},
-                        new Object[]{JavaKind.Float, TEST_CONSTANT, floatFieldOffset,
-                                        JavaConstant.forFloat(TEST_OBJECT.floatField), 32},
-                        new Object[]{JavaKind.Double, TEST_CONSTANT, doubleFieldOffset,
-                                        JavaConstant.forDouble(TEST_OBJECT.doubleField), 64},
-                        new Object[]{JavaKind.Char, TEST_CONSTANT, charFieldOffset,
-                                        JavaConstant.forChar(TEST_OBJECT.charField), 16}};
+        return result.toArray(new Object[result.size()][]);
+    }
+
+    @DataProvider(name = "outOfBoundsInstanceFields")
+    public static Object[][] getOutOfBoundsStaticFieldReads() {
+        long instanceSize = WHITE_BOX.getObjectSize(TEST_OBJECT);
+        List<Object[]> result = new ArrayList<>();
+        for (KindData k : PRIMITIVE_KIND_DATA) {
+            long lastValidOffset = instanceSize - (k.kind.getByteCount());
+            result.add(new Object[] {k.kind, TEST_CONSTANT, lastValidOffset, false});
+            result.add(new Object[] {k.kind, TEST_CONSTANT, (long) -1, true});
+            result.add(new Object[] {k.kind, TEST_CONSTANT, lastValidOffset + 1, true});
+            result.add(new Object[] {k.kind, TEST_CONSTANT, lastValidOffset + 100, true});
+        }
+        return result.toArray(new Object[result.size()][]);
+    }
+
+    @DataProvider(name = "outOfBoundsStaticFields")
+    public static Object[][] getOutOfBoundsInstanceFieldReads() {
+        long staticsSize = WHITE_BOX.getObjectSize(TEST_OBJECT.getClass());
+        List<Object[]> result = new ArrayList<>();
+        for (KindData k : PRIMITIVE_KIND_DATA) {
+            long lastValidOffset = staticsSize - (k.kind.getByteCount());
+            result.add(new Object[] {k.kind, TEST_CLASS_CONSTANT, lastValidOffset, false});
+            result.add(new Object[] {k.kind, TEST_CLASS_CONSTANT, (long) -1, true});
+            result.add(new Object[] {k.kind, TEST_CLASS_CONSTANT, lastValidOffset + 1, true});
+            result.add(new Object[] {k.kind, TEST_CLASS_CONSTANT, lastValidOffset + 100, true});
+        }
+        return result.toArray(new Object[result.size()][]);
     }
 
     @DataProvider(name = "negative")
@@ -108,6 +114,7 @@
                         new Object[]{JavaKind.Illegal, JavaConstant.INT_1}};
     }
 
+
     private static class TestClass {
         public final boolean booleanField = true;
         public final byte byteField = 2;
@@ -117,6 +124,43 @@
         public final double doubleField = 6.0d;
         public final float floatField = 7.0f;
         public final char charField = 'a';
-        public final String stringField = "abc";
+        public final String objectField = "abc";
+
+        public static final boolean booleanStaticField = true;
+        public static final byte byteStaticField = 2;
+        public static final short shortStaticField = 3;
+        public static final int intStaticField = 4;
+        public static final long longStaticField = 5L;
+        public static final double doubleStaticField = 6.0d;
+        public static final float floatStaticField = 7.0f;
+        public static final char charStaticField = 'a';
+        public static final String objectStaticField = "abc";
+    }
+
+
+    static class KindData {
+        final JavaKind kind;
+        final Field instanceField;
+        final Field staticField;
+        final long instanceFieldOffset;
+        final long staticFieldOffset;
+        final JavaConstant instanceFieldValue;
+        final JavaConstant staticFieldValue;
+        KindData(JavaKind kind, Object testObject) {
+            this.kind = kind;
+            try {
+                Class<?> c = testObject.getClass();
+                instanceField = c.getDeclaredField(kind.getJavaName() + "Field");
+                staticField = c.getDeclaredField(kind.getJavaName() + "StaticField");
+                instanceField.setAccessible(true);
+                staticField.setAccessible(true);
+                instanceFieldOffset = UNSAFE.objectFieldOffset(instanceField);
+                staticFieldOffset = UNSAFE.staticFieldOffset(staticField);
+                instanceFieldValue = JavaConstant.forBoxedPrimitive(instanceField.get(testObject));
+                staticFieldValue = JavaConstant.forBoxedPrimitive(staticField.get(null));
+            } catch (Exception e) {
+                throw new Error("TESTBUG for kind " + kind, e);
+            }
+        }
     }
 }
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderTest.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderTest.java	Wed Apr 19 03:21:41 2017 +0000
@@ -31,12 +31,19 @@
  *          jdk.internal.vm.ci/jdk.vm.ci.runtime
  *          jdk.internal.vm.ci/jdk.vm.ci.hotspot
  *          java.base/jdk.internal.misc
- * @run testng/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run testng/othervm -Xbootclasspath/a:.
+ *      -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
+ *      -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
  *      jdk.vm.ci.hotspot.test.MemoryAccessProviderTest
  */
 
 package jdk.vm.ci.hotspot.test;
 
+import sun.hotspot.WhiteBox;
+
 import jdk.vm.ci.meta.Constant;
 import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.meta.MemoryAccessProvider;
@@ -59,7 +66,27 @@
 
     @Test(dataProvider = "negative", dataProviderClass = MemoryAccessProviderData.class, expectedExceptions = {IllegalArgumentException.class})
     public void testNegativeReadPrimitiveConstant(JavaKind kind, Constant base) {
-        PROVIDER.readPrimitiveConstant(kind, base, 0L, kind == null ? 0 : kind.getBitCount());
+        PROVIDER.readPrimitiveConstant(kind, base, 0L, kind == null ? 0 : kind.getByteCount() / 8);
+    }
+
+    @Test(dataProvider = "outOfBoundsInstanceFields", dataProviderClass = MemoryAccessProviderData.class)
+    public void testReadPrimitiveInstanceFieldOutOfBounds(JavaKind kind, Constant base, Long offset, boolean isOutOfBounds) {
+        try {
+            PROVIDER.readPrimitiveConstant(kind, base, offset, kind.getByteCount() * 8);
+            Assert.assertFalse(isOutOfBounds);
+        } catch (IllegalArgumentException iae) {
+            Assert.assertTrue(isOutOfBounds);
+        }
+    }
+
+    @Test(dataProvider = "outOfBoundsStaticFields", dataProviderClass = MemoryAccessProviderData.class)
+    public void testReadPrimitiveStaticFieldOutOFBounds(JavaKind kind, Constant base, Long offset, boolean isOutOfBounds) {
+        try {
+            PROVIDER.readPrimitiveConstant(kind, base, offset, kind.getByteCount() * 8);
+            Assert.assertFalse(isOutOfBounds);
+        } catch (IllegalArgumentException iae) {
+            Assert.assertTrue(isOutOfBounds);
+        }
     }
 
     @Test(dataProvider = "positiveObject", dataProviderClass = MemoryAccessProviderData.class, expectedExceptions = {IllegalArgumentException.class})
@@ -87,7 +114,7 @@
         Assert.assertNull(PROVIDER.readObjectConstant(base, offset + 1), "Expected null");
     }
 
-    @Test(dataProvider = "positivePrimitive", dataProviderClass = MemoryAccessProviderData.class)
+    @Test(dataProvider = "positivePrimitive", dataProviderClass = MemoryAccessProviderData.class, expectedExceptions = {IllegalArgumentException.class})
     public void testNegativeReadObjectConstantPrimitiveBase(JavaKind kind, Constant base, Long offset, Object expected, int bitsCount) {
         Assert.assertNull(PROVIDER.readObjectConstant(base, offset), "Expected null");
     }
--- a/hotspot/test/gc/parallel/TestPrintGCDetailsVerbose.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/gc/parallel/TestPrintGCDetailsVerbose.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -23,12 +23,13 @@
 
 /*
  * @test TestPrintGCDetailsVerbose
- * @bug 8016740
+ * @bug 8016740 8177963
  * @summary Tests that jvm with maximally verbose GC logging does not crash when ParOldGC has no memory
  * @key gc
  * @requires vm.gc.Parallel
  * @modules java.base/jdk.internal.misc
  * @run main/othervm -Xmx50m -XX:+UseParallelGC -Xlog:gc*=trace TestPrintGCDetailsVerbose
+ * @run main/othervm -Xmx50m -XX:+UseParallelGC -XX:GCTaskTimeStampEntries=1 -Xlog:gc*=trace TestPrintGCDetailsVerbose
  */
 public class TestPrintGCDetailsVerbose {
 
--- a/hotspot/test/native/runtime/test_globals.cpp	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/native/runtime/test_globals.cpp	Wed Apr 19 03:21:41 2017 +0000
@@ -53,7 +53,7 @@
 }
 
 TEST_VM(FlagGuard, uintx_flag) {
-  TEST_FLAG(GCTaskTimeStampEntries, uintx, 1337);
+  TEST_FLAG(GCTaskTimeStampEntries, uint, 1337);
 }
 
 TEST_VM(FlagGuard, size_t_flag) {
--- a/hotspot/test/runtime/SharedArchiveFile/ArchiveDoesNotExist.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/ArchiveDoesNotExist.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,8 @@
  * @run main ArchiveDoesNotExist
  */
 
-import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.cds.CDSOptions;
+import jdk.test.lib.cds.CDSTestUtils;
 import jdk.test.lib.process.OutputAnalyzer;
 import java.io.File;
 
@@ -45,27 +46,22 @@
         if (cdsFile.exists())
             throw new RuntimeException("Test error: cds file already exists");
 
-        // Sharing: on
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-           "-XX:+UnlockDiagnosticVMOptions",
-           "-XX:SharedArchiveFile=./" + fileName,
-           "-Xshare:on",
-           "-version");
+        CDSOptions opts = (new CDSOptions()).setArchiveName(fileName);
 
-        OutputAnalyzer output = new OutputAnalyzer(pb.start());
-        output.shouldContain("Specified shared archive not found");
-        output.shouldHaveExitValue(1);
+        // -Xshare=on
+        OutputAnalyzer out = CDSTestUtils.runWithArchive(opts);
+        if (!CDSTestUtils.isUnableToMap(out)) {
+            out.shouldContain("Specified shared archive not found")
+               .shouldHaveExitValue(1);
+        }
 
-        // Sharing: auto
-        pb = ProcessTools.createJavaProcessBuilder(
-           "-XX:+UnlockDiagnosticVMOptions",
-           "-XX:SharedArchiveFile=./" + fileName,
-           "-Xshare:auto",
-           "-version");
-
-        output = new OutputAnalyzer(pb.start());
-        output.shouldMatch("(java|openjdk) version");
-        output.shouldNotContain("sharing");
-        output.shouldHaveExitValue(0);
+        // -Xshare=auto
+        opts.setXShareMode("auto");
+        out = CDSTestUtils.runWithArchive(opts);
+        if (!CDSTestUtils.isUnableToMap(out)) {
+            out.shouldMatch("(java|openjdk) version")
+               .shouldNotContain("sharing")
+               .shouldHaveExitValue(0);
+        }
     }
 }
--- a/hotspot/test/runtime/SharedArchiveFile/BootAppendTests.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/BootAppendTests.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,6 +43,8 @@
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
+import jdk.test.lib.cds.CDSOptions;
+import jdk.test.lib.cds.CDSTestUtils;
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
 
@@ -67,45 +69,45 @@
 
     public static void main(String... args) throws Exception {
         dumpArchive();
+
+        logTestCase("1");
         testBootAppendModuleClass();
+
+        log("TESTCASE: 2");
         testBootAppendDuplicateModuleClass();
+
+        logTestCase("3");
         testBootAppendExcludedModuleClass();
+
+        logTestCase("4");
         testBootAppendDuplicateExcludedModuleClass();
+
+        logTestCase("5");
         testBootAppendClass();
     }
 
+    private static void logTestCase(String msg) {
+        System.out.println();
+        System.out.printf("TESTCASE: %s", msg);
+        System.out.println();
+    }
+
     static void dumpArchive() throws Exception {
         // create the classlist
-        File classlist = new File(new File(System.getProperty("test.classes", ".")),
-                                  "BootAppendTest.classlist");
-        FileOutputStream fos = new FileOutputStream(classlist);
-        PrintStream ps = new PrintStream(fos);
-        for (String s : ARCHIVE_CLASSES) {
-            ps.println(s);
-        }
-        ps.close();
-        fos.close();
+        File classlist = CDSTestUtils.makeClassList(ARCHIVE_CLASSES);
 
         // build jar files
         appJar = ClassFileInstaller.writeJar("app.jar", APP_CLASS);
         bootAppendJar = ClassFileInstaller.writeJar("bootAppend.jar",
             BOOT_APPEND_MODULE_CLASS, BOOT_APPEND_DUPLICATE_MODULE_CLASS, BOOT_APPEND_CLASS);
 
-        // dump
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-            "-XX:+UnlockDiagnosticVMOptions",
-            "-XX:SharedArchiveFile=./BootAppendTests.jsa",
-            "-XX:SharedClassListFile=" + classlist.getPath(),
-            "-XX:+PrintSharedSpaces",
-            "-Xbootclasspath/a:" + bootAppendJar,
-            "-Xshare:dump");
-        OutputAnalyzer output = new OutputAnalyzer(pb.start());
-        output.shouldContain("Loading classes to share")
-              .shouldHaveExitValue(0);
 
+        OutputAnalyzer out = CDSTestUtils.createArchiveAndCheck(
+                                 "-Xbootclasspath/a:" + bootAppendJar,
+                                 "-XX:SharedClassListFile=" + classlist.getPath());
         // Make sure all the classes were successfully archived.
         for (String archiveClass : ARCHIVE_CLASSES) {
-            output.shouldNotContain("Preload Warning: Cannot find " + archiveClass);
+            out.shouldNotContain("Preload Warning: Cannot find " + archiveClass);
         }
     }
 
@@ -119,16 +121,13 @@
     //          should not be loaded at runtime.
     public static void testBootAppendModuleClass() throws Exception {
         for (String mode : modes) {
-            ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-                "-XX:+UnlockDiagnosticVMOptions",
-                "-XX:SharedArchiveFile=./BootAppendTests.jsa",
-                "-cp", appJar,
-                "-Xbootclasspath/a:" + bootAppendJar,
-                "-Xshare:" + mode,
-                APP_CLASS,
-                BOOT_APPEND_MODULE_CLASS_NAME);
-            OutputAnalyzer output = new OutputAnalyzer(pb.start());
-            output.shouldContain("java.lang.ClassNotFoundException: javax.sound.sampled.MyClass");
+            CDSOptions opts = (new CDSOptions())
+                .setXShareMode(mode).setUseVersion(false)
+                .addPrefix("-Xbootclasspath/a:" + bootAppendJar, "-cp", appJar)
+                .addSuffix(APP_CLASS, BOOT_APPEND_MODULE_CLASS_NAME);
+
+            CDSTestUtils.runWithArchive(opts)
+                .shouldContain("java.lang.ClassNotFoundException: javax.sound.sampled.MyClass");
         }
     }
 
@@ -143,17 +142,13 @@
     //          The one from the boot modules should be loaded instead.
     public static void testBootAppendDuplicateModuleClass() throws Exception {
         for (String mode : modes) {
-            ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-                "-XX:+UnlockDiagnosticVMOptions",
-                "-XX:SharedArchiveFile=./BootAppendTests.jsa",
-                "-XX:+TraceClassLoading",
-                "-cp", appJar,
-                "-Xbootclasspath/a:" + bootAppendJar,
-                "-Xshare:" + mode,
-                APP_CLASS,
-                BOOT_APPEND_DUPLICATE_MODULE_CLASS_NAME);
-            OutputAnalyzer output = new OutputAnalyzer(pb.start());
-            output.shouldContain("[class,load] org.omg.CORBA.Context source: jrt:/java.corba");
+            CDSOptions opts = (new CDSOptions())
+                .setXShareMode(mode).setUseVersion(false)
+                .addPrefix("-Xbootclasspath/a:" + bootAppendJar, "-cp", appJar)
+                .addSuffix(APP_CLASS, BOOT_APPEND_DUPLICATE_MODULE_CLASS_NAME);
+
+            CDSTestUtils.runWithArchive(opts)
+                .shouldContain("[class,load] org.omg.CORBA.Context source: jrt:/java.corba");
         }
     }
 
@@ -167,22 +162,19 @@
     //          loaded from the archive at runtime.
     public static void testBootAppendExcludedModuleClass() throws Exception {
         for (String mode : modes) {
-            ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-                "-XX:+UnlockDiagnosticVMOptions",
-                "-XX:SharedArchiveFile=./BootAppendTests.jsa",
-                "-XX:+TraceClassLoading",
-                "-cp", appJar,
-                "-Xbootclasspath/a:" + bootAppendJar,
-                "--limit-modules=java.base",
-                "-Xshare:" + mode,
-                APP_CLASS,
-                BOOT_APPEND_MODULE_CLASS_NAME);
-            OutputAnalyzer output = new OutputAnalyzer(pb.start());
-            output.shouldContain("[class,load] javax.sound.sampled.MyClass");
+            CDSOptions opts = (new CDSOptions())
+                .setXShareMode(mode).setUseVersion(false)
+                .addPrefix("-Xbootclasspath/a:" + bootAppendJar,
+                           "--limit-modules=java.base", "-cp", appJar)
+                .addSuffix("-Xlog:class+load=info",
+                           APP_CLASS, BOOT_APPEND_MODULE_CLASS_NAME);
+
+            OutputAnalyzer out = CDSTestUtils.runWithArchive(opts)
+                .shouldContain("[class,load] javax.sound.sampled.MyClass");
 
             // When CDS is enabled, the shared class should be loaded from the archive.
             if (mode.equals("on")) {
-                output.shouldContain("[class,load] javax.sound.sampled.MyClass source: shared objects file");
+                out.shouldContain("[class,load] javax.sound.sampled.MyClass source: shared objects file");
             }
         }
     }
@@ -199,19 +191,16 @@
     //          java.corba is excluded.
     public static void testBootAppendDuplicateExcludedModuleClass() throws Exception {
         for (String mode : modes) {
-            ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-                "-XX:+UnlockDiagnosticVMOptions",
-                "-XX:SharedArchiveFile=./BootAppendTests.jsa",
-                "-XX:+TraceClassLoading",
-                "-cp", appJar,
-                "-Xbootclasspath/a:" + bootAppendJar,
-                "--limit-modules=java.base",
-                "-Xshare:" + mode,
-                APP_CLASS,
-                BOOT_APPEND_DUPLICATE_MODULE_CLASS_NAME);
-            OutputAnalyzer output = new OutputAnalyzer(pb.start());
-            output.shouldContain("[class,load] org.omg.CORBA.Context");
-            output.shouldMatch(".*\\[class,load\\] org.omg.CORBA.Context source:.*bootAppend.jar");
+            CDSOptions opts = (new CDSOptions())
+                .setXShareMode(mode).setUseVersion(false)
+                .addPrefix("-Xbootclasspath/a:" + bootAppendJar,
+                           "--limit-modules=java.base", "-cp", appJar)
+                .addSuffix("-Xlog:class+load=info",
+                           APP_CLASS, BOOT_APPEND_DUPLICATE_MODULE_CLASS_NAME);
+
+            CDSTestUtils.runWithArchive(opts)
+                .shouldContain("[class,load] org.omg.CORBA.Context")
+                .shouldMatch(".*\\[class,load\\] org.omg.CORBA.Context source:.*bootAppend.jar");
         }
     }
 
@@ -224,22 +213,20 @@
     //          can be loaded at runtime when CDS is enabled.
     public static void testBootAppendClass() throws Exception {
         for (String mode : modes) {
-            ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-                "-XX:+UnlockDiagnosticVMOptions",
-                "-XX:SharedArchiveFile=./BootAppendTests.jsa",
-                "-XX:+TraceClassLoading",
-                "-cp", appJar,
-                "-Xbootclasspath/a:" + bootAppendJar,
-                "-Xshare:" + mode,
-                APP_CLASS,
-                BOOT_APPEND_CLASS_NAME);
-            OutputAnalyzer output = new OutputAnalyzer(pb.start());
-            output.shouldContain("[class,load] nonjdk.myPackage.MyClass");
+            CDSOptions opts = (new CDSOptions())
+                .setXShareMode(mode).setUseVersion(false)
+                .addPrefix("-Xbootclasspath/a:" + bootAppendJar,
+                           "--limit-modules=java.base", "-cp", appJar)
+                .addSuffix("-Xlog:class+load=info",
+                           APP_CLASS, BOOT_APPEND_CLASS_NAME);
+
+            OutputAnalyzer out = CDSTestUtils.runWithArchive(opts)
+                .shouldContain("[class,load] nonjdk.myPackage.MyClass");
 
             // If CDS is enabled, the nonjdk.myPackage.MyClass should be loaded
             // from the shared archive.
             if (mode.equals("on")) {
-                output.shouldContain(
+                out.shouldContain(
                     "[class,load] nonjdk.myPackage.MyClass source: shared objects file");
             }
         }
--- a/hotspot/test/runtime/SharedArchiveFile/CDSTestUtils.java	Tue Apr 18 20:17:22 2017 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.IOException;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.PrintStream;
-import jdk.test.lib.process.OutputAnalyzer;
-
-
-// This class contains common test utilities for CDS testing
-public class CDSTestUtils {
-
-    // check result of 'dump' operation
-    public static void checkDump(OutputAnalyzer output, String... extraMatches)
-        throws Exception {
-
-        output.shouldContain("Loading classes to share");
-        output.shouldHaveExitValue(0);
-
-        for (String match : extraMatches) {
-            output.shouldContain(match);
-        }
-    }
-
-
-    // check the output for indication that mapping of the archive failed
-    public static boolean isUnableToMap(OutputAnalyzer output) {
-        String outStr = output.getOutput();
-        if ((output.getExitValue() == 1) && (
-            outStr.contains("Unable to reserve shared space at required address") ||
-            outStr.contains("Unable to map ReadOnly shared space at required address") ||
-            outStr.contains("Unable to map ReadWrite shared space at required address") ||
-            outStr.contains("Unable to map MiscData shared space at required address") ||
-            outStr.contains("Unable to map MiscCode shared space at required address") ||
-            outStr.contains("Unable to map shared string space at required address") ||
-            outStr.contains("Could not allocate metaspace at a compatible address") ||
-            outStr.contains("Unable to allocate shared string space: range is not within java heap") ))
-        {
-            return true;
-        }
-
-        return false;
-    }
-
-    // check result of 'exec' operation, that is when JVM is run using the archive
-    public static void checkExec(OutputAnalyzer output, String... extraMatches) throws Exception {
-        if (isUnableToMap(output)) {
-            System.out.println("Unable to map shared archive: test did not complete; assumed PASS");
-            return;
-        }
-        output.shouldContain("sharing");
-        output.shouldHaveExitValue(0);
-
-        for (String match : extraMatches) {
-            output.shouldContain(match);
-        }
-    }
-
-
-    // get the file object for the test artifact
-    private static File getTestArtifactFile(String prefix, String name) {
-        File dir = new File(System.getProperty("test.classes", "."));
-        return new File(dir, prefix + name);
-    }
-
-
-    // create file containing the specified class list
-    public static File makeClassList(String testCaseName, String classes[])
-        throws Exception {
-
-        File classList = getTestArtifactFile(testCaseName, "test.classlist");
-        FileOutputStream fos = new FileOutputStream(classList);
-        PrintStream ps = new PrintStream(fos);
-
-        addToClassList(ps, classes);
-
-        ps.close();
-        fos.close();
-
-        return classList;
-    }
-
-
-    private static void addToClassList(PrintStream ps, String classes[])
-        throws IOException
-    {
-        if (classes != null) {
-            for (String s : classes) {
-                ps.println(s);
-            }
-        }
-    }
-
-}
--- a/hotspot/test/runtime/SharedArchiveFile/CdsDifferentCompactStrings.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/CdsDifferentCompactStrings.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -30,7 +30,7 @@
  *          java.management
  */
 
-import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.cds.CDSTestUtils;
 import jdk.test.lib.process.OutputAnalyzer;
 
 public class CdsDifferentCompactStrings {
@@ -45,32 +45,14 @@
         String createCompactStringsArgument = "-XX:" + create + "CompactStrings";
         String loadCompactStringsArgument   = "-XX:" + load   + "CompactStrings";
 
-        String filename = "./CdsDifferentCompactStrings" + create + ".jsa";
+        OutputAnalyzer out = CDSTestUtils.createArchive(createCompactStringsArgument);
+        CDSTestUtils.checkDump(out);
 
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-            "-XX:+UnlockDiagnosticVMOptions",
-            "-XX:SharedArchiveFile=" + filename,
-            "-Xshare:dump",
-            createCompactStringsArgument);
-
-        OutputAnalyzer output = new OutputAnalyzer(pb.start());
-        output.shouldContain("Loading classes to share");
-        output.shouldHaveExitValue(0);
-
-        pb = ProcessTools.createJavaProcessBuilder(
-            "-XX:+UnlockDiagnosticVMOptions",
-            "-XX:SharedArchiveFile=" + filename,
-            "-Xshare:on",
-            loadCompactStringsArgument,
-            "-version");
-
-        output = new OutputAnalyzer(pb.start());
-        try {
-            output.shouldContain("The shared archive file's CompactStrings " +
-                "setting .* does not equal the current CompactStrings setting");
-        } catch (RuntimeException e) {
-            output.shouldContain("Unable to use shared archive");
+        out = CDSTestUtils.runWithArchive(loadCompactStringsArgument);
+        if (!CDSTestUtils.isUnableToMap(out)) {
+            out.shouldMatch("The shared archive file's CompactStrings " +
+                "setting .* does not equal the current CompactStrings setting")
+                .shouldHaveExitValue(1);
         }
-        output.shouldHaveExitValue(1);
     }
 }
--- a/hotspot/test/runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -34,7 +34,7 @@
  *          java.management
  */
 
-import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.cds.CDSTestUtils;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.Platform;
 
@@ -61,26 +61,6 @@
             createAlignment;
         String loadAlignmentArgument = "-XX:ObjectAlignmentInBytes=" +
             loadAlignment;
-        String filename = "./CdsDifferentObjectAlignment" + createAlignment + ".jsa";
-
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-            "-XX:+UnlockDiagnosticVMOptions",
-            "-XX:SharedArchiveFile=" + filename,
-            "-Xshare:dump",
-            createAlignmentArgument);
-
-        OutputAnalyzer output = new OutputAnalyzer(pb.start());
-        output.shouldContain("Loading classes to share");
-        output.shouldHaveExitValue(0);
-
-        pb = ProcessTools.createJavaProcessBuilder(
-            "-XX:+UnlockDiagnosticVMOptions",
-            "-XX:SharedArchiveFile=" + filename,
-            "-Xshare:on",
-            loadAlignmentArgument,
-            "-version");
-
-        output = new OutputAnalyzer(pb.start());
         String expectedErrorMsg =
             String.format(
             "The shared archive file's ObjectAlignmentInBytes of %d " +
@@ -88,11 +68,9 @@
             createAlignment,
             loadAlignment);
 
-        try {
-            output.shouldContain(expectedErrorMsg);
-        } catch (RuntimeException e) {
-            output.shouldContain("Unable to use shared archive");
-        }
-        output.shouldHaveExitValue(1);
+        CDSTestUtils.createArchiveAndCheck(createAlignmentArgument);
+
+        OutputAnalyzer out = CDSTestUtils.runWithArchive(loadAlignmentArgument);
+        CDSTestUtils.checkExecExpectError(out, 1, expectedErrorMsg);
     }
 }
--- a/hotspot/test/runtime/SharedArchiveFile/CdsSameObjectAlignment.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/CdsSameObjectAlignment.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -30,9 +30,9 @@
  *          java.management
  */
 
-import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.Platform;
+import jdk.test.lib.cds.CDSTestUtils;
 import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.Platform;
 
 public class CdsSameObjectAlignment {
     public static void main(String[] args) throws Exception {
@@ -57,40 +57,7 @@
         System.out.println("dumpAndLoadSharedArchive(): objectAlignmentInBytes = "
             + objectAlignmentInBytes);
 
-        String filename = "./CdsSameObjectAlignment" + objectAlignmentInBytes + ".jsa";
-        // create shared archive
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-            "-XX:+UnlockDiagnosticVMOptions",
-            "-XX:SharedArchiveFile=" + filename,
-            "-Xshare:dump",
-            objectAlignmentArg);
-
-        OutputAnalyzer output = new OutputAnalyzer(pb.start());
-        output.shouldContain("Loading classes to share");
-        output.shouldHaveExitValue(0);
-
-
-        // run using the shared archive
-        pb = ProcessTools.createJavaProcessBuilder(
-            "-XX:+UnlockDiagnosticVMOptions",
-            "-XX:SharedArchiveFile=" + filename,
-            "-Xshare:on",
-            objectAlignmentArg,
-            "-version");
-
-        output = new OutputAnalyzer(pb.start());
-
-        try {
-            output.shouldContain("sharing");
-            output.shouldHaveExitValue(0);
-        } catch (RuntimeException e) {
-            // CDS uses absolute addresses for performance.
-            // It will try to reserve memory at a specific address;
-            // there is a chance such reservation will fail
-            // If it does, it is NOT considered a failure of the feature,
-            // rather a possible expected outcome, though not likely
-            output.shouldContain("Unable to use shared archive");
-            output.shouldHaveExitValue(1);
-        }
+        CDSTestUtils.createArchiveAndCheck(objectAlignmentArg);
+        CDSTestUtils.runWithArchiveAndCheck(objectAlignmentArg);
     }
 }
--- a/hotspot/test/runtime/SharedArchiveFile/DefaultUseWithClient.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/DefaultUseWithClient.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,15 +31,13 @@
  * @bug 8032224
  */
 
-import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.cds.CDSTestUtils;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.Platform;
 import java.io.File;
 
 public class DefaultUseWithClient {
     public static void main(String[] args) throws Exception {
-        String fileName = "DefaultUseWithClient.jsa";
-
         // On 32-bit windows CDS should be on by default in "-client" config
         // Skip this test on any other platform
         boolean is32BitWindows = (Platform.isWindows() && Platform.is32bit());
@@ -48,29 +46,7 @@
             return;
         }
 
-        // create the archive
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-           "-XX:+UnlockDiagnosticVMOptions",
-           "-XX:SharedArchiveFile=./" + fileName,
-           "-Xshare:dump");
-        OutputAnalyzer output = new OutputAnalyzer(pb.start());
-        output.shouldHaveExitValue(0);
-
-        pb = ProcessTools.createJavaProcessBuilder(
-           "-XX:+UnlockDiagnosticVMOptions",
-           "-XX:SharedArchiveFile=./" + fileName,
-           "-client",
-           "-XX:+PrintSharedSpaces",
-           "-version");
-
-        output = new OutputAnalyzer(pb.start());
-        try {
-            output.shouldContain("sharing");
-        } catch (RuntimeException e) {
-            // if sharing failed due to ASLR or similar reasons,
-            // check whether sharing was attempted at all (UseSharedSpaces)
-            output.shouldContain("UseSharedSpaces:");
-        }
-        output.shouldHaveExitValue(0);
+        CDSTestUtils.createArchiveAndCheck();
+        CDSTestUtils.runWithArchiveAndCheck("-client", "-XX:+PrintSharedSpaces");
    }
 }
--- a/hotspot/test/runtime/SharedArchiveFile/LargeSharedSpace.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/LargeSharedSpace.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,7 @@
  * @run main LargeSharedSpace
  */
 
-import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.cds.CDSTestUtils;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.Platform;
 
@@ -46,10 +46,8 @@
        //
        // The archive should be dumped successfully. It might fail to reserve memory
        // for shared space under low memory condition. The dumping process should not crash.
-       pb = ProcessTools.createJavaProcessBuilder(
-                "-XX:SharedMiscCodeSize=1066924031", "-XX:+UnlockDiagnosticVMOptions",
-                "-XX:SharedArchiveFile=./LargeSharedSpace.jsa", "-Xshare:dump");
-       output = new OutputAnalyzer(pb.start());
+       output = CDSTestUtils.createArchive("-XX:SharedMiscCodeSize=1066924031",
+                                           "-XX:+UnlockDiagnosticVMOptions");
        try {
            output.shouldContain("Loading classes to share");
        } catch (RuntimeException e1) {
@@ -64,12 +62,10 @@
        //
        // The dumping process should not crash.
        if (Platform.is64bit()) {
-           pb = ProcessTools.createJavaProcessBuilder(
-                    "-XX:+UseCompressedClassPointers", "-XX:CompressedClassSpaceSize=3G",
-                    "-XX:SharedMiscCodeSize=1600386047", "-XX:+UnlockDiagnosticVMOptions",
-                    "-XX:SharedArchiveFile=./LargeSharedSpace.jsa", "-Xshare:dump");
-           output = new OutputAnalyzer(pb.start());
-           output.shouldContain("larger than compressed klass limit");
+           CDSTestUtils.createArchive(
+               "-XX:+UseCompressedClassPointers", "-XX:CompressedClassSpaceSize=3G",
+               "-XX:SharedMiscCodeSize=1600386047")
+               .shouldContain("larger than compressed klass limit");
         }
 
         // Test case 3: -XX:SharedMiscCodeSize=1600386047
@@ -79,15 +75,12 @@
         //
         // The dumping process should not crash.
         if (Platform.is32bit()) {
-           pb = ProcessTools.createJavaProcessBuilder(
-                    "-XX:SharedMiscCodeSize=1600386047", "-XX:+UnlockDiagnosticVMOptions",
-                    "-XX:SharedArchiveFile=./LargeSharedSpace.jsa", "-Xshare:dump");
-           output = new OutputAnalyzer(pb.start());
-           try {
-               output.shouldContain("Loading classes to share");
-           } catch (RuntimeException e3) {
-               output.shouldContain("Unable to allocate memory for shared space");
-           }
+            output = CDSTestUtils.createArchive("-XX:SharedMiscCodeSize=1600386047");
+            try {
+                output.shouldContain("Loading classes to share");
+            } catch (RuntimeException e3) {
+                output.shouldContain("Unable to allocate memory for shared space");
+            }
         }
     }
 }
--- a/hotspot/test/runtime/SharedArchiveFile/PrintSharedArchiveAndExit.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/PrintSharedArchiveAndExit.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,41 +30,38 @@
  *          java.management
  */
 
+import jdk.test.lib.cds.CDSOptions;
+import jdk.test.lib.cds.CDSTestUtils;
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
 
+
 public class PrintSharedArchiveAndExit {
-  public static void main(String[] args) throws Exception {
-    String filename = "./PrintSharedArchiveAndExit.jsa";
+    public static void main(String[] args) throws Exception {
+        String archiveName = "PrintSharedArchiveAndExit.jsa";
+        CDSOptions opts = (new CDSOptions()).setArchiveName(archiveName);
+        OutputAnalyzer out = CDSTestUtils.createArchive(opts);
+        CDSTestUtils.checkDump(out);
 
-    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-        "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=" + filename, "-Xshare:dump");
-    OutputAnalyzer output = new OutputAnalyzer(pb.start());
-    try {
-      output.shouldContain("Loading classes to share");
-      output.shouldHaveExitValue(0);
+        // (1) With a valid archive
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+                "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./" + archiveName,
+                "-XX:+PrintSharedArchiveAndExit", "-version");
+        out = CDSTestUtils.executeAndLog(pb, "print-shared-archive-and-version");
+        if (!CDSTestUtils.isUnableToMap(out)) {
+            out.shouldContain("archive is valid")
+                .shouldNotContain("java version")     // Should not print JVM version
+                .shouldHaveExitValue(0);              // Should report success in error code.
+        }
 
-      // (1) With a valid archive
-      pb = ProcessTools.createJavaProcessBuilder(
-          "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=" + filename,
-          "-XX:+PrintSharedArchiveAndExit", "-version");
-      output = new OutputAnalyzer(pb.start());
-      output.shouldContain("archive is valid");
-      output.shouldNotContain("java version");     // Should not print JVM version
-      output.shouldHaveExitValue(0);               // Should report success in error code.
-
-      pb = ProcessTools.createJavaProcessBuilder(
-          "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=" + filename,
-          "-XX:+PrintSharedArchiveAndExit");
-      output = new OutputAnalyzer(pb.start());
-      output.shouldContain("archive is valid");
-      output.shouldNotContain("Usage:");           // Should not print JVM help message
-      output.shouldHaveExitValue(0);               // Should report success in error code.
-
-    } catch (RuntimeException e) {
-      e.printStackTrace();
-      output.shouldContain("Unable to use shared archive");
-      output.shouldHaveExitValue(1);
+        pb = ProcessTools.createJavaProcessBuilder(
+                "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./" + archiveName,
+                "-XX:+PrintSharedArchiveAndExit");
+        out = CDSTestUtils.executeAndLog(pb, "print-shared-archive");
+        if (!CDSTestUtils.isUnableToMap(out)) {
+            out.shouldContain("archive is valid")
+                .shouldNotContain("Usage:")           // Should not print JVM help message
+                .shouldHaveExitValue(0);               // Should report success in error code.
+        }
     }
-  }
 }
--- a/hotspot/test/runtime/SharedArchiveFile/SASymbolTableTest.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/SASymbolTableTest.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,6 +37,7 @@
 
 import java.util.Arrays;
 import java.util.List;
+import jdk.test.lib.cds.CDSTestUtils;
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.JDKToolFinder;
@@ -55,26 +56,18 @@
     static String jsaName = "./SASymbolTableTest.jsa";
     private static LingeredApp theApp = null;
 
+
     public static void main(String[] args) throws Exception {
         if (!Platform.shouldSAAttach()) {
             System.out.println("SA attach not expected to work - test skipped.");
             return;
         }
-        createArchive();
+
+        CDSTestUtils.createArchiveAndCheck();
         run(true);
         run(false);
     }
 
-    private static void createArchive()  throws Exception {
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-            "-XX:+UnlockDiagnosticVMOptions",
-            "-XX:SharedArchiveFile=" + jsaName,
-            "-Xshare:dump");
-
-        OutputAnalyzer output = new OutputAnalyzer(pb.start());
-        output.shouldContain("Loading classes to share");
-        output.shouldHaveExitValue(0);
-    }
 
     private static void run(boolean useArchive) throws Exception {
         String flag = useArchive ? "auto" : "off";
--- a/hotspot/test/runtime/SharedArchiveFile/SharedArchiveFile.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/SharedArchiveFile.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -30,27 +30,28 @@
  *          java.management
  */
 
+import jdk.test.lib.cds.CDSTestUtils;
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
 
+
+// NOTE: This test serves as a sanity test and also as an example for simple
+// use of SharedArchiveFile argument. For this reason it DOES NOT use the utility
+// methods to form command line to create/use shared archive.
 public class SharedArchiveFile {
-  public static void main(String[] args) throws Exception {
-    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-        "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./SharedArchiveFile.jsa", "-Xshare:dump");
-    OutputAnalyzer output = new OutputAnalyzer(pb.start());
-    try {
-      output.shouldContain("Loading classes to share");
-      output.shouldHaveExitValue(0);
+    public static void main(String[] args) throws Exception {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+                                "-XX:+UnlockDiagnosticVMOptions",
+                                "-XX:SharedArchiveFile=./SharedArchiveFile.jsa",
+                                "-Xshare:dump");
+        OutputAnalyzer out = CDSTestUtils.executeAndLog(pb, "SharedArchiveFile");
+        CDSTestUtils.checkDump(out);
 
-      pb = ProcessTools.createJavaProcessBuilder(
-        "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./SharedArchiveFile.jsa", "-Xshare:on", "-version");
-      output = new OutputAnalyzer(pb.start());
-      output.shouldContain("sharing");
-      output.shouldHaveExitValue(0);
-
-    } catch (RuntimeException e) {
-      output.shouldContain("Unable to use shared archive");
-      output.shouldHaveExitValue(1);
+        pb = ProcessTools.createJavaProcessBuilder(
+                              "-XX:+UnlockDiagnosticVMOptions",
+                              "-XX:SharedArchiveFile=./SharedArchiveFile.jsa",
+                              "-Xshare:on", "-version");
+        out = CDSTestUtils.executeAndLog(pb, "SharedArchiveFile");
+        CDSTestUtils.checkExec(out);
     }
-  }
 }
--- a/hotspot/test/runtime/SharedArchiveFile/SharedBaseAddress.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/SharedBaseAddress.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,8 @@
  * @run main SharedBaseAddress
  */
 
-import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.cds.CDSTestUtils;
+import jdk.test.lib.cds.CDSOptions;
 import jdk.test.lib.process.OutputAnalyzer;
 
 public class SharedBaseAddress {
@@ -48,30 +49,12 @@
         for (String testEntry : testTable) {
             String filename = "SharedBaseAddress" + testEntry + ".jsa";
             System.out.println("sharedBaseAddress = " + testEntry);
+            CDSOptions opts = (new CDSOptions())
+                .setArchiveName(filename)
+                .addPrefix("-XX:SharedBaseAddress=" + testEntry);
 
-            ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-               "-XX:+UnlockDiagnosticVMOptions",
-               "-XX:SharedArchiveFile=" + filename,
-               "-XX:SharedBaseAddress=" + testEntry,
-               "-Xshare:dump");
-
-            OutputAnalyzer output = new OutputAnalyzer(pb.start());
-
-            output.shouldContain("Loading classes to share");
-
-            try {
-                pb = ProcessTools.createJavaProcessBuilder(
-                    "-XX:+UnlockDiagnosticVMOptions",
-                    "-XX:SharedArchiveFile=" + filename,
-                    "-Xshare:on",
-                    "-version");
-                output = new OutputAnalyzer(pb.start());
-                output.shouldContain("sharing");
-                output.shouldHaveExitValue(0);
-            } catch (RuntimeException e) {
-                output.shouldContain("Unable to use shared archive");
-                output.shouldHaveExitValue(1);
-            }
+            CDSTestUtils.createArchiveAndCheck(opts);
+            CDSTestUtils.runWithArchiveAndCheck(opts);
         }
     }
 }
--- a/hotspot/test/runtime/SharedArchiveFile/SharedStrings.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/SharedStrings.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -36,12 +36,17 @@
  * @run main ClassFileInstaller -jar whitebox.jar sun.hotspot.WhiteBox
  * @run main SharedStrings
  */
+
+import jdk.test.lib.cds.CDSTestUtils;
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
 
 public class SharedStrings {
     public static void main(String[] args) throws Exception {
-        boolean test_runtime = true;
+        // Note: This is a basic sanity test for Shared Strings feature.
+        // This also serves as a reference on how to use this feature,
+        // hence the command lines are spelled out instead of using the
+        // test utils methods.
         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
             "-XX:+UnlockDiagnosticVMOptions",
             "-XX:SharedArchiveFile=./SharedStrings.jsa",
@@ -52,22 +57,11 @@
             "-Xbootclasspath/a:" + ClassFileInstaller.getJarPath("whitebox.jar"),
             "-Xshare:dump");
 
-        OutputAnalyzer dumpOutput = new OutputAnalyzer(pb.start());
-        try {
-            dumpOutput.shouldContain("Loading classes to share");
-            dumpOutput.shouldContain("Shared string table stats");
-            dumpOutput.shouldHaveExitValue(0);
-        } catch (RuntimeException e) {
-            if (dumpOutput.getOutput().indexOf("Shared strings are excluded") != -1 ||
-                dumpOutput.getOutput().indexOf("Cannot dump shared archive") != -1) {
-                test_runtime = false;
-            } else {
-                throw new RuntimeException("Unexpected failure");
-            }
-        }
+        OutputAnalyzer out = CDSTestUtils.executeAndLog(pb, "dump");
+        CDSTestUtils.checkDump(out, "Shared string table stats");
 
-        if (test_runtime) {
-            pb = ProcessTools.createJavaProcessBuilder(
+
+        pb = ProcessTools.createJavaProcessBuilder(
                 "-XX:+UnlockDiagnosticVMOptions",
                 "-XX:SharedArchiveFile=./SharedStrings.jsa",
                 // these are required modes for shared strings
@@ -77,15 +71,7 @@
                 "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI",
                 "-Xshare:on", "-showversion", "SharedStringsWb");
 
-            OutputAnalyzer output = new OutputAnalyzer(pb.start());
-
-            try {
-                output.shouldContain("sharing");
-                output.shouldHaveExitValue(0);
-            } catch (RuntimeException e) {
-                output.shouldContain("Unable to use shared archive");
-                output.shouldHaveExitValue(1);
-            }
-        }
+        out = CDSTestUtils.executeAndLog(pb, "exec");
+        CDSTestUtils.checkExec(out);
     }
 }
--- a/hotspot/test/runtime/SharedArchiveFile/SharedStringsDedup.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/SharedStringsDedup.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,7 @@
  * @run main SharedStringsDedup
  */
 
-import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.cds.CDSTestUtils;
 import jdk.test.lib.process.OutputAnalyzer;
 import java.io.File;
 
@@ -44,30 +44,10 @@
 // doesn't happen often so it won't impact coverage).
 public class SharedStringsDedup {
     public static void main(String[] args) throws Exception {
-        // Dump
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-            "-XX:+UnlockDiagnosticVMOptions",
-            "-XX:SharedArchiveFile=./SharedStringsDedup.jsa",
-            "-XX:+UseCompressedOops", "-XX:+UseG1GC",
-            "-XX:+PrintSharedSpaces",
-            "-Xshare:dump");
-
-        new OutputAnalyzer(pb.start())
-            .shouldContain("Loading classes to share")
-            .shouldContain("Shared string table stats")
-            .shouldHaveExitValue(0);
-
-        // Run with -Xshare:auto
-        pb = ProcessTools.createJavaProcessBuilder(
-           "-XX:+UnlockDiagnosticVMOptions",
-           "-XX:SharedArchiveFile=./SharedStringsDedup.jsa",
-           "-XX:+UseCompressedOops", "-XX:+UseG1GC",
-           "-XX:+UseStringDeduplication",
-           "-Xshare:auto",
-           "-version");
-
-        new OutputAnalyzer(pb.start())
-            .shouldMatch("(java|openjdk) version")
-            .shouldHaveExitValue(0);
+        OutputAnalyzer out =
+            CDSTestUtils.createArchive("-XX:+UseCompressedOops", "-XX:+UseG1GC");
+        CDSTestUtils.checkDump(out, "Shared string table stats");
+        CDSTestUtils.runWithArchiveAndCheck("-XX:+UseCompressedOops", "-XX:+UseG1GC",
+                                            "-XX:+UseStringDeduplication");
     }
 }
--- a/hotspot/test/runtime/SharedArchiveFile/SharedStringsRunAuto.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/SharedStringsRunAuto.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -34,35 +34,15 @@
  * @run main SharedStringsRunAuto
  */
 
-import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.cds.CDSTestUtils;
 import jdk.test.lib.process.OutputAnalyzer;
 import java.io.File;
 
 public class SharedStringsRunAuto {
     public static void main(String[] args) throws Exception {
-        // Dump
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-            "-XX:+UnlockDiagnosticVMOptions",
-            "-XX:SharedArchiveFile=./SharedStringsRunAuto.jsa",
-            "-XX:+UseCompressedOops", "-XX:+UseG1GC",
-            "-XX:+PrintSharedSpaces",
-            "-Xshare:dump");
-
-        new OutputAnalyzer(pb.start())
-            .shouldContain("Loading classes to share")
-            .shouldContain("Shared string table stats")
-            .shouldHaveExitValue(0);
-
-        // Run with -Xshare:auto
-        pb = ProcessTools.createJavaProcessBuilder(
-           "-XX:+UnlockDiagnosticVMOptions",
-           "-XX:SharedArchiveFile=./SharedStringsRunAuto.jsa",
-           "-XX:+UseCompressedOops", "-XX:+UseG1GC",
-           "-Xshare:auto",
-           "-version");
-
-        new OutputAnalyzer(pb.start())
-            .shouldMatch("(java|openjdk) version")
-            .shouldHaveExitValue(0);
+        OutputAnalyzer out =
+            CDSTestUtils.createArchive("-XX:+UseCompressedOops", "-XX:+UseG1GC");
+        CDSTestUtils.checkDump(out, "Shared string table stats");
+        CDSTestUtils.runWithArchiveAndCheck("-XX:+UseCompressedOops", "-XX:+UseG1GC");
     }
 }
--- a/hotspot/test/runtime/SharedArchiveFile/SharedSymbolTableBucketSize.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/SharedSymbolTableBucketSize.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,41 +30,35 @@
  *          java.management
  */
 
-import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.cds.CDSTestUtils;
 import jdk.test.lib.process.OutputAnalyzer;
 
 public class SharedSymbolTableBucketSize {
     public static void main(String[] args) throws Exception {
         int bucket_size = 8;
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-            "-Xshare:dump", "-XX:+PrintSharedSpaces",
-            "-XX:+UnlockDiagnosticVMOptions",
-            "-XX:SharedArchiveFile=./SharedSymbolTableBucketSize.jsa",
-            "-XX:SharedSymbolTableBucketSize=" + Integer.valueOf(bucket_size));
-        OutputAnalyzer output = new OutputAnalyzer(pb.start());
-        output.shouldContain("Loading classes to share");
-        output.shouldHaveExitValue(0);
 
-        String s = output.firstMatch("Average bucket size     : .*");
-        Float f = Float.parseFloat(s.substring(25));
-        int size = Math.round(f);
-        if (size != bucket_size) {
-          throw new Exception("FAILED: incorrect bucket size " + size +
-                              ", expect " + bucket_size);
+        OutputAnalyzer output =
+            CDSTestUtils.createArchive("-XX:SharedSymbolTableBucketSize="
+                                       + Integer.valueOf(bucket_size));
+        CDSTestUtils.checkDump(output);
+
+        if (!CDSTestUtils.isUnableToMap(output)) {
+            String s = output.firstMatch("Average bucket size     : .*");
+            Float f = Float.parseFloat(s.substring(25));
+            int size = Math.round(f);
+            if (size != bucket_size) {
+                throw new Exception("FAILED: incorrect bucket size " + size +
+                                    ", expect " + bucket_size);
+            }
         }
 
-
         // Invalid SharedSymbolTableBucketSize input
         String input[] = {"-XX:SharedSymbolTableBucketSize=-1",
                           "-XX:SharedSymbolTableBucketSize=2.5"};
         for (int i = 0; i < input.length; i++) {
-          pb = ProcessTools.createJavaProcessBuilder(
-               "-Xshare:dump", "-XX:+PrintSharedSpaces",
-               "-XX:+UnlockDiagnosticVMOptions",
-               "-XX:SharedArchiveFile=./SharedSymbolTableBucketSize.jsa",
-               input[i]);
-          output = new OutputAnalyzer(pb.start());
-          output.shouldContain("Improperly specified VM option");
-      }
-  }
+            CDSTestUtils.createArchive(input[i])
+                .shouldContain("Improperly specified VM option")
+                .shouldHaveExitValue(1);
+        }
+    }
 }
--- a/hotspot/test/runtime/SharedArchiveFile/SpaceUtilizationCheck.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/SpaceUtilizationCheck.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,7 @@
  * @run main SpaceUtilizationCheck
  */
 
-import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.cds.CDSTestUtils;
 import jdk.test.lib.process.OutputAnalyzer;
 
 import java.util.regex.Pattern;
@@ -49,12 +49,9 @@
     private static final int NUMBER_OF_CHECKED_SHARED_REGIONS = 2;
 
     public static void main(String[] args) throws Exception {
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-           "-XX:+UnlockDiagnosticVMOptions",
-           "-XX:SharedArchiveFile=./SpaceUtilizationCheck.jsa",
-           "-Xshare:dump");
+        OutputAnalyzer output = CDSTestUtils.createArchive();
+        CDSTestUtils.checkDump(output);
 
-        OutputAnalyzer output = new OutputAnalyzer(pb.start());
         String stdout = output.getStdout();
         ArrayList<String> utilization = findUtilization(stdout);
 
--- a/hotspot/test/runtime/SharedArchiveFile/TestInterpreterMethodEntries.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/TestInterpreterMethodEntries.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,7 +35,8 @@
 import java.lang.Math;
 import java.util.zip.CRC32;
 import java.util.zip.CRC32C;
-import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.cds.CDSOptions;
+import jdk.test.lib.cds.CDSTestUtils;
 import jdk.test.lib.process.OutputAnalyzer;
 
 public class TestInterpreterMethodEntries {
@@ -68,29 +69,13 @@
         String useCRC32   = "-XX:" + use  + "UseCRC32Intrinsics";
         String useCRC32C  = "-XX:" + use  + "UseCRC32CIntrinsics";
 
-        // Dump shared archive
-        String filename = "./TestInterpreterMethodEntries" + dump + ".jsa";
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-            "-XX:+UnlockDiagnosticVMOptions",
-            "-XX:SharedArchiveFile=" + filename,
-            "-Xshare:dump",
-            dumpFMA, dumpCRC32, dumpCRC32C);
-        OutputAnalyzer output = new OutputAnalyzer(pb.start());
-        CDSTestUtils.checkDump(output);
+        CDSTestUtils.createArchiveAndCheck(dumpFMA, dumpCRC32, dumpCRC32C);
 
-        // Use shared archive
-        pb = ProcessTools.createJavaProcessBuilder(
-            "-XX:+UnlockDiagnosticVMOptions",
-            "-XX:SharedArchiveFile=" + filename,
-            "-Xshare:on",
-            useFMA, useCRC32, useCRC32C,
-            "TestInterpreterMethodEntries", "run");
-        output = new OutputAnalyzer(pb.start());
-        if (CDSTestUtils.isUnableToMap(output)) {
-          System.out.println("Unable to map shared archive: test did not complete; assumed PASS");
-          return;
-        }
-        output.shouldHaveExitValue(0);
+        CDSOptions opts = (new CDSOptions())
+            .addPrefix(useFMA, useCRC32, useCRC32C, "-showversion")
+            .addSuffix("TestInterpreterMethodEntries", "run")
+            .setUseVersion(false);
+        CDSTestUtils.runWithArchiveAndCheck(opts);
     }
 }
 
--- a/hotspot/test/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformRelatedClasses.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformRelatedClasses.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -56,10 +56,11 @@
 //     TransformerAgent - an agent that is used when JVM-under-test is executed
 //         to transform specific strings inside specified classes
 //     TransformerAgent.mf - accompanies transformer agent
-//     CDSTestUtils - Test Utilities common to all CDS tests
 
 import java.io.File;
 import java.util.ArrayList;
+import jdk.test.lib.cds.CDSOptions;
+import jdk.test.lib.cds.CDSTestUtils;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
 
@@ -143,18 +144,11 @@
                                            testClasses);
 
         // create an archive
-        File classList = CDSTestUtils.makeClassList("transform-" + parent,
-                                                    testNames);
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true,
-                                        "-Xbootclasspath/a:" + testJar,
-                                        "-XX:+UnlockDiagnosticVMOptions",
-                                        "-XX:ExtraSharedClassListFile=" +
-                                        classList.getPath(),
-                                        "-XX:SharedArchiveFile=" + archiveName,
-                                        "-XX:+PrintSharedSpaces",
-                                        "-Xshare:dump");
-        OutputAnalyzer out = new OutputAnalyzer(pb.start());
-        CDSTestUtils.checkDump(out);
+        String classList =
+            CDSTestUtils.makeClassList("transform-" + parent, testNames).getPath();
+
+        CDSTestUtils.createArchiveAndCheck("-Xbootclasspath/a:" + testJar,
+            "-XX:ExtraSharedClassListFile=" + classList);
     }
 
 
@@ -165,15 +159,12 @@
         String agentParam = "-javaagent:" + agentJar + "=" +
             TransformTestCommon.getAgentParams(entry, parent, child);
 
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true,
-                                        "-Xbootclasspath/a:" + testJar,
-                                        "-XX:+UnlockDiagnosticVMOptions",
-                                        "-XX:SharedArchiveFile=" + archiveName,
-                                        "-Xlog:class+load=info",
-                                        "-Xshare:on", "-showversion",
-                                        agentParam, child);
-        OutputAnalyzer out = new OutputAnalyzer(pb.start());
+        CDSOptions opts = new CDSOptions()
+            .addPrefix("-Xbootclasspath/a:" + testJar, "-Xlog:class+load=info")
+            .setUseVersion(false)
+            .addSuffix( "-showversion",agentParam, child);
 
+        OutputAnalyzer out = CDSTestUtils.runWithArchive(opts);
         TransformTestCommon.checkResults(entry, out, parent, child);
     }
 }
--- a/hotspot/test/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformTestCommon.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformTestCommon.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,6 +21,7 @@
  * questions.
  */
 
+import jdk.test.lib.cds.CDSTestUtils;
 import jdk.test.lib.process.OutputAnalyzer;
 
 
--- a/hotspot/test/runtime/classFileParserBug/fakeMethodAccessor.jasm	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/classFileParserBug/fakeMethodAccessor.jasm	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
  // to create a sub-type of jdk.internal.reflect.MethodAccessorImpl in order
  // to bypass Reflection.getCallerClass.  That should fail with an IAE.
  //
- import java.lang.reflect.Module;
  class fakeMethodAccessor extends jdk.internal.reflect.MethodAccessorImpl {
      public static void main(String[] a) throws Exception {
         fakeMethodAccessor f = new fakeMethodAccessor();
@@ -60,11 +59,11 @@
         astore_1;
         getstatic    Field java/lang/System.out:"Ljava/io/PrintStream;";
         ldc    class java/lang/String;
-        invokevirtual    Method java/lang/Class.getModule:"()Ljava/lang/reflect/Module;";
+        invokevirtual    Method java/lang/Class.getModule:"()Ljava/lang/Module;";
         ldc    String "jdk.internal.misc";
         ldc    class FakeMethodAccessor;
-        invokevirtual    Method java/lang/Class.getModule:"()Ljava/lang/reflect/Module;";
-        invokevirtual    Method java/lang/reflect/Module.isExported:"(Ljava/lang/String;Ljava/lang/reflect/Module;)Z";
+        invokevirtual    Method java/lang/Class.getModule:"()Ljava/lang/Module;";
+        invokevirtual    Method java/lang/Module.isExported:"(Ljava/lang/String;Ljava/lang/Module;)Z";
         invokevirtual    Method java/io/PrintStream.println:"(Z)V";
         return;
 }
--- a/hotspot/test/runtime/getSysPackage/GetSysPkgTest.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/getSysPackage/GetSysPkgTest.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -55,7 +55,7 @@
                 return m;
             }
         }
-        throw new RuntimeException("Failed to find method " + name + " in java.lang.reflect.Module");
+        throw new RuntimeException("Failed to find method " + name + " in java.lang.Module");
     }
 
     // Throw RuntimeException if getSystemPackageLocation() does not return
--- a/hotspot/test/runtime/modules/AccModuleTest.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccModuleTest.java	Wed Apr 19 03:21:41 2017 +0000
@@ -28,8 +28,6 @@
  * @run main AccModuleTest
  */
 
-import java.io.File;
-
 public class AccModuleTest {
 
     public static void main(String args[]) throws Throwable {
--- a/hotspot/test/runtime/modules/AccessCheck/AccessExportTwice.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/AccessExportTwice.java	Wed Apr 19 03:21:41 2017 +0000
@@ -39,8 +39,6 @@
 import java.lang.module.Configuration;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
@@ -58,7 +56,7 @@
 
 public class AccessExportTwice {
 
-    // Create a Layer over the boot layer.
+    // Create a layer over the boot layer.
     // Define modules within this layer to test access between
     // publicly defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
@@ -87,7 +85,7 @@
         ModuleFinder finder = ModuleLibrary.of(descriptor_first_mod, descriptor_second_mod);
 
         // Resolves "first_mod"
-        Configuration cf = Layer.boot()
+        Configuration cf = ModuleLayer.boot()
                 .configuration()
                 .resolve(finder, ModuleFinder.of(), Set.of("first_mod"));
 
@@ -96,8 +94,8 @@
         map.put("first_mod", MySameClassLoader.loader1);
         map.put("second_mod", MySameClassLoader.loader1);
 
-        // Create Layer that contains first_mod & second_mod
-        Layer layer = Layer.boot().defineModules(cf, map::get);
+        // Create layer that contains first_mod & second_mod
+        ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
         assertTrue(layer.findLoader("first_mod") == MySameClassLoader.loader1);
         assertTrue(layer.findLoader("second_mod") == MySameClassLoader.loader1);
--- a/hotspot/test/runtime/modules/AccessCheck/AccessReadTwice.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/AccessReadTwice.java	Wed Apr 19 03:21:41 2017 +0000
@@ -39,8 +39,6 @@
 import java.lang.module.Configuration;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
@@ -56,7 +54,7 @@
 
 public class AccessReadTwice {
 
-    // Create a Layer over the boot layer.
+    // Create a layer over the boot layer.
     // Define modules within this layer to test access between
     // publicly defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
@@ -85,7 +83,7 @@
         ModuleFinder finder = ModuleLibrary.of(descriptor_first_mod, descriptor_second_mod);
 
         // Resolves "first_mod" and "second_mod"
-        Configuration cf = Layer.boot()
+        Configuration cf = ModuleLayer.boot()
                 .configuration()
                 .resolve(finder, ModuleFinder.of(), Set.of("first_mod", "second_mod"));
 
@@ -95,8 +93,8 @@
         map.put("first_mod", loader);
         map.put("second_mod", loader);
 
-        // Create Layer that contains first_mod & second_mod
-        Layer layer = Layer.boot().defineModules(cf, map::get);
+        // Create layer that contains first_mod & second_mod
+        ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
         assertTrue(layer.findLoader("first_mod") == loader);
         assertTrue(layer.findLoader("second_mod") == loader);
--- a/hotspot/test/runtime/modules/AccessCheck/CheckRead.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/CheckRead.java	Wed Apr 19 03:21:41 2017 +0000
@@ -37,7 +37,6 @@
 
 import static jdk.test.lib.Asserts.*;
 
-import java.lang.reflect.Layer;
 import java.lang.module.Configuration;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
@@ -59,7 +58,7 @@
 //
 public class CheckRead {
 
-    // Create a Layer over the boot layer.
+    // Create a layer over the boot layer.
     // Define modules within this layer to test access between
     // publicly defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
@@ -100,7 +99,7 @@
         ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
 
         // Resolves "m1x"
-        Configuration cf = Layer.boot()
+        Configuration cf = ModuleLayer.boot()
                 .configuration()
                 .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -110,8 +109,8 @@
         map.put("m2x", MySameClassLoader.loader1);
         map.put("m3x", MySameClassLoader.loader1);
 
-        // Create Layer that contains m1x, m2x and m3x
-        Layer layer = Layer.boot().defineModules(cf, map::get);
+        // Create layer that contains m1x, m2x and m3x
+        ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
         assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
         assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
--- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_CheckRead.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_CheckRead.java	Wed Apr 19 03:21:41 2017 +0000
@@ -37,7 +37,6 @@
 
 import static jdk.test.lib.Asserts.*;
 
-import java.lang.reflect.Layer;
 import java.lang.module.Configuration;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
@@ -59,7 +58,7 @@
 //
 public class DiffCL_CheckRead {
 
-    // Create a Layer over the boot layer.
+    // Create a layer over the boot layer.
     // Define modules within this layer to test access between
     // publicly defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
@@ -100,7 +99,7 @@
         ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
 
         // Resolves "m1x"
-        Configuration cf = Layer.boot()
+        Configuration cf = ModuleLayer.boot()
                 .configuration()
                 .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -110,8 +109,8 @@
         map.put("m2x", MyDiffClassLoader.loader2);
         map.put("m3x", MyDiffClassLoader.loader2);
 
-        // Create Layer that contains m1x, m2x and m3x
-        Layer layer = Layer.boot().defineModules(cf, map::get);
+        // Create layer that contains m1x, m2x and m3x
+        ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
         assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
         assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
--- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualOther.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualOther.java	Wed Apr 19 03:21:41 2017 +0000
@@ -38,7 +38,6 @@
 
 import static jdk.test.lib.Asserts.*;
 
-import java.lang.reflect.Layer;
 import java.lang.module.Configuration;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
@@ -60,7 +59,7 @@
 //
 public class DiffCL_ExpQualOther {
 
-    // Create a Layer over the boot layer.
+    // Create a layer over the boot layer.
     // Define modules within this layer to test access between
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
@@ -102,7 +101,7 @@
         ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
 
         // Resolves "m1x"
-        Configuration cf = Layer.boot()
+        Configuration cf = ModuleLayer.boot()
                 .configuration()
                 .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -112,8 +111,8 @@
         map.put("m2x", MyDiffClassLoader.loader2);
         map.put("m3x", MyDiffClassLoader.loader2);
 
-        // Create Layer that contains m1x & m2x
-        Layer layer = Layer.boot().defineModules(cf, map::get);
+        // Create layer that contains m1x & m2x
+        ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
         assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
         assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
--- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualToM1.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualToM1.java	Wed Apr 19 03:21:41 2017 +0000
@@ -37,7 +37,6 @@
 
 import static jdk.test.lib.Asserts.*;
 
-import java.lang.reflect.Layer;
 import java.lang.module.Configuration;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
@@ -58,7 +57,7 @@
 //
 public class DiffCL_ExpQualToM1 {
 
-    // Create a Layer over the boot layer.
+    // Create a layer over the boot layer.
     // Define modules within this layer to test access between
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
@@ -88,7 +87,7 @@
         ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
         // Resolves "m1x"
-        Configuration cf = Layer.boot()
+        Configuration cf = ModuleLayer.boot()
                 .configuration()
                 .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -97,8 +96,8 @@
         map.put("m1x", MyDiffClassLoader.loader1);
         map.put("m2x", MyDiffClassLoader.loader2);
 
-        // Create Layer that contains m1x & m2x
-        Layer layer = Layer.boot().defineModules(cf, map::get);
+        // Create layer that contains m1x & m2x
+        ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
         assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
         assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
--- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpUnqual.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpUnqual.java	Wed Apr 19 03:21:41 2017 +0000
@@ -37,7 +37,6 @@
 
 import static jdk.test.lib.Asserts.*;
 
-import java.lang.reflect.Layer;
 import java.lang.module.Configuration;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
@@ -59,7 +58,7 @@
 //
 public class DiffCL_ExpUnqual {
 
-    // Create a Layer over the boot layer.
+    // Create a layer over the boot layer.
     // Define modules within this layer to test access between
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
@@ -89,7 +88,7 @@
         ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
         // Resolves "m1x"
-        Configuration cf = Layer.boot()
+        Configuration cf = ModuleLayer.boot()
                 .configuration()
                 .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -98,8 +97,8 @@
         map.put("m1x", MyDiffClassLoader.loader1);
         map.put("m2x", MyDiffClassLoader.loader2);
 
-        // Create Layer that contains m1x & m2x
-        Layer layer = Layer.boot().defineModules(cf, map::get);
+        // Create layer that contains m1x & m2x
+        ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
         assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
         assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
--- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_PkgNotExp.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_PkgNotExp.java	Wed Apr 19 03:21:41 2017 +0000
@@ -37,7 +37,6 @@
 
 import static jdk.test.lib.Asserts.*;
 
-import java.lang.reflect.Layer;
 import java.lang.module.Configuration;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
@@ -58,7 +57,7 @@
 //
 public class DiffCL_PkgNotExp {
 
-    // Create a Layer over the boot layer.
+    // Create a layer over the boot layer.
     // Define modules within this layer to test access between
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
@@ -88,7 +87,7 @@
         ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
         // Resolves "m1x"
-        Configuration cf = Layer.boot()
+        Configuration cf = ModuleLayer.boot()
                 .configuration()
                 .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -97,8 +96,8 @@
         map.put("m1x", MyDiffClassLoader.loader1);
         map.put("m2x", MyDiffClassLoader.loader2);
 
-        // Create Layer that contains m1x & m2x
-        Layer layer = Layer.boot().defineModules(cf, map::get);
+        // Create layer that contains m1x & m2x
+        ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
         assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
         assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
--- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_Umod.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_Umod.java	Wed Apr 19 03:21:41 2017 +0000
@@ -42,8 +42,6 @@
 import java.lang.module.Configuration;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
@@ -68,7 +66,7 @@
 //
 public class DiffCL_Umod {
 
- // Create Layers over the boot layer to test different
+ // Create layers over the boot layer to test different
  // accessing scenarios of a named module to an unnamed module.
 
  // Module m1x is a strict module and has not established
@@ -89,7 +87,7 @@
      ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
 
      // Resolves "m1x"
-     Configuration cf = Layer.boot()
+     Configuration cf = ModuleLayer.boot()
              .configuration()
              .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -102,8 +100,8 @@
      Map<String, ClassLoader> map = new HashMap<>();
      map.put("m1x", MyDiffClassLoader.loader1);
 
-     // Create Layer that contains m1x
-     Layer layer = Layer.boot().defineModules(cf, map::get);
+     // Create layer that contains m1x
+     ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
      assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
      assertTrue(layer.findLoader("java.base") == null);
@@ -138,7 +136,7 @@
      ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
 
      // Resolves "m1x"
-     Configuration cf = Layer.boot()
+     Configuration cf = ModuleLayer.boot()
              .configuration()
              .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -151,8 +149,8 @@
      Map<String, ClassLoader> map = new HashMap<>();
      map.put("m1x", MyDiffClassLoader.loader1);
 
-     // Create Layer that contains m1x
-     Layer layer = Layer.boot().defineModules(cf, map::get);
+     // Create layer that contains m1x
+     ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
      assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
      assertTrue(layer.findLoader("java.base") == null);
@@ -187,7 +185,7 @@
      ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
 
      // Resolves "m1x"
-     Configuration cf = Layer.boot()
+     Configuration cf = ModuleLayer.boot()
              .configuration()
              .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -200,8 +198,8 @@
      Map<String, ClassLoader> map = new HashMap<>();
      map.put("m1x", MyDiffClassLoader.loader1);
 
-     // Create Layer that contains m1x
-     Layer layer = Layer.boot().defineModules(cf, map::get);
+     // Create layer that contains m1x
+     ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
      assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
      assertTrue(layer.findLoader("java.base") == null);
--- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_UmodUpkg.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_UmodUpkg.java	Wed Apr 19 03:21:41 2017 +0000
@@ -38,7 +38,6 @@
 
 import static jdk.test.lib.Asserts.*;
 
-import java.lang.reflect.Layer;
 import java.lang.module.Configuration;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
@@ -63,7 +62,7 @@
 //
 public class DiffCL_UmodUpkg {
 
- // Create Layers over the boot layer to test different
+ // Create layers over the boot layer to test different
  // accessing scenarios of a named module to an unnamed module.
 
  // Module m1x is a strict module and has not established
@@ -84,7 +83,7 @@
      ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
 
      // Resolves "m1x"
-     Configuration cf = Layer.boot()
+     Configuration cf = ModuleLayer.boot()
              .configuration()
              .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -97,8 +96,8 @@
      Map<String, ClassLoader> map = new HashMap<>();
      map.put("m1x", MyDiffClassLoader.loader1);
 
-     // Create Layer that contains m1x
-     Layer layer = Layer.boot().defineModules(cf, map::get);
+     // Create layer that contains m1x
+     ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
      assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
      assertTrue(layer.findLoader("java.base") == null);
@@ -133,7 +132,7 @@
      ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
 
      // Resolves "m1x"
-     Configuration cf = Layer.boot()
+     Configuration cf = ModuleLayer.boot()
              .configuration()
              .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -146,8 +145,8 @@
      Map<String, ClassLoader> map = new HashMap<>();
      map.put("m1x", MyDiffClassLoader.loader1);
 
-     // Create Layer that contains m1x
-     Layer layer = Layer.boot().defineModules(cf, map::get);
+     // Create layer that contains m1x
+     ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
      assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
      assertTrue(layer.findLoader("java.base") == null);
--- a/hotspot/test/runtime/modules/AccessCheck/ExpQualOther.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/ExpQualOther.java	Wed Apr 19 03:21:41 2017 +0000
@@ -38,7 +38,6 @@
 
 import static jdk.test.lib.Asserts.*;
 
-import java.lang.reflect.Layer;
 import java.lang.module.Configuration;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
@@ -60,7 +59,7 @@
 //
 public class ExpQualOther {
 
-    // Create a Layer over the boot layer.
+    // Create a layer over the boot layer.
     // Define modules within this layer to test access between
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
@@ -102,7 +101,7 @@
         ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
 
         // Resolves "m1x"
-        Configuration cf = Layer.boot()
+        Configuration cf = ModuleLayer.boot()
                 .configuration()
                 .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -112,8 +111,8 @@
         map.put("m2x", MySameClassLoader.loader1);
         map.put("m3x", MySameClassLoader.loader1);
 
-        // Create Layer that contains m1x & m2x
-        Layer layer = Layer.boot().defineModules(cf, map::get);
+        // Create layer that contains m1x & m2x
+        ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
         assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
         assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
--- a/hotspot/test/runtime/modules/AccessCheck/ExpQualToM1.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/ExpQualToM1.java	Wed Apr 19 03:21:41 2017 +0000
@@ -37,7 +37,6 @@
 
 import static jdk.test.lib.Asserts.*;
 
-import java.lang.reflect.Layer;
 import java.lang.module.Configuration;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
@@ -48,7 +47,7 @@
 
 public class ExpQualToM1 {
 
-    // Create a Layer over the boot layer.
+    // Create a layer over the boot layer.
     // Define modules within this layer to test access between
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
@@ -78,7 +77,7 @@
         ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
         // Resolves "m1x"
-        Configuration cf = Layer.boot()
+        Configuration cf = ModuleLayer.boot()
                 .configuration()
                 .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -87,8 +86,8 @@
         map.put("m1x", MySameClassLoader.loader1);
         map.put("m2x", MySameClassLoader.loader1);
 
-        // Create Layer that contains m1x & m2x
-        Layer layer = Layer.boot().defineModules(cf, map::get);
+        // Create layer that contains m1x & m2x
+        ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
         assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
         assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
--- a/hotspot/test/runtime/modules/AccessCheck/ExpUnqual.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/ExpUnqual.java	Wed Apr 19 03:21:41 2017 +0000
@@ -37,7 +37,6 @@
 
 import static jdk.test.lib.Asserts.*;
 
-import java.lang.reflect.Layer;
 import java.lang.module.Configuration;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
@@ -48,7 +47,7 @@
 
 public class ExpUnqual {
 
-    // Create a Layer over the boot layer.
+    // Create a layer over the boot layer.
     // Define modules within this layer to test access between
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
@@ -78,7 +77,7 @@
         ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
         // Resolves "m1x"
-        Configuration cf = Layer.boot()
+        Configuration cf = ModuleLayer.boot()
                 .configuration()
                 .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -87,8 +86,8 @@
         map.put("m1x", MySameClassLoader.loader1);
         map.put("m2x", MySameClassLoader.loader1);
 
-        // Create Layer that contains m1x & m2x
-        Layer layer = Layer.boot().defineModules(cf, map::get);
+        // Create layer that contains m1x & m2x
+        ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
         assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
         assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
--- a/hotspot/test/runtime/modules/AccessCheck/ExportAllUnnamed.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/ExportAllUnnamed.java	Wed Apr 19 03:21:41 2017 +0000
@@ -41,8 +41,6 @@
 import java.lang.module.Configuration;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
@@ -61,7 +59,7 @@
 
 public class ExportAllUnnamed {
 
-    // Create a Layer over the boot layer.
+    // Create a layer over the boot layer.
     // Define modules within this layer to test access between
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
@@ -90,7 +88,7 @@
         ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
         // Resolves "m1x"
-        Configuration cf = Layer.boot()
+        Configuration cf = ModuleLayer.boot()
                 .configuration()
                 .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -99,8 +97,8 @@
         map.put("m1x", MySameClassLoader.loader1);
         map.put("m2x", MySameClassLoader.loader1);
 
-        // Create Layer that contains m1x & m2x
-        Layer layer = Layer.boot().defineModules(cf, map::get);
+        // Create layer that contains m1x & m2x
+        ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
         assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
         assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
--- a/hotspot/test/runtime/modules/AccessCheck/PkgNotExp.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/PkgNotExp.java	Wed Apr 19 03:21:41 2017 +0000
@@ -37,7 +37,6 @@
 
 import static jdk.test.lib.Asserts.*;
 
-import java.lang.reflect.Layer;
 import java.lang.module.Configuration;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
@@ -58,7 +57,7 @@
 //
 public class PkgNotExp {
 
-    // Create a Layer over the boot layer.
+    // Create a layer over the boot layer.
     // Define modules within this layer to test access between
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
@@ -88,7 +87,7 @@
         ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
         // Resolves "m1x"
-        Configuration cf = Layer.boot()
+        Configuration cf = ModuleLayer.boot()
                 .configuration()
                 .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -97,8 +96,8 @@
         map.put("m1x", MySameClassLoader.loader1);
         map.put("m2x", MySameClassLoader.loader1);
 
-        // Create Layer that contains m1x and m2x
-        Layer layer = Layer.boot().defineModules(cf, map::get);
+        // Create layer that contains m1x and m2x
+        ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
         assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
         assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
--- a/hotspot/test/runtime/modules/AccessCheck/Umod.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/Umod.java	Wed Apr 19 03:21:41 2017 +0000
@@ -39,11 +39,9 @@
 
 import static jdk.test.lib.Asserts.*;
 
-import java.lang.reflect.Layer;
 import java.lang.module.Configuration;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
-import java.lang.reflect.Module;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
@@ -68,7 +66,7 @@
 //
 public class Umod {
 
- // Create Layers over the boot layer to test different
+ // Create layers over the boot layer to test different
  // accessing scenarios of a named module to an unnamed module.
 
  // Module m1x is a strict module and has not established
@@ -89,7 +87,7 @@
      ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
 
      // Resolves "m1x"
-     Configuration cf = Layer.boot()
+     Configuration cf = ModuleLayer.boot()
              .configuration()
              .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -99,8 +97,8 @@
      Map<String, ClassLoader> map = new HashMap<>();
      map.put("m1x", loader);
 
-     // Create Layer that contains m1x
-     Layer layer = Layer.boot().defineModules(cf, map::get);
+     // Create layer that contains m1x
+     ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
      assertTrue(layer.findLoader("m1x") == loader);
      assertTrue(layer.findLoader("java.base") == null);
@@ -135,7 +133,7 @@
      ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
 
      // Resolves "m1x"
-     Configuration cf = Layer.boot()
+     Configuration cf = ModuleLayer.boot()
              .configuration()
              .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -145,8 +143,8 @@
      Map<String, ClassLoader> map = new HashMap<>();
      map.put("m1x", loader);
 
-     // Create Layer that contains m1x
-     Layer layer = Layer.boot().defineModules(cf, map::get);
+     // Create layer that contains m1x
+     ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
      assertTrue(layer.findLoader("m1x") == loader);
      assertTrue(layer.findLoader("java.base") == null);
@@ -181,7 +179,7 @@
      ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
 
      // Resolves "m1x"
-     Configuration cf = Layer.boot()
+     Configuration cf = ModuleLayer.boot()
              .configuration()
              .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -191,8 +189,8 @@
      Map<String, ClassLoader> map = new HashMap<>();
      map.put("m1x", loader);
 
-     // Create Layer that contains m1x
-     Layer layer = Layer.boot().defineModules(cf, map::get);
+     // Create layer that contains m1x
+     ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
      assertTrue(layer.findLoader("m1x") == loader);
      assertTrue(layer.findLoader("java.base") == null);
--- a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpQualOther.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpQualOther.java	Wed Apr 19 03:21:41 2017 +0000
@@ -38,7 +38,6 @@
 
 import static jdk.test.lib.Asserts.*;
 
-import java.lang.reflect.Layer;
 import java.lang.module.Configuration;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
@@ -60,7 +59,7 @@
 //
 public class UmodDiffCL_ExpQualOther {
 
-    // Create a Layer over the boot layer.
+    // Create a layer over the boot layer.
     // Define modules within this layer to test access between
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
@@ -89,7 +88,7 @@
         ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
         // Resolves "m1x"
-        Configuration cf = Layer.boot()
+        Configuration cf = ModuleLayer.boot()
                 .configuration()
                 .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -98,8 +97,8 @@
         map.put("m1x", MyDiffClassLoader.loader1);
         map.put("m2x", MyDiffClassLoader.loader2);
 
-        // Create Layer that contains m1x & m2x
-        Layer layer = Layer.boot().defineModules(cf, map::get);
+        // Create layer that contains m1x & m2x
+        ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
         assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
         assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
--- a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpUnqual.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpUnqual.java	Wed Apr 19 03:21:41 2017 +0000
@@ -38,7 +38,6 @@
 
 import static jdk.test.lib.Asserts.*;
 
-import java.lang.reflect.Layer;
 import java.lang.module.Configuration;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
@@ -60,7 +59,7 @@
 //
 public class UmodDiffCL_ExpUnqual {
 
-    // Create a Layer over the boot layer.
+    // Create a layer over the boot layer.
     // Define modules within this layer to test access between
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
@@ -89,7 +88,7 @@
         ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
         // Resolves "m1x"
-        Configuration cf = Layer.boot()
+        Configuration cf = ModuleLayer.boot()
                 .configuration()
                 .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -98,8 +97,8 @@
         map.put("m1x", MyDiffClassLoader.loader1);
         map.put("m2x", MyDiffClassLoader.loader2);
 
-        // Create Layer that contains m1x & m2x
-        Layer layer = Layer.boot().defineModules(cf, map::get);
+        // Create layer that contains m1x & m2x
+        ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
         assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
         assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
--- a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_PkgNotExp.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_PkgNotExp.java	Wed Apr 19 03:21:41 2017 +0000
@@ -37,7 +37,6 @@
 
 import static jdk.test.lib.Asserts.*;
 
-import java.lang.reflect.Layer;
 import java.lang.module.Configuration;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
@@ -59,7 +58,7 @@
 //
 public class UmodDiffCL_PkgNotExp {
 
-    // Create a Layer over the boot layer.
+    // Create a layer over the boot layer.
     // Define modules within this layer to test access between
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
@@ -88,7 +87,7 @@
         ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
         // Resolves "m1x"
-        Configuration cf = Layer.boot()
+        Configuration cf = ModuleLayer.boot()
                 .configuration()
                 .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -97,8 +96,8 @@
         map.put("m1x", MyDiffClassLoader.loader1);
         map.put("m2x", MyDiffClassLoader.loader2);
 
-        // Create Layer that contains m1x & m2x
-        Layer layer = Layer.boot().defineModules(cf, map::get);
+        // Create layer that contains m1x & m2x
+        ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
         assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
         assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
--- a/hotspot/test/runtime/modules/AccessCheck/UmodUPkg.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodUPkg.java	Wed Apr 19 03:21:41 2017 +0000
@@ -40,8 +40,6 @@
 import java.lang.module.Configuration;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
@@ -63,7 +61,7 @@
 //
 public class UmodUPkg {
 
- // Create Layers over the boot layer to test different
+ // Create layers over the boot layer to test different
  // accessing scenarios of a named module to an unnamed module.
 
  // Module m1x is a strict module and has not established
@@ -84,7 +82,7 @@
      ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
 
      // Resolves "m1x"
-     Configuration cf = Layer.boot()
+     Configuration cf = ModuleLayer.boot()
              .configuration()
              .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -94,8 +92,8 @@
      Map<String, ClassLoader> map = new HashMap<>();
      map.put("m1x", loader);
 
-     // Create Layer that contains m1x
-     Layer layer = Layer.boot().defineModules(cf, map::get);
+     // Create layer that contains m1x
+     ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
      assertTrue(layer.findLoader("m1x") == loader);
      assertTrue(layer.findLoader("java.base") == null);
@@ -130,7 +128,7 @@
      ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
 
      // Resolves "m1x"
-     Configuration cf = Layer.boot()
+     Configuration cf = ModuleLayer.boot()
              .configuration()
              .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -140,8 +138,8 @@
      Map<String, ClassLoader> map = new HashMap<>();
      map.put("m1x", loader);
 
-     // Create Layer that contains m1x
-     Layer layer = Layer.boot().defineModules(cf, map::get);
+     // Create layer that contains m1x
+     ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
      assertTrue(layer.findLoader("m1x") == loader);
      assertTrue(layer.findLoader("java.base") == null);
--- a/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_ExpQualOther.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_ExpQualOther.java	Wed Apr 19 03:21:41 2017 +0000
@@ -38,7 +38,6 @@
 
 import static jdk.test.lib.Asserts.*;
 
-import java.lang.reflect.Layer;
 import java.lang.module.Configuration;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
@@ -60,7 +59,7 @@
 //
 public class UmodUpkgDiffCL_ExpQualOther {
 
-    // Create a Layer over the boot layer.
+    // Create a layer over the boot layer.
     // Define modules within this layer to test access between
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
@@ -89,7 +88,7 @@
         ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
         // Resolves "m1x"
-        Configuration cf = Layer.boot()
+        Configuration cf = ModuleLayer.boot()
                 .configuration()
                 .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -98,8 +97,8 @@
         map.put("m1x", MyDiffClassLoader.loader1);
         map.put("m2x", MyDiffClassLoader.loader2);
 
-        // Create Layer that contains m1x & m2x
-        Layer layer = Layer.boot().defineModules(cf, map::get);
+        // Create layer that contains m1x & m2x
+        ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
         assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
         assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
--- a/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_NotExp.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_NotExp.java	Wed Apr 19 03:21:41 2017 +0000
@@ -37,7 +37,6 @@
 
 import static jdk.test.lib.Asserts.*;
 
-import java.lang.reflect.Layer;
 import java.lang.module.Configuration;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
@@ -59,7 +58,7 @@
 //
 public class UmodUpkgDiffCL_NotExp {
 
-    // Create a Layer over the boot layer.
+    // Create a layer over the boot layer.
     // Define modules within this layer to test access between
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
@@ -88,7 +87,7 @@
         ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
         // Resolves "m1x"
-        Configuration cf = Layer.boot()
+        Configuration cf = ModuleLayer.boot()
                 .configuration()
                 .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -97,8 +96,8 @@
         map.put("m1x", MyDiffClassLoader.loader1);
         map.put("m2x", MyDiffClassLoader.loader2);
 
-        // Create Layer that contains m1x & m2x
-        Layer layer = Layer.boot().defineModules(cf, map::get);
+        // Create layer that contains m1x & m2x
+        ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
         assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
         assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
--- a/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_ExpQualOther.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_ExpQualOther.java	Wed Apr 19 03:21:41 2017 +0000
@@ -37,7 +37,6 @@
 
 import static jdk.test.lib.Asserts.*;
 
-import java.lang.reflect.Layer;
 import java.lang.module.Configuration;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
@@ -59,12 +58,12 @@
 //
 public class UmodUpkg_ExpQualOther {
 
-    // Create a Layer over the boot layer.
+    // Create a layer over the boot layer.
     // Define modules within this layer to test access between
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
 
-        // Define module:     m1x (need to define m1x to establish the Layer successfully)
+        // Define module:     m1x (need to define m1x to establish the layer successfully)
         // Can read:          java.base, m2x, m3x
         // Packages:          none
         // Packages exported: none
@@ -98,7 +97,7 @@
         ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
 
         // Resolves "m1x"
-        Configuration cf = Layer.boot()
+        Configuration cf = ModuleLayer.boot()
                 .configuration()
                 .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -108,8 +107,8 @@
         map.put("m2x", MySameClassLoader.loader1);
         map.put("m3x", MySameClassLoader.loader1);
 
-        // Create Layer that contains m1x, m2x and m3x
-        Layer layer = Layer.boot().defineModules(cf, map::get);
+        // Create layer that contains m1x, m2x and m3x
+        ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
         assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
         assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
--- a/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_NotExp.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_NotExp.java	Wed Apr 19 03:21:41 2017 +0000
@@ -37,7 +37,6 @@
 
 import static jdk.test.lib.Asserts.*;
 
-import java.lang.reflect.Layer;
 import java.lang.module.Configuration;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
@@ -57,7 +56,7 @@
 //
 public class UmodUpkg_NotExp {
 
-    // Create a Layer over the boot layer.
+    // Create a layer over the boot layer.
     // Define modules within this layer to test access between
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
@@ -86,7 +85,7 @@
         ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
         // Resolves "m1x"
-        Configuration cf = Layer.boot()
+        Configuration cf = ModuleLayer.boot()
                 .configuration()
                 .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -95,8 +94,8 @@
         map.put("m1x", MySameClassLoader.loader1);
         map.put("m2x", MySameClassLoader.loader1);
 
-        // Create Layer that contains m1x and m2x
-        Layer layer = Layer.boot().defineModules(cf, map::get);
+        // Create layer that contains m1x and m2x
+        ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
         assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
         assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
--- a/hotspot/test/runtime/modules/AccessCheck/Umod_ExpQualOther.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/Umod_ExpQualOther.java	Wed Apr 19 03:21:41 2017 +0000
@@ -37,7 +37,6 @@
 
 import static jdk.test.lib.Asserts.*;
 
-import java.lang.reflect.Layer;
 import java.lang.module.Configuration;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
@@ -59,12 +58,12 @@
 //
 public class Umod_ExpQualOther {
 
-    // Create a Layer over the boot layer.
+    // Create a layer over the boot layer.
     // Define modules within this layer to test access between
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
 
-        // Define module:     m1x (need to define m1x to establish the Layer successfully)
+        // Define module:     m1x (need to define m1x to establish the layer successfully)
         // Can read:          java.base, m2x, m3x
         // Packages:          none
         // Packages exported: none
@@ -98,7 +97,7 @@
         ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
 
         // Resolves "m1x"
-        Configuration cf = Layer.boot()
+        Configuration cf = ModuleLayer.boot()
                 .configuration()
                 .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -108,8 +107,8 @@
         map.put("m2x", MySameClassLoader.loader1);
         map.put("m3x", MySameClassLoader.loader1);
 
-        // Create Layer that contains m1x, m2x and m3x
-        Layer layer = Layer.boot().defineModules(cf, map::get);
+        // Create layer that contains m1x, m2x and m3x
+        ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
         assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
         assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
--- a/hotspot/test/runtime/modules/AccessCheck/Umod_ExpUnqual.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/Umod_ExpUnqual.java	Wed Apr 19 03:21:41 2017 +0000
@@ -37,7 +37,6 @@
 
 import static jdk.test.lib.Asserts.*;
 
-import java.lang.reflect.Layer;
 import java.lang.module.Configuration;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
@@ -59,7 +58,7 @@
 
 public class Umod_ExpUnqual {
 
-    // Create a Layer over the boot layer.
+    // Create a layer over the boot layer.
     // Define modules within this layer to test access between
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
@@ -88,7 +87,7 @@
         ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
         // Resolves "m1x"
-        Configuration cf = Layer.boot()
+        Configuration cf = ModuleLayer.boot()
                 .configuration()
                 .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -97,8 +96,8 @@
         map.put("m1x", MySameClassLoader.loader1);
         map.put("m2x", MySameClassLoader.loader1);
 
-        // Create Layer that contains m1x & m2x
-        Layer layer = Layer.boot().defineModules(cf, map::get);
+        // Create layer that contains m1x & m2x
+        ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
         assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
         assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
--- a/hotspot/test/runtime/modules/AccessCheck/Umod_PkgNotExp.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/Umod_PkgNotExp.java	Wed Apr 19 03:21:41 2017 +0000
@@ -37,7 +37,6 @@
 
 import static jdk.test.lib.Asserts.*;
 
-import java.lang.reflect.Layer;
 import java.lang.module.Configuration;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
@@ -57,7 +56,7 @@
 //
 public class Umod_PkgNotExp {
 
-    // Create a Layer over the boot layer.
+    // Create a layer over the boot layer.
     // Define modules within this layer to test access between
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
@@ -86,7 +85,7 @@
         ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
         // Resolves "m1x"
-        Configuration cf = Layer.boot()
+        Configuration cf = ModuleLayer.boot()
                 .configuration()
                 .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -95,8 +94,8 @@
         map.put("m1x", MySameClassLoader.loader1);
         map.put("m2x", MySameClassLoader.loader1);
 
-        // Create Layer that contains m1x and m2x
-        Layer layer = Layer.boot().defineModules(cf, map::get);
+        // Create layer that contains m1x and m2x
+        ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
 
         assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
         assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
--- a/hotspot/test/runtime/modules/AccessCheck/p1/c1ReadEdge.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/p1/c1ReadEdge.java	Wed Apr 19 03:21:41 2017 +0000
@@ -22,7 +22,6 @@
  */
 package p1;
 
-import java.lang.reflect.*;
 import p2.c2;
 
 public class c1ReadEdge {
--- a/hotspot/test/runtime/modules/AccessCheck/p1/c1ReadEdgeDiffLoader.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/p1/c1ReadEdgeDiffLoader.java	Wed Apr 19 03:21:41 2017 +0000
@@ -22,7 +22,6 @@
  */
 package p1;
 
-import java.lang.reflect.*;
 import myloaders.MyDiffClassLoader;
 import p2.c2;
 
--- a/hotspot/test/runtime/modules/AccessCheck/p3/c3ReadEdge.jcod	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/p3/c3ReadEdge.jcod	Wed Apr 19 03:21:41 2017 +0000
@@ -23,7 +23,6 @@
 
 /*
  * package p3;
- * import java.lang.reflect.*;
  * public class c3ReadEdge {
  *    public c3ReadEdge() {
  *       // Establish read edge from module m1x, where c3ReadEdge is defined,
@@ -75,14 +74,14 @@
     Utf8 "java/lang/Object"; // #28     at 0xBC
     Utf8 "java/lang/Class"; // #29     at 0xCF
     Utf8 "getModule"; // #30     at 0xE1
-    Utf8 "()Ljava/lang/reflect/Module;"; // #31     at 0xED
+    Utf8 "()Ljava/lang/Module;"; // #31     at 0xED
     Utf8 "getClassLoader"; // #32     at 0x010C
     Utf8 "()Ljava/lang/ClassLoader;"; // #33     at 0x011D
     Utf8 "java/lang/ClassLoader"; // #34     at 0x0139
     Utf8 "getUnnamedModule"; // #35     at 0x0151
-    Utf8 "java/lang/reflect/Module"; // #36     at 0x0164
+    Utf8 "java/lang/Module"; // #36     at 0x0164
     Utf8 "addReads"; // #37     at 0x017F
-    Utf8 "(Ljava/lang/reflect/Module;)Ljava/lang/reflect/Module;"; // #38     at 0x018A
+    Utf8 "(Ljava/lang/Module;)Ljava/lang/Module;"; // #38     at 0x018A
     Utf8 "method4"; // #39     at 0x01C3
   } // Constant Pool
 
--- a/hotspot/test/runtime/modules/AccessCheck/p3/c3ReadEdgeDiffLoader.jcod	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/p3/c3ReadEdgeDiffLoader.jcod	Wed Apr 19 03:21:41 2017 +0000
@@ -23,7 +23,6 @@
 
 /* 
  * package p3;
- * import java.lang.reflect.*;
  * import myloaders.MyDiffClassLoader;
  *
  * public class c3ReadEdgeDiffLoader {
@@ -100,14 +99,14 @@
     Utf8 "java/lang/Object"; // #31     at 0xDD
     Utf8 "java/lang/Class"; // #32     at 0xF0
     Utf8 "getModule"; // #33     at 0x0102
-    Utf8 "()Ljava/lang/reflect/Module;"; // #34     at 0x010E
+    Utf8 "()Ljava/lang/Module;"; // #34     at 0x010E
     Utf8 "java/lang/ClassLoader"; // #35     at 0x012D
     Utf8 "getSystemClassLoader"; // #36     at 0x0145
     Utf8 "()Ljava/lang/ClassLoader;"; // #37     at 0x015C
     Utf8 "getUnnamedModule"; // #38     at 0x0178
-    Utf8 "java/lang/reflect/Module"; // #39     at 0x018B
+    Utf8 "java/lang/Module"; // #39     at 0x018B
     Utf8 "addReads"; // #40     at 0x01A6
-    Utf8 "(Ljava/lang/reflect/Module;)Ljava/lang/reflect/Module;"; // #41     at 0x01B1
+    Utf8 "(Ljava/lang/Module;)Ljava/lang/Module;"; // #41     at 0x01B1
     Utf8 "myloaders/MyDiffClassLoader"; // #42     at 0x01EA
     Utf8 "loader2"; // #43     at 0x0208
     Utf8 "Lmyloaders/MyDiffClassLoader;"; // #44     at 0x0212
--- a/hotspot/test/runtime/modules/AccessCheck/p4/c4.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheck/p4/c4.java	Wed Apr 19 03:21:41 2017 +0000
@@ -25,8 +25,6 @@
 
 package p4;
 
-import java.lang.reflect.Module;
-
 public class c4 {
     // Add a read edge from c4's module to given module m
     public void addReads(Module m) {
--- a/hotspot/test/runtime/modules/AccessCheckAllUnnamed.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheckAllUnnamed.java	Wed Apr 19 03:21:41 2017 +0000
@@ -21,7 +21,6 @@
  * questions.
  */
 
-import java.lang.reflect.Module;
 import static jdk.test.lib.Asserts.*;
 
 /*
@@ -31,7 +30,7 @@
  * @compile p2/c2.java
  * @compile p1/c1.java
  * @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @compile/module=java.base java/lang/ModuleHelper.java
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI AccessCheckAllUnnamed
@@ -45,10 +44,10 @@
     public static void main(String args[]) throws Throwable {
         Object m1x, m2x;
 
-        // Get the java.lang.reflect.Module object for module java.base.
+        // Get the java.lang.Module object for module java.base.
         Class jlObject = Class.forName("java.lang.Object");
-        Object jlObject_jlrM = jlObject.getModule();
-        assertNotNull(jlObject_jlrM, "jlrModule object of java.lang.Object should not be null");
+        Object jlM = jlObject.getModule();
+        assertNotNull(jlM, "jlModule object of java.lang.Object should not be null");
 
         // Get the class loader for AccessCheckWorks and assume it's also used to
         // load class p2.c2.
@@ -58,13 +57,13 @@
         m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p3" });
         assertNotNull(m1x, "Module should not be null");
         ModuleHelper.DefineModule(m1x, "9.0", "m1x/there", new String[] { "p3" });
-        ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
+        ModuleHelper.AddReadsModule(m1x, jlM);
 
         // Define a module for p2.
         m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
         assertNotNull(m2x, "Module should not be null");
         ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
-        ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
+        ModuleHelper.AddReadsModule(m2x, jlM);
 
         try {
             ModuleHelper.AddModuleExportsToAllUnnamed((Module)null, "p2");
--- a/hotspot/test/runtime/modules/AccessCheckExp.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheckExp.java	Wed Apr 19 03:21:41 2017 +0000
@@ -28,13 +28,12 @@
  * @compile p2/c2.java
  * @compile p1/c1.java
  * @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @compile/module=java.base java/lang/ModuleHelper.java
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI AccessCheckExp
  */
 
-import java.lang.reflect.Module;
 import static jdk.test.lib.Asserts.*;
 
 public class AccessCheckExp {
@@ -44,10 +43,10 @@
     public static void main(String args[]) throws Throwable {
         Object m1x, m2x;
 
-        // Get the java.lang.reflect.Module object for module java.base.
+        // Get the java.lang.Module object for module java.base.
         Class jlObject = Class.forName("java.lang.Object");
-        Object jlObject_jlrM = jlObject.getModule();
-        assertNotNull(jlObject_jlrM, "jlrModule object of java.lang.Object should not be null");
+        Object jlObject_jlM = jlObject.getModule();
+        assertNotNull(jlObject_jlM, "jlModule object of java.lang.Object should not be null");
 
         // Get the class loader for AccessCheckExp and assume it's also used to
         // load classes p1.c1 and p2.c2.
@@ -57,13 +56,13 @@
         m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p1" });
         assertNotNull(m1x, "Module should not be null");
         ModuleHelper.DefineModule(m1x, "9.0", "m1x/here", new String[] { "p1" });
-        ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
+        ModuleHelper.AddReadsModule(m1x, jlObject_jlM);
 
         // Define a module for p2.
         m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
         assertNotNull(m2x, "Module should not be null");
         ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
-        ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
+        ModuleHelper.AddReadsModule(m2x, jlObject_jlM);
 
         // Make package p1 in m1x visible to everyone.
         ModuleHelper.AddModuleExportsToAll(m1x, "p1");
--- a/hotspot/test/runtime/modules/AccessCheckJavaBase.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheckJavaBase.java	Wed Apr 19 03:21:41 2017 +0000
@@ -27,13 +27,12 @@
  * @library /test/lib ..
  * @compile p2/c2.java
  * @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @compile/module=java.base java/lang/ModuleHelper.java
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI AccessCheckJavaBase
  */
 
-import java.lang.reflect.Module;
 import static jdk.test.lib.Asserts.*;
 
 public class AccessCheckJavaBase {
--- a/hotspot/test/runtime/modules/AccessCheckRead.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheckRead.java	Wed Apr 19 03:21:41 2017 +0000
@@ -28,13 +28,12 @@
  * @compile p2/c2.java
  * @compile p1/c1.java
  * @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @compile/module=java.base java/lang/ModuleHelper.java
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI AccessCheckRead
  */
 
-import java.lang.reflect.Module;
 import static jdk.test.lib.Asserts.*;
 
 public class AccessCheckRead {
@@ -44,10 +43,10 @@
     public static void main(String args[]) throws Throwable {
         Object m1x, m2x;
 
-        // Get the java.lang.reflect.Module object for module java.base.
+        // Get the java.lang.Module object for module java.base.
         Class jlObject = Class.forName("java.lang.Object");
-        Object jlObject_jlrM = jlObject.getModule();
-        assertNotNull(jlObject_jlrM, "jlrModule object of java.lang.Object should not be null");
+        Object jlObject_jlM = jlObject.getModule();
+        assertNotNull(jlObject_jlM, "jlModule object of java.lang.Object should not be null");
 
         // Get the class loader for AccessCheckRead and assume it's also used to
         // load classes p1.c1 and p2.c2.
@@ -57,13 +56,13 @@
         m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p1" });
         assertNotNull(m1x, "Module should not be null");
         ModuleHelper.DefineModule(m1x, "9.0", "m1x/here", new String[] { "p1" });
-        ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
+        ModuleHelper.AddReadsModule(m1x, jlObject_jlM);
 
         // Define a module for p2.
         m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
         assertNotNull(m2x, "Module should not be null");
         ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
-        ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
+        ModuleHelper.AddReadsModule(m2x, jlObject_jlM);
 
         // Make package p1 in m1x visible to everyone.
         ModuleHelper.AddModuleExportsToAll(m1x, "p1");
--- a/hotspot/test/runtime/modules/AccessCheckSuper.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheckSuper.java	Wed Apr 19 03:21:41 2017 +0000
@@ -28,13 +28,12 @@
  * @compile p2/c2.java
  * @compile p3/c3.java
  * @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @compile/module=java.base java/lang/ModuleHelper.java
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI AccessCheckSuper
  */
 
-import java.lang.reflect.Module;
 import static jdk.test.lib.Asserts.*;
 
 public class AccessCheckSuper {
--- a/hotspot/test/runtime/modules/AccessCheckUnnamed.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheckUnnamed.java	Wed Apr 19 03:21:41 2017 +0000
@@ -21,7 +21,6 @@
  * questions.
  */
 
-import java.lang.reflect.Module;
 import static jdk.test.lib.Asserts.*;
 
 /*
@@ -31,7 +30,7 @@
  * @compile p2/c2.java
  * @compile p1/c1.java
  * @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @compile/module=java.base java/lang/ModuleHelper.java
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI AccessCheckUnnamed
@@ -44,10 +43,10 @@
     public static void main(String args[]) throws Throwable {
         Object m1x, m2x;
 
-        // Get the java.lang.reflect.Module object for module java.base.
+        // Get the java.lang.Module object for module java.base.
         Class jlObject = Class.forName("java.lang.Object");
-        Object jlObject_jlrM = jlObject.getModule();
-        assertNotNull(jlObject_jlrM, "jlrModule object of java.lang.Object should not be null");
+        Object jlObject_jlM = jlObject.getModule();
+        assertNotNull(jlObject_jlM, "jlModule object of java.lang.Object should not be null");
 
         // Get the class loader for AccessCheckWorks and assume it's also used to
         // load class p2.c2.
@@ -57,7 +56,7 @@
         m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
         assertNotNull(m2x, "Module should not be null");
         ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
-        ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
+        ModuleHelper.AddReadsModule(m2x, jlObject_jlM);
 
         // p1.c1's ctor tries to call a method in p2.c2.  This should fail because
         // p1 is in the unnamed module and p2.c2 is not unqualifiedly exported.
--- a/hotspot/test/runtime/modules/AccessCheckWorks.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/AccessCheckWorks.java	Wed Apr 19 03:21:41 2017 +0000
@@ -28,13 +28,12 @@
  * @compile p2/c2.java
  * @compile p1/c1.java
  * @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @compile/module=java.base java/lang/ModuleHelper.java
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI AccessCheckWorks
  */
 
-import java.lang.reflect.Module;
 import static jdk.test.lib.Asserts.*;
 
 public class AccessCheckWorks {
@@ -45,10 +44,10 @@
     public static void main(String args[]) throws Throwable {
         Object m1x, m2x;
 
-        // Get the java.lang.reflect.Module object for module java.base.
+        // Get the java.lang.Module object for module java.base.
         Class jlObject = Class.forName("java.lang.Object");
-        Object jlObject_jlrM = jlObject.getModule();
-        assertNotNull(jlObject_jlrM, "jlrModule object of java.lang.Object should not be null");
+        Object jlObject_jlM = jlObject.getModule();
+        assertNotNull(jlObject_jlM, "jlModule object of java.lang.Object should not be null");
 
         // Get the class loader for AccessCheckWorks and assume it's also used to
         // load classes p1.c1 and p2.c2.
@@ -58,13 +57,13 @@
         m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p1" });
         assertNotNull(m1x, "Module should not be null");
         ModuleHelper.DefineModule(m1x, "9.0", "m1x/here", new String[] { "p1" });
-        ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
+        ModuleHelper.AddReadsModule(m1x, jlObject_jlM);
 
         // Define a module for p2.
         m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
         assertNotNull(m2x, "Module should not be null");
         ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
-        ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
+        ModuleHelper.AddReadsModule(m2x, jlObject_jlM);
 
         // Make package p1 in m1x visible to everyone.
         ModuleHelper.AddModuleExportsToAll(m1x, "p1");
--- a/hotspot/test/runtime/modules/CCE_module_msg.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/CCE_module_msg.java	Wed Apr 19 03:21:41 2017 +0000
@@ -28,14 +28,13 @@
  * @compile p2/c2.java
  * @compile p4/c4.java
  * @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @compile/module=java.base java/lang/ModuleHelper.java
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI CCE_module_msg
  */
 
 import java.io.*;
-import java.lang.reflect.Module;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.nio.file.Path;
@@ -73,10 +72,10 @@
     }
 
     public static void invalidClassToString() throws Throwable {
-        // Get the java.lang.reflect.Module object for module java.base.
+        // Get the java.lang.Module object for module java.base.
         Class jlObject = Class.forName("java.lang.Object");
-        Object jlObject_jlrM = jlObject.getModule();
-        assertNotNull(jlObject_jlrM, "jlrModule object of java.lang.Object should not be null");
+        Object jlObject_jlM = jlObject.getModule();
+        assertNotNull(jlObject_jlM, "jlModule object of java.lang.Object should not be null");
 
         // Get the class loader for CCE_module_msg and assume it's also used to
         // load classes p1.c1 and p2.c2.
@@ -86,7 +85,7 @@
         Object m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
         assertNotNull(m2x, "Module should not be null");
         ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
-        ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
+        ModuleHelper.AddReadsModule(m2x, jlObject_jlM);
 
         try {
             ModuleHelper.AddModuleExportsToAll(m2x, "p2");
@@ -105,10 +104,10 @@
     }
 
     public static void invalidClassToStringCustomLoader() throws Throwable {
-        // Get the java.lang.reflect.Module object for module java.base.
+        // Get the java.lang.Module object for module java.base.
         Class jlObject = Class.forName("java.lang.Object");
-        Object jlObject_jlrM = jlObject.getModule();
-        assertNotNull(jlObject_jlrM, "jlrModule object of java.lang.Object should not be null");
+        Object jlObject_jlM = jlObject.getModule();
+        assertNotNull(jlObject_jlM, "jlModule object of java.lang.Object should not be null");
 
         // Create a customer class loader to load class p4/c4.
         URL[] urls = new URL[] { CLASSES_DIR.toUri().toURL() };
--- a/hotspot/test/runtime/modules/ExportTwice.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/ExportTwice.java	Wed Apr 19 03:21:41 2017 +0000
@@ -28,13 +28,12 @@
  * @compile p2/c2.java
  * @compile p1/c1.java
  * @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @compile/module=java.base java/lang/ModuleHelper.java
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ExportTwice
  */
 
-import java.lang.reflect.Module;
 import static jdk.test.lib.Asserts.*;
 
 public class ExportTwice {
@@ -46,10 +45,10 @@
     public static void main(String args[]) throws Throwable {
         Object m1x, m2x, m3x;
 
-        // Get the java.lang.reflect.Module object for module java.base.
+        // Get the java.lang.Module object for module java.base.
         Class jlObject = Class.forName("java.lang.Object");
-        Object jlObject_jlrM = jlObject.getModule();
-        assertNotNull(jlObject_jlrM, "jlrModule object of java.lang.Object should not be null");
+        Object jlObject_jlM = jlObject.getModule();
+        assertNotNull(jlObject_jlM, "jlModule object of java.lang.Object should not be null");
 
         // Get the class loader for ExportTwice and assume it's also used to
         // load classes p1.c1 and p2.c2.
@@ -59,19 +58,19 @@
         m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p1" });
         assertNotNull(m1x, "Module should not be null");
         ModuleHelper.DefineModule(m1x, "9.0", "m1x/here", new String[] { "p1" });
-        ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
+        ModuleHelper.AddReadsModule(m1x, jlObject_jlM);
 
         // Define a module for p2.
         m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
         assertNotNull(m2x, "Module should not be null");
         ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
-        ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
+        ModuleHelper.AddReadsModule(m2x, jlObject_jlM);
 
         // Define a module for p3.
         m3x = ModuleHelper.ModuleObject("module_three", this_cldr, new String[] { "p3" });
         assertNotNull(m3x, "Module should not be null");
         ModuleHelper.DefineModule(m3x, "9.0", "m3x/there", new String[] { "p3" });
-        ModuleHelper.AddReadsModule(m3x, jlObject_jlrM);
+        ModuleHelper.AddReadsModule(m3x, jlObject_jlM);
 
         // Make package p1 in m1x visible to everyone.
         ModuleHelper.AddModuleExportsToAll(m1x, "p1");
--- a/hotspot/test/runtime/modules/JVMAddModuleExportToAllUnnamed.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/JVMAddModuleExportToAllUnnamed.java	Wed Apr 19 03:21:41 2017 +0000
@@ -30,11 +30,10 @@
  * @build sun.hotspot.WhiteBox
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @compile/module=java.base java/lang/ModuleHelper.java
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI JVMAddModuleExportToAllUnnamed
  */
 
-import java.lang.reflect.Module;
 import static jdk.test.lib.Asserts.*;
 
 public class JVMAddModuleExportToAllUnnamed {
@@ -44,10 +43,10 @@
     public static void main(String args[]) throws Throwable {
         Object m1x;
 
-        // Get the java.lang.reflect.Module object for module java.base.
+        // Get the java.lang.Module object for module java.base.
         Class jlObject = Class.forName("java.lang.Object");
-        Object jlObject_jlrM = jlObject.getModule();
-        assertNotNull(jlObject_jlrM, "jlrModule object of java.lang.Object should not be null");
+        Object jlObject_jlM = jlObject.getModule();
+        assertNotNull(jlObject_jlM, "jlModule object of java.lang.Object should not be null");
 
         // Get the class loader for JVMAddModuleExportToAllUnnamed and assume it's also used to
         // load class p1.c1.
@@ -57,7 +56,7 @@
         m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p1" });
         assertNotNull(m1x, "Module should not be null");
         ModuleHelper.DefineModule(m1x, "9.0", "m1x/here", new String[] { "p1" });
-        ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
+        ModuleHelper.AddReadsModule(m1x, jlObject_jlM);
 
         // Make package p1 in m1x visible to everyone.
         ModuleHelper.AddModuleExportsToAll(m1x, "p1");
--- a/hotspot/test/runtime/modules/JVMAddModuleExports.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/JVMAddModuleExports.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,13 +26,12 @@
  * @modules java.base/jdk.internal.misc
  * @library /test/lib ..
  * @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @compile/module=java.base java/lang/ModuleHelper.java
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI JVMAddModuleExports
  */
 
-import java.lang.reflect.Module;
 import static jdk.test.lib.Asserts.*;
 
 public class JVMAddModuleExports {
--- a/hotspot/test/runtime/modules/JVMAddModuleExportsToAll.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/JVMAddModuleExportsToAll.java	Wed Apr 19 03:21:41 2017 +0000
@@ -21,7 +21,6 @@
  * questions.
  */
 
-import java.lang.reflect.Module;
 import static jdk.test.lib.Asserts.*;
 
 /*
@@ -31,7 +30,7 @@
  * @compile p2/c2.java
  * @compile p1/c1.java
  * @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @compile/module=java.base java/lang/ModuleHelper.java
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI JVMAddModuleExportsToAll
@@ -45,10 +44,10 @@
     public static void main(String args[]) throws Throwable {
         Object m1x, m2x, m3x;
 
-        // Get the java.lang.reflect.Module object for module java.base.
+        // Get the java.lang.Module object for module java.base.
         Class jlObject = Class.forName("java.lang.Object");
-        Object jlObject_jlrM = jlObject.getModule();
-        assertNotNull(jlObject_jlrM, "jlrModule object of java.lang.Object should not be null");
+        Object jlObject_jlM = jlObject.getModule();
+        assertNotNull(jlObject_jlM, "jlModule object of java.lang.Object should not be null");
 
         // Get the class loader for JVMAddModuleExportsToAll and assume it's also used to
         // load class p2.c2.
@@ -58,13 +57,13 @@
         m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p3" });
         assertNotNull(m1x, "Module should not be null");
         ModuleHelper.DefineModule(m1x, "9.0", "m1x/there", new String[] { "p3" });
-        ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
+        ModuleHelper.AddReadsModule(m1x, jlObject_jlM);
 
         // Define a module for p2.
         m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
         assertNotNull(m2x, "Module should not be null");
         ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
-        ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
+        ModuleHelper.AddReadsModule(m2x, jlObject_jlM);
 
         try {
             ModuleHelper.AddModuleExportsToAll((Module)null, "p2");
@@ -80,7 +79,7 @@
             // Expected
         }
 
-        try { // Expect IAE when passing a ClassLoader object instead of a java.lang.reflect.Module object.
+        try { // Expect IAE when passing a ClassLoader object instead of a java.lang.Module object.
             ModuleHelper.AddModuleExportsToAll(this_cldr, "p2");
             throw new RuntimeException("Failed to get the expected IAE for bad module");
         } catch(IllegalArgumentException e) {
--- a/hotspot/test/runtime/modules/JVMAddModulePackage.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/JVMAddModulePackage.java	Wed Apr 19 03:21:41 2017 +0000
@@ -26,7 +26,7 @@
  * @modules java.base/jdk.internal.misc
  * @library /test/lib ..
  * @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @compile/module=java.base java/lang/ModuleHelper.java
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI JVMAddModulePackage
--- a/hotspot/test/runtime/modules/JVMAddReadsModule.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/JVMAddReadsModule.java	Wed Apr 19 03:21:41 2017 +0000
@@ -26,7 +26,7 @@
  * @modules java.base/jdk.internal.misc
  * @library /test/lib ..
  * @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @compile/module=java.base java/lang/ModuleHelper.java
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI JVMAddReadsModule
--- a/hotspot/test/runtime/modules/JVMDefineModule.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/JVMDefineModule.java	Wed Apr 19 03:21:41 2017 +0000
@@ -26,7 +26,7 @@
  * @modules java.base/jdk.internal.misc
  * @library /test/lib ..
  * @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @compile/module=java.base java/lang/ModuleHelper.java
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI JVMDefineModule
@@ -78,7 +78,7 @@
             ModuleHelper.DefineModule(new Object(),  "9.0", "mymodule/here", new String[] { "mypackage1" });
             throw new RuntimeException("Failed to get expected IAE or NPE for bad module");
         } catch(IllegalArgumentException e) {
-            if (!e.getMessage().contains("module is not an instance of type java.lang.reflect.Module")) {
+            if (!e.getMessage().contains("module is not an instance of type java.lang.Module")) {
               throw new RuntimeException("Failed to get expected IAE message for bad module: " + e.getMessage());
             }
         }
--- a/hotspot/test/runtime/modules/LoadUnloadModuleStress.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/LoadUnloadModuleStress.java	Wed Apr 19 03:21:41 2017 +0000
@@ -27,7 +27,7 @@
  * @modules java.base/jdk.internal.misc
  * @library /test/lib ..
  * @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @compile/module=java.base java/lang/ModuleHelper.java
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xmx64m -Xmx64m LoadUnloadModuleStress 15000
--- a/hotspot/test/runtime/modules/ModuleHelper.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/ModuleHelper.java	Wed Apr 19 03:21:41 2017 +0000
@@ -23,7 +23,6 @@
 
 import java.net.URI;
 import java.lang.module.ModuleDescriptor;
-import java.lang.reflect.Module;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
@@ -41,31 +40,31 @@
     public static void AddModuleExports(Object from, String pkg, Object to) throws Throwable {
         WhiteBox wb = WhiteBox.getWhiteBox();
         wb.AddModuleExports(from, pkg, to);
-        java.lang.reflect.ModuleHelper.addExportsNoSync((Module)from, pkg, (Module)to);
+        java.lang.ModuleHelper.addExportsNoSync((Module)from, pkg, (Module)to);
     }
 
     public static void AddReadsModule(Object from, Object to) throws Throwable {
         WhiteBox wb = WhiteBox.getWhiteBox();
         wb.AddReadsModule(from, to);
-        java.lang.reflect.ModuleHelper.addReadsNoSync((Module)from, (Module)to);
+        java.lang.ModuleHelper.addReadsNoSync((Module)from, (Module)to);
     }
 
     public static void AddModulePackage(Object m, String pkg) throws Throwable {
         WhiteBox wb = WhiteBox.getWhiteBox();
         wb.AddModulePackage(m, pkg);
-        java.lang.reflect.ModuleHelper.addPackageNoSync((Module)m, pkg);
+        java.lang.ModuleHelper.addPackageNoSync((Module)m, pkg);
     }
 
     public static void AddModuleExportsToAllUnnamed(Object m, String pkg) throws Throwable {
         WhiteBox wb = WhiteBox.getWhiteBox();
         wb.AddModuleExportsToAllUnnamed(m, pkg);
-        //java.lang.reflect.ModuleHelper.addExportsToAllUnnamedNoSync((Module)m, pkg);
+        //java.lang.ModuleHelper.addExportsToAllUnnamedNoSync((Module)m, pkg);
     }
 
     public static void AddModuleExportsToAll(Object m, String pkg) throws Throwable {
         WhiteBox wb = WhiteBox.getWhiteBox();
         wb.AddModuleExportsToAll(m, pkg);
-        java.lang.reflect.ModuleHelper.addExportsNoSync((Module)m, pkg, (Module)null);
+        java.lang.ModuleHelper.addExportsNoSync((Module)m, pkg, (Module)null);
     }
 
     public static Module ModuleObject(String name, ClassLoader loader, String[] pkgs) throws Throwable {
@@ -82,7 +81,7 @@
             ModuleDescriptor.newModule(name).packages(pkg_set).build();
         URI uri = URI.create("module:/" + name);
 
-        return java.lang.reflect.ModuleHelper.newModule(loader, descriptor);
+        return java.lang.ModuleHelper.newModule(loader, descriptor);
     }
 
 }
--- a/hotspot/test/runtime/modules/ModuleStress/ModuleNonBuiltinCLMain.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/ModuleStress/ModuleNonBuiltinCLMain.java	Wed Apr 19 03:21:41 2017 +0000
@@ -25,7 +25,6 @@
 
 import static jdk.test.lib.Asserts.*;
 
-import java.lang.reflect.Layer;
 import java.lang.module.Configuration;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
@@ -47,7 +46,7 @@
 //
 public class ModuleNonBuiltinCLMain {
 
-    // Create a Layer over the boot layer.
+    // Create a layer over the boot layer.
     // Define modules within this layer to test access between
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
@@ -90,7 +89,7 @@
         ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
 
         // Resolves "m1x"
-        Configuration cf = Layer.boot()
+        Configuration cf = ModuleLayer.boot()
                 .configuration()
                 .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -103,8 +102,8 @@
         map.put("m2x", cl2);
         map.put("m3x", cl3);
 
-        // Create Layer that contains m1x & m2x
-        Layer layer = Layer.boot().defineModules(cf, map::get);
+        // Create layer that contains m1x & m2x
+        ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
         assertTrue(layer.findLoader("m1x") == cl1);
         assertTrue(layer.findLoader("m2x") == cl2);
         assertTrue(layer.findLoader("m3x") == cl3);
--- a/hotspot/test/runtime/modules/ModuleStress/ModuleSameCLMain.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/ModuleStress/ModuleSameCLMain.java	Wed Apr 19 03:21:41 2017 +0000
@@ -25,7 +25,6 @@
 
 import static jdk.test.lib.Asserts.*;
 
-import java.lang.reflect.Layer;
 import java.lang.module.Configuration;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
@@ -45,7 +44,7 @@
 //
 public class ModuleSameCLMain {
 
-    // Create a Layer over the boot layer.
+    // Create a layer over the boot layer.
     // Define modules within this layer to test access between
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
@@ -75,7 +74,7 @@
         ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
         // Resolves "m1x"
-        Configuration cf = Layer.boot()
+        Configuration cf = ModuleLayer.boot()
                 .configuration()
                 .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
@@ -85,8 +84,8 @@
         map.put("m1x", cl1);
         map.put("m2x", cl1);
 
-        // Create Layer that contains m1x & m2x
-        Layer layer = Layer.boot().defineModules(cf, map::get);
+        // Create layer that contains m1x & m2x
+        ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
         assertTrue(layer.findLoader("m1x") == cl1);
         assertTrue(layer.findLoader("m2x") == cl1);
         assertTrue(layer.findLoader("java.base") == null);
--- a/hotspot/test/runtime/modules/ModuleStress/src/jdk.test/test/Main.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/ModuleStress/src/jdk.test/test/Main.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,9 +25,7 @@
 
 import java.lang.module.Configuration;
 import java.lang.module.ModuleFinder;
-import java.lang.reflect.Layer;
 import java.lang.reflect.Method;
-import java.lang.reflect.Module;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.*;
@@ -44,7 +42,7 @@
     public static void main(String[] args) throws Exception {
 
         ModuleFinder finder = ModuleFinder.of(MODS_DIR);
-        Layer layerBoot = Layer.boot();
+        ModuleLayer layerBoot = ModuleLayer.boot();
 
         Configuration cf = layerBoot
                 .configuration()
@@ -58,7 +56,7 @@
         Callable<Void> task = new Callable<Void>() {
             @Override
             public Void call() throws Exception {
-                Layer layer = Layer.boot().defineModulesWithOneLoader(cf, scl);
+                ModuleLayer layer = ModuleLayer.boot().defineModulesWithOneLoader(cf, scl);
                 Module transletModule = layer.findModule(MODULE_NAME).get();
                 testModule.addExports("test", transletModule);
                 Class<?> c = layer.findLoader(MODULE_NAME).loadClass("translet.Main");
--- a/hotspot/test/runtime/modules/ModuleStress/src/jdk.test/test/MainGC.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/ModuleStress/src/jdk.test/test/MainGC.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,9 +25,7 @@
 
 import java.lang.module.Configuration;
 import java.lang.module.ModuleFinder;
-import java.lang.reflect.Layer;
 import java.lang.reflect.Method;
-import java.lang.reflect.Module;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.*;
@@ -44,7 +42,7 @@
     public static void main(String[] args) throws Exception {
 
         ModuleFinder finder = ModuleFinder.of(MODS_DIR);
-        Layer layerBoot = Layer.boot();
+        ModuleLayer layerBoot = ModuleLayer.boot();
 
         Configuration cf = layerBoot
                 .configuration()
@@ -59,7 +57,7 @@
         Callable<Void> task = new Callable<Void>() {
             @Override
             public Void call() throws Exception {
-                Layer layer = Layer.boot().defineModulesWithOneLoader(cf, scl);
+                ModuleLayer layer = ModuleLayer.boot().defineModulesWithOneLoader(cf, scl);
                 Module transletModule = layer.findModule(MODULE_NAME).get();
                 testModule.addExports("test", transletModule);
                 testModule.addReads(transletModule);
--- a/hotspot/test/runtime/modules/getModuleJNI/GetModule.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/runtime/modules/getModuleJNI/GetModule.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
  * @run main/native GetModule
  */
 
-import java.lang.reflect.Module;
 import java.lang.management.LockInfo;
 public class GetModule {
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/modules/java.base/java/lang/ModuleHelper.java	Wed Apr 19 03:21:41 2017 +0000
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ */
+
+package java.lang;
+
+import java.lang.module.ModuleDescriptor;
+
+/**
+ * A helper class intended to be injected into java.lang using the
+ * java --patch-module option. The helper class provides access to package private
+ * methods in java.lang.Module.
+ */
+
+public final class ModuleHelper {
+
+    private ModuleHelper() { }
+
+    /**
+     * Creates a named module but without defining the module to the VM.
+     */
+    public static Module newModule(ClassLoader loader, ModuleDescriptor descriptor) {
+        return new Module(loader, descriptor);
+    }
+
+    /**
+     * Updates module {@code from} to that it reads module {@code to} without
+     * notifying the VM.
+     */
+    public static void addReadsNoSync(Module from, Module to) {
+        from.implAddReadsNoSync(to);
+    }
+
+    /**
+     * Updates module {@code from} so that it exports package {@code pkg}
+     * to module {@code to} but without notifying the VM. If {@code to} is
+     * {@code null} then the package is exported unconditionally.
+     */
+    public static void addExportsNoSync(Module from, String pkg, Module to) {
+        if (to == null) {
+            from.implAddExportsNoSync(pkg);
+        } else {
+            from.implAddExportsNoSync(pkg, to);
+        }
+    }
+
+    /**
+     * Adds a package to a module without notifying the VM.
+     */
+    public static void addPackageNoSync(Module m, String pkg) {
+        m.implAddPackageNoSync(pkg);
+    }
+
+}
--- a/hotspot/test/runtime/modules/java.base/java/lang/reflect/ModuleHelper.java	Tue Apr 18 20:17:22 2017 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package java.lang.reflect;
-
-import java.lang.module.ModuleDescriptor;
-
-/**
- * A helper class intended to be injected into java.lang.reflect using the
- * java --patch-module option. The helper class provides access to package private
- * methods in java.lang.reflect.Module.
- */
-
-public final class ModuleHelper {
-
-    private ModuleHelper() { }
-
-    /**
-     * Creates a named module but without defining the module to the VM.
-     */
-    public static Module newModule(ClassLoader loader, ModuleDescriptor descriptor) {
-        return new Module(loader, descriptor);
-    }
-
-    /**
-     * Updates module {@code from} to that it reads module {@code to} without
-     * notifying the VM.
-     */
-    public static void addReadsNoSync(Module from, Module to) {
-        from.implAddReadsNoSync(to);
-    }
-
-    /**
-     * Updates module {@code from} so that it exports package {@code pkg}
-     * to module {@code to} but without notifying the VM. If {@code to} is
-     * {@code null} then the package is exported unconditionally.
-     */
-    public static void addExportsNoSync(Module from, String pkg, Module to) {
-        from.implAddExportsNoSync(pkg, to);
-    }
-
-    /**
-     * Adds a package to a module without notifying the VM.
-     */
-    public static void addPackageNoSync(Module m, String pkg) {
-        m.implAddPackageNoSync(pkg);
-    }
-
-}
--- a/hotspot/test/serviceability/jdwp/AllModulesCommandTestDebuggee.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/serviceability/jdwp/AllModulesCommandTestDebuggee.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,8 +21,6 @@
  * questions.
  */
 
-import java.lang.reflect.Module;
-import java.lang.reflect.Layer;
 import java.util.Set;
 import java.util.HashSet;
 
@@ -35,10 +33,10 @@
 
     public static void main(String[] args) throws InterruptedException {
 
-        int modCount = Layer.boot().modules().size();
+        int modCount = ModuleLayer.boot().modules().size();
 
         // Send all modules names via the process output
-        for (Module mod : Layer.boot().modules()) {
+        for (Module mod : ModuleLayer.boot().modules()) {
             String info = String.format("module %s", mod.getName());
             write(info);
         }
--- a/hotspot/test/serviceability/jvmti/AddModuleExportsAndOpens/MyPackage/AddModuleExportsAndOpensTest.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/serviceability/jvmti/AddModuleExportsAndOpens/MyPackage/AddModuleExportsAndOpensTest.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,6 @@
  */
 
 import java.io.PrintStream;
-import java.lang.reflect.Module;
 
 public class AddModuleExportsAndOpensTest {
 
--- a/hotspot/test/serviceability/jvmti/AddModuleExportsAndOpens/libAddModuleExportsAndOpensTest.c	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/serviceability/jvmti/AddModuleExportsAndOpens/libAddModuleExportsAndOpensTest.c	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,7 +47,7 @@
 #define FAILED 2
 
 static const char *EXC_CNAME = "java/lang/Exception";
-static const char* MOD_CNAME = "Ljava/lang/reflect/Module;";
+static const char* MOD_CNAME = "Ljava/lang/Module;";
 
 static jvmtiEnv *jvmti = NULL;
 static jint result = PASSED;
@@ -97,7 +97,7 @@
 }
 
 static
-jclass jlrM(JNIEnv *env) {
+jclass jlM(JNIEnv *env) {
     jclass cls = NULL;
 
     cls = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env, MOD_CNAME));
@@ -127,7 +127,7 @@
     if (mIsExported == NULL) {
         const char* sign = "(Ljava/lang/String;)Z";
         const char* name = open ? "isOpen" : "isExported";
-        mIsExported = get_method(env, jlrM(env), name, sign);
+        mIsExported = get_method(env, jlM(env), name, sign);
     }
     jstr = JNI_ENV_PTR(env)->NewStringUTF(JNI_ENV_ARG(env, pkg));
     res = JNI_ENV_PTR(env)->CallBooleanMethod(JNI_ENV_ARG(env, module),
@@ -143,9 +143,9 @@
     jboolean res = JNI_FALSE;
 
     if (mIsExportedTo == NULL) {
-        const char* sign = "(Ljava/lang/String;Ljava/lang/reflect/Module;)Z";
+        const char* sign = "(Ljava/lang/String;Ljava/lang/Module;)Z";
         const char* name = open ? "isOpen" : "isExported";
-        mIsExportedTo = get_method(env, jlrM(env), name, sign);
+        mIsExportedTo = get_method(env, jlM(env), name, sign);
     }
     jstr = JNI_ENV_PTR(env)->NewStringUTF(JNI_ENV_ARG(env, pkg));
     res = JNI_ENV_PTR(env)->CallBooleanMethod(JNI_ENV_ARG(env, module),
--- a/hotspot/test/serviceability/jvmti/AddModuleReads/MyPackage/AddModuleReadsTest.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/serviceability/jvmti/AddModuleReads/MyPackage/AddModuleReadsTest.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,6 @@
 
 import java.io.PrintStream;
 import java.lang.instrument.Instrumentation;
-import java.lang.reflect.Module;
 
 public class AddModuleReadsTest {
 
--- a/hotspot/test/serviceability/jvmti/AddModuleReads/libAddModuleReadsTest.c	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/serviceability/jvmti/AddModuleReads/libAddModuleReadsTest.c	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,7 +47,7 @@
 #define FAILED 2
 
 static const char *EXC_CNAME = "java/lang/Exception";
-static const char* MOD_CNAME = "Ljava/lang/reflect/Module;";
+static const char* MOD_CNAME = "Ljava/lang/Module;";
 
 static jvmtiEnv *jvmti = NULL;
 static jint result = PASSED;
@@ -96,7 +96,7 @@
 }
 
 static
-jclass jlrM(JNIEnv *env) {
+jclass jlM(JNIEnv *env) {
     jclass cls = NULL;
 
     cls = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env, MOD_CNAME));
@@ -123,8 +123,8 @@
     jboolean res = JNI_FALSE;
 
     if (mCanRead == NULL) {
-        const char* sign = "(Ljava/lang/reflect/Module;)Z";
-        mCanRead = get_method(env, jlrM(env), "canRead", sign);
+        const char* sign = "(Ljava/lang/Module;)Z";
+        mCanRead = get_method(env, jlM(env), "canRead", sign);
     }
     res = JNI_ENV_PTR(env)->CallBooleanMethod(JNI_ENV_ARG(env, module),
                                               mCanRead, to_module);
--- a/hotspot/test/serviceability/jvmti/AddModuleUsesAndProvides/MyPackage/AddModuleUsesAndProvidesTest.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/serviceability/jvmti/AddModuleUsesAndProvides/MyPackage/AddModuleUsesAndProvidesTest.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,6 @@
 
 import java.io.PrintStream;
 import java.lang.TestProvider;
-import java.lang.reflect.Module;
 
 public class AddModuleUsesAndProvidesTest {
 
--- a/hotspot/test/serviceability/jvmti/AddModuleUsesAndProvides/libAddModuleUsesAndProvidesTest.c	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/serviceability/jvmti/AddModuleUsesAndProvides/libAddModuleUsesAndProvidesTest.c	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,7 +47,7 @@
 #define FAILED 2
 
 static const char *EXC_CNAME = "java/lang/Exception";
-static const char* MOD_CNAME = "Ljava/lang/reflect/Module;";
+static const char* MOD_CNAME = "Ljava/lang/Module;";
 
 static jvmtiEnv *jvmti = NULL;
 static jint result = PASSED;
@@ -97,7 +97,7 @@
 }
 
 static
-jclass jlrM(JNIEnv *env) {
+jclass jlM(JNIEnv *env) {
     jclass cls = NULL;
 
     cls = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env, MOD_CNAME));
@@ -125,7 +125,7 @@
 
     if (mCanUse == NULL) {
         const char* sign = "(Ljava/lang/Class;)Z";
-        mCanUse = get_method(env, jlrM(env), "canUse", sign);
+        mCanUse = get_method(env, jlM(env), "canUse", sign);
     }
     res = JNI_ENV_PTR(env)->CallBooleanMethod(JNI_ENV_ARG(env, module),
                                               mCanUse, service);
--- a/hotspot/test/serviceability/jvmti/GetModulesInfo/JvmtiGetAllModulesTest.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/serviceability/jvmti/GetModulesInfo/JvmtiGetAllModulesTest.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,8 +28,6 @@
  * @run main/othervm -agentlib:JvmtiGetAllModulesTest JvmtiGetAllModulesTest
  *
  */
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.lang.module.ModuleReference;
 import java.lang.module.ModuleFinder;
 import java.lang.module.ModuleReader;
@@ -79,15 +77,15 @@
         final String MY_MODULE_NAME = "myModule";
 
         // Verify that JVMTI reports exactly the same info as Java regarding the named modules
-        Asserts.assertEquals(Layer.boot().modules(), getModulesJVMTI());
+        Asserts.assertEquals(ModuleLayer.boot().modules(), getModulesJVMTI());
 
         // Load a new named module
         ModuleDescriptor descriptor = ModuleDescriptor.newModule(MY_MODULE_NAME).build();
         ModuleFinder finder = finderOf(descriptor);
         ClassLoader loader = new ClassLoader() {};
-        Configuration parent = Layer.boot().configuration();
+        Configuration parent = ModuleLayer.boot().configuration();
         Configuration cf = parent.resolve(finder, ModuleFinder.of(), Set.of(MY_MODULE_NAME));
-        Layer my = Layer.boot().defineModules(cf, m -> loader);
+        ModuleLayer my = ModuleLayer.boot().defineModules(cf, m -> loader);
 
         // Verify that the loaded module is indeed reported by JVMTI
         Set<Module> jvmtiModules = getModulesJVMTI();
--- a/hotspot/test/serviceability/jvmti/GetModulesInfo/libJvmtiGetAllModulesTest.c	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/serviceability/jvmti/GetModulesInfo/libJvmtiGetAllModulesTest.c	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,7 +53,7 @@
             return NULL;
         }
 
-        array = (*env)->NewObjectArray(env, modules_count, (*env)->FindClass(env, "java/lang/reflect/Module"), NULL);
+        array = (*env)->NewObjectArray(env, modules_count, (*env)->FindClass(env, "java/lang/Module"), NULL);
 
         for (i = 0; i < modules_count; ++i) {
             (*env)->SetObjectArrayElement(env, array, i, modules_ptr[i]);
--- a/hotspot/test/serviceability/jvmti/GetNamedModule/libGetNamedModuleTest.c	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/serviceability/jvmti/GetNamedModule/libGetNamedModuleTest.c	Wed Apr 19 03:21:41 2017 +0000
@@ -47,7 +47,7 @@
 #define FAILED 2
 
 static const char *EXC_CNAME = "java/lang/Exception";
-static const char* MOD_CNAME = "Ljava/lang/reflect/Module;";
+static const char* MOD_CNAME = "Ljava/lang/Module;";
 
 static jvmtiEnv *jvmti = NULL;
 static jint result = PASSED;
@@ -115,7 +115,7 @@
 }
 
 static
-jclass jlrM(JNIEnv *env) {
+jclass jlM(JNIEnv *env) {
     jclass cls = NULL;
 
     cls = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env, MOD_CNAME));
@@ -142,7 +142,7 @@
     jobject loader = NULL;
 
     if (cl_method == NULL) {
-        cl_method = get_method(env, jlrM(env), "getClassLoader", "()Ljava/lang/ClassLoader;");
+        cl_method = get_method(env, jlM(env), "getClassLoader", "()Ljava/lang/ClassLoader;");
     }
     loader = (jobject)JNI_ENV_PTR(env)->CallObjectMethod(JNI_ENV_ARG(env, module), cl_method);
     return loader;
@@ -157,7 +157,7 @@
     const char *nstr = NULL;
 
     if (method == NULL) {
-        method = get_method(env, jlrM(env), "getName", "()Ljava/lang/String;");
+        method = get_method(env, jlM(env), "getName", "()Ljava/lang/String;");
     }
     jstr = (jstring)JNI_ENV_PTR(env)->CallObjectMethod(JNI_ENV_ARG(env, module), method);
     if (jstr != NULL) {
--- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -151,8 +151,9 @@
         if (id >= Utils.COMPILE_THE_WORLD_START_AT) {
             try {
                 Class<?> aClass = loader.loadClass(name);
-                if (name != "sun.reflect.misc.Trampoline"
-                        && name != "sun.tools.jconsole.OutputViewer") { // workaround for JDK-8159155
+                if (!"sun.reflect.misc.Trampoline".equals(name)
+                        // workaround for JDK-8159155
+                        && !"sun.tools.jconsole.OutputViewer".equals(name)) {
                     UNSAFE.ensureClassInitialized(aClass);
                 }
                 CompileTheWorld.OUT.printf("[%d]\t%s%n", id, name);
--- a/jaxp/.hgtags	Tue Apr 18 20:17:22 2017 -0700
+++ b/jaxp/.hgtags	Wed Apr 19 03:21:41 2017 +0000
@@ -408,3 +408,4 @@
 d02b6fbcab06c59a5f5a4a6736bd4ec6d2567855 jdk-9+162
 92a38c75cd277d8b11f4382511a62087044659a1 jdk-9+163
 6dc790a4e8310c86712cfdf7561a9820818546e6 jdk-9+164
+55419603989707ec50c84bb379bbdc1adeec3ab2 jdk-9+165
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Constants.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Constants.java	Wed Apr 19 03:21:41 2017 +0000
@@ -99,7 +99,7 @@
         = com.sun.org.apache.bcel.internal.Constants.ACC_STATIC;
 
     public static final String MODULE_SIG
-        = "Ljava/lang/reflect/Module;";
+        = "Ljava/lang/Module;";
     public static final String CLASS_SIG
         = "Ljava/lang/Class;";
     public static final String STRING_SIG
@@ -255,7 +255,7 @@
     public static final String CLASS_CLASS
         = "java.lang.Class";
     public static final String MODULE_CLASS
-        = "java.lang.reflect.Module";
+        = "java.lang.Module";
     public static final String STRING_CLASS
         = "java.lang.String";
     public static final String OBJECT_CLASS
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java	Wed Apr 19 03:21:41 2017 +0000
@@ -43,8 +43,6 @@
 import java.lang.module.ModuleFinder;
 import java.lang.module.ModuleReference;
 import java.lang.module.ModuleReader;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.security.AccessController;
 import java.security.CodeSigner;
 import java.security.CodeSource;
@@ -435,13 +433,13 @@
             }
         };
 
-        Layer bootLayer = Layer.boot();
+        ModuleLayer bootLayer = ModuleLayer.boot();
 
         Configuration cf = bootLayer.configuration()
                 .resolve(finder, ModuleFinder.of(), Set.of(mn));
 
-        PrivilegedAction<Layer> pa = () -> bootLayer.defineModules(cf, name -> loader);
-        Layer layer = AccessController.doPrivileged(pa);
+        PrivilegedAction<ModuleLayer> pa = () -> bootLayer.defineModules(cf, name -> loader);
+        ModuleLayer layer = AccessController.doPrivileged(pa);
 
         Module m = layer.findModule(mn).get();
         assert m.getLayer() == layer;
--- a/jaxp/test/TEST.ROOT	Tue Apr 18 20:17:22 2017 -0700
+++ b/jaxp/test/TEST.ROOT	Wed Apr 19 03:21:41 2017 +0000
@@ -23,7 +23,7 @@
 groups=TEST.groups
 
 # Minimum jtreg version
-requiredVersion=4.2 b04
+requiredVersion=4.2 b07
 
 # Use new module options
 useNewOptions=true
--- a/jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/JDKToolLauncher.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/JDKToolLauncher.java	Wed Apr 19 03:21:41 2017 +0000
@@ -24,7 +24,6 @@
 package jdk.testlibrary;
 
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 
 /**
@@ -60,7 +59,6 @@
         } else {
             executable = JDKToolFinder.getTestJDKTool(tool);
         }
-        vmArgs.addAll(Arrays.asList(ProcessTools.getPlatformSpecificVMArgs()));
     }
 
     /**
--- a/jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/ProcessTools.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/ProcessTools.java	Wed Apr 19 03:21:41 2017 +0000
@@ -260,31 +260,13 @@
     }
 
     /**
-     * Get platform specific VM arguments (e.g. -d64 on 64bit Solaris)
-     *
-     * @return String[] with platform specific arguments, empty if there are
-     *         none
-     */
-    public static String[] getPlatformSpecificVMArgs() {
-        String osName = System.getProperty("os.name");
-        String dataModel = System.getProperty("sun.arch.data.model");
-
-        if (osName.equals("SunOS") && dataModel.equals("64")) {
-            return new String[] { "-d64" };
-        }
-
-        return new String[] {};
-    }
-
-    /**
      * Create ProcessBuilder using the java launcher from the jdk to be tested,
      * and with any platform specific arguments prepended.
      *
      * @param command Arguments to pass to the java command.
      * @return The ProcessBuilder instance representing the java command.
      */
-    public static ProcessBuilder createJavaProcessBuilder(String... command)
-            throws Exception {
+    public static ProcessBuilder createJavaProcessBuilder(String... command) {
         return createJavaProcessBuilder(false, command);
     }
 
@@ -297,12 +279,11 @@
      * @param command Arguments to pass to the java command.
      * @return The ProcessBuilder instance representing the java command.
      */
-    public static ProcessBuilder createJavaProcessBuilder(boolean addTestVmAndJavaOptions, String... command) throws Exception {
+    public static ProcessBuilder createJavaProcessBuilder(boolean addTestVmAndJavaOptions, String... command) {
         String javapath = JDKToolFinder.getJDKTool("java");
 
         ArrayList<String> args = new ArrayList<>();
         args.add(javapath);
-        Collections.addAll(args, getPlatformSpecificVMArgs());
 
         if (addTestVmAndJavaOptions) {
             // -cp is needed to make sure the same classpath is used whether the test is
--- a/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/DefaultFactoryWrapperTest.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/DefaultFactoryWrapperTest.java	Wed Apr 19 03:21:41 2017 +0000
@@ -27,8 +27,6 @@
 
 import java.io.StringReader;
 import java.io.StringWriter;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 
 import javax.xml.datatype.DatatypeFactory;
 import javax.xml.parsers.DocumentBuilderFactory;
@@ -52,7 +50,7 @@
  * @summary test customized provider wraps the built-in system-default implementation of JAXP factories
  */
 public class DefaultFactoryWrapperTest {
-    private static final Module XML_MODULE = Layer.boot().findModule("java.xml").get();
+    private static final Module XML_MODULE = ModuleLayer.boot().findModule("java.xml").get();
 
     private static final String PROVIDER_PACKAGE = "xwp";
 
--- a/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/LayerModularXMLParserTest.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/LayerModularXMLParserTest.java	Wed Apr 19 03:21:41 2017 +0000
@@ -29,9 +29,7 @@
 import java.lang.System;
 import java.lang.module.Configuration;
 import java.lang.module.ModuleFinder;
-import java.lang.reflect.Layer;
 import java.lang.reflect.Method;
-import java.lang.reflect.Module;
 import java.nio.file.Paths;
 import java.nio.file.Path;
 import java.util.Collections;
@@ -95,23 +93,23 @@
      */
     public void testOneLayer() throws Exception {
         ModuleFinder finder1 = ModuleFinder.of(MOD_DIR1);
-        Configuration cf1 = Layer.boot().configuration()
+        Configuration cf1 = ModuleLayer.boot().configuration()
                 .resolveAndBind(finder1, ModuleFinder.of(), Set.of("test"));
         ClassLoader scl = ClassLoader.getSystemClassLoader();
-        Layer layer1 = Layer.boot().defineModulesWithManyLoaders(cf1, scl);
+        ModuleLayer layer1 = ModuleLayer.boot().defineModulesWithManyLoaders(cf1, scl);
         ClassLoader cl1 = layer1.findLoader("test");
 
         Method m = cl1.loadClass("test.XMLFactoryHelper").getMethod("instantiateXMLService", String.class);
         for (String service : services1) {
             Object o = m.invoke(null, service);
-            Layer providerLayer = o.getClass().getModule().getLayer();
+            ModuleLayer providerLayer = o.getClass().getModule().getLayer();
             assertSame(providerLayer, layer1);
         }
 
         for (String service : services2) {
             Object o = m.invoke(null, service);
-            Layer providerLayer = o.getClass().getModule().getLayer();
-            assertSame(providerLayer, Layer.boot());
+            ModuleLayer providerLayer = o.getClass().getModule().getLayer();
+            assertSame(providerLayer, ModuleLayer.boot());
         }
 
     }
@@ -125,26 +123,26 @@
      */
     public void testTwoLayer() throws Exception {
         ModuleFinder finder1 = ModuleFinder.of(MOD_DIR1);
-        Configuration cf1 = Layer.boot().configuration()
+        Configuration cf1 = ModuleLayer.boot().configuration()
                 .resolveAndBind(finder1, ModuleFinder.of(), Set.of("test"));
         ClassLoader scl = ClassLoader.getSystemClassLoader();
-        Layer layer1 = Layer.boot().defineModulesWithManyLoaders(cf1, scl);
+        ModuleLayer layer1 = ModuleLayer.boot().defineModulesWithManyLoaders(cf1, scl);
 
         ModuleFinder finder2 = ModuleFinder.of(MOD_DIR2);
         Configuration cf2 = cf1.resolveAndBind(finder2, ModuleFinder.of(), Set.of("test"));
-        Layer layer2 = layer1.defineModulesWithOneLoader(cf2, layer1.findLoader("test"));
+        ModuleLayer layer2 = layer1.defineModulesWithOneLoader(cf2, layer1.findLoader("test"));
         ClassLoader cl2 = layer2.findLoader("test");
 
         Method m = cl2.loadClass("test.XMLFactoryHelper").getMethod("instantiateXMLService", String.class);
         for (String service : services1) {
             Object o = m.invoke(null, service);
-            Layer providerLayer = o.getClass().getModule().getLayer();
+            ModuleLayer providerLayer = o.getClass().getModule().getLayer();
             assertSame(providerLayer, layer1);
         }
 
         for (String service : services2) {
             Object o = m.invoke(null, service);
-            Layer providerLayer = o.getClass().getModule().getLayer();
+            ModuleLayer providerLayer = o.getClass().getModule().getLayer();
             assertSame(providerLayer, layer2);
         }
 
@@ -159,26 +157,26 @@
      */
     public void testTwoLayerWithDuplicate() throws Exception {
         ModuleFinder finder1 = ModuleFinder.of(MOD_DIR1, MOD_DIR2);
-        Configuration cf1 = Layer.boot().configuration()
+        Configuration cf1 = ModuleLayer.boot().configuration()
                 .resolveAndBind(finder1, ModuleFinder.of(), Set.of("test"));
         ClassLoader scl = ClassLoader.getSystemClassLoader();
-        Layer layer1 = Layer.boot().defineModulesWithManyLoaders(cf1, scl);
+        ModuleLayer layer1 = ModuleLayer.boot().defineModulesWithManyLoaders(cf1, scl);
 
         ModuleFinder finder2 = ModuleFinder.of(MOD_DIR2);
         Configuration cf2 = cf1.resolveAndBind(finder2, ModuleFinder.of(), Set.of("test"));
-        Layer layer2 = layer1.defineModulesWithOneLoader(cf2, layer1.findLoader("test"));
+        ModuleLayer layer2 = layer1.defineModulesWithOneLoader(cf2, layer1.findLoader("test"));
         ClassLoader cl2 = layer2.findLoader("test");
 
         Method m = cl2.loadClass("test.XMLFactoryHelper").getMethod("instantiateXMLService", String.class);
         for (String service : services1) {
             Object o = m.invoke(null, service);
-            Layer providerLayer = o.getClass().getModule().getLayer();
+            ModuleLayer providerLayer = o.getClass().getModule().getLayer();
             assertSame(providerLayer, layer1);
         }
 
         for (String service : services2) {
             Object o = m.invoke(null, service);
-            Layer providerLayer = o.getClass().getModule().getLayer();
+            ModuleLayer providerLayer = o.getClass().getModule().getLayer();
             assertSame(providerLayer, layer2);
         }
 
--- a/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/src/unnamed/Main.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/src/unnamed/Main.java	Wed Apr 19 03:21:41 2017 +0000
@@ -24,8 +24,6 @@
 import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
 
 import java.lang.module.ModuleDescriptor.Provides;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Set;
@@ -38,7 +36,7 @@
      * @param args, the names of provider modules, which have been loaded
      */
     public static void main(String[] args) throws Exception {
-        Module xml = Layer.boot().findModule("java.xml").get();
+        Module xml = ModuleLayer.boot().findModule("java.xml").get();
 
         Set<String> allServices = new HashSet<>(Arrays.asList(expectedAllServices));
         if (!allServices.equals(xml.getDescriptor().uses()))
@@ -46,7 +44,7 @@
                     + xml.getDescriptor().uses());
 
         long violationCount = Stream.of(args)
-                .map(xmlProviderName -> Layer.boot().findModule(xmlProviderName).get())
+                .map(xmlProviderName -> ModuleLayer.boot().findModule(xmlProviderName).get())
                 .mapToLong(
                         // services provided by the implementation in provider module
                         provider -> provider.getDescriptor().provides().stream()
--- a/jaxws/.hgtags	Tue Apr 18 20:17:22 2017 -0700
+++ b/jaxws/.hgtags	Wed Apr 19 03:21:41 2017 +0000
@@ -411,3 +411,4 @@
 b8aebe5292f23689f97cb8e66a9f327834dd43e6 jdk-9+162
 3890f96e8995be8c84f330d1f65269b03ac36b24 jdk-9+163
 1a52de2da827459e866fd736f9e9c62eb2ecd6bb jdk-9+164
+a987401bac0d528475e57732c9d5d93f4405804c jdk-9+165
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/addressing/EPRSDDocumentFilter.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/addressing/EPRSDDocumentFilter.java	Wed Apr 19 03:21:41 2017 +0000
@@ -26,6 +26,7 @@
 package com.sun.xml.internal.ws.addressing;
 
 import com.sun.xml.internal.ws.api.server.*;
+import com.sun.xml.internal.ws.api.server.Module;
 import com.sun.xml.internal.ws.api.addressing.WSEndpointReference;
 import com.sun.xml.internal.ws.api.addressing.AddressingVersion;
 import com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory;
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/server/SDDocumentSource.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/server/SDDocumentSource.java	Wed Apr 19 03:21:41 2017 +0000
@@ -155,12 +155,10 @@
             }
 
             private InputStream inputStream() throws IOException {
-                java.lang.reflect.Module module = resolvingClass.getModule();
-                if (module != null) {
-                    InputStream stream = module.getResourceAsStream(path);
-                    if (stream != null) {
-                        return stream;
-                    }
+                java.lang.Module module = resolvingClass.getModule();
+                InputStream stream = module.getResourceAsStream(path);
+                if (stream != null) {
+                    return stream;
                 }
                 throw new ServerRtException("cannot.load.wsdl", path);
             }
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/HandlerAnnotationProcessor.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/HandlerAnnotationProcessor.java	Wed Apr 19 03:21:41 2017 +0000
@@ -234,17 +234,15 @@
     }
 
     private static InputStream moduleResource(Class resolvingClass, String name) {
-        java.lang.reflect.Module module = resolvingClass.getModule();
-        if (module != null) {
-            try {
-                InputStream stream = module.getResourceAsStream(name);
-                if (stream != null) {
-                    return stream;
-                }
-            } catch(IOException e) {
-                throw new UtilException("util.failed.to.find.handlerchain.file",
-                        resolvingClass.getName(), name);
+        Module module = resolvingClass.getModule();
+        try {
+            InputStream stream = module.getResourceAsStream(name);
+            if (stream != null) {
+                return stream;
             }
+        } catch(IOException e) {
+            throw new UtilException("util.failed.to.find.handlerchain.file",
+                    resolvingClass.getName(), name);
         }
         return null;
     }
--- a/jaxws/src/jdk.xml.bind/share/legal/relaxngdatatype.md	Tue Apr 18 20:17:22 2017 -0700
+++ b/jaxws/src/jdk.xml.bind/share/legal/relaxngdatatype.md	Wed Apr 19 03:21:41 2017 +0000
@@ -3,7 +3,7 @@
 ### RelaxNG Datatype License
 <pre>
 
-Copyright (c) 2001, Thai Open Source Software Center Ltd, Sun Microsystems.
+Copyright (c) 2005, 2010 Thai Open Source Software Center Ltd
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
--- a/jdk/.hgtags	Tue Apr 18 20:17:22 2017 -0700
+++ b/jdk/.hgtags	Wed Apr 19 03:21:41 2017 +0000
@@ -408,3 +408,4 @@
 f6bf027e88e9a4dd19f721001a7af00157af42c4 jdk-9+162
 50171f8c47961710cbf87aead6f03fa431d8d240 jdk-9+163
 6dea581453d7c0e767e3169cfec8b423a381e71d jdk-9+164
+a7942c3b1e59495dbf51dc7c41aab355fcd253d7 jdk-9+165
--- a/jdk/make/data/tzdata/VERSION	Tue Apr 18 20:17:22 2017 -0700
+++ b/jdk/make/data/tzdata/VERSION	Wed Apr 19 03:21:41 2017 +0000
@@ -21,4 +21,4 @@
 # or visit www.oracle.com if you need additional information or have any
 # questions.
 #
-tzdata2017a
+tzdata2017b
--- a/jdk/make/data/tzdata/africa	Tue Apr 18 20:17:22 2017 -0700
+++ b/jdk/make/data/tzdata/africa	Wed Apr 19 03:21:41 2017 +0000
@@ -443,18 +443,25 @@
 # See Africa/Johannesburg.
 
 # Liberia
-# From Paul Eggert (2006-03-22):
-# In 1972 Liberia was the last country to switch
-# from a UTC offset that was not a multiple of 15 or 20 minutes.
-# Howse reports that it was in honor of their president's birthday.
-# Shank & Pottenger report the date as May 1, whereas Howse reports Jan;
-# go with Shanks & Pottenger.
-# For Liberia before 1972, Shanks & Pottenger report -0:44, whereas Howse and
-# Whitman each report -0:44:30; go with the more precise figure.
+#
+# From Paul Eggert (2017-03-02):
+#
+# The Nautical Almanac for the Year 1970, p 264, is the source for -0:44:30.
+#
+# In 1972 Liberia was the last country to switch from a UTC offset
+# that was not a multiple of 15 or 20 minutes.  The 1972 change was on
+# 1972-01-07, according to an entry dated 1972-01-04 on p 330 of:
+# Presidential Papers: First year of the administration of
+# President William R. Tolbert, Jr., July 23, 1971-July 31, 1972.
+# Monrovia: Executive Mansion.
+#
+# Use the abbreviation "MMT" before 1972, as the more-accurate numeric
+# abbreviation "-004430" would be one byte over the POSIX limit.
+#
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Africa/Monrovia	-0:43:08 -	LMT	1882
 			-0:43:08 -	MMT	1919 Mar # Monrovia Mean Time
-			-0:44:30 -	-004430	1972 May
+			-0:44:30 -	MMT	1972 Jan 7 # approximately MMT
 			 0:00	-	GMT
 
 ###############################################################################
--- a/jdk/make/data/tzdata/iso3166.tab	Tue Apr 18 20:17:22 2017 -0700
+++ b/jdk/make/data/tzdata/iso3166.tab	Wed Apr 19 03:21:41 2017 +0000
@@ -32,8 +32,8 @@
 # All text uses UTF-8 encoding.  The columns of the table are as follows:
 #
 # 1.  ISO 3166-1 alpha-2 country code, current as of
-#     ISO 3166-1 Newsletter VI-16 (2013-07-11).  See: Updates on ISO 3166
-#   http://www.iso.org/iso/home/standards/country_codes/updates_on_iso_3166.htm
+#     ISO 3166-1 N905 (2016-11-15).  See: Updates on ISO 3166-1
+#     http://isotc.iso.org/livelink/livelink/Open/16944257
 # 2.  The usual English name for the coded region,
 #     chosen so that alphabetic sorting of subsets produces helpful lists.
 #     This is not the same as the English name in the ISO 3166 tables.
--- a/jdk/make/data/tzdata/northamerica	Tue Apr 18 20:17:22 2017 -0700
+++ b/jdk/make/data/tzdata/northamerica	Wed Apr 19 03:21:41 2017 +0000
@@ -3162,6 +3162,12 @@
 # http://www.vantbefinfo.com/changement-dheure-pas-pour-haiti/
 # http://news.anmwe.com/haiti-lheure-nationale-ne-sera-ni-avancee-ni-reculee-cette-annee/
 
+# From Steffen Thorsen (2017-03-12):
+# We have received 4 mails from different people telling that Haiti
+# has started DST again today, and this source seems to confirm that,
+# I have not been able to find a more authoritative source:
+# https://www.haitilibre.com/en/news-20319-haiti-notices-time-change-in-haiti.html
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Haiti	1983	only	-	May	8	0:00	1:00	D
 Rule	Haiti	1984	1987	-	Apr	lastSun	0:00	1:00	D
@@ -3174,6 +3180,8 @@
 Rule	Haiti	2005	2006	-	Oct	lastSun	0:00	0	S
 Rule	Haiti	2012	2015	-	Mar	Sun>=8	2:00	1:00	D
 Rule	Haiti	2012	2015	-	Nov	Sun>=1	2:00	0	S
+Rule	Haiti	2017	max	-	Mar	Sun>=8	2:00	1:00	D
+Rule	Haiti	2017	max	-	Nov	Sun>=1	2:00	0	S
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone America/Port-au-Prince -4:49:20 -	LMT	1890
 			-4:49	-	PPMT	1917 Jan 24 12:00 # P-a-P MT
--- a/jdk/make/mapfiles/libjava/mapfile-vers	Tue Apr 18 20:17:22 2017 -0700
+++ b/jdk/make/mapfiles/libjava/mapfile-vers	Wed Apr 19 03:21:41 2017 +0000
@@ -273,12 +273,12 @@
                 Java_jdk_internal_misc_VM_getRuntimeArguments;
                 Java_jdk_internal_misc_VM_initialize;
 
-                Java_java_lang_reflect_Module_defineModule0;
-                Java_java_lang_reflect_Module_addReads0;
-                Java_java_lang_reflect_Module_addExports0;
-                Java_java_lang_reflect_Module_addExportsToAll0;
-                Java_java_lang_reflect_Module_addExportsToAllUnnamed0;
-                Java_java_lang_reflect_Module_addPackage0;
+                Java_java_lang_Module_defineModule0;
+                Java_java_lang_Module_addReads0;
+                Java_java_lang_Module_addExports0;
+                Java_java_lang_Module_addExportsToAll0;
+                Java_java_lang_Module_addExportsToAllUnnamed0;
+                Java_java_lang_Module_addPackage0;
 
 		Java_jdk_internal_loader_BootLoader_getSystemPackageLocation;
 		Java_jdk_internal_loader_BootLoader_getSystemPackageNames;
--- a/jdk/src/java.base/macosx/classes/java/net/DefaultInterface.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/jdk/src/java.base/macosx/classes/java/net/DefaultInterface.java	Wed Apr 19 03:21:41 2017 +0000
@@ -50,10 +50,11 @@
     }
 
     /**
-     * Choose a default interface. This method returns an interface that is
-     * both "up" and supports multicast. This method choses an interface in
+     * Choose a default interface. This method returns the first interface that
+     * is both "up" and supports multicast. This method chooses an interface in
      * order of preference:
      * 1. neither loopback nor point to point
+     *    ( prefer interfaces with dual IP support )
      * 2. point to point
      * 3. loopback
      *
@@ -66,32 +67,56 @@
         try {
            nifs = NetworkInterface.getNetworkInterfaces();
         } catch (IOException ignore) {
-            // unable to enumate network interfaces
+            // unable to enumerate network interfaces
             return null;
         }
 
+        NetworkInterface preferred = null;
         NetworkInterface ppp = null;
         NetworkInterface loopback = null;
 
         while (nifs.hasMoreElements()) {
             NetworkInterface ni = nifs.nextElement();
             try {
-                if (ni.isUp() && ni.supportsMulticast()) {
-                    boolean isLoopback = ni.isLoopback();
-                    boolean isPPP = ni.isPointToPoint();
-                    if (!isLoopback && !isPPP) {
-                        // found an interface that is not the loopback or a
-                        // point-to-point interface
+                if (!ni.isUp() || !ni.supportsMulticast())
+                    continue;
+
+                boolean ip4 = false, ip6 = false;
+                Enumeration<InetAddress> addrs = ni.getInetAddresses();
+                while (addrs.hasMoreElements()) {
+                    InetAddress addr = addrs.nextElement();
+                    if (!addr.isAnyLocalAddress()) {
+                        if (addr instanceof Inet4Address) {
+                            ip4 = true;
+                        } else if (addr instanceof Inet6Address) {
+                            ip6 = true;
+                        }
+                    }
+                }
+
+                boolean isLoopback = ni.isLoopback();
+                boolean isPPP = ni.isPointToPoint();
+                if (!isLoopback && !isPPP) {
+                    // found an interface that is not the loopback or a
+                    // point-to-point interface
+                    if (preferred == null) {
+                        preferred = ni;
+                    } else if (ip4 && ip6){
                         return ni;
                     }
-                    if (ppp == null && isPPP)
-                        ppp = ni;
-                    if (loopback == null && isLoopback)
-                        loopback = ni;
                 }
+                if (ppp == null && isPPP)
+                    ppp = ni;
+                if (loopback == null && isLoopback)
+                    loopback = ni;
+
             } catch (IOException skip) { }
         }
 
-        return (ppp != null) ? ppp : loopback;
+        if (preferred != null) {
+            return preferred;
+        } else {
+            return (ppp != null) ? ppp : loopback;
+        }
     }
 }
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/DESKey.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/DESKey.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -149,6 +149,7 @@
      * Ensures that the bytes of this key are
      * set to zero when there are no more references to it.
      */
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         try {
             if (this.key != null) {
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/DESedeKey.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/DESedeKey.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -150,6 +150,7 @@
      * Ensures that the bytes of this key are
      * set to zero when there are no more references to it.
      */
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         try {
             if (this.key != null) {
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBEKey.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBEKey.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -145,6 +145,7 @@
      * Ensures that the password bytes of this key are
      * set to zero when there are no more references to it.
      */
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         try {
             if (this.key != null) {
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBKDF2KeyImpl.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBKDF2KeyImpl.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -267,6 +267,7 @@
      * Ensures that the password bytes of this key are
      * erased when there are no more references to it.
      */
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         try {
             if (this.passwd != null) {
--- a/jdk/src/java.base/share/classes/java/io/BufferedReader.java	Tue Apr 18 20:17:22 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/io/BufferedReader.java	Wed Apr 19 03:21:41 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -297,14 +297,15 @@
 
     /**
      * Reads a line of text.  A line is considered to be terminated by any one
-     * of a line feed ('\n'), a carriage return ('\r'), or a carriage return
-     * followed immediately by a linefeed.
+     * of a line feed ('\n'), a carriage return ('\r'), a carriage return
+     * followed immediately by a line feed, or by reaching the end-of-file
+     * (EOF).
      *
      * @param      ignoreLF  If true, the next '\n' will be skipped
      *
      * @return     A String containing the contents of the line, not including
      *             any line-termination characters, or null if the end of the
-     *             stream has been reached
+     *             stream has been reached without reading any characters
      *
      * @see        java.io.LineNumberReader#readLine()
      *
@@ -375,12 +376,13 @@
 
     /**
      * Reads a line of text.  A line is considered to be terminated by any one
-     * of a line feed ('\n'), a carriage return ('\r'), or a carriage return
-     * followed immediately by a linefeed.
+     * of a line feed ('\n'), a carriage return ('\r'), a carriage return
+     * followed immediately by a line feed, or by reaching the end-of-file
+     * (EOF).
      *
      * @return     A String containing the contents of the line, not including
      *             any line-termination characters, or null if the end of the
-     *             stream has been reached
+     *             stream has been reached without reading any characters
      *
      * @exception  IOException  If an I/O error occurs
      *
--- a/jdk/src/java.base/share/class