Update of /cvsroot/monetdb/pathfinder/compiler/mil
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv25894
Modified Files:
Tag: XQuery_0-16
milprint_summer.c
Log Message:
- fix xmark q09 that had been affected by the changes in variable expansion
(triggered by the moerkotte queries)
Index: milprint_summer.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/mil/milprint_summer.c,v
retrieving revision 1.318.2.18
retrieving revision 1.318.2.19
diff -u -d -r1.318.2.18 -r1.318.2.19
--- milprint_summer.c 26 Feb 2007 17:26:08 -0000 1.318.2.18
+++ milprint_summer.c 3 Mar 2007 11:18:58 -0000 1.318.2.19
@@ -160,8 +160,8 @@
static int
translate2MIL (opt_t *f, int code, int cur_level, int counter, PFcnode_t *c);
-static int
-var_is_used (PFvar_t *v, PFcnode_t *e);
+static int var_is_used (PFvar_t *v, PFcnode_t *e);
+static int var_is_used2 (PFvar_t *v, PFcnode_t *e);
int PFqueryType(PFcnode_t *c);
/* throw away out-of date flwr information. return the relevant level */
@@ -8920,13 +8920,13 @@
{
if (noForBetween (v, LR(c)) == 0)
return 0;
- if (var_is_used (v, R(c)))
+ if (var_is_used2 (v, R(c)))
return 0;
}
else if (c->kind == c_apply &&
!PFqname_eq(c->sem.fun->qname, PFqname (PFns_pf,"join")))
{
- if (var_is_used (v, D(c)))
+ if (var_is_used2 (v, D(c)))
return 0;
}
else
@@ -8937,7 +8937,7 @@
}
/**
- * expandable tests wether a variable can be expanded without causing
+ * expandable tests whether a variable can be expanded without causing
* any problems and returns the result of the functions noConstructor and
* noForBetween
*
@@ -9010,6 +9010,31 @@
return usage;
}
+static int
+var_is_used2 (PFvar_t *v, PFcnode_t *e)
+{
+ int i;
+ int usage = 0;
+
+ assert (v && e);
+
+ /* if variable is used to iterate over, ignore it as use */
+ if (e->kind == c_for &&
+ L(e) && L(e)->kind == c_forbind &&
+ LR(e) && LR(e)->kind == c_var && LR(e)->sem.var == v)
+ {
+ return 0; /* speculate that var will be recognized as a join-side */
+ }
+
+ if (e->kind == c_var && e->sem.var == v)
+ return 1;
+ else
+ for (i = 0; (i < PFCNODE_MAXCHILD) && e->child[i]; i++)
+ usage += var_is_used2 (v, e->child[i]);
+
+ return usage;
+}
+
#define assert_exp(e) (assert (e), (e))
/*
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins