I guess I should find the time to finish the CAS primop work I volunteered to do then. Ill look into in a few days. <span></span><br><br>On Friday, July 19, 2013, Simon Marlow  wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 18/07/13 14:17, Ryan Newton wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The &quot;atomic-primops&quot; library depends on symbols such as<br>
store_load_barrier and &quot;cas&quot;, which are defined in SMP.h.  Thus the<br>
result is that if the program is linked WITHOUT &quot;-threaded&quot;, the user<br>
gets a linker error about undefined symbols.<br>
<br>
The specific place it&#39;s used is in the &#39;foreign &quot;C&quot;&#39; bits of this .cmm code:<br>
<br>
<a href="https://github.com/rrnewton/haskell-lockfree-queue/blob/87e63b21b2a6c375e93c30b98c28c1d04f88781c/AtomicPrimops/cbits/primops.cmm" target="_blank">https://github.com/rrnewton/<u></u>haskell-lockfree-queue/blob/<u></u>87e63b21b2a6c375e93c30b98c28c1<u></u>d04f88781c/AtomicPrimops/<u></u>cbits/primops.cmm</a><br>

<br>
I&#39;m trying to explore hacks that will enable me to pull in those<br>
functions during compile time, without duplicating a whole bunch of code<br>
from the RTS.  But it&#39;s a fragile business.<br>
<br>
It seems to me that some of these routines have general utility.  In<br>
future versions of GHC, could we consider linking in those routines<br>
irrespective of &quot;-threaded&quot;?<br>
</blockquote>
<br>
We should make the non-THREADED versions EXTERN_INLINE too, so that there will be (empty) functions to call in rts/Inlines.c.  Want to submit a patch?<br>
<br>
A better solution would be to make them into primops.  You don&#39;t really want to be calling out to a C function to implement a memory barrier. We have this for write_barrier(), but none of the others so far.  Of couse that&#39;s a larger change.<br>

<br>
Cheers,<br>
        Simon<br>
<br>
<br>
<br>
______________________________<u></u>_________________<br>
ghc-devs mailing list<br>
<a>ghc-devs@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/ghc-devs" target="_blank">http://www.haskell.org/<u></u>mailman/listinfo/ghc-devs</a><br>
</blockquote>