-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Labels
Description
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:
- in compiler.py...
- create a function called
optimise_bytecodefor this and future optimisations - create this optimisation in
remove_redundant_bytecodeor something - call
optimise_bytecodefromCompileTopLevel.make_function
Reactions are currently unavailable