Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Nuutti Kotivuori <naked+caml@naked.iki.fi>
To: Alain.Frisch@ens.fr
Cc: Caml list <caml-list@inria.fr>
Subject: Re: [Caml-list] Freeing dynamically loaded code
Date: Thu, 18 Dec 2003 01:16:59 +0200	[thread overview]
Message-ID: <87llpbrq50.fsf@naked.iki.fi> (raw)
In-Reply-To: <87oeuayduv.fsf@naked.iki.fi> (Nuutti Kotivuori's message of "Mon, 15 Dec 2003 05:11:20 +0200")

Nuutti Kotivuori wrote:

[...]

> Now I have no idea what GRAB and RESTART do, and what would be need
> to fix them. They look scary. On CLOSUREREC I have an idea what it's
> supposed to do, but I have no idea how the Infix headers really work
> there - and what we'd need to do to fix that.

Okay, I think I now know how GRAB and RESTART work, and they should be
doable. And I have a better idea how CLOSUREREC works as well - but
that seems to be nasty. Considering that it has several code pointers,
and none of those have a local environment but the whole closure only
has one - every one of those code pointers would have to point to
something like CALLRECDYN or something, and the environment of the
CLOSUREREC should have offsets for every subfunction and then the code
block address. CALLRECDYN would then have to find the correct offset
for the correct closure in the CLOSUREREC block, and call
that. Eww. But possibly doable.

Another thing which struck me. What about objects? All they have is a
virtual table as the first pointer, which carries loads of code
pointers that aren't embedded in a closure. And if we can't touch the
callers, calling any of those would have to still be compatible, so
where on earth could the actual offsets be stored then? Mucho
problems.


[...]

> How do we pass the knowledge where the start of the block is where
> this code resides, so it can place that pointer in the env and
> calculate the offset there as well?

One very hackish way to implement this would be to add a semi-global
variable to the interpreter, that has this pointer - then the calldyn
instruction could update it for the current block always, so any
closures created inside a calldyn'd instruction would have the right
pointer. Or something.

[...]

This is starting to get muddier and muddier - and not looking too
good. But I will continue thinking about the problems for now - if
something comes up that is really impossible to do, then we can just
drop this approach since it isn't going to work and move on to
something else.

-- Naked

-------------------
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-12-17 23:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-12 19:04 Nuutti Kotivuori
2003-12-12 19:36 ` Alain.Frisch
2003-12-12 20:05   ` Nuutti Kotivuori
2003-12-12 21:26     ` Alain.Frisch
2003-12-12 21:54       ` Nuutti Kotivuori
2003-12-13  7:25         ` Nuutti Kotivuori
2003-12-13  8:15           ` Alain.Frisch
2003-12-13 20:57             ` Nuutti Kotivuori
2003-12-17  7:17             ` Jacques Garrigue
2003-12-17 23:48               ` Nuutti Kotivuori
2003-12-13  2:04       ` skaller
2003-12-13  6:50         ` Nuutti Kotivuori
2003-12-15  3:11       ` Nuutti Kotivuori
2003-12-17 23:16         ` Nuutti Kotivuori [this message]
2003-12-15  9:35 ` Basile Starynkevitch
2003-12-15 11:34   ` Nuutti Kotivuori

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=87llpbrq50.fsf@naked.iki.fi \
    --to=naked+caml@naked.iki.fi \
    --cc=Alain.Frisch@ens.fr \
    --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