mirror of
https://github.com/ruby/ruby.git
synced 2025-09-18 10:03:59 +02:00
MJIT: Refactor CDHASH handling
Converting a CDHASH into a safe Hash is a lot of work, but retrieving just values is much easier.
This commit is contained in:
parent
44165df121
commit
8a0acbea4c
3 changed files with 4 additions and 49 deletions
|
@ -544,12 +544,12 @@ class RubyVM::MJIT::Compiler
|
|||
when /\A\s+JUMP\((?<dest>[^)]+)\);\s+\z/
|
||||
dest = Regexp.last_match[:dest]
|
||||
if insn.name == :opt_case_dispatch # special case... TODO: use another macro to avoid checking name
|
||||
hash_offsets = C.rb_hash_values(operands[0])
|
||||
else_offset = cast_offset(operands[1])
|
||||
cdhash = C.cdhash_to_hash(operands[0])
|
||||
base_pos = pos + insn_len
|
||||
|
||||
src << " switch (#{dest}) {\n"
|
||||
cdhash.each do |_key, offset|
|
||||
hash_offsets.each do |offset|
|
||||
src << " case #{offset}:\n"
|
||||
src << " goto label_#{base_pos + offset};\n"
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue