From: bdemsky Date: Tue, 12 May 2009 03:28:59 +0000 (+0000) Subject: small changes X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2d10b09e1a6e3c25fedec1ef74343c5f48c85f6f;p=IRC.git small changes plus bugfixes...one race condition on riskyflag vs lock fixed --- diff --git a/Robust/src/Analysis/Locality/TypeAnalysis.java b/Robust/src/Analysis/Locality/TypeAnalysis.java index e90b860f..60452132 100644 --- a/Robust/src/Analysis/Locality/TypeAnalysis.java +++ b/Robust/src/Analysis/Locality/TypeAnalysis.java @@ -92,6 +92,15 @@ public class TypeAnalysis { return namemap.get(td); } + public Set expandSet(Set tdset) { + HashSet expandedSet=new HashSet(); + for(Iterator it=tdset.iterator();it.hasNext();) { + TypeDescriptor td=it.next(); + expandedSet.addAll(expand(td)); + } + return expandedSet; + } + public boolean couldAlias(TypeDescriptor td1, TypeDescriptor td2) { return namemap.get(td1).contains(td2); } @@ -181,4 +190,4 @@ public class TypeAnalysis { } } -} \ No newline at end of file +} diff --git a/Robust/src/Benchmarks/SingleTM/KMeans/makefile b/Robust/src/Benchmarks/SingleTM/KMeans/makefile index 6e2c4dcc..af62dbef 100644 --- a/Robust/src/Benchmarks/SingleTM/KMeans/makefile +++ b/Robust/src/Benchmarks/SingleTM/KMeans/makefile @@ -6,7 +6,7 @@ SRC=${MAINCLASS}.java \ Common.java \ GlobalArgs.java \ ../../../ClassLibrary/JavaSTM/Barrier.java -FLAGS=-mainclass ${MAINCLASS} -singleTM -optimize -debug -dcopts -transstats -joptimize -stmstats +FLAGS=-mainclass ${MAINCLASS} -singleTM -optimize -debug -dcopts -transstats -joptimize default: ../../../buildscript ${FLAGS} -o ${MAINCLASS} ${SRC} diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index c7300369..8b11ed2a 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -241,16 +241,6 @@ public class BuildCode { } if (state.THREAD||state.DSM||state.SINGLETM) { outmethod.println("initializethreads();"); - outmethod.println("#ifdef STMSTATS\n"); - outmethod.println("objlockscope = calloc(1, sizeof(objlockstate_t));"); - outmethod.println("pthread_mutex_init(&lockedobjstore, NULL);"); - outmethod.println("for(i=0; ilock[i]), NULL);"); - outmethod.println("}"); - outmethod.println("for(i=0; iabortCount++; if (x->abortCount > MAXABORTS && (x->riskyflag != 1)) { //makes riskflag sticky - x->riskyflag = 1; pthread_mutex_lock(&lockedobjstore); if (objlockscope->offsetobjlock=&(objlockscope->lock[objlockscope->offset++]); } else { objlockstate_t *tmp=malloc(sizeof(objlockstate_t)); - int i; - for(i=0; ilock[i]), NULL); tmp->next=objlockscope; - x->objlock=&(tmp->lock[0]); tmp->offset=1; - objlockscope=tmp; + x->objlock=&(tmp->lock[0]); + objlockscope=tmp; } pthread_mutex_unlock(&lockedobjstore); + pthread_mutex_init(x->objlock, NULL); + //should put a memory barrier here + x->riskyflag = 1; } } #endif @@ -148,12 +147,7 @@ objheader_t *transCreateObj(void * ptr, unsigned int size) { objheader_t *retval=&tmp[1]; tmp->lock=RW_LOCK_BIAS; tmp->version = 1; - tmp->abortCount = 0; - tmp->accessCount = 0; - tmp->riskyflag = 0; - tmp->trec = NULL; //initialize obj lock to the header - tmp->objlock = NULL; STATUS(tmp)=NEW; // don't insert into table if (newobjs->offset___cachedCode___=src->___cachedCode___; dst->___cachedHash___=src->___cachedHash___; memcpy(&dst[1], &src[1], tmpsize-sizeof(struct ___Object___)); - header->version += 1; + __asm__ __volatile__("": : :"memory"); + header->version++; } + __asm__ __volatile__("": : :"memory"); /* Release write locks */ for(i=0; i< numoidwrlocked; i++) { @@ -759,6 +755,7 @@ int transCommitProcess(void ** oidwrlocked, int numoidwrlocked) { ptr=ptr->next; } #endif + return 0; } diff --git a/Robust/src/Runtime/thread.c b/Robust/src/Runtime/thread.c index 18bb2281..678e2847 100644 --- a/Robust/src/Runtime/thread.c +++ b/Robust/src/Runtime/thread.c @@ -118,6 +118,14 @@ void initializethreads() { trec=calloc(1, sizeof(threadrec_t)); trec->blocked = 0; lockedobjs=calloc(1, sizeof(struct objlist)); + objlockscope = calloc(1, sizeof(objlockstate_t)); + pthread_mutex_init(&lockedobjstore, NULL); + { + int i; + for(i=0; i