Analysis.OoOJava.ConflictGraph graph = oooa.getConflictGraph(currentSESE);
if(graph!=null){
Set<Analysis.OoOJava.SESELock> seseLockSet = oooa.getLockMappings(graph);
- Set<Analysis.OoOJava.WaitingElement> waitingElementSet =
- graph.getStallSiteWaitingElementSet(fn, seseLockSet);
+ Set<Analysis.OoOJava.WaitingElement> waitingElementSet = graph.getStallSiteWaitingElementSet(fn, seseLockSet);
if(waitingElementSet.size()>0){
output.println("// stall on parent's stall sites ");
}
if(state.RCR) {
//no need to enqueue parent effect if coarse grained conflict clears us
- output.println(" stallrecord.common.parentsStallSem=&rentry->parentStallSem;");
- output.println(" stallrecord.tag=rentry->tag;");
- output.println(" "+rcr.getTraverserInvocation(waitingElement.getTempDesc(), generateTemp(fm, waitingElement.getTempDesc(), null)+", &stallrecord", fn));
+ output.println(" stallrecord.common.parentsStallSem=&rentry->parentStallSem;");
+ output.println(" stallrecord.tag=rentry->tag;");
+ output.println(" stallrecord.___obj___=(struct ___Object___ *)"+generateTemp(fm, waitingElement.getTempDesc(), null)+";");
+ output.println(" stallrecord.common.classID=-"+rcr.getTraverserID(waitingElement.getTempDesc(), fn)+";");
+ output.println(" enqueueTR(TRqueue, (void *)&stallrecord);");
}
output.println(" psem_take( &(rentry->parentStallSem), (struct garbagelist *)&___locals___ );");
if( state.COREPROF ) {
import java.util.Iterator;
import java.util.Set;
import java.util.Vector;
+import Util.Tuple;
import Analysis.Disjoint.*;
import Analysis.MLP.CodePlan;
import IR.Flat.*;
//This keeps track of taints we've traversed to prevent printing duplicate traverse functions
//The Integer keeps track of the weakly connected group it's in (used in enumerateHeapRoots)
private Hashtable<Taint, Integer> doneTaints;
+ private Hashtable<Tuple, Integer> idMap=new Hashtable<Tuple,Integer>();
private Hashtable<Taint, Set<Effect>> globalEffects;
private Hashtable<Taint, Set<Effect>> globalConflicts;
private ArrayList<TraversalInfo> toTraverse;
+ public int currentID=1;
+
// initializing variables can be found in printHeader()
private static final String getAllocSiteInC = "->allocsite";
private static final String queryVistedHashtable = "hashRCRInsert";
return "traverse___" + invar.getSafeSymbol() +
removeInvalidChars(flatname) + "___("+varString+");";
}
+
+ public int getTraverserID(TempDescriptor invar, FlatNode fn) {
+ Tuple t=new Tuple(invar, fn);
+ if (idMap.containsKey(t))
+ return idMap.get(t).intValue();
+ int value=currentID++;
+ idMap.put(t, new Integer(value));
+ return value;
+ }
public String removeInvalidChars(String in) {
StringBuilder s = new StringBuilder(in);
cFile.println( " break;");
}
+ for(Taint t: doneTaints.keySet()) {
+ if (t.isStallSiteTaint()){
+ cFile.println( " case -" + getTraverserID(t.getVar(), t.getStallSite())+ ": {");
+ cFile.println( " SESEstall * rec=(SESEstall*) record;");
+ cFile.println( " " + this.getTraverserInvocation(t.getVar(), "rec->___obj___, rec", t.getStallSite())+";");
+ cFile.println( " }");
+ cFile.println(" break;");
+ }
+ }
+
cFile.println(" default:\n printf(\"Invalid SESE ID was passed in.\\n\");\n break;");
cFile.println(" }");
//This is done with the assumption that an array of object stores pointers.
currCase.append("{\n int i;\n");
currCase.append(" for(i = 0; i<((struct ArrayObject *) " + prefix + " )->___length___; i++ ) {\n");
- //XXXXXXXXX
currCase.append(" struct ___Object___ * arrayElement =((struct ___Object___ **)(((char *) &(((struct ArrayObject *)"+ prefix+")->___length___))+sizeof(int)))[i];\n");
currCase.append(" if( arrayElement != NULL && (");
int shift=__builtin_ctzll(mask)+1;
index+=shift;
if (atomic_sub_and_test(1,&array[index].count)) {
- if(unlikely(record->classID==STALLCLASSID)) {
+ if(unlikely(record->classID<0)) {
//parent stall...clear it
psem_give_tag(record->parentsStallSem, ((SESEstall *)record)->tag);
} else {
struct rcrRecord *next;
};
-#define STALLCLASSID 1939921
-
typedef struct SESEstall_t {
SESEcommon common;
int size;
void * next;
+ struct ___Object___* ___obj___;
struct rcrRecord rcrRecords[1];
int tag;
} SESEstall;
pthread_attr_setdetachstate( &nattr, PTHREAD_CREATE_DETACHED );
//set up the stall site SESErecord
- stallrecord.common.classID=STALLCLASSID;
stallrecord.common.offsetToParamRecords=(INTPTR) &((SESEstall *)0)->rcrRecords;
+ stallrecord.common.classID=-1;
if( TRqueue == NULL ) {
TRqueue = allocTR();
--- /dev/null
+package Util;
+
+public class Tuple {
+ private Object a;
+ private Object b;
+ public Tuple(Object a, Object b) {
+ this.a=a;
+ this.b=b;
+ }
+ public int hashCode() {
+ return a.hashCode()*31+b.hashCode();
+ }
+ public boolean equals(Object o) {
+ if (!(o instanceof Tuple))
+ return false;
+ Tuple t=(Tuple)o;
+ return a.equals(t.a)&&b.equals(t.b);
+ }
+}
\ No newline at end of file