Skip to content

Commit

Permalink
Avoid reusing the same reference map for duplicated calls
Browse files Browse the repository at this point in the history
  • Loading branch information
loicottet committed Apr 15, 2020
1 parent 7f46a44 commit 7853363
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
import com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMSymbolIteratorRef;
import com.oracle.svm.shadowed.org.bytedeco.llvm.global.LLVM;

import jdk.vm.ci.code.DebugInfo;
import jdk.vm.ci.code.ReferenceMap;
import jdk.vm.ci.code.site.Call;
import jdk.vm.ci.code.site.Infopoint;
import jdk.vm.ci.code.site.InfopointReason;
Expand Down Expand Up @@ -176,10 +178,8 @@ public void readStackMap(LLVMStackMapInfo info, CompilationResult compilation, R
for (int actualPcOffset : info.getPatchpointOffsets(call.pcOffset)) {
SubstrateReferenceMap referenceMap = new SubstrateReferenceMap();
info.forEachStatepointOffset(call.pcOffset, actualPcOffset, referenceMap::markReferenceAtOffset);
call.debugInfo.setReferenceMap(referenceMap);
stackMapDumper.dumpCallSite(call, actualPcOffset, referenceMap);

newInfopoints.add(new Call(call.target, actualPcOffset, call.size, call.direct, call.debugInfo));
newInfopoints.add(new Call(call.target, actualPcOffset, call.size, call.direct, copyWithReferenceMap(call.debugInfo, referenceMap)));
}
}
}
Expand All @@ -189,6 +189,13 @@ public void readStackMap(LLVMStackMapInfo info, CompilationResult compilation, R
newInfopoints.forEach(compilation::addInfopoint);
}

private static DebugInfo copyWithReferenceMap(DebugInfo debugInfo, ReferenceMap referenceMap) {
DebugInfo newInfo = new DebugInfo(debugInfo.getBytecodePosition(), debugInfo.getVirtualObjectMapping());
newInfo.setCalleeSaveInfo(debugInfo.getCalleeSaveInfo());
newInfo.setReferenceMap(referenceMap);
return newInfo;
}

public static final class LLVMTextSectionInfo {
private final long codeSize;
private final Map<Integer, String> offsetToSymbol = new TreeMap<>();
Expand Down

0 comments on commit 7853363

Please sign in to comment.