ruby-changes:69174
From: Maxime <ko1@a...>
Date: Thu, 21 Oct 2021 08:19:06 +0900 (JST)
Subject: [ruby-changes:69174] 9bd779cbf9 (master): Don't check if value is immediate if context has type info
https://git.ruby-lang.org/ruby.git/commit/?id=9bd779cbf9 From 9bd779cbf96fc6abc6135502d8580a4765d4b28d Mon Sep 17 00:00:00 2001 From: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@s...> Date: Thu, 22 Apr 2021 10:10:15 -0400 Subject: Don't check if value is immediate if context has type info --- yjit_codegen.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/yjit_codegen.c b/yjit_codegen.c index e835d3442d..4d4f182b6d 100644 --- a/yjit_codegen.c +++ b/yjit_codegen.c @@ -775,13 +775,20 @@ gen_set_ivar(jitstate_t *jit, ctx_t *ctx, const int max_chain_depth, VALUE compt https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L775 if (iv_index_tbl && rb_iv_index_tbl_lookup(iv_index_tbl, id, &ent)) { uint32_t ivar_index = ent->index; - x86opnd_t val_to_write = ctx_stack_pop(ctx, 1); + val_type_t val_type = ctx_get_opnd_type(ctx, OPND_STACK(0)); + x86opnd_t val_to_write = ctx_stack_opnd(ctx, 0); mov(cb, REG1, val_to_write); // Bail if the value to write is a heap object, because this needs a write barrier - ADD_COMMENT(cb, "guard value is immediate"); - test(cb, REG1, imm_opnd(RUBY_IMMEDIATE_MASK)); - jz_ptr(cb, COUNTED_EXIT(side_exit, setivar_val_heapobject)); + if (!val_type.is_imm) { + ADD_COMMENT(cb, "guard value is immediate"); + test(cb, REG1, imm_opnd(RUBY_IMMEDIATE_MASK)); + jz_ptr(cb, COUNTED_EXIT(side_exit, setivar_val_heapobject)); + ctx_set_opnd_type(ctx, OPND_STACK(0), TYPE_IMM); + } + + // Pop the value to write + ctx_stack_pop(ctx, 1); // Bail if this object is frozen ADD_COMMENT(cb, "guard self is not frozen"); -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/