caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Hendrik Tews <tews@tcs.inf.tu-dresden.de>
To: caml-list@inria.fr
Subject: two questions for keeping harmony (with the garbage collector)
Date: Sat, 13 May 2006 00:59:11 +0200	[thread overview]
Message-ID: <17509.4927.287237.266015@ithif59.inf.tu-dresden.de> (raw)

Dear all,

could somebody knowledgeable please comment on the following two
points?

1. About rule 1: CAMLparam / CAMLreturn can be ommitted in the
   following cases:

   a) there is no value in the function that is a pointer to a
      block inside the heap.

   b) no allocation will take place between the start and the end
      of the function. (Really? Even in the presence of threads?)


2. I believe rule 2 (register with CAMLlocal) must be extended to
   intermediate values. Consider for instance

      value f(...);
      value g(...);

      ...
      h(f(...), g(...));

   Assuming right to left evaluation, this will break if the
   garbage collector is called inside f, because the value
   returned by g is not registered as a root.

   However, the following is save:

      h2(g(...))

   because h2 will register the value before any allocation can
   happen.

Bye,

Hendrik


             reply	other threads:[~2006-05-12 22:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-12 22:59 Hendrik Tews [this message]
2006-05-12 23:47 ` [Caml-list] " Markus Mottl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=17509.4927.287237.266015@ithif59.inf.tu-dresden.de \
    --to=tews@tcs.inf.tu-dresden.de \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).