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

ruby-changes:73128

From: Maxime <ko1@a...>
Date: Tue, 30 Aug 2022 00:53:44 +0900 (JST)
Subject: [ruby-changes:73128] c2fdec93a9 (master): First pass at porting gen_entry_prologue()

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

From c2fdec93a9d533e9e9eaabd96b6bf5210b211abf Mon Sep 17 00:00:00 2001
From: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@s...>
Date: Tue, 7 Jun 2022 16:57:16 -0400
Subject: First pass at porting gen_entry_prologue()

---
 yjit/src/codegen.rs | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs
index d6f8b34596..6584e0d127 100644
--- a/yjit/src/codegen.rs
+++ b/yjit/src/codegen.rs
@@ -610,30 +610,32 @@ pub fn gen_entry_prologue(cb: &mut CodeBlock, iseq: IseqPtr, insn_idx: u32) -> O https://github.com/ruby/ruby/blob/trunk/yjit/src/codegen.rs#L610
 
     let old_write_pos = cb.get_write_pos();
 
+    // TODO: figure out if this is actually beneficial for performance
     // Align the current write position to cache line boundaries
     cb.align_pos(64);
 
     let code_ptr = cb.get_write_ptr();
     add_comment(cb, "yjit entry");
 
-    push(cb, REG_CFP);
-    push(cb, REG_EC);
-    push(cb, REG_SP);
+    let mut asm = Assembler::new();
+
+    // FIXME
+    //push(cb, REG_CFP);
+    //push(cb, REG_EC);
+    //push(cb, REG_SP);
 
     // We are passed EC and CFP
-    mov(cb, REG_EC, C_ARG_REGS[0]);
-    mov(cb, REG_CFP, C_ARG_REGS[1]);
+    asm.mov(EC, C_ARG_REGS[0].into());
+    asm.mov(CFP, C_ARG_REGS[1].into());
 
     // Load the current SP from the CFP into REG_SP
-    mov(cb, REG_SP, mem_opnd(64, REG_CFP, RUBY_OFFSET_CFP_SP));
+    asm.mov(SP, Opnd::mem(64, CFP, RUBY_OFFSET_CFP_SP));
 
     // Setup cfp->jit_return
-    mov(
-        cb,
-        REG0,
-        code_ptr_opnd(CodegenGlobals::get_leave_exit_code()),
+    asm.mov(
+        Opnd::mem(64, CFP, RUBY_OFFSET_CFP_JIT_RETURN),
+        Opnd::const_ptr(CodegenGlobals::get_leave_exit_code().raw_ptr()),
     );
-    mov(cb, mem_opnd(64, REG_CFP, RUBY_OFFSET_CFP_JIT_RETURN), REG0);
 
     // We're compiling iseqs that we *expect* to start at `insn_idx`. But in
     // the case of optional parameters, the interpreter can set the pc to a
@@ -642,9 +644,15 @@ pub fn gen_entry_prologue(cb: &mut CodeBlock, iseq: IseqPtr, insn_idx: u32) -> O https://github.com/ruby/ruby/blob/trunk/yjit/src/codegen.rs#L644
     // compiled for is the same PC that the interpreter wants us to run with.
     // If they don't match, then we'll take a side exit.
     if unsafe { get_iseq_flags_has_opt(iseq) } {
-        gen_pc_guard(cb, iseq, insn_idx);
+
+        // FIXME
+        todo!();
+
+        //gen_pc_guard(cb, iseq, insn_idx);
     }
 
+    asm.compile(cb);
+
     // Verify MAX_PROLOGUE_SIZE
     assert!(cb.get_write_pos() - old_write_pos <= MAX_PROLOGUE_SIZE);
 
-- 
cgit v1.2.1


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

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