|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 identifier. |
protected Log |
log
Used for printing log information in a thread safe manner |
Constructor Summary | |
---|---|
CollectorContext()
|
Method Summary | |
---|---|
Address |
allocCopy(ObjectReference original,
int bytes,
int align,
int offset,
int allocator)
Allocate space for copying an object (this method does not copy the object, it only allocates space) |
int |
copyCheckAllocator(ObjectReference from,
int bytes,
int align,
int allocator)
Run-time check of the allocator to use for a given copy allocation. |
int |
getId()
|
Log |
getLog()
|
void |
initCollector(int id)
Notify that the collector context is registered and ready to execute. |
int |
parallelWorkerCount()
The number of parallel workers currently executing with this collector context. |
int |
parallelWorkerOrdinal()
The ordinal of the current worker. |
void |
postCopy(ObjectReference ref,
ObjectReference typeRef,
int bytes,
int allocator)
Perform any post-copy actions. |
int |
rendezvous()
Get the executing context to rendezvous with other contexts working in parallel. |
abstract void |
run()
Entry point for the collector context. |
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 Log log
Constructor Detail |
---|
public 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 size of the space to be allocated (in bytes)align
- Required alignment for the copyoffset
- 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)
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.
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 run()
public int parallelWorkerCount()
public int parallelWorkerOrdinal()
public int rendezvous()
public final Log getLog()
Log
instance for this collector context.public int getId()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |