1 class BadGraphVolatile { 2 // use volatile to force c2 to load it again 3 volatile int value; 4 5 BadGraphVolatile(int value) { 6 this.value = value; 7 } 8 9 void blackhole(int field) { 10 assert field == 42 :" wrong answer"; 11 } 12 13 public static void foo(int value) { 14 var x = new BadGraphVolatile(value); 15 x.blackhole(x.value); 16 return; 17 } 18 19 public static void main(String[] args) { 20 for (int i = 0; i < 30_000; ++i) { 21 foo(42); 22 } 23 } 24 }