[foreign-memaccess+abi] RFR: 8301261: Add linker option for specifying uncaught exception handler

Jorn Vernee jvernee at openjdk.org
Fri Feb 3 17:13:21 UTC 2023


On Wed, 1 Feb 2023 22:12:30 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

> This patch adds the ability to specify an uncaught exception handler for an upcall stub, and changes the uncaught exception handling code to delegate to the thread's installed uncaught exception handler when no handler is specified as well, which will also allow setting a system-wide uncaught exception handler.
> 
> For the tests: I've refactored TestUpcallException a bit. Previously the test code was found in a separate class (ThrowingUpcall). I've removed this class and moved the code into nested classes of TestUpcallException instead. Then I've added new test cases for testing the uncaught exception handler.
> 
> I also noticed that we were setting the wrong system property to control binding recipe specialization in several tests (I thought I fixed this before, but it might have been undone by a merge...). I've fixed these to set the right property, and that also revealed a small bug in the interpreted version of the UnboxAddress binding, where we weren't properly reject heap segments. I've fixed that as well.

I've addressed review comments.

I wrote this code a while back, and at the time I had used `exactInvoker` in the tests to bypass the exception that you get when trying to link an upcall stub with a target method handle that provably throws an exception. I've now decided that a simpler way to deal with that issue is to just throw an unchecked exception. (So that's where the switch from `Throwable` -> `RuntimeException` comes from)

-------------

PR: https://git.openjdk.org/panama-foreign/pull/777


More information about the panama-dev mailing list