What is the first thing the VM does when starting an image? I want to learn more about how the image actually works.
On Thu, Feb 26, 2009 at 1:22 PM, GeertC geert.wl.claes@gmail.com wrote:
What is the first thing the VM does when starting an image? I want to learn more about how the image actually works.
It runs main() or WinMain().
If you really want to know what the VM does, have a look at the VM source. See http://www.squeakvm.org/.
Also, see here for a description of how the VM works; Squeak is similar but different to this:
http://users.ipa.net/~dwighth/smalltalk/bluebook/bluebook_imp_toc.html
The rest of the blue book is available on Stef's book list (Google for it).
Gulik.
On 26.02.2009, at 01:22, GeertC wrote:
What is the first thing the VM does when starting an image? I want to learn more about how the image actually works.
It simply continues where ever the image was stopped. Select the following two lines in a workspace and "do it":
Smalltalk snapshot: true andQuit: true. self inform: 'Welcome back!'.
This will save the image and quit Squeak, and when you restart it, the informer will show.
In contrast to most other systems, Squeak is not bootstrapped. When you save the image, a primitive is invoked that snapshots the executing state of the system, and when you start an image, it restores the state, and continues right where it left off.
There are, however some actions performed before snapshotting, and right after restarting. It's an extensible design. You can find it in the #snapshot:andQuit: method. There is a line like this:
ifFalse: [self snapshotPrimitive]. "<-- PC frozen here on image file"
Everything following that line is performed on startup. Basically, classes can register to be called at shutdown and/or at startup time, see #processShutDownList: and #processStartUpList:.
- Bert -
beginners@lists.squeakfoundation.org