mirror of
https://github.com/danbulant/Cosmos
synced 2026-06-05 15:51:56 +00:00
This commit is contained in:
parent
1d146df185
commit
13ab61a6ac
2 changed files with 35 additions and 66 deletions
|
|
@ -1,44 +1,15 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Cosmos.IL2CPU.X86.IL
|
namespace Cosmos.IL2CPU.X86.IL {
|
||||||
{
|
[Cosmos.IL2CPU.OpCode(ILOpCode.Code.Conv_Ovf_I4)]
|
||||||
[Cosmos.IL2CPU.OpCode(ILOpCode.Code.Conv_Ovf_I4)]
|
public class Conv_Ovf_I4 : ILOp {
|
||||||
public class Conv_Ovf_I4: ILOp
|
public Conv_Ovf_I4(Cosmos.IL2CPU.Assembler aAsmblr)
|
||||||
{
|
: base(aAsmblr) {
|
||||||
public Conv_Ovf_I4(Cosmos.IL2CPU.Assembler aAsmblr):base(aAsmblr)
|
}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Execute(MethodInfo aMethod, ILOpCode aOpCode) {
|
public override void Execute(MethodInfo aMethod, ILOpCode aOpCode) {
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
// using System;
|
|
||||||
// using System.IO;
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// using CPU = Cosmos.IL2CPU.X86;
|
|
||||||
//
|
|
||||||
// namespace Indy.IL2CPU.IL.X86 {
|
|
||||||
// [OpCode(OpCodeEnum.Conv_Ovf_I4)]
|
|
||||||
// public class Conv_Ovf_I4: Op {
|
|
||||||
// private string mNextLabel;
|
|
||||||
// private string mCurLabel;
|
|
||||||
// private uint mCurOffset;
|
|
||||||
// private MethodInformation mMethodInformation;
|
|
||||||
// public Conv_Ovf_I4(ILReader aReader, MethodInformation aMethodInfo)
|
|
||||||
// : base(aReader, aMethodInfo) {
|
|
||||||
// mMethodInformation = aMethodInfo;
|
|
||||||
// mCurOffset = aReader.Position;
|
|
||||||
// mCurLabel = IL.Op.GetInstructionLabel(aReader);
|
|
||||||
// mNextLabel = IL.Op.GetInstructionLabel(aReader.NextPosition);
|
|
||||||
// }
|
|
||||||
// public override void DoAssemble() {
|
|
||||||
// EmitNotImplementedException(Assembler, GetServiceProvider(), "Conv_Ovf_I4: This has not been implemented at all yet!", mCurLabel, mMethodInformation, mCurOffset, mNextLabel);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Indy.IL2CPU;
|
using Indy.IL2CPU;
|
||||||
using Indy.IL2CPU.Plugs;
|
using Indy.IL2CPU.Plugs;
|
||||||
|
|
||||||
namespace Cosmos.IL2CPU {
|
namespace Cosmos.IL2CPU {
|
||||||
public class ILScanner {
|
public class ILScanner {
|
||||||
|
|
@ -75,7 +75,7 @@ namespace Cosmos.IL2CPU {
|
||||||
if (xTargetType == null) {
|
if (xTargetType == null) {
|
||||||
xTargetType = Type.GetType(xTypeAttrib.TargetName, true);
|
xTargetType = Type.GetType(xTypeAttrib.TargetName, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// See if there is a custom PlugMethod attribute
|
// See if there is a custom PlugMethod attribute
|
||||||
// Plug implementations must be static and public, so
|
// Plug implementations must be static and public, so
|
||||||
// we narrow the search to meet these requirements
|
// we narrow the search to meet these requirements
|
||||||
|
|
@ -127,9 +127,9 @@ namespace Cosmos.IL2CPU {
|
||||||
|
|
||||||
if (xEnabled) {
|
if (xEnabled) {
|
||||||
// for PlugMethodAttribute:
|
// for PlugMethodAttribute:
|
||||||
//TODO: public string Signature;
|
//TODO: public string Signature;
|
||||||
//[PlugMethod(Signature = "System_Void__Indy_IL2CPU_Assembler_Assembler__cctor__")]
|
//[PlugMethod(Signature = "System_Void__Indy_IL2CPU_Assembler_Assembler__cctor__")]
|
||||||
//TODO: public Type Assembler = null;
|
//TODO: public Type Assembler = null;
|
||||||
// Scan the plug implementation
|
// Scan the plug implementation
|
||||||
uint xUID = ExecuteInternal(xMethod, true);
|
uint xUID = ExecuteInternal(xMethod, true);
|
||||||
|
|
||||||
|
|
@ -198,25 +198,25 @@ namespace Cosmos.IL2CPU {
|
||||||
}
|
}
|
||||||
//TODO: Look for Field plugs
|
//TODO: Look for Field plugs
|
||||||
}
|
}
|
||||||
// register any "system" types:
|
|
||||||
QueueType(typeof(Array));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ExecuteInternal( ( System.Reflection.MethodInfo )RuntimeEngineRefs.InitializeApplicationRef, true );
|
// Manually register certain system types
|
||||||
ExecuteInternal( ( System.Reflection.MethodInfo )RuntimeEngineRefs.FinalizeApplicationRef, true );
|
QueueType(typeof(Array));
|
||||||
|
|
||||||
|
// Pull in extra implementations, GC etc.
|
||||||
|
ExecuteInternal((System.Reflection.MethodInfo)RuntimeEngineRefs.InitializeApplicationRef, true);
|
||||||
|
ExecuteInternal((System.Reflection.MethodInfo)RuntimeEngineRefs.FinalizeApplicationRef, true);
|
||||||
////xScanner.QueueMethod(typeof(CosmosAssembler).GetMethod("PrintException"), true);
|
////xScanner.QueueMethod(typeof(CosmosAssembler).GetMethod("PrintException"), true);
|
||||||
ExecuteInternal( ( System.Reflection.MethodInfo )VTablesImplRefs.LoadTypeTableRef, true );
|
ExecuteInternal((System.Reflection.MethodInfo)VTablesImplRefs.LoadTypeTableRef, true);
|
||||||
ExecuteInternal( ( System.Reflection.MethodInfo )VTablesImplRefs.SetMethodInfoRef, true );
|
ExecuteInternal((System.Reflection.MethodInfo)VTablesImplRefs.SetMethodInfoRef, true);
|
||||||
ExecuteInternal( ( System.Reflection.MethodInfo )VTablesImplRefs.IsInstanceRef, true );
|
ExecuteInternal((System.Reflection.MethodInfo)VTablesImplRefs.IsInstanceRef, true);
|
||||||
ExecuteInternal( ( System.Reflection.MethodInfo )VTablesImplRefs.SetTypeInfoRef, true );
|
ExecuteInternal((System.Reflection.MethodInfo)VTablesImplRefs.SetTypeInfoRef, true);
|
||||||
ExecuteInternal( ( System.Reflection.MethodInfo )VTablesImplRefs.GetMethodAddressForTypeRef, true );
|
ExecuteInternal((System.Reflection.MethodInfo)VTablesImplRefs.GetMethodAddressForTypeRef, true);
|
||||||
ExecuteInternal( ( System.Reflection.MethodInfo )GCImplementationRefs.IncRefCountRef, true );
|
ExecuteInternal((System.Reflection.MethodInfo)GCImplementationRefs.IncRefCountRef, true);
|
||||||
ExecuteInternal( ( System.Reflection.MethodInfo )GCImplementationRefs.DecRefCountRef, true );
|
ExecuteInternal((System.Reflection.MethodInfo)GCImplementationRefs.DecRefCountRef, true);
|
||||||
ExecuteInternal( ( System.Reflection.MethodInfo )GCImplementationRefs.AllocNewObjectRef, true );
|
ExecuteInternal((System.Reflection.MethodInfo)GCImplementationRefs.AllocNewObjectRef, true);
|
||||||
|
|
||||||
// Scan from entry point of this program
|
// Scan from entry point of this program
|
||||||
//TODO: Now that we scan plugs first, we might need to put a jump
|
|
||||||
// in the asm to jump to the entry point?
|
|
||||||
ExecuteInternal(aStartMethod, false);
|
ExecuteInternal(aStartMethod, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -323,7 +323,7 @@ namespace Cosmos.IL2CPU {
|
||||||
if (mKnownMethods.TryGetValue(aMethodBase, out xResult)) {
|
if (mKnownMethods.TryGetValue(aMethodBase, out xResult)) {
|
||||||
return xResult;
|
return xResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
xResult = (uint)mMethodsToProcess.Count;
|
xResult = (uint)mMethodsToProcess.Count;
|
||||||
mKnownMethods.Add(aMethodBase, xResult);
|
mKnownMethods.Add(aMethodBase, xResult);
|
||||||
|
|
||||||
|
|
@ -352,17 +352,15 @@ namespace Cosmos.IL2CPU {
|
||||||
var xMethod = new MethodInfo(aMethodBase, xResult, xMethodType, xPlug);
|
var xMethod = new MethodInfo(aMethodBase, xResult, xMethodType, xPlug);
|
||||||
mMethodsToProcess.Add(xMethod);
|
mMethodsToProcess.Add(xMethod);
|
||||||
|
|
||||||
//TODO: Might still need this one, see after we get assembly output again
|
// Queue Types directly related to method
|
||||||
//Im hoping the operand walking we have now will include this on its own.
|
QueueType(aMethodBase.DeclaringType);
|
||||||
//QueueType(aMethod.DeclaringType);
|
if (aMethodBase is System.Reflection.MethodInfo) {
|
||||||
|
QueueType(((System.Reflection.MethodInfo)aMethodBase).ReturnType);
|
||||||
|
}
|
||||||
|
foreach (var xParam in aMethodBase.GetParameters()) {
|
||||||
|
QueueType(xParam.ParameterType);
|
||||||
|
}
|
||||||
|
|
||||||
//var xMethodInfo = aMethod as MethodInfo;
|
|
||||||
//if (xMethodInfo != null) {
|
|
||||||
// QueueType(xMethodInfo.ReturnType);
|
|
||||||
//}
|
|
||||||
//foreach (var xParam in aMethod.GetParameters()) {
|
|
||||||
// QueueType(xParam.ParameterType);
|
|
||||||
//}
|
|
||||||
return xResult;
|
return xResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue