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);
}
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);
}
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);
}
}
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());
}
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;
}
Aggregations