|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.mmtk.plan.Plan
public abstract class Plan
This abstract class implements the global core functionality for all memory management schemes. All global MMTk plans should inherit from this class.
All plans make a clear distinction between global and thread-local activities, and divides global and local state into separate class hierarchies. Global activities must be synchronized, whereas no synchronization is required for thread-local activities. There is a single instance of Plan (or the appropriate sub-class), and a 1:1 mapping of PlanLocal to "kernel threads" (aka CPUs). Thus instance methods of PlanLocal allow fast, unsynchronized access to functions such as allocation and collection. The global instance defines and manages static resources (such as memory and virtual memory resources). This mapping of threads to instances is crucial to understanding the correctness and performance properties of MMTk plans.
| Field Summary | |
|---|---|
static int |
ALLOC_CODE
|
static int |
ALLOC_COLD_CODE
|
static int |
ALLOC_DEFAULT
|
static int |
ALLOC_GCSPY
|
static int |
ALLOC_HOT_CODE
|
static int |
ALLOC_IMMORTAL
|
static int |
ALLOC_LARGE_CODE
|
static int |
ALLOC_LOS
|
static int |
ALLOC_NON_MOVING
|
static int |
ALLOC_NON_REFERENCE
|
static int |
ALLOC_PRIMITIVE_LOS
|
static int |
ALLOC_STACK
|
protected static int |
allocationSiteCount
Support for allocation-site identification |
static int |
ALLOCATORS
|
protected static boolean |
awaitingAsyncCollection
|
protected static int |
collectionTrigger
|
private static boolean |
collectionTriggered
|
static int |
DEFAULT_MAX_NURSERY
|
static int |
DEFAULT_MIN_NURSERY
|
static int |
DEFAULT_POLL_FREQUENCY
|
static int |
DEFAULT_SITE
|
protected static boolean |
emergencyCollection
|
static boolean |
GATHER_WRITE_BARRIER_STATS
|
static int |
GC_PREPARE
|
static int |
GC_PROPER
|
private static int |
gcStatus
|
static int |
HEAP_FULL_MINIMUM
|
static int |
HEAP_FULL_PERCENTAGE
|
static int |
IMMORTAL
|
static ImmortalSpace |
immortalSpace
Any immortal objects allocated after booting are allocated here. |
private static boolean |
initialized
|
protected static boolean |
insideHarness
Harness |
static int |
LARGE_CODE
|
static LargeObjectSpace |
largeCodeSpace
|
private long |
lastStressPages
|
static int |
LOS
|
static LargeObjectSpace |
loSpace
Large objects are allocated into a special large object space. |
static int |
MAX_COLLECTION_ATTEMPTS
|
static int |
MAX_NON_LOS_COPY_BYTES
|
static int |
MAX_NON_LOS_DEFAULT_ALLOC_BYTES
|
static int |
MAX_NON_LOS_NONMOVING_ALLOC_BYTES
|
static int |
META
|
static int |
META_DATA_POLL_FREQUENCY
|
static RawPageSpace |
metaDataSpace
All meta data that is used by MMTk is allocated (and accounted for) in the meta data space. |
static boolean |
NEEDS_LOG_BIT_IN_HEADER
|
static int |
NON_MOVING
|
static int |
NON_PARTICIPANT
|
static MarkSweepSpace |
nonMovingSpace
Space used to allocate objects that cannot be moved. we do not need a large space as the LOS is non-moving. |
static int |
NOT_IN_GC
Constants |
static float |
PLOS_FRAC
|
protected static int |
requiredAtStart
GC State |
static int |
SANITY
|
static SanityChecker |
sanityChecker
Global sanity checking state |
static RawPageSpace |
sanitySpace
Space used by the sanity checker (used at runtime only if sanity checking enabled |
static boolean |
SCAN_BOOT_IMAGE
|
static int |
SMALL_CODE
|
static MarkSweepSpace |
smallCodeSpace
|
protected static boolean |
stacksPrepared
|
protected static long |
timeCap
Support for time-limited GCs |
static Timer |
totalTime
Timer that counts total time |
static boolean |
USE_CODE_SPACE
|
static int |
VM_SPACE
|
static Space |
vmSpace
The space that holds any VM specific objects (e.g. a boot image) |
| Constructor Summary | |
|---|---|
Plan()
Constructor. |
|
| Method Summary | |
|---|---|
static Extent |
availableMemory()
Return the amount of available memory, in bytes. |
void |
boot()
The boot method is called early in the boot process before any allocation. |
Word |
bootTimeWriteBarrier(Word reference)
Perform any required write barrier action when installing an object reference a boot time. |
static void |
checkForAsyncCollection()
Check whether an asynchronous collection is pending. |
static void |
collectionComplete()
A collection has fully completed. |
abstract void |
collectionPhase(short phase)
Perform a (global) collection phase. |
protected boolean |
collectionRequired(boolean spaceFull)
This method controls the triggering of a GC. |
protected boolean |
concurrentCollectionRequired()
This method controls the triggering of an atomic phase of a concurrent collection. |
void |
forceFullHeapCollection()
Force the next collection to be full heap. |
static Extent |
freeMemory()
Return the amount of free memory, in bytes (where free is defined as not in use). |
void |
fullyBooted()
The fullyBooted method is called by the runtime just before normal execution commences. |
static boolean |
gcInProgress()
Return true if a collection is in progress. |
static boolean |
gcInProgressProper()
Return true if a collection is in progress and past the preparatory stage. |
static int |
getAllocationSite(boolean compileTime)
Allocation |
int |
getCollectionReserve()
Return the number of pages reserved for collection. |
int |
getHeapFullThreshold()
The minimum number of pages a GC must have available after a collection for us to consider the collection successful. |
int |
getMetaDataPagesUsed()
Return the number of metadata pages reserved for use given the pending allocation. |
int |
getPagesAvail()
Return the number of pages available for allocation. |
int |
getPagesRequired()
Calculate the number of pages a collection is required to free to satisfy outstanding allocation requests. |
int |
getPagesReserved()
Return the number of pages reserved for use given the pending allocation. |
int |
getPagesUsed()
Return the number of pages reserved for use given the pending allocation. |
Class<?> |
getSpecializedScanClass(int id)
Get the specialized scan with the given id. |
static long |
getTimeCap()
Return the cycle time at which this GC should complete. |
int |
getTotalPages()
Return the total amount of memory managed to the memory management system, in pages. |
static void |
harnessBegin()
Generic hook to allow benchmarks to be harnessed. |
static void |
harnessEnd()
Generic hook to allow benchmarks to be harnessed. |
void |
insertPhaseAfter(int markerScheduledPhase,
int scheduledPhase)
Insert a phase. |
static boolean |
isCollectionTriggered()
Has collection has triggered? |
boolean |
isCurrentGCNursery()
|
static boolean |
isEmergencyCollection()
|
static boolean |
isInitialized()
|
boolean |
lastCollectionFailed()
|
boolean |
lastCollectionFullHeap()
|
boolean |
lastCollectionWasExhaustive()
|
ObjectReference |
loadObjectReference(Address slot)
Load an object reference |
private void |
logPoll(Space space,
String message)
Log a message from within 'poll' |
void |
notifyExit(int value)
The VM is about to exit. |
boolean |
poll(boolean spaceFull,
Space space)
This method is called periodically by the allocation subsystem (by default, each time a page is consumed), and provides the collector with an opportunity to collect. |
void |
postBoot()
The postBoot method is called by the runtime immediately after command-line arguments are available. |
protected void |
printDetailedTiming(boolean totals)
Any Plan can override this to provide additional plan specific timing information. |
void |
printPostStats()
Print out statistics at the end of a GC |
void |
printPreStats()
Print out statistics at the start of a GC |
void |
printUsedPages()
|
protected void |
registerSpecializedMethods()
Register specialized methods. |
void |
replacePhase(int oldScheduledPhase,
int scheduledPhase)
Replace a phase. |
static Extent |
reservedMemory()
Return the amount of memory in use, in bytes. |
int |
sanityExpectedRC(ObjectReference object,
int sanityRootRC)
Return the expected reference count. |
void |
sanityLinearScan(LinearScan scanner)
Perform a linear scan of all spaces to check for possible leaks. |
protected static void |
setAwaitingAsyncCollection()
Request an async GC |
static void |
setCollectionTrigger(int trigger)
Set the collection trigger. |
static void |
setCollectionTriggered()
Set that a collection has been triggered. |
static void |
setGCStatus(int s)
Sets the GC status. |
static boolean |
stacksPrepared()
Return true if stacks have been prepared in this collection cycle. |
void |
startGCspyServer(int port,
boolean wait)
Start GCspy server. |
void |
storeObjectReference(Address slot,
ObjectReference value)
Store an object reference |
boolean |
stressTestGCRequired()
|
static Extent |
totalMemory()
Return the total amount of memory managed to the memory management system, in bytes. |
static Extent |
usedMemory()
Return the amount of memory in use, in bytes. |
boolean |
willNeverMove(ObjectReference object)
Can this object ever move. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int NOT_IN_GC
public static final int GC_PREPARE
public static final int GC_PROPER
public static final int DEFAULT_POLL_FREQUENCY
public static final int META_DATA_POLL_FREQUENCY
public static final boolean USE_CODE_SPACE
public static final float PLOS_FRAC
public static final int HEAP_FULL_MINIMUM
public static final int HEAP_FULL_PERCENTAGE
public static final int ALLOC_DEFAULT
public static final int ALLOC_NON_REFERENCE
public static final int ALLOC_NON_MOVING
public static final int ALLOC_IMMORTAL
public static final int ALLOC_LOS
public static final int ALLOC_PRIMITIVE_LOS
public static final int ALLOC_GCSPY
public static final int ALLOC_CODE
public static final int ALLOC_LARGE_CODE
public static final int ALLOC_HOT_CODE
public static final int ALLOC_COLD_CODE
public static final int ALLOC_STACK
public static final int ALLOCATORS
public static final int DEFAULT_SITE
public static final int NON_PARTICIPANT
public static final boolean GATHER_WRITE_BARRIER_STATS
public static final int DEFAULT_MIN_NURSERY
public static final int DEFAULT_MAX_NURSERY
public static final boolean SCAN_BOOT_IMAGE
public static final int MAX_COLLECTION_ATTEMPTS
public static final int MAX_NON_LOS_DEFAULT_ALLOC_BYTES
public static final int MAX_NON_LOS_NONMOVING_ALLOC_BYTES
public static final int MAX_NON_LOS_COPY_BYTES
public static final boolean NEEDS_LOG_BIT_IN_HEADER
public static final Space vmSpace
public static final ImmortalSpace immortalSpace
public static final RawPageSpace metaDataSpace
public static final LargeObjectSpace loSpace
public static final RawPageSpace sanitySpace
public static final MarkSweepSpace nonMovingSpace
public static final MarkSweepSpace smallCodeSpace
public static final LargeObjectSpace largeCodeSpace
public static final int IMMORTAL
public static final int VM_SPACE
public static final int META
public static final int LOS
public static final int SANITY
public static final int NON_MOVING
public static final int SMALL_CODE
public static final int LARGE_CODE
public static final Timer totalTime
protected static long timeCap
protected static int allocationSiteCount
public static final SanityChecker sanityChecker
private long lastStressPages
protected static int requiredAtStart
protected static int collectionTrigger
protected static boolean emergencyCollection
protected static boolean awaitingAsyncCollection
protected static boolean stacksPrepared
private static boolean initialized
private static boolean collectionTriggered
private static int gcStatus
protected static boolean insideHarness
| Constructor Detail |
|---|
public Plan()
| Method Detail |
|---|
public void boot()
public void postBoot()
public void fullyBooted()
public void notifyExit(int value)
value - The exit valueprotected void printDetailedTiming(boolean totals)
totals - Print totalspublic Word bootTimeWriteBarrier(Word reference)
reference - the reference value that is to be stored
public static int getAllocationSite(boolean compileTime)
public abstract void collectionPhase(short phase)
public void replacePhase(int oldScheduledPhase,
int scheduledPhase)
oldScheduledPhase - The scheduled phase to insert afterscheduledPhase - The scheduled phase to insert
public void insertPhaseAfter(int markerScheduledPhase,
int scheduledPhase)
markerScheduledPhase - The scheduled phase to insert afterscheduledPhase - The scheduled phase to insertpublic boolean lastCollectionWasExhaustive()
public boolean lastCollectionFullHeap()
public static boolean isEmergencyCollection()
public final boolean lastCollectionFailed()
public void forceFullHeapCollection()
public boolean isCurrentGCNursery()
public int sanityExpectedRC(ObjectReference object,
int sanityRootRC)
object - The object to check.sanityRootRC - The number of root references to the object.
public void sanityLinearScan(LinearScan scanner)
scanner - The scanner callback to use.public final boolean stressTestGCRequired()
public static boolean isInitialized()
public static boolean isCollectionTriggered()
public static void setCollectionTriggered()
public static void collectionComplete()
public static boolean stacksPrepared()
public static boolean gcInProgress()
public static boolean gcInProgressProper()
public static void setGCStatus(int s)
s - The new GC status.public void printPreStats()
public final void printPostStats()
public final void printUsedPages()
public static void setCollectionTrigger(int trigger)
public static void harnessBegin()
public static void harnessEnd()
public static Extent freeMemory()
public static Extent availableMemory()
public static Extent usedMemory()
public static Extent reservedMemory()
public static Extent totalMemory()
public final int getTotalPages()
public int getPagesAvail()
public final int getPagesReserved()
public int getCollectionReserve()
public int getPagesUsed()
public int getPagesRequired()
public int getHeapFullThreshold()
public int getMetaDataPagesUsed()
public static long getTimeCap()
public void storeObjectReference(Address slot,
ObjectReference value)
slot - The location of the referencevalue - The value to storepublic ObjectReference loadObjectReference(Address slot)
slot - The location of the reference
public final boolean poll(boolean spaceFull,
Space space)
spaceFull - Space request failed, must recover pages within 'space'.space - The space that triggered the poll.
public static void checkForAsyncCollection()
This is decoupled from the poll() mechanism because the triggering of asynchronous collections can trigger write barriers, which can trigger an asynchronous collection. Thus, if the triggering were tightly coupled with the request to alloc() within the write buffer code, then inifinite regress could result. There is no race condition in the following code since there is no harm in triggering the collection more than once, thus it is unsynchronized.
protected static void setAwaitingAsyncCollection()
private void logPoll(Space space,
String message)
space - message - protected boolean collectionRequired(boolean spaceFull)
spaceFull - Space request failed, must recover pages within 'space'.
protected boolean concurrentCollectionRequired()
public void startGCspyServer(int port,
boolean wait)
port - The port to listen on,wait - Should we wait for a client to connect?public boolean willNeverMove(ObjectReference object)
object - The object in question
protected void registerSpecializedMethods()
public final Class<?> getSpecializedScanClass(int id)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||