美文网首页
dex2oat流程

dex2oat流程

作者: dumphex | 来源:发表于2018-01-12 15:55 被阅读0次

Overview

  • source

    • art/dex2oat.cc
    • art/compiler/driver/compiler_options.h
    • art/compiler/driver/compiler_options.cc
    • art/compiler/driver/compiler_driver.h
    • art/compiler/driver/compiler_driver-inl.h
    • art/compiler/driver/compiler_driver.cc
    • art/compiler/oat_writer.h
    • art/compiler/oat_writer.cc
    • art/compiler/elf_writer.h
    • art/compiler/image_writer.h
    • art/compiler/image_writer.cc
  • 数据结构

    • class Dex2Oat
    • class CompilerOptions
    • class CompilerDriver

dex2oat工作流程

函数调用

dex2oat.png

抓取的systrace(app安装)

dex2oat_systrace.png

几点说明

  • dex2oat本身的代码逻辑,涵盖了boot image/app安装/app PGC等多个应用场景.

  • boot image

    • 若dex2oat未指定--compiler-filter参数, 则默认的 compiler filter是CompilerFilter::kDefaultCompilerFilter,即kSpeed
    • 文件名扩展
      • boot class path中的第一个jar文件会被跳过,即/system/framework/core-oj.jar, 它会被编译成boot.art/boot.oat/boot.vdex

      • 其它dex location文件名则要扩展

        • 前缀为"boot-"
        • 中间为文件名
        • 后缀为".art"/".oat"/".vdex"
      • art文件统一存储到image_filenames_

      • oat文件统一存储到oat_filenames_

      • vdex文件统一存储到vdex_files_

  • 不论是verify还是compile阶段,dex2oat都是按照dex/class/method的顺序去做相应的verify/compile工作.

相关文章

网友评论

      本文标题:dex2oat流程

      本文链接:https://www.haomeiwen.com/subject/jdufoxtx.html