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

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


On Tue, 2 Apr 2024 12:05:49 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Thank you for finding the original comment thread. Wouldn't it be sufficient to add a `TBIVM` if and only if `Thread::current_or_null() != nullptr`?
>
> 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 :-).

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

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


More information about the hotspot-runtime-dev mailing list