[Vm-dev] Squeak Object Engine Message Sending clarification

tim Rowledge tim at rowledge.org
Sun Dec 8 18:23:42 UTC 2013


On 08-12-2013, at 10:12 AM, gettimothy <gettimothy at zoho.com> wrote:

> Thank you Tim.
> 
> From what I have gathered in this thread, the process is (loosely speaking, I will tighten up my terminology when I see the outline of the parts and delve into the details)...
> 
> 0. VM references stack for Oop
> 1. Using the Oop, VM references the header on the object in ObjectMemory (see comment in ObjectMemory)
> 2.....
> 
> Just that fact that it goes out to ObjectMemory, instead of "receiver class methodDict" to me, hints at some interesting stuff and is a
> very important distinction.

it finds the object on the context stack
looks at the objects header
finds the class oop from that (with a possible indirection through a table of classes used commonly enough that it is worth ‘caching’ them)
looks in the class object for the method dictionary
scans the dictionary for the method named by the message being sent
- possibly fails and looks up the parent class, rinse and repeat)
loads up the found method
sets up a new context with suitable values
moves execution to the new context

So, lots of looking through objects in object memory, quite a lot of reliance upon them having the correct ‘shape’ and a fair bit of redundant copying. The key (well, one key) to making it all go faster is finding wasys to reduce the digging around and copying. Eliot has done more clever work than most in finding those clever shortcuts and Cog is a prime example of how complex it can be to do something ‘simple’, fast.

That reminds that there’s also an important point that seems to have been forgotten by most people in recent years; actually writing decent code using sensible algorithms is pretty important. An entire swathe of code monkeys has grown up thinking they can throw together any old rubbish and next year’s computers will make it all run decently. T’ain’t so no more. Simplistic performance growth as a free side-effect of Moore’s Law is over. Time to start actually *engineering* software (again).

tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
"Bother!" said Pooh, as he stood up to his waist in a cow pat.




More information about the Vm-dev mailing list