org.mmtk.vm
Class Collection

java.lang.Object
  extended by org.mmtk.vm.Collection
Direct Known Subclasses:
Collection

public abstract class Collection
extends Object


Field Summary
static int EXTERNAL_GC_TRIGGER
          Externally triggered garbage collection (eg call to System.gc())
static int INTERNAL_GC_TRIGGER
          Internally triggered garbage collection.
static int INTERNAL_PHASE_GC_TRIGGER
          Concurrent collection phase trigger.
static int RESOURCE_GC_TRIGGER
          Resource triggered garbage collection.
static int TRIGGER_REASONS
          The number of garbage collection trigger reasons.
protected static String[] triggerReasons
          Short descriptions of the garbage collection trigger reasons.
static int UNKNOWN_GC_TRIGGER
          An unknown GC trigger reason.
 
Constructor Summary
Collection()
           
 
Method Summary
abstract  int activeGCThreadOrdinal()
           
abstract  int activeGCThreads()
           
abstract  boolean isEmergencyAllocation()
          Does the VM consider this an emergency alloction, where the normal heap size rules can be ignored.
abstract  void joinCollection()
          Joins an already requested collection.
abstract  int maximumCollectionAttempt()
          The maximum number collection attempts across threads.
abstract  boolean noThreadsInGC()
          Determine whether a collection cycle has fully completed (this is used to ensure a GC is not in the process of completing, to avoid, for example, an async GC being triggered on the switch from GC to mutator thread before all GC threads have switched.
abstract  void prepareCollector(CollectorContext c)
          Prepare a collector for a collection.
abstract  void prepareMutator(MutatorContext m)
          Prepare a mutator for collection.
abstract  int rendezvous(int where)
          Rendezvous with all other processors, returning the rank (that is, the order this processor arrived at the barrier).
abstract  void reportAllocationSuccess()
          Report that the allocation has succeeded.
abstract  void reportPhysicalAllocationFailed()
          Report that a physical allocation has failed.
abstract  void requestMutatorFlush()
          Request each mutator flush remembered sets.
abstract  void scheduleConcurrentWorkers()
          Ensure all concurrent worker threads are scheduled.
abstract  void triggerAsyncCollection(int why)
          Trigger an asynchronous collection, checking for memory exhaustion first.
abstract  void triggerCollection(int why)
          Triggers a collection.
abstract  boolean yieldpoint()
          Possibly yield the current concurrent collector thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNKNOWN_GC_TRIGGER

public static final int UNKNOWN_GC_TRIGGER
An unknown GC trigger reason. Signals a logic bug.

See Also:
Constant Field Values

INTERNAL_PHASE_GC_TRIGGER

public static final int INTERNAL_PHASE_GC_TRIGGER
Concurrent collection phase trigger.

See Also:
Constant Field Values

EXTERNAL_GC_TRIGGER

public static final int EXTERNAL_GC_TRIGGER
Externally triggered garbage collection (eg call to System.gc())

See Also:
Constant Field Values

RESOURCE_GC_TRIGGER

public static final int RESOURCE_GC_TRIGGER
Resource triggered garbage collection. For example, an allocation request would take the number of pages in use beyond the number available.

See Also:
Constant Field Values

INTERNAL_GC_TRIGGER

public static final int INTERNAL_GC_TRIGGER
Internally triggered garbage collection. For example, the memory manager attempting another collection after the first failed to free space.

See Also:
Constant Field Values

TRIGGER_REASONS

public static final int TRIGGER_REASONS
The number of garbage collection trigger reasons.

See Also:
Constant Field Values

triggerReasons

protected static final String[] triggerReasons
Short descriptions of the garbage collection trigger reasons.

Constructor Detail

Collection

public Collection()
Method Detail

triggerCollection

public abstract void triggerCollection(int why)
Triggers a collection.

Parameters:
why - the reason why a collection was triggered. 0 to TRIGGER_REASONS - 1.

joinCollection

public abstract void joinCollection()
Joins an already requested collection.


triggerAsyncCollection

public abstract void triggerAsyncCollection(int why)
Trigger an asynchronous collection, checking for memory exhaustion first.

Parameters:
why - the reason why a collection was triggered. 0 to TRIGGER_REASONS - 1.

maximumCollectionAttempt

public abstract int maximumCollectionAttempt()
The maximum number collection attempts across threads.


reportAllocationSuccess

public abstract void reportAllocationSuccess()
Report that the allocation has succeeded.


reportPhysicalAllocationFailed

public abstract void reportPhysicalAllocationFailed()
Report that a physical allocation has failed.


isEmergencyAllocation

public abstract boolean isEmergencyAllocation()
Does the VM consider this an emergency alloction, where the normal heap size rules can be ignored.


noThreadsInGC

public abstract boolean noThreadsInGC()
Determine whether a collection cycle has fully completed (this is used to ensure a GC is not in the process of completing, to avoid, for example, an async GC being triggered on the switch from GC to mutator thread before all GC threads have switched.

Returns:
True if GC is not in progress.

prepareMutator

public abstract void prepareMutator(MutatorContext m)
Prepare a mutator for collection.

Parameters:
m - the mutator to prepare

prepareCollector

public abstract void prepareCollector(CollectorContext c)
Prepare a collector for a collection.

Parameters:
c - the collector to prepare

rendezvous

public abstract int rendezvous(int where)
Rendezvous with all other processors, returning the rank (that is, the order this processor arrived at the barrier).


activeGCThreads

public abstract int activeGCThreads()
Returns:
The number of active collector threads

activeGCThreadOrdinal

public abstract int activeGCThreadOrdinal()
Returns:
The ordinal ID of the running collector thread w.r.t. the set of active collector threads (zero based)

scheduleConcurrentWorkers

public abstract void scheduleConcurrentWorkers()
Ensure all concurrent worker threads are scheduled.


requestMutatorFlush

public abstract void requestMutatorFlush()
Request each mutator flush remembered sets. This method will trigger the flush and then yield until all processors have flushed.


yieldpoint

public abstract boolean yieldpoint()
Possibly yield the current concurrent collector thread. Return true if yielded.