mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-13 23:19:36 +00:00
8265705: aarch64: KlassDecodeMovk mode broken
Reviewed-by: aph, iklam, ngasson
This commit is contained in:
parent
cf97252f3f
commit
3c010a7c7e
@ -219,7 +219,16 @@ void CompressedKlassPointers::initialize(address addr, size_t len) {
|
||||
// cannot be larger than that).
|
||||
|
||||
base = addr;
|
||||
shift = LogKlassAlignmentInBytes;
|
||||
|
||||
// JDK-8265705
|
||||
// This is a temporary fix for aarch64: there, if the range-to-be-encoded is located
|
||||
// below 32g, either encoding base should be zero or base should be aligned to 4G
|
||||
// and shift should be zero. The simplest way to fix this for now is to force
|
||||
// shift to zero for both runtime and dumptime.
|
||||
// Note however that this is not a perfect solution. Ideally this whole function
|
||||
// should be CDS agnostic, that would simplify it - and testing - alot. See JDK-8267141
|
||||
// for details.
|
||||
shift = 0;
|
||||
|
||||
// This must be true since at dumptime cds+ccs is 4G, at runtime it can
|
||||
// only be smaller, see comment above.
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
|
||||
/**
|
||||
* @test SharedBaseAddress
|
||||
* @bug 8265705
|
||||
* @summary Test variety of values for SharedBaseAddress, making sure
|
||||
* VM handles normal values as well as edge values w/o a crash.
|
||||
* @requires vm.cds
|
||||
@ -47,6 +48,8 @@ public class SharedBaseAddress {
|
||||
"0xffffffffffffffff", // archive bottom wraps around 64-bit address space -- due to align_up()
|
||||
"0xffffffff", // archive bottom wraps around 32-bit address space -- due to align_up()
|
||||
"0x00007ffffff00000", // end of archive will go past the end of user space on linux/x64
|
||||
"0x500000000", // (20g) below 32g at a 4g aligned address, but cannot be expressed with a logical
|
||||
// immediate on aarch64 (0x5_0000_0000) (see JDK-8265705)
|
||||
"0", // always let OS pick the base address at runtime (ASLR for CDS archive)
|
||||
};
|
||||
|
||||
@ -55,24 +58,38 @@ public class SharedBaseAddress {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
for (String testEntry : testTable) {
|
||||
String filename = "SharedBaseAddress" + testEntry + ".jsa";
|
||||
System.out.println("sharedBaseAddress = " + testEntry);
|
||||
CDSOptions opts = (new CDSOptions())
|
||||
.setArchiveName(filename)
|
||||
.addPrefix("-XX:SharedBaseAddress=" + testEntry)
|
||||
.addPrefix("-Xlog:cds=debug")
|
||||
.addPrefix("-Xlog:cds+reloc=debug")
|
||||
.addPrefix("-Xlog:nmt=debug")
|
||||
.addPrefix("-Xlog:os=debug")
|
||||
.addPrefix("-XX:NativeMemoryTracking=detail");
|
||||
for (int run = 0; run < 2; run ++) {
|
||||
// We run twice:
|
||||
// Once, where we want to increase the chance that mapping the generated archive at the designated base
|
||||
// succeeds, to test Klass pointer encoding at that weird location. We do this by sizing heap + class space
|
||||
// small, and by switching off compressed oops.
|
||||
// On the second run, we don't do this but instead go with default parameters. This is more of a test of
|
||||
// CDS' ability to recover if mapping at runtime fails.
|
||||
for (String testEntry : testTable) {
|
||||
String filename = "SharedBaseAddress-base" + testEntry + "-run" + run + ".jsa";
|
||||
System.out.println("sharedBaseAddress = " + testEntry);
|
||||
CDSOptions opts = (new CDSOptions())
|
||||
.setArchiveName(filename)
|
||||
.addPrefix("-XX:SharedBaseAddress=" + testEntry)
|
||||
.addPrefix("-Xlog:cds=debug")
|
||||
.addPrefix("-Xlog:cds+reloc=debug")
|
||||
.addPrefix("-Xlog:nmt=debug")
|
||||
.addPrefix("-Xlog:os=debug")
|
||||
.addPrefix("-Xlog:gc+metaspace")
|
||||
.addPrefix("-XX:NativeMemoryTracking=detail");
|
||||
|
||||
CDSTestUtils.createArchiveAndCheck(opts);
|
||||
OutputAnalyzer out = CDSTestUtils.runWithArchiveAndCheck(opts);
|
||||
if (testEntry.equals("0")) {
|
||||
out.shouldContain("Archive(s) were created with -XX:SharedBaseAddress=0. Always map at os-selected address.")
|
||||
.shouldContain("Try to map archive(s) at an alternative address")
|
||||
.shouldNotMatch(failedPattern);
|
||||
if (run == 0) {
|
||||
opts.addPrefix("-Xmx128m")
|
||||
.addPrefix("-XX:CompressedClassSpaceSize=32m")
|
||||
.addPrefix("-XX:-UseCompressedOops");
|
||||
}
|
||||
CDSTestUtils.createArchiveAndCheck(opts);
|
||||
OutputAnalyzer out = CDSTestUtils.runWithArchiveAndCheck(opts);
|
||||
if (testEntry.equals("0")) {
|
||||
out.shouldContain("Archive(s) were created with -XX:SharedBaseAddress=0. Always map at os-selected address.")
|
||||
.shouldContain("Try to map archive(s) at an alternative address")
|
||||
.shouldNotMatch(failedPattern);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user