Changeset: 1ac0fa4aa52d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1ac0fa4aa52d
Modified Files:
gdk/gdk_utils.c
monetdb5/modules/kernel/batcalc.mal
monetdb5/modules/kernel/batcalc.mal.sh
Branch: default
Log Message:
Merge with Jul2012 branch.
diffs (truncated from 690 to 300 lines):
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -316,16 +316,10 @@ int GDK_vm_trim = 1;
static volatile size_t GDK_mallocedbytes_estimate = 0;
static volatile size_t GDK_vm_cursize = 0;
-#ifndef NDEBUG
static MT_Lock mbyteslock;
-#define malloc_lock() gdk_set_lock(mbyteslock, "malloc")
-#define malloc_unlock() gdk_unset_lock(mbyteslock, "malloc");
-#define malloc_lock_init() MT_lock_init(&mbyteslock, "mbyteslock")
-#else
-#define malloc_lock()
-#define malloc_unlock()
-#define malloc_lock_init()
-#endif
+#define malloc_lock(func) gdk_set_lock(mbyteslock, func)
+#define malloc_unlock(func) gdk_unset_lock(mbyteslock, func);
+#define malloc_lock_init() MT_lock_init(&mbyteslock, "mbyteslock")
size_t _MT_pagesize = 0; /* variable holding memory size */
size_t _MT_npages = 0; /* variable holding page size */
@@ -441,9 +435,9 @@ GDKmem_inuse(void)
/* RAM/swapmem that Monet is really using now */
size_t mem_mallocedbytes_estimate;
- malloc_lock();
+ malloc_lock("GDKmem_inuse");
mem_mallocedbytes_estimate = GDK_mallocedbytes_estimate;
- malloc_unlock();
+ malloc_unlock("GDKmem_inuse");
return mem_mallocedbytes_estimate;
}
@@ -454,9 +448,9 @@ GDKvm_cursize(void)
/* current Monet VM address space usage */
size_t vm_cursize;
- gdk_set_lock(GDKthreadLock, "GDKvm_cursize");
+ malloc_lock("GDKvm_cursize");
vm_cursize = GDK_vm_cursize;
- gdk_unset_lock(GDKthreadLock, "GDKvm_cursize");
+ malloc_unlock("GDKvm_cursize");
return vm_cursize + GDKmem_inuse();
}
@@ -485,18 +479,18 @@ GDKmem_heapcheck(int t)
do { \
int _idx; \
\
- malloc_lock(); \
+ malloc_lock("heapinc"); \
GDK_mallocedbytes_estimate += (_memdelta); \
GDKmallidx(_idx, _memdelta); \
GDK_nmallocs[_idx]++; \
- malloc_unlock(); \
+ malloc_unlock("heapinc"); \
} while (0)
#define heapdec(memdelta) \
do { \
size_t _memdelta = (size_t) (memdelta); \
int _idx; \
\
- malloc_lock(); \
+ malloc_lock("heapdec"); \
if (_memdelta > GDK_mallocedbytes_estimate) { \
/* clearly, the stats are off: it should never \
* become less-than-zero */ \
@@ -506,19 +500,19 @@ GDKmem_heapcheck(int t)
} \
GDKmallidx(_idx, _memdelta); \
GDK_nmallocs[_idx]--; \
- malloc_unlock(); \
+ malloc_unlock("heapdec"); \
} while (0)
#else
#define heapinc(_memdelta) \
do { \
- malloc_lock(); \
+ malloc_lock("heapinc"); \
GDK_mallocedbytes_estimate += (_memdelta); \
- malloc_unlock(); \
+ malloc_unlock("heapinc"); \
} while (0)
#define heapdec(memdelta) \
do { \
size_t _memdelta = (size_t) (memdelta); \
- malloc_lock(); \
+ malloc_lock("heapdec"); \
if (_memdelta > GDK_mallocedbytes_estimate) { \
/* clearly, the stats are off: it should never \
* become less-than-zero */ \
@@ -526,7 +520,7 @@ GDKmem_heapcheck(int t)
} else { \
GDK_mallocedbytes_estimate -= _memdelta; \
} \
- malloc_unlock(); \
+ malloc_unlock("heapdec"); \
} while (0)
#endif
@@ -536,45 +530,45 @@ GDKmem_heapcheck(int t)
size_t _vmdelta = (size_t) SEG_SIZE((vmdelta),MT_VMUNITLOG); \
int _idx; \
\
- gdk_set_lock(GDKthreadLock, fcn); \
+ malloc_lock(fcn); \
GDKmallidx(_idx, _vmdelta); \
GDK_vm_nallocs[_idx]++; \
GDK_vm_cursize += _vmdelta; \
- gdk_unset_lock(GDKthreadLock, fcn); \
+ malloc_unlock(fcn); \
} while (0)
#define memdec(vmdelta, fcn) \
do { \
size_t _vmdelta = (size_t) SEG_SIZE((vmdelta),MT_VMUNITLOG); \
int _idx; \
\
- gdk_set_lock(GDKthreadLock, fcn); \
+ malloc_lock(fcn); \
GDKmallidx(_idx, _vmdelta); \
GDK_vm_nallocs[_idx]--; \
if (_vmdelta > GDK_vm_cursize) \
GDK_vm_cursize = 0; \
else \
GDK_vm_cursize -= _vmdelta; \
- gdk_unset_lock(GDKthreadLock, fcn); \
+ malloc_unlock(fcn); \
} while (0)
#else
#define meminc(vmdelta, fcn) \
do { \
size_t _vmdelta = (size_t) SEG_SIZE((vmdelta),MT_VMUNITLOG); \
\
- gdk_set_lock(GDKthreadLock, fcn); \
+ malloc_lock(fcn); \
GDK_vm_cursize += _vmdelta; \
- gdk_unset_lock(GDKthreadLock, fcn); \
+ malloc_unlock(fcn); \
} while (0)
#define memdec(vmdelta, fcn) \
do { \
size_t _vmdelta = (size_t) SEG_SIZE((vmdelta),MT_VMUNITLOG); \
\
- gdk_set_lock(GDKthreadLock, fcn); \
+ malloc_lock(fcn); \
if (_vmdelta > GDK_vm_cursize) \
GDK_vm_cursize = 0; \
else \
GDK_vm_cursize -= _vmdelta; \
- gdk_unset_lock(GDKthreadLock, fcn); \
+ malloc_unlock(fcn); \
} while (0)
#endif
@@ -598,28 +592,28 @@ GDKmemdump(void)
{
int i;
- malloc_lock();
+ malloc_lock("GDKmemdump");
THRprintf(GDKstdout, "#memory histogram\n");
for (i = 3; i < GDK_HISTO_MAX_BIT - 1; i++) {
size_t j = 1 << i;
THRprintf(GDKstdout, "# " SZFMT " " SZFMT "\n", j,
GDK_nmallocs[i]);
}
- malloc_unlock();
+ malloc_unlock("GDKmemdump");
}
#endif
#ifdef GDK_VM_KEEPHISTO
{
int i;
- gdk_set_lock(GDKthreadLock, "GDKmemdump");
+ malloc_lock("GDKmemdump");
THRprintf(GDKstdout, "\n#virtual memory histogram\n");
for (i = 12; i < GDK_HISTO_MAX_BIT - 1; i++) {
size_t j = 1 << i;
THRprintf(GDKstdout, "# " SZFMT " " SZFMT "\n", j,
GDK_vm_nallocs[i]);
}
- gdk_unset_lock(GDKthreadLock, "GDKmemdump");
+ malloc_unlock("GDKmemdump");
}
#endif
}
diff --git a/monetdb5/modules/kernel/batcalc.mal
b/monetdb5/modules/kernel/batcalc.mal
--- a/monetdb5/modules/kernel/batcalc.mal
+++ b/monetdb5/modules/kernel/batcalc.mal
@@ -368,7 +368,7 @@ pattern +(b:bat[:oid,:bte],v:bte) :bat[:
address CMDbatADDcstenlarge
comment "Return B + V, guarantee no overflow by returning larger type";
pattern +(v:bte,b:bat[:oid,:bte]) :bat[:oid,:sht]
-address CMDbatADDcstsignal
+address CMDbatADDcstenlarge
comment "Return V + B, guarantee no overflow by returning larger type";
command +(b1:bat[:oid,:bte],b2:bat[:oid,:sht]) :bat[:oid,:int]
@@ -378,7 +378,7 @@ pattern +(b:bat[:oid,:bte],v:sht) :bat[:
address CMDbatADDcstenlarge
comment "Return B + V, guarantee no overflow by returning larger type";
pattern +(v:bte,b:bat[:oid,:sht]) :bat[:oid,:int]
-address CMDbatADDcstsignal
+address CMDbatADDcstenlarge
comment "Return V + B, guarantee no overflow by returning larger type";
command +(b1:bat[:oid,:bte],b2:bat[:oid,:int]) :bat[:oid,:lng]
@@ -388,7 +388,7 @@ pattern +(b:bat[:oid,:bte],v:int) :bat[:
address CMDbatADDcstenlarge
comment "Return B + V, guarantee no overflow by returning larger type";
pattern +(v:bte,b:bat[:oid,:int]) :bat[:oid,:lng]
-address CMDbatADDcstsignal
+address CMDbatADDcstenlarge
comment "Return V + B, guarantee no overflow by returning larger type";
command +(b1:bat[:oid,:bte],b2:bat[:oid,:flt]) :bat[:oid,:dbl]
@@ -398,7 +398,7 @@ pattern +(b:bat[:oid,:bte],v:flt) :bat[:
address CMDbatADDcstenlarge
comment "Return B + V, guarantee no overflow by returning larger type";
pattern +(v:bte,b:bat[:oid,:flt]) :bat[:oid,:dbl]
-address CMDbatADDcstsignal
+address CMDbatADDcstenlarge
comment "Return V + B, guarantee no overflow by returning larger type";
command +(b1:bat[:oid,:sht],b2:bat[:oid,:bte]) :bat[:oid,:int]
@@ -408,7 +408,7 @@ pattern +(b:bat[:oid,:sht],v:bte) :bat[:
address CMDbatADDcstenlarge
comment "Return B + V, guarantee no overflow by returning larger type";
pattern +(v:sht,b:bat[:oid,:bte]) :bat[:oid,:int]
-address CMDbatADDcstsignal
+address CMDbatADDcstenlarge
comment "Return V + B, guarantee no overflow by returning larger type";
command +(b1:bat[:oid,:sht],b2:bat[:oid,:sht]) :bat[:oid,:int]
@@ -418,7 +418,7 @@ pattern +(b:bat[:oid,:sht],v:sht) :bat[:
address CMDbatADDcstenlarge
comment "Return B + V, guarantee no overflow by returning larger type";
pattern +(v:sht,b:bat[:oid,:sht]) :bat[:oid,:int]
-address CMDbatADDcstsignal
+address CMDbatADDcstenlarge
comment "Return V + B, guarantee no overflow by returning larger type";
command +(b1:bat[:oid,:sht],b2:bat[:oid,:int]) :bat[:oid,:lng]
@@ -428,7 +428,7 @@ pattern +(b:bat[:oid,:sht],v:int) :bat[:
address CMDbatADDcstenlarge
comment "Return B + V, guarantee no overflow by returning larger type";
pattern +(v:sht,b:bat[:oid,:int]) :bat[:oid,:lng]
-address CMDbatADDcstsignal
+address CMDbatADDcstenlarge
comment "Return V + B, guarantee no overflow by returning larger type";
command +(b1:bat[:oid,:sht],b2:bat[:oid,:flt]) :bat[:oid,:dbl]
@@ -438,7 +438,7 @@ pattern +(b:bat[:oid,:sht],v:flt) :bat[:
address CMDbatADDcstenlarge
comment "Return B + V, guarantee no overflow by returning larger type";
pattern +(v:sht,b:bat[:oid,:flt]) :bat[:oid,:dbl]
-address CMDbatADDcstsignal
+address CMDbatADDcstenlarge
comment "Return V + B, guarantee no overflow by returning larger type";
command +(b1:bat[:oid,:int],b2:bat[:oid,:bte]) :bat[:oid,:lng]
@@ -448,7 +448,7 @@ pattern +(b:bat[:oid,:int],v:bte) :bat[:
address CMDbatADDcstenlarge
comment "Return B + V, guarantee no overflow by returning larger type";
pattern +(v:int,b:bat[:oid,:bte]) :bat[:oid,:lng]
-address CMDbatADDcstsignal
+address CMDbatADDcstenlarge
comment "Return V + B, guarantee no overflow by returning larger type";
command +(b1:bat[:oid,:int],b2:bat[:oid,:sht]) :bat[:oid,:lng]
@@ -458,7 +458,7 @@ pattern +(b:bat[:oid,:int],v:sht) :bat[:
address CMDbatADDcstenlarge
comment "Return B + V, guarantee no overflow by returning larger type";
pattern +(v:int,b:bat[:oid,:sht]) :bat[:oid,:lng]
-address CMDbatADDcstsignal
+address CMDbatADDcstenlarge
comment "Return V + B, guarantee no overflow by returning larger type";
command +(b1:bat[:oid,:int],b2:bat[:oid,:int]) :bat[:oid,:lng]
@@ -468,7 +468,7 @@ pattern +(b:bat[:oid,:int],v:int) :bat[:
address CMDbatADDcstenlarge
comment "Return B + V, guarantee no overflow by returning larger type";
pattern +(v:int,b:bat[:oid,:int]) :bat[:oid,:lng]
-address CMDbatADDcstsignal
+address CMDbatADDcstenlarge
comment "Return V + B, guarantee no overflow by returning larger type";
command +(b1:bat[:oid,:int],b2:bat[:oid,:flt]) :bat[:oid,:dbl]
@@ -478,7 +478,7 @@ pattern +(b:bat[:oid,:int],v:flt) :bat[:
address CMDbatADDcstenlarge
comment "Return B + V, guarantee no overflow by returning larger type";
pattern +(v:int,b:bat[:oid,:flt]) :bat[:oid,:dbl]
-address CMDbatADDcstsignal
+address CMDbatADDcstenlarge
comment "Return V + B, guarantee no overflow by returning larger type";
command +(b1:bat[:oid,:lng],b2:bat[:oid,:flt]) :bat[:oid,:dbl]
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list