Hi Janko,<br><br><div class="gmail_quote">2011/3/27 Janko Mivšek <span dir="ltr">&lt;<a href="mailto:janko.mivsek@eranova.si">janko.mivsek@eranova.si</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Dear all,<br>
<br>
What is current status of immutable/read-only support in VM? Or more<br>
broader, object instvar change catching support (for which I mostly need<br>
immutability anyway)?<br></blockquote><div><br></div><div>My understanding is that this exists only in the Newspeak VM sources.  It is now reasonably easy to port to the standard and Cog VMs and the necessary primitive error code support is in the VMs and the image.  I&#39;m currently working in Newspeak at Cadence expect that this summer I will have the opportunity to port the Cog VM under Newspeak.  At that point I&#39;ll be able to add the support to Cog and the standard VM.</div>
<div><br></div><div>There are now mechanisms in the VM which would allow one to include the immutability support conditionally, in which case the source could be included in the base VMs, and not have to live in a fork, which would be my preference.  e.g.</div>
<div><br></div><div>Interpreter methods for stack bytecodes</div><div><div>storeAndPopReceiverVariableBytecode</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>&quot;Note: This code uses storePointerUnchecked:ofObject:withValue: and does the </div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>store check explicitly in order to help the translator produce better code.&quot;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>| rcvr top |</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>&lt;expandInCase: &#39;currentBytecode&#39;&gt;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>&quot;this bytecode will be expanded so that refs to currentBytecode below will be constant&quot;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>rcvr := receiver.</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>top := self internalStackTop.</div><div><span class="Apple-tab-span" style="white-space: pre; ">        </span>self cppIf: Immutability</div>
<div><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span>ifTrue:</div><div><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span>[(self internalIsImmutable: rcvr) ifTrue:</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>[self internalPop: 1.</div>
<div><span class="Apple-tab-span" style="white-space: pre; "></span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space:pre">        </span> self internalCannotAssign: top to: receiver withIndex: (currentBytecode bitAnd: 7)].</div>
<div><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>&quot;cannot fetch next bytecode until after immutability check so pc is correct (set to</div>
<div><span class="Apple-tab-span" style="white-space: pre; "></span></div><div><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space:pre">        </span> following bytecode, not the bytecode after that) after attemptToAssign:withIndex:&quot;].</div>
<div><span class="Apple-tab-span" style="white-space: pre; "></span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>self fetchNextBytecode.</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>rcvr &lt; youngStart ifTrue:</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>[self possibleRootStoreInto: rcvr value: top].</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>self storePointerUnchecked: (currentBytecode bitAnd: 7) ofObject: rcvr withValue: top.</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>self internalPop: 1</div></div><div><br></div><div>best,</div><div>Eliot</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<br>
Best regards<br>
Janko<br>
<font color="#888888"><br>
--<br>
Janko Mivšek<br>
Aida/Web<br>
Smalltalk Web Application Server<br>
<a href="http://www.aidaweb.si" target="_blank">http://www.aidaweb.si</a><br>
<br>
</font></blockquote></div><br>