Re: [Pharo-project] Sender of or: Boolean method
On Mar 3, 2012, at 1:02 PM, Dario Trussardi wrote:
Ciao,
i work with:
Pharo-1.0 Latest update: #10517.
( but i found the same answer into Pharo1.2.2 Latest update: #12353 )
I have a browser open on Boolean class.
When i select the or: method and click on the sender button the system answer only ten methods.
Because ?
It is compiled to jumps, the message send is optimized away. e.g "true or: [false]" is compiled to: 17 <71> pushConstant: true 18 <99> jumpFalse: 21 19 <71> pushConstant: true 20 <90> jumpTo: 22 21 <72> pushConstant: false 22 <7C> returnTop This means that then in the compiledmethod, there is no symbol needed for or: to execute the code. It is omited for space reasons (keep in mind that the original target machine of this system had 512 Kb of RAM maximum) The "senders of" iterates over all methods and looks if a symbol is there, it does not look at source code. (that's why it is so fast and works even without sources...) These days where a $25 computer is shipped witth 256MB of RAM, of course adding in 1000 methods pointers to a symbol is not that of a problem, and therefore, in 1.4, the selector of optimized-away messages is now added to the literalframe (if there is space), even though it's pure waste from the execution point of view. So now, senders of #or: gives you 1092 methods. Same for ifTrue: and all the other inlined methods. Marcus -- Marcus Denker -- http://marcusdenker.de
participants (1)
-
Marcus Denker