Summary
The purpose of this feature is to construct an optimised bytecode interpreter for a word machine. The goal is to minimise cost at every level.
Approach
The bytecode format will include a relatively wide range of instructions in an effort to optimise common occurring cases. This includes:
- (Single Assignment Forms). For instruction forms which can target multiple registers, it is generally the case that most occurrences are for assigning a single register.
- (Type Safe Assignments). Whilst some assignments require explicit casts to be safe, others do not (e.g. assigning from a
u32 register to another u32 register does not require a case check).
- (Fixed Arguments). Many instruction forms accept multiple arguments but, in practice, most occurrences will have a fixed (small) number. We can optimise these cases.
- (Vector Instructions). Currently, instructions are packaged into vectors and this complicates the control-flow logic.
- (Function Call / Return). Currently, function call / returns allocate space on the call-stack and then copy data from the current frame into the next whilst also performing cast checks.
Is believable we could apply constant propagation after the fact as well.
Question
- What about a stack machine? Even if it had only one stack slot!
- An interesting question is whether it makes sense to completely remove the base interpreter with something like this instead. One problem with this is that we still need to be able to generate constraints from the bytecode. But, it seems plausible that it could be done by supporting e.g. high-level and low-level instructions, perhaps.
Summary
The purpose of this feature is to construct an optimised bytecode interpreter for a word machine. The goal is to minimise cost at every level.
Approach
The bytecode format will include a relatively wide range of instructions in an effort to optimise common occurring cases. This includes:
u32register to anotheru32register does not require a case check).Is believable we could apply constant propagation after the fact as well.
Question