Back: Invocation Up: Using GNU Smalltalk Forward: Command-line processing   Top: GNU Smalltalk User's Guide Contents: Table of Contents Index: About: About this document

1.2 Startup sequence

Caveat: The startup sequence is pretty complicated. If you are not interested in its customization, you can skip the first two sections below. These two sections also don't apply when using the command-line option `-I', unless also using `--maybe-rebuild-image'.

You can abort GNU Smalltalk at any time during this procedure with Ctrl-c.

1.2.1 Picking an image path and a kernel path  
1.2.2 Loading an image or creating a new one  
1.2.3 After the image is created or restored  


1.2.1 Picking an image path and a kernel path

When GNU Smalltalk is invoked, it first chooses two paths, the "image path" and the "kernel path". The image path is set by considering these paths in succession:

The "kernel path" is the directory in which to look for Smalltalk code compiled into the base image. The possibilities in this case are:


1.2.2 Loading an image or creating a new one

GNU Smalltalk can load images created on any system with the same pointer size as its host system by approximately the same version of GNU Smalltalk, even if they have different endianness. For example, images created on 32-bit PowerPC can be loaded with a 32-bit x86 gst VM, provided that the GNU Smalltalk versions are similar enough. Such images are called compatible images. It cannot load images created on systems with different pointer sizes; for example, our x86 gst cannot load an image created on x86-64.

Unless the `-i' flag is used, GNU Smalltalk first tries to load the file named by `--image-file', defaulting to `gst.im' in the image path. If this is found, GNU Smalltalk ensures the image is "not stale", meaning its write date is newer than the write dates of all of the kernel method definition files. It also ensures that the image is "compatible", as described above. If both tests pass, GNU Smalltalk loads the image and continues with After the image is created or restored.

If that fails, a new image has to be created. The image path may now be changed to the current directory if the previous choice is not writeable.

To build an image, GNU Smalltalk loads the set of files that make up the kernel, one at a time. The list can be found in `libgst/lib.c', in the standard_files variable. You can override kernel files by placing your own copies in `~/.st/kernel/'.(3) For example, if you create a file `~/.st/kernel/Builtins.st', it will be loaded instead of the `Builtins.st' in the kernel path.

To aid with image customization and local bug fixes, GNU Smalltalk loads two more files (if present) before saving the image. The first is `site-pre.st', found in the parent directory of the kernel directory. Unless users at a site change the kernel directory when running gst, `/usr/local/share/smalltalk/site-pre.st' provides a convenient place for site-wide customization. The second is `~/.st/pre.st', which can be different for each user's home directory.(4).

Before the next steps, GNU Smalltalk takes a snapshot of the new memory image, saving it over the old image file if it can, or in the current directory otherwise.


1.2.3 After the image is created or restored

Next, GNU Smalltalk sends the returnFromSnapshot event to the dependents of the special class ObjectMemory (see section 2.8 Memory accessing methods). Afterwards, it loads `~/.st/init.st' if available.(5)

You can remember the difference between `pre.st' and `init.st' by remembering that `pre.st' is the pre-snapshot file and `init.st' is the post-image-load initialization file.

Finally, GNU Smalltalk loads files listed on the command line, or prompts for input at the terminal, as described in Command line arguments.



Back: Loading or creating an image Up: Operation Forward: Syntax   Top: GNU Smalltalk User's Guide Contents: Table of Contents Index: About: About this document


This document was generated on April, 16 2013 using texi2html