diff options
author | Takashi Kokubun <takashikkbn@gmail.com> | 2023-01-07 13:39:33 -0800 |
---|---|---|
committer | Takashi Kokubun <takashikkbn@gmail.com> | 2023-03-05 22:11:20 -0800 |
commit | 850303ded65e2a949732a6a7d037079d610d22a6 (patch) | |
tree | dc6acf8c74bcf75db67b9a56f4e0c6cf070289d4 /lib | |
parent | 62d36dd1277bdfeac609f89bc64589e8856421b8 (diff) | |
download | ruby-850303ded65e2a949732a6a7d037079d610d22a6.tar.gz |
Implement putself
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ruby_vm/mjit/insn_compiler.rb | 17 | ||||
-rw-r--r-- | lib/ruby_vm/mjit/stats.rb | 2 |
2 files changed, 14 insertions, 5 deletions
diff --git a/lib/ruby_vm/mjit/insn_compiler.rb b/lib/ruby_vm/mjit/insn_compiler.rb index 19bb607637..c13287f74c 100644 --- a/lib/ruby_vm/mjit/insn_compiler.rb +++ b/lib/ruby_vm/mjit/insn_compiler.rb @@ -17,7 +17,7 @@ module RubyVM::MJIT asm.incr_counter(:mjit_insns_count) asm.comment("Insn: #{insn.name}") - # 6/101 + # 7/101 case insn.name # nop # getlocal @@ -37,7 +37,7 @@ module RubyVM::MJIT # getglobal # setglobal when :putnil then putnil(jit, ctx, asm) - # putself + when :putself then putself(jit, ctx, asm) when :putobject then putobject(jit, ctx, asm) # putspecialobject # putstring @@ -153,7 +153,16 @@ module RubyVM::MJIT KeepCompiling end - # putself + # @param jit [RubyVM::MJIT::JITState] + # @param ctx [RubyVM::MJIT::Context] + # @param asm [RubyVM::MJIT::Assembler] + def putself(jit, ctx, asm) + raise 'sp_offset != stack_size' if ctx.sp_offset != ctx.stack_size # TODO: handle this + asm.mov(:rax, [CFP, C.rb_control_frame_t.offsetof(:self)]) + asm.mov([SP, C.VALUE.size * ctx.stack_size], :rax) + ctx.stack_push(1) + KeepCompiling + end # @param jit [RubyVM::MJIT::JITState] # @param ctx [RubyVM::MJIT::Context] @@ -260,7 +269,7 @@ module RubyVM::MJIT ctx.stack_pop(1) # Set stubs - # TODO: reuse already-compiled blocks + # TODO: reuse already-compiled blocks jumped from different blocks branch_stub = BranchStub.new( iseq: jit.iseq, ctx: ctx.dup, diff --git a/lib/ruby_vm/mjit/stats.rb b/lib/ruby_vm/mjit/stats.rb index 684ca61f20..b372ffa07e 100644 --- a/lib/ruby_vm/mjit/stats.rb +++ b/lib/ruby_vm/mjit/stats.rb @@ -38,7 +38,7 @@ module RubyVM::MJIT $stderr.puts "total_insns_count: #{format('%10d', stats[:total_insns_count])}" if stats.key?(:total_insns_count) $stderr.puts "vm_insns_count: #{format('%10d', stats[:vm_insns_count])}" if stats.key?(:vm_insns_count) $stderr.puts "mjit_insns_count: #{format('%10d', stats[:mjit_insns_count])}" - $stderr.puts "ratio_in_yjit: #{format('%9.1f', stats[:ratio_in_mjit])}%" if stats.key?(:ratio_in_mjit) + $stderr.puts "ratio_in_mjit: #{format('%9.1f', stats[:ratio_in_mjit])}%" if stats.key?(:ratio_in_mjit) print_exit_counts(stats) end |