public abstract class AbstractDriver extends Object
This class implements for the MMTk a base driver for a GCspy space. All drivers for GCspy spaces should inherit from this class.
Modifier and Type | Field and Description |
---|---|
protected int |
blockSize
The GCspy space's block size
|
protected boolean |
changed
Has this space changed?
|
protected byte[] |
control
control values for tiles in this space
|
protected static byte |
CONTROL_BACKGROUND
The tile is a background tile
|
protected static byte |
CONTROL_LINK
The tile is a link
|
protected static byte |
CONTROL_SEPARATOR
The tile is a separator
|
protected static byte |
CONTROL_UNUSED
The tile is unused
|
protected static byte |
CONTROL_USED
The tile is used
|
private static boolean |
DEBUG |
private static int |
MAX_STREAMS |
protected int |
maxTileNum
The maximum number of tiles in this GCspy space
|
protected Space |
mmtkSpace
The MMTK space
|
protected String |
myClass |
protected String |
name
The name of the GCspy space driver
|
protected ServerInterpreter |
server
The owning GCspy server
|
protected ServerSpace |
serverSpace
The GCspy space abstraction
|
protected Stream[] |
streams
This space's streams
|
Constructor and Description |
---|
AbstractDriver(ServerInterpreter server,
String name,
Space mmtkSpace,
int blockSize,
boolean mainSpace)
Create a new driver for this collector.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addControl(int index,
byte value)
Add a control to the tile
|
void |
addStream(Stream stream)
Add a stream to the driver.
|
protected static boolean |
controlIsBackground(byte val)
Is a tile a background pseudo-tile?
|
protected static boolean |
controlIsSeparator(byte val)
Is this a separator?
|
protected static boolean |
controlIsUnused(byte val)
Is a tile unused?
|
protected static boolean |
controlIsUsed(byte val)
Is a tile used?
|
protected void |
controlValues(byte tag,
int start,
int len)
Set the control value in each tile in a region.
|
protected int |
countTileNum(Address start,
Address end,
int tileSize)
Count number of tiles in an address range.
|
protected int |
countTileNum(Extent extent,
int tileSize)
Count number of tiles in an address range.
|
private int |
countTileNum(int diff,
int tileSize) |
protected ServerSpace |
createServerSpace(ServerInterpreter server,
String spaceName,
int maxTileNum,
boolean mainSpace)
Create a new GCspy ServerSpace and add it to the ServerInterpreter.
|
protected Subspace |
createSubspace(Space mmtkSpace)
Creates a subspace for this space.
|
byte |
getControl(int index)
Get the controls for a tile.
|
protected abstract String |
getDriverName()
Get the name of this driver type.
|
int |
getMaxTileNum()
Get the maximum number of tiles in this space.
|
ServerSpace |
getServerSpace()
The GCspy space managed by this driver.
|
boolean |
handleReferenceFromImmortalSpace(Address addr)
Handle a direct reference from the immortal space.
|
protected void |
initControl(int index,
byte value)
Initialise the value of a control.
|
protected void |
initControls()
Initialise control values in all tiles
|
boolean |
isConnected(int event) |
int |
maxObjectsPerBlock(int blockSize)
The "typical" maximum number of objects in each tile.
|
protected void |
resetData()
Reset the statistics for a space.
|
void |
scan(Address obj)
Scan an object found at a location.
|
void |
scan(Address obj,
boolean total)
Scan an object found at a location.
|
void |
scan(ObjectReference obj)
Scan an object found at a location.
|
void |
scan(ObjectReference obj,
boolean total)
Scan an object found at a location.
|
protected void |
send(int event,
int numTiles)
Send all the streams for this space if it has changed.
|
protected void |
setControl(int index,
byte value)
Set the control
|
void |
setRange(Address start,
Address end)
Indicate the limits of a space.
|
void |
setRange(Address start,
Extent extent)
Indicate the limits of a space.
|
protected void |
setSpaceInfo(Offset size)
Set space info.
|
protected void |
setTilenames(Subspace subspace,
int numTiles)
Setup the tile names in a subspace.
|
abstract void |
transmit(int event)
Transmit the streams for this space.
|
protected static final byte CONTROL_USED
protected static final byte CONTROL_BACKGROUND
protected static final byte CONTROL_UNUSED
protected static final byte CONTROL_SEPARATOR
protected static final byte CONTROL_LINK
private static final int MAX_STREAMS
private static final boolean DEBUG
protected final ServerInterpreter server
protected final ServerSpace serverSpace
protected int blockSize
protected int maxTileNum
protected byte[] control
protected boolean changed
public AbstractDriver(ServerInterpreter server, String name, Space mmtkSpace, int blockSize, boolean mainSpace)
server
- The ServerInterpreter that owns this GCspy space.name
- The name of this driver.mmtkSpace
- The MMTk space represented by this driver.blockSize
- The tile size.mainSpace
- Is this the main space?protected Subspace createSubspace(Space mmtkSpace)
mmtkSpace
- The MMTk spaceprotected ServerSpace createServerSpace(ServerInterpreter server, String spaceName, int maxTileNum, boolean mainSpace)
server
- the GCspy ServerInterpreter.spaceName
- The name of this driver.maxTileNum
- the maximum number of tiles in this space.mainSpace
- Is this the main space?protected abstract String getDriverName()
public int getMaxTileNum()
public ServerSpace getServerSpace()
public void addStream(Stream stream)
stream
- The streamIndexOutOfBoundsException
- if more than MAX_STREAMS are addedprotected int countTileNum(Address start, Address end, int tileSize)
start
- The start of the range.end
- The end of the range.tileSize
- The size of each tile.protected int countTileNum(Extent extent, int tileSize)
extent
- The extent of the range.tileSize
- The size of each tile.private int countTileNum(int diff, int tileSize)
public void setRange(Address start, Address end)
start
- the Address of the start of the space.end
- the Address of the end of the space.public void setRange(Address start, Extent extent)
start
- the Address of the start of the space.extent
- the extent of the space.protected void setTilenames(Subspace subspace, int numTiles)
subspace
- the SubspacenumTiles
- the number of tiles to namepublic int maxObjectsPerBlock(int blockSize)
blockSize
- The size of a tilepublic boolean isConnected(int event)
event
- The current eventprotected void resetData()
public void scan(ObjectReference obj, boolean total)
obj
- the reference to the object foundtotal
- Whether to total the statisticspublic void scan(ObjectReference obj)
obj
- the reference to the object foundpublic void scan(Address obj, boolean total)
obj
- the reference to the object foundtotal
- Whether to total the statisticspublic void scan(Address obj)
obj
- the reference to the object foundpublic boolean handleReferenceFromImmortalSpace(Address addr)
This is an empty implementation. Subclasses may override this method
to increment their refFromImmortal
Stream.
addr
- The Addresstrue
if the given Address is in this subspace. Always false
here.protected void setSpaceInfo(Offset size)
size
- the size of the spaceprotected static boolean controlIsUsed(byte val)
val
- the control value.true
if the tile is usedprotected static boolean controlIsBackground(byte val)
val
- the control value.true
if the tile is a background tileprotected static boolean controlIsUnused(byte val)
val
- the control value.true
if the tile is unusedprotected static boolean controlIsSeparator(byte val)
val
- the control value.true
if this is a separatorprotected void initControl(int index, byte value)
index
- The index of the tile.value
- The new value of the controlprotected void addControl(int index, byte value)
index
- The index of the tile.value
- The control to add.protected void setControl(int index, byte value)
index
- the index of the tilevalue
- The value to setpublic byte getControl(int index)
index
- The index of the tile.protected void initControls()
protected void controlValues(byte tag, int start, int len)
tag
- The control tag.start
- The start index of the region.len
- The number of tiles in the region.public abstract void transmit(int event)
server.isConnected(event)
stream.setSummary(values...);
controlValues(CONTROL_USED, start, numBlocks);
controlValues(CONTROL_UNUSED, end, remainingBlocks);
setSpace(info);
send(event, numTiles);Note that AbstractDriver.send takes care of sending the information for all streams (including control data).
event
- The eventprotected void send(int event, int numTiles)
event
- the eventnumTiles
- the number of blocks in this space