Currently, the project uses long CIL sequences to compare values and branch.
ldarg.0
ldarg.1
clt // 2 bytes long, compare less than
brtrue // 1 byte + offset, branch if true
Those sequences can be shortened, using the blt instructions:
ldarg.0
ldarg.1
blt // 1 byte + offset, branch if less than
This more optimal sequence is not only more space efficient, it is also better for the JIT compiler.
Steps needed:
[ ] Add this instruction, by adding a new variant of the CILRoot enum
[ ] Add support for exporting this instruction.
[ ] Add optimizations, changing the sequence clt brtrue into just blt
[ ] Add some basic unit tests
This only requires changes to the cilly crate, so no Rust-specific experience is needed.
Currently, the project uses long CIL sequences to compare values and branch.
Those sequences can be shortened, using the
blt
instructions:This more optimal sequence is not only more space efficient, it is also better for the JIT compiler.
Steps needed:
[ ] Add this instruction, by adding a new variant of the CILRoot enum [ ] Add support for exporting this instruction. [ ] Add optimizations, changing the sequence
clt brtrue
into justblt
[ ] Add some basic unit testsThis only requires changes to the cilly crate, so no Rust-specific experience is needed.
Helpful sources: List of CIL instructions CIL Root optimization function