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:+ZGenerational",
59 "-XX:LoopUnrollLimit=24");
60 }
61
62 @Test
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 }
|
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:+ZGenerational",
59 "-XX:LoopUnrollLimit=24");
60 }
61
62 @Test
63 // TODO JDK-8331551
64 // @IR(counts = {IRNode.STORE_P, "1"})
65 public static void testNoUnrolling(Outer o, Object o1) {
66 for (int i = 0; i < 64; i++) {
67 fVarHandle.setVolatile(o, o1);
68 }
69 }
70
71 @Run(test = {"testNoUnrolling"})
72 void run() {
73 testNoUnrolling(new Outer(), new Object());
74 }
75 }
|