[Vm-beginners] Two Questions

Bert Freudenberg bert at freudenbergs.de
Fri May 13 19:41:53 UTC 2011


On 13.05.2011, at 20:23, Chris Cunnington wrote:

> Ok, yea. I see that. At some point Alice has to go down the rabbit hole. The depiction of events in Smalltalk has to stop making sense at some point. So, #dispatchOn:in: ceases to refer to things on this level of abstraction.
> 
> For the second question, I think I've been having a problem grokking what ObjectMemory is. What's the depiction of memory between regular objects as I see them in a browser and the RAM? Hmmm... that'd be ObjectMemory itself.
> 
> MicroSqueakImageBuilder creates a ByteArray. That gets pulled into ObjectMemory>>#memory. And the #specialObjectsOop gets pulled in from the same ByteArray. (Well, it's a binary at this point.)
> 
> In the same way that MicroSqueakImageBuilder saved a ByteArray and it became a fresh, new image. After we've changed the state of the image, and we Snapshot&Quit, I guess the contents of Object>>#memory get filed into that same image with altered state.

The thing is what you see in Interpreter and ObjectMemory is only meant to be translated to C. "OOPs" are actual pointers after translation to C. It's not object-oriented. The classes itself are ignored. The Simulator subclass makes things work in Smalltalk, using Integers to refer to locations inside the "memory" bytearray. That's a simulation of the actual main memory of your machine. A snapshot of that memory / bytearray is what we call "image", and so that's what MicroSqueakImageBuilder creates.

Makes sense?

- Bert -




More information about the VM-beginners mailing list