YJIT: Add counters for ivar exits (#7266)

This commit is contained in:
Takashi Kokubun 2023-02-09 07:16:17 -08:00 committed by GitHub
parent da4464b824
commit e2b6289bab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
Notes: git 2023-02-09 15:16:42 +00:00
Merged-By: maximecb <maximecb@ruby-lang.org>
2 changed files with 9 additions and 1 deletions

View File

@ -1977,6 +1977,7 @@ fn gen_get_ivar(
) -> CodegenStatus {
// If the object has a too complex shape, we exit
if comptime_receiver.shape_too_complex() {
gen_counter_incr!(asm, getivar_too_complex);
return CantCompile;
}
@ -2209,8 +2210,13 @@ fn gen_setinstancevariable(
// If the comptime receiver is frozen, writing an IV will raise an exception
// and we don't want to JIT code to deal with that situation.
if comptime_receiver.is_frozen() {
gen_counter_incr!(asm, setivar_frozen);
return CantCompile;
}
// If the object has a too complex shape, we will also exit
if comptime_receiver.is_frozen() || comptime_receiver.shape_too_complex() {
if comptime_receiver.shape_too_complex() {
gen_counter_incr!(asm, setivar_too_complex);
return CantCompile;
}

View File

@ -264,6 +264,7 @@ make_counters! {
getivar_se_self_not_heap,
getivar_idx_out_of_range,
getivar_megamorphic,
getivar_too_complex,
setivar_se_self_not_heap,
setivar_idx_out_of_range,
@ -272,6 +273,7 @@ make_counters! {
setivar_not_object,
setivar_frozen,
setivar_megamorphic,
setivar_too_complex,
oaref_argc_not_one,
oaref_arg_not_fixnum,