Changeset: 2ee694210ef0 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2ee694210ef0
Modified Files:
        monetdb5/mal/mal_interpreter.mx
        monetdb5/mal/mal_runtime.c
        monetdb5/mal/mal_runtime.h
Branch: default
Log Message:

Fix for bug 3076 and other repairs.
- You really don't have to export every function in sight!
- Inline only makes sense if the inlined function's definition (not
  just declaration) is visible when the calling function is compiled.
- Don't call MT_mallinfo all the time: it's really expensive on
  platforms where it is implemented.
- Correct copyright notices.


diffs (157 lines):

diff --git a/monetdb5/mal/mal_interpreter.mx b/monetdb5/mal/mal_interpreter.mx
--- a/monetdb5/mal/mal_interpreter.mx
+++ b/monetdb5/mal/mal_interpreter.mx
@@ -47,7 +47,6 @@ mal_export str callMAL(Client cntxt, Mal
 mal_export void garbageElement(Client cntxt, ValPtr v);
 mal_export void garbageCollector(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
int flag);
 mal_export void releaseBAT(MalBlkPtr mb, MalStkPtr stk, int bid);
-mal_export lng getVolume(MalStkPtr stk, InstrPtr pci, int rd);
 
 mal_export ptr getArgReference(MalStkPtr stk, InstrPtr pci, int k);
 
@@ -242,7 +241,7 @@ str runMAL(Client cntxt, MalBlkPtr mb, i
        str ret;
        RuntimeProfileRecord runtimeProfile;
 
-       runtimeProfileInit(mb, &runtimeProfile);
+       runtimeProfileInit(mb, &runtimeProfile, cntxt->flags & memoryFlag);
        if (mb->errors) {
                showErrors(cntxt);
                if (cntxt->itrace == 0) /* permit debugger analysis */
@@ -393,7 +392,7 @@ callMAL(Client cntxt, MalBlkPtr mb, MalS
        InstrPtr pci = getInstrPtr(mb, 0);
        RuntimeProfileRecord runtimeProfile;
 
-       runtimeProfileInit(mb, &runtimeProfile);
+       runtimeProfileInit(mb, &runtimeProfile, cntxt->flags & memoryFlag);
 #ifdef DEBUG_CALLMAL
        mnstr_printf(cntxt->fdout, "callMAL\n");
        printInstruction(cntxt->fdout, mb, 0, pci, LIST_MAL_ALL);
@@ -458,7 +457,7 @@ str runMALsequence(Client cntxt, MalBlkP
        int tid = 0;
        RuntimeProfileRecord runtimeProfile;
 
-       runtimeProfileInit(mb, &runtimeProfile);
+       runtimeProfileInit(mb, &runtimeProfile, cntxt->flags & memoryFlag);
        if (stk == NULL)
                throw(MAL, "mal.interpreter", MAL_STACK_FAIL);
        if (cntxt->flags & timerFlag)
@@ -947,7 +946,7 @@ DFLOWstep(FlowTask *t, FlowStatus fs)
        int tid = t->id, prevpc = 0;
        RuntimeProfileRecord runtimeProfile;
 
-       runtimeProfileInit(mb, &runtimeProfile);
+       runtimeProfileInit(mb, &runtimeProfile, cntxt->flags & memoryFlag);
        if (stk == NULL || stkpc < 0)
                throw(MAL, "mal.interpreter", MAL_STACK_FAIL);
 
diff --git a/monetdb5/mal/mal_runtime.c b/monetdb5/mal/mal_runtime.c
--- a/monetdb5/mal/mal_runtime.c
+++ b/monetdb5/mal/mal_runtime.c
@@ -3,19 +3,19 @@
  * Version 1.1 (the "License"); you may not use this file except in
  * compliance with the License. You may obtain a copy of the License at
  * http://www.monetdb.org/Legal/MonetDBLicense
- * 
+ *
  * Software distributed under the License is distributed on an "AS IS"
  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
  * License for the specific language governing rights and limitations
  * under the License.
- * 
+ *
  * The Original Code is the MonetDB Database System.
- * 
+ *
  * The Initial Developer of the Original Code is CWI.
  * Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
- * Copyright August 2008-2011 MonetDB B.V.
+ * Copyright August 2008-2012 MonetDB B.V.
  * All Rights Reserved.
-*/
+ */
 
 /* Author(s) M.L. Kersten
  * The MAL Runtime Profiler
@@ -33,21 +33,24 @@
  * Manage the runtime profiling information
 */
 void
-runtimeProfileInit(MalBlkPtr mb, RuntimeProfile prof)
+runtimeProfileInit(MalBlkPtr mb, RuntimeProfile prof, int initmemory)
 {
        prof->newclk=0;
        prof->ppc= -2;
        prof->tcs = 0;
        prof->inblock = 0;
        prof->oublock = 0;
-       prof->memory = MT_mallinfo();
+       if (initmemory)
+               prof->memory = MT_mallinfo();
+       else
+               memset(&prof->memory, 0, sizeof(prof->memory));
        if (malProfileMode ) {
                setFilterOnBlock(mb, 0, 0);
                prof->ppc = -1;
        }
 }
 
-inline void 
+void
 runtimeProfileBegin(Client cntxt, MalBlkPtr mb, MalStkPtr stk, int stkpc, 
RuntimeProfile prof, int start)
 {
        if( stk && mb->profiler != NULL ){
@@ -73,7 +76,7 @@ runtimeProfileBegin(Client cntxt, MalBlk
 }
 
 
-inline void 
+void
 runtimeProfileExit(Client cntxt, MalBlkPtr mb, MalStkPtr stk, RuntimeProfile 
prof)
 {
        int stkpc = prof->ppc;
diff --git a/monetdb5/mal/mal_runtime.h b/monetdb5/mal/mal_runtime.h
--- a/monetdb5/mal/mal_runtime.h
+++ b/monetdb5/mal/mal_runtime.h
@@ -3,19 +3,19 @@
  * Version 1.1 (the "License"); you may not use this file except in
  * compliance with the License. You may obtain a copy of the License at
  * http://www.monetdb.org/Legal/MonetDBLicense
- * 
+ *
  * Software distributed under the License is distributed on an "AS IS"
  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
  * License for the specific language governing rights and limitations
  * under the License.
- * 
+ *
  * The Original Code is the MonetDB Database System.
- * 
+ *
  * The Initial Developer of the Original Code is CWI.
  * Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
- * Copyright August 2008-2011 MonetDB B.V.
+ * Copyright August 2008-2012 MonetDB B.V.
  * All Rights Reserved.
-*/
+ */
 
 #ifndef _MAL_RUNTIME_H
 #define _MAL_RUNTIME_H
@@ -35,10 +35,10 @@ typedef struct{
        struct Mallinfo memory;
 } *RuntimeProfile, RuntimeProfileRecord;
 
-mal_export void runtimeProfileInit(MalBlkPtr mb, RuntimeProfile prof);
-mal_export void runtimeProfileBegin(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
int stkpc, RuntimeProfile prof, int start);
-mal_export void runtimeProfileExit(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
RuntimeProfile prof);
-mal_export void runtimeTiming(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci, int tid, MT_Lock *lock, RuntimeProfile prof);
-mal_export lng getVolume(MalStkPtr stk, InstrPtr pci, int rd);
-mal_export void displayVolume(Client cntxt, lng vol);
+void runtimeProfileInit(MalBlkPtr mb, RuntimeProfile prof, int initmemory);
+void runtimeProfileBegin(Client cntxt, MalBlkPtr mb, MalStkPtr stk, int stkpc, 
RuntimeProfile prof, int start);
+void runtimeProfileExit(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
RuntimeProfile prof);
+void runtimeTiming(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci, 
int tid, MT_Lock *lock, RuntimeProfile prof);
+lng getVolume(MalStkPtr stk, InstrPtr pci, int rd);
+void displayVolume(Client cntxt, lng vol);
 #endif
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to