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

Modified Files:
        coreopt.brg fs.brg simplify.brg 
Log Message:
-- Modified the core code generation for function application to make sure
   that an XRPC operator is always *directly* followed by an apply node.


Index: simplify.brg
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/core/simplify.brg,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- simplify.brg        4 Oct 2007 10:40:45 -0000       1.33
+++ simplify.brg        7 Dec 2007 13:55:36 -0000       1.34
@@ -313,8 +313,9 @@
 TagName:            tag                                         =  48 (10);
 TagName:            CoreExpr                                    =  49 (10);
                                                                      
-CoreExpr:           apply (FunctionArgs)                        =  50 (10);
-CoreExpr:           apply (arg (CoreExpr,                                
+CoreExpr:           FunExpr                                     =  79 (10);
+FunExpr:            apply (FunctionArgs)                        =  50 (10);
+FunExpr:            apply (arg (CoreExpr,                                
                                 arg (CoreExpr,                           
                                      arg (CoreExpr,                      
                                           FunctionArgs))))      =  51 (10);
@@ -360,7 +361,7 @@
 CoreExpr:           recursion (var, seed (CoreExpr, CoreExpr))  =  77 (10);
 
 /* Pathfinder extension: XRPC */
-CoreExpr:           xrpc (CoreExpr, CoreExpr)                   =  78 (10);
+CoreExpr:           xrpc (CoreExpr, FunExpr)                    =  78 (10);
 
 %%
 

Index: coreopt.brg
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/core/coreopt.brg,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- coreopt.brg 4 Oct 2007 10:40:44 -0000       1.53
+++ coreopt.brg 7 Dec 2007 13:55:36 -0000       1.54
@@ -324,13 +324,14 @@
 TagName:            tag                                         =   83(10);
 TagName:            CoreExpr                                    =   84(10);
                                                                      
-CoreExpr:           apply (FunctionArgs)                        =   85(10);
-CoreExpr:           apply (arg (CoreExpr, nil))                 =  25 (10);
-CoreExpr:           apply (arg (CoreExpr, arg (CoreExpr, nil))) =  26 (10);
+CoreExpr:           FunExpr                                     =   85(10);
+FunExpr:            apply (FunctionArgs)                        =   86(10);
+FunExpr:            apply (arg (CoreExpr, nil))                 =  25 (10);
+FunExpr:            apply (arg (CoreExpr, arg (CoreExpr, nil))) =  26 (10);
 
-FunctionArgs:       arg (CoreExpr, FunctionArgs)                =   86(10);
-FunctionArgs:       arg (SequenceTypeCast, FunctionArgs)        =   87(10);
-FunctionArgs:       nil                                         =   88(10);
+FunctionArgs:       arg (CoreExpr, FunctionArgs)                =   87(10);
+FunctionArgs:       arg (SequenceTypeCast, FunctionArgs)        =   88(10);
+FunctionArgs:       nil                                         =   89(10);
                                                                      
 CoreExpr:           ordered (CoreExpr)                          =   90(10);
 CoreExpr:           unordered (CoreExpr)                        =   91(10);
@@ -369,7 +370,7 @@
 CoreExpr:           recursion (var, seed (CoreExpr, CoreExpr))  =  115(10);
 
 /* Pathfinder extension: XRPC */
-CoreExpr:           xrpc (CoreExpr, CoreExpr)                   =  116(10);
+CoreExpr:           xrpc (CoreExpr, FunExpr)                    =  116(10);
 
 %%
 
@@ -490,7 +491,7 @@
                 }
                 break;
 
-            /* OptBindExpr:        let (letbind (var, CoreExpr), OptBindExpr) 
*/
+            /* OptBindExpr:        let (letbind (var, Atom), OptBindExpr) */
             case 10:
                 /*
                  * Unfold atoms (a is an atom)

Index: fs.brg
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/core/fs.brg,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- fs.brg      27 Jul 2007 15:31:40 -0000      1.61
+++ fs.brg      7 Dec 2007 13:55:36 -0000       1.62
@@ -2890,7 +2890,7 @@
              * Apply ``function conversion rules'' (W3C XQuery 3.1.5).
              * See also helper function function_conversion().
              */
-            PFvar_t      *v        = new_var (NULL);
+            PFcnode_t    *dummy = nil ();
             PFfun_t      *fun;
             PFty_t        expected;
             int  param_num;
@@ -2900,9 +2900,10 @@
             /* translate function argument */
             reduce (kids[0], nts[0]);
 
-            /* build up argument list */
+            /* build up argument list -- fill in a dummy placeholder
+               which will be replaced at the end by the real content */
             *(PFcnode_t **) PFarray_top (args)
-                = arg (var (v), *(PFcnode_t **) PFarray_top (args));
+                = arg (dummy, *(PFcnode_t **) PFarray_top (args));
 
             /* translate other arguments */
             reduce (kids[1], nts[1]);
@@ -2973,19 +2974,15 @@
             if (! PFqname_eq (fun->qname, PFqname (PFns_fn, "concat")))
                 implicit = function (PFqname (PFns_fn, "string"));
 
-            if (implicit) {
-                C(p) = flwr (let (letbind (var (v),
-                                           APPLY (implicit, converted)),
-                                  nil ()),
-                             C(R(p)));
-            }
-            else {
-                /* construct return value */
-                C(p) = flwr (let (letbind (var (v), converted),
-                                  nil ()),
-                             C(R(p)));
-            }
+            /* replace the dummy placeholder in the list of function
+               arguments by the real input */
+            if (implicit)
+                *dummy = *(APPLY (implicit, converted));
+            else
+                *dummy = *(converted); 
 
+            /* propagate the complete function call */
+            C(p) = C(R(p));
         } break;
 
         /* OrderedExpr:            ordered (Expr) */


-------------------------------------------------------------------------
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to