Fixed runtime error (ExecutionEngineException)

This commit is contained in:
mterwoord_cp 2009-07-26 09:36:08 +00:00
parent bea4acf095
commit bebe8633ad
4 changed files with 5 additions and 6 deletions

View file

@ -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)));
}

View file

@ -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));

View file

@ -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);
}
}

View file

@ -23,7 +23,6 @@ namespace HelloWorld {
using (var xOldAsmblr = new CosmosAssembler(0)) {
//InitializePlugs(aPlugs);
xScanner.Execute(xEntryPoint);
}
}