org.mmtk.plan.semispace.gctrace
Class GCTrace
java.lang.Object
org.mmtk.plan.Plan
org.mmtk.plan.Simple
org.mmtk.plan.StopTheWorld
org.mmtk.plan.semispace.SS
org.mmtk.plan.semispace.gctrace.GCTrace
- All Implemented Interfaces:
- Constants
public class GCTrace
- extends SS
This plan has been modified slightly to perform the processing necessary
for GC trace generation. To maximize performance, it attempts to remain
as faithful as possible to semiSpace/Plan.java.
The generated trace format is as follows:
B 345678 12
(Object 345678 was created in the boot image with a size of 12 bytes)
U 59843 234 47298
(Update object 59843 at the slot at offset 234 to refer to 47298)
S 1233 12345
(Update static slot 1233 to refer to 12345)
T 4567 78924
(The TIB of 4567 is set to refer to 78924)
D 342789
(Object 342789 became unreachable)
A 6860 24 346648 3
(Object 6860 was allocated, requiring 24 bytes, with fp 346648 on
thread 3; this allocation has perfect knowledge)
a 6884 24 346640 5
(Object 6864 was allocated, requiring 24 bytes, with fp 346640 on
thread 5; this allocation DOES NOT have perfect knowledge)
I 6860 24 346648 3
(Object 6860 was allocated into immortal space, requiring 24 bytes,
with fp 346648 on thread 3; this allocation has perfect knowledge)
i 6884 24 346640 5
(Object 6864 was allocated into immortal space, requiring 24 bytes,
with fp 346640 on thread 5; this allocation DOES NOT have perfect
knowledge)
48954->[345]LObject;:blah()V:23 Ljava/lang/Foo;
(Citation for: a) where the was allocated, fp of 48954,
at the method with ID 345 -- or void Object.blah() -- and bytecode
with offset 23; b) the object allocated is of type java.lang.Foo)
D 342789 361460
(Object 342789 became unreachable after 361460 was allocated)
This class implements a simple semi-space collector. 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.
Fields inherited from class org.mmtk.plan.Simple |
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 |
Fields inherited from class org.mmtk.plan.Plan |
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 |
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 |
Constructor Summary |
GCTrace()
Constructor |
Method Summary |
void |
collectionPhase(short phaseId)
Perform a (global) collection phase. |
boolean |
collectionRequired(boolean spaceFull,
Space space)
This method controls the triggering of a GC. |
static GCTrace |
global()
|
boolean |
isLastGCFull()
|
void |
notifyExit(int value)
The planExit method is called at RVM termination to allow the
trace process to finish. |
void |
processOptions()
The processOptions method is called by the runtime immediately after
command-line arguments are available. |
Methods inherited from class org.mmtk.plan.Plan |
availableMemory, bootTimeWriteBarrier, concurrentCollectionRequired, enableAllocation, enableCollection, forceFullHeapCollection, freeMemory, fullyBooted, gcInProgress, gcInProgressProper, getAllocationSite, getPagesReserved, getSpecializedScanClass, getTotalPages, handleUserCollectionRequest, harnessBegin, harnessEnd, insertPhaseAfter, isCurrentGCNursery, isEmergencyCollection, isInitialized, isInternalTriggeredCollection, isUserTriggeredCollection, lastCollectionFullHeap, lastCollectionWasExhaustive, loadObjectReference, logPoll, poll, printDetailedTiming, printPostStats, printPreStats, printUsedPages, reservedMemory, resetCollectionTrigger, sanityExpectedRC, sanityLinearScan, setGCStatus, stacksPrepared, startGCspyServer, storeObjectReference, stressTestGCRequired, totalMemory, triggerInternalCollectionRequest, usedMemory |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
traceSpace
public static final RawPageSpace traceSpace
TRACE
public static final int TRACE
lastGCWasTracing
public static boolean lastGCWasTracing
traceInducedGC
public static boolean traceInducedGC
deathScan
public static boolean deathScan
finalDead
public static boolean finalDead
GCTrace
public GCTrace()
- Constructor
processOptions
public void processOptions()
- Description copied from class:
StopTheWorld
- The processOptions method is called by the runtime immediately after
command-line arguments are available. Allocation must be supported
prior to this point because the runtime infrastructure may require
allocation in order to parse the command line arguments. For this
reason all plans should operate gracefully on the default minimum
heap size until the point that processOptions is called.
- Overrides:
processOptions
in class StopTheWorld
notifyExit
public final void notifyExit(int value)
- The planExit method is called at RVM termination to allow the
trace process to finish.
- Overrides:
notifyExit
in class Plan
- Parameters:
value
- The exit value
collectionRequired
public final boolean collectionRequired(boolean spaceFull,
Space space)
- Description copied from class:
Plan
- This method controls the triggering of a GC. It is called periodically
during allocation. Returns
true
to trigger a collection.
- Overrides:
collectionRequired
in class Plan
- Parameters:
spaceFull
- Space request failed, must recover pages within 'space'.space
- TODO
- Returns:
true
if a collection is requested by the plan.
collectionPhase
public void collectionPhase(short phaseId)
- Perform a (global) collection phase.
- Overrides:
collectionPhase
in class SS
- Parameters:
phaseId
- The unique id of the phase to perform.
isLastGCFull
public boolean isLastGCFull()
- Returns:
- Since trace induced collections are not called to free up memory,
their failure to return memory isn't cause for concern.
global
public static GCTrace global()
- Returns:
- the active Plan as a GCTrace