Changeset: 362b2da619ba for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=362b2da619ba Removed Files: monetdb5/optimizer/opt_qep.c monetdb5/optimizer/opt_qep.h Modified Files: clients/Tests/MAL-signatures.stable.out clients/Tests/MAL-signatures.stable.out.int128 clients/Tests/exports.stable.out monetdb5/optimizer/Makefile.ag monetdb5/optimizer/opt_wrapper.c monetdb5/optimizer/optimizer.mal Branch: Jun2016 Log Message:
Removed opt_qep.[ch] (OPTdumpQEPImplementation) since it's deprecated and unused (and leaky). diffs (truncated from 326 to 300 lines): diff --git a/clients/Tests/MAL-signatures.stable.out b/clients/Tests/MAL-signatures.stable.out --- a/clients/Tests/MAL-signatures.stable.out +++ b/clients/Tests/MAL-signatures.stable.out @@ -39892,12 +39892,6 @@ comment Handle simple type coercions pattern optimizer.coercions():str address OPTwrapper; -pattern optimizer.dumpQEP(mod:str,fcn:str):str -address OPTwrapper; -comment Produce an indented tree visualisation - -pattern optimizer.dumpQEP():void -address OPTwrapper; pattern optimizer.derivePath(mod:str,fcn:str):str address OPTwrapper; comment Join path constructor diff --git a/clients/Tests/MAL-signatures.stable.out.int128 b/clients/Tests/MAL-signatures.stable.out.int128 --- a/clients/Tests/MAL-signatures.stable.out.int128 +++ b/clients/Tests/MAL-signatures.stable.out.int128 @@ -50756,12 +50756,6 @@ comment Handle simple type coercions pattern optimizer.coercions():str address OPTwrapper; -pattern optimizer.dumpQEP(mod:str,fcn:str):str -address OPTwrapper; -comment Produce an indented tree visualisation - -pattern optimizer.dumpQEP():void -address OPTwrapper; pattern optimizer.derivePath(mod:str,fcn:str):str address OPTwrapper; comment Join path constructor diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -1533,7 +1533,6 @@ int OPTconstantsImplementation(Client cn int OPTcostModelImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); int OPTdataflowImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p); int OPTdeadcodeImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); -int OPTdumpQEPImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p); int OPTevaluateImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); int OPTfactorizeImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); int OPTgarbageCollectorImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); diff --git a/monetdb5/optimizer/Makefile.ag b/monetdb5/optimizer/Makefile.ag --- a/monetdb5/optimizer/Makefile.ag +++ b/monetdb5/optimizer/Makefile.ag @@ -41,7 +41,6 @@ lib_optimizer = { opt_multiplex.c opt_multiplex.h \ opt_pipes.c opt_pipes.h \ opt_prelude.c opt_prelude.h \ - opt_qep.c opt_qep.h \ opt_recycler.c opt_recycler.h \ opt_reduce.c opt_reduce.h \ opt_remap.c opt_remap.h \ diff --git a/monetdb5/optimizer/opt_qep.c b/monetdb5/optimizer/opt_qep.c deleted file mode 100644 --- a/monetdb5/optimizer/opt_qep.c +++ /dev/null @@ -1,194 +0,0 @@ -/* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * Copyright 1997 - July 2008 CWI, August 2008 - 2016 MonetDB B.V. - */ - -/* (c) M Kersten - * This optimizer is deprecated and leaks - */ -#include "monetdb_config.h" -#include "opt_qep.h" - -static QEP -QEPnew(int p, int c){ - QEP qep; - qep = (QEP) GDKmalloc( sizeof(struct QEPrecord)); - if (qep == NULL) - return NULL; - qep->mb= NULL; - qep->p = NULL; - qep->plimit = p; - if( p ) { - qep->parents = (QEP*) GDKzalloc( sizeof(QEP) * p); - if( qep->parents == NULL){ - GDKfree(qep); - return NULL; - } - } - qep->climit = c; - if( c){ - qep->children = (QEP *) GDKzalloc( sizeof(QEP) * c); - if( qep->children == NULL){ - GDKfree(qep); - return NULL; - } - } - return qep; -} - -static QEP -QEPnewNode(MalBlkPtr mb,InstrPtr p){ - QEP q; - q= QEPnew(p->retc,p->argc-p->retc+1); - if( q){ - q->mb= mb; - q->p = p; - } - return q; -} - -static QEP -QEPexpandChildren(QEP qep, int extra){ - int i; - /*extend node */ - qep->children = (QEP*) GDKrealloc( (char*) qep->children, sizeof(QEP) * (qep->climit + extra)); - if( qep->children == NULL) - return NULL; - for(i=qep->climit;i <qep->climit + extra; i++) - qep->children[i]=0; - qep->climit = qep->climit + extra; - return qep; -} - -/* Extract a child from the qep, to be inserted somewhere else */ -static QEP -QEPappend(QEP qep, QEP child){ - int i; - for( i=0; i< qep->climit-1; i++) - if( qep->children[i] == NULL) - break; - if(qep->climit== 0 || qep->children[i]!= NULL ) - qep= QEPexpandChildren(qep,MAXCHILD); - qep->children[i]= child; - if( child) - child->parents[0]= qep; - return qep; -} -/* - * The core of the work is focused on building the tree using a flow analysis. - * Building the tree means that we should not allow the same variable can not be used twice. -*/ -#define LEAFNODE 2 -#define TOPNODE 3 - -static QEP -QEPbuild(MalBlkPtr mb){ - QEP qroot= NULL, q= NULL, *vq; - InstrPtr p; - int i, j, k, *status; - - vq= (QEP*) GDKmalloc( mb->vtop * sizeof(QEP)); - if (vq == NULL) - return NULL; - status= (int*) GDKmalloc( mb->vtop * sizeof(int)); - if (status == NULL){ - GDKfree(vq); - return NULL; - } - for(i=0; i<mb->vtop; i++) { - status[i]= 0; - vq[i] = 0; - } - - for(i=1; i< mb->stop-1; i++){ - p= getInstrPtr(mb,i); - q= QEPnewNode(mb,p); - if( q == NULL) - continue; - for( k=p->retc; k<p->argc; k++) - if( ! isVarConstant(mb, getArg(p,k)) ){ - status[getArg(p,k)]= LEAFNODE; - if( vq[getArg(p,k)] ) - QEPappend(q, vq[getArg(p,k)]); - } - for( k=0; k<p->retc; k++){ - if( vq[getArg(p,k)] == 0) - vq[getArg(p,k)] = q; - status[getArg(p,k)]= TOPNODE; - } - - } -/* We may end up with multiple variables not yet bound to a QEP. */ - - qroot= QEPnew(MAXPARENT,mb->stop); - if( qroot) - for(i=1; i< mb->stop-1; i++){ - p= getInstrPtr(mb,i); - - k=0; - if( p->barrier){ - k++; - q= QEPnewNode(mb,p); - } else - for( j=0; j< p->retc; j++) - if( status[getArg(p,j)] == TOPNODE){ - q= vq[getArg(p,j)]; - k++; - break; - } - if(q && k) - QEPappend(qroot,q); - } - GDKfree(vq); - GDKfree(status); - return qroot; -} -/* - * It may be handy to dump the graph for inspection - * or to prepare for the dot program. -*/ -static void -QEPdump(stream *f, QEP qep, int indent){ - int i,inc = 0; - str s; - if( qep->p){ - for(i=0;i<indent; i++) mnstr_printf(f," "); - s= instruction2str(qep->mb, 0,qep->p, LIST_MAL_DEBUG ); - mnstr_printf(f,"%s\n",s); - GDKfree(s); - inc = 4; - } - for(i=0; i< qep->climit; i++) - if( qep->children[i]) - QEPdump(f,qep->children[i], indent+ inc); -} - -static void -QEPfree(QEP qep) -{ - int i; - if( qep == 0) - return; - for(i=0; i< qep->climit; i++) - if( qep->children[i]) - QEPfree(qep->children[i]); - GDKfree(qep); -} - -int -OPTdumpQEPImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p){ - QEP qep; - (void) cntxt; - (void) stk; - (void) p; - - qep= QEPbuild(mb); - if(qep == NULL) - return 0; - QEPdump(cntxt->fdout,qep,0); - if(0)QEPfree(qep); // leaves garbage - return 1; -} diff --git a/monetdb5/optimizer/opt_qep.h b/monetdb5/optimizer/opt_qep.h deleted file mode 100644 --- a/monetdb5/optimizer/opt_qep.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * Copyright 1997 - July 2008 CWI, August 2008 - 2016 MonetDB B.V. - */ - -#ifndef _OPT_QEP_ -#define _OPT_QEP_ -#include "mal.h" -#include "mal_interpreter.h" -#include "opt_prelude.h" -#include "opt_support.h" - -typedef struct QEPrecord { - MalBlkPtr mb; - InstrPtr p; - int plimit, climit; /* capacities */ - struct QEPrecord **parents; /* at least one link to parent */ - struct QEPrecord **children; -} *QEP; - -#define MAXPARENT 4 -#define MAXCHILD 8 - -opt_export int OPTdumpQEPImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p); - -#define OPTDEBUGdumpQEP if ( optDebug & ((lng) 1 <<DEBUG_OPT_QEP) ) - -#endif /* _OPT_QEP_ */ diff --git a/monetdb5/optimizer/opt_wrapper.c b/monetdb5/optimizer/opt_wrapper.c --- a/monetdb5/optimizer/opt_wrapper.c +++ b/monetdb5/optimizer/opt_wrapper.c @@ -47,7 +47,6 @@ #include "opt_multiplex.h" #include "opt_profiler.h" #include "opt_pushselect.h" -#include "opt_qep.h" #include "opt_querylog.h" #include "opt_recycler.h" #include "opt_reduce.h" _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list