From 8719149706fee0118fcb761aa00a801a3e1996ba Mon Sep 17 00:00:00 2001 From: bdemsky Date: Thu, 24 May 2007 07:02:08 +0000 Subject: [PATCH] bug fixed in taskanalysis. we missed self edges if the task just returned w/o setting flags --- .../TaskStateAnalysis/Allocations.java | 2 +- .../Analysis/TaskStateAnalysis/FlagState.java | 2 +- .../TaskStateAnalysis/TaskAnalysis.java | 31 +++++++++++++++---- Robust/src/IR/Flat/BuildCode.java | 4 +-- Robust/src/IR/Flat/BuildFlat.java | 19 ++++++++++-- Robust/src/IR/Flat/FlatMethod.java | 17 +++------- Robust/src/Interface/WebInterface.java | 2 +- Robust/src/Makefile | 3 +- 8 files changed, 53 insertions(+), 27 deletions(-) diff --git a/Robust/src/Analysis/TaskStateAnalysis/Allocations.java b/Robust/src/Analysis/TaskStateAnalysis/Allocations.java index 0e275003..760a7a6b 100644 --- a/Robust/src/Analysis/TaskStateAnalysis/Allocations.java +++ b/Robust/src/Analysis/TaskStateAnalysis/Allocations.java @@ -1,7 +1,7 @@ package Analysis.TaskStateAnalysis; import Util.*; -public class Allocations { +public class Allocations extends Namer { public Allocations() {} public String nodeLabel(GraphNode gn) { diff --git a/Robust/src/Analysis/TaskStateAnalysis/FlagState.java b/Robust/src/Analysis/TaskStateAnalysis/FlagState.java index b32c0265..3c862ce5 100644 --- a/Robust/src/Analysis/TaskStateAnalysis/FlagState.java +++ b/Robust/src/Analysis/TaskStateAnalysis/FlagState.java @@ -246,7 +246,7 @@ public class FlagState extends GraphNode { } } if (label==null) - return ""; + return " "; return label; } diff --git a/Robust/src/Analysis/TaskStateAnalysis/TaskAnalysis.java b/Robust/src/Analysis/TaskStateAnalysis/TaskAnalysis.java index 7d98537a..b723e1b8 100644 --- a/Robust/src/Analysis/TaskStateAnalysis/TaskAnalysis.java +++ b/Robust/src/Analysis/TaskStateAnalysis/TaskAnalysis.java @@ -119,12 +119,14 @@ public class TaskAnalysis { ClassDescriptor startupobject=typeutil.getClass(TypeUtil.StartupClass); sourcenodes=(Hashtable)flagstates.get(startupobject); - FlagState fsstartup=new FlagState(startupobject); + + FlagDescriptor[] fd=(FlagDescriptor[])flags.get(startupobject); fsstartup=fsstartup.setFlag(fd[0],true); - + fsstartup.setAsSourceNode(); + sourcenodes.put(fsstartup,fsstartup); toprocess.add(fsstartup); @@ -212,13 +214,21 @@ private void analyseTasks(FlagState fs) { } } + Stack nodestack=new Stack(); + HashSet discovered=new HashSet(); + nodestack.push(fm); + discovered.add(fm); //Iterating through the nodes - Set nodeset=fm.getNodeSet(); - for(Iterator nodeit=nodeset.iterator();nodeit.hasNext();) { - FlatNode fn1 = (FlatNode) nodeit.next(); + while(!nodestack.isEmpty()) { + FlatNode fn1 = (FlatNode) nodestack.pop(); - if (fn1.kind()==FKind.FlatFlagActionNode) { + if (fn1.kind()==FKind.FlatReturnNode) { + /* Self edge */ + FEdge newedge=new FEdge(fs, taskname); + fs.addEdge(newedge); + continue; + } else if (fn1.kind()==FKind.FlatFlagActionNode) { FlatFlagActionNode ffan=(FlatFlagActionNode)fn1; if (ffan.getTaskType() == FlatFlagActionNode.PRE) { if (ffan.getTempFlagPairs().hasNext()||ffan.getTempTagPairs().hasNext()) @@ -243,6 +253,15 @@ private void analyseTasks(FlagState fs) { //FEdge newedge=new FEdge(fs_taskexit,td); fs.addEdge(newedge); } + continue; + } + } + /* Queue other nodes past this one */ + for(int i=0;i"+ cd.getSymbol() +""); + pw.println("Task Graph "+ cd.getSymbol() +""); pw.println("
"); taskgraphmap.put("/"+cd.getSymbol()+"-t.html", cd); } diff --git a/Robust/src/Makefile b/Robust/src/Makefile index 68fbe05f..ee3dbb19 100644 --- a/Robust/src/Makefile +++ b/Robust/src/Makefile @@ -47,6 +47,7 @@ IR/Tree/TagEffect.class IR/Tree/TagExpressionList.class \ IR/Tree/TaskExitNode.class IR/Tree/TreeNode.class \ IR/Tree/Walkable.class Analysis/TaskStateAnalysis/FEdge.class \ Analysis/TaskStateAnalysis/FlagState.class \ +Analysis/TaskStateAnalysis/Allocations.class \ Analysis/TaskStateAnalysis/TEdge.class \ Analysis/TaskStateAnalysis/TagAnalysis.class \ Analysis/TaskStateAnalysis/TagBinding.class \ @@ -78,7 +79,7 @@ javadoc: javadoc -classpath ../cup:.:$(CLASSPATH) -sourcepath . -private -d javadoc Lex Util IR IR.Tree IR.Flat Analysis Analysis.CallGraph Analysis.Flag Analysis.TaskStateAnalysis Main clean: - rm IR/*.class IR/Tree/*.class Main/*.class Lex/*.class Parse/*.class Parse/Sym.java Parse/Parser.java IR/Flat/*.class classdefs.h methodheaders.h methods.c structdefs.h virtualtable.h task.h taskdefs.c taskdefs.h Analysis/*.class Analysis/Flag/*.class Analysis/CallGraph/*.class Analysis/TaskStateAnalysis/*.class Util/Relation/*.class + rm IR/*.class IR/Tree/*.class Main/*.class Lex/*.class Parse/*.class Parse/Sym.java Parse/Parser.java IR/Flat/*.class classdefs.h methodheaders.h methods.c structdefs.h virtualtable.h task.h taskdefs.c taskdefs.h Analysis/*.class Analysis/Flag/*.class Analysis/CallGraph/*.class Analysis/TaskStateAnalysis/*.class Util/Relation/*.class Interface/*.class cleandoc: rm -rf javadoc \ No newline at end of file -- 2.34.1