org.mmtk.utility.gcspy.drivers
Class LinearSpaceDriver

java.lang.Object
  extended by org.mmtk.utility.gcspy.drivers.AbstractDriver
      extended by org.mmtk.utility.gcspy.drivers.LinearSpaceDriver
Direct Known Subclasses:
ImmortalSpaceDriver

public class LinearSpaceDriver
extends AbstractDriver

GCspy driver for the MMTk ContigousSpace.

This class implements a simple driver for contiguous MMTk spaces such as CopySpace and ImmortalSpace.


Field Summary
protected  int allTileNum
           
protected  ShortStream arrayObjectsStream
           
protected  ShortStream arrayPrimitiveStream
           
protected  IntStream arrayUsedSpaceStream
           
private static boolean DEBUG
           
protected  Address lastAddress
           
protected  int lastSize
           
protected  ShortStream refFromImmortalStream
           
protected  ShortStream rootsStream
           
protected  ShortStream scalarObjectsStream
           
protected  IntStream scalarUsedSpaceStream
           
private  LinearScan scanner
           
protected  Subspace subspace
           
protected  int totalArrayObjects
           
protected  int totalArrayUsedSpace
           
protected  int totalPrimitives
           
protected  int totalRefFromImmortal
           
protected  int totalRoots
           
protected  int totalScalarObjects
           
protected  int totalScalarUsedSpace
           
 
Fields inherited from class org.mmtk.utility.gcspy.drivers.AbstractDriver
blockSize, changed, control, CONTROL_BACKGROUND, CONTROL_LINK, CONTROL_SEPARATOR, CONTROL_UNUSED, CONTROL_USED, maxTileNum, mmtkSpace, myClass, name, server, serverSpace, streams
 
Constructor Summary
LinearSpaceDriver(ServerInterpreter server, String spaceName, Space mmtkSpace, int blockSize, boolean mainSpace)
          Create a new driver for a contiguous MMTk space.
 
Method Summary
private  ShortStream createArrayObjectsStream()
           
private  ShortStream createArrayPrimitiveStream()
           
private  IntStream createArrayUsedSpaceStream()
           
private  ShortStream createRefFromImmortalStream()
           
private  ShortStream createRootsStream()
           
private  ShortStream createScalarObjectsStream()
           
private  IntStream createScalarUsedSpaceStream()
          Private creator methods to create the Streams.
protected  String getDriverName()
          Get the name of this driver type.
 LinearScan getScanner()
          BumpPointer.linearScan needs a LinearScan object, which we provide here.
 boolean handleReferenceFromImmortalSpace(Address addr)
          Handle a direct reference from the immortal space.
 boolean handleRoot(Address addr)
          Handle a root address
 void resetData()
          Reset the statistics for all the streams, including totals used for summaries
 void resetRootsStream()
          Reset the roots Stream The roots Stream has to be reset separately because we do not gather data in the usual way using scan().
 void scan(ObjectReference obj)
          Update the tile statistics
 void scan(ObjectReference obj, boolean total)
          Update the tile statistics
protected  boolean scanCheckPrimitiveArray(ObjectReference obj, int index, boolean total, int length)
          Check if this Object is an array of primitives.
 void setRange(Address start, Address end)
          Set the current address range of a contiguous space
protected  void setupControlInfo()
          Setup control info part of the transmit method.
protected  void setupSummaries()
          Setup summaries part of the transmit method.
 void transmit(int event)
          Transmit the data if this event is of interest to the client.
 
Methods inherited from class org.mmtk.utility.gcspy.drivers.AbstractDriver
addControl, addStream, controlIsBackground, controlIsSeparator, controlIsUnused, controlIsUsed, controlValues, countTileNum, countTileNum, createServerSpace, createSubspace, getControl, getMaxTileNum, getServerSpace, initControl, initControls, isConnected, maxObjectsPerBlock, scan, scan, send, setControl, setRange, setSpaceInfo, setTilenames
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

scalarUsedSpaceStream

protected IntStream scalarUsedSpaceStream

arrayUsedSpaceStream

protected IntStream arrayUsedSpaceStream

scalarObjectsStream

protected ShortStream scalarObjectsStream

arrayObjectsStream

protected ShortStream arrayObjectsStream

arrayPrimitiveStream

protected ShortStream arrayPrimitiveStream

rootsStream

