#class and #== optimalizations

Rob Withers rwithers12 at comcast.net
Wed Jun 30 09:38:52 UTC 2004

hi Pavel,

I also needed to intercept these two messages with my use of proxies in 
SqueakElib.  I have a vm patch that pass through those bytecodes here: 

That blocks the bytecodes but there are still three methods you need.  
I have attached that file.  Note that I hand edited the order of 
methods to put #basicEquivalence: before #==.

One other class of methods that need consideration are those of the 
#ifTrue:ifFalse: varients.  If the receiver isn't a boolean, you get a 
MustBeBoolean (or whatever it is) error.   Tim mentioned this to me and 
said that changing these could have a noticable impact on the system.  
:-(  Maybe we could change the MustBeBoolean to a msg send, like 
#cannotInterpret or doesNotUnderstand:.  Then we could catch it.   I 
haven't attempted any solution for this case.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: ignoreClassAndIdentityBytecodes.1.cs
Type: application/octet-stream
Size: 871 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20040630/770a7f7f/ignoreClassAndIdentityBytecodes.1.obj
-------------- next part --------------

On Wednesday, June 30, 2004, at 12:34 AM, Pavel K?iv?nek wrote:

> Hi all,
> Monticello has a problem with this class construction:
> ProtoObject subclass: #MyClass
>             instanceVariableNames: 'object'
>             classVariableNames: ''
>             poolDictionaries: ''
>             category: 'MyClasses.
> MyClass superclass: nil
> It forgets the last line with superclass specification.
> I'm using it for proxy objects. Instances of MyClass have one variable 
> to
> store a real receiver of messages. MyClass resends messages using
> doesNotUnderstand mechanism.
> doesNotUnderstand: aMessage
>             ^ aMessage sendTo: object.
> It works well but there is one problem - Squeak uses optimalization of 
> some
> message calls. For example, message #class is never called, because 
> Squeak
> uses special bytecode 199 (bytecodePrimClass). Real class of proxy 
> object is
> returned instead of receiver class.
> Message #isVariable returns wrong value for arrays, large integers 
> etc. So I
> have made a variable subclass of MyClass and I use it for proxy object 
> of
> variable receivers. It works well too.
> I used this proxy objects for a dictionary and its instance variables
> including tally. This variable stores a size of dictionary. When Squeak
> makes a copy of dictionary array, he sends tally like a parameter in
> constructor
> of new array, but primitive method fails. VM wants an integer instance
> strictly.
> Any ideas?
>  Pavel

More information about the Squeak-dev mailing list