use of org.jikesrvm.compilers.opt.inlining.InlineOracle 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));
}
use of org.jikesrvm.compilers.opt.inlining.InlineOracle 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));
}
use of org.jikesrvm.compilers.opt.inlining.InlineOracle 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);
}
use of org.jikesrvm.compilers.opt.inlining.InlineOracle 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));
}
use of org.jikesrvm.compilers.opt.inlining.InlineOracle 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);
}
Aggregations