Changeset: b596a6d0fc12 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b596a6d0fc12
Modified Files:
        monetdb5/mal/Tests/tst1200.mal
        monetdb5/mal/Tests/tst1200.stable.out
        monetdb5/mal/Tests/tst1205.mal
        monetdb5/mal/Tests/tst1205.stable.out
        monetdb5/mal/Tests/tst2510.mal
        monetdb5/mal/Tests/tst2510.stable.out
        monetdb5/modules/kernel/alarm.c
        monetdb5/modules/kernel/alarm.mal
        monetdb5/modules/kernel/bat5.c
        monetdb5/modules/kernel/bat5.h
        monetdb5/modules/kernel/bat5.mal
        monetdb5/modules/mal/Tests/inspect05.stable.out.int128
        monetdb5/modules/mal/batExtensions.mal
        monetdb5/optimizer/opt_dataflow.c
        monetdb5/scheduler/Tests/memo01.mal
        monetdb5/scheduler/Tests/memo01.stable.out
        monetdb5/scheduler/Tests/memo02.mal
        monetdb5/scheduler/Tests/memo02.stable.out
        monetdb5/tests/suite_00/Tests/test_15.mal
        monetdb5/tests/suite_00/Tests/test_15.stable.out
Branch: default
Log Message:

merged


diffs (truncated from 971 to 300 lines):

