Search in sources :

Example 1 with DebugInfo

use of jdk.vm.ci.code.DebugInfo in project graal by oracle.

the class CompilationResultBuilder method recordIndirectCall.

public void recordIndirectCall(int posBefore, int posAfter, InvokeTarget callTarget, LIRFrameState info) {
    DebugInfo debugInfo = info != null ? info.debugInfo() : null;
    compilationResult.recordCall(posBefore, posAfter - posBefore, callTarget, debugInfo, false);
}
Also used : DebugInfo(jdk.vm.ci.code.DebugInfo)

Example 2 with DebugInfo

use of jdk.vm.ci.code.DebugInfo in project graal by oracle.

the class CompilationResultBuilder method recordInfopoint.

public void recordInfopoint(int pos, LIRFrameState info, InfopointReason reason) {
    // infopoints always need debug info
    DebugInfo debugInfo = info.debugInfo();
    recordInfopoint(pos, debugInfo, reason);
}
Also used : DebugInfo(jdk.vm.ci.code.DebugInfo)

Example 3 with DebugInfo

use of jdk.vm.ci.code.DebugInfo in project graal by oracle.

the class CFGPrinter method printLIRInstruction.

private void printLIRInstruction(LIRInstruction inst) {
    if (inst == null) {
        out.print("nr   -1 ").print(COLUMN_END).print(" instruction ").print("<deleted>").print(COLUMN_END);
        out.println(COLUMN_END);
    } else {
        out.printf("nr %4d ", inst.id()).print(COLUMN_END);
        final StringBuilder stateString = new StringBuilder();
        inst.forEachState(state -> {
            if (state.hasDebugInfo()) {
                DebugInfo di = state.debugInfo();
                stateString.append(debugInfoToString(di.getBytecodePosition(), di.getReferenceMap(), state.getLiveBasePointers(), di.getCalleeSaveInfo()));
            } else {
                stateString.append(debugInfoToString(state.topFrame, null, state.getLiveBasePointers(), null));
            }
        });
        if (stateString.length() > 0) {
            int level = out.indentationLevel();
            out.adjustIndentation(-level);
            out.print(" st ").print(HOVER_START).print("st").print(HOVER_SEP).print(stateString.toString()).print(HOVER_END).print(COLUMN_END);
            out.adjustIndentation(level);
        }
        out.print(" instruction ").print(inst.toString(res)).print(COLUMN_END);
        out.println(COLUMN_END);
    }
}
Also used : DebugInfo(jdk.vm.ci.code.DebugInfo)

Example 4 with DebugInfo

use of jdk.vm.ci.code.DebugInfo in project graal by oracle.

the class CollectingObjectReferenceVisitor method addMethod.

public void addMethod(SharedMethod method, CompilationResult compilation, int compilationOffset) {
    int totalFrameSize = compilation.getTotalFrameSize();
    /* Mark the method start and register the frame size. */
    IPData startEntry = makeEntry(compilationOffset);
    startEntry.frameSizeEncoding = encodeFrameSize(totalFrameSize, true);
    /* Register the frame size for all entries that are starting points for the index. */
    long entryIP = CodeInfoDecoder.lookupEntryIP(CodeInfoDecoder.indexGranularity() + compilationOffset);
    while (entryIP <= CodeInfoDecoder.lookupEntryIP(compilation.getTargetCodeSize() + compilationOffset)) {
        IPData entry = makeEntry(entryIP);
        entry.frameSizeEncoding = encodeFrameSize(totalFrameSize, false);
        entryIP += CodeInfoDecoder.indexGranularity();
    }
    /* Make entries for all calls and deoptimization entry points of the method. */
    for (Infopoint infopoint : compilation.getInfopoints()) {
        final DebugInfo debugInfo = infopoint.debugInfo;
        if (debugInfo != null) {
            final int offset = getEntryOffset(infopoint);
            if (offset >= 0) {
                IPData entry = makeEntry(offset + compilationOffset);
                assert entry.referenceMap == null && entry.frameData == null;
                entry.referenceMap = (ReferenceMapEncoder.Input) debugInfo.getReferenceMap();
                entry.frameData = frameInfoEncoder.addDebugInfo(method, infopoint, totalFrameSize);
            }
        }
    }
    /* Make entries for all exception handlers. */
    for (ExceptionHandler handler : compilation.getExceptionHandlers()) {
        final IPData entry = makeEntry(handler.pcOffset + compilationOffset);
        assert entry.exceptionOffset == 0;
        entry.exceptionOffset = handler.handlerPos - handler.pcOffset;
    }
    ImageSingletons.lookup(Counters.class).methodCount.inc();
    ImageSingletons.lookup(Counters.class).codeSize.add(compilation.getTargetCodeSize());
}
Also used : ExceptionHandler(jdk.vm.ci.code.site.ExceptionHandler) ReferenceMapEncoder(com.oracle.svm.core.heap.ReferenceMapEncoder) Infopoint(jdk.vm.ci.code.site.Infopoint) DeoptEntryInfopoint(com.oracle.svm.core.deopt.DeoptEntryInfopoint) DebugInfo(jdk.vm.ci.code.DebugInfo) Infopoint(jdk.vm.ci.code.site.Infopoint) DeoptEntryInfopoint(com.oracle.svm.core.deopt.DeoptEntryInfopoint)

