Repository navigation
Conversation
sferik
force-pushed
the
ir-persist-int-temp
branch
from
October 20, 2026 02:21
7c86f75 to
0103757
Compare
Array patterns compile to instructions that IRReaderStream couldn't read back: TemporaryIntVariable operands, b_int, int_math and as_fixnum. Each class already had a decode method, but the reader's switches never called them, so loading a jrubyc-compiled file with an array pattern failed with a NullPointerException. IntegerMathInstr also didn't write its operands, so it couldn't have been read back even with a reader case. It now writes them in the order its decode method reads them. Fixes jruby#9834
sferik
force-pushed
the
ir-persist-int-temp
branch
from
October 20, 2026 02:53
0103757 to
dfb2a7e
Compare
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.
Fixes #9834.
Loading a
jrubyc-compiled file that uses an array pattern, like[1] in [1], failed with aNullPointerExceptionwhile reading the persisted IR. The first problem was inTemporaryLocalVariable.decode, which had no case forINT, so theTemporaryIntVariables that array patterns use for the length, rest count and indexes decoded asnulland the reader lost its place.Fixing that turned up the next one:
IRReaderStreamcouldn't readb_int,int_mathoras_fixnumeither. All three instruction classes already had adecodemethod, but nothing called them. AndIntegerMathInstrnever wrote its two operands, so it couldn't have been read back regardless. It now writes them in the order itsdecodereads them.I checked the reader's switch against every operation. The other ones it doesn't handle either have no
decodemethod at all or are only added by optimization passes, so I left them alone.The new spec runs array patterns, including a rest pattern that exercises
int_math, in all four compile modes, and the persistence mode fails without this change. I also compiled several pattern forms withjrubyc, including rest and find patterns, and they now load and give the same results as CRuby.