blob: f9671d7c59537b5909c23f835ac4d43a2186ca24 [file] [log] [blame]
Brian Carlstrom7940e442013-07-12 13:46:57 -07001/*
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 Carlstromfc0e3212013-07-17 14:40:12 -070017#ifndef ART_COMPILER_OAT_WRITER_H_
18#define ART_COMPILER_OAT_WRITER_H_
Brian Carlstrom7940e442013-07-12 13:46:57 -070019
20#include <stdint.h>
Brian Carlstrom7940e442013-07-12 13:46:57 -070021#include <cstddef>
Ian Rogers700a4022014-05-19 16:49:03 -070022#include <memory>
Brian Carlstrom7940e442013-07-12 13:46:57 -070023
David Brazdild9c90372016-09-14 16:53:55 +010024#include "base/array_ref.h"
Vladimir Marko49b0f452015-12-10 13:49:19 +000025#include "base/dchecked_vector.h"
Vladimir Markob163bb72015-03-31 21:49:49 +010026#include "linker/relative_patcher.h" // For linker::RelativePatcherTargetProvider.
Brian Carlstrom7940e442013-07-12 13:46:57 -070027#include "mem_map.h"
Vladimir Markof4da6752014-08-01 19:04:18 +010028#include "method_reference.h"
Brian Carlstrom7940e442013-07-12 13:46:57 -070029#include "mirror/class.h"
Artem Udovichenkod9786b02015-10-14 16:36:55 +030030#include "oat.h"
Vladimir Marko9bdf1082016-01-21 12:15:52 +000031#include "os.h"
Brian Carlstrom7940e442013-07-12 13:46:57 -070032#include "safe_map.h"
Vladimir Markoaad75c62016-10-03 08:46:48 +000033#include "string_reference.h"
Brian Carlstrom7940e442013-07-12 13:46:57 -070034
35namespace art {
36
Brian Carlstromba150c32013-08-27 17:31:03 -070037class BitVector;
Andreas Gampe79273802014-08-05 20:21:05 -070038class CompiledMethod;
Vladimir Marko20f85592015-03-19 10:07:02 +000039class CompilerDriver;
Vladimir Markof4da6752014-08-01 19:04:18 +010040class ImageWriter;
Jeff Hao608f2ce2016-10-19 11:17:11 -070041class ProfileCompilationInfo;
Brian Carlstrom7940e442013-07-12 13:46:57 -070042class OutputStream;
Vladimir Marko20f85592015-03-19 10:07:02 +000043class TimingLogger;
Artem Udovichenkod9786b02015-10-14 16:36:55 +030044class TypeLookupTable;
Vladimir Marko9bdf1082016-01-21 12:15:52 +000045class ZipEntry;
Brian Carlstrom7940e442013-07-12 13:46:57 -070046
David Srbeckyc5bfa972016-02-05 15:49:10 +000047namespace debug {
Vladimir Marko10c13562015-11-25 14:33:36 +000048struct MethodDebugInfo;
David Srbeckyc5bfa972016-02-05 15:49:10 +000049} // namespace debug
Vladimir Marko10c13562015-11-25 14:33:36 +000050
Vladimir Marko944da602016-02-19 12:27:55 +000051namespace linker {
52class MultiOatRelativePatcher;
53} // namespace linker
54
David Brazdil5d5a36b2016-09-14 15:34:10 +010055namespace verifier {
56 class VerifierDeps;
57} // namespace verifier
58
Brian Carlstrom7940e442013-07-12 13:46:57 -070059// OatHeader variable length with count of D OatDexFiles
60//
61// OatDexFile[0] one variable sized OatDexFile with offsets to Dex and OatClasses
62// OatDexFile[1]
63// ...
64// OatDexFile[D]
65//
Artem Udovichenkod9786b02015-10-14 16:36:55 +030066// TypeLookupTable[0] one descriptor to class def index hash table for each OatDexFile.
67// TypeLookupTable[1]
68// ...
69// TypeLookupTable[D]
70//
Vladimir Marko9bdf1082016-01-21 12:15:52 +000071// ClassOffsets[0] one table of OatClass offsets for each class def for each OatDexFile.
72// ClassOffsets[1]
73// ...
74// ClassOffsets[D]
75//
Brian Carlstrom7940e442013-07-12 13:46:57 -070076// OatClass[0] one variable sized OatClass for each of C DexFile::ClassDefs
77// OatClass[1] contains OatClass entries with class status, offsets to code, etc.
78// ...
79// OatClass[C]
80//
Vladimir Marko96c6ab92014-04-08 14:00:50 +010081// GcMap one variable sized blob with GC map.
82// GcMap GC maps are deduplicated.
83// ...
84// GcMap
85//
86// VmapTable one variable sized VmapTable blob (quick compiler only).
87// VmapTable VmapTables are deduplicated.
88// ...
89// VmapTable
90//
91// MappingTable one variable sized blob with MappingTable (quick compiler only).
92// MappingTable MappingTables are deduplicated.
93// ...
94// MappingTable
95//
Brian Carlstrom7940e442013-07-12 13:46:57 -070096// padding if necessary so that the following code will be page aligned
97//
Vladimir Marko96c6ab92014-04-08 14:00:50 +010098// OatMethodHeader fixed size header for a CompiledMethod including the size of the MethodCode.
99// MethodCode one variable sized blob with the code of a CompiledMethod.
100// OatMethodHeader (OatMethodHeader, MethodCode) pairs are deduplicated.
101// MethodCode
Brian Carlstrom7940e442013-07-12 13:46:57 -0700102// ...
Vladimir Marko96c6ab92014-04-08 14:00:50 +0100103// OatMethodHeader
104// MethodCode
Brian Carlstrom7940e442013-07-12 13:46:57 -0700105//
106class OatWriter {
107 public:
Vladimir Marko9bdf1082016-01-21 12:15:52 +0000108 enum class CreateTypeLookupTable {
109 kCreate,
110 kDontCreate,
111 kDefault = kCreate
112 };
113
Jeff Hao608f2ce2016-10-19 11:17:11 -0700114 OatWriter(bool compiling_boot_image, TimingLogger* timings, ProfileCompilationInfo* info);
Vladimir Marko9bdf1082016-01-21 12:15:52 +0000115
116 // To produce a valid oat file, the user must first add sources with any combination of
117 // - AddDexFileSource(),
118 // - AddZippedDexFilesSource(),
119 // - AddRawDexFileSource().
120 // Then the user must call in order
121 // - WriteAndOpenDexFiles()
Nicolas Geoffray4acefd32016-10-24 13:14:58 +0100122 // - Initialize()
123 // - WriteVerifierDeps()
124 // - WriteQuickeningInfo()
125 // - WriteVdexHeader()
Vladimir Marko9bdf1082016-01-21 12:15:52 +0000126 // - PrepareLayout(),
127 // - WriteRodata(),
128 // - WriteCode(),
129 // - WriteHeader().
130
131 // Add dex file source(s) from a file, either a plain dex file or
132 // a zip file with one or more dex files.
133 bool AddDexFileSource(
134 const char* filename,
135 const char* location,
136 CreateTypeLookupTable create_type_lookup_table = CreateTypeLookupTable::kDefault);
137 // Add dex file source(s) from a zip file specified by a file handle.
138 bool AddZippedDexFilesSource(
Andreas Gampe43e10b02016-07-15 17:17:34 -0700139 File&& zip_fd,
Vladimir Marko9bdf1082016-01-21 12:15:52 +0000140 const char* location,
141 CreateTypeLookupTable create_type_lookup_table = CreateTypeLookupTable::kDefault);
142 // Add dex file source from raw memory.
143 bool AddRawDexFileSource(
144 const ArrayRef<const uint8_t>& data,
145 const char* location,
146 uint32_t location_checksum,
147 CreateTypeLookupTable create_type_lookup_table = CreateTypeLookupTable::kDefault);
148 dchecked_vector<const char*> GetSourceLocations() const;
149
David Brazdil7b49e6c2016-09-01 11:06:18 +0100150 // Write raw dex files to the vdex file, mmap the file and open the dex files from it.
151 // Supporting data structures are written into the .rodata section of the oat file.
152 // The `verify` setting dictates whether the dex file verifier should check the dex files.
153 // This is generally the case, and should only be false for tests.
154 bool WriteAndOpenDexFiles(File* vdex_file,
155 OutputStream* oat_rodata,
Vladimir Marko9bdf1082016-01-21 12:15:52 +0000156 InstructionSet instruction_set,
157 const InstructionSetFeatures* instruction_set_features,
158 SafeMap<std::string, std::string>* key_value_store,
Andreas Gampe3a2bd292016-01-26 17:23:47 -0800159 bool verify,
Vladimir Marko9bdf1082016-01-21 12:15:52 +0000160 /*out*/ std::unique_ptr<MemMap>* opened_dex_files_map,
161 /*out*/ std::vector<std::unique_ptr<const DexFile>>* opened_dex_files);
Nicolas Geoffray4acefd32016-10-24 13:14:58 +0100162 bool WriteQuickeningInfo(OutputStream* vdex_out);
David Brazdil5d5a36b2016-09-14 15:34:10 +0100163 bool WriteVerifierDeps(OutputStream* vdex_out, verifier::VerifierDeps* verifier_deps);
164 bool WriteVdexHeader(OutputStream* vdex_out);
Nicolas Geoffray4acefd32016-10-24 13:14:58 +0100165 // Initialize the writer with the given parameters.
166 void Initialize(const CompilerDriver* compiler,
167 ImageWriter* image_writer,
168 const std::vector<const DexFile*>& dex_files) {
169 compiler_driver_ = compiler;
170 image_writer_ = image_writer;
171 dex_files_ = &dex_files;
172 }
David Brazdil5d5a36b2016-09-14 15:34:10 +0100173
Vladimir Marko9bdf1082016-01-21 12:15:52 +0000174 // Prepare layout of remaining data.
Nicolas Geoffray4acefd32016-10-24 13:14:58 +0100175 void PrepareLayout(linker::MultiOatRelativePatcher* relative_patcher);
Vladimir Marko9bdf1082016-01-21 12:15:52 +0000176 // Write the rest of .rodata section (ClassOffsets[], OatClass[], maps).
177 bool WriteRodata(OutputStream* out);
178 // Write the code to the .text section.
179 bool WriteCode(OutputStream* out);
180 // Write the oat header. This finalizes the oat file.
181 bool WriteHeader(OutputStream* out,
182 uint32_t image_file_location_oat_checksum,
183 uintptr_t image_file_location_oat_begin,
184 int32_t image_patch_delta);
Brian Carlstromc50d8e12013-07-23 22:35:16 -0700185
Vladimir Marko09d09432015-09-08 13:47:48 +0100186 // Returns whether the oat file has an associated image.
187 bool HasImage() const {
188 // Since the image is being created at the same time as the oat file,
189 // check if there's an image writer.
190 return image_writer_ != nullptr;
191 }
192
Mathieu Chartierda5b28a2015-11-05 08:03:47 -0800193 bool HasBootImage() const {
194 return compiling_boot_image_;
195 }
196
Brian Carlstromc50d8e12013-07-23 22:35:16 -0700197 const OatHeader& GetOatHeader() const {
198 return *oat_header_;
199 }
200
David Brazdil7b49e6c2016-09-01 11:06:18 +0100201 size_t GetOatSize() const {
202 return oat_size_;
Brian Carlstromc50d8e12013-07-23 22:35:16 -0700203 }
204
Vladimir Marko5c42c292015-02-25 12:02:49 +0000205 size_t GetBssSize() const {
206 return bss_size_;
207 }
208
Vladimir Markoaad75c62016-10-03 08:46:48 +0000209 size_t GetBssRootsOffset() const {
210 return bss_roots_offset_;
211 }
212
Vladimir Marko944da602016-02-19 12:27:55 +0000213 size_t GetOatDataOffset() const {
214 return oat_data_offset_;
215 }
216
Vladimir Marko49b0f452015-12-10 13:49:19 +0000217 ArrayRef<const uintptr_t> GetAbsolutePatchLocations() const {
218 return ArrayRef<const uintptr_t>(absolute_patch_locations_);
Vladimir Markof4da6752014-08-01 19:04:18 +0100219 }
220
Brian Carlstrom7940e442013-07-12 13:46:57 -0700221 ~OatWriter();
222
David Srbecky09c2a6b2016-03-11 17:11:44 +0000223 void AddMethodDebugInfos(const std::vector<debug::MethodDebugInfo>& infos) {
224 method_info_.insert(method_info_.end(), infos.begin(), infos.end());
225 }
226
David Srbeckyc5bfa972016-02-05 15:49:10 +0000227 ArrayRef<const debug::MethodDebugInfo> GetMethodDebugInfo() const {
228 return ArrayRef<const debug::MethodDebugInfo>(method_info_);
Mark Mendellae9fd932014-02-10 16:14:35 -0800229 }
230
Vladimir Markob163bb72015-03-31 21:49:49 +0100231 const CompilerDriver* GetCompilerDriver() {
232 return compiler_driver_;
233 }
234
Brian Carlstromc50d8e12013-07-23 22:35:16 -0700235 private:
Vladimir Marko9bdf1082016-01-21 12:15:52 +0000236 class DexFileSource;
Vladimir Marko49b0f452015-12-10 13:49:19 +0000237 class OatClass;
238 class OatDexFile;
239
Vladimir Marko96c6ab92014-04-08 14:00:50 +0100240 // The function VisitDexMethods() below iterates through all the methods in all
241 // the compiled dex files in order of their definitions. The method visitor
242 // classes provide individual bits of processing for each of the passes we need to
243 // first collect the data we want to write to the oat file and then, in later passes,
244 // to actually write it.
245 class DexMethodVisitor;
246 class OatDexMethodVisitor;
247 class InitOatClassesMethodVisitor;
248 class InitCodeMethodVisitor;
Vladimir Marko96c6ab92014-04-08 14:00:50 +0100249 class InitMapMethodVisitor;
250 class InitImageMethodVisitor;
251 class WriteCodeMethodVisitor;
Vladimir Marko96c6ab92014-04-08 14:00:50 +0100252 class WriteMapMethodVisitor;
Nicolas Geoffray4acefd32016-10-24 13:14:58 +0100253 class WriteQuickeningInfoMethodVisitor;
Vladimir Marko96c6ab92014-04-08 14:00:50 +0100254
255 // Visit all the methods in all the compiled dex files in their definition order
256 // with a given DexMethodVisitor.
257 bool VisitDexMethods(DexMethodVisitor* visitor);
258
David Brazdil7b49e6c2016-09-01 11:06:18 +0100259 bool WriteDexFiles(OutputStream* out, File* file);
260 bool WriteDexFile(OutputStream* out, File* file, OatDexFile* oat_dex_file);
261 bool SeekToDexFile(OutputStream* out, File* file, OatDexFile* oat_dex_file);
Jeff Hao608f2ce2016-10-19 11:17:11 -0700262 bool LayoutAndWriteDexFile(OutputStream* out, OatDexFile* oat_dex_file);
David Brazdil7b49e6c2016-09-01 11:06:18 +0100263 bool WriteDexFile(OutputStream* out,
264 File* file,
265 OatDexFile* oat_dex_file,
266 ZipEntry* dex_file);
267 bool WriteDexFile(OutputStream* out,
268 File* file,
269 OatDexFile* oat_dex_file,
270 File* dex_file);
271 bool WriteDexFile(OutputStream* out, OatDexFile* oat_dex_file, const uint8_t* dex_file);
272 bool OpenDexFiles(File* file,
273 bool verify,
274 /*out*/ std::unique_ptr<MemMap>* opened_dex_files_map,
275 /*out*/ std::vector<std::unique_ptr<const DexFile>>* opened_dex_files);
276
Vladimir Marko9bdf1082016-01-21 12:15:52 +0000277 size_t InitOatHeader(InstructionSet instruction_set,
278 const InstructionSetFeatures* instruction_set_features,
279 uint32_t num_dex_files,
280 SafeMap<std::string, std::string>* key_value_store);
Brian Carlstrom7940e442013-07-12 13:46:57 -0700281 size_t InitOatDexFiles(size_t offset);
Brian Carlstrom7940e442013-07-12 13:46:57 -0700282 size_t InitOatClasses(size_t offset);
Vladimir Marko96c6ab92014-04-08 14:00:50 +0100283 size_t InitOatMaps(size_t offset);
Vladimir Marko49b0f452015-12-10 13:49:19 +0000284 size_t InitOatCode(size_t offset);
285 size_t InitOatCodeDexFiles(size_t offset);
Vladimir Markoaad75c62016-10-03 08:46:48 +0000286 void InitBssLayout(InstructionSet instruction_set);
Brian Carlstrom7940e442013-07-12 13:46:57 -0700287
Vladimir Marko9bdf1082016-01-21 12:15:52 +0000288 bool WriteClassOffsets(OutputStream* out);
289 bool WriteClasses(OutputStream* out);
Vladimir Marko96c6ab92014-04-08 14:00:50 +0100290 size_t WriteMaps(OutputStream* out, const size_t file_offset, size_t relative_offset);
291 size_t WriteCode(OutputStream* out, const size_t file_offset, size_t relative_offset);
Ian Rogers3d504072014-03-01 09:16:49 -0800292 size_t WriteCodeDexFiles(OutputStream* out, const size_t file_offset, size_t relative_offset);
Brian Carlstrom7940e442013-07-12 13:46:57 -0700293
Vladimir Marko944da602016-02-19 12:27:55 +0000294 bool RecordOatDataOffset(OutputStream* out);
David Brazdil7b49e6c2016-09-01 11:06:18 +0100295 bool ReadDexFileHeader(File* oat_file, OatDexFile* oat_dex_file);
Vladimir Marko9bdf1082016-01-21 12:15:52 +0000296 bool ValidateDexFileHeader(const uint8_t* raw_header, const char* location);
David Brazdil7b49e6c2016-09-01 11:06:18 +0100297 bool WriteOatDexFiles(OutputStream* oat_rodata);
298 bool WriteTypeLookupTables(OutputStream* oat_rodata,
Vladimir Marko9bdf1082016-01-21 12:15:52 +0000299 const std::vector<std::unique_ptr<const DexFile>>& opened_dex_files);
Vladimir Markof4da6752014-08-01 19:04:18 +0100300 bool WriteCodeAlignment(OutputStream* out, uint32_t aligned_code_delta);
Vladimir Marko944da602016-02-19 12:27:55 +0000301 void SetMultiOatRelativePatcherAdjustment();
Vladimir Markof4da6752014-08-01 19:04:18 +0100302
Vladimir Marko9bdf1082016-01-21 12:15:52 +0000303 enum class WriteState {
304 kAddingDexFileSources,
305 kPrepareLayout,
306 kWriteRoData,
307 kWriteText,
308 kWriteHeader,
309 kDone
310 };
311
312 WriteState write_state_;
313 TimingLogger* timings_;
314
315 std::vector<std::unique_ptr<File>> raw_dex_files_;
316 std::vector<std::unique_ptr<ZipArchive>> zip_archives_;
317 std::vector<std::unique_ptr<ZipEntry>> zipped_dex_files_;
318
319 // Using std::list<> which doesn't move elements around on push/emplace_back().
320 // We need this because we keep plain pointers to the strings' c_str().
321 std::list<std::string> zipped_dex_file_locations_;
322
David Srbeckyc5bfa972016-02-05 15:49:10 +0000323 dchecked_vector<debug::MethodDebugInfo> method_info_;
Mark Mendellae9fd932014-02-10 16:14:35 -0800324
Vladimir Marko9bdf1082016-01-21 12:15:52 +0000325 const CompilerDriver* compiler_driver_;
326 ImageWriter* image_writer_;
Mathieu Chartierda5b28a2015-11-05 08:03:47 -0800327 const bool compiling_boot_image_;
Brian Carlstrom7940e442013-07-12 13:46:57 -0700328
329 // note OatFile does not take ownership of the DexFiles
330 const std::vector<const DexFile*>* dex_files_;
331
David Brazdil7b49e6c2016-09-01 11:06:18 +0100332 // Size required for Vdex data structures.
333 size_t vdex_size_;
334
335 // Offset of section holding Dex files inside Vdex.
336 size_t vdex_dex_files_offset_;
337
David Brazdil5d5a36b2016-09-14 15:34:10 +0100338 // Offset of section holding VerifierDeps inside Vdex.
339 size_t vdex_verifier_deps_offset_;
340
Nicolas Geoffray4acefd32016-10-24 13:14:58 +0100341 // Offset of section holding quickening info inside Vdex.
342 size_t vdex_quickening_info_offset_;
343
Brian Carlstromc50d8e12013-07-23 22:35:16 -0700344 // Size required for Oat data structures.
David Brazdil7b49e6c2016-09-01 11:06:18 +0100345 size_t oat_size_;
Brian Carlstromc50d8e12013-07-23 22:35:16 -0700346
Vladimir Markoaad75c62016-10-03 08:46:48 +0000347 // The start of the required .bss section.
348 size_t bss_start_;
349
350 // The size of the required .bss section holding the DexCache data and GC roots.
Vladimir Marko5c42c292015-02-25 12:02:49 +0000351 size_t bss_size_;
352
Vladimir Markoaad75c62016-10-03 08:46:48 +0000353 // The offset of the GC roots in .bss section.
354 size_t bss_roots_offset_;
355
356 // Map for allocating String entries in .bss. Indexed by StringReference for the source
357 // string in the dex file with the "string value comparator" for deduplication. The value
358 // is the target offset for patching, starting at `bss_start_ + bss_roots_offset_`.
359 SafeMap<StringReference, size_t, StringReferenceValueComparator> bss_string_entries_;
360
Vladimir Marko09d09432015-09-08 13:47:48 +0100361 // Offsets of the dex cache arrays for each app dex file. For the
362 // boot image, this information is provided by the ImageWriter.
Vladimir Marko06d7aaa2015-10-16 11:23:41 +0100363 SafeMap<const DexFile*, size_t> dex_cache_arrays_offsets_; // DexFiles not owned.
Vladimir Marko09d09432015-09-08 13:47:48 +0100364
Vladimir Markof4da6752014-08-01 19:04:18 +0100365 // Offset of the oat data from the start of the mmapped region of the elf file.
366 size_t oat_data_offset_;
367
Mathieu Chartier1b868492016-11-16 16:22:37 -0800368 // Fake OatDexFiles to hold type lookup tables for the compiler.
369 std::vector<std::unique_ptr<art::OatDexFile>> type_lookup_table_oat_dex_files_;
370
Brian Carlstrom7940e442013-07-12 13:46:57 -0700371 // data to write
Vladimir Marko49b0f452015-12-10 13:49:19 +0000372 std::unique_ptr<OatHeader> oat_header_;
373 dchecked_vector<OatDexFile> oat_dex_files_;
374 dchecked_vector<OatClass> oat_classes_;
Ian Rogers700a4022014-05-19 16:49:03 -0700375 std::unique_ptr<const std::vector<uint8_t>> jni_dlsym_lookup_;
Ian Rogers700a4022014-05-19 16:49:03 -0700376 std::unique_ptr<const std::vector<uint8_t>> quick_generic_jni_trampoline_;
377 std::unique_ptr<const std::vector<uint8_t>> quick_imt_conflict_trampoline_;
378 std::unique_ptr<const std::vector<uint8_t>> quick_resolution_trampoline_;
379 std::unique_ptr<const std::vector<uint8_t>> quick_to_interpreter_bridge_;
Brian Carlstrom7940e442013-07-12 13:46:57 -0700380
381 // output stats
David Brazdil7b49e6c2016-09-01 11:06:18 +0100382 uint32_t size_vdex_header_;
Brian Carlstrom7940e442013-07-12 13:46:57 -0700383 uint32_t size_dex_file_alignment_;
384 uint32_t size_executable_offset_alignment_;
385 uint32_t size_oat_header_;
Andreas Gampe22f8e5c2014-07-09 11:38:21 -0700386 uint32_t size_oat_header_key_value_store_;
Brian Carlstrom7940e442013-07-12 13:46:57 -0700387 uint32_t size_dex_file_;
David Brazdil5d5a36b2016-09-14 15:34:10 +0100388 uint32_t size_verifier_deps_;
389 uint32_t size_verifier_deps_alignment_;
Nicolas Geoffray4acefd32016-10-24 13:14:58 +0100390 uint32_t size_quickening_info_;
391 uint32_t size_quickening_info_alignment_;
Ian Rogers468532e2013-08-05 10:56:33 -0700392 uint32_t size_interpreter_to_interpreter_bridge_;
393 uint32_t size_interpreter_to_compiled_code_bridge_;
394 uint32_t size_jni_dlsym_lookup_;
Andreas Gampe2da88232014-02-27 12:26:20 -0800395 uint32_t size_quick_generic_jni_trampoline_;
Jeff Hao88474b42013-10-23 16:24:40 -0700396 uint32_t size_quick_imt_conflict_trampoline_;
Brian Carlstrom7940e442013-07-12 13:46:57 -0700397 uint32_t size_quick_resolution_trampoline_;
Ian Rogers468532e2013-08-05 10:56:33 -0700398 uint32_t size_quick_to_interpreter_bridge_;
399 uint32_t size_trampoline_alignment_;
Vladimir Marko96c6ab92014-04-08 14:00:50 +0100400 uint32_t size_method_header_;
Brian Carlstrom7940e442013-07-12 13:46:57 -0700401 uint32_t size_code_;
402 uint32_t size_code_alignment_;
Vladimir Markof4da6752014-08-01 19:04:18 +0100403 uint32_t size_relative_call_thunks_;
Vladimir Markoc74658b2015-03-31 10:26:41 +0100404 uint32_t size_misc_thunks_;
Brian Carlstrom7940e442013-07-12 13:46:57 -0700405 uint32_t size_vmap_table_;
Brian Carlstrom7940e442013-07-12 13:46:57 -0700406 uint32_t size_oat_dex_file_location_size_;
407 uint32_t size_oat_dex_file_location_data_;
408 uint32_t size_oat_dex_file_location_checksum_;
409 uint32_t size_oat_dex_file_offset_;
Vladimir Marko9bdf1082016-01-21 12:15:52 +0000410 uint32_t size_oat_dex_file_class_offsets_offset_;
Vladimir Marko49b0f452015-12-10 13:49:19 +0000411 uint32_t size_oat_dex_file_lookup_table_offset_;
Vladimir Marko49b0f452015-12-10 13:49:19 +0000412 uint32_t size_oat_lookup_table_alignment_;
413 uint32_t size_oat_lookup_table_;
Vladimir Marko9bdf1082016-01-21 12:15:52 +0000414 uint32_t size_oat_class_offsets_alignment_;
415 uint32_t size_oat_class_offsets_;
Brian Carlstromba150c32013-08-27 17:31:03 -0700416 uint32_t size_oat_class_type_;
Brian Carlstrom7940e442013-07-12 13:46:57 -0700417 uint32_t size_oat_class_status_;
Brian Carlstromba150c32013-08-27 17:31:03 -0700418 uint32_t size_oat_class_method_bitmaps_;
Brian Carlstrom7940e442013-07-12 13:46:57 -0700419 uint32_t size_oat_class_method_offsets_;
420
Vladimir Marko944da602016-02-19 12:27:55 +0000421 // The helper for processing relative patches is external so that we can patch across oat files.
422 linker::MultiOatRelativePatcher* relative_patcher_;
Vladimir Markof4da6752014-08-01 19:04:18 +0100423
David Srbeckyf8980872015-05-22 17:04:47 +0100424 // The locations of absolute patches relative to the start of the executable section.
Vladimir Marko9bdf1082016-01-21 12:15:52 +0000425 dchecked_vector<uintptr_t> absolute_patch_locations_;
Vladimir Markof4da6752014-08-01 19:04:18 +0100426
Jeff Hao608f2ce2016-10-19 11:17:11 -0700427 // Profile info used to generate new layout of files.
428 ProfileCompilationInfo* profile_compilation_info_;
429
Brian Carlstrom7940e442013-07-12 13:46:57 -0700430 DISALLOW_COPY_AND_ASSIGN(OatWriter);
431};
432
433} // namespace art
434
Brian Carlstromfc0e3212013-07-17 14:40:12 -0700435#endif // ART_COMPILER_OAT_WRITER_H_