Changeset: 5abe49eee7a9 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5abe49eee7a9
Modified Files:
clients/Tests/exports.stable.out
monetdb5/mal/Makefile.ag
monetdb5/mal/mal.h
monetdb5/mal/mal_debugger.c
monetdb5/mal/mal_instruction.c
monetdb5/mal/mal_instruction.h
monetdb5/mal/mal_session.c
monetdb5/modules/mal/batExtensions.c
monetdb5/modules/mal/inspect.c
monetdb5/optimizer/opt_macro.c
monetdb5/optimizer/opt_wrapper.c
sql/backends/monet5/sql.c
Branch: default
Log Message:
Drop remainder of property management
The generic property handling infrastructure is gone.
It was too generic and used only in a few distinct places.
diffs (truncated from 642 to 300 lines):
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
@@ -2032,7 +2032,6 @@ str constraintsRef;
str convertConstant(malType type, ValPtr vr);
InstrPtr copyInstruction(InstrPtr p);
MalBlkPtr copyMalBlk(MalBlkPtr mb);
-void copyProperties(MalBlkPtr mb, int src, int dst);
str copyRef;
int copyVariable(MalBlkPtr dst, VarPtr v);
str copy_fromRef;
@@ -2357,7 +2356,6 @@ MalBlkPtr newMalBlk(int maxvars, int max
int newMalBlkStmt(MalBlkPtr mb, int maxstmts);
Module newModule(Module scope, str nme);
Plant newPlant(MalBlkPtr mb);
-int newProperty(MalBlkPtr mb);
InstrPtr newRaiseStmt(MalBlkPtr mb, str nme);
str newRef;
InstrPtr newReturnStmt(MalBlkPtr mb);
@@ -2598,9 +2596,6 @@ void updateFootPrint(MalBlkPtr mb, MalSt
str updateRef;
void updateScenario(str scen, str nme, MALfcn fcn);
str userRef;
-VarPtr varGetProp(MalBlkPtr mb, int var, int prop);
-str varGetPropStr(MalBlkPtr mb, int var);
-void varSetProp(MalBlkPtr mb, int var, int prop, int op, ValPtr cst);
str vectorRef;
str zero_or_oneRef;
diff --git a/monetdb5/mal/Makefile.ag b/monetdb5/mal/Makefile.ag
--- a/monetdb5/mal/Makefile.ag
+++ b/monetdb5/mal/Makefile.ag
@@ -39,7 +39,6 @@ lib_mal = {
mal_namespace.c mal_namespace.h \
mal_parser.c mal_parser.h \
mal_profiler.c mal_profiler.h \
- mal_properties.c mal_properties.h \
mal_readline.c mal_readline.h \
mal_recycle.c mal_recycle.h \
mal_resolve.c mal_resolve.h \
@@ -61,7 +60,6 @@ headers_h = {
mal_exception.h \
mal_instruction.h \
mal_namespace.h \
- mal_properties.h \
mal_stack.h \
mal_type.h
}
diff --git a/monetdb5/mal/mal.h b/monetdb5/mal/mal.h
--- a/monetdb5/mal/mal.h
+++ b/monetdb5/mal/mal.h
@@ -133,12 +133,6 @@ mal_export void mal_exit(void);
typedef int malType;
typedef str (*MALfcn) ();
-typedef struct MalProp {
- bte idx;
- bte op;
- int var;
-} *MalPropPtr, MalProp;
-
typedef struct SYMDEF {
struct SYMDEF *peer; /* where to look next */
struct SYMDEF *skip; /* skip to next different symbol */
@@ -156,8 +150,6 @@ typedef struct VARRECORD {
int eolife; /* pc index when it
should be garbage collected */
int worker; /* tread id of last
worker producing it */
BUN rowcnt; /* estimated row count*/
- int propc, maxprop; /* proc count and max number of
properties */
- int prps[FLEXIBLE_ARRAY_MEMBER]; /* property array */
} *VarPtr, VarRecord;
/* For performance analysis we keep track of the number of calls and
@@ -206,7 +198,6 @@ typedef struct MALBLK {
InstrPtr *stmt; /* Instruction location */
int ptop; /* next free slot */
int psize; /* byte size of arena */
- MalProp *prps; /* property table */
int inlineProp; /* inline property */
int unsafeProp; /* unsafe property */
diff --git a/monetdb5/mal/mal_debugger.c b/monetdb5/mal/mal_debugger.c
--- a/monetdb5/mal/mal_debugger.c
+++ b/monetdb5/mal/mal_debugger.c
@@ -1286,13 +1286,6 @@ printStackElm(stream *f, MalBlkPtr mb, V
if (getEndOfLife(mb, index))
mnstr_printf(f, " eolife=%d ", getEndOfLife(mb, index));
GDKfree(nme);
- if (n->propc) {
- nme = varGetPropStr(mb, index);
- if (nme) {
- mnstr_printf(f, "%s", nme);
- GDKfree(nme);
- }
- }
mnstr_printf(f, "\n");
GDKfree(nmeOnStk);
diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c
--- a/monetdb5/mal/mal_instruction.c
+++ b/monetdb5/mal/mal_instruction.c
@@ -125,7 +125,6 @@ newMalBlk(int maxvars, int maxstmts)
mb->inlineProp = 0;
mb->unsafeProp = 0;
mb->ptop = mb->psize = 0;
- mb->prps = NULL;
mb->replica = NULL;
mb->recycle = 0;
mb->recid = 0;
@@ -202,10 +201,6 @@ freeMalBlk(MalBlkPtr mb)
mb->stmt = 0;
GDKfree(mb->var);
mb->var = 0;
- if (mb->prps)
- GDKfree(mb->prps);
- mb->ptop = mb->psize = 0;
- mb->prps = NULL;
if (mb->history)
freeMalBlk(mb->history);
@@ -291,18 +286,6 @@ copyMalBlk(MalBlkPtr old)
mb->maxarg = old->maxarg;
mb->inlineProp = old->inlineProp;
mb->unsafeProp = old->unsafeProp;
-
- mb->ptop = mb->psize = 0;
- mb->prps = NULL;
- if (old->prps) {
- mb->prps = (MalProp *) GDKzalloc(old->psize * sizeof(MalProp));
- if( mb->prps == NULL)
- GDKerror("copyMAL block, allocation of property table
failed");
- mb->psize = old->psize;
- mb->ptop = old->ptop;
- for (i = 0; i < old->ptop && mb->prps; i++)
- mb->prps[i] = old->prps[i];
- }
return mb;
}
@@ -925,7 +908,7 @@ newVariable(MalBlkPtr mb, str name, malT
}
n = mb->vtop;
if (getVar(mb, n) == NULL){
- getVar(mb, n) = (VarPtr) GDKzalloc(offsetof(VarRecord, prps) +
MAXARG * sizeof(int));
+ getVar(mb, n) = (VarPtr) GDKzalloc(sizeof(VarRecord) );
if ( getVar(mb,n) == NULL) {
GDKerror("newVariable:" MAL_MALLOC_FAIL);
GDKfree(name);
@@ -933,8 +916,6 @@ newVariable(MalBlkPtr mb, str name, malT
}
}
mb->var[n]->name = name;
- mb->var[n]->propc = 0;
- mb->var[n]->maxprop = MAXARG;
setRowCnt(mb,n,0);
setVarType(mb, n, type);
@@ -1006,7 +987,7 @@ newTmpVariable(MalBlkPtr mb, malType typ
return -1;
n = mb->vtop;
if (getVar(mb, n) == NULL) {
- getVar(mb, n) = (VarPtr) GDKzalloc(offsetof(VarRecord, prps) +
MAXARG * sizeof(int));
+ getVar(mb, n) = (VarPtr) GDKzalloc(sizeof(VarRecord));
if (getVar(mb,n) == NULL){
GDKerror("newTmpVariable" MAL_MALLOC_FAIL);
return -1;
@@ -1014,8 +995,6 @@ newTmpVariable(MalBlkPtr mb, malType typ
}
getVarTmp(mb, n) = n;
setVarType(mb, n, type);
- mb->var[n]->propc = 0;
- mb->var[n]->maxprop = MAXARG;
mb->vtop++;
return n;
}
@@ -1054,39 +1033,13 @@ delVariable(MalBlkPtr mb, int varid)
}
}
-void
-copyProperties(MalBlkPtr mb, int src, int dst)
-{
- VarPtr w, v;
- int i;
-
- assert(src >=0 && src < mb->vtop);
- assert(dst >=0 && dst < mb->vtop);
- v = mb->var[src];
- w = mb->var[dst];
- if ( w->maxprop < v->maxprop){
- w = (VarPtr) GDKrealloc(w, offsetof(VarRecord, prps) + v->maxprop *
sizeof(int));
- if ( w == NULL){
- GDKerror("copyProperties" MAL_MALLOC_FAIL);
- return;
- }
- mb->var[dst] = w;
- w->maxprop = v->maxprop;
- }
- w->rowcnt = v->rowcnt;
- w->propc = v->propc;
- for ( i= 0; i< v->propc; i++)
- w->prps[i] = v->prps[i];
-}
int
copyVariable(MalBlkPtr dst, VarPtr v)
{
- int i;
VarPtr w;
- assert(v->propc <= v->maxprop);
- w = (VarPtr) GDKzalloc(offsetof(VarRecord, prps) + v->maxprop *
sizeof(int));
+ w = (VarPtr) GDKzalloc(sizeof(VarRecord));
if( w == NULL)
return -1;
w->name = v->name ? GDKstrdup(v->name) : 0;
@@ -1094,11 +1047,6 @@ copyVariable(MalBlkPtr dst, VarPtr v)
w->flags = v->flags;
w->tmpindex = v->tmpindex;
w->rowcnt = v->rowcnt;
- w->propc = v->propc;
- w->maxprop = v->maxprop;
- for (i = 0; i < v->propc; i++)
- w->prps[i] = v->prps[i];
-
VALcopy(&w->value, &v->value);
dst->var[dst->vtop] = w;
return 0;
@@ -1145,7 +1093,6 @@ clearVariable(MalBlkPtr mb, int varid)
v->flags = 0;
v->tmpindex = 0;
v->rowcnt = 0;
- v->propc = 0;
v->eolife = 0;
}
@@ -1215,12 +1162,6 @@ trimMalVariables_(MalBlkPtr mb, bit *use
for (j = 0; j < q->argc; j++)
getArg(q, j) = vars[getArg(q, j)];
}
- for (i = 0; i < mb->ptop; i++) {
- MalProp *p = mb->prps + i;
-
- if (p->var)
- p->var = vars[p->var];
- }
}
#ifdef DEBUG_REDUCE
mnstr_printf(GDKout, "After reduction \n");
@@ -1250,10 +1191,6 @@ trimMalVariables(MalBlkPtr mb, MalStkPtr
for (j = 0; j < q->argc; j++)
used[getArg(q, j)] = 1;
}
- for (i = 0; i < mb->ptop; i++) {
- if (mb->prps[i].var)
- used[mb->prps[i].var] = 1;
- }
trimMalVariables_(mb, used, stk);
GDKfree(used);
}
@@ -1829,154 +1766,3 @@ pushEndInstruction(MalBlkPtr mb)
pushInstruction(mb, p);
}
-int
-newProperty(MalBlkPtr mb)
-{
- if (mb->ptop >= mb->psize) {
- mb->psize += MAXVARS;
- mb->prps = (MalProp *) GDKrealloc(mb->prps, mb->psize *
sizeof(MalProp));
- if (mb->prps == NULL) {
- mb->errors++;
- return -1;
- }
- }
- return mb->ptop++;
-}
-
-void
-varSetProp(MalBlkPtr mb, int var, int prop, int op, ValPtr cst)
-{
- VarPtr v = getVar(mb, var), vnew;
- int i, propid = -1, reset = 0, size;
-
- for (i = 0; i < v->propc; i++) {
- MalProp *p = mb->prps + v->prps[i];
-
- if (p->idx == prop) {
- propid = v->prps[i];
- reset = 1;
- break;
- }
- }
- if (propid < 0 && (propid = newProperty(mb)) < 0) {
- GDKerror("varSetProp"MAL_MALLOC_FAIL);
- return;
- }
-
- mb->prps[propid].var = 0;
- if (cst != NULL) {
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list