use of jdk.vm.ci.code.BytecodeFrame 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;
}
use of jdk.vm.ci.code.BytecodeFrame in project graal by oracle.
the class HotSpotDebugInfoBuilder method computeFrameForState.
@Override
protected BytecodeFrame computeFrameForState(FrameState state) {
if (isPlaceholderBci(state.bci) && state.bci != BytecodeFrame.BEFORE_BCI) {
raiseInvalidFrameStateError(state);
}
BytecodeFrame result = super.computeFrameForState(state);
maxInterpreterFrameSize = Math.max(maxInterpreterFrameSize, codeCacheProvider.interpreterFrameSize(result));
return result;
}
use of jdk.vm.ci.code.BytecodeFrame in project graal by oracle.
the class JVMCIInfopointErrorTest method modifyTopFrame.
private static LIRFrameState modifyTopFrame(LIRFrameState state, VirtualObject[] vobj, JavaValue[] values, JavaKind[] slotKinds, int locals, int stack, int locks) {
BytecodeFrame top = state.topFrame;
top = new BytecodeFrame(top.caller(), top.getMethod(), top.getBCI(), top.rethrowException, top.duringCall, values, slotKinds, locals, stack, locks);
return new LIRFrameState(top, vobj, state.exceptionEdge);
}
use of jdk.vm.ci.code.BytecodeFrame in project graal by oracle.
the class FrameInfoVerifier method addDebugInfo.
protected FrameData addDebugInfo(ResolvedJavaMethod method, Infopoint infopoint, int totalFrameSize) {
final boolean shouldIncludeMethod = customization.shouldInclude(method, infopoint);
final boolean encodeSourceReferences = FrameInfoDecoder.encodeSourceReferences();
if (!shouldIncludeMethod && !encodeSourceReferences) {
return null;
}
final DebugInfo debugInfo = infopoint.debugInfo;
final FrameData data = new FrameData();
data.debugInfo = debugInfo;
data.totalFrameSize = totalFrameSize;
data.virtualObjects = new ValueInfo[countVirtualObjects(debugInfo)][];
data.frame = addFrame(data, debugInfo.frame(), customization.isDeoptEntry(method, infopoint), shouldIncludeMethod);
final boolean encodeDebugNames = shouldIncludeMethod && FrameInfoDecoder.encodeDebugNames();
if (encodeDebugNames || FrameInfoDecoder.encodeSourceReferences()) {
BytecodeFrame bytecodeFrame = data.debugInfo.frame();
for (FrameInfoQueryResult resultFrame = data.frame; bytecodeFrame != null; resultFrame = resultFrame.caller) {
customization.fillDebugNames(bytecodeFrame, resultFrame, encodeDebugNames && shouldIncludeMethod);
bytecodeFrame = bytecodeFrame.caller();
}
for (FrameInfoQueryResult cur = data.frame; cur != null; cur = cur.caller) {
sourceClassNames.addObject(cur.sourceClassName);
sourceMethodNames.addObject(cur.sourceMethodName);
sourceFileNames.addObject(cur.sourceFileName);
if (encodeDebugNames) {
for (ValueInfo valueInfo : cur.valueInfos) {
if (valueInfo.name == null) {
valueInfo.name = "";
}
names.addObject(valueInfo.name);
}
}
}
}
allDebugInfos.add(data);
return data;
}
use of jdk.vm.ci.code.BytecodeFrame in project graal by oracle.
the class CompilationPrinter method debugInfoToString.
/**
* Formats given debug info as a multi line string.
*/
protected String debugInfoToString(BytecodePosition codePos, ReferenceMap refMap, IndexedValueMap liveBasePointers, RegisterSaveLayout calleeSaveInfo) {
StringBuilder sb = new StringBuilder();
if (refMap != null) {
sb.append("reference-map: ");
sb.append(refMap.toString());
sb.append("\n");
}
if (liveBasePointers != null) {
sb.append("live-base-pointers: ");
sb.append(liveBasePointers);
sb.append("\n");
}
if (calleeSaveInfo != null) {
sb.append("callee-save-info:");
for (Map.Entry<Register, Integer> e : calleeSaveInfo.registersToSlots(true).entrySet()) {
sb.append(" " + e.getKey() + " -> s" + e.getValue());
}
sb.append("\n");
}
if (codePos != null) {
BytecodePosition curCodePos = codePos;
List<VirtualObject> virtualObjects = new ArrayList<>();
do {
sb.append(MetaUtil.toLocation(curCodePos.getMethod(), curCodePos.getBCI()));
sb.append('\n');
if (curCodePos instanceof BytecodeFrame) {
BytecodeFrame frame = (BytecodeFrame) curCodePos;
if (frame.numStack > 0) {
sb.append("stack: ");
for (int i = 0; i < frame.numStack; i++) {
sb.append(valueToString(frame.getStackValue(i), virtualObjects)).append(' ');
}
sb.append("\n");
}
sb.append("locals: ");
for (int i = 0; i < frame.numLocals; i++) {
sb.append(valueToString(frame.getLocalValue(i), virtualObjects)).append(' ');
}
sb.append("\n");
if (frame.numLocks > 0) {
sb.append("locks: ");
for (int i = 0; i < frame.numLocks; ++i) {
sb.append(valueToString(frame.getLockValue(i), virtualObjects)).append(' ');
}
sb.append("\n");
}
}
curCodePos = curCodePos.getCaller();
} while (curCodePos != null);
for (int i = 0; i < virtualObjects.size(); i++) {
VirtualObject obj = virtualObjects.get(i);
sb.append(obj).append(" ").append(obj.getType().getName()).append(" ");
for (int j = 0; j < obj.getValues().length; j++) {
sb.append(valueToString(obj.getValues()[j], virtualObjects)).append(' ');
}
sb.append("\n");
}
}
return sb.toString();
}
Aggregations