-
Notifications
You must be signed in to change notification settings - Fork 323
Description
Blocked by: #1439
Currently Wasmi uses slices of Instructions to represent function bodies.
This is a very low level usage. A much better, more flexible and higher-level approach is build up these function bodies or instruction sequences with so-called IR-builders.
The wasmi_ir::for_each_op macro can be used to generate such an IrBuilder. The IrBuilder will have one builder function per Wasmi IR instruction in the form of:
pub fn $instr_name(&mut self, $args: ..) -> Result<Instr, Errror> { ... }Which allows to incrementally build-up the instruction sequence.
This is more flexible than a slice or array of instructions because this also allows to later replace the underlying build-up mechanism to use a byte-encoding similar to what Wasmtime's pulley interpreter is doing.
The main work item is probably to convert all the many Wasmi translation unit tests and the Wasmi translator to use this new API.
The currently existing Instruction constructors will no longer be needed after this has been implemented.
A simiar InstrSequence type has existed in wasmi_ir for some time but was removed in #1323.