Search in sources :

Example 91 with NormalMethod

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));
}
Also used : NormalMethod(org.jikesrvm.classloader.NormalMethod) Test(org.junit.Test)

Example 92 with NormalMethod

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();
}
Also used : NormalMethod(org.jikesrvm.classloader.NormalMethod) Category(org.junit.experimental.categories.Category) Test(org.junit.Test)

Example 93 with NormalMethod

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();
}
Also used : NormalMethod(org.jikesrvm.classloader.NormalMethod) Category(org.junit.experimental.categories.Category) Test(org.junit.Test)

Example 94 with NormalMethod

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));
}
Also used : NormalMethod(org.jikesrvm.classloader.NormalMethod) Test(org.junit.Test)

Example 95 with NormalMethod

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;
}
Also used : RVMMethod(org.jikesrvm.classloader.RVMMethod) NormalMethod(org.jikesrvm.classloader.NormalMethod) NormalMethod(org.jikesrvm.classloader.NormalMethod) RVMMethod(org.jikesrvm.classloader.RVMMethod) Method(java.lang.reflect.Method)

Aggregations

NormalMethod (org.jikesrvm.classloader.NormalMethod)95 Test (org.junit.Test)66 OptOptions (org.jikesrvm.compilers.opt.OptOptions)45 CompiledMethod (org.jikesrvm.compilers.common.CompiledMethod)41 OptCompiledMethod (org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod)31 DefaultInlineOracle (org.jikesrvm.compilers.opt.inlining.DefaultInlineOracle)28 InlineOracle (org.jikesrvm.compilers.opt.inlining.InlineOracle)28 RegisterOperand (org.jikesrvm.compilers.opt.ir.operand.RegisterOperand)28 Instruction (org.jikesrvm.compilers.opt.ir.Instruction)21 InlineSequence (org.jikesrvm.compilers.opt.inlining.InlineSequence)17 TypeReference (org.jikesrvm.classloader.TypeReference)15 ExceptionHandlerBasicBlockBag (org.jikesrvm.compilers.opt.ir.ExceptionHandlerBasicBlockBag)15 MethodOperand (org.jikesrvm.compilers.opt.ir.operand.MethodOperand)15 BasicBlock (org.jikesrvm.compilers.opt.ir.BasicBlock)13 ExceptionHandlerBasicBlock (org.jikesrvm.compilers.opt.ir.ExceptionHandlerBasicBlock)13 Register (org.jikesrvm.compilers.opt.ir.Register)13 RVMMethod (org.jikesrvm.classloader.RVMMethod)8 Operand (org.jikesrvm.compilers.opt.ir.operand.Operand)8 TrueGuardOperand (org.jikesrvm.compilers.opt.ir.operand.TrueGuardOperand)8 TypeOperand (org.jikesrvm.compilers.opt.ir.operand.TypeOperand)8