File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
test/hotspot/jtreg/compiler Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change 25
25
* @test
26
26
* @bug 8202414
27
27
* @summary Unsafe write after primitive array creation may result in array length change
28
+ * @modules java.base/jdk.internal.misc
29
+ * @library /test/lib
28
30
* @run main/othervm compiler.c2.Test8202414
29
31
*/
30
32
34
36
import java .lang .reflect .Field ;
35
37
import java .security .AccessController ;
36
38
import java .security .PrivilegedAction ;
39
+ import jtreg .SkippedException ;
37
40
38
41
public class Test8202414 {
39
42
40
43
public static void main (String [] args ) {
44
+ // Some CPUs (for example, ARM) does not support unaligned
45
+ // memory accesses. This test may cause JVM crash due to
46
+ // alignment check failure on such CPUs.
47
+ if (!jdk .internal .misc .Unsafe .getUnsafe ().unalignedAccess ()) {
48
+ throw new SkippedException (
49
+ "Platform is missing unaligned memory accesses support." );
50
+ }
41
51
System .err .close ();
42
52
int count = 0 ;
43
53
while (count ++ < 120000 ) {
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2016 SAP SE. All rights reserved.
2
+ * Copyright (c) 2016, 2020 SAP SE. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
26
26
* @bug 8158260
27
27
* @summary Test unaligned Unsafe accesses
28
28
* @modules java.base/jdk.internal.misc:+open
29
- *
29
+ * @library /test/lib
30
30
* @run main/othervm -Diters=20000 -XX:-UseOnStackReplacement -XX:-BackgroundCompilation
31
31
* compiler.unsafe.JdkInternalMiscUnsafeUnalignedAccess
32
32
* @author volker.simonis@gmail.com
38
38
39
39
import java .lang .reflect .Field ;
40
40
import java .nio .ByteOrder ;
41
+ import jtreg .SkippedException ;
41
42
42
43
public class JdkInternalMiscUnsafeUnalignedAccess {
43
44
static final int ITERS = Integer .getInteger ("iters" , 20_000 );
@@ -131,8 +132,7 @@ static void putLong_17(long l) {
131
132
public static void main (String [] args ) throws Exception {
132
133
133
134
if (!UNSAFE .unalignedAccess ()) {
134
- System .out .println ("Platform is not supporting unaligned access - nothing to test." );
135
- return ;
135
+ throw new SkippedException ("Platform is not supporting unaligned access - nothing to test." );
136
136
}
137
137
138
138
memory = UNSAFE .allocateMemory (SIZE );
You can’t perform that action at this time.
0 commit comments