From: bdemsky Date: Thu, 22 Oct 2009 22:08:43 +0000 (+0000) Subject: bug fixes X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=65e48626f785722d1be78cc95b8d4baf09c6bb6f;p=IRC.git bug fixes --- diff --git a/Robust/src/Analysis/Locality/DelayComputation.java b/Robust/src/Analysis/Locality/DelayComputation.java index af98cdc5..590e5c65 100644 --- a/Robust/src/Analysis/Locality/DelayComputation.java +++ b/Robust/src/Analysis/Locality/DelayComputation.java @@ -285,7 +285,9 @@ public class DelayComputation { FlatMethod fm=state.getMethodFlat(md); HashSet delayedset=notreadymap.get(lb); - HashSet derefset=derefmap.get(lb); + HashSet derefset=null; + if (state.STMARRAY) + derefset=derefmap.get(lb); HashSet otherset=othermap.get(lb); HashSet cannotdelayset=cannotdelaymap.get(lb); Hashtable> livemap=Liveness.computeLiveTemps(fm); @@ -550,7 +552,7 @@ public class DelayComputation { //Delay branches if possible if (fn.kind()==FKind.FlatCondBranch) { - Set branchset=revbranchmap.get(lb); + Set branchset=revbranchmap.get((FlatCondBranch)fn); for(Iterator brit=branchset.iterator();brit.hasNext();) { FlatNode branchnode=brit.next(); if (cannotdelay.contains(branchnode)||(state.STMARRAY&&derefset.contains(branchnode))) { @@ -609,7 +611,7 @@ public class DelayComputation { for(Iterator fcbit=fcbset.iterator();fcbit.hasNext();) { FlatCondBranch fcb=fcbit.next(); //enqueue flatcondbranch node for reanalysis - if (cannotdelay.contains(fcb)) { + if (!cannotdelay.contains(fcb)) { cannotdelay.add(fcb); toanalyze.add(fcb); } diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index f5f35791..cb9e3642 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -2248,7 +2248,7 @@ public class BuildCode { if (genset==null||genset.contains(current_node)||specialprimitive) generateFlatNode(fm, lb, current_node, output); - if (state.STMARRAY&&refset.contains(current_node)) { + if (state.STMARRAY&&refset!=null&&refset.contains(current_node)) { //need to acquire lock handleArrayDeref(fm, lb, current_node, output, firstpass); } @@ -2367,10 +2367,10 @@ public class BuildCode { else type=elementtype.getSafeSymbol()+" "; output.println("{"); - output.println(" struct ___ArrayObject___ *array;"); + output.println(" struct ArrayObject *array;"); output.println(" int index;"); output.println(" RESTOREARRAY(array,index);"); - output.println(" (("+type+"*)((struct ___ArrayObject___*) (((char *)&array->___length___))+sizeof(int)))[index]="+fsen.getSrc()+";"); + output.println(" (("+type+"*)(((char *)&array->___length___)+sizeof(int)))[index]="+fsen.getSrc()+";"); output.println("}"); } } else if (fn.kind()==FKind.FlatElementNode) { @@ -2380,7 +2380,7 @@ public class BuildCode { if (firstpass) { output.println("STOREARRAY("+src+","+index+");"); } else { - TypeDescriptor elementtype=fen.getDst().getType().dereference(); + TypeDescriptor elementtype=fen.getSrc().getType().dereference(); String dst=generateTemp(fm, fen.getDst(), lb); String type=""; if (elementtype.isArray()||elementtype.isClass()) @@ -2388,10 +2388,10 @@ public class BuildCode { else type=elementtype.getSafeSymbol()+" "; output.println("{"); - output.println(" struct ___ArrayObject___ *array;"); + output.println(" struct ArrayObject *array;"); output.println(" int index;"); output.println(" RESTOREARRAY(array,index);"); - output.println(" "+dst+"=(("+type+"*)((struct ___ArrayObject___*) (((char *)&array->___length___))+sizeof(int)))[index];"); + output.println(" "+dst+"=(("+type+"*)(((char *)&array->___length___)+sizeof(int)))[index];"); output.println("}"); } } diff --git a/Robust/src/Runtime/STM/delaycomp.h b/Robust/src/Runtime/STM/delaycomp.h index 3b9c980d..11be68a9 100644 --- a/Robust/src/Runtime/STM/delaycomp.h +++ b/Robust/src/Runtime/STM/delaycomp.h @@ -47,11 +47,11 @@ extern __thread struct arraylist arraystack; #define RESTOREARRAY(x,z) {x=arraystack.array[arraystack.maxcount];z=arraystack.index[arraystack.maxcount++];} -#define STOREARRAY(x,z) {void * y=COMPOID(x); arraystack.array[arraystack.count]=y; arraystack.index[arraystack.count++]=z; dc_t_chashInsertOnce(y,y,z);} +#define STOREARRAY(x,z) {void * y=COMPOID(x); arraystack.array[arraystack.count]=y; arraystack.index[arraystack.count++]=z; dc_t_chashInsertOnceArray(y,y,z);} #define STOREARRAYNOLOCK(x,z) {void * y=COMPOID(x); arraystack.array[arraystack.count]=y; arraystack.index[arraystack.count++]=z;} -#define STOREARRAYNOTRANS(x,z) {void * y=x; arraystack.array[arraystack.count]=y; arraystack.index[arraystack.count++]=z; dc_t_chashInsertOnce(y,y,z);} +#define STOREARRAYNOTRANS(x,z) {void * y=x; arraystack.array[arraystack.count]=y; arraystack.index[arraystack.count++]=z; dc_t_chashInsertOnceArray(y,y,z);} #define STOREARRAYNOLOCKNOTRANS(x,z) {void * y=x; arraystack.array[arraystack.count]=y; arraystack.index[arraystack.count++]=z; } diff --git a/Robust/src/Runtime/STM/stmlookup.c b/Robust/src/Runtime/STM/stmlookup.c index 42ce0d91..594e3aeb 100644 --- a/Robust/src/Runtime/STM/stmlookup.c +++ b/Robust/src/Runtime/STM/stmlookup.c @@ -368,62 +368,6 @@ void dc_t_chashInsertOnceArray(void * key, unsigned int intkey, void *val) { } #endif -#ifdef STMARRAY -//Store objects and their pointers into hash -void dc_t_chashInsertOnce(void * key, unsigned int indexkey, void *val) { - chashlistnode_t *ptr; - - if (key==NULL) - return; - - if(dc_c_numelements > (dc_c_threshold)) { - //Resize - unsigned int newsize = dc_c_size << 1; - dc_t_chashResize(newsize); - } - - ptr = &dc_c_table[(((unsigned INTPTR)key)&dc_c_mask)>>4]; - - if(ptr->key==0) { - ptr->key=key; - ptr->val=val; - ptr->lnext=dc_c_list; - dc_c_list=ptr; - dc_c_numelements++; - } else { // Insert in the beginning of linked list - chashlistnode_t * node; - chashlistnode_t *search=ptr; - - //make sure it isn't here - do { - if(search->key == key) { - return; - } - search=search->next; - } while(search != NULL); - - dc_c_numelements++; - if (dc_c_structs->numarray[dc_c_structs->num]; - dc_c_structs->num++; - } else { - //get new list - cliststruct_t *tcl=calloc(1,sizeof(cliststruct_t)); - tcl->next=dc_c_structs; - dc_c_structs=tcl; - node=&tcl->array[0]; - tcl->num=1; - } - node->key = key; - node->val = val; - node->next = ptr->next; - ptr->next=node; - node->lnext=dc_c_list; - dc_c_list=node; - } -} -#endif - unsigned int dc_t_chashResize(unsigned int newsize) { dchashlistnode_t *node, *ptr, *curr; // curr and next keep track of the current and the next chashlistnodes in a linked list unsigned int oldsize;