caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* c/OCaml interface question... Bigarray
@ 2008-04-05 20:46 Andrew I. Schein
  2008-04-05 21:11 ` [Caml-list] " Gordon Henriksen
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew I. Schein @ 2008-04-05 20:46 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 310 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 407 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] c/OCaml interface question... Bigarray
  2008-04-05 20:46 c/OCaml interface question... Bigarray Andrew I. Schein
@ 2008-04-05 21:11 ` Gordon Henriksen
  0 siblings, 0 replies; 2+ messages in thread
From: Gordon Henriksen @ 2008-04-05 21:11 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-04-05 21:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-05 20:46 c/OCaml interface question... Bigarray Andrew I. Schein
2008-04-05 21:11 ` [Caml-list] " Gordon Henriksen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).