[GOODIE] Squeak Smalltalk: A Quick Reference (v. 0.0)

Randal L. Schwartz merlyn at stonehenge.com
Sun Dec 5 19:24:18 UTC 1999


>>>>> "Bob" == Bob Arning <arning at charm.net> writes:

Bob> That's one of those VM shortcuts whose existence sometimes fools
Bob> us, but without which life would proceed at a much slower pace. A
Bob> number of common message sends are actually compiled to their own
Bob> bytecode. This can reduce the size of compiled methods and speed
Bob> execution of really common stuff.

Bob> - some of these simply do a normal method dispatch 
Bob> - some of these actually do the intended work if the receiver
Bob> (and arguments, if any) are of certain common type(s) and send a
Bob> normal message only if this fails.
Bob> - some simply do the job without question. The bytecode for
Bob> sending #class is one of these. You can even put a #halt in the
Bob> #class method from Object and still have a running system
Bob> (although you might have trouble if someone sent #class as the
Bob> argument to #perform:).

Bob> For further details, see the implementors of #bytecodePrim... in
Bob> Interpreter.

Hmm... then the comment in Object class>>howToModifyPrimitives is wrong,
as is Object>>class since it isn't marked "No Lookup":

   A selector which is a special selector solely in order to save space has a 
   normal behavior.  Methods whose selectors are special in order to 
   gain speed contain the comment, 'No Lookup'.  When the interpreter 
   encounters a send-special-selector bytecode, it checks the class of the 
   receiver and the selector.  If the class-selector pair is a no-lookup pair, 
   then the interpreter swiftly jumps to the routine which implements the 
   corresponding primitive.  (A special selector whose receiver is not of the 
   right class to make a no-lookup pair, is looked up normally).  The pairs are 
   listed below.  No-lookup methods contain a primitive number specification, 
   <primitive: xx>, which is redundant.  Since the method is not normally looked 
   up, deleting the primitive number specification cannot prevent this 
   primitive from running.  If a no-lookup primitive fails, the method is looked 
   up normally, and the expressions in it are executed. 

   No Lookup pairs of (class, selector) 

   SmallInteger with any of                + - * /  \\  bitOr: bitShift: bitAnd:  // 
   SmallInteger with any of                =  ~=  >  <  >=  <= 
   Any class with                                  == 
   Any class with                                  @ 
   Point with either of                            x y 
   ContextPart with                                        blockCopy: 
   BlockContext with either of             value value:



-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!





More information about the Squeak-dev mailing list