Hashtable<LocalityBinding, Set<FlatNode>> treadmap;
Hashtable<LocalityBinding, Set<TempFlatPair>> transreadmap;
Hashtable<LocalityBinding, Set<FlatNode>> srcmap;
-
- public DiscoverConflicts(LocalityAnalysis locality, State state) {
+ TypeAnalysis typeanalysis;
+
+ public DiscoverConflicts(LocalityAnalysis locality, State state, TypeAnalysis typeanalysis) {
this.locality=locality;
this.fields=new HashSet<FieldDescriptor>();
this.arrays=new HashSet<TypeDescriptor>();
this.state=state;
+ this.typeanalysis=typeanalysis;
transreadmap=new Hashtable<LocalityBinding, Set<TempFlatPair>>();
treadmap=new Hashtable<LocalityBinding, Set<FlatNode>>();
srcmap=new Hashtable<LocalityBinding, Set<FlatNode>>();
}
public void expandTypes() {
- //FIX ARRAY...compute super/sub sets of each so we can do simple membership test
+ Set<TypeDescriptor> expandedarrays=new HashSet<TypeDescriptor>();
+ for(Iterator<TypeDescriptor> it=arrays.iterator();it.hasNext();) {
+ TypeDescriptor td=it.next();
+ expandedarrays.addAll(typeanalysis.expand(td));
+ }
+ arrays=expandedarrays;
}
Hashtable<TempDescriptor, Set<TempFlatPair>> doMerge(FlatNode fn, Hashtable<FlatNode, Hashtable<TempDescriptor, Set<TempFlatPair>>> tmptofnset) {
return namemap.get(td);
}
+ public boolean couldAlias(TypeDescriptor td1, TypeDescriptor td2) {
+ return namemap.get(td1).contains(td2);
+ }
+
public void addMapping(TypeDescriptor src, TypeDescriptor dst) {
if (!map.containsKey(src))
map.put(src, new HashSet<TypeDescriptor>());
if (fc.getReturnTemp()!=null) {
addMapping(fc.getMethod().getReturnType(), fc.getReturnTemp().getType());
}
+ MethodDescriptor callmd=fc.getMethod();
if (fc.getThis()!=null) {
//complicated...need to deal with virtual dispatch here
- MethodDescriptor callmd=fc.getMethod();
Set methods=cg.getMethods(callmd);
for(Iterator mdit=methods.iterator();mdit.hasNext();) {
MethodDescriptor md2=(MethodDescriptor)mdit.next();
}
for(int i=0;i<fc.numArgs();i++) {
TempDescriptor arg=fc.getArg(i);
- TypeDescriptor ptype=md.getParamType(i);
+ TypeDescriptor ptype=callmd.getParamType(i);
addMapping(arg.getType(), ptype);
}
break;
import Analysis.CallGraph.CallGraph;
import Analysis.Prefetch.*;
import Analysis.Loops.WriteBarrier;
+import Analysis.Locality.TypeAnalysis;
public class BuildCode {
State state;
this.wb=new WriteBarrier(locality, st);
}
if (state.SINGLETM&&state.DCOPTS) {
- this.dc=new DiscoverConflicts(locality, st);
+ TypeAnalysis typeanalysis=new TypeAnalysis(locality, st, typeutil,callgraph);
+ this.dc=new DiscoverConflicts(locality, st, typeanalysis);
dc.doAnalysis();
}