Changeset: 77bed127f56d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=77bed127f56d
Modified Files:
        monetdb5/optimizer/opt_commonTerms.c
Branch: default
Log Message:

Indent + send debug output to stderr.


diffs (112 lines):

diff --git a/monetdb5/optimizer/opt_commonTerms.c 
b/monetdb5/optimizer/opt_commonTerms.c
--- a/monetdb5/optimizer/opt_commonTerms.c
+++ b/monetdb5/optimizer/opt_commonTerms.c
@@ -58,8 +58,8 @@ OPTcommonTermsImplementation(Client cntx
                duplicate = 0;
 
                for ( k = 0; k < p->argc; k++)
-               if ( alias[getArg(p,k)] )
-                       getArg(p,k) = alias[getArg(p,k)];
+                       if ( alias[getArg(p,k)] )
+                               getArg(p,k) = alias[getArg(p,k)];
                        
                if (p->token == ENDsymbol){
                        pushInstruction(mb,p);
@@ -84,7 +84,7 @@ OPTcommonTermsImplementation(Client cntx
                barrier |= getFunctionId(p) == assertRef;
                if (barrier || p->token == NOOPsymbol || p->token == 
ASSIGNsymbol) {
 #ifdef DEBUG_OPT_COMMONTERMS_MORE
-                               fprintf(stderr, "#COMMON SKIPPED[%d] %d 
%d\n",i, barrier, p->retc == p->argc);
+                       fprintf(stderr, "#COMMON SKIPPED[%d] %d %d\n",i, 
barrier, p->retc == p->argc);
 #endif
                        pushInstruction(mb,p);
                        continue;
@@ -93,7 +93,7 @@ OPTcommonTermsImplementation(Client cntx
                /* the same holds for function calls without an argument, it is 
unclear where the results comes from (e.g. clock()) */
                if ( mayhaveSideEffects(cntxt, mb, p,TRUE) || p->argc == 
p->retc){
 #ifdef DEBUG_OPT_COMMONTERMS_MORE
-                               fprintf(stderr, "#COMMON SKIPPED[%d] 
side-effect %d\n", i, p->retc == p->argc);
+                       fprintf(stderr, "#COMMON SKIPPED[%d] side-effect %d\n", 
i, p->retc == p->argc);
 #endif
                        pushInstruction(mb,p);
                        continue;
@@ -101,25 +101,25 @@ OPTcommonTermsImplementation(Client cntx
 
                /* from here we have a candidate to look for a match */
 #ifdef DEBUG_OPT_COMMONTERMS_MORE
-                       fprintf(stderr,"#CANDIDATE[%d] look at list[%d]=>%d\n",
+               fprintf(stderr,"#CANDIDATE[%d] look at list[%d]=>%d\n",
                                i, HASHinstruction(p), 
hash[HASHinstruction(p)]);
-                       fprintInstruction(stderr, mb, 0, p, LIST_MAL_ALL);
+               fprintInstruction(stderr, mb, 0, p, LIST_MAL_ALL);
 #endif
                /* Look into the hash structure for matching instructions */
                for (j = hash[HASHinstruction(p)];  j > 0  ; j = list[j]) 
                        if ( (q= getInstrPtr(mb,j)) && getFunctionId(q) == 
getFunctionId(p) && getModuleId(q) == getModuleId(p)  ){
 #ifdef DEBUG_OPT_COMMONTERMS_MORE
-                       fprintf(stderr,"#CANDIDATE[%d->%d] %d %d", j, list[j], 
-                               hasSameSignature(mb, p, q, p->retc), 
-                               hasSameArguments(mb, p, q));
-                               mnstr_printf(cntxt->fdout," :%d %d %d=%d %d %d 
%d ", 
-                                       q->token != ASSIGNsymbol ,
-                                       list[getArg(q,q->argc-1)],i,
-                                       !hasCommonResults(p, q), 
-                                       !isUnsafeFunction(q),
-                                       !isUpdateInstruction(q),
-                                       isLinearFlow(q));
-                               printInstruction(cntxt->fdout, mb, 0, q, 
LIST_MAL_ALL);
+                               fprintf(stderr,"#CANDIDATE[%d->%d] %d %d :%d %d 
%d=%d %d %d %d ",
+                                               j, list[j], 
+                                               hasSameSignature(mb, p, q, 
p->retc), 
+                                               hasSameArguments(mb, p, q),
+                                               q->token != ASSIGNsymbol ,
+                                               list[getArg(q,q->argc-1)],i,
+                                               !hasCommonResults(p, q), 
+                                               !isUnsafeFunction(q),
+                                               !isUpdateInstruction(q),
+                                               isLinearFlow(q));
+                               fprintInstruction(stderr, mb, 0, q, 
LIST_MAL_ALL);
 #endif
                                /*
                                 * Simple assignments are not replaced either. 
They should be
@@ -127,13 +127,13 @@ OPTcommonTermsImplementation(Client cntx
                                 * be assigned their value before instruction p.
                                 */
                                if ( hasSameArguments(mb, p, q) && 
-                                       hasSameSignature(mb, p, q, p->retc) && 
-                                       !hasCommonResults(p, q) && 
-                                       !isUnsafeFunction(q) && 
-                                       !isUpdateInstruction(q) &&
-                                       isLinearFlow(q) 
-                                  ) {
-                                               if (safetyBarrier(p, q) ){
+                                        hasSameSignature(mb, p, q, p->retc) && 
+                                        !hasCommonResults(p, q) && 
+                                        !isUnsafeFunction(q) && 
+                                        !isUpdateInstruction(q) &&
+                                        isLinearFlow(q) 
+                                       ) {
+                                       if (safetyBarrier(p, q) ){
 #ifdef DEBUG_OPT_COMMONTERMS_MORE
                                                fprintf(stderr,"#safetybarrier 
reached\n");
 #endif
@@ -167,7 +167,7 @@ OPTcommonTermsImplementation(Client cntx
                /* update the hash structure with another candidate for re-use 
*/
 #ifdef DEBUG_OPT_COMMONTERMS_MORE
                fprintf(stderr,"#UPDATE HASH[%d] look at  arg %d hash %d list 
%d\n",
-                       i, getArg(p,p->argc-1), HASHinstruction(p), 
hash[HASHinstruction(p)]);
+                               i, getArg(p,p->argc-1), HASHinstruction(p), 
hash[HASHinstruction(p)]);
                fprintInstruction(stderr, mb, 0, p, LIST_MAL_ALL);
 #endif
                list[i] = hash[HASHinstruction(p)];
@@ -189,8 +189,9 @@ OPTcommonTermsImplementation(Client cntx
     newComment(mb,buf);
        if( actions >= 0)
                addtoMalBlkHistory(mb);
+       fprintFunction(stderr, mb, stk, LIST_MAL_ALL);
 
-wrapup:
+  wrapup:
        if(alias) GDKfree(alias);
        if(list) GDKfree(list);
        if(hash) GDKfree(hash);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to