<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/12/f6e4f3915780cad48789ef64a0624577"
  from="Nuutti Kotivuori &lt;naked+caml@n...&gt;"
  author="Nuutti Kotivuori"
  date="2003-12-17T23:48:37"
  subject="Re: [Caml-list] Freeing dynamically loaded code"
  prev="2003/12/ea2a721b6ed22c6404d67bc1566cc56e"
  next="2003/12/052649193f7443e5fad49ddd9dbe05f7"
  prev-in-thread="2003/12/e8b6acc35d8fa6020be206659a0b8e6f"
  next-in-thread="2003/12/294e6e26a75ec5a94aec065cd022d938"
  prev-thread="2003/12/d1e1de7970b7af2882a64e70200b90ab"
  next-thread="2003/12/68276101f2bc192b44f47bce0bf1c103"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Freeing dynamically loaded code">
<msg 
  url="2003/12/c8b08257908c25043521e0a3fe5eaa77"
  from="Nuutti Kotivuori &lt;naked+caml@n...&gt;"
  author="Nuutti Kotivuori"
  date="2003-12-12T19:04:32"
  subject="[Caml-list] Freeing dynamically loaded code">
<msg 
  url="2003/12/0c7decba295f699bda078d6318fb9445"
  from="Alain.Frisch@e..."
  author="Alain.Frisch@e..."
  date="2003-12-12T19:36:48"
  subject="Re: [Caml-list] Freeing dynamically loaded code">
<msg 
  url="2003/12/93987d0010b1b77d46ffdd8b42e9ddb6"
  from="Nuutti Kotivuori &lt;naked+caml@n...&gt;"
  author="Nuutti Kotivuori"
  date="2003-12-12T20:05:51"
  subject="Re: [Caml-list] Freeing dynamically loaded code">
<msg 
  url="2003/12/0b0cbd59b0fdc2fb5469101f41b02c0d"
  from="Alain.Frisch@e..."
  author="Alain.Frisch@e..."
  date="2003-12-12T21:26:50"
  subject="Re: [Caml-list] Freeing dynamically loaded code">
<msg 
  url="2003/12/ccc55211ed05144411fb273907604dfc"
  from="Nuutti Kotivuori &lt;naked+caml@n...&gt;"
  author="Nuutti Kotivuori"
  date="2003-12-12T21:55:00"
  subject="Re: [Caml-list] Freeing dynamically loaded code">
<msg 
  url="2003/12/de2a57cea59abdba26c046de1d0a57d0"
  from="Nuutti Kotivuori &lt;naked+caml@n...&gt;"
  author="Nuutti Kotivuori"
  date="2003-12-13T07:25:41"
  subject="Re: [Caml-list] Freeing dynamically loaded code">
<msg 
  url="2003/12/89f22e8743e7c03c963e920443aafb34"
  from="Alain.Frisch@e..."
  author="Alain.Frisch@e..."
  date="2003-12-13T08:15:58"
  subject="Re: [Caml-list] Freeing dynamically loaded code">
<msg 
  url="2003/12/17b689cbb8f6dc1d21d31abd0ae53371"
  from="Nuutti Kotivuori &lt;naked+caml@n...&gt;"
  author="Nuutti Kotivuori"
  date="2003-12-13T20:57:35"
  subject="Re: [Caml-list] Freeing dynamically loaded code">
</msg>
<msg 
  url="2003/12/e8b6acc35d8fa6020be206659a0b8e6f"
  from="Jacques Garrigue &lt;garrigue@k...&gt;"
  author="Jacques Garrigue"
  date="2003-12-17T07:17:47"
  subject="Re: [Caml-list] Freeing dynamically loaded code">
<msg 
  url="2003/12/f6e4f3915780cad48789ef64a0624577"
  from="Nuutti Kotivuori &lt;naked+caml@n...&gt;"
  author="Nuutti Kotivuori"
  date="2003-12-17T23:48:37"
  subject="Re: [Caml-list] Freeing dynamically loaded code">
</msg>
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2003/12/294e6e26a75ec5a94aec065cd022d938"
  from="skaller &lt;skaller@o...&gt;"
  author="skaller"
  date="2003-12-13T03:05:14"
  subject="Re: [Caml-list] Freeing dynamically loaded code">
<msg 
  url="2003/12/be509fa3a919a5e8efb6a28c92bb384e"
  from="Nuutti Kotivuori &lt;naked+caml@n...&gt;"
  author="Nuutti Kotivuori"
  date="2003-12-13T06:50:24"
  subject="Re: [Caml-list] Freeing dynamically loaded code">
</msg>
</msg>
<msg 
  url="2003/12/2d9430335faaca17eba81d2c109937ca"
  from="Nuutti Kotivuori &lt;naked+caml@n...&gt;"
  author="Nuutti Kotivuori"
  date="2003-12-15T03:11:26"
  subject="Re: [Caml-list] Freeing dynamically loaded code">
<msg 
  url="2003/12/ea2a721b6ed22c6404d67bc1566cc56e"
  from="Nuutti Kotivuori &lt;naked+caml@n...&gt;"
  author="Nuutti Kotivuori"
  date="2003-12-17T23:17:03"
  subject="Re: [Caml-list] Freeing dynamically loaded code">
</msg>
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2003/12/d48b5541e82f7a6160b744399b9e7b12"
  from="Basile Starynkevitch &lt;basile.starynkevitch@i...&gt;"
  author="Basile Starynkevitch"
  date="2003-12-15T09:35:21"
  subject="Re: [Caml-list] Freeing dynamically loaded code">
<msg 
  url="2003/12/d1b02bef80190b6a892c1eb4d2c74bff"
  from="Nuutti Kotivuori &lt;naked+caml@n...&gt;"
  author="Nuutti Kotivuori"
  date="2003-12-15T11:34:52"
  subject="Re: [Caml-list] Freeing dynamically loaded code">
</msg>
</msg>
</msg>
</thread>

<contents>
Jacques Garrigue wrote:
&gt; The variable doesn't need to point directly to the code block: it
&gt; can point to a finalized stub. The code is still statically
&gt; allocated, but when the stub is garbage collected the code is freed.
&gt;
&gt; So this should work.
&gt; 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

</contents>

</message>

