Merge "Fix -verbose:image errors"
diff --git a/runtime/intern_table-inl.h b/runtime/intern_table-inl.h
index 6e5c903..8c7fb42 100644
--- a/runtime/intern_table-inl.h
+++ b/runtime/intern_table-inl.h
@@ -51,9 +51,12 @@
 inline void InternTable::Table::AddInternStrings(UnorderedSet&& intern_strings) {
   static constexpr bool kCheckDuplicates = kIsDebugBuild;
   if (kCheckDuplicates) {
+    // Avoid doing read barriers since the space might not yet be added to the heap.
+    // See b/117803941
     for (GcRoot<mirror::String>& string : intern_strings) {
-      CHECK(Find(string.Read()) == nullptr)
-          << "Already found " << string.Read()->ToModifiedUtf8() << " in the intern table";
+      CHECK(Find(string.Read<kWithoutReadBarrier>()) == nullptr)
+          << "Already found " << string.Read<kWithoutReadBarrier>()->ToModifiedUtf8()
+          << " in the intern table";
     }
   }
   // Insert at the front since we add new interns into the back.
diff --git a/tools/ahat/Android.mk b/tools/ahat/Android.mk
index 32e5b55..dcd9105 100644
--- a/tools/ahat/Android.mk
+++ b/tools/ahat/Android.mk
@@ -104,9 +104,17 @@
 $(AHAT_TEST_DUMP_PROGUARD_MAP): $(proguard_dictionary)
 	cp $(PRIVATE_AHAT_SOURCE_PROGUARD_MAP) $@
 
+ifeq (true,$(HOST_PREFER_32_BIT))
+  AHAT_TEST_DALVIKVM_DEP := $(HOST_OUT_EXECUTABLES)/dalvikvm32
+  AHAT_TEST_DALVIKVM_ARG := --32
+else
+  AHAT_TEST_DALVIKVM_DEP := $(HOST_OUT_EXECUTABLES)/dalvikvm64
+  AHAT_TEST_DALVIKVM_ARG := --64
+endif
+
 # Run ahat-test-dump.jar to generate test-dump.hprof and test-dump-base.hprof
 AHAT_TEST_DUMP_DEPENDENCIES := \
-  $(HOST_OUT_EXECUTABLES)/dalvikvm64 \
+  $(AHAT_TEST_DALVIKVM_DEP) \
   $(ART_HOST_SHARED_LIBRARY_DEBUG_DEPENDENCIES) \
   $(HOST_OUT_EXECUTABLES)/art \
   $(HOST_CORE_IMG_OUT_BASE)$(CORE_IMG_SUFFIX)
@@ -114,20 +122,24 @@
 $(AHAT_TEST_DUMP_HPROF): PRIVATE_AHAT_TEST_ART := $(HOST_OUT_EXECUTABLES)/art
 $(AHAT_TEST_DUMP_HPROF): PRIVATE_AHAT_TEST_DUMP_JAR := $(AHAT_TEST_DUMP_JAR)
 $(AHAT_TEST_DUMP_HPROF): PRIVATE_AHAT_TEST_ANDROID_DATA := $(AHAT_TEST_DUMP_ANDROID_DATA)
+$(AHAT_TEST_DUMP_HPROF): PRIVATE_AHAT_TEST_DALVIKVM_ARG := $(AHAT_TEST_DALVIKVM_ARG)
 $(AHAT_TEST_DUMP_HPROF): $(AHAT_TEST_DUMP_JAR) $(AHAT_TEST_DUMP_DEPENDENCIES)
 	rm -rf $(PRIVATE_AHAT_TEST_ANDROID_DATA)
 	mkdir -p $(PRIVATE_AHAT_TEST_ANDROID_DATA)
 	ANDROID_DATA=$(PRIVATE_AHAT_TEST_ANDROID_DATA) \
-	  $(PRIVATE_AHAT_TEST_ART) -d --64 -cp $(PRIVATE_AHAT_TEST_DUMP_JAR) Main $@
+	  $(PRIVATE_AHAT_TEST_ART) -d $(PRIVATE_AHAT_TEST_DALVIKVM_ARG) \
+	  -cp $(PRIVATE_AHAT_TEST_DUMP_JAR) Main $@
 
 $(AHAT_TEST_DUMP_BASE_HPROF): PRIVATE_AHAT_TEST_ART := $(HOST_OUT_EXECUTABLES)/art
 $(AHAT_TEST_DUMP_BASE_HPROF): PRIVATE_AHAT_TEST_DUMP_JAR := $(AHAT_TEST_DUMP_JAR)
 $(AHAT_TEST_DUMP_BASE_HPROF): PRIVATE_AHAT_TEST_ANDROID_DATA := $(AHAT_TEST_DUMP_BASE_ANDROID_DATA)
+$(AHAT_TEST_DUMP_BASE_HPROF): PRIVATE_AHAT_TEST_DALVIKVM_ARG := $(AHAT_TEST_DALVIKVM_ARG)
 $(AHAT_TEST_DUMP_BASE_HPROF): $(AHAT_TEST_DUMP_JAR) $(AHAT_TEST_DUMP_DEPENDENCIES)
 	rm -rf $(PRIVATE_AHAT_TEST_ANDROID_DATA)
 	mkdir -p $(PRIVATE_AHAT_TEST_ANDROID_DATA)
 	ANDROID_DATA=$(PRIVATE_AHAT_TEST_ANDROID_DATA) \
-	  $(PRIVATE_AHAT_TEST_ART) -d --64 -cp $(PRIVATE_AHAT_TEST_DUMP_JAR) Main $@ --base
+	  $(PRIVATE_AHAT_TEST_ART) -d $(PRIVATE_AHAT_TEST_DALVIKVM_ARG) \
+	  -cp $(PRIVATE_AHAT_TEST_DUMP_JAR) Main $@ --base
 
 # --- ahat-ri-test-dump.jar -------
 include $(CLEAR_VARS)