Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Alain Frisch <alain@frisch.fr>
To: "Milan Stanojević" <milanst@gmail.com>
Cc: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] empty mli for executable
Date: Thu, 03 Oct 2013 22:52:41 +0200	[thread overview]
Message-ID: <524DD919.7070604@frisch.fr> (raw)
In-Reply-To: <CAKR7PS9SBXJUak76btS63C8Avk5yWo=8ZnrNfdv2-XLmU8zbdg@mail.gmail.com>

On 10/3/2013 8:42 PM, Milan Stanojević wrote:
> Thanks, Alain.
> Just one question about this. Let's say I have a toplevel value in my
> executable and an empty mli. How is this toplevel value then retained?
> Is it part of some other root set ?

Well, actually, after double-checking, it appears that in native code, 
the non-exported values are still stored in the global record 
corresponding to the unit.  See this comment in translmod.ml:

    Identifiers that are not exported are assigned positions at the
    end of the block (beyond the positions of all exported idents).


This is just one possible compilation strategy, designed to reduce 
pressure on registers (and it invalidates my explanation).  Another one 
would be to simply consider those value as local variables (in 
registers, maybe spilled to the stack).

The current strategy has the effect that a non-exported toplevel value 
is never reclaimed by the GC, even if it is no longer accessible (this 
is not the case in bytecode).


Alain

      reply	other threads:[~2013-10-03 20:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-03 16:50 Milan Stanojević
2013-10-03 17:45 ` Alain Frisch
2013-10-03 18:42   ` Milan Stanojević
2013-10-03 20:52     ` Alain Frisch [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=524DD919.7070604@frisch.fr \
    --to=alain@frisch.fr \
    --cc=caml-list@inria.fr \
    --cc=milanst@gmail.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