ruby-changes:68724
From: Maxime <ko1@a...>
Date: Thu, 21 Oct 2021 08:12:36 +0900 (JST)
Subject: [ruby-changes:68724] e7909467df (master): Eliminate type checks in opt_lt
https://git.ruby-lang.org/ruby.git/commit/?id=e7909467df From e7909467df181641b1753512cba3f49c0f0f6583 Mon Sep 17 00:00:00 2001 From: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@s...> Date: Mon, 25 Jan 2021 16:42:42 -0500 Subject: Eliminate type checks in opt_lt --- ujit_codegen.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ujit_codegen.c b/ujit_codegen.c index a38ecf18bb..e10e276fe2 100644 --- a/ujit_codegen.c +++ b/ujit_codegen.c @@ -532,14 +532,20 @@ gen_opt_lt(jitstate_t* jit, ctx_t* ctx) https://github.com/ruby/ruby/blob/trunk/ujit_codegen.c#L532 jnz_ptr(cb, side_exit); // Get the operands and destination from the stack + int arg1_type = ctx_get_top_type(ctx); x86opnd_t arg1 = ctx_stack_pop(ctx, 1); + int arg0_type = ctx_get_top_type(ctx); x86opnd_t arg0 = ctx_stack_pop(ctx, 1); // If not fixnums, fall back - test(cb, arg0, imm_opnd(RUBY_FIXNUM_FLAG)); - jz_ptr(cb, side_exit); - test(cb, arg1, imm_opnd(RUBY_FIXNUM_FLAG)); - jz_ptr(cb, side_exit); + if (arg0_type != T_FIXNUM) { + test(cb, arg0, imm_opnd(RUBY_FIXNUM_FLAG)); + jz_ptr(cb, side_exit); + } + if (arg1_type != T_FIXNUM) { + test(cb, arg1, imm_opnd(RUBY_FIXNUM_FLAG)); + jz_ptr(cb, side_exit); + } // Compare the arguments mov(cb, REG0, arg0); -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/