Using C++11+ in hotspot
Martin Buchholz
martinrb at google.com
Thu Aug 9 02:24:15 UTC 2018
On Mon, Aug 6, 2018 at 11:12 AM, John Rose <john.r.rose at oracle.com> wrote:
> On Aug 5, 2018, at 8:30 AM, Martin Buchholz <martinrb at google.com> wrote:
>
>
> 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++;
> }
>
> Today, that loop should be recoded to use copy, and copy in turn needs to
> do whatever magic is required to force word-atomic access on non-atomic
> data.
>
I now see the many variants of copy in share/utilities/copy.hpp but there
is none that makes copies of the type "address".
Maybe you could make an atomic copy template that takes any type T with
sizeof(T) <= 8 ?
---
At the type system level, HeapWord is a struct, so C++ will not be happy
with our other traditional trick of reading a pointer to a volatile
HeapWord to "force" atomicity.
More information about the workshop-discuss
mailing list