mirror of
https://github.com/openjdk/jdk.git
synced 2026-07-14 21:19:00 +00:00
8373487: Out-of-bounds access in AlignmentGapAccess test
Reviewed-by: dlong, ayang
This commit is contained in:
parent
151516fae2
commit
30abe0b3a6
@ -67,8 +67,6 @@ compiler/interpreter/Test6833129.java 8335266 generic-i586
|
||||
|
||||
compiler/c2/aarch64/TestStaticCallStub.java 8359963 generic-aarch64
|
||||
|
||||
compiler/unsafe/AlignmentGapAccess.java 8373487 generic-all
|
||||
|
||||
compiler/escapeAnalysis/TestBCEscapeAnalyzerOverflow.java 8387392 windows-aarch64
|
||||
|
||||
#############################################################################
|
||||
|
||||
@ -38,17 +38,22 @@ public class AlignmentGapAccess {
|
||||
|
||||
static class A { int fa; }
|
||||
static class B extends A { byte fb; }
|
||||
static class C extends B { int fc; }
|
||||
|
||||
static final long FA_OFFSET = UNSAFE.objectFieldOffset(A.class, "fa");
|
||||
static final long FB_OFFSET = UNSAFE.objectFieldOffset(B.class, "fb");
|
||||
static final long FC_OFFSET = UNSAFE.objectFieldOffset(C.class, "fc");
|
||||
|
||||
static int test(B obj) {
|
||||
return UNSAFE.getInt(obj, FB_OFFSET + 1);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.printf("Layout: +%d: fa; +%d: fb; +%d: fc\n",
|
||||
FA_OFFSET, FB_OFFSET, FC_OFFSET);
|
||||
|
||||
for (int i = 0; i < 20_000; i++) {
|
||||
test(new B());
|
||||
test(new C());
|
||||
}
|
||||
System.out.println("TEST PASSED");
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user