|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mmtk.plan.Plan org.mmtk.plan.Simple org.mmtk.plan.StopTheWorld org.mmtk.plan.semispace.SS org.mmtk.plan.semispace.gcspy.SSGCspy
public class SSGCspy
This class extends a simple semi-space collector to instrument it for GCspy.
See the Jones & Lins GC book, section 2.2 for an overview of the basic algorithm. This implementation also includes a large object space (LOS), and an uncollected "immortal" space.
All plans make a clear distinction between global and thread-local activities. Global activities must be synchronized, whereas no synchronization is required for thread-local activities. Instances of Plan map 1:1 to "kernel threads" (aka CPUs). Thus instance methods allow fast, unsychronized access to Plan utilities such as allocation and collection. Each instance rests on static resources (such as memory and virtual memory resources) which are "global" and therefore "static" members of Plan. This mapping of threads to instances is crucial to understanding the correctness and performance proprties of this plan.
FIXME This seems to have changed The order of phases and GCspy actions is important here. It is:
PREPARE phase SSGCspyMutator.gcspyGatherData(SSGCspy.BEFORE_COLLECTION); // safepoint SSMutator.PREPARE // FIXME DOES NOT ss.rebind(SS.toSpace()); PREPARE phase SS.PREPARE // flip semispaces gcspySpace.prepare(); SSGCspyCollector.gcspyGatherData(SSGCspy.BEFORE_COLLECTION); SSCollector.PREPARE // ss.rebind(SS.toSpace()); FORWARD_FINALIZABLE phase SSCollector.FORWARD_FINALIZABLE SSGCspyCollector.gcspyGatherData(SSGCspy.SEMISPACE_COPIED); RELEASE phase SSGCspyMutator.gcspyGatherData(SSGCspy.SEMISPACE_COPIED); // safepoint SSMutator.RELEASE // FIXME ss.rebind(SS.toSpace()); SSGCspyMutator.gcspyGatherData(SSGCspy.AFTER_COLLECTION); RELEASE phase SSCollector.RELEASE SSGCspyCollector.gcspyGatherData(SSGCspy.AFTER_COLLECTION); SS.RELEASE gcspySpace.release(); SSGCspy.gcspyGatherData(); // safepointNote that SSMutator has changed the point at which it rebinds toSpace from PREPARE (2.4.6) to after RELEASE (3.x.x).
--Phase Collector.initiate --Phase Mutator.initiate-mutator --Phase Mutator.prepare-mutator SSGCspyMutator.gcspyGatherData, event=0 --Phase Plan.prepare --Phase Collector.prepare SSGCspyCollector.gcspyGatherData, event=0 --Phase Collector.bootimage-root --Phase Collector.root --Phase Plan.root --Phase Collector.start-closure --Phase Collector.soft-ref --Phase Collector.complete-closure --Phase Collector.weak-ref --Phase Collector.finalize --Phase Collector.complete-closure --Phase Collector.phantom-ref --Phase Collector.forward-ref --Phase Collector.forward-finalize SSGCspyCollector.gcspyGatherData, event=1 --Phase Mutator.release-mutator SSGCspyMutator.gcspyGatherData, event=1 SSGCspyMutator.gcspyGatherData, event=2 --Phase Collector.release SSGCspyCollector.gcspyGatherData, event=2 --Phase Plan.release SSGCspy.gcspyGatherData, event=2 --Phase Collector.complete --Phase Plan.complete
Field Summary | |
---|---|
(package private) static int |
AFTER_COLLECTION
The collection is complete, i.e. immediately after SS.collectionPhase(SS.RELEASE,..). |
(package private) static int |
BEFORE_COLLECTION
Before a collection has started, i.e. before SS.collectionPhase(SS.PREPARE,..). |
private static boolean |
DEBUG
|
(package private) static int |
gcspyEvent_
|
(package private) static ImmortalSpaceDriver |
immortalDriver
|
(package private) static TreadmillDriver |
losDriver
|
(package private) static TreadmillDriver |
losNurseryDriver
|
(package private) static TreadmillDriver |
plosDriver
|
(package private) static TreadmillDriver |
plosNurseryDriver
|
(package private) static int |
SEMISPACE_COPIED
After the semispace has been copied and the large object space has been traced At this time the Large Object Space has not been swept. |
(package private) static LinearSpaceDriver |
ss0Driver
|
(package private) static LinearSpaceDriver |
ss1Driver
|
Fields inherited from class org.mmtk.plan.semispace.SS |
---|
ALLOC_SS, copySpace0, copySpace1, hi, SCAN_SS, SS0, SS1, ssTrace |
Fields inherited from class org.mmtk.plan.StopTheWorld |
---|
postSanityPhase, preSanityPhase |
Fields inherited from interface org.mmtk.plan.GCspyPlan |
---|
GCSPY, gcspySpace |
Constructor Summary | |
---|---|
SSGCspy()
|
Method Summary | |
---|---|
void |
collectionPhase(short phaseId)
Perform a (global) collection phase. |
private void |
gcspyGatherData(int event)
Gather data for GCspy for the semispaces, the immortal space and the large object space. |
int |
getPagesUsed()
Return the number of pages reserved for use given the pending allocation. |
private LinearSpaceDriver |
newLinearSpaceDriver(String name,
CopySpace space,
boolean mainSpace)
Create a new LinearSpaceDriver TODO is this the best name or should we call it LargeObjectSpaceDriver? |
private TreadmillDriver |
newTreadmillDriver(String name,
LargeObjectSpace space)
Create a new TreadmillDriver TODO is this the best name or should we call it LargeObjectSpaceDriver? |
protected void |
registerSpecializedMethods()
Register specialized methods. |
(package private) static void |
reportSpaces()
Report information on the semispaces |
void |
startGCspyServer(int port,
boolean wait)
Start the server and wait if necessary. |
Methods inherited from class org.mmtk.plan.semispace.SS |
---|
fromSpace, getCollectionReserve, getPagesAvail, toSpace, willNeverMove |
Methods inherited from class org.mmtk.plan.StopTheWorld |
---|
processOptions |
Methods inherited from class org.mmtk.plan.Simple |
---|
replacePhase, replacePlaceholderPhase, switchNurseryZeroingApproach |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final int BEFORE_COLLECTION
static final int SEMISPACE_COPIED
static final int AFTER_COLLECTION
static int gcspyEvent_
static LinearSpaceDriver ss0Driver
static LinearSpaceDriver ss1Driver
static ImmortalSpaceDriver immortalDriver
static TreadmillDriver losNurseryDriver
static TreadmillDriver losDriver
static TreadmillDriver plosNurseryDriver
static TreadmillDriver plosDriver
private static final boolean DEBUG
Constructor Detail |
---|
public SSGCspy()
Method Detail |
---|
public final void startGCspyServer(int port, boolean wait)
server = ServerInterpreter.init(name, portNumber, verbose);
server.addEvent(eventID, eventName);
server.setGeneralInfo(info);
myDriver = new MyDriver(server, args...);Drivers extend AbstractDriver and register their spce with the ServerInterpreter. In addition to the server, drivers will take as arguments the name of the space, the MMTk space, the tilesize, and whether this space is to be the main space in the visualiser.
startGCspyServer
in class Plan
wait
- Whether to waitport
- The port to talk to the GCspy client (e.g. visualiser)private LinearSpaceDriver newLinearSpaceDriver(String name, CopySpace space, boolean mainSpace)
name
- Name of the spacespace
- The space
private TreadmillDriver newTreadmillDriver(String name, LargeObjectSpace space)
name
- Name of the spacespace
- The space
public void collectionPhase(short phaseId)
collectionPhase
in class SS
phaseId
- The unique id of the phase to perform.private void gcspyGatherData(int event)
This method sweeps the semispace under consideration to gather data. Alternatively and more efficiently, 'used space' can obviously be discovered in constant time simply by comparing the start and the end addresses of the semispace. However, per-object information can only be gathered by sweeping through the space and we do this here for tutorial purposes.
event
- The event, either BEFORE_COLLECTION, SEMISPACE_COPIED or
AFTER_COLLECTIONpublic final int getPagesUsed()
getPagesUsed
in class SS
static void reportSpaces()
protected void registerSpecializedMethods()
Plan
registerSpecializedMethods
in class SS
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |