The design of the Inferno virtual machine
Created on 2020-08-24T05:56:17.023567
Instructions are of the form:
OP src1, src2, dst
- Opcodes work on memory addresses or offsets directly, not through registers.
- This is similar to an "infinite register" machine.
Types
- 32-bit signed word
- 64-bit signed big
- 8-bit unsigned byte
- 64-bit float real
- Platform dependent pointer
Memory segments
- Code segments are not addressible from the instruction set.
- Code segments may contain either VM opcodes, or compiled native code pages.
Memory management
- VM prefers automated reference counting (ARC) primarily
- A mark/sweep (or equivalent) garbage collector exists to collect cycles
- Pointers need special pointer operations to keep ARC/GC data up to date
Type descriptors
- Type descriptors consist of a word to identify the type, a word for the size of the type in bytes, and a pointer map.
- The pointer map is one or more bytes.
- Each bit in the pointer map indicates a pointer is stored at some word in the type.
- The most significant bit of the pointer map is the lowest address of the type.
Registers
- mp register: module pointer; points to memory for a given module
- fp register: frame pointer; poitns to memory for the current thread frame