titzer / virgil

A fast and lightweight native programming language
1.17k stars 40 forks source link

[WIP] Refactoring RefLayout #198

Closed btwj closed 10 months ago

btwj commented 10 months ago

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:

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: