Mark non-image spaces and use write barrier for image spaces.
Don't mark string and class roots that are in the image, alloc space
references will be caught by the write barrier.
Change-Id: Idcf9e4ede3b83556d4f8a01276273726dc6eea46
diff --git a/src/intern_table.cc b/src/intern_table.cc
index 4cc19bd..5de70d8 100644
--- a/src/intern_table.cc
+++ b/src/intern_table.cc
@@ -21,7 +21,7 @@
for (It it = strong_interns_.begin(), end = strong_interns_.end(); it != end; ++it) {
visitor(it->second, arg);
}
- // Note: we deliberately don't visit the weak_interns_ table.
+ // Note: we deliberately don't visit the weak_interns_ table and the immutable image roots.
}
String* InternTable::Lookup(Table& table, String* s, uint32_t hash_code) {
@@ -44,7 +44,7 @@
void InternTable::RegisterStrong(String* s) {
MutexLock mu(intern_table_lock_);
- Insert(strong_interns_, s, s->GetHashCode());
+ Insert(image_strong_interns_, s, s->GetHashCode());
}
void InternTable::Remove(Table& table, const String* s, uint32_t hash_code) {
@@ -65,11 +65,15 @@
uint32_t hash_code = s->GetHashCode();
if (is_strong) {
- // Check the strong table for a match.
+ // Check the strong tables for a match.
String* strong = Lookup(strong_interns_, s, hash_code);
if (strong != NULL) {
return strong;
}
+ strong = Lookup(image_strong_interns_, s, hash_code);
+ if (strong != NULL) {
+ return strong;
+ }
// There is no match in the strong table, check the weak table.
String* weak = Lookup(weak_interns_, s, hash_code);