|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mmtk.plan.Phase
public abstract class Phase
A garbage collection proceeds as a sequence of phases. Each phase is either simple (singular) or complex (an array).
The context an individual phase executes in may be global, mutator, or collector.
Phases are executed within a stack and all synchronization between parallel GC threads is managed from within this class.
MutatorContext.collectionPhase(short, boolean)
Field Summary | |
---|---|
private static boolean |
allowConcurrentPhase
Do we want to allow new concurrent workers to become active |
private static int[] |
complexPhaseCursor
Stores the current sub phase for a complex phase. |
private static short |
concurrentPhaseId
The concurrent phase being executed |
private static boolean |
evenMutatorResetRendezvous
Do we need to add a sync point to reset the mutator count. |
private static int |
evenScheduledPhase
The current even (0 mod 2) scheduled phase. |
protected short |
id
The unique phase identifier. |
private static int |
MAX_PHASE_STACK_DEPTH
The maximum stack depth for the phase stack. |
private static int |
MAX_PHASES
The maximum number of phases |
protected String |
name
The name of the phase. |
private static short |
nextPhaseId
The id to be allocated for the next phase |
private static boolean |
oddMutatorResetRendezvous
Do we need to add a sync point to reset the mutator count. |
private static int |
oddScheduledPhase
The current odd (1 mod 2) scheduled phase. |
private static Phase[] |
phases
The array of phase instances. |
private static int[] |
phaseStack
The phase stack. |
private static int |
phaseStackPointer
The current stack pointer |
protected static short |
SCHEDULE_COLLECTOR
Run the phase on collectors. |
protected static short |
SCHEDULE_COMPLEX
This is a complex phase. |
protected static short |
SCHEDULE_CONCURRENT
Run this phase concurrently with the mutators |
protected static short |
SCHEDULE_GLOBAL
Run the phase globally. |
protected static short |
SCHEDULE_MUTATOR
Run the phase on mutators. |
protected static short |
SCHEDULE_PLACEHOLDER
Don't run this phase. |
private static short |
startComplexTimer
The complex phase whose timer should be started after the next rendezvous. |
private static short |
stopComplexTimer
The complex phase whose timer should be stopped after the next rendezvous. |
protected Timer |
timer
The Timer that is started and stopped around the execution of this phase. |
Constructor Summary | |
---|---|
protected |
Phase(String name)
Create a new Phase. |
protected |
Phase(String name,
Timer timer)
Create a new phase. |
Method Summary | |
---|---|
static void |
beginNewPhaseStack(int scheduledPhase)
Place a phase on the phase stack and begin processing. |
static void |
clearConcurrentPhase()
Clear the current phase Id. |
static boolean |
concurrentPhaseActive()
|
static void |
continuePhaseStack()
Continue the execution of a phase stack. |
static short |
createComplex(String name,
int... scheduledPhases)
Construct a complex phase. |
static short |
createComplex(String name,
Timer timer,
int... scheduledPhases)
Construct a complex phase, re-using a specified timer. |
static short |
createConcurrent(String name,
int atomicScheduledPhase)
Construct a phase. |
static short |
createConcurrent(String name,
Timer timer,
int atomicScheduledPhase)
Construct a phase, re-using a specified timer. |
static short |
createSimple(String name)
Construct a phase. |
static short |
createSimple(String name,
Timer timer)
Construct a phase, re-using a specified timer. |
static short |
getConcurrentPhaseId()
Get the current phase Id. |
private static int |
getCurrentPhase(boolean isEvenPhase)
Get the next phase. |
short |
getId()
|
static String |
getName(short phaseId)
|
private static int |
getNextPhase()
Pull the next scheduled phase off the stack. |
static Phase |
getPhase(short id)
Retrieve a phase by the unique phase identifier. |
protected static short |
getPhaseId(int scheduledPhase)
Get the phase id component of an encoded phase |
protected static short |
getSchedule(int scheduledPhase)
Get the ordering component of an encoded phase |
protected static String |
getScheduleName(short ordering)
Get the ordering component of an encoded phase |
private static int |
incrementComplexPhaseCursor()
Increment the cursor associated with the current phase stack entry. |
static boolean |
isPhaseStackEmpty()
Return true if phase stack is empty, false otherwise. |
protected abstract void |
logPhase()
Display a description of this phase, for debugging purposes. |
private static boolean |
needsMutatorResetRendezvous(boolean isEvenPhase)
Do we need a mutator reset rendezvous in this phase? |
static boolean |
notifyConcurrentPhaseComplete()
Notify that the concurrent phase has completed successfully. |
static void |
notifyConcurrentPhaseIncomplete()
Notify that the concurrent phase has not finished, and must be re-attempted. |
private static void |
pauseComplexTimers()
Pause all of the timers for the complex phases sitting in the stack. |
private static int |
peekScheduledPhase()
Peek the scheduled phase at the top of the work stack. |
private static int |
popScheduledPhase()
Pop off the scheduled phase at the top of the work stack. |
private static void |
processPhaseStack(boolean resume)
Process the phase stack. |
static void |
pushScheduledPhase(int scheduledPhase)
Push a scheduled phase onto the top of the work stack. |
static void |
resetPhaseStack()
Clears the scheduled phase stack. |
private static void |
resumeComplexTimers()
Resume all of the timers for the complex phases sitting in the stack. |
static int |
scheduleCollector(short phaseId)
Take the passed phase and return an encoded phase to run that phase in a collector context; |
static int |
scheduleComplex(short phaseId)
Take the passed phase and return an encoded phase to run that phase as a complex phase. |
static int |
scheduleConcurrent(short phaseId)
Take the passed phase and return an encoded phase to run that phase as a concurrent phase. |
static int |
scheduleGlobal(short phaseId)
Take the passed phase and return an encoded phase to run that phase in a global context; |
static int |
scheduleMutator(short phaseId)
Take the passed phase and return an encoded phase to run that phase in a mutator context; |
static int |
schedulePlaceholder(short phaseId)
Take the passed phase and return an encoded phase to run that phase in a mutator context; |
private static void |
setNextPhase(boolean isEvenPhase,
int scheduledPhase,
boolean needsResetRendezvous)
Set the next phase. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int MAX_PHASES
private static final Phase[] phases
private static short nextPhaseId
protected static final short SCHEDULE_GLOBAL
protected static final short SCHEDULE_COLLECTOR
protected static final short SCHEDULE_MUTATOR
protected static final short SCHEDULE_CONCURRENT
protected static final short SCHEDULE_PLACEHOLDER
protected static final short SCHEDULE_COMPLEX
protected final short id
protected final String name
protected final Timer timer
private static final int MAX_PHASE_STACK_DEPTH
private static int[] complexPhaseCursor
private static int[] phaseStack
private static int phaseStackPointer
private static int evenScheduledPhase
private static int oddScheduledPhase
private static boolean evenMutatorResetRendezvous
private static boolean oddMutatorResetRendezvous
private static short startComplexTimer
private static short stopComplexTimer
private static short concurrentPhaseId
private static boolean allowConcurrentPhase
Constructor Detail |
---|
protected Phase(String name)
name
- The name for the phase.protected Phase(String name, Timer timer)
name
- The name of the phase.timer
- The timer, or null if this is an untimed phase.Method Detail |
---|
public static Phase getPhase(short id)
id
- The phase identifier.
protected static short getPhaseId(int scheduledPhase)
public static String getName(short phaseId)
phaseId
- The unique phase identifier.
protected static short getSchedule(int scheduledPhase)
protected static String getScheduleName(short ordering)
public static short createSimple(String name)
name
- Display name of the phasepublic static short createSimple(String name, Timer timer)
name
- Display name of the phasepublic static short createComplex(String name, int... scheduledPhases)
name
- Display name of the phasescheduledPhases
- The phases in this complex phase.public static short createComplex(String name, Timer timer, int... scheduledPhases)
name
- Display name of the phasetimer
- Timer for this phase to contribute toscheduledPhases
- The phases in this complex phase.public static final short createConcurrent(String name, int atomicScheduledPhase)
name
- Display name of the phaseatomicScheduledPhase
- The corresponding atomic phase to run in a stop the world collectionpublic static final short createConcurrent(String name, Timer timer, int atomicScheduledPhase)
name
- Display name of the phasetimer
- Timer for this phase to contribute toatomicScheduledPhase
- The corresponding atomic phase to run in a stop the world collectionpublic static int scheduleComplex(short phaseId)
phaseId
- The phase to run as complex
public static int scheduleConcurrent(short phaseId)
phaseId
- The phase to run as concurrent
public static int scheduleGlobal(short phaseId)
phaseId
- The phase to run globally
public static int scheduleCollector(short phaseId)
phaseId
- The phase to run on collectors
public static int scheduleMutator(short phaseId)
phaseId
- The phase to run on mutators
public static int schedulePlaceholder(short phaseId)
phaseId
- The phase to run on mutators
public final short getId()
protected abstract void logPhase()
public static void beginNewPhaseStack(int scheduledPhase)
scheduledPhase
- The phase to executepublic static void continuePhaseStack()
private static void processPhaseStack(boolean resume)
private static int getCurrentPhase(boolean isEvenPhase)
private static boolean needsMutatorResetRendezvous(boolean isEvenPhase)
private static void setNextPhase(boolean isEvenPhase, int scheduledPhase, boolean needsResetRendezvous)
private static int getNextPhase()
private static void pauseComplexTimers()
private static void resumeComplexTimers()
public static boolean isPhaseStackEmpty()
public static void resetPhaseStack()
public static void pushScheduledPhase(int scheduledPhase)
scheduledPhase
- The scheduled phase.private static int incrementComplexPhaseCursor()
private static int popScheduledPhase()
private static int peekScheduledPhase()
public static short getConcurrentPhaseId()
public static void clearConcurrentPhase()
public static boolean concurrentPhaseActive()
true
if there is an active concurrent phase.public static boolean notifyConcurrentPhaseComplete()
public static void notifyConcurrentPhaseIncomplete()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |