// Create an empty int[] to force loading the int[] class before compiling // TestCase.deoptimizeNewInstance. // This makes sure the compiler can properly type int[] and not bail. staticint[] emptyArray = newint[0];
{ // If the JIT is enabled, ensure it has compiled the method to force the deopt.
ensureJitCompiled(c, "deoptimizeNewInstance");
Method m = c.getMethod("deoptimizeNewInstance", int[].class, byte[].class); try {
m.invoke(null, new Object[] { newint[] { 1, 2, 3 }, testData });
} catch (InvocationTargetException ex) { if (ex.getCause() instanceof ArrayIndexOutOfBoundsException) { // Expected.
} else { throw ex.getCause();
}
}
}
{
Method m = c.getMethod("removeNewInstance", byte[].class);
String result = (String) m.invoke(null, new Object[] { testData });
assertEqual(testString, result);
}
{
Method m = c.getMethod("irreducibleLoopAndStringInit1", byte[].class, boolean.class);
String result = (String) m.invoke(null, new Object[] { testData, true });
assertEqual(testString, result);
result = (String) m.invoke(null, new Object[] { testData, false });
assertEqual(testString, result);
}
{
Method m = c.getMethod("irreducibleLoopAndStringInit2", byte[].class, boolean.class);
String result = (String) m.invoke(null, new Object[] { testData, true });
assertEqual(testString, result);
result = (String) m.invoke(null, new Object[] { testData, false });
assertEqual(testString, result);
}
{
Method m = c.getMethod("irreducibleLoopAndStringInit3", byte[].class, boolean.class);
String result = (String) m.invoke(null, new Object[] { testData, true });
assertEqual(testString, result);
result = (String) m.invoke(null, new Object[] { testData, false });
assertEqual(testString, result);
}
{
Method m = c.getMethod("loopAndStringInit", byte[].class, boolean.class);
String result = (String) m.invoke(null, new Object[] { testData, true });
assertEqual(testString, result);
result = (String) m.invoke(null, new Object[] { testData, false });
assertEqual(testString, result);
}
{
Method m = c.getMethod("loopAndStringInitAlias", byte[].class, boolean.class);
String result = (String) m.invoke(null, new Object[] { testData, true });
assertEqual(testString, result);
result = (String) m.invoke(null, new Object[] { testData, false });
assertEqual(testString, result);
}
{
Method m = c.getMethod("loopAndStringInitAndTest", byte[].class, boolean.class);
String result = (String) m.invoke(null, new Object[] { testData, true });
assertEqual(testString, result);
result = (String) m.invoke(null, new Object[] { testData, false });
assertEqual(testString, result);
}
{ // If the JIT is enabled, ensure it has compiled the method to force the deopt.
ensureJitCompiled(c, "deoptimizeNewInstanceAfterLoop");
Method m = c.getMethod( "deoptimizeNewInstanceAfterLoop", int[].class, byte[].class, int.class); try {
m.invoke(null, new Object[] { newint[] { 1, 2, 3 }, testData, 0 });
} catch (InvocationTargetException ex) { if (ex.getCause() instanceof ArrayIndexOutOfBoundsException) { // Expected.
} else { throw ex.getCause();
}
}
}
{
Method m = c.getMethod("loopAndStringInitAndPhi", byte[].class, boolean.class);
String result = (String) m.invoke(null, new Object[] { testData, true });
assertEqual(testString, result);
result = (String) m.invoke(null, new Object[] { testData, false });
assertEqual(testString, result);
}
{
Method m =
c.getMethod("loopAndTwoStringInitAndPhi", byte[].class, boolean.class, boolean.class);
String result = (String) m.invoke(null, new Object[] { testData, false, false });
assertEqual(testString, result);
result = (String) m.invoke(null, new Object[] { testData, false, true });
assertEqual(testString, result);
}
{
Method m = c.getMethod("stringAndCatch", byte[].class, boolean.class);
String result = (String) m.invoke(null, new Object[] { testData, false });
assertEqual(testString, result);
}
{
Method m = c.getMethod("stringAndCatch2", byte[].class, boolean.class);
String result = (String) m.invoke(null, new Object[] { testData, false });
assertEqual(testString, result);
}
{
Method m = c.getMethod("stringAndCatch3", byte[].class, boolean.class);
String result = (String) m.invoke(null, new Object[] { testData, false });
assertEqual(testString, result);
}
}
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.