Update of /cvsroot/monetdb/MonetDB5/src/mal
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv31634/src/mal

Modified Files:
      Tag: GDK-2
        mal_client.mx mal_interpreter.mx 
Log Message:
propagated changes of Friday Sep 28 2007 - Wednesday Oct 03 2007
from the development trunk to the GDK-2 branch


Index: mal_client.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_client.mx,v
retrieving revision 1.154.2.4
retrieving revision 1.154.2.5
diff -u -d -r1.154.2.4 -r1.154.2.5
--- mal_client.mx       18 Sep 2007 12:42:47 -0000      1.154.2.4
+++ mal_client.mx       3 Oct 2007 14:53:50 -0000       1.154.2.5
@@ -772,23 +772,20 @@
                }
                while ((rd = bstream_next(in)) > 0 && !in->eof) {
                        sum += rd;
-                       if (!in->mode) {/* read one line at a time in line mode 
*/
+                       if (!in->mode) /* read one line at a time in line mode 
*/
                                break;
-                       } else { /* find last new line */
-                               char *p = in->buf+in->len-1;
+               }
+               if (in->mode) { /* find last new line */
+                       char *p = in->buf+in->len-1;
 
-                               while(p > in->buf && *p != '\n') {
-                                       *(p+1) = *p;
-                                       p--;
-                               }
-                               if (p > in->buf) {
-                                       *(p+1) = 0;
-                               } else {
-                                       in->pos++;
-                               }
-                               if (p != in->buf+ in->len -1)
-                                       in->len++;
+                       while(p > in->buf && *p != '\n') {
+                               *(p+1) = *p;
+                               p--;
                        }
+                       if (p > in->buf)
+                               *(p+1) = 0;
+                       if (p != in->buf + in->len -1)
+                               in->len++;
                }
                if (sum == 0 && in->eof && isa_block_stream(in->s)) {
                        /* we hadn't seen the EOF before, so just try again

Index: mal_interpreter.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_interpreter.mx,v
retrieving revision 1.194.2.4
retrieving revision 1.194.2.5
diff -u -d -r1.194.2.4 -r1.194.2.5
--- mal_interpreter.mx  24 Sep 2007 09:41:34 -0000      1.194.2.4
+++ mal_interpreter.mx  3 Oct 2007 14:53:56 -0000       1.194.2.5
@@ -70,6 +70,9 @@
 #include "mal_debugger.h"   /* for mdbStep() */
 #include "mal_type.h"
 
+#define SLOW 1
+#define FAST 0
+
 static str runMALsequence( Client cntxt, MalBlkPtr mb, int startpc, 
                int stoppc, MalStkPtr stk, MalStkPtr env, InstrPtr pcicaller);
 static str setDynamicType(MalBlkPtr mb, VarPtr v, int tpe, int pc);
@@ -421,8 +424,27 @@
        stkpc = startpc;
        exceptionVar = exceptionPC = -1;
        (void)exceptionPC; /* TODO maybe we should use this variable somewhere*/
[EMAIL PROTECTED]
+From this point onwards we should differentiate fast processing
+against monitored processing. Fast processing is possible if there is
+no call to the debugger statically/dynamically set. Same holds for
+performance control statements.
+The code currently does not statically checks the mode change.
+Preferrably we should introduce a itrace flag PROFILE
+We rely on optimizing compilers to remove the redundant code.
[EMAIL PROTECTED]
+       if( malProfileMode == 0 && cntxt->itrace==0){
+               while(stkpc < mb->stop && stkpc != stoppc ){
+                       pci = getInstrPtr(mb,stkpc);
+                       if( malProfileMode + cntxt->itrace)
+                               goto workslow;
+                       @:MALinterpret(FAST)@
+                       @:MALflowofcontrol(FAST)@
+               }
+       } else
        while(stkpc < mb->stop && stkpc != stoppc ){
                pci = getInstrPtr(mb,stkpc);
+workslow:
                if( cntxt->itrace  ) {
                        lng t=0;
                        if( stk->cmd== 0) stk->cmd= cntxt->itrace;
@@ -445,8 +467,8 @@
                }
 
                @:beginProfile@
-               @:MALinterpret@
-               @:MALflowofcontrol@
+               @:MALinterpret(SLOW)@
+               @:MALflowofcontrol(SLOW)@
                @:endProfile@
        }
        @:MALwrapup@
@@ -639,11 +661,11 @@
 limited.
 @c
                switch( pci->token){
-               case ASSIGNsymbol: @:assignStmt@ break;
-               case PATcall: @:patterncall@ break;
-               case CMDcall: @:commandcall@ break;
-               case FACcall: @:factorycall@ break;
-               case FCNcall: @:functioncall@ break;
+               case ASSIGNsymbol: @:assignStmt(SLOW)@ break;
+               case PATcall: @:patterncall(SLOW)@ break;
+               case CMDcall: @:commandcall(SLOW)@ break;
+               case FACcall: @:factorycall(SLOW)@ break;
+               case FCNcall: @:functioncall(SLOW)@ break;
                }
                /* we don't allow sequential flow control here */
                dropMALflowStep(flow,stkpc,n,pending,mb,stk);
@@ -710,22 +732,26 @@
 @= MALinterpret
        ret = 0;
        switch( pci->token){
-       case ASSIGNsymbol: @:assignStmt@ break;
-       case PATcall: @:patterncall@ break;
-       case CMDcall: @:commandcall@ break;
-       case FACcall: @:factorycall@ break;
-       case FCNcall: @:functioncall@ break;
+       case ASSIGNsymbol: @:assignStmt(@1)@ break;
+       case PATcall: @:patterncall(@1)@ break;
+       case CMDcall: @:commandcall(@1)@ break;
+       case FACcall: @:factorycall(@1)@ break;
+       case FCNcall: @:functioncall(@1)@ break;
        case NOOPsymbol:
        case REMsymbol:
                break;
        case ENDsymbol: 
                if( getInstrPtr(mb,0)->token == FACTORYsymbol)
                        ret= shutdownFactory(mb);
+#if @1
                if( oldtimer)
                        cntxt->timer= oldtimer;
+#endif
                if( pcicaller && garbageControl(getInstrPtr(mb,0)) )
                        garbageCollector(mb, stk, TRUE);
+#if @1
                @:endProfile@
+#endif
                stkpc= mb->stop;
                continue;
        default:
@@ -735,7 +761,9 @@
                }
                ret = createScriptException(mb, stkpc,MAL,
                                NULL, "unkown operation");
+#if @1
                @:endProfile@
+#endif
                stkpc= mb->stop;
                continue;
        }
@@ -886,9 +914,10 @@
                if( lhs->vtype == TYPE_bat)
                        BBPincref(lhs->val.br.id, TRUE);
        }
