Parallel stack overflow handling
Original Publication Date: 2002-Jul-14
Included in the Prior Art Database: 2003-Jun-21
During the "mark" phase of a stop-the-world Garbage collection in a *Java Virtual Machine (JVM) we identify which objects in the heap are no longer reachable, i.e garbage, and can therefore be collected. As we have no way of individually identifying unreachable objects we instead identify all the reachable objects; the remainder are garbage. The process of identifying all the reachable objects is also known as "tracing". The active state of the JVM is made up of the saved registers for each thread, the set of stacks representing the threads, the statics within Java classes, the set of local and global JNI references. All invocations of functions within the JVM itself give rise to a frame on the C stack. This frame may itself contain references to objects either as a result of an assignment to a local variable or a parameter passed from the caller. These thread stacks are viewed as a set of 4 byte fields (8 bytes in 64 bit architecture) and are scanned from top to the bottom. All these references are treated equally by the tracing routines and each is examined to see if its points to an object in the heap. Note that this does not make it necessarily a pointer to an object since it may be just an unlucky combination of bits in a float or integer. Hence when we make this scan of the stacks we must be 'conservative'. Anything which points at an object is assumed to be a live reference. A reference is considered to be a pointer to an object if it fulfills the following three criteria: 1. It is grained on an 8 byte boundary. 2. It is within the bounds of the heap.