Changeset: 8da95f72111d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8da95f72111d
Modified Files:
monetdb5/mal/mal_function.c
monetdb5/mal/mal_type.c
monetdb5/mal/mal_type.h
monetdb5/modules/kernel/Tests/vacuum.mal
monetdb5/modules/kernel/Tests/vacuum.stable.out
monetdb5/modules/mal/Tests/inspect05.stable.out
monetdb5/modules/mal/Tests/inspect05.stable.out.Windows
Branch: Apr2012
Log Message:
Merged parallel track of Aug2012 branch
diffs (truncated from 390 to 300 lines):
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
@@ -496,82 +496,127 @@ static void replaceTypeVar(MalBlkPtr mb,
#endif
}
}
+
+/* insert a symbol into the symbol table just before the symbol
+ * "before". */
+static void
+insertSymbolBefore(Module scope, Symbol prg, Symbol before)
+{
+ InstrPtr sig;
+ int t;
+ Symbol s;
+
+ assert(strcmp(prg->name, before->name) == 0);
+ sig = getSignature(prg);
+ if (getModuleId(sig) && getModuleId(sig) != scope->name) {
+ Module c = findModule(scope, getModuleId(sig));
+ if (c)
+ scope = c;
+ }
+ t = getSubScope(getFunctionId(sig));
+ assert(scope->subscope != NULL);
+ assert(scope->subscope[t] != NULL);
+ s = scope->subscope[t];
+ prg->skip = before->skip;
+ prg->peer = before;
+ if (s == before) {
+ scope->subscope[t] = prg;
+ } else {
+ for (;;) {
+ assert(s != NULL);
+ if (s->skip == before) {
+ s->skip = prg;
+ }
+ if (s->peer == before) {
+ s->peer = prg;
+ break;
+ }
+ s = s->peer;
+ }
+ }
+}
+
/*
- * @-
* Upon cloning a function we should remove all the polymorphic flags.
* Otherwise we may end up with a recursive clone.
*/
-Symbol cloneFunction(stream *out, Module scope, Symbol proc, MalBlkPtr mb,
InstrPtr p){
+Symbol
+cloneFunction(stream *out, Module scope, Symbol proc, MalBlkPtr mb, InstrPtr p)
+{
Symbol new;
int i,v;
InstrPtr pp;
#ifdef DEBUG_CLONE
mnstr_printf(out,"clone the function %s to scope %s\n",
- proc->name,scope->name);
+ proc->name,scope->name);
printInstruction(out,mb,0,p,LIST_MAL_ALL);
#endif
- new= newFunction(scope->name, proc->name, getSignature(proc)->token );
+ new = newFunction(scope->name, proc->name, getSignature(proc)->token);
freeMalBlk(new->def);
new->def = copyMalBlk(proc->def);
/* now change the definition of the original proc */
#ifdef DEBUG_CLONE
- mnstr_printf(out,"CLONED VERSION\n");
+ mnstr_printf(out, "CLONED VERSION\n");
printFunction(out, new->def, 0, LIST_MAL_ALL);
#endif
/* check for errors after fixation , TODO*/
pp = getSignature(new);
- for(i=0;i<pp->argc;i++)
- if( isPolymorphic(v= getArgType(new->def,pp,i)) ){
- int t = getArgType(mb,p,i);
+ for (i = 0; i < pp->argc; i++)
+ if (isPolymorphic(v = getArgType(new->def,pp, i))) {
+ int t = getArgType(mb, p, i);
- if ( v== TYPE_any)
- replaceTypeVar(new->def, pp, v, t);
- if( isaBatType(v) ){
- if( getHeadIndex(v) )
- replaceTypeVar(new->def, pp, getHeadIndex(v),
getHeadType(t));
- if( getTailIndex(v) )
- replaceTypeVar(new->def, pp, getTailIndex(v),
getTailType(t));
- } else
- replaceTypeVar(new->def, pp, getTailIndex(v), t);
- }
+ if (v == TYPE_any)
+ replaceTypeVar(new->def, pp, v, t);
+ if (isaBatType(v)) {
+ if (getHeadIndex(v))
+ replaceTypeVar(new->def, pp,
getHeadIndex(v), getHeadType(t));
+ if (getTailIndex(v))
+ replaceTypeVar(new->def, pp,
getTailIndex(v), getTailType(t));
+ } else
+ replaceTypeVar(new->def, pp, getTailIndex(v),
t);
+ }
#ifdef DEBUG_MAL_FCN
- else mnstr_printf(out,"%d remains %s\n",i, getTypeName(v));
+ else
+ mnstr_printf(out,"%d remains %s\n", i, getTypeName(v));
#endif
/* include the function at the proper place in the scope */
- insertSymbol(scope,new);
+ insertSymbolBefore(scope, new, proc);
/* clear polymorphic and type to force analysis*/
- for(i=0;i<new->def->stop;i++) {
- pp= getInstrPtr(new->def,i);
- pp->typechk= TYPE_UNKNOWN;
- pp->polymorphic= 0;
+ for (i = 0; i < new->def->stop; i++) {
+ pp = getInstrPtr(new->def, i);
+ pp->typechk = TYPE_UNKNOWN;
+ pp->polymorphic = 0;
}
/* clear type fixations */
- for(i=0;i< new->def->vtop; i++)
- clrVarFixed(new->def,i);
+ for (i = 0; i < new->def->vtop; i++)
+ clrVarFixed(new->def, i);
#ifdef DEBUG_MAL_FCN
- mnstr_printf(out,"FUNCTION TO BE CHECKED\n");
+ mnstr_printf(out, "FUNCTION TO BE CHECKED\n");
printFunction(out, new->def, 0, LIST_MAL_ALL);
#endif
/* check for errors after fixation , TODO*/
/* beware, we should now ignore any cloning */
- if(proc->def->errors == 0) {
+ if (proc->def->errors == 0) {
chkProgram(out, scope,new->def);
- if( new->def->errors){
- showScriptException(out, new->def,0,MAL,"Error in
cloned function");
+ if (new->def->errors) {
+ showScriptException(out, new->def, 0, MAL,
+ "Error in
cloned function");
#ifdef DEBUG_MAL_FCN
- printFunction(out,new->def, 0, LIST_MAL_ALL);
+ printFunction(out, new->def, 0, LIST_MAL_ALL);
#endif
}
}
#ifdef DEBUG_CLONE
- mnstr_printf(out,"newly cloned function added to %s %d
\n",scope->name,i);
- printFunction(out,new->def, 0, LIST_MAL_ALL);
+ mnstr_printf(out, "newly cloned function added to %s %d \n",
+ scope->name, i);
+ printFunction(out, new->def, 0, LIST_MAL_ALL);
#endif
return new;
}
+
/*
* @-
* For commands we do not have to clone the routine. We merely have to
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
@@ -115,15 +115,6 @@ getTypeIdentifier(malType tpe){
* Use the information that identifiers are at least one character
* and are terminated by a null to speedup comparison
*/
-inline int
-idcmp(str n, str m)
-{
- assert(n != NULL);
- assert(m != NULL);
- if (*n == *m)
- return strcmp(n, m);
- return -1;
-}
/*
* @-
@@ -194,8 +185,8 @@ getTypeIndex(str nme, int len, int defty
nme[k] = 0;
}
for(i= TYPE_str; i< GDKatomcnt; i++)
- if( BATatoms[i].name[0]==nme[0] &&
- strcmp(nme,BATatoms[i].name)==0) break;
+ if( BATatoms[i].name[0]==nme[0] &&
+ strcmp(nme,BATatoms[i].name)==0) break;
if( len > 0)
nme[k]=old;
if (i == GDKatomcnt)
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
@@ -82,7 +82,7 @@ mal_export str getTypeIdentifier(malType
mal_export int getTypeIndex(str nme, int len, int deftpe);
mal_export malType reverseBatType(malType v);
mal_export malType malAnyBatType(malType t1, malType t2);
-mal_export int idcmp(str n, str m);
+#define idcmp(n, m) strcmp(n, m)
mal_export str newTmpName(char tag, int i);
mal_export int isTmpName(str n);
mal_export int isTypeName(str n);
diff --git a/monetdb5/modules/kernel/Tests/vacuum.mal
b/monetdb5/modules/kernel/Tests/vacuum.mal
--- a/monetdb5/modules/kernel/Tests/vacuum.mal
+++ b/monetdb5/modules/kernel/Tests/vacuum.mal
@@ -4,6 +4,12 @@ b:= bat.new(:oid,:int);
c:= bat.new(:oid,:oid);
k:= 0;
+INT_MAX := 2147483647;
+dbgmsk_restore := mdb.getDebug();
+dbgmsk_unset := 8+8388608;
+dbgmsk_keep := calc.xor(INT_MAX,dbgmsk_unset);
+dbgmsk_set := calc.and(dbgmsk_restore,dbgmsk_keep);
+mdb.setDebug(dbgmsk_set);
barrier (go,i):= language.newRange(0:lng);
k:= k +1;
barrier t:= k <= 1000;
@@ -13,6 +19,7 @@ barrier (go,i):= language.newRange(0:lng
bat.append(b,k);
redo (go,i):= language.nextElement(1:lng,1000000:lng);
exit (go,i);
+mdb.setDebug(dbgmsk_restore);
d:= algebra.copy(b);
diff --git a/monetdb5/modules/kernel/Tests/vacuum.stable.out
b/monetdb5/modules/kernel/Tests/vacuum.stable.out
--- a/monetdb5/modules/kernel/Tests/vacuum.stable.out
+++ b/monetdb5/modules/kernel/Tests/vacuum.stable.out
@@ -21,6 +21,12 @@ function user.main():void;
b := bat.new(:oid,:int);
c := bat.new(:oid,:oid);
k := 0;
+ INT_MAX := 2147483647;
+ dbgmsk_restore := mdb.getDebug();
+ dbgmsk_unset := calc.+(8,8388608);
+ dbgmsk_keep := calc.xor(INT_MAX,dbgmsk_unset);
+ dbgmsk_set := calc.and(dbgmsk_restore,dbgmsk_keep);
+ mdb.setDebug(dbgmsk_set);
barrier (go,i) := language.newRange(0:lng);
k := calc.+(k,1);
barrier t := calc.<=(k,1000);
@@ -30,6 +36,7 @@ exit t;
bat.append(b,k);
redo (go,i) := language.nextElement(1:lng,1000000:lng);
exit (go,i);
+ mdb.setDebug(dbgmsk_restore);
d := algebra.copy(b);
cnt := aggr.count(b);
io.print(cnt);
diff --git a/monetdb5/modules/mal/Tests/inspect05.stable.out
b/monetdb5/modules/mal/Tests/inspect05.stable.out
--- a/monetdb5/modules/mal/Tests/inspect05.stable.out
+++ b/monetdb5/modules/mal/Tests/inspect05.stable.out
@@ -4974,24 +4974,18 @@ end main;
[ "stddev_pop", "function", "aggr",
"(v:bat[:oid,:flt],g:bat[:oid,:oid],e:bat[:oid,:any_2]):bat[:oid,:flt];",
"nil" ]
[ "stddev", "function", "aggr",
"(v:bat[:oid,:flt],g:bat[:oid,:oid],e:bat[:oid,:any_2]):bat[:oid,:flt];",
"nil" ]
[ "stddev", "function", "aggr",
"(e:bat[:oid,:flt]):flt;",
"nil" ]
-[ "sum", "function", "aggr",
"(b:bat[:oid,:flt]):flt;",
"nil" ]
[ "stddev_pop", "function", "aggr",
"(v:bat[:oid,:lng],g:bat[:oid,:oid],e:bat[:oid,:any_2]):bat[:oid,:lng];",
"nil" ]
[ "stddev", "function", "aggr",
"(v:bat[:oid,:lng],g:bat[:oid,:oid],e:bat[:oid,:any_2]):bat[:oid,:lng];",
"nil" ]
[ "stddev", "function", "aggr",
"(e:bat[:oid,:lng]):lng;",
"nil" ]
-[ "sum", "function", "aggr",
"(b:bat[:oid,:lng]):lng;",
"nil" ]
[ "stddev_pop", "function", "aggr",
"(v:bat[:oid,:int],g:bat[:oid,:oid],e:bat[:oid,:any_2]):bat[:oid,:int];",
"nil" ]
[ "stddev", "function", "aggr",
"(v:bat[:oid,:int],g:bat[:oid,:oid],e:bat[:oid,:any_2]):bat[:oid,:int];",
"nil" ]
[ "stddev", "function", "aggr",
"(e:bat[:oid,:int]):int;",
"nil" ]
-[ "sum", "function", "aggr",
"(b:bat[:oid,:int]):int;",
"nil" ]
[ "stddev_pop", "function", "aggr",
"(v:bat[:oid,:sht],g:bat[:oid,:oid],e:bat[:oid,:any_2]):bat[:oid,:sht];",
"nil" ]
[ "stddev", "function", "aggr",
"(v:bat[:oid,:sht],g:bat[:oid,:oid],e:bat[:oid,:any_2]):bat[:oid,:sht];",
"nil" ]
[ "stddev", "function", "aggr",
"(e:bat[:oid,:sht]):sht;",
"nil" ]
-[ "sum", "function", "aggr",
"(b:bat[:oid,:sht]):sht;",
"nil" ]
[ "stddev_pop", "function", "aggr",
"(v:bat[:oid,:bte],g:bat[:oid,:oid],e:bat[:oid,:any_2]):bat[:oid,:bte];",
"nil" ]
[ "stddev", "function", "aggr",
"(v:bat[:oid,:bte],g:bat[:oid,:oid],e:bat[:oid,:any_2]):bat[:oid,:bte];",
"nil" ]
-[ "sum", "function", "aggr",
"(b:bat[:oid,:dbl]):dbl;",
"nil" ]
[ "stddev", "function", "aggr",
"(e:bat[:oid,:bte]):bte;",
"nil" ]
-[ "sum", "function", "aggr",
"(b:bat[:oid,:bte]):bte;",
"nil" ]
[ "size", "command", "aggr",
"(b:bat[:void,:bit],e:bat[:void,:any_1]):bat[:void,:wrd] ",
"AX3aggrX3_size;"
]
[ "sum", "command", "aggr",
"(b:bat[:oid,:dbl],g:bat[:oid,:oid],e:bat[:oid,:any_1]):bat[:oid,:dbl] ",
"AX3aggrX3_sum3_dbl_dbl;" ]
[ "sum", "command", "aggr",
"(b:bat[:oid,:dbl],e:bat[:oid,:any_1]):bat[:oid,:dbl] ",
"AX3aggrX3_sum_dbl_dbl;" ]
@@ -5048,12 +5042,15 @@ end main;
[ "sum", "command", "aggr",
"(b:bat[:any_1,:sht],empty_is_nil:bit):dbl ",
"ALGsum_sht_dbl;"
]
[ "sum", "function", "aggr",
"(b:bat[:any_1,:bte]):dbl;",
"nil"
]
[ "sum", "command", "aggr",
"(b:bat[:any_1,:bte],empty_is_nil:bit):dbl ",
"ALGsum_bte_dbl;"
]
+[ "sum", "function", "aggr",
"(b:bat[:oid,:dbl]):dbl;",
"nil"
]
[ "sum", "function", "aggr",
"(b:bat[:any_1,:dbl]):dbl;",
"nil"
]
[ "sum", "command", "aggr",
"(b:bat[:any_1,:dbl],empty_is_nil:bit):dbl ",
"ALGsum_dbl_dbl;"
]
[ "sum", "function", "aggr",
"(b:bat[:any_1,:flt]):dbl;",
"nil"
]
[ "sum", "command", "aggr",
"(b:bat[:any_1,:flt],empty_is_nil:bit):dbl ",
"ALGsum_flt_dbl;"
]
+[ "sum", "function", "aggr",
"(b:bat[:oid,:flt]):flt;",
"nil"
]
[ "sum", "function", "aggr",
"(b:bat[:any_1,:flt]):flt;",
"nil"
]
[ "sum", "command", "aggr",
"(b:bat[:any_1,:flt],empty_is_nil:bit):flt ",
"ALGsum_flt_flt;"
]
+[ "sum", "function", "aggr",
"(b:bat[:oid,:lng]):lng;",
"nil"
]
[ "sum", "function", "aggr",
"(b:bat[:any_1,:lng]):lng;",
"nil"
]
[ "sum", "command", "aggr",
"(b:bat[:any_1,:lng],empty_is_nil:bit):lng ",
"ALGsum_lng_lng;"
]
[ "sum", "function", "aggr",
"(b:bat[:any_1,:wrd]):lng;",
"nil"
]
@@ -5064,6 +5061,7 @@ end main;
[ "sum", "command", "aggr",
"(b:bat[:any_1,:int],empty_is_nil:bit):lng ",
"ALGsum_int_lng;"
]
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list