aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 2ce6f8bfa6..793f56551c 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 b8b3a90d75..fbddaa9f6d 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 54f9698afa..3ecc78fcfe 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;