oat_file.h revision c93b3be140f6a57a572f2a4cdaf46aba87235a02
12faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes/*
22faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * Copyright (C) 2011 The Android Open Source Project
32faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes *
42faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * Licensed under the Apache License, Version 2.0 (the "License");
52faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * you may not use this file except in compliance with the License.
62faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * You may obtain a copy of the License at
72faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes *
82faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes *      http://www.apache.org/licenses/LICENSE-2.0
92faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes *
102faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * Unless required by applicable law or agreed to in writing, software
112faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * distributed under the License is distributed on an "AS IS" BASIS,
122faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
132faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * See the License for the specific language governing permissions and
142faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * limitations under the License.
152faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes */
16e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom
17fc0e3219edc9a5bf81b166e82fd5db2796eb6a0dBrian Carlstrom#ifndef ART_RUNTIME_OAT_FILE_H_
18fc0e3219edc9a5bf81b166e82fd5db2796eb6a0dBrian Carlstrom#define ART_RUNTIME_OAT_FILE_H_
19e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom
203f5838d7d0b9fc63db0ccc35c2ea05ed29264986Vladimir Marko#include <list>
21700c8d31733534a3d978b75a03f6f7e177dc7e81Brian Carlstrom#include <string>
22e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom#include <vector>
23e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom
243f5838d7d0b9fc63db0ccc35c2ea05ed29264986Vladimir Marko#include "base/mutex.h"
25539690a351d8c325707368729aafa2b4fa134d4cVladimir Marko#include "base/stringpiece.h"
262dd0e2cea360bc9206eb88ecc40d259e796c239dIan Rogers#include "dex_file.h"
272dd0e2cea360bc9206eb88ecc40d259e796c239dIan Rogers#include "invoke_type.h"
282dd0e2cea360bc9206eb88ecc40d259e796c239dIan Rogers#include "mem_map.h"
2998d1cc8033251c93786e2fa8c59a2e555a9493beMingyao Yang#include "mirror/class.h"
302dd0e2cea360bc9206eb88ecc40d259e796c239dIan Rogers#include "oat.h"
31700c8d31733534a3d978b75a03f6f7e177dc7e81Brian Carlstrom#include "os.h"
326bc4374e3fa00e3ee5e832e1761c43e0b8a71558Nicolas Geoffray#include "utils.h"
337b49e6cade09bc65b3b5f22d45fc9d0a7184e4f2David Brazdil#include "vdex_file.h"
34e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom
35e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstromnamespace art {
36e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom
37ba150c37d582eeeb8c11ba5245edc281cf31793cBrian Carlstromclass BitVector;
38700c8d31733534a3d978b75a03f6f7e177dc7e81Brian Carlstromclass ElfFile;
39700c8d31733534a3d978b75a03f6f7e177dc7e81Brian Carlstromclass MemMap;
40700c8d31733534a3d978b75a03f6f7e177dc7e81Brian Carlstromclass OatMethodOffsets;
4133e9566255c426e7a2c8fca5b8a1b6a94a5d352cIan Rogersclass OatHeader;
4207b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhlerclass OatDexFile;
43700c8d31733534a3d978b75a03f6f7e177dc7e81Brian Carlstrom
445351da0225d027a19420153615634a1c78966bcaMathieu Chartiernamespace gc {
455351da0225d027a19420153615634a1c78966bcaMathieu Chartiernamespace collector {
465351da0225d027a19420153615634a1c78966bcaMathieu Chartierclass DummyOatFile;
475351da0225d027a19420153615634a1c78966bcaMathieu Chartier}  // namespace collector
485351da0225d027a19420153615634a1c78966bcaMathieu Chartier}  // namespace gc
495351da0225d027a19420153615634a1c78966bcaMathieu Chartier
507b49e6cade09bc65b3b5f22d45fc9d0a7184e4f2David Brazdil// Runtime representation of the OAT file format which holds compiler output.
517b49e6cade09bc65b3b5f22d45fc9d0a7184e4f2David Brazdil// The class opens an OAT file from storage and maps it to memory, typically with
527b49e6cade09bc65b3b5f22d45fc9d0a7184e4f2David Brazdil// dlopen and provides access to its internal data structures (see OatWriter for
537b49e6cade09bc65b3b5f22d45fc9d0a7184e4f2David Brazdil// for more details about the OAT format).
547b49e6cade09bc65b3b5f22d45fc9d0a7184e4f2David Brazdil// In the process of loading OAT, the class also loads the associated VDEX file
557b49e6cade09bc65b3b5f22d45fc9d0a7184e4f2David Brazdil// with the input DEX files (see VdexFile for details about the VDEX format).
567b49e6cade09bc65b3b5f22d45fc9d0a7184e4f2David Brazdil// The raw DEX data are accessible transparently through the OatDexFile objects.
577b49e6cade09bc65b3b5f22d45fc9d0a7184e4f2David Brazdil
58049cff0ed5e28aa17a17e456efe3121b6d58910fAndreas Gampeclass OatFile {
59e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom public:
60f0192c86a58b2f43378c9a2113007538dd38ddbfJeff Hao  // Special classpath that skips shared library check.
61f0192c86a58b2f43378c9a2113007538dd38ddbfJeff Hao  static constexpr const char* kSpecialSharedLibrary = "&";
62f0192c86a58b2f43378c9a2113007538dd38ddbfJeff Hao
6307b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  typedef art::OatDexFile OatDexFile;
6407b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler
6584d7605f93f1e6e86a16e02017e305c90e93117aAlex Light  // Opens an oat file contained within the given elf file. This is always opened as
6684d7605f93f1e6e86a16e02017e305c90e93117aAlex Light  // non-executable at the moment.
67c93b3be140f6a57a572f2a4cdaf46aba87235a02David Brazdil  static OatFile* OpenWithElfFile(ElfFile* elf_file,
68c93b3be140f6a57a572f2a4cdaf46aba87235a02David Brazdil                                  VdexFile* vdex_file,
69c93b3be140f6a57a572f2a4cdaf46aba87235a02David Brazdil                                  const std::string& location,
70e5fed03772144595c0904faf3d6974cc55214c8cRichard Uhler                                  const char* abs_dex_location,
71b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin                                  std::string* error_msg);
722cebb24bfc3247d3e9be138a3350106737455918Mathieu Chartier  // Open an oat file. Returns null on failure.  Requested base can
73e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom  // optionally be used to request where the file should be loaded.
74e5fed03772144595c0904faf3d6974cc55214c8cRichard Uhler  // See the ResolveRelativeEncodedDexLocation for a description of how the
75e5fed03772144595c0904faf3d6974cc55214c8cRichard Uhler  // abs_dex_location argument is used.
76e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom  static OatFile* Open(const std::string& filename,
77a004aa933a58428489e42d77f707c2b063b73747Brian Carlstrom                       const std::string& location,
7813735955f39b3b304c37d2b2840663c131262c18Ian Rogers                       uint8_t* requested_base,
7946774767fcf7780d1455e755729198648d08742eIgor Murashkin                       uint8_t* oat_file_begin,
808d31bbd3d6536de12bc20e3d29cfe03fe848f9daIan Rogers                       bool executable,
810b4cbd0c2a75b47ae09d21e5d73d2b1709cb5b9eMathieu Chartier                       bool low_4gb,
82e5fed03772144595c0904faf3d6974cc55214c8cRichard Uhler                       const char* abs_dex_location,
83b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin                       std::string* error_msg);
84e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom
85700c8d31733534a3d978b75a03f6f7e177dc7e81Brian Carlstrom  // Open an oat file from an already opened File.
86265091e581c9f643b37e7966890911f09e223269Brian Carlstrom  // Does not use dlopen underneath so cannot be used for runtime use
87265091e581c9f643b37e7966890911f09e223269Brian Carlstrom  // where relocations may be required. Currently used from
88265091e581c9f643b37e7966890911f09e223269Brian Carlstrom  // ImageWriter which wants to open a writable version from an existing
89265091e581c9f643b37e7966890911f09e223269Brian Carlstrom  // file descriptor for patching.
90b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin  static OatFile* OpenWritable(File* file, const std::string& location,
91e5fed03772144595c0904faf3d6974cc55214c8cRichard Uhler                               const char* abs_dex_location,
92b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin                               std::string* error_msg);
93a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light  // Opens an oat file from an already opened File. Maps it PROT_READ, MAP_PRIVATE.
94b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin  static OatFile* OpenReadable(File* file, const std::string& location,
95e5fed03772144595c0904faf3d6974cc55214c8cRichard Uhler                               const char* abs_dex_location,
96b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin                               std::string* error_msg);
97700c8d31733534a3d978b75a03f6f7e177dc7e81Brian Carlstrom
98049cff0ed5e28aa17a17e456efe3121b6d58910fAndreas Gampe  virtual ~OatFile();
99e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom
1009dcc4572949f6a8231a1b4ed859676ba6f411726Alex Light  bool IsExecutable() const {
1019dcc4572949f6a8231a1b4ed859676ba6f411726Alex Light    return is_executable_;
1029dcc4572949f6a8231a1b4ed859676ba6f411726Alex Light  }
1039dcc4572949f6a8231a1b4ed859676ba6f411726Alex Light
104d1537b569b6cd18297c5e02d13cdd588c4366c51Richard Uhler  bool HasPatchInfo() const;
105d1537b569b6cd18297c5e02d13cdd588c4366c51Richard Uhler
1067ba649636c4475c3992fa15a57acd2546d69ff38Andreas Gampe  bool IsPic() const;
1077ba649636c4475c3992fa15a57acd2546d69ff38Andreas Gampe
1080de1133ba600f299b3d67938f650720d9f859eb2Sebastien Hertz  // Indicates whether the oat file was compiled with full debugging capability.
1090de1133ba600f299b3d67938f650720d9f859eb2Sebastien Hertz  bool IsDebuggable() const;
1100de1133ba600f299b3d67938f650720d9f859eb2Sebastien Hertz
11129d38e77c553c6cf71fc4dafe2d22b4e3f814872Andreas Gampe  CompilerFilter::Filter GetCompilerFilter() const;
112b077e15d2d11b7c81aacbcd4a46c2b1e9c9ba20dCalin Juravle
113e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom  const std::string& GetLocation() const {
114e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom    return location_;
115e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom  }
116e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom
117e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom  const OatHeader& GetOatHeader() const;
118e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom
11907b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  class OatMethod FINAL {
1203320cf46afd082398aa401b246e6f301cebdf64dBrian Carlstrom   public:
121e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier    void LinkMethod(ArtMethod* method) const;
122ae826983f7903bc0a6bbbe8426bf393fb2f6d747Brian Carlstrom
123c04c800e7bda94abfadc8c2d30f58c50b261b612Nicolas Geoffray    uint32_t GetCodeOffset() const;
124ae826983f7903bc0a6bbbe8426bf393fb2f6d747Brian Carlstrom
125c04c800e7bda94abfadc8c2d30f58c50b261b612Nicolas Geoffray    const void* GetQuickCode() const;
1262cbaccb67e22c0b313a9785bfc65bcb4b25d0676Brian Carlstrom
1272cbaccb67e22c0b313a9785bfc65bcb4b25d0676Brian Carlstrom    // Returns size of quick code.
128ef7d42fca18c16fbaf103822ad16f23246e2905dIan Rogers    uint32_t GetQuickCodeSize() const;
1292cbaccb67e22c0b313a9785bfc65bcb4b25d0676Brian Carlstrom    uint32_t GetQuickCodeSizeOffset() const;
1302cbaccb67e22c0b313a9785bfc65bcb4b25d0676Brian Carlstrom
1312cbaccb67e22c0b313a9785bfc65bcb4b25d0676Brian Carlstrom    // Returns OatQuickMethodHeader for debugging. Most callers should
1322cbaccb67e22c0b313a9785bfc65bcb4b25d0676Brian Carlstrom    // use more specific methods such as GetQuickCodeSize.
1332cbaccb67e22c0b313a9785bfc65bcb4b25d0676Brian Carlstrom    const OatQuickMethodHeader* GetOatQuickMethodHeader() const;
1342cbaccb67e22c0b313a9785bfc65bcb4b25d0676Brian Carlstrom    uint32_t GetOatQuickMethodHeaderOffset() const;
1350c717dd1c56bd29cf860d0feda8e629dab2cadb3Logan Chien
1367624d25dad2d1ba25969ae704fccf68649103ae5Vladimir Marko    size_t GetFrameSizeInBytes() const;
1377624d25dad2d1ba25969ae704fccf68649103ae5Vladimir Marko    uint32_t GetCoreSpillMask() const;
1387624d25dad2d1ba25969ae704fccf68649103ae5Vladimir Marko    uint32_t GetFpSpillMask() const;
1392cbaccb67e22c0b313a9785bfc65bcb4b25d0676Brian Carlstrom
1408a630577ed2d9e9571c3434c505e5de223b23c07Vladimir Marko    const uint8_t* GetVmapTable() const;
1412cbaccb67e22c0b313a9785bfc65bcb4b25d0676Brian Carlstrom    uint32_t GetVmapTableOffset() const;
1422cbaccb67e22c0b313a9785bfc65bcb4b25d0676Brian Carlstrom    uint32_t GetVmapTableOffsetOffset() const;
1438a630577ed2d9e9571c3434c505e5de223b23c07Vladimir Marko
144ae826983f7903bc0a6bbbe8426bf393fb2f6d747Brian Carlstrom    // Create an OatMethod with offsets relative to the given base address
145957ca1cd025104fccb0b08928f955f9bdb4ab91cMathieu Chartier    OatMethod(const uint8_t* base, const uint32_t code_offset)
146957ca1cd025104fccb0b08928f955f9bdb4ab91cMathieu Chartier        : begin_(base), code_offset_(code_offset) {
14797b52f89e5e0b52a08d4b9a3953d0973a3cf5636Ian Rogers    }
148758a801b66c134361a7b43f7e83f85d1fb800c4cAndreas Gampe    OatMethod(const OatMethod&) = default;
14997b52f89e5e0b52a08d4b9a3953d0973a3cf5636Ian Rogers    ~OatMethod() {}
1503320cf46afd082398aa401b246e6f301cebdf64dBrian Carlstrom
151758a801b66c134361a7b43f7e83f85d1fb800c4cAndreas Gampe    OatMethod& operator=(const OatMethod&) = default;
152758a801b66c134361a7b43f7e83f85d1fb800c4cAndreas Gampe
15397b52f89e5e0b52a08d4b9a3953d0973a3cf5636Ian Rogers    // A representation of an invalid OatMethod, used when an OatMethod or OatClass can't be found.
15497b52f89e5e0b52a08d4b9a3953d0973a3cf5636Ian Rogers    // See ClassLinker::FindOatMethodFor.
15597b52f89e5e0b52a08d4b9a3953d0973a3cf5636Ian Rogers    static const OatMethod Invalid() {
156957ca1cd025104fccb0b08928f955f9bdb4ab91cMathieu Chartier      return OatMethod(nullptr, -1);
15797b52f89e5e0b52a08d4b9a3953d0973a3cf5636Ian Rogers    }
1584fcdc94d22a4608e355aa8df36240181149d10e8Nicolas Geoffray
159ae826983f7903bc0a6bbbe8426bf393fb2f6d747Brian Carlstrom   private:
160ae826983f7903bc0a6bbbe8426bf393fb2f6d747Brian Carlstrom    template<class T>
161ae826983f7903bc0a6bbbe8426bf393fb2f6d747Brian Carlstrom    T GetOatPointer(uint32_t offset) const {
162ae826983f7903bc0a6bbbe8426bf393fb2f6d747Brian Carlstrom      if (offset == 0) {
1632cebb24bfc3247d3e9be138a3350106737455918Mathieu Chartier        return nullptr;
164ae826983f7903bc0a6bbbe8426bf393fb2f6d747Brian Carlstrom      }
16530fab40ee5a07af6b8c3b6b0e9438071695a57f4Ian Rogers      return reinterpret_cast<T>(begin_ + offset);
166ae826983f7903bc0a6bbbe8426bf393fb2f6d747Brian Carlstrom    }
1673320cf46afd082398aa401b246e6f301cebdf64dBrian Carlstrom
168e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier    const uint8_t* begin_;
169e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier    uint32_t code_offset_;
170ae826983f7903bc0a6bbbe8426bf393fb2f6d747Brian Carlstrom
171ae826983f7903bc0a6bbbe8426bf393fb2f6d747Brian Carlstrom    friend class OatClass;
1723320cf46afd082398aa401b246e6f301cebdf64dBrian Carlstrom  };
1733320cf46afd082398aa401b246e6f301cebdf64dBrian Carlstrom
17407b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  class OatClass FINAL {
175e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom   public:
176ba150c37d582eeeb8c11ba5245edc281cf31793cBrian Carlstrom    mirror::Class::Status GetStatus() const {
177ba150c37d582eeeb8c11ba5245edc281cf31793cBrian Carlstrom      return status_;
178ba150c37d582eeeb8c11ba5245edc281cf31793cBrian Carlstrom    }
179ba150c37d582eeeb8c11ba5245edc281cf31793cBrian Carlstrom
180ba150c37d582eeeb8c11ba5245edc281cf31793cBrian Carlstrom    OatClassType GetType() const {
181ba150c37d582eeeb8c11ba5245edc281cf31793cBrian Carlstrom      return type_;
182ba150c37d582eeeb8c11ba5245edc281cf31793cBrian Carlstrom    }
1830755ec5ea1dce0b549fc1adefeb52d89f119ebecBrian Carlstrom
184eb8167a4f4d27fce0530f6724ab8032610cd146bMathieu Chartier    // Get the OatMethod entry based on its index into the class
1852cbaccb67e22c0b313a9785bfc65bcb4b25d0676Brian Carlstrom    // defintion. Direct methods come first, followed by virtual
1862cbaccb67e22c0b313a9785bfc65bcb4b25d0676Brian Carlstrom    // methods. Note that runtime created methods such as miranda
187e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom    // methods are not included.
188aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom    const OatMethod GetOatMethod(uint32_t method_index) const;
189e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom
1902cbaccb67e22c0b313a9785bfc65bcb4b25d0676Brian Carlstrom    // Return a pointer to the OatMethodOffsets for the requested
1912cebb24bfc3247d3e9be138a3350106737455918Mathieu Chartier    // method_index, or null if none is present. Note that most
1922cbaccb67e22c0b313a9785bfc65bcb4b25d0676Brian Carlstrom    // callers should use GetOatMethod.
1932cbaccb67e22c0b313a9785bfc65bcb4b25d0676Brian Carlstrom    const OatMethodOffsets* GetOatMethodOffsets(uint32_t method_index) const;
1942cbaccb67e22c0b313a9785bfc65bcb4b25d0676Brian Carlstrom
1952cbaccb67e22c0b313a9785bfc65bcb4b25d0676Brian Carlstrom    // Return the offset from the start of the OatFile to the
1962cbaccb67e22c0b313a9785bfc65bcb4b25d0676Brian Carlstrom    // OatMethodOffsets for the requested method_index, or 0 if none
1972cbaccb67e22c0b313a9785bfc65bcb4b25d0676Brian Carlstrom    // is present. Note that most callers should use GetOatMethod.
1982cbaccb67e22c0b313a9785bfc65bcb4b25d0676Brian Carlstrom    uint32_t GetOatMethodOffsetsOffset(uint32_t method_index) const;
1992cbaccb67e22c0b313a9785bfc65bcb4b25d0676Brian Carlstrom
20097b52f89e5e0b52a08d4b9a3953d0973a3cf5636Ian Rogers    // A representation of an invalid OatClass, used when an OatClass can't be found.
20197b52f89e5e0b52a08d4b9a3953d0973a3cf5636Ian Rogers    // See ClassLinker::FindOatClass.
20297b52f89e5e0b52a08d4b9a3953d0973a3cf5636Ian Rogers    static OatClass Invalid() {
20397b52f89e5e0b52a08d4b9a3953d0973a3cf5636Ian Rogers      return OatClass(nullptr, mirror::Class::kStatusError, kOatClassNoneCompiled, 0, nullptr,
20497b52f89e5e0b52a08d4b9a3953d0973a3cf5636Ian Rogers                      nullptr);
20597b52f89e5e0b52a08d4b9a3953d0973a3cf5636Ian Rogers    }
2064fcdc94d22a4608e355aa8df36240181149d10e8Nicolas Geoffray
207e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom   private:
2080755ec5ea1dce0b549fc1adefeb52d89f119ebecBrian Carlstrom    OatClass(const OatFile* oat_file,
2092dd0e2cea360bc9206eb88ecc40d259e796c239dIan Rogers             mirror::Class::Status status,
210ba150c37d582eeeb8c11ba5245edc281cf31793cBrian Carlstrom             OatClassType type,
211ba150c37d582eeeb8c11ba5245edc281cf31793cBrian Carlstrom             uint32_t bitmap_size,
212ba150c37d582eeeb8c11ba5245edc281cf31793cBrian Carlstrom             const uint32_t* bitmap_pointer,
2130755ec5ea1dce0b549fc1adefeb52d89f119ebecBrian Carlstrom             const OatMethodOffsets* methods_pointer);
2143320cf46afd082398aa401b246e6f301cebdf64dBrian Carlstrom
21597b52f89e5e0b52a08d4b9a3953d0973a3cf5636Ian Rogers    const OatFile* const oat_file_;
216ba150c37d582eeeb8c11ba5245edc281cf31793cBrian Carlstrom
21797b52f89e5e0b52a08d4b9a3953d0973a3cf5636Ian Rogers    const mirror::Class::Status status_;
218ba150c37d582eeeb8c11ba5245edc281cf31793cBrian Carlstrom
21997b52f89e5e0b52a08d4b9a3953d0973a3cf5636Ian Rogers    const OatClassType type_;
220ba150c37d582eeeb8c11ba5245edc281cf31793cBrian Carlstrom
22197b52f89e5e0b52a08d4b9a3953d0973a3cf5636Ian Rogers    const uint32_t* const bitmap_;
222ba150c37d582eeeb8c11ba5245edc281cf31793cBrian Carlstrom
22397b52f89e5e0b52a08d4b9a3953d0973a3cf5636Ian Rogers    const OatMethodOffsets* const methods_pointer_;
224e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom
22507b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler    friend class art::OatDexFile;
226e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom  };
2279a37efc6e1a8dd9fe6978f209fb493510267c528Richard Uhler
2289a37efc6e1a8dd9fe6978f209fb493510267c528Richard Uhler  // Get the OatDexFile for the given dex_location within this oat file.
2299a37efc6e1a8dd9fe6978f209fb493510267c528Richard Uhler  // If dex_location_checksum is non-null, the OatDexFile will only be
2309a37efc6e1a8dd9fe6978f209fb493510267c528Richard Uhler  // returned if it has a matching checksum.
2319a37efc6e1a8dd9fe6978f209fb493510267c528Richard Uhler  // If error_msg is non-null and no OatDexFile is returned, error_msg will
2329a37efc6e1a8dd9fe6978f209fb493510267c528Richard Uhler  // be updated with a description of why no OatDexFile was returned.
2338d31bbd3d6536de12bc20e3d29cfe03fe848f9daIan Rogers  const OatDexFile* GetOatDexFile(const char* dex_location,
234756ee4e090bc1e1812b41fb7b4661df601a32ef9Brian Carlstrom                                  const uint32_t* const dex_location_checksum,
2359a37efc6e1a8dd9fe6978f209fb493510267c528Richard Uhler                                  /*out*/std::string* error_msg = nullptr) const
23690443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier      REQUIRES(!secondary_lookup_lock_);
2378d31bbd3d6536de12bc20e3d29cfe03fe848f9daIan Rogers
238aa4497db59f1eeec954f2ba5da6d458fcdf9b3a4Vladimir Marko  const std::vector<const OatDexFile*>& GetOatDexFiles() const {
239aa4497db59f1eeec954f2ba5da6d458fcdf9b3a4Vladimir Marko    return oat_dex_files_storage_;
240aa4497db59f1eeec954f2ba5da6d458fcdf9b3a4Vladimir Marko  }
241e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom
24230fab40ee5a07af6b8c3b6b0e9438071695a57f4Ian Rogers  size_t Size() const {
24330fab40ee5a07af6b8c3b6b0e9438071695a57f4Ian Rogers    return End() - Begin();
244e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom  }
245e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom
2466ea1a0e2168c8d9b6d97c075c73a72d84080f45bMingyao Yang  bool Contains(const void* p) const {
2476ea1a0e2168c8d9b6d97c075c73a72d84080f45bMingyao Yang    return p >= Begin() && p < End();
2486ea1a0e2168c8d9b6d97c075c73a72d84080f45bMingyao Yang  }
2496ea1a0e2168c8d9b6d97c075c73a72d84080f45bMingyao Yang
2505c42c29b89286e5efa4a4613132b09051ce5945bVladimir Marko  size_t BssSize() const {
2515c42c29b89286e5efa4a4613132b09051ce5945bVladimir Marko    return BssEnd() - BssBegin();
2525c42c29b89286e5efa4a4613132b09051ce5945bVladimir Marko  }
2535c42c29b89286e5efa4a4613132b09051ce5945bVladimir Marko
2547b49e6cade09bc65b3b5f22d45fc9d0a7184e4f2David Brazdil  size_t DexSize() const {
2557b49e6cade09bc65b3b5f22d45fc9d0a7184e4f2David Brazdil    return DexEnd() - DexBegin();
2567b49e6cade09bc65b3b5f22d45fc9d0a7184e4f2David Brazdil  }
2577b49e6cade09bc65b3b5f22d45fc9d0a7184e4f2David Brazdil
25813735955f39b3b304c37d2b2840663c131262c18Ian Rogers  const uint8_t* Begin() const;
25913735955f39b3b304c37d2b2840663c131262c18Ian Rogers  const uint8_t* End() const;
26053cb16b98acf3cf6f3a1e2204ad4958ecf1b5a3cAlex Light
2615c42c29b89286e5efa4a4613132b09051ce5945bVladimir Marko  const uint8_t* BssBegin() const;
2625c42c29b89286e5efa4a4613132b09051ce5945bVladimir Marko  const uint8_t* BssEnd() const;
2635c42c29b89286e5efa4a4613132b09051ce5945bVladimir Marko
2647b49e6cade09bc65b3b5f22d45fc9d0a7184e4f2David Brazdil  const uint8_t* DexBegin() const;
2657b49e6cade09bc65b3b5f22d45fc9d0a7184e4f2David Brazdil  const uint8_t* DexEnd() const;
2667b49e6cade09bc65b3b5f22d45fc9d0a7184e4f2David Brazdil
267e5fed03772144595c0904faf3d6974cc55214c8cRichard Uhler  // Returns the absolute dex location for the encoded relative dex location.
268e5fed03772144595c0904faf3d6974cc55214c8cRichard Uhler  //
2692cebb24bfc3247d3e9be138a3350106737455918Mathieu Chartier  // If not null, abs_dex_location is used to resolve the absolute dex
270e5fed03772144595c0904faf3d6974cc55214c8cRichard Uhler  // location of relative dex locations encoded in the oat file.
271e5fed03772144595c0904faf3d6974cc55214c8cRichard Uhler  // For example, given absolute location "/data/app/foo/base.apk", encoded
272e5fed03772144595c0904faf3d6974cc55214c8cRichard Uhler  // dex locations "base.apk", "base.apk:classes2.dex", etc. would be resolved
273e5fed03772144595c0904faf3d6974cc55214c8cRichard Uhler  // to "/data/app/foo/base.apk", "/data/app/foo/base.apk:classes2.dex", etc.
274e5fed03772144595c0904faf3d6974cc55214c8cRichard Uhler  // Relative encoded dex locations that don't match the given abs_dex_location
275e5fed03772144595c0904faf3d6974cc55214c8cRichard Uhler  // are left unchanged.
276e5fed03772144595c0904faf3d6974cc55214c8cRichard Uhler  static std::string ResolveRelativeEncodedDexLocation(
277e5fed03772144595c0904faf3d6974cc55214c8cRichard Uhler      const char* abs_dex_location, const std::string& rel_dex_location);
278e5fed03772144595c0904faf3d6974cc55214c8cRichard Uhler
2797848da48a0a4241dedc1cc83ac4931e61575eb92Andreas Gampe  // Create a dependency list (dex locations and checksums) for the given dex files.
2807848da48a0a4241dedc1cc83ac4931e61575eb92Andreas Gampe  static std::string EncodeDexFileDependencies(const std::vector<const DexFile*>& dex_files);
2817848da48a0a4241dedc1cc83ac4931e61575eb92Andreas Gampe
2827848da48a0a4241dedc1cc83ac4931e61575eb92Andreas Gampe  // Check the given dependency list against their dex files - thus the name "Static," this does
2837848da48a0a4241dedc1cc83ac4931e61575eb92Andreas Gampe  // not check the class-loader environment, only whether there have been file updates.
284b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin  static bool CheckStaticDexFileDependencies(const char* dex_dependencies, std::string* msg);
2857848da48a0a4241dedc1cc83ac4931e61575eb92Andreas Gampe
2867848da48a0a4241dedc1cc83ac4931e61575eb92Andreas Gampe  // Get the dex locations of a dependency list. Note: this is *not* cleaned for synthetic
2877848da48a0a4241dedc1cc83ac4931e61575eb92Andreas Gampe  // locations of multidex files.
2887848da48a0a4241dedc1cc83ac4931e61575eb92Andreas Gampe  static bool GetDexLocationsFromDependencies(const char* dex_dependencies,
289b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin                                              std::vector<std::string>* locations);
2907848da48a0a4241dedc1cc83ac4931e61575eb92Andreas Gampe
291049cff0ed5e28aa17a17e456efe3121b6d58910fAndreas Gampe protected:
292049cff0ed5e28aa17a17e456efe3121b6d58910fAndreas Gampe  OatFile(const std::string& filename, bool executable);
293e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom
294049cff0ed5e28aa17a17e456efe3121b6d58910fAndreas Gampe private:
295e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom  // The oat file name.
296e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom  //
297e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom  // The image will embed this to link its associated oat file.
298e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom  const std::string location_;
299e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom
3007b49e6cade09bc65b3b5f22d45fc9d0a7184e4f2David Brazdil  // Pointer to the Vdex file with the Dex files for this Oat file.
3017b49e6cade09bc65b3b5f22d45fc9d0a7184e4f2David Brazdil  std::unique_ptr<VdexFile> vdex_;
3027b49e6cade09bc65b3b5f22d45fc9d0a7184e4f2David Brazdil
303700c8d31733534a3d978b75a03f6f7e177dc7e81Brian Carlstrom  // Pointer to OatHeader.
30413735955f39b3b304c37d2b2840663c131262c18Ian Rogers  const uint8_t* begin_;
305700c8d31733534a3d978b75a03f6f7e177dc7e81Brian Carlstrom
306700c8d31733534a3d978b75a03f6f7e177dc7e81Brian Carlstrom  // Pointer to end of oat region for bounds checking.
30713735955f39b3b304c37d2b2840663c131262c18Ian Rogers  const uint8_t* end_;
308700c8d31733534a3d978b75a03f6f7e177dc7e81Brian Carlstrom
3092cebb24bfc3247d3e9be138a3350106737455918Mathieu Chartier  // Pointer to the .bss section, if present, otherwise null.
31006d7aaa75f3d6d21fe904d54208b28e486673d97Vladimir Marko  uint8_t* bss_begin_;
3115c42c29b89286e5efa4a4613132b09051ce5945bVladimir Marko
3122cebb24bfc3247d3e9be138a3350106737455918Mathieu Chartier  // Pointer to the end of the .bss section, if present, otherwise null.
31306d7aaa75f3d6d21fe904d54208b28e486673d97Vladimir Marko  uint8_t* bss_end_;
3145c42c29b89286e5efa4a4613132b09051ce5945bVladimir Marko
3159dcc4572949f6a8231a1b4ed859676ba6f411726Alex Light  // Was this oat_file loaded executable?
3169dcc4572949f6a8231a1b4ed859676ba6f411726Alex Light  const bool is_executable_;
3179dcc4572949f6a8231a1b4ed859676ba6f411726Alex Light
318aa4497db59f1eeec954f2ba5da6d458fcdf9b3a4Vladimir Marko  // Owning storage for the OatDexFile objects.
319aa4497db59f1eeec954f2ba5da6d458fcdf9b3a4Vladimir Marko  std::vector<const OatDexFile*> oat_dex_files_storage_;
320aa4497db59f1eeec954f2ba5da6d458fcdf9b3a4Vladimir Marko
3213f5838d7d0b9fc63db0ccc35c2ea05ed29264986Vladimir Marko  // NOTE: We use a StringPiece as the key type to avoid a memory allocation on every
3223f5838d7d0b9fc63db0ccc35c2ea05ed29264986Vladimir Marko  // lookup with a const char* key. The StringPiece doesn't own its backing storage,
3233f5838d7d0b9fc63db0ccc35c2ea05ed29264986Vladimir Marko  // therefore we're using the OatDexFile::dex_file_location_ as the backing storage
3243f5838d7d0b9fc63db0ccc35c2ea05ed29264986Vladimir Marko  // for keys in oat_dex_files_ and the string_cache_ entries for the backing storage
3253f5838d7d0b9fc63db0ccc35c2ea05ed29264986Vladimir Marko  // of keys in secondary_oat_dex_files_ and oat_dex_files_by_canonical_location_.
326bad0267eaab9d6a522d05469ff90501deefdb88bMathieu Chartier  typedef AllocationTrackingSafeMap<StringPiece, const OatDexFile*, kAllocatorTagOatFile> Table;
3273f5838d7d0b9fc63db0ccc35c2ea05ed29264986Vladimir Marko
328aa4497db59f1eeec954f2ba5da6d458fcdf9b3a4Vladimir Marko  // Map each location and canonical location (if different) retrieved from the
329aa4497db59f1eeec954f2ba5da6d458fcdf9b3a4Vladimir Marko  // oat file to its OatDexFile. This map doesn't change after it's constructed in Setup()
330aa4497db59f1eeec954f2ba5da6d458fcdf9b3a4Vladimir Marko  // and therefore doesn't need any locking and provides the cheapest dex file lookup
3312cebb24bfc3247d3e9be138a3350106737455918Mathieu Chartier  // for GetOatDexFile() for a very frequent use case. Never contains a null value.
332aa4497db59f1eeec954f2ba5da6d458fcdf9b3a4Vladimir Marko  Table oat_dex_files_;
3333f5838d7d0b9fc63db0ccc35c2ea05ed29264986Vladimir Marko
3343f5838d7d0b9fc63db0ccc35c2ea05ed29264986Vladimir Marko  // Lock guarding all members needed for secondary lookup in GetOatDexFile().
3353f5838d7d0b9fc63db0ccc35c2ea05ed29264986Vladimir Marko  mutable Mutex secondary_lookup_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER;
3363f5838d7d0b9fc63db0ccc35c2ea05ed29264986Vladimir Marko
3373f5838d7d0b9fc63db0ccc35c2ea05ed29264986Vladimir Marko  // If the primary oat_dex_files_ lookup fails, use a secondary map. This map stores
3383f5838d7d0b9fc63db0ccc35c2ea05ed29264986Vladimir Marko  // the results of all previous secondary lookups, whether successful (non-null) or
3393f5838d7d0b9fc63db0ccc35c2ea05ed29264986Vladimir Marko  // failed (null). If it doesn't contain an entry we need to calculate the canonical
3403f5838d7d0b9fc63db0ccc35c2ea05ed29264986Vladimir Marko  // location and use oat_dex_files_by_canonical_location_.
3413f5838d7d0b9fc63db0ccc35c2ea05ed29264986Vladimir Marko  mutable Table secondary_oat_dex_files_ GUARDED_BY(secondary_lookup_lock_);
3423f5838d7d0b9fc63db0ccc35c2ea05ed29264986Vladimir Marko
3433f5838d7d0b9fc63db0ccc35c2ea05ed29264986Vladimir Marko  // Cache of strings. Contains the backing storage for keys in the secondary_oat_dex_files_
3443f5838d7d0b9fc63db0ccc35c2ea05ed29264986Vladimir Marko  // and the lazily initialized oat_dex_files_by_canonical_location_.
3453f5838d7d0b9fc63db0ccc35c2ea05ed29264986Vladimir Marko  // NOTE: We're keeping references to contained strings in form of StringPiece and adding
3463f5838d7d0b9fc63db0ccc35c2ea05ed29264986Vladimir Marko  // new strings to the end. The adding of a new element must not touch any previously stored
3473f5838d7d0b9fc63db0ccc35c2ea05ed29264986Vladimir Marko  // elements. std::list<> and std::deque<> satisfy this requirement, std::vector<> doesn't.
3483f5838d7d0b9fc63db0ccc35c2ea05ed29264986Vladimir Marko  mutable std::list<std::string> string_cache_ GUARDED_BY(secondary_lookup_lock_);
349e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom
3505351da0225d027a19420153615634a1c78966bcaMathieu Chartier  friend class gc::collector::DummyOatFile;  // For modifying begin_ and end_.
351e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom  friend class OatClass;
35207b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  friend class art::OatDexFile;
353e3c845cdb5884e770287a5c0c65c8bb64733c388Elliott Hughes  friend class OatDumper;  // For GetBase and GetLimit
354049cff0ed5e28aa17a17e456efe3121b6d58910fAndreas Gampe  friend class OatFileBase;
355e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom  DISALLOW_COPY_AND_ASSIGN(OatFile);
356e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom};
357e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom
35807b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler// OatDexFile should be an inner class of OatFile. Unfortunately, C++ doesn't
35907b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler// support forward declarations of inner classes, and we want to
36007b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler// forward-declare OatDexFile so that we can store an opaque pointer to an
36107b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler// OatDexFile in DexFile.
36207b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhlerclass OatDexFile FINAL {
36307b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler public:
36407b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  // Opens the DexFile referred to by this OatDexFile from within the containing OatFile.
365b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin  std::unique_ptr<const DexFile> OpenDexFile(std::string* error_msg) const;
36607b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler
36707b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  const OatFile* GetOatFile() const {
36807b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler    return oat_file_;
36907b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  }
37007b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler
37107b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  // Returns the size of the DexFile refered to by this OatDexFile.
37207b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  size_t FileSize() const;
37307b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler
37407b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  // Returns original path of DexFile that was the source of this OatDexFile.
37507b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  const std::string& GetDexFileLocation() const {
37607b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler    return dex_file_location_;
37707b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  }
37807b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler
37907b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  // Returns the canonical location of DexFile that was the source of this OatDexFile.
38007b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  const std::string& GetCanonicalDexFileLocation() const {
38107b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler    return canonical_dex_file_location_;
38207b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  }
38307b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler
38407b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  // Returns checksum of original DexFile that was the source of this OatDexFile;
38507b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  uint32_t GetDexFileLocationChecksum() const {
38607b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler    return dex_file_location_checksum_;
38707b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  }
38807b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler
38907b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  // Returns the OatClass for the class specified by the given DexFile class_def_index.
39007b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  OatFile::OatClass GetOatClass(uint16_t class_def_index) const;
39107b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler
39207b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  // Returns the offset to the OatClass information. Most callers should use GetOatClass.
39307b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  uint32_t GetOatClassOffset(uint16_t class_def_index) const;
39407b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler
39506d7aaa75f3d6d21fe904d54208b28e486673d97Vladimir Marko  uint8_t* GetDexCacheArrays() const {
39609d0943f5efe92c1f3a6b9dbdf255adb0f960a22Vladimir Marko    return dex_cache_arrays_;
39709d0943f5efe92c1f3a6b9dbdf255adb0f960a22Vladimir Marko  }
39809d0943f5efe92c1f3a6b9dbdf255adb0f960a22Vladimir Marko
399d9786b0e5be23ea0258405165098b4216579209cArtem Udovichenko  const uint8_t* GetLookupTableData() const {
400d9786b0e5be23ea0258405165098b4216579209cArtem Udovichenko    return lookup_table_data_;
401d9786b0e5be23ea0258405165098b4216579209cArtem Udovichenko  }
402d9786b0e5be23ea0258405165098b4216579209cArtem Udovichenko
4032ba8895b4257d0e32a7b269bc2e7f6a3ec39a86aAndreas Gampe  const uint8_t* GetDexFilePointer() const {
4042ba8895b4257d0e32a7b269bc2e7f6a3ec39a86aAndreas Gampe    return dex_file_pointer_;
4052ba8895b4257d0e32a7b269bc2e7f6a3ec39a86aAndreas Gampe  }
4062ba8895b4257d0e32a7b269bc2e7f6a3ec39a86aAndreas Gampe
40707b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  ~OatDexFile();
40807b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler
40907b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler private:
41007b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  OatDexFile(const OatFile* oat_file,
41107b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler             const std::string& dex_file_location,
41207b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler             const std::string& canonical_dex_file_location,
41307b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler             uint32_t dex_file_checksum,
41407b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler             const uint8_t* dex_file_pointer,
415d9786b0e5be23ea0258405165098b4216579209cArtem Udovichenko             const uint8_t* lookup_table_data,
41609d0943f5efe92c1f3a6b9dbdf255adb0f960a22Vladimir Marko             const uint32_t* oat_class_offsets_pointer,
41706d7aaa75f3d6d21fe904d54208b28e486673d97Vladimir Marko             uint8_t* dex_cache_arrays);
41807b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler
41907b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  const OatFile* const oat_file_;
42007b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  const std::string dex_file_location_;
42107b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  const std::string canonical_dex_file_location_;
42207b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  const uint32_t dex_file_location_checksum_;
42307b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  const uint8_t* const dex_file_pointer_;
424d9786b0e5be23ea0258405165098b4216579209cArtem Udovichenko  const uint8_t* lookup_table_data_;
42507b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  const uint32_t* const oat_class_offsets_pointer_;
42606d7aaa75f3d6d21fe904d54208b28e486673d97Vladimir Marko  uint8_t* const dex_cache_arrays_;
42707b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler
42807b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  friend class OatFile;
429049cff0ed5e28aa17a17e456efe3121b6d58910fAndreas Gampe  friend class OatFileBase;
43007b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler  DISALLOW_COPY_AND_ASSIGN(OatDexFile);
43107b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler};
43207b3c2351bb527ea91c084dc19434600af9ae66bRichard Uhler
433e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom}  // namespace art
434e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom
435fc0e3219edc9a5bf81b166e82fd5db2796eb6a0dBrian Carlstrom#endif  // ART_RUNTIME_OAT_FILE_H_
436