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

ruby-changes:69057

From: John <ko1@a...>
Date: Thu, 21 Oct 2021 08:20:42 +0900 (JST)
Subject: [ruby-changes:69057] 641ef34dde (master): Allow upgrading first N types when stack is large

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

From 641ef34ddec2f8dd9af951f419fb084befea8175 Mon Sep 17 00:00:00 2001
From: John Hawthorn <john@h...>
Date: Sun, 1 Aug 2021 13:05:51 -0700
Subject: Allow upgrading first N types when stack is large

---
 yjit_core.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/yjit_core.c b/yjit_core.c
index 0d9464e0bd..45386dea23 100644
--- a/yjit_core.c
+++ b/yjit_core.c
@@ -175,13 +175,14 @@ void ctx_upgrade_opnd_type(ctx_t* ctx, insn_opnd_t opnd, val_type_t type) https://github.com/ruby/ruby/blob/trunk/yjit_core.c#L175
         return;
     }
 
-    if (ctx->stack_size >= MAX_TEMP_TYPES)
+    RUBY_ASSERT(opnd.idx < ctx->stack_size);
+    int stack_idx = ctx->stack_size - 1 - opnd.idx;
+
+    // If outside of tracked range, do nothing
+    if (stack_idx >= MAX_TEMP_TYPES)
         return;
 
-    RUBY_ASSERT(opnd.idx < ctx->stack_size);
-    int stack_index = ctx->stack_size - 1 - opnd.idx;
-    RUBY_ASSERT(stack_index < MAX_TEMP_TYPES);
-    temp_mapping_t mapping = ctx->temp_mapping[stack_index];
+    temp_mapping_t mapping = ctx->temp_mapping[stack_idx];
 
     switch (mapping.kind)
     {
@@ -190,7 +191,7 @@ void ctx_upgrade_opnd_type(ctx_t* ctx, insn_opnd_t opnd, val_type_t type) https://github.com/ruby/ruby/blob/trunk/yjit_core.c#L191
         break;
 
         case TEMP_STACK:
-        UPGRADE_TYPE(ctx->temp_types[stack_index], type);
+        UPGRADE_TYPE(ctx->temp_types[stack_idx], type);
         break;
 
         case TEMP_LOCAL:
-- 
cgit v1.2.1


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

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