Update of /cvsroot/monetdb/pathfinder/runtime
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5196
Modified Files:
ll_upwards.mx pf_support.mx
Log Message:
- preparing for the GDK-2 BAT head/tail split:
avoid GDKqsort in ll_upwards;
instead, ensure that ll_{parent,ancestor,ancestor_or_self} are called with
tail-ordered ctx_bat (like all other ll_* loop-lifted location-step routines)
- type-optimize the (iter_bat.tail, ctx_bat.tail) -> context.(iter,pre) copy
Index: ll_upwards.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/ll_upwards.mx,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- ll_upwards.mx 10 Aug 2007 00:26:43 -0000 1.22
+++ ll_upwards.mx 13 Aug 2007 12:49:51 -0000 1.23
@@ -288,6 +288,11 @@
GDKerror("%s: iter and context bat should be in sync.\n", axis);
return status;
}
+ if (!(BATtordered(ctx_bat) & 1))
+ {
+ GDKerror("%s: context bat must be ordered on tail.\n", axis);
+ return status;
+ }
if (BUNsize(size_bat) != sizeof(int) || size_bat->hseqbase ||
!BAThdense(size_bat)) {
GDKerror("%s: illegal size bat passed in.\n", axis);
return status;
@@ -302,32 +307,65 @@
if (context == NULL) return status;
/* gather the context nodes and analyze them (order, min/max iter) */
- if (p < q) {
- if (!(BATtordered(iter_bat)&1)) {
- while(p < q) {
- context[i].iter = *(oid*) BUNtail(iter_bat,p);
- context[i].pre = *(oid*) BUNtail(ctx_bat,r);
[EMAIL PROTECTED] ll_upwards_min_max
if (context[i].iter < min_iter) min_iter = context[i].iter;
if (context[i].iter > max_iter) max_iter = context[i].iter;
+@
[EMAIL PROTECTED] ll_upwards_copy
+ while(p < q) {
+ context[i].iter = @1;
+ context[i].pre = @2;
+ @3
i++; p += k; r += n;
}
+@
[EMAIL PROTECTED]
+ if (p < q) {
+ if (!(BATtordered(iter_bat)&1)) {
+ if (BATtdense(iter_bat) && BATtdense(ctx_bat)) {
+ oid iter = iter_bat->tseqbase;
+ oid pre = ctx_bat->tseqbase;
+ @:ll_upwards_copy(iter++, pre++, @:ll_upwards_min_max@)@
+ } else
+ if (BATtdense(iter_bat) && ctx_bat->ttype == TYPE_oid) {
+ oid iter = iter_bat->tseqbase;
+ @:ll_upwards_copy(iter++, *(oid*) BUNtloc(ctx_bat,r),
@:ll_upwards_min_max@)@
+ } else
+ if (iter_bat->ttype == TYPE_oid && BATtdense(ctx_bat)) {
+ oid pre = ctx_bat->tseqbase;
+ @:ll_upwards_copy(*(oid*) BUNtloc(iter_bat,p), pre++,
@:ll_upwards_min_max@)@
+ } else
+ if (iter_bat->ttype == TYPE_oid && ctx_bat->ttype == TYPE_oid) {
+ @:ll_upwards_copy(*(oid*) BUNtloc(iter_bat,p), *(oid*)
BUNtloc(ctx_bat,r), @:ll_upwards_min_max@)@
+ } else {
+ assert(0); /* should never happen */
+ }
} else {
/* ordered iters, so we know min and max */
- while(p < q) {
- context[i].iter = *(oid*) BUNtail(iter_bat,p);
- context[i].pre = *(oid*) BUNtail(ctx_bat,r);
- i++; p += k; r += n;
- }
+ if (BATtdense(iter_bat) && BATtdense(ctx_bat)) {
+ oid iter = iter_bat->tseqbase;
+ oid pre = ctx_bat->tseqbase;
+ @:ll_upwards_copy(iter++, pre++,)@
+ } else
+ if (BATtdense(iter_bat) && ctx_bat->ttype == TYPE_oid) {
+ oid iter = iter_bat->tseqbase;
+ @:ll_upwards_copy(iter++, *(oid*) BUNtloc(ctx_bat,r),)@
+ } else
+ if (iter_bat->ttype == TYPE_oid && BATtdense(ctx_bat)) {
+ oid pre = ctx_bat->tseqbase;
+ @:ll_upwards_copy(*(oid*) BUNtloc(iter_bat,p), pre++,)@
+ } else
+ if (iter_bat->ttype == TYPE_oid && ctx_bat->ttype == TYPE_oid) {
+ @:ll_upwards_copy(*(oid*) BUNtloc(iter_bat,p), *(oid*)
BUNtloc(ctx_bat,r),)@
+ } else {
+ assert(0); /* should never happen */
+ }
min_iter = context[0].iter;
max_iter = context[i-1].iter;
}
niters += max_iter - min_iter; /* the size of the per-iter lookup
arrays */
}
- if (!(BATtordered(ctx_bat)&1)) { /* if needed, sort context set on pre-s */
- GDKqsort(context, NULL, m, sizeof(duple), TYPE_oid, sizeof(oid));
- }
-
/* prune is a temporary array of duples, one duple per iter
* - duple.pre contains the pre-bound for pruning the previous node
* - duple.iter is (mis)used to contain the position in context[] of
Index: pf_support.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/pf_support.mx,v
retrieving revision 1.263
retrieving revision 1.264
diff -u -d -r1.263 -r1.264
--- pf_support.mx 10 Aug 2007 00:26:43 -0000 1.263
+++ pf_support.mx 13 Aug 2007 12:49:51 -0000 1.264
@@ -1608,14 +1608,16 @@
@
@= upwards
-PROC @1(BAT[void,oid] iter, BAT[void,oid] ctx, oid cont, BAT[void,bat] ws, int
order) : BAT[void,bat]
+PROC @1(BAT[void,oid] iter, BAT[void,oid] item, oid cont, BAT[void,bat] ws,
int order) : BAT[void,bat]
{
var pre_sizes := ws.fetch(PRE_SIZE).fetch(cont);
var pre_levels := ws.fetch(PRE_LEVEL).fetch(cont);
- # If ctx is not sorted on tail, [EMAIL PROTECTED] will internally sort ctx
and re-order iter accordingly.
+ iter := iter.chk_order();
+ item := item.chk_order();
+ @:pre_sort_input@
- var res := [EMAIL PROTECTED](iter.chk_order(), ctx.chk_order(), pre_sizes,
pre_levels);
+ var res := [EMAIL PROTECTED](iter, item, pre_sizes, pre_levels);
var result := new(void,bat,2).seqbase([EMAIL
PROTECTED]).append(hmark(res,[EMAIL PROTECTED])).append(tmark(res,[EMAIL
PROTECTED])).access(BAT_READ);
@:post_sort_output@
@@ -1641,7 +1643,7 @@
item := item.chk_order();
@:pre_sort_input@
- var res := ll_following_sibling(iter.chk_order(), item.chk_order(),
pre_sizes, pre_levels, pre_kinds, kind_test);
+ var res := ll_following_sibling(iter, item, pre_sizes, pre_levels,
pre_kinds, kind_test);
var result := new(void,bat,2).seqbase([EMAIL
PROTECTED]).append(hmark(res,[EMAIL PROTECTED])).append(tmark(res,[EMAIL
PROTECTED])).access(BAT_READ);
@:post_sort_output@
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins