Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YJIT: Add counters for ivar exits #7266

Merged
merged 1 commit into from Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion yjit/src/codegen.rs
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 2 additions & 0 deletions yjit/src/stats.rs
Expand Up @@ -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,
Expand All @@ -272,6 +273,7 @@ make_counters! {
setivar_not_object,
setivar_frozen,
setivar_megamorphic,
setivar_too_complex,

oaref_argc_not_one,
oaref_arg_not_fixnum,
Expand Down