protected ShortStream rootsStream

refFromImmortalStream

protected ShortStream refFromImmortalStream

subspace

protected Subspace subspace

allTileNum

protected int allTileNum

totalScalarObjects

protected int totalScalarObjects

totalArrayObjects

protected int totalArrayObjects

totalPrimitives

protected int totalPrimitives

totalScalarUsedSpace

protected int totalScalarUsedSpace

totalArrayUsedSpace

protected int totalArrayUsedSpace

totalRoots

protected int totalRoots

totalRefFromImmortal

protected int totalRefFromImmortal

scanner

private final LinearScan scanner

lastAddress

protected Address lastAddress

lastSize

protected int lastSize

DEBUG

private static final boolean DEBUG
See Also:
Constant Field Values
Constructor Detail

LinearSpaceDriver

public LinearSpaceDriver(ServerInterpreter server,
                         String spaceName,
                         Space mmtkSpace,
                         int blockSize,
                         boolean mainSpace)
Create a new driver for a contiguous MMTk space.

Parameters:
server - The GCspy ServerInterpreter
spaceName - The name of this GCspy space
mmtkSpace - The MMTk space
blockSize - The tile size
mainSpace - Is this the main space?
Method Detail

getDriverName

protected String getDriverName()
Description copied from class: AbstractDriver
Get the name of this driver type.

Specified by:
getDriverName in class AbstractDriver
Returns:
The name of this driver.

createScalarUsedSpaceStream

private IntStream createScalarUsedSpaceStream()
Private creator methods to create the Streams.


createArrayUsedSpaceStream

private IntStream createArrayUsedSpaceStream()

createScalarObjectsStream

private ShortStream createScalarObjectsStream()

createArrayPrimitiveStream

private ShortStream createArrayPrimitiveStream()

createArrayObjectsStream

private ShortStream createArrayObjectsStream()

createRootsStream

private ShortStream createRootsStream()

createRefFromImmortalStream

private ShortStream createRefFromImmortalStream()

resetData

public void resetData()
Reset the statistics for all the streams, including totals used for summaries

Overrides:
resetData in class AbstractDriver

getScanner

public LinearScan getScanner()
BumpPointer.linearScan needs a LinearScan object, which we provide here.

Returns:
the scanner for this driver

setRange

public void setRange(Address start,
                     Address end)
Set the current address range of a contiguous space

Overrides:
setRange in class AbstractDriver
Parameters:
start - the start of the contiguous space
end - the end of the contiguous space

scan

public void scan(ObjectReference obj)
Update the tile statistics

Overrides:
scan in class AbstractDriver
Parameters:
obj - The current object

scan

public void scan(ObjectReference obj,
                 boolean total)
Update the tile statistics

Overrides:
scan in class AbstractDriver
Parameters:
obj - The current object
total - Whether to accumulate the values

scanCheckPrimitiveArray

protected boolean scanCheckPrimitiveArray(ObjectReference obj,
                                          int index,
                                          boolean total,
                                          int length)
Check if this Object is an array of primitives.
Part of the public scan() method.

Parameters:
obj - The Object to check
index - Index of the tile
total - Increment summary
length - Current size of the Object, will be added to array space summary.
Returns:
true if this Object is an array of primitives.

transmit

public void transmit(int event)
Transmit the data if this event is of interest to the client.

Implemented using the algorithm pattern, subclasses can override parts of it.

Specified by:
transmit in class AbstractDriver
Parameters:
event - The event, defined in the Plan

setupSummaries

protected void setupSummaries()
Setup summaries part of the transmit method.

Override this method to setup summaries of additional streams in subclasses.


setupControlInfo

protected void setupControlInfo()
Setup control info part of the transmit method.

Override this method to change the controls for your own driver subclass.


handleRoot

public boolean handleRoot(Address addr)
Handle a root address

Parameters:
addr - Root Address
Returns:
true if the given Address is in this subspace.

resetRootsStream

public void resetRootsStream()
Reset the roots Stream The roots Stream has to be reset separately because we do not gather data in the usual way using scan().


handleReferenceFromImmortalSpace

public boolean handleReferenceFromImmortalSpace(Address addr)
Handle a direct reference from the immortal space.

Overrides:
handleReferenceFromImmortalSpace in class AbstractDriver
Parameters:
addr - The Address
Returns:
true if the given Address is in this subspace.