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

ruby-changes:72106

From: Takashi <ko1@a...>
Date: Thu, 9 Jun 2022 14:39:42 +0900 (JST)
Subject: [ruby-changes:72106] 90b240d127 (master): Fix MJIT's ISEQ_BODY macro usage at 5f10bd634fb

https://git.ruby-lang.org/ruby.git/commit/?id=90b240d127

From 90b240d1274b8597e02f94cb644da3aa137241b6 Mon Sep 17 00:00:00 2001
From: Takashi Kokubun <takashikkbn@g...>
Date: Wed, 8 Jun 2022 22:38:50 -0700
Subject: Fix MJIT's ISEQ_BODY macro usage at 5f10bd634fb

---
 mjit_compile.c         |  2 +-
 test/ruby/test_mjit.rb | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/mjit_compile.c b/mjit_compile.c
index 2d426b39fc..29b76f8b3d 100644
--- a/mjit_compile.c
+++ b/mjit_compile.c
@@ -370,7 +370,7 @@ mjit_compile_body(FILE *f, const rb_iseq_t *iseq, struct compile_status *status) https://github.com/ruby/ruby/blob/trunk/mjit_compile.c#L370
     if (body->param.flags.has_opt) {
         int i;
         fprintf(f, "\n");
-        fprintf(f, "    switch (reg_cfp->pc - reg_cfp->ISEQ_BODY(iseq)->iseq_encoded) {\n");
+        fprintf(f, "    switch (reg_cfp->pc - ISEQ_BODY(reg_cfp->iseq)->iseq_encoded) {\n");
         for (i = 0; i <= body->param.opt_num; i++) {
             VALUE pc_offset = body->param.opt_table[i];
             fprintf(f, "      case %"PRIdVALUE":\n", pc_offset);
diff --git a/test/ruby/test_mjit.rb b/test/ruby/test_mjit.rb
index 6f1ccc8402..9037dc3d80 100644
--- a/test/ruby/test_mjit.rb
+++ b/test/ruby/test_mjit.rb
@@ -621,6 +621,16 @@ class TestMJIT < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_mjit.rb#L621
     end;
   end
 
+  def test_compile_opt_pc
+    assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: 'hello', success_count: 1)
+    begin;
+      def test(arg = 'hello')
+        print arg
+      end
+      test
+    end;
+  end
+
   def test_mjit_output
     out, err = eval_with_jit('5.times { puts "MJIT" }', verbose: 1, min_calls: 5)
     assert_equal("MJIT\n" * 5, out)
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

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