Changeset: 2554db2bfd22 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2554db2bfd22
Modified Files:
        monetdb5/mal/mal_dataflow.c
Branch: default
Log Message:

uncrustify


diffs (truncated from 599 to 300 lines):

diff --git a/monetdb5/mal/mal_dataflow.c b/monetdb5/mal/mal_dataflow.c
--- a/monetdb5/mal/mal_dataflow.c
+++ b/monetdb5/mal/mal_dataflow.c
@@ -64,30 +64,30 @@ typedef struct {
 } FlowTask;
 
 typedef struct FLOWSTATUS {
-       Client cntxt;           /* for debugging and client resolution */
-       MalBlkPtr mb;           /* carry the context */
+       Client cntxt;   /* for debugging and client resolution */
+       MalBlkPtr mb;   /* carry the context */
        MalStkPtr stk;
-       int pc;                 /* pc in underlying malblock */
-       int blocks;     /* awaiting for variables */
-       sht state;              /* of execution */
+       int pc;         /* pc in underlying malblock */
+       int blocks;     /* awaiting for variables */
+       sht state;      /* of execution */
        sht cost;
-       lng hotclaim;   /* memory foot print of result variables */
-       lng argclaim;   /* memory foot print of arguments */
+       lng hotclaim;   /* memory foot print of result variables */
+       lng argclaim;   /* memory foot print of arguments */
        str error;
 } *FlowStatus, FlowStatusRec;
 
 typedef struct DataFlow {
-       int start, stop;        /* guarded block under consideration*/
-       FlowStatus status;              /* status of each instruction */
-       int *nodes;                     /* dependency graph nodes */
-       int *edges;                     /* dependency graph */
-       queue *done;            /* work finished */
-       queue *todo;            /* pending actions for this client */
-       int    nway;            /* number of workers */
-       FlowTask *worker;       /* worker threads for the client */
-       struct DataFlow *free;  /* free list */
-       int terminate;                  /* set if we need to terminate */
-       MT_Lock termlock;               /* lock to protect the above */
+    int start, stop;    /* guarded block under consideration*/
+    FlowStatus status;  /* status of each instruction */
+    int *nodes;         /* dependency graph nodes */
+    int *edges;         /* dependency graph */
+    queue *done;        /* work finished */
+    queue *todo;        /* pending actions for this client */
+    int    nway;        /* number of workers */
+    FlowTask *worker;   /* worker threads for the client */
+    struct DataFlow *free; /* free list */
+    int terminate;      /* set if we need to terminate */
+    MT_Lock termlock;   /* lock to protect the above */
 } *DataFlow, DataFlowRec;
 
 /* does not seem to have a major impact */
