mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-20 04:48:53 +00:00
some fixes related to static fields and structs.
This commit is contained in:
parent
d15b021506
commit
c159e8018c
4 changed files with 8 additions and 15 deletions
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue