Skip to content

Instantly share code, notes, and snippets.

/NewMain.java
Created May 25, 2017

Embed
What would you like to do?
Reproducation for HotSpot EA bug
public class NewMain {
public static void main(String[] args) {
System.out.println("BEGIN single");
for (int i = 0; i < 100_000_000; i++) {
single();
}
System.out.println("END single");
System.out.println("BEGIN multi");
for (int i = 0; i < 100_000_000; i++) {
multi();
}
System.out.println("DONE");
}
private static void single() {
final Object x = new Object();
Object[] array = new Object[]{x};
Object a = array[0];
}
private static void multi() {
final Object x = new Object();
final Object y = new Object();
Object[] array = new Object[]{x, y};
Object a = array[0];
Object b = array[1];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.