Re: Truly lock-free multi-processor card marking

Florian Weimer <[email protected]> Tue, 03 Jul 2007 22:27:31 +0200
Newsgroups gmane.comp.programming.garbage-collection.general
Message-ID <[email protected]>
* Hans Boehm:

> Now if your question is whether a C or C++ compiler is guaranteed to
> leave your byte assignment alone, or whether it may choose to compile to
> code that overwrites adjacent bytes, the current answer is that it can
> do all sorts of nasty things and remain standard conforming.  But it
> probably won't.

Today's compilers perform this kind of optimization, but only if they
can infer pointer alignment.  This seems unlikely in this case because
you probably want to shift away all alignment (and then some), and the
compiler cannot statically infer which parts of the word needs to be
updated as a result.

However, if you need byte-wise updates for correctness, you really
should use machine code insertions to make sure you get them.