OpenDream icon indicating copy to clipboard operation
OpenDream copied to clipboard

Unit tests for peephole optimizations

Open ike709 opened this issue 1 year ago • 0 comments

https://github.com/OpenDreamProject/OpenDream/pull/2054 revealed that we had a few optimizations that were never applied, and once that was fixed one of them still didn't work optimally due to how the optimizer functions.

Ideally, we would create some new unit tests that takes bytecode (or DM code?), peephole optimizes it, and then compares the outputted bytecode to an expected output.

Note that we need to be mindful of not using peephole optimizer opcodes in the inputted bytecode, or we may get another situation where PushNull -> Assign -> Pop is only compiled to PushNull -> AssignPop instead of being reduced to just NullRef.

ike709 avatar Oct 21 '24 03:10 ike709