{
MemoryStream methodDebugBlob = new MemoryStream();
- byte[] bounds = CreateBoundsBlobForMethod(method);
- byte[] vars = CreateVarBlobForMethod(method);
+ byte[] bounds = method.DebugLocInfos;
+ byte[] vars = method.DebugVarInfos;
NibbleWriter nibbleWriter = new NibbleWriter();
nibbleWriter.WriteUInt((uint)(bounds?.Length ?? 0));
definedSymbols: new ISymbolDefinitionNode[] { this });
}
- private byte[] CreateBoundsBlobForMethod(MethodWithGCInfo method)
+ public static byte[] CreateBoundsBlobForMethod(OffsetMapping[] offsetMapping)
{
- if (method.DebugLocInfos == null || method.DebugLocInfos.Length == 0)
+ if (offsetMapping == null || offsetMapping.Length == 0)
return null;
NibbleWriter writer = new NibbleWriter();
- writer.WriteUInt((uint)method.DebugLocInfos.Length);
+ writer.WriteUInt((uint)offsetMapping.Length);
uint previousNativeOffset = 0;
- foreach (var locInfo in method.DebugLocInfos)
+ foreach (var locInfo in offsetMapping)
{
writer.WriteUInt(locInfo.nativeOffset - previousNativeOffset);
writer.WriteUInt(locInfo.ilOffset + 3); // Count of items in Internal.JitInterface.MappingTypes to adjust the IL offset by
return writer.ToArray();
}
- private byte[] CreateVarBlobForMethod(MethodWithGCInfo method)
+ public static byte[] CreateVarBlobForMethod(NativeVarInfo[] varInfos)
{
- if (method.DebugVarInfos == null || method.DebugVarInfos.Length == 0)
+ if (varInfos == null || varInfos.Length == 0)
return null;
NibbleWriter writer = new NibbleWriter();
- writer.WriteUInt((uint)method.DebugVarInfos.Length);
+ writer.WriteUInt((uint)varInfos.Length);
- foreach (var nativeVarInfo in method.DebugVarInfos)
+ foreach (var nativeVarInfo in varInfos)
{
writer.WriteUInt(nativeVarInfo.startOffset);
writer.WriteUInt(nativeVarInfo.endOffset - nativeVarInfo.startOffset);
private FrameInfo[] _frameInfos;
private byte[] _gcInfo;
private ObjectData _ehInfo;
- private OffsetMapping[] _debugLocInfos;
- private NativeVarInfo[] _debugVarInfos;
+ private byte[] _debugLocInfos;
+ private byte[] _debugVarInfos;
private DebugEHClauseInfo[] _debugEHClauseInfos;
private List<ISymbolNode> _fixups;
private MethodDesc[] _inlinedMethods;
_ehInfo = ehInfo;
}
- public OffsetMapping[] DebugLocInfos => _debugLocInfos;
- public NativeVarInfo[] DebugVarInfos => _debugVarInfos;
+ public byte[] DebugLocInfos => _debugLocInfos;
+ public byte[] DebugVarInfos => _debugVarInfos;
public DebugEHClauseInfo[] DebugEHClauseInfos => _debugEHClauseInfos;
public void InitializeDebugLocInfos(OffsetMapping[] debugLocInfos)
{
Debug.Assert(_debugLocInfos == null);
- _debugLocInfos = debugLocInfos;
+ // Process the debug info from JIT format to R2R format immediately as it is large
+ // and not used in the rest of the process except to emit.
+ _debugLocInfos = DebugInfoTableNode.CreateBoundsBlobForMethod(debugLocInfos);
}
public void InitializeDebugVarInfos(NativeVarInfo[] debugVarInfos)
{
Debug.Assert(_debugVarInfos == null);
- _debugVarInfos = debugVarInfos;
+ // Process the debug info from JIT format to R2R format immediately as it is large
+ // and not used in the rest of the process except to emit.
+ _debugVarInfos = DebugInfoTableNode.CreateVarBlobForMethod(debugVarInfos);
}
public void InitializeDebugEHClauseInfos(DebugEHClauseInfo[] debugEHClauseInfos)