Elliott Hughes | 2faa5f1 | 2012-01-30 14:42:07 -0800 | [diff] [blame] | 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 | */ |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 16 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 17 | #ifndef ART_RUNTIME_OAT_FILE_H_ |
| 18 | #define ART_RUNTIME_OAT_FILE_H_ |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 19 | |
Vladimir Marko | 3f5838d | 2014-08-07 18:07:18 +0100 | [diff] [blame] | 20 | #include <list> |
Brian Carlstrom | 700c8d3 | 2012-11-05 10:42:02 -0800 | [diff] [blame] | 21 | #include <string> |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 22 | #include <vector> |
| 23 | |
Vladimir Marko | aad75c6 | 2016-10-03 08:46:48 +0000 | [diff] [blame] | 24 | #include "base/array_ref.h" |
Vladimir Marko | 3f5838d | 2014-08-07 18:07:18 +0100 | [diff] [blame] | 25 | #include "base/mutex.h" |
Vladimir Marko | 539690a | 2014-06-05 18:36:42 +0100 | [diff] [blame] | 26 | #include "base/stringpiece.h" |
Vladimir Marko | 2c64a83 | 2018-01-04 11:31:56 +0000 | [diff] [blame] | 27 | #include "class_status.h" |
Vladimir Marko | 97d7e1c | 2016-10-04 14:44:28 +0100 | [diff] [blame] | 28 | #include "compiler_filter.h" |
David Sehr | 9e734c7 | 2018-01-04 17:56:19 -0800 | [diff] [blame] | 29 | #include "dex/dex_file.h" |
| 30 | #include "dex/dex_file_layout.h" |
David Sehr | 0225f8e | 2018-01-31 08:52:24 +0000 | [diff] [blame^] | 31 | #include "dex/utf.h" |
Vladimir Marko | f3c52b4 | 2017-11-17 17:32:12 +0000 | [diff] [blame] | 32 | #include "index_bss_mapping.h" |
Vladimir Marko | 2c64a83 | 2018-01-04 11:31:56 +0000 | [diff] [blame] | 33 | #include "mirror/object.h" |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 34 | #include "oat.h" |
Brian Carlstrom | 700c8d3 | 2012-11-05 10:42:02 -0800 | [diff] [blame] | 35 | #include "os.h" |
David Sehr | 9aa352e | 2016-09-15 18:13:52 -0700 | [diff] [blame] | 36 | #include "type_lookup_table.h" |
Nicolas Geoffray | 6bc4374 | 2015-10-12 18:11:10 +0100 | [diff] [blame] | 37 | #include "utils.h" |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 38 | |
| 39 | namespace art { |
| 40 | |
Brian Carlstrom | ba150c3 | 2013-08-27 17:31:03 -0700 | [diff] [blame] | 41 | class BitVector; |
Brian Carlstrom | 700c8d3 | 2012-11-05 10:42:02 -0800 | [diff] [blame] | 42 | class ElfFile; |
Mathieu Chartier | 120aa28 | 2017-08-05 16:03:03 -0700 | [diff] [blame] | 43 | class DexLayoutSections; |
Vladimir Marko | aad75c6 | 2016-10-03 08:46:48 +0000 | [diff] [blame] | 44 | template <class MirrorType> class GcRoot; |
Brian Carlstrom | 700c8d3 | 2012-11-05 10:42:02 -0800 | [diff] [blame] | 45 | class MemMap; |
Richard Uhler | 07b3c23 | 2015-03-31 15:57:54 -0700 | [diff] [blame] | 46 | class OatDexFile; |
Andreas Gampe | 513061a | 2017-06-01 09:17:34 -0700 | [diff] [blame] | 47 | class OatHeader; |
| 48 | class OatMethodOffsets; |
| 49 | class OatQuickMethodHeader; |
Vladimir Marko | 97d7e1c | 2016-10-04 14:44:28 +0100 | [diff] [blame] | 50 | class VdexFile; |
Brian Carlstrom | 700c8d3 | 2012-11-05 10:42:02 -0800 | [diff] [blame] | 51 | |
Mathieu Chartier | 5351da0 | 2016-02-17 16:19:53 -0800 | [diff] [blame] | 52 | namespace gc { |
| 53 | namespace collector { |
| 54 | class DummyOatFile; |
| 55 | } // namespace collector |
| 56 | } // namespace gc |
| 57 | |
David Brazdil | 7b49e6c | 2016-09-01 11:06:18 +0100 | [diff] [blame] | 58 | // Runtime representation of the OAT file format which holds compiler output. |
| 59 | // The class opens an OAT file from storage and maps it to memory, typically with |
| 60 | // dlopen and provides access to its internal data structures (see OatWriter for |
| 61 | // for more details about the OAT format). |
| 62 | // In the process of loading OAT, the class also loads the associated VDEX file |
| 63 | // with the input DEX files (see VdexFile for details about the VDEX format). |
| 64 | // The raw DEX data are accessible transparently through the OatDexFile objects. |
| 65 | |
Andreas Gampe | 049cff0 | 2015-12-01 23:27:12 -0800 | [diff] [blame] | 66 | class OatFile { |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 67 | public: |
Jeff Hao | f0192c8 | 2016-03-28 20:39:50 -0700 | [diff] [blame] | 68 | // Special classpath that skips shared library check. |
| 69 | static constexpr const char* kSpecialSharedLibrary = "&"; |
| 70 | |
Richard Uhler | 07b3c23 | 2015-03-31 15:57:54 -0700 | [diff] [blame] | 71 | typedef art::OatDexFile OatDexFile; |
| 72 | |
Alex Light | 84d7605 | 2014-08-22 17:49:35 -0700 | [diff] [blame] | 73 | // Opens an oat file contained within the given elf file. This is always opened as |
| 74 | // non-executable at the moment. |
David Brazdil | c93b3be | 2016-09-12 18:49:58 +0100 | [diff] [blame] | 75 | static OatFile* OpenWithElfFile(ElfFile* elf_file, |
| 76 | VdexFile* vdex_file, |
| 77 | const std::string& location, |
Richard Uhler | e5fed03 | 2015-03-18 08:21:11 -0700 | [diff] [blame] | 78 | const char* abs_dex_location, |
Igor Murashkin | b1d8c31 | 2015-08-04 11:18:43 -0700 | [diff] [blame] | 79 | std::string* error_msg); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 80 | // Open an oat file. Returns null on failure. Requested base can |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 81 | // optionally be used to request where the file should be loaded. |
Richard Uhler | e5fed03 | 2015-03-18 08:21:11 -0700 | [diff] [blame] | 82 | // See the ResolveRelativeEncodedDexLocation for a description of how the |
| 83 | // abs_dex_location argument is used. |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 84 | static OatFile* Open(const std::string& filename, |
Brian Carlstrom | a004aa9 | 2012-02-08 18:05:09 -0800 | [diff] [blame] | 85 | const std::string& location, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 86 | uint8_t* requested_base, |
Igor Murashkin | 4677476 | 2014-10-22 11:37:02 -0700 | [diff] [blame] | 87 | uint8_t* oat_file_begin, |
Ian Rogers | 8d31bbd | 2013-10-13 10:44:14 -0700 | [diff] [blame] | 88 | bool executable, |
Mathieu Chartier | 0b4cbd0 | 2016-03-08 16:49:58 -0800 | [diff] [blame] | 89 | bool low_4gb, |
Richard Uhler | e5fed03 | 2015-03-18 08:21:11 -0700 | [diff] [blame] | 90 | const char* abs_dex_location, |
Igor Murashkin | b1d8c31 | 2015-08-04 11:18:43 -0700 | [diff] [blame] | 91 | std::string* error_msg); |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 92 | |
Shubham Ajmera | b22dea0 | 2017-10-04 18:36:41 -0700 | [diff] [blame] | 93 | // Similar to OatFile::Open(const std::string...), but accepts input vdex and |
| 94 | // odex files as file descriptors. |
| 95 | static OatFile* Open(int vdex_fd, |
| 96 | int oat_fd, |
| 97 | const std::string& oat_location, |
| 98 | uint8_t* requested_base, |
| 99 | uint8_t* oat_file_begin, |
| 100 | bool executable, |
| 101 | bool low_4gb, |
| 102 | const char* abs_dex_location, |
| 103 | std::string* error_msg); |
| 104 | |
Brian Carlstrom | 700c8d3 | 2012-11-05 10:42:02 -0800 | [diff] [blame] | 105 | // Open an oat file from an already opened File. |
Brian Carlstrom | 265091e | 2013-01-30 14:08:26 -0800 | [diff] [blame] | 106 | // Does not use dlopen underneath so cannot be used for runtime use |
| 107 | // where relocations may be required. Currently used from |
| 108 | // ImageWriter which wants to open a writable version from an existing |
| 109 | // file descriptor for patching. |
Igor Murashkin | b1d8c31 | 2015-08-04 11:18:43 -0700 | [diff] [blame] | 110 | static OatFile* OpenWritable(File* file, const std::string& location, |
Richard Uhler | e5fed03 | 2015-03-18 08:21:11 -0700 | [diff] [blame] | 111 | const char* abs_dex_location, |
Igor Murashkin | b1d8c31 | 2015-08-04 11:18:43 -0700 | [diff] [blame] | 112 | std::string* error_msg); |
Nicolas Geoffray | 58cc1cb | 2017-11-20 13:27:29 +0000 | [diff] [blame] | 113 | // Open an oat file from an already opened File. Maps it PROT_READ, MAP_PRIVATE. |
Igor Murashkin | b1d8c31 | 2015-08-04 11:18:43 -0700 | [diff] [blame] | 114 | static OatFile* OpenReadable(File* file, const std::string& location, |
Richard Uhler | e5fed03 | 2015-03-18 08:21:11 -0700 | [diff] [blame] | 115 | const char* abs_dex_location, |
Igor Murashkin | b1d8c31 | 2015-08-04 11:18:43 -0700 | [diff] [blame] | 116 | std::string* error_msg); |
Brian Carlstrom | 700c8d3 | 2012-11-05 10:42:02 -0800 | [diff] [blame] | 117 | |
Andreas Gampe | 049cff0 | 2015-12-01 23:27:12 -0800 | [diff] [blame] | 118 | virtual ~OatFile(); |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 119 | |
Alex Light | 9dcc457 | 2014-08-14 14:16:26 -0700 | [diff] [blame] | 120 | bool IsExecutable() const { |
| 121 | return is_executable_; |
| 122 | } |
| 123 | |
Andreas Gampe | 7ba6496 | 2014-10-23 11:37:40 -0700 | [diff] [blame] | 124 | bool IsPic() const; |
| 125 | |
Sebastien Hertz | 0de1133 | 2015-05-13 12:14:05 +0200 | [diff] [blame] | 126 | // Indicates whether the oat file was compiled with full debugging capability. |
| 127 | bool IsDebuggable() const; |
| 128 | |
Andreas Gampe | 29d38e7 | 2016-03-23 15:31:51 +0000 | [diff] [blame] | 129 | CompilerFilter::Filter GetCompilerFilter() const; |
Calin Juravle | b077e15 | 2016-02-18 18:47:37 +0000 | [diff] [blame] | 130 | |
Calin Juravle | 44e5efa | 2017-09-12 00:54:26 -0700 | [diff] [blame] | 131 | std::string GetClassLoaderContext() const; |
| 132 | |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 133 | const std::string& GetLocation() const { |
| 134 | return location_; |
| 135 | } |
| 136 | |
| 137 | const OatHeader& GetOatHeader() const; |
| 138 | |
Richard Uhler | 07b3c23 | 2015-03-31 15:57:54 -0700 | [diff] [blame] | 139 | class OatMethod FINAL { |
Brian Carlstrom | 3320cf4 | 2011-10-04 14:58:28 -0700 | [diff] [blame] | 140 | public: |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 141 | void LinkMethod(ArtMethod* method) const; |
Brian Carlstrom | ae82698 | 2011-11-09 01:33:42 -0800 | [diff] [blame] | 142 | |
Nicolas Geoffray | c04c800 | 2015-07-14 11:37:54 +0100 | [diff] [blame] | 143 | uint32_t GetCodeOffset() const; |
Brian Carlstrom | ae82698 | 2011-11-09 01:33:42 -0800 | [diff] [blame] | 144 | |
Nicolas Geoffray | c04c800 | 2015-07-14 11:37:54 +0100 | [diff] [blame] | 145 | const void* GetQuickCode() const; |
Brian Carlstrom | 2cbaccb | 2014-09-14 20:34:17 -0700 | [diff] [blame] | 146 | |
| 147 | // Returns size of quick code. |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 148 | uint32_t GetQuickCodeSize() const; |
Brian Carlstrom | 2cbaccb | 2014-09-14 20:34:17 -0700 | [diff] [blame] | 149 | uint32_t GetQuickCodeSizeOffset() const; |
| 150 | |
| 151 | // Returns OatQuickMethodHeader for debugging. Most callers should |
| 152 | // use more specific methods such as GetQuickCodeSize. |
| 153 | const OatQuickMethodHeader* GetOatQuickMethodHeader() const; |
| 154 | uint32_t GetOatQuickMethodHeaderOffset() const; |
Logan Chien | 0c717dd | 2012-03-28 18:31:07 +0800 | [diff] [blame] | 155 | |
Vladimir Marko | 7624d25 | 2014-05-02 14:40:15 +0100 | [diff] [blame] | 156 | size_t GetFrameSizeInBytes() const; |
| 157 | uint32_t GetCoreSpillMask() const; |
| 158 | uint32_t GetFpSpillMask() const; |
Brian Carlstrom | 2cbaccb | 2014-09-14 20:34:17 -0700 | [diff] [blame] | 159 | |
Vladimir Marko | 8a63057 | 2014-04-09 18:45:35 +0100 | [diff] [blame] | 160 | const uint8_t* GetVmapTable() const; |
Brian Carlstrom | 2cbaccb | 2014-09-14 20:34:17 -0700 | [diff] [blame] | 161 | uint32_t GetVmapTableOffset() const; |
| 162 | uint32_t GetVmapTableOffsetOffset() const; |
Vladimir Marko | 8a63057 | 2014-04-09 18:45:35 +0100 | [diff] [blame] | 163 | |
Brian Carlstrom | ae82698 | 2011-11-09 01:33:42 -0800 | [diff] [blame] | 164 | // Create an OatMethod with offsets relative to the given base address |
Mathieu Chartier | 957ca1c | 2014-11-21 16:51:29 -0800 | [diff] [blame] | 165 | OatMethod(const uint8_t* base, const uint32_t code_offset) |
| 166 | : begin_(base), code_offset_(code_offset) { |
Ian Rogers | 97b52f8 | 2014-08-14 11:34:07 -0700 | [diff] [blame] | 167 | } |
Andreas Gampe | 758a801 | 2015-04-03 21:28:42 -0700 | [diff] [blame] | 168 | OatMethod(const OatMethod&) = default; |
Ian Rogers | 97b52f8 | 2014-08-14 11:34:07 -0700 | [diff] [blame] | 169 | ~OatMethod() {} |
Brian Carlstrom | 3320cf4 | 2011-10-04 14:58:28 -0700 | [diff] [blame] | 170 | |
Andreas Gampe | 758a801 | 2015-04-03 21:28:42 -0700 | [diff] [blame] | 171 | OatMethod& operator=(const OatMethod&) = default; |
| 172 | |
Ian Rogers | 97b52f8 | 2014-08-14 11:34:07 -0700 | [diff] [blame] | 173 | // A representation of an invalid OatMethod, used when an OatMethod or OatClass can't be found. |
| 174 | // See ClassLinker::FindOatMethodFor. |
| 175 | static const OatMethod Invalid() { |
Mathieu Chartier | 957ca1c | 2014-11-21 16:51:29 -0800 | [diff] [blame] | 176 | return OatMethod(nullptr, -1); |
Ian Rogers | 97b52f8 | 2014-08-14 11:34:07 -0700 | [diff] [blame] | 177 | } |
Nicolas Geoffray | 4fcdc94 | 2014-07-22 10:48:00 +0100 | [diff] [blame] | 178 | |
Brian Carlstrom | ae82698 | 2011-11-09 01:33:42 -0800 | [diff] [blame] | 179 | private: |
| 180 | template<class T> |
| 181 | T GetOatPointer(uint32_t offset) const { |
| 182 | if (offset == 0) { |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 183 | return nullptr; |
Brian Carlstrom | ae82698 | 2011-11-09 01:33:42 -0800 | [diff] [blame] | 184 | } |
Ian Rogers | 30fab40 | 2012-01-23 15:43:46 -0800 | [diff] [blame] | 185 | return reinterpret_cast<T>(begin_ + offset); |
Brian Carlstrom | ae82698 | 2011-11-09 01:33:42 -0800 | [diff] [blame] | 186 | } |
| 187 | |
Mathieu Chartier | e5f13e5 | 2015-02-24 09:37:21 -0800 | [diff] [blame] | 188 | const uint8_t* begin_; |
| 189 | uint32_t code_offset_; |
Brian Carlstrom | ae82698 | 2011-11-09 01:33:42 -0800 | [diff] [blame] | 190 | |
| 191 | friend class OatClass; |
Brian Carlstrom | 3320cf4 | 2011-10-04 14:58:28 -0700 | [diff] [blame] | 192 | }; |
| 193 | |
Richard Uhler | 07b3c23 | 2015-03-31 15:57:54 -0700 | [diff] [blame] | 194 | class OatClass FINAL { |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 195 | public: |
Vladimir Marko | 2c64a83 | 2018-01-04 11:31:56 +0000 | [diff] [blame] | 196 | ClassStatus GetStatus() const { |
Brian Carlstrom | ba150c3 | 2013-08-27 17:31:03 -0700 | [diff] [blame] | 197 | return status_; |
| 198 | } |
| 199 | |
| 200 | OatClassType GetType() const { |
| 201 | return type_; |
| 202 | } |
Brian Carlstrom | 0755ec5 | 2012-01-11 15:19:46 -0800 | [diff] [blame] | 203 | |
Mathieu Chartier | eb8167a | 2014-05-07 15:43:14 -0700 | [diff] [blame] | 204 | // Get the OatMethod entry based on its index into the class |
Brian Carlstrom | 2cbaccb | 2014-09-14 20:34:17 -0700 | [diff] [blame] | 205 | // defintion. Direct methods come first, followed by virtual |
| 206 | // methods. Note that runtime created methods such as miranda |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 207 | // methods are not included. |
Brian Carlstrom | aded5f7 | 2011-10-07 17:15:04 -0700 | [diff] [blame] | 208 | const OatMethod GetOatMethod(uint32_t method_index) const; |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 209 | |
Brian Carlstrom | 2cbaccb | 2014-09-14 20:34:17 -0700 | [diff] [blame] | 210 | // Return a pointer to the OatMethodOffsets for the requested |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 211 | // method_index, or null if none is present. Note that most |
Brian Carlstrom | 2cbaccb | 2014-09-14 20:34:17 -0700 | [diff] [blame] | 212 | // callers should use GetOatMethod. |
| 213 | const OatMethodOffsets* GetOatMethodOffsets(uint32_t method_index) const; |
| 214 | |
| 215 | // Return the offset from the start of the OatFile to the |
| 216 | // OatMethodOffsets for the requested method_index, or 0 if none |
| 217 | // is present. Note that most callers should use GetOatMethod. |
| 218 | uint32_t GetOatMethodOffsetsOffset(uint32_t method_index) const; |
| 219 | |
Ian Rogers | 97b52f8 | 2014-08-14 11:34:07 -0700 | [diff] [blame] | 220 | // A representation of an invalid OatClass, used when an OatClass can't be found. |
Vladimir Marko | 97d7e1c | 2016-10-04 14:44:28 +0100 | [diff] [blame] | 221 | // See FindOatClass(). |
Ian Rogers | 97b52f8 | 2014-08-14 11:34:07 -0700 | [diff] [blame] | 222 | static OatClass Invalid() { |
Vladimir Marko | 72ab684 | 2017-01-20 19:32:50 +0000 | [diff] [blame] | 223 | return OatClass(/* oat_file */ nullptr, |
Vladimir Marko | 2c64a83 | 2018-01-04 11:31:56 +0000 | [diff] [blame] | 224 | ClassStatus::kErrorUnresolved, |
Vladimir Marko | 72ab684 | 2017-01-20 19:32:50 +0000 | [diff] [blame] | 225 | kOatClassNoneCompiled, |
| 226 | /* bitmap_size */ 0, |
| 227 | /* bitmap_pointer */ nullptr, |
| 228 | /* methods_pointer */ nullptr); |
Ian Rogers | 97b52f8 | 2014-08-14 11:34:07 -0700 | [diff] [blame] | 229 | } |
Nicolas Geoffray | 4fcdc94 | 2014-07-22 10:48:00 +0100 | [diff] [blame] | 230 | |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 231 | private: |
Brian Carlstrom | 0755ec5 | 2012-01-11 15:19:46 -0800 | [diff] [blame] | 232 | OatClass(const OatFile* oat_file, |
Vladimir Marko | 2c64a83 | 2018-01-04 11:31:56 +0000 | [diff] [blame] | 233 | ClassStatus status, |
Brian Carlstrom | ba150c3 | 2013-08-27 17:31:03 -0700 | [diff] [blame] | 234 | OatClassType type, |
| 235 | uint32_t bitmap_size, |
| 236 | const uint32_t* bitmap_pointer, |
Brian Carlstrom | 0755ec5 | 2012-01-11 15:19:46 -0800 | [diff] [blame] | 237 | const OatMethodOffsets* methods_pointer); |
Brian Carlstrom | 3320cf4 | 2011-10-04 14:58:28 -0700 | [diff] [blame] | 238 | |
Ian Rogers | 97b52f8 | 2014-08-14 11:34:07 -0700 | [diff] [blame] | 239 | const OatFile* const oat_file_; |
Brian Carlstrom | ba150c3 | 2013-08-27 17:31:03 -0700 | [diff] [blame] | 240 | |
Vladimir Marko | 2c64a83 | 2018-01-04 11:31:56 +0000 | [diff] [blame] | 241 | const ClassStatus status_; |
Brian Carlstrom | ba150c3 | 2013-08-27 17:31:03 -0700 | [diff] [blame] | 242 | |
Ian Rogers | 97b52f8 | 2014-08-14 11:34:07 -0700 | [diff] [blame] | 243 | const OatClassType type_; |
Brian Carlstrom | ba150c3 | 2013-08-27 17:31:03 -0700 | [diff] [blame] | 244 | |
Ian Rogers | 97b52f8 | 2014-08-14 11:34:07 -0700 | [diff] [blame] | 245 | const uint32_t* const bitmap_; |
Brian Carlstrom | ba150c3 | 2013-08-27 17:31:03 -0700 | [diff] [blame] | 246 | |
Ian Rogers | 97b52f8 | 2014-08-14 11:34:07 -0700 | [diff] [blame] | 247 | const OatMethodOffsets* const methods_pointer_; |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 248 | |
Richard Uhler | 07b3c23 | 2015-03-31 15:57:54 -0700 | [diff] [blame] | 249 | friend class art::OatDexFile; |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 250 | }; |
Richard Uhler | 9a37efc | 2016-08-05 16:32:55 -0700 | [diff] [blame] | 251 | |
| 252 | // Get the OatDexFile for the given dex_location within this oat file. |
| 253 | // If dex_location_checksum is non-null, the OatDexFile will only be |
| 254 | // returned if it has a matching checksum. |
| 255 | // If error_msg is non-null and no OatDexFile is returned, error_msg will |
| 256 | // be updated with a description of why no OatDexFile was returned. |
Ian Rogers | 8d31bbd | 2013-10-13 10:44:14 -0700 | [diff] [blame] | 257 | const OatDexFile* GetOatDexFile(const char* dex_location, |
Brian Carlstrom | 756ee4e | 2013-10-03 15:46:12 -0700 | [diff] [blame] | 258 | const uint32_t* const dex_location_checksum, |
Richard Uhler | 9a37efc | 2016-08-05 16:32:55 -0700 | [diff] [blame] | 259 | /*out*/std::string* error_msg = nullptr) const |
Mathieu Chartier | 9044347 | 2015-07-16 20:32:27 -0700 | [diff] [blame] | 260 | REQUIRES(!secondary_lookup_lock_); |
Ian Rogers | 8d31bbd | 2013-10-13 10:44:14 -0700 | [diff] [blame] | 261 | |
Vladimir Marko | aa4497d | 2014-09-05 14:01:17 +0100 | [diff] [blame] | 262 | const std::vector<const OatDexFile*>& GetOatDexFiles() const { |
| 263 | return oat_dex_files_storage_; |
| 264 | } |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 265 | |
Ian Rogers | 30fab40 | 2012-01-23 15:43:46 -0800 | [diff] [blame] | 266 | size_t Size() const { |
| 267 | return End() - Begin(); |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 268 | } |
| 269 | |
Mingyao Yang | 6ea1a0e | 2016-01-29 12:12:49 -0800 | [diff] [blame] | 270 | bool Contains(const void* p) const { |
| 271 | return p >= Begin() && p < End(); |
| 272 | } |
| 273 | |
Vladimir Marko | 5c42c29 | 2015-02-25 12:02:49 +0000 | [diff] [blame] | 274 | size_t BssSize() const { |
| 275 | return BssEnd() - BssBegin(); |
| 276 | } |
| 277 | |
David Srbecky | ec2cdf4 | 2017-12-08 16:21:25 +0000 | [diff] [blame] | 278 | size_t VdexSize() const { |
| 279 | return VdexEnd() - VdexBegin(); |
| 280 | } |
| 281 | |
Vladimir Marko | 0eb882b | 2017-05-15 13:39:18 +0100 | [diff] [blame] | 282 | size_t BssMethodsOffset() const { |
| 283 | // Note: This is used only for symbolizer and needs to return a valid .bss offset. |
| 284 | return (bss_methods_ != nullptr) ? bss_methods_ - BssBegin() : BssRootsOffset(); |
| 285 | } |
| 286 | |
Vladimir Marko | aad75c6 | 2016-10-03 08:46:48 +0000 | [diff] [blame] | 287 | size_t BssRootsOffset() const { |
Vladimir Marko | 0eb882b | 2017-05-15 13:39:18 +0100 | [diff] [blame] | 288 | // Note: This is used only for symbolizer and needs to return a valid .bss offset. |
| 289 | return (bss_roots_ != nullptr) ? bss_roots_ - BssBegin() : BssSize(); |
Vladimir Marko | aad75c6 | 2016-10-03 08:46:48 +0000 | [diff] [blame] | 290 | } |
| 291 | |
David Brazdil | 7b49e6c | 2016-09-01 11:06:18 +0100 | [diff] [blame] | 292 | size_t DexSize() const { |
| 293 | return DexEnd() - DexBegin(); |
| 294 | } |
| 295 | |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 296 | const uint8_t* Begin() const; |
| 297 | const uint8_t* End() const; |
Alex Light | 53cb16b | 2014-06-12 11:26:29 -0700 | [diff] [blame] | 298 | |
Vladimir Marko | 5c42c29 | 2015-02-25 12:02:49 +0000 | [diff] [blame] | 299 | const uint8_t* BssBegin() const; |
| 300 | const uint8_t* BssEnd() const; |
| 301 | |
David Srbecky | ec2cdf4 | 2017-12-08 16:21:25 +0000 | [diff] [blame] | 302 | const uint8_t* VdexBegin() const; |
| 303 | const uint8_t* VdexEnd() const; |
| 304 | |
David Brazdil | 7b49e6c | 2016-09-01 11:06:18 +0100 | [diff] [blame] | 305 | const uint8_t* DexBegin() const; |
| 306 | const uint8_t* DexEnd() const; |
| 307 | |
Vladimir Marko | 0eb882b | 2017-05-15 13:39:18 +0100 | [diff] [blame] | 308 | ArrayRef<ArtMethod*> GetBssMethods() const; |
Vladimir Marko | aad75c6 | 2016-10-03 08:46:48 +0000 | [diff] [blame] | 309 | ArrayRef<GcRoot<mirror::Object>> GetBssGcRoots() const; |
| 310 | |
Richard Uhler | e5fed03 | 2015-03-18 08:21:11 -0700 | [diff] [blame] | 311 | // Returns the absolute dex location for the encoded relative dex location. |
| 312 | // |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 313 | // If not null, abs_dex_location is used to resolve the absolute dex |
Richard Uhler | e5fed03 | 2015-03-18 08:21:11 -0700 | [diff] [blame] | 314 | // location of relative dex locations encoded in the oat file. |
| 315 | // For example, given absolute location "/data/app/foo/base.apk", encoded |
Calin Juravle | a308a32 | 2017-07-18 16:51:51 -0700 | [diff] [blame] | 316 | // dex locations "base.apk", "base.apk!classes2.dex", etc. would be resolved |
| 317 | // to "/data/app/foo/base.apk", "/data/app/foo/base.apk!classes2.dex", etc. |
Richard Uhler | e5fed03 | 2015-03-18 08:21:11 -0700 | [diff] [blame] | 318 | // Relative encoded dex locations that don't match the given abs_dex_location |
| 319 | // are left unchanged. |
| 320 | static std::string ResolveRelativeEncodedDexLocation( |
| 321 | const char* abs_dex_location, const std::string& rel_dex_location); |
| 322 | |
Vladimir Marko | 97d7e1c | 2016-10-04 14:44:28 +0100 | [diff] [blame] | 323 | // Finds the associated oat class for a dex_file and descriptor. Returns an invalid OatClass on |
| 324 | // error and sets found to false. |
| 325 | static OatClass FindOatClass(const DexFile& dex_file, uint16_t class_def_idx, bool* found); |
| 326 | |
Nicolas Geoffray | 4acefd3 | 2016-10-24 13:14:58 +0100 | [diff] [blame] | 327 | VdexFile* GetVdexFile() const { |
| 328 | return vdex_.get(); |
| 329 | } |
| 330 | |
Nicolas Geoffray | f307527 | 2018-01-08 12:41:19 +0000 | [diff] [blame] | 331 | // Whether the OatFile embeds the Dex code. |
| 332 | bool ContainsDexCode() const { |
| 333 | return uncompressed_dex_files_ == nullptr; |
| 334 | } |
| 335 | |
Andreas Gampe | 049cff0 | 2015-12-01 23:27:12 -0800 | [diff] [blame] | 336 | protected: |
| 337 | OatFile(const std::string& filename, bool executable); |
| 338 | |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 339 | private: |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 340 | // The oat file name. |
| 341 | // |
| 342 | // The image will embed this to link its associated oat file. |
| 343 | const std::string location_; |
| 344 | |
David Brazdil | 7b49e6c | 2016-09-01 11:06:18 +0100 | [diff] [blame] | 345 | // Pointer to the Vdex file with the Dex files for this Oat file. |
| 346 | std::unique_ptr<VdexFile> vdex_; |
| 347 | |
Brian Carlstrom | 700c8d3 | 2012-11-05 10:42:02 -0800 | [diff] [blame] | 348 | // Pointer to OatHeader. |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 349 | const uint8_t* begin_; |
Brian Carlstrom | 700c8d3 | 2012-11-05 10:42:02 -0800 | [diff] [blame] | 350 | |
| 351 | // Pointer to end of oat region for bounds checking. |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 352 | const uint8_t* end_; |
Brian Carlstrom | 700c8d3 | 2012-11-05 10:42:02 -0800 | [diff] [blame] | 353 | |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 354 | // Pointer to the .bss section, if present, otherwise null. |
Vladimir Marko | 06d7aaa | 2015-10-16 11:23:41 +0100 | [diff] [blame] | 355 | uint8_t* bss_begin_; |
Vladimir Marko | 5c42c29 | 2015-02-25 12:02:49 +0000 | [diff] [blame] | 356 | |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 357 | // Pointer to the end of the .bss section, if present, otherwise null. |
Vladimir Marko | 06d7aaa | 2015-10-16 11:23:41 +0100 | [diff] [blame] | 358 | uint8_t* bss_end_; |
Vladimir Marko | 5c42c29 | 2015-02-25 12:02:49 +0000 | [diff] [blame] | 359 | |
Vladimir Marko | 0eb882b | 2017-05-15 13:39:18 +0100 | [diff] [blame] | 360 | // Pointer to the beginning of the ArtMethod*s in .bss section, if present, otherwise null. |
| 361 | uint8_t* bss_methods_; |
| 362 | |
Vladimir Marko | aad75c6 | 2016-10-03 08:46:48 +0000 | [diff] [blame] | 363 | // Pointer to the beginning of the GC roots in .bss section, if present, otherwise null. |
| 364 | uint8_t* bss_roots_; |
| 365 | |
Alex Light | 9dcc457 | 2014-08-14 14:16:26 -0700 | [diff] [blame] | 366 | // Was this oat_file loaded executable? |
| 367 | const bool is_executable_; |
| 368 | |
David Srbecky | ec2cdf4 | 2017-12-08 16:21:25 +0000 | [diff] [blame] | 369 | // Pointer to the .vdex section, if present, otherwise null. |
| 370 | uint8_t* vdex_begin_; |
| 371 | |
| 372 | // Pointer to the end of the .vdex section, if present, otherwise null. |
| 373 | uint8_t* vdex_end_; |
| 374 | |
Vladimir Marko | aa4497d | 2014-09-05 14:01:17 +0100 | [diff] [blame] | 375 | // Owning storage for the OatDexFile objects. |
| 376 | std::vector<const OatDexFile*> oat_dex_files_storage_; |
| 377 | |
Vladimir Marko | 3f5838d | 2014-08-07 18:07:18 +0100 | [diff] [blame] | 378 | // NOTE: We use a StringPiece as the key type to avoid a memory allocation on every |
| 379 | // lookup with a const char* key. The StringPiece doesn't own its backing storage, |
| 380 | // therefore we're using the OatDexFile::dex_file_location_ as the backing storage |
| 381 | // for keys in oat_dex_files_ and the string_cache_ entries for the backing storage |
| 382 | // of keys in secondary_oat_dex_files_ and oat_dex_files_by_canonical_location_. |
Mathieu Chartier | bad0267 | 2014-08-25 13:08:22 -0700 | [diff] [blame] | 383 | typedef AllocationTrackingSafeMap<StringPiece, const OatDexFile*, kAllocatorTagOatFile> Table; |
Vladimir Marko | 3f5838d | 2014-08-07 18:07:18 +0100 | [diff] [blame] | 384 | |
Vladimir Marko | aa4497d | 2014-09-05 14:01:17 +0100 | [diff] [blame] | 385 | // Map each location and canonical location (if different) retrieved from the |
| 386 | // oat file to its OatDexFile. This map doesn't change after it's constructed in Setup() |
| 387 | // and therefore doesn't need any locking and provides the cheapest dex file lookup |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 388 | // for GetOatDexFile() for a very frequent use case. Never contains a null value. |
Vladimir Marko | aa4497d | 2014-09-05 14:01:17 +0100 | [diff] [blame] | 389 | Table oat_dex_files_; |
Vladimir Marko | 3f5838d | 2014-08-07 18:07:18 +0100 | [diff] [blame] | 390 | |
| 391 | // Lock guarding all members needed for secondary lookup in GetOatDexFile(). |
| 392 | mutable Mutex secondary_lookup_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER; |
| 393 | |
| 394 | // If the primary oat_dex_files_ lookup fails, use a secondary map. This map stores |
| 395 | // the results of all previous secondary lookups, whether successful (non-null) or |
| 396 | // failed (null). If it doesn't contain an entry we need to calculate the canonical |
| 397 | // location and use oat_dex_files_by_canonical_location_. |
| 398 | mutable Table secondary_oat_dex_files_ GUARDED_BY(secondary_lookup_lock_); |
| 399 | |
Vladimir Marko | 3f5838d | 2014-08-07 18:07:18 +0100 | [diff] [blame] | 400 | // Cache of strings. Contains the backing storage for keys in the secondary_oat_dex_files_ |
| 401 | // and the lazily initialized oat_dex_files_by_canonical_location_. |
| 402 | // NOTE: We're keeping references to contained strings in form of StringPiece and adding |
| 403 | // new strings to the end. The adding of a new element must not touch any previously stored |
| 404 | // elements. std::list<> and std::deque<> satisfy this requirement, std::vector<> doesn't. |
| 405 | mutable std::list<std::string> string_cache_ GUARDED_BY(secondary_lookup_lock_); |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 406 | |
Nicolas Geoffray | f307527 | 2018-01-08 12:41:19 +0000 | [diff] [blame] | 407 | // Cache of dex files mapped directly from a location, in case the OatFile does |
| 408 | // not embed the dex code. |
| 409 | std::unique_ptr<std::vector<std::unique_ptr<const DexFile>>> uncompressed_dex_files_; |
| 410 | |
Mathieu Chartier | 5351da0 | 2016-02-17 16:19:53 -0800 | [diff] [blame] | 411 | friend class gc::collector::DummyOatFile; // For modifying begin_ and end_. |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 412 | friend class OatClass; |
Richard Uhler | 07b3c23 | 2015-03-31 15:57:54 -0700 | [diff] [blame] | 413 | friend class art::OatDexFile; |
Elliott Hughes | e3c845c | 2012-02-28 17:23:01 -0800 | [diff] [blame] | 414 | friend class OatDumper; // For GetBase and GetLimit |
Andreas Gampe | 049cff0 | 2015-12-01 23:27:12 -0800 | [diff] [blame] | 415 | friend class OatFileBase; |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 416 | DISALLOW_COPY_AND_ASSIGN(OatFile); |
| 417 | }; |
| 418 | |
Richard Uhler | 07b3c23 | 2015-03-31 15:57:54 -0700 | [diff] [blame] | 419 | // OatDexFile should be an inner class of OatFile. Unfortunately, C++ doesn't |
| 420 | // support forward declarations of inner classes, and we want to |
| 421 | // forward-declare OatDexFile so that we can store an opaque pointer to an |
| 422 | // OatDexFile in DexFile. |
| 423 | class OatDexFile FINAL { |
| 424 | public: |
| 425 | // Opens the DexFile referred to by this OatDexFile from within the containing OatFile. |
Igor Murashkin | b1d8c31 | 2015-08-04 11:18:43 -0700 | [diff] [blame] | 426 | std::unique_ptr<const DexFile> OpenDexFile(std::string* error_msg) const; |
Richard Uhler | 07b3c23 | 2015-03-31 15:57:54 -0700 | [diff] [blame] | 427 | |
Mathieu Chartier | 1b86849 | 2016-11-16 16:22:37 -0800 | [diff] [blame] | 428 | // May return null if the OatDexFile only contains a type lookup table. This case only happens |
| 429 | // for the compiler to speed up compilation. |
Richard Uhler | 07b3c23 | 2015-03-31 15:57:54 -0700 | [diff] [blame] | 430 | const OatFile* GetOatFile() const { |
Mathieu Chartier | 1b86849 | 2016-11-16 16:22:37 -0800 | [diff] [blame] | 431 | // Avoid pulling in runtime.h in the header file. |
| 432 | if (kIsDebugBuild && oat_file_ == nullptr) { |
| 433 | AssertAotCompiler(); |
| 434 | } |
Richard Uhler | 07b3c23 | 2015-03-31 15:57:54 -0700 | [diff] [blame] | 435 | return oat_file_; |
| 436 | } |
| 437 | |
| 438 | // Returns the size of the DexFile refered to by this OatDexFile. |
| 439 | size_t FileSize() const; |
| 440 | |
| 441 | // Returns original path of DexFile that was the source of this OatDexFile. |
| 442 | const std::string& GetDexFileLocation() const { |
| 443 | return dex_file_location_; |
| 444 | } |
| 445 | |
| 446 | // Returns the canonical location of DexFile that was the source of this OatDexFile. |
| 447 | const std::string& GetCanonicalDexFileLocation() const { |
| 448 | return canonical_dex_file_location_; |
| 449 | } |
| 450 | |
| 451 | // Returns checksum of original DexFile that was the source of this OatDexFile; |
| 452 | uint32_t GetDexFileLocationChecksum() const { |
| 453 | return dex_file_location_checksum_; |
| 454 | } |
| 455 | |
| 456 | // Returns the OatClass for the class specified by the given DexFile class_def_index. |
| 457 | OatFile::OatClass GetOatClass(uint16_t class_def_index) const; |
| 458 | |
| 459 | // Returns the offset to the OatClass information. Most callers should use GetOatClass. |
| 460 | uint32_t GetOatClassOffset(uint16_t class_def_index) const; |
| 461 | |
Artem Udovichenko | d9786b0 | 2015-10-14 16:36:55 +0300 | [diff] [blame] | 462 | const uint8_t* GetLookupTableData() const { |
| 463 | return lookup_table_data_; |
| 464 | } |
| 465 | |
Vladimir Marko | f3c52b4 | 2017-11-17 17:32:12 +0000 | [diff] [blame] | 466 | const IndexBssMapping* GetMethodBssMapping() const { |
Vladimir Marko | 0eb882b | 2017-05-15 13:39:18 +0100 | [diff] [blame] | 467 | return method_bss_mapping_; |
| 468 | } |
| 469 | |
Vladimir Marko | f3c52b4 | 2017-11-17 17:32:12 +0000 | [diff] [blame] | 470 | const IndexBssMapping* GetTypeBssMapping() const { |
| 471 | return type_bss_mapping_; |
| 472 | } |
| 473 | |
| 474 | const IndexBssMapping* GetStringBssMapping() const { |
| 475 | return string_bss_mapping_; |
| 476 | } |
| 477 | |
Andreas Gampe | 2ba8895 | 2016-04-29 17:52:07 -0700 | [diff] [blame] | 478 | const uint8_t* GetDexFilePointer() const { |
| 479 | return dex_file_pointer_; |
| 480 | } |
| 481 | |
David Sehr | 9aa352e | 2016-09-15 18:13:52 -0700 | [diff] [blame] | 482 | // Looks up a class definition by its class descriptor. Hash must be |
| 483 | // ComputeModifiedUtf8Hash(descriptor). |
| 484 | static const DexFile::ClassDef* FindClassDef(const DexFile& dex_file, |
| 485 | const char* descriptor, |
| 486 | size_t hash); |
| 487 | |
Mathieu Chartier | 120aa28 | 2017-08-05 16:03:03 -0700 | [diff] [blame] | 488 | // Madvise the dex file based on the state we are moving to. |
| 489 | static void MadviseDexFile(const DexFile& dex_file, MadviseState state); |
| 490 | |
David Sehr | 9aa352e | 2016-09-15 18:13:52 -0700 | [diff] [blame] | 491 | TypeLookupTable* GetTypeLookupTable() const { |
| 492 | return lookup_table_.get(); |
| 493 | } |
| 494 | |
Richard Uhler | 07b3c23 | 2015-03-31 15:57:54 -0700 | [diff] [blame] | 495 | ~OatDexFile(); |
| 496 | |
Mathieu Chartier | 1b86849 | 2016-11-16 16:22:37 -0800 | [diff] [blame] | 497 | // Create only with a type lookup table, used by the compiler to speed up compilation. |
| 498 | explicit OatDexFile(std::unique_ptr<TypeLookupTable>&& lookup_table); |
| 499 | |
Mathieu Chartier | 120aa28 | 2017-08-05 16:03:03 -0700 | [diff] [blame] | 500 | // Return the dex layout sections. |
| 501 | const DexLayoutSections* GetDexLayoutSections() const { |
| 502 | return dex_layout_sections_; |
| 503 | } |
| 504 | |
Richard Uhler | 07b3c23 | 2015-03-31 15:57:54 -0700 | [diff] [blame] | 505 | private: |
| 506 | OatDexFile(const OatFile* oat_file, |
| 507 | const std::string& dex_file_location, |
| 508 | const std::string& canonical_dex_file_location, |
| 509 | uint32_t dex_file_checksum, |
| 510 | const uint8_t* dex_file_pointer, |
Artem Udovichenko | d9786b0 | 2015-10-14 16:36:55 +0300 | [diff] [blame] | 511 | const uint8_t* lookup_table_data, |
Vladimir Marko | f3c52b4 | 2017-11-17 17:32:12 +0000 | [diff] [blame] | 512 | const IndexBssMapping* method_bss_mapping, |
| 513 | const IndexBssMapping* type_bss_mapping, |
| 514 | const IndexBssMapping* string_bss_mapping, |
Vladimir Marko | 09d0943 | 2015-09-08 13:47:48 +0100 | [diff] [blame] | 515 | const uint32_t* oat_class_offsets_pointer, |
Mathieu Chartier | 120aa28 | 2017-08-05 16:03:03 -0700 | [diff] [blame] | 516 | const DexLayoutSections* dex_layout_sections); |
Richard Uhler | 07b3c23 | 2015-03-31 15:57:54 -0700 | [diff] [blame] | 517 | |
Mathieu Chartier | 1b86849 | 2016-11-16 16:22:37 -0800 | [diff] [blame] | 518 | static void AssertAotCompiler(); |
| 519 | |
| 520 | const OatFile* const oat_file_ = nullptr; |
Richard Uhler | 07b3c23 | 2015-03-31 15:57:54 -0700 | [diff] [blame] | 521 | const std::string dex_file_location_; |
| 522 | const std::string canonical_dex_file_location_; |
Mathieu Chartier | 1b86849 | 2016-11-16 16:22:37 -0800 | [diff] [blame] | 523 | const uint32_t dex_file_location_checksum_ = 0u; |
| 524 | const uint8_t* const dex_file_pointer_ = nullptr; |
Vladimir Marko | 0eb882b | 2017-05-15 13:39:18 +0100 | [diff] [blame] | 525 | const uint8_t* const lookup_table_data_ = nullptr; |
Vladimir Marko | f3c52b4 | 2017-11-17 17:32:12 +0000 | [diff] [blame] | 526 | const IndexBssMapping* const method_bss_mapping_ = nullptr; |
| 527 | const IndexBssMapping* const type_bss_mapping_ = nullptr; |
| 528 | const IndexBssMapping* const string_bss_mapping_ = nullptr; |
Mathieu Chartier | 1b86849 | 2016-11-16 16:22:37 -0800 | [diff] [blame] | 529 | const uint32_t* const oat_class_offsets_pointer_ = 0u; |
David Sehr | 9aa352e | 2016-09-15 18:13:52 -0700 | [diff] [blame] | 530 | mutable std::unique_ptr<TypeLookupTable> lookup_table_; |
Mathieu Chartier | 120aa28 | 2017-08-05 16:03:03 -0700 | [diff] [blame] | 531 | const DexLayoutSections* const dex_layout_sections_ = nullptr; |
Richard Uhler | 07b3c23 | 2015-03-31 15:57:54 -0700 | [diff] [blame] | 532 | |
| 533 | friend class OatFile; |
Andreas Gampe | 049cff0 | 2015-12-01 23:27:12 -0800 | [diff] [blame] | 534 | friend class OatFileBase; |
Richard Uhler | 07b3c23 | 2015-03-31 15:57:54 -0700 | [diff] [blame] | 535 | DISALLOW_COPY_AND_ASSIGN(OatDexFile); |
| 536 | }; |
| 537 | |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 538 | } // namespace art |
| 539 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 540 | #endif // ART_RUNTIME_OAT_FILE_H_ |