24
package compiler.gcbarriers;
26
import compiler.lib.ir_framework.CompilePhase;
27
import compiler.lib.ir_framework.DontInline;
28
import compiler.lib.ir_framework.IR;
29
import compiler.lib.ir_framework.IRNode;
30
import compiler.lib.ir_framework.Test;
31
import compiler.lib.ir_framework.TestFramework;
41
public class TestShenandoahBarrierExpansion {
42
public static void main(String[] args) {
43
TestFramework test = new TestFramework(TestShenandoahBarrierExpansion.class);
44
test.addFlags("-XX:+UseShenandoahGC");
48
private static Object staticField;
50
@IR(failOn = IRNode.IF, phase = CompilePhase.AFTER_PARSING)
51
@IR(counts = { IRNode.IF, "2" }, phase = CompilePhase.BARRIER_EXPANSION)
52
public Object testLoadFieldObject() {
56
private static A staticField2 = new A();
58
@IR(counts = { IRNode.IF, "1" }, phase = CompilePhase.AFTER_PARSING)
59
@IR(counts = { IRNode.IF, "3" }, phase = CompilePhase.BARRIER_EXPANSION)
60
private static int testLoadObjectFieldWithNullCheck() {
61
return staticField2.intField;
64
private static A staticField3 = new A();
66
@IR(counts = { IRNode.IF, "2" }, phase = CompilePhase.AFTER_PARSING)
67
@IR(counts = { IRNode.IF, "6" }, phase = CompilePhase.BARRIER_EXPANSION)
68
private static int testLoadTwoObjectFieldsWithNullCheck() {
69
return staticField2.intField + staticField3.intField;
73
@IR(failOn = IRNode.IF, phase = CompilePhase.AFTER_PARSING)
74
@IR(counts = { IRNode.IF, "3" }, phase = CompilePhase.BARRIER_EXPANSION)
75
private static void testLoadTwoFieldObjectAndEscape() {
76
final A field2 = staticField2;
77
final A field3 = staticField3;
78
notInlined(field2, field3);
82
private static void notInlined(A field2, A field3) {
86
private static class A {