RFR: 8353176: C1: x86 patching stub always calls Thread::current()
Vladimir Ivanov
vlivanov at openjdk.org
Fri Mar 28 17:49:31 UTC 2025
On Fri, 28 Mar 2025 11:05:33 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
> 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 currently emits a huge sequence of instructions for register save/restore and the call itself.
>
> Current code calls to `MacroAssembler::get_thread()`, which is always doing that 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`
> - [x] Linux x86_64 server fastdebug, `all` + `-XX:TieredStopAtLevel=1`
Looks good.
-------------
Marked as reviewed by vlivanov (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/24291#pullrequestreview-2726274704
More information about the hotspot-compiler-dev
mailing list