The RefLayout{Get/Set}Field opcodes (and their repeated counterparts) would read/write one byte at a time.
This PR introduces two new Opcodes that are created during normalization:
ByteArrayGetField[offset: int]<T>(arr: Array<byte>, i_offset: int) -> T
All RefLayout reads/writes (including those for repeated fields) are normalized into this form.
When lowering to machine code, we decompose these loads/stores into power-of-two loads/stores (e.g. a u56, with 7 bytes, will be decomposed into loads of 4+2+1 bytes).
Todo:
Since there is no intermediate lowering for JVM code generation, add a normalizer flag to perform byte-by-byte loads/stores (same as the old behavior) specially for the JVM target.
The RefLayout{Get/Set}Field opcodes (and their repeated counterparts) would read/write one byte at a time. This PR introduces two new Opcodes that are created during normalization:
ByteArrayGetField[offset: int]<T>(arr: Array<byte>, i_offset: int) -> T
ByteArraySetField[offset: int]<T>(arr: Array<byte>, i_offset: int, value: T) -> void
All RefLayout reads/writes (including those for repeated fields) are normalized into this form.
When lowering to machine code, we decompose these loads/stores into power-of-two loads/stores (e.g. a
u56
, with 7 bytes, will be decomposed into loads of 4+2+1 bytes).Todo: