-
Notifications
You must be signed in to change notification settings - Fork 125
Refactor the PeepholeOptimizer into arbitrary passes #2069
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
|
Instead of having the different interfaces for each pass, could we instead have a property that describes which pass each optimization is applied on? You could have a static const or enum to keep the naming of each pass. Like: public int OptPass => IOptimization.PassListCompaction; |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Changed the peephole optimizer to support arbitrary passes over the bytecode with different optimizations instead of trying (and failing) to do everything in one go, as opts like
PushNFloatswould break theGetOpcodes()checks of other optimizations.IPeepholeOptimizationhas been renamed toIOptimization. Individual optimizer passes are the inheritor interfaces of this parent interface.Here are the passes in order:
IPeepholeOptimization- Runs pretty much everything not involvingPushNopcodesIBytecodeCompactor- Converts multiplePushopcodes toPushNopcodesIListCompactor- ConvertsPushN... CreateListtoCreateListN...opcodesI ran my usual bytecode analysis scripts on TG and confirmed that we're now running const folding optimizations (in the first pass) 100% of the time. I also confirmed that second-pass and third-pass optimizations are also being applied.
I booted TG and confirmed it doesn't explode. I also ran the profiler and confirmed that the performance impact is negligible:

Closes #2059