diff --git a/monetdb5/mal/Tests/tst1200.mal b/monetdb5/mal/Tests/tst1200.mal
--- a/monetdb5/mal/Tests/tst1200.mal
+++ b/monetdb5/mal/Tests/tst1200.mal
@@ -511,7 +511,7 @@ io.print("daytime_bat,bh_a,dh_a,fh_a,hh_
 ## create timestamps in bulk from the above bats with dates, daytimes and 
tzones
 # Skipped due to coercion implication
        kh_a:bat[:oid,:timestamp] := 
mal.multiplex("mtime","timestamp",date_bat,daytime_bat,tzone_bat);
-       timestamp_bat:=kh_a; bat.setWriteMode(kh_a);
+       timestamp_bat:=kh_a; bat.setAccess(kh_a,"w");
 #var timestamp_bat := 
[timestamp](date_bat,daytime_bat,tzone_bat).access(BAT_WRITE);
 ## KILL
 ## var timestamp_now := timestamp(epoch());
diff --git a/monetdb5/mal/Tests/tst1200.stable.out 
b/monetdb5/mal/Tests/tst1200.stable.out
--- a/monetdb5/mal/Tests/tst1200.stable.out
+++ b/monetdb5/mal/Tests/tst1200.stable.out
@@ -1064,7 +1064,7 @@ exit lf_a;
 # Skipped due to coercion implication 
     kh_a:bat[:oid,:timestamp]  := 
mal.manifold("mtime","timestamp",date_bat,daytime_bat,tzone_bat);
     timestamp_bat := kh_a;
-    bat.setWriteMode(kh_a);
+    bat.setAccess(kh_a,"w");
 #var timestamp_bat := 
[timestamp](date_bat,daytime_bat,tzone_bat).access(BAT_WRITE); 
 ## KILL 
 ## var timestamp_now := timestamp(epoch()); 
diff --git a/monetdb5/mal/Tests/tst1205.mal b/monetdb5/mal/Tests/tst1205.mal
--- a/monetdb5/mal/Tests/tst1205.mal
+++ b/monetdb5/mal/Tests/tst1205.mal
@@ -329,6 +329,6 @@ io.print("daytime_bat,bh_a,dh_a,fh_a,hh_
 ## create timestamps in bulk from the above bats with dates, daytimes and 
tzones
 # Skipped due to coercion implication
        kh_a:bat[:oid,:timestamp] := 
mal.multiplex("mtime","timestamp",date_bat,daytime_bat,tzone_bat);
-       timestamp_bat:=kh_a; bat.setWriteMode(kh_a);
+       timestamp_bat:=kh_a; bat.setAccess(kh_a,"w");
 #var timestamp_bat := 
[timestamp](date_bat,daytime_bat,tzone_bat).access(BAT_WRITE);
 ## KILL
diff --git a/monetdb5/mal/Tests/tst1205.stable.out 
b/monetdb5/mal/Tests/tst1205.stable.out
--- a/monetdb5/mal/Tests/tst1205.stable.out
+++ b/monetdb5/mal/Tests/tst1205.stable.out
@@ -666,7 +666,7 @@ exit lf_a;
 # Skipped due to coercion implication 
     kh_a:bat[:oid,:timestamp]  := 
mal.manifold("mtime","timestamp",date_bat,daytime_bat,tzone_bat);
     timestamp_bat := kh_a;
-    bat.setWriteMode(kh_a);
+    bat.setAccess(kh_a,"w");
 #var timestamp_bat := 
[timestamp](date_bat,daytime_bat,tzone_bat).access(BAT_WRITE); 
 ## KILL 
 end main;
diff --git a/monetdb5/mal/Tests/tst2510.mal b/monetdb5/mal/Tests/tst2510.mal
--- a/monetdb5/mal/Tests/tst2510.mal
+++ b/monetdb5/mal/Tests/tst2510.mal
@@ -2,7 +2,7 @@
 
 factory tryme():bit;
        b:= bat.new(:oid,:int);
-    bat.setWriteMode(b);
+    bat.setAccess(b,"w");
 barrier always:= true;
     yield always;
     redo always;
diff --git a/monetdb5/mal/Tests/tst2510.stable.out 
b/monetdb5/mal/Tests/tst2510.stable.out
--- a/monetdb5/mal/Tests/tst2510.stable.out
+++ b/monetdb5/mal/Tests/tst2510.stable.out
@@ -27,7 +27,7 @@ stdout of test 'tst2510` in directory 'm
 #end tryme;
 factory user.tryme():bit;
     b := bat.new(:oid,:int);
-    bat.setWriteMode(b);
+    bat.setAccess(b,"w");
 barrier always := true;
     yield tryme := always;
     redo always;
diff --git a/monetdb5/modules/kernel/alarm.c b/monetdb5/modules/kernel/alarm.c
--- a/monetdb5/modules/kernel/alarm.c
+++ b/monetdb5/modules/kernel/alarm.c
@@ -47,7 +47,7 @@ alarm_export str ALARMepilogue(void *ret
 alarm_export str ALARMusec(lng *ret);
 alarm_export str ALARMsleep(void *res, int *secs);
 alarm_export str ALARMsetalarm(void *res, int *secs, str *action);
-alarm_export str ALARMtimers(bat *res);
+alarm_export str ALARMtimers(bat *res, bat *actions);
 alarm_export str ALARMctime(str *res);
 alarm_export str ALARMepoch(int *res);
 alarm_export str ALARMtime(int *res);
@@ -82,9 +82,8 @@ CLKsignal(int nr)
 
        (void) nr;
 
-       if (signal(SIGALRM, CLKsignal) == SIG_ERR) {
+       if (signal(SIGALRM, CLKsignal) == SIG_ERR) 
                GDKsyserror("CLKsignal: call failed\n");
-       }
 
        if (timerTop == 0) {
                return;
@@ -178,9 +177,10 @@ ALARMsetalarm(void *res, int *secs, str 
 }
 
 str
-ALARMtimers(bat *res)
+ALARMtimers(bat *res, bat *actions)
 {
        (void) res;             /* fool compiler */
+       (void) actions;         /* fool compiler */
        throw(MAL, "alarm.timers", PROGRAM_NYI);
 }
 
diff --git a/monetdb5/modules/kernel/alarm.mal 
b/monetdb5/modules/kernel/alarm.mal
--- a/monetdb5/modules/kernel/alarm.mal
+++ b/monetdb5/modules/kernel/alarm.mal
@@ -17,33 +17,41 @@
 
 module alarm;
 
-command sleep(secs:int):void
+command alarm.sleep{unsafe}(secs:int):void
 address ALARMsleep
-comment "sleep X secs";
-command alarm(secs:int, action:str):void
-address ALARMsetalarm
-comment "execute action in X secs";
-command timers{unsafe}() :bat[:str,:str]
-address ALARMtimers
-comment "give a list of all active timers";
-command usec{unsafe}() :lng
+comment "Sleep a few seconds";
+
+#command alarm.action(secs:int, action:str):void
+#address ALARMsetalarm
+#comment "Execute a MAL action after a few secs. NYI";
+
+#command alarm.timers{unsafe}() (time:bat[:oid,:str],action:bat[:oid,:str])
+#address ALARMtimers
+#comment "Give the list of all active timers. NYI";
+
+command alarm.usec{unsafe}() :lng
 address ALARMusec
-comment "return cpu microseconds info";
-command time{unsafe}() :int
+comment "Return time in microseconds.";
+
+command alarm.time{unsafe}() :int
 address ALARMtime
-comment "time in millisecs";
-command epoch{unsafe}() :int
+comment "Return time in milliseconds.";
+
+command alarm.epoch{unsafe}() :int
 address ALARMepoch
-comment "current time as unix epoch";
-command ctime{unsafe}() :str
+comment "Return the current time as UNIX epoch.";
+
+command alarm.ctime{unsafe}() :str
 address ALARMctime
-comment "current time as a string";
-command prelude():void
+comment "Return the current time as a C-time string.";
+
+command alarm.prelude():void
 address ALARMprelude
-comment "Initialize alarm module";
-command epilogue():void
+comment "Initialize alarm module.";
+
+command alarm.epilogue():void
 address ALARMepilogue
-comment "Finalize alarm module";
+comment "Finalize alarm module.";
 
 alarm.prelude();
 
diff --git a/monetdb5/modules/kernel/bat5.c b/monetdb5/modules/kernel/bat5.c
--- a/monetdb5/modules/kernel/bat5.c
+++ b/monetdb5/modules/kernel/bat5.c
@@ -343,73 +343,6 @@ CMDinfo(BAT **ret1, BAT **ret2, BAT *b)
        return GDK_SUCCEED;
 }
 
-#define ROUND_UP(x,y) ((y)*(((x)+(y)-1)/(y)))
-
-static int
-CMDbatdisksize(lng *tot, BAT *b)
-{
-       size_t blksize = 512;
-       size_t size = 0;
-
-       if (!isVIEW(b)) {
-               size += ROUND_UP(b->H->heap.free, blksize);
-               size += ROUND_UP(b->T->heap.free, blksize);
-               if (b->H->vheap)
-                       size += ROUND_UP(b->H->vheap->free, blksize);
-               if (b->T->vheap)
-                       size += ROUND_UP(b->T->vheap->free, blksize);
-       }
-       *tot = size;
-       return GDK_SUCCEED;
-}
-
-static int
-CMDbatvmsize(lng *tot, BAT *b)
-{
-       size_t blksize = MT_pagesize();
-       size_t size = 0;
-
-       if (!isVIEW(b)) {
-               BUN cnt = BATcapacity(b);
-
-               size += ROUND_UP(b->H->heap.size, blksize);
-               size += ROUND_UP(b->T->heap.size, blksize);
-               if (b->H->vheap)
-                       size += ROUND_UP(b->H->vheap->size, blksize);
-               if (b->T->vheap)
-                       size += ROUND_UP(b->T->vheap->size, blksize);
-               if (b->H->hash)
-                       size += ROUND_UP(sizeof(BUN) * cnt, blksize);
-               if (b->T->hash)
-                       size += ROUND_UP(sizeof(BUN) * cnt, blksize);
-       }
-       *tot = size;
-       return GDK_SUCCEED;
-}
-
-static int
-CMDbatsize(lng *tot, BAT *b, int force)
-{
-       size_t size = 0;
-
-       if ( force || !isVIEW(b)) {
-               BUN cnt = BATcapacity(b);
-
-               size += b->H->heap.size;
-               size += b->T->heap.size;
-               if (b->H->vheap)
-                       size += b->H->vheap->size;
-               if (b->T->vheap)
-                       size += b->T->vheap->size;
-               if (b->H->hash)
-                       size += sizeof(BUN) * cnt;
-               if (b->T->hash)
-                       size += sizeof(BUN) * cnt;
-       }
-       *tot = size;
-       return GDK_SUCCEED;
-}
-
 /*
  * BBP Management, IO
  */
@@ -1248,7 +1181,7 @@ BKCsetkey(bat *res, const bat *bid, cons
        if ((b = BATdescriptor(*bid)) == NULL) {
                throw(MAL, "bat.setKey", RUNTIME_OBJECT_MISSING);
        }
-       BATkey(b, *param ? BOUND2BTRUE :FALSE);
+       BATkey(BATmirror(b), *param ? BOUND2BTRUE :FALSE);
        *res = b->batCacheid;
        BBPkeepref(b->batCacheid);
        return MAL_SUCCEED;
@@ -1262,7 +1195,7 @@ BKCisSorted(bit *res, const bat *bid)
        if ((b = BATdescriptor(*bid)) == NULL) {
                throw(MAL, "bat.isSorted", RUNTIME_OBJECT_MISSING);
        }
-       *res = BATordered(b);
+       *res = BATordered(BATmirror(b));
        BBPreleaseref(b->batCacheid);
        return MAL_SUCCEED;
 }
@@ -1275,7 +1208,7 @@ BKCisSortedReverse(bit *res, const bat *
        if ((b = BATdescriptor(*bid)) == NULL) {
                throw(MAL, "bat.isSorted", RUNTIME_OBJECT_MISSING);
        }
-       *res = BATordered_rev(b);
+       *res = BATordered_rev(BATmirror(b));
        BBPreleaseref(b->batCacheid);
        return MAL_SUCCEED;
 }
@@ -1291,21 +1224,15 @@ BKCgetKey(bit *ret, const bat *bid)
 {
        BAT *b;
 
-       if ((b = BATdescriptor(*bid)) == NULL) {
+       if ((b = BATdescriptor(*bid)) == NULL) 
                throw(MAL, "bat.setPersistence", RUNTIME_OBJECT_MISSING);
-       }
-       /* we must take care of the special case of a nil column
-        * (TYPE_void,seqbase=nil): such nil columns never set hkey (and
-        * BUNins will never invalidate it if set) yet a nil column of a
-        * BAT with <= 1 entries does not contain doubles => return TRUE.
-        */
        if (BATcount(b) <= 1) {
                *ret = TRUE;
        } else {
-               if (!b->hkey) {
-                       BATderiveHeadProps(b, 1);
+               if (!b->tkey) {
+                       BATderiveHeadProps(BATmirror(b), 1);
                }
-               *ret = b->hkey ? TRUE : FALSE;
+               *ret = b->tkey ? TRUE : FALSE;
        }
        BBPreleaseref(b->batCacheid);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to