Add ability to generically optimize instr during LOP#8181
Merged
enebo merged 11 commits intojruby:9.5-devfrom Apr 5, 2024
Merged
Add ability to generically optimize instr during LOP#8181enebo merged 11 commits intojruby:9.5-devfrom
enebo merged 11 commits intojruby:9.5-devfrom
Conversation
Up to this point only branches could decide to NOP or Jump when the branch is trivially not needed. This change allows any method to reexamine its instr after operands have been simplified and potentially replace itself with another instr (even if a new instance or itself).
…String. If simplifyOperands creates contiguous FrozenString operands it will merge them. If it only ends up with a single FrozenString it will change the instr to a copy. This still has a bug in that it inplace edits the operands but if interpreter is still using the original instr it will start printing concat'd contents until the JIT version takes over. I will fix in next commit.
headius
added a commit
that referenced
this pull request
Apr 3, 2024
Due to value propagation in IR we may end up with a dstring where all arguments have propagated as literal strings, leaving this path with all static strings and no dynamic elements. This will be turned into a single string load by #8181 but for now this is the "zero" permutation of the buildString2 logic that has only static strings.
This uses new Appendable for properly combining encodings. This will not simplify an operand if it encounters any error while trying. This should only be encoding mismatches but I left the exception broader just in case.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Up to this point only branches could decide to NOP or Jump when the branch is trivially not needed. This change allows any method to reexamine its instr after operands have been simplified and potentially replace itself with another instr (even if a new instance or itself).