get some space for optional fs's
authorbdemsky <bdemsky>
Fri, 17 Aug 2007 01:33:39 +0000 (01:33 +0000)
committerbdemsky <bdemsky>
Fri, 17 Aug 2007 01:33:39 +0000 (01:33 +0000)
Robust/src/IR/Flat/BuildCode.java
Robust/src/Runtime/ObjectHash.c
Robust/src/Runtime/checkpoint.c
Robust/src/Runtime/garbage.c
Robust/src/Runtime/runtime.h
Robust/src/Runtime/task.c
Robust/src/buildscript

index 7a5ddc6f8414ed70d4f438f72439ef716a9cda02..f253e6da5bd1635912c2709dbadcd6311ca8d9ef 100644 (file)
@@ -2126,9 +2126,9 @@ public class BuildCode {
         }
         
         
-        
         //GENERATE STRUCTS
-        output.println("#include \"optionalstruct.h\"\n\n");    
+        if (state.OPTIONAL)
+            output.println("#include \"optionalstruct.h\"\n\n");        
         HashSet processedcd = new HashSet();
        
         int maxotd=0;
index de85a533a680fcf536285a3a098ba2b39f6cbc33..b3a42abe8197569c9eacb44b3a5ede92c816bf88 100755 (executable)
@@ -206,20 +206,6 @@ int ObjectHashcount(struct ObjectHash *thisvar,int key) {
     return count;
 }
 
