staticclass MyThread extendsThread { publicvoid run() { // This will throw at `callMethodThatThrows` and trigger deoptimization checks which we used // to crash on. new Inner();
}
}
publicstaticclass Inner { // Have a <clinit> method invoke another <clinit> method to ensure we execute in the // interpreter. static { new Inner2();
}
}
publicstaticvoid main(String[] args) throws Exception {
System.loadLibrary(args[0]); // Disables use of nterp.
Main.setAsyncExceptionsThrown();
// Execute the test in a different thread, to ensure we still // return a 0 exit status. Thread t = new MyThread();
t.setUncaughtExceptionHandler((th, e) -> {
System.out.println("Caught exception");
});
t.start();
t.join();
}
publicstaticvoid callMethodThatThrows() { // Ensures we get deoptimization requests.
Main.forceInterpreterOnThread(); thrownew Error("");
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.