Changeset: d7d547aa52c8 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d7d547aa52c8
Modified Files:
        monetdb5/optimizer/opt_xid.c
Branch: xid
Log Message:

Simplifying the optimizer code.

Still tpch 06 fails


diffs (85 lines):

diff --git a/monetdb5/optimizer/opt_xid.c b/monetdb5/optimizer/opt_xid.c
--- a/monetdb5/optimizer/opt_xid.c
+++ b/monetdb5/optimizer/opt_xid.c
@@ -22,7 +22,7 @@
 /*
  * Inject OID list compressions, to be used after garbagecontrol
  */
-#define MIN_DISTANCE 10
+#define MIN_DISTANCE 0
 
 int 
 OPTxidImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
@@ -72,34 +72,24 @@ OPTxidImplementation(Client cntxt, MalBl
                 */
                cnt = 0;
                for ( j =p->retc; j< p->argc; j++)
-               if (compressed[getArg(p,j)] ) cnt++;
-               /* at least one decompress needed */
-               if ( cnt ){
-                       cnt = 0;
-                       for ( j =p->retc; j< p->argc; j++)
-                       if ( isaBatType(getVarType(mb,getArg(p,j))) ) cnt++;
-               }
+               if (compressed[getArg(p,j)] || 
isaBatType(getVarType(mb,getArg(p,j))) ) cnt++;
 
                /* at least two BATs used, synchronise their access */
                if ( cnt >= 2 ){
-                       qs = newStmt(mb,languageRef,waitRef);
+                       qs = newStmt(mb, languageRef, waitRef);
                        qs->retc = qs->argc = 0;
                        for ( j =p->retc; j< p->argc; j++)
                        if ( isaBatType(getVarType(mb, getArg(p,j))) ) {
                                v = newTmpVariable(mb, getVarType(mb, 
getArg(p,j)));
                                assert(v < 2* mb->vtop);
                                qs= pushReturn(mb, qs, v);
-                               if ( compressed[getArg(p,j)] ) {
+                               if ( compressed[getArg(p,j)] ){
                                        qs= pushArgument(mb, qs, 
compressed[getArg(p,j)]);
                                        /* actually decompress when there is 
not a direct flow into the instruction */
-                                       if ( compressed[getArg(p,j)] && i - 
def[getArg(p,j)] > MIN_DISTANCE ){
-                                               mnstr_printf(GDKout,"#var %d 
def use %d\n",getArg(p,j), i - def[getArg(p,j)]);
-                                               q = 
newStmt(mb,"xid","decompress");
-                                               q= pushArgument(mb, q, 
compressed[getArg(p,j)]);
-                                               setVarType(mb, getArg(q,0), 
getVarType(mb, getArg(p,j)));
-                                               getArg(p,j) = getArg(q,0);
-                                       } else
-                                               getArg(p,j) = v;
+                                       q = newStmt(mb,"xid","decompress");
+                                       q= pushArgument(mb, q, v);
+                                       setVarType(mb, getArg(q,0), 
getVarType(mb, getArg(p,j)));
+                                       getArg(p,j) = getArg(q,0);
                                 } else {
                                        qs= pushArgument(mb, qs, getArg(p,j));
                                        getArg(p,j) = v;
@@ -108,8 +98,7 @@ OPTxidImplementation(Client cntxt, MalBl
                } else
                        for ( j =p->retc; j< p->argc; j++)
                        /* actually decompress when there is not a direct flow 
into the instruction */
-                       if ( compressed[getArg(p,j)] && i - def[getArg(p,j)] > 
MIN_DISTANCE ){
-                               mnstr_printf(GDKout,"#var %d def use 
%d\n",getArg(p,j), i - def[getArg(p,j)]);
+                       if ( compressed[getArg(p,j)] ){
                                q = newStmt(mb,"xid","decompress");
                                q= pushArgument(mb,q, compressed[getArg(p,j)]);
                                setVarType(mb, getArg(q,0), getVarType(mb, 
getArg(p,j)));
@@ -122,18 +111,18 @@ OPTxidImplementation(Client cntxt, MalBl
                for (j = 0 ; j < p->retc ; j++) {
                        type= getVarType(mb,getArg(p,j));
                        if ((getTailType(type) == TYPE_oid || getHeadType(type) 
== TYPE_oid) && compressed[getArg(p,j)] == 0) {
-                               //mnstr_printf(GDKout,"#got candidate %d head 
%d tail %d\n",getArg(p,j), getHeadType(getVarType(mb,getArg(p,j))),  
getTailType(getVarType(mb,getArg(p,j))));
                                /* don't compress if you immediately eat the 
result */
                                if (getEndLifespan(span, getArg(p,j)) >= i + 
MIN_DISTANCE) {
                                        q = newStmt(mb,"xid","compress");
                                        q= pushArgument(mb,q, getArg(p,j));
                                        compressed [getArg(p,j)] = getArg(q,0);
                                        def[getArg(p,j)] = i;
-                               mnstr_printf(GDKout,"#var %d def 
%d\n",getArg(p,j), i);
+                                       mnstr_printf(GDKout,"#var %d def 
%d\n",getArg(p,j), i);
                                }
                        }
                }
        }
+       printFunction(cntxt->fdout,mb,0,LIST_MAL_ALL);
        DEBUGoptimizers
                mnstr_printf(cntxt->fdout,"#opt_xid: %d statements removed\n", 
actions);
        GDKfree(old);
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to