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 26
26
* @bug 8202414
27
27
* @summary Unsafe write after primitive array creation may result in array length change
28
28
* @requires (os.arch != "sparc") & (os.arch != "sparcv9")
29
+ * @modules java.base/jdk.internal.misc
30
+ * @library /test/lib
29
31
* @run main/othervm compiler.c2.Test8202414
30
32
*/
31
33
35
37
import java .lang .reflect .Field ;
36
38
import java .security .AccessController ;
37
39
import java .security .PrivilegedAction ;
40
+ import jtreg .SkippedException ;
38
41
39
42
public class Test8202414 {
40
43
41
44
public static void main (String [] args ) {
45
+ // Some CPUs (for example, ARM) does not support unaligned
46
+ // memory accesses. This test may cause JVM crash due to
47
+ // alignment check failure on such CPUs.
48
+ if (!jdk .internal .misc .Unsafe .getUnsafe ().unalignedAccess ()) {
49
+ throw new SkippedException (
50
+ "Platform is missing unaligned memory accesses support." );
51
+ }
42
52
System .err .close ();
43
53
int count = 0 ;
44
54
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