[jdk17] RFR: 8271251: JavaThread::java_suspend() fails with "fatal error: Illegal threadstate encountered: 6" [v3]
Patricio Chilano Mateo
pchilanomate at openjdk.java.net
Tue Jul 27 16:51:37 UTC 2021
On Tue, 27 Jul 2021 15:41:15 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:
> If you decide to add `is_a_block_safe_state()`, then add it above
> SafepointSynchronize::block() and use it to determine what safepoint
> safe states are accepted by SafepointSynchronize::block(), i.e., share
> the new function.
>
So having an assert only for the _thread_in_vm case doesn't seem right to me since it would test only for this specific case that we are fixing. I can add the is_a_block_safe_state() method, but if we want to avoid code and check duplication I would have to remove the current switch statement from SafepointSynchronize::block(). Then the assert you want can be made a guarantee. Something like this:
https://github.com/pchilano/jdk17/commit/db0f8eb4dba08d6a7250bd9e87816f2f024fa600
I defined is_a_block_safe_state() in safepoint.hpp to allow inlining in SafepointMechanism::process().
Unless you want to keep the check of state in ::block, in which case I can add the guarantee in ::block instead and leave it in process() as an assert. The duplicate check would be only in debug mode in that case.
-------------
PR: https://git.openjdk.java.net/jdk17/pull/283
More information about the hotspot-runtime-dev
mailing list