RFR: 8356946: x86: Optimize interpreter profile updates

Vladimir Kozlov kvn at openjdk.org
Wed May 14 16:26:52 UTC 2025


On Wed, 14 May 2025 09:48:54 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> Noticed two awkward things in current x86 interpreter profiling code.
> 
> First, we carry the implementation for counter decrements without using them. This is dead code, and can be purged.
> 
> Second, we care about overflows for 64-bit for some reason. I think this is a reminiscent of 32-bit x86 support, where we can plausibly have 32-bit counter overflow in a reasonable timeframe. But for 64-bit counter, we need tens of years of constantly bashing the counter to get it to overflow. No other profile counter update code, e.g. in C1, cares about this.
> 
> So we can save a few instructions / memory accesses on this path. 
> 
> Additional testing:
>  - [x] Linux x86_64 server fastdebug, `tier1`
>  - [ ] Linux x86_64 server fastdebug, `all`

Looks good.

src/hotspot/cpu/x86/interp_masm_x86.hpp line 217:

> 215:   void increment_mdp_data_at(Address data, bool decrement = false);
> 216:   void increment_mdp_data_at(Register mdp_in, int constant,
> 217:                              bool decrement = false);

`decrement` is never used?

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

Marked as reviewed by kvn (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/25223#pullrequestreview-2840817142
PR Review Comment: https://git.openjdk.org/jdk/pull/25223#discussion_r2089316142


More information about the hotspot-compiler-dev mailing list