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

ruby-changes:60446

From: nagachika <ko1@a...>
Date: Thu, 19 Mar 2020 21:55:54 +0900 (JST)
Subject: [ruby-changes:60446] 4ab2353d50 (ruby_2_6): merge revision(s) c14b67b2a8cf60b37cfb221d8b97c6eb91833522: [Backport #16139]

https://git.ruby-lang.org/ruby.git/commit/?id=4ab2353d50

From 4ab2353d50f012d3e6c6272f5019684e6e843ad3 Mon Sep 17 00:00:00 2001
From: nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
Date: Thu, 19 Mar 2020 12:55:36 +0000
Subject: merge revision(s) c14b67b2a8cf60b37cfb221d8b97c6eb91833522: [Backport
 #16139]

	Check frozen flag on MJIT setinstancevariable

	It does not seem to have a significant performance impact, hopefully?

	```
	$ benchmark-driver -v benchmark.yml --rbenv 'before --jit;after --jit' --repeat-count=24 --output=all
	before --jit: ruby 2.7.0dev (2019-09-03T21:02:24Z master 77596fb7a9) +JIT [x86_64-linux]
	after --jit: ruby 2.7.0dev (2019-09-04T01:54:44Z master 7363e22d79) +JIT [x86_64-linux]
	Calculating -------------------------------------
	                                 before --jit           after --jit
	Optcarrot Lan_Master.nes    48.44054595799523     71.67010255902900 fps
	                            71.32797692837639     71.97846863769546
	                            72.51921961607691     78.87360980544105
	                            73.54082925611047     79.80408132389941
	                            74.03503843709451     79.85739528572826
	                            74.04863857926493     79.89850834901381
	                            75.30266276129467     80.34607233076015
	                            75.69063990896244     80.88474397425360
	                            75.70458132587405     81.09234267781642
	                            77.39842764662852     82.13766823612643
	                            77.76922944068329     82.20398304840373
	                            81.17984044023393     82.26722630628272
	                            82.85235776076533     82.71375902781254
	                            83.04906099135320     82.75893420702198
	                            83.10214168136230     82.79668965325972
	                            83.71456007558125     82.85131667916379
	                            84.06658306760725     82.95676565411722
	                            84.25690684305728     83.19972846225775
	                            84.27938663923503     83.28510503845854
	                            84.45467716218090     83.41003730434703
	                            84.51563186125925     83.67773614721280
	                            84.56139892968321     84.02082201151110
	                            84.69819452180658     84.10495346787033
	                            84.78125989622576     84.47867803506055
	```

	Note for backporter:
	test_jit's `success_count` would be 1 in Ruby 2.6, since 2.7 introduced
	"MJIT recompile" on JIT-ed code cancel.

	[Bug #16139]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

diff --git a/test/ruby/test_jit.rb b/test/ruby/test_jit.rb
index 9b50a32..b2467fe 100644
--- a/test/ruby/test_jit.rb
+++ b/test/ruby/test_jit.rb
@@ -697,6 +697,28 @@ class TestJIT < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_jit.rb#L697
     end;
   end
 
+  def test_inlined_setivar_frozen
+    assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: "FrozenError\n", success_count: 1, min_calls: 3)
+    begin;
+      class A
+        def a
+          @a = 1
+        end
+      end
+
+      a = A.new
+      a.a
+      a.a
+      a.a
+      a.freeze
+      begin
+        a.a
+      rescue FrozenError => e
+        p e.class
+      end
+    end;
+  end
+
   def test_attr_reader
     assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: "4nil\nnil\n6", success_count: 2, min_calls: 2)
     begin;
diff --git a/tool/ruby_vm/views/_mjit_compile_ivar.erb b/tool/ruby_vm/views/_mjit_compile_ivar.erb
index f1963c2..f3dd135 100644
--- a/tool/ruby_vm/views/_mjit_compile_ivar.erb
+++ b/tool/ruby_vm/views/_mjit_compile_ivar.erb
@@ -29,7 +29,7 @@ https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/views/_mjit_compile_ivar.erb#L29
 % # JIT: cache hit path of vm_getivar, or cancel JIT.
 % if insn.name == 'setinstancevariable'
         fprintf(f, "    VALUE val = stack[%d];\n", b->stack_size - 1);
-        fprintf(f, "    if (LIKELY(RB_TYPE_P(obj, T_OBJECT) && ic_serial == RCLASS_SERIAL(RBASIC(obj)->klass) && index < ROBJECT_NUMIV(obj))) {\n");
+        fprintf(f, "    if (LIKELY(RB_TYPE_P(obj, T_OBJECT) && ic_serial == RCLASS_SERIAL(RBASIC(obj)->klass) && index < ROBJECT_NUMIV(obj) && !RB_OBJ_FROZEN(obj))) {\n");
         fprintf(f, "        VALUE *ptr = ROBJECT_IVPTR(obj);\n");
         fprintf(f, "        RB_OBJ_WRITE(obj, &ptr[index], val);\n");
         fprintf(f, "    }\n");
diff --git a/version.h b/version.h
index 4d1ab59..26f116d 100644
--- a/version.h
+++ b/version.h
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L1
 #define RUBY_VERSION "2.6.6"
-#define RUBY_RELEASE_DATE "2020-03-18"
-#define RUBY_PATCHLEVEL 133
+#define RUBY_RELEASE_DATE "2020-03-19"
+#define RUBY_PATCHLEVEL 134
 
 #define RUBY_RELEASE_YEAR 2020
 #define RUBY_RELEASE_MONTH 3
-#define RUBY_RELEASE_DAY 18
+#define RUBY_RELEASE_DAY 19
 
 #include "ruby/version.h"
 
-- 
cgit v0.10.2


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

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