Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Gerd Stolpmann <info@gerd-stolpmann.de>
To: "Richard W.M. Jones" <rich@annexia.org>, caml-list@inria.fr
Subject: Re: [Caml-list] Initializing CAMLlocalX values to Val_unit
Date: Fri, 24 Feb 2017 14:50:54 +0100	[thread overview]
Message-ID: <1487944254.6296.63.camel@gerd-stolpmann.de> (raw)
In-Reply-To: <20170224103818.GI28111@annexia.org>

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

Am Freitag, den 24.02.2017, 10:38 +0000 schrieb Richard W.M. Jones:
> (2) We have lots of existing code which does:
> 
>   CAMLlocal1 (v);
>   // some code here which might allocate and call the GC
>   v = ...
> 
> It's my understanding that such code might crash with the older
> versions of OCaml, because when it calls the GC it will find a local
> root which is initialized to 0.  We want to continue to support the
> older versions (back to 3.12 in fact), so should we change it all to:
> 
>   CAMLlocal1 (v); v = Val_unit;
>   // some code here which might allocate and call the GC
>   v = ...
> 
> ?  Interestingly none of this code has actually crashed in production
> as far as I'm aware.

Because it is correct for older OCaml versions - which do not follow
pointers that are not allocated by OCaml. Note that this is still the
default, but you can now change it with the -no-naked-pointers
configure switch, in which case such pointers lead to a crash when they
are run into by the GC (well, I'm not sure about a null pointers,
though). The -no-naked-pointers switch accelerates in particular
assignments (caml_darken called via caml_modify).

Gerd
-- 
------------------------------------------------------------
Gerd Stolpmann, Darmstadt, Germany    gerd@gerd-stolpmann.de
My OCaml site:          http://www.camlcity.org
Contact details:        http://www.camlcity.org/contact.html
Company homepage:       http://www.gerd-stolpmann.de
------------------------------------------------------------



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

      parent reply	other threads:[~2017-02-24 13:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-24 10:38 Richard W.M. Jones
2017-02-24 13:43 ` Arlen Cox
2017-02-24 13:58   ` Richard W.M. Jones
2017-02-24 13:50 ` Gerd Stolpmann [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=1487944254.6296.63.camel@gerd-stolpmann.de \
    --to=info@gerd-stolpmann.de \
    --cc=caml-list@inria.fr \
    --cc=rich@annexia.org \
    /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