return namemap.get(td);
}
+ public Set<TypeDescriptor> expandSet(Set<TypeDescriptor> tdset) {
+ HashSet<TypeDescriptor> expandedSet=new HashSet<TypeDescriptor>();
+ for(Iterator<TypeDescriptor> 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);
}
}
}
-}
\ No newline at end of file
+}
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}
}
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; i<MAXOBJLIST; i++) {");
- outmethod.println(" pthread_mutex_init(&(objlockscope->lock[i]), NULL);");
- outmethod.println("}");
- outmethod.println("for(i=0; i<TOTALNUMCLASSANDARRAY; i++) {");
- outmethod.println(" typesCausingAbort[i] = 0;");
- outmethod.println("}");
- outmethod.println("#endif\n");
}
if (state.DSM) {
outmethod.println("if (dstmStartup(argv[1])) {");
x->abortCount++;
if (x->abortCount > MAXABORTS && (x->riskyflag != 1)) {
//makes riskflag sticky
- x->riskyflag = 1;
pthread_mutex_lock(&lockedobjstore);
if (objlockscope->offset<MAXOBJLIST) {
x->objlock=&(objlockscope->lock[objlockscope->offset++]);
} else {
objlockstate_t *tmp=malloc(sizeof(objlockstate_t));
- int i;
- for(i=0; i<MAXOBJLIST; i++)
- pthread_mutex_init(&(tmp->lock[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
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<MAXOBJLIST) {
dst->___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++) {
ptr=ptr->next;
}
#endif
+
return 0;
}
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<TOTALNUMCLASSANDARRAY; i++) {
+ typesCausingAbort[i] = 0;
+ }
+ }
#endif
#endif
}