1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fix JIT link failures

forgotten in https://github.com/ruby/ruby/pull/4018
This commit is contained in:
Takashi Kokubun 2021-01-18 14:52:07 -08:00
parent e812b36205
commit 9d1475c621
No known key found for this signature in database
GPG key ID: 6FFC433B12EE23DD
3 changed files with 17 additions and 9 deletions

View file

@ -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));

View file

@ -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

View file

@ -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;