Update of /cvsroot/monetdb/MonetDB5/src/mal
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5063

Modified Files:
        mal_instruction.mx mal_interpreter.mx mal_recycle.mx 
Log Message:
Use the proper MAL block when you debug instructions.
Check the version of the recycle before using it.
Make sure you first check for re-useable elements


Index: mal_recycle.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_recycle.mx,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- mal_recycle.mx      16 Mar 2008 20:59:02 -0000      1.52
+++ mal_recycle.mx      17 Mar 2008 07:02:29 -0000      1.53
@@ -64,7 +64,7 @@
 #include "mal_instruction.h"
 
 /* #define _DEBUG_RECYCLE_
-#define _DEBUG_RECYCLE_REUSE*/
+#define _DEBUG_RECYCLE_REUSE */
 @-
 We need some hard limits to not run out of datastructure
 spaces.
@@ -228,6 +228,9 @@
        int i;
 
        if( mb->version != recycleVersion) { 
+#ifdef _DEBUG_RECYCLE_
+               stream_printf(GDKout,"reshuffle the version admin\n");
+#endif
                mal_set_lock(recycleLock,"recycle");
                /* all re-used variables are dropped */
                for(i=0; i<mb->vtop; i++)               /* reinit recycle */
@@ -502,11 +505,21 @@
                            getVarConstant(recycleBlk, ridx).val.bval == 
s->stk[idx].val.bval)
                        {       
                                /* Time to check for the inclusion constraint */
-                               int leftbound = VALcmp( &s->stk[getArg(p,2)], 
-                                                               
&getVar(recycleBlk,getArg(q,2))->value) >=0;
-                               int rightbound = p->argc == 3 || 
-                                               VALcmp( &s->stk[getArg(p,3)], 
-                                                               
&getVar(recycleBlk,getArg(q,3))->value) <=0;
+                               int leftbound, rightbound;
+                               if( p->argc ==3 &&
+                                       VALcmp( &s->stk[getArg(p,2)], 
+                                                               
&getVar(recycleBlk,getArg(q,2))->value) ==0){
+#ifdef _DEBUG_RECYCLE_REUSE
+                                       stream_printf(GDKout,"RECYCLEreuse 
exact found\n");
+                                       printInstruction(GDKout, recycleBlk, q, 
LIST_MAL_ALL);
+#endif
+                                       goto foundmatch;
+                               } 
+                               leftbound= VALcmp( &s->stk[getArg(p,2)], 
+                                                       
&getVar(recycleBlk,getArg(q,2))->value) >=0;
+                               rightbound = p->argc == 3 || 
+                                       VALcmp( &s->stk[getArg(p,3)], 
+                                                       
&getVar(recycleBlk,getArg(q,3))->value) <=0;
 
                                if (p->argc == 6){
                                                /* inclusion bounds */
@@ -546,11 +559,12 @@
                        }
                case REUSE_EXACT:
                        /* 2: exact covering */
-                       for (j = p->retc; j < p->argc; j++){
+                       for (j = p->retc; j < p->argc; j++)
                                if ( VALcmp(&s->stk[getArg(p,j)], 
&getVarConstant(recycleBlk,getArg(q,j))))
                                        goto notfound;
-                       }
+                       
                        /* found an exact match */
+               foundmatch:
                        /* get the results on the stack */
                        for( j=0; j<q->retc; j++){
                                VALcopy(&s->stk[getArg(p,j)],
@@ -565,7 +579,7 @@
                        notfound: 
 #ifdef _DEBUG_RECYCLE_REUSE
        stream_printf(GDKout,"RECYCLEreuse exact failed\n");
-       printInstruction(GDKout, mb, q, LIST_MAL_ALL);
+       printInstruction(GDKout, recycleBlk, q, LIST_MAL_ALL);
 #endif
                                continue;
                }
@@ -578,13 +592,20 @@
                i= getPC(mb,p);
 #ifdef _DEBUG_RECYCLE_REUSE
        stream_printf(GDKout,"RECYCLEreuse subselect %d\n",pc);
+       stream_printf(GDKout,">>>");
+       printInstruction(GDKout, recycleBlk, getInstrPtr(recycleBlk,pc), 
LIST_MAL_ALL);
+
+       stream_printf(GDKout,">>>");
+       printTraceCall(GDKout, mb, s,i, LIST_MAL_ALL);
 #endif
                s->stk[getArg(p,1)].val.bval = bid;
                BBPincref(bid, TRUE);
                /* make sure the garbage collector is not called */
                j=s->keepAlive ;
                s->keepAlive= TRUE;
+               p->recycle= FALSE;
                (void) reenterMAL(MCgetClient(),mb,i,i+1,s,0,0);
+               p->recycle= TRUE;
                /* RECYCLEexit(mb, s, p); */
                /* restore the situation */
                s->keepAlive= j;
@@ -620,6 +641,8 @@
        int i, cnt=0;
        ValPtr lhs,rhs;
 
+       RECYCLEversion(mb);
+
        for(i=0;i< p->retc; i++) {
                if (isVarKept(mb, getArg(p,i)) && isVarRecycled(mb, 
getArg(p,i)) ){
                        cnt++;
@@ -663,6 +686,7 @@
 #ifdef _DEBUG_RECYCLE_
        stream_printf(GDKout,"RECYCLEexit policy %d \n",retainPolicy);
 #endif
+       RECYCLEversion(mb);
        clk= GDKusec()-stk->clk;
 
        while ((recycleMemory && recyclerUsedMemory + wr > recycleMemory))

Index: mal_interpreter.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_interpreter.mx,v
retrieving revision 1.220
retrieving revision 1.221
diff -u -d -r1.220 -r1.221
--- mal_interpreter.mx  14 Mar 2008 07:55:37 -0000      1.220
+++ mal_interpreter.mx  17 Mar 2008 07:02:29 -0000      1.221
@@ -1469,9 +1469,9 @@
 The recycler works for any variable and relies on policy functions
 registered.
 @= MALrecycleStart
-       if( !pci->recycle  || !mb->version  || !RECYCLEentry(mb,stk,pci) )
+       if( !mb->version  || !RECYCLEentry(mb,stk,pci) )
 @= MALrecycleExit
-       if( pci->recycle && mb->version )
+       if( pci->recycle )
                RECYCLEexit(mb,stk,pci);
 @}
 @-

Index: mal_instruction.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_instruction.mx,v
retrieving revision 1.317
retrieving revision 1.318
diff -u -d -r1.317 -r1.318
--- mal_instruction.mx  16 Mar 2008 15:08:01 -0000      1.317
+++ mal_instruction.mx  17 Mar 2008 07:02:29 -0000      1.318
@@ -2478,6 +2478,7 @@
        int low, high;
        char nmebuf[PATHLENGTH];
        str pstring = 0;
+       char *tnme;
 
        len = 64*1024;
        s = GDKmalloc(len);
@@ -2674,7 +2675,7 @@
                           !isaBatType(getArgType(mb, p, i)) &&
                          (isVarUDFtype(mb, getArg(p, i)) ||
                           ATOMcmp(getArgGDKType(mb,p,i), 
ATOMnilptr(getArgType(mb,p,i)), VALptr(&getVar(mb, getArg(p, i))->value) ) == 
0))) {
-                       char *tnme = getTypeName(getArgType(mb, p, i));
+                       tnme = getTypeName(getArgType(mb, p, i));
 
                        sprintf(t, ":%s", tnme);
                        GDKfree(tnme);


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to