Search in sources :

Example 41 with NormalMethod

use of org.jikesrvm.classloader.NormalMethod in project JikesRVM by JikesRVM.

the class OptTestHarnessTest method defaultCompilerForMethodsIsBaselineWhenVMIsBuildWithoutOptCompiler.

@Test
@Category(RequiresLackOfOptCompiler.class)
public void defaultCompilerForMethodsIsBaselineWhenVMIsBuildWithoutOptCompiler() throws Exception {
    String[] compileClass = { "-method", 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 42 with NormalMethod

use of org.jikesrvm.classloader.NormalMethod in project JikesRVM by JikesRVM.

the class OptTestHarnessTest method methodsWillOptCompiledIfRequested.

@Test
@Category(RequiresOptCompiler.class)
public void methodsWillOptCompiledIfRequested() throws Exception {
    String[] compileClass = { "+baseline", "-methodOpt", 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 43 with NormalMethod

use of org.jikesrvm.classloader.NormalMethod in project JikesRVM by JikesRVM.

the class OptTestHarnessTest method methodOptionsCanDistinguishMethodsBasedOnDescriptors.

@Test
public void methodOptionsCanDistinguishMethodsBasedOnDescriptors() throws Exception {
    String[] compilePrintIntMethod = { "-methodBase", CLASS_OVERLOADED_METHODS, "print", "(I)V" };
    executeOptTestHarness(compilePrintIntMethod);
    assertThatNoAdditionalErrorsHaveOccurred();
    assertThatNumberOfBaselineCompiledMethodsIs(1);
    assertThatNumberOfOptCompiledMethodsIs(0);
    assertThatNoAdditionalErrorsHaveOccurred();
    Class<?> classWithOverloadedMethods = Class.forName(CLASS_OVERLOADED_METHODS);
    NormalMethod printMethod = TestingTools.getNormalMethod(classWithOverloadedMethods, "print", int.class);
    assertThatOutputContainsMessageForCompiledMethod(printMethod);
    removeCompiledMethodMessageFromStandardOutput(printMethod);
    assertThatRemainingOutputIsEmptyWhenTrimmed();
}
Also used : NormalMethod(org.jikesrvm.classloader.NormalMethod) Test(org.junit.Test)

Example 44 with NormalMethod

use of org.jikesrvm.classloader.NormalMethod in project JikesRVM by JikesRVM.

the class InvocationCounts method counterTripped.

/**
 * Called from baseline compiled code when a method's invocation counter
 * becomes negative and thus must be handled
 *
 * @param id the compiled method id
 */
@Entrypoint
static synchronized void counterTripped(int id) {
    // set counter to max int to avoid lots of redundant calls.
    counts[id] = 0x7fffffff;
    if (processed[id])
        return;
    processed[id] = true;
    CompiledMethod cm = CompiledMethods.getCompiledMethod(id);
    if (cm == null)
        return;
    if (VM.VerifyAssertions)
        VM._assert(cm.getCompilerType() == CompiledMethod.BASELINE);
    NormalMethod m = (NormalMethod) cm.getMethod();
    CompilationPlan compPlan = new CompilationPlan(m, _optPlan, null, _options);
    ControllerPlan cp = // 2.0 is a bogus number....
    new ControllerPlan(compPlan, Controller.controllerClock, id, 2.0, 2.0, 2.0);
    cp.execute();
}
Also used : NormalMethod(org.jikesrvm.classloader.NormalMethod) CompilationPlan(org.jikesrvm.compilers.opt.driver.CompilationPlan) ControllerPlan(org.jikesrvm.adaptive.controller.ControllerPlan) CompiledMethod(org.jikesrvm.compilers.common.CompiledMethod) Entrypoint(org.vmmagic.pragma.Entrypoint)

Example 45 with NormalMethod

use of org.jikesrvm.classloader.NormalMethod in project JikesRVM by JikesRVM.

the class OptCompiledMethod method isWithinUninterruptibleCode.

@Override
@Interruptible
public boolean isWithinUninterruptibleCode(Offset instructionOffset) {
    NormalMethod realMethod = _mcMap.getMethodForMCOffset(instructionOffset);
    // error message when no method is found.
    if (realMethod == null) {
        VM.sysWrite("Failing instruction offset: ");
        VM.sysWrite(instructionOffset);
        VM.sysWrite(" in method ");
        RVMMethod thisMethod = this.getMethod();
        VM.sysWrite(thisMethod.getName());
        VM.sysWrite(" with descriptor ");
        VM.sysWrite(thisMethod.getDescriptor());
        VM.sysWrite(" declared by class with descriptor ");
        VM.sysWriteln(thisMethod.getDeclaringClass().getDescriptor());
        String msg = "Couldn't find a method for given instruction offset";
        if (VM.VerifyAssertions) {
            VM._assert(NOT_REACHED, msg);
        } else {
            VM.sysFail(msg);
        }
    }
    return realMethod.isUninterruptible();
}
Also used : RVMMethod(org.jikesrvm.classloader.RVMMethod) NormalMethod(org.jikesrvm.classloader.NormalMethod) Interruptible(org.vmmagic.pragma.Interruptible)

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