31 * @run main/othervm -Xbootclasspath/a:. |
31 * @run main/othervm -Xbootclasspath/a:. |
32 * -XX:+UnlockDiagnosticVMOptions |
32 * -XX:+UnlockDiagnosticVMOptions |
33 * -XX:+WhiteBoxAPI |
33 * -XX:+WhiteBoxAPI |
34 * -XX:DisableIntrinsic=_putCharVolatile,_putInt |
34 * -XX:DisableIntrinsic=_putCharVolatile,_putInt |
35 * -XX:DisableIntrinsic=_putIntVolatile |
35 * -XX:DisableIntrinsic=_putIntVolatile |
36 * -XX:CompileCommand=option,sun.misc.Unsafe::putChar,ccstrlist,DisableIntrinsic,_getCharVolatile,_getInt |
36 * -XX:CompileCommand=option,jdk.internal.misc.Unsafe::putChar,ccstrlist,DisableIntrinsic,_getCharVolatile,_getInt |
37 * -XX:CompileCommand=option,sun.misc.Unsafe::putCharVolatile,ccstrlist,DisableIntrinsic,_getIntVolatile |
37 * -XX:CompileCommand=option,jdk.internal.misc.Unsafe::putCharVolatile,ccstrlist,DisableIntrinsic,_getIntVolatile |
38 * IntrinsicDisabledTest |
38 * IntrinsicDisabledTest |
39 */ |
39 */ |
40 |
40 |
41 import java.lang.reflect.Executable; |
41 import java.lang.reflect.Executable; |
42 import java.util.Objects; |
42 import java.util.Objects; |
58 /* Determine if tiered compilation is enabled. */ |
58 /* Determine if tiered compilation is enabled. */ |
59 private static boolean isTieredCompilationEnabled() { |
59 private static boolean isTieredCompilationEnabled() { |
60 return Boolean.valueOf(Objects.toString(wb.getVMFlag("TieredCompilation"))); |
60 return Boolean.valueOf(Objects.toString(wb.getVMFlag("TieredCompilation"))); |
61 } |
61 } |
62 |
62 |
63 /* This test uses several methods from sun.misc.Unsafe. The method |
63 /* This test uses several methods from jdk.internal.misc.Unsafe. The method |
64 * getMethod() returns a different Executable for each different |
64 * getMethod() returns a different Executable for each different |
65 * combination of its input parameters. There are eight possible |
65 * combination of its input parameters. There are eight possible |
66 * combinations, getMethod can return an Executable representing |
66 * combinations, getMethod can return an Executable representing |
67 * the following methods: putChar, putCharVolatile, getChar, |
67 * the following methods: putChar, putCharVolatile, getChar, |
68 * getCharVolatile, putInt, putIntVolatile, getInt, |
68 * getCharVolatile, putInt, putIntVolatile, getInt, |
72 static Executable getMethod(boolean isChar, boolean isPut, boolean isVolatile) throws RuntimeException { |
72 static Executable getMethod(boolean isChar, boolean isPut, boolean isVolatile) throws RuntimeException { |
73 Executable aMethod; |
73 Executable aMethod; |
74 String methodTypeName = isChar ? "Char" : "Int"; |
74 String methodTypeName = isChar ? "Char" : "Int"; |
75 |
75 |
76 try { |
76 try { |
77 Class aClass = Class.forName("sun.misc.Unsafe"); |
77 Class aClass = Class.forName("jdk.internal.misc.Unsafe"); |
78 if (isPut) { |
78 if (isPut) { |
79 aMethod = aClass.getDeclaredMethod("put" + methodTypeName + (isVolatile ? "Volatile" : ""), |
79 aMethod = aClass.getDeclaredMethod("put" + methodTypeName + (isVolatile ? "Volatile" : ""), |
80 Object.class, |
80 Object.class, |
81 long.class, |
81 long.class, |
82 isChar ? char.class : int.class); |
82 isChar ? char.class : int.class); |