RFR: 8267952: async logging supports to dynamically change tags and decorators [v2]
David Holmes
dholmes at openjdk.java.net
Fri Jun 11 05:38:53 UTC 2021
On Thu, 10 Jun 2021 19:18:00 GMT, Xin Liu <xliu at openjdk.org> wrote:
>> I have no idea why you mention volatile and jsr-133 here.
>>
>> If there is an Atomic::add inside there then okay the necessary barrier may be in place. But it is not at all apparent there is an Atomic operation inside there, so given the order is important the comment needs to explain why an explicit barrier is not needed.
>
> The following code uses `Atomic::add`. Actually, there's a hidden 3rd argument. it's a default parameter and I highlight it. It is the conservative memory order emits a full memory barrier. I double-check the implementations on x86/aarch64 and powerpc.
>
>
> jint LogOutputList::increase_readers() {
> jint result = Atomic::add(&_active_readers, 1, /*memory_order_conservative*/);
> assert(_active_readers > 0, "Ensure we have consistent state");
> return result;
> }
Thanks for adding the comment.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4408
More information about the hotspot-runtime-dev
mailing list