RFR: 8285246: AArch64: remove overflow check from InterpreterMacroAssembler::increment_mdp_data_at

Nick Gasson ngasson at openjdk.java.net
Fri Apr 22 15:19:16 UTC 2022


On Fri, 22 Apr 2022 14:55:28 GMT, Andrew Haley <aph at openjdk.org> wrote:

> 
> Firstly, perhaps adjust Intel to be the same. 

I can do, although i386 at least is doing the right thing and saturating at 32 bits (because it uses `addptr`) so maybe it's worth leaving. If we cared about the overflow on 64-bit platforms it would be easier to handle it in `ProfileData::uint_at()` by checking if any of the high bits are set.

> Also, IIRC Gil Tene has spoken about the risk of counter values going backwards if atomic increments aren't used, and he believed it was a real risk, so +1 to investigating that.

I think there are two potential benefits from using far atomics here: one is not losing updates, the other is better performance if two threads are concurrently updating the same counters.

> Finally, I have heard that on at least some large AArch64 implementations, LSE atomics can have very poor performance.

True, but we can use STADD, STSET, etc. as we don't need the updated value and so don't need to worry too much about the latency. (It looks like `profile_taken_branch()` needs to return the updated counter but it's not actually used if you look at the only call site in `TemplateTable::branch()`, that can be cleaned up later too.)

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

PR: https://git.openjdk.java.net/jdk/pull/8363


More information about the hotspot-compiler-dev mailing list