Using C++11+ in hotspot
Andrew Haley
aph at redhat.com
Mon Aug 6 08:16:13 UTC 2018
On 08/05/2018 04:30 PM, Martin Buchholz wrote:
> Here's one example of code that actually did go wrong with Google's latest
> internal toolchain, because the copy was not in fact word-atomic. Thanks
> to whoever added the comment long ago.
>
> static inline void copy_table(address* from, address* to, int size) {
> // Copy non-overlapping tables. The copy has to occur word wise for MT
> safety.
> while (size-- > 0) *to++ = *from++;
> }
>
> Recommendation: target C++11 for jdk12;
I don't think that helps. There's no legal way AFAICS to force an atomic
access to non-atomic types in C++11.
--
Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
More information about the workshop-discuss
mailing list