RFR: 8378194: Protect process_pending_interp_only() work with JvmtiThreadState_lock [v5]

Leonid Mesnik lmesnik at openjdk.org
Thu Feb 26 00:06:34 UTC 2026


On Wed, 25 Feb 2026 23:17:51 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:

>> src/hotspot/share/prims/jvmtiThreadState.hpp line 207:
>> 
>>> 205:   // Return true if any thread has entered interp_only_mode at any point during the JVMs execution.
>>> 206:   static bool seen_interp_only_mode() {
>>> 207:     return _seen_interp_only_mode.load_relaxed();
>> 
>> Not sure `load_relaxed` is enough here.
>> I think we need `load_acquire`/`release_store`
>
> Okay, thanks. Replaced with `load_acquire`/`release_store`.

Well, I think that load_relaxed should be enough here. 

The `_seen_interp_only_mode` and `_pending_interp_only_mode` are updated with the JvmtiThreadState_lock and changes should be visible together after lock is released.

So even `_seen_interp_only_mode` is relaxed load/store and might be reordered with `_pending_interp_only_mode`, it is not possible that 
`_pending_interp_only_mode` is true  in the `JvmtiThreadState::enter_interp_only_mode()`
while
`_seen_interp_only_mode`
is still false.

It might be possible that it becomes 'true' while the recompute enabled is still in process, but it is ok.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29800#discussion_r2856121024


More information about the serviceability-dev mailing list