Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Generate runtime module dependency edges
  • Loading branch information
sorear committed Dec 23, 2010
1 parent 8807f8a commit 4acf199
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions lib/CLRBackend.cs
Expand Up @@ -150,6 +150,9 @@ class Unit {

public readonly Dictionary<string, Package> exp_pkg;

public Assembly clrAssembly;
public Type clrType;

public Unit(object[] from) {
mainline_ref = new Xref(from[0] as object[]);
name = ((JScalar) from[1]).str;
Expand Down Expand Up @@ -785,6 +788,8 @@ sealed class Tokens {
typeof(Kernel).GetMethod("Die");
public static readonly MethodInfo Kernel_SFH =
typeof(Kernel).GetMethod("SearchForHandler");
public static readonly MethodInfo Kernel_BootModule =
typeof(Kernel).GetMethod("BootModule");
public static readonly MethodInfo Kernel_RunLoop =
typeof(Kernel).GetMethod("RunLoop");
public static readonly MethodInfo Kernel_NewROScalar =
Expand Down Expand Up @@ -3070,6 +3075,13 @@ public class CLRBackend {
FieldAttributes.Static);
});

foreach (object o in unit.tdeps) {
string dp = JScalar.S(((object[])o)[0]);
if (dp == unit.name) continue;
thaw.Add(CpsOp.MethodCall(null, Tokens.Kernel_BootModule, new CpsOp[] {
CpsOp.StringLiteral(dp), CpsOp.DBDLiteral(CLRBackend.GetUnit(dp).clrType.GetMethod("BOOT")) }));
}

NamProcessor[] aux = new NamProcessor[unit.xref.Length];
unit.VisitSubsPreorder(delegate(int ix, StaticSub obj) {
CpsBuilder cpb = new CpsBuilder(this,
Expand Down Expand Up @@ -3364,10 +3376,10 @@ public class CLRBackend {
foreach (Unit u in used_units.Values) {
u.BindDepends();
if (u != root) {
Assembly da = Assembly.Load(u.name);
Type dt = da.GetType(u.name);
u.clrAssembly = Assembly.Load(u.name);
u.clrType = u.clrAssembly.GetType(u.name);
u.BindFields(delegate(string fn, Type t) {
return dt.GetField(fn);
return u.clrType.GetField(fn);
});
}
}
Expand Down

0 comments on commit 4acf199

Please sign in to comment.