Open rmhsilva opened 4 years ago
In many cases, the following bytecode is generated by the naïve compiler:
.... | 10 | BIND x | 11 | POP | 12 | PUSHB x ...
The last two instructions cancel each other out, and can be deleted entirely. This is a great simple optimisation to add!
Background reading: https://teal-book.condense9.com/vm/source-to-success-compilation.html#compile
Brief implementation thoughts:
optimise_bytecode
remove_redundant_bytecode
CompileTopLevel.make_function
In many cases, the following bytecode is generated by the naïve compiler:
The last two instructions cancel each other out, and can be deleted entirely. This is a great simple optimisation to add!
Background reading: https://teal-book.condense9.com/vm/source-to-success-compilation.html#compile
Brief implementation thoughts:
optimise_bytecode
for this and future optimisationsremove_redundant_bytecode
or somethingoptimise_bytecode
fromCompileTopLevel.make_function