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

ruby-changes:69024

From: Alan <ko1@a...>
Date: Thu, 21 Oct 2021 08:19:06 +0900 (JST)
Subject: [ruby-changes:69024] 476a3f4be7 (master): Use a insn_opnd instead of a bool

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

From 476a3f4be783d021a4a8b9aacd9486498d155ec8 Mon Sep 17 00:00:00 2001
From: Alan Wu <XrXr@u...>
Date: Fri, 9 Apr 2021 18:47:27 -0400
Subject: Use a insn_opnd instead of a bool

---
 yjit_codegen.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/yjit_codegen.c b/yjit_codegen.c
index 5b95cc6ce5..7f012cdeff 100644
--- a/yjit_codegen.c
+++ b/yjit_codegen.c
@@ -728,7 +728,7 @@ enum { https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L728
 //   - receiver has the same class as CLASS_OF(comptime_receiver)
 //   - no stack push or pops to ctx since the entry to the codegen of the instruction being compiled
 static codegen_status_t
-gen_get_ivar(jitstate_t *jit, ctx_t *ctx, const int max_chain_depth, VALUE comptime_receiver, ID ivar_name, bool pop_receiver, uint8_t *side_exit)
+gen_get_ivar(jitstate_t *jit, ctx_t *ctx, const int max_chain_depth, VALUE comptime_receiver, ID ivar_name, insn_opnd_t reg0_opnd, uint8_t *side_exit)
 {
     VALUE comptime_val_klass = CLASS_OF(comptime_receiver);
     const ctx_t starting_context = *ctx; // make a copy for use with jit_chain_guard
@@ -752,7 +752,8 @@ gen_get_ivar(jitstate_t *jit, ctx_t *ctx, const int max_chain_depth, VALUE compt https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L752
     if (iv_index_tbl && rb_iv_index_tbl_lookup(iv_index_tbl, id, &ent)) {
         uint32_t ivar_index = ent->index;
 
-        if (pop_receiver) {
+        // Pop receiver if it's on the temp stack
+        if (!reg0_opnd.is_self) {
             (void)ctx_stack_pop(ctx, 1);
         }
 
@@ -847,7 +848,7 @@ gen_getinstancevariable(jitstate_t *jit, ctx_t *ctx) https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L848
 
     jit_guard_known_klass(jit, ctx, comptime_val_klass, OPND_SELF, GETIVAR_MAX_DEPTH, side_exit);
 
-    return gen_get_ivar(jit, ctx, GETIVAR_MAX_DEPTH, comptime_val, ivar_name, false, side_exit);
+    return gen_get_ivar(jit, ctx, GETIVAR_MAX_DEPTH, comptime_val, ivar_name, OPND_SELF, side_exit);
 }
 
 static codegen_status_t
@@ -1840,8 +1841,9 @@ gen_opt_send_without_block(jitstate_t* jit, ctx_t* ctx) https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L1841
 
     // Points to the receiver operand on the stack
     x86opnd_t recv = ctx_stack_opnd(ctx, argc);
+    insn_opnd_t recv_opnd = OPND_STACK(argc);
     mov(cb, REG0, recv);
-    if (!jit_guard_known_klass(jit, ctx, comptime_recv_klass, OPND_STACK(argc), OSWB_MAX_DEPTH, side_exit)) {
+    if (!jit_guard_known_klass(jit, ctx, comptime_recv_klass, recv_opnd, OSWB_MAX_DEPTH, side_exit)) {
         return YJIT_CANT_COMPILE;
     }
 
@@ -1893,7 +1895,7 @@ gen_opt_send_without_block(jitstate_t* jit, ctx_t* ctx) https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L1895
             mov(cb, REG0, recv);
 
             ID ivar_name = cme->def->body.attr.id;
-            return gen_get_ivar(jit, ctx, OSWB_MAX_DEPTH, comptime_recv, ivar_name, true, side_exit);
+            return gen_get_ivar(jit, ctx, OSWB_MAX_DEPTH, comptime_recv, ivar_name, recv_opnd, side_exit);
         }
     case VM_METHOD_TYPE_ATTRSET:
         GEN_COUNTER_INC(cb, oswb_ivar_set_method);
-- 
cgit v1.2.1


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

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