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

ruby-changes:68657

From: Alan <ko1@a...>
Date: Thu, 21 Oct 2021 08:11:47 +0900 (JST)
Subject: [ruby-changes:68657] 1ef2887bc1 (master): MicroJIT: Use R9 in generated code for Ruby stack pointer

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

From 1ef2887bc118cc810d2103940504a802dcd74d45 Mon Sep 17 00:00:00 2001
From: Alan Wu <XrXr@u...>
Date: Mon, 19 Oct 2020 18:04:16 -0400
Subject: MicroJIT: Use R9 in generated code for Ruby stack pointer

---
 ujit_compile.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/ujit_compile.c b/ujit_compile.c
index 1bb7b407c8..a55d923a60 100644
--- a/ujit_compile.c
+++ b/ujit_compile.c
@@ -101,7 +101,7 @@ Get an operand for the adjusted stack pointer address https://github.com/ruby/ruby/blob/trunk/ujit_compile.c#L101
 x86opnd_t ctx_sp_opnd(ctx_t* ctx, size_t n)
 {
     int32_t offset = (ctx->stack_diff) * 8;
-    return mem_opnd(64, RSI, offset);
+    return mem_opnd(64, R9, offset);
 }
 
 /*
@@ -114,7 +114,7 @@ x86opnd_t ctx_stack_push(ctx_t* ctx, size_t n) https://github.com/ruby/ruby/blob/trunk/ujit_compile.c#L114
 
     // SP points just above the topmost value
     int32_t offset = (ctx->stack_diff - 1) * 8;
-    return mem_opnd(64, RSI, offset);
+    return mem_opnd(64, R9, offset);
 }
 
 /*
@@ -125,7 +125,7 @@ x86opnd_t ctx_stack_pop(ctx_t* ctx, size_t n) https://github.com/ruby/ruby/blob/trunk/ujit_compile.c#L125
 {
     // SP points just above the topmost value
     int32_t offset = (ctx->stack_diff - 1) * 8;
-    x86opnd_t top = mem_opnd(64, RSI, offset);
+    x86opnd_t top = mem_opnd(64, R9, offset);
 
     ctx->stack_diff -= n;
 
@@ -136,7 +136,7 @@ x86opnd_t ctx_stack_opnd(ctx_t* ctx, int32_t idx) https://github.com/ruby/ruby/blob/trunk/ujit_compile.c#L136
 {
     // SP points just above the topmost value
     int32_t offset = (ctx->stack_diff - 1 - idx) * 8;
-    x86opnd_t opnd = mem_opnd(64, RSI, offset);
+    x86opnd_t opnd = mem_opnd(64, R9, offset);
 
     return opnd;
 }
@@ -159,8 +159,8 @@ ujit_gen_exit(codeblock_t* cb, ctx_t* ctx, VALUE* exit_pc) https://github.com/ruby/ruby/blob/trunk/ujit_compile.c#L159
     if (ctx->stack_diff != 0)
     {
         x86opnd_t stack_pointer = ctx_sp_opnd(ctx, 1);
-        lea(cb, RSI, stack_pointer);
-        mov(cb, mem_opnd(64, RDI, 8), RSI);
+        lea(cb, R9, stack_pointer);
+        mov(cb, mem_opnd(64, RDI, 8), R9);
     }
 
     // Directly return the next PC, which is a constant
@@ -205,7 +205,7 @@ Eventually, this will handle multiple instructions in a sequence https://github.com/ruby/ruby/blob/trunk/ujit_compile.c#L205
 MicroJIT code gets a pointer to the cfp as the first argument in RDI
 See rb_ujit_empty_func(rb_control_frame_t *cfp) in iseq.c
 
-Throughout the generated code, we store the current stack pointer in RSI
+Throughout the generated code, we store the current stack pointer in R9
 
 System V ABI reference:
 https://wiki.osdev.org/System_V_ABI#x86-64
@@ -270,8 +270,8 @@ ujit_compile_insn(const rb_iseq_t *iseq, unsigned int insn_idx, unsigned int* ne https://github.com/ruby/ruby/blob/trunk/ujit_compile.c#L270
         {
             ujit_gen_entry(cb);
 
-            // Load the current SP from the CFP into RSI
-            mov(cb, RSI, mem_opnd(64, RDI, 8));
+            // Load the current SP from the CFP into R9
+            mov(cb, R9, mem_opnd(64, RDI, 8));
         }
 
         // Call the code generation function
@@ -659,7 +659,7 @@ gen_opt_send_without_block(codeblock_t* cb, codeblock_t* ocb, ctx_t* ctx) https://github.com/ruby/ruby/blob/trunk/ujit_compile.c#L659
 
     // Save the MicroJIT registers
     push(cb, RDI);
-    push(cb, RSI);
+    push(cb, R9);
 
 
 
@@ -671,7 +671,7 @@ gen_opt_send_without_block(codeblock_t* cb, codeblock_t* ocb, ctx_t* ctx) https://github.com/ruby/ruby/blob/trunk/ujit_compile.c#L671
 
 
     // Restore MicroJIT registers
-    pop(cb, RSI);
+    pop(cb, R9);
     pop(cb, RDI);
 
 
-- 
cgit v1.2.1


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

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