Skip to content

Commit cae1fd3

Browse files
committed
8357632: CDS test failures on static JDK
Reviewed-by: ccheung, dholmes
1 parent eb8ee8b commit cae1fd3

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

src/hotspot/share/cds/cdsConfig.cpp

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,24 @@ const char* CDSConfig::default_archive_path() {
110110
// before CDSConfig::ergo_initialize() is called.
111111
assert(_cds_ergo_initialize_started, "sanity");
112112
if (_default_archive_path == nullptr) {
113-
char jvm_path[JVM_MAXPATHLEN];
114-
os::jvm_path(jvm_path, sizeof(jvm_path));
115-
char *end = strrchr(jvm_path, *os::file_separator());
116-
if (end != nullptr) *end = '\0';
117113
stringStream tmp;
118-
tmp.print("%s%sclasses", jvm_path, os::file_separator());
114+
if (is_vm_statically_linked()) {
115+
// It's easier to form the path using JAVA_HOME as os::jvm_path
116+
// gives the path to the launcher executable on static JDK.
117+
const char* subdir = WINDOWS_ONLY("bin") NOT_WINDOWS("lib");
118+
tmp.print("%s%s%s%s%s%sclasses",
119+
Arguments::get_java_home(), os::file_separator(),
120+
subdir, os::file_separator(),
121+
Abstract_VM_Version::vm_variant(), os::file_separator());
122+
} else {
123+
// Assume .jsa is in the same directory where libjvm resides on
124+
// non-static JDK.
125+
char jvm_path[JVM_MAXPATHLEN];
126+
os::jvm_path(jvm_path, sizeof(jvm_path));
127+
char *end = strrchr(jvm_path, *os::file_separator());
128+
if (end != nullptr) *end = '\0';
129+
tmp.print("%s%sclasses", jvm_path, os::file_separator());
130+
}
119131
#ifdef _LP64
120132
if (!UseCompressedOops) {
121133
tmp.print_raw("_nocoops");

test/hotspot/jtreg/ProblemList-StaticJdk.txt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,3 @@ gtest/MetaspaceGtests.java#no-ccs 8356201 generic-all
4242
gtest/NMTGtests.java#nmt-detail 8356201 generic-all
4343
gtest/NMTGtests.java#nmt-off 8356201 generic-all
4444
gtest/NMTGtests.java#nmt-summary 8356201 generic-all
45-
46-
# Need CDS archive
47-
runtime/cds/NonJVMVariantLocation.java 8357632 generic-all
48-
runtime/cds/TestCDSVMCrash.java 8357632 generic-all
49-
runtime/cds/TestDefaultArchiveLoading.java#coops_coh 8357632 generic-all
50-
runtime/cds/TestDefaultArchiveLoading.java#coops_nocoh 8357632 generic-all
51-
runtime/cds/TestDefaultArchiveLoading.java#nocoops_coh 8357632 generic-all
52-
runtime/cds/TestDefaultArchiveLoading.java#nocoops_nocoh 8357632 generic-all
53-
serviceability/jvmti/RedefineClasses/RedefineSharedClass.java 8357632 generic-all

test/hotspot/jtreg/runtime/cds/NonJVMVariantLocation.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
* @test
2727
* @summary Test that CDS archive can be loaded if the archive is in a non-JVM variant directory.
2828
* @bug 8353504
29+
* @requires !jdk.static
2930
* @requires vm.cds
3031
* @requires vm.flagless
3132
* @requires vm.flavor == "server"

0 commit comments

Comments
 (0)