aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2021-01-18 14:52:07 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2021-01-18 14:52:33 -0800
commit9d1475c621af671494769dde5a09db4c86071474 (patch)
tree5cdd50495aad0a3c250b9fced5b9e14e9b54c01d
parente812b362059706d0fb4ce1ec4f8941383dda6166 (diff)
downloadruby-9d1475c621af671494769dde5a09db4c86071474.tar.gz
Fix JIT link failures
forgotten in https://github.com/ruby/ruby/pull/4018
-rw-r--r--numeric.c10
-rw-r--r--numeric.rb2
-rw-r--r--test/ruby/test_jit.rb14
3 files changed, 17 insertions, 9 deletions
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)
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)
}
}
-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)
#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
#
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
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;