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

ruby-changes:56356

From: Takashi <ko1@a...>
Date: Wed, 3 Jul 2019 10:39:41 +0900 (JST)
Subject: [ruby-changes:56356] Takashi Kokubun: 10cc6bc4d9 (master): Just disable inlining with local varaible for now

https://git.ruby-lang.org/ruby.git/commit/?id=10cc6bc4d9

From 10cc6bc4d9276023db21db1014969381de813ff8 Mon Sep 17 00:00:00 2001
From: Takashi Kokubun <takashikkbn@g...>
Date: Wed, 3 Jul 2019 10:00:50 +0900
Subject: Just disable inlining with local varaible for now

This partially reverts commit 712a66b0741605f5b2db670a292b9bb352f8a716.

The previous fix made CI strange like:
http://ci.rvm.jp/results/trunk-vm-asserts@silicon-docker/2124178

Let me just downgrade the behavior for now and deal with it later.

[Bug #15971]

diff --git a/mjit_compile.c b/mjit_compile.c
index 4110af3..b6ed984 100644
--- a/mjit_compile.c
+++ b/mjit_compile.c
@@ -331,6 +331,19 @@ inlinable_iseq_p(const struct rb_iseq_constant_body *body) https://github.com/ruby/ruby/blob/trunk/mjit_compile.c#L331
         //   * Do not read any `cfp->pc`
         if (insn != BIN(leave) && insn_may_depend_on_sp_or_pc(insn, body->iseq_encoded + (pos + 1)))
             return false;
+        // At this moment, `cfp->ep` in an inlined method is not working.
+        switch (insn) {
+          case BIN(getlocal):
+          case BIN(getlocal_WC_0):
+          case BIN(getlocal_WC_1):
+          case BIN(setlocal):
+          case BIN(setlocal_WC_0):
+          case BIN(setlocal_WC_1):
+          case BIN(getblockparam):
+          case BIN(getblockparamproxy):
+          case BIN(setblockparam):
+            return false;
+        }
         pos += insn_len(insn);
     }
     return true;
diff --git a/test/ruby/test_jit.rb b/test/ruby/test_jit.rb
index 6636073..08494cb 100644
--- a/test/ruby/test_jit.rb
+++ b/test/ruby/test_jit.rb
@@ -11,6 +11,7 @@ class TestJIT < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_jit.rb#L11
 
   IGNORABLE_PATTERNS = [
     /\AJIT recompile: .+\n\z/,
+    /\AJIT inline: .+\n\z/,
     /\ASuccessful MJIT finish\n\z/,
   ]
 
@@ -841,6 +842,19 @@ class TestJIT < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_jit.rb#L842
     end;
   end
 
+  def test_block_handler_with_possible_frame_omitted_inlining
+    assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: "70.0\n70.0\n70.0\n", success_count: 2, min_calls: 2)
+    begin;
+      def multiply(a, b)
+        a *= b
+      end
+
+      3.times do
+        p multiply(7.0, 10.0)
+      end
+    end;
+  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/

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