Next: , Previous: , Up: Operation  


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.


Footnotes

(3)

The directory is called _st/kernel under MS-DOS. Under OSes that don’t use home directories, it is looked for in the current directory.

(4)

The file is looked up as _st/pre.st under MS-DOS and again, under OSes that don’t use home directories it is looked for as pre.st in the current directory.


Next: , Previous: , Up: Operation