Search in sources :

Example 51 with NormalMethod

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

the class BaselineCompilerImplTest method emptyStaticMethodInClassWithDynamicBridgeRequires32WordsForWhenSSE2_FULLisFalse.

@Test
public void emptyStaticMethodInClassWithDynamicBridgeRequires32WordsForWhenSSE2_FULLisFalse() throws Exception {
    assumeThat(VM.BuildForSSE2Full, is(false));
    Class<?>[] noArgs = {};
    NormalMethod emptyStaticMethod = TestingTools.getNormalMethod(DynamicBridgeMethodsForTests.class, "emptyStaticMethodInClassWithDynamicBridge", noArgs);
    int size = BaselineCompilerImpl.calculateRequiredSpaceForFrame(emptyStaticMethod);
    assertThat(size, is(32 * WORDSIZE));
}
Also used : NormalMethod(org.jikesrvm.classloader.NormalMethod) Test(org.junit.Test)

Example 52 with NormalMethod

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

the class BaselineCompilerImplTest method emptyInstanceMethodWithParamsRequiresThreeWords.

@Test
public void emptyInstanceMethodWithParamsRequiresThreeWords() throws Exception {
    Class<?>[] args = { Object.class, double.class, int.class, long.class };
    NormalMethod emptyInstanceMethod = TestingTools.getNormalMethod(MethodsForTests.class, "emptyInstanceMethodWithParams", args);
    int size = BaselineCompilerImpl.calculateRequiredSpaceForFrame(emptyInstanceMethod);
    assertThat(size, is(3 * WORDSIZE));
}
Also used : NormalMethod(org.jikesrvm.classloader.NormalMethod) Test(org.junit.Test)

Example 53 with NormalMethod

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

the class BaselineCompilerImplTest method printRandomIntegerMethodRequiresSixWords.

@Test
public void printRandomIntegerMethodRequiresSixWords() throws Exception {
    Class<?>[] noArgs = {};
    NormalMethod printRandomIntegerMethod = TestingTools.getNormalMethod(MethodsForTests.class, "printRandomInteger", noArgs);
    int size = BaselineCompilerImpl.calculateRequiredSpaceForFrame(printRandomIntegerMethod);
    assertThat(size, is(6 * WORDSIZE));
}
Also used : NormalMethod(org.jikesrvm.classloader.NormalMethod) Test(org.junit.Test)

Example 54 with NormalMethod

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

the class BaselineCompilerImplTest method multiplyByAFewPrimesRequiresFiveWords.

@Test
public void multiplyByAFewPrimesRequiresFiveWords() throws Exception {
    NormalMethod multiplyByAFewPrimesMethod = TestingTools.getNormalMethod(MethodsForTests.class, "multiplyByAFewPrimes", int.class);
    int size = BaselineCompilerImpl.calculateRequiredSpaceForFrame(multiplyByAFewPrimesMethod);
    assertThat(size, is(5 * WORDSIZE));
}
Also used : NormalMethod(org.jikesrvm.classloader.NormalMethod) Test(org.junit.Test)

Example 55 with NormalMethod

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

the class BaselineGCMapIteratorTest method getNextReferenceAddressReturnsCorrectReferenceIfReferencesArePresent.

@Test
public void getNextReferenceAddressReturnsCorrectReferenceIfReferencesArePresent() throws Exception {
    NormalMethod nm = TestingTools.getNormalMethod(MethodsForTests.class, "emptyStaticMethodWithObjectParam", Object.class);
    CompiledMethod cm = nm.getCurrentCompiledMethod();
    // Fake a stack frame
    int stackWords = 5;
    WordArray wa = createNonMovableWordArray(stackWords);
    for (int i = 0; i < wa.length(); i++) {
        wa.set(i, Word.fromIntSignExtend(5 * i));
    }
    int targetSlot = wa.length() - 1;
    Address fp = Magic.objectAsAddress(wa).plus(targetSlot * BYTES_IN_WORD);
    // local 0 is reference.
    // +/- 0 words: FP
    // - 1 words: CMID
    // - 2 words: saved GPRs (EDI)
    // - 3 words: saved GPRs (EBX)
    // - 4 words: local0 == reference
    Address targetAddress = fp.minus(4 * BYTES_IN_STACKSLOT);
    Word targetContents = targetAddress.loadWord();
    gcMapIter.setupIterator(cm, Offset.fromIntZeroExtend(cm.getEntryCodeArray().length()), fp);
    Address referenceAddr = gcMapIter.getNextReferenceAddress();
    assertEquals(targetAddress, referenceAddr);
    assertEquals(targetContents, referenceAddr.loadWord());
}
Also used : Word(org.vmmagic.unboxed.Word) Address(org.vmmagic.unboxed.Address) NormalMethod(org.jikesrvm.classloader.NormalMethod) WordArray(org.vmmagic.unboxed.WordArray) TestingTools.createNonMovableWordArray(org.jikesrvm.tests.util.TestingTools.createNonMovableWordArray) CompiledMethod(org.jikesrvm.compilers.common.CompiledMethod) Test(org.junit.Test)

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