use of org.jikesrvm.classloader.NormalMethod in project JikesRVM by JikesRVM.
the class OptTestHarnessTest method methodsCompiledUsingExecutedAndRunAreNotCounted.
@Test
public void methodsCompiledUsingExecutedAndRunAreNotCounted() throws Exception {
String[] executeAndRun = { "-er", CLASS_WITH_STATIC_METHOD, "printMessage", "-" };
executeOTHWithStreamRedirection(executeAndRun);
assertThatNoAdditionalErrorsHaveOccurred();
assertThatNumberOfBaselineCompiledMethodsIs(0);
assertThatNumberOfOptCompiledMethodsIs(0);
Class<?> testClass3 = Class.forName(CLASS_WITH_STATIC_METHOD);
NormalMethod printMessage = TestingTools.getNormalMethod(testClass3, "printMessage");
assertThatOutputContainsMessageForCompiledMethod(printMessage);
removeCompiledMethodMessageFromStandardOutput(printMessage);
String output = getStandardOutput();
String expectedOutput = lineEnd + OptTestHarness.startOfExecutionString(printMessage) + lineEnd + ClassWithStaticMethod.PRINTOUT + lineEnd + OptTestHarness.endOfExecutionString(printMessage) + lineEnd + OptTestHarness.resultString(null) + lineEnd;
assertThat(output, equalTo(expectedOutput));
}
use of org.jikesrvm.classloader.NormalMethod in project JikesRVM by JikesRVM.
the class OptTestHarnessTest method methodsWillBeBaselineCompiledIfRequested.
@Test
@Category(RequiresOptCompiler.class)
public void methodsWillBeBaselineCompiledIfRequested() throws Exception {
String[] compileClass = { "-methodBase", ABSTRACT_CLASS_WITH_EMPTY_METHOD, "emptyMethod", "-" };
executeOptTestHarness(compileClass);
assertThatNumberOfBaselineCompiledMethodsIs(1);
assertThatNumberOfOptCompiledMethodsIs(0);
assertThatNoAdditionalErrorsHaveOccurred();
Class<?> testClass2 = Class.forName(ABSTRACT_CLASS_WITH_EMPTY_METHOD);
NormalMethod emptyMethod = TestingTools.getNormalMethod(testClass2, "emptyMethod");
assertThatOutputContainsMessageForCompiledMethod(emptyMethod);
removeCompiledMethodMessageFromStandardOutput(emptyMethod);
assertThatRemainingOutputIsEmptyWhenTrimmed();
}
use of org.jikesrvm.classloader.NormalMethod in project JikesRVM by JikesRVM.
the class OptTestHarnessTest method methodsAreOptCompiledByDefaultWhenSingleMethodIsCompiled.
@Test
@Category(RequiresOptCompiler.class)
public void methodsAreOptCompiledByDefaultWhenSingleMethodIsCompiled() throws Exception {
String[] compileClass = { "-method", ABSTRACT_CLASS_WITH_EMPTY_METHOD, "emptyMethod", "-" };
executeOptTestHarness(compileClass);
assertThatNumberOfBaselineCompiledMethodsIs(0);
assertThatNumberOfOptCompiledMethodsIs(1);
assertThatNoAdditionalErrorsHaveOccurred();
Class<?> testClass2 = Class.forName(ABSTRACT_CLASS_WITH_EMPTY_METHOD);
NormalMethod emptyMethod = TestingTools.getNormalMethod(testClass2, "emptyMethod");
assertThatOutputContainsMessageForCompiledMethod(emptyMethod);
removeCompiledMethodMessageFromStandardOutput(emptyMethod);
assertThatRemainingOutputIsEmptyWhenTrimmed();
}
use of org.jikesrvm.classloader.NormalMethod in project JikesRVM by JikesRVM.
the class OptTestHarnessTest method executeAndRunCanDistinguishMethodsBasedOnDescriptors.
@Test
public void executeAndRunCanDistinguishMethodsBasedOnDescriptors() throws Exception {
double d = -1.5d;
String numberString = Double.toString(d);
String[] compilePrintIntMethod = { "-er", CLASS_OVERLOADED_METHODS, "print", "(D)V", numberString };
executeOTHWithStreamRedirection(compilePrintIntMethod);
assertThatNumberOfBaselineCompiledMethodsIs(0);
assertThatNumberOfOptCompiledMethodsIs(0);
assertThatNoAdditionalErrorsHaveOccurred();
Class<?> classWithOverloadedMethods = Class.forName(CLASS_OVERLOADED_METHODS);
NormalMethod printMethod = TestingTools.getNormalMethod(classWithOverloadedMethods, "print", double.class);
assertThatOutputContainsMessageForCompiledMethod(printMethod);
removeCompiledMethodMessageFromStandardOutput(printMethod);
String output = getStandardOutput();
String expectedOutput = lineEnd + OptTestHarness.startOfExecutionString(printMethod) + lineEnd + numberString + lineEnd + OptTestHarness.endOfExecutionString(printMethod) + lineEnd + OptTestHarness.resultString(null) + lineEnd;
assertThat(output, equalTo(expectedOutput));
}
use of org.jikesrvm.classloader.NormalMethod in project JikesRVM by JikesRVM.
the class TestingTools method getNormalMethod.
public static NormalMethod getNormalMethod(Class<?> declaringClass, String name, Class<?>... argumentTypes) throws Exception {
Method m = declaringClass.getMethod(name, argumentTypes);
RVMMethod rvmm = JikesRVMSupport.getMethodOf(m);
return (NormalMethod) rvmm;
}
Aggregations