Changeset: 939d6fe25be6 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=939d6fe25be6 Modified Files: monetdb5/mal/mal_box.c monetdb5/mal/mal_builder.c monetdb5/mal/mal_debugger.c monetdb5/mal/mal_function.c monetdb5/mal/mal_profiler.c monetdb5/mal/mal_type.c monetdb5/mal/mal_type.h Branch: default Log Message:
Introduction of the ColType macros diffs (162 lines): diff --git a/monetdb5/mal/mal_box.c b/monetdb5/mal/mal_box.c --- a/monetdb5/mal/mal_box.c +++ b/monetdb5/mal/mal_box.c @@ -708,7 +708,7 @@ saveBox(Box box, int flag) BAT *b = (BAT *) BATdescriptor(v->val.bval); if (b) { if (b->batPersistence == PERSISTENT){ - str tt = getTypeName(getTailType(getVarType(box->sym,i))); + str tt = getTypeName(getColType(getVarType(box->sym,i))); mnstr_printf(f, "%s:bat[:void,:%s]:= %s.bind(%d);\n", getVarName(box->sym, i), tt, box->name, b->batCacheid); diff --git a/monetdb5/mal/mal_builder.c b/monetdb5/mal/mal_builder.c --- a/monetdb5/mal/mal_builder.c +++ b/monetdb5/mal/mal_builder.c @@ -365,7 +365,7 @@ pushEmptyBAT(MalBlkPtr mb, InstrPtr q, i getFunctionId(q) = getName("new",3); q = pushArgument(mb, q, newTypeVariable(mb,TYPE_void)); - q = pushArgument(mb, q, newTypeVariable(mb,getTailType(tpe))); + q = pushArgument(mb, q, newTypeVariable(mb,getColType(tpe))); q = pushZero(mb,q,TYPE_lng); return q; } 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 @@ -994,7 +994,7 @@ mdbSanityCheck(Client cntxt, MalBlkPtr m b = BATmirror(b); if (b) { nme = getTypeName(n->type); - nmeOnStk = getTypeName(newBatType(b->htype, b->ttype)); + nmeOnStk = getTypeName(newColType(b->ttype)); if (strcmp(nme, nmeOnStk)) { printTraceCall(cntxt->fdout, mb, stk, pc, cntxt->flags); mnstr_printf(cntxt->fdout, "!ERROR: %s != :%s\n", @@ -1217,7 +1217,7 @@ printBATelm(stream *f, int i, BUN cnt, B b = BATdescriptor(i); if (b) { - tpe = getTypeName(newBatType(b->htype, b->ttype)); + tpe = getTypeName(newColType(b->ttype)); mnstr_printf(f, ":%s ", tpe); printBATproperties(f, b); /* perform property checking */ @@ -1282,7 +1282,7 @@ printStackElm(stream *f, MalBlkPtr mb, V if (i < 0) b = BATmirror(b); if (b) { - nme = getTypeName(newBatType(b->htype, b->ttype)); + nme = getTypeName(newColType(b->ttype)); mnstr_printf(f, " :%s rows="BUNFMT, nme, BATcount(b)); } else { nme = getTypeName(n->type); diff --git a/monetdb5/mal/mal_function.c b/monetdb5/mal/mal_function.c --- a/monetdb5/mal/mal_function.c +++ b/monetdb5/mal/mal_function.c @@ -440,7 +440,7 @@ static void replaceTypeVar(MalBlkPtr mb, int head,tail; int hx,tx; head = getHeadType(x); - tail = getTailType(x); + tail = getColType(x); hx = getHeadIndex(x); tx = getTailIndex(x); if(v && hx == v && head == TYPE_any){ @@ -551,7 +551,7 @@ cloneFunction(stream *out, Module scope, if (getHeadIndex(v)) replaceTypeVar(new->def, pp, getHeadIndex(v), getHeadType(t)); if (getTailIndex(v)) - replaceTypeVar(new->def, pp, getTailIndex(v), getTailType(t)); + replaceTypeVar(new->def, pp, getTailIndex(v), getColType(t)); } else replaceTypeVar(new->def, pp, getTailIndex(v), t); } diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c --- a/monetdb5/mal/mal_profiler.c +++ b/monetdb5/mal/mal_profiler.c @@ -1076,21 +1076,21 @@ getTraceType(str nme) if (initTrace()) return TYPE_any; if (strcmp(nme, "time") == 0) - return newBatType(TYPE_void, TYPE_str); + return newColType( TYPE_str); if (strcmp(nme, "ticks") == 0) - return newBatType(TYPE_void, TYPE_lng); + return newColType( TYPE_lng); if (strcmp(nme, "pc") == 0) - return newBatType(TYPE_void, TYPE_str); + return newColType( TYPE_str); if (strcmp(nme, "thread") == 0) - return newBatType(TYPE_void, TYPE_int); + return newColType( TYPE_int); if (strcmp(nme, "stmt") == 0) - return newBatType(TYPE_void, TYPE_str); + return newColType( TYPE_str); if (strcmp(nme, "rbytes") == 0) - return newBatType(TYPE_void, TYPE_lng); + return newColType( TYPE_lng); if (strcmp(nme, "wbytes") == 0) - return newBatType(TYPE_void, TYPE_lng); + return newColType( TYPE_lng); if (strcmp(nme, "reads") == 0 || strcmp(nme, "writes") == 0) - return newBatType(TYPE_void, TYPE_lng); + return newColType( TYPE_lng); return TYPE_any; } diff --git a/monetdb5/mal/mal_type.c b/monetdb5/mal/mal_type.c --- a/monetdb5/mal/mal_type.c +++ b/monetdb5/mal/mal_type.c @@ -65,10 +65,10 @@ getTypeName(malType tpe) k = getTailIndex(tpe); if (k) snprintf(s, l, ":any%c%d]",TMPMARKER, k); - else if (getTailType(tpe) == TYPE_any) + else if (getColType(tpe) == TYPE_any) snprintf(s, l, ":any]"); else - snprintf(s, l, ":%s]", ATOMname(getTailType(tpe))); + snprintf(s, l, ":%s]", ATOMname(getColType(tpe))); return GDKstrdup(buf); } if (isAnyExpression(tpe)) { diff --git a/monetdb5/mal/mal_type.h b/monetdb5/mal/mal_type.h --- a/monetdb5/mal/mal_type.h +++ b/monetdb5/mal/mal_type.h @@ -23,7 +23,6 @@ /* #define DEBUG_MAL_TYPE 1 */ - typedef int malType; #define malVARG " malVARG" @@ -31,7 +30,6 @@ typedef int malType; #define REFMARKER 'X' #define newBatType(H,T) (1<<16 | (((H & 0377) <<8) | (T & 0377) )) -#define newColType(T) (1<<25 | (((TYPE_void & 0377) <<8) | (T & 0377) )) #define getHeadType(X) ((X>>8) & 0377 ) #define getTailType(X) ((X) & 0377 ) #define isaBatType(X) ((1<<16) & (X) && (X)!= TYPE_any) @@ -44,8 +42,17 @@ typedef int malType; #define getHeadIndex(X) (((X)>>22) & 017) #define getTailIndex(X) (((X)>>18) & 017) + +/* introduce gradually the column type macros, sharing the + * representation with BAT type + */ +#define newColType(T) (1<<16 | (T & 0377) ) +#define getColType(X) ((X) & 0377 ) +#define isaColType(X) ((1<<16) & (X) && (X)!= TYPE_any) +#define setAnyColIndex(X,I) X |= ((I & 017)<<18); +#define getColIndex(X) (((X)>>18) & 017) + /* - * @- * The symbol/instruction kinds are introduced here instead of reusing the defines * derived from the parser to avoid a loop in the define-structure. */ _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list