Example 5 with DebugInfo

use of jdk.vm.ci.code.DebugInfo in project graal by oracle.

the class CompileQueue method verifyDeoptTarget.

private static boolean verifyDeoptTarget(HostedMethod method, CompilationResult result) {
    Map<Long, BytecodeFrame> encodedBciMap = new HashMap<>();
    /*
         * All deopt targets must have a graph.
         */
    assert method.compilationInfo.graph != null : "Deopt target must have a graph.";
    /*
         * No deopt targets can have a StackValueNode in the graph.
         */
    assert method.compilationInfo.graph.getNodes(StackValueNode.TYPE).isEmpty() : "No stack value nodes must be present in deopt target.";
    for (Infopoint infopoint : result.getInfopoints()) {
        if (infopoint.debugInfo != null) {
            DebugInfo debugInfo = infopoint.debugInfo;
            if (!debugInfo.hasFrame()) {
                continue;
            }
            BytecodeFrame topFrame = debugInfo.frame();
            BytecodeFrame rootFrame = topFrame;
            while (rootFrame.caller() != null) {
                rootFrame = rootFrame.caller();
            }
            assert rootFrame.getMethod().equals(method);
            boolean isDeoptEntry = method.compilationInfo.isDeoptEntry(rootFrame.getBCI(), rootFrame.duringCall, rootFrame.rethrowException);
            if (infopoint instanceof DeoptEntryInfopoint) {
                assert isDeoptEntry;
            } else if (rootFrame.duringCall && isDeoptEntry) {
                assert infopoint instanceof Call || isSingleSteppingInfopoint(infopoint);
            } else {
                continue;
            }
            long encodedBci = FrameInfoEncoder.encodeBci(rootFrame.getBCI(), rootFrame.duringCall, rootFrame.rethrowException);
            if (encodedBciMap.containsKey(encodedBci)) {
                assert encodedBciMap.get(encodedBci).equals(rootFrame) : "duplicate encoded bci " + encodedBci + " in deopt target " + method + " with different debug info:\n\n" + rootFrame + "\n\n" + encodedBciMap.get(encodedBci);
            }
            encodedBciMap.put(encodedBci, rootFrame);
        }
    }
    return true;
}
Also used : Call(jdk.vm.ci.code.site.Call) BytecodeFrame(jdk.vm.ci.code.BytecodeFrame) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) DeoptEntryInfopoint(com.oracle.svm.core.deopt.DeoptEntryInfopoint) Infopoint(jdk.vm.ci.code.site.Infopoint) DeoptEntryInfopoint(com.oracle.svm.core.deopt.DeoptEntryInfopoint) DebugInfo(jdk.vm.ci.code.DebugInfo)

Aggregations

DebugInfo (jdk.vm.ci.code.DebugInfo)8 Infopoint (jdk.vm.ci.code.site.Infopoint)3 DeoptEntryInfopoint (com.oracle.svm.core.deopt.DeoptEntryInfopoint)2 BytecodeFrame (jdk.vm.ci.code.BytecodeFrame)2 ValueInfo (com.oracle.svm.core.code.FrameInfoQueryResult.ValueInfo)1 ReferenceMapEncoder (com.oracle.svm.core.heap.ReferenceMapEncoder)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 Call (jdk.vm.ci.code.site.Call)1 ExceptionHandler (jdk.vm.ci.code.site.ExceptionHandler)1 Site (jdk.vm.ci.code.site.Site)1 SourceMapping (org.graalvm.compiler.code.SourceMapping)1 NodeSourcePosition (org.graalvm.compiler.graph.NodeSourcePosition)1