caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Markus Mottl" <markus.mottl@gmail.com>
To: "Xavier Leroy" <Xavier.Leroy@inria.fr>
Cc: ocaml <caml-list@inria.fr>, ocaml-users@janestcapital.com
Subject: Re: [Caml-list] Global roots causing performance problems
Date: Fri, 7 Mar 2008 12:05:35 -0500	[thread overview]
Message-ID: <f8560b80803070905q385b3eb6o7da6b0b41c5e082d@mail.gmail.com> (raw)
In-Reply-To: <47D14CBD.4060207@inria.fr>

On Fri, Mar 7, 2008 at 9:10 AM, Xavier Leroy <Xavier.Leroy@inria.fr> wrote:
>  1- Change the specs of caml_register_global_root() to prohibit
>  in-place updates to the value contained in the registered value
>  pointer.  If programmers need to do this, they must un-register the
>  value pointer, update its contents, then re-register it.
>  How much existing code would that break?  I don't know.

I have just looked at a fairly large number of bindings.  Only a few
actually register global roots, and those that do would be perfectly
safe - with the exception of LablGTK it seems.  I'm a bit wary of
changing the semantics of global root registration in a way that could
seriously break existing libraries even though almost all of them seem
fine.

>  2- Keep the current API for backward compatibility and add a
>  caml_register_global_immutable_root() function that would implement
>  generational scanning of global roots, in exchange for the
>  programmer's guarantee that the values contained in those roots are
>  never changed.  Then, convince authors of Caml-C bindings to use the
>  new API.

After having given it some thought, I think I prefer this approach.
As a maintainer of some C-bindings that would be affected by this
change, I'd be perfectly happy to upgrade them, which seems like
extremely little work.

I also second Berke Durak's proposal to add some kind of modification
macro/function.  Concerning the naming we should maybe avoid the name
"immutable" then, because one can obviously update the value, but has
to do so explicitly.  How about "caml_(un)register_generational_root"
and "caml_modify_generational_root"?

> I'm willing to implement any of these 2 approaches, but it is not a
> transparent change in either case.

Thanks a lot, this would be great!

Best regards,
Markus

-- 
Markus Mottl        http://www.ocaml.info        markus.mottl@gmail.com


      parent reply	other threads:[~2008-03-07 17:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-06 23:51 Markus Mottl
2008-03-07 14:10 ` [Caml-list] " Xavier Leroy
2008-03-07 14:52   ` Berke Durak
2008-03-07 16:45   ` Richard Jones
2008-03-07 17:05   ` Markus Mottl [this message]

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=f8560b80803070905q385b3eb6o7da6b0b41c5e082d@mail.gmail.com \
    --to=markus.mottl@gmail.com \
    --cc=Xavier.Leroy@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=ocaml-users@janestcapital.com \
    /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).