<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On 2009-11-22, at 12:32, Benedikt Grundmann wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Browsing<br><br><a href="http://llvm.org/releases/2.5/docs/GarbageCollection.html#ocaml">http://llvm.org/releases/2.5/docs/GarbageCollection.html#ocaml</a><br><br>I stumbled across the sentence<br><br>"...The ocaml collector does not use read or write barriers, so the<br>user program may use load and store instead of llvm.gcread and<br>llvm.gcwrite..."<br><br>Which I believe is wrong as the ocaml collector does indeed use a<br>write barrier (caml_modify).  But maybe I misunderstood?</div></blockquote></div><div><br></div><div>This is intended to be a very limited statement. The 'ocaml'-style GC codegen supported by LLVM does not in isolation require the use of the llvm.gcwrite intrinsic. It can be (and is) used with runtimes other than ocaml's, and such a system might not need the write barrier.</div><div><br></div><div>Hope that helps,</div><div><div>Gordon</div><div><br></div><div><br></div><div>P.S. If you're actually interested in using this component in conjunction with ocaml, there are some challenges to overcome.</div><div><br></div><div>1. ocaml uses its own calling convention. Support for it would need to be added to LLVM.</div><div><br></div><div>2. ocaml places exported symbols interior to objects:</div><div><br></div></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><span class="Apple-tab-span" style="white-space: pre; "><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;">    </span></font></span><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;">.word <header for sym></span></font><br><span class="Apple-style-span" style="font-family: 'Courier New'; font-size: 12px; ">sym:</span><br><span class="Apple-tab-span" style="white-space: pre; "><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;">       </span></font></span><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;"><value of sym></span></font><br><span class="Apple-tab-span" style="white-space: pre; "><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;"> </span></font></span><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;">.word <header for sym2></span></font><br><span class="Apple-style-span" style="font-family: 'Courier New'; font-size: 12px; ">sym2:</span><br><span class="Apple-style-span" style="font-family: 'Courier New'; font-size: 12px; white-space: pre; "> <value of sym2></span></blockquote><div><div><br></div><div>LLVM cannot emit this code. The ocaml compiler needs to be modified to emit/expect code like this instead:</div><div><br></div></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><span class="Apple-style-span" style="font-family: 'Courier New'; font-size: 12px; ">sym:</span><br><span class="Apple-tab-span" style="white-space: pre; "><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px; ">  </span></font></span><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px; ">.word <header for sym></span></font><br><span class="Apple-tab-span" style="white-space: pre; "><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px; ">       </span></font></span><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px; "><value of sym></span></font><br><span class="Apple-style-span" style="font-family: 'Courier New'; font-size: 12px; ">sym2:</span><br><span class="Apple-tab-span" style="white-space: pre; "><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px; ">    </span></font></span><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px; ">.word <header for sym2></span></font><br><span class="Apple-style-span" style="font-family: 'Courier New'; font-size: 12px; white-space: pre; ">   <value of sym2></span></blockquote><div><div><div><br></div></div><div>References would need to look for sym+(word size) instead of sym. This is surprisingly trivial, but my patch is likely stale, and the ocaml developers were not interested in it when it was not.</div><div></div></div></body></html>