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;
30 protected TypeDescriptor type;
33 public AllocationSite( int allocationDepth, TypeDescriptor type ) {
34 assert allocationDepth >= 3;
36 this.allocationDepth = allocationDepth;
39 ithOldest = new Vector<Integer>( allocationDepth );
40 id = generateUniqueAllocationSiteID();
43 static public Integer generateUniqueAllocationSiteID() {
45 return new Integer( uniqueIDcount );
49 public void setIthOldest( int i, Integer id ) {
51 assert i < allocationDepth;
54 ithOldest.add( i, id );
57 public Integer getIthOldest( int i ) {
59 assert i < allocationDepth;
61 return ithOldest.get( i );
64 public Integer getOldest() {
65 return ithOldest.get( allocationDepth - 1 );
68 public void setSummary( Integer id ) {
73 public Integer getSummary() {
77 public TypeDescriptor getType() {
81 public String toString() {
82 return "allocSite" + id + "\\n" + type;