Optimize symbol lookup
Do not run symbol lookup on already visited soinfos
Not taking into account already visited libraries
dramatically slows down dlsym in cases when there
are multiple occurrences of a large library in
dependency tree.
Bug: 16977077
(cherry picked from commit 042426ba6375f5c145379e598486ec6d675533c9)
Change-Id: I69d59e395e8112f119343e8a4d72fe31cd449f31
diff --git a/linker/linked_list.h b/linker/linked_list.h
index 7f8c901..8096e62 100644
--- a/linker/linked_list.h
+++ b/linker/linked_list.h
@@ -100,6 +100,15 @@
}
}
+ bool contains(const T* el) {
+ for (LinkedListEntry<T>* e = head_; e != nullptr; e = e->next) {
+ if (e->element != nullptr && e->element == el) {
+ return true;
+ }
+ }
+ return false;
+ }
+
private:
LinkedListEntry<T>* head_;
LinkedListEntry<T>* tail_;