1 cananian 1.1.2.1 // BDWAllocationStrategy.java, created Mon Apr 3 20:00:00 2000 by cananian
 2 cananian 1.1.2.1 // Copyright (C) 2000 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.ESEQ;
15 cananian 1.1.2.1 import harpoon.IR.Tree.NAME;
16 cananian 1.1.2.1 import harpoon.IR.Tree.TEMP;
17 cananian 1.1.2.1 import harpoon.IR.Tree.Type;
18 cananian 1.1.2.1 import harpoon.Temp.Label;
19 cananian 1.1.2.1 import harpoon.Temp.Temp;
20 cananian 1.1.2.1 /**
21 cananian 1.1.2.1  * <code>BDWAllocationStrategy</code> calls the appropriate C functions
22 cananian 1.1.2.1  * in the Boehm-Demers-Weiser conservative garbage collector library
23 cananian 1.1.2.1  * to do the allocation.
24 cananian 1.1.2.1  * 
25 cananian 1.1.2.1  * @author  C. Scott Ananian <cananian@alumni.princeton.edu>
26 cananian 1.2      * @version $Id: BDWAllocationStrategy.java,v 1.2 2002/02/25 21:02:19 cananian Exp $
27 cananian 1.1.2.1  */
28 cananian 1.1.2.1 public class BDWAllocationStrategy extends MallocAllocationStrategy {
29 cananian 1.1.2.1 
30 cananian 1.1.2.1     /** Creates a <code>BDWAllocationStrategy</code>.
31 cananian 1.1.2.1      */
32 cananian 1.1.2.1     public BDWAllocationStrategy(Frame f) { super(f, "GC_malloc"); }
33 cananian 1.1.2.1 
34 cananian 1.1.2.1     public Exp memAlloc(TreeFactory tf, HCodeElement source,
35 cananian 1.1.2.1                         DerivationGenerator dg,
36 cananian 1.1.2.1                         AllocationProperties ap,
37 cananian 1.1.2.1                         Exp length) {
38 cananian 1.1.2.1         return buildAllocCall(tf, source, dg, ap,
39 cananian 1.1.2.1                               ap.hasInteriorPointers() ?
40 cananian 1.1.2.1                               "GC_malloc" : "GC_malloc_atomic", length, null);
41 cananian 1.1.2.1     }
42 cananian 1.2     }