-struct ObjectHash * ObjectHashimageSet(struct ObjectHash *thisvar, int key) {
-  struct ObjectHash * newset=allocateObjectHash(2*ObjectHashcount(thisvar,key)+4);
-  unsigned int hashkey = (unsigned int)key % thisvar->size;
-
-  struct ObjectNode *ptr = thisvar->bucket[hashkey];
-  while (ptr) {
-    if (ptr->key == key) {
-        ObjectHashadd(newset,ptr->data,ptr->data);
-    }
-    ptr = ptr->next;
-  }
-  return newset;
-}
-
 int ObjectHashget(struct ObjectHash *thisvar, int key, int *data, int *data2) {
     unsigned int hashkey = (unsigned int)key % thisvar->size;
 
index f77a551d090f63f8c9af9aa95a20633eb6019966..6fd62de7421af93e993fafb34a35018875fcdd57 100644 (file)
@@ -71,7 +71,7 @@ void ** makecheckpoint(int numparams, void ** srcpointer, struct RuntimeHash * f
     {
       void *cpy;
       RuntimeHashget(forward, (int) ptr, (int *) &cpy);
-      int * pointer=pointerarray[type];
+      unsigned int * pointer=pointerarray[type];
       if (pointer==0) {
        /* Array of primitives */
        /* Do nothing */
@@ -171,7 +171,7 @@ void restorecheckpoint(int numparams, void ** original, void ** checkpoint, stru
 
     {
       void *cpy;
-      int *pointer;
+      unsigned int *pointer;
       int size;
       RuntimeHashget(reverse, (int) ptr, (int *) &cpy);
       pointer=pointerarray[type];
index e86f2c1b6d1a7f259b7f12fbf19bb5809c814949..1e7a63f75401dcef8be1925af02fc1248a226127 100644 (file)
@@ -164,8 +164,8 @@ void collect(struct garbagelist * stackptr) {
     for(i=0;i<NUMCLASSES;i++) {
       struct parameterwrapper * p=objectqueues[i];
       while(p!=NULL) {
-       struct RuntimeHash * set=p->objectset;
-       struct RuntimeNode * ptr=set->listhead;
+       struct ObjectHash * set=p->objectset;
+       struct ObjectNode * ptr=set->listhead;
        while(ptr!=NULL) {
          void *orig=(void *)ptr->key;
          void *copy;
@@ -175,7 +175,7 @@ void collect(struct garbagelist * stackptr) {
          
          ptr=ptr->lnext;
        }
-       RuntimeHashrehash(set); /* Rehash the table */
+       ObjectHashrehash(set); /* Rehash the table */
        p=p->next;
       }
     }
index a90508fb07f91501e0f85dc00fcdbebaf8253c16..96cc3087d7174fb8da2b50fd3f94fa2c3ea29b5b 100644 (file)
@@ -66,9 +66,12 @@ void createstartupobject();
 
 #ifdef TASK
 #include "SimpleHash.h"
+#include "ObjectHash.h"
 #include "task.h"
 #include "structdefs.h"
+#ifdef OPTIONAL
 #include "optionalstruct.h"
+#endif
 
 void flagorand(void * ptr, int ormask, int andmask);
 void flagorandinit(void * ptr, int ormask, int andmask);
@@ -77,8 +80,8 @@ void processtasks();
 
 struct tagobjectiterator {
   int istag; /* 0 if object iterator, 1 if tag iterator */
-  struct RuntimeIterator it; /* Object iterator */
-  struct RuntimeHash * objectset;
+  struct ObjectIterator it; /* Object iterator */
+  struct ObjectHash * objectset;
   int slot;
   int tagobjindex; /* Index for tag or object depending on use */
   /*if tag we have an object binding */
@@ -91,7 +94,7 @@ struct tagobjectiterator {
 
 struct parameterwrapper {
   struct parameterwrapper *next;
-  struct RuntimeHash * objectset;
+  struct ObjectHash * objectset;
   int numberofterms;
   int * intarray;
   int numbertags;
index 88633ca04f2bf9e51782b96a3be98f3e33373b90..bdde536adf54591dd576a05e40be6f28027b71bd 100644 (file)
@@ -443,8 +443,7 @@ void flagorandinit(void * ptr, int ormask, int andmask) {
        temp=(struct ___Object___ *)node->key;
        if(temp->failedstatus==1 && temp->hashcode==currobj->hashcode){
         if(temp!=currobj){
-          RuntimeHashget(flagptr->objectset, (int)temp, (int *) &ptr);
-          RuntimeHashremove(flagptr->objectset, (int)temp, (int) ptr);//remove from wrapper
+          ObjectHashremove(flagptr->objectset, (int)temp);//remove from wrapper
           //delete the fields that wont be removed by the GC.
           if(temp->exitfses!=NULL) RUNFREE(temp->exitfses);
           if(temp->otds!=NULL) RUNFREE(temp->otds);
@@ -452,8 +451,7 @@ void flagorandinit(void * ptr, int ormask, int andmask) {
         }
         else{
           //remove from wrapper
-          RuntimeHashget(flagptr->objectset, (int)temp, (int *) &ptr);
-          RuntimeHashremove(flagptr->objectset, (int)temp, (int) ptr);
+          ObjectHashremove(flagptr->objectset, (int)temp);
           goto nextwrapper;
         }
        }
@@ -474,8 +472,9 @@ void flagorandinit(void * ptr, int ormask, int andmask) {
    while(flagptr!=NULL) {
      struct parameterwrapper *next;
      struct ___Object___ * tag=ptr->___tags___;
-     RuntimeHashget(flagptr->objectset, (int) ptr, (int *) &next);
-     RuntimeHashremove(flagptr->objectset, (int)ptr, (int) next);
+     int FIXME;
+     ObjectHashget(flagptr->objectset, (int) ptr, (int *) &next, &FIXME);
+     ObjectHashremove(flagptr->objectset, (int)ptr);
      flagptr=next;
    }
    
@@ -767,9 +766,9 @@ void flagorandinit(void * ptr, int ormask, int andmask) {
    //test if the predicate member is true
    struct parameterwrapper * paramwrapper = objectqueues[currpred->type];
    while(paramwrapper!=NULL){
-   struct RuntimeIterator * it = allocateRuntimeIterator(paramwrapper->objectset->listhead);
+   struct ObjectIterator * it = allocateObjectIterator(paramwrapper->objectset->listhead);
    do{
-   struct ___Object___ * obj = (struct ___Object___ *)Runkey(it);
+   struct ___Object___ * obj = (struct ___Object___ *)Objkey(it);
    printf("obj type : %i\n", obj->type);
    if(obj->type == currpred->type){
    //test the predicate
@@ -777,8 +776,8 @@ void flagorandinit(void * ptr, int ormask, int andmask) {
    //only if good
    goto enqueuetask;
    }
-   Runnext(it);
-   }while(RunhasNext(it));
+   Objnext(it);
+   }while(ObjhasNext(it));
    paramwrapper=paramwrapper->next;
    }
    printf("not the good predicate");
@@ -797,7 +796,7 @@ void flagorandinit(void * ptr, int ormask, int andmask) {
 
   struct taskdescriptor * task=parameter->task;
   
-  RuntimeHashadd(parameter->objectset, (int) ptr, (int) prevptr);//this add the object to parameterwrapper
+  ObjectHashadd(parameter->objectset, (int) ptr, (int) prevptr, 0);//this add the object to parameterwrapper
   
   /* Add enqueued object to parameter vector */
   taskpointerarray[parameter->slot]=ptr;
@@ -988,7 +987,7 @@ void executetasks() {
        if(obj->failedstatus==1){
          struct ___Object___ *temp=NULL;
          struct parameterwrapper * ptr;
-         struct RuntimeNode * node = pw->objectset->listhead;
+         struct ObjectNode * node = pw->objectset->listhead;
          while(node!=NULL){
            temp=(struct ___Object___ *)node->key;
            if(temp->failedstatus==1 && temp->hashcode==obj->hashcode){
@@ -1004,7 +1003,7 @@ void executetasks() {
        else
 #endif
        {
-         if (!RuntimeHashcontainskey(pw->objectset, (int) parameter)) {
+         if (!ObjectHashcontainskey(pw->objectset, (int) parameter)) {
            RUNFREE(currtpd->parameterArray);
            RUNFREE(currtpd);
            goto newtask;
@@ -1123,7 +1122,7 @@ void processtags(struct parameterdescriptor *pd, int index, struct parameterwrap
 void processobject(struct parameterwrapper *parameter, int index, struct parameterdescriptor *pd, int *iteratorcount, int * statusarray, int numparams) {
   int i;
   int tagcount=0;
-  struct RuntimeHash * objectset=((struct parameterwrapper *)pd->queue)->objectset;
+  struct ObjectHash * objectset=((struct parameterwrapper *)pd->queue)->objectset;
 
   parameter->iterators[*iteratorcount].istag=0;
   parameter->iterators[*iteratorcount].slot=index;
@@ -1223,7 +1222,7 @@ void processtasks() {
       struct parameterwrapper ** ptr=&objectqueues[param->type];
 
       param->queue=parameter;
-      parameter->objectset=allocateRuntimeHash(10);
+      parameter->objectset=allocateObjectHash(10);
       parameter->numberofterms=param->numberterms;
       parameter->intarray=param->intarray;
       parameter->numbertags=param->numbertags;
@@ -1251,7 +1250,7 @@ void toiReset(struct tagobjectiterator * it) {
   } else if (it->numtags>0) {
     it->tagobjindex=0;
   } else {
-    RuntimeHashiterator(it->objectset, &it->it);
+    ObjectHashiterator(it->objectset, &it->it);
   }
 }
 
@@ -1287,7 +1286,7 @@ int toiHasNext(struct tagobjectiterator *it, void ** objectarray) {
     if (objptr->type!=OBJECTARRAYTYPE) {
       if (it->tagobjindex>0)
        return 0;
-      if (!RuntimeHashcontainskey(it->objectset, (int) objptr))
+      if (!ObjectHashcontainskey(it->objectset, (int) objptr))
        return 0;
       for(i=1;i<it->numtags;i++) {
        struct ___TagDescriptor___ *tag2=objectarray[it->tagbindings[i]];
@@ -1301,7 +1300,7 @@ int toiHasNext(struct tagobjectiterator *it, void ** objectarray) {
       int i;
       for(tagindex=it->tagobjindex;tagindex<ao->___cachedCode___;tagindex++) {
        struct ___Object___ *objptr=ARRAYGET(ao, struct ___Object___*, tagindex);
-       if (!RuntimeHashcontainskey(it->objectset, (int) objptr))
+       if (!ObjectHashcontainskey(it->objectset, (int) objptr))
          continue;
        for(i=1;i<it->numtags;i++) {
          struct ___TagDescriptor___ *tag2=objectarray[it->tagbindings[i]];
@@ -1316,7 +1315,7 @@ int toiHasNext(struct tagobjectiterator *it, void ** objectarray) {
       return 0;
     }
   } else {
-    return RunhasNext(&it->it);
+    return ObjhasNext(&it->it);
   }
 }
 
@@ -1361,8 +1360,8 @@ void toiNext(struct tagobjectiterator *it , void ** objectarray) {
     }
   } else {
     /* Iterate object */
-    objectarray[it->slot]=(void *)Runkey(&it->it);
-    Runnext(&it->it);
+    objectarray[it->slot]=(void *)Objkey(&it->it);
+    Objnext(&it->it);
   }
 }
 
index 55e661a00619ad23d84a40897932cb20d1a70702..5c9ebbf011de1ae3110e0fa9565348dd6d671144 100755 (executable)
@@ -187,6 +187,7 @@ INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \
 FILES="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/task.c \
 $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/Queue.c \
 $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/option.c \
+$ROBUSTROOT/Runtime/ObjectHash.c \
 $ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/socket.c \
 $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c"