private void HandleLoadVar(XILSInstr i) { Tuple <int, int> stackRef; if (_read2write.TryGetValue(i.Index, out stackRef)) { int stackP = _resultStack.IndexOf(stackRef); Debug.Assert(stackP >= 0); Debug.Assert(_resultStack.Count == TypeStack.Count); int depth = _resultStack.Count; int relP = depth - stackP - 1; if (relP > 0) { var preds = RemapPreds(i.Preds); TypeDescriptor[] opTypes = TypeStack.Take(depth - stackP).Reverse().ToArray(); Debug.Assert(opTypes.First().Equals(i.ResultTypes[0])); TypeDescriptor[] rTypes = (TypeDescriptor[])opTypes.Clone(); for (int j = 1; j <= relP; j++) { var tmp = rTypes[j]; rTypes[j] = rTypes[j - 1]; rTypes[j - 1] = tmp; var tmpi = _resultStack[stackP + j]; _resultStack[stackP + j] = _resultStack[stackP + j - 1]; _resultStack[stackP + j - 1] = tmpi; } TypeDescriptor[] allTypes = opTypes.Concat(rTypes).ToArray(); base.Emit(DefaultInstructionSet.Instance.Dig(relP).CreateStk(preds, opTypes.Length, allTypes)); } } else { ProcessDefault(i); } }