blob: 23869140aed683ca3ea3d37527517036708f7d3f [file] [log] [blame]
Elliott Hughes2faa5f12012-01-30 14:42:07 -08001/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Brian Carlstrom3320cf42011-10-04 14:58:28 -070016
Mathieu Chartier193bad92013-08-29 18:46:00 -070017#ifndef ART_COMPILER_COMPILED_METHOD_H_
18#define ART_COMPILER_COMPILED_METHOD_H_
Brian Carlstrom3320cf42011-10-04 14:58:28 -070019
Ian Rogers700a4022014-05-19 16:49:03 -070020#include <memory>
Brian Carlstrom265091e2013-01-30 14:08:26 -080021#include <string>
Brian Carlstrom3320cf42011-10-04 14:58:28 -070022#include <vector>
23
Ian Rogersd582fa42014-11-05 23:46:43 -080024#include "arch/instruction_set.h"
Vladimir Markof4da6752014-08-01 19:04:18 +010025#include "method_reference.h"
Brian Carlstrom3320cf42011-10-04 14:58:28 -070026#include "utils.h"
Vladimir Markof4da6752014-08-01 19:04:18 +010027#include "utils/array_ref.h"
Andreas Gampee21dc3d2014-12-08 16:59:43 -080028#include "utils/swap_space.h"
Brian Carlstrom3320cf42011-10-04 14:58:28 -070029
30namespace art {
31
Mathieu Chartier193bad92013-08-29 18:46:00 -070032class CompilerDriver;
33
Logan Chien598c5132012-04-28 22:00:44 +080034class CompiledCode {
35 public:
Brian Carlstrom265091e2013-01-30 14:08:26 -080036 // For Quick to supply an code blob
Mathieu Chartier193bad92013-08-29 18:46:00 -070037 CompiledCode(CompilerDriver* compiler_driver, InstructionSet instruction_set,
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080038 const ArrayRef<const uint8_t>& quick_code, bool owns_code_array);
39
40 virtual ~CompiledCode();
Logan Chien598c5132012-04-28 22:00:44 +080041
Logan Chien598c5132012-04-28 22:00:44 +080042 InstructionSet GetInstructionSet() const {
43 return instruction_set_;
44 }
45
Andreas Gampee21dc3d2014-12-08 16:59:43 -080046 const SwapVector<uint8_t>* GetQuickCode() const {
Ian Rogersef7d42f2014-01-06 12:55:46 -080047 return quick_code_;
Logan Chien598c5132012-04-28 22:00:44 +080048 }
49
Andreas Gampee21dc3d2014-12-08 16:59:43 -080050 void SetCode(const ArrayRef<const uint8_t>* quick_code);
Ian Rogersef7d42f2014-01-06 12:55:46 -080051
52 bool operator==(const CompiledCode& rhs) const;
53
Logan Chien598c5132012-04-28 22:00:44 +080054 // To align an offset from a page-aligned value to make it suitable
55 // for code storage. For example on ARM, to ensure that PC relative
56 // valu computations work out as expected.
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080057 size_t AlignCode(size_t offset) const;
58 static size_t AlignCode(size_t offset, InstructionSet instruction_set);
Logan Chien598c5132012-04-28 22:00:44 +080059
60 // returns the difference between the code address and a usable PC.
61 // mainly to cope with kThumb2 where the lower bit must be set.
62 size_t CodeDelta() const;
Dave Allison50abf0a2014-06-23 13:19:59 -070063 static size_t CodeDelta(InstructionSet instruction_set);
Logan Chien598c5132012-04-28 22:00:44 +080064
65 // Returns a pointer suitable for invoking the code at the argument
66 // code_pointer address. Mainly to cope with kThumb2 where the
67 // lower bit must be set to indicate Thumb mode.
68 static const void* CodePointer(const void* code_pointer,
69 InstructionSet instruction_set);
70
Brian Carlstrom265091e2013-01-30 14:08:26 -080071 const std::vector<uint32_t>& GetOatdataOffsetsToCompliledCodeOffset() const;
72 void AddOatdataOffsetToCompliledCodeOffset(uint32_t offset);
Brian Carlstrom265091e2013-01-30 14:08:26 -080073
Logan Chien598c5132012-04-28 22:00:44 +080074 private:
Ian Rogersef7d42f2014-01-06 12:55:46 -080075 CompilerDriver* const compiler_driver_;
Mathieu Chartier193bad92013-08-29 18:46:00 -070076
Logan Chien598c5132012-04-28 22:00:44 +080077 const InstructionSet instruction_set_;
Brian Carlstrom8227cc12013-03-06 14:26:48 -080078
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080079 // If we own the code array (means that we free in destructor).
80 const bool owns_code_array_;
81
Ian Rogersef7d42f2014-01-06 12:55:46 -080082 // Used to store the PIC code for Quick.
Andreas Gampee21dc3d2014-12-08 16:59:43 -080083 SwapVector<uint8_t>* quick_code_;
Brian Carlstrom265091e2013-01-30 14:08:26 -080084
Brian Carlstrom265091e2013-01-30 14:08:26 -080085 // There are offsets from the oatdata symbol to where the offset to
86 // the compiled method will be found. These are computed by the
87 // OatWriter and then used by the ElfWriter to add relocations so
88 // that MCLinker can update the values to the location in the linked .so.
89 std::vector<uint32_t> oatdata_offsets_to_compiled_code_offset_;
Logan Chien598c5132012-04-28 22:00:44 +080090};
91
Yevgeny Roubane3ea8382014-08-08 16:29:38 +070092class SrcMapElem {
93 public:
94 uint32_t from_;
95 int32_t to_;
96
Yevgeny Rouban33ac8192014-08-19 18:39:57 +070097 explicit operator int64_t() const {
98 return (static_cast<int64_t>(to_) << 32) | from_;
Yevgeny Roubane3ea8382014-08-08 16:29:38 +070099 }
100
Yevgeny Rouban33ac8192014-08-19 18:39:57 +0700101 bool operator<(const SrcMapElem& sme) const {
102 return int64_t(*this) < int64_t(sme);
103 }
104
105 bool operator==(const SrcMapElem& sme) const {
106 return int64_t(*this) == int64_t(sme);
107 }
108
109 explicit operator uint8_t() const {
Yevgeny Roubane3ea8382014-08-08 16:29:38 +0700110 return static_cast<uint8_t>(from_ + to_);
111 }
112};
113
Andreas Gampee21dc3d2014-12-08 16:59:43 -0800114template <class Allocator>
115class SrcMap FINAL : public std::vector<SrcMapElem, Allocator> {
Yevgeny Roubane3ea8382014-08-08 16:29:38 +0700116 public:
Andreas Gampee21dc3d2014-12-08 16:59:43 -0800117 using std::vector<SrcMapElem, Allocator>::begin;
118 using typename std::vector<SrcMapElem, Allocator>::const_iterator;
119 using std::vector<SrcMapElem, Allocator>::empty;
120 using std::vector<SrcMapElem, Allocator>::end;
121 using std::vector<SrcMapElem, Allocator>::resize;
122 using std::vector<SrcMapElem, Allocator>::shrink_to_fit;
123 using std::vector<SrcMapElem, Allocator>::size;
124
125 explicit SrcMap() {}
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800126 explicit SrcMap(const Allocator& alloc) : std::vector<SrcMapElem, Allocator>(alloc) {}
Andreas Gampee21dc3d2014-12-08 16:59:43 -0800127
128 template <class InputIt>
129 SrcMap(InputIt first, InputIt last, const Allocator& alloc)
130 : std::vector<SrcMapElem, Allocator>(first, last, alloc) {}
131
Yevgeny Roubane3ea8382014-08-08 16:29:38 +0700132 void SortByFrom() {
Yevgeny Rouban33ac8192014-08-19 18:39:57 +0700133 std::sort(begin(), end(), [] (const SrcMapElem& lhs, const SrcMapElem& rhs) -> bool {
134 return lhs.from_ < rhs.from_;
135 });
Yevgeny Roubane3ea8382014-08-08 16:29:38 +0700136 }
137
138 const_iterator FindByTo(int32_t to) const {
Yevgeny Rouban33ac8192014-08-19 18:39:57 +0700139 return std::lower_bound(begin(), end(), SrcMapElem({0, to}));
Yevgeny Roubane3ea8382014-08-08 16:29:38 +0700140 }
141
142 SrcMap& Arrange() {
Yevgeny Roubane3ea8382014-08-08 16:29:38 +0700143 if (!empty()) {
Yevgeny Rouban33ac8192014-08-19 18:39:57 +0700144 std::sort(begin(), end());
145 resize(std::unique(begin(), end()) - begin());
146 shrink_to_fit();
Yevgeny Roubane3ea8382014-08-08 16:29:38 +0700147 }
148 return *this;
149 }
150
151 void DeltaFormat(const SrcMapElem& start, uint32_t highest_pc) {
152 // Convert from abs values to deltas.
153 if (!empty()) {
154 SortByFrom();
155
156 // TODO: one PC can be mapped to several Java src lines.
157 // do we want such a one-to-many correspondence?
158
159 // get rid of the highest values
160 size_t i = size() - 1;
161 for (; i > 0 ; i--) {
Yevgeny Rouban1127b122014-09-16 11:29:26 +0700162 if ((*this)[i].from_ < highest_pc) {
Yevgeny Roubane3ea8382014-08-08 16:29:38 +0700163 break;
164 }
165 }
166 this->resize(i + 1);
167
Andreas Gampe277ccbd2014-11-03 21:36:10 -0800168 for (i = size(); --i >= 1; ) {
Yevgeny Roubane3ea8382014-08-08 16:29:38 +0700169 (*this)[i].from_ -= (*this)[i-1].from_;
170 (*this)[i].to_ -= (*this)[i-1].to_;
171 }
172 DCHECK((*this)[0].from_ >= start.from_);
173 (*this)[0].from_ -= start.from_;
174 (*this)[0].to_ -= start.to_;
175 }
176 }
177};
178
Andreas Gampee21dc3d2014-12-08 16:59:43 -0800179using DefaultSrcMap = SrcMap<std::allocator<SrcMapElem>>;
180using SwapSrcMap = SrcMap<SwapAllocator<SrcMapElem>>;
181
182
Vladimir Markof4da6752014-08-01 19:04:18 +0100183enum LinkerPatchType {
184 kLinkerPatchMethod,
185 kLinkerPatchCall,
186 kLinkerPatchCallRelative, // NOTE: Actual patching is instruction_set-dependent.
187 kLinkerPatchType,
Vladimir Marko20f85592015-03-19 10:07:02 +0000188 kLinkerPatchDexCacheArray, // NOTE: Actual patching is instruction_set-dependent.
Vladimir Markof4da6752014-08-01 19:04:18 +0100189};
190
191class LinkerPatch {
192 public:
193 static LinkerPatch MethodPatch(size_t literal_offset,
194 const DexFile* target_dex_file,
195 uint32_t target_method_idx) {
Vladimir Marko20f85592015-03-19 10:07:02 +0000196 LinkerPatch patch(literal_offset, kLinkerPatchMethod, target_dex_file);
197 patch.method_idx_ = target_method_idx;
198 return patch;
Vladimir Markof4da6752014-08-01 19:04:18 +0100199 }
200
201 static LinkerPatch CodePatch(size_t literal_offset,
202 const DexFile* target_dex_file,
203 uint32_t target_method_idx) {
Vladimir Marko20f85592015-03-19 10:07:02 +0000204 LinkerPatch patch(literal_offset, kLinkerPatchCall, target_dex_file);
205 patch.method_idx_ = target_method_idx;
206 return patch;
Vladimir Markof4da6752014-08-01 19:04:18 +0100207 }
208
209 static LinkerPatch RelativeCodePatch(size_t literal_offset,
210 const DexFile* target_dex_file,
211 uint32_t target_method_idx) {
Vladimir Marko20f85592015-03-19 10:07:02 +0000212 LinkerPatch patch(literal_offset, kLinkerPatchCallRelative, target_dex_file);
213 patch.method_idx_ = target_method_idx;
214 return patch;
Vladimir Markof4da6752014-08-01 19:04:18 +0100215 }
216
217 static LinkerPatch TypePatch(size_t literal_offset,
218 const DexFile* target_dex_file,
219 uint32_t target_type_idx) {
Vladimir Marko20f85592015-03-19 10:07:02 +0000220 LinkerPatch patch(literal_offset, kLinkerPatchType, target_dex_file);
221 patch.type_idx_ = target_type_idx;
222 return patch;
223 }
224
225 static LinkerPatch DexCacheArrayPatch(size_t literal_offset,
226 const DexFile* target_dex_file,
227 uint32_t pc_insn_offset,
228 size_t element_offset) {
229 DCHECK(IsUint<32>(element_offset));
230 LinkerPatch patch(literal_offset, kLinkerPatchDexCacheArray, target_dex_file);
231 patch.pc_insn_offset_ = pc_insn_offset;
232 patch.element_offset_ = element_offset;
233 return patch;
Vladimir Markof4da6752014-08-01 19:04:18 +0100234 }
235
236 LinkerPatch(const LinkerPatch& other) = default;
237 LinkerPatch& operator=(const LinkerPatch& other) = default;
238
239 size_t LiteralOffset() const {
240 return literal_offset_;
241 }
242
243 LinkerPatchType Type() const {
244 return patch_type_;
245 }
246
Vladimir Marko20f85592015-03-19 10:07:02 +0000247 bool IsPcRelative() const {
248 return Type() == kLinkerPatchCallRelative || Type() == kLinkerPatchDexCacheArray;
249 }
250
Vladimir Markof4da6752014-08-01 19:04:18 +0100251 MethodReference TargetMethod() const {
252 DCHECK(patch_type_ == kLinkerPatchMethod ||
253 patch_type_ == kLinkerPatchCall || patch_type_ == kLinkerPatchCallRelative);
Vladimir Marko20f85592015-03-19 10:07:02 +0000254 return MethodReference(target_dex_file_, method_idx_);
Vladimir Markof4da6752014-08-01 19:04:18 +0100255 }
256
257 const DexFile* TargetTypeDexFile() const {
258 DCHECK(patch_type_ == kLinkerPatchType);
259 return target_dex_file_;
260 }
261
262 uint32_t TargetTypeIndex() const {
263 DCHECK(patch_type_ == kLinkerPatchType);
Vladimir Marko20f85592015-03-19 10:07:02 +0000264 return type_idx_;
265 }
266
267 const DexFile* TargetDexCacheDexFile() const {
268 DCHECK(patch_type_ == kLinkerPatchDexCacheArray);
269 return target_dex_file_;
270 }
271
272 size_t TargetDexCacheElementOffset() const {
273 DCHECK(patch_type_ == kLinkerPatchDexCacheArray);
274 return element_offset_;
275 }
276
277 uint32_t PcInsnOffset() const {
278 DCHECK(patch_type_ == kLinkerPatchDexCacheArray);
279 return pc_insn_offset_;
Vladimir Markof4da6752014-08-01 19:04:18 +0100280 }
281
282 private:
Vladimir Marko20f85592015-03-19 10:07:02 +0000283 LinkerPatch(size_t literal_offset, LinkerPatchType patch_type, const DexFile* target_dex_file)
284 : target_dex_file_(target_dex_file),
285 literal_offset_(literal_offset),
286 patch_type_(patch_type) {
287 cmp1_ = 0u;
288 cmp2_ = 0u;
289 // The compiler rejects methods that are too big, so the compiled code
290 // of a single method really shouln't be anywhere close to 16MiB.
291 DCHECK(IsUint<24>(literal_offset));
Vladimir Markof4da6752014-08-01 19:04:18 +0100292 }
293
Vladimir Markof4da6752014-08-01 19:04:18 +0100294 const DexFile* target_dex_file_;
Vladimir Marko20f85592015-03-19 10:07:02 +0000295 uint32_t literal_offset_ : 24; // Method code size up to 16MiB.
296 LinkerPatchType patch_type_ : 8;
297 union {
298 uint32_t cmp1_; // Used for relational operators.
299 uint32_t method_idx_; // Method index for Call/Method patches.
300 uint32_t type_idx_; // Type index for Type patches.
301 uint32_t element_offset_; // Element offset in the dex cache arrays.
302 };
303 union {
304 uint32_t cmp2_; // Used for relational operators.
305 // Literal offset of the insn loading PC (same as literal_offset if it's the same insn,
306 // may be different if the PC-relative addressing needs multiple insns).
307 uint32_t pc_insn_offset_;
308 static_assert(sizeof(pc_insn_offset_) == sizeof(cmp2_), "needed by relational operators");
309 };
Vladimir Markof4da6752014-08-01 19:04:18 +0100310
311 friend bool operator==(const LinkerPatch& lhs, const LinkerPatch& rhs);
312 friend bool operator<(const LinkerPatch& lhs, const LinkerPatch& rhs);
313};
314
315inline bool operator==(const LinkerPatch& lhs, const LinkerPatch& rhs) {
316 return lhs.literal_offset_ == rhs.literal_offset_ &&
317 lhs.patch_type_ == rhs.patch_type_ &&
Vladimir Marko20f85592015-03-19 10:07:02 +0000318 lhs.target_dex_file_ == rhs.target_dex_file_ &&
319 lhs.cmp1_ == rhs.cmp1_ &&
320 lhs.cmp2_ == rhs.cmp2_;
Vladimir Markof4da6752014-08-01 19:04:18 +0100321}
322
323inline bool operator<(const LinkerPatch& lhs, const LinkerPatch& rhs) {
324 return (lhs.literal_offset_ != rhs.literal_offset_) ? lhs.literal_offset_ < rhs.literal_offset_
325 : (lhs.patch_type_ != rhs.patch_type_) ? lhs.patch_type_ < rhs.patch_type_
Vladimir Marko20f85592015-03-19 10:07:02 +0000326 : (lhs.target_dex_file_ != rhs.target_dex_file_) ? lhs.target_dex_file_ < rhs.target_dex_file_
327 : (lhs.cmp1_ != rhs.cmp1_) ? lhs.cmp1_ < rhs.cmp1_
328 : lhs.cmp2_ < rhs.cmp2_;
Vladimir Markof4da6752014-08-01 19:04:18 +0100329}
330
Yevgeny Roubane3ea8382014-08-08 16:29:38 +0700331class CompiledMethod FINAL : public CompiledCode {
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700332 public:
Andreas Gampee21dc3d2014-12-08 16:59:43 -0800333 // Constructs a CompiledMethod.
334 // Note: Consider using the static allocation methods below that will allocate the CompiledMethod
335 // in the swap space.
Ian Rogers72d32622014-05-06 16:20:11 -0700336 CompiledMethod(CompilerDriver* driver,
Mathieu Chartier193bad92013-08-29 18:46:00 -0700337 InstructionSet instruction_set,
Andreas Gampee21dc3d2014-12-08 16:59:43 -0800338 const ArrayRef<const uint8_t>& quick_code,
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700339 const size_t frame_size_in_bytes,
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700340 const uint32_t core_spill_mask,
341 const uint32_t fp_spill_mask,
Andreas Gampee21dc3d2014-12-08 16:59:43 -0800342 DefaultSrcMap* src_mapping_table,
343 const ArrayRef<const uint8_t>& mapping_table,
344 const ArrayRef<const uint8_t>& vmap_table,
345 const ArrayRef<const uint8_t>& native_gc_map,
346 const ArrayRef<const uint8_t>& cfi_info,
Vladimir Markof4da6752014-08-01 19:04:18 +0100347 const ArrayRef<LinkerPatch>& patches = ArrayRef<LinkerPatch>());
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700348
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800349 virtual ~CompiledMethod();
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700350
Andreas Gampee21dc3d2014-12-08 16:59:43 -0800351 static CompiledMethod* SwapAllocCompiledMethod(
352 CompilerDriver* driver,
353 InstructionSet instruction_set,
354 const ArrayRef<const uint8_t>& quick_code,
355 const size_t frame_size_in_bytes,
356 const uint32_t core_spill_mask,
357 const uint32_t fp_spill_mask,
358 DefaultSrcMap* src_mapping_table,
359 const ArrayRef<const uint8_t>& mapping_table,
360 const ArrayRef<const uint8_t>& vmap_table,
361 const ArrayRef<const uint8_t>& native_gc_map,
362 const ArrayRef<const uint8_t>& cfi_info,
363 const ArrayRef<LinkerPatch>& patches = ArrayRef<LinkerPatch>());
364
365 static CompiledMethod* SwapAllocCompiledMethodStackMap(
366 CompilerDriver* driver,
367 InstructionSet instruction_set,
368 const ArrayRef<const uint8_t>& quick_code,
369 const size_t frame_size_in_bytes,
370 const uint32_t core_spill_mask,
371 const uint32_t fp_spill_mask,
372 const ArrayRef<const uint8_t>& stack_map);
373
374 static CompiledMethod* SwapAllocCompiledMethodCFI(CompilerDriver* driver,
375 InstructionSet instruction_set,
376 const ArrayRef<const uint8_t>& quick_code,
377 const size_t frame_size_in_bytes,
378 const uint32_t core_spill_mask,
379 const uint32_t fp_spill_mask,
380 const ArrayRef<const uint8_t>& cfi_info);
381
382 static void ReleaseSwapAllocatedCompiledMethod(CompilerDriver* driver, CompiledMethod* m);
383
Ian Rogers0c7abda2012-09-19 13:33:42 -0700384 size_t GetFrameSizeInBytes() const {
385 return frame_size_in_bytes_;
Logan Chien110bcba2012-04-16 19:11:28 +0800386 }
Ian Rogers0c7abda2012-09-19 13:33:42 -0700387
388 uint32_t GetCoreSpillMask() const {
389 return core_spill_mask_;
390 }
391
392 uint32_t GetFpSpillMask() const {
393 return fp_spill_mask_;
394 }
395
Andreas Gampee21dc3d2014-12-08 16:59:43 -0800396 const SwapSrcMap& GetSrcMappingTable() const {
Yevgeny Roubane3ea8382014-08-08 16:29:38 +0700397 DCHECK(src_mapping_table_ != nullptr);
398 return *src_mapping_table_;
399 }
400
Andreas Gampee21dc3d2014-12-08 16:59:43 -0800401 SwapVector<uint8_t> const* GetMappingTable() const {
Nicolas Geoffray376b2bb2014-12-09 14:26:32 +0000402 return mapping_table_;
Ian Rogers0c7abda2012-09-19 13:33:42 -0700403 }
404
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800405 const SwapVector<uint8_t>* GetVmapTable() const {
Mathieu Chartier193bad92013-08-29 18:46:00 -0700406 DCHECK(vmap_table_ != nullptr);
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800407 return vmap_table_;
Ian Rogers0c7abda2012-09-19 13:33:42 -0700408 }
409
Andreas Gampee21dc3d2014-12-08 16:59:43 -0800410 SwapVector<uint8_t> const* GetGcMap() const {
Nicolas Geoffray39468442014-09-02 15:17:15 +0100411 return gc_map_;
Ian Rogers0c7abda2012-09-19 13:33:42 -0700412 }
Logan Chien110bcba2012-04-16 19:11:28 +0800413
Andreas Gampee21dc3d2014-12-08 16:59:43 -0800414 const SwapVector<uint8_t>* GetCFIInfo() const {
Mark Mendellae9fd932014-02-10 16:14:35 -0800415 return cfi_info_;
416 }
417
Andreas Gampee21dc3d2014-12-08 16:59:43 -0800418 const SwapVector<LinkerPatch>& GetPatches() const {
Vladimir Markof4da6752014-08-01 19:04:18 +0100419 return patches_;
420 }
421
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700422 private:
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800423 // Whether or not the arrays are owned by the compiled method or dedupe sets.
424 const bool owns_arrays_;
Ian Rogersa1827042013-04-18 16:36:43 -0700425 // For quick code, the size of the activation used by the code.
Ian Rogers0c7abda2012-09-19 13:33:42 -0700426 const size_t frame_size_in_bytes_;
Ian Rogersa1827042013-04-18 16:36:43 -0700427 // For quick code, a bit mask describing spilled GPR callee-save registers.
Ian Rogers169c9a72011-11-13 20:13:17 -0800428 const uint32_t core_spill_mask_;
Ian Rogersa1827042013-04-18 16:36:43 -0700429 // For quick code, a bit mask describing spilled FPR callee-save registers.
Ian Rogers169c9a72011-11-13 20:13:17 -0800430 const uint32_t fp_spill_mask_;
Yevgeny Roubane3ea8382014-08-08 16:29:38 +0700431 // For quick code, a set of pairs (PC, Line) mapping from native PC offset to Java line
Andreas Gampee21dc3d2014-12-08 16:59:43 -0800432 SwapSrcMap* src_mapping_table_;
Ian Rogers96faf5b2013-08-09 22:05:32 -0700433 // For quick code, a uleb128 encoded map from native PC offset to dex PC aswell as dex PC to
434 // native PC offset. Size prefixed.
Andreas Gampee21dc3d2014-12-08 16:59:43 -0800435 SwapVector<uint8_t>* mapping_table_;
Ian Rogers96faf5b2013-08-09 22:05:32 -0700436 // For quick code, a uleb128 encoded map from GPR/FPR register to dex register. Size prefixed.
Andreas Gampee21dc3d2014-12-08 16:59:43 -0800437 SwapVector<uint8_t>* vmap_table_;
Ian Rogersa1827042013-04-18 16:36:43 -0700438 // For quick code, a map keyed by native PC indices to bitmaps describing what dalvik registers
Elliott Hughes956af0f2014-12-11 14:34:28 -0800439 // are live.
Andreas Gampee21dc3d2014-12-08 16:59:43 -0800440 SwapVector<uint8_t>* gc_map_;
Mark Mendellae9fd932014-02-10 16:14:35 -0800441 // For quick code, a FDE entry for the debug_frame section.
Andreas Gampee21dc3d2014-12-08 16:59:43 -0800442 SwapVector<uint8_t>* cfi_info_;
Vladimir Markof4da6752014-08-01 19:04:18 +0100443 // For quick code, linker patches needed by the method.
Andreas Gampee21dc3d2014-12-08 16:59:43 -0800444 SwapVector<LinkerPatch> patches_;
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700445};
446
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700447} // namespace art
448
Mathieu Chartier193bad92013-08-29 18:46:00 -0700449#endif // ART_COMPILER_COMPILED_METHOD_H_