RFR: 8353176: C1: x86 patching stub always calls Thread::current()

Aleksey Shipilev shade at openjdk.org
Fri Mar 28 12:35:54 UTC 2025


Noticed this while looking at compiled code density. In C1 PatchingStub code, we _always_ perform a runtime call to `Thread::current()`, even though we can rely on `r15_thread` to be available. This is because we are calling to `MacroAssembler::get_thread()`, which is always doing slowpath.

This kind of accident would be less likely / impossible once we cleanup uses of `MacroAssembler::get_thread()` with [JDK-8353174](https://bugs.openjdk.org/browse/JDK-8353174).

Additional testing:
 - [x] Linux x86_64 server fastdebug, `tier1`
 - [x] Linux x86_64 server fastdebug, `tier1` + `-XX:TieredStopAtLevel=1`
 - [ ] Linux x86_64 server fastdebug, `all`
 - [ ] Linux x86_64 server fastdebug, `all` + `-XX:TieredStopAtLevel=1`

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

Commit messages:
 - More comprehensive fix
 - Fix

Changes: https://git.openjdk.org/jdk/pull/24291/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24291&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8353176
  Stats: 10 lines in 1 file changed: 0 ins; 6 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/24291.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24291/head:pull/24291

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


More information about the hotspot-compiler-dev mailing list