Search in sources :

Example 21 with DefaultInlineOracle

use of org.jikesrvm.compilers.opt.inlining.DefaultInlineOracle in project JikesRVM by JikesRVM.

the class GenerationContextTest method getLocalNumberReturnsLocalNumberForRegistersCreateViaMakeLocal.

@Test
public void getLocalNumberReturnsLocalNumberForRegistersCreateViaMakeLocal() throws Exception {
    Class<?>[] argumentTypes = { Object.class, double.class, int.class, long.class };
    NormalMethod nm = getNormalMethodForTest("emptyInstanceMethodWithParams", argumentTypes);
    CompiledMethod cm = new OptCompiledMethod(-1, nm);
    OptOptions opts = new OptOptions();
    InlineOracle io = new DefaultInlineOracle();
    GenerationContext gc = new GenerationContext(nm, null, cm, opts, io);
    int thisLocalNumber = 0;
    TypeReference localType = nm.getDeclaringClass().getTypeRef();
    RegisterOperand thisRegOp = gc.makeLocal(thisLocalNumber, localType);
    Register thisReg = thisRegOp.getRegister();
    assertThat(gc.getLocalNumberFor(thisReg, localType), is(thisLocalNumber));
}
Also used : OptCompiledMethod(org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod) DefaultInlineOracle(org.jikesrvm.compilers.opt.inlining.DefaultInlineOracle) InlineOracle(org.jikesrvm.compilers.opt.inlining.InlineOracle) OptOptions(org.jikesrvm.compilers.opt.OptOptions) OptCompiledMethod(org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod) CompiledMethod(org.jikesrvm.compilers.common.CompiledMethod) RegisterOperand(org.jikesrvm.compilers.opt.ir.operand.RegisterOperand) Register(org.jikesrvm.compilers.opt.ir.Register) NormalMethod(org.jikesrvm.classloader.NormalMethod) DefaultInlineOracle(org.jikesrvm.compilers.opt.inlining.DefaultInlineOracle) TypeReference(org.jikesrvm.classloader.TypeReference) Test(org.junit.Test)

Example 22 with DefaultInlineOracle

use of org.jikesrvm.compilers.opt.inlining.DefaultInlineOracle in project JikesRVM by JikesRVM.

the class GenerationContextTest method childContextsSaveOSRBarrierInformationInOutermostParent.

@Test
public void childContextsSaveOSRBarrierInformationInOutermostParent() throws Exception {
    NormalMethod nm = getNormalMethodForTest("methodForInliningTests");
    CompiledMethod cm = new OptCompiledMethod(-1, nm);
    OptOptions opts = new OptOptions();
    InlineOracle io = new DefaultInlineOracle();
    GenerationContext outermost = new GenerationContext(nm, null, cm, opts, io);
    Class<?>[] classArgs = { Object.class };
    NormalMethod callee = getNormalMethodForTest("emptyStaticMethodWithObjectParamAndReturnValue", classArgs);
    MethodOperand methOp = MethodOperand.STATIC(callee);
    RegisterOperand result = createMockRegisterOperand(TypeReference.JavaLangObject);
    Instruction callInstr = Call.create(CALL, result, null, methOp, 1);
    RegisterOperand objectParam = createMockRegisterOperand(TypeReference.JavaLangObject);
    Call.setParam(callInstr, 0, objectParam);
    callInstr.setPosition(new InlineSequence(nm));
    ExceptionHandlerBasicBlockBag ebag = getMockEbag();
    GenerationContext child = outermost.createChildContext(ebag, callee, callInstr);
    Instruction osrBarrier = createMockOSRBarrier();
    Instruction call = createMockCall();
    child.saveOSRBarrierForInst(osrBarrier, call);
    assertThat(outermost.getOSRBarrierFromInst(call), is(osrBarrier));
    GenerationContext child2 = child.createChildContext(ebag, callee, callInstr);
    Instruction osrBarrier2 = createMockOSRBarrier();
    Instruction call2 = createMockCall();
    child2.saveOSRBarrierForInst(osrBarrier2, call2);
    assertThat(outermost.getOSRBarrierFromInst(call2), is(osrBarrier2));
}
Also used : OptCompiledMethod(org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod) DefaultInlineOracle(org.jikesrvm.compilers.opt.inlining.DefaultInlineOracle) InlineOracle(org.jikesrvm.compilers.opt.inlining.InlineOracle) OptOptions(org.jikesrvm.compilers.opt.OptOptions) Instruction(org.jikesrvm.compilers.opt.ir.Instruction) OptCompiledMethod(org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod) CompiledMethod(org.jikesrvm.compilers.common.CompiledMethod) MethodOperand(org.jikesrvm.compilers.opt.ir.operand.MethodOperand) ExceptionHandlerBasicBlockBag(org.jikesrvm.compilers.opt.ir.ExceptionHandlerBasicBlockBag) RegisterOperand(org.jikesrvm.compilers.opt.ir.operand.RegisterOperand) NormalMethod(org.jikesrvm.classloader.NormalMethod) DefaultInlineOracle(org.jikesrvm.compilers.opt.inlining.DefaultInlineOracle) InlineSequence(org.jikesrvm.compilers.opt.inlining.InlineSequence) Test(org.junit.Test)

