Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Markus Mottl <markus@oefai.at>
To: Christopher Quinn <cq@htec.demon.co.uk>
Cc: OCAML <caml-list@inria.fr>
Subject: Re: [Caml-list] GC and preventing data relocation
Date: Fri, 21 Mar 2003 13:03:02 +0100	[thread overview]
Message-ID: <20030321120302.GC23641@fichte.ai.univie.ac.at> (raw)
In-Reply-To: <3E7A67C6.5030302@htec.demon.co.uk>

On Fri, 21 Mar 2003, Christopher Quinn wrote:
> Markus Mottl wrote:
> >I don't quite understand this solution. How should this prevent the
> >string from being relocated if the string was allocated in the OCaml-heap?
> 
> it wouldn't, but at least the pointer to it is changed also. and the 
> assumption i made was that the glue code knows where it is keeping its 
> pointer to the string.

Well, the glue code can surely know, but unfortunately things are more
complicated, because the C-library can't:

  OCaml
    |
    +--> C-glue code
            |
            +--> C-library
                   |
           +-----> +--> C-glue code (via "callout" function pointer)
           |              |
           |              +--> OCaml (callback)
           |
      problem is here

Once the opaque C-library runs off with a given pointer to a string,
it may generate tons of internal datastructures that depend on this
specific location. There is just no way for me to tell the C-library
to continue elsewhere, because the C-library called me (the glue code)
before the OCaml-callback, not vice versa, and just expects me to return.

Well, I could ask the author of the C-library to add a feature that
adds offsets at each step to dependent pointers to accommodate for
relocations. But he'll probably rather kill me than rewrite 7 KLOCs of
low-level code... ;-)

> >And wouldn't be particulary portable...
> 
> what 3rd party modification to the distributed caml runtime is!?

Indeed...

Regards,
Markus Mottl

--
Markus Mottl                                             markus@oefai.at
Austrian Research Institute
for Artificial Intelligence                  http://www.oefai.at/~markus

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  reply	other threads:[~2003-03-21 12:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-20 15:16 Markus Mottl
2003-03-20 18:28 ` Christopher Quinn
2003-03-21  0:01   ` Markus Mottl
2003-03-21  1:15     ` Christopher Quinn
2003-03-21 12:03       ` Markus Mottl [this message]
2003-03-21 16:15 ` Damien Doligez
2003-03-21 16:35   ` Markus Mottl
2003-03-24  6:14     ` Nicolas Cannasse
2003-03-24  8:58       ` 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=20030321120302.GC23641@fichte.ai.univie.ac.at \
    --to=markus@oefai.at \
    --cc=caml-list@inria.fr \
    --cc=cq@htec.demon.co.uk \
    /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