|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.mmtk.plan.MutatorContext
org.mmtk.plan.SimpleMutator
org.mmtk.plan.StopTheWorldMutator
org.mmtk.plan.generational.GenMutator
org.mmtk.plan.generational.immix.GenImmixMutator
org.jikesrvm.mm.mminterface.Selected.Mutator
org.jikesrvm.mm.mminterface.ThreadContext
org.jikesrvm.scheduler.RVMThread
org.jikesrvm.mm.mminterface.CollectorThread
public final class CollectorThread
System thread used to preform garbage collections. These threads are created by VM.boot() at runtime startup. One is created for each processor that will (potentially) participate in garbage collection.
Its "run" method does the following:
1. wait for a collection request
2. synchronize with other collector threads (stop mutation)
3. reclaim space
4. synchronize with other collector threads (resume mutation)
5. goto 1
Between collections, the collector threads are parked on a pthread
condition variable. A collection in initiated by a call to the static
collect(Handshake,int) method, which calls
Handshake.requestAndAwaitCompletion(int) to signal the threads.
The collection commences when all
scheduled collector threads arrive at the first "rendezvous" in the run
methods run loop.
An instance of Handshake contains state information for the "current"
collection. When a collection is finished, a new Handshake is allocated
for the next garbage collection.
Handshake| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.jikesrvm.scheduler.RVMThread |
|---|
RVMThread.BlockAdapter, RVMThread.GCBlockAdapter, RVMThread.HandshakeBlockAdapter, RVMThread.HardHandshakeVisitor, RVMThread.SoftHandshakeVisitor, RVMThread.SuspendBlockAdapter, RVMThread.Waiting |
| Field Summary | |
|---|---|
static int |
collectionAttemptBase
The base collection attempt |
(package private) static int |
collectionCount
number of collections |
(package private) static boolean |
DISPLAY_OPTIONS_AT_BOOT
When true, causes RVM collectors to display heap configuration at startup |
static int |
GC_ORDINAL_BASE
gc threads are indexed from 1 for now... |
static SynchronizationBarrier |
gcBarrier
Use by collector threads to rendezvous during collection |
private int |
gcOrdinal
arrival order of collectorThreads participating in a collection |
(package private) static boolean |
gcThreadRunning
|
static Handshake |
handshake
The Handshake object that contains the state of the next or current (in progress) collection. |
static boolean |
MEASURE_WAIT_TIMES
When true, collector threads measure time spent waiting for buffers while processing the Work Deque, and time spent waiting in Rendezvous during the collection process. |
private static String |
myName
Name used by toString() and when we create the associated java.lang.Thread. |
private static int |
nextId
Next collector thread id. |
(package private) static int[] |
participantCount
array of size 1 to count arriving collector threads |
private Address |
stackTraceThread
The thread to use to determine stack traces if Throwables are created |
private ScanThread |
threadScanner
used by each CollectorThread when scanning stacks for references |
static boolean |
TIME_GC_PHASES
When true, causes RVM collectors to measure time spent in each phase of collection. |
(package private) int |
timeInRendezvous
time waiting in rendezvous (milliseconds) |
private static int |
verbose
Class variables |
| Fields inherited from class org.jikesrvm.mm.mminterface.ThreadContext |
|---|
collectorContext |
| Fields inherited from class org.mmtk.plan.generational.GenMutator |
|---|
arrayRemset, nursery, remset |
| Fields inherited from class org.mmtk.plan.MutatorContext |
|---|
immortal, lgcode, log, los, nonmove, smcode |
| Constructor Summary | |
|---|---|
CollectorThread(byte[] stack)
Constructor |
|
| Method Summary | |
|---|---|
void |
allocateOOMEForThread(RVMThread thread)
Allocate an OutOfMemoryError for a given thread. |
static void |
asyncCollect(Handshake handshake,
int why)
Initiate a garbage collection at next GC safe point. |
static void |
boot()
|
void |
clearThreadForStackTrace()
Set the thread to use for building stack traces. |
static void |
collect(Handshake handshake,
int why)
Initiate a garbage collection. |
static CollectorThread |
createActiveCollectorThread()
Make a collector thread that will participate in gc. |
int |
getGCOrdinal()
Return the GC ordinal for this collector thread. |
RVMThread |
getThreadForStackTrace()
Get the thread to use for building stack traces. |
ScanThread |
getThreadScanner()
|
static void |
init()
Initialize for boot image. |
boolean |
isGCThread()
Is this the GC thread? |
static boolean |
noThreadsInGC()
Return true if no threads are still in GC. |
static int |
numCollectors()
Returns number of collector threads participating in a collection |
int |
rendezvous(int where)
|
void |
run()
Run method for collector thread (one per processor). |
void |
setGCOrdinal(int ord)
Set the GC ordinal for this collector thread. |
void |
setThreadForStackTrace(RVMThread thread)
Set the thread to use for building stack traces. |
String |
toString()
Override Thread.toString |
| Methods inherited from class org.jikesrvm.mm.mminterface.Selected.Mutator |
|---|
get, getThread |
| Methods inherited from class org.mmtk.plan.generational.immix.GenImmixMutator |
|---|
alloc, collectionPhase, getAllocatorFromSpace, postAlloc |
| Methods inherited from class org.mmtk.plan.generational.GenMutator |
|---|
assertRemsetsFlushed, flushRememberedSets, objectReferenceBulkCopy, objectReferenceNonHeapWrite, objectReferenceTryCompareAndSwap, objectReferenceWrite |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final int verbose
private static final String myName
static final boolean DISPLAY_OPTIONS_AT_BOOT
public static final boolean TIME_GC_PHASES
public static final boolean MEASURE_WAIT_TIMES
public static final int GC_ORDINAL_BASE
static final int[] participantCount
static int collectionCount
public static final Handshake handshake
public static SynchronizationBarrier gcBarrier
public static int collectionAttemptBase
private int gcOrdinal
private final ScanThread threadScanner
int timeInRendezvous
static boolean gcThreadRunning
private Address stackTraceThread
private static int nextId
| Constructor Detail |
|---|
CollectorThread(byte[] stack)
stack - The stack this thread will run on| Method Detail |
|---|
public ScanThread getThreadScanner()
public boolean isGCThread()
isGCThread in class RVMThreadpublic RVMThread getThreadForStackTrace()
getThreadForStackTrace in class RVMThreadpublic void setThreadForStackTrace(RVMThread thread)
public void clearThreadForStackTrace()
public static void init()
public static void boot()
public static CollectorThread createActiveCollectorThread()
Note: the new thread's stack must be in pinned memory: currently done by allocating it in immortal memory.
public static void collect(Handshake handshake,
int why)
handshake - Handshake for the requested collection
public static void asyncCollect(Handshake handshake,
int why)
handshake - Handshake for the requested collectionpublic String toString()
toString in class RVMThreadpublic static int numCollectors()
public int getGCOrdinal()
public void setGCOrdinal(int ord)
ord - The new GC ordinal for this threadpublic void run()
run in class RVMThreadpublic static boolean noThreadsInGC()
true if no threads are still in GC.public int rendezvous(int where)
public void allocateOOMEForThread(RVMThread thread)
thread -
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||