1 salcianu 1.1 // DefaultAllocationInformationMap.java, created Sat Feb  8 14:21:19 2003 by salcianu
 2 salcianu 1.1 // Copyright (C) 2000 Alexandru Salcianu <salcianu@MIT.EDU>
 3 salcianu 1.1 // Licensed under the terms of the GNU GPL; see COPYING for details.
 4 salcianu 1.1 package harpoon.Analysis;
 5 salcianu 1.1 
 6 salcianu 1.1 import harpoon.Analysis.Maps.AllocationInformation.AllocationProperties;
 7 salcianu 1.1 import harpoon.Analysis.AllocationInformationMap;
 8 salcianu 1.1 import harpoon.Analysis.DefaultAllocationInformation;
 9 cananian 1.2 import harpoon.IR.Quads.Quad;
10 salcianu 1.1 
11 salcianu 1.1 import harpoon.ClassFile.HCodeElement;
12 salcianu 1.1 
13 salcianu 1.1 /** <code>DefaultAllocationInformationMap</code> is a combination of
14 salcianu 1.1     <code>AllocationInformationMap</code> and
15 salcianu 1.1     <code>DefaultAllocationInformation</code>.  Like
16 salcianu 1.1     <code>AllocationInformationMap</code>, it is a growable map from
17 salcianu 1.1     allocation sites to their corresponding allocation properties.
18 salcianu 1.1     However, if no <code>AllocationProperties</code> object is
19 salcianu 1.1     associated with a specific allocation site, <code>query</code>
20 salcianu 1.1     will return a default one, as indicated by
21 salcianu 1.1     <code>DefaultAllocationInformation</code>.
22 salcianu 1.1 
23 salcianu 1.1     @author  Alexandru Salcianu <salcianu@MIT.EDU>
24 cananian 1.2     @version $Id: DefaultAllocationInformationMap.java,v 1.2 2003/03/11 17:49:52 cananian Exp $ */
25 cananian 1.2 public class DefaultAllocationInformationMap
26 cananian 1.2     extends AllocationInformationMap<Quad> implements java.io.Serializable {
27 salcianu 1.1     
28 salcianu 1.1     /** Creates a <code>DefaultAllocationInformationMap</code>. */
29 salcianu 1.1     public DefaultAllocationInformationMap() { }
30 salcianu 1.1 
31 salcianu 1.1     /** Returns the <code>AllocationProperties</code> for an
32 salcianu 1.1         allocation site.  If no such object exists, it returns a
33 salcianu 1.1         default <code>AllocationProperties</code> object. */
34 cananian 1.2     public AllocationProperties query(Quad allocationSite) {
35 salcianu 1.1         AllocationProperties ap = super.query(allocationSite);
36 salcianu 1.1         if(ap == null)
37 salcianu 1.1             ap = DefaultAllocationInformation.SINGLETON.query(allocationSite);
38 salcianu 1.1         return ap;
39 salcianu 1.1     }
40 salcianu 1.1 }