Hi Francois,<br><br><div class="gmail_quote">On Mon, Feb 7, 2011 at 12:12 AM, Francois Stephany <span dir="ltr">&lt;<a href="mailto:tulipe.moutarde@gmail.com">tulipe.moutarde@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi Eliot,<br>
<br>
Probably a stupid question but what&#39;s the difference between SimpleStackBasedCogit and StackToRegisterMappingCogit ?</blockquote><div><br></div><div>See the following thread:</div><div><br></div><div><a href="http://lists.squeakfoundation.org/pipermail/squeak-dev/2010-November/155269.html">http://lists.squeakfoundation.org/pipermail/squeak-dev/2010-November/155269.html</a></div>
<div><a href="http://lists.squeakfoundation.org/pipermail/squeak-dev/2011-January/156356.html">http://lists.squeakfoundation.org/pipermail/squeak-dev/2011-January/156356.html</a></div><div><br></div><div>Here&#39;s a summary:</div>
<div><br></div><div>The SimpleStackBasedCogit is a one-to-one translation of bytecodes to machine code so tat every push or pop in the bytecode results in a corresponding push or pop in the generted code.  This results in a machine that passes all parameters on the stack and reifies all comparison results as either true or false.</div>
<div><br></div><div>The StackToRegisterMappingCogit defers generating code until it reaches a bytecode that consumes operands on the stack (i.e. a send, a temp or inst var store, a return, a closure creation or an Array creation ( {...} )).  This results in a machine that is able to pass parameters in registers for small arity sends (currently 0 or 1 arg), and able to inline some integer arithmetic and comparison, e.g. that involved in inlined to:do: loops, and can do some constant folding (hint: write 2 + 3 + 4 + i, not i + 2 + 3 + 4).</div>
<div><br></div><div>There are two main benefits.  The StackToRegisterMappingCogit produces machine code that is about 20% more compact than the SimpleStackBasedCogit (hence meaning less frequent code zone reclamations and better cache performance) and considerably faster for microbenchmarks, for example the empty 1 to: 100000000 do: [:i|] (equivalent to i := 1. [i &lt;= 100000000] whileTrue: [i := i + 1]) is 4 times faster than the SimpleStackBasedCogit.  </div>
<div><br></div><div>At a macro level StackToRegisterMappingCogit speeds up code such as compiling a method by about 10%, with low-level arithmetic-intensive code showing greater speedups.</div><div><br></div><div>best,</div>
<div>Eliot</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div></div><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
     new Cog VMs are available, SimpleStackBasedCogit @<br>
<a href="http://www.mirandabanda.org/files/Cog/VM/VM.r2359/" target="_blank">http://www.mirandabanda.org/files/Cog/VM/VM.r2359/</a> and<br>
StackToRegisterMappingCogit @<br>
<a href="http://www.mirandabanda.org/files/Cog/VM/VM.r2361" target="_blank">http://www.mirandabanda.org/files/Cog/VM/VM.r2361</a>.  I think the new code<br>
generator is ready for prime time now.  I fixed a number of bugs over<br>
the past three weeks and we&#39;re now using the StackToRegisterMappingCogit<br>
internally at Teleplace.<br>
</blockquote>
<br>
<br>
</div></div></blockquote></div><br>