From bebe8633ad20d28de435ff8e02742c4fea6db3cf Mon Sep 17 00:00:00 2001 From: mterwoord_cp <7cd3fd84a0151ea055c2f79e4d2eef9576fe9afesxUZAwxD> Date: Sun, 26 Jul 2009 09:36:08 +0000 Subject: [PATCH] Fixed runtime error (ExecutionEngineException) --- source2/IL2PCU/Cosmos.IL2CPU.X86/IL/Ldc_I4.cs | 4 ++-- source2/IL2PCU/Cosmos.IL2CPU/Assembler.cs | 4 ++-- source2/IL2PCU/Cosmos.IL2CPU/ILScanner.cs | 2 +- source2/Users/Kudzu/HelloWorld/Program.cs | 1 - 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/source2/IL2PCU/Cosmos.IL2CPU.X86/IL/Ldc_I4.cs b/source2/IL2PCU/Cosmos.IL2CPU.X86/IL/Ldc_I4.cs index 8edbb3bdb..d6753acea 100644 --- a/source2/IL2PCU/Cosmos.IL2CPU.X86/IL/Ldc_I4.cs +++ b/source2/IL2PCU/Cosmos.IL2CPU.X86/IL/Ldc_I4.cs @@ -7,10 +7,10 @@ using System.Collections.Generic; namespace Cosmos.IL2CPU.X86.IL { [Cosmos.IL2CPU.OpCode(ILOpCode.Code.Ldc_I4)] public class Ldc_I4: ILOp { - public Ldc_I4(ILOpCode aOpCode):base(aOpCode) { } + public Ldc_I4(ILOpCode aOpCode):base(aOpCode) {} public override void Execute(uint aMethodUID) { - new CPU.Push { DestinationValue = ((OpInt)OpCode).Value }; + new CPU.Push { DestinationValue = ((OpInt)OpCode).Value }; Asmblr.StackContents.Push(new StackContent(4, typeof(int))); } diff --git a/source2/IL2PCU/Cosmos.IL2CPU/Assembler.cs b/source2/IL2PCU/Cosmos.IL2CPU/Assembler.cs index 286969666..1ba2df3be 100644 --- a/source2/IL2PCU/Cosmos.IL2CPU/Assembler.cs +++ b/source2/IL2PCU/Cosmos.IL2CPU/Assembler.cs @@ -24,7 +24,7 @@ namespace Cosmos.IL2CPU { } else { xCtor = mILOpsHi[xOpCodeVal & 0xFF]; } - var xILOp = xCtor(xOpCode); + var xILOp = xCtor(xOpCode); xILOp.Execute(aMethodUID); } } @@ -33,7 +33,7 @@ namespace Cosmos.IL2CPU { protected ILOpCreateDelegate CreateCtorDelegate(Type aType) { var xMethod = new DynamicMethod("", typeof(ILOp), new Type[] { typeof(ILOpCode) }, typeof(ILScanner).Module); var xGen = xMethod.GetILGenerator(); - xGen.Emit(OpCodes.Ldarg_1); + xGen.Emit(OpCodes.Ldarg_0); xGen.Emit(OpCodes.Newobj, aType.GetConstructor(new Type[] { typeof(ILOpCode) })); xGen.Emit(OpCodes.Ret); return (ILOpCreateDelegate)xMethod.CreateDelegate(typeof(ILOpCreateDelegate)); diff --git a/source2/IL2PCU/Cosmos.IL2CPU/ILScanner.cs b/source2/IL2PCU/Cosmos.IL2CPU/ILScanner.cs index d30a3fb2b..6ee763460 100644 --- a/source2/IL2PCU/Cosmos.IL2CPU/ILScanner.cs +++ b/source2/IL2PCU/Cosmos.IL2CPU/ILScanner.cs @@ -35,7 +35,7 @@ namespace Cosmos.IL2CPU { // Cannot use foreach, the list changes as we go for (int i = 0; i < mMethods.Count; i++) { - ScanMethod(mMethods[i], (UInt32)i); + ScanMethod(mMethods[i], (UInt32)i); } } diff --git a/source2/Users/Kudzu/HelloWorld/Program.cs b/source2/Users/Kudzu/HelloWorld/Program.cs index f7a22b390..33b1de950 100644 --- a/source2/Users/Kudzu/HelloWorld/Program.cs +++ b/source2/Users/Kudzu/HelloWorld/Program.cs @@ -23,7 +23,6 @@ namespace HelloWorld { using (var xOldAsmblr = new CosmosAssembler(0)) { //InitializePlugs(aPlugs); - xScanner.Execute(xEntryPoint); } }