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

ruby-changes:69108

From: John <ko1@a...>
Date: Thu, 21 Oct 2021 08:20:51 +0900 (JST)
Subject: [ruby-changes:69108] 53079ca585 (master): Return if fixnums impossible

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

From 53079ca585161b882b37945b31802f6d477bbb1e Mon Sep 17 00:00:00 2001
From: John Hawthorn <john@h...>
Date: Wed, 14 Jul 2021 12:42:29 -0700
Subject: Return if fixnums impossible

---
 yjit_codegen.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/yjit_codegen.c b/yjit_codegen.c
index 5d05cce365..2512f9f52d 100644
--- a/yjit_codegen.c
+++ b/yjit_codegen.c
@@ -1667,6 +1667,26 @@ guard_two_fixnums(ctx_t* ctx, uint8_t* side_exit) https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L1667
     val_type_t arg1_type = ctx_get_opnd_type(ctx, OPND_STACK(0));
     val_type_t arg0_type = ctx_get_opnd_type(ctx, OPND_STACK(1));
 
+    if (arg0_type.is_heap || arg1_type.is_heap) {
+        jmp_ptr(cb, side_exit);
+        return;
+    }
+
+    if (arg0_type.type != ETYPE_FIXNUM && arg0_type.type != ETYPE_UNKNOWN) {
+        jmp_ptr(cb, side_exit);
+        return;
+    }
+
+    if (arg1_type.type != ETYPE_FIXNUM && arg1_type.type != ETYPE_UNKNOWN) {
+        jmp_ptr(cb, side_exit);
+        return;
+    }
+
+    RUBY_ASSERT(!arg0_type.is_heap);
+    RUBY_ASSERT(!arg1_type.is_heap);
+    RUBY_ASSERT(arg0_type.type == ETYPE_FIXNUM || arg0_type.type == ETYPE_UNKNOWN);
+    RUBY_ASSERT(arg1_type.type == ETYPE_FIXNUM || arg1_type.type == ETYPE_UNKNOWN);
+
     // Get stack operands without popping them
     x86opnd_t arg1 = ctx_stack_opnd(ctx, 0);
     x86opnd_t arg0 = ctx_stack_opnd(ctx, 1);
-- 
cgit v1.2.1


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

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