mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-22 05:48:37 +00:00
This commit is contained in:
parent
1fb5bebeb9
commit
ba872eba56
4 changed files with 9 additions and 15 deletions
|
|
@ -9,6 +9,6 @@ namespace Cosmos.IL2CPU.Profiler {
|
|||
: base(aOpCode) {
|
||||
}
|
||||
|
||||
public override void Assemble() { }
|
||||
public override void Execute(UInt32 aMethodUID) { }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<MethodBase> mMethodsSet = new HashSet<MethodBase>();
|
||||
// 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<MethodBase> mMethods = new List<MethodBase>();
|
||||
private HashSet<Type> mTypesSet = new HashSet<Type>();
|
||||
private HashSet<FieldInfo> mFieldsSet = new HashSet<FieldInfo>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue