diff --git a/source/Cosmos.IL2CPU/ILOpCodes/OpNone.cs b/source/Cosmos.IL2CPU/ILOpCodes/OpNone.cs index 2a1471f89..5c037d3e7 100644 --- a/source/Cosmos.IL2CPU/ILOpCodes/OpNone.cs +++ b/source/Cosmos.IL2CPU/ILOpCodes/OpNone.cs @@ -832,7 +832,7 @@ public override void DoInterpretStackTypes() { throw new Exception("Wrong value type: " + StackPopTypes[0].FullName); } - if (!ILOp.IsPointer(StackPopTypes[1]) && StackPopTypes[1] != typeof(int)) + if (!ILOp.IsPointer(StackPopTypes[1]) && StackPopTypes[1] != typeof(long) && StackPopTypes[1] != typeof(int)) { throw new Exception("Wrong Pointer type: " + StackPopTypes[1].FullName); } diff --git a/source/Cosmos.IL2CPU/MethodAnalysis/ILGroup.cs b/source/Cosmos.IL2CPU/MethodAnalysis/ILGroup.cs index 729fe81b1..4ef87cd68 100644 --- a/source/Cosmos.IL2CPU/MethodAnalysis/ILGroup.cs +++ b/source/Cosmos.IL2CPU/MethodAnalysis/ILGroup.cs @@ -81,14 +81,17 @@ public static List GenerateGroups(ILMethod aMethod, DebugInfo.SequenceP } // Initialse the datastructure with the first opcode - + var list = aMethod.Code.Select(c => c.Value.Position).ToList(); // Analyse op codes - foreach (var (_, opGroup) in groups) + foreach (var (val, opGroup) in groups) { + while (true) { var analysing = opGroup.OpCodes.Last(); + list.Remove(analysing.Position); + analysed++; var done = true; @@ -120,6 +123,9 @@ public static List GenerateGroups(ILMethod aMethod, DebugInfo.SequenceP } } + aMethod.Code = aMethod.Code.Where(c => !list.Contains(c.Key)).ToDictionary(i => i.Key, i => i.Value); + aMethod.Length = aMethod.Code.Count; + if(analysed != aMethod.Length) { throw new Exception("GenerateGroups --- Did not reach all instructions in method");