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

ruby-changes:69105

From: John <ko1@a...>
Date: Thu, 21 Oct 2021 08:20:51 +0900 (JST)
Subject: [ruby-changes:69105] 250b97da9b (master): Make ctx_diff aware of mappings

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

From 250b97da9be7d8d62be8055249497d9a93d83302 Mon Sep 17 00:00:00 2001
From: John Hawthorn <john@h...>
Date: Tue, 27 Jul 2021 23:35:01 -0700
Subject: Make ctx_diff aware of mappings

---
 yjit_core.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/yjit_core.c b/yjit_core.c
index c4db3de854..f1a57a01ae 100644
--- a/yjit_core.c
+++ b/yjit_core.c
@@ -355,9 +355,22 @@ int ctx_diff(const ctx_t* src, const ctx_t* dst) https://github.com/ruby/ruby/blob/trunk/yjit_core.c#L355
     // For each value on the temp stack
     for (size_t i = 0; i < src->stack_size; ++i)
     {
-        val_type_t t_src = ctx_get_opnd_type(src, OPND_STACK(i));
-        val_type_t t_dst = ctx_get_opnd_type(dst, OPND_STACK(i));
-        int temp_diff = type_diff(t_src, t_dst);
+        temp_type_mapping_t m_src = ctx_get_opnd_mapping(src, OPND_STACK(i));
+        temp_type_mapping_t m_dst = ctx_get_opnd_mapping(dst, OPND_STACK(i));
+
+        if (m_dst.mapping.kind != m_src.mapping.kind) {
+            if (m_dst.mapping.kind == TEMP_STACK) {
+                // We can safely drop information about the source of the temp
+                // stack operand.
+                diff += 1;
+            } else {
+                return INT_MAX;
+            }
+        } else if (m_dst.mapping.idx != m_src.mapping.idx) {
+            return INT_MAX;
+        }
+
+        int temp_diff = type_diff(m_src.type, m_dst.type);
 
         if (temp_diff == INT_MAX)
             return INT_MAX;
-- 
cgit v1.2.1


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

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