From: bdemsky Date: Sat, 18 Apr 2009 01:17:08 +0000 (+0000) Subject: integrate typeanalysis X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=64d33653ccf78eacfad07d9225aaf32bd9c2e87d;p=IRC.git integrate typeanalysis --- diff --git a/Robust/src/Analysis/Locality/DiscoverConflicts.java b/Robust/src/Analysis/Locality/DiscoverConflicts.java index 4db34352..9f35c7cc 100644 --- a/Robust/src/Analysis/Locality/DiscoverConflicts.java +++ b/Robust/src/Analysis/Locality/DiscoverConflicts.java @@ -20,12 +20,14 @@ public class DiscoverConflicts { Hashtable> treadmap; Hashtable> transreadmap; Hashtable> srcmap; - - public DiscoverConflicts(LocalityAnalysis locality, State state) { + TypeAnalysis typeanalysis; + + public DiscoverConflicts(LocalityAnalysis locality, State state, TypeAnalysis typeanalysis) { this.locality=locality; this.fields=new HashSet(); this.arrays=new HashSet(); this.state=state; + this.typeanalysis=typeanalysis; transreadmap=new Hashtable>(); treadmap=new Hashtable>(); srcmap=new Hashtable>(); @@ -56,7 +58,12 @@ public class DiscoverConflicts { } public void expandTypes() { - //FIX ARRAY...compute super/sub sets of each so we can do simple membership test + Set expandedarrays=new HashSet(); + for(Iterator it=arrays.iterator();it.hasNext();) { + TypeDescriptor td=it.next(); + expandedarrays.addAll(typeanalysis.expand(td)); + } + arrays=expandedarrays; } Hashtable> doMerge(FlatNode fn, Hashtable>> tmptofnset) { diff --git a/Robust/src/Analysis/Locality/TypeAnalysis.java b/Robust/src/Analysis/Locality/TypeAnalysis.java index beba8203..e90b860f 100644 --- a/Robust/src/Analysis/Locality/TypeAnalysis.java +++ b/Robust/src/Analysis/Locality/TypeAnalysis.java @@ -92,6 +92,10 @@ public class TypeAnalysis { 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()); @@ -145,9 +149,9 @@ public class TypeAnalysis { 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(); @@ -162,7 +166,7 @@ public class TypeAnalysis { } for(int i=0;i