Changeset: ba0683ce817d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ba0683ce817d
Modified Files:
        gdk/gdk_utils.mx
        monetdb5/mal/mal_interpreter.mx
Branch: Apr2011
Log Message:

Merged from Mar2011


diffs (120 lines):

diff --git a/gdk/ChangeLog.Mar2011 b/gdk/ChangeLog.Mar2011
--- a/gdk/ChangeLog.Mar2011
+++ b/gdk/ChangeLog.Mar2011
@@ -1,3 +1,7 @@
 # ChangeLog file for MonetDB
 # This file is updated with Maddlog
 
+* Tue Mar 22 2011 Fabian Groffen <[email protected]>
+- Fixed memory detection on Darwin (Mac OS X) systems not to return
+  bogus values
+
diff --git a/gdk/gdk_utils.mx b/gdk/gdk_utils.mx
--- a/gdk/gdk_utils.mx
+++ b/gdk/gdk_utils.mx
@@ -465,6 +465,16 @@
 #else
 # if defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE)
        _MT_pagesize = sysconf(_SC_PAGESIZE);
+# else
+#  if defined(HAVE_SYS_SYSCTL_H) && defined(HW_PAGESIZE)
+       {
+               int size;
+               size_t len = sizeof(size);
+
+               sysctlbyname("hw.pagesize", &size, &len, NULL, 0);
+               _MT_pagesize = size;
+       }
+#  endif
 # endif
 #endif
        if (_MT_pagesize <= 0)
@@ -490,14 +500,12 @@
 #  if defined(HAVE_SYSCONF) && defined(_SC_PHYS_PAGES)
        _MT_npages = sysconf(_SC_PHYS_PAGES);
 #  else
-#   if defined(HAVE_SYS_SYSCTL_H) && defined(HW_USERMEM)
+#   if defined(HAVE_SYS_SYSCTL_H) && defined(HW_MEMSIZE)
        {
                uint64_t size;
                size_t len = sizeof(size);
 
-               /* This is the 'non-kernel memory', e.g. what's left to a user
-                * process to allocate. */
-               sysctlbyname("hw.usermem", &size, &len, NULL, 0);
+               sysctlbyname("hw.memsize", &size, &len, NULL, 0);
                _MT_npages = size / _MT_pagesize;
        }
 #   else
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
@@ -1363,11 +1363,11 @@
 {
        int queued = 0, candidates;
        int todo = 0, done = 0;
-       int pc = 0, i, j, oa =0, ia;
-       int limit = flow->stop - flow->start;
+       int pc = 0, i, j, oa =0, ia,k;
+       int limit = flow->stop - flow->start, lookahead =0;
        str ret = MAL_SUCCEED;
        FlowStep fs = (FlowStep)alloca(sizeof(FlowStepRec) * limit), f = 0;
-       InstrPtr p;
+       InstrPtr p, last=0;
 
        if ( limit == 0)
                throw(MAL,"dataflow","Empty dataflow block");
@@ -1427,18 +1427,28 @@
                        /* deblock the output args */
                        for(j=0; j<p->retc; j++) {
                                oa = getArg(p,j);
+                               /* find the last instruction that should be 
inspected for eligibility */
+                               if ( getEndOfLife(flow->mb,oa) > lookahead)
+                                       lookahead = getEndOfLife(flow->mb,oa);
 
                                flow->blocked[oa] = 0;
                                flow->inuse[oa] = 0;
                        }
+                       last = p;
                }
                firststep:
                PARDEBUG if (queued)
                        mnstr_printf(GDKstdout,"#schedule new instructions, 
start from %d\n", pc);
 
+               /* avoid the head of the flow that has already been handled */
                for( ; pc < limit; pc++)
                        if ( fs[pc].status != DFLOWwrapup)
                                break;
+               if (lookahead <= pc)
+                       lookahead = pc+1;
+               if ( lookahead > limit)
+                       lookahead = limit;
+
                if (flow->stk->admit == 0) {
                        @:DFLOWscheduler_body( DFLOWeligible(flow,fs,i,p,pc) )@
                } else {
@@ -1447,11 +1457,13 @@
 @= DFLOWscheduler_body
                /* first try to find an instructions that use the released 
target */
                candidates = 0;
-               for(i = pc; i < limit ; i++)
+               if ( last)
+               for(i = pc; i < lookahead ; i++)
                        if (fs[i].status == DFLOWpending ) {
                                p = getInstrPtr(flow->mb, fs[i].pc);
                                for ( j= p->retc; j < p->argc; j++)
-                                       if ( getArg(p,j)== oa ) {
+                               for ( k= 0; k < last->retc; k++)
+                                       if ( getArg(p,j)== getArg(last,k) ) {
                                                if ( @1 ) {
                                                        queued++;
                                                        todo++;
@@ -1479,7 +1491,7 @@
        PARDEBUG {
                int candidates = 0;
                mnstr_printf(GDKstdout,"#end of data flow %d %d todo %d  done 
%d\n",pc,limit,todo,done);
-               for ( i =0 ; i<limit; i++)
+               for ( i =0 ; i<lookahead; i++)
                        if (fs[i].status != DFLOWwrapup  && fs[i].pc >=0) {
                                mnstr_printf(GDKstdout,"#missed %d %d %d ",  i, 
fs[i].status, fs[i].pc);
                                printInstruction(GDKstdout, flow->mb, 0, 
getInstrPtr(flow->mb,fs[i].pc), LIST_MAL_STMT | LIST_MAPI);
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to