public class SSGCspy extends SS implements GCspyPlan
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
Modifier and Type | Field and Description |
---|---|
(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 |
ALLOC_SS, copySpace0, copySpace1, hi, SCAN_SS, SS0, SS1, ssTrace
postSanityPhase, preSanityPhase
CLOSURE, collection, collectionAttempt, COMPLETE, completeClosurePhase, FINALIZABLE, finishPhase, FORWARD, FORWARD_FINALIZABLE, FORWARD_REFS, forwardPhase, INITIATE, initPhase, PHANTOM_REFS, POST_SANITY_PLACEHOLDER, PRE_SANITY_PLACEHOLDER, PREPARE, PREPARE_STACKS, prepareStacks, refTypeClosurePhase, RELEASE, rootClosurePhase, ROOTS, SANITY_BUILD_TABLE, SANITY_CHECK_TABLE, SANITY_COPY_ROOTS, SANITY_PREPARE, SANITY_RELEASE, SANITY_ROOTS, SANITY_SET_POSTGC, SANITY_SET_PREGC, sanityBuildPhase, sanityCheckPhase, SET_COLLECTION_KIND, SOFT_REFS, STACK_ROOTS, WEAK_REFS, WEAK_TRACK_REFS
ALLOC_CODE, ALLOC_COLD_CODE, ALLOC_DEFAULT, ALLOC_GCSPY, ALLOC_HOT_CODE, ALLOC_IMMORTAL, ALLOC_LARGE_CODE, ALLOC_LOS, ALLOC_NON_MOVING, ALLOC_NON_REFERENCE, ALLOC_PRIMITIVE_LOS, ALLOC_STACK, allocationSiteCount, ALLOCATORS, concurrentWorkers, controlCollectorContext, DEFAULT_MAX_NURSERY, DEFAULT_MIN_NURSERY, DEFAULT_SITE, defaultCollectorContext, emergencyCollection, GATHER_WRITE_BARRIER_STATS, GC_PREPARE, GC_PROPER, IMMORTAL, immortalSpace, insideHarness, internalTriggeredCollection, LARGE_CODE, largeCodeSpace, lastInternalTriggeredCollection, LOS, loSpace, MAX_NON_LOS_COPY_BYTES, MAX_NON_LOS_DEFAULT_ALLOC_BYTES, MAX_NON_LOS_NONMOVING_ALLOC_BYTES, META, metaDataSpace, NEEDS_LOG_BIT_IN_HEADER, NON_MOVING, NON_PARTICIPANT, nonMovingSpace, NOT_IN_GC, parallelWorkers, pretenureThreshold, SANITY, sanityChecker, sanitySpace, SCAN_BOOT_IMAGE, SMALL_CODE, smallCodeSpace, stacksPrepared, totalTime, USE_CODE_SPACE, userTriggeredCollection, VM_SPACE, vmSpace
GCSPY, gcspySpace
Constructor and Description |
---|
SSGCspy() |
Modifier and Type | Method and Description |
---|---|
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()
Registers 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.
|
fromSpace, getCollectionReserve, getPagesAvail, toSpace, willNeverMove
processOptions
replacePhase, replacePlaceholderPhase, switchNurseryZeroingApproach
availableMemory, bootTimeWriteBarrier, collectionRequired, concurrentCollectionRequired, determineThreadCount, enableAllocation, enableCollection, forceFullHeapCollection, freeMemory, fullyBooted, gcInProgress, gcInProgressProper, getAllocationSite, getPagesReserved, getSpecializedScanClass, getTotalPages, handleUserCollectionRequest, harnessBegin, harnessEnd, insertPhaseAfter, isCurrentGCNursery, isEmergencyCollection, isInitialized, isInternalTriggeredCollection, isUserTriggeredCollection, lastCollectionFullHeap, lastCollectionWasExhaustive, loadObjectReference, logPoll, notifyExit, poll, preCollectorSpawn, printDetailedTiming, printPostStats, printPreStats, printUsedPages, reservedMemory, resetCollectionTrigger, sanityExpectedRC, sanityLinearScan, setBuildTimeGCByte, setGCStatus, spawnCollectorThreads, stacksPrepared, storeObjectReference, stressTestGCRequired, totalMemory, triggerInternalCollectionRequest, usedMemory
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
public SSGCspy()
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 spacemainSpace
- whether the space will be the main spaceprivate TreadmillDriver newTreadmillDriver(String name, LargeObjectSpace space)
name
- Name of the spacespace
- The spacepublic 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