50 /**
51 * use
52 *
53 * <pre>
54 * mx unittest AheadOfTimeCompilationTest @-XX:CompileCommand='print,*AheadOfTimeCompilationTest.*'
55 * </pre>
56 *
57 * to print disassembly.
58 */
59 public class AheadOfTimeCompilationTest extends HotSpotGraalCompilerTest {
60
61 public static final Object STATICFINALOBJECT = new Object();
62 public static final String STATICFINALSTRING = "test string";
63
64 public static Object getStaticFinalObject() {
65 return AheadOfTimeCompilationTest.STATICFINALOBJECT;
66 }
67
68 @Before
69 public void setUp() {
70 // Ignore on SPARC
71 Assume.assumeFalse("skipping on AArch64", getTarget().arch instanceof AArch64);
72 }
73
74 @Test
75 public void testStaticFinalObjectAOT() {
76 StructuredGraph result = compile("getStaticFinalObject", true);
77 assertDeepEquals(1, getConstantNodes(result).count());
78 Stamp constantStamp = getConstantNodes(result).first().stamp(NodeView.DEFAULT);
79 Assert.assertTrue(constantStamp.toString(), constantStamp instanceof KlassPointerStamp);
80 int expected = runtime().getVMConfig().classMirrorIsHandle ? 3 : 2;
81 assertDeepEquals(expected, result.getNodes().filter(ReadNode.class).count());
82 }
83
84 @Test
85 public void testStaticFinalObject() {
86 StructuredGraph result = compile("getStaticFinalObject", false);
87 assertDeepEquals(1, getConstantNodes(result).count());
88 assertDeepEquals(JavaKind.Object, getConstantNodes(result).first().getStackKind());
89 assertDeepEquals(0, result.getNodes().filter(ReadNode.class).count());
90 }
|
50 /**
51 * use
52 *
53 * <pre>
54 * mx unittest AheadOfTimeCompilationTest @-XX:CompileCommand='print,*AheadOfTimeCompilationTest.*'
55 * </pre>
56 *
57 * to print disassembly.
58 */
59 public class AheadOfTimeCompilationTest extends HotSpotGraalCompilerTest {
60
61 public static final Object STATICFINALOBJECT = new Object();
62 public static final String STATICFINALSTRING = "test string";
63
64 public static Object getStaticFinalObject() {
65 return AheadOfTimeCompilationTest.STATICFINALOBJECT;
66 }
67
68 @Before
69 public void setUp() {
70 // Ignore on AArch64
71 Assume.assumeFalse("skipping on AArch64", getTarget().arch instanceof AArch64);
72 }
73
74 @Test
75 public void testStaticFinalObjectAOT() {
76 StructuredGraph result = compile("getStaticFinalObject", true);
77 assertDeepEquals(1, getConstantNodes(result).count());
78 Stamp constantStamp = getConstantNodes(result).first().stamp(NodeView.DEFAULT);
79 Assert.assertTrue(constantStamp.toString(), constantStamp instanceof KlassPointerStamp);
80 int expected = runtime().getVMConfig().classMirrorIsHandle ? 3 : 2;
81 assertDeepEquals(expected, result.getNodes().filter(ReadNode.class).count());
82 }
83
84 @Test
85 public void testStaticFinalObject() {
86 StructuredGraph result = compile("getStaticFinalObject", false);
87 assertDeepEquals(1, getConstantNodes(result).count());
88 assertDeepEquals(JavaKind.Object, getConstantNodes(result).first().getStackKind());
89 assertDeepEquals(0, result.getNodes().filter(ReadNode.class).count());
90 }
|