This commit is contained in:
Takashi Kokubun 2023-02-07 23:32:13 -08:00
Родитель d11f960fb0
Коммит 3ed7fa76e0
3 изменённых файлов: 13 добавлений и 4 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -119,8 +119,9 @@ MJIT_RUNTIME_COUNTERS(
send_kwarg,
send_tailcall,
getivar_not_embedded,
getivar_not_heap,
getivar_not_t_object,
getivar_polymorphic,
getivar_special_const,
getivar_too_complex,

Просмотреть файл

@ -864,8 +864,9 @@ module RubyVM::MJIT # :nodoc: all
send_args_splat: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), send_args_splat)")],
send_kwarg: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), send_kwarg)")],
send_tailcall: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), send_tailcall)")],
getivar_not_embedded: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), getivar_not_embedded)")],
getivar_not_heap: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), getivar_not_heap)")],
getivar_not_t_object: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), getivar_not_t_object)")],
getivar_polymorphic: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), getivar_polymorphic)")],
getivar_special_const: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), getivar_special_const)")],
getivar_too_complex: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), getivar_too_complex)")],
compiled_block_count: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), compiled_block_count)")],