Assembly Table

This commit is contained in:
kudzu_cp 2012-08-06 00:24:37 +00:00
parent 73504834f1
commit ee28601e02
5 changed files with 41 additions and 14 deletions

View file

@ -92,7 +92,7 @@ Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "Docs", "..\Docs", "{67E7DEF
Release.AspNetCompiler.ForceOverwrite = "true"
Release.AspNetCompiler.FixedNames = "false"
Release.AspNetCompiler.Debug = "False"
VWDPort = "6345"
VWDPort = "26549"
EndProjectSection
EndProject
Project("{471EC4BB-E47E-4229-A789-D1F5F83B52D4}") = "Playground.Kudzu.Breakpoints", "..\source2\Users\Kudzu\Breakpoints\Playground.Kudzu.Breakpoints.Cosmos", "{3EEE2ABA-87B3-4DD7-B6C5-BEF23D411136}"

View file

@ -207,6 +207,12 @@ namespace Cosmos.Build.MSBuild {
// These are the references of our boot project. We dont actually ever load the boot
// project asm. Instead the references will contain plugs, and the kernel. We load
// them then find the entry point in the kernel.
//
// Plugs and refs in this list will be loaded absolute (or as proj refs) only. Asm resolution
// will not be tried on them, but will on ASMs they reference.
//
// TODO - Update to use Load for Reflection only, but note that this wont load references
// and we have to do it manually (Probably better for us anyways)
Type xKernelType = null;
foreach (var xRef in References) {

View file

@ -206,6 +206,11 @@ namespace Cosmos.Debug.Common {
BulkInsert("Methods", mMethods, 2500, aFlush);
}
public void AddAssemblies(IList<AssemblyFile> aAssemblies) {
// GUIDs by caller on AssemblyFiles, see caller to see why.
BulkInsert("AssemblyFiles", aAssemblies, 0, true);
}
public void WriteSymbols(IList<MLSYMBOL> aSymbols, bool aFlush = false) {
foreach (var x in aSymbols) {
x.ID = Guid.NewGuid();

View file

@ -16,6 +16,10 @@ namespace Cosmos.IL2CPU {
public DebugInfo DebugInfo { get; set; }
protected System.IO.TextWriter mLog;
// Quick look up of assemblies so we dont have to go to the database and compare
// by fullname.
public Dictionary<Assembly, Guid> Assemblies = new Dictionary<Assembly, Guid>();
protected Cosmos.Assembler.Assembler mAssembler;
protected AppAssembler(Cosmos.Assembler.Assembler assembler) {
mAssembler = assembler;

View file

@ -57,6 +57,11 @@ namespace Cosmos.IL2CPU {
protected ILReader mReader;
protected AppAssembler mAsmblr;
// List of asssemblies found during scan. We cannot use the list of loaded
// assemblies because the loaded list includes compilers, etc, and also possibly
// other unused assemblies. So instead we collect a list of assemblies as we scan.
protected List<Assembly> mUsedAssemblies = new List<Assembly>();
protected OurHashSet<object> mItems = new OurHashSet<object>();
protected List<object> mItemsList = new List<object>();
// Contains items to be scanned, both types and methods
@ -295,12 +300,20 @@ namespace Cosmos.IL2CPU {
// scanner and assembler as needed.
//
// -SQL Inserts are slow when done individually.
// -Assemblies can only be uniquely identified by their names.
// -Assemblies can only be uniquely identified by their names or instance. ie there is no Token for example.
// -Assembly table must be written before dependent items like Method
// can be written.
// Because of this, we scan in a loop all at once instead of noticing
// assemblies as we use them.
//mAsmblr.DebugInfo
var xAssemblies = new List<Cosmos.Debug.Common.AssemblyFile>();
foreach (var xAsm in mUsedAssemblies) {
var xRow = new Cosmos.Debug.Common.AssemblyFile() {
ID = Guid.NewGuid(),
Pathname = xAsm.Location
};
xAssemblies.Add(xRow);
mAsmblr.Assemblies.Add(xAsm, xRow.ID);
}
mAsmblr.DebugInfo.AddAssemblies(xAssemblies);
// Time to assemble
foreach (var xItem in mItems) {
@ -816,7 +829,14 @@ namespace Cosmos.IL2CPU {
if (xItem.Item is MethodBase) {
ScanMethod((MethodBase)xItem.Item, false, xItem.SourceItem);
} else if (xItem.Item is Type) {
ScanType((Type)xItem.Item);
var xType = (Type)xItem.Item;
ScanType(xType);
// Methods and fields cant exist without types, so we only update
// mUsedAssemblies in type branch.
if (!mUsedAssemblies.Contains(xType.Assembly)) {
mUsedAssemblies.Add(xType.Assembly);
}
} else if (xItem.Item is FieldInfo) {
// todo: static fields need more processing?
} else {
@ -843,14 +863,6 @@ namespace Cosmos.IL2CPU {
xList.Add(xLogItem);
}
/// <summary>
///
/// </summary>
/// <param name="aTargetType"></param>
/// <param name="aImpls"></param>
/// <param name="aMethod">The target method to be plugged</param>
/// <param name="aParamTypes"></param>
/// <returns></returns>
protected MethodBase ResolvePlug(Type aTargetType, List<Type> aImpls, MethodBase aMethod, Type[] aParamTypes) {
//TODO: This method is "reversed" from old - remember that when porting
MethodBase xResult = null;