1 cananian 1.1.2.1 // HeapStatsAllocationStrategy.java, created by cananian
 2 cananian 1.1.2.1 // Copyright (C) 2002 C. Scott Ananian <cananian@alumni.princeton.edu>
 3 cananian 1.1.2.1 // Licensed under the terms of the GNU GPL; see COPYING for details.
 4 cananian 1.1.2.1 package harpoon.Backend.Runtime1;
 5 cananian 1.1.2.1 
 6 cananian 1.1.2.1 import harpoon.Analysis.Maps.AllocationInformation.AllocationProperties;
 7 cananian 1.1.2.1 import harpoon.Backend.Generic.Frame;
 8 cananian 1.1.2.1 import harpoon.ClassFile.HClass;
 9 cananian 1.1.2.1 import harpoon.ClassFile.HCodeElement;
10 cananian 1.1.2.1 import harpoon.IR.Tree.DerivationGenerator;
11 cananian 1.1.2.1 import harpoon.IR.Tree.Exp;
12 cananian 1.1.2.1 import harpoon.IR.Tree.ExpList;
13 cananian 1.1.2.1 import harpoon.IR.Tree.TreeFactory;
14 cananian 1.1.2.1 import harpoon.IR.Tree.CONST;
15 cananian 1.1.2.1 import harpoon.IR.Tree.ESEQ;
16 cananian 1.1.2.1 import harpoon.IR.Tree.NAME;
17 cananian 1.1.2.1 import harpoon.IR.Tree.TEMP;
18 cananian 1.1.2.1 import harpoon.IR.Tree.Type;
19 cananian 1.1.2.1 import harpoon.Temp.Label;
20 cananian 1.1.2.1 import harpoon.Temp.Temp;
21 cananian 1.1.2.1 /**
22 cananian 1.1.2.1  * <code>HeapStatsAllocationStrategy</code> calls the appropriate C functions
23 cananian 1.1.2.1  * in the --with-live-heap-statistics runtime code to collect statistics
24 cananian 1.1.2.1  * for objects and arrays allocated.
25 cananian 1.1.2.1  * 
26 cananian 1.1.2.1  * @author  C. Scott Ananian <cananian@alumni.princeton.edu>
27 cananian 1.2      * @version $Id: HeapStatsAllocationStrategy.java,v 1.2 2002/04/10 03:03:20 cananian Exp $
28 cananian 1.1.2.1  */
29 cananian 1.1.2.1 public class HeapStatsAllocationStrategy extends MallocAllocationStrategy {
30 cananian 1.1.2.1 
31 cananian 1.1.2.1     /** Creates a <code>HeapStatsAllocationStrategy</code>.
32 cananian 1.1.2.1      */
33 cananian 1.1.2.1     public HeapStatsAllocationStrategy(Frame f) { super(f, "heapstats_alloc"); }
34 cananian 1.1.2.1 
35 cananian 1.1.2.1     public Exp memAlloc(TreeFactory tf, HCodeElement source,
36 cananian 1.1.2.1                         DerivationGenerator dg,
37 cananian 1.1.2.1                         AllocationProperties ap,
38 cananian 1.1.2.1                         Exp length) {
39 cananian 1.1.2.1         return buildAllocCall(tf, source, dg, ap, "heapstats_alloc2", length,
40 cananian 1.1.2.1                               new ExpList
41 cananian 1.1.2.1                               (new CONST(tf, source,
42 cananian 1.1.2.1                                          ap.actualClass().isArray() ? 1 : 0),
43 cananian 1.1.2.1                                null));
44 cananian 1.1.2.1     }
45 cananian 1.2     }