diff --git a/source2/IL2PCU/Cosmos.IL2CPU.Profiler/ILOpProfiler.cs b/source2/IL2PCU/Cosmos.IL2CPU.Profiler/ILOpProfiler.cs index 76c6ce69c..a8274484d 100644 --- a/source2/IL2PCU/Cosmos.IL2CPU.Profiler/ILOpProfiler.cs +++ b/source2/IL2PCU/Cosmos.IL2CPU.Profiler/ILOpProfiler.cs @@ -9,6 +9,6 @@ namespace Cosmos.IL2CPU.Profiler { : base(aOpCode) { } - public override void Assemble() { } + public override void Execute(UInt32 aMethodUID) { } } } diff --git a/source2/IL2PCU/Cosmos.IL2CPU.X86/ILOpX86.cs b/source2/IL2PCU/Cosmos.IL2CPU.X86/ILOpX86.cs index 4c317f030..2d4599456 100644 --- a/source2/IL2PCU/Cosmos.IL2CPU.X86/ILOpX86.cs +++ b/source2/IL2PCU/Cosmos.IL2CPU.X86/ILOpX86.cs @@ -10,7 +10,7 @@ namespace Cosmos.IL2CPU.X86 { } //TODO: remove this when all descendants implement this - public override void Assemble() { + public override void Execute(UInt32 aMethodUID) { } } } diff --git a/source2/IL2PCU/Cosmos.IL2CPU/ILOp.cs b/source2/IL2PCU/Cosmos.IL2CPU/ILOp.cs index f1064f48a..f148faeea 100644 --- a/source2/IL2PCU/Cosmos.IL2CPU/ILOp.cs +++ b/source2/IL2PCU/Cosmos.IL2CPU/ILOp.cs @@ -10,6 +10,8 @@ namespace Cosmos.IL2CPU { OpCode = aOpCode; } - public abstract void Assemble(); + // This is called execute and not assemble, as the scanner + // could be used for other things, profiling, analysis, reporting, etc + public abstract void Execute(UInt32 aMethodUID); } } diff --git a/source2/IL2PCU/Cosmos.IL2CPU/ILScanner.cs b/source2/IL2PCU/Cosmos.IL2CPU/ILScanner.cs index ffbf69807..29aa6e02a 100644 --- a/source2/IL2PCU/Cosmos.IL2CPU/ILScanner.cs +++ b/source2/IL2PCU/Cosmos.IL2CPU/ILScanner.cs @@ -18,14 +18,11 @@ namespace Cosmos.IL2CPU { // need to hash on some UID instead of the refernce. Do not use strings, they are // super slow. private HashSet mMethodsSet = new HashSet(); - // we also need a List`1, to provide an easy way to do scanning. a list doesn't - // change position of it's elements. private List mMethods = new List(); private HashSet mTypesSet = new HashSet(); private HashSet mFieldsSet = new HashSet(); protected ILReader mReader; - // TODO: Investigate this and see if Matthi's emit way // is a lot faster than calling GetConstructor than invoke protected ConstructorInfo[] mILOpsLo = new ConstructorInfo[256]; protected ConstructorInfo[] mILOpsHi = new ConstructorInfo[256]; @@ -117,15 +114,10 @@ namespace Cosmos.IL2CPU { } else { xCtor = mILOpsHi[xOpCodeVal & 0xFF]; } - var xILOp = xCtor.Invoke(new object[] { xOpCode }); - // What to pass to Execute method? Passing whole scanner is inappropriate - // Op needs info about branch targets for example - // are all branches within method? - //inherited execute in ILOpX6 for example can emit this label - // MethodLabel + offset since we will need method labels anyways. Method label - // can be based on a UID generated by our compiler. ie 32 bits of UID + 32 bits offset - // UInt64 xUID = xMethodID << 32 | xOffset - //xILOp.Execute(xUID); + //TODO: This invoke nearly doubles scanner time. Comment it out and + // profiler runs about twice as fast. See if we can speed this up + var xILOp = (ILOp)xCtor.Invoke(new object[] { xOpCode }); + xILOp.Execute(0); } } }