Changeset: c8c042d32353 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c8c042d32353
Modified Files:
monetdb5/mal/mal_atom.mx
monetdb5/mal/mal_box.mx
monetdb5/mal/mal_builder.mx
monetdb5/mal/mal_debugger.mx
monetdb5/mal/mal_errors.mx
monetdb5/mal/mal_exception.mx
monetdb5/mal/mal_factory.mx
monetdb5/mal/mal_function.mx
monetdb5/mal/mal_instruction.mx
monetdb5/mal/mal_interpreter.mx
monetdb5/mal/mal_module.mx
monetdb5/mal/mal_parser.mx
monetdb5/mal/mal_profiler.mx
monetdb5/mal/mal_recycle.mx
monetdb5/mal/mal_resolve.mx
monetdb5/mal/mal_session.mx
monetdb5/mal/mal_type.mx
monetdb5/mal/mal_utils.mx
monetdb5/optimizer/opt_compression.mx
monetdb5/optimizer/opt_datacell.mx
monetdb5/optimizer/opt_datacyclotron.mx
monetdb5/optimizer/opt_dictionary.mx
monetdb5/optimizer/opt_evaluate.mx
monetdb5/optimizer/opt_macro.mx
monetdb5/optimizer/opt_mitosis.mx
monetdb5/optimizer/opt_multiplex.mx
monetdb5/optimizer/opt_octopus.mx
monetdb5/optimizer/opt_partitions.mx
monetdb5/optimizer/opt_recycler.mx
monetdb5/optimizer/opt_remoteQueries.mx
monetdb5/optimizer/opt_tarantula.mx
Branch: headless
Log Message:
pass over mal_instruction
Added a list of constants to speed up search duplicates.
The consequences of mal_type changes have been applied
as far as they caused compilation errors.
It is not expected to work.
diffs (truncated from 3379 to 300 lines):
diff --git a/monetdb5/mal/mal_atom.mx b/monetdb5/mal/mal_atom.mx
--- a/monetdb5/mal/mal_atom.mx
+++ b/monetdb5/mal/mal_atom.mx
@@ -116,6 +116,7 @@
return 1;
@c
#include "monetdb_config.h"
+#include "mal_utils.h"
#include "mal_atom.h"
#include "mal_namespace.h"
#include "mal_exception.h"
diff --git a/monetdb5/mal/mal_box.mx b/monetdb5/mal/mal_box.mx
--- a/monetdb5/mal/mal_box.mx
+++ b/monetdb5/mal/mal_box.mx
@@ -246,7 +246,7 @@
obj= (Box) GDKzalloc(sizeof(BoxRecord));
obj->name= GDKstrdup(name);
obj->sym= newMalBlk(MAXVARS,STMT_INCREMENT);
- obj->val = newStack(MAXVARS);
+ newStack(obj->val,MAXVARS);
if ( obj->val == NULL)
showException(MAL,"box.new", MAL_MALLOC_FAIL);
MT_lock_init(&obj->lock,"M5_box_lock");
@@ -416,8 +416,8 @@
return 0;
if (i < 0) {
i = newVariable(box->sym, GDKstrdup(name), type);
- if (stk->stksize <= i)
- box->val = reallocStack(stk, STACKINCR);
+ if (box->val->stksize <= i)
+ box->val = reallocStack(box->val, STACKINCR);
}
v = &box->val->stk[i];
VALclear(v);
diff --git a/monetdb5/mal/mal_builder.mx b/monetdb5/mal/mal_builder.mx
--- a/monetdb5/mal/mal_builder.mx
+++ b/monetdb5/mal/mal_builder.mx
@@ -171,7 +171,7 @@
q->barrier = CATCHsymbol;
if ( i< 0) {
getArg(q,0)= newVariable(mb, GDKstrdup(nme),TYPE_str);
- setVarUDFtype(mb,getArg(q,0));
+ setVarFixed(mb,getArg(q,0));
} else getArg(q,0) = i;
return q;
}
@@ -367,7 +367,7 @@
mb->var[_t]->type = tpe;
}
q= pushArgument(mb, q, _t);
- setVarUDFtype(mb,getArg(q,q->argc-1)); /* needed */
+ setVarFixed(mb,getArg(q,q->argc-1)); /* needed */
return q;
}
@@ -382,7 +382,7 @@
cst.val.oval= oid_nil;
convertConstant(idx, &cst);
_t = defConstant(mb,idx,&cst);
- setVarUDFtype(mb,_t);
+ setVarFixed(mb,_t);
return pushArgument(mb, q, _t);
}
@@ -396,7 +396,7 @@
cst.val.oval= oid_nil;
convertConstant(tpe, &cst);
_t = defConstant(mb,tpe,&cst);
- setVarUDFtype(mb,_t);
+ setVarFixed(mb,_t);
return pushArgument(mb, q, _t);
}
diff --git a/monetdb5/mal/mal_debugger.mx b/monetdb5/mal/mal_debugger.mx
--- a/monetdb5/mal/mal_debugger.mx
+++ b/monetdb5/mal/mal_debugger.mx
@@ -733,25 +733,22 @@
static void
printCall(Client cntxt, MalBlkPtr mb, MalStkPtr stk, int pc)
{
- str msg;
- msg = instruction2str(mb, stk, getInstrPtr(mb,pc), LIST_MAL_DEBUG);
- mnstr_printf(cntxt->fdout, "#%s at %s.%s[%d]\n", msg,
+ mnstr_printf(cntxt->fdout, "#");
+
promptInstruction(cntxt->fdout,mb,stk,getInstrPtr(mb,pc),LIST_MAL_DEBUG);
+ mnstr_printf(cntxt->fdout, " at %s.%s[%d]\n",
getModuleId(getInstrPtr(mb,0)),
getFunctionId(getInstrPtr(mb,0)),pc);
- GDKfree(msg);
}
/* utility to display instruction and dispose of structure */
void
printTraceCall(stream *out, MalBlkPtr mb, MalStkPtr stk, int pc, int flags)
{
- str msg;
InstrPtr p;
p= getInstrPtr(mb,pc);
- msg = instruction2str(mb, stk, p, flags);
- mnstr_printf(out, "#%s\n", msg);
- GDKfree(msg);
+ mnstr_printf(out, "#");
+ printInstruction(out,mb,stk,p,flags);
}
static void
@@ -1093,7 +1090,7 @@
while (fs != NULL) {
if (fcnname == NULL)
printSignature(out, fs,
0);
- else if (fs->def &&
strcmp(fcnname, getFcnName(fs->def)) == 0)
+ else if (fs->def &&
strcmp(fcnname, getFunctionId(getInstrPtr(fs->def,0))) == 0)
printSignature(out, fs,
0);
fs = fs->peer;
}
@@ -1841,7 +1838,7 @@
VarPtr n = getVar(mb, index);
if( v == 0 && isVarConstant(mb,index))
- v= &getVarConstant(mb,index);
+ v= getVarValue(mb,index);
if (n->tmpindex) {
snprintf(nmebuf, PATHLENGTH, "%c%d", TMPMARKER, n->tmpindex);
nme = nmebuf;
diff --git a/monetdb5/mal/mal_errors.mx b/monetdb5/mal/mal_errors.mx
--- a/monetdb5/mal/mal_errors.mx
+++ b/monetdb5/mal/mal_errors.mx
@@ -18,40 +18,35 @@
@
@f mal_errors
-@-
-The error strings are
-geared at answering the question "what happened".
-Optional information about "why it happened" is added
-as local strings in the code base with possibly runtime information.
-Information on "how to avoid it" is sporadically added using expected values.
-
-General considerations on error classes are summarized below:
-@itemize
-@item MAL_MALLOC_FAIL
-An operation allocates space for an object failed.
-Either the pre-requisites are not satisfied, or the system
-runs low on resources and can not accomodate the object.
-For failures to create BATs it sometimes indicates that an
-intermediate BAT size is too large.
-@item OPERATION_FAILED
-Mostly the module and function name are indicative enough.
-If possible more is said about the error context,
-informative references to arguments or variables,
-provided it is produced by the underlying implementation.
-@item GDK_EXCEPTION
-In general these are generated deep inside the kernel.
-They are captured by the MAL interpreter.
-@item SEMANTIC_*
-The patterns can be used to defer semantic type errors
-to runtime.
-@end itemize
-@{
-Getting all exception strings in one place improves consistency
-and maintenance.
-
-At a later stage we could introduce internationalization support, i.e.
-use a translation table where needed.
@h
+/* Author(s): M.L. Kersten
+ * The error strings are geared at answering the question "what happened".
+ * Optional information about "why it happened" is added
+ * as local strings in the code base with possibly runtime information.
+ * Information on "how to avoid it" is sporadically added using expected
values.
+ *
+ * General considerations on error classes are summarized below:
+ *
+ * MAL_MALLOC_FAIL
+ * An operation allocates space for an object failed.
+ * Either the pre-requisites are not satisfied, or the system
+ * runs low on resources and can not accomodate the object.
+ * For failures to create BATs it sometimes indicates that an
+ * intermediate BAT size is too large.
+ *
+ * OPERATION_FAILED
+ * Mostly the module and function name are indicative enough.
+ * If possible more is said about the error context,
+ * informative references to arguments or variables,
+ * provided it is produced by the underlying implementation.
+ * @item GDK_EXCEPTION
+ * In general these are generated deep inside the kernel.
+ * They are captured by the MAL interpreter.
+ *
+ * SEMANTIC_*
+ * The patterns can be used to defer semantic type errors
+ * to runtime.
+*/
#ifndef MAL_ERRORS
#define MAL_ERRORS
@@ -144,4 +139,3 @@
#define GDK_EXCEPTION "GDK reported error."
#endif /* MAL_ERRORS */
-@}
diff --git a/monetdb5/mal/mal_exception.mx b/monetdb5/mal/mal_exception.mx
--- a/monetdb5/mal/mal_exception.mx
+++ b/monetdb5/mal/mal_exception.mx
@@ -312,9 +312,10 @@
char buf[GDKMAXERRLEN];
size_t i;
str s, fcn;
+ InstrPtr q= getInstrPtr(mb,0);
- s = mb ? getModName(mb) : "unknown";
- fcn = mb ? getFcnName(mb) : "unknown";
+ s = mb ? getModuleId(q) : "unknown";
+ fcn = mb ? getFunctionId(q) : "unknown";
i = 0;
if (prev)
diff --git a/monetdb5/mal/mal_factory.mx b/monetdb5/mal/mal_factory.mx
--- a/monetdb5/mal/mal_factory.mx
+++ b/monetdb5/mal/mal_factory.mx
@@ -393,7 +393,7 @@
lhs = &pl->stk->stk[i];
if( isVarConstant(mb,i) > 0 ){
if( !isVarDisabled(mb,i)){
- rhs = &getVarConstant(mb,i);
+ rhs = getVarConstant(mb,i);
VALcopy(lhs,rhs);
}
} else{
@@ -451,7 +451,7 @@
for(i= psig->argc; i< mb->vtop; i++)
if( isVarConstant(mb,i) > 0 ){
lhs = &stk->stk[i];
- rhs = &getVarConstant(mb,i);
+ rhs = getVarConstant(mb,i);
VALcopy(lhs,rhs);
} else {
lhs = &stk->stk[i];
@@ -502,7 +502,7 @@
plim = plants + lastPlant;
for (p = plants; p < plim && p->factory; p++)
;
- stk = newStack(mb->vsize);
+ newStack(stk, mb->vsize);
if (lastPlant == MAXPLANTS || stk == NULL)
return 0;
if (p == plim)
diff --git a/monetdb5/mal/mal_function.mx b/monetdb5/mal/mal_function.mx
--- a/monetdb5/mal/mal_function.mx
+++ b/monetdb5/mal/mal_function.mx
@@ -107,7 +107,8 @@
@c
#include "monetdb_config.h"
#include "mal_function.h"
-#include "mal_resolve.h" /* for isPolymorphic() & chkProgram() */
+#include "mal_type.h"
+#include "mal_resolve.h" /* for chkProgram() */
#include "mal_interpreter.h" /* for showErrors() */
#include "mal_namespace.h"
@@ -223,7 +224,7 @@
showScriptException(mb,i,SYNTAX,
"recursive %s[%d] shields %s[%d]",
getVarName(mb,v), pc[j],
- getFcnName(mb),pc[i]);
+
getFunctionId(getInstrPtr(mb,0)),pc[i]);
mb->errors++;
return;
}
@@ -354,7 +355,7 @@
for(btop--; btop>=0;btop--){
showScriptException(mb,lastInstruction, SYNTAX,
"barrier '%s' without exit in %s[%d]",
- getVarName(mb,var[btop]),getFcnName(mb),i);
+
getVarName(mb,var[btop]),getFunctionId(getInstrPtr(mb,0)),i);
mb->errors++;
}
p= getInstrPtr(mb,0);
@@ -491,32 +492,26 @@
#endif
if( p->polymorphic)
for(i=0;i<p->argc; i++)
- if( isPolymorphic(x= getArgType(mb,p,i))) {
+ if( isaTypeVar(x= getArgType(mb,p,i))) {
if( isaColType(x)){
int tail;
int tx;
tail = getColType(x);
- tx = getColIndex(x);
+ tx = getColTypeIndex(x);
if(v && tx == v && tail == TYPE_any){
tx= 0;
tail = t;
}
y= newColType(tail);
- setColIndex(y,tx);
+ y = newColTypeIndex(y,tx);
setArgType(mb,p,i,y);
#ifdef DEBUG_MAL_FCN
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list