Skip to content

Add ability to generically optimize instr during LOP#8181

Merged
enebo merged 11 commits intojruby:9.5-devfrom
enebo:opt_instr
Apr 5, 2024
Merged

Add ability to generically optimize instr during LOP#8181
enebo merged 11 commits intojruby:9.5-devfrom
enebo:opt_instr

Conversation

@enebo
Copy link
Member

@enebo enebo commented Apr 1, 2024

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).

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).
@enebo enebo added this to the JRuby 10.0.0.0 milestone Apr 1, 2024
enebo added 5 commits April 1, 2024 11:33
…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.
enebo added 5 commits April 4, 2024 12:32
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.
@enebo enebo merged commit 750e615 into jruby:9.5-dev Apr 5, 2024
@enebo enebo deleted the opt_instr branch April 5, 2024 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant