this system checks heap results against runtime pointers to look for analysis bugs...
[IRC.git] / Robust / src / Analysis / Disjoint / HeapAnalysis.java
1 package Analysis.Disjoint;
2
3 import java.util.*;
4
5 import IR.*;
6 import IR.Flat.TempDescriptor;
7 import IR.Flat.FlatNode;
8 import IR.Flat.FlatNew;
9
10
11 public interface HeapAnalysis {
12   public EffectsAnalysis getEffectsAnalysis();
13   public Alloc getAllocationSiteFromFlatNew(FlatNew node);
14
15   // what are these for?  Well, if your heap analysis wants to model
16   // the command line argument heap as the initial context, AND you are
17   // assigning IDs to allocation sites, the problem is there is no explicit
18   // allocation site for the command line arguments in the source code.  So
19   // what you do is build your model and when these methods are invoked, return
20   // the alloc ID from your model.  So the structure is an array of Strings has
21   // elements that reference a single String, and that String has a field that
22   // references an array of char primitives.
23   public Alloc getCmdLineArgsAlloc();    // an array of String
24   public Alloc getCmdLineArgAlloc();     // a String
25   public Alloc getCmdLineArgBytesAlloc();// an array of char
26
27   // Use these methods to find out what allocation sites
28   // the given pointer might point to at or after the 
29   // given program point.  In the case of a variable and
30   // a field or element dereference you get a hashtable
31   // where the keys are allocs for the variables and the
32   // values are from following the second hop
33   // NOTE: if the set of Alloc's that something can point
34   // to is DONTCARE, this will mean "the analysis doesn't care
35   // what it points to" so the client shouldn't either, NOT
36   // interpreting it as "it can't point to anything."  The
37   // meaning "it can't point to anything" will be represented
38   // by an empty set of Alloc.
39   static public final Set<Alloc>                     DONTCARE_PTR  = new HashSet<Alloc>();
40   static public final Hashtable< Alloc, Set<Alloc> > DONTCARE_DREF = new Hashtable< Alloc, Set<Alloc> >();
41
42   public Set<Alloc> canPointToAt( TempDescriptor x,
43                                   FlatNode programPoint );
44
45   public Set<Alloc> canPointToAfter( TempDescriptor x,
46                                      FlatNode programPoint );
47   
48   public Hashtable< Alloc, Set<Alloc> > canPointToAt( TempDescriptor x,
49                                                       FieldDescriptor f,
50                                                       FlatNode programPoint );
51
52   public Hashtable< Alloc, Set<Alloc> > canPointToAtElement( TempDescriptor x, // x[i]
53                                                              FlatNode programPoint );
54 }
55