[squeak-dev] C++ parser in Smalltalk?

Igor Stasenko siguctua at gmail.com
Thu Jul 3 22:43:08 UTC 2008


2008/7/4  <bryce at kampjes.demon.co.uk>:
> 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 var
>  > assignment.  But for at:put: one can fold the check into other activities.
>  >  For example, in my VisualWorks implementation the write-protect bit was put
>  > very close to and more significant than the size field in the object header.
>
> <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 the
>  > 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.
>

Yes, it looks more like a capability-based approach. It is better in a
ways, that we can introduce wide range of capabilities in future while
keep object formats intact. The question is however, how to introduce
such model without compatibility conflicts.
Some magic with mixins/traits come in mind: to be able to define a
behavior which can be turned on/off/switch for a particular object.
Really,  why we should pay with state(flags), when actually its a
subject of different capabilities, which should be reflected by
behavior.

>  > I think per-object write-protection is very useful.  Its very useful for
>  > read-only literals, OODBs, proxies (distributed objects), debugging, etc.
>  >  Amongst Smalltalks I think VisualAge had it first and I did it for VW round
>  > 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 something
>  > 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
> Exupery.
>
> Immutability or change tracking can be provided more efficiently purely
> inside the image when it's needed.
>
> Bryce
>
>



-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list