1 package Analysis.OwnershipAnalysis;
7 // allocation sites are independent of any particular
8 // ownership graph, unlike most of the other elements
9 // of the ownership analysis. An allocation site is
10 // simply a collection of heap region identifiers that
11 // are associated with a single allocation site in the
12 // program under analysis.
14 // So two different ownership graphs may incorporate
15 // nodes that represent the memory from one allocation
16 // site. In this case there are two different sets of
17 // HeapRegionNode objects, but they have the same
18 // node identifiers, and there is one AllocationSite
19 // object associated with the FlatNew node that gives
20 // the graphs the identifiers in question.
22 public class AllocationSite {
24 static private int uniqueIDcount = 0;
27 protected int allocationDepth;
28 protected Vector<Integer> ithOldest;
29 protected Integer summary;
32 public AllocationSite( int allocationDepth ) {
33 assert allocationDepth >= 3;
35 this.allocationDepth = allocationDepth;
37 ithOldest = new Vector<Integer>( allocationDepth );
38 id = generateUniqueAllocationSiteID();
41 static public Integer generateUniqueAllocationSiteID() {
43 return new Integer( uniqueIDcount );
47 public void setIthOldest( int i, Integer id ) {
49 assert i < allocationDepth;
52 ithOldest.add( i, id );
55 public Integer getIthOldest( int i ) {
57 assert i < allocationDepth;
59 return ithOldest.get( i );
62 public Integer getOldest() {
63 return ithOldest.get( allocationDepth - 1 );
66 public void setSummary( Integer id ) {
71 public Integer getSummary() {
75 public String toString() {
76 return "allocSite" + id;