ruby-changes:61929
From: Takashi <ko1@a...>
Date: Thu, 25 Jun 2020 15:00:04 +0900 (JST)
Subject: [ruby-changes:61929] bb4a2351cb (master): Do not JIT inline builtin methods
https://git.ruby-lang.org/ruby.git/commit/?id=bb4a2351cb From bb4a2351cb86ae7e2603e1280e1eb756c89c7029 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun <takashikkbn@g...> Date: Wed, 24 Jun 2020 22:58:22 -0700 Subject: Do not JIT inline builtin methods It's probably not worth it because there's nothing we can optimize in such builtin methods. It's worth JIT only when inlined. diff --git a/mjit.h b/mjit.h index 177967a..06eb300 100644 --- a/mjit.h +++ b/mjit.h @@ -108,6 +108,7 @@ static inline int https://github.com/ruby/ruby/blob/trunk/mjit.h#L108 mjit_target_iseq_p(struct rb_iseq_constant_body *body) { return (body->type == ISEQ_TYPE_METHOD || body->type == ISEQ_TYPE_BLOCK) + && !body->builtin_inline_p && body->iseq_size < JIT_ISEQ_SIZE_THRESHOLD; } diff --git a/test/ruby/test_jit.rb b/test/ruby/test_jit.rb index 90d498c..c70a6b2 100644 --- a/test/ruby/test_jit.rb +++ b/test/ruby/test_jit.rb @@ -1007,6 +1007,10 @@ class TestJIT < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_jit.rb#L1007 end; end + def test_builtin_frame_omitted_inlining + assert_eval_with_jit('0.zero?; 0.zero?; 3.times { p 0.zero? }', stdout: "true\ntrue\ntrue\n", success_count: 1, min_calls: 2) + end + def test_program_counter_with_regexpmatch assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: "aa", success_count: 1) begin; -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/