Update of /cvsroot/monetdb/pathfinder/compiler/semantics
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv18454/compiler/semantics

Modified Files:
      Tag: M5XQ
        heuristic.c 
Log Message:
propagated changes of Thursday Nov 19 2009
from the XQFT branch to the M5XQ branch

  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2009/11/19 - sjoerd: compiler/semantics/heuristic.c,1.18.2.2
  propagated changes of Tuesday Nov 17 2009 - Thursday Nov 19 2009
  from the development trunk to the XQFT branch
  
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    2009/11/17 - stmane: compiler/semantics/heuristic.c,1.20
    propagated changes of Monday Nov 16 2009 - Tuesday Nov 17 2009
    from the Nov2009 branch to the development trunk
  
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      2009/11/16 - boncz: compiler/semantics/heuristic.c,1.15.6.5
      make index rewrite more selective:
      - patterns inside function invocations lead to an algebra translation
        that loop-lifts the index lookup, which we want to avoid.
  
      (fixes MBench/qa05 timeout)
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      2009/11/16 - boncz: compiler/semantics/heuristic.c,1.15.6.6
      - fix handling of non-string values in heuristic rewrite for index lookup
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Index: heuristic.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/semantics/heuristic.c,v
retrieving revision 1.14.4.4
retrieving revision 1.14.4.5
diff -u -d -r1.14.4.4 -r1.14.4.5
--- heuristic.c 12 Nov 2009 09:03:56 -0000      1.14.4.4
+++ heuristic.c 19 Nov 2009 13:51:16 -0000      1.14.4.5
@@ -291,14 +291,12 @@
     return r;
 }
 
-/*
 static PFpnode_t* 
 seq_ty_(PFloc_t loc, PFpnode_t *a) { 
     PFpnode_t *r = p_wire1(p_seq_ty, loc, a);  
     if (r) r->sem.kind = p_kind_node;
     return r; 
 }
-*/
 
 #define cpy(cur)            cpy_subst(cur,NULL,NULL,NULL)
 #define subst(cur,src,dst)  cpy_subst(cur,src,dst,NULL)
@@ -400,6 +398,7 @@
     {  0, p_attribute },
     {  0, p_attribute }
 };
+#define REV_AXIS(x) rev_axis[((x) <= 15)?(x):15]
 
 #define skip_over_emptyseq(p) skip(p,0)
 #define skip_to_locpath(p)    skip(p,1)
@@ -430,7 +429,7 @@
         }
         if (p->kind != p_locpath || L(p)->kind != p_step) break;
 
-        rev_axis_t a = rev_axis[L(p)->sem.kind];
+        rev_axis_t a = REV_AXIS(L(p)->sem.kind);
         if (a.id == p_attribute) return NULL;
 
         /* protect (a bit) against reverted locpaths that are 
@@ -538,7 +537,7 @@
 
     /* check txt/attr predicate and ensure it is the left child of eq */
     PFpnode_t *req_name = nil;
-    int tst = check_predicate(L(p), &req_name);
+    int i,j,tst = check_predicate(L(p), &req_name);
     if (!tst) {
         tst = check_predicate(R(p), &req_name);
         if (tst) {
@@ -549,6 +548,11 @@
            return 0;
         }
     }
+    /* prohibition on a loop-lifted function application on lookup result, as 
it forces looplifted index evaluation */
+    for(i=j=0; i<depth; i++) {
+        if (stack[i]->kind == p_flwr) j = 1;
+        if (j && stack[i]->kind == p_fun_ref) return 0;
+    }
 
     /* I do support conjunctions in PRED, EXPR1 */
     while(depth > 0 && stack[depth-1]->kind == p_and) depth--;
@@ -636,18 +640,15 @@
            let(var_type(cpy(VAR2)),
                flwr(binds(bind(vars(cpy(VAR3)),EXPR1), nil),
                where(nil, ord_ret(nil,
-                     apply("fn", "string", args(cpy(VAR3), nil)))))),
-/*
                      if_then(instof(cpy(VAR3), seq_ty(node_ty(p_kind_node, 
nil))),
                      then_else(apply("fn", "data", args(cpy(VAR3), nil)),
-                               cpy(VAR3)))
-*/
+                               cpy(VAR3))))))),
           binds(
            let(var_type(cpy(VAR4)),
                flwr(binds(bind(vars(cpy(VAR5)), cpy(VAR2)), nil),
                where(nil, ord_ret(nil,
                      apply("pf",(tst == TST_ATTR)?"attribute":"text", 
-                           args(cpy(VAR5), arg)))))), nil)));
+                           args(apply("fn", "string", args(cpy(VAR5), nil)), 
arg)))))), nil)));
 
         /* pattern(2): put in VBIND any remaining variable bindings after $x */
         if (VBIND) { 


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to