Browse thread
Using OCaml's run-time from LLVM-generated native code
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Alain Frisch <alain@f...> |
| Subject: | Re: [Caml-list] Using OCaml's run-time from LLVM-generated native code |
Jon Harrop wrote:
> On Monday 04 February 2008 11:11:33 Alain Frisch wrote:
>> Jon Harrop wrote:
>>> Despite the availability of that code it seems that few people can use it
>>> correctly and I am one of them.
>> What part of memory.h do you fail to understand?
>
> That file doesn't even mention the stack walker AFAICT.
Nevertheless, the file contains all the info you need to produce GC-safe
C code. If you want efficient GC-safe code, you need to understand how
ocamlopt records information about stack frames. It is probably
impossible to do it with pure portable C code. For LLVM-generated code,
you should be able to use the GC infrastructure improved by Gordon.
> Perhaps this does:
>
> int apply(int n) {
> CAMLparam0();
> CAMLlocal2(nv, fibn);
> nv = copy_int64(n);
> fibn = fib(nv);
> caml_gc_full_major(0);
> CAMLreturn(Int64_val(fib(nv)));
> }
CAMLreturnT would be better.
-- Alain