forked from mflatt/racket
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change intermediate representation for the bytecode optimizer
Correct the second-biggest design flaw in the bytecode optimizer: instead of using a de Bruijn-like representation of variable references in the optimizer pass, use variable objects. This change is intended to address limitations on programs like the one in http://bugs.racket-lang.org/query/?cmd=view&pr=15244 where the optimizer could not perform a straightforward-seeming transformation due to the constraints of its representation. Besides handling the bug-report example better, there are other minor optimization improvements as a side effect of refactoring the code. To simplify the optimizer's implementation (e.g., eliminate code that I didn't want to convert) and also preserve success for optimizer tests, the optimizer ended up getting a little better at flattening and eliminating `let` forms and `begin`--`let` combinations. Overall, the optimizer tests in "optimize.rktl" pass, which helps ensure that no optimizations were lost. I had to modify just a few tests: * The test at line 2139 didn't actually check against reordering as intended, but was instead checking that the bug-report limitation was intact (and now it's not). * The tests around 3095 got extra `p` references, because the optimizer is now able to eliminate an unused `let` around the second case, but it still doesn't discover the unusedness of `p` in the first case soon enough to eliminate the `let`. The extra references prevent eliminating the `let` in both case, since that's not the point of the tests. Thanks to Gustavo for taking a close look at the changes. LocalWords: pkgs rkt
- Loading branch information
Showing
27 changed files
with
2,792 additions
and
4,445 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.