SlotTable = new GcSlotTable(image, machine, _gcInfoTypes, ref bitOffset);
- Transitions = GetTranstions(image, SlotTable.GcSlots, ref bitOffset);
+ Transitions = GetTranstions(image, ref bitOffset);
Size = bitOffset - startBitOffset;
return (readyToRunMajorVersion == 1) ? 1 : GCINFO_VERSION;
}
- public IList<GcTransition> GetTranstions(byte[] image, List<GcSlotTable.GcSlot> slots, ref int bitOffset)
+ public IList<GcTransition> GetTranstions(byte[] image, ref int bitOffset)
{
int totalInterruptibleLength = 0;
if (NumInterruptibleRanges == 0)
int info2Offset = (int)Math.Ceiling(bitOffset / 8.0) * 8;
List<GcTransition> transitions = new List<GcTransition>();
- bool[] liveAtEnd = new bool[slots.Count];
+ bool[] liveAtEnd = new bool[SlotTable.GcSlots.Count - SlotTable.NumUntracked];
for (int currentChunk = 0; currentChunk < numChunks; currentChunk++)
{
if (chunkPointers[currentChunk] == 0)
slotId = -1;
}
- uint numCouldBeLiveSlots = GetNumCouldBeLiveSlots(image, slots, ref bitOffset);
+ uint numCouldBeLiveSlots = GetNumCouldBeLiveSlots(image, ref bitOffset);
int finalStateOffset = bitOffset;
bitOffset += (int)numCouldBeLiveSlots;
return transitions;
}
- private uint GetNumCouldBeLiveSlots(byte[] image, List<GcSlotTable.GcSlot> slots, ref int bitOffset)
+ private uint GetNumCouldBeLiveSlots(byte[] image, ref int bitOffset)
{
uint numCouldBeLiveSlots = 0;
- int numSlots = slots.Count;
+ int numTracked = SlotTable.GcSlots.Count - (int)SlotTable.NumUntracked;
if (NativeReader.ReadBits(image, 1, ref bitOffset) != 0)
{
// RLE encoded
bool fReport = true;
uint readSlots = NativeReader.DecodeVarLengthUnsigned(image, fSkip ? _gcInfoTypes.LIVESTATE_RLE_SKIP_ENCBASE : _gcInfoTypes.LIVESTATE_RLE_RUN_ENCBASE, ref bitOffset);
fSkip = !fSkip;
- while (readSlots < numSlots)
+ while (readSlots < numTracked)
{
uint cnt = NativeReader.DecodeVarLengthUnsigned(image, fSkip ? _gcInfoTypes.LIVESTATE_RLE_SKIP_ENCBASE : _gcInfoTypes.LIVESTATE_RLE_RUN_ENCBASE, ref bitOffset) + 1;
if (fReport)
}
else
{
- foreach (var slot in slots)
+ foreach (var slot in SlotTable.GcSlots)
{
- if (slot.StackSlot != null)
+ if (slot.Flags == GcSlotFlags.GC_SLOT_UNTRACKED)
break;
if (NativeReader.ReadBits(image, 1, ref bitOffset) != 0)
public GcStackSlot StackSlot { get; }
public GcSlotFlags Flags { get; }
- public GcSlot(int registerNumber, GcStackSlot stack, GcSlotFlags flags)
+ public GcSlot(int registerNumber, GcStackSlot stack, GcSlotFlags flags, bool isUntracked = false)
{
RegisterNumber = registerNumber;
StackSlot = stack;
- Flags = flags;
+ if (isUntracked)
+ {
+ Flags = GcSlotFlags.GC_SLOT_UNTRACKED;
+ }
+ else
+ {
+ Flags = flags;
+ }
}
public override string ToString()
}
if ((NumStackSlots > 0) && (GcSlots.Count < gcInfoTypes.MAX_PREDECODED_SLOTS))
{
- DecodeStackSlots(image, machine, gcInfoTypes, NumStackSlots, ref bitOffset);
+ DecodeStackSlots(image, machine, gcInfoTypes, NumStackSlots, false, ref bitOffset);
}
if ((NumUntracked > 0) && (GcSlots.Count < gcInfoTypes.MAX_PREDECODED_SLOTS))
{
- DecodeStackSlots(image, machine, gcInfoTypes, NumUntracked, ref bitOffset);
+ DecodeStackSlots(image, machine, gcInfoTypes, NumUntracked, true, ref bitOffset);
}
}
}
}
- private void DecodeStackSlots(byte[] image, Machine machine, GcInfoTypes gcInfoTypes, uint nSlots, ref int bitOffset)
+ private void DecodeStackSlots(byte[] image, Machine machine, GcInfoTypes gcInfoTypes, uint nSlots, bool isUntracked, ref int bitOffset)
{
// We have stack slots left and more room to predecode
GcStackSlotBase spBase = (GcStackSlotBase)NativeReader.ReadBits(image, 2, ref bitOffset);
int normSpOffset = NativeReader.DecodeVarLengthSigned(image, gcInfoTypes.STACK_SLOT_ENCBASE, ref bitOffset);
int spOffset = gcInfoTypes.DenormalizeStackSlot(normSpOffset);
GcSlotFlags flags = (GcSlotFlags)NativeReader.ReadBits(image, 2, ref bitOffset);
- GcSlots.Add(new GcSlot(-1, new GcStackSlot(spOffset, spBase), flags));
+ GcSlots.Add(new GcSlot(-1, new GcStackSlot(spOffset, spBase), flags, isUntracked));
for (int i = 1; i < nSlots; i++)
{
normSpOffset += normSpOffsetDelta;
spOffset = gcInfoTypes.DenormalizeStackSlot(normSpOffset);
}
- GcSlots.Add(new GcSlot(-1, new GcStackSlot(spOffset, spBase), flags));
+ GcSlots.Add(new GcSlot(-1, new GcStackSlot(spOffset, spBase), flags, isUntracked));
}
}
}