Merge
This commit is contained in:
commit
289ebabe62
.hgtags-top-repo
.jcheck
common/doc
hotspot
.hgtags
.jcheck
make
src
cpu
aarch64/vm
arm/vm
x86/vm
jdk.aot/share/classes
jdk.internal.vm.ci/share/classes
jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot
jdk.vm.ci.meta/src/jdk/vm/ci/meta
jdk.internal.vm.compiler/share/classes
share/vm
c1
classfile
code
compiler
jvmci
prims
runtime
services
test
compiler
c1
jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test
runtime/modules
serviceability/jvmti
GetNamedModule/MyPackage
IsModifiableModule
testlibrary_tests
make
test/lib
@ -430,3 +430,5 @@ b94be69cbb1d2943b886bf2d458745756df146e4 jdk-10+9
|
||||
88d7fd969e7df0e07a53b201cfd29393ca33ede9 jdk-9+173
|
||||
5466f409346e0446ee9a6daeb7f5d75c8fc76823 jdk-9+174
|
||||
8d4ed1e06fe184c9cb08c5b708e7d6f5c066644f jdk-10+12
|
||||
8f7227c6012b0051ea4e0bcee040c627bf699b88 jdk-9+175
|
||||
d67a3f1f057f7e31e12f33ebe3667cb73d252268 jdk-10+13
|
||||
|
@ -1 +1,2 @@
|
||||
project=jdk10
|
||||
bugids=dup
|
||||
|
@ -18,14 +18,16 @@
|
||||
</header>
|
||||
<nav id="TOC">
|
||||
<ul>
|
||||
<li><a href="#using-the-run-test-framework">Using the run-test framework</a></li>
|
||||
<li><a href="#using-the-run-test-framework">Using the run-test framework</a><ul>
|
||||
<li><a href="#configuration">Configuration</a></li>
|
||||
</ul></li>
|
||||
<li><a href="#test-selection">Test selection</a><ul>
|
||||
<li><a href="#jtreg">JTreg</a></li>
|
||||
<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="#jtreg-keywords">JTReg keywords</a></li>
|
||||
<li><a href="#gtest-keywords">Gtest keywords</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
@ -41,14 +43,17 @@ $ make run-test-only TEST="gtest:LogTagSet gtest:LogTagSetDescriptions"
|
||||
$ 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"
|
||||
$ make exploded-run-test TEST=hotspot_tier1</code></pre>
|
||||
|
||||
<h3 id="configuration">Configuration</h3>
|
||||
<p>To be able to run JTReg tests, <code>configure</code> needs to know where to find the JTReg test framework. If it is not picked up automatically by configure, use the <code>--with-jtreg=<path to jtreg home></code> option to point to the JTReg framework. Note that this option should point to the JTReg home, i.e. the top directory, containing <code>lib/jtreg.jar</code> etc. (An alternative is to set the <code>JT_HOME</code> environment variable to point to the JTReg home before running <code>configure</code>.)</p>
|
||||
<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="tier1"</code>, but the latter is more tab-completion friendly. For more complex test runs, the <code>run-test TEST="x"</code> solution needs to be used.</p>
|
||||
<p>For some common top-level tests, direct make targets have been generated. This includes all JTReg test groups, the hotspot gtest, and custom tests (if present). This means that <code>make run-test-tier1</code> is equivalent to <code>make run-test TEST="tier1"</code>, but the latter is more tab-completion friendly. For more complex test runs, the <code>run-test TEST="x"</code> solution needs to be used.</p>
|
||||
<p>The test specifications given in <code>TEST</code> is parsed into fully qualified test descriptors, which clearly and unambigously show which tests will be run. As an example, <code>:tier1</code> will expand to <code>jtreg: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>
|
||||
<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>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>
|
||||
@ -67,15 +72,15 @@ 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>>> ... <<</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>All tests have their result stored in <code>build/$BUILD/test-results/$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="JOBS=1;TIMEOUT=8"</code> will set the JTreg concurrency level to 1 and the timeout factor to 8. This is equivalent to setting <code>JTREG_JOBS=1 JTREG_TIMEOUT=8</code>, but using the keyword format means that the <code>JTREG</code> variable is parsed and verified for correctness, so <code>JTREG="TMIEOUT=8"</code> would give an error, while <code>JTREG_TMIEOUT=8</code> would just pass unnoticed.</p>
|
||||
<p>These variables use a keyword=value approach to allow multiple values to be set. So, for instance, <code>JTREG="JOBS=1;TIMEOUT=8"</code> will set the JTReg concurrency level to 1 and the timeout factor to 8. This is equivalent to setting <code>JTREG_JOBS=1 JTREG_TIMEOUT=8</code>, but using the keyword format means that the <code>JTREG</code> variable is parsed and verified for correctness, so <code>JTREG="TMIEOUT=8"</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="...;..."</code>. This will also make sure spaces are preserved, as in <code>JTREG="VM_OTIONS=-XshowSettings -Xlog:gc+ref=debug"</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>
|
||||
<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>
|
||||
@ -96,15 +101,15 @@ TEST FAILURE</code></pre>
|
||||
<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>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="OPTIONS=--help all"</code> to see all available JTreg options.</p>
|
||||
<p>Additional options to the JTReg test framework.</p>
|
||||
<p>Use <code>JTREG="OPTIONS=--help all"</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>
|
||||
<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>
|
||||
<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>
|
||||
|
@ -22,6 +22,15 @@ Some example command-lines:
|
||||
$ make run-test TEST="jtreg:hotspot/test:hotspot_gc hotspot/test/native_sanity/JniVersion.java"
|
||||
$ make exploded-run-test TEST=hotspot_tier1
|
||||
|
||||
### Configuration
|
||||
|
||||
To be able to run JTReg tests, `configure` needs to know where to find the
|
||||
JTReg test framework. If it is not picked up automatically by configure, use
|
||||
the `--with-jtreg=<path to jtreg home>` option to point to the JTReg framework.
|
||||
Note that this option should point to the JTReg home, i.e. the top directory,
|
||||
containing `lib/jtreg.jar` etc. (An alternative is to set the `JT_HOME`
|
||||
environment variable to point to the JTReg home before running `configure`.)
|
||||
|
||||
## Test selection
|
||||
|
||||
All functionality is available using the run-test make target. In this use
|
||||
@ -30,7 +39,7 @@ 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
|
||||
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.
|
||||
@ -42,9 +51,9 @@ 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
|
||||
|
||||
JTreg test groups can be specified either without a test root, e.g. `:tier1`
|
||||
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`.
|
||||
|
||||
@ -52,10 +61,10 @@ 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
|
||||
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.
|
||||
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
|
||||
@ -99,7 +108,7 @@ 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`,
|
||||
All tests have their result stored in `build/$BUILD/test-results/$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
|
||||
@ -115,7 +124,7 @@ 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
|
||||
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
|
||||
@ -136,7 +145,7 @@ proper quoting of command line arguments through.)
|
||||
As far as possible, the names of the keywords have been standardized between
|
||||
test suites.
|
||||
|
||||
### JTreg keywords
|
||||
### JTReg keywords
|
||||
|
||||
#### JOBS
|
||||
The test concurrency (`-concurrency`).
|
||||
@ -174,21 +183,21 @@ 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
|
||||
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.
|
||||
Additional options to the JTReg test framework.
|
||||
|
||||
Use `JTREG="OPTIONS=--help all"` to see all available JTreg options.
|
||||
Use `JTREG="OPTIONS=--help all"` to see all available JTReg options.
|
||||
|
||||
#### JAVA_OPTIONS
|
||||
Additional Java options to JTreg (`-javaoption`).
|
||||
Additional Java options to JTReg (`-javaoption`).
|
||||
|
||||
#### VM_OPTIONS
|
||||
Additional VM options to JTreg (`-vmoption`).
|
||||
Additional VM options to JTReg (`-vmoption`).
|
||||
|
||||
### Gtest keywords
|
||||
|
||||
|
@ -590,3 +590,5 @@ c6cd3ec8d46b034e57c86399380ffcf7f25706e4 jdk-10+10
|
||||
e64b1cb48d6e7703928a9d1da106fc27f8cb65fd jdk-9+173
|
||||
944791f8160185bffa13fbb821fc09b6198f1f25 jdk-9+174
|
||||
070aa7a2eb14c4645f7eb31384cba0a2ba72a4b5 jdk-10+12
|
||||
8f04d457168b9f1f4a1b2c37f49e0513ca9d33a7 jdk-9+175
|
||||
a9da03357f190807591177fe9846d6e68ad64fc0 jdk-10+13
|
||||
|
@ -1 +1,2 @@
|
||||
project=jdk10
|
||||
bugids=dup
|
||||
|
@ -188,7 +188,6 @@ JVM_Yield
|
||||
JVM_AddModuleExports
|
||||
JVM_AddModuleExportsToAll
|
||||
JVM_AddModuleExportsToAllUnnamed
|
||||
JVM_AddModulePackage
|
||||
JVM_AddReadsModule
|
||||
JVM_DefineModule
|
||||
JVM_SetBootLoaderUnnamedModule
|
||||
|
@ -56,6 +56,7 @@ BUILD_HOTSPOT_JTREG_NATIVE_SRC := \
|
||||
$(HOTSPOT_TOPDIR)/test/compiler/floatingpoint/ \
|
||||
$(HOTSPOT_TOPDIR)/test/compiler/calls \
|
||||
$(HOTSPOT_TOPDIR)/test/serviceability/jvmti/GetNamedModule \
|
||||
$(HOTSPOT_TOPDIR)/test/serviceability/jvmti/IsModifiableModule \
|
||||
$(HOTSPOT_TOPDIR)/test/serviceability/jvmti/AddModuleReads \
|
||||
$(HOTSPOT_TOPDIR)/test/serviceability/jvmti/AddModuleExportsAndOpens \
|
||||
$(HOTSPOT_TOPDIR)/test/serviceability/jvmti/AddModuleUsesAndProvides \
|
||||
@ -85,6 +86,7 @@ ifeq ($(TOOLCHAIN_TYPE), solstudio)
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_liboverflow := -lc
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libSimpleClassFileLoadHook := -lc
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libGetNamedModuleTest := -lc
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libIsModifiableModuleTest := -lc
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libAddModuleReadsTest := -lc
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libAddModuleExportsAndOpensTest := -lc
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libAddModuleUsesAndProvidesTest := -lc
|
||||
|
@ -109,9 +109,15 @@ int AbstractInterpreter::size_activation(int max_stack,
|
||||
// for the callee's params we only need to account for the extra
|
||||
// locals.
|
||||
int size = overhead +
|
||||
(callee_locals - callee_params)*Interpreter::stackElementWords +
|
||||
(callee_locals - callee_params) +
|
||||
monitors * frame::interpreter_frame_monitor_size() +
|
||||
temps* Interpreter::stackElementWords + extra_args;
|
||||
// On the top frame, at all times SP <= ESP, and SP is
|
||||
// 16-aligned. We ensure this by adjusting SP on method
|
||||
// entry and re-entry to allow room for the maximum size of
|
||||
// the expression stack. When we call another method we bump
|
||||
// SP so that no stack space is wasted. So, only on the top
|
||||
// frame do we need to allow max_stack words.
|
||||
(is_top_frame ? max_stack : temps + extra_args);
|
||||
|
||||
// On AArch64 we always keep the stack pointer 16-aligned, so we
|
||||
// must round up here.
|
||||
|
@ -598,12 +598,12 @@ void LIRGenerator::do_ArithmeticOp_Int(ArithmeticOp* x) {
|
||||
} else {
|
||||
assert (x->op() == Bytecodes::_imul, "expect imul");
|
||||
if (right.is_constant()) {
|
||||
int c = right.get_jint_constant();
|
||||
if (! is_power_of_2(c) && ! is_power_of_2(c + 1) && ! is_power_of_2(c - 1)) {
|
||||
// Cannot use constant op.
|
||||
right.load_item();
|
||||
jint c = right.get_jint_constant();
|
||||
if (c > 0 && c < max_jint && (is_power_of_2(c) || is_power_of_2(c - 1) || is_power_of_2(c + 1))) {
|
||||
right_arg->dont_load_item();
|
||||
} else {
|
||||
right.dont_load_item();
|
||||
// Cannot use constant op.
|
||||
right_arg->load_item();
|
||||
}
|
||||
} else {
|
||||
right.load_item();
|
||||
|
@ -51,6 +51,11 @@ extern "C" void bad_compiled_vtable_index(JavaThread* thread,
|
||||
VtableStub* VtableStubs::create_vtable_stub(int vtable_index) {
|
||||
const int aarch64_code_length = VtableStub::pd_code_size_limit(true);
|
||||
VtableStub* s = new(aarch64_code_length) VtableStub(true, vtable_index);
|
||||
// Can be NULL if there is no free space in the code cache.
|
||||
if (s == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ResourceMark rm;
|
||||
CodeBuffer cb(s->entry_point(), aarch64_code_length);
|
||||
MacroAssembler* masm = new MacroAssembler(&cb);
|
||||
|
@ -923,8 +923,8 @@ void LIRGenerator::do_ArithmeticOp_Int(ArithmeticOp* x) {
|
||||
} else {
|
||||
left_arg->load_item();
|
||||
if (x->op() == Bytecodes::_imul && right_arg->is_constant()) {
|
||||
int c = right_arg->get_jint_constant();
|
||||
if (c > 0 && (is_power_of_2(c) || is_power_of_2(c - 1) || is_power_of_2(c + 1))) {
|
||||
jint c = right_arg->get_jint_constant();
|
||||
if (c > 0 && c < max_jint && (is_power_of_2(c) || is_power_of_2(c - 1) || is_power_of_2(c + 1))) {
|
||||
right_arg->dont_load_item();
|
||||
} else {
|
||||
right_arg->load_item();
|
||||
|
@ -234,8 +234,8 @@ void LIRGenerator::cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Opr bas
|
||||
}
|
||||
|
||||
|
||||
bool LIRGenerator::strength_reduce_multiply(LIR_Opr left, int c, LIR_Opr result, LIR_Opr tmp) {
|
||||
if (tmp->is_valid()) {
|
||||
bool LIRGenerator::strength_reduce_multiply(LIR_Opr left, jint c, LIR_Opr result, LIR_Opr tmp) {
|
||||
if (tmp->is_valid() && c > 0 && c < max_jint) {
|
||||
if (is_power_of_2(c + 1)) {
|
||||
__ move(left, tmp);
|
||||
__ shift_left(left, log2_intptr(c + 1), left);
|
||||
@ -603,8 +603,8 @@ void LIRGenerator::do_ArithmeticOp_Int(ArithmeticOp* x) {
|
||||
bool use_constant = false;
|
||||
bool use_tmp = false;
|
||||
if (right_arg->is_constant()) {
|
||||
int iconst = right_arg->get_jint_constant();
|
||||
if (iconst > 0) {
|
||||
jint iconst = right_arg->get_jint_constant();
|
||||
if (iconst > 0 && iconst < max_jint) {
|
||||
if (is_power_of_2(iconst)) {
|
||||
use_constant = true;
|
||||
} else if (is_power_of_2(iconst - 1) || is_power_of_2(iconst + 1)) {
|
||||
|
@ -23,8 +23,15 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Defines the Ahead-of-Time (AOT) compiler, <em>{@index jaotc jaotc tool}</em>,
|
||||
* for compiling Java classes into AOT library.
|
||||
*
|
||||
* @moduleGraph
|
||||
* @since 9
|
||||
*/
|
||||
module jdk.aot {
|
||||
requires jdk.management;
|
||||
requires jdk.internal.vm.ci;
|
||||
requires jdk.internal.vm.compiler;
|
||||
requires jdk.management;
|
||||
}
|
||||
|
@ -644,4 +644,9 @@ final class CompilerToVM {
|
||||
* {@link Long}
|
||||
*/
|
||||
native Object getFlagValue(String name);
|
||||
|
||||
/**
|
||||
* Gets the host class for {@code type}.
|
||||
*/
|
||||
native HotSpotResolvedObjectTypeImpl getHostClass(HotSpotResolvedObjectTypeImpl type);
|
||||
}
|
||||
|
@ -411,6 +411,14 @@ final class HotSpotResolvedObjectTypeImpl extends HotSpotResolvedJavaType implem
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResolvedJavaType getHostClass() {
|
||||
if (isArray()) {
|
||||
return null;
|
||||
}
|
||||
return compilerToVM().getHostClass(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isJavaLangObject() {
|
||||
return javaClass.equals(Object.class);
|
||||
|
@ -153,6 +153,11 @@ public final class HotSpotResolvedPrimitiveType extends HotSpotResolvedJavaType
|
||||
return other.equals(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResolvedJavaType getHostClass() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaKind getJavaKind() {
|
||||
return kind;
|
||||
|
7
hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ResolvedJavaType.java
7
hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ResolvedJavaType.java
@ -104,6 +104,13 @@ public interface ResolvedJavaType extends JavaType, ModifiersProvider, Annotated
|
||||
*/
|
||||
boolean isAssignableFrom(ResolvedJavaType other);
|
||||
|
||||
/**
|
||||
* Returns the {@link ResolvedJavaType} object representing the host class of this VM anonymous
|
||||
* class (as opposed to the unrelated concept specified by {@link Class#isAnonymousClass()}) or
|
||||
* {@code null} if this object does not represent a VM anonymous class.
|
||||
*/
|
||||
ResolvedJavaType getHostClass();
|
||||
|
||||
/**
|
||||
* Returns true if this type is exactly the type {@link java.lang.Object}.
|
||||
*/
|
||||
|
@ -26,11 +26,9 @@
|
||||
module jdk.internal.vm.compiler {
|
||||
requires java.instrument;
|
||||
requires java.management;
|
||||
requires jdk.management;
|
||||
requires jdk.internal.vm.ci;
|
||||
|
||||
// sun.misc.Unsafe is used
|
||||
requires jdk.unsupported;
|
||||
requires jdk.management;
|
||||
requires jdk.unsupported; // sun.misc.Unsafe is used
|
||||
|
||||
uses org.graalvm.compiler.code.DisassemblerProvider;
|
||||
uses org.graalvm.compiler.core.match.MatchStatementSet;
|
||||
|
@ -545,11 +545,11 @@ void LIRGenerator::arithmetic_op(Bytecodes::Code code, LIR_Opr result, LIR_Opr l
|
||||
|
||||
case Bytecodes::_imul:
|
||||
{
|
||||
bool did_strength_reduce = false;
|
||||
bool did_strength_reduce = false;
|
||||
|
||||
if (right->is_constant()) {
|
||||
int c = right->as_jint();
|
||||
if (is_power_of_2(c)) {
|
||||
jint c = right->as_jint();
|
||||
if (c > 0 && is_power_of_2(c)) {
|
||||
// do not need tmp here
|
||||
__ shift_left(left_op, exact_log2(c), result_op);
|
||||
did_strength_reduce = true;
|
||||
|
@ -313,7 +313,7 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure {
|
||||
// is_strictfp is only needed for mul and div (and only generates different code on i486)
|
||||
void arithmetic_op(Bytecodes::Code code, LIR_Opr result, LIR_Opr left, LIR_Opr right, bool is_strictfp, LIR_Opr tmp, CodeEmitInfo* info = NULL);
|
||||
// machine dependent. returns true if it emitted code for the multiply
|
||||
bool strength_reduce_multiply(LIR_Opr left, int constant, LIR_Opr result, LIR_Opr tmp);
|
||||
bool strength_reduce_multiply(LIR_Opr left, jint constant, LIR_Opr result, LIR_Opr tmp);
|
||||
|
||||
void store_stack_parameter (LIR_Opr opr, ByteSize offset_from_sp_in_bytes);
|
||||
|
||||
|
@ -722,74 +722,6 @@ jobject Modules::get_module(Symbol* package_name, Handle h_loader, TRAPS) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void Modules::add_module_package(jobject module, const char* package_name, TRAPS) {
|
||||
ResourceMark rm(THREAD);
|
||||
|
||||
if (module == NULL) {
|
||||
THROW_MSG(vmSymbols::java_lang_NullPointerException(),
|
||||
"module is null");
|
||||
}
|
||||
if (package_name == NULL) {
|
||||
THROW_MSG(vmSymbols::java_lang_NullPointerException(),
|
||||
"package is null");
|
||||
}
|
||||
ModuleEntry* module_entry = get_module_entry(module, CHECK);
|
||||
if (module_entry == NULL) {
|
||||
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
|
||||
"module is invalid");
|
||||
}
|
||||
if (!module_entry->is_named()) {
|
||||
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
|
||||
"module cannot be an unnamed module");
|
||||
}
|
||||
if (!verify_package_name(package_name)) {
|
||||
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
|
||||
err_msg("Invalid package name: %s", package_name));
|
||||
}
|
||||
|
||||
ClassLoaderData *loader_data = module_entry->loader_data();
|
||||
|
||||
// Only modules defined to either the boot or platform class loader, can define a "java/" package.
|
||||
if (!loader_data->is_the_null_class_loader_data() &&
|
||||
!loader_data->is_platform_class_loader_data() &&
|
||||
(strncmp(package_name, JAVAPKG, JAVAPKG_LEN) == 0 &&
|
||||
(package_name[JAVAPKG_LEN] == '/' || package_name[JAVAPKG_LEN] == '\0'))) {
|
||||
const char* class_loader_name = SystemDictionary::loader_name(loader_data);
|
||||
size_t pkg_len = strlen(package_name);
|
||||
char* pkg_name = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, pkg_len);
|
||||
strncpy(pkg_name, package_name, pkg_len);
|
||||
StringUtils::replace_no_expand(pkg_name, "/", ".");
|
||||
const char* msg_text1 = "Class loader (instance of): ";
|
||||
const char* msg_text2 = " tried to define prohibited package name: ";
|
||||
size_t len = strlen(msg_text1) + strlen(class_loader_name) + strlen(msg_text2) + pkg_len + 1;
|
||||
char* message = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, len);
|
||||
jio_snprintf(message, len, "%s%s%s%s", msg_text1, class_loader_name, msg_text2, pkg_name);
|
||||
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), message);
|
||||
}
|
||||
|
||||
log_debug(module)("add_module_package(): Adding package %s to module %s",
|
||||
package_name, module_entry->name()->as_C_string());
|
||||
|
||||
TempNewSymbol pkg_symbol = SymbolTable::new_symbol(package_name, CHECK);
|
||||
PackageEntryTable* package_table = loader_data->packages();
|
||||
assert(package_table != NULL, "Missing package_table");
|
||||
|
||||
PackageEntry* existing_pkg = NULL;
|
||||
{
|
||||
MutexLocker ml(Module_lock, THREAD);
|
||||
|
||||
// Check that the package does not exist in the class loader's package table.
|
||||
existing_pkg = package_table->lookup_only(pkg_symbol);
|
||||
if (existing_pkg == NULL) {
|
||||
PackageEntry* pkg = package_table->locked_create_entry_or_null(pkg_symbol, module_entry);
|
||||
assert(pkg != NULL, "Unable to create a module's package entry");
|
||||
}
|
||||
}
|
||||
if (existing_pkg != NULL) {
|
||||
throw_dup_pkg_exception(module_entry->name()->as_C_string(), existing_pkg, CHECK);
|
||||
}
|
||||
}
|
||||
|
||||
// Export package in module to all unnamed modules.
|
||||
void Modules::add_module_exports_to_all_unnamed(jobject module, const char* package_name, TRAPS) {
|
||||
if (module == NULL) {
|
||||
|
@ -113,14 +113,6 @@ public:
|
||||
// Returns NULL if package is invalid or not defined by loader.
|
||||
static jobject get_module(Symbol* package_name, Handle h_loader, TRAPS);
|
||||
|
||||
// This adds package to module.
|
||||
// It throws IllegalArgumentException if:
|
||||
// * Module is bad
|
||||
// * Module is unnamed
|
||||
// * Package is not syntactically correct
|
||||
// * Package is already defined for module's class loader.
|
||||
static void add_module_package(jobject module, const char* package, TRAPS);
|
||||
|
||||
// Marks the specified package as exported to all unnamed modules.
|
||||
// If either module or package is null then NullPointerException is thrown.
|
||||
// If module or package is bad, or module is unnamed, or package is not in
|
||||
|
@ -130,6 +130,7 @@ class CodeBlob_sizes {
|
||||
// Iterate over all CodeHeaps
|
||||
#define FOR_ALL_HEAPS(heap) for (GrowableArrayIterator<CodeHeap*> heap = _heaps->begin(); heap != _heaps->end(); ++heap)
|
||||
#define FOR_ALL_NMETHOD_HEAPS(heap) for (GrowableArrayIterator<CodeHeap*> heap = _nmethod_heaps->begin(); heap != _nmethod_heaps->end(); ++heap)
|
||||
#define FOR_ALL_ALLOCABLE_HEAPS(heap) for (GrowableArrayIterator<CodeHeap*> heap = _allocable_heaps->begin(); heap != _allocable_heaps->end(); ++heap)
|
||||
|
||||
// Iterate over all CodeBlobs (cb) on the given CodeHeap
|
||||
#define FOR_ALL_BLOBS(cb, heap) for (CodeBlob* cb = first_blob(heap); cb != NULL; cb = next_blob(heap, cb))
|
||||
@ -140,10 +141,11 @@ int CodeCache::_number_of_nmethods_with_dependencies = 0;
|
||||
bool CodeCache::_needs_cache_clean = false;
|
||||
nmethod* CodeCache::_scavenge_root_nmethods = NULL;
|
||||
|
||||
// Initialize array of CodeHeaps
|
||||
// Initialize arrays of CodeHeap subsets
|
||||
GrowableArray<CodeHeap*>* CodeCache::_heaps = new(ResourceObj::C_HEAP, mtCode) GrowableArray<CodeHeap*> (CodeBlobType::All, true);
|
||||
GrowableArray<CodeHeap*>* CodeCache::_compiled_heaps = new(ResourceObj::C_HEAP, mtCode) GrowableArray<CodeHeap*> (CodeBlobType::All, true);
|
||||
GrowableArray<CodeHeap*>* CodeCache::_nmethod_heaps = new(ResourceObj::C_HEAP, mtCode) GrowableArray<CodeHeap*> (CodeBlobType::All, true);
|
||||
GrowableArray<CodeHeap*>* CodeCache::_allocable_heaps = new(ResourceObj::C_HEAP, mtCode) GrowableArray<CodeHeap*> (CodeBlobType::All, true);
|
||||
|
||||
void CodeCache::check_heap_sizes(size_t non_nmethod_size, size_t profiled_size, size_t non_profiled_size, size_t cache_size, bool all_set) {
|
||||
size_t total_size = non_nmethod_size + profiled_size + non_profiled_size;
|
||||
@ -338,6 +340,7 @@ ReservedCodeSpace CodeCache::reserve_heap_memory(size_t size) {
|
||||
return rs;
|
||||
}
|
||||
|
||||
// Heaps available for allocation
|
||||
bool CodeCache::heap_available(int code_blob_type) {
|
||||
if (!SegmentedCodeCache) {
|
||||
// No segmentation: use a single code heap
|
||||
@ -391,6 +394,9 @@ void CodeCache::add_heap(CodeHeap* heap) {
|
||||
if (code_blob_type_accepts_nmethod(type)) {
|
||||
_nmethod_heaps->insert_sorted<code_heap_compare>(heap);
|
||||
}
|
||||
if (code_blob_type_accepts_allocable(type)) {
|
||||
_allocable_heaps->insert_sorted<code_heap_compare>(heap);
|
||||
}
|
||||
}
|
||||
|
||||
void CodeCache::add_heap(ReservedSpace rs, const char* name, int code_blob_type) {
|
||||
@ -620,7 +626,7 @@ nmethod* CodeCache::find_nmethod(void* start) {
|
||||
|
||||
void CodeCache::blobs_do(void f(CodeBlob* nm)) {
|
||||
assert_locked_or_safepoint(CodeCache_lock);
|
||||
FOR_ALL_NMETHOD_HEAPS(heap) {
|
||||
FOR_ALL_HEAPS(heap) {
|
||||
FOR_ALL_BLOBS(cb, *heap) {
|
||||
f(cb);
|
||||
}
|
||||
@ -663,7 +669,7 @@ void CodeCache::do_unloading(BoolObjectClosure* is_alive, bool unloading_occurre
|
||||
|
||||
void CodeCache::blobs_do(CodeBlobClosure* f) {
|
||||
assert_locked_or_safepoint(CodeCache_lock);
|
||||
FOR_ALL_NMETHOD_HEAPS(heap) {
|
||||
FOR_ALL_ALLOCABLE_HEAPS(heap) {
|
||||
FOR_ALL_BLOBS(cb, *heap) {
|
||||
if (cb->is_alive()) {
|
||||
f->do_code_blob(cb);
|
||||
@ -960,7 +966,7 @@ address CodeCache::high_bound(int code_blob_type) {
|
||||
|
||||
size_t CodeCache::capacity() {
|
||||
size_t cap = 0;
|
||||
FOR_ALL_NMETHOD_HEAPS(heap) {
|
||||
FOR_ALL_ALLOCABLE_HEAPS(heap) {
|
||||
cap += (*heap)->capacity();
|
||||
}
|
||||
return cap;
|
||||
@ -973,7 +979,7 @@ size_t CodeCache::unallocated_capacity(int code_blob_type) {
|
||||
|
||||
size_t CodeCache::unallocated_capacity() {
|
||||
size_t unallocated_cap = 0;
|
||||
FOR_ALL_NMETHOD_HEAPS(heap) {
|
||||
FOR_ALL_ALLOCABLE_HEAPS(heap) {
|
||||
unallocated_cap += (*heap)->unallocated_capacity();
|
||||
}
|
||||
return unallocated_cap;
|
||||
@ -981,7 +987,7 @@ size_t CodeCache::unallocated_capacity() {
|
||||
|
||||
size_t CodeCache::max_capacity() {
|
||||
size_t max_cap = 0;
|
||||
FOR_ALL_NMETHOD_HEAPS(heap) {
|
||||
FOR_ALL_ALLOCABLE_HEAPS(heap) {
|
||||
max_cap += (*heap)->max_capacity();
|
||||
}
|
||||
return max_cap;
|
||||
@ -1007,7 +1013,7 @@ double CodeCache::reverse_free_ratio(int code_blob_type) {
|
||||
|
||||
size_t CodeCache::bytes_allocated_in_freelists() {
|
||||
size_t allocated_bytes = 0;
|
||||
FOR_ALL_NMETHOD_HEAPS(heap) {
|
||||
FOR_ALL_ALLOCABLE_HEAPS(heap) {
|
||||
allocated_bytes += (*heap)->allocated_in_freelist();
|
||||
}
|
||||
return allocated_bytes;
|
||||
@ -1015,7 +1021,7 @@ size_t CodeCache::bytes_allocated_in_freelists() {
|
||||
|
||||
int CodeCache::allocated_segments() {
|
||||
int number_of_segments = 0;
|
||||
FOR_ALL_NMETHOD_HEAPS(heap) {
|
||||
FOR_ALL_ALLOCABLE_HEAPS(heap) {
|
||||
number_of_segments += (*heap)->allocated_segments();
|
||||
}
|
||||
return number_of_segments;
|
||||
@ -1023,7 +1029,7 @@ int CodeCache::allocated_segments() {
|
||||
|
||||
size_t CodeCache::freelists_length() {
|
||||
size_t length = 0;
|
||||
FOR_ALL_NMETHOD_HEAPS(heap) {
|
||||
FOR_ALL_ALLOCABLE_HEAPS(heap) {
|
||||
length += (*heap)->freelist_length();
|
||||
}
|
||||
return length;
|
||||
@ -1354,7 +1360,7 @@ void CodeCache::report_codemem_full(int code_blob_type, bool print) {
|
||||
|
||||
void CodeCache::print_memory_overhead() {
|
||||
size_t wasted_bytes = 0;
|
||||
FOR_ALL_NMETHOD_HEAPS(heap) {
|
||||
FOR_ALL_ALLOCABLE_HEAPS(heap) {
|
||||
CodeHeap* curr_heap = *heap;
|
||||
for (CodeBlob* cb = (CodeBlob*)curr_heap->first(); cb != NULL; cb = (CodeBlob*)curr_heap->next(cb)) {
|
||||
HeapBlock* heap_block = ((HeapBlock*)cb) - 1;
|
||||
@ -1400,7 +1406,7 @@ void CodeCache::print_internals() {
|
||||
ResourceMark rm;
|
||||
|
||||
int i = 0;
|
||||
FOR_ALL_NMETHOD_HEAPS(heap) {
|
||||
FOR_ALL_ALLOCABLE_HEAPS(heap) {
|
||||
if ((_nmethod_heaps->length() >= 1) && Verbose) {
|
||||
tty->print_cr("-- %s --", (*heap)->name());
|
||||
}
|
||||
@ -1497,7 +1503,7 @@ void CodeCache::print() {
|
||||
CodeBlob_sizes live;
|
||||
CodeBlob_sizes dead;
|
||||
|
||||
FOR_ALL_NMETHOD_HEAPS(heap) {
|
||||
FOR_ALL_ALLOCABLE_HEAPS(heap) {
|
||||
FOR_ALL_BLOBS(cb, *heap) {
|
||||
if (!cb->is_alive()) {
|
||||
dead.add(cb);
|
||||
@ -1523,7 +1529,7 @@ void CodeCache::print() {
|
||||
int number_of_blobs = 0;
|
||||
int number_of_oop_maps = 0;
|
||||
int map_size = 0;
|
||||
FOR_ALL_NMETHOD_HEAPS(heap) {
|
||||
FOR_ALL_ALLOCABLE_HEAPS(heap) {
|
||||
FOR_ALL_BLOBS(cb, *heap) {
|
||||
if (cb->is_alive()) {
|
||||
number_of_blobs++;
|
||||
|
@ -85,6 +85,7 @@ class CodeCache : AllStatic {
|
||||
static GrowableArray<CodeHeap*>* _heaps;
|
||||
static GrowableArray<CodeHeap*>* _compiled_heaps;
|
||||
static GrowableArray<CodeHeap*>* _nmethod_heaps;
|
||||
static GrowableArray<CodeHeap*>* _allocable_heaps;
|
||||
|
||||
static address _low_bound; // Lower bound of CodeHeap addresses
|
||||
static address _high_bound; // Upper bound of CodeHeap addresses
|
||||
@ -237,6 +238,11 @@ class CodeCache : AllStatic {
|
||||
return type == CodeBlobType::All || type <= CodeBlobType::MethodProfiled;
|
||||
}
|
||||
|
||||
static bool code_blob_type_accepts_allocable(int type) {
|
||||
return type <= CodeBlobType::All;
|
||||
}
|
||||
|
||||
|
||||
// Returns the CodeBlobType for the given compilation level
|
||||
static int get_code_blob_type(int comp_level) {
|
||||
if (comp_level == CompLevel_none ||
|
||||
|
@ -1557,7 +1557,7 @@ void CompileBroker::compiler_thread_loop() {
|
||||
|
||||
// First thread to get here will initialize the compiler interface
|
||||
|
||||
if (!ciObjectFactory::is_initialized()) {
|
||||
{
|
||||
ASSERT_IN_VM;
|
||||
MutexLocker only_one (CompileThread_lock, thread);
|
||||
if (!ciObjectFactory::is_initialized()) {
|
||||
|
@ -1687,6 +1687,13 @@ C2V_VMENTRY(jlong, getFingerprint, (JNIEnv*, jobject, jlong metaspace_klass))
|
||||
}
|
||||
C2V_END
|
||||
|
||||
C2V_VMENTRY(jobject, getHostClass, (JNIEnv*, jobject, jobject jvmci_type))
|
||||
InstanceKlass* k = InstanceKlass::cast(CompilerToVM::asKlass(jvmci_type));
|
||||
InstanceKlass* host = k->host_klass();
|
||||
oop result = CompilerToVM::get_jvmci_type(host, CHECK_NULL);
|
||||
return JNIHandles::make_local(THREAD, result);
|
||||
C2V_END
|
||||
|
||||
C2V_VMENTRY(int, interpreterFrameSize, (JNIEnv*, jobject, jobject bytecode_frame_handle))
|
||||
if (bytecode_frame_handle == NULL) {
|
||||
THROW_0(vmSymbols::java_lang_NullPointerException());
|
||||
@ -1817,6 +1824,7 @@ JNINativeMethod CompilerToVM::methods[] = {
|
||||
{CC "flushDebugOutput", CC "()V", FN_PTR(flushDebugOutput)},
|
||||
{CC "methodDataProfileDataSize", CC "(JI)I", FN_PTR(methodDataProfileDataSize)},
|
||||
{CC "getFingerprint", CC "(J)J", FN_PTR(getFingerprint)},
|
||||
{CC "getHostClass", CC "(" HS_RESOLVED_KLASS ")" HS_RESOLVED_KLASS, FN_PTR(getHostClass)},
|
||||
{CC "interpreterFrameSize", CC "(" BYTECODE_FRAME ")I", FN_PTR(interpreterFrameSize)},
|
||||
{CC "compileToBytecode", CC "(" OBJECT ")V", FN_PTR(compileToBytecode)},
|
||||
{CC "getFlagValue", CC "(" STRING ")" OBJECT, FN_PTR(getFlagValue)},
|
||||
|
@ -1039,11 +1039,6 @@ JVM_ENTRY (void, JVM_AddReadsModule(JNIEnv *env, jobject from_module, jobject so
|
||||
Modules::add_reads_module(from_module, source_module, CHECK);
|
||||
JVM_END
|
||||
|
||||
JVM_ENTRY (void, JVM_AddModulePackage(JNIEnv *env, jobject module, const char* package))
|
||||
JVMWrapper("JVM_AddModulePackage");
|
||||
Modules::add_module_package(module, package, CHECK);
|
||||
JVM_END
|
||||
|
||||
// Reflection support //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
JVM_ENTRY(jstring, JVM_GetClassName(JNIEnv *env, jclass cls))
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2016, 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
|
||||
@ -466,14 +466,6 @@ JVM_AddModuleExportsToAll(JNIEnv *env, jobject from_module, const char* package)
|
||||
JNIEXPORT void JNICALL
|
||||
JVM_AddReadsModule(JNIEnv *env, jobject from_module, jobject source_module);
|
||||
|
||||
/*
|
||||
* Add a package to a module.
|
||||
* module: module that will contain the package
|
||||
* package: package to add to the module
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
JVM_AddModulePackage(JNIEnv* env, jobject module, const char* package);
|
||||
|
||||
/*
|
||||
* Reflection support functions
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 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
|
||||
@ -1457,15 +1457,6 @@ WB_ENTRY(void, WB_AddReadsModule(JNIEnv* env, jobject o, jobject from_module, jo
|
||||
Modules::add_reads_module(from_module, source_module, CHECK);
|
||||
WB_END
|
||||
|
||||
WB_ENTRY(void, WB_AddModulePackage(JNIEnv* env, jobject o, jclass module, jstring package))
|
||||
ResourceMark rm(THREAD);
|
||||
char* package_name = NULL;
|
||||
if (package != NULL) {
|
||||
package_name = java_lang_String::as_utf8_string(JNIHandles::resolve_non_null(package));
|
||||
}
|
||||
Modules::add_module_package(module, package_name, CHECK);
|
||||
WB_END
|
||||
|
||||
WB_ENTRY(jobject, WB_GetModuleByPackageName(JNIEnv* env, jobject o, jobject loader, jstring package))
|
||||
ResourceMark rm(THREAD);
|
||||
char* package_name = NULL;
|
||||
@ -1910,8 +1901,6 @@ static JNINativeMethod methods[] = {
|
||||
(void*)&WB_AddModuleExports },
|
||||
{CC"AddReadsModule", CC"(Ljava/lang/Object;Ljava/lang/Object;)V",
|
||||
(void*)&WB_AddReadsModule },
|
||||
{CC"AddModulePackage", CC"(Ljava/lang/Object;Ljava/lang/String;)V",
|
||||
(void*)&WB_AddModulePackage },
|
||||
{CC"GetModuleByPackageName", CC"(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;",
|
||||
(void*)&WB_GetModuleByPackageName },
|
||||
{CC"AddModuleExportsToAllUnnamed", CC"(Ljava/lang/Object;Ljava/lang/String;)V",
|
||||
|
@ -2861,8 +2861,8 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_m
|
||||
if (res != JNI_OK) {
|
||||
return res;
|
||||
}
|
||||
} else if (match_option(option, "--permit-illegal-access")) {
|
||||
if (!create_property("jdk.module.permitIllegalAccess", "true", ExternalProperty)) {
|
||||
} else if (match_option(option, "--illegal-access=", &tail)) {
|
||||
if (!create_property("jdk.module.illegalAccess", tail, ExternalProperty)) {
|
||||
return JNI_ENOMEM;
|
||||
}
|
||||
// -agentlib and -agentpath
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -296,19 +296,41 @@ void SensorInfo::trigger(int count, TRAPS) {
|
||||
Klass* k = Management::sun_management_Sensor_klass(CHECK);
|
||||
instanceKlassHandle sensorKlass (THREAD, k);
|
||||
Handle sensor_h(THREAD, _sensor_obj);
|
||||
Handle usage_h = MemoryService::create_MemoryUsage_obj(_usage, CHECK);
|
||||
|
||||
Symbol* trigger_method_signature;
|
||||
|
||||
JavaValue result(T_VOID);
|
||||
JavaCallArguments args(sensor_h);
|
||||
args.push_int((int) count);
|
||||
args.push_oop(usage_h);
|
||||
|
||||
Handle usage_h = MemoryService::create_MemoryUsage_obj(_usage, THREAD);
|
||||
// Call Sensor::trigger(int, MemoryUsage) to send notification to listeners.
|
||||
// When OOME occurs and fails to allocate MemoryUsage object, call
|
||||
// Sensor::trigger(int) instead. The pending request will be processed
|
||||
// but no notification will be sent.
|
||||
if (HAS_PENDING_EXCEPTION) {
|
||||
assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOME here");
|
||||
CLEAR_PENDING_EXCEPTION;
|
||||
trigger_method_signature = vmSymbols::int_void_signature();
|
||||
} else {
|
||||
trigger_method_signature = vmSymbols::trigger_method_signature();
|
||||
args.push_oop(usage_h);
|
||||
}
|
||||
|
||||
JavaCalls::call_virtual(&result,
|
||||
sensorKlass,
|
||||
vmSymbols::trigger_name(),
|
||||
vmSymbols::trigger_method_signature(),
|
||||
&args,
|
||||
CHECK);
|
||||
sensorKlass,
|
||||
vmSymbols::trigger_name(),
|
||||
trigger_method_signature,
|
||||
&args,
|
||||
THREAD);
|
||||
|
||||
if (HAS_PENDING_EXCEPTION) {
|
||||
// We just clear the OOM pending exception that we might have encountered
|
||||
// in Java's tiggerAction(), and continue with updating the counters since
|
||||
// the Java counters have been updated too.
|
||||
assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOME here");
|
||||
CLEAR_PENDING_EXCEPTION;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
|
53
hotspot/test/compiler/c1/MultiplyByMaxInt.java
Normal file
53
hotspot/test/compiler/c1/MultiplyByMaxInt.java
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8181872
|
||||
*
|
||||
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions
|
||||
* -XX:CompileThreshold=100 -XX:+TieredCompilation -XX:TieredStopAtLevel=1
|
||||
* -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,compiler.c1.MultiplyByMaxInt::test
|
||||
* compiler.c1.MultiplyByMaxInt
|
||||
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-BackgroundCompilation
|
||||
* -XX:CompileThreshold=100 -XX:+TieredCompilation -XX:TieredStopAtLevel=3
|
||||
* -XX:CompileCommand=dontinline,compiler.c1.MultiplyByMaxInt::test
|
||||
* compiler.c1.MultiplyByMaxInt
|
||||
*/
|
||||
package compiler.c1;
|
||||
|
||||
public class MultiplyByMaxInt {
|
||||
static int test(int x) {
|
||||
int loops = (x >>> 4) & 7;
|
||||
while (loops-- > 0) {
|
||||
x = (x * 2147483647) % 16807;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
for (int i = 0; i < 20000; i++) {
|
||||
test(i);
|
||||
}
|
||||
}
|
||||
}
|
@ -54,6 +54,7 @@ import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
@ -142,6 +143,27 @@ public class TestResolvedJavaType extends TypeUniverse {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getHostClassTest() {
|
||||
for (Class<?> c : classes) {
|
||||
ResolvedJavaType type = metaAccess.lookupJavaType(c);
|
||||
ResolvedJavaType host = type.getHostClass();
|
||||
assertNull(host);
|
||||
}
|
||||
|
||||
class LocalClass {}
|
||||
Cloneable clone = new Cloneable() {};
|
||||
assertNull(metaAccess.lookupJavaType(LocalClass.class).getHostClass());
|
||||
assertNull(metaAccess.lookupJavaType(clone.getClass()).getHostClass());
|
||||
|
||||
Supplier<Runnable> lambda = () -> () -> System.out.println("run");
|
||||
ResolvedJavaType lambdaType = metaAccess.lookupJavaType(lambda.getClass());
|
||||
ResolvedJavaType nestedLambdaType = metaAccess.lookupJavaType(lambda.get().getClass());
|
||||
assertNotNull(lambdaType.getHostClass());
|
||||
assertNotNull(nestedLambdaType.getHostClass());
|
||||
assertEquals(lambdaType.getHostClass(), nestedLambdaType.getHostClass());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getModifiersTest() {
|
||||
for (Class<?> c : classes) {
|
||||
|
@ -1,154 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @library /test/lib ..
|
||||
* @build sun.hotspot.WhiteBox
|
||||
* @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
|
||||
*/
|
||||
|
||||
import static jdk.test.lib.Asserts.*;
|
||||
import java.sql.Time;
|
||||
|
||||
public class JVMAddModulePackage {
|
||||
|
||||
public static void main(String args[]) throws Throwable {
|
||||
MyClassLoader cl1 = new MyClassLoader();
|
||||
MyClassLoader cl3 = new MyClassLoader();
|
||||
Object module_one, module_two, module_three;
|
||||
boolean result;
|
||||
|
||||
module_one = ModuleHelper.ModuleObject("module_one", cl1, new String[] { "mypackage" });
|
||||
assertNotNull(module_one, "Module should not be null");
|
||||
ModuleHelper.DefineModule(module_one, "9.0", "module_one/here", new String[] { "mypackage" });
|
||||
module_two = ModuleHelper.ModuleObject("module_two", cl1, new String[] { "yourpackage" });
|
||||
assertNotNull(module_two, "Module should not be null");
|
||||
ModuleHelper.DefineModule(module_two, "9.0", "module_two/here", new String[] { "yourpackage" });
|
||||
module_three = ModuleHelper.ModuleObject("module_three", cl3, new String[] { "apackage/num3" });
|
||||
assertNotNull(module_three, "Module should not be null");
|
||||
ModuleHelper.DefineModule(module_three, "9.0", "module_three/here", new String[] { "apackage/num3" });
|
||||
|
||||
// Simple call
|
||||
ModuleHelper.AddModulePackage(module_one, "new_package");
|
||||
|
||||
// Add a package and export it
|
||||
ModuleHelper.AddModulePackage(module_one, "apackage/num3");
|
||||
ModuleHelper.AddModuleExportsToAll(module_one, "apackage/num3");
|
||||
|
||||
// Null module argument, expect an NPE
|
||||
try {
|
||||
ModuleHelper.AddModulePackage(null, "new_package");
|
||||
throw new RuntimeException("Failed to get the expected NPE");
|
||||
} catch(NullPointerException e) {
|
||||
// Expected
|
||||
}
|
||||
|
||||
// Bad module argument, expect an IAE
|
||||
try {
|
||||
ModuleHelper.AddModulePackage(cl1, "new_package");
|
||||
throw new RuntimeException("Failed to get the expected IAE");
|
||||
} catch(IllegalArgumentException e) {
|
||||
// Expected
|
||||
}
|
||||
|
||||
// Null package argument, expect an NPE
|
||||
try {
|
||||
ModuleHelper.AddModulePackage(module_one, null);
|
||||
throw new RuntimeException("Failed to get the expected NPE");
|
||||
} catch(NullPointerException e) {
|
||||
// Expected
|
||||
}
|
||||
|
||||
// Existing package, expect an ISE
|
||||
try {
|
||||
ModuleHelper.AddModulePackage(module_one, "yourpackage");
|
||||
throw new RuntimeException("Failed to get the expected ISE");
|
||||
} catch(IllegalStateException e) {
|
||||
// Expected
|
||||
}
|
||||
|
||||
// Invalid package name, expect an IAE
|
||||
try {
|
||||
ModuleHelper.AddModulePackage(module_one, "your.apackage");
|
||||
throw new RuntimeException("Failed to get the expected IAE");
|
||||
} catch(IllegalArgumentException e) {
|
||||
// Expected
|
||||
}
|
||||
|
||||
// Invalid package name, expect an IAE
|
||||
try {
|
||||
ModuleHelper.AddModulePackage(module_one, ";your/apackage");
|
||||
throw new RuntimeException("Failed to get the expected IAE");
|
||||
} catch(IllegalArgumentException e) {
|
||||
// Expected
|
||||
}
|
||||
|
||||
// Invalid package name, expect an IAE
|
||||
try {
|
||||
ModuleHelper.AddModulePackage(module_one, "7[743");
|
||||
throw new RuntimeException("Failed to get the expected IAE");
|
||||
} catch(IllegalArgumentException e) {
|
||||
// Expected
|
||||
}
|
||||
|
||||
// Empty package name, expect an IAE
|
||||
try {
|
||||
ModuleHelper.AddModulePackage(module_one, "");
|
||||
throw new RuntimeException("Failed to get the expected IAE");
|
||||
} catch(IllegalArgumentException e) {
|
||||
// Expected
|
||||
}
|
||||
|
||||
// Add package named "java" to an module defined to a class loader other than the boot or platform loader.
|
||||
try {
|
||||
// module_one is defined to a MyClassLoader class loader.
|
||||
ModuleHelper.AddModulePackage(module_one, "java/foo");
|
||||
throw new RuntimeException("Failed to get the expected IAE");
|
||||
} catch(IllegalArgumentException e) {
|
||||
if (!e.getMessage().contains("prohibited package name")) {
|
||||
throw new RuntimeException("Failed to get expected IAE message for prohibited package name: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// Package "javabar" should be ok
|
||||
ModuleHelper.AddModulePackage(module_one, "javabar");
|
||||
|
||||
// Package named "java" defined to the boot class loader, should be ok
|
||||
Object module_javabase = module_one.getClass().getModule();
|
||||
ModuleHelper.AddModulePackage(module_javabase, "java/foo");
|
||||
|
||||
// Package named "java" defined to the platform class loader, should be ok
|
||||
// The module java.sql is defined to the platform class loader.
|
||||
java.sql.Time jst = new java.sql.Time(45000); // milliseconds
|
||||
Object module_javasql = jst.getClass().getModule();
|
||||
ModuleHelper.AddModulePackage(module_javasql, "java/foo");
|
||||
}
|
||||
|
||||
static class MyClassLoader extends ClassLoader { }
|
||||
}
|
||||
|
@ -49,12 +49,6 @@ public class ModuleHelper {
|
||||
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.ModuleHelper.addPackageNoSync((Module)m, pkg);
|
||||
}
|
||||
|
||||
public static Module GetModuleByPackageName(Object ldr, String pkg) throws Throwable {
|
||||
WhiteBox wb = WhiteBox.getWhiteBox();
|
||||
return (Module)wb.GetModuleByPackageName(ldr, pkg);
|
||||
|
@ -63,11 +63,4 @@ public final class ModuleHelper {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a package to a module without notifying the VM.
|
||||
*/
|
||||
public static void addPackageNoSync(Module m, String pkg) {
|
||||
m.implAddPackageNoSync(pkg);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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,6 +26,7 @@ package MyPackage;
|
||||
/**
|
||||
* @test
|
||||
* @summary Verifies the JVMTI GetNamedModule API
|
||||
* @modules jdk.jdi
|
||||
* @compile GetNamedModuleTest.java
|
||||
* @run main/othervm/native -agentlib:GetNamedModuleTest MyPackage.GetNamedModuleTest
|
||||
*/
|
||||
|
57
hotspot/test/serviceability/jvmti/IsModifiableModule/MyPackage/IsModifiableModuleTest.java
Normal file
57
hotspot/test/serviceability/jvmti/IsModifiableModule/MyPackage/IsModifiableModuleTest.java
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) 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 MyPackage;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @summary Verifies the JVMTI IsModifiableModule API
|
||||
* @modules jdk.jdi
|
||||
* @compile IsModifiableModuleTest.java
|
||||
* @run main/othervm/native -agentlib:IsModifiableModuleTest MyPackage.IsModifiableModuleTest
|
||||
*/
|
||||
|
||||
import java.io.PrintStream;
|
||||
|
||||
public class IsModifiableModuleTest {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("IsModifiableModuleTest");
|
||||
} catch (UnsatisfiedLinkError ule) {
|
||||
System.err.println("Could not load IsModifiableModuleTest library");
|
||||
System.err.println("java.library.path: "
|
||||
+ System.getProperty("java.library.path"));
|
||||
throw ule;
|
||||
}
|
||||
}
|
||||
|
||||
native static int check();
|
||||
|
||||
public static void main(String args[]) {
|
||||
int status = check();
|
||||
if (status != 0) {
|
||||
throw new RuntimeException("Non-zero status returned from the agent: " + status);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,215 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "jvmti.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef JNI_ENV_ARG
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define JNI_ENV_ARG(x, y) y
|
||||
#define JNI_ENV_PTR(x) x
|
||||
#else
|
||||
#define JNI_ENV_ARG(x,y) x, y
|
||||
#define JNI_ENV_PTR(x) (*x)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#define TranslateError(err) "JVMTI error"
|
||||
|
||||
#define PASSED 0
|
||||
#define FAILED 2
|
||||
|
||||
static const char *EXC_CNAME = "java/lang/AssertionError";
|
||||
|
||||
static jvmtiEnv *jvmti = NULL;
|
||||
static jint result = PASSED;
|
||||
static jboolean printdump = JNI_FALSE;
|
||||
|
||||
static jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved);
|
||||
|
||||
JNIEXPORT
|
||||
jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
|
||||
return Agent_Initialize(jvm, options, reserved);
|
||||
}
|
||||
|
||||
JNIEXPORT
|
||||
jint JNICALL Agent_OnAttach(JavaVM *jvm, char *options, void *reserved) {
|
||||
return Agent_Initialize(jvm, options, reserved);
|
||||
}
|
||||
|
||||
JNIEXPORT
|
||||
jint JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) {
|
||||
return JNI_VERSION_1_8;
|
||||
}
|
||||
|
||||
static
|
||||
jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
|
||||
jint res;
|
||||
|
||||
if (options != NULL && strcmp(options, "printdump") == 0) {
|
||||
printdump = JNI_TRUE;
|
||||
}
|
||||
|
||||
res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
|
||||
JVMTI_VERSION_9);
|
||||
if (res != JNI_OK || jvmti == NULL) {
|
||||
printf(" Error: wrong result of a valid call to GetEnv!\n");
|
||||
return JNI_ERR;
|
||||
}
|
||||
|
||||
return JNI_OK;
|
||||
}
|
||||
|
||||
static
|
||||
jclass find_class(JNIEnv *env, const char* cname) {
|
||||
jclass cls = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env, cname));
|
||||
|
||||
if (cls == NULL) {
|
||||
printf("find_class: Error: FindClass(env, \"%s\") returned NULL\n", cname);
|
||||
}
|
||||
return cls;
|
||||
}
|
||||
|
||||
static
|
||||
jint throw_exc(JNIEnv *env, char *msg) {
|
||||
jclass exc_class = find_class(env, EXC_CNAME);
|
||||
|
||||
if (exc_class == NULL) {
|
||||
printf("throw_exc: Error in find_class(env, \"%s\")\n", EXC_CNAME);
|
||||
return -1;
|
||||
}
|
||||
return JNI_ENV_PTR(env)->ThrowNew(JNI_ENV_ARG(env, exc_class), msg);
|
||||
}
|
||||
|
||||
static jobject get_module_by_class_name(JNIEnv *env, const char* cname) {
|
||||
jobject module = NULL;
|
||||
jclass cls = find_class(env, cname);
|
||||
|
||||
printf(">>> getting module by class name: \"%s\"\n", cname);
|
||||
if (cls == NULL) {
|
||||
printf("get_module_by_class_name: Error in find_class(env, \"%s\")\n", cname);
|
||||
return NULL;
|
||||
}
|
||||
module = JNI_ENV_PTR(env)->GetModule(JNI_ENV_ARG(env, cls));
|
||||
if (module == NULL) {
|
||||
printf("get_module_by_class_name: Error in GetModule for class \"%s\"\n", cname);
|
||||
}
|
||||
return module;
|
||||
}
|
||||
|
||||
static
|
||||
jint check_is_modifiable_error_codes(jobject module, jobject not_a_module) {
|
||||
jvmtiError err = JVMTI_ERROR_NONE;
|
||||
jboolean is_modifiable = JNI_FALSE;
|
||||
|
||||
printf(">>> passing a bad module argument to JVMTI IsModifiableModule\n");
|
||||
err = (*jvmti)->IsModifiableModule(jvmti, not_a_module, &is_modifiable);
|
||||
if (err != JVMTI_ERROR_INVALID_MODULE) {
|
||||
printf(" Error #EC0: Did not get expected INVALID_MODULE error code from"
|
||||
" IsModifiableModule: %s (%d)\n", TranslateError(err), err);
|
||||
return FAILED;
|
||||
}
|
||||
printf(">>> passing NULL module argument to JVMTI IsModifiableModule\n");
|
||||
err = (*jvmti)->IsModifiableModule(jvmti, NULL, &is_modifiable);
|
||||
if (err != JVMTI_ERROR_NULL_POINTER) {
|
||||
printf(" Error #EC1: Did not get expected NULL_POINTER error code from"
|
||||
" IsModifiableModule: %s (%d)\n", TranslateError(err), err);
|
||||
return FAILED;
|
||||
}
|
||||
printf(">>> passing NULL status pointer to JVMTI IsModifiableModule\n");
|
||||
err = (*jvmti)->IsModifiableModule(jvmti, module, NULL);
|
||||
if (err != JVMTI_ERROR_NULL_POINTER) {
|
||||
printf(" Error #EC2: Did not get expected NULL_POINTER error code from"
|
||||
" IsModifiableModule: %s (%d)\n", TranslateError(err), err);
|
||||
return FAILED;
|
||||
}
|
||||
return PASSED;
|
||||
}
|
||||
|
||||
static
|
||||
jint check_is_modifiable(jobject module) {
|
||||
jvmtiError err = JVMTI_ERROR_NONE;
|
||||
jboolean is_modifiable = JNI_FALSE;
|
||||
|
||||
printf(">>> checking module %p is modifiable\n", module);
|
||||
err = (*jvmti)->IsModifiableModule(jvmti, module, &is_modifiable);
|
||||
if (err != JVMTI_ERROR_NONE) {
|
||||
printf(" Error in IsModifiableModule for module %p: %s (%d)\n",
|
||||
module, TranslateError(err), err);
|
||||
return FAILED;
|
||||
}
|
||||
if (is_modifiable == JNI_FALSE) {
|
||||
printf(" unexpected non-modifiable status for module: %p\n", module);
|
||||
return FAILED;
|
||||
}
|
||||
return PASSED;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_MyPackage_IsModifiableModuleTest_check(JNIEnv *env, jclass cls) {
|
||||
jobject module = NULL;
|
||||
|
||||
if (jvmti == NULL) {
|
||||
throw_exc(env, "JVMTI client was not properly loaded!\n");
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
printf("\n*** Testing IsModifiableModule ***\n\n");
|
||||
|
||||
if (check_is_modifiable_error_codes(module, cls) == FAILED) {
|
||||
throw_exc(env, "check #MM0: failed to return expected error code from "
|
||||
"a bad call to JVMTI IsModifiableModule");
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
module = get_module_by_class_name(env, "java/lang/Class");
|
||||
if (check_is_modifiable(module) == FAILED) {
|
||||
throw_exc(env, "check #MM1: failed to return modifiable module status");
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
module = get_module_by_class_name(env, "com/sun/jdi/VirtualMachine");
|
||||
if (check_is_modifiable(module) == FAILED) {
|
||||
throw_exc(env, "check #MM2: failed to return modifiable module status");
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
module = get_module_by_class_name(env, "MyPackage/IsModifiableModuleTest");
|
||||
if (check_is_modifiable(module) == FAILED) {
|
||||
throw_exc(env, "check #MM3: failed to return modifiable module status");
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
return PASSED;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -51,8 +51,7 @@ public class TestMutuallyExclusivePlatformPredicates {
|
||||
VM_TYPE("isClient", "isServer", "isGraal", "isMinimal", "isZero", "isEmbedded"),
|
||||
MODE("isInt", "isMixed", "isComp"),
|
||||
IGNORED("isEmulatedClient", "isDebugBuild", "isFastDebugBuild", "isSlowDebugBuild",
|
||||
"shouldSAAttach", "canPtraceAttachLinux", "canAttachOSX",
|
||||
"isTieredSupported");
|
||||
"shouldSAAttach", "isTieredSupported");
|
||||
|
||||
public final List<String> methodNames;
|
||||
|
||||
|
@ -81,7 +81,6 @@ endif
|
||||
|
||||
LEGAL_NOTICES := \
|
||||
$(SUPPORT_OUTPUTDIR)/modules_legal/java.base \
|
||||
$(wildcard $(SUPPORT_OUTPUTDIR)/modules_legal/$(MODULE)) \
|
||||
$(call FindModuleLegalDirs, $(MODULE)) \
|
||||
#
|
||||
|
||||
@ -106,10 +105,10 @@ ifeq ($(MODULE), java.base)
|
||||
DEPS += $(patsubst %, $(JMODS_DIR)/%.jmod, \
|
||||
$(filter-out java.base $(ALL_UPGRADEABLE_MODULES), $(call FindAllModules)))
|
||||
|
||||
EXCLUDE_PATTERN := $(strip $(subst $(SPACE),|,$(strip $(ALL_UPGRADEABLE_MODULES))))
|
||||
EXCLUDE_PATTERN := $(strip $(subst $(SPACE),$$|,$(strip $(ALL_UPGRADEABLE_MODULES))))
|
||||
|
||||
JMOD_FLAGS += --module-path $(JMODS_DIR) \
|
||||
--hash-modules '^(?!$(EXCLUDE_PATTERN))'
|
||||
--hash-modules '^(?!$(EXCLUDE_PATTERN)$$)'
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
132
make/Docs.gmk
132
make/Docs.gmk
@ -63,7 +63,7 @@ MODULES_SOURCE_PATH := $(call PathList, $(call GetModuleSrcPath) \
|
||||
# URLs
|
||||
JAVADOC_BASE_URL := http://www.oracle.com/pls/topic/lookup?ctx=javase9&id=homepage
|
||||
BUG_SUBMIT_URL := http://bugreport.java.com/bugreport/
|
||||
COPYRIGHT_URL := {@docroot}/../legal/cpyr.html
|
||||
COPYRIGHT_URL := {@docroot}/../legal/copyright.html
|
||||
LICENSE_URL := http://www.oracle.com/technetwork/java/javase/terms/license/java9speclicense.html
|
||||
REDISTRIBUTION_URL := http://www.oracle.com/technetwork/java/redist-137594.html
|
||||
|
||||
@ -116,9 +116,9 @@ endif
|
||||
# General text snippets
|
||||
|
||||
FULL_COMPANY_NAME := Oracle and/or its affiliates
|
||||
COMPANY_ADDRESS := 500 Oracle Parkway<br>Redwood Shores, CA 94065 USA
|
||||
COMPANY_ADDRESS := 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
|
||||
JAVA_PLATFORM := Java™ Platform
|
||||
JAVA_PLATFORM := Java Platform
|
||||
|
||||
ifeq ($(IS_DRAFT), true)
|
||||
DRAFT_MARKER_STR := <br><strong>DRAFT $(VERSION_STRING)</strong>
|
||||
@ -127,51 +127,44 @@ ifeq ($(IS_DRAFT), true)
|
||||
else
|
||||
DRAFT_MARKER_TITLE := [build $(VERSION_BUILD)]
|
||||
endif
|
||||
DRAFT_TEXT := Please note that the specifications and other information \
|
||||
contained herein are not final and are subject to change. The \
|
||||
information is being made available to you solely for purpose of \
|
||||
evaluation.
|
||||
DRAFT_TEXT := This specification is not final and is subject to change. \
|
||||
Use is subject to <a href="$(LICENSE_URL)">license terms</a>.
|
||||
endif
|
||||
|
||||
JAVADOC_BOTTOM := \
|
||||
<span style="font-size:smaller"> \
|
||||
<a href="$(BUG_SUBMIT_URL)">Submit a bug or feature</a><br> \
|
||||
For further API reference and developer documentation, see \
|
||||
<a href="$(BUG_SUBMIT_URL)">Report a bug or suggest an enhancement</a><br> \
|
||||
For further API reference and developer documentation see the \
|
||||
<a href="$(JAVADOC_BASE_URL)" target="_blank">Java SE \
|
||||
Documentation</a>. That documentation contains more detailed, \
|
||||
developer-targeted descriptions, with conceptual overviews, definitions \
|
||||
Documentation</a>, which contains more detailed, \
|
||||
developer-targeted descriptions with conceptual overviews, definitions \
|
||||
of terms, workarounds, and working code examples.<br> \
|
||||
Java is a trademark or registered trademark of $(FULL_COMPANY_NAME) in \
|
||||
the US and other countries.<br> \
|
||||
<a href="$(COPYRIGHT_URL)">Copyright</a> \
|
||||
© 1993, $(COPYRIGHT_YEAR), $(FULL_COMPANY_NAME). \
|
||||
$(COMPANY_ADDRESS). All rights reserved. \
|
||||
Use is subject to <a href="$(LICENSE_URL)">license terms</a>. Also see the \
|
||||
© 1993, $(COPYRIGHT_YEAR), $(FULL_COMPANY_NAME), \
|
||||
$(COMPANY_ADDRESS).<br>All rights reserved. \
|
||||
Use is subject to <a href="$(LICENSE_URL)">license terms</a> and the \
|
||||
<a href="$(REDISTRIBUTION_URL)">documentation redistribution policy</a>. \
|
||||
$(DRAFT_MARKER_STR)</span>
|
||||
$(DRAFT_MARKER_STR) <!-- Version $(VERSION_STRING) -->
|
||||
|
||||
|
||||
JAVADOC_TOP := \
|
||||
<div style="background-color: $(HASH)EEEEEE"><div style="padding: 6px; \
|
||||
margin-top: 2px; margin-bottom: 6px; margin-left: 6px; margin-right: \
|
||||
6px; text-align: justify; font-size: 80%; font-family: Helvetica, Arial, \
|
||||
sans-serif; font-weight: normal;">$(DRAFT_TEXT)</div></div>
|
||||
<div style="padding: 6px; text-align: center; font-size: 80%; \
|
||||
font-family: DejaVu Sans, Arial, Helvetica, sans-serif; \
|
||||
font-weight: normal;">$(DRAFT_TEXT)</div>
|
||||
|
||||
################################################################################
|
||||
# JDK javadoc titles/text snippets
|
||||
|
||||
JDK_SHORT_NAME := JDK™ $(VERSION_SPECIFICATION)
|
||||
JDK_LONG_NAME := Standard Edition Development Kit (JDK™) $(VERSION_SPECIFICATION)
|
||||
JDK_SHORT_NAME := Java SE $(VERSION_SPECIFICATION) & JDK $(VERSION_SPECIFICATION)
|
||||
JDK_LONG_NAME := Java<sup>®</sup> Platform, Standard Edition \
|
||||
<span style="white-space: nowrap;">& Java Development Kit</span>
|
||||
|
||||
################################################################################
|
||||
# Java SE javadoc titles/text snippets
|
||||
|
||||
JAVASE_SHORT_NAME := SE $(VERSION_SPECIFICATION)
|
||||
JAVASE_LONG_NAME := Standard Edition $(VERSION_SPECIFICATION)
|
||||
|
||||
################################################################################
|
||||
# Index page text titles/snippets
|
||||
|
||||
JDK_INDEX_TITLE := $(JAVA_PLATFORM), $(JDK_LONG_NAME) Specification $(DRAFT_MARKER_TITLE)
|
||||
JAVASE_SHORT_NAME := Java SE $(VERSION_SPECIFICATION)
|
||||
JAVASE_LONG_NAME := Java<sup>®</sup> Platform, Standard Edition
|
||||
|
||||
################################################################################
|
||||
# Functions
|
||||
@ -204,24 +197,19 @@ define create_overview_file
|
||||
$1_OVERVIEW_TEXT := \
|
||||
<!DOCTYPE html> \
|
||||
<html><head></head><body> \
|
||||
<p>This document is the API specification for $$($1_FULL_NAME).</p> \
|
||||
#
|
||||
ifneq ($$($1_GROUPS),)
|
||||
$1_OVERVIEW_TEXT += \
|
||||
<p>For an overview of the full specification, grouped by usage, see the <a href="../index.html">$$(JAVA_PLATFORM), $$($1_LONG_NAME) Specification</a>.</p> \
|
||||
<dl> \
|
||||
#
|
||||
<p>This document is divided into \
|
||||
$$(subst 2,two,$$(subst 3,three,$$(words $$($1_GROUPS)))) sections:</p> \
|
||||
<blockquote><dl> \
|
||||
#
|
||||
$1_OVERVIEW_TEXT += $$(foreach g, $$($1_GROUPS), \
|
||||
<dt><a href="\#$$g">$$($$g_GROUP_NAME)</a></dt> \
|
||||
<dd>$$($$g_GROUP_DESCRIPTION)</dt> \
|
||||
<dt style="margin-top: 8px;"><a href="\#$$g">$$($$g_GROUP_NAME)</a></dt> \
|
||||
<dd style="margin-top: 8px;">$$($$g_GROUP_DESCRIPTION)</dt> \
|
||||
)
|
||||
$1_OVERVIEW_TEXT += \
|
||||
</dl> \
|
||||
#
|
||||
endif
|
||||
ifeq ($$(IS_DRAFT), true)
|
||||
$1_OVERVIEW_TEXT += \
|
||||
<p><strong>$$(DRAFT_TEXT)</strong></p> \
|
||||
</dl><blockquote> \
|
||||
#
|
||||
endif
|
||||
$1_OVERVIEW_TEXT += \
|
||||
@ -279,13 +267,16 @@ define SetupApiDocsGenerationBody
|
||||
$1_OPTIONS += -Xdoclint:all,$$(call CommaList, $$(addprefix -, \
|
||||
$$(JAVADOC_DISABLED_DOCLINT)))
|
||||
|
||||
$1_FULL_NAME := $$(JAVA_PLATFORM), $$($1_LONG_NAME) \
|
||||
$$(DRAFT_MARKER_TITLE)
|
||||
$1_DOC_TITLE := $$($1_FULL_NAME)<br>API Specification
|
||||
$1_WINDOW_TITLE := $$(subst ™,,$$(JAVA_PLATFORM) $$($1_SHORT_NAME)) \
|
||||
$1_DOC_TITLE := $$($1_LONG_NAME)<br>Version $$(VERSION_SPECIFICATION) API Specification
|
||||
$1_WINDOW_TITLE := $$(subst &,&,$$($1_SHORT_NAME)) \
|
||||
$$(DRAFT_MARKER_TITLE)
|
||||
$1_HEADER_TITLE := <strong>$$(JAVA_PLATFORM)<br>$$($1_SHORT_NAME)</strong> \
|
||||
$$(DRAFT_MARKER_STR)
|
||||
ifeq ($(VERSION_IS_GA), true) # Workaround stylesheet bug
|
||||
$1_HEADER_PAD := 14
|
||||
else
|
||||
$1_HEADER_PAD := 9
|
||||
endif
|
||||
$1_HEADER_TITLE := <div style="margin-top: $$($1_HEADER_PAD)px;"><strong>$$($1_SHORT_NAME)</strong> \
|
||||
$$(DRAFT_MARKER_STR)</div>
|
||||
|
||||
$1_OPTIONS += -doctitle '$$($1_DOC_TITLE)'
|
||||
$1_OPTIONS += -windowtitle '$$($1_WINDOW_TITLE)'
|
||||
@ -379,18 +370,18 @@ JavaSE_GROUP_NAME := Java SE
|
||||
JavaSE_GROUP_MODULES := $(call ColonList, $(sort java.se.ee \
|
||||
$(call FindTransitiveIndirectDepsForModules, java.se.ee)))
|
||||
JavaSE_GROUP_DESCRIPTION := \
|
||||
The Java Platform, Standard Edition ("Java SE") APIs define the core Java \
|
||||
platform for general-purpose computing. These APIs are in modules with \
|
||||
names starting with the string "java.". \
|
||||
The Java Platform, Standard Edition (Java SE) APIs define the core Java \
|
||||
platform for general-purpose computing. These APIs are in modules whose \
|
||||
names start with {@code java}. \
|
||||
#
|
||||
JDK_GROUPS += JavaSE
|
||||
|
||||
JDK_GROUP_NAME := JDK
|
||||
JDK_GROUP_MODULES := jdk.*
|
||||
JDK_GROUP_DESCRIPTION := \
|
||||
The Java Development Kit ("JDK") APIs define an implementation of the Java \
|
||||
SE Platform which may include platform-specific details. These APIs are in \
|
||||
modules with names starting with the string "jdk.". \
|
||||
The Java Development Kit (JDK) APIs are specific to the JDK and will not \
|
||||
necessarily be available in all implementations of the Java SE Platform. \
|
||||
These APIs are in modules whose names start with {@code jdk}. \
|
||||
#
|
||||
JDK_GROUPS += JDK
|
||||
|
||||
@ -401,9 +392,9 @@ ifneq ($(findstring javafx., $(IMPORTED_MODULES)), )
|
||||
JavaFX_GROUP_NAME := JavaFX
|
||||
JavaFX_GROUP_MODULES := javafx.*
|
||||
JavaFX_GROUP_DESCRIPTION := \
|
||||
The JavaFX APIs define a set of user interface (UI) controls, graphics, \
|
||||
The JavaFX APIs define a set of user-interface controls, graphics, \
|
||||
media, and web packages for developing rich client applications. These \
|
||||
APIs are in modules with names starting with the string "javafx.". \
|
||||
APIs are in modules whose names start with {@code javafx}. \
|
||||
#
|
||||
JDK_GROUPS += JavaFX
|
||||
endif
|
||||
@ -425,7 +416,7 @@ $(eval $(call SetupApiDocsGeneration, JDK_API, \
|
||||
################################################################################
|
||||
# Setup generation of the Java SE API documentation (javadoc + modulegraph)
|
||||
|
||||
# The Java SE module scope is just java.se.ee and it's transitive indirect
|
||||
# The Java SE module scope is just java.se.ee and its transitive indirect
|
||||
# exports.
|
||||
JAVASE_MODULES := java.se.ee
|
||||
|
||||
@ -442,17 +433,19 @@ $(eval $(call SetupApiDocsGeneration, JAVASE_API, \
|
||||
################################################################################
|
||||
|
||||
JDK_INDEX_HTML := $(DOCS_OUTPUTDIR)/index.html
|
||||
JDK_INDEX_TOOLS_DIR := $(TOOLS_CLASSES_DIR)/build/tools/docs
|
||||
|
||||
$(JDK_INDEX_HTML): $(BUILD_JIGSAW_TOOLS) \
|
||||
$(JDK_INDEX_TOOLS_DIR)/docs-bundle-page.html \
|
||||
$(JDK_INDEX_TOOLS_DIR)/docs-module-groups.properties
|
||||
$(call LogInfo, Generating docs bundle index page)
|
||||
$(MKDIR) -p $(@D)
|
||||
$(TOOL_GEN_DOCS_BUNDLE_PAGE) --title '$(JDK_INDEX_TITLE)' \
|
||||
--output $@
|
||||
JDK_INDEX_CONTENT := \
|
||||
<!DOCTYPE html> \
|
||||
<html lang="en"> \
|
||||
<head> \
|
||||
<meta http-equiv="refresh" content="0;url=api/index.html"> \
|
||||
</head> \
|
||||
</html>
|
||||
|
||||
JDK_INDEX_TARGETS := $(JDK_INDEX_HTML)
|
||||
$(JDK_INDEX_HTML):
|
||||
$(ECHO) '$(JDK_INDEX_CONTENT)' > $@
|
||||
|
||||
JDK_INDEX_TARGETS += $(JDK_INDEX_HTML)
|
||||
|
||||
# Copy the global resources
|
||||
GLOBAL_SPECS_RESOURCES_DIR := $(JDK_TOPDIR)/make/data/docs-resources/
|
||||
@ -463,6 +456,15 @@ $(eval $(call SetupCopyFiles, COPY_GLOBAL_RESOURCES, \
|
||||
))
|
||||
JDK_INDEX_TARGETS += $(COPY_GLOBAL_RESOURCES)
|
||||
|
||||
# Copy the legal notices distributed with the docs bundle
|
||||
DOCS_LEGAL_NOTICES := jquery.md jszip.md pako.md
|
||||
$(eval $(call SetupCopyFiles, COPY_DOCS_LEGAL_NOTICES, \
|
||||
SRC := $(LANGTOOLS_TOPDIR)/src/jdk.javadoc/share/legal, \
|
||||
FILES := $(DOCS_LEGAL_NOTICES), \
|
||||
DEST := $(DOCS_OUTPUTDIR)/legal, \
|
||||
))
|
||||
JDK_INDEX_TARGETS += $(COPY_DOCS_LEGAL_NOTICES)
|
||||
|
||||
################################################################################
|
||||
# Copy JDK specs files
|
||||
|
||||
|
@ -72,8 +72,11 @@ BOOT_MODULES += \
|
||||
jdk.naming.rmi \
|
||||
#
|
||||
|
||||
# Modules that directly or indirectly requiring upgradeable modules
|
||||
# should carefully be considered if it should be upgradeable or not.
|
||||
UPGRADEABLE_MODULES += \
|
||||
java.activation \
|
||||
java.compiler \
|
||||
java.corba \
|
||||
java.transaction \
|
||||
java.xml.bind \
|
||||
@ -82,10 +85,9 @@ UPGRADEABLE_MODULES += \
|
||||
jdk.internal.vm.compiler \
|
||||
#
|
||||
|
||||
# Modules explicitly declared as not being upgradeable even though they require
|
||||
# an upgradeable module.
|
||||
NON_UPGRADEABLE_MODULES += \
|
||||
jdk.aot \
|
||||
UPGRADEABLE_TOOL_MODULES += \
|
||||
jdk.xml.bind \
|
||||
jdk.xml.ws \
|
||||
#
|
||||
|
||||
AGGREGATOR_MODULES += \
|
||||
@ -99,7 +101,6 @@ PLATFORM_MODULES += \
|
||||
#
|
||||
|
||||
PLATFORM_MODULES += \
|
||||
java.compiler \
|
||||
java.scripting \
|
||||
java.security.jgss \
|
||||
java.smartcardio \
|
||||
@ -175,13 +176,10 @@ DOCS_MODULES += \
|
||||
jdk.policytool \
|
||||
jdk.rmic \
|
||||
jdk.scripting.nashorn \
|
||||
jdk.scripting.nashorn.shell \
|
||||
jdk.sctp \
|
||||
jdk.security.auth \
|
||||
jdk.security.jgss \
|
||||
jdk.xml.bind \
|
||||
jdk.xml.dom \
|
||||
jdk.xml.ws \
|
||||
jdk.zipfs \
|
||||
#
|
||||
|
||||
@ -384,15 +382,8 @@ FindTransitiveIndirectDepsForModules = \
|
||||
# Upgradeable modules are those that are either defined as upgradeable or that
|
||||
# require an upradeable module.
|
||||
FindAllUpgradeableModules = \
|
||||
$(filter-out $(MODULES_FILTER) $(NON_UPGRADEABLE_MODULES), \
|
||||
$(sort $(UPGRADEABLE_MODULES) $(foreach m, \
|
||||
$(filter-out $(UPGRADEABLE_MODULES), $(call FindAllModules)), \
|
||||
$(if $(filter $(UPGRADEABLE_MODULES), \
|
||||
$(call FindTransitiveDepsForModule, $m)), \
|
||||
$m \
|
||||
) \
|
||||
)) \
|
||||
)
|
||||
$(sort $(filter-out $(MODULES_FILTER), $(UPGRADEABLE_MODULES) $(UPGRADEABLE_TOOL_MODULES)))
|
||||
|
||||
|
||||
################################################################################
|
||||
|
||||
|
@ -23,10 +23,9 @@
|
||||
|
||||
package jdk.test.lib;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class Platform {
|
||||
@ -208,12 +207,13 @@ public class Platform {
|
||||
* Return a boolean for whether we expect to be able to attach
|
||||
* the SA to our own processes on this system.
|
||||
*/
|
||||
public static boolean shouldSAAttach() throws Exception {
|
||||
|
||||
public static boolean shouldSAAttach() throws IOException {
|
||||
if (isAix()) {
|
||||
return false; // SA not implemented.
|
||||
return false; // SA not implemented.
|
||||
} else if (isLinux()) {
|
||||
if (isS390x()) { return false; } // SA not implemented.
|
||||
if (isS390x()) {
|
||||
return false; // SA not implemented.
|
||||
}
|
||||
return canPtraceAttachLinux();
|
||||
} else if (isOSX()) {
|
||||
return canAttachOSX();
|
||||
@ -229,13 +229,15 @@ public class Platform {
|
||||
* if we are root, so return true. Then return false for an expected denial
|
||||
* if "ptrace_scope" is 1, and true otherwise.
|
||||
*/
|
||||
public static boolean canPtraceAttachLinux() throws Exception {
|
||||
|
||||
private static boolean canPtraceAttachLinux() throws IOException {
|
||||
// SELinux deny_ptrace:
|
||||
String deny_ptrace = fileAsString("/sys/fs/selinux/booleans/deny_ptrace");
|
||||
if (deny_ptrace != null && deny_ptrace.contains("1")) {
|
||||
// ptrace will be denied:
|
||||
return false;
|
||||
File deny_ptrace = new File("/sys/fs/selinux/booleans/deny_ptrace");
|
||||
if (deny_ptrace.exists()) {
|
||||
try (RandomAccessFile file = new RandomAccessFile(deny_ptrace, "r")) {
|
||||
if (file.readByte() != '0') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// YAMA enhanced security ptrace_scope:
|
||||
@ -243,14 +245,17 @@ public class Platform {
|
||||
// 1 - restricted ptrace: a process must be a children of the inferior or user is root
|
||||
// 2 - only processes with CAP_SYS_PTRACE may use ptrace or user is root
|
||||
// 3 - no attach: no processes may use ptrace with PTRACE_ATTACH
|
||||
String ptrace_scope = fileAsString("/proc/sys/kernel/yama/ptrace_scope");
|
||||
if (ptrace_scope != null) {
|
||||
if (ptrace_scope.startsWith("3")) {
|
||||
return false;
|
||||
}
|
||||
if (!userName.equals("root") && !ptrace_scope.startsWith("0")) {
|
||||
// ptrace will be denied:
|
||||
return false;
|
||||
File ptrace_scope = new File("/proc/sys/kernel/yama/ptrace_scope");
|
||||
if (ptrace_scope.exists()) {
|
||||
try (RandomAccessFile file = new RandomAccessFile(ptrace_scope, "r")) {
|
||||
byte yama_scope = file.readByte();
|
||||
if (yama_scope == '3') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!userName.equals("root") && yama_scope != '0') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Otherwise expect to be permitted:
|
||||
@ -260,7 +265,7 @@ public class Platform {
|
||||
/**
|
||||
* On OSX, expect permission to attach only if we are root.
|
||||
*/
|
||||
public static boolean canAttachOSX() throws Exception {
|
||||
private static boolean canAttachOSX() {
|
||||
return userName.equals("root");
|
||||
}
|
||||
|
||||
@ -269,10 +274,4 @@ public class Platform {
|
||||
.matcher(osArch)
|
||||
.matches();
|
||||
}
|
||||
|
||||
private static String fileAsString(String filename) throws IOException {
|
||||
Path filePath = Paths.get(filename);
|
||||
if (!Files.exists(filePath)) return null;
|
||||
return new String(Files.readAllBytes(filePath));
|
||||
}
|
||||
}
|
||||
|
@ -453,7 +453,6 @@ public class WhiteBox {
|
||||
Object[] packages);
|
||||
public native void AddModuleExports(Object from_module, String pkg, Object to_module);
|
||||
public native void AddReadsModule(Object from_module, Object source_module);
|
||||
public native void AddModulePackage(Object module, String pkg);
|
||||
public native void AddModuleExportsToAllUnnamed(Object module, String pkg);
|
||||
public native void AddModuleExportsToAll(Object module, String pkg);
|
||||
public native Object GetModuleByPackageName(Object ldr, String pkg);
|
||||
|
Loading…
x
Reference in New Issue
Block a user