|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.mmtk.plan.CollectorContext
public abstract class CollectorContext
This class (and its sub-classes) implement per-collector thread behavior. We assume N collector threads and M mutator threads, where N is often equal to the number of available processors, P (for P-way parallelism at GC-time), and M may simply be the number of mutator (application) threads. Both N and M are determined by the VM, not MMTk. In the case where a VM uses posix threads (pthreads) for each mutator ("1:1" threading), M will typically be equal to the number of mutator threads. When a uses "green threads" or a hybrid threading scheme (such as Jikes RVM), M will typically be equal to the level of true parallelism (ie the number of underlying kernel threads).
Collector operations are separated into per-collector thread
operations (the bulk of the GC), and per-mutator thread operations
(important in flushing and restoring per-mutator state such as allocator
state and write buffer/remset state). SimplePhase
ensures that per-collector thread GC phases are performed by each
collector thread, and that the M per-mutator thread operations
are multiplexed across the N active collector threads.
MMTk assumes that the VM instantiates instances of CollectorContext
in thread local storage (TLS) for each thread participating in
collection. Accesses to this state are therefore assumed to be
low-cost at GC time.
MMTk explicitly separates thread-local (this class) and global
operations (See Plan), so that syncrhonization is localized
and explicit, and thus hopefully minimized (See Plan). Global (Plan)
and per-thread (this class) state are also explicitly separated.
Operations in this class (and its children) are therefore strictly
local to each collector thread, and synchronized operations always
happen via access to explicitly global classes such as Plan and its
children.
This class (and its children) therefore typically implement per-collector thread structures such as collection work queues.
MutatorContext,
ActivePlan,
Plan| Field Summary | |
|---|---|
private int |
id
Unique collector identifier |
protected BumpPointer |
immortal
Per-collector allocator into the immortal space |
protected boolean |
resetConcurrentWork
Used for aborting concurrent phases pre-empted by stop the world collection |
protected SanityCheckerLocal |
sanityLocal
Used for sanity checking |
| Constructor Summary | |
|---|---|
protected |
CollectorContext()
Initialization |
| Method Summary | |
|---|---|
Address |
allocCopy(ObjectReference original,
int bytes,
int align,
int offset,
int allocator)
Allocate memory when copying an object. |
protected void |
clearResetConcurrentWork()
Allow concurrent work to continue. |
abstract void |
collect()
Perform a garbage collection |
abstract void |
collectionPhase(short phaseId,
boolean primary)
Perform a (local) collection phase. |
abstract void |
concurrentCollect()
Perform some concurrent garbage collection |
abstract void |
concurrentCollectionPhase(short phaseId)
Perform some concurrent collection work. |
int |
copyCheckAllocator(ObjectReference from,
int bytes,
int align,
int allocator)
Run-time check of the allocator to use for a given copy allocation At the moment this method assumes that allocators will use the simple (worst) method of aligning to determine if the object is a large object to ensure that no objects are larger than other allocators can handle. |
abstract TraceLocal |
getCurrentTrace()
|
int |
getId()
|
void |
initCollector(int id)
Notify that the collector context is registered and ready to execute. |
void |
postCopy(ObjectReference ref,
ObjectReference typeRef,
int bytes,
int allocator)
Perform any post-copy actions. |
protected void |
resetConcurrentWork()
Abort concurrent work due to pre-empt by stop the world collection. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private int id
protected final BumpPointer immortal
protected boolean resetConcurrentWork
protected final SanityCheckerLocal sanityLocal
| Constructor Detail |
|---|
protected CollectorContext()
| Method Detail |
|---|
public void initCollector(int id)
id - The id of this collector context.
public Address allocCopy(ObjectReference original,
int bytes,
int align,
int offset,
int allocator)
original - The object that is being copied.bytes - The number of bytes required for the copy.align - Required alignment for the copy.offset - Offset associated with the alignment.allocator - The allocator associated with this request.
public void postCopy(ObjectReference ref,
ObjectReference typeRef,
int bytes,
int allocator)
ref - The newly allocated object.typeRef - the type reference for the instance being created.bytes - The size of the space to be allocated (in bytes).allocator - The allocator statically assigned to this allocation.
public int copyCheckAllocator(ObjectReference from,
int bytes,
int align,
int allocator)
from - The object that is being copied.bytes - The number of bytes to be allocated.align - The requested alignment.allocator - The allocator statically assigned to this allocation.
public abstract void collect()
public abstract void concurrentCollect()
public abstract void collectionPhase(short phaseId,
boolean primary)
phaseId - The unique phase identifierprimary - Should this thread be used to execute any single-threaded
local operations?public abstract void concurrentCollectionPhase(short phaseId)
phaseId - The unique phase identifierpublic abstract TraceLocal getCurrentTrace()
protected void resetConcurrentWork()
protected void clearResetConcurrentWork()
public int getId()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||