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

ruby-changes:64946

From: Takashi <ko1@a...>
Date: Tue, 19 Jan 2021 07:53:24 +0900 (JST)
Subject: [ruby-changes:64946] 9d1475c621 (master): Fix JIT link failures

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

From 9d1475c621af671494769dde5a09db4c86071474 Mon Sep 17 00:00:00 2001
From: Takashi Kokubun <takashikkbn@g...>
Date: Mon, 18 Jan 2021 14:52:07 -0800
Subject: Fix JIT link failures

forgotten in https://github.com/ruby/ruby/pull/4018

diff --git a/numeric.c b/numeric.c
index 2ce6f8b..793f565 100644
--- a/numeric.c
+++ b/numeric.c
@@ -1030,7 +1030,7 @@ flo_coerce(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/numeric.c#L1030
     return rb_assoc_new(rb_Float(y), x);
 }
 
-VALUE
+MJIT_FUNC_EXPORTED VALUE
 rb_float_uminus(VALUE flt)
 {
     return DBL2NUM(-RFLOAT_VALUE(flt));
@@ -1108,12 +1108,6 @@ rb_float_mul(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/numeric.c#L1108
     }
 }
 
-static bool
-flo_iszero(VALUE f)
-{
-    return FLOAT_ZERO_P(f);
-}
-
 static double
 double_div_double(double x, double y)
 {
@@ -1694,7 +1688,7 @@ rb_float_eql(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/numeric.c#L1688
 
 #define flo_eql rb_float_eql
 
-VALUE
+MJIT_FUNC_EXPORTED VALUE
 rb_float_abs(VALUE flt)
 {
     double val = fabs(RFLOAT_VALUE(flt));
diff --git a/numeric.rb b/numeric.rb
index b8b3a90..fbddaa9 100644
--- a/numeric.rb
+++ b/numeric.rb
@@ -202,6 +202,6 @@ class Float https://github.com/ruby/ruby/blob/trunk/numeric.rb#L202
   #
   def zero?
     Primitive.attr! 'inline'
-    Primitive.cexpr! 'flo_iszero(self) ? Qtrue : Qfalse'
+    Primitive.cexpr! 'FLOAT_ZERO_P(self) ? Qtrue : Qfalse'
   end
 end
diff --git a/test/ruby/test_jit.rb b/test/ruby/test_jit.rb
index 54f9698..3ecc78f 100644
--- a/test/ruby/test_jit.rb
+++ b/test/ruby/test_jit.rb
@@ -777,6 +777,20 @@ class TestJIT < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_jit.rb#L777
     end;
   end
 
+  def test_inlined_builtin_methods
+    assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: '', success_count: 1, min_calls: 2)
+    begin;
+      def test
+        float = 0.0
+        float.abs
+        -float
+        float.zero?
+      end
+      test
+      test
+    end;
+  end
+
   def test_inlined_c_method
     assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: "aaa", success_count: 2, recompile_count: 1, min_calls: 2)
     begin;
-- 
cgit v0.10.2


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

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