Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [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 | */ |
| 16 | |
Vladimir Marko | 7452797 | 2016-11-29 15:57:32 +0000 | [diff] [blame] | 17 | #ifndef ART_DEX2OAT_LINKER_IMAGE_WRITER_H_ |
| 18 | #define ART_DEX2OAT_LINKER_IMAGE_WRITER_H_ |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 19 | |
| 20 | #include <stdint.h> |
Evgenii Stepanov | 1e13374 | 2015-05-20 12:30:59 -0700 | [diff] [blame] | 21 | #include "base/memory_tool.h" |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 22 | |
| 23 | #include <cstddef> |
Ian Rogers | 700a402 | 2014-05-19 16:49:03 -0700 | [diff] [blame] | 24 | #include <memory> |
Andreas Gampe | 8cf9cb3 | 2017-07-19 09:28:38 -0700 | [diff] [blame] | 25 | #include <ostream> |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 26 | #include <set> |
Mathieu Chartier | 496577f | 2016-09-20 15:33:31 -0700 | [diff] [blame] | 27 | #include <stack> |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 28 | #include <string> |
| 29 | |
Alex Light | dba6148 | 2016-12-21 08:20:29 -0800 | [diff] [blame] | 30 | #include "art_method.h" |
Vladimir Marko | 80afd02 | 2015-05-19 18:08:00 +0100 | [diff] [blame] | 31 | #include "base/bit_utils.h" |
Vladimir Marko | 944da60 | 2016-02-19 12:27:55 +0000 | [diff] [blame] | 32 | #include "base/dchecked_vector.h" |
Andreas Gampe | 542451c | 2016-07-26 09:02:02 -0700 | [diff] [blame] | 33 | #include "base/enums.h" |
Vladimir Marko | 54159c6 | 2018-06-20 14:30:08 +0100 | [diff] [blame^] | 34 | #include "base/hash_set.h" |
Alex Light | e64300b | 2015-12-15 15:02:47 -0800 | [diff] [blame] | 35 | #include "base/length_prefixed_array.h" |
Igor Murashkin | 4677476 | 2014-10-22 11:37:02 -0700 | [diff] [blame] | 36 | #include "base/macros.h" |
David Sehr | 79e2607 | 2018-04-06 17:58:50 -0700 | [diff] [blame] | 37 | #include "base/mem_map.h" |
David Sehr | c431b9d | 2018-03-02 12:01:51 -0800 | [diff] [blame] | 38 | #include "base/os.h" |
David Sehr | 67bf42e | 2018-02-26 16:43:04 -0800 | [diff] [blame] | 39 | #include "base/safe_map.h" |
David Sehr | c431b9d | 2018-03-02 12:01:51 -0800 | [diff] [blame] | 40 | #include "base/utils.h" |
Andreas Gampe | 2ff3b97 | 2017-06-05 18:14:53 -0700 | [diff] [blame] | 41 | #include "class_table.h" |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 42 | #include "driver/compiler_driver.h" |
Mathieu Chartier | ceb07b3 | 2015-12-10 09:33:21 -0800 | [diff] [blame] | 43 | #include "image.h" |
Andreas Gampe | b2d18fa | 2017-06-06 20:46:10 -0700 | [diff] [blame] | 44 | #include "intern_table.h" |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 45 | #include "lock_word.h" |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 46 | #include "mirror/dex_cache.h" |
Mathieu Chartier | 8c19d24 | 2017-03-06 12:35:10 -0800 | [diff] [blame] | 47 | #include "oat_file.h" |
Andreas Gampe | 8cf9cb3 | 2017-07-19 09:28:38 -0700 | [diff] [blame] | 48 | #include "obj_ptr.h" |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 49 | |
| 50 | namespace art { |
Mathieu Chartier | da5b28a | 2015-11-05 08:03:47 -0800 | [diff] [blame] | 51 | namespace gc { |
Andreas Gampe | d490129 | 2017-05-30 18:41:34 -0700 | [diff] [blame] | 52 | namespace accounting { |
| 53 | template <size_t kAlignment> class SpaceBitmap; |
| 54 | typedef SpaceBitmap<kObjectAlignment> ContinuousSpaceBitmap; |
| 55 | } // namespace accounting |
Mathieu Chartier | da5b28a | 2015-11-05 08:03:47 -0800 | [diff] [blame] | 56 | namespace space { |
| 57 | class ImageSpace; |
| 58 | } // namespace space |
| 59 | } // namespace gc |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 60 | |
Vladimir Marko | 8d6768d | 2017-03-14 10:13:21 +0000 | [diff] [blame] | 61 | namespace mirror { |
| 62 | class ClassLoader; |
| 63 | } // namespace mirror |
| 64 | |
Vladimir Marko | c5798bf | 2016-12-09 10:20:54 +0000 | [diff] [blame] | 65 | class ClassLoaderVisitor; |
Vladimir Marko | 2c64a83 | 2018-01-04 11:31:56 +0000 | [diff] [blame] | 66 | class ImTable; |
Vladimir Marko | 8d6768d | 2017-03-14 10:13:21 +0000 | [diff] [blame] | 67 | class ImtConflictTable; |
Mathieu Chartier | 703b82a | 2018-04-10 15:52:32 -0700 | [diff] [blame] | 68 | class TimingLogger; |
Mathieu Chartier | 1f47b67 | 2016-01-07 16:29:01 -0800 | [diff] [blame] | 69 | |
Mathieu Chartier | fbc3108 | 2016-01-24 11:59:56 -0800 | [diff] [blame] | 70 | static constexpr int kInvalidFd = -1; |
Mathieu Chartier | a90c772 | 2015-10-29 15:41:36 -0700 | [diff] [blame] | 71 | |
Vladimir Marko | 7452797 | 2016-11-29 15:57:32 +0000 | [diff] [blame] | 72 | namespace linker { |
| 73 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 74 | // Write a Space built during compilation for use during execution. |
Igor Murashkin | 4677476 | 2014-10-22 11:37:02 -0700 | [diff] [blame] | 75 | class ImageWriter FINAL { |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 76 | public: |
Mathieu Chartier | da5b28a | 2015-11-05 08:03:47 -0800 | [diff] [blame] | 77 | ImageWriter(const CompilerDriver& compiler_driver, |
| 78 | uintptr_t image_begin, |
| 79 | bool compile_pic, |
Mathieu Chartier | ceb07b3 | 2015-12-10 09:33:21 -0800 | [diff] [blame] | 80 | bool compile_app_image, |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 81 | ImageHeader::StorageMode image_storage_mode, |
Vladimir Marko | 944da60 | 2016-02-19 12:27:55 +0000 | [diff] [blame] | 82 | const std::vector<const char*>& oat_filenames, |
Jeff Hao | c23b0c0 | 2017-07-27 18:19:38 -0700 | [diff] [blame] | 83 | const std::unordered_map<const DexFile*, size_t>& dex_file_oat_index_map, |
Vladimir Marko | 54159c6 | 2018-06-20 14:30:08 +0100 | [diff] [blame^] | 84 | const HashSet<std::string>* dirty_image_objects); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 85 | |
Mathieu Chartier | 703b82a | 2018-04-10 15:52:32 -0700 | [diff] [blame] | 86 | bool PrepareImageAddressSpace(TimingLogger* timings); |
Vladimir Marko | f4da675 | 2014-08-01 19:04:18 +0100 | [diff] [blame] | 87 | |
| 88 | bool IsImageAddressSpaceReady() const { |
Vladimir Marko | 944da60 | 2016-02-19 12:27:55 +0000 | [diff] [blame] | 89 | DCHECK(!image_infos_.empty()); |
| 90 | for (const ImageInfo& image_info : image_infos_) { |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 91 | if (image_info.image_roots_address_ == 0u) { |
| 92 | return false; |
| 93 | } |
| 94 | } |
Vladimir Marko | 944da60 | 2016-02-19 12:27:55 +0000 | [diff] [blame] | 95 | return true; |
Vladimir Marko | f4da675 | 2014-08-01 19:04:18 +0100 | [diff] [blame] | 96 | } |
| 97 | |
Vladimir Marko | 8d6768d | 2017-03-14 10:13:21 +0000 | [diff] [blame] | 98 | ObjPtr<mirror::ClassLoader> GetClassLoader() { |
| 99 | CHECK_EQ(class_loaders_.size(), compile_app_image_ ? 1u : 0u); |
| 100 | return compile_app_image_ ? *class_loaders_.begin() : nullptr; |
| 101 | } |
| 102 | |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 103 | template <typename T> |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 104 | T* GetImageAddress(T* object) const REQUIRES_SHARED(Locks::mutator_lock_) { |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 105 | if (object == nullptr || IsInBootImage(object)) { |
| 106 | return object; |
| 107 | } else { |
Vladimir Marko | 944da60 | 2016-02-19 12:27:55 +0000 | [diff] [blame] | 108 | size_t oat_index = GetOatIndex(object); |
| 109 | const ImageInfo& image_info = GetImageInfo(oat_index); |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 110 | return reinterpret_cast<T*>(image_info.image_begin_ + GetImageOffset(object)); |
| 111 | } |
Vladimir Marko | f4da675 | 2014-08-01 19:04:18 +0100 | [diff] [blame] | 112 | } |
| 113 | |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 114 | ArtMethod* GetImageMethodAddress(ArtMethod* method) REQUIRES_SHARED(Locks::mutator_lock_); |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 115 | |
Vladimir Marko | 944da60 | 2016-02-19 12:27:55 +0000 | [diff] [blame] | 116 | size_t GetOatFileOffset(size_t oat_index) const { |
| 117 | return GetImageInfo(oat_index).oat_offset_; |
| 118 | } |
| 119 | |
| 120 | const uint8_t* GetOatFileBegin(size_t oat_index) const { |
| 121 | return GetImageInfo(oat_index).oat_file_begin_; |
| 122 | } |
Vladimir Marko | f4da675 | 2014-08-01 19:04:18 +0100 | [diff] [blame] | 123 | |
Mathieu Chartier | fbc3108 | 2016-01-24 11:59:56 -0800 | [diff] [blame] | 124 | // If image_fd is not kInvalidFd, then we use that for the image file. Otherwise we open |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 125 | // the names in image_filenames. |
Mathieu Chartier | fbc3108 | 2016-01-24 11:59:56 -0800 | [diff] [blame] | 126 | // If oat_fd is not kInvalidFd, then we use that for the oat file. Otherwise we open |
| 127 | // the names in oat_filenames. |
Mathieu Chartier | a90c772 | 2015-10-29 15:41:36 -0700 | [diff] [blame] | 128 | bool Write(int image_fd, |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 129 | const std::vector<const char*>& image_filenames, |
Vladimir Marko | 944da60 | 2016-02-19 12:27:55 +0000 | [diff] [blame] | 130 | const std::vector<const char*>& oat_filenames) |
Mathieu Chartier | 9044347 | 2015-07-16 20:32:27 -0700 | [diff] [blame] | 131 | REQUIRES(!Locks::mutator_lock_); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 132 | |
Vladimir Marko | 944da60 | 2016-02-19 12:27:55 +0000 | [diff] [blame] | 133 | uintptr_t GetOatDataBegin(size_t oat_index) { |
| 134 | return reinterpret_cast<uintptr_t>(GetImageInfo(oat_index).oat_data_begin_); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 135 | } |
| 136 | |
Vladimir Marko | 944da60 | 2016-02-19 12:27:55 +0000 | [diff] [blame] | 137 | // Get the index of the oat file containing the dex file. |
| 138 | // |
| 139 | // This "oat_index" is used to retrieve information about the the memory layout |
| 140 | // of the oat file and its associated image file, needed for link-time patching |
| 141 | // of references to the image or across oat files. |
| 142 | size_t GetOatIndexForDexFile(const DexFile* dex_file) const; |
| 143 | |
| 144 | // Get the index of the oat file containing the dex file served by the dex cache. |
Mathieu Chartier | c4f3925 | 2016-10-05 18:32:08 -0700 | [diff] [blame] | 145 | size_t GetOatIndexForDexCache(ObjPtr<mirror::DexCache> dex_cache) const |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 146 | REQUIRES_SHARED(Locks::mutator_lock_); |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 147 | |
Vladimir Marko | 944da60 | 2016-02-19 12:27:55 +0000 | [diff] [blame] | 148 | // Update the oat layout for the given oat file. |
| 149 | // This will make the oat_offset for the next oat file valid. |
| 150 | void UpdateOatFileLayout(size_t oat_index, |
| 151 | size_t oat_loaded_size, |
| 152 | size_t oat_data_offset, |
| 153 | size_t oat_data_size); |
| 154 | // Update information about the oat header, i.e. checksum and trampoline offsets. |
| 155 | void UpdateOatFileHeader(size_t oat_index, const OatHeader& oat_header); |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 156 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 157 | private: |
Mathieu Chartier | 496577f | 2016-09-20 15:33:31 -0700 | [diff] [blame] | 158 | using WorkStack = std::stack<std::pair<mirror::Object*, size_t>>; |
| 159 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 160 | bool AllocMemory(); |
| 161 | |
Mathieu Chartier | 31e8925 | 2013-08-28 11:29:12 -0700 | [diff] [blame] | 162 | // Mark the objects defined in this space in the given live bitmap. |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 163 | void RecordImageAllocations() REQUIRES_SHARED(Locks::mutator_lock_); |
Mathieu Chartier | 31e8925 | 2013-08-28 11:29:12 -0700 | [diff] [blame] | 164 | |
Igor Murashkin | f5b4c50 | 2014-11-14 15:01:59 -0800 | [diff] [blame] | 165 | // Classify different kinds of bins that objects end up getting packed into during image writing. |
Mathieu Chartier | 2ba04ea | 2016-04-08 19:01:05 -0700 | [diff] [blame] | 166 | // Ordered from dirtiest to cleanest (until ArtMethods). |
Vladimir Marko | d504c7e | 2017-12-04 15:56:51 +0000 | [diff] [blame] | 167 | enum class Bin { |
| 168 | kKnownDirty, // Known dirty objects from --dirty-image-objects list |
| 169 | kMiscDirty, // Dex caches, object locks, etc... |
| 170 | kClassVerified, // Class verified, but initializers haven't been run |
Mathieu Chartier | d464fa1 | 2016-04-08 18:54:36 -0700 | [diff] [blame] | 171 | // Unknown mix of clean/dirty: |
Vladimir Marko | d504c7e | 2017-12-04 15:56:51 +0000 | [diff] [blame] | 172 | kRegular, |
| 173 | kClassInitialized, // Class initializers have been run |
Mathieu Chartier | d464fa1 | 2016-04-08 18:54:36 -0700 | [diff] [blame] | 174 | // All classes get their own bins since their fields often dirty |
Vladimir Marko | d504c7e | 2017-12-04 15:56:51 +0000 | [diff] [blame] | 175 | kClassInitializedFinalStatics, // Class initializers have been run, no non-final statics |
Mathieu Chartier | 2ba04ea | 2016-04-08 19:01:05 -0700 | [diff] [blame] | 176 | // Likely-clean: |
Vladimir Marko | d504c7e | 2017-12-04 15:56:51 +0000 | [diff] [blame] | 177 | kString, // [String] Almost always immutable (except for obj header). |
Igor Murashkin | f5b4c50 | 2014-11-14 15:01:59 -0800 | [diff] [blame] | 178 | // Add more bins here if we add more segregation code. |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 179 | // Non mirror fields must be below. |
| 180 | // ArtFields should be always clean. |
Vladimir Marko | d504c7e | 2017-12-04 15:56:51 +0000 | [diff] [blame] | 181 | kArtField, |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 182 | // If the class is initialized, then the ArtMethods are probably clean. |
Vladimir Marko | d504c7e | 2017-12-04 15:56:51 +0000 | [diff] [blame] | 183 | kArtMethodClean, |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 184 | // ArtMethods may be dirty if the class has native methods or a declaring class that isn't |
| 185 | // initialized. |
Vladimir Marko | d504c7e | 2017-12-04 15:56:51 +0000 | [diff] [blame] | 186 | kArtMethodDirty, |
Artem Udovichenko | a62cb9b | 2016-06-30 09:18:25 +0000 | [diff] [blame] | 187 | // IMT (clean) |
Vladimir Marko | d504c7e | 2017-12-04 15:56:51 +0000 | [diff] [blame] | 188 | kImTable, |
Mathieu Chartier | e42888f | 2016-04-14 10:49:19 -0700 | [diff] [blame] | 189 | // Conflict tables (clean). |
Vladimir Marko | d504c7e | 2017-12-04 15:56:51 +0000 | [diff] [blame] | 190 | kIMTConflictTable, |
Mathieu Chartier | e42888f | 2016-04-14 10:49:19 -0700 | [diff] [blame] | 191 | // Runtime methods (always clean, do not have a length prefix array). |
Vladimir Marko | d504c7e | 2017-12-04 15:56:51 +0000 | [diff] [blame] | 192 | kRuntimeMethod, |
Vladimir Marko | 05792b9 | 2015-08-03 11:56:49 +0100 | [diff] [blame] | 193 | // Dex cache arrays have a special slot for PC-relative addressing. Since they are |
| 194 | // huge, and as such their dirtiness is not important for the clean/dirty separation, |
| 195 | // we arbitrarily keep them at the end of the native data. |
Vladimir Marko | d504c7e | 2017-12-04 15:56:51 +0000 | [diff] [blame] | 196 | kDexCacheArray, // Arrays belonging to dex cache. |
| 197 | kLast = kDexCacheArray, |
Mathieu Chartier | c785344 | 2015-03-27 14:35:38 -0700 | [diff] [blame] | 198 | // Number of bins which are for mirror objects. |
Vladimir Marko | d504c7e | 2017-12-04 15:56:51 +0000 | [diff] [blame] | 199 | kMirrorCount = kArtField, |
Igor Murashkin | f5b4c50 | 2014-11-14 15:01:59 -0800 | [diff] [blame] | 200 | }; |
Igor Murashkin | f5b4c50 | 2014-11-14 15:01:59 -0800 | [diff] [blame] | 201 | friend std::ostream& operator<<(std::ostream& stream, const Bin& bin); |
| 202 | |
Vladimir Marko | d504c7e | 2017-12-04 15:56:51 +0000 | [diff] [blame] | 203 | enum class NativeObjectRelocationType { |
| 204 | kArtField, |
| 205 | kArtFieldArray, |
| 206 | kArtMethodClean, |
| 207 | kArtMethodArrayClean, |
| 208 | kArtMethodDirty, |
| 209 | kArtMethodArrayDirty, |
| 210 | kRuntimeMethod, |
| 211 | kIMTable, |
| 212 | kIMTConflictTable, |
| 213 | kDexCacheArray, |
Mathieu Chartier | 54d220e | 2015-07-30 16:20:06 -0700 | [diff] [blame] | 214 | }; |
| 215 | friend std::ostream& operator<<(std::ostream& stream, const NativeObjectRelocationType& type); |
| 216 | |
Vladimir Marko | d504c7e | 2017-12-04 15:56:51 +0000 | [diff] [blame] | 217 | enum class StubType { |
| 218 | kInterpreterToInterpreterBridge, |
| 219 | kInterpreterToCompiledCodeBridge, |
| 220 | kJNIDlsymLookup, |
| 221 | kQuickGenericJNITrampoline, |
| 222 | kQuickIMTConflictTrampoline, |
| 223 | kQuickResolutionTrampoline, |
| 224 | kQuickToInterpreterBridge, |
| 225 | kLast = kQuickToInterpreterBridge, |
Mathieu Chartier | da5b28a | 2015-11-05 08:03:47 -0800 | [diff] [blame] | 226 | }; |
Vladimir Marko | d504c7e | 2017-12-04 15:56:51 +0000 | [diff] [blame] | 227 | friend std::ostream& operator<<(std::ostream& stream, const StubType& stub_type); |
Mathieu Chartier | da5b28a | 2015-11-05 08:03:47 -0800 | [diff] [blame] | 228 | |
Vladimir Marko | d504c7e | 2017-12-04 15:56:51 +0000 | [diff] [blame] | 229 | static constexpr size_t kBinBits = |
| 230 | MinimumBitsToStore<uint32_t>(static_cast<size_t>(Bin::kMirrorCount) - 1); |
Igor Murashkin | f5b4c50 | 2014-11-14 15:01:59 -0800 | [diff] [blame] | 231 | // uint32 = typeof(lockword_) |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 232 | // Subtract read barrier bits since we want these to remain 0, or else it may result in DCHECK |
| 233 | // failures due to invalid read barrier bits during object field reads. |
Mathieu Chartier | 36a270a | 2016-07-28 18:08:51 -0700 | [diff] [blame] | 234 | static const size_t kBinShift = BitSizeOf<uint32_t>() - kBinBits - LockWord::kGCStateSize; |
Igor Murashkin | f5b4c50 | 2014-11-14 15:01:59 -0800 | [diff] [blame] | 235 | // 111000.....0 |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 236 | static const size_t kBinMask = ((static_cast<size_t>(1) << kBinBits) - 1) << kBinShift; |
Igor Murashkin | f5b4c50 | 2014-11-14 15:01:59 -0800 | [diff] [blame] | 237 | |
Vladimir Marko | d504c7e | 2017-12-04 15:56:51 +0000 | [diff] [blame] | 238 | // Number of bins, including non-mirror bins. |
| 239 | static constexpr size_t kNumberOfBins = static_cast<size_t>(Bin::kLast) + 1u; |
| 240 | |
| 241 | // Number of stub types. |
| 242 | static constexpr size_t kNumberOfStubTypes = static_cast<size_t>(StubType::kLast) + 1u; |
| 243 | |
Igor Murashkin | f5b4c50 | 2014-11-14 15:01:59 -0800 | [diff] [blame] | 244 | // We use the lock word to store the bin # and bin index of the object in the image. |
| 245 | // |
| 246 | // The struct size must be exactly sizeof(LockWord), currently 32-bits, since this will end up |
| 247 | // stored in the lock word bit-for-bit when object forwarding addresses are being calculated. |
| 248 | struct BinSlot { |
| 249 | explicit BinSlot(uint32_t lockword); |
| 250 | BinSlot(Bin bin, uint32_t index); |
| 251 | |
| 252 | // The bin an object belongs to, i.e. regular, class/verified, class/initialized, etc. |
| 253 | Bin GetBin() const; |
| 254 | // The offset in bytes from the beginning of the bin. Aligned to object size. |
| 255 | uint32_t GetIndex() const; |
| 256 | // Pack into a single uint32_t, for storing into a lock word. |
Mathieu Chartier | d39645e | 2015-06-09 17:50:29 -0700 | [diff] [blame] | 257 | uint32_t Uint32Value() const { return lockword_; } |
Igor Murashkin | f5b4c50 | 2014-11-14 15:01:59 -0800 | [diff] [blame] | 258 | // Comparison operator for map support |
| 259 | bool operator<(const BinSlot& other) const { return lockword_ < other.lockword_; } |
| 260 | |
Igor Murashkin | 2ffb703 | 2017-11-08 13:35:21 -0800 | [diff] [blame] | 261 | private: |
Igor Murashkin | f5b4c50 | 2014-11-14 15:01:59 -0800 | [diff] [blame] | 262 | // Must be the same size as LockWord, any larger and we would truncate the data. |
| 263 | const uint32_t lockword_; |
| 264 | }; |
| 265 | |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 266 | struct ImageInfo { |
Mathieu Chartier | ea0831f | 2015-12-29 13:17:37 -0800 | [diff] [blame] | 267 | ImageInfo(); |
| 268 | ImageInfo(ImageInfo&&) = default; |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 269 | |
Mathieu Chartier | a06ba05 | 2016-01-06 13:51:52 -0800 | [diff] [blame] | 270 | // Create the image sections into the out sections variable, returns the size of the image |
| 271 | // excluding the bitmap. |
Vladimir Marko | e47f60c | 2018-02-21 13:43:28 +0000 | [diff] [blame] | 272 | size_t CreateImageSections(ImageSection* out_sections) const; |
Mathieu Chartier | a06ba05 | 2016-01-06 13:51:52 -0800 | [diff] [blame] | 273 | |
Vladimir Marko | d504c7e | 2017-12-04 15:56:51 +0000 | [diff] [blame] | 274 | size_t GetStubOffset(StubType stub_type) const { |
| 275 | DCHECK_LT(static_cast<size_t>(stub_type), kNumberOfStubTypes); |
| 276 | return stub_offsets_[static_cast<size_t>(stub_type)]; |
| 277 | } |
| 278 | |
| 279 | void SetStubOffset(StubType stub_type, size_t offset) { |
| 280 | DCHECK_LT(static_cast<size_t>(stub_type), kNumberOfStubTypes); |
| 281 | stub_offsets_[static_cast<size_t>(stub_type)] = offset; |
| 282 | } |
| 283 | |
| 284 | size_t GetBinSlotOffset(Bin bin) const { |
| 285 | DCHECK_LT(static_cast<size_t>(bin), kNumberOfBins); |
| 286 | return bin_slot_offsets_[static_cast<size_t>(bin)]; |
| 287 | } |
| 288 | |
| 289 | void IncrementBinSlotSize(Bin bin, size_t size_to_add) { |
| 290 | DCHECK_LT(static_cast<size_t>(bin), kNumberOfBins); |
| 291 | bin_slot_sizes_[static_cast<size_t>(bin)] += size_to_add; |
| 292 | } |
| 293 | |
| 294 | size_t GetBinSlotSize(Bin bin) const { |
| 295 | DCHECK_LT(static_cast<size_t>(bin), kNumberOfBins); |
| 296 | return bin_slot_sizes_[static_cast<size_t>(bin)]; |
| 297 | } |
| 298 | |
| 299 | void IncrementBinSlotCount(Bin bin, size_t count_to_add) { |
| 300 | DCHECK_LT(static_cast<size_t>(bin), kNumberOfBins); |
| 301 | bin_slot_count_[static_cast<size_t>(bin)] += count_to_add; |
| 302 | } |
| 303 | |
| 304 | // Calculate the sum total of the bin slot sizes in [0, up_to). Defaults to all bins. |
| 305 | size_t GetBinSizeSum(Bin up_to) const; |
| 306 | |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 307 | std::unique_ptr<MemMap> image_; // Memory mapped for generating the image. |
| 308 | |
| 309 | // Target begin of this image. Notes: It is not valid to write here, this is the address |
| 310 | // of the target image, not necessarily where image_ is mapped. The address is only valid |
| 311 | // after layouting (otherwise null). |
Mathieu Chartier | ea0831f | 2015-12-29 13:17:37 -0800 | [diff] [blame] | 312 | uint8_t* image_begin_ = nullptr; |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 313 | |
Mathieu Chartier | ea0831f | 2015-12-29 13:17:37 -0800 | [diff] [blame] | 314 | // Offset to the free space in image_, initially size of image header. |
| 315 | size_t image_end_ = RoundUp(sizeof(ImageHeader), kObjectAlignment); |
| 316 | uint32_t image_roots_address_ = 0; // The image roots address in the image. |
| 317 | size_t image_offset_ = 0; // Offset of this image from the start of the first image. |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 318 | |
| 319 | // Image size is the *address space* covered by this image. As the live bitmap is aligned |
| 320 | // to the page size, the live bitmap will cover more address space than necessary. But live |
| 321 | // bitmaps may not overlap, so an image has a "shadow," which is accounted for in the size. |
| 322 | // The next image may only start at image_begin_ + image_size_ (which is guaranteed to be |
| 323 | // page-aligned). |
Mathieu Chartier | ea0831f | 2015-12-29 13:17:37 -0800 | [diff] [blame] | 324 | size_t image_size_ = 0; |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 325 | |
| 326 | // Oat data. |
Mathieu Chartier | ea0831f | 2015-12-29 13:17:37 -0800 | [diff] [blame] | 327 | // Offset of the oat file for this image from start of oat files. This is |
| 328 | // valid when the previous oat file has been written. |
| 329 | size_t oat_offset_ = 0; |
Vladimir Marko | 944da60 | 2016-02-19 12:27:55 +0000 | [diff] [blame] | 330 | // Layout of the loaded ELF file containing the oat file, valid after UpdateOatFileLayout(). |
| 331 | const uint8_t* oat_file_begin_ = nullptr; |
| 332 | size_t oat_loaded_size_ = 0; |
| 333 | const uint8_t* oat_data_begin_ = nullptr; |
Mathieu Chartier | ea0831f | 2015-12-29 13:17:37 -0800 | [diff] [blame] | 334 | size_t oat_size_ = 0; // Size of the corresponding oat data. |
Vladimir Marko | 944da60 | 2016-02-19 12:27:55 +0000 | [diff] [blame] | 335 | // The oat header checksum, valid after UpdateOatFileHeader(). |
| 336 | uint32_t oat_checksum_ = 0u; |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 337 | |
| 338 | // Image bitmap which lets us know where the objects inside of the image reside. |
| 339 | std::unique_ptr<gc::accounting::ContinuousSpaceBitmap> image_bitmap_; |
| 340 | |
| 341 | // The start offsets of the dex cache arrays. |
| 342 | SafeMap<const DexFile*, size_t> dex_cache_array_starts_; |
| 343 | |
| 344 | // Offset from oat_data_begin_ to the stubs. |
Vladimir Marko | d504c7e | 2017-12-04 15:56:51 +0000 | [diff] [blame] | 345 | uint32_t stub_offsets_[kNumberOfStubTypes] = {}; |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 346 | |
| 347 | // Bin slot tracking for dirty object packing. |
Vladimir Marko | d504c7e | 2017-12-04 15:56:51 +0000 | [diff] [blame] | 348 | size_t bin_slot_sizes_[kNumberOfBins] = {}; // Number of bytes in a bin. |
| 349 | size_t bin_slot_offsets_[kNumberOfBins] = {}; // Number of bytes in previous bins. |
| 350 | size_t bin_slot_count_[kNumberOfBins] = {}; // Number of objects in a bin. |
Mathieu Chartier | ea0831f | 2015-12-29 13:17:37 -0800 | [diff] [blame] | 351 | |
| 352 | // Cached size of the intern table for when we allocate memory. |
| 353 | size_t intern_table_bytes_ = 0; |
| 354 | |
Mathieu Chartier | 1f47b67 | 2016-01-07 16:29:01 -0800 | [diff] [blame] | 355 | // Number of image class table bytes. |
| 356 | size_t class_table_bytes_ = 0; |
| 357 | |
Mathieu Chartier | 8c19d24 | 2017-03-06 12:35:10 -0800 | [diff] [blame] | 358 | // Number of object fixup bytes. |
| 359 | size_t object_fixup_bytes_ = 0; |
| 360 | |
| 361 | // Number of pointer fixup bytes. |
| 362 | size_t pointer_fixup_bytes_ = 0; |
| 363 | |
Mathieu Chartier | 1f47b67 | 2016-01-07 16:29:01 -0800 | [diff] [blame] | 364 | // Intern table associated with this image for serialization. |
Mathieu Chartier | ea0831f | 2015-12-29 13:17:37 -0800 | [diff] [blame] | 365 | std::unique_ptr<InternTable> intern_table_; |
Mathieu Chartier | 1f47b67 | 2016-01-07 16:29:01 -0800 | [diff] [blame] | 366 | |
| 367 | // Class table associated with this image for serialization. |
| 368 | std::unique_ptr<ClassTable> class_table_; |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 369 | }; |
| 370 | |
Mathieu Chartier | 31e8925 | 2013-08-28 11:29:12 -0700 | [diff] [blame] | 371 | // We use the lock word to store the offset of the object in the image. |
Igor Murashkin | f5b4c50 | 2014-11-14 15:01:59 -0800 | [diff] [blame] | 372 | void AssignImageOffset(mirror::Object* object, BinSlot bin_slot) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 373 | REQUIRES_SHARED(Locks::mutator_lock_); |
Mathieu Chartier | d39645e | 2015-06-09 17:50:29 -0700 | [diff] [blame] | 374 | void SetImageOffset(mirror::Object* object, size_t offset) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 375 | REQUIRES_SHARED(Locks::mutator_lock_); |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 376 | bool IsImageOffsetAssigned(mirror::Object* object) const |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 377 | REQUIRES_SHARED(Locks::mutator_lock_); |
| 378 | size_t GetImageOffset(mirror::Object* object) const REQUIRES_SHARED(Locks::mutator_lock_); |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 379 | void UpdateImageOffset(mirror::Object* obj, uintptr_t offset) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 380 | REQUIRES_SHARED(Locks::mutator_lock_); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 381 | |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 382 | void PrepareDexCacheArraySlots() REQUIRES_SHARED(Locks::mutator_lock_); |
Mathieu Chartier | 496577f | 2016-09-20 15:33:31 -0700 | [diff] [blame] | 383 | void AssignImageBinSlot(mirror::Object* object, size_t oat_index) |
| 384 | REQUIRES_SHARED(Locks::mutator_lock_); |
| 385 | mirror::Object* TryAssignBinSlot(WorkStack& work_stack, mirror::Object* obj, size_t oat_index) |
| 386 | REQUIRES_SHARED(Locks::mutator_lock_); |
Igor Murashkin | f5b4c50 | 2014-11-14 15:01:59 -0800 | [diff] [blame] | 387 | void SetImageBinSlot(mirror::Object* object, BinSlot bin_slot) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 388 | REQUIRES_SHARED(Locks::mutator_lock_); |
Igor Murashkin | f5b4c50 | 2014-11-14 15:01:59 -0800 | [diff] [blame] | 389 | bool IsImageBinSlotAssigned(mirror::Object* object) const |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 390 | REQUIRES_SHARED(Locks::mutator_lock_); |
| 391 | BinSlot GetImageBinSlot(mirror::Object* object) const REQUIRES_SHARED(Locks::mutator_lock_); |
Igor Murashkin | f5b4c50 | 2014-11-14 15:01:59 -0800 | [diff] [blame] | 392 | |
Mathieu Chartier | c4f3925 | 2016-10-05 18:32:08 -0700 | [diff] [blame] | 393 | void AddDexCacheArrayRelocation(void* array, size_t offset, ObjPtr<mirror::DexCache> dex_cache) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 394 | REQUIRES_SHARED(Locks::mutator_lock_); |
| 395 | void AddMethodPointerArray(mirror::PointerArray* arr) REQUIRES_SHARED(Locks::mutator_lock_); |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 396 | |
Alex Light | a59dd80 | 2014-07-02 16:28:08 -0700 | [diff] [blame] | 397 | static void* GetImageAddressCallback(void* writer, mirror::Object* obj) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 398 | REQUIRES_SHARED(Locks::mutator_lock_) { |
Alex Light | a59dd80 | 2014-07-02 16:28:08 -0700 | [diff] [blame] | 399 | return reinterpret_cast<ImageWriter*>(writer)->GetImageAddress(obj); |
| 400 | } |
| 401 | |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 402 | mirror::Object* GetLocalAddress(mirror::Object* object) const |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 403 | REQUIRES_SHARED(Locks::mutator_lock_) { |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 404 | size_t offset = GetImageOffset(object); |
Vladimir Marko | 944da60 | 2016-02-19 12:27:55 +0000 | [diff] [blame] | 405 | size_t oat_index = GetOatIndex(object); |
| 406 | const ImageInfo& image_info = GetImageInfo(oat_index); |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 407 | uint8_t* dst = image_info.image_->Begin() + offset; |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 408 | return reinterpret_cast<mirror::Object*>(dst); |
| 409 | } |
| 410 | |
Mathieu Chartier | da5b28a | 2015-11-05 08:03:47 -0800 | [diff] [blame] | 411 | // Returns the address in the boot image if we are compiling the app image. |
Vladimir Marko | d504c7e | 2017-12-04 15:56:51 +0000 | [diff] [blame] | 412 | const uint8_t* GetOatAddress(StubType type) const; |
Mathieu Chartier | da5b28a | 2015-11-05 08:03:47 -0800 | [diff] [blame] | 413 | |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 414 | const uint8_t* GetOatAddressForOffset(uint32_t offset, const ImageInfo& image_info) const { |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 415 | // With Quick, code is within the OatFile, as there are all in one |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 416 | // .o ELF object. But interpret it as signed. |
| 417 | DCHECK_LE(static_cast<int32_t>(offset), static_cast<int32_t>(image_info.oat_size_)); |
| 418 | DCHECK(image_info.oat_data_begin_ != nullptr); |
| 419 | return offset == 0u ? nullptr : image_info.oat_data_begin_ + static_cast<int32_t>(offset); |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 420 | } |
| 421 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 422 | // Returns true if the class was in the original requested image classes list. |
Vladimir Marko | f25cc73 | 2017-03-16 16:18:15 +0000 | [diff] [blame] | 423 | bool KeepClass(ObjPtr<mirror::Class> klass) REQUIRES_SHARED(Locks::mutator_lock_); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 424 | |
| 425 | // Debug aid that list of requested image classes. |
| 426 | void DumpImageClasses(); |
| 427 | |
| 428 | // Preinitializes some otherwise lazy fields (such as Class name) to avoid runtime image dirtying. |
| 429 | void ComputeLazyFieldsForImageClasses() |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 430 | REQUIRES_SHARED(Locks::mutator_lock_); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 431 | |
Vladimir Marko | c5798bf | 2016-12-09 10:20:54 +0000 | [diff] [blame] | 432 | // Visit all class loaders. |
| 433 | void VisitClassLoaders(ClassLoaderVisitor* visitor) REQUIRES_SHARED(Locks::mutator_lock_); |
| 434 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 435 | // Remove unwanted classes from various roots. |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 436 | void PruneNonImageClasses() REQUIRES_SHARED(Locks::mutator_lock_); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 437 | |
Vladimir Marko | f25cc73 | 2017-03-16 16:18:15 +0000 | [diff] [blame] | 438 | // Remove unwanted classes from the DexCache roots and preload deterministic DexCache contents. |
| 439 | void PruneAndPreloadDexCache(ObjPtr<mirror::DexCache> dex_cache, |
| 440 | ObjPtr<mirror::ClassLoader> class_loader) |
| 441 | REQUIRES_SHARED(Locks::mutator_lock_) |
| 442 | REQUIRES(!Locks::classlinker_classes_lock_); |
| 443 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 444 | // Verify unwanted classes removed. |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 445 | void CheckNonImageClassesRemoved() REQUIRES_SHARED(Locks::mutator_lock_); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 446 | |
| 447 | // Lays out where the image objects will be at runtime. |
Vladimir Marko | f4da675 | 2014-08-01 19:04:18 +0100 | [diff] [blame] | 448 | void CalculateNewObjectOffsets() |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 449 | REQUIRES_SHARED(Locks::mutator_lock_); |
Mathieu Chartier | 496577f | 2016-09-20 15:33:31 -0700 | [diff] [blame] | 450 | void ProcessWorkStack(WorkStack* work_stack) |
| 451 | REQUIRES_SHARED(Locks::mutator_lock_); |
Vladimir Marko | 944da60 | 2016-02-19 12:27:55 +0000 | [diff] [blame] | 452 | void CreateHeader(size_t oat_index) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 453 | REQUIRES_SHARED(Locks::mutator_lock_); |
Vladimir Marko | f75613c | 2018-06-05 12:51:04 +0100 | [diff] [blame] | 454 | ObjPtr<mirror::ObjectArray<mirror::Object>> CollectDexCaches(Thread* self, size_t oat_index) const |
| 455 | REQUIRES_SHARED(Locks::mutator_lock_); |
Vladimir Marko | 944da60 | 2016-02-19 12:27:55 +0000 | [diff] [blame] | 456 | mirror::ObjectArray<mirror::Object>* CreateImageRoots(size_t oat_index) const |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 457 | REQUIRES_SHARED(Locks::mutator_lock_); |
Igor Murashkin | f5b4c50 | 2014-11-14 15:01:59 -0800 | [diff] [blame] | 458 | void CalculateObjectBinSlots(mirror::Object* obj) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 459 | REQUIRES_SHARED(Locks::mutator_lock_); |
Igor Murashkin | f5b4c50 | 2014-11-14 15:01:59 -0800 | [diff] [blame] | 460 | void UnbinObjectsIntoOffset(mirror::Object* obj) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 461 | REQUIRES_SHARED(Locks::mutator_lock_); |
Mathieu Chartier | 590fee9 | 2013-09-13 13:46:47 -0700 | [diff] [blame] | 462 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 463 | // Creates the contiguous image in memory and adjusts pointers. |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 464 | void CopyAndFixupNativeData(size_t oat_index) REQUIRES_SHARED(Locks::mutator_lock_); |
| 465 | void CopyAndFixupObjects() REQUIRES_SHARED(Locks::mutator_lock_); |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 466 | void CopyAndFixupObject(mirror::Object* obj) REQUIRES_SHARED(Locks::mutator_lock_); |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 467 | void CopyAndFixupMethod(ArtMethod* orig, ArtMethod* copy, const ImageInfo& image_info) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 468 | REQUIRES_SHARED(Locks::mutator_lock_); |
| 469 | void CopyAndFixupImTable(ImTable* orig, ImTable* copy) REQUIRES_SHARED(Locks::mutator_lock_); |
Mathieu Chartier | e42888f | 2016-04-14 10:49:19 -0700 | [diff] [blame] | 470 | void CopyAndFixupImtConflictTable(ImtConflictTable* orig, ImtConflictTable* copy) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 471 | REQUIRES_SHARED(Locks::mutator_lock_); |
Mathieu Chartier | c785344 | 2015-03-27 14:35:38 -0700 | [diff] [blame] | 472 | void FixupClass(mirror::Class* orig, mirror::Class* copy) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 473 | REQUIRES_SHARED(Locks::mutator_lock_); |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 474 | void FixupObject(mirror::Object* orig, mirror::Object* copy) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 475 | REQUIRES_SHARED(Locks::mutator_lock_); |
Vladimir Marko | 05792b9 | 2015-08-03 11:56:49 +0100 | [diff] [blame] | 476 | void FixupDexCache(mirror::DexCache* orig_dex_cache, mirror::DexCache* copy_dex_cache) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 477 | REQUIRES_SHARED(Locks::mutator_lock_); |
Mathieu Chartier | a808bac | 2015-11-05 16:33:15 -0800 | [diff] [blame] | 478 | void FixupPointerArray(mirror::Object* dst, |
| 479 | mirror::PointerArray* arr, |
| 480 | mirror::Class* klass, |
| 481 | Bin array_type) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 482 | REQUIRES_SHARED(Locks::mutator_lock_); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 483 | |
Mingyao Yang | 98d1cc8 | 2014-05-15 17:02:16 -0700 | [diff] [blame] | 484 | // Get quick code for non-resolution/imt_conflict/abstract method. |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 485 | const uint8_t* GetQuickCode(ArtMethod* method, |
| 486 | const ImageInfo& image_info, |
| 487 | bool* quick_is_interpreted) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 488 | REQUIRES_SHARED(Locks::mutator_lock_); |
Mingyao Yang | 98d1cc8 | 2014-05-15 17:02:16 -0700 | [diff] [blame] | 489 | |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 490 | // Return true if a method is likely to be dirtied at runtime. |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 491 | bool WillMethodBeDirty(ArtMethod* m) const REQUIRES_SHARED(Locks::mutator_lock_); |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 492 | |
| 493 | // Assign the offset for an ArtMethod. |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 494 | void AssignMethodOffset(ArtMethod* method, |
| 495 | NativeObjectRelocationType type, |
Vladimir Marko | 944da60 | 2016-02-19 12:27:55 +0000 | [diff] [blame] | 496 | size_t oat_index) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 497 | REQUIRES_SHARED(Locks::mutator_lock_); |
Mathieu Chartier | 54d220e | 2015-07-30 16:20:06 -0700 | [diff] [blame] | 498 | |
Mathieu Chartier | 8c19d24 | 2017-03-06 12:35:10 -0800 | [diff] [blame] | 499 | // Return true if imt was newly inserted. |
| 500 | bool TryAssignImTableOffset(ImTable* imt, size_t oat_index) REQUIRES_SHARED(Locks::mutator_lock_); |
Artem Udovichenko | a62cb9b | 2016-06-30 09:18:25 +0000 | [diff] [blame] | 501 | |
Mathieu Chartier | e42888f | 2016-04-14 10:49:19 -0700 | [diff] [blame] | 502 | // Assign the offset for an IMT conflict table. Does nothing if the table already has a native |
| 503 | // relocation. |
| 504 | void TryAssignConflictTableOffset(ImtConflictTable* table, size_t oat_index) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 505 | REQUIRES_SHARED(Locks::mutator_lock_); |
Mathieu Chartier | e42888f | 2016-04-14 10:49:19 -0700 | [diff] [blame] | 506 | |
Mathieu Chartier | a808bac | 2015-11-05 16:33:15 -0800 | [diff] [blame] | 507 | // Return true if klass is loaded by the boot class loader but not in the boot image. |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 508 | bool IsBootClassLoaderNonImageClass(mirror::Class* klass) REQUIRES_SHARED(Locks::mutator_lock_); |
Mathieu Chartier | da5b28a | 2015-11-05 08:03:47 -0800 | [diff] [blame] | 509 | |
Mathieu Chartier | 901e070 | 2016-02-19 13:42:48 -0800 | [diff] [blame] | 510 | // Return true if klass depends on a boot class loader non image class. We want to prune these |
| 511 | // classes since we do not want any boot class loader classes in the image. This means that |
Mathieu Chartier | a808bac | 2015-11-05 16:33:15 -0800 | [diff] [blame] | 512 | // we also cannot have any classes which refer to these boot class loader non image classes. |
Mathieu Chartier | 901e070 | 2016-02-19 13:42:48 -0800 | [diff] [blame] | 513 | // PruneAppImageClass also prunes if klass depends on a non-image class according to the compiler |
| 514 | // driver. |
Vladimir Marko | f25cc73 | 2017-03-16 16:18:15 +0000 | [diff] [blame] | 515 | bool PruneAppImageClass(ObjPtr<mirror::Class> klass) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 516 | REQUIRES_SHARED(Locks::mutator_lock_); |
Mathieu Chartier | da5b28a | 2015-11-05 08:03:47 -0800 | [diff] [blame] | 517 | |
Mathieu Chartier | 945c1c1 | 2015-11-24 15:37:12 -0800 | [diff] [blame] | 518 | // early_exit is true if we had a cyclic dependency anywhere down the chain. |
Vladimir Marko | f25cc73 | 2017-03-16 16:18:15 +0000 | [diff] [blame] | 519 | bool PruneAppImageClassInternal(ObjPtr<mirror::Class> klass, |
Mathieu Chartier | 901e070 | 2016-02-19 13:42:48 -0800 | [diff] [blame] | 520 | bool* early_exit, |
Chang Xing | b2e8adc | 2017-07-07 17:35:37 -0700 | [diff] [blame] | 521 | std::unordered_set<mirror::Object*>* visited) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 522 | REQUIRES_SHARED(Locks::mutator_lock_); |
Mathieu Chartier | 945c1c1 | 2015-11-24 15:37:12 -0800 | [diff] [blame] | 523 | |
Mathieu Chartier | 496577f | 2016-09-20 15:33:31 -0700 | [diff] [blame] | 524 | bool IsMultiImage() const { |
| 525 | return image_infos_.size() > 1; |
| 526 | } |
| 527 | |
Mathieu Chartier | 54d220e | 2015-07-30 16:20:06 -0700 | [diff] [blame] | 528 | static Bin BinTypeForNativeRelocationType(NativeObjectRelocationType type); |
| 529 | |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 530 | uintptr_t NativeOffsetInImage(void* obj) REQUIRES_SHARED(Locks::mutator_lock_); |
Vladimir Marko | 05792b9 | 2015-08-03 11:56:49 +0100 | [diff] [blame] | 531 | |
Mathieu Chartier | 4b00d34 | 2015-11-13 10:42:08 -0800 | [diff] [blame] | 532 | // Location of where the object will be when the image is loaded at runtime. |
Vladimir Marko | 05792b9 | 2015-08-03 11:56:49 +0100 | [diff] [blame] | 533 | template <typename T> |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 534 | T* NativeLocationInImage(T* obj) REQUIRES_SHARED(Locks::mutator_lock_); |
Andreas Gampe | 245ee00 | 2014-12-04 21:25:04 -0800 | [diff] [blame] | 535 | |
Mathieu Chartier | 4b00d34 | 2015-11-13 10:42:08 -0800 | [diff] [blame] | 536 | // Location of where the temporary copy of the object currently is. |
| 537 | template <typename T> |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 538 | T* NativeCopyLocation(T* obj, mirror::DexCache* dex_cache) REQUIRES_SHARED(Locks::mutator_lock_); |
Mathieu Chartier | 4b00d34 | 2015-11-13 10:42:08 -0800 | [diff] [blame] | 539 | |
Mathieu Chartier | da5b28a | 2015-11-05 08:03:47 -0800 | [diff] [blame] | 540 | // Return true of obj is inside of the boot image space. This may only return true if we are |
| 541 | // compiling an app image. |
| 542 | bool IsInBootImage(const void* obj) const; |
| 543 | |
| 544 | // Return true if ptr is within the boot oat file. |
| 545 | bool IsInBootOatFile(const void* ptr) const; |
| 546 | |
Vladimir Marko | 944da60 | 2016-02-19 12:27:55 +0000 | [diff] [blame] | 547 | // Get the index of the oat file associated with the object. |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 548 | size_t GetOatIndex(mirror::Object* object) const REQUIRES_SHARED(Locks::mutator_lock_); |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 549 | |
Vladimir Marko | 944da60 | 2016-02-19 12:27:55 +0000 | [diff] [blame] | 550 | // The oat index for shared data in multi-image and all data in single-image compilation. |
| 551 | size_t GetDefaultOatIndex() const { |
| 552 | return 0u; |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 553 | } |
| 554 | |
Vladimir Marko | 944da60 | 2016-02-19 12:27:55 +0000 | [diff] [blame] | 555 | ImageInfo& GetImageInfo(size_t oat_index) { |
| 556 | return image_infos_[oat_index]; |
| 557 | } |
| 558 | |
| 559 | const ImageInfo& GetImageInfo(size_t oat_index) const { |
| 560 | return image_infos_[oat_index]; |
| 561 | } |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 562 | |
Mathieu Chartier | fbc3108 | 2016-01-24 11:59:56 -0800 | [diff] [blame] | 563 | // Find an already strong interned string in the other images or in the boot image. Used to |
| 564 | // remove duplicates in the multi image and app image case. |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 565 | mirror::String* FindInternedString(mirror::String* string) REQUIRES_SHARED(Locks::mutator_lock_); |
Mathieu Chartier | fbc3108 | 2016-01-24 11:59:56 -0800 | [diff] [blame] | 566 | |
Mathieu Chartier | e42888f | 2016-04-14 10:49:19 -0700 | [diff] [blame] | 567 | // Return true if there already exists a native allocation for an object. |
| 568 | bool NativeRelocationAssigned(void* ptr) const; |
| 569 | |
Mathieu Chartier | 8c19d24 | 2017-03-06 12:35:10 -0800 | [diff] [blame] | 570 | void CopyReference(mirror::HeapReference<mirror::Object>* dest, ObjPtr<mirror::Object> src) |
| 571 | REQUIRES_SHARED(Locks::mutator_lock_); |
| 572 | |
| 573 | void CopyReference(mirror::CompressedReference<mirror::Object>* dest, ObjPtr<mirror::Object> src) |
| 574 | REQUIRES_SHARED(Locks::mutator_lock_); |
| 575 | |
| 576 | void CopyAndFixupPointer(void** target, void* value); |
| 577 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 578 | const CompilerDriver& compiler_driver_; |
| 579 | |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 580 | // Beginning target image address for the first image. |
| 581 | uint8_t* global_image_begin_; |
Vladimir Marko | f4da675 | 2014-08-01 19:04:18 +0100 | [diff] [blame] | 582 | |
Igor Murashkin | f5b4c50 | 2014-11-14 15:01:59 -0800 | [diff] [blame] | 583 | // Offset from image_begin_ to where the first object is in image_. |
| 584 | size_t image_objects_offset_begin_; |
| 585 | |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 586 | // Pointer arrays that need to be updated. Since these are only some int and long arrays, we need |
| 587 | // to keep track. These include vtable arrays, iftable arrays, and dex caches. |
| 588 | std::unordered_map<mirror::PointerArray*, Bin> pointer_arrays_; |
| 589 | |
Mathieu Chartier | d39645e | 2015-06-09 17:50:29 -0700 | [diff] [blame] | 590 | // Saved hash codes. We use these to restore lockwords which were temporarily used to have |
| 591 | // forwarding addresses as well as copying over hash codes. |
| 592 | std::unordered_map<mirror::Object*, uint32_t> saved_hashcode_map_; |
Igor Murashkin | f5b4c50 | 2014-11-14 15:01:59 -0800 | [diff] [blame] | 593 | |
Mathieu Chartier | 496577f | 2016-09-20 15:33:31 -0700 | [diff] [blame] | 594 | // Oat index map for objects. |
| 595 | std::unordered_map<mirror::Object*, uint32_t> oat_index_map_; |
| 596 | |
Mathieu Chartier | da5b28a | 2015-11-05 08:03:47 -0800 | [diff] [blame] | 597 | // Boolean flags. |
Igor Murashkin | 4677476 | 2014-10-22 11:37:02 -0700 | [diff] [blame] | 598 | const bool compile_pic_; |
Mathieu Chartier | da5b28a | 2015-11-05 08:03:47 -0800 | [diff] [blame] | 599 | const bool compile_app_image_; |
| 600 | |
Mathieu Chartier | 2d72101 | 2014-11-10 11:08:06 -0800 | [diff] [blame] | 601 | // Size of pointers on the target architecture. |
Andreas Gampe | 542451c | 2016-07-26 09:02:02 -0700 | [diff] [blame] | 602 | PointerSize target_ptr_size_; |
Mathieu Chartier | 2d72101 | 2014-11-10 11:08:06 -0800 | [diff] [blame] | 603 | |
Vladimir Marko | 944da60 | 2016-02-19 12:27:55 +0000 | [diff] [blame] | 604 | // Image data indexed by the oat file index. |
| 605 | dchecked_vector<ImageInfo> image_infos_; |
Igor Murashkin | f5b4c50 | 2014-11-14 15:01:59 -0800 | [diff] [blame] | 606 | |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 607 | // ArtField, ArtMethod relocating map. These are allocated as array of structs but we want to |
| 608 | // have one entry per art field for convenience. ArtFields are placed right after the end of the |
| 609 | // image objects (aka sum of bin_slot_sizes_). ArtMethods are placed right after the ArtFields. |
Mathieu Chartier | 54d220e | 2015-07-30 16:20:06 -0700 | [diff] [blame] | 610 | struct NativeObjectRelocation { |
Vladimir Marko | 944da60 | 2016-02-19 12:27:55 +0000 | [diff] [blame] | 611 | size_t oat_index; |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 612 | uintptr_t offset; |
Mathieu Chartier | 54d220e | 2015-07-30 16:20:06 -0700 | [diff] [blame] | 613 | NativeObjectRelocationType type; |
| 614 | |
| 615 | bool IsArtMethodRelocation() const { |
Vladimir Marko | d504c7e | 2017-12-04 15:56:51 +0000 | [diff] [blame] | 616 | return type == NativeObjectRelocationType::kArtMethodClean || |
| 617 | type == NativeObjectRelocationType::kArtMethodDirty || |
| 618 | type == NativeObjectRelocationType::kRuntimeMethod; |
Mathieu Chartier | 54d220e | 2015-07-30 16:20:06 -0700 | [diff] [blame] | 619 | } |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 620 | }; |
Mathieu Chartier | 54d220e | 2015-07-30 16:20:06 -0700 | [diff] [blame] | 621 | std::unordered_map<void*, NativeObjectRelocation> native_object_relocations_; |
Mathieu Chartier | c785344 | 2015-03-27 14:35:38 -0700 | [diff] [blame] | 622 | |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 623 | // Runtime ArtMethods which aren't reachable from any Class but need to be copied into the image. |
| 624 | ArtMethod* image_methods_[ImageHeader::kImageMethodsCount]; |
| 625 | |
| 626 | // Counters for measurements, used for logging only. |
| 627 | uint64_t dirty_methods_; |
| 628 | uint64_t clean_methods_; |
Andreas Gampe | 245ee00 | 2014-12-04 21:25:04 -0800 | [diff] [blame] | 629 | |
Mathieu Chartier | a808bac | 2015-11-05 16:33:15 -0800 | [diff] [blame] | 630 | // Prune class memoization table to speed up ContainsBootClassLoaderNonImageClass. |
Mathieu Chartier | da5b28a | 2015-11-05 08:03:47 -0800 | [diff] [blame] | 631 | std::unordered_map<mirror::Class*, bool> prune_class_memo_; |
| 632 | |
Mathieu Chartier | 67ad20e | 2015-12-09 15:41:09 -0800 | [diff] [blame] | 633 | // Class loaders with a class table to write out. There should only be one class loader because |
| 634 | // dex2oat loads the dex files to be compiled into a single class loader. For the boot image, |
| 635 | // null is a valid entry. |
Mathieu Chartier | 208a5cb | 2015-12-02 15:44:07 -0800 | [diff] [blame] | 636 | std::unordered_set<mirror::ClassLoader*> class_loaders_; |
| 637 | |
Mathieu Chartier | ceb07b3 | 2015-12-10 09:33:21 -0800 | [diff] [blame] | 638 | // Which mode the image is stored as, see image.h |
| 639 | const ImageHeader::StorageMode image_storage_mode_; |
| 640 | |
Vladimir Marko | 944da60 | 2016-02-19 12:27:55 +0000 | [diff] [blame] | 641 | // The file names of oat files. |
| 642 | const std::vector<const char*>& oat_filenames_; |
| 643 | |
| 644 | // Map of dex files to the indexes of oat files that they were compiled into. |
| 645 | const std::unordered_map<const DexFile*, size_t>& dex_file_oat_index_map_; |
Jeff Hao | dcdc85b | 2015-12-04 14:06:18 -0800 | [diff] [blame] | 646 | |
Jeff Hao | c23b0c0 | 2017-07-27 18:19:38 -0700 | [diff] [blame] | 647 | // Set of objects known to be dirty in the image. Can be nullptr if there are none. |
Vladimir Marko | 54159c6 | 2018-06-20 14:30:08 +0100 | [diff] [blame^] | 648 | const HashSet<std::string>* dirty_image_objects_; |
Jeff Hao | c23b0c0 | 2017-07-27 18:19:38 -0700 | [diff] [blame] | 649 | |
Vladimir Marko | ad06b98 | 2016-11-17 16:38:59 +0000 | [diff] [blame] | 650 | class ComputeLazyFieldsForClassesVisitor; |
| 651 | class FixupClassVisitor; |
| 652 | class FixupRootVisitor; |
| 653 | class FixupVisitor; |
Mathieu Chartier | 496577f | 2016-09-20 15:33:31 -0700 | [diff] [blame] | 654 | class GetRootsVisitor; |
Mathieu Chartier | 8c19d24 | 2017-03-06 12:35:10 -0800 | [diff] [blame] | 655 | class ImageAddressVisitorForDexCacheArray; |
Vladimir Marko | ad06b98 | 2016-11-17 16:38:59 +0000 | [diff] [blame] | 656 | class NativeLocationVisitor; |
Vladimir Marko | c5798bf | 2016-12-09 10:20:54 +0000 | [diff] [blame] | 657 | class PruneClassesVisitor; |
| 658 | class PruneClassLoaderClassesVisitor; |
Mathieu Chartier | 8c19d24 | 2017-03-06 12:35:10 -0800 | [diff] [blame] | 659 | class RegisterBootClassPathClassesVisitor; |
Mathieu Chartier | 496577f | 2016-09-20 15:33:31 -0700 | [diff] [blame] | 660 | class VisitReferencesVisitor; |
Chang Xing | b2e8adc | 2017-07-07 17:35:37 -0700 | [diff] [blame] | 661 | class PruneObjectReferenceVisitor; |
Vladimir Marko | ad06b98 | 2016-11-17 16:38:59 +0000 | [diff] [blame] | 662 | |
Mathieu Chartier | b7ea3ac | 2014-03-24 16:54:46 -0700 | [diff] [blame] | 663 | DISALLOW_COPY_AND_ASSIGN(ImageWriter); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 664 | }; |
| 665 | |
Vladimir Marko | 7452797 | 2016-11-29 15:57:32 +0000 | [diff] [blame] | 666 | } // namespace linker |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 667 | } // namespace art |
| 668 | |
Vladimir Marko | 7452797 | 2016-11-29 15:57:32 +0000 | [diff] [blame] | 669 | #endif // ART_DEX2OAT_LINKER_IMAGE_WRITER_H_ |