<html><body bgcolor="#FFFFFF"><div>The real address in already loaded to a temp var, so mo worries there.<br><br>Sent from my iPhone</div><div><br>On Jan 6, 2010, at 11:28 PM, Kevin Bealer &lt;<a href="mailto:kevinbealer@gmail.com">kevinbealer@gmail.com</a>&gt; wrote:<br><br></div><div></div><blockquote type="cite"><div>On Wed, Jan 6, 2010 at 3:09 PM, Sean Kelly <span dir="ltr">&lt;<a href="mailto:kelly.sean@apple.com"><a href="mailto:kelly.sean@apple.com">kelly.sean@apple.com</a></a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On Jan 6, 2010, at 11:52 AM, Sean Kelly wrote:<br>
&gt;<br>
&gt; In cases 1 and 2, all we really need to worry about is the assignment to x. &nbsp;On recent x86 we should be able to use 8 byte CAS to do it in one shot, but on other architectures the algorithm seems more complicated. &nbsp;I'd need to poke around to see if there's a published algorithm for updating two values together, but here's a shot at it that uses a special value assigned to the array pointer as a sentinel<br>

<br>
</div>I just thought of a better approach. &nbsp;Simply set the '1' bit of the pointer to indicate that an update is taking place, since it really will never be set under normal circumstances.<br>
<div><div></div><div class="h5">_______________________________________________<br>
dmd-concurrency mailing list<br>
<a href="mailto:dmd-concurrency@puremagic.com"><a href="mailto:dmd-concurrency@puremagic.com">dmd-concurrency@puremagic.com</a></a><br>
<a href="http://lists.puremagic.com/mailman/listinfo/dmd-concurrency" target="_blank"><a href="http://lists.puremagic.com/mailman/listinfo/dmd-concurrency">http://lists.puremagic.com/mailman/listinfo/dmd-concurrency</a></a><br>
</div></div></blockquote></div><br>But be sure to tell the GC that pointers can now look like (ptr % 4 == 1) as well as (ptr % 4 == 0).&nbsp; Otherwise a conservative GC might toss your object.<br><br>Kevin<br><br>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>dmd-concurrency mailing list</span><br><span><a href="mailto:dmd-concurrency@puremagic.com">dmd-concurrency@puremagic.com</a></span><br><span><a href="http://lists.puremagic.com/mailman/listinfo/dmd-concurrency">http://lists.puremagic.com/mailman/listinfo/dmd-concurrency</a></span></div></blockquote></body></html>