There is a class of possible issues on macos/aarch64 related to W^X management, when the switch between modes is performed near JavaThread state change (java/native/vm). Thread state change checks for safepoint and sometimes this check leads to actual safepoint, where we may need WXWrite mode (e.g. making method non-entrant needs to poison nmethod instructions). So in general, java thread state should always be changed in WXWrite mode and before going to WXExec. Failing to do that leads to rare and hard to reproduce crashes.
This enhancement suggests to add explicit check of the WX mode to catch such issues in advance.