summaryrefslogtreecommitdiff
path: root/compiler/image_writer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/image_writer.cc')
-rw-r--r--compiler/image_writer.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc
index fc7cd016b2..f4e8a89e92 100644
--- a/compiler/image_writer.cc
+++ b/compiler/image_writer.cc
@@ -770,18 +770,18 @@ class ImageWriter::PruneObjectReferenceVisitor {
*result_ = true;
}
- // Record the object visited in case of circular reference.
- visited_->emplace(ref);
if (ref->IsClass()) {
*result_ = *result_ ||
image_writer_->PruneAppImageClassInternal(ref->AsClass(), early_exit_, visited_);
} else {
+ // Record the object visited in case of circular reference.
+ visited_->emplace(ref);
*result_ = *result_ ||
image_writer_->PruneAppImageClassInternal(klass, early_exit_, visited_);
ref->VisitReferences(*this, *this);
+ // Clean up before exit for next call of this function.
+ visited_->erase(ref);
}
- // Clean up before exit for next call of this function.
- visited_->erase(ref);
}
ALWAYS_INLINE void operator() (ObjPtr<mirror::Class> klass ATTRIBUTE_UNUSED,