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

Aleksey Shipilev shade at openjdk.org
Mon Mar 31 10:05:18 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`
>  - [x] Linux x86_64 server fastdebug, `all`
>  - [x] Linux x86_64 server fastdebug, `all` + `-XX:TieredStopAtLevel=1`

This pull request has now been integrated.

Changeset: 6fbaa066
Author:    Aleksey Shipilev <shade at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/6fbaa066ce45b70f1c288d1245b03fe18ceba126
Stats:     10 lines in 1 file changed: 0 ins; 6 del; 4 mod

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

Reviewed-by: mdoerr, kvn, vlivanov

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

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


More information about the hotspot-compiler-dev mailing list