mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-27 05:52:11 +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)
|
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()
|
protected int GetVTableEntrySize()
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,11 @@ namespace Cosmos.IL2CPU.X86.IL
|
||||||
public override void Execute(MethodInfo aMethod, ILOpCode aOpCode)
|
public override void Execute(MethodInfo aMethod, ILOpCode aOpCode)
|
||||||
{
|
{
|
||||||
var xOpCode = (ILOpCodes.OpField) aOpCode;
|
var xOpCode = (ILOpCodes.OpField) aOpCode;
|
||||||
var xField = ResolveField(aMethod.MethodBase.DeclaringType, xOpCode.Value.GetFullName());
|
var xFieldName = DataMember.GetStaticFieldName(xOpCode.Value);
|
||||||
DoExecute(Assembler, aMethod, xField, xOpCode.Value.DeclaringType, aOpCode);
|
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:
|
// call cctor:
|
||||||
var xCctor = (declaringType.GetConstructors(BindingFlags.Static | BindingFlags.NonPublic) ?? new ConstructorInfo[0]).SingleOrDefault();
|
var xCctor = (declaringType.GetConstructors(BindingFlags.Static | BindingFlags.NonPublic) ?? new ConstructorInfo[0]).SingleOrDefault();
|
||||||
|
|
@ -38,7 +38,7 @@ namespace Cosmos.IL2CPU.X86.IL
|
||||||
new Label(".AfterCCTorExceptionCheck");
|
new Label(".AfterCCTorExceptionCheck");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
string xDataName = field.Id;
|
string xDataName = field;
|
||||||
new CPUx86.Push
|
new CPUx86.Push
|
||||||
{
|
{
|
||||||
DestinationRef = Cosmos.Assembler.ElementReference.New(xDataName)
|
DestinationRef = Cosmos.Assembler.ElementReference.New(xDataName)
|
||||||
|
|
|
||||||
|
|
@ -206,15 +206,7 @@ namespace Cosmos.IL2CPU {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
string xId;
|
string xId = xField.GetFullName();
|
||||||
if (!xField.IsStatic)
|
|
||||||
{
|
|
||||||
xId = xField.GetFullName();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
xId = DataMember.GetStaticFieldName(xField);
|
|
||||||
}
|
|
||||||
|
|
||||||
var xInfo = new X86.IL.FieldInfo(xId, SizeOfType(xField.FieldType), aType, xField.FieldType);
|
var xInfo = new X86.IL.FieldInfo(xId, SizeOfType(xField.FieldType), aType, xField.FieldType);
|
||||||
xInfo.IsStatic = xField.IsStatic;
|
xInfo.IsStatic = xField.IsStatic;
|
||||||
|
|
|
||||||
|
|
@ -234,7 +234,8 @@ namespace Cosmos.IL2CPU.ILOpCodes {
|
||||||
}
|
}
|
||||||
if (StackPopTypes[0] == Value.DeclaringType.MakePointerType() ||
|
if (StackPopTypes[0] == Value.DeclaringType.MakePointerType() ||
|
||||||
StackPopTypes[0] == Value.DeclaringType.MakeByRefType() ||
|
StackPopTypes[0] == Value.DeclaringType.MakeByRefType() ||
|
||||||
StackPopTypes[0] == typeof(void*))
|
StackPopTypes[0] == typeof(void*) ||
|
||||||
|
StackPopTypes[0] == typeof(IntPtr))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue