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

ruby-changes:73145

From: Maxime <ko1@a...>
Date: Tue, 30 Aug 2022 00:55:38 +0900 (JST)
Subject: [ruby-changes:73145] 4932a6ef75 (master): Fix small bug in x86_split

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

From 4932a6ef755ae4cc473666c8757f7c51ac8c2902 Mon Sep 17 00:00:00 2001
From: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@s...>
Date: Thu, 16 Jun 2022 11:20:54 -0400
Subject: Fix small bug in x86_split

---
 yjit/src/backend/tests.rs      | 19 +++++++++++++++++++
 yjit/src/backend/x86_64/mod.rs | 10 ++++++++--
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/yjit/src/backend/tests.rs b/yjit/src/backend/tests.rs
index 7b2f357455..902d9eeebc 100644
--- a/yjit/src/backend/tests.rs
+++ b/yjit/src/backend/tests.rs
@@ -223,3 +223,22 @@ fn test_jcc_label() https://github.com/ruby/ruby/blob/trunk/yjit/src/backend/tests.rs#L223
 
     asm.compile_with_num_regs(&mut cb, 1);
 }
+
+#[test]
+fn test_jcc_ptr()
+{
+    let (mut asm, mut cb) = setup_asm();
+
+    // FIXME
+    /*
+    let side_exit = Target::CodePtr((5 as *mut u8).into());
+    let not_mask = asm.not(Opnd::mem(32, EC, RUBY_OFFSET_EC_INTERRUPT_MASK));
+    asm.test(
+        Opnd::mem(32, EC, RUBY_OFFSET_EC_INTERRUPT_FLAG),
+        not_mask,
+    );
+    asm.jnz(side_exit);
+    */
+
+    asm.compile_with_num_regs(&mut cb, 1);
+}
diff --git a/yjit/src/backend/x86_64/mod.rs b/yjit/src/backend/x86_64/mod.rs
index e4f8745583..819dad1209 100644
--- a/yjit/src/backend/x86_64/mod.rs
+++ b/yjit/src/backend/x86_64/mod.rs
@@ -88,7 +88,9 @@ impl Assembler https://github.com/ruby/ruby/blob/trunk/yjit/src/backend/x86_64/mod.rs#L88
                         Opnd::InsnOut(out_idx) => {
                             if live_ranges[out_idx] > index {
                                 let opnd0 = asm.load(opnds[0]);
-                                asm.push_insn(op, vec![opnd0, opnds[1]], None);
+                                let mut new_opnds = vec![opnd0];
+                                new_opnds.extend_from_slice(&opnds[1..]);
+                                asm.push_insn(op, new_opnds, None);
                                 return;
                             }
                         },
@@ -96,7 +98,9 @@ impl Assembler https://github.com/ruby/ruby/blob/trunk/yjit/src/backend/x86_64/mod.rs#L98
                         // We have to load memory and register operands to avoid corrupting them
                         Opnd::Mem(_) | Opnd::Reg(_) => {
                             let opnd0 = asm.load(opnds[0]);
-                            asm.push_insn(op, vec![opnd0, opnds[1]], None);
+                            let mut new_opnds = vec![opnd0];
+                            new_opnds.extend_from_slice(&opnds[1..]);
+                            asm.push_insn(op, new_opnds, None);
                             return;
                         },
 
@@ -113,6 +117,8 @@ impl Assembler https://github.com/ruby/ruby/blob/trunk/yjit/src/backend/x86_64/mod.rs#L117
     /// Emit platform-specific machine code
     pub fn x86_emit(&mut self, cb: &mut CodeBlock) -> Vec<u32>
     {
+        //dbg!(&self.insns);
+
         // List of GC offsets
         let mut gc_offsets: Vec<u32> = Vec::new();
 
-- 
cgit v1.2.1


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

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