Update of /cvsroot/monetdb/pathfinder/compiler/mil
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv19294/mil

Modified Files:
        milgen.brg 
Log Message:
-- Fixed MIL code generation for the fun_call operator. The MIL variables
   representing the function parameters are now pinned longer and thus visible
   until they are manually released (in rule fun_call).


U milgen.brg
Index: milgen.brg
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/mil/milgen.brg,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -d -r1.131 -r1.132
--- milgen.brg  7 Apr 2008 11:01:09 -0000       1.131
+++ milgen.brg  8 Apr 2008 12:16:49 -0000       1.132
@@ -8099,7 +8099,8 @@
         /* FunRel:   fun_call (Rel, Param) */
         case 151: /* fold( */
         {   /* TOPDOWN */
-            PFarray_t     *old_fun_params;
+            PFarray_t *old_fun_params;
+            PFpa_op_t *param;
 
             /* Collect the destinations */
             reduce (kids[0], nts[0]);
@@ -8124,7 +8125,6 @@
                 PFcnode_t *core_apply = (PFcnode_t *) p->sem.fun_call.ctx;
 
                 /* do XRPC stuff here */
-                (void)* fun_params;
                 (void)* core_apply;
 
                 /* dummy stub to fill the environment */
@@ -8152,6 +8152,15 @@
 
             }
 
+            /* Unpin all MIL variables that represent the function parameters.
+               (They have 1 additional pin (see rule fun_param) to ensure
+                their visibility in this operator.) */
+            for (unsigned int i = 0; i < PFarray_last (fun_params); i++) {
+                param = *((PFpa_op_t **) PFarray_at (fun_params, i));
+                for (unsigned int j = 0; j < PFarray_last (param->env); j++)
+                    unpin (((env_t *) PFarray_at (param->env, j))->mvar, 1);
+            }
+            
             /* restore the function arguments */
             fun_params = old_fun_params;
         }   break; /* fold) */
@@ -8166,6 +8175,11 @@
             /* copy the complete environment of the argument */
             env_copy (p, L(p)->env);
 
+            /* Add an extra pin to every function argument to ensure
+               that they are only free'ed AFTER the fun_call operator. */
+            for (unsigned int i = 0; i < PFarray_last (p->env); i++)
+                pin (((env_t *) PFarray_at (p->env, i))->mvar, 1);
+            
             /* Append the new parameter to function parameter list */
             *((PFpa_op_t **) PFarray_add (fun_params)) = p;
 


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Register now and save $200. Hurry, offer ends at 11:59 p.m., 
Monday, April 7! Use priority code J8TLD2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to