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

ruby-changes:73180

From: Maxime <ko1@a...>
Date: Tue, 30 Aug 2022 00:58:01 +0900 (JST)
Subject: [ruby-changes:73180] aab53e2868 (master): Add test for direct jump to a code pointer

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

From aab53e2868f7b1a28915f181e0875b990c07b8c9 Mon Sep 17 00:00:00 2001
From: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@s...>
Date: Wed, 6 Jul 2022 15:09:08 -0400
Subject: Add test for direct jump to a code pointer

---
 yjit/src/backend/tests.rs | 12 ++++++++++++
 yjit/src/codegen.rs       |  7 +++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/yjit/src/backend/tests.rs b/yjit/src/backend/tests.rs
index 6545d01517..9ec986f734 100644
--- a/yjit/src/backend/tests.rs
+++ b/yjit/src/backend/tests.rs
@@ -250,6 +250,18 @@ fn test_jcc_ptr() https://github.com/ruby/ruby/blob/trunk/yjit/src/backend/tests.rs#L250
     asm.compile_with_num_regs(&mut cb, 1);
 }
 
+/// Direct jump to a stub e.g. for deferred compilation
+#[test]
+fn test_jmp_ptr()
+{
+    let (mut asm, mut cb) = setup_asm();
+
+    let stub = Target::CodePtr((5 as *mut u8).into());
+    asm.jmp(stub);
+
+    asm.compile_with_num_regs(&mut cb, 0);
+}
+
 #[test]
 fn test_jo()
 {
diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs
index c99fef5b0c..656fc63c0c 100644
--- a/yjit/src/codegen.rs
+++ b/yjit/src/codegen.rs
@@ -1100,6 +1100,7 @@ fn gen_adjuststack( https://github.com/ruby/ruby/blob/trunk/yjit/src/codegen.rs#L1100
     KeepCompiling
 }
 
+
 /*
 fn gen_opt_plus(
     jit: &mut JITState,
@@ -1134,7 +1135,7 @@ fn gen_opt_plus( https://github.com/ruby/ruby/blob/trunk/yjit/src/codegen.rs#L1135
         // Add arg0 + arg1 and test for overflow
         let arg0_untag = asm.sub(arg0, Opnd::Imm(1));
         let out_val = asm.add(arg0_untag, arg1);
-        asm.jo(side_exit);
+        asm.jo(side_exit.into());
 
         // Push the output on the stack
         let dst = ctx.stack_push(Type::Fixnum);
@@ -1142,12 +1143,14 @@ fn gen_opt_plus( https://github.com/ruby/ruby/blob/trunk/yjit/src/codegen.rs#L1143
 
         KeepCompiling
     } else {
-        todo!();
+        todo!("opt_plus send path");
         //gen_opt_send_without_block(jit, ctx, cb, ocb)
     }
 }
 */
 
+
+
 // new array initialized from top N values
 fn gen_newarray(
     jit: &mut JITState,
-- 
cgit v1.2.1


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

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