Created
January 30, 2023 23:04
-
-
Save navyxliu/cb32d2990089d097705edc716a4c3c50 to your computer and use it in GitHub Desktop.
Example3_3.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// java -ea -Xms16m -Xmx16M -XX:+UnlockExperimentalVMOptions -XX:-UseOnStackReplacement -XX:+PrintEscapeAnalysis -XX:+PrintEliminateAllocations -XX:+UseEpsilonGC -XX:-UseTLAB -XX:+DoPartialEscapeAnalysis -XX:CompileCommand=compileonly,Example3_3::foo -XX:CompileCommand=dontinline,Example3_3::blackhole -XX:CompileCommand=quiet -Xbatch Example3_3 | |
class Example3_3 { | |
// use volatile to force c2 to load it again | |
volatile int value; | |
Example3_3(int value) { | |
this.value = value; | |
} | |
void blackhole(int field) { | |
assert field == 42 :" wrong answer"; | |
} | |
public static void foo(int value) { | |
var x = new Example3_3(value); | |
x.blackhole(x.value); | |
return; | |
} | |
public static void main(String[] args) { | |
long iterations = 0; | |
try { | |
while (true) { | |
foo(42); | |
iterations++; | |
} | |
} finally { | |
System.err.println("Epsilon Test: " + iterations); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have a patch to handle this, but I need more time to polish it.
put aside it because it's not a blocker.