<br><br><div class="gmail_quote">On Tue, Mar 10, 2009 at 12:48 AM, Klaus D. Witzel <span dir="ltr">&lt;<a href="mailto:klaus.witzel@cobss.com">klaus.witzel@cobss.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,<div class="im"><br>
<br>
On Tue, 10 Mar 2009 01:04:29 +0100, Eliot Miranda wrote:<br>
<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Klaus,<br>
<br>
On Mon, Mar 9, 2009 at 11:04 AM, Klaus D. Witzel wrote:<br>
</blockquote>
...<div class="im"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I&#39;ve seen that one of the differences between the Encoder*XYZ&#39;s is<br>
#supportsClosureOpcodes being true/false but also #generateAsClosure plays a<br>
role. So the *Closures suffix is short for *EmitClosuresBytecode? Also,<br>
blocks are never emitted the old (non-closure) way?<br>
</blockquote>
<br>
<br>
The scheme is that by choosing the encoder one can choose the type of code generated.  So that e.g. if you say<br>
<br>
(Parser new<br>
encoderClass: EncoderForV3PlusClosures;<br>
parse: someString readStream class: MyClass)<br>
 generate: #(0 0 0 0)<br>
<br>
you&#39;ll get closure code and if you say<br>
<br>
(Parser new<br>
encoderClass: EncoderForV3;<br>
parse: someString readStream class: MyClass)<br>
 generate: #(0 0 0 0)<br>
<br>
you&#39;ll get pre-closure old-block code.<br>
</blockquote>
<br></div>
Okay thanks, perfectly clear now.<br>
<br>
...<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
And on the wrong VM it&#39;ll crash.  Only the CLosure VM that people are<br>
providing right now can run both new and old code.  The StackVM we have in<br>
Qwaq (that I hope will be released sometime) will only run Closure code and die horribly if given old block code.<br>
</blockquote>
<br></div>
This implies that any test*ABC method which compiles source code and passes the wrong Encoder*XYZ to Parser can crash its VM. So one has to check, in such tests, what VM type is running. How can the VM be queried for that?</blockquote>
<div><br></div><div>Good point.  There isn&#39;t a straight-forward way in the normal VMs.  In the Qwaq internal VMs I added the imageFormatVersion of the current VM as vm parameter #41.  BTW, here is the complete list of things I&#39;ve added</div>
<div><br></div><div><div><span class="Apple-tab-span" style="white-space:pre">                </span>41  imageFormatVersion for the VM</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>42<span class="Apple-tab-span" style="white-space:pre">        </span>nil (number of stack pages in use in Stack VM)</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>43<span class="Apple-tab-span" style="white-space:pre">        </span>nil (desired number of stack pages in Stack VM)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>44<span class="Apple-tab-span" style="white-space:pre">        </span>nil (size of eden, in bytes in Stack VM)</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>45<span class="Apple-tab-span" style="white-space:pre">        </span>nil (desired size of eden in Stack VM)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>46-55 nil; reserved for VM parameters that persist in the image (such as eden above)</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>56<span class="Apple-tab-span" style="white-space:pre">        </span>number of process switches since startup (read-only)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>57<span class="Apple-tab-span" style="white-space:pre">        </span>number of ioProcessEvents calls since startup (read-only)</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>58<span class="Apple-tab-span" style="white-space:pre">        </span>number of ForceInterruptCheck calls since startup (read-only)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>59<span class="Apple-tab-span" style="white-space:pre">        </span>number of check event calls since startup (read-only)</div>
<div><br></div><div>There might be a way of constructing an empty closure on a null method and testing if a version of the closure primitive fails, but I prefer the image format parameter.  In older VMs the vm parameter primitive should fail if given parameter 41.  What say the VM devs?  Can we add #41 as answering the imageFormatVersion of the VM?</div>
</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>
/Klaus<br>
<br>
-- <br>
&quot;If at first, the idea is not absurd, then there is no hope for it&quot;. Albert Einstein<br>
<br>
<br>
</div></div></blockquote></div><br>