@@ -145,7 +145,7 @@ DFLOWgraphSize(MalBlkPtr mb, int start, 
 /*
  * The memory claim is the estimate for the amount of memory hold.
  * Views are consider cheap and ignored
-*/
+ */
 lng
 getMemoryClaim(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci, int i, int flag)
 {
@@ -184,8 +184,7 @@ getMemoryClaim(MalBlkPtr mb, MalStkPtr s
  * The hotclaim is a hint how large the result would be.
  */
 #ifdef USE_DFLOW_ADMISSION
-/* experiments on sf-100 on small machine showed no real improvement
-*/
+/* experiments on sf-100 on small machine showed no real improvement */
 int
 DFLOWadmission(lng argclaim, lng hotclaim)
 {
@@ -397,9 +396,9 @@ DFLOWstep(FlowTask *t, FlowStatus fs)
                throw(MAL, "mal.interpreter", MAL_STACK_FAIL);
 
        /* prepare extended backup and garbage structures */
-       if ( mb->maxarg > 16 ){
+       if (mb->maxarg > 16) {
                backup = GDKzalloc(mb->maxarg * sizeof(ValRecord));
-               garbage = (int*)GDKzalloc(mb->maxarg * sizeof(int));
+               garbage = (int *) GDKzalloc(mb->maxarg * sizeof(int));
        } else {
                backup = backups;
                garbage = garbages;
@@ -422,8 +421,10 @@ DFLOWstep(FlowTask *t, FlowStatus fs)
                        /* need a way to skip */
                        stkpc = mb->stop;
                        fs->state = -1;
-                       if ( backup != backups) GDKfree(backup);
-                       if ( garbage != garbages) GDKfree(garbage);
+                       if (backup != backups)
+                               GDKfree(backup);
+                       if (garbage != garbages)
+                               GDKfree(garbage);
                        return ret;
                }
                if (oldtimer) {
@@ -433,17 +434,18 @@ DFLOWstep(FlowTask *t, FlowStatus fs)
                }
        }
 
-       //runtimeProfileBegin(cntxt, mb, stk, stkpc, &runtimeProfile, 0);
+       /*runtimeProfileBegin(cntxt, mb, stk, stkpc, &runtimeProfile, 0);*/
        FREE_EXCEPTION(ret);
        ret = MAL_SUCCEED;
        if (pci->recycle > 0)
                t->clk = GDKusec();
-       if (!RECYCLEentry(cntxt, mb, stk, pci)){
+       if (!RECYCLEentry(cntxt, mb, stk, pci)) {
                runtimeProfileBegin(cntxt, mb, stk, stkpc, &runtimeProfile, 1);
-/*
- * Before we execute an instruction the variables to be garbage collected
- * are identified. In the post-execution phase they are removed.
- */
+               /*
+                * Before we execute an instruction the variables to be garbage
+                * collected are identified. In the post-execution phase they
+                * are removed.
+                */
                if (garbageControl(pci)) {
                        for (i = 0; i < pci->argc; i++) {
                                int a = getArg(pci, i);
@@ -467,8 +469,9 @@ DFLOWstep(FlowTask *t, FlowStatus fs)
                        }
                }
                /*
-                * The number of instructions allowed is severely limited.
-                * We don't allow sequential flow control here, which is 
enforced by the dataflow optimizer;
+                * The number of instructions allowed is severely limited.  We
+                * don't allow sequential flow control here, which is enforced
+                * by the dataflow optimizer;
                 */
                switch (pci->token) {
                case ASSIGNsymbol:
@@ -485,23 +488,23 @@ DFLOWstep(FlowTask *t, FlowStatus fs)
                case PATcall:
                        if (pci->fcn == NULL) {
                                ret = createScriptException(mb, stkpc, MAL, 
NULL,
-                                       "address of pattern %s.%s missing", 
pci->modname, pci->fcnname);
+                                               "address of pattern %s.%s 
missing", pci->modname, pci->fcnname);
                        } else {
-                               ret = (str)(*pci->fcn)(cntxt, mb, stk, pci);
+                               ret = (str) (*pci->fcn)(cntxt, mb, stk, pci);
                        }
                        break;
                case CMDcall:
-                       ret =malCommandCall(stk, pci);
+                       ret = malCommandCall(stk, pci);
                        break;
                case FACcall:
-/*
- * Factory calls are more involved. At this stage it is a synchrononous
- * call to the factory manager.
- * Factory calls should deal with the reference counting.
- */
+                       /*
+                        * Factory calls are more involved. At this stage it is 
a
+                        * synchrononous call to the factory manager.  Factory 
calls
+                        * should deal with the reference counting.
+                        */
                        if (pci->blk == NULL)
                                ret = createScriptException(mb, stkpc, MAL, 
NULL,
-                                       "reference to MAL function missing");
+                                               "reference to MAL function 
missing");
                        else {
                                /* show call before entering the factory */
                                if (cntxt->itrace || mb->trap) {
@@ -519,57 +522,58 @@ DFLOWstep(FlowTask *t, FlowStatus fs)
                                        if (oldtimer) {
                                                /* ignore debugger waiting 
time*/
                                                t = GDKusec() - t;
-                               oldtimer += t;
+                                               oldtimer += t;
                                        }
                                }
                                ret = runFactory(cntxt, pci->blk, mb, stk, pci);
                        }
                        break;
                case FCNcall:
-/*
- * MAL function calls are relatively expensive, because they have to assemble
- * a new stack frame and do housekeeping, such as garbagecollection of all
- * non-returned values.
- */
-                       {       MalStkPtr nstk;
-                               InstrPtr q;
-                               int ii, arg;
+               {
+                       /*
+                        * MAL function calls are relatively expensive, because 
they
+                        * have to assemble a new stack frame and do 
housekeeping,
+                        * such as garbagecollection of all non-returned values.
+                        */
+                       MalStkPtr nstk;
+                       InstrPtr q;
+                       int ii, arg;
 
-                               stk->pcup = stkpc;
-                               nstk = prepareMALstack(pci->blk, 
pci->blk->vsize);
-                               if (nstk == 0){
-                                       ret= 
createException(MAL,"mal.interpreter",MAL_STACK_FAIL);
-                                       break;
-                               }
+                       stk->pcup = stkpc;
+                       nstk = prepareMALstack(pci->blk, pci->blk->vsize);
+                       if (nstk == 0) {
+                               ret = createException(MAL, "mal.interpreter", 
MAL_STACK_FAIL);
+                               break;
+                       }
 
-                               /*safeguardStack*/
-                               nstk->stkdepth = nstk->stksize + stk->stkdepth;
-                               nstk->calldepth = stk->calldepth + 1;
-                               nstk->up = stk;
-                               if (nstk->calldepth > 256){
-                                       ret=createException(MAL, 
"mal.interpreter", MAL_CALLDEPTH_FAIL);
-                                       break;
-                               }
-                               if ((unsigned)nstk->stkdepth > 
THREAD_STACK_SIZE / sizeof(mb->var[0]) / 4 && THRhighwater()){
-                                       /* we are running low on stack space */
-                                       ret= createException(MAL, 
"mal.interpreter", MAL_STACK_FAIL);
-                                       break;
-                               }
+                       /*safeguardStack*/
+                       nstk->stkdepth = nstk->stksize + stk->stkdepth;
+                       nstk->calldepth = stk->calldepth + 1;
+                       nstk->up = stk;
+                       if (nstk->calldepth > 256) {
+                               ret = createException(MAL, "mal.interpreter", 
MAL_CALLDEPTH_FAIL);
+                               break;
+                       }
+                       if ((unsigned) nstk->stkdepth > THREAD_STACK_SIZE / 
sizeof(mb->var[0]) / 4 && THRhighwater()) {
+                               /* we are running low on stack space */
+                               ret = createException(MAL, "mal.interpreter", 
MAL_STACK_FAIL);
+                               break;
+                       }
 
-                               /* copy arguments onto destination stack */
-                               q= getInstrPtr(pci->blk,0);
-                               arg = q->retc;
-                               for (ii = pci->retc; ii < pci->argc; 
ii++,arg++) {
-                                       lhs = &nstk->stk[q->argv[arg]];
-                                       rhs = &stk->stk[pci->argv[ii]];
-                                       VALcopy(lhs, rhs);
-                                       if (lhs->vtype == TYPE_bat)
-                                               BBPincref(lhs->val.bval, TRUE);
-                               }
-                               ret = runMALsequence(cntxt, pci->blk, 1, 
pci->blk->stop, nstk, stk, pci);
-                               GDKfree(nstk);
+                       /* copy arguments onto destination stack */
+                       q = getInstrPtr(pci->blk, 0);
+                       arg = q->retc;
+                       for (ii = pci->retc; ii < pci->argc; ii++, arg++) {
+                               lhs = &nstk->stk[q->argv[arg]];
+                               rhs = &stk->stk[pci->argv[ii]];
+                               VALcopy(lhs, rhs);
+                               if (lhs->vtype == TYPE_bat)
+                                       BBPincref(lhs->val.bval, TRUE);
                        }
-                       break;
+                       ret = runMALsequence(cntxt, pci->blk, 1, 
pci->blk->stop, nstk, stk, pci);
+                       GDKfree(nstk);
+               }
+               break;
                case NOOPsymbol:
                case REMsymbol:
                        break;
@@ -579,11 +583,11 @@ DFLOWstep(FlowTask *t, FlowStatus fs)
                                break;
                        }
                        ret = createScriptException(mb, stkpc, MAL,
-                               NULL, "unkown operation");
+                                       NULL, "unkown operation");
                }
                if (pci->token != FACcall) {
                        /* Provide debugging support */
-                       if (GDKdebug & (CHECKMASK|PROPMASK) && exceptionVar < 
0) {
+                       if (GDKdebug & (CHECKMASK | PROPMASK) && exceptionVar < 
0) {
                                BAT *b;
 
                                for (i = 0; i < pci->retc; i++) {
@@ -698,17 +702,17 @@ DFLOWstep(FlowTask *t, FlowStatus fs)
                        msg = strchr(ret, ':');
                        if (msg) {
                                *msg = 0;
-                               exceptionVar = findVariableLength(mb, ret, 
(int)(msg - ret));
+                               exceptionVar = findVariableLength(mb, ret, 
(int) (msg - ret));
                                *msg = ':';
                        }
                        if (exceptionVar == -1)
-                               exceptionVar = findVariableLength(mb, 
(str)"ANYexception", 12);
+                               exceptionVar = findVariableLength(mb, (str) 
"ANYexception", 12);
 
                        /* unknown exceptions lead to propagation */
                        if (exceptionVar == -1) {
                                runtimeProfileExit(cntxt, mb, stk, 
&runtimeProfile);
                                if (cntxt->qtimeout && time(NULL) - 
stk->clock.tv_usec > cntxt->qtimeout)
-                                       ret= createException(MAL, 
"mal.interpreter", RUNTIME_QRY_TIMEOUT);
+                                       ret = createException(MAL, 
"mal.interpreter", RUNTIME_QRY_TIMEOUT);
                                stkpc = mb->stop;
                                fs->pc = -fs->pc;
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to