Skip to content

Commit

Permalink
[Sanitizers] Re-apply the fix ordering initialization of coverage and…
Browse files Browse the repository at this point in the history
… guard arrays

Original commit: http://reviews.llvm.org/rL226440
Related review: http://reviews.llvm.org/D6892

llvm-svn: 227789
  • Loading branch information
v-kutuzov committed Feb 2, 2015
1 parent 104949d commit 7891c8c
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -157,7 +157,8 @@ void CoverageData::Init() {
}

void CoverageData::Enable() {
CHECK_EQ(pc_array, nullptr);
if (pc_array)
return;
pc_array = reinterpret_cast<uptr *>(
MmapNoReserveOrDie(sizeof(uptr) * kPcArrayMaxSize, "CovInit"));
atomic_store(&pc_array_index, 0, memory_order_relaxed);
@@ -183,6 +184,7 @@ void CoverageData::Enable() {
}

void CoverageData::InitializeGuardArray(s32 *guards) {
Enable(); // Make sure coverage is enabled at this point.
s32 n = guards[0];
for (s32 j = 1; j <= n; j++) {
uptr idx = atomic_fetch_add(&pc_array_index, 1, memory_order_relaxed);

0 comments on commit 7891c8c

Please sign in to comment.