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

ruby-changes:68926

From: Alan <ko1@a...>
Date: Thu, 21 Oct 2021 08:16:36 +0900 (JST)
Subject: [ruby-changes:68926] 4442029ec4 (master): move assert. opnd.idx doesn't make sense for OPND_SELF

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

From 4442029ec496754fcad38fa05c3d03553a38107e Mon Sep 17 00:00:00 2001
From: Alan Wu <XrXr@u...>
Date: Fri, 9 Apr 2021 12:16:56 -0400
Subject: move assert. opnd.idx doesn't make sense for OPND_SELF

---
 yjit_codegen.c | 4 ++--
 yjit_core.c    | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/yjit_codegen.c b/yjit_codegen.c
index 57efe6d3a8..5b95cc6ce5 100644
--- a/yjit_codegen.c
+++ b/yjit_codegen.c
@@ -726,7 +726,7 @@ enum { https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L726
 // Preconditions:
 //   - receiver is in REG0
 //   - receiver has the same class as CLASS_OF(comptime_receiver)
-//   - ctx has not been modified since entry to the codegen of the instruction being compiled
+//   - 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)
 {
@@ -781,7 +781,7 @@ 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#L781
             mov(cb, out_opnd, REG1);
         }
         else {
-            // Compile value is *not* embeded.
+            // Compile time value is *not* embeded.
 
             // Guard that value is *not* embedded
             // See ROBJECT_IVPTR() from include/ruby/internal/core/robject.h
diff --git a/yjit_core.c b/yjit_core.c
index 68d4f976a3..8657f05ca3 100644
--- a/yjit_core.c
+++ b/yjit_core.c
@@ -137,14 +137,13 @@ Get the type of an instruction operand https://github.com/ruby/ruby/blob/trunk/yjit_core.c#L137
 val_type_t
 ctx_get_opnd_type(const ctx_t* ctx, insn_opnd_t opnd)
 {
-    RUBY_ASSERT(opnd.idx < ctx->stack_size);
-
     if (opnd.is_self)
         return ctx->self_type;
 
     if (ctx->stack_size > MAX_TEMP_TYPES)
         return TYPE_UNKNOWN;
 
+    RUBY_ASSERT(opnd.idx < ctx->stack_size);
     temp_mapping_t mapping = ctx->temp_mapping[ctx->stack_size - 1 - opnd.idx];
 
     switch (mapping.kind)
-- 
cgit v1.2.1


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

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