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 2525 * @test
2626 * @bug 8202414
2727 * @summary Unsafe write after primitive array creation may result in array length change
28+ * @modules java.base/jdk.internal.misc
29+ * @library /test/lib
2830 * @run main/othervm compiler.c2.Test8202414
2931 */
3032
3436import java .lang .reflect .Field ;
3537import java .security .AccessController ;
3638import java .security .PrivilegedAction ;
39+ import jtreg .SkippedException ;
3740
3841public class Test8202414 {
3942
4043 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+ }
4151 System .err .close ();
4252 int count = 0 ;
4353 while (count ++ < 120000 ) {
Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2016 SAP SE. All rights reserved.
2+ * Copyright (c) 2016, 2020 SAP SE. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
2626 * @bug 8158260
2727 * @summary Test unaligned Unsafe accesses
2828 * @modules java.base/jdk.internal.misc:+open
29- *
29+ * @library /test/lib
3030 * @run main/othervm -Diters=20000 -XX:-UseOnStackReplacement -XX:-BackgroundCompilation
3131 * compiler.unsafe.JdkInternalMiscUnsafeUnalignedAccess
3232 * @author volker.simonis@gmail.com
3838
3939import java .lang .reflect .Field ;
4040import java .nio .ByteOrder ;
41+ import jtreg .SkippedException ;
4142
4243public class JdkInternalMiscUnsafeUnalignedAccess {
4344 static final int ITERS = Integer .getInteger ("iters" , 20_000 );
@@ -131,8 +132,7 @@ static void putLong_17(long l) {
131132 public static void main (String [] args ) throws Exception {
132133
133134 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." );
136136 }
137137
138138 memory = UNSAFE .allocateMemory (SIZE );
You can’t perform that action at this time.
0 commit comments