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  void blockForGC()
          Block for the garbage collector.
abstract  int getActiveThreads()
           
abstract  int getDefaultThreads()
           
abstract  void outOfMemory()
          Fail with an out of memory error.
abstract  void prepareMutator(MutatorContext m)
          Prepare a mutator for collection.
abstract  void requestMutatorFlush()
          Request each mutator flush remembered sets.
abstract  void resumeAllMutators()
          Resume all mutators blocked for GC.
abstract  void spawnCollectorContext(CollectorContext context)
          Spawn a thread to execute the supplied collector context.
abstract  void stopAllMutators()
          Stop all mutator threads.
 
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

spawnCollectorContext

public abstract void spawnCollectorContext(CollectorContext context)
Spawn a thread to execute the supplied collector context.


getDefaultThreads

public abstract int getDefaultThreads()
Returns:
The default number of collector threads to use.

getActiveThreads

public abstract int getActiveThreads()
Returns:
The number of active threads.

blockForGC

public abstract void blockForGC()
Block for the garbage collector.


prepareMutator

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

Parameters:
m - the mutator to prepare

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.


stopAllMutators

public abstract void stopAllMutators()
Stop all mutator threads. This is current intended to be run by a single thread.

Fixpoint until there are no threads that we haven't blocked. Fixpoint is needed to catch the (unlikely) case that a thread spawns another thread while we are waiting.


resumeAllMutators

public abstract void resumeAllMutators()
Resume all mutators blocked for GC.


outOfMemory

public abstract void outOfMemory()
Fail with an out of memory error.