From 9e81fc5b71ea6b09d15ad3298e90e8048faa2ac2 Mon Sep 17 00:00:00 2001 From: yeom Date: Thu, 29 Oct 2009 01:26:54 +0000 Subject: [PATCH 1/1] more changes. --- Robust/src/Analysis/MLP/StallSite.java | 48 ++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/Robust/src/Analysis/MLP/StallSite.java b/Robust/src/Analysis/MLP/StallSite.java index edb794d9..beb1b65e 100644 --- a/Robust/src/Analysis/MLP/StallSite.java +++ b/Robust/src/Analysis/MLP/StallSite.java @@ -1,7 +1,10 @@ package Analysis.MLP; import java.util.HashSet; +import java.util.Iterator; +import Analysis.OwnershipAnalysis.AllocationSite; +import Analysis.OwnershipAnalysis.HeapRegionNode; import Analysis.OwnershipAnalysis.ReachabilitySet; public class StallSite { @@ -10,21 +13,46 @@ public class StallSite { public static final Integer WRITE_EFFECT = new Integer(2); private HashSet effectSet; - private HashSet hrnIDSet; + private HashSet hrnSet; + private HashSet allocationSiteSet; private ReachabilitySet rechabilitySet; public StallSite() { effectSet = new HashSet(); - hrnIDSet = new HashSet(); + hrnSet = new HashSet(); rechabilitySet = new ReachabilitySet(); + allocationSiteSet=new HashSet(); + } + + public StallSite(HashSet hrnSet){ + this(); + setHeapRegionNodeSet(hrnSet); + for (Iterator iterator = hrnSet.iterator(); iterator.hasNext();) { + HeapRegionNode heapRegionNode = (HeapRegionNode) iterator.next(); + setAllocationSite(heapRegionNode.getAllocationSite()); + } } - public StallSite(HashSet effectSet, HashSet hrnIDSet, + public StallSite(HashSet effectSet, HashSet hrnSet, ReachabilitySet rechabilitySet) { this.effectSet = effectSet; - this.hrnIDSet = hrnIDSet; + this.hrnSet = hrnSet; this.rechabilitySet = rechabilitySet; } + + public void setAllocationSite(AllocationSite allocationSite){ + if(allocationSite!=null){ + allocationSiteSet.add(allocationSite); + } + } + + public void setHeapRegionNodeSet(HashSet newSet){ + hrnSet.addAll(newSet); + } + + public HashSet getAllocationSiteSet(){ + return allocationSiteSet; + } public void addEffect(String type, String field, Integer effect) { Effect e = new Effect(type, field, effect); @@ -35,8 +63,8 @@ public class StallSite { return effectSet; } - public HashSet getHRNIDSet() { - return hrnIDSet; + public HashSet getHRNSet() { + return hrnSet; } public ReachabilitySet getReachabilitySet() { @@ -56,7 +84,7 @@ public class StallSite { StallSite in = (StallSite) o; if (effectSet.equals(in.getEffectSet()) - && hrnIDSet.equals(in.getHRNIDSet()) + && hrnSet.equals(in.getHRNSet()) && rechabilitySet.equals(in.getReachabilitySet())) { return true; } else { @@ -64,6 +92,12 @@ public class StallSite { } } + + public String toString() { + return "StallSite [effectSet=" + effectSet + ", hrnIDSet=" + hrnSet + + ", rechabilitySet=" + rechabilitySet + "]"; + } + } class Effect { -- 2.34.1