Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Caml-list] c/OCaml interface question... Bigarray

3 views
Skip to first unread message

Andrew I. Schein

unread,
Apr 5, 2008, 4:46:58 PM4/5/08
to caml...@yquem.inria.fr
I have been looking at the Bigarray code to figure out how it works. I see
in the bigarray_get_N function inside bigarray_stubs.c, that there is no use
of macro CAMLParam* or CAMLReturn. How is it that these macros are
unnecessary in this code?

Thanks,

Andy

--
Andrew I. Schein
web: www.andrewschein.com

Gordon Henriksen

unread,
Apr 5, 2008, 5:11:58 PM4/5/08
to caml...@yquem.inria.fr
On 2008-04-05, at 16:46, Andrew I. Schein wrote:

> I have been looking at the Bigarray code to figure out how it
> works. I see in the bigarray_get_N function inside
> bigarray_stubs.c, that there is no use of macro CAMLParam* or
> CAMLReturn. How is it that these macros are unnecessary in this code?

These macros allow the garbage collector find and update pointers on
the stack. Without them, the GC might collect the referenced objects,
leaving dangling pointers in stack-local variables. The use of these
macros is unnecessary overhead if (1) the collector cannot be invoked
from the function (that is, no GC memory is allocated from it) or (2)
there are no object references kept in parameters or local variables.

— Gordon

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

0 new messages