harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pavel Afremov" <pavel.n.afre...@gmail.com>
Subject Stack Overflow Error support issues
Date Thu, 22 Jun 2006 17:51:46 GMT

As far as I know, current implementation of DRL VM doesn't support Stack
Overflow Error (SOE).
I have found it out using following test:

public class Stack {
    static int depth = 0;

    public static void func() {

    public static void main(String[] args) {
        try {
        } catch (Throwable th) {
            System.out.println("First SOE depth = " + depth);
            System.out.println("Caught = " + th);

I'm experimenting to add Stack Overflow Error (SOE) support using protected
memory page on the stack. I see and use two main schemes of exception
1. If top frame is unwindable (regular java code), then signal handler or
vectored exception handler throws regular java exception, as it can happen
now for NullPointerException.
2. If top frame is non-unwindable (for example, JNI native code) VM sets
exceptions for the current thread and continues its execution from
interrupted place. A code which works in nonunwindable mode should
periodically check that no exception is raised.

During my experiments I found some problems in current VM implementation
(including JIT)
1. Some parts of VM which use long recursion calls in non-unwindable mode
(JIT compiler, verifier) don't check that StackOverflowError has occured. I
added check that there are 256 Kbytes of free stack, before starting
compilation. But I'm afraid it is not enough sometimes.
2. If StackOverflowError is thrown during the first two commands of compiled
method, function "unwind "of the JIT cannot always unwind frame correctly.

Are there any ideas how to fix them?

I have some code developed locally, and can submit it to JIRA if anyone is
interested in trying it.

Pavel Afremov.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message