|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mmtk.plan.MutatorContext org.mmtk.plan.SimpleMutator org.mmtk.plan.StopTheWorldMutator org.mmtk.plan.generational.GenMutator org.mmtk.plan.generational.immix.GenImmixMutator org.jikesrvm.mm.mminterface.Selected.Mutator org.jikesrvm.mm.mminterface.ThreadContext org.jikesrvm.scheduler.RVMThread
public final class RVMThread
A generic java thread's execution context.
Threads use a state machine to indicate to other threads, as well as VM services, how this thread should be treated in the case of an asynchronous request, for example in the case of GC. The state machine uses the following states:
CollectorThread
,
FinalizerThread
,
Organizer
Nested Class Summary | |
---|---|
(package private) static class |
RVMThread.AllButGCHardHandshakeVisitor
|
static class |
RVMThread.BlockAdapter
A block adapter specifies the reason for blocking or unblocking a thread. |
static class |
RVMThread.GCBlockAdapter
|
static class |
RVMThread.HandshakeBlockAdapter
|
static class |
RVMThread.HardHandshakeVisitor
|
static class |
RVMThread.SoftHandshakeVisitor
|
static class |
RVMThread.SuspendBlockAdapter
|
protected static class |
RVMThread.Waiting
An enumeration that describes the different manners in which a thread might be voluntarily waiting. |
Field Summary | |
---|---|
private static int[] |
aboutToTerminate
Thread slots of threads that are about to terminate. |
private static int |
aboutToTerminateN
Number of threads that are about to terminate. |
static NoYieldpointsMonitor |
acctLock
Lock (mutex) used for creating and destroying threads as well as thread accounting. |
boolean |
activeMutatorContext
Is this a "registered mutator?" |
static RVMThread.AllButGCHardHandshakeVisitor |
allButGC
|
static boolean |
ALWAYS_LOCK_ON_STATE_TRANSITION
|
(package private) int |
arrayIndexTrapParam
"hidden parameter" from ArrayIndexOutOfBounds trap to C trap handler |
boolean |
asyncDebugRequestedForThisThread
|
(package private) Throwable |
asyncThrowable
Exception to throw in this thread at the earliest possible point. |
(package private) boolean |
atYieldpoint
Are we at a yieldpoint right now? |
static int |
availableProcessors
The number of processors to use. |
(package private) SpinLock |
awaitingSpinLock
Used to handle contention for spin locks |
static int |
BACKEDGE
|
int |
barriersEntered
|
int |
barriersExited
|
(package private) static RVMThread.BlockAdapter[] |
blockAdapters
|
static int |
BLOCKED_IN_JNI
like BLOCKED_IN_NATIVE, but indicates that the thread is in JNI rather than VM native code. |
static int |
BLOCKED_IN_NATIVE
thread is in native code, and is to block before returning to Java code. |
static RVMThread |
bootThread
The boot thread, can't be final so as to allow initialization during boot image writing. |
ArchitectureSpecific.CodeArray |
bridgeInstructions
Before call new instructions, we need a bridge to recover register states from the stack frame. |
Lock |
cachedFreeLock
A cached free lock. |
boolean |
codePatchSyncRequested
flag indicating this processor needs to execute a memory synchronization sequence Used for code patching on SMP PowerPCs. |
private int |
collectionAttempt
Used by GC to determine collection success |
private static Monitor[] |
communicationLockBySlot
|
(package private) RVMThread |
contenderLink
|
ArchitectureSpecific.Registers |
contextRegisters
Place to save register state when this thread is not actually running. |
ArchitectureSpecific.Registers |
contextRegistersSave
Place to save register state when this thread is not actually running. |
private ArchitectureSpecific.Registers |
contextRegistersSaveShadow
|
private ArchitectureSpecific.Registers |
contextRegistersShadow
|
int |
countdownCBSCall
Number of call yieldpoints between CBS samples |
int |
countdownCBSMethod
Number of counter ticks between CBS samples |
protected boolean |
daemon
The virtual machine terminates when the last non-daemon (user) thread terminates. |
static boolean |
DEBUG_STACK_TRAMPOLINE
debugging flag for return barrier trampoline |
static NoYieldpointsMonitor |
debugLock
Lock (mutex) used for servicing debug requests. |
static boolean |
debugRequested
Flag set by external signal to request debugger activation at next thread switch. |
static RVMThread[] |
debugThreads
Preallocated array for use in debug requested. |
private int |
disableGCDepth
Counts the depth of outstanding calls to VM.disableGC() . |
private boolean |
disallowAllocationsByThisThread
Assertion checking while manipulating raw addresses -- see VM.disableGC() /VM.enableGC() . |
static Latch |
doProfileReport
The latch for reporting profile data. |
static Monitor |
dumpLock
Lock used for dumping stack and such. |
protected static boolean |
dumpStackOnBlock
|
static int |
EPILOGUE
|
private ArchitectureSpecific.Registers |
exceptionRegisters
Place to save register state during hardware(C signal trap handler) or software (RuntimeEntrypoints.athrow) trap handling. |
private ArchitectureSpecific.Registers |
exceptionRegistersShadow
|
private int |
execStatus
Thread state. |
(package private) static int[] |
execStatusTransitionHistogram
|
protected static boolean |
exitInProgress
In dump stack and dying |
Feedlet |
feedlet
The Feedlet instance for this thread to use to make addEvent calls. |
int |
firstCBSCallSample
round robin starting point for CBS samples |
int |
firstCBSMethodSample
round robin starting point for CBS samples |
boolean |
flushRequested
Is there a flush request for this thread? |
Offset |
fooFPOffset
Foo frame pointer offset |
(package private) Address |
framePointer
FP for current frame, saved in the prologue of every method |
private static int |
freeSlotN
Number of free thread slots. |
private static int[] |
freeSlots
Free thread slots |
static RVMThread.GCBlockAdapter |
gcBlockAdapter
|
static RVMThread.HandshakeBlockAdapter |
handshakeBlockAdapter
|
static Monitor |
handshakeLock
Lock that prevents multiple (soft or hard) handshakes from proceeding concurrently. |
static RVMThread[] |
handshakeThreads
Preallocated array for use in handshakes. |
(package private) boolean |
hasInterrupt
Has the thread been interrupted? |
(package private) int |
hiddenSignatureId
"hidden parameter" for interface invocation thru the IMT |
private Address |
hijackedReturnAddress
Return address of stack frame hijacked by return barrier |
private Address |
hijackedReturnCalleeFp
Callee frame pointer for stack frame hijacked by return barrier |
private Address |
hijackedReturnCallerFp
Caller frame pointer for stack frame hijacked by return barrier |
static int |
IN_JAVA
Thread is executing "normal" Java bytecode |
static int |
IN_JAVA_TO_BLOCK
thread is in Java code but is expected to block. the transition from IN_JAVA to IN_jAVA_TO_BLOCK happens as a result of an asynchronous call by the GC or any other internal VM code that requires this thread to perform an asynchronous activity (another example is the request to do an isync on PPC). |
static int |
IN_JNI
Same as IN_NATIVE, except that we're executing JNI code and thus have a JNI stack frame and JNI environment, and thus the GC can load registers from there rather than using contextRegisters. |
static int |
IN_NATIVE
A state used by the scheduler to mark that a thread is in privileged code that does not need to synchronize with the collector. |
protected int |
inDumpStack
Number of times dump stack has been called recursively |
private boolean |
isAboutToTerminate
Is the thread about to terminate? |
(package private) boolean |
isBlockedForGC
Is the thread blocked for thread-to-thread communication? |
(package private) boolean |
isBlockedForHandshake
Is the thread blocked for handshake? |
(package private) boolean |
isBlocking
Is this thread in the process of blocking? |
(package private) boolean |
isJoinable
Is the thread no longer executing user code? |
(package private) boolean |
isSuspended
Is the thread suspended? |
boolean |
isWaitingForOsr
The flag indicates whether this thread is waiting for on stack replacement before being rescheduled. |
private long |
jniEnteredBlocked
|
private JNIEnvironment |
jniEnv
Cached JNI environment for this thread |
private JNIEnvironment |
jniEnvShadow
|
static int |
LAST_EXEC_STATUS
Not actually a state but just a marker. |
int |
lockingId
|
static int |
LOG_MAX_THREADS
Maximum number of RVMThread's that we can support. |
static int |
MAX_THREADS
|
private static NoYieldpointsMonitor[] |
monitorBySlot
Per-thread monitors. |
private String |
name
Name of the thread (can be changed during execution) |
static int |
NATIVE_EPILOGUE
|
static int |
NATIVE_PROLOGUE
|
private long |
nativeEnteredBlocked
|
private static boolean |
neverKillThreads
Never kill threads. |
static int |
NEW
Thread has not yet started. |
(package private) RVMThread |
next
Link pointer for queues (specifically ThreadQueue). |
static int |
nextSlot
When there are no thread slots on the free list, this is the next one to use. |
(package private) static int |
notifyAllOperations
Number of notifyAll operations |
(package private) static int |
notifyOperations
Number of notify operations |
private static int |
numActiveDaemons
Number of active daemon threads. |
private static int |
numActiveThreads
Number of active threads in the system. |
int |
numCBSCallSamples
Number of CBS samples to take in this window |
int |
numCBSMethodSamples
Number of CBS samples to take in this window |
static int |
numThreads
Number of threads in the system (some of which may not be active). |
Object |
onStackReplacementEvent
Only used by OSR when VM.BuildForAdaptiveSystem. |
boolean |
osr_done
Flag to indicate that the last OSR request is done. |
static int |
OSROPT
|
private static OutOfMemoryError |
outOfMemoryError
The OOME to throw |
private static NoYieldpointsMonitor |
outputLock
Lock used for generating debug output. |
private boolean |
parkingPermit
Is a running thread permitted to ignore the next park request |
private boolean |
physicalAllocationFailed
Used by GC to determine collection success |
static int |
PRIMORDIAL_THREAD_INDEX
Index of thread in which "VM.boot()" runs |
private int |
priority
Scheduling priority for this thread. |
static int |
PROLOGUE
|
Word |
pthread_id
Thread handle. |
(package private) ThreadQueue |
queuedOn
The queue that the thread is on, or null if the thread is not on a queue (specifically ThreadQueue). |
boolean |
requesting_osr
Flag to synchronize with osr organizer, the trigger sets osr requests the organizer clear the requests |
private double |
scratchStorage
Scratch area for use for gpr <=> fpr transfers by PPC baseline compiler. |
(package private) boolean |
shouldBlockForGC
Should the thread block for a thread-to-thread communication? |
(package private) boolean |
shouldBlockForHandshake
Should the thread block for handshake? |
(package private) boolean |
shouldSuspend
Should the thread suspend? |
(package private) int |
shouldSuspendToken
An integer token identifying the last suspend request |
private static boolean |
SHOW_FP_IN_STACK_DUMP
Toggle display of frame pointer address in stack dump |
(package private) static int[] |
sloppyExecStatusHistogram
|
static Monitor |
softHandshakeDataLock
Lock that protects soft handshake fields. |
static int |
softHandshakeLeft
How many threads have not yet reached the soft handshake? |
boolean |
softHandshakeRequested
Is a soft handshake requested? |
private byte[] |
stack
Execution stack for this thread. |
Address |
stackLimit
The Address of the guard area for stack . |
static ArchitectureSpecific.CodeArray |
stackTrampolineBridgeInstructions
pointer to bridge code for return barrier trampoline |
private static boolean |
STATS
Generate statistics? |
(package private) static int[] |
statusAtSTWHistogram
|
static RVMThread.SuspendBlockAdapter |
suspendBlockAdapter
|
private static boolean |
systemShuttingDown
Is the system in the process of shutting down (has System.exit been called) |
private SystemThread |
systemThread
Non-null indicates this is a system thread, that is one used by the system and as such doesn't have a Runnable... |
int |
takeYieldpoint
Should the next executed yieldpoint be taken? |
static int |
TERMINATED
Thread has died. |
private Thread |
thread
java.lang.Thread wrapper for this Thread. |
int |
thread_cbs_counter
For builds using counter-based sampling. |
static RVMThread[] |
threadBySlot
thread array - all threads are stored in this array according to their threadSlot. |
private int |
threadIdx
Current index of this thread in the threads array. |
static boolean |
threadingInitialized
Is the threading system initialized? |
static RVMThread[] |
threads
Packed and unordered array or active threads. |
int |
threadSlot
Index of this thread in threadBySlot []. |
(package private) static int |
timedWaitOperations
Number of timed wait operations |
static long |
timerTicks
Number of timer ticks we've seen |
int |
timeSliceExpired
How many times has the "timeslice" expired? |
(package private) static long |
totalResumeTime
|
(package private) static long |
totalSuspendTime
|
protected static boolean |
trace
Trace execution |
protected static boolean |
traceAboutToTerminate
|
protected static boolean |
traceAcct
Trace thread start/stop |
private static boolean |
traceAdjustments
Trace adjustments to stack size |
protected static boolean |
traceBind
|
protected static boolean |
traceBlock
Trace thread blockage |
protected static boolean |
traceDetails
Extra debug from traces |
protected static boolean |
traceReallyBlock
Trace when a thread is really blocked |
private static boolean |
traceTermination
Trace thread termination |
private ArchitectureSpecific.Registers |
trampolineRegisters
Registers used by return barrier trampoline |
Offset |
tsFPOffset
Thread switch frame pointer offset |
private int |
uncaughtExceptionCount
Count of recursive uncaught exceptions, we need to bail out at some point |
protected int |
waitCount
Lock recursion count for this thread's monitor. |
protected RVMThread.Waiting |
waiting
Accounting of whether or not a thread is waiting (in the Java thread state sense), and if so, how it's waiting. |
protected Object |
waitObject
Place to save/restore this thread's monitor state during Object.wait() and Object.notify() . |
(package private) static int |
waitOperations
Number of wait operations |
private static boolean |
worldStopped
|
boolean |
yieldForCBSCall
Is CBS enabled for 'call' yieldpoints? |
boolean |
yieldForCBSMethod
Is CBS enabled for 'method' yieldpoints? |
(package private) boolean |
yieldpointRequestPending
Is a takeYieldpoint request pending on this thread? |
private int |
yieldpointsEnabledCount
Should this thread yield at yieldpoints? |
private long |
yieldpointsTaken
|
private long |
yieldpointsTakenFully
|
boolean |
yieldToOSRRequested
Is the next taken yieldpoint in response to a request to perform OSR? |
Fields inherited from class org.jikesrvm.mm.mminterface.ThreadContext |
---|
collectorContext |
Fields inherited from class org.mmtk.plan.generational.GenMutator |
---|
arrayRemset, nursery, remset |
Fields inherited from class org.mmtk.plan.MutatorContext |
---|
immortal, lgcode, log, los, nonmove, smcode |
Fields inherited from interface org.jikesrvm.Constants |
---|
NOT_REACHED, REFLECTION_FPRS_BITS, REFLECTION_FPRS_MASK, REFLECTION_GPRS_BITS, REFLECTION_GPRS_MASK |
Fields inherited from interface org.jikesrvm.objectmodel.ThinLockConstants |
---|
TL_DEDICATED_U16_OFFSET, TL_DEDICATED_U16_SHIFT, TL_LOCK_COUNT_MASK, TL_LOCK_COUNT_SHIFT, TL_LOCK_COUNT_UNIT, TL_LOCK_ID_MASK, TL_LOCK_ID_SHIFT, TL_NUM_BITS_RC, TL_NUM_BITS_STAT, TL_NUM_BITS_TID, TL_STAT_BIASABLE, TL_STAT_FAT, TL_STAT_MASK, TL_STAT_SHIFT, TL_STAT_THIN, TL_THREAD_ID_MASK, TL_THREAD_ID_SHIFT, TL_UNLOCK_MASK |
Fields inherited from interface org.jikesrvm.objectmodel.TIBLayoutConstants |
---|
IMT_METHOD_SLOTS, NEEDS_DYNAMIC_LINK, TIB_ARRAY_ELEMENT_TIB_INDEX, TIB_DOES_IMPLEMENT_INDEX, TIB_FIRST_SPECIALIZED_METHOD_INDEX, TIB_FIRST_VIRTUAL_METHOD_INDEX, TIB_INTERFACE_DISPATCH_TABLE_INDEX, TIB_SUPERCLASS_IDS_INDEX, TIB_TYPE_INDEX |
Fields inherited from interface org.jikesrvm.HeapLayoutConstants |
---|
BAD_MAP_COMPRESSION, BOOT_IMAGE_CODE_END, BOOT_IMAGE_CODE_SIZE, BOOT_IMAGE_CODE_START, BOOT_IMAGE_DATA_END, BOOT_IMAGE_DATA_SIZE, BOOT_IMAGE_DATA_START, BOOT_IMAGE_END, BOOT_IMAGE_RMAP_END, BOOT_IMAGE_RMAP_START, MAX_BOOT_IMAGE_RMAP_SIZE, MAXIMUM_MAPPABLE |
Constructor Summary | |
---|---|
RVMThread(byte[] stack,
Thread thread,
String name,
boolean daemon,
SystemThread systemThread,
int priority)
Create a new RVM Thread |
|
RVMThread(SystemThread systemThread,
byte[] stack,
String name)
Create a thread with the given stack and name. |
|
RVMThread(SystemThread systemThread,
String name)
Create a thread with default stack and with the given name. |
|
RVMThread(Thread thread,
long stacksize,
String name,
boolean daemon,
int priority)
Create a thread with ... called by java.lang.VMThread.create. |
Method Summary | |
---|---|
private static void |
_trace(String who,
String what,
int howmany,
boolean hex)
|
private void |
acknowledgeBlockRequests()
Check if the thread has block requests (for example, for suspension and GC). |
private void |
addAboutToTerminate()
Add this thread to the termination watchlist. |
private static void |
adjustRegisters(ArchitectureSpecific.Registers registers,
Offset delta)
A thread's stack has been moved or resized. |
private static void |
adjustStack(byte[] stack,
Address fp,
Offset delta)
A thread's stack has been moved or resized. |
void |
assertAcceptableStates(int expected)
|
void |
assertAcceptableStates(int expected1,
int expected2)
|
void |
assertUnacceptableStates(int unexpected)
|
void |
assertUnacceptableStates(int unexpected1,
int unexpected2)
|
(package private) void |
assignThreadSlot()
Find a thread slot not in use by any other live thread and bind the given thread to it. |
int |
asyncBlock(RVMThread.BlockAdapter ba)
|
private boolean |
attemptFastExecStatusTransition(int oldState,
int newState)
|
static boolean |
attemptLeaveNativeNoBlock()
Attempt to transition from IN_JNI or IN_NATIVE to IN_JAVA, fail if execStatus is anything but IN_JNI or IN_NATIVE. |
void |
beginPairHandshake()
|
void |
beginPairWith(RVMThread other)
|
void |
beginPairWithCurrent()
|
(package private) static void |
bind(int cpuId)
|
(package private) static void |
bindIfRequested()
|
int |
block(RVMThread.BlockAdapter ba)
|
(package private) int |
block(RVMThread.BlockAdapter ba,
boolean asynchronous)
Attempt to block the thread, and return the state it is in after the attempt. |
static void |
blockAllMutatorsForGC()
Stop all mutator threads. |
boolean |
blockedFor(RVMThread.BlockAdapter ba)
|
static void |
boot()
Boot the threading subsystem. |
private void |
callSystemExit(int exitStatus)
Call System.exit() with the correct security status. |
(package private) void |
checkBlock()
Check if the thread is supposed to block, and if so, block it. |
private void |
checkBlockNoSaveContext()
A variant of checkBlock() that does not save the thread state. |
static void |
checkDebugRequest()
|
void |
clearDisallowAllocationsByThisThread()
Allow allocations by this thread |
void |
clearInterrupted()
Clear the interrupted status of this thread |
void |
clearPhysicalAllocationFailed()
Clear the physical allocation failed flag. |
Monitor |
communicationLock()
|
Monitor |
communicationLockForSlot(int slot)
|
private static Offset |
copyStack(byte[] newStack)
Initialize a new stack with the live portion of the stack we're currently running on. |
int |
countStackFrames()
Count the stack frames of this thread |
void |
deInstallStackTrampoline()
de-install the stack trampoline (disabling return barriers). |
void |
disableYieldpoints()
Disable yieldpoints on this thread. |
void |
dump()
Dump this thread's identifying information, for debugging, via VM.sysWrite(String) . |
int |
dump(char[] dest)
Dump this thread's info, for debugging. |
int |
dump(char[] dest,
int offset)
Dump this thread's info, for debugging. |
void |
dump(int verbosity)
Dump this thread's identifying information, for debugging, via VM.sysWrite(String) . |
(package private) static void |
dump1DHisto(String name,
int[] histo)
|
static void |
dumpAcct()
|
static void |
dumpAll(int verbosity)
Dump information for all threads, via VM.sysWrite(String) . |
private static void |
dumpFrame(Address fp)
Dump the specified frame in a format useful for debugging the stack trampoline |
static void |
dumpStack()
Dump stack of calling thread, starting at callers frame |
static void |
dumpStack(Address fp)
Dump state of a (stopped) thread's stack. |
static void |
dumpStack(Address ip,
Address fp)
Dump state of a (stopped) thread's stack. |
static void |
dumpStackAndDie(Address fp)
Dump state of a (stopped) thread's stack and exit the virtual machine. |
(package private) static void |
dumpStats()
Dump statistics gather on operations |
private static void |
dumpThread(RVMThread t)
|
private static void |
dumpThreadArray(RVMThread[] array,
int bound)
|
private static void |
dumpThreadArray(String name,
RVMThread[] array,
int bound)
|
private static void |
dumpThreadSlotArray(int[] array,
int bound)
|
private static void |
dumpThreadSlotArray(String name,
int[] array,
int bound)
|
static void |
dumpVirtualMachine()
Dump state of virtual machine. |
void |
dumpWithPadding(int leftJustify)
Dump this thread's identifying information, for debugging, via VM.sysWrite(String) . |
void |
enableYieldpoints()
Enable yieldpoints on this thread. |
void |
endPairHandshake()
|
void |
endPairWith(RVMThread other)
|
void |
endPairWithCurrent()
|
private void |
enterJNIBlocked()
|
static void |
enterJNIBlockedFromCallIntoNative()
|
static void |
enterJNIBlockedFromJNIFunctionCall()
|
static void |
enterJNIFromCallIntoNative()
|
static void |
enterJNIFromJNIFunctionCall()
|
static void |
enterNative()
Indicate that we'd like the current thread to be executing privileged code that does not require synchronization with the GC. |
private void |
enterNativeBlocked()
|
private void |
enterNativeBlockedImpl(boolean jni)
Internal method for transitioning a thread from IN_JAVA or IN_JAVA_TO_BLOCK to either BLOCKED_IN_NATIVE or BLOCKED_IN_JNI, depending on the value of the jni parameter. |
void |
extDump()
|
void |
failIfYieldpointsDisabled()
Fail if yieldpoints are disabled on this thread |
(package private) void |
finishThreadTermination()
Uninterruptible final portion of thread termination. |
void |
fixupMovedStack(Offset delta)
This (suspended) thread's stack has been moved. |
static boolean |
gcEnabled()
Is it safe to start forcing garbage collects for stress testing? |
int |
getCollectionAttempt()
Set the initial attempt. |
CollectorThread |
getCollectorThread()
Get the collector thread this RVMTHread is running |
ArchitectureSpecific.Registers |
getContextRegisters()
|
static Feedlet |
getCurrentFeedlet()
|
static RVMThread |
getCurrentThread()
|
static int |
getCurrentThreadSlot()
|
int |
getDisableGCDepth()
Get the disable GC depth |
boolean |
getDisallowAllocationsByThisThread()
Are allocations allowed by this thread? |
ArchitectureSpecific.Registers |
getExceptionRegisters()
|
int |
getExecStatus()
|
static Address |
getHijackedReturnAddress(Address hijackedFp)
Given a frame that has been hijacked by the stack trampoline, return the real (hijacked) return address. |
Address |
getHijackedReturnCalleeFp()
|
boolean |
getIsAboutToTerminate()
|
Thread |
getJavaLangThread()
Get the current java.lang.Thread. |
JNIEnvironment |
getJNIEnv()
Get current thread's JNI environment. |
int |
getLockingId()
Get this thread's id for use in lock ownership tests. |
String |
getName()
Gets the name of the thread |
Address |
getNextUnencounteredFrame()
|
static int |
getNumActiveDaemons()
Number of active daemon threads. |
static int |
getNumActiveThreads()
Number of active threads in the system. |
static OutOfMemoryError |
getOutOfMemoryError()
Returns the outstanding OutOfMemoryError. |
int |
getPriority()
Get the priority of the thread |
byte[] |
getStack()
|
int |
getStackLength()
|
private Address |
getStackTrampolineBridgeIP()
|
Thread.State |
getState()
Get the state of the thread in a manner compatible with the Java API |
int |
getThreadSlot()
|
Address |
getTrampolineHijackedReturnAddress()
|
private void |
handleDebugRequestForThread()
|
(package private) void |
handleHandshakeRequest()
Handle requests that required a soft handshake. |
private void |
handlePossibleRecursiveException()
Handle the case of exception handling triggering new exceptions. |
void |
handleUncaughtException(Throwable exceptionObject)
|
static void |
hardHandshakeResume()
|
static void |
hardHandshakeResume(RVMThread.BlockAdapter ba,
RVMThread.HardHandshakeVisitor hhv)
|
static void |
hardHandshakeSuspend()
|
static void |
hardHandshakeSuspend(RVMThread.BlockAdapter ba,
RVMThread.HardHandshakeVisitor hhv)
|
boolean |
hasNativeStackFrame()
Indicate whether the stack of this Thread contains any C frame (used in RuntimeEntrypoints.deliverHardwareException for stack resize) |
boolean |
holdsLock(Object obj)
Does the currently running Thread hold the lock on an obj? |
boolean |
ignoreHandshakesAndGC()
Should this thread run concurrently with STW GC and ignore handshakes? |
static void |
init()
Initialize the threading subsystem for the boot image. |
void |
initializeJNIEnv()
Initialize JNI environment for system threads. |
void |
installStackTrampolineBridge(Address targetFp)
Install the stack trampoline bridge at a given frame, hijacking that frame, saving the hijacked return address and callee fp in thread-local state to allow execution of the hijacked frame later. |
void |
interrupt()
Interrupt this thread |
private static boolean |
isAddressValidFramePointer(Address address)
Return true if the supplied address could be a valid frame pointer. |
boolean |
isAlive()
Is the thread started and not terminated |
boolean |
isBlocked()
Checks if the thread system has acknowledged that the thread is supposed to be blocked. |
boolean |
isBootThread()
|
boolean |
isDaemonThread()
Returns the value of daemon . |
boolean |
isInJava()
Checks if the thread is executing Java code. |
boolean |
isInterrupted()
Was this thread interrupted? |
private boolean |
isMainThread()
|
boolean |
isOnQueue()
|
boolean |
isSystemThread()
Is this a system thread? |
static boolean |
isTrampolineIP(Address ip)
Determine whether a given method is the stack trampoline |
void |
join(long ms,
int ns)
Wait for the thread to die or for the timeout to occur |
private void |
leaveJNIBlocked()
|
static void |
leaveJNIBlockedFromCallIntoNative()
Called when JNI code tried to transition from IN_JNI to IN_JAVA but failed |
(package private) static void |
leaveJNIBlockedFromJNIFunctionCall()
|
static void |
leaveJNIFromCallIntoNative()
|
static void |
leaveJNIFromJNIFunctionCall()
|
static void |
leaveNative()
Leave privileged code. |
private void |
leaveNativeBlocked()
|
private void |
leaveNativeBlockedImpl()
|
void |
makeDaemon(boolean on)
Set the "isDaemon" status of this thread. |
NoYieldpointsMonitor |
monitor()
Get the NoYieldpointsCondLock for this thread. |
(package private) static NoYieldpointsMonitor |
monitorForSlot(int slot)
Get a NoYieldpointsCondLock for a given thread slot. |
static void |
notify(Object o)
Support for Java Object.notify() synchronization
primitive. |
static void |
notifyAll(Object o)
Support for Java synchronization primitive. |
static boolean |
notRunning(int state)
|
(package private) void |
observeExecStatus()
|
static void |
observeExecStatusAtSTW(int execStatus)
|
(package private) static void |
observeStateTransition(int oldState,
int newState)
|
void |
park(boolean isAbsolute,
long time)
|
boolean |
physicalAllocationFailed()
Get the physical allocation failed flag. |
static void |
processAboutToTerminate()
Method called after processing a list of threads, or before starting a new thread. |
static void |
raiseIllegalMonitorStateException(String msg,
Object o)
|
(package private) void |
releaseThreadSlot()
Release a thread's slot in the threads array. |
void |
reportCollectionAttempt()
Set the initial attempt. |
static void |
reportThreadTransitionCounts()
|
void |
resetCollectionAttempts()
Resets the attempts. |
static void |
resizeCurrentStack(int newSize,
ArchitectureSpecific.Registers exceptionRegisters)
Change the size of the currently executing thread's stack. |
void |
resume()
Resume execution of a thread that has been suspended. |
static void |
returnBarrier()
The return barrier. |
void |
run()
Method to be executed when this thread starts running. |
int |
safeAsyncBlock(RVMThread.BlockAdapter ba)
|
int |
safeBlock(RVMThread.BlockAdapter ba)
|
private int |
safeBlock(RVMThread.BlockAdapter ba,
boolean asynchronous)
|
static boolean |
safeToForceGCs()
Is it safe to start forcing garbage collects for stress testing? |
static void |
saveThreadState()
Save the current thread state. |
private int |
setBlockedExecStatus()
|
void |
setDisableGCDepth(int d)
Modify the disable GC depth |
void |
setDisallowAllocationsByThisThread()
Disallow allocations by this thread |
private void |
setExecStatus(int newState)
|
void |
setName(String name)
Sets the name of the thread |
void |
setPhysicalAllocationFailed()
Set the physical allocation failed flag. |
void |
setPriority(int priority)
Set the priority of the thread |
void |
setupBootJavaThread()
Called during booting to give the boot thread a java.lang.Thread |
static RVMThread |
setupBootThread()
Set up the initial thread and processors as part of boot image writing |
boolean |
shouldBeSampled()
Should the thread by eligible for sampling by the timer thread? |
private static void |
showMethod(int compiledMethodId,
Address fp)
Show a method where getCompiledMethod returns null |
private static void |
showMethod(RVMMethod method,
int lineNumber,
Address fp)
Helper function for dumpStack(Address,Address) . |
private static void |
showMethod(String name,
Address fp)
Show a method that we can't show (ie just a text description of the stack frame |
private static void |
showPrologue(Address fp)
|
static void |
sleep(long ns)
Suspend execution of current thread for specified number of seconds (or fraction). |
static void |
sleep(long millis,
int ns)
Suspend execution of current thread for specified number of seconds (or fraction). |
static int |
snapshotHandshakeThreads(RVMThread.SoftHandshakeVisitor v)
|
static void |
softHandshake(RVMThread.SoftHandshakeVisitor v)
Tell each thread to take a yieldpoint and wait until all of them have done so at least once. |
void |
softRendezvous()
Rendezvous with a soft handshake request. |
boolean |
softRendezvousCheckAndClear()
Check and clear the need for a soft handshake rendezvous. |
void |
softRendezvousCommit()
Commit the soft handshake rendezvous. |
void |
start()
Start execution of 'this' by putting it on the appropriate queue of an unspecified virtual processor. |
private static void |
startoff()
Begin execution of current thread by calling its "run" method. |
void |
stop(Throwable cause)
|
void |
suspend()
Suspend execution of current thread until it is resumed. |
void |
terminate()
Terminate execution of current thread by abandoning all references to it and resuming execution in some other (ready) thread. |
private void |
terminateUnpreemptible()
Unpreemptible portion of thread termination. |
private static void |
throwFromUninterruptible(Throwable e)
|
(package private) void |
timerTick()
|
String |
toString()
String representation of thread |
static void |
trace(String who,
String what)
Print out message in format "[j] (cez#td) who: what", where: j = java thread id z* = RVMThread.getCurrentThread().yieldpointsEnabledCount (0 means yieldpoints are enabled outside of the call to debug) t* = numActiveThreads d* = numActiveDaemons * parenthetical values, printed only if traceDetails = true) We serialize against a mutex to avoid intermingling debug output from multiple threads. |
static void |
trace(String who,
String what,
Address addr)
|
static void |
trace(String who,
String what,
int howmany)
Print out message in format "p[j] (cez#td) who: what howmany", where: p = processor id j = java thread id c* = java thread id of the owner of threadCreationMutex (if any) e* = java thread id of the owner of threadExecutionMutex (if any) t* = numActiveThreads d* = numActiveDaemons * parenthetical values, printed only if traceDetails = true) We serialize against a mutex to avoid intermingling debug output from multiple threads. |
static void |
traceback(String message)
Print interesting scheduler information, starting with a stack traceback. |
static void |
traceback(String message,
int number)
|
(package private) static void |
tracebackWithoutLock()
|
static void |
traceHex(String who,
String what,
int howmany)
|
private static void |
transferExecutionToNewStack(byte[] newStack,
ArchitectureSpecific.Registers exceptionRegisters)
|
(package private) static int |
transitionHistogramIndex(int oldState,
int newState)
|
void |
unblock(RVMThread.BlockAdapter ba)
|
static void |
unblockAllMutatorsForGC()
Unblock all mutators blocked for GC. |
void |
unpark()
|
static void |
wait(Object o)
Support for Java Object.wait() synchronization primitive. |
static void |
wait(Object o,
long millis)
Support for Java Object.wait() synchronization primitive. |
static void |
waitAbsoluteNanos(Object o,
long whenNanos)
Support for RTSJ- and pthread-style absolute wait. |
(package private) void |
waitImpl(Object o,
boolean hasTimeout,
long whenWakeupNanos)
|
static boolean |
worldStopped()
|
static void |
yieldNoHandshake()
|
static void |
yieldpoint(int whereFrom,
Address yieldpointServiceMethodFP)
Process a taken yieldpoint. |
static void |
yieldpointFromBackedge()
Yieldpoint taken on backedge. |
static void |
yieldpointFromEpilogue()
Yieldpoint taken in epilogue. |
static void |
yieldpointFromPrologue()
Yieldpoint taken in prologue. |
boolean |
yieldpointsEnabled()
Are we allowed to take yieldpoints? |
static void |
yieldWithHandshake()
|
Methods inherited from class org.jikesrvm.mm.mminterface.ThreadContext |
---|
getCollectorContext, isCollectorThread |
Methods inherited from class org.jikesrvm.mm.mminterface.Selected.Mutator |
---|
get, getThread |
Methods inherited from class org.mmtk.plan.generational.immix.GenImmixMutator |
---|
alloc, collectionPhase, getAllocatorFromSpace, postAlloc |
Methods inherited from class org.mmtk.plan.generational.GenMutator |
---|
assertRemsetsFlushed, flushRememberedSets, objectReferenceBulkCopy, objectReferenceNonHeapWrite, objectReferenceTryCompareAndSwap, objectReferenceWrite |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final boolean traceBlock
protected static final boolean traceReallyBlock
protected static final boolean traceAboutToTerminate
protected static final boolean dumpStackOnBlock
protected static final boolean traceBind
protected static final boolean traceAcct
protected static final boolean trace
private static final boolean traceTermination
private static final boolean traceAdjustments
private static final boolean neverKillThreads
private static final boolean STATS
static int waitOperations
static int timedWaitOperations
static int notifyOperations
static int notifyAllOperations
public static final boolean ALWAYS_LOCK_ON_STATE_TRANSITION
public static final int NEW
public static final int IN_JAVA
public static final int IN_NATIVE
public static final int IN_JNI
public static final int IN_JAVA_TO_BLOCK
public static final int BLOCKED_IN_NATIVE
the point of this state is that the thread is guaranteed not to execute any Java code until:
public static final int BLOCKED_IN_JNI
public static final int TERMINATED
public static final int LAST_EXEC_STATUS
private ArchitectureSpecific.Registers trampolineRegisters
private Address hijackedReturnAddress
private Address hijackedReturnCalleeFp
private Address hijackedReturnCallerFp
public static final boolean DEBUG_STACK_TRAMPOLINE
public static ArchitectureSpecific.CodeArray stackTrampolineBridgeInstructions
private int execStatus
private boolean isAboutToTerminate
boolean isBlocking
boolean isJoinable
RVMThread next
queuedOn
.
volatile ThreadQueue queuedOn
next
field is used as a link pointer.
SpinLock awaitingSpinLock
RVMThread contenderLink
private Thread thread
private String name
protected boolean daemon
private int priority
Thread.MIN_PRIORITY
<= priority <=
Thread.MAX_PRIORITY
.
public int threadSlot
threadBySlot
[]. This value must be non-zero
because it is shifted and used in Object
lock ownership tests.
public int lockingId
private final SystemThread systemThread
public static RVMThread bootThread
public static boolean threadingInitialized
public static long timerTicks
private long yieldpointsTaken
private long yieldpointsTakenFully
private long nativeEnteredBlocked
private long jniEnteredBlocked
private boolean disallowAllocationsByThisThread
VM.disableGC()
/VM.enableGC()
. A value of "true" means
it's an error for this thread to call "new". This is only used for
assertion checking; we do not bother to set it when
Configuration.VerifyAssertions
is false.
private int disableGCDepth
VM.disableGC()
. If this
is set, then we should also have disallowAllocationsByThisThread
set. The converse also holds.
public int barriersEntered
public int barriersExited
private byte[] stack
public Address stackLimit
Address
of the guard area for stack
.
Address framePointer
int hiddenSignatureId
int arrayIndexTrapParam
public boolean yieldToOSRRequested
public boolean yieldForCBSCall
public boolean yieldForCBSMethod
public int numCBSCallSamples
public int countdownCBSCall
public int firstCBSCallSample
public int numCBSMethodSamples
public int countdownCBSMethod
public int firstCBSMethodSample
public boolean codePatchSyncRequested
public int thread_cbs_counter
private int yieldpointsEnabledCount
boolean yieldpointRequestPending
boolean atYieldpoint
public boolean flushRequested
public boolean softHandshakeRequested
public static int softHandshakeLeft
public static Monitor softHandshakeDataLock
public static Monitor handshakeLock
public final ArchitectureSpecific.Registers contextRegisters
private final ArchitectureSpecific.Registers contextRegistersShadow
public final ArchitectureSpecific.Registers contextRegistersSave
private final ArchitectureSpecific.Registers contextRegistersSaveShadow
private final ArchitectureSpecific.Registers exceptionRegisters
private final ArchitectureSpecific.Registers exceptionRegistersShadow
private int uncaughtExceptionCount
public Lock cachedFreeLock
protected Object waitObject
Object.wait()
and Object.notify()
.
protected int waitCount
boolean shouldSuspend
int shouldSuspendToken
boolean isSuspended
boolean shouldBlockForHandshake
boolean isBlockedForHandshake
boolean shouldBlockForGC
boolean isBlockedForGC
public static final RVMThread.SuspendBlockAdapter suspendBlockAdapter
public static final RVMThread.HandshakeBlockAdapter handshakeBlockAdapter
public static final RVMThread.GCBlockAdapter gcBlockAdapter
static final RVMThread.BlockAdapter[] blockAdapters
protected RVMThread.Waiting waiting
Invariant: the RVM runtime does not ever use this field for any purpose other than updating it so that the java.lang.Thread knows the state. Thus, if you get sloppy with this field, the worst case outcome is that some Java program that queries the thread state will get something other than what it may or may not have expected.
Throwable asyncThrowable
boolean hasInterrupt
public int takeYieldpoint
To support efficient sampling of only prologue/epilogues we also encode some extra information into this field. 0 means that the yieldpoint should not be taken. >0 means that the next yieldpoint of any type should be taken <0 means that the next prologue/epilogue yieldpoint should be taken
Note the following rules:
public int timeSliceExpired
private boolean parkingPermit
private JNIEnvironment jniEnv
private JNIEnvironment jniEnvShadow
private boolean physicalAllocationFailed
private int collectionAttempt
private static OutOfMemoryError outOfMemoryError
public static final int PROLOGUE
public static final int BACKEDGE
public static final int EPILOGUE
public static final int NATIVE_PROLOGUE
public static final int NATIVE_EPILOGUE
public static final int OSROPT
public final Object onStackReplacementEvent
public boolean isWaitingForOsr
public ArchitectureSpecific.CodeArray bridgeInstructions
public Offset fooFPOffset
public Offset tsFPOffset
public boolean requesting_osr
public boolean osr_done
public static int availableProcessors
public Word pthread_id
private double scratchStorage
private int threadIdx
private static boolean systemShuttingDown
public static volatile boolean debugRequested
public volatile boolean asyncDebugRequestedForThisThread
public static Latch doProfileReport
protected int inDumpStack
public boolean activeMutatorContext
public static Monitor dumpLock
protected static boolean exitInProgress
private static boolean worldStopped
protected static final boolean traceDetails
private static final boolean SHOW_FP_IN_STACK_DUMP
public static final int PRIMORDIAL_THREAD_INDEX
public static final int LOG_MAX_THREADS
public static final int MAX_THREADS
public static RVMThread[] threadBySlot
private static final NoYieldpointsMonitor[] monitorBySlot
Question: what is the outcome, if any, of taking a yieldpoint while holding this lock?
private static final Monitor[] communicationLockBySlot
public static NoYieldpointsMonitor acctLock
public static NoYieldpointsMonitor debugLock
private static NoYieldpointsMonitor outputLock
private static final int[] aboutToTerminate
private static int aboutToTerminateN
private static final int[] freeSlots
private static int freeSlotN
public static int nextSlot
public static int numThreads
public static final RVMThread[] threads
Note further that threads remain in this array even after the Java libraries no longer consider the thread to be active.
public static final RVMThread[] handshakeThreads
public static final RVMThread[] debugThreads
private static int numActiveThreads
private static int numActiveDaemons
public Feedlet feedlet
public static final RVMThread.AllButGCHardHandshakeVisitor allButGC
static long totalSuspendTime
static long totalResumeTime
static final int[] sloppyExecStatusHistogram
static final int[] statusAtSTWHistogram
static final int[] execStatusTransitionHistogram
Constructor Detail |
---|
public RVMThread(byte[] stack, Thread thread, String name, boolean daemon, SystemThread systemThread, int priority)
stack
- The stack on which to execute the thread.thread
- The corresponding java.lang.Thread.name
- The name of the threaddaemon
- True if this is a daemon thread.systemThread
- True if this is a system thread.priority
- The threads execution priority.public RVMThread(SystemThread systemThread, String name)
public RVMThread(SystemThread systemThread, byte[] stack, String name)
CollectorThread
and the
boot image writer for the boot thread.
public RVMThread(Thread thread, long stacksize, String name, boolean daemon, int priority)
Method Detail |
---|
public static boolean notRunning(int state)
public Address getHijackedReturnCalleeFp()
public int getExecStatus()
private boolean attemptFastExecStatusTransition(int oldState, int newState)
private void setExecStatus(int newState)
public boolean getIsAboutToTerminate()
public boolean isOnQueue()
static NoYieldpointsMonitor monitorForSlot(int slot)
public NoYieldpointsMonitor monitor()
public Monitor communicationLockForSlot(int slot)
public Monitor communicationLock()
public static void init()
public void assertAcceptableStates(int expected)
public void assertAcceptableStates(int expected1, int expected2)
public void assertUnacceptableStates(int unexpected)
public void assertUnacceptableStates(int unexpected1, int unexpected2)
static void bind(int cpuId)
static void bindIfRequested()
public static void boot()
private void addAboutToTerminate()
public static void processAboutToTerminate()
void assignThreadSlot()
void releaseThreadSlot()
private void acknowledgeBlockRequests()
public boolean isBlocked()
public boolean isInJava()
execStatus
is IN_JAVA
or
IN_JAVA_TO_BLOCK
, and if it is not
aboutToTerminate
, and if it is not blocked. Only call this
method when already holding the monitor(), and probably only after calling
setBlockedExecStatus(), for two reasons:
public boolean shouldBeSampled()
private void checkBlockNoSaveContext()
void checkBlock()
execStatus
) is set to IN_JAVA
once all blocking requests are cleared, and that other threads are notified
that this thread is in the middle of blocking by setting the appropriate
flag (isBlocking
). Note that this thread acquires the
monitor(), though it may release it completely either by calling wait() or
by calling unlockCompletely(). Thus, although it isn't generally a problem
to call this method while holding the monitor() lock, you should only do so
if the loss of atomicity is acceptable.
Generally, this method should be called from the following four places:
private void enterNativeBlockedImpl(boolean jni)
This method takes care of all bookkeeping and notifications required when a a thread that has been requested to block instead decides to run native code. Threads enter native code never need to block, since they will not be executing any Java code. However, such threads must ensure that any system services (like GC) that are waiting for this thread to stop are notified that the thread has instead chosen to exit Java. As well, any requests to perform a sot handshake must be serviced and acknowledged.
private void leaveNativeBlockedImpl()
private void enterNativeBlocked()
private void leaveNativeBlocked()
private void enterJNIBlocked()
private void leaveJNIBlocked()
public static void enterJNIBlockedFromJNIFunctionCall()
public static void enterJNIBlockedFromCallIntoNative()
static void leaveJNIBlockedFromJNIFunctionCall()
public static void leaveJNIBlockedFromCallIntoNative()
private int setBlockedExecStatus()
int block(RVMThread.BlockAdapter ba, boolean asynchronous)
Note that this method is ridiculously dangerous, especially if you pass asynchronous==false. Waiting for another thread to stop is not in itself interruptible - so if you ask another thread to block and they ask you to block, you might deadlock.
public boolean blockedFor(RVMThread.BlockAdapter ba)
public int asyncBlock(RVMThread.BlockAdapter ba)
public int block(RVMThread.BlockAdapter ba)
public void beginPairWith(RVMThread other)
public void endPairWith(RVMThread other)
public void beginPairWithCurrent()
public void endPairWithCurrent()
private int safeBlock(RVMThread.BlockAdapter ba, boolean asynchronous)
public int safeAsyncBlock(RVMThread.BlockAdapter ba)
public int safeBlock(RVMThread.BlockAdapter ba)
public void beginPairHandshake()
public void endPairHandshake()
public static void saveThreadState()
public static void enterNative()
public static boolean attemptLeaveNativeNoBlock()
public static void leaveNative()
public static void enterJNIFromCallIntoNative()
public static void leaveJNIFromCallIntoNative()
public static void enterJNIFromJNIFunctionCall()
public static void leaveJNIFromJNIFunctionCall()
public void unblock(RVMThread.BlockAdapter ba)
private void handleDebugRequestForThread()
public static void checkDebugRequest()
void timerTick()
public boolean yieldpointsEnabled()
public void enableYieldpoints()
public void disableYieldpoints()
public void failIfYieldpointsDisabled()
public static RVMThread getCurrentThread()
public static int getCurrentThreadSlot()
public int getThreadSlot()
public void setupBootJavaThread()
public String toString()
toString
in class Object
public Thread getJavaLangThread()
public JNIEnvironment getJNIEnv()
public int getDisableGCDepth()
public void setDisableGCDepth(int d)
public boolean getDisallowAllocationsByThisThread()
public void setDisallowAllocationsByThisThread()
public void clearDisallowAllocationsByThisThread()
public void initializeJNIEnv()
public boolean hasNativeStackFrame()
public void run()
private static void startoff()
public void start()
public void terminate()
private void callSystemExit(int exitStatus)
exitStatus
- private void terminateUnpreemptible()
void finishThreadTermination()
public static void yieldpointFromPrologue()
public static void yieldpointFromBackedge()
public static void returnBarrier()
The following code implements return barriers as described for Lisp by Yuasa http://www.yuasa.kuis.kyoto-u.ac.jp/~yuasa/ilc2002/index.html http://dx.doi.org/10.1109/ISORC.2005.45 and for Jikes RVM by Kumar et al http://dx.doi.org/10.1145/2398857.2384639
This code is executed when a method returns into a frame that has been hijacked by the return barrier mechanism. The return barrier trampoline will save state, execute this method, and then upon return from this method will transparently return into the frame that had been hijacked.
In this default implementation, the barrier reinstalls itself in the caller's frame thus incrementally moving the barrier down the stack.
The execution of this method is fragile. It is generally safest to call some other method from here that does the substantive work of the barrier.
public void installStackTrampolineBridge(Address targetFp)
targetFp
- The frame to be hijacked.public void deInstallStackTrampoline()
private Address getStackTrampolineBridgeIP()
public Address getTrampolineHijackedReturnAddress()
public static boolean isTrampolineIP(Address ip)
ip
- the code to be checked
true
if the code is the stack trampoline.public static Address getHijackedReturnAddress(Address hijackedFp)
hijackedFp
- a frame that has been hijacked by the stack trampoline
private static void dumpFrame(Address fp)
fp
- The frame to be dumped.public Address getNextUnencounteredFrame()
public static void yieldpointFromEpilogue()
public void suspend()
public void resume()
public static void yieldNoHandshake()
public static void yieldWithHandshake()
public static void sleep(long ns) throws InterruptedException
InterruptedException
public static void sleep(long millis, int ns) throws InterruptedException
InterruptedException
void waitImpl(Object o, boolean hasTimeout, long whenWakeupNanos)
public static void wait(Object o)
Object.wait()
synchronization primitive.
o
- the object synchronized onpublic static void wait(Object o, long millis)
Object.wait()
synchronization primitive.
o
- the object synchronized onmillis
- the number of milliseconds to wait for notificationpublic static void waitAbsoluteNanos(Object o, long whenNanos)
o
- the object synchronized onwhenNanos
- the absolute time in nanoseconds when we should wake uppublic static void raiseIllegalMonitorStateException(String msg, Object o)
public static void notify(Object o)
Object.notify()
synchronization
primitive.
o
- the object synchronized onpublic static void notifyAll(Object o)
o
- the object synchronized onObject.notifyAll()
public void stop(Throwable cause)
public void park(boolean isAbsolute, long time) throws Throwable
Throwable
public void unpark()
public int getLockingId()
getThreadSlot()
, shifted appropriately
so it can be directly used in the ownership tests.
public static int snapshotHandshakeThreads(RVMThread.SoftHandshakeVisitor v)
public static void softHandshake(RVMThread.SoftHandshakeVisitor v)
visit()
method is called with both the
thread's monitor held, and the softHandshakeDataLock
held.
Currently we only use this mechanism for code patch isync requests on PPC, but this mechanism is powerful enough to be used by sliding-views style concurrent GC.
public boolean softRendezvousCheckAndClear()
public void softRendezvousCommit()
public void softRendezvous()
void handleHandshakeRequest()
This is almost always called with the monitor() lock held, but that's not guaranteed. If you need that lock, you can grab it (since it's a recursive lock). But you should avoid grabbing other sorts of locks since that might cause deadlock.
public static void blockAllMutatorsForGC()
public static void unblockAllMutatorsForGC()
public static void hardHandshakeSuspend(RVMThread.BlockAdapter ba, RVMThread.HardHandshakeVisitor hhv)
public static void hardHandshakeResume(RVMThread.BlockAdapter ba, RVMThread.HardHandshakeVisitor hhv)
public static void hardHandshakeSuspend()
public static void hardHandshakeResume()
public static boolean worldStopped()
public static void yieldpoint(int whereFrom, Address yieldpointServiceMethodFP)
private static void throwFromUninterruptible(Throwable e)
public static void resizeCurrentStack(int newSize, ArchitectureSpecific.Registers exceptionRegisters)
newSize
- new size (in bytes)exceptionRegisters
- register state at which stack overflow trap was encountered (null
--> normal method call, not a trap)private static void transferExecutionToNewStack(byte[] newStack, ArchitectureSpecific.Registers exceptionRegisters)
public void fixupMovedStack(Offset delta)
delta
- displacement to be applied to all interior referencesprivate static void adjustRegisters(ArchitectureSpecific.Registers registers, Offset delta)
registers
- registers to be adjusteddelta
- displacement to be appliedprivate static void adjustStack(byte[] stack, Address fp, Offset delta)
stack
- stack to be adjustedfp
- pointer to its innermost framedelta
- displacement to be applied to all its interior referencesprivate static Offset copyStack(byte[] newStack)
lo-mem hi-mem |<---myDepth----| +----------+---------------+ | empty | live | +----------+---------------+ ˆmyStack ˆmyFP ˆmyTop +-------------------+---------------+ | empty | live | +-------------------+---------------+ ˆnewStack ˆnewFP ˆnewTop
public void makeDaemon(boolean on)
Note: This method might need to be uninterruptible so it is final, which is why it isn't called setDaemon.
Public so that java.lang.Thread can use it.
public static void dumpAll(int verbosity)
VM.sysWrite(String)
. Each
thread's info is newline-terminated.
verbosity
- Ignored.public boolean isBootThread()
isBootThread()
private boolean isMainThread()
public boolean isSystemThread()
public CollectorThread getCollectorThread()
public boolean isDaemonThread()
daemon
.
public boolean ignoreHandshakesAndGC()
public boolean isAlive()
public void setName(String name)
name
- the new name for the threadThread.setName(String)
public String getName()
Thread.getName()
public boolean holdsLock(Object obj)
obj
- the object to check
Thread.holdsLock(Object)
public boolean isInterrupted()
Thread.isInterrupted()
public void clearInterrupted()
Thread.interrupted()
public void interrupt()
Thread.interrupt()
public int getPriority()
Thread.getPriority()
public void setPriority(int priority)
priority
- Thread.getPriority()
public Thread.State getState()
Thread.getState()
public void join(long ms, int ns) throws InterruptedException
ms
- milliseconds to waitns
- nanoseconds to wait
InterruptedException
public int countStackFrames()
public int getStackLength()
public byte[] getStack()
public ArchitectureSpecific.Registers getExceptionRegisters()
public ArchitectureSpecific.Registers getContextRegisters()
public void reportCollectionAttempt()
public int getCollectionAttempt()
public void resetCollectionAttempts()
public boolean physicalAllocationFailed()
public void setPhysicalAllocationFailed()
public void clearPhysicalAllocationFailed()
public static OutOfMemoryError getOutOfMemoryError()
public static int getNumActiveThreads()
public static int getNumActiveDaemons()
public void handleUncaughtException(Throwable exceptionObject)
private void handlePossibleRecursiveException()
private static void dumpThread(RVMThread t)
private static void dumpThreadArray(RVMThread[] array, int bound)
private static void dumpThreadSlotArray(int[] array, int bound)
private static void dumpThreadArray(String name, RVMThread[] array, int bound)
private static void dumpThreadSlotArray(String name, int[] array, int bound)
public static void dumpAcct()
public void extDump()
public void dump()
VM.sysWrite(String)
. We do not use any spacing or newline
characters. Callers are responsible for space-separating or
newline-terminating output.
public void dumpWithPadding(int leftJustify)
VM.sysWrite(String)
. We pad to a minimum of leftJustify
characters. We do not use any spacing characters. Callers are responsible
for space-separating or newline-terminating output.
leftJustify
- minimum number of characters emitted, with any extra characters
being spaces.public void dump(int verbosity)
VM.sysWrite(String)
. We do not use any spacing or newline
characters. Callers are responsible for space-separating or
newline-terminating output.
This function avoids write barriers and allocation.
verbosity
- Ignored.public int dump(char[] dest, int offset)
IndexOutOfBoundsException
.
dest
- char array to copy the source info into.offset
- Offset into dest
where we start copying
offset
. This is intended to represent the first
unused position in the array dest
. However, it also
serves as a pseudo-overflow check: It may have the value
dest.length
, if the array dest
was
completely filled by the call, or it may have a value greater than
dest.length
, if the info needs more than
dest.length - offset
characters of space.
-1 if offset
is negative.public int dump(char[] dest)
This is identical to calling dump(char[],int)
with an
offset
of zero.
static void dumpStats()
public static void trace(String who, String what)
We serialize against a mutex to avoid intermingling debug output from multiple threads.
public static void trace(String who, String what, int howmany)
We serialize against a mutex to avoid intermingling debug output from multiple threads.
public static void traceHex(String who, String what, int howmany)
public static void trace(String who, String what, Address addr)
private static void _trace(String who, String what, int howmany, boolean hex)
public static void traceback(String message)
Note: the system could be in a fragile state when this method is called, so we try to rely on as little runtime functionality as possible (eg. use no bytecodes that require RuntimeEntrypoints support).
public static void traceback(String message, int number)
static void tracebackWithoutLock()
public static void dumpStack()
public static void dumpStack(Address fp)
fp
- address of starting frame. first frame output is the calling
frame of passed framepublic static void dumpStack(Address ip, Address fp)
ip
- instruction pointer for first frame to dumpfp
- frame pointer for first frame to dumpprivate static boolean isAddressValidFramePointer(Address address)
or it is StackframeLayoutConstants.STACKFRAME_SENTINEL_FP
. The
STACKFRAME_SENTINEL_FP is possible when the thread has been created but has
yet to be scheduled.
address
- the address.
private static void showPrologue(Address fp)
private static void showMethod(int compiledMethodId, Address fp)
compiledMethodId
- fp
- private static void showMethod(String name, Address fp)
name
- fp
- private static void showMethod(RVMMethod method, int lineNumber, Address fp)
dumpStack(Address,Address)
. Print a stack
frame showing the method.
public static void dumpStackAndDie(Address fp)
fp
- address of starting frame Returned: doesn't return. This method is
called from RunBootImage.C when something goes horrifically wrong
with exception handling and we want to die with useful
diagnostics.public static boolean safeToForceGCs()
public static boolean gcEnabled()
public static RVMThread setupBootThread()
public static void dumpVirtualMachine()
public static Feedlet getCurrentFeedlet()
public static void reportThreadTransitionCounts()
static void dump1DHisto(String name, int[] histo)
void observeExecStatus()
public static void observeExecStatusAtSTW(int execStatus)
static int transitionHistogramIndex(int oldState, int newState)
static void observeStateTransition(int oldState, int newState)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |