[Cuis-dev] Questions about MessageNode macro transformation
wiljo at mac.com
Sun Jul 14 17:25:11 PDT 2019
The original Smalltalk-80 bluebook specification for the language identified the following selectors for special processing.
ifTrue:, ifFalse:, ifTrue:ifFalse:, ifFalse:ifTrue:, to:do:, to:by:do:, and:, or: ==, timesRepeat:, basicAt:, basicAt:put:, basicSize, basicNew:
This was for performance reasons. A conformant compiler was allowed to inline these selectors after checking the receiver to ensure that it is an appropriate type. The ANSI standard definition of Smalltalk codifies these restricted selectors.
In the 1980’s the Self group at Sun Microsystems (David Ungar et. al.) experimented with no special selectors and a minimal byte code set. They depended instead about type inference and pioneered the idea of the “hot spot” just in time optimizer. IIRC, there was a paper about this work in 1988 or 1989 OOPSLA proceedings.
> On Jul 14, 2019, at 6:07 PM, Fernando Gasperi Jabalera via Cuis-dev <cuis-dev at lists.cuis.st <mailto:cuis-dev at lists.cuis.st>> wrote:
> Hi there,
> I'm was trying to understand why code like:
> a ifNil:  ifNotNil: 
> when parsed got a corresponding MessageNode with an #ifTrue:ifFalse selector and a receiver of the form a == nil. Following the trail lead me to the macro transformations in the MessageNode class. It seems to me that several messages (some loops, boolean operations like and and most of the if messages) are transformed to a special or canonical form, when some conditions on the number of arguments of the blocks for example are satisfied, so that they can be inlined and therefore run faster. Is that correct? Could someone explain a little bit about why it is this way and which cases are chosen to be inlined?
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st <mailto:Cuis-dev at lists.cuis.st>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Cuis-dev