Make it possible to enable read barriers at build time.
Bug: 12687968
Change-Id: I26ec55063c2d5ff0181e628c1002bfa609815b29
diff --git a/build/Android.common_build.mk b/build/Android.common_build.mk
index cd9ed50..c792536 100644
--- a/build/Android.common_build.mk
+++ b/build/Android.common_build.mk
@@ -221,6 +221,10 @@
art_cflags += -DART_HEAP_POISONING=1
endif
+ifeq ($(ART_USE_READ_BARRIER),true)
+ art_cflags += -DART_USE_READ_BARRIER=1
+endif
+
# Cflags for non-debug ART and ART tools.
art_non_debug_cflags := \
-O3
diff --git a/runtime/read_barrier_c.h b/runtime/read_barrier_c.h
index 4d1c7df..49efaa2 100644
--- a/runtime/read_barrier_c.h
+++ b/runtime/read_barrier_c.h
@@ -25,9 +25,11 @@
// Object.java (libcore) to enable baker, brooks (unimplemented), or
// table-lookup read barriers.
+#ifdef ART_USE_READ_BARRIER
// #define USE_BAKER_READ_BARRIER
// #define USE_BROOKS_READ_BARRIER
-// #define USE_TABLE_LOOKUP_READ_BARRIER
+#define USE_TABLE_LOOKUP_READ_BARRIER
+#endif
#if defined(USE_BAKER_READ_BARRIER) || defined(USE_BROOKS_READ_BARRIER)
#define USE_BAKER_OR_BROOKS_READ_BARRIER