2010/1/13 Martin McClure <mar...@hand2mouse.com>: > Eliot Miranda wrote: >> A *much* better way to implement this is to support immutability in the >> VM (I know, I know, but all the code is available in the Newspeak VM), >> mark objects one wants to mark as dirty as immutable, catch the >> NoModificationError exception, and proceed after having made the object >> mutable and marked it dirty. No creating hidden classes, no trying to >> get change class to work for compact classes, etc. Just a simple >> VM-implemented write barrier that can also be used for a host of other >> things (object-database mapping, debugging, immutable literals etc). > > Since object dirtying is at the core of the product I work with, and > I've worked extensively with both methods of implementing write barriers... > > I very strongly agree with Eliot. *So* much nicer a way to do this. >
It could be more efficient, in respect that you don't need to create shadow classes. But triggering exception leads to stack unwinding to find a handler, which inevitably leads to deoptimizing all contexts.. and if stack depth is high (between point of writing attempt and hook, where magma will handle exception), this will be much slower than WriteBarrier implementation, described by Cris, which checking the value in-place, without the need of touching exception machinery. Just 2 cents. > Regards, > > -Martin > > > _______________________________________________ > Pharo-project mailing list > Pharo-project@lists.gforge.inria.fr > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > -- Best regards, Igor Stasenko AKA sig. _______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project