summaryrefslogtreecommitdiff
path: root/lib/ruby_vm/mjit/compiler.rb
diff options
context:
space:
mode:
authorTakashi Kokubun <[email protected]>2023-01-02 13:30:56 -0800
committerTakashi Kokubun <[email protected]>2023-03-05 22:11:20 -0800
commit00c659d246784fe98114136bc3eb4d7f02cb071c (patch)
treeb644b9f9db6883001cca357ddef60d840b8d7807 /lib/ruby_vm/mjit/compiler.rb
parent4b6c7381808110e725d3bc08f3fbdbb13c44128f (diff)
Move the insn dispatch table to InsnCompiler
Diffstat (limited to 'lib/ruby_vm/mjit/compiler.rb')
-rw-r--r--lib/ruby_vm/mjit/compiler.rb110
1 files changed, 1 insertions, 109 deletions
diff --git a/lib/ruby_vm/mjit/compiler.rb b/lib/ruby_vm/mjit/compiler.rb
index 2bd22fcb98..3302b02ffa 100644
--- a/lib/ruby_vm/mjit/compiler.rb
+++ b/lib/ruby_vm/mjit/compiler.rb
@@ -116,7 +116,7 @@ module RubyVM::MJIT
insn = self.class.decode_insn(iseq.body.iseq_encoded[index])
jit.pc = (iseq.body.iseq_encoded + index).to_i
- case compile_insn(jit, ctx, asm, insn)
+ case @insn_compiler.compile(jit, ctx, asm, insn)
when EndBlock
break
when CantCompile
@@ -127,114 +127,6 @@ module RubyVM::MJIT
end
end
- # @param jit [RubyVM::MJIT::JITState]
- # @param ctx [RubyVM::MJIT::Context]
- # @param asm [RubyVM::MJIT::Assembler]
- def compile_insn(jit, ctx, asm, insn)
- asm.incr_counter(:mjit_insns_count)
- asm.comment("Insn: #{insn.name}")
-
- case insn.name
- # nop
- # getlocal
- # setlocal
- # getblockparam
- # setblockparam
- # getblockparamproxy
- # getspecial
- # setspecial
- # getinstancevariable
- # setinstancevariable
- # getclassvariable
- # setclassvariable
- # opt_getconstant_path
- # getconstant
- # setconstant
- # getglobal
- # setglobal
- when :putnil then @insn_compiler.putnil(jit, ctx, asm)
- # putself
- when :putobject then @insn_compiler.putobject(jit, ctx, asm)
- # putspecialobject
- # putstring
- # concatstrings
- # anytostring
- # toregexp
- # intern
- # newarray
- # newarraykwsplat
- # duparray
- # duphash
- # expandarray
- # concatarray
- # splatarray
- # newhash
- # newrange
- # pop
- # dup
- # dupn
- # swap
- # opt_reverse
- # topn
- # setn
- # adjuststack
- # defined
- # checkmatch
- # checkkeyword
- # checktype
- # defineclass
- # definemethod
- # definesmethod
- # send
- # opt_send_without_block
- # objtostring
- # opt_str_freeze
- # opt_nil_p
- # opt_str_uminus
- # opt_newarray_max
- # opt_newarray_min
- # invokesuper
- # invokeblock
- when :leave then @insn_compiler.leave(jit, ctx, asm)
- # throw
- # jump
- # branchif
- # branchunless
- # branchnil
- # once
- # opt_case_dispatch
- # opt_plus
- # opt_minus
- # opt_mult
- # opt_div
- # opt_mod
- # opt_eq
- # opt_neq
- when :opt_lt then @insn_compiler.opt_lt(jit, ctx, asm)
- # opt_le
- # opt_gt
- # opt_ge
- # opt_ltlt
- # opt_and
- # opt_or
- # opt_aref
- # opt_aset
- # opt_aset_with
- # opt_aref_with
- # opt_length
- # opt_size
- # opt_empty_p
- # opt_succ
- # opt_not
- # opt_regexpmatch2
- # invokebuiltin
- # opt_invokebuiltin_delegate
- # opt_invokebuiltin_delegate_leave
- when :getlocal_WC_0 then @insn_compiler.getlocal_WC_0(jit, ctx, asm)
- else CantCompile
- end
- end
-
# vm_core.h: pathobj_path
def pathobj_path(pathobj)
if pathobj.is_a?(String)