summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
author Elliott Hughes <enh@google.com> 2012-06-12 15:34:20 -0700
committer Elliott Hughes <enh@google.com> 2012-06-12 15:34:20 -0700
commita168c83a1d247094e9efb1244b0f73a5f1e1ed97 (patch)
treed0fb5a91a00227eda6b430fd64f2a1bff5271723 /src
parent289be85116aaf7c48413858b5d0448868b4e61f3 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/card_table.cc9
-rw-r--r--src/card_table.h5
-rw-r--r--src/compiler.cc1
-rw-r--r--src/compiler/codegen/arm/Assemble.cc1
-rw-r--r--src/compiler/codegen/mips/Assemble.cc1
-rw-r--r--src/compiler/codegen/x86/Assemble.cc1
-rw-r--r--src/dex_file.cc1
-rw-r--r--src/exception_test.cc4
-rw-r--r--src/heap_bitmap.cc4
-rw-r--r--src/image_writer.cc3
-rw-r--r--src/jni_compiler_test.cc4
-rw-r--r--src/jni_internal.cc1
-rw-r--r--src/jni_internal_test.cc2
-rw-r--r--src/mark_stack.cc4
-rw-r--r--src/mem_map.cc2
-rw-r--r--src/mem_map.h1
-rw-r--r--src/oat/jni/jni_compiler.cc1
-rw-r--r--src/oat_file.cc2
-rw-r--r--src/space.cc2
-rw-r--r--src/thread.cc1
-rw-r--r--src/zip_archive.h1
21 files changed, 16 insertions, 35 deletions
diff --git a/src/card_table.cc b/src/card_table.cc
index 0eac91f44d..d4c391a471 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 @@ CardTable* CardTable::Create(const byte* heap_begin, size_t heap_capacity) {
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();
diff --git a/src/card_table.h b/src/card_table.h
index 9cfa70b905..0d5178ec74 100644
--- a/src/card_table.h
+++ b/src/card_table.h
@@ -71,10 +71,9 @@ class CardTable {
// Resets all of the bytes in the card table to clean.
void ClearNonImageSpaceCards(Heap* heap);
- private:
- CardTable(MemMap* begin, byte* biased_begin, size_t offset) :
- mem_map_(begin), biased_begin_(biased_begin), offset_(offset) {}
+ private:
+ CardTable(MemMap* begin, byte* biased_begin, size_t offset);
// Returns the address of the relevant byte in the card table, given an address on the heap.
byte* CardFromAddr(const void *addr) const {
diff --git a/src/compiler.cc b/src/compiler.cc
index 2e17c9bc84..89f35b361a 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -19,7 +19,6 @@
#include <vector>
#include <dlfcn.h>
-#include <sys/mman.h>
#include <unistd.h>
#include "class_linker.h"
diff --git a/src/compiler/codegen/arm/Assemble.cc b/src/compiler/codegen/arm/Assemble.cc
index aca146e309..86517fa0dd 100644
--- a/src/compiler/codegen/arm/Assemble.cc
+++ b/src/compiler/codegen/arm/Assemble.cc
@@ -18,7 +18,6 @@
#include "../../CompilerInternals.h"
#include "ArmLIR.h"
#include "Codegen.h"
-#include <sys/mman.h> /* for protection change */
namespace art {
diff --git a/src/compiler/codegen/mips/Assemble.cc b/src/compiler/codegen/mips/Assemble.cc
index c19effe2f3..39ad36b4ad 100644
--- a/src/compiler/codegen/mips/Assemble.cc
+++ b/src/compiler/codegen/mips/Assemble.cc
@@ -18,7 +18,6 @@
#include "../../CompilerInternals.h"
#include "MipsLIR.h"
#include "Codegen.h"
-#include <sys/mman.h> /* for protection change */
namespace art {
diff --git a/src/compiler/codegen/x86/Assemble.cc b/src/compiler/codegen/x86/Assemble.cc
index 671e72863a..9e0e713e0c 100644
--- a/src/compiler/codegen/x86/Assemble.cc
+++ b/src/compiler/codegen/x86/Assemble.cc
@@ -18,7 +18,6 @@
#include "../../CompilerInternals.h"
#include "X86LIR.h"
#include "Codegen.h"
-#include <sys/mman.h> /* for protection change */
namespace art {
diff --git a/src/dex_file.cc b/src/dex_file.cc
index cca1a30f32..8f30c738fb 100644
--- a/src/dex_file.cc
+++ b/src/dex_file.cc
@@ -22,7 +22,6 @@
#include <stdlib.h>
#include <string.h>
#include <sys/file.h>
-#include <sys/mman.h>
#include <sys/stat.h>
#include "class_linker.h"
diff --git a/src/exception_test.cc b/src/exception_test.cc
index 23a437a34f..2730954390 100644
--- a/src/exception_test.cc
+++ b/src/exception_test.cc
@@ -14,15 +14,13 @@
* limitations under the License.
*/
-#include <sys/mman.h>
-
-#include "UniquePtr.h"
#include "class_linker.h"
#include "common_test.h"
#include "dex_file.h"
#include "gtest/gtest.h"
#include "runtime.h"
#include "thread.h"
+#include "UniquePtr.h"
namespace art {
diff --git a/src/heap_bitmap.cc b/src/heap_bitmap.cc
index 5223178ef2..769ee9d602 100644
--- a/src/heap_bitmap.cc
+++ b/src/heap_bitmap.cc
@@ -16,10 +16,8 @@
#include "heap_bitmap.h"
-#include <sys/mman.h>
-
-#include "UniquePtr.h"
#include "logging.h"
+#include "UniquePtr.h"
#include "utils.h"
namespace art {
diff --git a/src/image_writer.cc b/src/image_writer.cc
index d1328c15e5..589d3d730f 100644
--- a/src/image_writer.cc
+++ b/src/image_writer.cc
@@ -16,12 +16,10 @@
#include "image_writer.h"
-#include <sys/mman.h>
#include <sys/stat.h>
#include <vector>
-#include "UniquePtr.h"
#include "class_linker.h"
#include "class_loader.h"
#include "compiled_method.h"
@@ -38,6 +36,7 @@
#include "object_utils.h"
#include "runtime.h"
#include "space.h"
+#include "UniquePtr.h"
#include "utils.h"
namespace art {
diff --git a/src/jni_compiler_test.cc b/src/jni_compiler_test.cc
index 2c763b22f4..f821eee7c0 100644
--- a/src/jni_compiler_test.cc
+++ b/src/jni_compiler_test.cc
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-#include <sys/mman.h>
-
-#include "UniquePtr.h"
#include "class_linker.h"
#include "common_test.h"
#include "dex_file.h"
@@ -27,6 +24,7 @@
#include "runtime.h"
#include "scoped_jni_thread_state.h"
#include "thread.h"
+#include "UniquePtr.h"
extern "C" JNIEXPORT jint JNICALL Java_MyClassNatives_bar(JNIEnv*, jobject, jint count) {
return count + 1;
diff --git a/src/jni_internal.cc b/src/jni_internal.cc
index 87d5449b3d..4f01f7dacb 100644
--- a/src/jni_internal.cc
+++ b/src/jni_internal.cc
@@ -17,7 +17,6 @@
#include "jni_internal.h"
#include <dlfcn.h>
-#include <sys/mman.h>
#include <cstdarg>
#include <utility>
diff --git a/src/jni_internal_test.cc b/src/jni_internal_test.cc
index b9366c1fe2..2ca2b3cc9e 100644
--- a/src/jni_internal_test.cc
+++ b/src/jni_internal_test.cc
@@ -16,8 +16,6 @@
#include "jni_internal.h"
-#include <sys/mman.h>
-
#include <cmath>
#include "common_test.h"
diff --git a/src/mark_stack.cc b/src/mark_stack.cc
index e2694555b9..e1aa6161d3 100644
--- a/src/mark_stack.cc
+++ b/src/mark_stack.cc
@@ -16,11 +16,9 @@
#include "mark_stack.h"
-#include <sys/mman.h>
-
-#include "UniquePtr.h"
#include "globals.h"
#include "logging.h"
+#include "UniquePtr.h"
#include "utils.h"
namespace art {
diff --git a/src/mem_map.cc b/src/mem_map.cc
index d9ffaeb31d..c9929cc9e9 100644
--- a/src/mem_map.cc
+++ b/src/mem_map.cc
@@ -16,8 +16,6 @@
#include "mem_map.h"
-#include <sys/mman.h>
-
#include "ScopedFd.h"
#include "stringprintf.h"
#include "utils.h"
diff --git a/src/mem_map.h b/src/mem_map.h
index 9da2a84813..3861327327 100644
--- a/src/mem_map.h
+++ b/src/mem_map.h
@@ -18,6 +18,7 @@
#define ART_SRC_MEM_MAP_H_
#include <stddef.h>
+#include <sys/mman.h> // For the PROT_* and MAP_* constants.
#include <sys/types.h>
#include "globals.h"
diff --git a/src/oat/jni/jni_compiler.cc b/src/oat/jni/jni_compiler.cc
index 24915868c1..42d2166b0c 100644
--- a/src/oat/jni/jni_compiler.cc
+++ b/src/oat/jni/jni_compiler.cc
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-#include <sys/mman.h>
#include <vector>
#include "calling_convention.h"
diff --git a/src/oat_file.cc b/src/oat_file.cc
index 15ad11f5ff..81e88ddf41 100644
--- a/src/oat_file.cc
+++ b/src/oat_file.cc
@@ -16,8 +16,6 @@
#include "oat_file.h"
-#include <sys/mman.h>
-
#include "file.h"
#include "os.h"
#include "stl_util.h"
diff --git a/src/space.cc b/src/space.cc
index 5aceed73f8..46004433bb 100644
--- a/src/space.cc
+++ b/src/space.cc
@@ -16,8 +16,6 @@
#include "space.h"
-#include <sys/mman.h>
-
#include "UniquePtr.h"
#include "dlmalloc.h"
#include "file.h"
diff --git a/src/thread.cc b/src/thread.cc
index b177cf851f..8ef784fc6a 100644
--- a/src/thread.cc
+++ b/src/thread.cc
@@ -19,7 +19,6 @@
#include <dynamic_annotations.h>
#include <pthread.h>
#include <signal.h>
-#include <sys/mman.h>
#include <sys/resource.h>
#include <sys/time.h>
diff --git a/src/zip_archive.h b/src/zip_archive.h
index 3889fcbbb4..cda3522f1c 100644
--- a/src/zip_archive.h
+++ b/src/zip_archive.h
@@ -18,7 +18,6 @@
#define ART_SRC_ZIP_ARCHIVE_H_
#include <stdint.h>
-#include <sys/mman.h>
#include <zlib.h>
#include "file.h"