Files
sdk/runtime
Martin Kustermann f94936c549 [vm] Fix racy initialization of lazily populated ObjectStore members
If two threads concurrently trigger initialization of the lazily
populated ObjectStore members, they have to coordinate.

We ensure mutual exclusion by holding a writer lock, to ensure only one
thread can perform the lazy initialization. Furthermore we use
store-release/load-acquire for those ObjectStore fields to ensure that
once an object is made available on ObjectStore all of it's initializing
stores are visible at that point.

We no longer make public setters for those fields, since they shouldn't
be used (only the getters + lazy initialization should be used)

Fixes https://github.com/dart-lang/sdk/issues/46611

TEST=Fixes TSAN races reported on iso-stres builder.

Change-Id: Icaf54bb224e74baf1bfbb4a9bfc386ebfbd52755
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/206782
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2021-07-14 18:44:42 +00:00
..
2021-07-02 00:45:53 +00:00