Capturing stable state.
[IRC.git] / Robust / src / Analysis / OwnershipAnalysis / AllocationSite.java
1 package Analysis.OwnershipAnalysis;
2
3 import IR.*;
4 import IR.Flat.*;
5 import java.util.*;
6
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.
13
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.
21
22 public class AllocationSite {
23
24     protected int allocationDepth;
25     protected Vector<Integer> ithOldest;
26
27     public AllocationSite( int allocationDepth ) {
28         assert allocationDepth >= 3;
29
30         this.allocationDepth = allocationDepth;
31         ithOldest = new Vector<Integer>( allocationDepth );
32     }
33     
34     public void setIthOldest( int i, Integer id ) {
35         assert i  >= 0;
36         assert i  <  allocationDepth;
37         assert id != null;
38
39         ithOldest.add( i, id );
40     }
41
42     public Integer getIthOldest( int i ) {
43         assert i >= 0;
44         assert i <  allocationDepth;
45
46         return ithOldest.get( i );
47     }
48 }