Atomic
David Holmes
david.holmes at oracle.com
Tue Mar 21 01:23:28 UTC 2023
On 21/03/2023 1:42 am, Justin King wrote:
> While messing around with seeing if ThreadSanitizer would be useful in
> Hotspot, I rewrote runtime/atomic.hpp using compiler intrinsics
> (__atomic_* on GCC/Clang/XLC, interlocked for MSVC) instead of inline
> assembly.
I assume you mean the platform specific atomic*.hpp files?
Inline assembly doesn't get instrumented very well and the
> compiler cannot optimize it very well. Is there any want for replacing
> the inline assembly with compiler intrinsics, regardless of
> ThreadSanitizer? They also have intrinsics that can be used to build
> optimized implementations of parallel bit set manipulation as well.
Sorry but this just seems like churn to me. First we have to go through
the process of establishing the equivalence of the compiler intrinsics
with the assembly code. Then make all the changes. Then deal with the
potential that some os_cpu code might be compiled by multiple compilers.
Then we have to deal with the possibility that the compilers might
change behaviour or introduce bugs across releases (yeah these low-level
things _should_ be stable but ...).
What would we gain by doing any of this?
IMO the ideal place we would like to get to is use of C++ atomic
operations, but I wouldn't want to go there via use of compiler
intrinsics. And I don't know what challenges we would face trying to use
C++ atomic ops.
Cheers,
David
> --
>
> Google Logo
> Justin King
> Software Engineer
> jcking at google.com <mailto:jcking at google.com>
>
>
>
More information about the hotspot-runtime-dev
mailing list