harpoon.Instrumentation.AllocationStatistics
Class AllocationNumberingStub
java.lang.Object
harpoon.Instrumentation.AllocationStatistics.AllocationNumberingStub
- All Implemented Interfaces:
- AllocationNumberingInterf
public class AllocationNumberingStub
- extends Object
- implements AllocationNumberingInterf
AllocationNumberingStub
is a very simple
implementation of AllocationNumberingInterf
designed
to avoid serialization (serialization is buggy in many, if not all,
JVMs). Instead, AllocationNumberingStub
s can be
textualized to/from an ASCII file.
- Version:
- $Id: AllocationNumberingStub.java,v 1.5 2005/08/17 23:40:52 salcianu Exp $
- Author:
- Alexandru SALCIANU <salcianu@MIT.edu>
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AllocationNumberingStub
public AllocationNumberingStub(Linker linker,
String filename)
throws IOException
- Create an
AllocationNumberingStub
by parsing a
text file. This is the only approved way of creating an
AllocationNumberingStub
object.
- Parameters:
linker
- Linker; given a string, gives the
HClass
objects that represents the class with that
name (this is used mostly for convenience: it's easier to work
with HClass
es and HMethod
s instead of
just strings).filename
- Name of the file that contains the
textualized version of the
AllocationNumberingStub
- Throws:
IOException
allocID
public int allocID(Quad q)
- Specified by:
allocID
in interface AllocationNumberingInterf
- Returns:
- a unique identifier for the allocation site
q
.
May throw UnknownAllocationSiteError
if the
instrumentation has not seen that allocation site when the
unique IDs where assigned.
writeToFile
public static void writeToFile(AllocationNumbering an,
String filename,
Linker linker)
throws IOException
- Write into a file a simplified version of an
AllocationNumbering object. This method does a very simple
serialization, I would call it textualization. It
outputs just enough information to retrieve the ID of each
quad; the output has only ASCII characters.
One can construct an
AllocationNumberingStub
stub
from the textualized file image, using the appropriate
constructor.
- Parameters:
an
- AllocationNumbering
to textualizefilename
- Name of the file to write the textualization into.linker
- Linker used to load the classes of the compiled
program. If non-null, it will be used to parse the file back
into an AllocationNumberingStub
and verify that
the unique IDs for the allocation sites did not change. If
null, no verification will be performed.
- Throws:
IOException