ruby-changes:68948
From: Maxime <ko1@a...>
Date: Thu, 21 Oct 2021 08:19:25 +0900 (JST)
Subject: [ruby-changes:68948] 03da234eb0 (master): Add T_OBJECT check to getivar
https://git.ruby-lang.org/ruby.git/commit/?id=03da234eb0 From 03da234eb019902176f8d456fceaefee11858a59 Mon Sep 17 00:00:00 2001 From: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@s...> Date: Tue, 18 May 2021 15:37:11 -0400 Subject: Add T_OBJECT check to getivar --- yjit_codegen.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/yjit_codegen.c b/yjit_codegen.c index e04a065061..33efb927ec 100644 --- a/yjit_codegen.c +++ b/yjit_codegen.c @@ -1010,7 +1010,15 @@ gen_get_ivar(jitstate_t *jit, ctx_t *ctx, const int max_chain_depth, VALUE compt https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L1010 jit_jump_to_next_insn(jit, ctx); return YJIT_END_BLOCK; } - RUBY_ASSERT(BUILTIN_TYPE(comptime_receiver) == T_OBJECT); // because we checked the allocator + + // FIXME: we should be able to eliminate this check with object shapes + // Guard that the receiver is T_OBJECT + // #define RB_BUILTIN_TYPE(x) (int)(((struct RBasic*)(x))->flags & RUBY_T_MASK) + ADD_COMMENT(cb, "guard receiver is T_OBJECT"); + mov(cb, REG1, member_opnd(REG0, struct RBasic, flags)); + and(cb, REG1, imm_opnd(RUBY_T_MASK)); + cmp(cb, REG1, imm_opnd(T_OBJECT)); + jit_chain_guard(JCC_JNE, jit, &starting_context, max_chain_depth, side_exit); // ID for the name of the ivar ID id = ivar_name; -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/