/// <summary> /// convert normCodeOffsetDelta to the actual CodeOffset /// </summary> private Dictionary <int, List <BaseGcTransition> > UpdateTransitionCodeOffset(List <GcTransition> transitions) { Dictionary <int, List <BaseGcTransition> > updatedTransitions = new Dictionary <int, List <BaseGcTransition> >(); int cumInterruptibleLength = 0; // the sum of the lengths of all preceding interruptible ranges using (IEnumerator <InterruptibleRange> interruptibleRangesIter = InterruptibleRanges.GetEnumerator()) { interruptibleRangesIter.MoveNext(); InterruptibleRange currentRange = interruptibleRangesIter.Current; int currentRangeLength = (int)(currentRange.StopOffset - currentRange.StartOffset); foreach (GcTransition transition in transitions) { int codeOffset = transition.CodeOffset + (int)currentRange.StartOffset - cumInterruptibleLength; if (codeOffset > currentRange.StopOffset) { cumInterruptibleLength += currentRangeLength; interruptibleRangesIter.MoveNext(); currentRange = interruptibleRangesIter.Current; currentRangeLength = (int)(currentRange.StopOffset - currentRange.StartOffset); codeOffset = transition.CodeOffset + (int)currentRange.StartOffset - cumInterruptibleLength; } transition.CodeOffset = codeOffset; if (!updatedTransitions.ContainsKey(codeOffset)) { updatedTransitions[codeOffset] = new List <BaseGcTransition>(); } updatedTransitions[codeOffset].Add(transition); } } return(updatedTransitions); }
private Dictionary <int, GcTransition> UpdateTransitionCodeOffset(List <GcTransition> transitions) { Dictionary <int, GcTransition> updatedTransitions = new Dictionary <int, GcTransition>(); int cumInterruptibleLength = 0; using (IEnumerator <InterruptibleRange> interruptibleRangesIter = InterruptibleRanges.GetEnumerator()) { interruptibleRangesIter.MoveNext(); InterruptibleRange currentRange = interruptibleRangesIter.Current; int currentRangeLength = (int)(currentRange.StopOffset - currentRange.StartOffset); foreach (GcTransition transition in transitions) { int codeOffset = transition.CodeOffset + (int)currentRange.StartOffset - cumInterruptibleLength; if (codeOffset > currentRange.StopOffset) { cumInterruptibleLength += currentRangeLength; interruptibleRangesIter.MoveNext(); currentRange = interruptibleRangesIter.Current; currentRangeLength = (int)(currentRange.StopOffset - currentRange.StartOffset); codeOffset = transition.CodeOffset + (int)currentRange.StartOffset - cumInterruptibleLength; } transition.CodeOffset = codeOffset; updatedTransitions[codeOffset] = transition; } } return(updatedTransitions); }
private void UpdateTransitionCodeOffset(List <GcTransition> transitions) { int cumInterruptibleLength = 0; using (IEnumerator <InterruptibleRange> interruptibleRangesIter = InterruptibleRanges.GetEnumerator()) { interruptibleRangesIter.MoveNext(); InterruptibleRange currentRange = interruptibleRangesIter.Current; int currentRangeLength = (int)(currentRange.StopOffset - currentRange.StartOffset); foreach (GcTransition transition in transitions) { int codeOffset = transition.CodeOffset + (int)currentRange.StartOffset - cumInterruptibleLength; if (codeOffset > currentRange.StopOffset) { cumInterruptibleLength += currentRangeLength; interruptibleRangesIter.MoveNext(); currentRange = interruptibleRangesIter.Current; currentRangeLength = (int)(currentRange.StopOffset - currentRange.StartOffset); codeOffset = transition.CodeOffset + (int)currentRange.StartOffset - cumInterruptibleLength; } transition.CodeOffset = codeOffset; } } }