org.mmtk.utility
Class TraceGenerator

java.lang.Object
  extended by org.mmtk.utility.TraceGenerator
All Implemented Interfaces:
Constants, TracingConstants

public final class TraceGenerator
extends Object
implements Constants, TracingConstants

Class that supports scanning Objects and Arrays for references during tracing, handling those references, and computing death times


Field Summary
private static Word agePropagate
           
private static int ALLOC_BOOT
           
private static int ALLOCATORS
           
private static Word lastGC
           
static boolean MERLIN_ANALYSIS
          Type of lifetime analysis to be used
private static ObjectReferenceArray objectLinks
           
private static TraceBuffer trace
           
private static boolean traceBusy
           
private static SortTODSharedDeque tracePool
           
private static SortTODObjectReferenceStack worklist
           
private static SortTODSharedDeque workListPool
           
 
Fields inherited from interface org.mmtk.utility.Constants
ALIGNMENT_VALUE, ARRAY_ELEMENT, BITS_IN_ADDRESS, BITS_IN_BYTE, BITS_IN_CHAR, BITS_IN_INT, BITS_IN_PAGE, BITS_IN_SHORT, BITS_IN_WORD, BYTES_IN_ADDRESS, BYTES_IN_BYTE, BYTES_IN_CHAR, BYTES_IN_INT, BYTES_IN_KBYTE, BYTES_IN_MBYTE, BYTES_IN_PAGE, BYTES_IN_SHORT, BYTES_IN_WORD, CARD_MASK, CARD_META_PAGES_PER_REGION, INSTANCE_FIELD, LOG_BITS_IN_ADDRESS, LOG_BITS_IN_BYTE, LOG_BITS_IN_CHAR, LOG_BITS_IN_INT, LOG_BITS_IN_PAGE, LOG_BITS_IN_SHORT, LOG_BITS_IN_WORD, LOG_BYTES_IN_ADDRESS, LOG_BYTES_IN_ADDRESS_SPACE, LOG_BYTES_IN_BYTE, LOG_BYTES_IN_CHAR, LOG_BYTES_IN_INT, LOG_BYTES_IN_KBYTE, LOG_BYTES_IN_MBYTE, LOG_BYTES_IN_PAGE, LOG_BYTES_IN_SHORT, LOG_BYTES_IN_WORD, LOG_CARD_BYTES, LOG_CARD_GRAIN, LOG_CARD_META_BYTES, LOG_CARD_META_PAGES, LOG_CARD_META_SIZE, LOG_CARD_UNITS, LOG_MIN_ALIGNMENT, MAX_ALIGNMENT, MAX_BYTES_PADDING, MAX_INT, MIN_ALIGNMENT, MIN_INT, SUPPORT_CARD_SCANNING
 
Fields inherited from interface org.mmtk.utility.TracingConstants
TRACE_ALLOC, TRACE_ARRAY_SET, TRACE_BOOT_ALLOC, TRACE_BOOTEND, TRACE_BOOTSTART, TRACE_DEATH, TRACE_EXACT_ALLOC, TRACE_EXACT_IMMORTAL_ALLOC, TRACE_FIELD_SET, TRACE_GCBAR, TRACE_GCEND, TRACE_GCROOT, TRACE_GCSTART, TRACE_IMMORTAL_ALLOC, TRACE_ROOTPTR, TRACE_STACKDELTA, TRACE_STATIC_SET, TRACE_THREAD_SWITCH, TRACE_TIB_SET
 
Constructor Summary
TraceGenerator()
           
 
Method Summary
static void addTraceObject(ObjectReference ref, int linkSpace)
          Add a newly allocated object into the linked list of objects in a region.
static void boot(Address bootStart)
          Add the information in the bootImage to the trace.
private static void computeTransitiveClosure()
          This finds all object death times by computing the (limited) transitive closure of the dead objects.
private static void findDeaths()
          This computes and adds to the trace buffer the unreachable time for all of the objects that are _provably_ unreachable.
private static TraceLocal getTraceLocal()
           
static void init(SortTODSharedDeque worklist_, SortTODSharedDeque trace_)
          This is called at "build-time" and passes the necessary build image objects to the trace processor.
static void notifyExit(int value)
          This is called immediately before Jikes terminates.
static void postCollection()
          Do the work necessary following each garbage collection.
