Hello.<br><br>Maybe &quot;Heap of heaps&quot; shoud be controlled by VM (god:)<br><br><div class="gmail_quote">2009/5/7 Igor Stasenko <span dir="ltr">&lt;<a href="mailto:siguctua@gmail.com">siguctua@gmail.com</a>&gt;</span><br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="h5">2009/5/7 Joshua Gargus &lt;<a href="mailto:schwa@fastmail.us">schwa@fastmail.us</a>&gt;:<br>


&gt; Igor Stasenko wrote:<br>
&gt;<br>
&gt; 2009/5/7 Joshua Gargus &lt;<a href="mailto:schwa@fastmail.us">schwa@fastmail.us</a>&gt;:<br>
&gt;<br>
&gt;<br>
&gt; Igor Stasenko wrote:<br>
&gt;<br>
&gt; 2009/5/7 Eliot Miranda &lt;<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>&gt;:<br>
&gt;<br>
&gt;<br>
&gt; On Tue, Apr 28, 2009 at 9:26 PM, Michael van der Gulik &lt;<a href="mailto:mikevdg@gmail.com">mikevdg@gmail.com</a>&gt;<br>
&gt; wrote:<br>
&gt;<br>
&gt;<br>
&gt; On 4/29/09, Andreas Raab &lt;<a href="mailto:andreas.raab@gmx.de">andreas.raab@gmx.de</a>&gt; wrote:<br>
&gt;<br>
&gt;<br>
&gt; Eliot Miranda wrote:<br>
&gt; Note that<br>
&gt; you could even run GC only from the scheduler (i.e., treat GC as an<br>
&gt; external signal that requests a GC from the scheduler) which solves the<br>
&gt; concurrent GC problem even with the current VM design.<br>
&gt;<br>
&gt;<br>
&gt; ...or even implement the GC in bytecodes. You could provide primitives<br>
&gt; which gives lower level access to the image - raw memory maybe, or<br>
&gt; perhaps objects indexed by oop.<br>
&gt;<br>
&gt; It would be a bit tricky managing the garbage the GC itself would<br>
&gt; generate. Maybe you could just leave it lying around, or maybe<br>
&gt; deallocate it manually? And it would be a bit slow.<br>
&gt;<br>
&gt;<br>
&gt; See Expert to Expert - Erik Meijer and Lars Bak: Inside V8.  Lars Bak thinks<br>
&gt; this is a bad idea, and I agree with him :)<br>
&gt;<br>
&gt;<br>
&gt; Then make GC which can&#39;t generate the garbage. Or, in other words, it<br>
&gt; should consume a predictable preallocated limited amount of memory to<br>
&gt; do garbage collection. Since most of GC working in that way, i don&#39;t<br>
&gt; see how a bytecode (or better to say - the &#39;in-language&#39;) GC<br>
&gt; implementation could be different. Of course you need to allow a<br>
&gt; direct memory access, and need to be careful with code/objects<br>
&gt; relocations which is used by GC itself during running GC, and of<br>
&gt; course it would be better to run it in native code - for speed reasons<br>
&gt; :)<br>
&gt; This is not something , which is impossible to do.<br>
&gt;<br>
&gt;<br>
&gt; It would be easier to use Hydra instead of jumping though hoops to run the<br>
&gt; GC code from the same object-memory that you&#39;re GCing.  And, the effort put<br>
&gt; into making Hydra support this would actually be useful, instead of doing<br>
&gt; something extra-complicated just to show that you can ;-)<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Heh, no this couldn&#39;t help. Who will sweep the garbage in object<br>
&gt; memory which used to collect garbage in another object memory? 3rd<br>
&gt; one? :)<br>
&gt;<br>
&gt;<br>
&gt; Sure, why not?   &quot;It&#39;s turtles all the way down&quot;, and to hell with the<br>
&gt; finite hardware!<br>
&gt;<br>
&gt; Of course you don&#39;t need an infinite chain of images.  An image could<br>
&gt; publish a list of services that it provides, one of them being<br>
&gt; garbage-collection.  When an image requires garbage collection, it can send<br>
&gt; a request to one of the images that publish that service.  Or more simply,<br>
&gt; just have 2 GC images that take care of each other&#39;s needs (in a massively<br>
&gt; multicore scenario, you&#39;d want more than one image performing GCs anyway).<br>
&gt;<br>
<br>
</div></div>Consider we&#39;re talking about self-sustaining system. In this case, you<br>
have a number of heaps where one of them having permission to access<br>
other(s). But in this scenario you will need to have a &#39;heap of heaps&#39;<br>
then, to rule them out. And who will control that &#39;heap of heaps&#39;<br>
then? Chicken &amp; egg problem :)<br>
<div class="im"><br>
&gt; I think that to make an &#39;in-language&#39; GC possible, it should use an<br>
&gt; object/classes mirrors, which providing methods required by GC in<br>
&gt; functional style i.e.:<br>
&gt; to visit all refs of a single oop, GC would call following method:<br>
&gt; oop mirror iterateReferencesFor: oop iterationCallback: closure.<br>
&gt; instead of:<br>
&gt; oop allReferences do: [:each| GC mark: each ].<br>
&gt;<br>
&gt;<br>
&gt; Pretty!  The point, I gather, is that you would avoid generating garbage<br>
&gt; during the iteration?<br>
&gt;<br>
</div>Yup.<br>
<div class="im"><br>
&gt; i started prototyping these things in Moebius. Currently i&#39;m using<br>
&gt; them to bootstrap an object memory. I could instantiate such mirrors<br>
&gt; in Squeak and then using them to fill the oops in newly created object<br>
&gt; memory. It is possible because a functional/declarative code behavior<br>
&gt; is invariant in any environment.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; (BTW, are you still working on Hydra much?  Waiting for Cog?)<br>
&gt;<br>
&gt;<br>
&gt; I&#39;d prefer help finishing Cog first, then we could get back to Hydra sooner<br>
&gt; :)<br>
&gt;<br>
&gt;<br>
&gt; :-)  Hopefully Eliot&#39;s &quot;Stack VM&quot; will be released soon; it should be a good<br>
&gt; point to merge the Hydra changes before &quot;Cog&quot; makes it out.<br>
&gt;<br>
&gt; Mainly, what i don&#39;t like in Squeak VM building process is the<br>
&gt; involvement of C compiler.<br>
&gt; I keep advocating the idea that by having a native code generator, we<br>
&gt; don&#39;t need the C compiler anymore.<br>
&gt;<br>
&gt;<br>
&gt; That would be swell.  Eliot met Slava Pestov at PyCon, and was quite<br>
&gt; impressed by the code-generator in Factor<br>
&gt; (<a href="http://www.mirandabanda.org/cogblog/2008/06/06/cog/#comment-4027" target="_blank">http://www.mirandabanda.org/cogblog/2008/06/06/cog/#comment-4027</a>).<br>
&gt;<br>
</div>thanks for pointer. i&#39;ll read about it now.<br>
<div class="im"><br>
&gt; Cheers,<br>
&gt; Josh<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Cheers,<br>
&gt; Josh<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Gulik.<br>
&gt;<br>
&gt; --<br>
&gt; <a href="http://gulik.pbwiki.com/" target="_blank">http://gulik.pbwiki.com/</a><br>
&gt;<br>
<br>
<br>
<br>
</div><div><div></div><div class="h5">--<br>
Best regards,<br>
Igor Stasenko AKA sig.<br>
<br>
</div></div></blockquote></div><br>