Project

General

Profile

Actions

Bug #20477

closed

RJIT NoMatchingPatternError when initialize Hash literal with more 8 items

Added by ukolovda (Dmitry Ukolov) 7 months ago. Updated 7 months ago.

Status:
Feedback
Target version:
-
ruby -v:
ruby 3.3.1 (2024-04-23 revision c56cd86388) [x86_64-linux]
[ruby-core:117804]

Description

When I create Hash with 8 or more items, I got the error:

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:

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


Related issues 1 (0 open1 closed)

Copied from Ruby master - Bug #20475: RJIT `and' NoMatchingPatternErrorFeedbackk0kubun (Takashi Kokubun)Actions
Actions #1

Updated by ukolovda (Dmitry Ukolov) 7 months ago

  • Description updated (diff)
Actions #2

Updated by k0kubun (Takashi Kokubun) 7 months ago

  • Copied from Bug #20475: RJIT `and' NoMatchingPatternError added

Updated by k0kubun (Takashi Kokubun) 7 months ago

  • Status changed from Open to Feedback
  • Assignee set to k0kubun (Takashi Kokubun)

Updated by k0kubun (Takashi Kokubun) 7 months ago

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.

Updated by ukolovda (Dmitry Ukolov) 7 months ago

Thank you!
I guessed, RJIT will be production solution in some future, sorry.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0