Example 23 with DefaultInlineOracle

use of org.jikesrvm.compilers.opt.inlining.DefaultInlineOracle in project JikesRVM by JikesRVM.

the class GenerationContextTest method threadLocalSynchronizedStaticMethodDoesNotHaveMonitorEnterAndMonitorExit.

@Test
public void threadLocalSynchronizedStaticMethodDoesNotHaveMonitorEnterAndMonitorExit() throws Exception {
    NormalMethod nm = getNormalMethodForTest("emptySynchronizedStaticMethod");
    CompiledMethod cm = new OptCompiledMethod(-1, nm);
    OptOptions opts = new OptOptions();
    opts.ESCAPE_INVOKEE_THREAD_LOCAL = true;
    InlineOracle io = new DefaultInlineOracle();
    GenerationContext gc = new GenerationContext(nm, null, cm, opts, io);
    assertThatStateIsCorrectForUnsynchronizedEmptyStaticMethod(nm, cm, io, gc);
}
Also used : OptCompiledMethod(org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod) DefaultInlineOracle(org.jikesrvm.compilers.opt.inlining.DefaultInlineOracle) InlineOracle(org.jikesrvm.compilers.opt.inlining.InlineOracle) NormalMethod(org.jikesrvm.classloader.NormalMethod) DefaultInlineOracle(org.jikesrvm.compilers.opt.inlining.DefaultInlineOracle) OptOptions(org.jikesrvm.compilers.opt.OptOptions) OptCompiledMethod(org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod) CompiledMethod(org.jikesrvm.compilers.common.CompiledMethod) Test(org.junit.Test)

Example 24 with DefaultInlineOracle

use of org.jikesrvm.compilers.opt.inlining.DefaultInlineOracle in project JikesRVM by JikesRVM.

the class GenerationContextTest method methodIsSelectedForDebuggingWithMethodToPrintReturnsTrueIfMethodOfContextMatches.

@Test
public void methodIsSelectedForDebuggingWithMethodToPrintReturnsTrueIfMethodOfContextMatches() throws Exception {
    String methodName = "emptyStaticMethodWithoutAnnotations";
    NormalMethod nm = getNormalMethodForTest(methodName);
    CompiledMethod cm = new OptCompiledMethod(-1, nm);
    OptOptions opts = buildOptionsWithMethodToPrintOptionSet(methodName);
    InlineOracle io = new DefaultInlineOracle();
    GenerationContext gc = new GenerationContext(nm, null, cm, opts, io);
    assertThat(gc.methodIsSelectedForDebuggingWithMethodToPrint(), is(true));
}
Also used : OptCompiledMethod(org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod) DefaultInlineOracle(org.jikesrvm.compilers.opt.inlining.DefaultInlineOracle) InlineOracle(org.jikesrvm.compilers.opt.inlining.InlineOracle) NormalMethod(org.jikesrvm.classloader.NormalMethod) DefaultInlineOracle(org.jikesrvm.compilers.opt.inlining.DefaultInlineOracle) OptOptions(org.jikesrvm.compilers.opt.OptOptions) OptCompiledMethod(org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod) CompiledMethod(org.jikesrvm.compilers.common.CompiledMethod) Test(org.junit.Test)

