MethodDescriptor md=fc.getMethod();
Set<FieldDescriptor> fields=gft.getFields(md);
Set<TypeDescriptor> arrays=gft.getArrays(md);
- killexpressions(tab, fields, arrays, gft.containsAtomic(md));
+ killexpressions(tab, fields, arrays, gft.containsAtomic(md)||gft.containsBarrier(md));
break;
}
case FKind.FlatOpNode:
Hashtable<MethodDescriptor, Set<FieldDescriptor>> fields;
Hashtable<MethodDescriptor, Set<TypeDescriptor>> arrays;
HashSet<MethodDescriptor> containsAtomic;
+ HashSet<MethodDescriptor> containsBarrier;
public GlobalFieldType(CallGraph cg, State st, MethodDescriptor root) {
this.cg=cg;
this.fields=new Hashtable<MethodDescriptor, Set<FieldDescriptor>>();
this.arrays=new Hashtable<MethodDescriptor, Set<TypeDescriptor>>();
this.containsAtomic=new HashSet<MethodDescriptor>();
+ this.containsBarrier=new HashSet<MethodDescriptor>();
doAnalysis();
}
private void doAnalysis() {
if (containsAtomic.add(md))
changed=true;
}
+ if (containsBarrier.contains(md2)) {
+ if (containsBarrier.add(md))
+ changed=true;
+ }
}
}
}
return containsAtomic.contains(md);
}
+ public boolean containsBarrier(MethodDescriptor md) {
+ return containsBarrier.contains(md);
+ }
+
public Set<FieldDescriptor> getFields(MethodDescriptor md) {
return fields.get(md);
}
fields.get(md).add(fsfn.getField());
} else if (fn.kind()==FKind.FlatAtomicEnterNode) {
containsAtomic.add(md);
+ } else if (fn.kind()==FKind.FlatCall) {
+ MethodDescriptor mdcall=((FlatCall)fn).getMethod();
+ if (mdcall.getSymbol().equals("enterBarrier")&&
+ mdcall.getClassDesc().getSymbol().equals("Barrier"))
+ containsBarrier.add(md);
}
}
}
dstf.set.add(src);
HashSet<FieldDescriptor> fields=new HashSet<FieldDescriptor>();
fields.add(fsfn.getField());
- kill(table, fields, null, false);
+ kill(table, fields, null, false, false);
table.put(src, dstf);
break;
}
dstf.set.add(src);
HashSet<TypeDescriptor> arrays=new HashSet<TypeDescriptor>();
arrays.add(fsen.getDst().getType());
- kill(table, null, arrays, false);
+ kill(table, null, arrays, false, false);
table.put(src, dstf);
break;
}
MethodDescriptor md=fc.getMethod();
Set<FieldDescriptor> fields=gft.getFields(md);
Set<TypeDescriptor> arrays=gft.getArrays(md);
- kill(table, fields, arrays, gft.containsAtomic(md));
+ kill(table, fields, arrays, gft.containsAtomic(md), gft.containsBarrier(md));
}
default: {
TempDescriptor[] writes=fn.writesTemps();
} while(fn.numPrev()==1);
}
}
- public void kill(Hashtable<LocalExpression, Group> tab, Set<FieldDescriptor> fields, Set<TypeDescriptor> arrays, boolean isAtomic) {
+ public void kill(Hashtable<LocalExpression, Group> tab, Set<FieldDescriptor> fields, Set<TypeDescriptor> arrays, boolean isAtomic, boolean isBarrier) {
Set<LocalExpression> eset=tab.keySet();
for(Iterator<LocalExpression> it=eset.iterator();it.hasNext();) {
LocalExpression e=it.next();
- if (isAtomic&&(e.td!=null||e.f!=null)) {
+ if (isBarrier) {
+ //make Barriers kill everything
+ it.remove();
+ } else if (isAtomic&&(e.td!=null||e.f!=null)) {
Group g=tab.get(e);
g.set.remove(e);
it.remove();