Update of /cvsroot/monetdb/MonetDB5/src/mal
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv28514/src/mal
Modified Files:
mal_instruction.mx mal_resolve.mx
Log Message:
The output of the instructions is cleaned up.
Amongst others, the properties of instructions are also displayed.
U = types not yet resolved
P = polymorphic instruction
G = subject to garbage control
R = subject to recycler control
J = jump towards other statement
A few tests are not handled yet.
Index: mal_instruction.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_instruction.mx,v
retrieving revision 1.314
retrieving revision 1.315
diff -u -d -r1.314 -r1.315
--- mal_instruction.mx 13 Mar 2008 15:01:30 -0000 1.314
+++ mal_instruction.mx 15 Mar 2008 19:34:00 -0000 1.315
@@ -342,9 +342,7 @@
/* type check status is kept around to improve type checking efficiency */
#define TYPE_ERROR -1
#define TYPE_UNKNOWN 0
-#define TYPE_DYNAMIC 1
-#define TYPE_BIND 2
-#define TYPE_RESOLVED 4
+#define TYPE_RESOLVED 2
#define QUICKCLEANUP 1
#define GARBAGECONTROL 2
@@ -362,7 +360,7 @@
bit typechk; /* type check status */
bit gc; /* garbage control flags */
bit polymorphic; /* complex type analysis */
- bit varargs; /* variable number of arguments or targets */
+ bit varargs; /* variable number of arguments */
bit recycle; /* under the control of the recycler */
int jump; /* controlflow program counter */
MALfcn fcn; /* resolved function address */
@@ -555,7 +553,7 @@
mal_export str fcnClass(InstrPtr p);
mal_export str fcnDefinition(MalBlkPtr mb, InstrPtr p, str s, int flg);
mal_export void printInstruction(stream *fd, MalBlkPtr mb, InstrPtr p, int
flg);
-mal_export str recognizedCall(MalBlkPtr mb, InstrPtr p, str s);
+mal_export str instructionCall(MalBlkPtr mb, InstrPtr p, str s);
mal_export void promptInstruction(stream *fd, MalBlkPtr mb, InstrPtr p, int
flg);
mal_export str instruction2str(MalBlkPtr mb, InstrPtr p, int hidden);
mal_export str function2str(MalBlkPtr mb, int flg);
@@ -564,6 +562,7 @@
#define functionStart(X) ((X)->token == FUNCTIONsymbol || \
(X)->token == COMMANDsymbol || \
(X)->token == FACTORYsymbol )
+#define patternStart(X) ((X)->token == PATTERNsymbol)
#define functionExit(X) ((X)->token == ENDsymbol)
#define blockStart(X) ((X)->barrier && (((X)->barrier == BARRIERsymbol || \
@@ -2242,49 +2241,30 @@
#define advance(X) while(*(X))(X)++;
str
-typechkName(int i)
-{
- switch (i) {
- default:
- case TYPE_ERROR:
- return " error";
- case TYPE_UNKNOWN:
- return " unknown";
- case TYPE_DYNAMIC:
- return " dynamic";
- case TYPE_BIND:
- return " bind";
- case TYPE_RESOLVED:
- return "";
- }
-}
-str
-recognizedCall(MalBlkPtr mb, InstrPtr p, str s)
+instructionCall(MalBlkPtr mb, InstrPtr p, str s)
{
- int i;
+ int i, closing=0;
str tpe;
-
- if( p->retc > 1)
- *s++= '(';
- for (i = 0; i < p->retc; i++)
- if (p->argv[i] >= 0) {
- str nme;
- char nmebuf[PATHLENGTH];
- tpe = getTypeName(getArgType(mb, p, i));
- if (isTmpVar(mb, getArg(p, i)) || isVarTypedef(mb,
getArg(p, i))) {
- snprintf(nmebuf, PATHLENGTH, "%c%d", TMPMARKER,
getVarTmp(mb, getArg(p, i)));
- nme = nmebuf;
+ if (p->retc > 1){
+ *s++ = '(';
+ *s=0;
+ }
+ for (i = 0; i < p->argc; i++) {
+ if (i== p->retc){
+ if (i>1)
+ *s++ = ')';
+ sprintf(s, " := ");
+ advance(s);
+ if( p->blk && p->blk->binding){
+ sprintf(s, "%s(", p->blk->binding );
+ closing= 1;
} else
- nme = getArgName(mb, p, i);
- sprintf(s, "%s:%s%s", (nme ? nme : "nil"), tpe,
(i<p->retc-1?", ":""));
+ if( getFunctionId(p)) {
+ sprintf(s, "%s.%s(",
getModuleId(p),getFunctionId(p) );
+ closing= 1;
+ }
advance(s);
- GDKfree(tpe);
}
- if( p->retc > 1)
- *s++= ')';
- sprintf(s," := %s.%s(", getModuleId(p),getFunctionId(p));
- advance(s);
- for (i = p->retc; i < p->argc; i++)
if (p->argv[i] >= 0) {
str nme;
char nmebuf[PATHLENGTH];
@@ -2295,47 +2275,70 @@
nme = nmebuf;
} else
nme = getArgName(mb, p, i);
- sprintf(s, "%s:%s%s", (nme ? nme : "nil"), tpe,
(i<p->argc-1?", ":""));
+ sprintf(s, "%s:%s", (nme ? nme : "nil"), tpe);
advance(s);
+ if (i != p->retc-1 && i< p->argc-1){
+ sprintf(s, ", ");
+ advance(s);
+ }
+
GDKfree(tpe);
}
- advance(s);
- *s++= ')';
+ }
+ if( closing)
+ *s++= ')';
*s=0;
return s;
}
str
-hiddenInstructionArgs(MalBlkPtr mb, InstrPtr p, str s)
+hiddenInstructionArgs(MalBlkPtr mb, InstrPtr p, str s, str start, int flg)
{
int i;
- str tpe;
- sprintf(s, "\t# %d %s%s ", getPC(mb, p), ((p->blk && p->blk->binding) ?
p->blk->binding : ""), typechkName(p->typechk));
+ if (p->token == REMsymbol )
+ return s;
+ i= (int)(s-start);
+ while (i++< 40) *s++= ' '; /* to give a better look to most
programs */
+ *s = 0;
+ sprintf(s, "#%3d ", getPC(mb, p));
advance(s);
- for (i = 0; i < p->argc; i++)
- if (p->argv[i] >= 0) {
- str nme;
- char nmebuf[PATHLENGTH];
+ s = instructionCall(mb,p,s);
[EMAIL PROTECTED]
+The instruction is complemented with simple flags to ease debugging.
+To limit the impact on test output, we only display them when they
+are set.
- if (i == p->retc) {
- sprintf(s, "<-");
- advance(s);
- }
- tpe = getTypeName(getArgType(mb, p, i));
- if (isTmpVar(mb, getArg(p, i)) || isVarTypedef(mb,
getArg(p, i))) {
- snprintf(nmebuf, PATHLENGTH, "%c%d", TMPMARKER,
getVarTmp(mb, getArg(p, i)));
- nme = nmebuf;
- } else
- nme = getArgName(mb, p, i);
- sprintf(s, "(%s:%s)", (nme ? nme : "nil"), tpe);
+U = types not yet resolved
+P = polymorphic instruction
+G = subject to garbage control
+R = subject to recycler control
+J = jump towards other statement
[EMAIL PROTECTED]
+ if (flg & LIST_MAL_PROPS){
+ *s++ =' ';
+ *s++ ='{';
+ switch( p->typechk){
+ case TYPE_UNKNOWN:
+ *s++ ='U'; break;
+ case TYPE_RESOLVED:
+ /* implicit *s++ =' '; */ break;
+ }
+ if (p->polymorphic)
+ *s++ ='P';
+ if (p->gc)
+ *s++ ='G';
+ if (p->recycle)
+ *s++ ='R';
+ if (p->jump){
+ sprintf(s, "J%d", p->jump);
advance(s);
- GDKfree(tpe);
}
- advance(s);
- if (p->jump)
- sprintf(s, " jump %d", p->jump);
- advance(s);
+ if( *(s-1) != '{')
+ *s++ ='}';
+ else s--;
+ *s=0;
+ }
return s;
}
@@ -2423,12 +2426,7 @@
#ifdef DEBUG_MAL_INSTR
if (flg & LIST_MAL_TYPE) {
advance(t);
- hiddenInstructionArgs(mb, p, t);
-/*
- advance(t);
- if( mb->typefixed) sprintf(t," typefixed");
- if( mb->flowfixed) sprintf(t," flowfixed");
-*/
+ hiddenInstructionArgs(mb, p, t,s, flg);
}
#endif
return s;
@@ -2600,6 +2598,7 @@
break;
case ENDsymbol:
sprintf(t, "end %s", getFunctionId(getInstrPtr(mb, 0)));
+ advance(t);
break;
case COMMANDsymbol:
case FUNCTIONsymbol:
@@ -2692,7 +2691,7 @@
sprintf(t, ";");
if (flg & LIST_MAL_TYPE) {
advance(t);
- t = hiddenInstructionArgs(mb, p, t);
+ t = hiddenInstructionArgs(mb, p, t,s, flg);
}
advance(t);
/* sprintf(t,"\n"); */
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins