}
}
+ public static void assertEquals(int expected, int actual) {
+ if (expected != actual) {
+ throw new Error("Expected " + expected + ", got " + actual);
+ }
+ }
+
public static void main(String[] args) throws Exception {
System.loadLibrary(args[0]);
Main[] mains = new Main[3];
testInvokeVirtual(mains[1]);
testInvokeInterface(itfs[0]);
testInvokeInterface(itfs[1]);
+ $noinline$testInlineToSameTarget(mains[0]);
+ $noinline$testInlineToSameTarget(mains[1]);
}
ensureJittedAndPolymorphicInline();
// This will trigger a deoptimization of the compiled code.
assertEquals(OtherSubclass.class, testInvokeVirtual(mains[2]));
assertEquals(OtherSubclass.class, testInvokeInterface(itfs[2]));
+
+ // Run this once to make sure we execute the JITted code.
+ $noinline$testInlineToSameTarget(mains[0]);
+ assertEquals(20001, counter);
}
public Class sameInvokeVirtual() {
return m.sameInvokeVirtual();
}
+ public static void $noinline$testInlineToSameTarget(Main m) {
+ if (doThrow) throw new Error("");
+ m.increment();
+ }
+
public Object field = new Object();
public static native void ensureJittedAndPolymorphicInline();
+
+ public void increment() {
+ counter++;
+ }
+ public static int counter = 0;
+ public static boolean doThrow = false;
}
class Subclass extends Main {