// // Tests various entrypoints and patterns in simulator mode. // publicclass Main { // Class used for testing object allocation and resolution. staticclass ClassTest { int foo() { return1;
}
}
staticclass ClassTestExtends extends ClassTest {}
// Class used for testing non trivial instance of and class casting. staticfinalclass ClassTestFinal {}
for (int i = 0; i < LENGTH; i++) { for (int j = 0; j < LENGTH_SMALL; j++) {
expectEquals(j, a[i][j]);
}
}
System.out.println("LoopWithAllocations passed");
}
// Test the art_quick_resolve_type entrypoint. publicstaticClass $compile$testResolveType() { return ClassTest.class;
}
// Test the art_quick_alloc_object_initialized_rosalloc entrypoint. publicstatic Object $compile$testAllocObjectInitialized() {
Object x = new Object(); return x;
}
// Test the art_quick_alloc_object_resolved_rosalloc entrypoint. publicstatic ClassTest $compile$testAllocObjectResolved() {
ClassTest x = new ClassTest(); return x;
}
// Test object allocation entrypoints. publicstaticvoid testAllocObject() {
Object objVal = $compile$testAllocObjectInitialized(); if (objVal == null) {
System.out.println("Expected initialized object, but found NULL."); thrownew AssertionError();
}
ClassTest testObjVal = $compile$testAllocObjectResolved(); if (testObjVal == null) {
System.out.println("Expected resolved object, but found NULL."); thrownew AssertionError();
}
System.out.println("AllocObject passed");
}
// Test the InstanceOf entrypoint main path. publicstaticvoid $compile$testInstanceOfTrivial(Object o) {
Object obj = (ClassTest[]) o;
}
// Test the CheckInstanceOfNonTrivial entrypoint. publicstaticboolean $compile$testInstanceOfInterface(Object o) { return o instanceof Itf;
}
// Test the InstanceOf entrypoint by throwing a ClassCastException. publicstatic ClassTestFinal $compile$testThrowClassCastException(Object o) { return (ClassTestFinal) o;
}
// Test InstanceOf entrypoints. publicstaticvoid testInstanceOf() {
$compile$testInstanceOfTrivial(new ClassTestExtends[2]);
// Passes a null as an array and expects an exception; null check is implemented via // Equal+Deoptimize thus we actually do deoptimization and then throw an exception // from interpreter. publicstaticvoid testDeopt() { try {
$compile$noinline$plainLoop(null);
} catch (NullPointerException e) {
System.out.println("Exception caught: " + e.toString());
}
}
publicstaticvoid main(String[] args) throws Exception {
System.loadLibrary(args[0]);
Main obj = new Main();
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.