Changeset: c99b01e208dd for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c99b01e208dd
Modified Files:
        gdk/gdk.h
        gdk/gdk_atoms.c
        gdk/gdk_atoms.h
        gdk/gdk_heap.c
        gdk/gdk_private.h
        gdk/gdk_storage.c
        monetdb5/mal/mal_atom.c
Branch: default
Log Message:

Removed atomHeapConvert and atomHeapCheck with attendant code.
Unused stuff.

NOTE: complete recompilation is required.


diffs (truncated from 422 to 300 lines):

diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1037,8 +1037,6 @@ gdk_export size_t HEAPmemsize(Heap *h);
  * HEAP_private     (Heap* h)
  * @item void
  * HEAP_printstatus (Heap* h)
- * @item void
- * HEAP_check       (Heap* h)
  * @end table
  *
  * The heap space starts with a private space that is left untouched
@@ -1048,16 +1046,6 @@ gdk_export size_t HEAPmemsize(Heap *h);
  * previously allocated chunk HEAP_private returns an integer index to
  * private space.
  */
-/* structure used by HEAP_check functions */
-typedef struct {
-       size_t minpos;          /* minimum block byte-index */
-       size_t maxpos;          /* maximum block byte-index */
-       int alignment;          /* block index alignment */
-       int *validmask;         /* bitmap with all valid byte-indices
-                                * first bit corresponds with 'minpos';
-                                * 2nd bit with 'minpos+alignment', etc
-                                */
-} HeapRepair;
 
 gdk_export void HEAP_initialize(
        Heap *heap,             /* nbytes -- Initial size of the heap. */
@@ -1946,10 +1934,6 @@ gdk_export BAT *BBPquickdesc(bat b, int 
  * @tab ATOMunfix       (int id, ptr v);
  * @item int
  * @tab ATOMheap        (int id, Heap *hp, size_t cap);
- * @item void
- * @tab ATOMheapconvert (int id, Heap *hp, int direction);
- * @item int
- * @tab ATOMheapcheck   (int id, Heap *hp, HeapRepair *hr);
  * @item int
  * @tab ATOMput         (int id, Heap *hp, BUN pos_dst, ptr val_src);
  * @item int
@@ -2089,9 +2073,6 @@ typedef struct {
        void (*atomDel) (Heap *, var_t *atom);
        int (*atomLen) (const void *atom);
        void (*atomHeap) (Heap *, size_t);
-       /* optional functions */
-       void (*atomHeapConvert) (Heap *, int direction);
-       int (*atomHeapCheck) (Heap *, HeapRepair *);
 } atomDesc;
 
 gdk_export atomDesc BATatoms[];
diff --git a/gdk/gdk_atoms.c b/gdk/gdk_atoms.c
--- a/gdk/gdk_atoms.c
+++ b/gdk/gdk_atoms.c
@@ -236,10 +236,6 @@ ATOMproperty(str id, str property, GDKfc
                        BATatoms[t].varsized = 1;
                        BATatoms[t].align = sizeof(var_t);
                        atomset(BATatoms[t].atomHeap, (void (*)(Heap *, 
size_t)) arg);
-               } else if (strcmp("heapconvert", property) == 0) {
-                       atomset(BATatoms[t].atomHeapConvert, (void (*)(Heap *, 
int)) arg);
-               } else if (strcmp("check", property) == 0) {
-                       atomset(BATatoms[t].atomHeapCheck, (int (*)(Heap *, 
HeapRepair *)) arg);
                } else if (strcmp("del", property) == 0) {
                        atomset(BATatoms[t].atomDel, (void (*)(Heap *, var_t 
*)) arg);
                } else if (strcmp("put", property) == 0) {
@@ -1752,7 +1748,6 @@ atomDesc BATatoms[MAXATOMS] = {
 #endif
         0, 0,
         0, 0,
-        0, 0,
         0, 0},
        {"bit", TYPE_bte, 1, sizeof(bit), sizeof(bit), 0, 0, (ptr) &bte_nil,
         (int (*)(const char *, int *, ptr *)) bitFromStr, (int (*)(str *, int 
*, const void *)) bitToStr,
@@ -1761,7 +1756,6 @@ atomDesc BATatoms[MAXATOMS] = {
         (BUN (*)(const void *)) bteHash,
         0, 0,
         0, 0,
-        0, 0,
         0, 0},
        {"bte", TYPE_bte, 1, sizeof(bte), sizeof(bte), 0, 0, (ptr) &bte_nil,
         (int (*)(const char *, int *, ptr *)) bteFromStr, (int (*)(str *, int 
*, const void *)) bteToStr,
@@ -1770,7 +1764,6 @@ atomDesc BATatoms[MAXATOMS] = {
         (BUN (*)(const void *)) bteHash,
         0, 0,
         0, 0,
-        0, 0,
         0, 0},
        {"sht", TYPE_sht, 1, sizeof(sht), sizeof(sht), 0, 0, (ptr) &sht_nil,
         (int (*)(const char *, int *, ptr *)) shtFromStr, (int (*)(str *, int 
*, const void *)) shtToStr,
@@ -1779,7 +1772,6 @@ atomDesc BATatoms[MAXATOMS] = {
         (BUN (*)(const void *)) shtHash,
         0, 0,
         0, 0,
-        0, 0,
         0, 0},
        {"BAT", TYPE_int, 1, sizeof(bat), sizeof(bat), 0, 0, (ptr) &int_nil,
         (int (*)(const char *, int *, ptr *)) batFromStr, (int (*)(str *, int 
*, const void *)) batToStr,
@@ -1788,7 +1780,6 @@ atomDesc BATatoms[MAXATOMS] = {
         (BUN (*)(const void *)) intHash,
         (int (*)(const void *)) batFix, (int (*)(const void *)) batUnfix,
         0, 0,
-        0, 0,
         0, 0},
        {"int", TYPE_int, 1, sizeof(int), sizeof(int), 0, 0, (ptr) &int_nil,
         (int (*)(const char *, int *, ptr *)) intFromStr, (int (*)(str *, int 
*, const void *)) intToStr,
@@ -1797,7 +1788,6 @@ atomDesc BATatoms[MAXATOMS] = {
         (BUN (*)(const void *)) intHash,
         0, 0,
         0, 0,
-        0, 0,
         0, 0},
        {"oid",
 #if SIZEOF_OID == SIZEOF_INT
@@ -1815,7 +1805,6 @@ atomDesc BATatoms[MAXATOMS] = {
 #endif
         0, 0,
         0, 0,
-        0, 0,
         0, 0},
        {"wrd",
 #if SIZEOF_WRD == SIZEOF_INT
@@ -1833,7 +1822,6 @@ atomDesc BATatoms[MAXATOMS] = {
 #endif
         0, 0,
         0, 0,
-        0, 0,
         0, 0},
        {"ptr",
 #if SIZEOF_VOID_P == SIZEOF_INT
@@ -1851,7 +1839,6 @@ atomDesc BATatoms[MAXATOMS] = {
 #endif
         0, 0,
         0, 0,
-        0, 0,
         0, 0},
        {"flt", TYPE_flt, 1, sizeof(flt), sizeof(flt), 0, 0, (ptr) &flt_nil,
         (int (*)(const char *, int *, ptr *)) fltFromStr, (int (*)(str *, int 
*, const void *)) fltToStr,
@@ -1860,7 +1847,6 @@ atomDesc BATatoms[MAXATOMS] = {
         (BUN (*)(const void *)) intHash,
         0, 0,
         0, 0,
-        0, 0,
         0, 0},
        {"dbl", TYPE_dbl, 1, sizeof(dbl), sizeof(dbl), 0, 0, (ptr) &dbl_nil,
         (int (*)(const char *, int *, ptr *)) dblFromStr, (int (*)(str *, int 
*, const void *)) dblToStr,
@@ -1869,7 +1855,6 @@ atomDesc BATatoms[MAXATOMS] = {
         (BUN (*)(const void *)) lngHash,
         0, 0,
         0, 0,
-        0, 0,
         0, 0},
        {"lng", TYPE_lng, 1, sizeof(lng), sizeof(lng), 0, 0, (ptr) &lng_nil,
         (int (*)(const char *, int *, ptr *)) lngFromStr, (int (*)(str *, int 
*, const void *)) lngToStr,
@@ -1878,7 +1863,6 @@ atomDesc BATatoms[MAXATOMS] = {
         (BUN (*)(const void *)) lngHash,
         0, 0,
         0, 0,
-        0, 0,
         0, 0},
        {"str", TYPE_str, 1, sizeof(var_t), sizeof(var_t), 0, 1, (ptr) str_nil,
         (int (*)(const char *, int *, ptr *)) strFromStr, (int (*)(str *, int 
*, const void *)) strToStr,
@@ -1887,8 +1871,7 @@ atomDesc BATatoms[MAXATOMS] = {
         (BUN (*)(const void *)) strHash,
         0, 0,
         (var_t (*)(Heap *, var_t *, const void *)) strPut, 0,
-        (int (*)(const void *)) strLen, strHeap,
-        (void (*)(Heap *, int)) 0, 0},
+        (int (*)(const void *)) strLen, strHeap},
 };
 
 int GDKatomcnt = TYPE_str + 1;
diff --git a/gdk/gdk_atoms.h b/gdk/gdk_atoms.h
--- a/gdk/gdk_atoms.h
+++ b/gdk/gdk_atoms.h
@@ -205,7 +205,6 @@ gdk_export const ptr ptr_nil;
 #define ATOMtype(t)            ((t == TYPE_void)?TYPE_oid:t)
 #define ATOMfix(t,v)           do if (BATatoms[t].atomFix) 
BATatoms[t].atomFix(v); while (0)
 #define ATOMunfix(t,v)         do if (BATatoms[t].atomUnfix) 
BATatoms[t].atomUnfix(v); while (0)
-#define ATOMheapConvert(t,hp,d)        do if (BATatoms[t].atomHeapConvert) 
BATatoms[t].atomHeapConvert(hp,d); while (0)
 
 #define CONV_HTON               1
 #define CONV_NTOH               0
diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c
--- a/gdk/gdk_heap.c
+++ b/gdk/gdk_heap.c
@@ -1084,161 +1084,3 @@ HEAP_free(Heap *heap, var_t mem)
                hheader->head = block;
        }
 }
-
-int
-HEAP_check(Heap *heap, HeapRepair *hr)
-{
-       HEADER *hheader = HEAP_index(heap, 0, HEADER);
-       size_t head = hheader->head, alignshift = 2;
-       size_t block, nwords = (size_t) ((heap->free - 1) >> 7);
-       int *freemask;
-       size_t prevblock = 0;
-       CHUNK *blockp;
-
-       hr->alignment = hheader->alignment;
-       hr->minpos = sizeof(HEADER);
-       hr->maxpos = heap->free;
-       hr->validmask = NULL;
-
-       if (hheader->alignment == 8) {
-               nwords >>= 1;
-               alignshift = 3;
-       } else if (hheader->alignment != 4) {
-               GDKerror("HEAP_check: Heap structure corrupt alignment = %d\n", 
hheader->alignment);
-               return FALSE;
-       }
-       if ((head != roundup_num(head, hheader->alignment))) {
-               GDKerror("HEAP_check: Heap structure corrupt: head = " SZFMT 
"\n", head);
-               return FALSE;
-       }
-
-       /*
-        * Create bitmasks that will hold all valid block positions
-        */
-       hr->validmask = (int *) GDKzalloc(sizeof(int) * ++nwords);
-       freemask = (int *) GDKzalloc(sizeof(int) * nwords);
-       if (hr->validmask == NULL || freemask == NULL) {
-               GDKfree(hr->validmask);
-               GDKfree(freemask);
-               return FALSE;
-       }
-
-       /*
-        * Walk the freelist; register them in freemask
-        */
-       for (block = hheader->head; block != 0; block = HEAP_index(heap, block, 
CHUNK)->next) {
-               size_t idx = block >> alignshift;
-               size_t pos = idx >> 5;
-               int mask = 1 << (idx & 31);
-
-               if ((block <= prevblock) && (block != 0)) {
-                       GDKerror("HEAP_check: Freelist is not ordered\n");
-               } else if (block <= 0 || block > heap->free) {
-                       GDKerror("HEAP_check: Entry freelist corrupt: block " 
SZFMT " not in heap\n", block);
-               } else {
-                       freemask[pos] |= mask;
-                       continue;
-               }
-               goto xit;
-       }
-
-       /*
-        * Walk the blocklist; register in validmask/eliminate from freemask
-        */
-       block = hheader->firstblock;
-       while (block < heap->free) {
-               size_t idx = block >> alignshift;
-               size_t pos = idx >> 5;
-               int mask = 1 << (idx & 31);
-
-               hr->validmask[pos] |= mask;
-               blockp = HEAP_index(heap, block, CHUNK);
-
-               if (freemask[pos] & mask) {
-                       freemask[pos] &= ~mask;
-                       block += blockp->size;
-               } else {
-                       block += blocksize(hheader, blockp);
-               }
-       }
-       if (block != heap->free) {
-               GDKerror("HEAP_check: Something wrong with heap\n");
-               goto xit;
-       }
-
-       /*
-        * Check if there are left over free blocks
-        */
-       for (block = hheader->head; block != 0; block = HEAP_index(heap, block, 
CHUNK)->next) {
-               size_t idx = block >> alignshift;
-               size_t pos = idx >> 5;
-               int mask = 1 << (idx & 31);
-
-               if (freemask[pos] & mask) {
-                       GDKerror("HEAP_check: Entry freelist corrupt: block " 
SZFMT " not in blocklist\n", block);
-                       goto xit;
-               }
-       }
-       GDKfree(freemask);
-       return TRUE;
-      xit:
-       GDKfree(freemask);
-       GDKfree(hr->validmask);
-       hr->validmask = NULL;
-       return FALSE;
-}
-
-/*
- * The HEAP_init() function is called in the BAT load sequence, if
- * Monet sees that a standard heap is being loaded (it looks for a
- * directly registered HEAP_check ADT function).
- */
-/* reinitialize the size function after a load */
-void
-HEAP_init(Heap *heap, int tpe)
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to