aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ruby_vm
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-12-18 23:45:17 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2023-03-05 22:11:20 -0800
commit396d5754519e044658c107138d949bef006e8a12 (patch)
tree390f19d94ce443aa52aee2af794be02b192684bb /lib/ruby_vm
parent2700d35b7ba0543c36cf9a07e0459483a1272ea6 (diff)
downloadruby-396d5754519e044658c107138d949bef006e8a12.tar.gz
Implement mov encoding properly
Diffstat (limited to 'lib/ruby_vm')
-rw-r--r--lib/ruby_vm/mjit/compiler.rb35
1 files changed, 17 insertions, 18 deletions
diff --git a/lib/ruby_vm/mjit/compiler.rb b/lib/ruby_vm/mjit/compiler.rb
index c9dadf6790..75314501c1 100644
--- a/lib/ruby_vm/mjit/compiler.rb
+++ b/lib/ruby_vm/mjit/compiler.rb
@@ -26,8 +26,7 @@ module RubyVM::MJIT
return if iseq.body.location.label == '<main>'
iseq.body.jit_func = compile_block(iseq)
rescue Exception => e
- # TODO: check --mjit-verbose
- $stderr.puts e.full_message
+ $stderr.puts e.full_message # TODO: check verbose
end
def write_addr
@@ -36,6 +35,20 @@ module RubyVM::MJIT
private
+ def compile(asm)
+ start_addr = write_addr
+
+ C.mjit_mark_writable
+ @write_pos += asm.compile(start_addr)
+ C.mjit_mark_executable
+
+ end_addr = write_addr
+ if C.mjit_opts.dump_disasm && start_addr < end_addr
+ dump_disasm(start_addr, end_addr)
+ end
+ start_addr
+ end
+
# ec -> RDI, cfp -> RSI
def compile_block(iseq)
addr = write_addr
@@ -56,26 +69,12 @@ module RubyVM::MJIT
def compile_insn(asm, insn)
case insn.name
- when :putnil then @insn_compiler.on_putnil(asm)
- when :leave then @insn_compiler.on_leave(asm)
+ when :putnil then @insn_compiler.putnil(asm)
+ when :leave then @insn_compiler.leave(asm)
else raise NotImplementedError, "insn '#{insn.name}' is not supported yet"
end
end
- def compile(asm)
- start_addr = write_addr
-
- C.mjit_mark_writable
- @write_pos += asm.compile(start_addr)
- C.mjit_mark_executable
-
- end_addr = write_addr
- if C.mjit_opts.dump_disasm && start_addr < end_addr
- dump_disasm(start_addr, end_addr)
- end
- start_addr
- end
-
def decode_insn(encoded)
INSNS.fetch(C.rb_vm_insn_decode(encoded))
end