From: Nuutti Kotivuori <naked+caml@naked.iki.fi>
To: Jacques Garrigue <garrigue@kurims.kyoto-u.ac.jp>
Cc: Alain.Frisch@ens.fr, caml-list@inria.fr
Subject: Re: [Caml-list] Freeing dynamically loaded code
Date: Thu, 18 Dec 2003 01:48:32 +0200 [thread overview]
Message-ID: <87hdzzroof.fsf@naked.iki.fi> (raw)
In-Reply-To: <20031217161733O.garrigue@kurims.kyoto-u.ac.jp> (Jacques Garrigue's message of "Wed, 17 Dec 2003 16:17:33 +0900")
Jacques Garrigue wrote:
> The variable doesn't need to point directly to the code block: it
> can point to a finalized stub. The code is still statically
> allocated, but when the stub is garbage collected the code is freed.
>
> So this should work.
> But I'm not candidate to try it :-)
Hmmmmmmmm...
So then the pointers wouldn't ever get invalid since the block is
statically allocated. And if every closure referenced the finalized
block, when the last reference goes, the block would get freed.
Then the block wouldn't be in the normal heap compaction at all - but
it would be handled as malloc handles these things. And since it's not
like we are mallocing for every local variable, but just for loading
new code files, malloc will do a rather good job at it as well.
Rather nice. Rather nice indeed.
So then, while the code is running - I would expect the current env
will always have to be traversed by the GC - and while executing
subfunctions, the old env is probably on the stack, so that's handled
as well.
Hmm. If it all works, then the only thing to ensure is that every
closure has the abstract block referenced. Grab and restart are
irrelevant, since the closures they create reference the original
closure - and the code pointers will stay valid. Closurerec can have
the pointer in the local environment as well. That leaves us with
objects, which would have to have the pointer in their member
variables as well - and that shouldn't be a problem either.
So yes, can't find a damn thing wrong with that proposal. Now the
problem is just to get the variables there, either by mangling
bytecode, or the interpreter.
Thanks for the suggestion, I'll look into it!
-- 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
next prev parent reply other threads:[~2003-12-17 23:48 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 [this message]
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
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=87hdzzroof.fsf@naked.iki.fi \
--to=naked+caml@naked.iki.fi \
--cc=Alain.Frisch@ens.fr \
--cc=caml-list@inria.fr \
--cc=garrigue@kurims.kyoto-u.ac.jp \
/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