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

Modified Files:
      Tag: Nov2009
        intro_borders.c 
Log Message:
propagated changes of Monday Sep 28 2009 - Wednesday Oct 07 2009
from the Aug2009_NFI branch to the Nov2009 branch

  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2009/09/28 - boncz: compiler/algebra/intro_borders.c,1.2.6.1
  optimizations for NFI XIRAF use case -- thanks a great bunch Jan R.!!
  
  - ds_link (already in Stable) optimized for 1-node case
  - indices now contain all data (but still not used automatically, nor based 
on Lefteris' new indexing schemes)
  
  most prominently though is: subexpression result caching
  - caching hints in pragmas
  - query enclosed in (# pf:session id:msec ) { query }  or (# pf:session-use 
id:msec ) { query }
    + queries in the same session use the same working set (documents opened 
only once)
    + same working set allows to cache results
    + pf:session-use only uses cache, cannot add to it
      - but, multiple pf:session-use can run concurrently; whereas pf:session 
is exclusive
  - inside a query, an arbitrary number of expressions can be marked up for 
caching/reuse
    + (# pf:cache id ) { subexpr }
    + subexpr may not be enclosed by a for-loop
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


U intro_borders.c
Index: intro_borders.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/intro_borders.c,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -d -r1.2 -r1.2.4.1
--- intro_borders.c     26 May 2009 11:46:07 -0000      1.2
+++ intro_borders.c     7 Oct 2009 13:43:56 -0000       1.2.4.1
@@ -269,7 +269,8 @@
         pfIN(n) = true;
 
     if (n == dep_op) {
-        assert (n->kind == pa_dep_cross);
+        assert (n->kind == pa_dep_cross ||
+                n->kind == pa_cache);
 
         mark_plan (L(n), dep_op);
 
@@ -284,7 +285,7 @@
  * Worker for introduce_dep_borders.
  */ 
 static void
-introduce_dep_borders_worker (PFpa_op_t *n)
+introduce_borders_worker (PFpa_op_t *n, PFpa_op_kind_t kind)
 {
     /* We mark only the independent operators as SEEN as we stop
        as soon as we reach a boundary to an dependent operator. */
@@ -298,17 +299,19 @@
             n->child[i]->kind != pa_nil) {
             /* Introduce a border if a boundary is reached
                and stop the traversal. */
-            n->child[i] = PFpa_dep_border (n->child[i]);
+            n->child[i] = (kind == pa_dep_cross)
+                          ?PFpa_dep_border (n->child[i])
+                          :PFpa_cache_border (n->child[i]);
             n->child[i]->prop = L(n->child[i])->prop;
         }
         else
             /* Recursively traverse the plan otherwise. */
-            introduce_dep_borders_worker (n->child[i]);
+            introduce_borders_worker (n->child[i], kind);
 
     /* Rewrite dependent cross products that are nested in
        the right side of another dependent cross into normal
        cross products again. */
-    if (n->kind == pa_dep_cross)
+    if (kind == pa_dep_cross && n->kind == pa_dep_cross)
         /* we can replace the kind as the two cross
            product operators behave exactly the same */
         n->kind = pa_cross;
@@ -319,7 +322,7 @@
  * introduce dependencies.
  */
 static void
-introduce_dep_borders (PFpa_op_t *n, PFpa_op_t *root)
+introduce_borders (PFpa_op_t *n, PFpa_op_t *root)
 {
     if (SEEN(n))
         return;
@@ -327,9 +330,9 @@
         SEEN(n) = true;
 
     /* Detect borders for this operator. */
-    if (n->kind == pa_dep_cross) {
+    if (n->kind == pa_dep_cross || n->kind == pa_cache) {
         /* Traverse the query plan for the left argument */
-        introduce_dep_borders (L(n), root);
+        introduce_borders (L(n), root);
 
         /* Mark all operators that are reachable from the
            root (except for the right side of n) to detect
@@ -339,18 +342,18 @@
         /* Dependent cross products that have no operators
            that can be evaluated in dependence are rewritten
            into normal cross products again. */
-        if (pfIN(R(n)))
+        if (n->kind == pa_dep_cross && pfIN(R(n)))
             /* we can replace the kind as the two cross
                product operators behave exactly the same */
             n->kind = pa_cross;
         else
             /* Introduce the borders for this operator. */
-            introduce_dep_borders_worker (R(n));
+            introduce_borders_worker (R(n), n->kind);
         in_reset (root);
     }
     else
         for (unsigned int i = 0; i < PFPA_OP_MAXCHILD && n->child[i]; i++)
-            introduce_dep_borders (n->child[i], root);
+            introduce_borders (n->child[i], root);
 }
 
 /**
@@ -365,8 +368,9 @@
     PFpa_dag_reset (n);
 
     /* Introduce border operators
-       for dependency generating operators */
-    introduce_dep_borders (n, n);
+       for dependency generating
+       and caching operators */
+    introduce_borders (n, n);
     PFpa_dag_reset (n);
 
     return n;


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to