-       @:restoreTarget@
+       @:restoreTarget(@1)@
        ret = 0;
-       @:exceptionHndlr@
+       @:exceptionHndlr(@1)@
+       @:timingHndlr(@1)@
 }
 @}
 @-
@@ -1000,6 +1029,7 @@
                } 
        }
        /* Provide debugging support */
+#if @1
        if( GDKdebug & 10 ){
                BAT *b;
                str oldmsg =0;
@@ -1034,6 +1064,7 @@
                        }
                }
        }
+#endif
 @-
 @= commandcall
 {      
@@ -1146,8 +1177,9 @@
                ret = createScriptException(mb, stkpc, MAL, NULL,
                                "too many arguments for command call");
        }
-       @:restoreTarget@
-       @:exceptionHndlr@
+       @:restoreTarget(@1)@
+       @:exceptionHndlr(@1)@
+       @:timingHndlr(@1)@
 }
 @-
 @= patterncall
@@ -1157,8 +1189,9 @@
        else {
                @:safeTarget@
                ret = (str) (*pci->fcn)(mb,stk,pci);
-               @:restoreTarget@
-               @:exceptionHndlr@
+               @:restoreTarget(@1)@
+               @:exceptionHndlr(@1)@
+               @:timingHndlr(@1)@
        }
 @-
 MAL function calls are relatively expensive, because they have to assemble
@@ -1171,8 +1204,9 @@
        stk->pcup = stkpc;
        @:safeTarget@
        ret= runMAL(cntxt,pci->blk,1,mb,stk,pci);
-       @:restoreTarget@
-       @:exceptionHndlr@
+       @:restoreTarget(@1)@
+       @:exceptionHndlr(@1)@
+       @:timingHndlr(@1)@
 }
 @-
 Factory calls are more involved. At this stage it is a synchrononous
@@ -1184,7 +1218,8 @@
                                "reference to MAL function missing");
        else
                ret= runFactory(cntxt,pci->blk,mb,stk,pci);
-       @:exceptionHndlr@
+       @:exceptionHndlr(@1)@
+       @:timingHndlr(SLOW)@
 @-
 The type dispatching table in getArgValue can be removed if we 
 determine at compile time the address offset within a ValRecord. 
@@ -1323,7 +1358,6 @@
 @{
 
 @= exceptionHndlr
-       @:timingHndlr@
 if( ret != MAL_SUCCEED ) {
        str msg = 0, nxt;
        if( stk->cmd  ) {
@@ -1569,6 +1603,7 @@
 #endif
 
 @= timingHndlr
+#if @1
 if( cntxt->flags && stk->cmd != 't' && stk->cmd != 'C'){
        if( cntxt->flags & timerFlag)
                stream_printf(cntxt->fdout,"[%6d usec ",GDKusec()-cntxt->timer);
@@ -1611,6 +1646,7 @@
        if( cntxt->flags & timerFlag)
                cntxt->timer = GDKusec();
 }
+#endif
 @-
 The bigfoot memory tracker keeps track on the space
 occupancy of BATs. It ignores for the time being the heaps.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to