From 9d2bea60690743588c0c917584813542bd16f3e4 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Thu, 8 Nov 2007 08:47:44 +0000 Subject: [PATCH] more bugs --- .../TaskStateAnalysis/SafetyAnalysis.java | 20 ++++++++++++------- .../TaskStateAnalysis/TagAnalysis.java | 7 ++++--- .../TaskStateAnalysis/TaskAnalysis.java | 2 +- .../Analysis/TaskStateAnalysis/TaskIndex.java | 15 ++++++++++++++ Robust/src/IR/Flat/BuildCode.java | 12 +++++++++-- 5 files changed, 43 insertions(+), 13 deletions(-) diff --git a/Robust/src/Analysis/TaskStateAnalysis/SafetyAnalysis.java b/Robust/src/Analysis/TaskStateAnalysis/SafetyAnalysis.java index f1cbdb21..8cb13496 100644 --- a/Robust/src/Analysis/TaskStateAnalysis/SafetyAnalysis.java +++ b/Robust/src/Analysis/TaskStateAnalysis/SafetyAnalysis.java @@ -62,6 +62,10 @@ public class SafetyAnalysis { return fstotimap.get(fs).get(new TaskIndex(td, index)); } + public Set getOptions(FlagState fs, TaskIndex ti) { + return fstotimap.get(fs).get(ti); + } + public Set getTaskIndex(FlagState fs) { return fstotimap.get(fs).keySet(); } @@ -168,13 +172,15 @@ public class SafetyAnalysis { else setotd=new HashSet(); } - - 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); + } } } diff --git a/Robust/src/Analysis/TaskStateAnalysis/TagAnalysis.java b/Robust/src/Analysis/TaskStateAnalysis/TagAnalysis.java index 93840a16..c33f7592 100644 --- a/Robust/src/Analysis/TaskStateAnalysis/TagAnalysis.java +++ b/Robust/src/Analysis/TaskStateAnalysis/TagAnalysis.java @@ -46,7 +46,7 @@ public class TagAnalysis { for(int i=0;i1) - 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); diff --git a/Robust/src/Analysis/TaskStateAnalysis/TaskIndex.java b/Robust/src/Analysis/TaskStateAnalysis/TaskIndex.java index 02b64190..84f21d0d 100644 --- a/Robust/src/Analysis/TaskStateAnalysis/TaskIndex.java +++ b/Robust/src/Analysis/TaskStateAnalysis/TaskIndex.java @@ -4,18 +4,33 @@ import IR.TaskDescriptor; 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; } diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index a4679e76..91a96e57 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -2366,7 +2366,10 @@ public class BuildCode { Set tiset=sa.getTaskIndex(fs); for(Iterator itti=tiset.iterator();itti.hasNext();) { TaskIndex ti=itti.next(); - Set otdset=sa.getOptions(fs, ti.getTask(), ti.getIndex()); + if (ti.isRuntime()) + continue; + + Set otdset=sa.getOptions(fs, ti); output.print("struct optionaltaskdescriptor * optionaltaskfailure_"+ti.getTask().getSafeSymbol()+"_"+ti.getIndex()+"_array[] = {"); boolean needcomma=false; @@ -2389,9 +2392,14 @@ public class BuildCode { tiset=sa.getTaskIndex(fs); boolean needcomma=false; + int runtimeti=0; output.println("struct taskfailure * taskfailurearray"+fscounter+"_"+cdtemp.getSafeSymbol()+"[]={"); for(Iterator itti=tiset.iterator();itti.hasNext();) { TaskIndex ti=itti.next(); + if (ti.isRuntime()) { + runtimeti++; + continue; + } if (needcomma) output.print(", "); needcomma=true; @@ -2405,7 +2413,7 @@ public class BuildCode { 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()); -- 2.34.1