Search in sources :

Example 46 with NormalMethod

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

the class OptCompiledMethod method getDynamicLink.

/**
 * Fetch symbolic reference to a method that's called
 * by one of this method's instructions.
 * @param dynamicLink place to put return information
 * @param instructionOffset offset of machine instruction that issued
 *                          the call
 */
@Override
public void getDynamicLink(DynamicLink dynamicLink, Offset instructionOffset) {
    int bci = _mcMap.getBytecodeIndexForMCOffset(instructionOffset);
    NormalMethod realMethod = _mcMap.getMethodForMCOffset(instructionOffset);
    if (bci == -1 || realMethod == null) {
        VM.sysFail("Mapping to source code location not available at Dynamic Linking point\n");
    }
    realMethod.getDynamicLink(dynamicLink, bci);
}
Also used : NormalMethod(org.jikesrvm.classloader.NormalMethod)

Example 47 with NormalMethod

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

the class OptCompiledMethod method printStackTrace.

@Override
@Interruptible
public void printStackTrace(Offset instructionOffset, PrintLN out) {
    OptMachineCodeMap map = getMCMap();
    int iei = map.getInlineEncodingForMCOffset(instructionOffset);
    if (iei >= 0) {
        int[] inlineEncoding = map.inlineEncoding;
        int bci = map.getBytecodeIndexForMCOffset(instructionOffset);
        for (int j = iei; j >= 0; j = OptEncodedCallSiteTree.getParent(j, inlineEncoding)) {
            int mid = OptEncodedCallSiteTree.getMethodID(j, inlineEncoding);
            NormalMethod m = (NormalMethod) MemberReference.getMethodRef(mid).peekResolvedMethod();
            // might be 0 if unavailable.
            int lineNumber = m.getLineNumberForBCIndex(bci);
            out.print("\tat ");
            out.print(m.getDeclaringClass());
            out.print('.');
            out.print(m.getName());
            out.print('(');
            out.print(m.getDeclaringClass().getSourceName());
            out.print(':');
            out.print(lineNumber);
            out.print(')');
            out.println();
            if (j > 0) {
                bci = OptEncodedCallSiteTree.getByteCodeOffset(j, inlineEncoding);
            }
        }
    } else {
        out.print("\tat ");
        out.print(method.getDeclaringClass());
        out.print('.');
        out.print(method.getName());
        out.print('(');
        out.print(method.getDeclaringClass().getSourceName());
        out.print("; machine code offset: ");
        out.printHex(instructionOffset.toInt());
        out.print(')');
        out.println();
    }
}
Also used : NormalMethod(org.jikesrvm.classloader.NormalMethod) Interruptible(org.vmmagic.pragma.Interruptible)

Example 48 with NormalMethod

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

the class OptLinker method resolveDynamicLink.

/**
 * Given an opt compiler info and a machine code offset in that method's
 * instruction array, performs the dynamic linking required by that
 * instruction.
 * <p>
 * We do this by mapping back to the source RVMMethod and bytecode offset,
 * then examining the bytecodes to see what field/method was being
 * referenced, then calling TableBasedDynamicLinker to do the real work.
 *
 * @param cm the opt compiled method
 * @param offset machine code offset
 */
public static void resolveDynamicLink(OptCompiledMethod cm, Offset offset) throws NoClassDefFoundError {
    OptMachineCodeMap map = cm.getMCMap();
    int bci = map.getBytecodeIndexForMCOffset(offset);
    NormalMethod realMethod = map.getMethodForMCOffset(offset);
    if (bci == -1 || realMethod == null) {
        VM.sysFail("Mapping to source code location not available at Dynamic Linking point\n");
    }
    BytecodeStream bcodes = realMethod.getBytecodes();
    bcodes.reset(bci);
    int opcode = bcodes.nextInstruction();
    switch(opcode) {
        case JBC_getfield:
        case JBC_putfield:
        case JBC_getstatic:
        case JBC_putstatic:
            TableBasedDynamicLinker.resolveMember(bcodes.getFieldReference());
            break;
        case JBC_invokevirtual:
        case JBC_invokestatic:
        case JBC_invokespecial:
            TableBasedDynamicLinker.resolveMember(bcodes.getMethodReference());
            break;
        case JBC_invokeinterface:
        default:
            if (VM.VerifyAssertions) {
                VM._assert(VM.NOT_REACHED, "Unexpected case in OptLinker.resolveDynamicLink");
            }
            break;
    }
}
Also used : NormalMethod(org.jikesrvm.classloader.NormalMethod) BytecodeStream(org.jikesrvm.classloader.BytecodeStream) Entrypoint(org.vmmagic.pragma.Entrypoint)

Example 49 with NormalMethod

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

the class BaselineCompilerImplTest method emptyStaticMethodInClassWithDynamicBridgeRequiresThirteenWordsForSSE2_FULLAndX64.

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

Example 50 with NormalMethod

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

the class BaselineCompilerImplTest method emptyStaticMethodRequiresThreeWords.

@Test
public void emptyStaticMethodRequiresThreeWords() throws Exception {
    Class<?>[] noArgs = {};
    NormalMethod emptyStaticMethod = TestingTools.getNormalMethod(MethodsForTests.class, "emptyStaticMethodWithoutAnnotations", noArgs);
    int size = BaselineCompilerImpl.calculateRequiredSpaceForFrame(emptyStaticMethod);
    assertThat(size, is(3 * WORDSIZE));
}
Also used : NormalMethod(org.jikesrvm.classloader.NormalMethod) 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