Example 25 with DefaultInlineOracle

use of org.jikesrvm.compilers.opt.inlining.DefaultInlineOracle in project JikesRVM by JikesRVM.

the class GenerationContextTest method transferStateUpdatesFieldsInParentFromChild.

@Test
public void transferStateUpdatesFieldsInParentFromChild() throws Exception {
    NormalMethod nm = getNormalMethodForTest("emptyStaticMethodWithoutAnnotations");
    CompiledMethod cm = new OptCompiledMethod(-1, nm);
    OptOptions opts = new OptOptions();
    InlineOracle io = new DefaultInlineOracle();
    GenerationContext parent = new GenerationContext(nm, null, cm, opts, io);
    int targetNumberOfNodes = 23456789;
    assertThatContextIsInExpectedState(parent, targetNumberOfNodes);
    NormalMethod interruptibleCallee = getNormalMethodForTest("emptyStaticMethodWithoutAnnotations");
    Instruction callInstr = buildCallInstructionForStaticMethodWithoutReturn(interruptibleCallee, nm);
    ExceptionHandlerBasicBlockBag ebag = getMockEbag();
    GenerationContext child = parent.createChildContext(ebag, interruptibleCallee, callInstr);
    setTransferableProperties(targetNumberOfNodes, child);
    child.transferStateToParent();
    assertThatStateWasTransferedToOtherContext(parent, targetNumberOfNodes);
}
Also used : OptCompiledMethod(org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod) DefaultInlineOracle(org.jikesrvm.compilers.opt.inlining.DefaultInlineOracle) InlineOracle(org.jikesrvm.compilers.opt.inlining.InlineOracle) NormalMethod(org.jikesrvm.classloader.NormalMethod) DefaultInlineOracle(org.jikesrvm.compilers.opt.inlining.DefaultInlineOracle) OptOptions(org.jikesrvm.compilers.opt.OptOptions) Instruction(org.jikesrvm.compilers.opt.ir.Instruction) OptCompiledMethod(org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod) CompiledMethod(org.jikesrvm.compilers.common.CompiledMethod) ExceptionHandlerBasicBlockBag(org.jikesrvm.compilers.opt.ir.ExceptionHandlerBasicBlockBag) Test(org.junit.Test)

Aggregations

NormalMethod (org.jikesrvm.classloader.NormalMethod)28 CompiledMethod (org.jikesrvm.compilers.common.CompiledMethod)28 OptOptions (org.jikesrvm.compilers.opt.OptOptions)28 DefaultInlineOracle (org.jikesrvm.compilers.opt.inlining.DefaultInlineOracle)28 InlineOracle (org.jikesrvm.compilers.opt.inlining.InlineOracle)28 OptCompiledMethod (org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod)28 Test (org.junit.Test)28 RegisterOperand (org.jikesrvm.compilers.opt.ir.operand.RegisterOperand)19 Instruction (org.jikesrvm.compilers.opt.ir.Instruction)18 InlineSequence (org.jikesrvm.compilers.opt.inlining.InlineSequence)17 ExceptionHandlerBasicBlockBag (org.jikesrvm.compilers.opt.ir.ExceptionHandlerBasicBlockBag)14 BasicBlock (org.jikesrvm.compilers.opt.ir.BasicBlock)12 ExceptionHandlerBasicBlock (org.jikesrvm.compilers.opt.ir.ExceptionHandlerBasicBlock)12 MethodOperand (org.jikesrvm.compilers.opt.ir.operand.MethodOperand)12 TypeReference (org.jikesrvm.classloader.TypeReference)7 ClassConstantOperand (org.jikesrvm.compilers.opt.ir.operand.ClassConstantOperand)6 ObjectConstantOperand (org.jikesrvm.compilers.opt.ir.operand.ObjectConstantOperand)6 Operand (org.jikesrvm.compilers.opt.ir.operand.Operand)6 TrueGuardOperand (org.jikesrvm.compilers.opt.ir.operand.TrueGuardOperand)6 TypeOperand (org.jikesrvm.compilers.opt.ir.operand.TypeOperand)6