Changeset: 828184b2dc1b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=828184b2dc1b
Modified Files:
monetdb5/mal/mal_resolve.c
Branch: malparsing
Log Message:
Fix some old debugging code.
diffs (236 lines):
diff --git a/monetdb5/mal/mal_resolve.c b/monetdb5/mal/mal_resolve.c
--- a/monetdb5/mal/mal_resolve.c
+++ b/monetdb5/mal/mal_resolve.c
@@ -120,7 +120,7 @@ findFunctionType(Module scope, MalBlkPtr
* Simplify polytype using a map into the concrete argument table.
*/
#ifdef _DEBUG_MAL_RESOLVE
- fprintf(stderr,"findFunction %s.%s\n", getModuleId(p),
getFunctionId(p));
+ fprintf(stderr,"#findFunction %s.%s\n", getModuleId(p),
getFunctionId(p));
#endif
m = scope;
s = m->space[(int) (getSymbolIndex(getFunctionId(p)))];
@@ -161,15 +161,6 @@ findFunctionType(Module scope, MalBlkPtr
sig = getSignature(s);
unmatched = 0;
-#ifdef _DEBUG_MAL_RESOLVE
- if (tracefcn) {
- fprintf(stderr, "-->resolving\n");
- fprintInstruction(stderr, mb, 0, p, LIST_MAL_ALL);
- fprintf(stderr, "++> test against signature\n");
- fprintInstruction(stderr, s->def, 0, getSignature(s),
LIST_MAL_ALL);
- fprintf(stderr, " %s \n", sig->polymorphic ?
"polymorphic" : "");
- }
-#endif
/*
* The simple case could be taken care of separately to
* speedup processing
@@ -197,6 +188,14 @@ findFunctionType(Module scope, MalBlkPtr
/* if(polyVector[0]==0) polyInit();
memcpy(polytype,polyVector, 2*sig->argc*sizeof(int)); */
+#ifdef _DEBUG_MAL_RESOLVE
+ if (tracefcn && (sig->polymorphic || sig->retc == p->retc)) {
+ fprintf(stderr, "#resolving: ");
+ fprintInstruction(stderr, mb, 0, p, LIST_MAL_ALL);
+ fprintf(stderr, "#against:");
+ fprintInstruction(stderr, s->def, 0, getSignature(s),
LIST_MAL_ALL);
+ }
+#endif
for (k = 0; k < limit; k++)
polytype[k] = TYPE_any;
/*
@@ -279,6 +278,14 @@ findFunctionType(Module scope, MalBlkPtr
s = s->peer;
continue;
}
+#ifdef _DEBUG_MAL_RESOLVE
+ if (tracefcn && (sig->polymorphic || sig->retc == p->retc)) {
+ fprintf(stderr, "#resolving: ");
+ fprintInstruction(stderr, mb, 0, p, LIST_MAL_ALL);
+ fprintf(stderr, "#against:");
+ fprintInstruction(stderr, s->def, 0, getSignature(s),
LIST_MAL_ALL);
+ }
+#endif
for (i = p->retc; i < p->argc; i++) {
int actual = getArgType(mb, p, i);
int formal = getArgType(s->def, sig, i);
@@ -286,7 +293,7 @@ findFunctionType(Module scope, MalBlkPtr
#ifdef _DEBUG_MAL_RESOLVE
char *ftpe = getTypeName(formal);
char *atpe = getTypeName(actual);
- fprintf(stderr, "unmatched %d formal %s
actual %s\n",
+ fprintf(stderr, "#unmatched %d formal
%s actual %s\n",
i, ftpe, atpe);
GDKfree(ftpe);
GDKfree(atpe);
@@ -307,26 +314,29 @@ findFunctionType(Module scope, MalBlkPtr
#ifdef _DEBUG_MAL_RESOLVE
if (tracefcn) {
char *tpe, *tpe2;
- fprintf(stderr, "finished %s.%s unmatched=%d
polymorphic=%d %d\n",
+ fprintf(stderr, "#finished %s.%s unmatched=%d
polymorphic=%d %d",
getModuleId(sig),
getFunctionId(sig), unmatched,
sig->polymorphic, p == sig);
if (sig->polymorphic) {
int l;
+ fprintf(stderr,"poly ");
for (l = 0; l < 2 * p->argc; l++)
if (polytype[l] != TYPE_any) {
tpe = getTypeName(polytype[l]);
- fprintf(stderr, "poly %d %s\n",
l, tpe);
+ fprintf(stderr, " %d %s", l,
tpe);
GDKfree(tpe);
}
+ fprintf(stderr,"\n");
}
- fprintf(stderr, "-->resolving:");
+ fprintf(stderr, "#resolving:");
fprintInstruction(stderr, mb, 0, p, LIST_MAL_ALL);
- fprintf(stderr, "++> against :");
+ fprintf(stderr, "#against :");
fprintInstruction(stderr, s->def, 0, getSignature(s),
LIST_MAL_ALL);
tpe = getTypeName(getArgType(mb, p, unmatched));
tpe2 = getTypeName(getArgType(s->def, sig, unmatched));
- fprintf(stderr, "\nmismatch unmatched %d test %s poly
%s\n",
- unmatched, tpe, tpe2);
+ if( unmatched)
+ fprintf(stderr, "#unmatched %d test %s poly
%s\n",
+ unmatched, tpe, tpe2);
GDKfree(tpe);
GDKfree(tpe2);
}
@@ -396,8 +406,8 @@ findFunctionType(Module scope, MalBlkPtr
* Beware, this is not yet effectuated in the interpreter.
*/
#ifdef _DEBUG_MAL_RESOLVE
- fprintf(stderr,"TYPE RESOLVED:");
- fprintInstruction(stderr, mb, 0, p, LIST_MAL_ALL);
+ fprintf(stderr,"#TYPE RESOLVED:");
+ fprintInstruction(stderr, mb, 0, p, LIST_MAL_DEBUG);
#endif
p->typechk = TYPE_RESOLVED;
for (i = 0; i < p->retc; i++) {
@@ -465,12 +475,6 @@ findFunctionType(Module scope, MalBlkPtr
}
\
bindFunction(s, p, mb);
-#ifdef _DEBUG_MAL_RESOLVE
- if (tracefcn) {
- fprintf(stderr, "Finished matching:");
- fprintInstruction(stderr, mb, 0, p, LIST_MAL_ALL);
- }
-#endif
if (returntype && returntype != returns)
GDKfree(returntype);
return s1;
@@ -483,7 +487,7 @@ findFunctionType(Module scope, MalBlkPtr
wrapup:
#ifdef _DEBUG_MAL_RESOLVE
if (tracefcn) {
- fprintf(stderr, "Wrapup matching returntype %d returns
%d:",*returntype,*returns);
+ fprintf(stderr, "#Wrapup matching returntype %d returns
%d:",*returntype,*returns);
fprintInstruction(stderr, mb, 0, p, LIST_MAL_ALL);
}
#endif
@@ -499,7 +503,7 @@ resolveType(int dsttype, int srctype)
if (tracefcn) {
char *dtpe = getTypeName(dsttype);
char *stpe = getTypeName(srctype);
- fprintf(stderr, "resolveType dst %s (%d) %s(%d)\n",
+ fprintf(stderr, "#resolveType dst %s (%d) %s(%d)\n",
dtpe, dsttype, stpe, srctype);
GDKfree(dtpe);
GDKfree(stpe);
@@ -531,7 +535,7 @@ resolveType(int dsttype, int srctype)
else {
#ifdef _DEBUG_MAL_RESOLVE
if (tracefcn)
- fprintf(stderr, "Tail can not be resolved \n");
+ fprintf(stderr, "#Tail can not be resolved \n");
#endif
return -1;
}
@@ -542,7 +546,7 @@ resolveType(int dsttype, int srctype)
tpe1 = getTypeName(t1);
tpe2 = getTypeName(t2);
tpe3 = getTypeName(t3);
- fprintf(stderr, "resolved to bat[:oid,:%s]
bat[:oid,:%s]->bat[:oid,%s:%d]\n",
+ fprintf(stderr, "#resolved to bat[:oid,:%s]
bat[:oid,:%s]->bat[:oid,%s:%d]\n",
tpe1, tpe2, tpe3, i2);
GDKfree(tpe1);
GDKfree(tpe2);
@@ -553,7 +557,7 @@ resolveType(int dsttype, int srctype)
}
#ifdef _DEBUG_MAL_RESOLVE
if (tracefcn)
- fprintf(stderr, "Can not be resolved \n");
+ fprintf(stderr, "#Can not be resolved \n");
#endif
return -1;
}
@@ -615,9 +619,6 @@ typeChecker(Module scope, MalBlkPtr mb,
p->typechk = TYPE_RESOLVED;
for (k = 0; k < p->retc; k++)
p->typechk = MIN(p->typechk, typeKind(mb, p, 0));
-#ifdef _DEBUG_MAL_RESOLVE
- fprintf(stderr,"typeChecker signature matched\n");
-#endif
return;
}
if (getFunctionId(p) && getModuleId(p)) {
@@ -627,7 +628,7 @@ typeChecker(Module scope, MalBlkPtr mb,
m = findModule(scope, getModuleId(p));
s1 = findFunctionType(m, mb, p, silent);
#ifdef _DEBUG_MAL_RESOLVE
- fprintf(stderr,"typeChecker matched %d\n",s1);
+ fprintf(stderr,"#typeChecker matched %d\n",s1);
#endif
if (s1 >= 0)
return;
@@ -668,7 +669,7 @@ typeChecker(Module scope, MalBlkPtr mb,
} else
p->typechk = TYPE_RESOLVED;
#ifdef _DEBUG_MAL_RESOLVE
- fprintf(stderr,"typeChecker no-sig and no-oly could not find
it %d\n",p->typechk);
+ fprintf(stderr,"#typeChecker no-sig and no-oly could not find
it %d\n",p->typechk);
#endif
return;
}
@@ -680,7 +681,7 @@ typeChecker(Module scope, MalBlkPtr mb,
*/
if (getFunctionId(p)){
#ifdef _DEBUG_MAL_RESOLVE
- fprintf(stderr,"typeChecker function call break %s\n",
getFunctionId(p));
+ fprintf(stderr,"#typeChecker function call break %s\n",
getFunctionId(p));
#endif
return;
}
@@ -698,7 +699,7 @@ typeChecker(Module scope, MalBlkPtr mb,
if (s1 == -1) {
typeMismatch(mb, p, lhs, rhs, silent);
#ifdef _DEBUG_MAL_RESOLVE
- fprintf(stderr,"typeChecker function mismatch
%s\n", getFunctionId(p));
+ fprintf(stderr,"#typeChecker function mismatch
%s\n", getFunctionId(p));
#endif
return;
}
@@ -853,7 +854,7 @@ updateTypeMap(int formal, int actual, in
#ifdef _DEBUG_MAL_RESOLVE
if(tracefcn){
char *tpe1 = getTypeName(formal), *tpe2 = getTypeName(actual);
- fprintf(stderr, "updateTypeMap:formal %s actual %s\n", tpe1,
tpe2);
+ fprintf(stderr, "#updateTypeMap:formal %s actual %s\n", tpe1,
tpe2);
GDKfree(tpe1);
GDKfree(tpe2);
}
@@ -884,7 +885,7 @@ updateTypeMap(int formal, int actual, in
}
updLabel:
#ifdef _DEBUG_MAL_RESOLVE
- fprintf(stderr, "updateTypeMap returns: %d\n", ret);
+ fprintf(stderr, "#updateTypeMap returns: %d\n", ret);
#endif
return ret;
}
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list