+
+ public HashSet<FlatNode> computeNotReadySet(LocalityBinding lb, HashSet<FlatNode> cannotdelay) {
+ //You are in not ready set if:
+ //I. You read a not ready temp
+
+ //II. You read a field or element and both (A) you are not in the
+ //cannot delay set and (B) you do a transactional access to object
+ MethodDescriptor md=lb.getMethod();
+ FlatMethod fm=state.getMethodFlat(md);
+ Hashtable<FlatNode, Integer> atomictable=locality.getAtomic(lb);
+
+ HashSet<FlatNode> notreadynodes=new HashSet<FlatNode>();
+ HashSet<FlatNode> toanalyze=new HashSet<FlatNode>();
+ toanalyze.addAll(fm.getNodeSet());
+ Hashtable<FlatNode, HashSet<TempDescriptor>> notreadymap=new Hashtable<FlatNode, HashSet<TempDescriptor>>();
+
+ while(!toanalyze.isEmpty()) {
+ FlatNode fn=toanalyze.iterator().next();
+ toanalyze.remove(fn);
+ boolean isatomic=atomictable.get(fn).intValue()>0;
+
+ if (!isatomic)
+ continue;
+
+ //Compute initial notready set
+ HashSet<TempDescriptor> notreadyset=new HashSet<TempDescriptor>();
+ for(int i=0;i<fn.numPrev();i++) {
+ if (notreadymap.containsKey(fn.getPrev(i)))
+ notreadyset.addAll(notreadymap.get(fn.getPrev(i)));
+ }
+
+ //Are we ready
+ boolean notready=false;
+
+ //Test our read set first
+ TempDescriptor readset[]=fn.readsTemps();
+ for(int i=0;i<readset.length;i++) {
+ TempDescriptor tmp=readset[i];
+ if (notreadyset.contains(tmp)) {
+ notready=true;
+ break;
+ }
+ }
+
+ if (!notready&&!cannotdelay.contains(fn)&&
+ (fn.kind()==FKind.FlatFieldNode||fn.kind()==FKind.FlatElementNode)&&
+ dcopts.getNeedTrans(lb, fn)) {
+ notready=true;
+ }
+
+ //Fix up things based on our status
+ if (notready) {
+ //add us to the list
+ notreadynodes.add(fn);
+ //Add our writes
+ TempDescriptor writeset[]=fn.writesTemps();
+ for(int i=0;i<writeset.length;i++) {
+ TempDescriptor tmp=writeset[i];
+ notreadyset.add(tmp);
+ }
+ } else {
+ //Kill our writes
+ TempDescriptor writeset[]=fn.writesTemps();
+ for(int i=0;i<writeset.length;i++) {
+ TempDescriptor tmp=writeset[i];
+ notreadyset.remove(tmp);
+ }
+ }
+
+ //See if we need to propagate changes
+ if (!notreadymap.containsKey(fn)||
+ !notreadymap.get(fn).equals(notreadyset)) {
+ notreadymap.put(fn, notreadyset);
+ for(int i=0;i<fn.numNext();i++)
+ toanalyze.add(fn.getNext(i));
+ }
+ } //end of while
+ return notreadynodes;
+ } //end of computeNotReadySet