RFR: 8297600: Check current thread in selected JRT_LEAF methods

Aleksey Shipilev shade at openjdk.org
Thu Nov 24 19:30:24 UTC 2022


With [JDK-8275286](https://bugs.openjdk.org/browse/JDK-8275286), we added the `Thread::current()` checks for most of the JRT entries. But `JRT_LEAF` is still not checked, because not every `JRT_LEAF` carries a `JavaThread` argument. Having assertions there helps for two reasons. First, these methods can be called from the stub/compiler code, which might be erroneous with thread handling (especially in x86_32 that does not have a dedicated thread register). Second, in the post-Loom world, current thread can change suddenly, as evidenced here: https://mail.openjdk.org/pipermail/hotspot-compiler-dev/2022-November/060779.html.

We can add the thread checks to relevant `JRT_LEAF` methods that accept `JavaThread*` too.

Additional testing:
 - [x] Linux x86_64 fastdebug `tier1`
 - [x] Linux x86_64 fastdebug `tier2`
 - [ ] Linux x86_32 fastdebug `tier1`
 - [ ] Linux x86_32 fastdebug `tier2`

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

Commit messages:
 - Fix

Changes: https://git.openjdk.org/jdk/pull/11359/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11359&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8297600
  Stats: 32 lines in 8 files changed: 32 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/11359.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11359/head:pull/11359

PR: https://git.openjdk.org/jdk/pull/11359


More information about the hotspot-dev mailing list