From 9f376bacbbe7a6df0202eaa741ff2ad62897ced1 Mon Sep 17 00:00:00 2001 From: mterwoord_cp <7cd3fd84a0151ea055c2f79e4d2eef9576fe9afesxUZAwxD> Date: Sat, 19 Jul 2008 08:04:53 +0000 Subject: [PATCH] ReturnCode fix --- .../Indy.IL2CPU.IL.X86/X86MethodFooterOp.cs | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/source/Indy.IL2CPU.IL.X86/X86MethodFooterOp.cs b/source/Indy.IL2CPU.IL.X86/X86MethodFooterOp.cs index c6afbdd71..29abfa0a1 100644 --- a/source/Indy.IL2CPU.IL.X86/X86MethodFooterOp.cs +++ b/source/Indy.IL2CPU.IL.X86/X86MethodFooterOp.cs @@ -30,7 +30,10 @@ namespace Indy.IL2CPU.IL.X86 DebugMode = aMethodInfo.DebugMode; MethodIsNonDebuggable = aMethodInfo.IsNonDebuggable; LocAllocItemCount = 0; - if(aMethodInfo.MethodData == null){System.Diagnostics.Debugger.Break();} + if (aMethodInfo.LabelName.Contains("TestMethodThreeParams") || aMethodInfo.LabelName.Contains("TestMethodComplicated")) + { + System.Diagnostics.Debugger.Break(); + } if (aMethodInfo.MethodData.ContainsKey(Localloc.LocAllocCountMethodDataEntry)) { LocAllocItemCount = (int)aMethodInfo.MethodData[Localloc.LocAllocCountMethodDataEntry]; } @@ -54,12 +57,30 @@ namespace Indy.IL2CPU.IL.X86 new CPUx86.Move("ecx", "0"); if (aReturnSize > 0) { + //var xArgSize = (from item in aArgs + // let xSize = item.Size + item.Offset + // select xSize).FirstOrDefault(); + //new Comment(String.Format("ReturnSize = {0}, ArgumentSize = {1}", + // aReturnSize, + // xArgSize)); + //int xOffset = 4; + //if(xArgSize>0) { + // xArgSize -= xReturnSize; + // xOffset = xArgSize; + //} int xOffset = 4; if (aArgs.Length > 0) { - xOffset = aArgs.First().Offset+4; - if (xOffset < 0) { - xOffset = 0; } + // old code: + //xOffset = aArgs.First().Offset + 4; + //if (xOffset < 0) + //{ + // xOffset = 0; + //} + + // new code: + xOffset = (from item in aArgs + select item.Offset + item.Size).First(); } for (int i = 0; i < xReturnSize / 4; i++) {