• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2011 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef ART_RUNTIME_OAT_FILE_H_
18 #define ART_RUNTIME_OAT_FILE_H_
19 
20 #include <list>
21 #include <string>
22 #include <string_view>
23 #include <vector>
24 
25 #include "base/array_ref.h"
26 #include "base/compiler_filter.h"
27 #include "base/mutex.h"
28 #include "base/os.h"
29 #include "base/safe_map.h"
30 #include "base/tracking_safe_map.h"
31 #include "class_status.h"
32 #include "dex/dex_file_layout.h"
33 #include "dex/type_lookup_table.h"
34 #include "dex/utf.h"
35 #include "index_bss_mapping.h"
36 #include "mirror/object.h"
37 
38 namespace art {
39 
40 class BitVector;
41 class DexFile;
42 class ClassLoaderContext;
43 class ElfFile;
44 class DexLayoutSections;
45 template <class MirrorType> class GcRoot;
46 class MemMap;
47 class OatDexFile;
48 class OatHeader;
49 class OatMethodOffsets;
50 class OatQuickMethodHeader;
51 class VdexFile;
52 
53 namespace dex {
54 struct ClassDef;
55 }  // namespace dex
56 
57 namespace gc {
58 namespace collector {
59 class FakeOatFile;
60 }  // namespace collector
61 }  // namespace gc
62 
63 // A special compilation reason to indicate that only the VDEX file is usable. Keep in sync with
64 // `ArtConstants::REASON_VDEX` in artd/binder/com/android/server/art/ArtConstants.aidl.
65 static constexpr const char* kReasonVdex = "vdex";
66 
67 // OatMethodOffsets are currently 5x32-bits=160-bits long, so if we can
68 // save even one OatMethodOffsets struct, the more complicated encoding
69 // using a bitmap pays for itself since few classes will have 160
70 // methods.
71 enum class OatClassType : uint8_t {
72   kAllCompiled = 0,   // OatClass is followed by an OatMethodOffsets for each method.
73   kSomeCompiled = 1,  // A bitmap of OatMethodOffsets that are present follows the OatClass.
74   kNoneCompiled = 2,  // All methods are interpreted so no OatMethodOffsets are necessary.
75   kOatClassMax = 3,
76 };
77 
78 std::ostream& operator<<(std::ostream& os, OatClassType rhs);
79 
80 class PACKED(4) OatMethodOffsets {
81  public:
code_offset_(code_offset)82   explicit OatMethodOffsets(uint32_t code_offset = 0) : code_offset_(code_offset) {}
83 
~OatMethodOffsets()84   ~OatMethodOffsets() {}
85 
86   OatMethodOffsets(const OatMethodOffsets&) = default;
87   OatMethodOffsets& operator=(const OatMethodOffsets&) = default;
88 
89   uint32_t code_offset_;
90 };
91 
92 // Runtime representation of the OAT file format which holds compiler output.
93 // The class opens an OAT file from storage and maps it to memory, typically with
94 // dlopen and provides access to its internal data structures (see OatWriter for
95 // for more details about the OAT format).
96 // In the process of loading OAT, the class also loads the associated VDEX file
97 // with the input DEX files (see VdexFile for details about the VDEX format).
98 // The raw DEX data are accessible transparently through the OatDexFile objects.
99 
100 class OatFile {
101  public:
102   // Open an oat file. Returns null on failure.
103   // The `dex_filenames` argument, if provided, overrides the dex locations
104   // from oat file when opening the dex files if they are not embedded in the
105   // vdex file. These may differ for cross-compilation (the dex file name is
106   // the host path and dex location is the future path on target) and testing.
107   static OatFile* Open(int zip_fd,
108                        const std::string& filename,
109                        const std::string& location,
110                        bool executable,
111                        bool low_4gb,
112                        ArrayRef<const std::string> dex_filenames,
113                        ArrayRef<const int> dex_fds,
114                        /*inout*/MemMap* reservation,  // Where to load if not null.
115                        /*out*/std::string* error_msg);
116   // Helper overload that takes a single dex filename and no reservation.
Open(int zip_fd,const std::string & filename,const std::string & location,bool executable,bool low_4gb,const std::string & dex_filename,std::string * error_msg)117   static OatFile* Open(int zip_fd,
118                        const std::string& filename,
119                        const std::string& location,
120                        bool executable,
121                        bool low_4gb,
122                        const std::string& dex_filename,
123                        /*out*/std::string* error_msg) {
124     return Open(zip_fd,
125                 filename,
126                 location,
127                 executable,
128                 low_4gb,
129                 ArrayRef<const std::string>(&dex_filename, /*size=*/ 1u),
130                 /*dex_fds=*/ ArrayRef<const int>(),  // not currently supported
131                 /*reservation=*/ nullptr,
132                 error_msg);
133   }
134   // Helper overload that takes no dex filename and no reservation.
Open(int zip_fd,const std::string & filename,const std::string & location,bool executable,bool low_4gb,std::string * error_msg)135   static OatFile* Open(int zip_fd,
136                        const std::string& filename,
137                        const std::string& location,
138                        bool executable,
139                        bool low_4gb,
140                        /*out*/std::string* error_msg) {
141     return Open(zip_fd,
142                 filename,
143                 location,
144                 executable,
145                 low_4gb,
146                 /*dex_filenames=*/ ArrayRef<const std::string>(),
147                 /*dex_fds=*/ ArrayRef<const int>(),  // not currently supported
148                 /*reservation=*/ nullptr,
149                 error_msg);
150   }
151 
152   // Similar to OatFile::Open(const std::string...), but accepts input vdex and
153   // odex files as file descriptors. We also take zip_fd in case the vdex does not
154   // contain the dex code, and we need to read it from the zip file.
155   static OatFile* Open(int zip_fd,
156                        int vdex_fd,
157                        int oat_fd,
158                        const std::string& oat_location,
159                        bool executable,
160                        bool low_4gb,
161                        ArrayRef<const std::string> dex_filenames,
162                        ArrayRef<const int> dex_fds,
163                        /*inout*/MemMap* reservation,  // Where to load if not null.
164                        /*out*/std::string* error_msg);
165 
166   // Initialize OatFile instance from an already loaded VdexFile. This assumes
167   // the vdex does not have a dex section and accepts a vector of DexFiles separately.
168   static OatFile* OpenFromVdex(const std::vector<const DexFile*>& dex_files,
169                                std::unique_ptr<VdexFile>&& vdex_file,
170                                const std::string& location,
171                                ClassLoaderContext* context);
172 
173   // Initialize OatFile instance from an already loaded VdexFile. The dex files
174   // will be opened through `zip_fd` or `dex_location` if `zip_fd` is -1.
175   static OatFile* OpenFromVdex(int zip_fd,
176                                std::unique_ptr<VdexFile>&& vdex_file,
177                                const std::string& location,
178                                ClassLoaderContext* context,
179                                std::string* error_msg);
180 
181   // Return whether the `OatFile` uses a vdex-only file.
182   bool IsBackedByVdexOnly() const;
183 
184   virtual ~OatFile();
185 
IsExecutable()186   bool IsExecutable() const {
187     return is_executable_;
188   }
189 
190   // Indicates whether the oat file was compiled with full debugging capability.
191   bool IsDebuggable() const;
192 
193   CompilerFilter::Filter GetCompilerFilter() const;
194 
195   std::string GetClassLoaderContext() const;
196 
197   const char* GetCompilationReason() const;
198 
GetLocation()199   const std::string& GetLocation() const {
200     return location_;
201   }
202 
203   const OatHeader& GetOatHeader() const;
204 
205   class OatMethod final {
206    public:
GetCodeOffset()207     uint32_t GetCodeOffset() const { return code_offset_; }
208 
209     const void* GetQuickCode() const;
210 
211     // Returns size of quick code.
212     uint32_t GetQuickCodeSize() const;
213 
214     // Returns OatQuickMethodHeader for debugging. Most callers should
215     // use more specific methods such as GetQuickCodeSize.
216     const OatQuickMethodHeader* GetOatQuickMethodHeader() const;
217     uint32_t GetOatQuickMethodHeaderOffset() const;
218 
219     size_t GetFrameSizeInBytes() const;
220     uint32_t GetCoreSpillMask() const;
221     uint32_t GetFpSpillMask() const;
222 
223     const uint8_t* GetVmapTable() const;
224     uint32_t GetVmapTableOffset() const;
225 
226     // Create an OatMethod with offsets relative to the given base address
OatMethod(const uint8_t * base,const uint32_t code_offset)227     OatMethod(const uint8_t* base, const uint32_t code_offset)
228         : begin_(base), code_offset_(code_offset) {
229     }
230     OatMethod(const OatMethod&) = default;
~OatMethod()231     ~OatMethod() {}
232 
233     OatMethod& operator=(const OatMethod&) = default;
234 
235     // A representation of an invalid OatMethod, used when an OatMethod or OatClass can't be found.
236     // See ClassLinker::FindOatMethodFor.
Invalid()237     static const OatMethod Invalid() {
238       return OatMethod(nullptr, -1);
239     }
240 
241    private:
242     const uint8_t* begin_;
243     uint32_t code_offset_;
244 
245     friend class OatClass;
246   };
247 
248   class OatClass final {
249    public:
GetStatus()250     ClassStatus GetStatus() const {
251       return status_;
252     }
253 
GetType()254     OatClassType GetType() const {
255       return type_;
256     }
257 
258     // Get the OatMethod entry based on its index into the class
259     // defintion. Direct methods come first, followed by virtual
260     // methods. Note that runtime created methods such as miranda
261     // methods are not included.
262     const OatMethod GetOatMethod(uint32_t method_index) const;
263 
264     // Return a pointer to the OatMethodOffsets for the requested
265     // method_index, or null if none is present. Note that most
266     // callers should use GetOatMethod.
267     const OatMethodOffsets* GetOatMethodOffsets(uint32_t method_index) const;
268 
269     // Return the offset from the start of the OatFile to the
270     // OatMethodOffsets for the requested method_index, or 0 if none
271     // is present. Note that most callers should use GetOatMethod.
272     uint32_t GetOatMethodOffsetsOffset(uint32_t method_index) const;
273 
274     // A representation of an invalid OatClass, used when an OatClass can't be found.
275     // See FindOatClass().
Invalid()276     static OatClass Invalid() {
277       return OatClass(/* oat_file= */ nullptr,
278                       ClassStatus::kErrorUnresolved,
279                       OatClassType::kNoneCompiled,
280                       /* num_methods= */ 0,
281                       /* bitmap_pointer= */ nullptr,
282                       /* methods_pointer= */ nullptr);
283     }
284 
285    private:
286     OatClass(const OatFile* oat_file,
287              ClassStatus status,
288              OatClassType type,
289              uint32_t num_methods,
290              const uint32_t* bitmap_pointer,
291              const OatMethodOffsets* methods_pointer);
292 
293     const OatFile* const oat_file_;
294     const ClassStatus status_;
295     const OatClassType type_;
296     const uint32_t num_methods_;
297     const uint32_t* const bitmap_;
298     const OatMethodOffsets* const methods_pointer_;
299 
300     friend class art::OatDexFile;
301   };
302 
303   // Get the OatDexFile for the given dex_location within this oat file.
304   // If dex_location_checksum is non-null, the OatDexFile will only be
305   // returned if it has a matching checksum.
306   // If error_msg is non-null and no OatDexFile is returned, error_msg will
307   // be updated with a description of why no OatDexFile was returned.
308   const OatDexFile* GetOatDexFile(const char* dex_location,
309                                   const uint32_t* const dex_location_checksum,
310                                   /*out*/std::string* error_msg = nullptr) const
311       REQUIRES(!secondary_lookup_lock_);
312 
GetOatDexFiles()313   const std::vector<const OatDexFile*>& GetOatDexFiles() const {
314     return oat_dex_files_storage_;
315   }
316 
Size()317   size_t Size() const {
318     return End() - Begin();
319   }
320 
Contains(const void * p)321   bool Contains(const void* p) const {
322     return p >= Begin() && p < End();
323   }
324 
DataBimgRelRoSize()325   size_t DataBimgRelRoSize() const {
326     return DataBimgRelRoEnd() - DataBimgRelRoBegin();
327   }
328 
BssSize()329   size_t BssSize() const {
330     return BssEnd() - BssBegin();
331   }
332 
VdexSize()333   size_t VdexSize() const {
334     return VdexEnd() - VdexBegin();
335   }
336 
BssMethodsOffset()337   size_t BssMethodsOffset() const {
338     // Note: This is used only for symbolizer and needs to return a valid .bss offset.
339     return (bss_methods_ != nullptr) ? bss_methods_ - BssBegin() : BssRootsOffset();
340   }
341 
BssRootsOffset()342   size_t BssRootsOffset() const {
343     // Note: This is used only for symbolizer and needs to return a valid .bss offset.
344     return (bss_roots_ != nullptr) ? bss_roots_ - BssBegin() : BssSize();
345   }
346 
DexSize()347   size_t DexSize() const {
348     return DexEnd() - DexBegin();
349   }
350 
351   const uint8_t* Begin() const;
352   const uint8_t* End() const;
353 
DataBimgRelRoBegin()354   const uint8_t* DataBimgRelRoBegin() const { return data_bimg_rel_ro_begin_; }
DataBimgRelRoEnd()355   const uint8_t* DataBimgRelRoEnd() const { return data_bimg_rel_ro_end_; }
356 
BssBegin()357   const uint8_t* BssBegin() const { return bss_begin_; }
BssEnd()358   const uint8_t* BssEnd() const { return bss_end_; }
359 
VdexBegin()360   const uint8_t* VdexBegin() const { return vdex_begin_; }
VdexEnd()361   const uint8_t* VdexEnd() const { return vdex_end_; }
362 
363   const uint8_t* DexBegin() const;
364   const uint8_t* DexEnd() const;
365 
366   ArrayRef<const uint32_t> GetBootImageRelocations() const;
367   ArrayRef<ArtMethod*> GetBssMethods() const;
368   ArrayRef<GcRoot<mirror::Object>> GetBssGcRoots() const;
369 
370   // Initialize relocation sections (.data.bimg.rel.ro and .bss).
371   void InitializeRelocations() const;
372 
373   // Finds the associated oat class for a dex_file and descriptor. Returns an invalid OatClass on
374   // error and sets found to false.
375   static OatClass FindOatClass(const DexFile& dex_file, uint16_t class_def_idx, bool* found);
376 
GetVdexFile()377   VdexFile* GetVdexFile() const {
378     return vdex_.get();
379   }
380 
381   // Whether the OatFile embeds the Dex code.
ContainsDexCode()382   bool ContainsDexCode() const {
383     return external_dex_files_.empty();
384   }
385 
386   // Returns whether an image (e.g. app image) is required to safely execute this OAT file.
387   bool RequiresImage() const;
388 
389   struct BssMappingInfo {
390     const IndexBssMapping* method_bss_mapping = nullptr;
391     const IndexBssMapping* type_bss_mapping = nullptr;
392     const IndexBssMapping* public_type_bss_mapping = nullptr;
393     const IndexBssMapping* package_type_bss_mapping = nullptr;
394     const IndexBssMapping* string_bss_mapping = nullptr;
395   };
396 
GetBcpBssInfo()397   ArrayRef<const BssMappingInfo> GetBcpBssInfo() const {
398     return ArrayRef<const BssMappingInfo>(bcp_bss_info_);
399   }
400 
401   // Returns the mapping info of `dex_file` if found in the BcpBssInfo, or nullptr otherwise.
402   const BssMappingInfo* FindBcpMappingInfo(const DexFile* dex_file) const;
403 
404  protected:
405   OatFile(const std::string& filename, bool executable);
406 
407  private:
408   // The oat file name.
409   //
410   // The image will embed this to link its associated oat file.
411   const std::string location_;
412 
413   // Pointer to the Vdex file with the Dex files for this Oat file.
414   std::unique_ptr<VdexFile> vdex_;
415 
416   // Pointer to OatHeader.
417   const uint8_t* begin_;
418 
419   // Pointer to end of oat region for bounds checking.
420   const uint8_t* end_;
421 
422   // Pointer to the .data.bimg.rel.ro section, if present, otherwise null.
423   const uint8_t* data_bimg_rel_ro_begin_;
424 
425   // Pointer to the end of the .data.bimg.rel.ro section, if present, otherwise null.
426   const uint8_t* data_bimg_rel_ro_end_;
427 
428   // Pointer to the .bss section, if present, otherwise null.
429   uint8_t* bss_begin_;
430 
431   // Pointer to the end of the .bss section, if present, otherwise null.
432   uint8_t* bss_end_;
433 
434   // Pointer to the beginning of the ArtMethod*s in .bss section, if present, otherwise null.
435   uint8_t* bss_methods_;
436 
437   // Pointer to the beginning of the GC roots in .bss section, if present, otherwise null.
438   uint8_t* bss_roots_;
439 
440   // Was this oat_file loaded executable?
441   const bool is_executable_;
442 
443   // Pointer to the .vdex section, if present, otherwise null.
444   uint8_t* vdex_begin_;
445 
446   // Pointer to the end of the .vdex section, if present, otherwise null.
447   uint8_t* vdex_end_;
448 
449   // Owning storage for the OatDexFile objects.
450   std::vector<const OatDexFile*> oat_dex_files_storage_;
451 
452   // Mapping info for DexFiles in the BCP.
453   std::vector<BssMappingInfo> bcp_bss_info_;
454 
455   // NOTE: We use a std::string_view as the key type to avoid a memory allocation on every
456   // lookup with a const char* key. The std::string_view doesn't own its backing storage,
457   // therefore we're using the OatFile's stored dex location as the backing storage
458   // for keys in oat_dex_files_ and the string_cache_ entries for the backing storage
459   // of keys in secondary_oat_dex_files_ and oat_dex_files_by_canonical_location_.
460   using Table =
461       AllocationTrackingSafeMap<std::string_view, const OatDexFile*, kAllocatorTagOatFile>;
462 
463   // Map each location and canonical location (if different) retrieved from the
464   // oat file to its OatDexFile. This map doesn't change after it's constructed in Setup()
465   // and therefore doesn't need any locking and provides the cheapest dex file lookup
466   // for GetOatDexFile() for a very frequent use case. Never contains a null value.
467   Table oat_dex_files_;
468 
469   // Lock guarding all members needed for secondary lookup in GetOatDexFile().
470   mutable Mutex secondary_lookup_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER;
471 
472   // If the primary oat_dex_files_ lookup fails, use a secondary map. This map stores
473   // the results of all previous secondary lookups, whether successful (non-null) or
474   // failed (null). If it doesn't contain an entry we need to calculate the canonical
475   // location and use oat_dex_files_by_canonical_location_.
476   mutable Table secondary_oat_dex_files_ GUARDED_BY(secondary_lookup_lock_);
477 
478   // Cache of strings. Contains the backing storage for keys in the secondary_oat_dex_files_
479   // and the lazily initialized oat_dex_files_by_canonical_location_.
480   // NOTE: We're keeping references to contained strings in form of std::string_view and adding
481   // new strings to the end. The adding of a new element must not touch any previously stored
482   // elements. std::list<> and std::deque<> satisfy this requirement, std::vector<> doesn't.
483   mutable std::list<std::string> string_cache_ GUARDED_BY(secondary_lookup_lock_);
484 
485   // Dex files opened directly from a file referenced from the oat file or specifed
486   // by the `dex_filenames` parameter, in case the OatFile does not embed the dex code.
487   std::vector<std::unique_ptr<const DexFile>> external_dex_files_;
488 
489   friend class gc::collector::FakeOatFile;  // For modifying begin_ and end_.
490   friend class OatClass;
491   friend class art::OatDexFile;
492   friend class OatDumper;  // For GetBase and GetLimit
493   friend class OatFileBackedByVdex;
494   friend class OatFileBase;
495   DISALLOW_COPY_AND_ASSIGN(OatFile);
496 };
497 
498 // OatDexFile should be an inner class of OatFile. Unfortunately, C++ doesn't
499 // support forward declarations of inner classes, and we want to
500 // forward-declare OatDexFile so that we can store an opaque pointer to an
501 // OatDexFile in DexFile.
502 class OatDexFile final {
503  public:
504   // Opens the DexFile referred to by this OatDexFile from within the containing OatFile.
505   std::unique_ptr<const DexFile> OpenDexFile(std::string* error_msg) const;
506 
507   // May return null if the OatDexFile only contains a type lookup table. This case only happens
508   // for the compiler to speed up compilation, or in jitzygote.
GetOatFile()509   const OatFile* GetOatFile() const {
510     return oat_file_;
511   }
512 
513   // Returns the size of the DexFile refered to by this OatDexFile.
514   size_t FileSize() const;
515 
516   // Returns original path of DexFile that was the source of this OatDexFile.
GetDexFileLocation()517   const std::string& GetDexFileLocation() const {
518     return dex_file_location_;
519   }
520 
521   // Returns the canonical location of DexFile that was the source of this OatDexFile.
GetCanonicalDexFileLocation()522   const std::string& GetCanonicalDexFileLocation() const {
523     return canonical_dex_file_location_;
524   }
525 
526   // Returns checksum of original DexFile that was the source of this OatDexFile;
GetDexFileLocationChecksum()527   uint32_t GetDexFileLocationChecksum() const {
528     return dex_file_location_checksum_;
529   }
530 
531   // Returns the OatClass for the class specified by the given DexFile class_def_index.
532   OatFile::OatClass GetOatClass(uint16_t class_def_index) const;
533 
534   // Returns the offset to the OatClass information. Most callers should use GetOatClass.
535   uint32_t GetOatClassOffset(uint16_t class_def_index) const;
536 
GetLookupTableData()537   const uint8_t* GetLookupTableData() const {
538     return lookup_table_data_;
539   }
540 
GetMethodBssMapping()541   const IndexBssMapping* GetMethodBssMapping() const {
542     return method_bss_mapping_;
543   }
544 
GetTypeBssMapping()545   const IndexBssMapping* GetTypeBssMapping() const {
546     return type_bss_mapping_;
547   }
548 
GetPublicTypeBssMapping()549   const IndexBssMapping* GetPublicTypeBssMapping() const {
550     return public_type_bss_mapping_;
551   }
552 
GetPackageTypeBssMapping()553   const IndexBssMapping* GetPackageTypeBssMapping() const {
554     return package_type_bss_mapping_;
555   }
556 
GetStringBssMapping()557   const IndexBssMapping* GetStringBssMapping() const {
558     return string_bss_mapping_;
559   }
560 
GetDexFilePointer()561   const uint8_t* GetDexFilePointer() const {
562     return dex_file_pointer_;
563   }
564 
565   // Looks up a class definition by its class descriptor. Hash must be
566   // ComputeModifiedUtf8Hash(descriptor).
567   static const dex::ClassDef* FindClassDef(const DexFile& dex_file,
568                                            const char* descriptor,
569                                            size_t hash);
570 
GetTypeLookupTable()571   const TypeLookupTable& GetTypeLookupTable() const {
572     return lookup_table_;
573   }
574 
575   ~OatDexFile();
576 
577   // Create only with a type lookup table, used by the compiler to speed up compilation.
578   explicit OatDexFile(TypeLookupTable&& lookup_table);
579 
580   // Return the dex layout sections.
GetDexLayoutSections()581   const DexLayoutSections* GetDexLayoutSections() const {
582     return dex_layout_sections_;
583   }
584 
585  private:
586   OatDexFile(const OatFile* oat_file,
587              const std::string& dex_file_location,
588              const std::string& canonical_dex_file_location,
589              uint32_t dex_file_checksum,
590              const uint8_t* dex_file_pointer,
591              const uint8_t* lookup_table_data,
592              const IndexBssMapping* method_bss_mapping,
593              const IndexBssMapping* type_bss_mapping,
594              const IndexBssMapping* public_type_bss_mapping,
595              const IndexBssMapping* package_type_bss_mapping,
596              const IndexBssMapping* string_bss_mapping,
597              const uint32_t* oat_class_offsets_pointer,
598              const DexLayoutSections* dex_layout_sections);
599 
600   // Create an OatDexFile wrapping an existing DexFile. Will set the OatDexFile
601   // pointer in the DexFile.
602   OatDexFile(const OatFile* oat_file,
603              const uint8_t* dex_file_pointer,
604              uint32_t dex_file_checksum,
605              const std::string& dex_file_location,
606              const std::string& canonical_dex_file_location,
607              const uint8_t* lookup_table_data);
608 
609   bool IsBackedByVdexOnly() const;
610   void InitializeTypeLookupTable();
611 
612   static void AssertAotCompiler();
613 
614   const OatFile* const oat_file_ = nullptr;
615   const std::string dex_file_location_;
616   const std::string canonical_dex_file_location_;
617   const uint32_t dex_file_location_checksum_ = 0u;
618   const uint8_t* const dex_file_pointer_ = nullptr;
619   const uint8_t* const lookup_table_data_ = nullptr;
620   const IndexBssMapping* const method_bss_mapping_ = nullptr;
621   const IndexBssMapping* const type_bss_mapping_ = nullptr;
622   const IndexBssMapping* const public_type_bss_mapping_ = nullptr;
623   const IndexBssMapping* const package_type_bss_mapping_ = nullptr;
624   const IndexBssMapping* const string_bss_mapping_ = nullptr;
625   const uint32_t* const oat_class_offsets_pointer_ = nullptr;
626   TypeLookupTable lookup_table_;
627   const DexLayoutSections* const dex_layout_sections_ = nullptr;
628 
629   friend class OatFile;
630   friend class OatFileBase;
631   friend class OatFileBackedByVdex;
632   DISALLOW_COPY_AND_ASSIGN(OatDexFile);
633 };
634 
635 }  // namespace art
636 
637 #endif  // ART_RUNTIME_OAT_FILE_H_
638