blob: 71044f7b6e7fedcc69d5658106f0ea1c8ccc0637 [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_IMAGE_WRITER_H_
18#define ART_COMPILER_IMAGE_WRITER_H_
Brian Carlstrom7940e442013-07-12 13:46:57 -070019
20#include <stdint.h>
Andreas Gampe245ee002014-12-04 21:25:04 -080021#include <valgrind.h>
Brian Carlstrom7940e442013-07-12 13:46:57 -070022
23#include <cstddef>
Ian Rogers700a4022014-05-19 16:49:03 -070024#include <memory>
Brian Carlstrom7940e442013-07-12 13:46:57 -070025#include <set>
26#include <string>
Igor Murashkinf5b4c502014-11-14 15:01:59 -080027#include <ostream>
Brian Carlstrom7940e442013-07-12 13:46:57 -070028
Igor Murashkin46774762014-10-22 11:37:02 -070029#include "base/macros.h"
Brian Carlstrom7940e442013-07-12 13:46:57 -070030#include "driver/compiler_driver.h"
Mathieu Chartierfd04b6f2014-11-14 19:34:18 -080031#include "gc/space/space.h"
Brian Carlstrom7940e442013-07-12 13:46:57 -070032#include "mem_map.h"
33#include "oat_file.h"
34#include "mirror/dex_cache.h"
35#include "os.h"
36#include "safe_map.h"
Igor Murashkinf5b4c502014-11-14 15:01:59 -080037#include "gc/space/space.h"
38#include "utils.h"
Brian Carlstrom7940e442013-07-12 13:46:57 -070039
40namespace art {
41
42// Write a Space built during compilation for use during execution.
Igor Murashkin46774762014-10-22 11:37:02 -070043class ImageWriter FINAL {
Brian Carlstrom7940e442013-07-12 13:46:57 -070044 public:
Igor Murashkin46774762014-10-22 11:37:02 -070045 ImageWriter(const CompilerDriver& compiler_driver, uintptr_t image_begin,
46 bool compile_pic)
Ian Rogers13735952014-10-08 12:43:28 -070047 : compiler_driver_(compiler_driver), image_begin_(reinterpret_cast<uint8_t*>(image_begin)),
Igor Murashkinf5b4c502014-11-14 15:01:59 -080048 image_end_(0), image_objects_offset_begin_(0), image_roots_address_(0), oat_file_(nullptr),
Igor Murashkin46774762014-10-22 11:37:02 -070049 oat_data_begin_(nullptr), interpreter_to_interpreter_bridge_offset_(0),
Vladimir Markof4da6752014-08-01 19:04:18 +010050 interpreter_to_compiled_code_bridge_offset_(0), jni_dlsym_lookup_offset_(0),
Elliott Hughes956af0f2014-12-11 14:34:28 -080051 quick_generic_jni_trampoline_offset_(0),
Vladimir Markof4da6752014-08-01 19:04:18 +010052 quick_imt_conflict_trampoline_offset_(0), quick_resolution_trampoline_offset_(0),
Mathieu Chartier2d721012014-11-10 11:08:06 -080053 quick_to_interpreter_bridge_offset_(0), compile_pic_(compile_pic),
Igor Murashkinf5b4c502014-11-14 15:01:59 -080054 target_ptr_size_(InstructionSetPointerSize(compiler_driver_.GetInstructionSet())),
Vladimir Marko20f85592015-03-19 10:07:02 +000055 bin_slot_sizes_(), bin_slot_previous_sizes_(), bin_slot_count_(),
56 string_data_array_(nullptr) {
Vladimir Markof4da6752014-08-01 19:04:18 +010057 CHECK_NE(image_begin, 0U);
58 }
Brian Carlstrom7940e442013-07-12 13:46:57 -070059
Andreas Gampe245ee002014-12-04 21:25:04 -080060 ~ImageWriter() {
61 // For interned strings a large array is allocated to hold all the character data and avoid
62 // overhead. However, no GC is run anymore at this point. As the array is likely large, it
63 // will be allocated in the large object space, where valgrind can track every single
64 // allocation. Not explicitly freeing that array will be recognized as a leak.
65 if (RUNNING_ON_VALGRIND != 0) {
66 FreeStringDataArray();
67 }
68 }
Brian Carlstrom7940e442013-07-12 13:46:57 -070069
Vladimir Markof4da6752014-08-01 19:04:18 +010070 bool PrepareImageAddressSpace();
71
72 bool IsImageAddressSpaceReady() const {
73 return image_roots_address_ != 0u;
74 }
75
76 mirror::Object* GetImageAddress(mirror::Object* object) const
77 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Igor Murashkin46774762014-10-22 11:37:02 -070078 if (object == nullptr) {
79 return nullptr;
Vladimir Markof4da6752014-08-01 19:04:18 +010080 }
81 return reinterpret_cast<mirror::Object*>(image_begin_ + GetImageOffset(object));
82 }
83
Vladimir Marko20f85592015-03-19 10:07:02 +000084 mirror::HeapReference<mirror::Object>* GetDexCacheArrayElementImageAddress(
85 const DexFile* dex_file, uint32_t offset) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
86 auto it = dex_cache_array_starts_.find(dex_file);
87 DCHECK(it != dex_cache_array_starts_.end());
88 return reinterpret_cast<mirror::HeapReference<mirror::Object>*>(
89 image_begin_ + RoundUp(sizeof(ImageHeader), kObjectAlignment) + it->second + offset);
90 }
91
Ian Rogers13735952014-10-08 12:43:28 -070092 uint8_t* GetOatFileBegin() const {
Vladimir Markof4da6752014-08-01 19:04:18 +010093 return image_begin_ + RoundUp(image_end_, kPageSize);
94 }
95
Brian Carlstrom7940e442013-07-12 13:46:57 -070096 bool Write(const std::string& image_filename,
Brian Carlstrom7940e442013-07-12 13:46:57 -070097 const std::string& oat_filename,
98 const std::string& oat_location)
99 LOCKS_EXCLUDED(Locks::mutator_lock_);
100
101 uintptr_t GetOatDataBegin() {
102 return reinterpret_cast<uintptr_t>(oat_data_begin_);
103 }
104
105 private:
106 bool AllocMemory();
107
Mathieu Chartier31e89252013-08-28 11:29:12 -0700108 // Mark the objects defined in this space in the given live bitmap.
109 void RecordImageAllocations() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
110
Igor Murashkinf5b4c502014-11-14 15:01:59 -0800111 // Classify different kinds of bins that objects end up getting packed into during image writing.
112 enum Bin {
Vladimir Marko20f85592015-03-19 10:07:02 +0000113 // Dex cache arrays have a special slot for PC-relative addressing. Since they are
114 // huge, and as such their dirtiness is not important for the clean/dirty separation,
115 // we arbitrarily keep them at the beginning.
116 kBinDexCacheArray, // Object arrays belonging to dex cache.
Igor Murashkinf5b4c502014-11-14 15:01:59 -0800117 // Likely-clean:
118 kBinString, // [String] Almost always immutable (except for obj header).
119 kBinArtMethodsManagedInitialized, // [ArtMethod] Not-native, and initialized. Unlikely to dirty
120 // Unknown mix of clean/dirty:
121 kBinRegular,
122 // Likely-dirty:
123 // All classes get their own bins since their fields often dirty
124 kBinClassInitializedFinalStatics, // Class initializers have been run, no non-final statics
125 kBinClassInitialized, // Class initializers have been run
126 kBinClassVerified, // Class verified, but initializers haven't been run
127 kBinArtMethodNative, // Art method that is actually native
128 kBinArtMethodNotInitialized, // Art method with a declaring class that wasn't initialized
Igor Murashkinf5b4c502014-11-14 15:01:59 -0800129 // Add more bins here if we add more segregation code.
130 kBinSize,
131 };
132
133 friend std::ostream& operator<<(std::ostream& stream, const Bin& bin);
134
135 static constexpr size_t kBinBits = MinimumBitsToStore(kBinSize - 1);
136 // uint32 = typeof(lockword_)
137 static constexpr size_t kBinShift = BitSizeOf<uint32_t>() - kBinBits;
138 // 111000.....0
139 static constexpr size_t kBinMask = ((static_cast<size_t>(1) << kBinBits) - 1) << kBinShift;
140
141 // We use the lock word to store the bin # and bin index of the object in the image.
142 //
143 // The struct size must be exactly sizeof(LockWord), currently 32-bits, since this will end up
144 // stored in the lock word bit-for-bit when object forwarding addresses are being calculated.
145 struct BinSlot {
146 explicit BinSlot(uint32_t lockword);
147 BinSlot(Bin bin, uint32_t index);
148
149 // The bin an object belongs to, i.e. regular, class/verified, class/initialized, etc.
150 Bin GetBin() const;
151 // The offset in bytes from the beginning of the bin. Aligned to object size.
152 uint32_t GetIndex() const;
153 // Pack into a single uint32_t, for storing into a lock word.
154 explicit operator uint32_t() const { return lockword_; }
155 // Comparison operator for map support
156 bool operator<(const BinSlot& other) const { return lockword_ < other.lockword_; }
157
158 private:
159 // Must be the same size as LockWord, any larger and we would truncate the data.
160 const uint32_t lockword_;
161 };
162
Mathieu Chartier31e89252013-08-28 11:29:12 -0700163 // We use the lock word to store the offset of the object in the image.
Igor Murashkinf5b4c502014-11-14 15:01:59 -0800164 void AssignImageOffset(mirror::Object* object, BinSlot bin_slot)
165 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
166 void SetImageOffset(mirror::Object* object, BinSlot bin_slot, size_t offset)
Mathieu Chartier590fee92013-09-13 13:46:47 -0700167 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700168 bool IsImageOffsetAssigned(mirror::Object* object) const
169 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
170 size_t GetImageOffset(mirror::Object* object) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstrom7940e442013-07-12 13:46:57 -0700171
Vladimir Marko20f85592015-03-19 10:07:02 +0000172 void PrepareDexCacheArraySlots() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Igor Murashkinf5b4c502014-11-14 15:01:59 -0800173 void AssignImageBinSlot(mirror::Object* object) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
174 void SetImageBinSlot(mirror::Object* object, BinSlot bin_slot)
175 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
176 bool IsImageBinSlotAssigned(mirror::Object* object) const
177 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
178 BinSlot GetImageBinSlot(mirror::Object* object) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
179
Alex Lighta59dd802014-07-02 16:28:08 -0700180 static void* GetImageAddressCallback(void* writer, mirror::Object* obj)
181 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
182 return reinterpret_cast<ImageWriter*>(writer)->GetImageAddress(obj);
183 }
184
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700185 mirror::Object* GetLocalAddress(mirror::Object* object) const
186 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Brian Carlstrom7940e442013-07-12 13:46:57 -0700187 size_t offset = GetImageOffset(object);
Ian Rogers13735952014-10-08 12:43:28 -0700188 uint8_t* dst = image_->Begin() + offset;
Brian Carlstrom7940e442013-07-12 13:46:57 -0700189 return reinterpret_cast<mirror::Object*>(dst);
190 }
191
Ian Rogers13735952014-10-08 12:43:28 -0700192 const uint8_t* GetOatAddress(uint32_t offset) const {
Brian Carlstrom7940e442013-07-12 13:46:57 -0700193 // With Quick, code is within the OatFile, as there are all in one
Elliott Hughes956af0f2014-12-11 14:34:28 -0800194 // .o ELF object.
Brian Carlstrom7940e442013-07-12 13:46:57 -0700195 DCHECK_LT(offset, oat_file_->Size());
Igor Murashkin46774762014-10-22 11:37:02 -0700196 if (offset == 0u) {
197 return nullptr;
Brian Carlstrom7940e442013-07-12 13:46:57 -0700198 }
199 return oat_data_begin_ + offset;
200 }
201
202 // Returns true if the class was in the original requested image classes list.
Ian Rogersef7d42f2014-01-06 12:55:46 -0800203 bool IsImageClass(mirror::Class* klass) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstrom7940e442013-07-12 13:46:57 -0700204
205 // Debug aid that list of requested image classes.
206 void DumpImageClasses();
207
208 // Preinitializes some otherwise lazy fields (such as Class name) to avoid runtime image dirtying.
209 void ComputeLazyFieldsForImageClasses()
210 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
211 static bool ComputeLazyFieldsForClassesVisitor(mirror::Class* klass, void* arg)
212 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
213
214 // Wire dex cache resolved strings to strings in the image to avoid runtime resolution.
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700215 void ComputeEagerResolvedStrings() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstrom7940e442013-07-12 13:46:57 -0700216 static void ComputeEagerResolvedStringsCallback(mirror::Object* obj, void* arg)
217 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
218
Mathieu Chartierfd04b6f2014-11-14 19:34:18 -0800219 // Combine string char arrays.
220 void ProcessStrings() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
221
Brian Carlstrom7940e442013-07-12 13:46:57 -0700222 // Remove unwanted classes from various roots.
223 void PruneNonImageClasses() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
224 static bool NonImageClassesVisitor(mirror::Class* c, void* arg)
225 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
226
227 // Verify unwanted classes removed.
Mathieu Chartierfd04b6f2014-11-14 19:34:18 -0800228 void CheckNonImageClassesRemoved() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstrom7940e442013-07-12 13:46:57 -0700229 static void CheckNonImageClassesRemovedCallback(mirror::Object* obj, void* arg)
230 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
231
232 // Lays out where the image objects will be at runtime.
Vladimir Markof4da6752014-08-01 19:04:18 +0100233 void CalculateNewObjectOffsets()
234 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
235 void CreateHeader(size_t oat_loaded_size, size_t oat_data_offset)
Brian Carlstrom7940e442013-07-12 13:46:57 -0700236 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
237 mirror::ObjectArray<mirror::Object>* CreateImageRoots() const
238 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Igor Murashkinf5b4c502014-11-14 15:01:59 -0800239 void CalculateObjectBinSlots(mirror::Object* obj)
240 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
241 void UnbinObjectsIntoOffset(mirror::Object* obj)
Mathieu Chartier590fee92013-09-13 13:46:47 -0700242 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
243
244 void WalkInstanceFields(mirror::Object* obj, mirror::Class* klass)
245 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
246 void WalkFieldsInOrder(mirror::Object* obj)
247 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
248 static void WalkFieldsCallback(mirror::Object* obj, void* arg)
Brian Carlstrom7940e442013-07-12 13:46:57 -0700249 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Igor Murashkinf5b4c502014-11-14 15:01:59 -0800250 static void UnbinObjectsIntoOffsetCallback(mirror::Object* obj, void* arg)
251 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstrom7940e442013-07-12 13:46:57 -0700252
253 // Creates the contiguous image in memory and adjusts pointers.
Mathieu Chartierfd04b6f2014-11-14 19:34:18 -0800254 void CopyAndFixupObjects() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstrom7940e442013-07-12 13:46:57 -0700255 static void CopyAndFixupObjectsCallback(mirror::Object* obj, void* arg)
256 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogersef7d42f2014-01-06 12:55:46 -0800257 void FixupMethod(mirror::ArtMethod* orig, mirror::ArtMethod* copy)
Brian Carlstrom7940e442013-07-12 13:46:57 -0700258 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogersef7d42f2014-01-06 12:55:46 -0800259 void FixupObject(mirror::Object* orig, mirror::Object* copy)
Brian Carlstrom7940e442013-07-12 13:46:57 -0700260 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstrom7940e442013-07-12 13:46:57 -0700261
Mingyao Yang98d1cc82014-05-15 17:02:16 -0700262 // Get quick code for non-resolution/imt_conflict/abstract method.
Ian Rogers13735952014-10-08 12:43:28 -0700263 const uint8_t* GetQuickCode(mirror::ArtMethod* method, bool* quick_is_interpreted)
Mingyao Yang98d1cc82014-05-15 17:02:16 -0700264 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
265
Ian Rogers13735952014-10-08 12:43:28 -0700266 const uint8_t* GetQuickEntryPoint(mirror::ArtMethod* method)
Mingyao Yang98d1cc82014-05-15 17:02:16 -0700267 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
268
Brian Carlstrom7940e442013-07-12 13:46:57 -0700269 // Patches references in OatFile to expect runtime addresses.
Vladimir Markof4da6752014-08-01 19:04:18 +0100270 void SetOatChecksumFromElfFile(File* elf_file);
Brian Carlstrom7940e442013-07-12 13:46:57 -0700271
Igor Murashkinf5b4c502014-11-14 15:01:59 -0800272 // Calculate the sum total of the bin slot sizes in [0, up_to). Defaults to all bins.
273 size_t GetBinSizeSum(Bin up_to = kBinSize) const;
274
Andreas Gampe245ee002014-12-04 21:25:04 -0800275 // Release the string_data_array_.
276 void FreeStringDataArray();
277
Brian Carlstrom7940e442013-07-12 13:46:57 -0700278 const CompilerDriver& compiler_driver_;
279
Vladimir Markof4da6752014-08-01 19:04:18 +0100280 // Beginning target image address for the output image.
Ian Rogers13735952014-10-08 12:43:28 -0700281 uint8_t* image_begin_;
Vladimir Markof4da6752014-08-01 19:04:18 +0100282
283 // Offset to the free space in image_.
284 size_t image_end_;
285
Igor Murashkinf5b4c502014-11-14 15:01:59 -0800286 // Offset from image_begin_ to where the first object is in image_.
287 size_t image_objects_offset_begin_;
288
Vladimir Markof4da6752014-08-01 19:04:18 +0100289 // The image roots address in the image.
290 uint32_t image_roots_address_;
291
Brian Carlstrom7940e442013-07-12 13:46:57 -0700292 // oat file with code for this image
293 OatFile* oat_file_;
294
295 // Memory mapped for generating the image.
Ian Rogers700a4022014-05-19 16:49:03 -0700296 std::unique_ptr<MemMap> image_;
Brian Carlstrom7940e442013-07-12 13:46:57 -0700297
Vladimir Marko20f85592015-03-19 10:07:02 +0000298 // Indexes for dex cache arrays (objects are inside of the image so that they don't move).
299 SafeMap<mirror::Object*, size_t> dex_cache_array_indexes_;
300
301 // The start offsets of the dex cache arrays.
302 SafeMap<const DexFile*, size_t> dex_cache_array_starts_;
303
Mathieu Chartier590fee92013-09-13 13:46:47 -0700304 // Saved hashes (objects are inside of the image so that they don't move).
Ian Rogers700a4022014-05-19 16:49:03 -0700305 std::vector<std::pair<mirror::Object*, uint32_t>> saved_hashes_;
Mathieu Chartier590fee92013-09-13 13:46:47 -0700306
Igor Murashkinf5b4c502014-11-14 15:01:59 -0800307 // Saved hashes (objects are bin slots to inside of the image, not yet allocated an address).
308 std::map<BinSlot, uint32_t> saved_hashes_map_;
309
Brian Carlstrom7940e442013-07-12 13:46:57 -0700310 // Beginning target oat address for the pointers from the output image to its oat file.
Ian Rogers13735952014-10-08 12:43:28 -0700311 const uint8_t* oat_data_begin_;
Brian Carlstrom7940e442013-07-12 13:46:57 -0700312
Mathieu Chartier31e89252013-08-28 11:29:12 -0700313 // Image bitmap which lets us know where the objects inside of the image reside.
Ian Rogers700a4022014-05-19 16:49:03 -0700314 std::unique_ptr<gc::accounting::ContinuousSpaceBitmap> image_bitmap_;
Mathieu Chartier31e89252013-08-28 11:29:12 -0700315
Brian Carlstrom7940e442013-07-12 13:46:57 -0700316 // Offset from oat_data_begin_ to the stubs.
Ian Rogers848871b2013-08-05 10:56:33 -0700317 uint32_t interpreter_to_interpreter_bridge_offset_;
318 uint32_t interpreter_to_compiled_code_bridge_offset_;
319 uint32_t jni_dlsym_lookup_offset_;
Andreas Gampe2da88232014-02-27 12:26:20 -0800320 uint32_t quick_generic_jni_trampoline_offset_;
Jeff Hao88474b42013-10-23 16:24:40 -0700321 uint32_t quick_imt_conflict_trampoline_offset_;
Brian Carlstrom7940e442013-07-12 13:46:57 -0700322 uint32_t quick_resolution_trampoline_offset_;
Ian Rogers848871b2013-08-05 10:56:33 -0700323 uint32_t quick_to_interpreter_bridge_offset_;
Igor Murashkin46774762014-10-22 11:37:02 -0700324 const bool compile_pic_;
Mathieu Chartierb7ea3ac2014-03-24 16:54:46 -0700325
Mathieu Chartier2d721012014-11-10 11:08:06 -0800326 // Size of pointers on the target architecture.
327 size_t target_ptr_size_;
328
Igor Murashkinf5b4c502014-11-14 15:01:59 -0800329 // Bin slot tracking for dirty object packing
330 size_t bin_slot_sizes_[kBinSize]; // Number of bytes in a bin
Vladimir Marko20f85592015-03-19 10:07:02 +0000331 size_t bin_slot_previous_sizes_[kBinSize]; // Number of bytes in previous bins.
Igor Murashkinf5b4c502014-11-14 15:01:59 -0800332 size_t bin_slot_count_[kBinSize]; // Number of objects in a bin
333
Andreas Gampe245ee002014-12-04 21:25:04 -0800334 void* string_data_array_; // The backing for the interned strings.
335
Mathieu Chartierb7ea3ac2014-03-24 16:54:46 -0700336 friend class FixupVisitor;
Mingyao Yang98d1cc82014-05-15 17:02:16 -0700337 friend class FixupClassVisitor;
Mathieu Chartierb7ea3ac2014-03-24 16:54:46 -0700338 DISALLOW_COPY_AND_ASSIGN(ImageWriter);
Brian Carlstrom7940e442013-07-12 13:46:57 -0700339};
340
341} // namespace art
342
Brian Carlstromfc0e3212013-07-17 14:40:12 -0700343#endif // ART_COMPILER_IMAGE_WRITER_H_