Commit 9e37aece authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

heap: Do not rely on other synchronization for GCInfo

Instead of relying on in-construction bit, use off-the-shelf
double-checked-locking for ensuring GCInfo correctness as it is way
simpler to reason about.

In general, GCInfo are known statically at compilation time which is why
we should think about putting them into proper sections. The current
problem there is component builds.

This reverts parts of https://crrev.com/c/2062440

Change-Id: Id3100b00f44386328ce7b8946d95362a3323e104
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2066841
Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: default avatarAnton Bikineev <bikineev@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#743512}
parent 0c0a2d64
......@@ -75,7 +75,7 @@ GCInfoIndex GCInfoTable::EnsureGCInfoIndex(
CHECK_LT(gc_info_index, GCInfoTable::kMaxIndex);
table_[gc_info_index] = gc_info;
gc_info_index_slot->store(gc_info_index, std::memory_order_relaxed);
gc_info_index_slot->store(gc_info_index, std::memory_order_release);
return gc_info_index;
}
......
......@@ -109,7 +109,7 @@ struct GCInfoTrait {
// This is more complicated than using threadsafe initialization, but this
// is instantiated many times (once for every GC type).
static std::atomic<GCInfoIndex> gc_info_index{0};
GCInfoIndex index = gc_info_index.load(std::memory_order_relaxed);
GCInfoIndex index = gc_info_index.load(std::memory_order_acquire);
if (!index) {
index = GCInfoTable::GetMutable()->EnsureGCInfoIndex(&kGcInfo,
&gc_info_index);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment