Convince tsan that the card table isn't a problem.
Also move the #include <sys/mman.h> into "mem_map.h", since it's
currently not possible to make any use of the latter without the
former. If we care about the pollution, we should offer our own
constants as part of our API.
Change-Id: I01ec451d23c1d8afb8cb8a6660af8d9723faf5f5
diff --git a/src/card_table.cc b/src/card_table.cc
index 0eac91f..d4c391a 100644
--- a/src/card_table.cc
+++ b/src/card_table.cc
@@ -16,7 +16,7 @@
#include "card_table.h"
-#include <sys/mman.h> /* for PROT_* */
+#include <dynamic_annotations.h>
#include "heap.h"
#include "heap_bitmap.h"
@@ -81,6 +81,13 @@
return new CardTable(mem_map.release(), biased_begin, offset);
}
+CardTable::CardTable(MemMap* mem_map, byte* biased_begin, size_t offset)
+ : mem_map_(mem_map), biased_begin_(biased_begin), offset_(offset) {
+ byte* __attribute__((unused)) begin = mem_map_->Begin() + offset_;
+ byte* __attribute__((unused)) end = mem_map_->End();
+ ANNOTATE_BENIGN_RACE_SIZED(begin, (end - begin), "writes to GC card table");
+}
+
void CardTable::ClearNonImageSpaceCards(Heap* heap) {
// TODO: clear just the range of the table that has been modified
const std::vector<Space*>& spaces = heap->GetSpaces();