return fstotimap.get(fs).get(new TaskIndex(td, index));
}
+ public Set<OptionalTaskDescriptor> getOptions(FlagState fs, TaskIndex ti) {
+ return fstotimap.get(fs).get(ti);
+ }
+
public Set<TaskIndex> getTaskIndex(FlagState fs) {
return fstotimap.get(fs).keySet();
}
else
setotd=new HashSet<OptionalTaskDescriptor>();
}
-
- TaskIndex ti=new TaskIndex(egnode.getTD(), egnode.getIndex());
- if (timap.containsKey(ti)) {
- //AND case
- timap.put(ti, createIntersection(timap.get(ti), setotd, fs.getClassDescriptor()));
- } else {
- timap.put(ti, setotd);
+ TaskIndex ti=egnode.isRuntime()?new TaskIndex():new TaskIndex(egnode.getTD(), egnode.getIndex());
+ if (!ti.runtime) {
+ //runtime edges don't do anything...don't have to take them, can't predict when we can.
+ if (timap.containsKey(ti)) {
+ //AND case
+ timap.put(ti, createIntersection(timap.get(ti), setotd, fs.getClassDescriptor()));
+ } else {
+ timap.put(ti, setotd);
+ }
}
}
for(int i=0;i<scc.numSCC();i++) {
Set component=scc.getSCC(i);
HashSet flagset=new HashSet();
- for(Iterator compit=flagset.iterator();compit.hasNext();) {
+ for(Iterator compit=component.iterator();compit.hasNext();) {
TagBinding tb=(TagBinding)compit.next();
flagset.addAll(tb.getAllocations());
for(Iterator edgeit=tb.edges();edgeit.hasNext();) {
flagset.addAll(tb2.getAllocations());
}
}
- for(Iterator compit=flagset.iterator();compit.hasNext();) {
+ for(Iterator compit=component.iterator();compit.hasNext();) {
TagBinding tb=(TagBinding)compit.next();
tb.getAllocations().addAll(flagset);
}
}
private void computeCallsFlags(FlatMethod fm, Hashtable parammap, Set tagbindings, Set newflags) {
+ System.out.println(" "+fm.getMethod());
Set nodeset=fm.getNodeSet();
for(Iterator nodeit=nodeset.iterator();nodeit.hasNext();) {
FlatNode fn=(FlatNode)nodeit.next();
private void computeTagBindings(Set roots) {
tovisit.addAll(roots);
-
+
for(Iterator it=roots.iterator();it.hasNext();) {
TagBinding tb=(TagBinding)it.next();
discovered.put(tb,tb);
continue;
if (trigger_ctr>1)
- throw new Error("Illegal Operation: A single flagstate cannot satisfy more than one parameter of a task.");
+ System.out.println("Illegal Operation: A single flagstate cannot satisfy more than one parameter of a task:"+fs + " in "+td);
Set newstates=taganalysis.getFlagStates(td);
public class TaskIndex {
TaskDescriptor td;
int index;
+ boolean runtime;
public TaskIndex(TaskDescriptor td, int index) {
this.td=td;
this.index=index;
+ runtime=false;
+ }
+
+ public TaskIndex() {
+ runtime=true;
+ }
+
+ public boolean isRuntime() {
+ return runtime;
}
public int hashCode() {
+ if (runtime)
+ return 71;
return td.hashCode()^index;
}
public boolean equals(Object o) {
if (o instanceof TaskIndex) {
TaskIndex ti=(TaskIndex) o;
+ if (ti.runtime==runtime)
+ return true;
+
if (ti.index==index && ti.td==td)
return true;
}
Set<TaskIndex> tiset=sa.getTaskIndex(fs);
for(Iterator<TaskIndex> itti=tiset.iterator();itti.hasNext();) {
TaskIndex ti=itti.next();
- Set<OptionalTaskDescriptor> otdset=sa.getOptions(fs, ti.getTask(), ti.getIndex());
+ if (ti.isRuntime())
+ continue;
+
+ Set<OptionalTaskDescriptor> otdset=sa.getOptions(fs, ti);
output.print("struct optionaltaskdescriptor * optionaltaskfailure_"+ti.getTask().getSafeSymbol()+"_"+ti.getIndex()+"_array[] = {");
boolean needcomma=false;
tiset=sa.getTaskIndex(fs);
boolean needcomma=false;
+ int runtimeti=0;
output.println("struct taskfailure * taskfailurearray"+fscounter+"_"+cdtemp.getSafeSymbol()+"[]={");
for(Iterator<TaskIndex> itti=tiset.iterator();itti.hasNext();) {
TaskIndex ti=itti.next();
+ if (ti.isRuntime()) {
+ runtimeti++;
+ continue;
+ }
if (needcomma)
output.print(", ");
needcomma=true;
output.println("/*flag*/"+flagid+",");
output.println("/* number of tags*/"+tagcounter+",");
output.println("tags_FS"+fscounter+"_"+cdtemp.getSafeSymbol()+",");
- output.println("/* numtask failures */"+tiset.size()+",");
+ output.println("/* numtask failures */"+(tiset.size()-runtimeti)+",");
output.println("taskfailurearray"+fscounter+"_"+cdtemp.getSafeSymbol()+",");
output.println("/* number of optionaltaskdescriptors */"+availabletasks.size()+",");
output.println("optionaltaskdescriptorarray_FS"+fscounter+"_"+cdtemp.getSafeSymbol());