[squeak-dev] C++ parser in Smalltalk?
eliot.miranda at gmail.com
Thu Jul 3 23:01:42 UTC 2008
On Thu, Jul 3, 2008 at 2:56 PM, <bryce at kampjes.demon.co.uk> wrote:
> Eliot Miranda writes:
> > > P.S. That's one reason I don't like the idea of a write protect bit in
> > > the object header. It adds yet another thing to check for every single
> > > write into an object. Small costs add up on common basic operations.
> > Actually one can be clever about this. yes one has to check for inst
> > assignment. But for at:put: one can fold the check into other
> > For example, in my VisualWorks implementation the write-protect bit was
> > very close to and more significant than the size field in the object
> <snip, neat optimisation>
> > > Write protection could be implemented using similar tricks to the
> > > write barrier. Then send optimisation will help reduce the costs when
> > > it's used. When it's not used, there's no cost.
> > I don't understand this. Can you explain the write-barrier tricks and
> > send optimization that eliminates them?
> Automatically create a new hidden subclass of the class that acts
> appropriately for every write. The write protection can then be
> encoded in the class. The only overhead is that required by dynamic
> dispatch which we're already paying for.
Ah, ok. This doesn't work in general. e.g. one can't turn on immutablity
in the middle of a method that assigns to inst vars. The method in the
subclass would need to be different and mapping pcs at runtime is, uh,
decidely nontrivial. It works for access to arrays but not to objects in
> I think per-object write-protection is very useful. Its very useful for
> > read-only literals, OODBs, proxies (distributed objects), debugging,
> > Amongst Smalltalks I think VisualAge had it first and I did it for VW
> > about 2002. I did it again for Squeak at Cadence. In both the VW and
> > Squeak cases the performance degradation was less than 5% for standard
> > benchmarks. Its cheap enough not to be noticed and there's lots more
> fat in
> > the Squeak VM one can cut to more than regain performance.
> > So unlike, say, named primitives for the core primitives, this is
> > I am in favour of. It is a cost well worth paying for the added
> > functionality.
> And when we're twice as fast as VisualWorks is now it'll be a 10%
> overhead. Twice as fast as VisualWorks is the original goal for
Where are you on that?
> Immutability or change tracking can be provided more efficiently purely
> inside the image when it's needed.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Squeak-dev