Benedikt Grundmann
2009-Nov-22 17:32 UTC
[LLVMdev] question on the ocaml compatible collector
Browsing http://llvm.org/releases/2.5/docs/GarbageCollection.html#ocaml I stumbled across the sentence "...The ocaml collector does not use read or write barriers, so the user program may use load and store instead of llvm.gcread and llvm.gcwrite..." Which I believe is wrong as the ocaml collector does indeed use a write barrier (caml_modify). But maybe I misunderstood? Thanks, Benedikt Grundmann -- Calvin: I try to make everyone's day a little more surreal. (From Calvin & Hobbes)
Gordon Henriksen
2009-Dec-04 16:44 UTC
[LLVMdev] question on the ocaml compatible collector
On 2009-11-22, at 12:32, Benedikt Grundmann wrote:> Browsing > > http://llvm.org/releases/2.5/docs/GarbageCollection.html#ocaml > > I stumbled across the sentence > > "...The ocaml collector does not use read or write barriers, so the > user program may use load and store instead of llvm.gcread and > llvm.gcwrite..." > > Which I believe is wrong as the ocaml collector does indeed use a > write barrier (caml_modify). But maybe I misunderstood?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. Hope that helps, Gordon P.S. If you're actually interested in using this component in conjunction with ocaml, there are some challenges to overcome. 1. ocaml uses its own calling convention. Support for it would need to be added to LLVM. 2. ocaml places exported symbols interior to objects: .word <header for sym> sym: <value of sym> .word <header for sym2> sym2: <value of sym2> LLVM cannot emit this code. The ocaml compiler needs to be modified to emit/expect code like this instead: sym: .word <header for sym> <value of sym> sym2: .word <header for sym2> <value of sym2> 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. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091204/3a6460ec/attachment.html>