[ruby-core:117804] [Ruby master Bug#20477] RJIT NoMatchingPatternError when initialize Hash literal with more 8 items

Issue #20477 has been reported by ukolovda (Dmitry Ukolov). ---------------------------------------- Bug #20477: RJIT NoMatchingPatternError when initialize Hash literal with more 8 items https://bugs.ruby-lang.org/issues/20477 * Author: ukolovda (Dmitry Ukolov) * Status: Open * ruby -v: ruby 3.3.1 (2024-04-23 revision c56cd86388) [x86_64-linux] * Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- When I create Hash with 8 or more items: ```bash ruby --rjit -e "a = 1; 1.upto(10) { b={a1: a&1, a2: a&1, a3: a&1, a4: a&1, a5: a&1, a6: a&1, a7: a&1, a8: a&1} }" /home/ukolovda/.rvm/rubies/ruby-3.3.1/lib/ruby/3.3.0/ruby_vm/rjit/assembler.rb:124:in `and': [:rax, [:rbx, 128]] (NoMatchingPatternError) from /home/ukolovda/.rvm/rubies/ruby-3.3.1/lib/ruby/3.3.0/ruby_vm/rjit/insn_compiler.rb:2348:in `opt_and' from /home/ukolovda/.rvm/rubies/ruby-3.3.1/lib/ruby/3.3.0/ruby_vm/rjit/insn_compiler.rb:118:in `compile' from /home/ukolovda/.rvm/rubies/ruby-3.3.1/lib/ruby/3.3.0/ruby_vm/rjit/compiler.rb:321:in `compile_block' from /home/ukolovda/.rvm/rubies/ruby-3.3.1/lib/ruby/3.3.0/ruby_vm/rjit/compiler.rb:150:in `block in branch_stub_hit' from <internal:kernel>:133:in `then' from /home/ukolovda/.rvm/rubies/ruby-3.3.1/lib/ruby/3.3.0/ruby_vm/rjit/compiler.rb:149:in `branch_stub_hit' from -e:1:in `block in <main>' from -e:1:in `upto' from -e:1:in `<main>' ``` Test ruby file: ```ruby # test.rb # Running: ruby --rjit test.rb a = 1 1.upto(10) do b = { a1: a&1, a2: a&1, a3: a&1, a4: a&1, a5: a&1, a6: a&1, a7: a&1, a8: a&1, } end ``` (I described it first in #20475, but it is closed now. Current description is more clear and easy reproduce). -- https://bugs.ruby-lang.org/

Issue #20477 has been updated by k0kubun (Takashi Kokubun). Status changed from Open to Feedback Assignee set to k0kubun (Takashi Kokubun) ---------------------------------------- Bug #20477: RJIT NoMatchingPatternError when initialize Hash literal with more 8 items https://bugs.ruby-lang.org/issues/20477#change-108214 * Author: ukolovda (Dmitry Ukolov) * Status: Feedback * Assignee: k0kubun (Takashi Kokubun) * ruby -v: ruby 3.3.1 (2024-04-23 revision c56cd86388) [x86_64-linux] * Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- When I create Hash with 8 or more items, I got the error: ```bash ruby --rjit -e "a = 1; 1.upto(10) { b={a1: a&1, a2: a&1, a3: a&1, a4: a&1, a5: a&1, a6: a&1, a7: a&1, a8: a&1} }" /home/ukolovda/.rvm/rubies/ruby-3.3.1/lib/ruby/3.3.0/ruby_vm/rjit/assembler.rb:124:in `and': [:rax, [:rbx, 128]] (NoMatchingPatternError) from /home/ukolovda/.rvm/rubies/ruby-3.3.1/lib/ruby/3.3.0/ruby_vm/rjit/insn_compiler.rb:2348:in `opt_and' from /home/ukolovda/.rvm/rubies/ruby-3.3.1/lib/ruby/3.3.0/ruby_vm/rjit/insn_compiler.rb:118:in `compile' from /home/ukolovda/.rvm/rubies/ruby-3.3.1/lib/ruby/3.3.0/ruby_vm/rjit/compiler.rb:321:in `compile_block' from /home/ukolovda/.rvm/rubies/ruby-3.3.1/lib/ruby/3.3.0/ruby_vm/rjit/compiler.rb:150:in `block in branch_stub_hit' from <internal:kernel>:133:in `then' from /home/ukolovda/.rvm/rubies/ruby-3.3.1/lib/ruby/3.3.0/ruby_vm/rjit/compiler.rb:149:in `branch_stub_hit' from -e:1:in `block in <main>' from -e:1:in `upto' from -e:1:in `<main>' ``` Test ruby file: ```ruby # test.rb # Running: ruby --rjit test.rb a = 1 1.upto(10) do b = { a1: a&1, a2: a&1, a3: a&1, a4: a&1, a5: a&1, a6: a&1, a7: a&1, a8: a&1, } end ``` (I described it first in #20475, but it is closed now. Current description is more clear and easy reproduce). -- https://bugs.ruby-lang.org/

Issue #20477 has been updated by k0kubun (Takashi Kokubun). Thanks for the easy reproduction steps. As a reminder from the previous ticket,
Given its experimental nature, it's somewhat intended that RJIT's assembler doesn't cover some patterns. It's for developers to try some stuff, so feel free to open a pull request to add support for that instruction encoding, or just switch to --yjit if you just want to use a JIT.
---------------------------------------- Bug #20477: RJIT NoMatchingPatternError when initialize Hash literal with more 8 items https://bugs.ruby-lang.org/issues/20477#change-108215 * Author: ukolovda (Dmitry Ukolov) * Status: Feedback * Assignee: k0kubun (Takashi Kokubun) * ruby -v: ruby 3.3.1 (2024-04-23 revision c56cd86388) [x86_64-linux] * Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- When I create Hash with 8 or more items, I got the error: ```bash ruby --rjit -e "a = 1; 1.upto(10) { b={a1: a&1, a2: a&1, a3: a&1, a4: a&1, a5: a&1, a6: a&1, a7: a&1, a8: a&1} }" /home/ukolovda/.rvm/rubies/ruby-3.3.1/lib/ruby/3.3.0/ruby_vm/rjit/assembler.rb:124:in `and': [:rax, [:rbx, 128]] (NoMatchingPatternError) from /home/ukolovda/.rvm/rubies/ruby-3.3.1/lib/ruby/3.3.0/ruby_vm/rjit/insn_compiler.rb:2348:in `opt_and' from /home/ukolovda/.rvm/rubies/ruby-3.3.1/lib/ruby/3.3.0/ruby_vm/rjit/insn_compiler.rb:118:in `compile' from /home/ukolovda/.rvm/rubies/ruby-3.3.1/lib/ruby/3.3.0/ruby_vm/rjit/compiler.rb:321:in `compile_block' from /home/ukolovda/.rvm/rubies/ruby-3.3.1/lib/ruby/3.3.0/ruby_vm/rjit/compiler.rb:150:in `block in branch_stub_hit' from <internal:kernel>:133:in `then' from /home/ukolovda/.rvm/rubies/ruby-3.3.1/lib/ruby/3.3.0/ruby_vm/rjit/compiler.rb:149:in `branch_stub_hit' from -e:1:in `block in <main>' from -e:1:in `upto' from -e:1:in `<main>' ``` Test ruby file: ```ruby # test.rb # Running: ruby --rjit test.rb a = 1 1.upto(10) do b = { a1: a&1, a2: a&1, a3: a&1, a4: a&1, a5: a&1, a6: a&1, a7: a&1, a8: a&1, } end ``` (I described it first in #20475, but it is closed now. Current description is more clear and easy reproduce). -- https://bugs.ruby-lang.org/

Issue #20477 has been updated by ukolovda (Dmitry Ukolov). Thank you! I guessed, RJIT will be production solution in some future, sorry. ---------------------------------------- Bug #20477: RJIT NoMatchingPatternError when initialize Hash literal with more 8 items https://bugs.ruby-lang.org/issues/20477#change-108216 * Author: ukolovda (Dmitry Ukolov) * Status: Feedback * Assignee: k0kubun (Takashi Kokubun) * ruby -v: ruby 3.3.1 (2024-04-23 revision c56cd86388) [x86_64-linux] * Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- When I create Hash with 8 or more items, I got the error: ```bash ruby --rjit -e "a = 1; 1.upto(10) { b={a1: a&1, a2: a&1, a3: a&1, a4: a&1, a5: a&1, a6: a&1, a7: a&1, a8: a&1} }" /home/ukolovda/.rvm/rubies/ruby-3.3.1/lib/ruby/3.3.0/ruby_vm/rjit/assembler.rb:124:in `and': [:rax, [:rbx, 128]] (NoMatchingPatternError) from /home/ukolovda/.rvm/rubies/ruby-3.3.1/lib/ruby/3.3.0/ruby_vm/rjit/insn_compiler.rb:2348:in `opt_and' from /home/ukolovda/.rvm/rubies/ruby-3.3.1/lib/ruby/3.3.0/ruby_vm/rjit/insn_compiler.rb:118:in `compile' from /home/ukolovda/.rvm/rubies/ruby-3.3.1/lib/ruby/3.3.0/ruby_vm/rjit/compiler.rb:321:in `compile_block' from /home/ukolovda/.rvm/rubies/ruby-3.3.1/lib/ruby/3.3.0/ruby_vm/rjit/compiler.rb:150:in `block in branch_stub_hit' from <internal:kernel>:133:in `then' from /home/ukolovda/.rvm/rubies/ruby-3.3.1/lib/ruby/3.3.0/ruby_vm/rjit/compiler.rb:149:in `branch_stub_hit' from -e:1:in `block in <main>' from -e:1:in `upto' from -e:1:in `<main>' ``` Test ruby file: ```ruby # test.rb # Running: ruby --rjit test.rb a = 1 1.upto(10) do b = { a1: a&1, a2: a&1, a3: a&1, a4: a&1, a5: a&1, a6: a&1, a7: a&1, a8: a&1, } end ``` (I described it first in #20475, but it is closed now. Current description is more clear and easy reproduce). -- https://bugs.ruby-lang.org/
participants (2)
-
k0kubun (Takashi Kokubun)
-
ukolovda (Dmitry Ukolov)