[Vm-dev] Questions related to immutability in Cog

Clément Bera bera.clement at gmail.com
Mon Nov 16 17:05:23 UTC 2015

Hi all,

I am willing to have this done because I need it for the sista production
version (I need the literals not to be able to be become).

So my questions are:
- Is Sebastian or someone going to do this ? Else I will try to find a
student for next summer or do it myself.
- We agreed that what we build is a write barrier and not immutability.
Hence, how should I call the methods marking the object as non writable ?
#markAsNonWritable, #markAsWritable, #isWritable ? The call back selector
for instance variables will remain #attemptToWrite: value atIndex: index.

If I do it or supervise someone to do it, the first version will be a VM
compilation option because there will be performance loss with this feature
due to inst var stores and at:put: being slowed (we expect 5% overhead).

The scheme works for all objects but contexts. I think for contexts I will
just forbid to mark them as non writable for now. In the future we could
divorce and discard the frame, mark the context as non writeable, and
returns across stack page would handle differently returns to non writable
contexts (for example we could ask the image to interpret them). I guess it
could make sense in some cases.


2015-11-11 15:30 GMT-03:00 tim Rowledge <tim at rowledge.org>:

> > On 11-11-2015, at 7:47 AM, Chris Cunningham <cunningham.cb at gmail.com>
> wrote:
> >
> >  immutablity - an immutable bitblit?
> exactly what I was thinking :-)
> A couple of other immutability thoughts;
> copying an imm. (I refuse to type it out every time) object - the copy
> primitive would need to clear the imm. bit unless we declare that a copy is
> also imm. In which case only ST code copying could be used to make non-imm.
> copies.
> we’re SOL anytime any external prim or call is passed the guts of an imm.
> object.
> tim
> --
> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
> A hacker does for love what others would not do for money.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20151116/c0968f61/attachment-0001.htm

More information about the Vm-dev mailing list