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

ruby-changes:73209

From: Maxime <ko1@a...>
Date: Tue, 30 Aug 2022 01:00:26 +0900 (JST)
Subject: [ruby-changes:73209] c9484fe0c1 (master): Fix push/pop and frame setup/teardown with Kevin & Alan

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

From c9484fe0c1f2897521d08780a66fab89e5e2f5b1 Mon Sep 17 00:00:00 2001
From: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@s...>
Date: Tue, 19 Jul 2022 15:26:06 -0400
Subject: Fix push/pop and frame setup/teardown with Kevin & Alan

---
 yjit/src/backend/arm64/mod.rs | 12 ++++++++----
 yjit/src/codegen.rs           |  2 +-
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/yjit/src/backend/arm64/mod.rs b/yjit/src/backend/arm64/mod.rs
index 729ee06fa9..c48c03fe04 100644
--- a/yjit/src/backend/arm64/mod.rs
+++ b/yjit/src/backend/arm64/mod.rs
@@ -380,7 +380,7 @@ impl Assembler https://github.com/ruby/ruby/blob/trunk/yjit/src/backend/arm64/mod.rs#L380
         /// Emit a push instruction for the given operand by adding to the stack
         /// pointer and then storing the given value.
         fn emit_push(cb: &mut CodeBlock, opnd: A64Opnd) {
-            add(cb, C_SP_REG, C_SP_REG, C_SP_STEP);
+            sub(cb, C_SP_REG, C_SP_REG, C_SP_STEP);
             stur(cb, opnd, A64Opnd::new_mem(64, C_SP_REG, 0));
         }
 
@@ -388,7 +388,7 @@ impl Assembler https://github.com/ruby/ruby/blob/trunk/yjit/src/backend/arm64/mod.rs#L388
         /// and then subtracting from the stack pointer.
         fn emit_pop(cb: &mut CodeBlock, opnd: A64Opnd) {
             ldur(cb, opnd, A64Opnd::new_mem(64, C_SP_REG, 0));
-            sub(cb, C_SP_REG, C_SP_REG, C_SP_STEP);
+            add(cb, C_SP_REG, C_SP_REG, C_SP_STEP);
         }
 
         // dbg!(&self.insns);
@@ -428,10 +428,14 @@ impl Assembler https://github.com/ruby/ruby/blob/trunk/yjit/src/backend/arm64/mod.rs#L428
                 },
                 Op::FrameSetup => {
                     stp_pre(cb, X29, X30, A64Opnd::new_mem(128, C_SP_REG, -16));
-                    mov(cb, X29, C_SP_REG);
+
+                    // X29 (frame_pointer) = SP
+                    add(cb, X29, C_SP_REG, A64Opnd::new_uimm(0));
                 },
                 Op::FrameTeardown => {
-                    mov(cb, C_SP_REG, X29);
+                    // SP = X29 (frame pointer)
+                    add(cb, C_SP_REG, X29, A64Opnd::new_uimm(0));
+
                     ldp_post(cb, X29, X30, A64Opnd::new_mem(128, C_SP_REG, 16));
                 },
                 Op::Sub => {
diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs
index 654e6d7d63..fa6b4e41b0 100644
--- a/yjit/src/codegen.rs
+++ b/yjit/src/codegen.rs
@@ -6232,7 +6232,7 @@ impl CodegenGlobals { https://github.com/ruby/ruby/blob/trunk/yjit/src/codegen.rs#L6232
         let mut codegen_globals = CodegenGlobals {
             inline_cb: cb,
             outlined_cb: ocb,
-            leave_exit_code: leave_exit_code,
+            leave_exit_code,
             stub_exit_code: stub_exit_code,
             outline_full_cfunc_return_pos: cfunc_exit_code,
             global_inval_patches: Vec::new(),
-- 
cgit v1.2.1


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

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