RFR: 8323807: Async UL: Add a stalling mode to async UL [v2]

Johan Sjölen jsjolen at openjdk.org
Tue Apr 2 14:57:02 UTC 2024


On Tue, 2 Apr 2024 14:45:16 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

>> That will mean a little duplicated code due to the TBIVM being block-scoped (which we do elsewhere). The TBIVM is  necessary but I'm not certain it is sufficient to deal with all safepoint issues.
>
> From reading TBIVM, I think I'm using it incorrectly. It's currently this:
> 
> ```c++
>       if (thread != nullptr && thread->is_Java_thread()) {
>         ThreadBlockInVM tbivm(JavaThread::cast(thread));
>         while (not_enough_memory()) {
>           _producer_lock.wait(0);
>         }
>       }
> 
> 
> But maybe it should be this:
> 
> ```c++
>       if (thread != nullptr && thread->is_Java_thread()) {
>         while (not_enough_memory()) {
>         ThreadBlockInVM tbivm(JavaThread::cast(thread));
>           _producer_lock.wait(0);
>         }
>       }
> 
> 
> `Monitor` is also a bit confusing to me, it seems that only `JavaThread`s can use `Monitor` (see `Monitor::wait` for example), but we have no guarantee that UL is used from a `JavaThread`.
> 
> At the very least, this is revealing that I'm not that good at the JVM's thread and locking system :-).

Right, I talked to ErikÖ, and the first version (the current one in the source tree) is correct. The second one isn't wrong either, but it's unnecessary.

I'm not creative enough to see any other safepoint issues, however.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17757#discussion_r1548054930


More information about the hotspot-runtime-dev mailing list