summaryrefslogtreecommitdiff
path: root/bootstraptest
diff options
context:
space:
mode:
authorNARUSE, Yui <naruse@airemix.jp>2021-03-13 05:11:30 +0900
committerNARUSE, Yui <naruse@airemix.jp>2021-03-13 05:11:30 +0900
commit6bf32cbed8f3fd0b73b99737d671f833c594d800 (patch)
tree8386c8baaf64923af62e953cf000e1bcea4f6ba2 /bootstraptest
parent7b122b8af86c155eb23e8cad463cdf2c0bfc1d77 (diff)
merge revision(s) 63abb5c227e5c20d18d0debf699251da93ca64b5,34d02631e71209b12abb69d0114601027e485bc9,2adbf01ae14c0a4cf190b7c969b91726966a0e0f,3acc81d9e41b18380b9e0168fe2b5e5e0c727256: [Backport #17612]
dtoa.c: make compilable independently Except for `-Dxmalloc=malloc -Dxfree=free`. --- missing/dtoa.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) dtoa.c: constified clang seems to locate never modified local data in the const segment implicitly. --- missing/dtoa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) dtoa.c: make thread-safe by using atomic CAS --- common.mk | 2 ++ missing/dtoa.c | 75 ++++++++++++++++++++++++++++++++++++++++++---------------- util.c | 1 + 3 files changed, 57 insertions(+), 21 deletions(-) Fixed race in dtoa [Bug #17612] Fixed the race condition when replacing `freelist` entry with its chained next element. At acquiring an entry, hold the entry once with the special value, then release by replacing it with the next element again after acquired. If another thread is holding the same entry at that time, spinning until the entry gets released. Co-Authored-By: Koichi Sasada <ko1@atdot.net> --- bootstraptest/test_ractor.rb | 11 +++++++++++ missing/dtoa.c | 13 ++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-)
Diffstat (limited to 'bootstraptest')
-rw-r--r--bootstraptest/test_ractor.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/bootstraptest/test_ractor.rb b/bootstraptest/test_ractor.rb
index 878b846487..fd698fa4d7 100644
--- a/bootstraptest/test_ractor.rb
+++ b/bootstraptest/test_ractor.rb
@@ -176,6 +176,17 @@ assert_equal '[[:e1, 1], [:e2, 2]]', %q{
a #
}
+# dtoa race condition
+assert_equal '[:ok, :ok, :ok]', %q{
+ n = 3
+ n.times.map{
+ Ractor.new{
+ 10_000.times{ rand.to_s }
+ :ok
+ }
+ }.map(&:take)
+}
+
###
###
# Ractor still has several memory corruption so skip huge number of tests