RFR: 8267952: async logging supports to dynamically change tags and decorators [v2]
Xin Liu
xliu at openjdk.java.net
Thu Jun 10 19:16:01 UTC 2021
On Thu, 10 Jun 2021 12:59:03 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> Sorry I just realized what you are saying here. This is a LogDecorator type not a primitive type so the notion of atomic load/store doesn't make sense. The comments about it being a bitfield threw me.
>
> It is the load/store of `uint _decorators;` that needs to be atomic.
I can't overload copy constructor and assignment operator using Atomic because there are many places we don't need atomic operation at all. Of course, I can provide two member functions atomic_load/store for `LogDecorators`. TBH, I feel I am uglifying code. Actually I did it, the generated code is exactly same. that's why I am reluctant to use them.
Yes, the atomicity isn't provided by C++. It is provided by both c++ and underneath processors. As long as load/store are aligned and the ALU is 32-bit or wider, store like c42 is atomic.
0000000000000c40 <LogOutput::set_decorators(LogDecorators const&)>:
c40: 8b 06 mov (%rsi),%eax
c42: 89 47 20 mov %eax,0x20(%rdi)
c45: c3 retq
A RCU algorithm never be straightforward. That's why I try to write comments here. It's not me who introduce this code. I just try to explain how it works.
How about this? Could you submit this patch to the internal test infra and see if it can pass tier1~tier7? if it can't, we refactor this code.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4408
More information about the hotspot-runtime-dev
mailing list