publicstaticvoid main(String[] args) throws Exception {
System.loadLibrary(args[0]); // Only test stack frames in compiled mode. if (!hasJit()) {
disableStackFrameAsserts();
}
// Just declare a new int array so that the int arrays are resolved properly when JITing. int[] tmp = newint[3];
ensureAllJitCompiled();
final HashMap<SampleObject, Long> map = new HashMap<SampleObject, Long>();
publicvoid runInternal() { int[] arr = newint[3];
assertIsManaged(); int res = $noinline$run1(arr);
assertIsManaged(); // Only single frame is deoptimized. if (res != 79) {
System.out.println("Failure 1!");
System.exit(0);
}
}
});
// Single-frame deoptimization that covers a full fragment.
execute(new Runnable() { publicvoid run() {
ensureJitCompiled(this.getClass(), "runInternal");
runInternal();
}
publicvoid runInternal() { try { int[] arr = newint[3];
assertIsManaged(); // Use reflection to call $noinline$run2 so that it does // full-fragment deoptimization since that is an upcall. Class<?> cls = Class.forName("Main");
Method method = cls.getDeclaredMethod("$noinline$run2", int[].class); double res = (double)method.invoke(Main.class, arr);
assertIsManaged(); // Only single frame is deoptimized. if (res != 79.3d) {
System.out.println("Failure 2!");
System.exit(0);
}
} catch (Exception e) {
e.printStackTrace(System.out);
}
}
});
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.