using System;
using System.Collections.Generic;
+using System.Diagnostics;
using System.Text;
namespace ILCompiler.Reflection.ReadyToRun.Amd64
FrameOffset = NativeReader.ReadUInt16(image, ref offset);
NextFrameOffset = -1;
+ if (UnwindOp == UnwindOpCodes.UWOP_ALLOC_LARGE)
+ {
+ uint codedSize;
+ if (OpInfo == 0)
+ {
+ codedSize = NativeReader.ReadUInt16(image, ref offset);
+ }
+ else if (OpInfo == 1)
+ {
+ codedSize = NativeReader.ReadUInt32(image, ref offset);
+ }
+ }
+
IsOpInfo = false;
}
}
public Registers FrameRegister { get; set; } //4 bits
public byte FrameOffset { get; set; } //4 bits
public UnwindCode[] UnwindCodeArray { get; set; }
- public Dictionary<int, List<UnwindCode>> UnwindCodes { get; set; }
+ public Dictionary<int, UnwindCode> UnwindCodes { get; set; }
public uint PersonalityRoutineRVA { get; set; }
public UnwindInfo() { }
FrameOffset = (byte)(frameRegisterAndOffset >> 4);
UnwindCodeArray = new UnwindCode[CountOfUnwindCodes];
- UnwindCodes = new Dictionary<int, List<UnwindCode>>();
+ UnwindCodes = new Dictionary<int, UnwindCode>();
for (int i = 0; i < CountOfUnwindCodes; i++)
{
UnwindCodeArray[i] = new UnwindCode(image, i, ref offset);
for (int i = 0; i < CountOfUnwindCodes; i++)
{
ParseUnwindCode(ref i);
- if (!UnwindCodes.ContainsKey(UnwindCodeArray[i].CodeOffset))
- {
- UnwindCodes[UnwindCodeArray[i].CodeOffset] = new List<UnwindCode>();
- }
- UnwindCodes[UnwindCodeArray[i].CodeOffset].Add(UnwindCodeArray[i]);
+ Debug.Assert(!UnwindCodes.ContainsKey(UnwindCodeArray[i].CodeOffset));
+ UnwindCodes.Add(UnwindCodeArray[i].CodeOffset, UnwindCodeArray[i]);
}
Size = _offsetofUnwindCode + CountOfUnwindCodes * _sizeofUnwindCode;
if (_r2r.Machine == Machine.Amd64 && ((ILCompiler.Reflection.ReadyToRun.Amd64.UnwindInfo)rtf.UnwindInfo).UnwindCodes.ContainsKey(codeOffset))
{
- List<ILCompiler.Reflection.ReadyToRun.Amd64.UnwindCode> codes = ((ILCompiler.Reflection.ReadyToRun.Amd64.UnwindInfo)rtf.UnwindInfo).UnwindCodes[codeOffset];
- foreach (ILCompiler.Reflection.ReadyToRun.Amd64.UnwindCode code in codes)
+ ILCompiler.Reflection.ReadyToRun.Amd64.UnwindCode code = ((ILCompiler.Reflection.ReadyToRun.Amd64.UnwindInfo)rtf.UnwindInfo).UnwindCodes[codeOffset];
+ _writer.Write($"{indentString}{code.UnwindOp} {code.OpInfoStr}");
+ if (code.NextFrameOffset != -1)
{
- _writer.Write($"{indentString}{code.UnwindOp} {code.OpInfoStr}");
- if (code.NextFrameOffset != -1)
- {
- _writer.WriteLine($"{indentString}{code.NextFrameOffset}");
- }
- _writer.WriteLine();
+ _writer.WriteLine($"{indentString}{code.NextFrameOffset}");
}
+ _writer.WriteLine();
}
if (!_options.HideTransitions && rtf.Method.GcInfo?.Transitions != null && rtf.Method.GcInfo.Transitions.TryGetValue(codeOffset, out List<BaseGcTransition> transitionsForOffset))