diff options
author | Alan Wu <XrXr@users.noreply.github.com> | 2021-08-27 15:41:24 -0400 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2021-10-20 18:19:39 -0400 |
commit | ed85e8a33ac13c75967f8a893bb5de22b729c1ef (patch) | |
tree | 3a53abc8c865094c2469cd1723d40e9af304eda1 | |
parent | c210fade27c2f39f078c9b1aec71a05532fb832b (diff) | |
download | ruby-ed85e8a33ac13c75967f8a893bb5de22b729c1ef.tar.gz |
Use reg1 in GEN_COUNTER_INC to avoid clobbering RAX
-rw-r--r-- | yjit_codegen.c | 8 |
1 files 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 _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. |