-
Notifications
You must be signed in to change notification settings - Fork 9
How It All Works
Kyle Hayes edited this page Dec 30, 2022
·
1 revision
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:
- Read in the version header to determine which format the image is in. Currently this is version 3.
- Read in the objects one at a time. Objects are of a few types:
- SmallInt: These are compressed by storing just the bytes that are not zero.
- 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.
- nil: This has its own special format.
- Regular objects: These are stored by saving the object header (which contains the size), the class, and then all the instance variables.
- Previously dumped objects: these are referenced by indexes.
- TBD
- Get the globals dictionary.
- 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.
- Look for either the REPL or WebGUI class. These are subclasses of Application.
- Find the #start method on the class. Note that this is a class method, not an instance method.
- Build a Process and Context to run that method.
- Pass the Process instance to the bytecode interpreter.