<div dir="ltr">Hi Clement,<div><br></div><div>Per object immutability was implemented in the old, pre-Cog Newspeak VM (NewspeakInterpreter). It has not yet been implemented current Cog Newspeak VM (Stack/CoInterpreter + NewspeakVM=true), but the necessary bit is reserved in the object header. It was used as part of an orthogonal synchronization scheme to detect changed objects: mark synchronized objects as immutable, trap on change attempt, add to dirty list and mark as mutable again. A marked object is only shallowly immutable, and its instance variables may contain mutable objects.<br><div class="gmail_extra"><br></div><div class="gmail_extra">Ryan</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 10, 2015 at 6:17 AM, Clément Bera <span dir="ltr">&lt;<a href="mailto:bera.clement@gmail.com" target="_blank">bera.clement@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"> <br><div dir="ltr">Hello everyone,<div><br></div><div>I tried to understand how immutability is implemented in the CogVM (NewSpeak flavor). I have some questions:</div><div><br></div><div>- Does it actually work and is it used ?</div><div>- Does an object being immutable means that you can&#39;t edit its variable fields only or that you can&#39;t either edit its instance variables ? Because I don&#39;t see any code checking for instance variable stores in the Newspeak interpreter.</div><div>- How does the immutability check works in machine code ? In the Newspeak interpreter there is an immutability check in #at:put: . In the at:put: generated by the JIT (for example CogObjectRepresentationFor32BitSpur) I don&#39;t see any immutability check. Did I miss some clever bit trick ? Does the Newspeak spur VMs use the #at:put: machine code version of the primitive ?</div><div><br></div><div>Thanks ! </div><div>
</div></div>
<br></blockquote></div><br></div></div></div>