aboutsummaryrefslogtreecommitdiffstats
path: root/bootstraptest
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2020-10-14 10:43:13 +0900
committerKoichi Sasada <ko1@atdot.net>2020-10-14 16:36:55 +0900
commitfad97f1f96caf11005a5858a29d32c66203913e8 (patch)
tree156a20da88b4e1efae3c9f749a1ed0dd2181da86 /bootstraptest
parentae693fff748c68ca2500bbc2c0a8802d50f269dc (diff)
downloadruby-fad97f1f96caf11005a5858a29d32c66203913e8.tar.gz
sync generic_ivtbl
generic_ivtbl is a process global table to maintain instance variables for non T_OBJECT/T_CLASS/... objects. So we need to protect them for multi-Ractor exection. Hint: we can make them Ractor local for unshareable objects, but now it is premature optimization.
Diffstat (limited to 'bootstraptest')
-rw-r--r--bootstraptest/test_ractor.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/bootstraptest/test_ractor.rb b/bootstraptest/test_ractor.rb
index 05139e2081..eaa265fcfa 100644
--- a/bootstraptest/test_ractor.rb
+++ b/bootstraptest/test_ractor.rb
@@ -780,6 +780,7 @@ assert_equal "#{N}#{N}", %Q{
}.map{|r| r.take}.join
}
+# enc_table
assert_equal "#{N/10}", %Q{
Ractor.new do
loop do
@@ -794,4 +795,20 @@ assert_equal "#{N/10}", %Q{
}
}
+# Generic ivtbl
+n = N/2
+assert_equal "#{n}#{n}", %Q{
+ 2.times.map{
+ Ractor.new do
+ #{n}.times do
+ obj = ''
+ obj.instance_variable_set("@a", 1)
+ obj.instance_variable_set("@b", 1)
+ obj.instance_variable_set("@c", 1)
+ obj.instance_variable_defined?("@a")
+ end
+ end
+ }.map{|r| r.take}.join
+}
+
end # if !ENV['GITHUB_WORKFLOW']