From: bdemsky Date: Fri, 9 Nov 2007 02:10:46 +0000 (+0000) Subject: more bugs X-Git-Tag: preEdgeChange~379 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=5847710ba1c7b61d8c2ea06464bbab4cc7c94600;p=IRC.git more bugs --- diff --git a/Robust/src/Analysis/TaskStateAnalysis/TagAnalysis.java b/Robust/src/Analysis/TaskStateAnalysis/TagAnalysis.java index c33f7592..82f3d713 100644 --- a/Robust/src/Analysis/TaskStateAnalysis/TagAnalysis.java +++ b/Robust/src/Analysis/TaskStateAnalysis/TagAnalysis.java @@ -90,7 +90,6 @@ public class TagAnalysis { } private void computeCallsFlags(FlatMethod fm, Hashtable parammap, Set tagbindings, Set newflags) { - System.out.println(" "+fm.getMethod()); Set nodeset=fm.getNodeSet(); for(Iterator nodeit=nodeset.iterator();nodeit.hasNext();) { FlatNode fn=(FlatNode)nodeit.next(); diff --git a/Robust/src/ClassLibrary/Socket.java b/Robust/src/ClassLibrary/Socket.java index 89a77928..a9f3fbf0 100644 --- a/Robust/src/ClassLibrary/Socket.java +++ b/Robust/src/ClassLibrary/Socket.java @@ -54,6 +54,7 @@ public class Socket { nativeWrite(b, offset, len); } + private native void nativeBindFD(int fd); private native int nativeRead(byte[] b); private native void nativeWrite(byte[] b, int offset, int len); private native void nativeClose(); diff --git a/Robust/src/Runtime/ObjectHash.c b/Robust/src/Runtime/ObjectHash.c index 239331e4..fa5f5a36 100755 --- a/Robust/src/Runtime/ObjectHash.c +++ b/Robust/src/Runtime/ObjectHash.c @@ -251,7 +251,7 @@ inline int ObjhasNext(struct ObjectIterator *thisvar) { inline int Objnext(struct ObjectIterator *thisvar) { int curr=thisvar->cur->data; - thisvar->cur=thisvar->cur->next; + thisvar->cur=thisvar->cur->lnext; return curr; } diff --git a/Robust/src/Runtime/SimpleHash.c b/Robust/src/Runtime/SimpleHash.c index 69055bb7..5e69d1d7 100755 --- a/Robust/src/Runtime/SimpleHash.c +++ b/Robust/src/Runtime/SimpleHash.c @@ -53,6 +53,36 @@ int RuntimeHashfirstkey(struct RuntimeHash *thisvar) { return ptr->key; } +int RuntimeHashremovekey(struct RuntimeHash *thisvar, int key) { + unsigned int hashkey = (unsigned int)key % thisvar->size; + + struct RuntimeNode **ptr = &thisvar->bucket[hashkey]; + int i; + + while (*ptr) { + if ((*ptr)->key == key) { + struct RuntimeNode *toremove=*ptr; + *ptr=(*ptr)->next; + + if (toremove->lprev!=NULL) + toremove->lprev->lnext=toremove->lnext; + else + thisvar->listhead=toremove->lnext; + if (toremove->lnext!=NULL) + toremove->lnext->lprev=toremove->lprev; + else + thisvar->listtail=toremove->lprev; + RUNFREE(toremove); + + thisvar->numelements--; + return 1; + } + ptr = &((*ptr)->next); + } + + return 0; +} + int RuntimeHashremove(struct RuntimeHash *thisvar, int key, int data) { unsigned int hashkey = (unsigned int)key % thisvar->size; @@ -251,7 +281,8 @@ inline int RunhasNext(struct RuntimeIterator *thisvar) { inline int Runnext(struct RuntimeIterator *thisvar) { int curr=thisvar->cur->data; - thisvar->cur=thisvar->cur->next; + thisvar->cur=thisvar->cur->lnext; + return curr; } inline int Runkey(struct RuntimeIterator *thisvar) { diff --git a/Robust/src/Runtime/SimpleHash.h b/Robust/src/Runtime/SimpleHash.h index 2a25d6cc..7810120a 100755 --- a/Robust/src/Runtime/SimpleHash.h +++ b/Robust/src/Runtime/SimpleHash.h @@ -24,6 +24,7 @@ void freeRuntimeHash(struct RuntimeHash *); void RuntimeHashrehash(struct RuntimeHash * thisvar); int RuntimeHashadd(struct RuntimeHash *, int key, int data); +int RuntimeHashremovekey(struct RuntimeHash *,int key); int RuntimeHashremove(struct RuntimeHash *,int key, int data); bool RuntimeHashcontainskey(struct RuntimeHash *,int key); bool RuntimeHashcontainskeydata(struct RuntimeHash *,int key, int data); diff --git a/Robust/src/Runtime/checkpoint.c b/Robust/src/Runtime/checkpoint.c index 4e716ea0..96019e38 100644 --- a/Robust/src/Runtime/checkpoint.c +++ b/Robust/src/Runtime/checkpoint.c @@ -52,6 +52,58 @@ void freemalloc() { } } +void checkvalid(void * ptr) { + if (ptr>=curr_heapbase&&ptr<=curr_heaptop) { + printf("Valid\n"); + } +} + +void validitycheck(struct RuntimeHash *forward, struct RuntimeHash *reverse) { + struct RuntimeIterator rit; + RuntimeHashiterator(forward, &rit); + while(RunhasNext(&rit)) { + struct ___Object___ * data=(struct ___Object___*) Runnext(&rit); + int type=data->type; + unsigned int * pointer=pointerarray[type]; + int size; + int i; + if (pointer!=0&&((int)pointer)!=1) { + size=pointer[0]; + for(i=1;i<=size;i++) { + int offset=pointer[i]; + void * ptr=*(void **) (((int) data) + offset); + if (ptr!=NULL&&!RuntimeHashcontainskey(reverse, (int) ptr)) { + printf("Bad\n"); + } + checkvalid(ptr); + } + } + } + + RuntimeHashiterator(reverse, &rit); + while(RunhasNext(&rit)) { + struct ___Object___ * data=(struct ___Object___*) Runkey(&rit); + Runnext(&rit); + int type=data->type; + unsigned int * pointer=pointerarray[type]; + int size; + int i; + if (pointer!=0&&((int)pointer)!=1) { + size=pointer[0]; + for(i=1;i<=size;i++) { + int offset=pointer[i]; + void * ptr=*(void **) (((int) data) + offset); + if (ptr!=NULL&&!RuntimeHashcontainskey(reverse, (int) ptr)) { + printf("Bad2\n"); + } + checkvalid(ptr); + } + } + } + } + + + void ** makecheckpoint(int numparams, void ** srcpointer, struct RuntimeHash * forward, struct RuntimeHash * reverse) { #ifdef PRECISE_GC void **newarray=cpmalloc(sizeof(void *)*numparams); @@ -80,16 +132,21 @@ void ** makecheckpoint(int numparams, void ** srcpointer, struct RuntimeHash * f { void *cpy; RuntimeHashget(forward, (int) ptr, (int *) &cpy); + unsigned int * pointer=pointerarray[type]; #ifdef TASK if (type==TAGTYPE) { void *objptr=((struct ___TagDescriptor___*)ptr)->flagptr; if (objptr!=NULL) { - void * copy=createcopy(objptr); - RuntimeHashadd(forward, (int) objptr, (int) copy); - RuntimeHashadd(reverse, (int) copy, (int) objptr); - RuntimeHashadd(todo, (int) objptr, (int) objptr); - ((struct ___TagDescriptor___*)cpy)->flagptr=copy; + if (!RuntimeHashcontainskey(forward, (int) objptr)) { + void *copy=createcopy(objptr); + RuntimeHashadd(forward, (int) objptr, (int) copy); + RuntimeHashadd(reverse, (int) copy, (int) objptr); + RuntimeHashadd(todo, (int) objptr, (int) objptr); + ((struct ___TagDescriptor___*)cpy)->flagptr=copy; + } else { + RuntimeHashget(forward, (int) objptr, (int *) &(((struct ___TagDescriptor___*) cpy)->flagptr)); + } } } else #endif diff --git a/Robust/src/Runtime/socket.c b/Robust/src/Runtime/socket.c index 13b0ed02..60709cd2 100644 --- a/Robust/src/Runtime/socket.c +++ b/Robust/src/Runtime/socket.c @@ -51,6 +51,15 @@ int CALL24(___Socket______nativeConnect____I__AR_B_I, int ___fd___, int ___port_ return -1; } +#ifdef TASK +int CALL12(___Socket______nativeBindFD____I, int ___fd___, struct ___Socket___ * ___this___, int ___fd___) { + if (RuntimeHashcontainskey(fdtoobject, ___fd___)) + RuntimeHashremovekey(fdtoobject, ___fd___); + RuntimeHashadd(fdtoobject, ___fd___, (int) VAR(___this___)); + addreadfd(___fd___); +} +#endif + int CALL12(___Socket______nativeBind_____AR_B_I, int ___port___, struct ArrayObject * ___address___, int ___port___) { int fd;