summaryrefslogtreecommitdiff
path: root/src/passes/OptimizeAddedConstants.cpp
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2021-04-30 12:39:18 -0700
committerGitHub <noreply@github.com>2021-04-30 12:39:18 -0700
commit5387a0b1ffcaf925b40ee661063893c475d4c632 (patch)
tree94de70c2a2b306e83c5189c8c3c93598014e8cf7 /src/passes/OptimizeAddedConstants.cpp
parentea8ebefa551b8e6e2d4baa759df8c531cfd842d8 (diff)
downloadbinaryen-5387a0b1ffcaf925b40ee661063893c475d4c632.tar.gz
binaryen-5387a0b1ffcaf925b40ee661063893c475d4c632.tar.bz2
binaryen-5387a0b1ffcaf925b40ee661063893c475d4c632.zip
Fix data races in type canonicalization (#3852)
Fix two potential sources of data races identified with the help of thread sanitizer. First, keep a lock on the global HeapType store as long as it can reach temporary types to ensure that no other threads observe the temporary types, for example if another thread concurrently constructs a new HeapType with the same shape as one being canonicalized here. This cannot happen with Types because they are hashed in the global store by pointer identity, which has not yet escaped the builder, rather than shape. Second, in the shape canonicalizer, do not replace children of the new, minimal HeapTypeInfos if they are already canonical. Even though these writes are always no-ops, they still race because they are visible to other threads via canonical Types.
Diffstat (limited to 'src/passes/OptimizeAddedConstants.cpp')
0 files changed, 0 insertions, 0 deletions