RFR: 8283044: Use asynchronous handshakes to deliver asynchronous exceptions [v2]
Patricio Chilano Mateo
pchilanomate at openjdk.java.net
Thu Mar 24 20:06:45 UTC 2022
> Please review the following patch to use asynchronous handshakes to handle asynchronous exceptions. The patch is broken down in 3 commits:
>
> 1) A small comment/code cleanup that applies to the current code even without this patch. It attempts to improve commentaries on the issues of handling asynchronous exceptions when coming from compiled code.
>
> 2) Implementation of send_async_exception(). This commit is the core of the implementation. Some things about the implementation:
>
> - If we try to send a new async exception to a JT that already has a pending ThreadDeath in the handshake queue then we skip installing the async handshake. This resembles the current behavior where we don't overwrite _pending_async_exception if it is set to a ThreadDeath oop already.
>
> - If we try to send a new exception to a JT that already has a pending async exception different that ThreadDeath in the handshake queue then we do install the async handshake. Since the handshake queue is a FIFO the last delivered exception will prevail on the _pending_exception field. This also resembles the current behavior where if _pending_async_exception is set but is not a ThreadDeath we overwrite it with the new one.
>
> - Some key methods from the SafepointMechanism and HandshakeState class were modified to receive an extra boolean to decide when to check for async exceptions, since as with suspend requests we don't want to process them on every poll. These changes still keep the current behavior of processing async exceptions only on transitions back to Java where we don't specifically disallow them (of course since we now arm the poll, the condition will be identified much faster but the processing is still done in the same allowed places as today).
>
> 3) Implementation of unsafe access error. I added special method HandshakeState::handle_unsafe_access_error() which takes care of creating the exception oop and calling handle_async_exception() to install the exception.
>
> I added test AsyncExceptionTest.java to stress delivery of async exceptions with compiled methods on the stack. I also added test AsyncExceptionOnMonitorEnter.java to stress delivery of async exceptions while target is trying to acquire a monitor. The test has two modes, one uses Java monitors and the other one JVMTI raw monitors.
>
> Besides those new added tests I tested the patch in mach5 tiers1-7.
>
> Thanks,
> Patricio
Patricio Chilano Mateo has updated the pull request incrementally with one additional commit since the last revision:
address Dan's comments
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/7930/files
- new: https://git.openjdk.java.net/jdk/pull/7930/files/5510dbdb..c9c48865
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=7930&range=01
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=7930&range=00-01
Stats: 11 lines in 3 files changed: 0 ins; 2 del; 9 mod
Patch: https://git.openjdk.java.net/jdk/pull/7930.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/7930/head:pull/7930
PR: https://git.openjdk.java.net/jdk/pull/7930
More information about the hotspot-runtime-dev
mailing list