42
43 static class Outer {
44 Object f;
45 }
46
47 static final VarHandle fVarHandle;
48 static {
49 MethodHandles.Lookup l = MethodHandles.lookup();
50 try {
51 fVarHandle = l.findVarHandle(Outer.class, "f", Object.class);
52 } catch (Exception e) {
53 throw new Error(e);
54 }
55 }
56
57 public static void main(String[] args) {
58 TestFramework.runWithFlags("-XX:+UseZGC", "-XX:LoopUnrollLimit=24");
59 }
60
61 @Test
62 @IR(counts = {IRNode.STORE_P, "1"})
63 public static void testNoUnrolling(Outer o, Object o1) {
64 for (int i = 0; i < 64; i++) {
65 fVarHandle.setVolatile(o, o1);
66 }
67 }
68
69 @Run(test = {"testNoUnrolling"})
70 void run() {
71 testNoUnrolling(new Outer(), new Object());
72 }
73 }
|
42
43 static class Outer {
44 Object f;
45 }
46
47 static final VarHandle fVarHandle;
48 static {
49 MethodHandles.Lookup l = MethodHandles.lookup();
50 try {
51 fVarHandle = l.findVarHandle(Outer.class, "f", Object.class);
52 } catch (Exception e) {
53 throw new Error(e);
54 }
55 }
56
57 public static void main(String[] args) {
58 TestFramework.runWithFlags("-XX:+UseZGC", "-XX:LoopUnrollLimit=24");
59 }
60
61 @Test
62 // TODO JDK-8331551
63 // @IR(counts = {IRNode.STORE_P, "1"})
64 public static void testNoUnrolling(Outer o, Object o1) {
65 for (int i = 0; i < 64; i++) {
66 fVarHandle.setVolatile(o, o1);
67 }
68 }
69
70 @Run(test = {"testNoUnrolling"})
71 void run() {
72 testNoUnrolling(new Outer(), new Object());
73 }
74 }
|