hotspot/test/compiler/unsafe/UnsafeGetStableArrayElement.java
changeset 36617 390e8993b88e
parent 36351 c16f26ae72c9
child 38030 93f24e7b3c43
equal deleted inserted replaced
36616:5172e3dd60f2 36617:390e8993b88e
    41 import jdk.internal.vm.annotation.Stable;
    41 import jdk.internal.vm.annotation.Stable;
    42 import java.util.concurrent.Callable;
    42 import java.util.concurrent.Callable;
    43 
    43 
    44 import static jdk.internal.misc.Unsafe.*;
    44 import static jdk.internal.misc.Unsafe.*;
    45 import static jdk.test.lib.Asserts.*;
    45 import static jdk.test.lib.Asserts.*;
       
    46 import static jdk.test.lib.Platform;
    46 
    47 
    47 public class UnsafeGetStableArrayElement {
    48 public class UnsafeGetStableArrayElement {
    48     @Stable static final boolean[] STABLE_BOOLEAN_ARRAY = new boolean[16];
    49     @Stable static final boolean[] STABLE_BOOLEAN_ARRAY = new boolean[16];
    49     @Stable static final    byte[]    STABLE_BYTE_ARRAY = new    byte[16];
    50     @Stable static final    byte[]    STABLE_BYTE_ARRAY = new    byte[16];
    50     @Stable static final   short[]   STABLE_SHORT_ARRAY = new   short[8];
    51     @Stable static final   short[]   STABLE_SHORT_ARRAY = new   short[8];
   217         run(c, null, setDefaultAction);
   218         run(c, null, setDefaultAction);
   218         Setter.reset();
   219         Setter.reset();
   219     }
   220     }
   220 
   221 
   221     public static void main(String[] args) throws Exception {
   222     public static void main(String[] args) throws Exception {
       
   223         if (Platform.isServer()) {
       
   224             test();
       
   225         }
       
   226     }
       
   227 
       
   228     static void test() throws Exception {
   222         // boolean[], aligned accesses
   229         // boolean[], aligned accesses
   223         testMatched(   Test::testZ_Z, Test::changeZ);
   230         testMatched(   Test::testZ_Z, Test::changeZ);
   224         testMismatched(Test::testZ_B, Test::changeZ);
   231         testMismatched(Test::testZ_B, Test::changeZ);
   225         testMismatched(Test::testZ_S, Test::changeZ);
   232         testMismatched(Test::testZ_S, Test::changeZ);
   226         testMismatched(Test::testZ_C, Test::changeZ);
   233         testMismatched(Test::testZ_C, Test::changeZ);