ruby-changes:68641
From: Maxime <ko1@a...>
Date: Thu, 21 Oct 2021 08:11:26 +0900 (JST)
Subject: [ruby-changes:68641] e677ca4af0 (master): Fixed is-object check in opt_send_without_block
https://git.ruby-lang.org/ruby.git/commit/?id=e677ca4af0 From e677ca4af08070a73a30816dfe6e80c776f91d25 Mon Sep 17 00:00:00 2001 From: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@s...> Date: Fri, 16 Oct 2020 16:57:56 -0400 Subject: Fixed is-object check in opt_send_without_block --- ujit_compile.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ujit_compile.c b/ujit_compile.c index e25a400804..1d349b5664 100644 --- a/ujit_compile.c +++ b/ujit_compile.c @@ -541,12 +541,17 @@ gen_opt_send_without_block(codeblock_t* cb, codeblock_t* ocb, ctx_t* ctx) https://github.com/ruby/ruby/blob/trunk/ujit_compile.c#L541 //print_str(cb, rb_id2name(mid)); //print_ptr(cb, RCX); + // IDEA: may be able to eliminate this in some cases if we know the previous instruction? // TODO: guard_is_object() helper function? + // FIXME: an object can have QNil bit 1000 set + // need to check for immediate mask, Qnil and Qfalse // Check that the receiver is an object - cmp(cb, RCX, imm_opnd(0)); - je_ptr(cb, side_exit); - test(cb, RCX, imm_opnd(RUBY_IMMEDIATE_MASK | RUBY_Qnil)); + test(cb, RCX, imm_opnd(RUBY_IMMEDIATE_MASK)); jnz_ptr(cb, side_exit); + cmp(cb, RCX, imm_opnd(Qfalse)); + je_ptr(cb, side_exit); + cmp(cb, RCX, imm_opnd(Qnil)); + je_ptr(cb, side_exit); // Pointer to the klass field of the receiver &(recv->klass) x86opnd_t klass_opnd = mem_opnd(64, RCX, offsetof(struct RBasic, klass)); -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/