diff options
author | Aaron Patterson <tenderlove@ruby-lang.org> | 2021-10-06 13:55:02 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2021-10-07 15:39:47 -0700 |
commit | 217df51f0e5d9824ed712a4d175f555d932e44d8 (patch) | |
tree | cc3687806ac84c8d6d239d9bbde6255804e99f07 /test | |
parent | cb5a3b198e2a196c701d82842b3eb06ed0527110 (diff) | |
download | ruby-217df51f0e5d9824ed712a4d175f555d932e44d8.tar.gz |
Dump outer variables tables when dumping an iseq to binary
This commit dumps the outer variables table when dumping an iseq to
binary. This fixes a case where Ractors aren't able to tell what outer
variables belong to a lambda after the lambda is loaded via ISeq.load_from_binary
[Bug #18232] [ruby-core:105504]
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_iseq.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb index 0cde1fbb7a..edd131823e 100644 --- a/test/ruby/test_iseq.rb +++ b/test/ruby/test_iseq.rb @@ -95,6 +95,16 @@ class TestISeq < Test::Unit::TestCase assert_equal(42, ISeq.load_from_binary(iseq.to_binary).eval) end + def test_lambda_with_ractor_roundtrip + iseq = compile(<<~EOF) + x = 42 + y = lambda { x } + Ractor.make_shareable(y) + y.call + EOF + assert_equal(42, ISeq.load_from_binary(iseq.to_binary).eval) + end + def test_disasm_encoding src = "\u{3042} = 1; \u{3042}; \u{3043}" asm = compile(src).disasm |