RFR: 8274379: Allow process of unsafe access errors in check_special_condition_for_native_trans
Patricio Chilano Mateo
pchilanomate at openjdk.java.net
Fri Oct 1 14:47:36 UTC 2021
On Fri, 1 Oct 2021 02:05:06 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> Please review the following patch to allow processing of unsafe access errors in check_special_condition_for_native_trans().
>> Today we special case unsafe access errors from other async exceptions in that we don't process them when transitioning from native back to Java. Code comments in check_special_condition_for_native_trans() mention that unsafe access errors should not be handled because that may block while creating the exception. But that should not be an issue since we can always make sure we call process_if_requested_with_exit_check() after the call to throw_unsafe_access_internal_error() to process any pending operations not already handled in a ThreadBlockInVM wrapper (today that only means suspend requests and object reallocation operations).
>> By removing this special treatment for unsafe access errors we can also simplify the async exception support API. For instance we can remove _async_exception_condition and simplify some of the supporting methods. I also removed the _thread_in_native case from the switch statement in check_and_handle_async_exceptions() since we never call that method in that state.
>> Testing by running tiers1-6 in mach5.
> src/hotspot/share/runtime/thread.cpp line 1640:
>> 1638: // We might have blocked in a ThreadBlockInVM wrapper in the call above so make sure we process pending
>> 1639: // suspend requests and object reallocation operations if any since we might be going to Java after this.
>> 1640: SafepointMechanism::process_if_requested_with_exit_check(this, true /* check asyncs */);
> I have to wonder why this isn't handled in the TBIVM?
In 8270085 we had to disable by default processing of suspend requests due to possible deadlocks. So although suspend requests are implemented with handshakes, calls to process_if_requested() from ~TBIVM will not process them. As for object reallocation I'm not sure but I think it's just because there is no need to process them until we are about to go back to Java.
More information about the hotspot-runtime-dev