函数为
DexFile_openDexFileNative
ClassLinker::OpenDexFilesFromOat
1、 FindOpenedOatDexFile 查找缓存中是否存在,checksum为空或者相同
2、 CreateOatFileForDexLocation
一、生成oat文件 执行execv 调用 dex2oat 生成Oat 会启动进程生成较慢
std::string dex2oat(Runtime::Current()->GetCompilerExecutable()); 文件路径待研究
execv执行成功就返回成功,不管是不是成功
二、OatFile::Open打开,如果失败返回null OatFile* OatFile::Open
调用 ElfFile::Open 判断非ELF文件返回NULL
3、CreateOatFileForDexLocation 生成失败 调用 DexFile::Open 不生成优化
// Failed, bail.
if (open_oat_file.get() == nullptr) {
std::string error_msg;
// dex2oat was disabled or crashed. Add the dex file in the list of dex_files to make progress