8224692: runtime/appcds tests crash in "HotSpotJVMCI::compute_offset" when running in Graal as JIT mode
Reviewed-by: ccheung
This commit is contained in:
parent
67defd71f2
commit
43e23020f2
@ -623,13 +623,11 @@ size_t SymbolTable::estimate_size_for_archive() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SymbolTable::write_to_archive(bool is_static_archive) {
|
void SymbolTable::write_to_archive(bool is_static_archive) {
|
||||||
_shared_table.reset();
|
|
||||||
_dynamic_shared_table.reset();
|
|
||||||
|
|
||||||
CompactHashtableWriter writer(int(_items_count),
|
CompactHashtableWriter writer(int(_items_count),
|
||||||
&MetaspaceShared::stats()->symbol);
|
&MetaspaceShared::stats()->symbol);
|
||||||
copy_shared_symbol_table(&writer);
|
copy_shared_symbol_table(&writer);
|
||||||
if (is_static_archive) {
|
if (is_static_archive) {
|
||||||
|
_shared_table.reset();
|
||||||
writer.dump(&_shared_table, "symbol");
|
writer.dump(&_shared_table, "symbol");
|
||||||
|
|
||||||
// Verify table is correct
|
// Verify table is correct
|
||||||
@ -639,6 +637,7 @@ void SymbolTable::write_to_archive(bool is_static_archive) {
|
|||||||
unsigned int hash = hash_symbol(name, len, _alt_hash);
|
unsigned int hash = hash_symbol(name, len, _alt_hash);
|
||||||
assert(sym == _shared_table.lookup(name, hash, len), "sanity");
|
assert(sym == _shared_table.lookup(name, hash, len), "sanity");
|
||||||
} else {
|
} else {
|
||||||
|
_dynamic_shared_table.reset();
|
||||||
writer.dump(&_dynamic_shared_table, "symbol");
|
writer.dump(&_dynamic_shared_table, "symbol");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -756,6 +756,10 @@ size_t DynamicArchiveBuilder::estimate_trampoline_size() {
|
|||||||
Array<Method*>* methods = ik->methods();
|
Array<Method*>* methods = ik->methods();
|
||||||
total += each_method_bytes * methods->length();
|
total += each_method_bytes * methods->length();
|
||||||
}
|
}
|
||||||
|
if (total == 0) {
|
||||||
|
// We have nothing to archive, but let's avoid having an empty region.
|
||||||
|
total = SharedRuntime::trampoline_size();
|
||||||
|
}
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -774,6 +778,11 @@ void DynamicArchiveBuilder::make_trampolines() {
|
|||||||
m->set_adapter_trampoline(to_target(adapter_trampoline));
|
m->set_adapter_trampoline(to_target(adapter_trampoline));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (MetaspaceShared::misc_code_dump_space()->used() == 0) {
|
||||||
|
// We have nothing to archive, but let's avoid having an empty region.
|
||||||
|
MetaspaceShared::misc_code_space_alloc(SharedRuntime::trampoline_size());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicArchiveBuilder::make_klasses_shareable() {
|
void DynamicArchiveBuilder::make_klasses_shareable() {
|
||||||
|
@ -61,19 +61,21 @@ public class NoClassToArchive extends DynamicArchiveTestBase {
|
|||||||
doTestCustomBase(baseArchiveName, topArchiveName);
|
doTestCustomBase(baseArchiveName, topArchiveName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void checkWarning(OutputAnalyzer output) throws Exception {
|
||||||
|
if (output.getStdout().contains("jrt:/") || output.getStdout().contains("unsafe anonymous")) {
|
||||||
|
System.out.println("test skipped: this platform uses non-archived classes when running -version");
|
||||||
|
} else {
|
||||||
|
output.shouldContain(warningMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void doTest(String baseArchiveName, String topArchiveName) throws Exception {
|
private static void doTest(String baseArchiveName, String topArchiveName) throws Exception {
|
||||||
dump2(baseArchiveName, topArchiveName,
|
dump2(baseArchiveName, topArchiveName,
|
||||||
"-Xlog:cds",
|
"-Xlog:cds",
|
||||||
"-Xlog:cds+dynamic=debug",
|
"-Xlog:cds+dynamic=debug",
|
||||||
"-Xlog:class+load=trace",
|
"-Xlog:class+load=trace",
|
||||||
"-version")
|
"-version")
|
||||||
.assertNormalExit(output -> {
|
.assertNormalExit(output -> checkWarning(output));
|
||||||
if (output.getStdout().contains("jrt:/")) {
|
|
||||||
System.out.println("test skipped: this platform uses non-archived classes when running -version");
|
|
||||||
} else {
|
|
||||||
output.shouldContain(warningMessage);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
dump2(baseArchiveName, topArchiveName,
|
dump2(baseArchiveName, topArchiveName,
|
||||||
"-Xlog:cds",
|
"-Xlog:cds",
|
||||||
@ -103,9 +105,11 @@ public class NoClassToArchive extends DynamicArchiveTestBase {
|
|||||||
|
|
||||||
// create a dynamic archive with the custom base archive
|
// create a dynamic archive with the custom base archive
|
||||||
// no class should be included in the dynamic archive
|
// no class should be included in the dynamic archive
|
||||||
dump2(baseArchiveName, topArchiveName, "-version")
|
dump2(baseArchiveName, topArchiveName,
|
||||||
.assertNormalExit(out -> {
|
"-Xlog:cds",
|
||||||
out.shouldMatch(warningMessage);
|
"-Xlog:cds+dynamic=debug",
|
||||||
});
|
"-Xlog:class+load=trace",
|
||||||
|
"-version")
|
||||||
|
.assertNormalExit(out -> checkWarning(out));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user