4.0 patch: Implement gij -Xss option
Bryce McKinlay
mckinlay@redhat.com
Thu Nov 17 19:07:00 GMT 2005
This is a simple subset of a larger patch I was working on to change the
default stack size and implement stack overflow detection.
Unfortunately, it turns out that there are currently some CG issues that
prevent stack overflow detection from working robustly. Specifically,
because the GC can run on any thread, and itself requires some stack,
there must be plenty of stack available for the signal handler to
execute as the signal handler needs to allocate. One solution might be
to ensure that the GC always runs on its own thread(s) which are
guaranteed to have plenty of stack space.
Limitations of this patch:
- There is no support for detecting stack overflow and throwing
StackOverflowException. If a stack overflows, it will bring down the
whole runtime (this is the same as what happens currently). Not good
behaviour!
- The default stack size remains unchanged.
- It does not limit the size of the initial thread's stack. The initial
patch I wrote implements this by inserting a guard page, but it seems
pointless to do so when we don't have StackOverflowException.
Another issue is that code running in our interpreter currently uses
substantially more stack than on other implementations, or with gcj
native code (I suspect this is due largely to libffi's stack allocated
closures). This means that interpreted code, given the same stack size,
is more likely to hit the stack limit on libgcj than in other
implementations.
Despite these issues, the ability to control the stack size is necessary
for large applications such as Jonas which can quickly run out of
address space when spawning many threads on a 32-bit machine. I plan to
post the more extensive (but problematic) implementation soon, but it
will still need some work before it can be committed.
I'm checking this in to both the 4.0 branch and trunk.
Bryce
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc40-stacksize-xss.patch
Type: text/x-patch
Size: 4572 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20051117/377f2792/attachment.bin>
More information about the Java-patches
mailing list