bug fix
authorjzhou <jzhou>
Sat, 17 Jul 2010 20:51:43 +0000 (20:51 +0000)
committerjzhou <jzhou>
Sat, 17 Jul 2010 20:51:43 +0000 (20:51 +0000)
Robust/src/Benchmarks/Scheduling/GC/Fibheaps/TestRunner.java
Robust/src/Runtime/GCSharedHash.c
Robust/src/Runtime/MGCHash.c
Robust/src/Runtime/MGCHash.h

index 25e3090b52dc1c7702a2014d6f1cbf7bbdb61368..4c8139cd1b9056f2b5158388ae06c966b3ac0454 100644 (file)
@@ -7,7 +7,7 @@ public class TestRunner {
   
   public void run() {
     // generate test data
-    int iter = 600; //200;
+    int iter = 700; //200;
     int seed = 1967;
     //Vector testdata = new Vector(iter);
     FibHeap fh = new FibHeap();
@@ -57,4 +57,4 @@ public class TestRunner {
       }
     }
   }
-}
\ No newline at end of file
+}
index e60729ae4597d6793d14c7a213b32118b424e520..92f1a61c1bda2a3870d2af372342f29174387d3d 100755 (executable)
@@ -387,7 +387,6 @@ int mgcsharedhashInsert(mgcsharedhashtbl_t * tbl, void * key, void * val) {
   //int keyto = ((unsigned INTPTR)key) % (tbl->size);
   //ptr=&tbl->table[keyto];
   ptr=&tbl->table[(((unsigned INTPTR)key)&tbl->mask)>>6];
-  //printf("%x \n", (((unsigned INTPTR)key)&tbl->mask)>>6); // TODO
 
   if(ptr->key==0) {
     // the first time insert a value for the key
@@ -422,7 +421,6 @@ int mgcsharedhashInsert_I(mgcsharedhashtbl_t * tbl, void * key, void * val) {
   //int keyto = ((unsigned INTPTR)key) % (tbl->size);
   //ptr=&tbl->table[keyto];
   ptr=&tbl->table[(((unsigned INTPTR)key)&tbl->mask)>>6];
-  //printf("%x \n", (((unsigned INTPTR)key)&tbl->mask)>>6); // TODO
 
   if(ptr->key==0) {
     // the first time insert a value for the key
index 5fe44056ba297325b95c04b99ea7ed1f90c48fb9..6a5b2cc3bee8d2026fd9d95d3b2e3c22e9d13c3a 100755 (executable)
@@ -50,7 +50,7 @@ mgchashtable_t * mgchashCreate(unsigned int size, double loadfactor) {
   ctable->threshold=size*loadfactor;
 
   ctable->mask = (size << 6)-1;
-  ctable->list = NULL;
+  //ctable->list = NULL;
   ctable->structs = (mgcliststruct_t*)RUNMALLOC(1*sizeof(mgcliststruct_t));
   ctable->numelements = 0; // Initial number of elements in the hash
 
@@ -61,11 +61,11 @@ void mgchashreset(mgchashtable_t * tbl) {
   mgchashlistnode_t *ptr = tbl->table;
   int i;
 
-  if (tbl->numelements<(tbl->size>>6)) {
+  /*if (tbl->numelements<(tbl->size>>6)) {
        mgchashlistnode_t *top=&ptr[tbl->size];
        mgchashlistnode_t * list = tbl->list;
        while(list != NULL) {
-      mgchashlistnode_t * next = list->next;
+      mgchashlistnode_t * next = list->lnext;
       if ((list >= ptr) && (list < top)) {
                //zero in list
         list->key=NULL;
@@ -73,9 +73,9 @@ void mgchashreset(mgchashtable_t * tbl) {
       }
       list = next;
        }
-  } else {
+  } else {*/
        BAMBOO_MEMSET_WH(tbl->table, '\0', sizeof(mgchashlistnode_t)*tbl->size);
-  }
+  //}
   // TODO now never release any allocated memory, may need to be changed
   mgcliststruct_t * next = tbl->structs;
   while(/*tbl->structs->*/next!=NULL) {
@@ -106,6 +106,8 @@ void mgchashInsert(mgchashtable_t * tbl, void * key, void *val) {
     // the first time insert a value for the key
     ptr->key=key;
     ptr->val=val;
+       /*ptr->lnext = tbl->list;
+       tbl->list = ptr;*/
   } else { // Insert in the beginning of linked list
     mgchashlistnode_t * node;
     if (tbl->structs->num<NUMMGCLIST) {
@@ -123,6 +125,8 @@ void mgchashInsert(mgchashtable_t * tbl, void * key, void *val) {
     node->val = val;
     node->next = ptr->next;
     ptr->next = node;
+       /*node->lnext = tbl->list;
+       tbl->list = node;*/
   }
 }
 
@@ -157,7 +161,7 @@ mgchashtable_t * mgchashCreate_I(unsigned int size, double loadfactor) {
   ctable->threshold=size*loadfactor;
 
   ctable->mask = (size << 6)-1;
-  ctable->list = NULL;
+  //ctable->list = NULL;
   ctable->structs = (mgcliststruct_t*)RUNMALLOC_I(1*sizeof(mgcliststruct_t));
   ctable->numelements = 0; // Initial number of elements in the hash
 
@@ -179,6 +183,8 @@ void mgchashInsert_I(mgchashtable_t * tbl, void * key, void *val) {
   if(ptr->key==0) {
     ptr->key=key;
     ptr->val=val;
+       /*ptr->lnext = tbl->list;
+       tbl->list = ptr;*/
     return;
   } else { // Insert in the beginning of linked list
     mgchashlistnode_t * node;
@@ -197,6 +203,8 @@ void mgchashInsert_I(mgchashtable_t * tbl, void * key, void *val) {
     node->val = val;
     node->next = ptr->next;
     ptr->next = node;
+       /*node->lnext = tbl->list;
+       tbl->list = node;*/
   }
 }
 #endif
@@ -238,6 +246,7 @@ unsigned int mgchashResize(mgchashtable_t * tbl, unsigned int newsize) {
   tbl->size = newsize;
   tbl->threshold = newsize * tbl->loadfactor;
   mask = tbl->mask = (newsize << 6) - 1;
+  //tbl->list = NULL;
 
   for(i = 0; i < oldsize; i++) {   //Outer loop for each bin in hash table
     curr = &ptr[i];
@@ -258,6 +267,8 @@ unsigned int mgchashResize(mgchashtable_t * tbl, unsigned int newsize) {
       if(tmp->key == 0) {
                tmp->key = key;
                tmp->val = curr->val;
+               /*tmp->lnext = tbl->list;
+               tbl->list = tmp;*/
       } /*
           NOTE:  Add this case if you change this...
           This case currently never happens because of the way things rehash....*/
@@ -267,10 +278,14 @@ unsigned int mgchashResize(mgchashtable_t * tbl, unsigned int newsize) {
                 newnode->val = curr->val;
                 newnode->next = tmp->next;
                 tmp->next=newnode;
+                /*newnode->lnext = tbl->list;
+                tbl->list = newnode;*/
           } 
       else {
                curr->next=tmp->next;
                tmp->next=curr;
+               /*curr->lnext = tbl->list;
+               tbl->list = curr;*/
       }
 
       isfirst = 0;
@@ -306,6 +321,7 @@ unsigned int mgchashResize_I(mgchashtable_t * tbl, unsigned int newsize) {
   tbl->size = newsize;
   tbl->threshold = newsize * tbl->loadfactor;
   mask = tbl->mask = (newsize << 6)-1;
+  //tbl->list = NULL;
 
   for(i = 0; i < oldsize; i++) {  //Outer loop for each bin in hash table
     curr = &ptr[i];
@@ -326,6 +342,8 @@ unsigned int mgchashResize_I(mgchashtable_t * tbl, unsigned int newsize) {
       if(tmp->key == 0) {
                tmp->key = key;
                tmp->val = curr->val;
+               /*tmp->lnext = tbl->list;
+               tbl->list = tmp;*/
       } /*
           NOTE:  Add this case if you change this...
           This case currently never happens because of the way things rehash....*/
@@ -335,9 +353,13 @@ unsigned int mgchashResize_I(mgchashtable_t * tbl, unsigned int newsize) {
                newnode->val = curr->val;
                newnode->next = tmp->next;
                tmp->next=newnode;
+               /*newnode->lnext = tbl->list;
+               tbl->list = newnode;*/
       } else {
                curr->next=tmp->next;
                tmp->next=curr;
+               /*curr->lnext = tbl->list;
+               tbl->list = curr;*/
       }
 
       isfirst = 0;
index 6c0459d53b3534ff2acec8be035c738f8752f78d..03844ebcfd7e4e03bfedfaa4f6235e51d9457ef5 100755 (executable)
@@ -25,6 +25,7 @@ typedef struct mgchashlistnode {
   void * val; //this can be cast to another type or used to point to a
               //larger structure
   struct mgchashlistnode *next;
+  //struct mgchashlistnode *lnext;
 } mgchashlistnode_t;
 
 #define NUMMGCLIST 250
@@ -36,7 +37,7 @@ typedef struct mgclist {
 
 typedef struct mgchashtable {
   mgchashlistnode_t * table;       // points to beginning of hash table
-  mgchashlistnode_t * list;
+  //mgchashlistnode_t * list;
   mgcliststruct_t * structs;
   unsigned int size;
   unsigned int mask;