mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-24 12:35:31 +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) {
|
: 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
|
//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;
|
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
|
// need to hash on some UID instead of the refernce. Do not use strings, they are
|
||||||
// super slow.
|
// super slow.
|
||||||
private HashSet<MethodBase> mMethodsSet = new HashSet<MethodBase>();
|
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 List<MethodBase> mMethods = new List<MethodBase>();
|
||||||
private HashSet<Type> mTypesSet = new HashSet<Type>();
|
private HashSet<Type> mTypesSet = new HashSet<Type>();
|
||||||
private HashSet<FieldInfo> mFieldsSet = new HashSet<FieldInfo>();
|
private HashSet<FieldInfo> mFieldsSet = new HashSet<FieldInfo>();
|
||||||
protected ILReader mReader;
|
protected ILReader mReader;
|
||||||
|
|
||||||
// TODO: Investigate this and see if Matthi's emit way
|
|
||||||
// is a lot faster than calling GetConstructor than invoke
|
// is a lot faster than calling GetConstructor than invoke
|
||||||
protected ConstructorInfo[] mILOpsLo = new ConstructorInfo[256];
|
protected ConstructorInfo[] mILOpsLo = new ConstructorInfo[256];
|
||||||
protected ConstructorInfo[] mILOpsHi = new ConstructorInfo[256];
|
protected ConstructorInfo[] mILOpsHi = new ConstructorInfo[256];
|
||||||
|
|
@ -117,15 +114,10 @@ namespace Cosmos.IL2CPU {
|
||||||
} else {
|
} else {
|
||||||
xCtor = mILOpsHi[xOpCodeVal & 0xFF];
|
xCtor = mILOpsHi[xOpCodeVal & 0xFF];
|
||||||
}
|
}
|
||||||
var xILOp = xCtor.Invoke(new object[] { xOpCode });
|
//TODO: This invoke nearly doubles scanner time. Comment it out and
|
||||||
// What to pass to Execute method? Passing whole scanner is inappropriate
|
// profiler runs about twice as fast. See if we can speed this up
|
||||||
// Op needs info about branch targets for example
|
var xILOp = (ILOp)xCtor.Invoke(new object[] { xOpCode });
|
||||||
// are all branches within method?
|
xILOp.Execute(0);
|
||||||
//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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue