1 // -Xcomp -Xms16M -Xmx16M -XX:+AlwaysPreTouch -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -XX:-UseOnStackReplacement -XX:CompileOnly='Example2_merykitty.foo' -XX:CompileCommand=dontinline,Example2_merykitty.blackhole 2 class Example2_merykitty { 3 private static Object _cache1; 4 private static Object _cache2; 5 6 public void foo(boolean cond1, boolean cond2) { 7 Object x = new Object(); 8 9 blackhole(); 10 11 if (cond1) { 12 _cache1 = x; 13 } 14 15 blackhole(); 16 17 if (cond2) { 18 _cache2 = x; 19 } 20 } 21 22 public static void blackhole() {} 23 24 public static void main(String[] args) { 25 Example2_merykitty kase = new Example2_merykitty(); 26 long iterations = 0; 27 try { 28 while (true) { 29 boolean cond = 0 == (iterations & 0xf); 30 kase.foo(cond, cond); 31 assert Example2_merykitty._cache1 == Example2_merykitty._cache2 :"check"; 32 iterations++; 33 } 34 } finally { 35 System.err.println("Epsilon Test: " + iterations); 36 } 37 } 38 }