summaryrefslogtreecommitdiff
path: root/lib/ruby_vm
diff options
context:
space:
mode:
authorTakashi Kokubun <[email protected]>2023-02-07 23:32:13 -0800
committerTakashi Kokubun <[email protected]>2023-03-05 22:11:20 -0800
commit3ed7fa76e0dad293bf7d1b7a6672aa0f1589e0b2 (patch)
tree24adcbaa3f9699143cfff094624045c198680b55 /lib/ruby_vm
parentd11f960fb0243f2285f7f476c8b0fd244bbbdfc5 (diff)
Implement counted exits
Diffstat (limited to 'lib/ruby_vm')
-rw-r--r--lib/ruby_vm/mjit/insn_compiler.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/ruby_vm/mjit/insn_compiler.rb b/lib/ruby_vm/mjit/insn_compiler.rb
index 285ba41102..cfbd1cd65d 100644
--- a/lib/ruby_vm/mjit/insn_compiler.rb
+++ b/lib/ruby_vm/mjit/insn_compiler.rb
@@ -571,7 +571,7 @@ module RubyVM::MJIT
return CantCompile
end
asm.mov(:rax, [CFP, C.rb_control_frame_t.offsetof(:self)])
- guard_object_is_heap(asm, :rax, side_exit) # TODO: counted side exit
+ guard_object_is_heap(asm, :rax, counted_exit(side_exit, :getivar_not_heap))
case C.BUILTIN_TYPE(comptime_obj)
when C.T_OBJECT
@@ -589,7 +589,7 @@ module RubyVM::MJIT
asm.comment('guard shape')
asm.cmp(DwordPtr[:rax, C.rb_shape_id_offset], shape_id)
- asm.jne(side_exit) # TODO: counted side exit
+ asm.jne(counted_exit(side_exit, :getivar_polymorphic))
index = C.rb_shape_get_iv_index(shape_id, ivar_id)
if index
@@ -935,6 +935,13 @@ module RubyVM::MJIT
jit.side_exits[jit.pc] = @ocb.write(asm)
end
+ def counted_exit(side_exit, name)
+ asm = Assembler.new
+ asm.incr_counter(name)
+ asm.jmp(side_exit)
+ @ocb.write(asm)
+ end
+
def def_iseq_ptr(cme_def)
C.rb_iseq_check(cme_def.body.iseq.iseqptr)
end