use of org.graalvm.compiler.lir.util.IndexedValueMap 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