summaryrefslogtreecommitdiff
path: root/lib/ruby_vm/mjit/insn_compiler.rb
diff options
context:
space:
mode:
authorTakashi Kokubun <[email protected]>2023-03-03 21:10:17 -0800
committerTakashi Kokubun <[email protected]>2023-03-05 23:28:59 -0800
commitf81c7a674751681d77d84110ffdb9c609b602cea (patch)
tree05acc8e2a00574795a71f9c2031b4ed37f1b488f /lib/ruby_vm/mjit/insn_compiler.rb
parent366c3c76446108ae442e1918c15219b0fef3fb8d (diff)
Initial support for opt_case_dispatch
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/7448
Diffstat (limited to 'lib/ruby_vm/mjit/insn_compiler.rb')
-rw-r--r--lib/ruby_vm/mjit/insn_compiler.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/ruby_vm/mjit/insn_compiler.rb b/lib/ruby_vm/mjit/insn_compiler.rb
index 386e836cd7..a4516e73e0 100644
--- a/lib/ruby_vm/mjit/insn_compiler.rb
+++ b/lib/ruby_vm/mjit/insn_compiler.rb
@@ -24,7 +24,7 @@ module RubyVM::MJIT
asm.incr_counter(:mjit_insns_count)
asm.comment("Insn: #{insn.name}")
- # 62/101
+ # 63/101
case insn.name
when :nop then nop(jit, ctx, asm)
when :getlocal then getlocal(jit, ctx, asm)
@@ -93,7 +93,7 @@ module RubyVM::MJIT
when :branchunless then branchunless(jit, ctx, asm)
# branchnil
# once
- # opt_case_dispatch
+ when :opt_case_dispatch then opt_case_dispatch(jit, ctx, asm)
when :opt_plus then opt_plus(jit, ctx, asm)
when :opt_minus then opt_minus(jit, ctx, asm)
when :opt_mult then opt_mult(jit, ctx, asm)
@@ -1066,7 +1066,15 @@ module RubyVM::MJIT
# branchnil
# once
- # opt_case_dispatch
+
+ # @param jit [RubyVM::MJIT::JITState]
+ # @param ctx [RubyVM::MJIT::Context]
+ # @param asm [RubyVM::MJIT::Assembler]
+ def opt_case_dispatch(jit, ctx, asm)
+ # Just go to === branches for now
+ ctx.stack_pop
+ KeepCompiling
+ end
# @param jit [RubyVM::MJIT::JITState]
# @param ctx [RubyVM::MJIT::Context]