On 6/08/2018 6:16 PM, Andrew Haley wrote:
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.
I would agree. We implicitly rely on compilers doing the obvious/natural thing as long as the variables are suitable aligned. We're outside the language here with regards to "atomic access".** David
participants (1)
-
David Holmes