From ea08d4c1838e7fdc6b22da83ec205539aae41a7a Mon Sep 17 00:00:00 2001 From: bdemsky Date: Tue, 13 Oct 2009 20:33:09 +0000 Subject: [PATCH] small changes --- Robust/src/Analysis/MLP/SESETree.java | 49 +++++++++++++++++++-------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/Robust/src/Analysis/MLP/SESETree.java b/Robust/src/Analysis/MLP/SESETree.java index 62e91c10..f63e78ab 100644 --- a/Robust/src/Analysis/MLP/SESETree.java +++ b/Robust/src/Analysis/MLP/SESETree.java @@ -46,7 +46,15 @@ public class SESETree { return sesemap.get(enter); } - private void analyzeMethod(FlatMethod fm, Set context) { + public Set getSESE(MethodDescriptor md) { + return discovered.get(md); + } + + public Hashtable> analyzeMethod(FlatMethod fm) { + return analyzeMethod(fm, null); + } + + private Hashtable> analyzeMethod(FlatMethod fm, Set context) { Hashtable> stacks=new Hashtable> (); stacks.put(fm, new Stack()); HashSet tovisit=new HashSet(); @@ -59,6 +67,8 @@ public class SESETree { Stack instack=stacks.get(fm); switch(fn.kind()) { case FKind.FlatCall: { + if (context==null) + break; FlatCall fc=(FlatCall)fn; //handle method call Set parents; @@ -81,17 +91,20 @@ public class SESETree { } case FKind.FlatSESEEnterNode: { FlatSESEEnterNode enter=(FlatSESEEnterNode)fn; - Set parents; - if (instack.isEmpty()) { - parents=context; - } else { - parents=new HashSet(); - parents.add(instack.peek()); - } - SESENode sese=getSESE(enter); - for(Iterator parentit=parents.iterator();parentit.hasNext();) { - SESENode parentsese=parentit.next(); - parentsese.addChild(sese); + + if (context!=null) { + Set parents; + if (instack.isEmpty()) { + parents=context; + } else { + parents=new HashSet(); + parents.add(instack.peek()); + } + SESENode sese=getSESE(enter); + for(Iterator parentit=parents.iterator();parentit.hasNext();) { + SESENode parentsese=parentit.next(); + parentsese.addChild(sese); + } } Stack copy=(Stack)instack.clone(); copy.push(sese); @@ -115,8 +128,7 @@ public class SESETree { } } } - - + return stacks; } public static boolean add(Hashtable> discovered, MethodDescriptor md, SESENode sese) { @@ -132,6 +144,8 @@ public class SESETree { class SESENode { boolean isRoot; HashSet children; + HashSet parents; + FlatSESEEnterNode node; SESENode(FlatSESEEnterNode node, boolean isRoot) { children=new HashSet(); @@ -143,10 +157,15 @@ public class SESETree { return children.isEmpty(); } - public void addChild(SESENode child) { + protected void addChild(SESENode child) { children.add(child); + child.parents.add(this); } + public Set getParents() { + return parents; + } + public Set getChildren() { return children; } -- 2.34.1