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

ruby-changes:73257

From: Maxime <ko1@a...>
Date: Tue, 30 Aug 2022 01:05:10 +0900 (JST)
Subject: [ruby-changes:73257] e24037267f (master): Add Opnd::None error message to x86 backend as well

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

From e24037267f5912814dff463bccc618deacefd529 Mon Sep 17 00:00:00 2001
From: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@s...>
Date: Fri, 5 Aug 2022 11:05:20 -0400
Subject: Add Opnd::None error message to x86 backend as well

---
 yjit/src/backend/arm64/mod.rs  | 5 ++++-
 yjit/src/backend/x86_64/mod.rs | 6 ++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/yjit/src/backend/arm64/mod.rs b/yjit/src/backend/arm64/mod.rs
index 4b0b034088..778f1b6992 100644
--- a/yjit/src/backend/arm64/mod.rs
+++ b/yjit/src/backend/arm64/mod.rs
@@ -50,8 +50,11 @@ impl From<Opnd> for A64Opnd { https://github.com/ruby/ruby/blob/trunk/yjit/src/backend/arm64/mod.rs#L50
                 panic!("attempted to lower an Opnd::Mem with a MemBase::InsnOut base")
             },
             Opnd::InsnOut { .. } => panic!("attempted to lower an Opnd::InsnOut"),
-            Opnd::None => panic!("attempted to lower an Opnd::None"),
             Opnd::Value(_) => panic!("attempted to lower an Opnd::Value"),
+            Opnd::None => panic!(
+                "Attempted to lower an Opnd::None. This often happens when an out operand was not allocated for an instruction because the output of the instruction was not used. Please ensure you are using the output."
+            ),
+
         }
     }
 }
diff --git a/yjit/src/backend/x86_64/mod.rs b/yjit/src/backend/x86_64/mod.rs
index d1f1698b2f..696846d2a8 100644
--- a/yjit/src/backend/x86_64/mod.rs
+++ b/yjit/src/backend/x86_64/mod.rs
@@ -40,8 +40,6 @@ impl From<Opnd> for X86Opnd { https://github.com/ruby/ruby/blob/trunk/yjit/src/backend/x86_64/mod.rs#L40
 
             Opnd::InsnOut{..} => panic!("InsnOut operand made it past register allocation"),
 
-            Opnd::None => X86Opnd::None,
-
             Opnd::UImm(val) => uimm_opnd(val),
             Opnd::Imm(val) => imm_opnd(val),
             Opnd::Value(VALUE(uimm)) => uimm_opnd(uimm as u64),
@@ -60,6 +58,10 @@ impl From<Opnd> for X86Opnd { https://github.com/ruby/ruby/blob/trunk/yjit/src/backend/x86_64/mod.rs#L58
                 mem_opnd(num_bits, X86Opnd::Reg(reg), disp)
             }
 
+            Opnd::None => panic!(
+                "Attempted to lower an Opnd::None. This often happens when an out operand was not allocated for an instruction because the output of the instruction was not used. Please ensure you are using the output."
+            ),
+
             _ => panic!("unsupported x86 operand type")
         }
     }
-- 
cgit v1.2.1


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

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