Currently, the project uses long CIL sequences to compare values and branch.
ldarg.0
ldarg.1
cgt // 2 bytes long, compare greater than
brtrue // 1 byte + offset, branch if true
Those sequences can be shortened, using the blt instructions:
ldarg.0
ldarg.1
bgt // 1 byte + offset, branch if greater 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 cgt brtrue into just bgt
[ ] 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
cgt brtrue
into justbgt
[ ] 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