From 9bc82a92894c837f4aeb0da94f10eee46eb08d02 Mon Sep 17 00:00:00 2001 From: kudzu_cp <6d05c8c8ef5431987001abfdb2eadc9593ac9498> Date: Sat, 25 Jul 2009 03:30:56 +0000 Subject: [PATCH] --- .../IL2PCU/Cosmos.IL2CPU.Profiler/ILOpProfiler.cs | 2 ++ source2/IL2PCU/Cosmos.IL2CPU.X86/ILOpX86.cs | 4 ++++ source2/IL2PCU/Cosmos.IL2CPU/ILOp.cs | 9 +++------ source2/IL2PCU/Cosmos.IL2CPU/ILScanner.cs | 13 +++++++++---- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/source2/IL2PCU/Cosmos.IL2CPU.Profiler/ILOpProfiler.cs b/source2/IL2PCU/Cosmos.IL2CPU.Profiler/ILOpProfiler.cs index 087160baf..76c6ce69c 100644 --- a/source2/IL2PCU/Cosmos.IL2CPU.Profiler/ILOpProfiler.cs +++ b/source2/IL2PCU/Cosmos.IL2CPU.Profiler/ILOpProfiler.cs @@ -8,5 +8,7 @@ namespace Cosmos.IL2CPU.Profiler { public ILOpProfiler(ILOpCode aOpCode) : base(aOpCode) { } + + public override void Assemble() { } } } diff --git a/source2/IL2PCU/Cosmos.IL2CPU.X86/ILOpX86.cs b/source2/IL2PCU/Cosmos.IL2CPU.X86/ILOpX86.cs index 5030eb0ae..4c317f030 100644 --- a/source2/IL2PCU/Cosmos.IL2CPU.X86/ILOpX86.cs +++ b/source2/IL2PCU/Cosmos.IL2CPU.X86/ILOpX86.cs @@ -8,5 +8,9 @@ namespace Cosmos.IL2CPU.X86 { protected ILOpX86(ILOpCode aOpCode):base(aOpCode) { } + + //TODO: remove this when all descendants implement this + public override void Assemble() { + } } } diff --git a/source2/IL2PCU/Cosmos.IL2CPU/ILOp.cs b/source2/IL2PCU/Cosmos.IL2CPU/ILOp.cs index 4b48c928e..f1064f48a 100644 --- a/source2/IL2PCU/Cosmos.IL2CPU/ILOp.cs +++ b/source2/IL2PCU/Cosmos.IL2CPU/ILOp.cs @@ -6,13 +6,10 @@ using System.Text; namespace Cosmos.IL2CPU { public abstract class ILOp { public readonly ILOpCode OpCode; - protected ILOp(ILOpCode aOpCode) - { - if (aOpCode == null) - { - throw new ArgumentNullException("aOpCode"); - } + protected ILOp(ILOpCode aOpCode) { OpCode = aOpCode; } + + public abstract void Assemble(); } } diff --git a/source2/IL2PCU/Cosmos.IL2CPU/ILScanner.cs b/source2/IL2PCU/Cosmos.IL2CPU/ILScanner.cs index 486bc08b1..9bf1f9b6a 100644 --- a/source2/IL2PCU/Cosmos.IL2CPU/ILScanner.cs +++ b/source2/IL2PCU/Cosmos.IL2CPU/ILScanner.cs @@ -116,15 +116,20 @@ namespace Cosmos.IL2CPU { } else { xCtor = mILOpsHi[xOpCodeVal & 0xFF]; } - // TODO: Remove this if when all shortcut espansions are working again + // TODO: Remove this if when all shortcut expansions are working again if (xCtor != null) { var xILOp = xCtor.Invoke(new object[] { xOpCode }); + // What to pass to execute? Passing whole scanner may be inappropriate + // Op needs info about branch targets for example + // are all branches within method? Maybe ILOpCode can include offset and + // ILOp can reconcile from that and no need to pass anything? + //xILOp.Execute(this); } } } } - public void QueueMethod(MethodBase aMethod) { + protected void QueueMethod(MethodBase aMethod) { if (!mMethodsSet.Contains(aMethod)) { mMethodsSet.Add(aMethod); mMethods.Add(aMethod); @@ -139,7 +144,7 @@ namespace Cosmos.IL2CPU { } } - public void QueueStaticField(FieldInfo aFieldInfo) { + protected void QueueStaticField(FieldInfo aFieldInfo) { if (!mFieldsSet.Contains(aFieldInfo)) { if (!aFieldInfo.IsStatic) { throw new Exception("Cannot queue instance fields!"); @@ -150,7 +155,7 @@ namespace Cosmos.IL2CPU { } } - public void QueueType(Type aType) { + protected void QueueType(Type aType) { if (aType != null) { if (!mTypesSet.Contains(aType)) { mTypesSet.Add(aType);