Remove #include "oat_file.h" from class_linker.h .
Refactor the OatClass and OatMethod related functions from
ClassLinker to OatFile and ArtMethod, respectively. Refactor
the remaining ClassLinker dependencies on OatFile to break
the #include dependency and reduce incremental build times.
Test: m test-art-host
Change-Id: Iebc5b9f81b48fbcf79821cc827a5d7c4a0261bf6
diff --git a/runtime/oat_file.cc b/runtime/oat_file.cc
index ea692cd..b05d7ac 100644
--- a/runtime/oat_file.cc
+++ b/runtime/oat_file.cc
@@ -52,6 +52,7 @@
#include "utf-inl.h"
#include "utils.h"
#include "utils/dex_cache_arrays_layout-inl.h"
+#include "vdex_file.h"
namespace art {
@@ -1497,4 +1498,17 @@
return true;
}
+OatFile::OatClass OatFile::FindOatClass(const DexFile& dex_file,
+ uint16_t class_def_idx,
+ bool* found) {
+ DCHECK_NE(class_def_idx, DexFile::kDexNoIndex16);
+ const OatFile::OatDexFile* oat_dex_file = dex_file.GetOatDexFile();
+ if (oat_dex_file == nullptr) {
+ *found = false;
+ return OatFile::OatClass::Invalid();
+ }
+ *found = true;
+ return oat_dex_file->GetOatClass(class_def_idx);
+}
+
} // namespace art