use of com.oracle.svm.core.deopt.DeoptEntryInfopoint 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 com.oracle.svm.core.deopt.DeoptEntryInfopoint in project graal by oracle.
the class DeoptEntryOp method emitCode.
@Override
public void emitCode(CompilationResultBuilder crb) {
CompilationResult compilation = crb.compilationResult;
/* Search for the previous added info point. */
List<Infopoint> infoPoints = compilation.getInfopoints();
int size = infoPoints.size();
for (int idx = size - 1; idx >= 0; idx--) {
Infopoint infopoint = infoPoints.get(idx);
int entryOffset = CodeInfoEncoder.getEntryOffset(infopoint);
if (entryOffset >= 0) {
if (entryOffset == crb.asm.position()) {
crb.asm.ensureUniquePC();
break;
}
}
}
/* Register this location as a deopt infopoint. */
compilation.addInfopoint(new DeoptEntryInfopoint(crb.asm.position(), state.debugInfo()));
/* Add NOP so that the next infopoint (e.g., an invoke) gets a unique PC. */
crb.asm.ensureUniquePC();
}
Aggregations