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 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 17 | #ifndef ART_COMPILER_OAT_WRITER_H_ |
| 18 | #define ART_COMPILER_OAT_WRITER_H_ |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 19 | |
| 20 | #include <stdint.h> |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 21 | #include <cstddef> |
Ian Rogers | 700a402 | 2014-05-19 16:49:03 -0700 | [diff] [blame] | 22 | #include <memory> |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 23 | |
Vladimir Marko | 49b0f45 | 2015-12-10 13:49:19 +0000 | [diff] [blame] | 24 | #include "base/dchecked_vector.h" |
Vladimir Marko | b163bb7 | 2015-03-31 21:49:49 +0100 | [diff] [blame] | 25 | #include "linker/relative_patcher.h" // For linker::RelativePatcherTargetProvider. |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 26 | #include "mem_map.h" |
Vladimir Marko | f4da675 | 2014-08-01 19:04:18 +0100 | [diff] [blame] | 27 | #include "method_reference.h" |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 28 | #include "mirror/class.h" |
Artem Udovichenko | d9786b0 | 2015-10-14 16:36:55 +0300 | [diff] [blame] | 29 | #include "oat.h" |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 30 | #include "safe_map.h" |
Vladimir Marko | 49b0f45 | 2015-12-10 13:49:19 +0000 | [diff] [blame] | 31 | #include "utils/array_ref.h" |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 32 | |
| 33 | namespace art { |
| 34 | |
Brian Carlstrom | ba150c3 | 2013-08-27 17:31:03 -0700 | [diff] [blame] | 35 | class BitVector; |
Andreas Gampe | 7927380 | 2014-08-05 20:21:05 -0700 | [diff] [blame] | 36 | class CompiledMethod; |
Vladimir Marko | 20f8559 | 2015-03-19 10:07:02 +0000 | [diff] [blame] | 37 | class CompilerDriver; |
Vladimir Marko | f4da675 | 2014-08-01 19:04:18 +0100 | [diff] [blame] | 38 | class ImageWriter; |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 39 | class OutputStream; |
Vladimir Marko | 20f8559 | 2015-03-19 10:07:02 +0000 | [diff] [blame] | 40 | class TimingLogger; |
Artem Udovichenko | d9786b0 | 2015-10-14 16:36:55 +0300 | [diff] [blame] | 41 | class TypeLookupTable; |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 42 | |
Vladimir Marko | 10c1356 | 2015-11-25 14:33:36 +0000 | [diff] [blame] | 43 | namespace dwarf { |
| 44 | struct MethodDebugInfo; |
| 45 | } // namespace dwarf |
| 46 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 47 | // OatHeader variable length with count of D OatDexFiles |
| 48 | // |
| 49 | // OatDexFile[0] one variable sized OatDexFile with offsets to Dex and OatClasses |
| 50 | // OatDexFile[1] |
| 51 | // ... |
| 52 | // OatDexFile[D] |
| 53 | // |
| 54 | // Dex[0] one variable sized DexFile for each OatDexFile. |
| 55 | // Dex[1] these are literal copies of the input .dex files. |
| 56 | // ... |
| 57 | // Dex[D] |
| 58 | // |
Artem Udovichenko | d9786b0 | 2015-10-14 16:36:55 +0300 | [diff] [blame] | 59 | // TypeLookupTable[0] one descriptor to class def index hash table for each OatDexFile. |
| 60 | // TypeLookupTable[1] |
| 61 | // ... |
| 62 | // TypeLookupTable[D] |
| 63 | // |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 64 | // OatClass[0] one variable sized OatClass for each of C DexFile::ClassDefs |
| 65 | // OatClass[1] contains OatClass entries with class status, offsets to code, etc. |
| 66 | // ... |
| 67 | // OatClass[C] |
| 68 | // |
Vladimir Marko | 96c6ab9 | 2014-04-08 14:00:50 +0100 | [diff] [blame] | 69 | // GcMap one variable sized blob with GC map. |
| 70 | // GcMap GC maps are deduplicated. |
| 71 | // ... |
| 72 | // GcMap |
| 73 | // |
| 74 | // VmapTable one variable sized VmapTable blob (quick compiler only). |
| 75 | // VmapTable VmapTables are deduplicated. |
| 76 | // ... |
| 77 | // VmapTable |
| 78 | // |
| 79 | // MappingTable one variable sized blob with MappingTable (quick compiler only). |
| 80 | // MappingTable MappingTables are deduplicated. |
| 81 | // ... |
| 82 | // MappingTable |
| 83 | // |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 84 | // padding if necessary so that the following code will be page aligned |
| 85 | // |
Vladimir Marko | 96c6ab9 | 2014-04-08 14:00:50 +0100 | [diff] [blame] | 86 | // OatMethodHeader fixed size header for a CompiledMethod including the size of the MethodCode. |
| 87 | // MethodCode one variable sized blob with the code of a CompiledMethod. |
| 88 | // OatMethodHeader (OatMethodHeader, MethodCode) pairs are deduplicated. |
| 89 | // MethodCode |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 90 | // ... |
Vladimir Marko | 96c6ab9 | 2014-04-08 14:00:50 +0100 | [diff] [blame] | 91 | // OatMethodHeader |
| 92 | // MethodCode |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 93 | // |
| 94 | class OatWriter { |
| 95 | public: |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 96 | OatWriter(const std::vector<const DexFile*>& dex_files, |
| 97 | uint32_t image_file_location_oat_checksum, |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 98 | uintptr_t image_file_location_oat_begin, |
Alex Light | a59dd80 | 2014-07-02 16:28:08 -0700 | [diff] [blame] | 99 | int32_t image_patch_delta, |
Ian Rogers | ca368cb | 2013-11-15 15:52:08 -0800 | [diff] [blame] | 100 | const CompilerDriver* compiler, |
Vladimir Marko | f4da675 | 2014-08-01 19:04:18 +0100 | [diff] [blame] | 101 | ImageWriter* image_writer, |
Mathieu Chartier | da5b28a | 2015-11-05 08:03:47 -0800 | [diff] [blame] | 102 | bool compiling_boot_image, |
Andreas Gampe | 22f8e5c | 2014-07-09 11:38:21 -0700 | [diff] [blame] | 103 | TimingLogger* timings, |
| 104 | SafeMap<std::string, std::string>* key_value_store); |
Brian Carlstrom | c50d8e1 | 2013-07-23 22:35:16 -0700 | [diff] [blame] | 105 | |
Vladimir Marko | 09d0943 | 2015-09-08 13:47:48 +0100 | [diff] [blame] | 106 | // Returns whether the oat file has an associated image. |
| 107 | bool HasImage() const { |
| 108 | // Since the image is being created at the same time as the oat file, |
| 109 | // check if there's an image writer. |
| 110 | return image_writer_ != nullptr; |
| 111 | } |
| 112 | |
Mathieu Chartier | da5b28a | 2015-11-05 08:03:47 -0800 | [diff] [blame] | 113 | bool HasBootImage() const { |
| 114 | return compiling_boot_image_; |
| 115 | } |
| 116 | |
Brian Carlstrom | c50d8e1 | 2013-07-23 22:35:16 -0700 | [diff] [blame] | 117 | const OatHeader& GetOatHeader() const { |
| 118 | return *oat_header_; |
| 119 | } |
| 120 | |
| 121 | size_t GetSize() const { |
| 122 | return size_; |
| 123 | } |
| 124 | |
Vladimir Marko | 5c42c29 | 2015-02-25 12:02:49 +0000 | [diff] [blame] | 125 | size_t GetBssSize() const { |
| 126 | return bss_size_; |
| 127 | } |
| 128 | |
Vladimir Marko | 49b0f45 | 2015-12-10 13:49:19 +0000 | [diff] [blame] | 129 | ArrayRef<const uintptr_t> GetAbsolutePatchLocations() const { |
| 130 | return ArrayRef<const uintptr_t>(absolute_patch_locations_); |
Vladimir Marko | f4da675 | 2014-08-01 19:04:18 +0100 | [diff] [blame] | 131 | } |
| 132 | |
David Srbecky | bc90fd0 | 2015-04-22 19:40:27 +0100 | [diff] [blame] | 133 | bool WriteRodata(OutputStream* out); |
| 134 | bool WriteCode(OutputStream* out); |
Brian Carlstrom | c50d8e1 | 2013-07-23 22:35:16 -0700 | [diff] [blame] | 135 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 136 | ~OatWriter(); |
| 137 | |
Vladimir Marko | 49b0f45 | 2015-12-10 13:49:19 +0000 | [diff] [blame] | 138 | ArrayRef<const dwarf::MethodDebugInfo> GetMethodDebugInfo() const { |
| 139 | return ArrayRef<const dwarf::MethodDebugInfo>(method_info_); |
Mark Mendell | ae9fd93 | 2014-02-10 16:14:35 -0800 | [diff] [blame] | 140 | } |
| 141 | |
Vladimir Marko | b163bb7 | 2015-03-31 21:49:49 +0100 | [diff] [blame] | 142 | const CompilerDriver* GetCompilerDriver() { |
| 143 | return compiler_driver_; |
| 144 | } |
| 145 | |
Brian Carlstrom | c50d8e1 | 2013-07-23 22:35:16 -0700 | [diff] [blame] | 146 | private: |
Vladimir Marko | 49b0f45 | 2015-12-10 13:49:19 +0000 | [diff] [blame] | 147 | class OatClass; |
| 148 | class OatDexFile; |
| 149 | |
Vladimir Marko | 96c6ab9 | 2014-04-08 14:00:50 +0100 | [diff] [blame] | 150 | // The DataAccess classes are helper classes that provide access to members related to |
| 151 | // a given map, i.e. GC map, mapping table or vmap table. By abstracting these away |
| 152 | // we can share a lot of code for processing the maps with template classes below. |
| 153 | struct GcMapDataAccess; |
| 154 | struct MappingTableDataAccess; |
| 155 | struct VmapTableDataAccess; |
| 156 | |
| 157 | // The function VisitDexMethods() below iterates through all the methods in all |
| 158 | // the compiled dex files in order of their definitions. The method visitor |
| 159 | // classes provide individual bits of processing for each of the passes we need to |
| 160 | // first collect the data we want to write to the oat file and then, in later passes, |
| 161 | // to actually write it. |
| 162 | class DexMethodVisitor; |
| 163 | class OatDexMethodVisitor; |
| 164 | class InitOatClassesMethodVisitor; |
| 165 | class InitCodeMethodVisitor; |
| 166 | template <typename DataAccess> |
| 167 | class InitMapMethodVisitor; |
| 168 | class InitImageMethodVisitor; |
| 169 | class WriteCodeMethodVisitor; |
| 170 | template <typename DataAccess> |
| 171 | class WriteMapMethodVisitor; |
| 172 | |
| 173 | // Visit all the methods in all the compiled dex files in their definition order |
| 174 | // with a given DexMethodVisitor. |
| 175 | bool VisitDexMethods(DexMethodVisitor* visitor); |
| 176 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 177 | size_t InitOatHeader(); |
| 178 | size_t InitOatDexFiles(size_t offset); |
Artem Udovichenko | d9786b0 | 2015-10-14 16:36:55 +0300 | [diff] [blame] | 179 | size_t InitLookupTables(size_t offset); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 180 | size_t InitDexFiles(size_t offset); |
| 181 | size_t InitOatClasses(size_t offset); |
Vladimir Marko | 96c6ab9 | 2014-04-08 14:00:50 +0100 | [diff] [blame] | 182 | size_t InitOatMaps(size_t offset); |
Vladimir Marko | 49b0f45 | 2015-12-10 13:49:19 +0000 | [diff] [blame] | 183 | size_t InitOatCode(size_t offset); |
| 184 | size_t InitOatCodeDexFiles(size_t offset); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 185 | |
Ian Rogers | 3d50407 | 2014-03-01 09:16:49 -0800 | [diff] [blame] | 186 | bool WriteTables(OutputStream* out, const size_t file_offset); |
Artem Udovichenko | d9786b0 | 2015-10-14 16:36:55 +0300 | [diff] [blame] | 187 | bool WriteLookupTables(OutputStream* out, const size_t file_offset); |
Vladimir Marko | 96c6ab9 | 2014-04-08 14:00:50 +0100 | [diff] [blame] | 188 | size_t WriteMaps(OutputStream* out, const size_t file_offset, size_t relative_offset); |
| 189 | size_t WriteCode(OutputStream* out, const size_t file_offset, size_t relative_offset); |
Ian Rogers | 3d50407 | 2014-03-01 09:16:49 -0800 | [diff] [blame] | 190 | size_t WriteCodeDexFiles(OutputStream* out, const size_t file_offset, size_t relative_offset); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 191 | |
Vladimir Marko | 49b0f45 | 2015-12-10 13:49:19 +0000 | [diff] [blame] | 192 | bool GetOatDataOffset(OutputStream* out); |
Vladimir Marko | f4da675 | 2014-08-01 19:04:18 +0100 | [diff] [blame] | 193 | bool WriteCodeAlignment(OutputStream* out, uint32_t aligned_code_delta); |
Vladimir Marko | 49b0f45 | 2015-12-10 13:49:19 +0000 | [diff] [blame] | 194 | bool WriteData(OutputStream* out, const void* data, size_t size); |
Vladimir Marko | f4da675 | 2014-08-01 19:04:18 +0100 | [diff] [blame] | 195 | |
Vladimir Marko | 49b0f45 | 2015-12-10 13:49:19 +0000 | [diff] [blame] | 196 | dchecked_vector<dwarf::MethodDebugInfo> method_info_; |
Mark Mendell | ae9fd93 | 2014-02-10 16:14:35 -0800 | [diff] [blame] | 197 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 198 | const CompilerDriver* const compiler_driver_; |
Vladimir Marko | f4da675 | 2014-08-01 19:04:18 +0100 | [diff] [blame] | 199 | ImageWriter* const image_writer_; |
Mathieu Chartier | da5b28a | 2015-11-05 08:03:47 -0800 | [diff] [blame] | 200 | const bool compiling_boot_image_; |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 201 | |
| 202 | // note OatFile does not take ownership of the DexFiles |
| 203 | const std::vector<const DexFile*>* dex_files_; |
| 204 | |
Brian Carlstrom | c50d8e1 | 2013-07-23 22:35:16 -0700 | [diff] [blame] | 205 | // Size required for Oat data structures. |
| 206 | size_t size_; |
| 207 | |
Vladimir Marko | 5c42c29 | 2015-02-25 12:02:49 +0000 | [diff] [blame] | 208 | // The size of the required .bss section holding the DexCache data. |
| 209 | size_t bss_size_; |
| 210 | |
Vladimir Marko | 09d0943 | 2015-09-08 13:47:48 +0100 | [diff] [blame] | 211 | // Offsets of the dex cache arrays for each app dex file. For the |
| 212 | // boot image, this information is provided by the ImageWriter. |
Vladimir Marko | 06d7aaa | 2015-10-16 11:23:41 +0100 | [diff] [blame] | 213 | SafeMap<const DexFile*, size_t> dex_cache_arrays_offsets_; // DexFiles not owned. |
Vladimir Marko | 09d0943 | 2015-09-08 13:47:48 +0100 | [diff] [blame] | 214 | |
Vladimir Marko | f4da675 | 2014-08-01 19:04:18 +0100 | [diff] [blame] | 215 | // Offset of the oat data from the start of the mmapped region of the elf file. |
| 216 | size_t oat_data_offset_; |
| 217 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 218 | // dependencies on the image. |
| 219 | uint32_t image_file_location_oat_checksum_; |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 220 | uintptr_t image_file_location_oat_begin_; |
Alex Light | a59dd80 | 2014-07-02 16:28:08 -0700 | [diff] [blame] | 221 | int32_t image_patch_delta_; |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 222 | |
| 223 | // data to write |
Andreas Gampe | 22f8e5c | 2014-07-09 11:38:21 -0700 | [diff] [blame] | 224 | SafeMap<std::string, std::string>* key_value_store_; |
Vladimir Marko | 49b0f45 | 2015-12-10 13:49:19 +0000 | [diff] [blame] | 225 | std::unique_ptr<OatHeader> oat_header_; |
| 226 | dchecked_vector<OatDexFile> oat_dex_files_; |
| 227 | dchecked_vector<OatClass> oat_classes_; |
Ian Rogers | 700a402 | 2014-05-19 16:49:03 -0700 | [diff] [blame] | 228 | std::unique_ptr<const std::vector<uint8_t>> jni_dlsym_lookup_; |
Ian Rogers | 700a402 | 2014-05-19 16:49:03 -0700 | [diff] [blame] | 229 | std::unique_ptr<const std::vector<uint8_t>> quick_generic_jni_trampoline_; |
| 230 | std::unique_ptr<const std::vector<uint8_t>> quick_imt_conflict_trampoline_; |
| 231 | std::unique_ptr<const std::vector<uint8_t>> quick_resolution_trampoline_; |
| 232 | std::unique_ptr<const std::vector<uint8_t>> quick_to_interpreter_bridge_; |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 233 | |
| 234 | // output stats |
| 235 | uint32_t size_dex_file_alignment_; |
| 236 | uint32_t size_executable_offset_alignment_; |
| 237 | uint32_t size_oat_header_; |
Andreas Gampe | 22f8e5c | 2014-07-09 11:38:21 -0700 | [diff] [blame] | 238 | uint32_t size_oat_header_key_value_store_; |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 239 | uint32_t size_dex_file_; |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 240 | uint32_t size_interpreter_to_interpreter_bridge_; |
| 241 | uint32_t size_interpreter_to_compiled_code_bridge_; |
| 242 | uint32_t size_jni_dlsym_lookup_; |
Andreas Gampe | 2da8823 | 2014-02-27 12:26:20 -0800 | [diff] [blame] | 243 | uint32_t size_quick_generic_jni_trampoline_; |
Jeff Hao | 88474b4 | 2013-10-23 16:24:40 -0700 | [diff] [blame] | 244 | uint32_t size_quick_imt_conflict_trampoline_; |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 245 | uint32_t size_quick_resolution_trampoline_; |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 246 | uint32_t size_quick_to_interpreter_bridge_; |
| 247 | uint32_t size_trampoline_alignment_; |
Vladimir Marko | 96c6ab9 | 2014-04-08 14:00:50 +0100 | [diff] [blame] | 248 | uint32_t size_method_header_; |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 249 | uint32_t size_code_; |
| 250 | uint32_t size_code_alignment_; |
Vladimir Marko | f4da675 | 2014-08-01 19:04:18 +0100 | [diff] [blame] | 251 | uint32_t size_relative_call_thunks_; |
Vladimir Marko | c74658b | 2015-03-31 10:26:41 +0100 | [diff] [blame] | 252 | uint32_t size_misc_thunks_; |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 253 | uint32_t size_mapping_table_; |
| 254 | uint32_t size_vmap_table_; |
| 255 | uint32_t size_gc_map_; |
| 256 | uint32_t size_oat_dex_file_location_size_; |
| 257 | uint32_t size_oat_dex_file_location_data_; |
| 258 | uint32_t size_oat_dex_file_location_checksum_; |
| 259 | uint32_t size_oat_dex_file_offset_; |
Vladimir Marko | 49b0f45 | 2015-12-10 13:49:19 +0000 | [diff] [blame] | 260 | uint32_t size_oat_dex_file_lookup_table_offset_; |
| 261 | uint32_t size_oat_dex_file_class_offsets_; |
| 262 | uint32_t size_oat_lookup_table_alignment_; |
| 263 | uint32_t size_oat_lookup_table_; |
Brian Carlstrom | ba150c3 | 2013-08-27 17:31:03 -0700 | [diff] [blame] | 264 | uint32_t size_oat_class_type_; |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 265 | uint32_t size_oat_class_status_; |
Brian Carlstrom | ba150c3 | 2013-08-27 17:31:03 -0700 | [diff] [blame] | 266 | uint32_t size_oat_class_method_bitmaps_; |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 267 | uint32_t size_oat_class_method_offsets_; |
| 268 | |
Vladimir Marko | b163bb7 | 2015-03-31 21:49:49 +0100 | [diff] [blame] | 269 | std::unique_ptr<linker::RelativePatcher> relative_patcher_; |
Vladimir Marko | f4da675 | 2014-08-01 19:04:18 +0100 | [diff] [blame] | 270 | |
David Srbecky | f898087 | 2015-05-22 17:04:47 +0100 | [diff] [blame] | 271 | // The locations of absolute patches relative to the start of the executable section. |
| 272 | std::vector<uintptr_t> absolute_patch_locations_; |
Vladimir Marko | f4da675 | 2014-08-01 19:04:18 +0100 | [diff] [blame] | 273 | |
Vladimir Marko | b163bb7 | 2015-03-31 21:49:49 +0100 | [diff] [blame] | 274 | // Map method reference to assigned offset. |
| 275 | // Wrap the map in a class implementing linker::RelativePatcherTargetProvider. |
| 276 | class MethodOffsetMap FINAL : public linker::RelativePatcherTargetProvider { |
| 277 | public: |
| 278 | std::pair<bool, uint32_t> FindMethodOffset(MethodReference ref) OVERRIDE; |
| 279 | SafeMap<MethodReference, uint32_t, MethodReferenceComparator> map; |
| 280 | }; |
| 281 | MethodOffsetMap method_offset_map_; |
Vladimir Marko | f4da675 | 2014-08-01 19:04:18 +0100 | [diff] [blame] | 282 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 283 | DISALLOW_COPY_AND_ASSIGN(OatWriter); |
| 284 | }; |
| 285 | |
| 286 | } // namespace art |
| 287 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 288 | #endif // ART_COMPILER_OAT_WRITER_H_ |