[前][次][番号順一覧][スレッド一覧]

ruby-changes:73216

From: Maxime <ko1@a...>
Date: Tue, 30 Aug 2022 01:03:01 +0900 (JST)
Subject: [ruby-changes:73216] b1dbc5f1a6 (master): Fix crash in newhash ccall

https://git.ruby-lang.org/ruby.git/commit/?id=b1dbc5f1a6

From b1dbc5f1a683e4727f463c0a5a3e0195e5c2cc7f Mon Sep 17 00:00:00 2001
From: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@s...>
Date: Thu, 21 Jul 2022 12:43:54 -0400
Subject: Fix crash in newhash ccall

---
 yjit/src/backend/arm64/mod.rs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/yjit/src/backend/arm64/mod.rs b/yjit/src/backend/arm64/mod.rs
index 25e155dafa..1f93441c03 100644
--- a/yjit/src/backend/arm64/mod.rs
+++ b/yjit/src/backend/arm64/mod.rs
@@ -121,7 +121,9 @@ impl Assembler https://github.com/ruby/ruby/blob/trunk/yjit/src/backend/arm64/mod.rs#L121
                     // For each of the operands we're going to first load them
                     // into a register and then move them into the correct
                     // argument register.
-                    for (idx, opnd) in opnds.into_iter().enumerate() {
+                    // Note: the iteration order is reversed to avoid corrupting x0,
+                    // which is both the return value and first argument register
+                    for (idx, opnd) in opnds.into_iter().enumerate().rev() {
                         let value = asm.load(opnd);
                         asm.mov(Opnd::Reg(C_ARG_REGREGS[idx]), value);
                     }
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]