RFR: 8316959: Improve InlineCacheBuffer pending queue management [v2]

Thomas Schatzl tschatzl at openjdk.org
Mon Oct 9 08:39:27 UTC 2023


On Fri, 6 Oct 2023 19:45:26 GMT, Dean Long <dlong at openjdk.org> wrote:

>> Thomas Schatzl has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update src/hotspot/share/code/icBuffer.cpp
>>   
>>   Co-authored-by: Dean Long <17332032+dean-long at users.noreply.github.com>
>
> src/hotspot/share/code/icBuffer.cpp line 270:
> 
>> 268:   for (;;) {
>> 269:     icholder->set_next(old);
>> 270:     CompiledICHolder* cur = Atomic::cmpxchg(&_pending_released, old, icholder, memory_order_relaxed);
> 
> I think we need a release barrier between these two writes, and a corresponding acquire barrier on the read side.  Well, maybe not if and readers are at a safepoint, so all the writes will be visible.
> Also, how about adding an assert that icholder->next() == nullptr as the first line?

As you mention, all readers are at a safepoint (i.e. there is at least a safepoint with all its synchronization between this and the read) so I did not see a reason to make the `cmpxchg` more strict wrt to memory ordering. I can add this if you think this is easier to understand.

I will add an assert to check the next value so that it is only ever written once.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16059#discussion_r1350001450


More information about the hotspot-compiler-dev mailing list