Skip to content
Kyle Hayes edited this page Dec 30, 2022 · 1 revision

Image Startup

The LST runtime loads an image from a file passed on the command line. The file has a header describing the version of the image format and then a slightly compressed and endian-independent dump of the image.

The steps the runtime does are:

  1. Read in the version header to determine which format the image is in. Currently this is version 3.
  2. Read in the objects one at a time. Objects are of a few types:
    1. SmallInt: These are compressed by storing just the bytes that are not zero.
    2. ByteArray: These are stored as normal object, but the data is stored directly and the size in the object header is the size in bytes.
    3. nil: This has its own special format.
    4. Regular objects: These are stored by saving the object header (which contains the size), the class, and then all the instance variables.
    5. Previously dumped objects: these are referenced by indexes.
    6. TBD
  3. Get the globals dictionary.
  4. Look up special classes used by the interpreter. This includes Class, SmallInt, Process, Context, Block, Array etc. These classes are used heavily within the C interpreter code.
  5. Look for either the REPL or WebGUI class. These are subclasses of Application.
  6. Find the #start method on the class. Note that this is a class method, not an instance method.
  7. Build a Process and Context to run that method.
  8. Pass the Process instance to the bytecode interpreter.
Clone this wiki locally