RFR: 8341708: Optimize safepoint poll encoding with smaller poll data offset

Quan Anh Mai qamai at openjdk.org
Thu Oct 10 02:53:10 UTC 2024


On Tue, 8 Oct 2024 10:42:40 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> See the bug for discussion. We can optimize the encoding for safepoint polls by making sure the polling data is at small offset in `Thread`. There is already the area where we pull data like this for better encoding.
> 
> Code density improves on x86_64, can be seen with just `-Xcomp -XX:+CITime`:
> 
> 
> # Before
>   nmethod code size         :  7107136 bytes
>   nmethod code size         :  7107120 bytes
>   nmethod code size         :  7107136 bytes
> 
> # After (-0.25%)
>   nmethod code size         :  7088896 bytes
>   nmethod code size         :  7088896 bytes
>   nmethod code size         :  7088864 bytes
> 
> 
> Additional testing:
>  - [x] Ad-hoc code density checks
>  - [x] Linux x86_64 server fastdebug, `all`

src/hotspot/share/runtime/thread.hpp line 140:

> 138:  protected:
> 139:   // Poll data is used in generated code for safepoint polls.
> 140:   SafepointMechanism::ThreadData _poll_data;

Should this be private and you can add `friend class JavaThread` to this class. Also, the accessor below should be moved to `JavaThread`, too. Comments explaining that it is put here only for offset optimization would be great.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21405#discussion_r1794544404


More information about the hotspot-runtime-dev mailing list