ruby-changes:69078
From: Alan <ko1@a...>
Date: Thu, 21 Oct 2021 08:20:46 +0900 (JST)
Subject: [ruby-changes:69078] ed85e8a33a (master): Use reg1 in GEN_COUNTER_INC to avoid clobbering RAX
https://git.ruby-lang.org/ruby.git/commit/?id=ed85e8a33a From ed85e8a33ac13c75967f8a893bb5de22b729c1ef Mon Sep 17 00:00:00 2001 From: Alan Wu <XrXr@u...> Date: Fri, 27 Aug 2021 15:41:24 -0400 Subject: Use reg1 in GEN_COUNTER_INC to avoid clobbering RAX --- yjit_codegen.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/yjit_codegen.c b/yjit_codegen.c index 0abf2376c6..a42bd1b871 100644 --- a/yjit_codegen.c +++ b/yjit_codegen.c @@ -306,9 +306,11 @@ static void https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L306 _gen_counter_inc(codeblock_t *cb, int64_t *counter) { if (!rb_yjit_opts.gen_stats) return; - mov(cb, REG0, const_ptr_opnd(counter)); - cb_write_lock_prefix(cb); // for ractors. - add(cb, mem_opnd(64, REG0, 0), imm_opnd(1)); + + // Use REG1 because there might be return value in REG0 + mov(cb, REG1, const_ptr_opnd(counter)); + cb_write_lock_prefix(cb); // for ractors. + add(cb, mem_opnd(64, REG1, 0), imm_opnd(1)); } // Increment a counter then take an existing side exit. -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/