diff options
author | eileencodes <eileencodes@gmail.com> | 2021-12-01 14:01:34 -0500 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2021-12-03 09:45:58 -0800 |
commit | 54ca530dbe39f389da2b5972a574460a3665eeff (patch) | |
tree | cf6917afe40bc58637730e9ddea1e7e2d8c2b504 /yjit_codegen.c | |
parent | 7fc9d83bd1c1b8c44790b6af0f81f3b7364270ca (diff) |
YJIT: Add ivar counter exits
On Rails we're seeing a lot of exits for ivars in the Active Record
tests. In trying to track them down it was hard to find what code is
exiting.
This change adds a counted exit for when an object is "megamorphic". In
these cases there are too many specializations in the Ruby code so YJIT
exits.
Co-authored-by: Aaron Patterson tenderlove@ruby-lang.org
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5197
Diffstat (limited to 'yjit_codegen.c')
-rw-r--r-- | yjit_codegen.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/yjit_codegen.c b/yjit_codegen.c index ed2d7bbcdc..061cd1ead7 100644 --- a/yjit_codegen.c +++ b/yjit_codegen.c @@ -1735,7 +1735,7 @@ gen_get_ivar(jitstate_t *jit, ctx_t *ctx, const int max_chain_depth, VALUE compt ADD_COMMENT(cb, "guard embedded getivar"); x86opnd_t flags_opnd = member_opnd(REG0, struct RBasic, flags); test(cb, flags_opnd, imm_opnd(ROBJECT_EMBED)); - jit_chain_guard(JCC_JZ, jit, &starting_context, max_chain_depth, side_exit); + jit_chain_guard(JCC_JZ, jit, &starting_context, max_chain_depth, COUNTED_EXIT(jit, side_exit, getivar_megamorphic)); // Load the variable x86opnd_t ivar_opnd = mem_opnd(64, REG0, offsetof(struct RObject, as.ary) + ivar_index * SIZEOF_VALUE); @@ -1758,7 +1758,7 @@ gen_get_ivar(jitstate_t *jit, ctx_t *ctx, const int max_chain_depth, VALUE compt ADD_COMMENT(cb, "guard extended getivar"); x86opnd_t flags_opnd = member_opnd(REG0, struct RBasic, flags); test(cb, flags_opnd, imm_opnd(ROBJECT_EMBED)); - jit_chain_guard(JCC_JNZ, jit, &starting_context, max_chain_depth, side_exit); + jit_chain_guard(JCC_JNZ, jit, &starting_context, max_chain_depth, COUNTED_EXIT(jit, side_exit, getivar_megamorphic)); // check that the extended table is big enough if (ivar_index >= ROBJECT_EMBED_LEN_MAX + 1) { |