Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8056402 | emb-9 | Roland Westrelin | P3 | Resolved | Fixed | b29 |
JDK-8063291 | 8u45 | Roland Westrelin | P3 | Resolved | Fixed | b01 |
JDK-8058239 | 8u40 | Roland Westrelin | P3 | Resolved | Fixed | b06 |
JDK-8071028 | emb-8u47 | Roland Westrelin | P3 | Resolved | Fixed | team |
Starting from JDK8-FCS following method will throw StackOverflowError when it compiled by C1:
void run() {
try {
run();
} catch (Throwable t) {
// StackOverflowError expected to be caught here
}
}
Issue happens when StackOverflowError is thrown during constraint class resolution (in this case j.l.Throwable and it is unresolved for some reason) in Method::fast_exception_handler_bci_for.
In that case SharedRuntime::compute_compiled_exc_handler will return address of unwind handler and C1's Runtime1::exception_handler_for_pc_helper will store in ExceptionCache as handler for StackOverflowError @ run() bci.
As a result, at every further attempt to find exception handler during unwinding Runtime1::exception_handler_for_pc_helper will return unwind handler from cache and method will never catch StackOverflowError.
For C2 StackOverflowError is also occurring during Throwable resolution, but in that case stack will be unwound until there will be enough stack space to resolve Throwable and actual exception handler will be returned.
Issue could be reproduced starting from 8 FCS. It is also reproducible with latest JDK9 build (b25).
Issue could be reproduced only with C1.
void run() {
try {
run();
} catch (Throwable t) {
// StackOverflowError expected to be caught here
}
}
Issue happens when StackOverflowError is thrown during constraint class resolution (in this case j.l.Throwable and it is unresolved for some reason) in Method::fast_exception_handler_bci_for.
In that case SharedRuntime::compute_compiled_exc_handler will return address of unwind handler and C1's Runtime1::exception_handler_for_pc_helper will store in ExceptionCache as handler for StackOverflowError @ run() bci.
As a result, at every further attempt to find exception handler during unwinding Runtime1::exception_handler_for_pc_helper will return unwind handler from cache and method will never catch StackOverflowError.
For C2 StackOverflowError is also occurring during Throwable resolution, but in that case stack will be unwound until there will be enough stack space to resolve Throwable and actual exception handler will be returned.
Issue could be reproduced starting from 8 FCS. It is also reproducible with latest JDK9 build (b25).
Issue could be reproduced only with C1.
- backported by
-
JDK-8056402 Recursive method that was compiled by C1 is unable to catch StackOverflowError
-
- Resolved
-
-
JDK-8058239 Recursive method that was compiled by C1 is unable to catch StackOverflowError
-
- Resolved
-
-
JDK-8063291 Recursive method that was compiled by C1 is unable to catch StackOverflowError
-
- Resolved
-
-
JDK-8071028 Recursive method that was compiled by C1 is unable to catch StackOverflowError
-
- Resolved
-