mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-26 21:42:11 +00:00
This commit is contained in:
parent
e8a5c585b6
commit
3ce2fee1c2
1 changed files with 19 additions and 9 deletions
|
|
@ -19,15 +19,16 @@ namespace Cosmos.IL2CPU.X86.IL
|
||||||
|
|
||||||
public override void Execute( MethodInfo aMethod, ILOpCode aOpCode )
|
public override void Execute( MethodInfo aMethod, ILOpCode aOpCode )
|
||||||
{
|
{
|
||||||
var xMethodDescription = CPU.MethodInfoLabelGenerator.GenerateLabelName( aMethod.MethodBase );
|
var xMethodInfo = ( System.Reflection.MethodInfo )( ( ( Cosmos.IL2CPU.ILOpCodes.OpMethod )aOpCode ).Value );
|
||||||
|
var xMethodDescription = CPU.MethodInfoLabelGenerator.GenerateLabelName( xMethodInfo );
|
||||||
// mTargetMethodInfo = GetService<IMetaDataInfoService>().GetMethodInfo(mMethod
|
// mTargetMethodInfo = GetService<IMetaDataInfoService>().GetMethodInfo(mMethod
|
||||||
// , mMethod, mMethodDescription, null, mCurrentMethodInfo.DebugMode);
|
// , mMethod, mMethodDescription, null, mCurrentMethodInfo.DebugMode);
|
||||||
if( aMethod.MethodBase.IsStatic || !aMethod.MethodBase.IsVirtual || aMethod.MethodBase.IsFinal )
|
if( xMethodInfo.IsStatic || !xMethodInfo.IsVirtual || xMethodInfo.IsFinal )
|
||||||
{
|
{
|
||||||
var xNormalAddress = CPU.MethodInfoLabelGenerator.GenerateLabelName( aMethod.MethodBase );
|
var xNormalAddress = CPU.MethodInfoLabelGenerator.GenerateLabelName( xMethodInfo );
|
||||||
}
|
}
|
||||||
// mMethodIdentifier = GetService<IMetaDataInfoService>().GetMethodIdLabel(mMethod);
|
// mMethodIdentifier = GetService<IMetaDataInfoService>().GetMethodIdLabel(mMethod);
|
||||||
var xMethodInfo = ( System.Reflection.MethodInfo )( ( ( Cosmos.IL2CPU.ILOpCodes.OpMethod )aOpCode ).Value );
|
|
||||||
int xArgCount = xMethodInfo.GetParameters().Length;
|
int xArgCount = xMethodInfo.GetParameters().Length;
|
||||||
uint xReturnSize = SizeOfType( xMethodInfo.ReturnType );
|
uint xReturnSize = SizeOfType( xMethodInfo.ReturnType );
|
||||||
// Extracted from MethodInformation: Calculated offset
|
// Extracted from MethodInformation: Calculated offset
|
||||||
|
|
@ -53,6 +54,14 @@ namespace Cosmos.IL2CPU.X86.IL
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
//// Above: Arguments[i].Offset += ExtraStackSize; => Arguments[0].Offset == ExtraStackSize
|
||||||
|
//// below:
|
||||||
|
//// mThisOffset = mTargetMethodInfo.Arguments[ 0 ].Offset; => mThisOffset == ExtraStackSize
|
||||||
|
//// mExtraStackSpace = mTargetMethodInfo.ExtraStackSize;
|
||||||
|
//// if (mExtraStackSpace > 0) {
|
||||||
|
//// mThisOffset -= mExtraStackSpace; => mThisOffset == 0 ???
|
||||||
|
//// }
|
||||||
|
//// First argument in old methodinfo has always an offset of 0 that means mThisOffset is always 0.
|
||||||
|
|
||||||
// This is finding offset to self? It looks like we dont need offsets of other
|
// This is finding offset to self? It looks like we dont need offsets of other
|
||||||
// arguments, but only self. If so can calculate without calculating all fields
|
// arguments, but only self. If so can calculate without calculating all fields
|
||||||
|
|
@ -89,9 +98,10 @@ namespace Cosmos.IL2CPU.X86.IL
|
||||||
// GetServiceProvider()
|
// GetServiceProvider()
|
||||||
// );
|
// );
|
||||||
// new CPU.Label(mLabelName + "_AfterNullRefCheck");
|
// new CPU.Label(mLabelName + "_AfterNullRefCheck");
|
||||||
// if (mExtraStackSpace > 0) {
|
if( xExtraStackSize > 0 )
|
||||||
// new CPUx86.Sub { DestinationReg = CPUx86.Registers.ESP, SourceValue = (uint)mExtraStackSpace };
|
{
|
||||||
// }
|
new CPUx86.Sub { DestinationReg = CPUx86.Registers.ESP, SourceValue = ( uint )xExtraStackSize };
|
||||||
|
}
|
||||||
// new CPUx86.Call { DestinationLabel = mNormalAddress };
|
// new CPUx86.Call { DestinationLabel = mNormalAddress };
|
||||||
// } else {
|
// } else {
|
||||||
// /*
|
// /*
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue