diff --git a/source/Cosmos.IL2CPU/AppAssembler.cs b/source/Cosmos.IL2CPU/AppAssembler.cs index 91cc98082..d1cb932af 100644 --- a/source/Cosmos.IL2CPU/AppAssembler.cs +++ b/source/Cosmos.IL2CPU/AppAssembler.cs @@ -834,7 +834,7 @@ namespace Cosmos.IL2CPU protected void Ldsflda(MethodInfo aMethod, X86.IL.FieldInfo aFieldInfo) { - X86.IL.Ldsflda.DoExecute(Assembler, aMethod, aFieldInfo, aMethod.PluggedMethod.MethodBase.DeclaringType, null); + X86.IL.Ldsflda.DoExecute(Assembler, aMethod, aFieldInfo.Id, aMethod.PluggedMethod.MethodBase.DeclaringType, null); } protected int GetVTableEntrySize() diff --git a/source/Cosmos.IL2CPU/IL/Ldsflda.cs b/source/Cosmos.IL2CPU/IL/Ldsflda.cs index 1b4eb75ff..c9879584a 100644 --- a/source/Cosmos.IL2CPU/IL/Ldsflda.cs +++ b/source/Cosmos.IL2CPU/IL/Ldsflda.cs @@ -18,11 +18,11 @@ namespace Cosmos.IL2CPU.X86.IL public override void Execute(MethodInfo aMethod, ILOpCode aOpCode) { var xOpCode = (ILOpCodes.OpField) aOpCode; - var xField = ResolveField(aMethod.MethodBase.DeclaringType, xOpCode.Value.GetFullName()); - DoExecute(Assembler, aMethod, xField, xOpCode.Value.DeclaringType, aOpCode); + var xFieldName = DataMember.GetStaticFieldName(xOpCode.Value); + DoExecute(Assembler, aMethod, xFieldName, xOpCode.Value.DeclaringType, aOpCode); } - public static void DoExecute(Cosmos.Assembler.Assembler assembler, MethodInfo aMethod, FieldInfo field, Type declaringType, ILOpCode aCurrentOpCode) + public static void DoExecute(Cosmos.Assembler.Assembler assembler, MethodInfo aMethod, string field, Type declaringType, ILOpCode aCurrentOpCode) { // call cctor: var xCctor = (declaringType.GetConstructors(BindingFlags.Static | BindingFlags.NonPublic) ?? new ConstructorInfo[0]).SingleOrDefault(); @@ -38,7 +38,7 @@ namespace Cosmos.IL2CPU.X86.IL new Label(".AfterCCTorExceptionCheck"); } } - string xDataName = field.Id; + string xDataName = field; new CPUx86.Push { DestinationRef = Cosmos.Assembler.ElementReference.New(xDataName) diff --git a/source/Cosmos.IL2CPU/ILOp.cs b/source/Cosmos.IL2CPU/ILOp.cs index dbf5fc96b..4e5f792ce 100644 --- a/source/Cosmos.IL2CPU/ILOp.cs +++ b/source/Cosmos.IL2CPU/ILOp.cs @@ -206,15 +206,7 @@ namespace Cosmos.IL2CPU { continue; } - string xId; - if (!xField.IsStatic) - { - xId = xField.GetFullName(); - } - else - { - xId = DataMember.GetStaticFieldName(xField); - } + string xId = xField.GetFullName(); var xInfo = new X86.IL.FieldInfo(xId, SizeOfType(xField.FieldType), aType, xField.FieldType); xInfo.IsStatic = xField.IsStatic; diff --git a/source/Cosmos.IL2CPU/ILOpCodes/OpField.cs b/source/Cosmos.IL2CPU/ILOpCodes/OpField.cs index bda0d847c..0f430f912 100644 --- a/source/Cosmos.IL2CPU/ILOpCodes/OpField.cs +++ b/source/Cosmos.IL2CPU/ILOpCodes/OpField.cs @@ -234,7 +234,8 @@ namespace Cosmos.IL2CPU.ILOpCodes { } if (StackPopTypes[0] == Value.DeclaringType.MakePointerType() || StackPopTypes[0] == Value.DeclaringType.MakeByRefType() || - StackPopTypes[0] == typeof(void*)) + StackPopTypes[0] == typeof(void*) || + StackPopTypes[0] == typeof(IntPtr)) { return; }