Search in sources :

Example 51 with RVMMethod

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

the class PartialCallGraph method getCallTargets.

/**
 * @param caller caller method
 * @param bcIndex bytecode index in caller method
 * @return the WeightedCallTargets currently associated with the
 *         given caller bytecodeIndex pair.
 */
public WeightedCallTargets getCallTargets(RVMMethod caller, int bcIndex) {
    MethodReference callerRef = caller.getMemberRef().asMethodReference();
    UnResolvedWeightedCallTargets unresolvedTargets = unresolvedCallGraph.get(new UnResolvedCallSite(callerRef, bcIndex));
    if (unresolvedTargets != null) {
        final RVMMethod fCaller = caller;
        final int fBcIndex = bcIndex;
        final PartialCallGraph pg = this;
        unresolvedTargets.visitTargets(new UnResolvedWeightedCallTargets.Visitor() {

            @Override
            public void visit(MethodReference calleeRef, double weight) {
                RVMMethod callee = calleeRef.getResolvedMember();
                if (callee != null) {
                    pg.incrementEdge(fCaller, fBcIndex, callee, (float) weight);
                }
            }
        });
    }
    return getCallTargets(new CallSite(caller, bcIndex));
}
Also used : UnResolvedWeightedCallTargets(org.jikesrvm.adaptive.util.UnResolvedWeightedCallTargets) RVMMethod(org.jikesrvm.classloader.RVMMethod) MethodReference(org.jikesrvm.classloader.MethodReference) UnResolvedCallSite(org.jikesrvm.adaptive.util.UnResolvedCallSite) UnResolvedCallSite(org.jikesrvm.adaptive.util.UnResolvedCallSite)

Example 52 with RVMMethod

use of org.jikesrvm.classloader.RVMMethod 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)

Example 53 with RVMMethod

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

the class OptMachineCodeMap method getNonInlinedCallSites.

/**
 * @return an arraylist of CallSite objects representing all non-inlined
 *         callsites in the method. Returns null if there are no such callsites.
 */
public ArrayList<CallSite> getNonInlinedCallSites() {
    ArrayList<CallSite> ans = null;
    if (MCInformation == null)
        return ans;
    for (int entry = 0; entry < MCInformation.length; ) {
        int callInfo = getCallInfo(entry);
        if (callInfo == IS_UNGUARDED_CALL) {
            int bcIndex = getBytecodeIndex(entry);
            if (bcIndex != -1) {
                int iei = getInlineEncodingIndex(entry);
                if (iei != -1) {
                    int mid = OptEncodedCallSiteTree.getMethodID(iei, inlineEncoding);
                    RVMMethod caller = MemberReference.getMemberRef(mid).asMethodReference().peekResolvedMethod();
                    if (caller != null) {
                        if (ans == null)
                            ans = new ArrayList<CallSite>();
                        ans.add(new CallSite(caller, bcIndex));
                    }
                }
            }
        }
        entry = nextEntry(entry);
    }
    return ans;
}
Also used : RVMMethod(org.jikesrvm.classloader.RVMMethod) ArrayList(java.util.ArrayList) CallSite(org.jikesrvm.adaptive.database.callgraph.CallSite)

Example 54 with RVMMethod

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

the class OptMachineCodeMap method printMCInformationEntry.

private void printMCInformationEntry(int entry, boolean DUMP_MAPS) {
    if (DUMP_MAPS) {
        String sep = "\tMC: ";
        if (isBigEntry(entry))
            sep = "B\tMC: ";
        if (isHugeEntry(entry))
            sep = "H\tMC: ";
        int mcOffset = getMCOffset(entry);
        VM.sysWrite(entry + sep + mcOffset + " (" + Integer.toHexString(mcOffset) + ")");
        int bci = getBytecodeIndex(entry);
        if (bci != -1) {
            VM.sysWriteln();
            VM.sysWrite("\tBCI: " + bci);
        }
        int iei = getInlineEncodingIndex(entry);
        if (iei != -1) {
            VM.sysWriteln();
            VM.sysWrite("\tIEI: " + iei);
        }
        boolean first = true;
        while (iei >= 0) {
            int mid = OptEncodedCallSiteTree.getMethodID(iei, inlineEncoding);
            RVMMethod meth = MemberReference.getMethodRef(mid).getResolvedMember();
            if (first) {
                first = false;
                VM.sysWriteln();
                VM.sysWrite("\tIn method    " + meth + " at bytecode " + bci);
            } else {
                VM.sysWriteln();
                VM.sysWrite("\tInlined into " + meth + " at bytecode " + bci);
            }
            if (iei > 0) {
                bci = OptEncodedCallSiteTree.getByteCodeOffset(iei, inlineEncoding);
            }
            iei = OptEncodedCallSiteTree.getParent(iei, inlineEncoding);
        }
        if (getGCMapIndex(entry) != OptGCMap.NO_MAP_ENTRY) {
            VM.sysWriteln();
            VM.sysWrite("\tGC Map Idx: " + getGCMapIndex(entry) + " ");
            OptGCMap.dumpMap(getGCMapIndex(entry), gcMaps);
        } else {
            VM.sysWriteln();
            VM.sysWrite("\tno GC map");
        }
        VM.sysWriteln();
    }
}
Also used : RVMMethod(org.jikesrvm.classloader.RVMMethod)

Example 55 with RVMMethod

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

the class SpecializationDatabase method registerSpecialVersion.

/**
 * Records a new specialized method in this database.
 * Also remember that this method will need to be compiled later,
 * at the next call to <code> doDeferredSpecializations() </code>
 *
 * @param spMethod the method to register
 */
static synchronized void registerSpecialVersion(SpecializedMethod spMethod) {
    RVMMethod source = spMethod.getMethod();
    MethodSet<RVMMethod> s = findOrCreateMethodSet(specialVersionsHash, source);
    s.add(spMethod);
    deferredMethods.add(spMethod);
}
Also used : RVMMethod(org.jikesrvm.classloader.RVMMethod)

Aggregations

RVMMethod (org.jikesrvm.classloader.RVMMethod)86 RVMClass (org.jikesrvm.classloader.RVMClass)29 TypeReference (org.jikesrvm.classloader.TypeReference)17 RVMType (org.jikesrvm.classloader.RVMType)15 CompiledMethod (org.jikesrvm.compilers.common.CompiledMethod)14 MethodOperand (org.jikesrvm.compilers.opt.ir.operand.MethodOperand)13 Atom (org.jikesrvm.classloader.Atom)11 RegisterOperand (org.jikesrvm.compilers.opt.ir.operand.RegisterOperand)11 Offset (org.vmmagic.unboxed.Offset)11 Instruction (org.jikesrvm.compilers.opt.ir.Instruction)10 Operand (org.jikesrvm.compilers.opt.ir.operand.Operand)10 Address (org.vmmagic.unboxed.Address)9 MethodReference (org.jikesrvm.classloader.MethodReference)8 NormalMethod (org.jikesrvm.classloader.NormalMethod)8 BranchProfileOperand (org.jikesrvm.compilers.opt.ir.operand.BranchProfileOperand)8 IntConstantOperand (org.jikesrvm.compilers.opt.ir.operand.IntConstantOperand)8 Method (java.lang.reflect.Method)7 ConditionOperand (org.jikesrvm.compilers.opt.ir.operand.ConditionOperand)7 TrapCodeOperand (org.jikesrvm.compilers.opt.ir.operand.TrapCodeOperand)7 OptCompiledMethod (org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod)7