Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix Frame.code/protopad/RUN_ONCE interaction
  • Loading branch information
sorear committed Oct 3, 2011
1 parent f1f89cc commit 6c3002f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions lib/CodeGen.cs
Expand Up @@ -4231,6 +4231,8 @@ class NamProcessor {

sub.code = (DynBlockDelegate) Delegate.CreateDelegate(
Tokens.DynBlockDelegate, m);
if (sub.protopad != null)
sub.protopad.code = sub.code;
}

JScalar j(string s) { return new JScalar(s); }
Expand Down
10 changes: 7 additions & 3 deletions lib/Kernel.cs
Expand Up @@ -309,8 +309,10 @@ class IdentityComparer : IEqualityComparer<object> {
foreach (KeyValuePair<object, FieldBuilder> kv in constants)
type.GetField(kv.Value.Name).SetValue(null, kv.Key);

for (int i = 0; i < ths.Length; i++)
for (int i = 0; i < ths.Length; i++) {
ths[i].FillSubInfo(type);
Console.WriteLine("{0} | {1}", our_subs[i].name, our_subs[i].code);
}

if (Environment.GetEnvironmentVariable("NIECZA_DEFER_TRACE") != null) {
Kernel.TraceFlags = Kernel.TRACE_CUR;
Expand Down Expand Up @@ -1801,6 +1803,7 @@ public class UsedInScopeInfo {
public SubInfo(string name, int[] lines, DynBlockDelegate code,
SubInfo outer, LAD ltm, int[] edata, string[] label_names,
int nspill) {
Console.WriteLine("New SubInfo#1 {0}", name);
this.lines = lines;
this.code = code;
this.outer = outer;
Expand All @@ -1817,6 +1820,7 @@ public class UsedInScopeInfo {

public SubInfo(RuntimeUnit unit, string name, SubInfo outer,
STable cls, STable pkg, bool once) {
Console.WriteLine("New SubInfo#2 {0} [{1:X}]", name, GetHashCode());
edata = new int[0];
this.name = name;
this.unit = unit;
Expand Down Expand Up @@ -4774,8 +4778,8 @@ class ExitRunloopException : Exception {
private static void DoTrace(Frame cur) {
TraceCount = TraceFreq;
if ((TraceFlags & TRACE_CUR) != 0)
Console.WriteLine("{0}|{1} @ {2}",
cur.DepthMark(), cur.info.name, cur.ip);
Console.WriteLine("{0}|{1} @ {2} [{3}/{4:X}]",
cur.DepthMark(), cur.info.name, cur.ip, cur.info.code, cur.info.GetHashCode());
if ((TraceFlags & TRACE_ALL) != 0) {
Console.WriteLine("Context:" + DescribeBacktrace(cur, null));
}
Expand Down

0 comments on commit 6c3002f

Please sign in to comment.