RFR: 8329748: Change default value of AssertWXAtThreadSync to true

Dean Long dlong at openjdk.org
Mon May 6 21:55:53 UTC 2024


On Mon, 6 May 2024 21:50:03 GMT, Dean Long <dlong at openjdk.org> wrote:

>> The debug flag `-XX:+AssertWXAtThreadSync` conservatively  checks for correct W^X thread state at possible safepoints or handshake. The flag is useful to detect missing `MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread));`. Since the check is cheap and it is a `AARCH64_ONLY(develop(..))` only flag it makes sense to enable the flag by default. 
>> 
>> There was one missing `MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread));` to make all tests (tier1-7) pass.
>
> src/hotspot/share/jfr/support/jfrIntrinsics.cpp line 77:
> 
>> 75: void* JfrIntrinsicSupport::return_lease(JavaThread* jt) {
>> 76:   DEBUG_ONLY(assert_precondition(jt);)
>> 77:   MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, jt));
> 
> It seems like this could be moved down.  It doesn't seem to be needed for the Java --> native transition.  Is it needed for the JfrJavaEventWriter::flush() call?

If it is only needed for the native --> Java transition below, why don't we do it lazily?  The interpreter and compilers already do this by calling check_special_condition_for_native_trans() only if a safepoint is detected.
Normally we would want to be in the WXExec state when executing in _thread_in_native.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19102#discussion_r1591594916


More information about the hotspot-dev mailing list