wasmi_ir
: Add proper IrEncoder
to encode Instruction
s in sequence
#1324
Labels
tech-debt
An issue to resolve some technical debt.
Currently Wasmi uses slices of
Instruction
s 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 anIrBuilder
. TheIrBuilder
will have one builder function per Wasmi IR instruction in the form of: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 inwasmi_ir
for some time but was removed in #1323.The text was updated successfully, but these errors were encountered: