From 757250d9c69284c4d089b9b8d2831b70fa19e2d0 Mon Sep 17 00:00:00 2001 From: Diamantino-Op Date: Fri, 10 Jun 2022 20:01:13 +0200 Subject: [PATCH 1/2] Update ILGroup.cs --- source/Cosmos.IL2CPU/MethodAnalysis/ILGroup.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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"); From 36ce51ef2e143fc8896ddf287f9a882c748720c4 Mon Sep 17 00:00:00 2001 From: Diamantino-Op Date: Wed, 29 Jun 2022 02:51:06 +0200 Subject: [PATCH 2/2] s --- source/Cosmos.IL2CPU/ILOpCodes/OpNone.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); }