static void processPointerUpdate(boolean isScalar, ObjectReference src, Address slot, ObjectReference tgt)
          Do any tracing work required at each a pointer store operation.
static void propagateDeathTime(ObjectReference ref)
          This propagates the death time being computed to the object passed as an address.
static void rootEnumerate(ObjectReference obj)
          This method is called for each root-referenced object at every Merlin root enumeration.
static void traceAlloc(boolean isImmortal, ObjectReference ref, ObjectReference typeRef, int bytes)
          Do any tracing work required at each object allocation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MERLIN_ANALYSIS

public static final boolean MERLIN_ANALYSIS
Type of lifetime analysis to be used

See Also:
Constant Field Values

ALLOC_BOOT

private static final int ALLOC_BOOT
See Also:
Constant Field Values

ALLOCATORS

private static final int ALLOCATORS
See Also:
Constant Field Values

tracePool

private static SortTODSharedDeque tracePool

trace

private static TraceBuffer trace

traceBusy

private static boolean traceBusy

lastGC

private static Word lastGC

objectLinks

private static ObjectReferenceArray objectLinks

workListPool

private static SortTODSharedDeque workListPool

worklist

private static SortTODObjectReferenceStack worklist

agePropagate

private static Word agePropagate
Constructor Detail

TraceGenerator

public TraceGenerator()
Method Detail

init

public static void init(SortTODSharedDeque worklist_,
                        SortTODSharedDeque trace_)
This is called at "build-time" and passes the necessary build image objects to the trace processor.

Parameters:
worklist_ - The dequeue that serves as the worklist for death time propagation
trace_ - The dequeue used to store and then output the trace

notifyExit

public static void notifyExit(int value)
This is called immediately before Jikes terminates. It will perform any death time processing that the analysis requires and then output any remaining information in the trace buffer.

Parameters:
value - The integer value for the reason Jikes is terminating

addTraceObject

public static void addTraceObject(ObjectReference ref,
                                  int linkSpace)
Add a newly allocated object into the linked list of objects in a region. This is typically called after each object allocation.

Parameters:
ref - The address of the object to be added to the linked list
linkSpace - The region to which the object should be added

postCollection

public static void postCollection()
Do the work necessary following each garbage collection. This HAS to be called after EACH collection.


boot

public static void boot(Address bootStart)
Add the information in the bootImage to the trace. This should be called before any allocations and pointer updates have occurred.

Parameters:
bootStart - The address at which the bootimage starts

processPointerUpdate

public static void processPointerUpdate(boolean isScalar,
                                        ObjectReference src,
                                        Address slot,
                                        ObjectReference tgt)
Do any tracing work required at each a pointer store operation. This will add the pointer store to the trace buffer and, when Merlin lifetime analysis is being used, performs the necessary timestamping.

Parameters:
isScalar - If this is a pointer store to a scalar object
src - The address of the source object
slot - The address within src into which tgt will be stored
tgt - The target of the pointer store

traceAlloc

public static void traceAlloc(boolean isImmortal,
                              ObjectReference ref,
                              ObjectReference typeRef,
                              int bytes)
Do any tracing work required at each object allocation. This will add the object allocation to the trace buffer, triggers the necessary collection work at exact allocations, and output the data in the trace buffer.

Parameters:
ref - The address of the object just allocated.
typeRef - the type reference for the instance being created
bytes - The size of the object being allocated

findDeaths

private static void findDeaths()
This computes and adds to the trace buffer the unreachable time for all of the objects that are _provably_ unreachable. This method should be called after garbage collection (but before the space has been reclaimed) and at program termination.


rootEnumerate

public static void rootEnumerate(ObjectReference obj)
This method is called for each root-referenced object at every Merlin root enumeration. The method will update the death time of the parameter to the current trace time.

Parameters:
obj - The root-referenced object

propagateDeathTime

public static void propagateDeathTime(ObjectReference ref)
This propagates the death time being computed to the object passed as an address. If we find the unreachable time for the parameter, it will be pushed on to the processing stack.

Parameters:
ref - The address of the object to examine

computeTransitiveClosure

private static void computeTransitiveClosure()
This finds all object death times by computing the (limited) transitive closure of the dead objects. Death times are computed as the latest reaching death time to an object.


getTraceLocal

private static TraceLocal getTraceLocal()