[svn] r7126: nemerle/trunk/ncc/generation: ILEmitter.n Typer3.n

malekith svnadmin at nemerle.org
Wed Dec 20 14:53:34 CET 2006


Log:
Emit debug sequence points for void literals. Use a simple hack for inlined functions' sequence points.

Author: malekith
Date: Wed Dec 20 14:53:33 2006
New Revision: 7126

Modified:
   nemerle/trunk/ncc/generation/ILEmitter.n
   nemerle/trunk/ncc/generation/Typer3.n

Modified: nemerle/trunk/ncc/generation/ILEmitter.n
==============================================================================
--- nemerle/trunk/ncc/generation/ILEmitter.n	(original)
+++ nemerle/trunk/ncc/generation/ILEmitter.n	Wed Dec 20 14:53:33 2006
@@ -37,6 +37,10 @@
   using System.Diagnostics.SymbolStore;
 
   using Nemerle.Compiler.Typedtree;
+  using Nemerle.Logging;
+
+  [assembly: LogFlag (EMIT, 0)]
+
 
   /* ----------------------------------------------------------------------- */
   /* -- CODE GENERATOR CLASS ----------------------------------------------- */
@@ -503,7 +507,7 @@
      */
     private emit (expr : TExpr) : void
     {
-      // Message.Debug (expr.loc, "{ emit: " + expr.ToString ());
+      log (EMIT, $"{ emit: $expr");
       Util.cassert (expr != null);
       Util.locate (expr.loc,
       match (expr) {
@@ -1378,7 +1382,12 @@
                 emit (TExpr.DefaultValue (expr.loc, expr.Type))
               | _ => emit_literal (l);
             }
-          else
+          else if (l is Literal.Void) {
+            when (IsDebugEnabled) {
+              Mark (expr.Location);
+              _ilg.Emit (OpCodes.Nop);   
+            }
+          } else
             emit_literal (l);
 
         /* loads address of given method */
@@ -1492,8 +1501,8 @@
 
         | _ =>
           Message.Warning ($ "FIXME: unmatched: $expr");
-      })
-      // Message.Debug (expr.loc, "} emit");
+      });
+      log (EMIT, $"} emit");
     }
 
     private array_set_method (t : System.Type) : MethodInfo

Modified: nemerle/trunk/ncc/generation/Typer3.n
==============================================================================
--- nemerle/trunk/ncc/generation/Typer3.n	(original)
+++ nemerle/trunk/ncc/generation/Typer3.n	Wed Dec 20 14:53:33 2006
@@ -1430,7 +1430,7 @@
     }
 
 
-    EmitCall (ret_type : TyVar, func : TExpr, parms : list [Parm], is_tail : bool) : TExpr
+    EmitCall (loc : Location, ret_type : TyVar, func : TExpr, parms : list [Parm], is_tail : bool) : TExpr
     {
       foreach (p in parms)
         p.expr = Walk (p.expr);
@@ -1467,7 +1467,10 @@
                           (ValKind = LocalValue.Kind.Function (hd, _)), type_parms) =>
           match (hd.usage) {
             | FunctionUsage.UsedJustOnce =>
-              EmitLoop (hd, parms)
+              def body = EmitLoop (hd, parms);
+              TExpr.Sequence (loc, body.Type,
+                TExpr.Literal (loc, InternalType.Void, Literal.Void ()),
+                body)
 
             | _ =>
               if (hd.static_method != null) {
@@ -1657,7 +1660,7 @@
           EmitDelegateCtor (expr.Type, sr, parm.expr)
 
         | TExpr.Call (func, parms, is_tail) =>
-          EmitCall (expr.Type, func, parms, is_tail)
+          EmitCall (expr.Location, expr.Type, func, parms, is_tail)
 
         | TExpr.SelfTailCall (parms) =>
           def clo_len = ClosureParmCount (current_local_fun);



More information about the svn mailing list