blob: df81df8a963d859bd8b8abdb31d32ebfe8501677 [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 Carlstrome24fa612011-09-29 00:53:55 -070016
17#include "oat_file.h"
18
19#include <sys/mman.h>
20
21#include "file.h"
22#include "os.h"
23#include "stl_util.h"
24
25namespace art {
26
jeffhao262bf462011-10-20 18:36:32 -070027std::string OatFile::DexFilenameToOatFilename(const std::string& location) {
jeffhao262bf462011-10-20 18:36:32 -070028 CHECK(IsValidDexFilename(location) || IsValidZipFilename(location));
Brian Carlstroma6cc8932012-01-04 14:44:07 -080029 std::string oat_location(location);
30 oat_location += ".oat";
jeffhao262bf462011-10-20 18:36:32 -070031 return oat_location;
Brian Carlstromb7bbba42011-10-13 14:58:47 -070032}
33
Brian Carlstrome24fa612011-09-29 00:53:55 -070034OatFile* OatFile::Open(const std::string& filename,
Brian Carlstroma004aa92012-02-08 18:05:09 -080035 const std::string& location,
Brian Carlstromf5822582012-03-19 22:34:31 -070036 byte* requested_base,
37 bool writable) {
Brian Carlstroma004aa92012-02-08 18:05:09 -080038 CHECK(!location.empty()) << filename;
Brian Carlstromf5822582012-03-19 22:34:31 -070039 UniquePtr<File> file(OS::OpenFile(filename.c_str(), writable, false));
Brian Carlstrom5b332c82012-02-01 15:02:31 -080040 if (file.get() == NULL) {
Brian Carlstromf5822582012-03-19 22:34:31 -070041 return NULL;
Brian Carlstrom5b332c82012-02-01 15:02:31 -080042 }
Brian Carlstromf5822582012-03-19 22:34:31 -070043 return Open(*file.get(), location, requested_base, writable);
Brian Carlstrom5b332c82012-02-01 15:02:31 -080044}
Brian Carlstrome24fa612011-09-29 00:53:55 -070045
Brian Carlstrom5b332c82012-02-01 15:02:31 -080046OatFile* OatFile::Open(File& file,
47 const std::string& location,
Brian Carlstromf5822582012-03-19 22:34:31 -070048 byte* requested_base,
49 bool writable) {
Brian Carlstrom5b332c82012-02-01 15:02:31 -080050 UniquePtr<OatFile> oat_file(new OatFile(location));
Brian Carlstromf5822582012-03-19 22:34:31 -070051 bool success = oat_file->Map(file, requested_base, writable);
Brian Carlstrome24fa612011-09-29 00:53:55 -070052 if (!success) {
53 return NULL;
54 }
55 return oat_file.release();
56}
57
Brian Carlstroma004aa92012-02-08 18:05:09 -080058OatFile::OatFile(const std::string& location) : location_(location) {
59 CHECK(!location_.empty());
60}
Brian Carlstrome24fa612011-09-29 00:53:55 -070061
62OatFile::~OatFile() {
63 STLDeleteValues(&oat_dex_files_);
Logan Chien0cc6ab62012-03-20 22:57:52 +080064 STLDeleteElements(&oat_elf_images_);
Brian Carlstrome24fa612011-09-29 00:53:55 -070065}
66
Brian Carlstromf5822582012-03-19 22:34:31 -070067bool OatFile::Map(File& file, byte* requested_base, bool writable) {
Brian Carlstrome24fa612011-09-29 00:53:55 -070068 OatHeader oat_header;
Brian Carlstrom5b332c82012-02-01 15:02:31 -080069 bool success = file.ReadFully(&oat_header, sizeof(oat_header));
Brian Carlstrome24fa612011-09-29 00:53:55 -070070 if (!success || !oat_header.IsValid()) {
Brian Carlstrom5b332c82012-02-01 15:02:31 -080071 LOG(WARNING) << "Invalid oat header " << GetLocation();
Brian Carlstrome24fa612011-09-29 00:53:55 -070072 return false;
73 }
74
Brian Carlstromf5822582012-03-19 22:34:31 -070075 int flags = 0;
76 int prot = 0;
77 if (writable) {
78 flags |= MAP_SHARED; // So changes will write through to file
79 prot |= (PROT_READ | PROT_WRITE);
80 } else {
81 flags |= MAP_PRIVATE;
82 prot |= PROT_READ;
83 }
84 if (requested_base != NULL) {
85 flags |= MAP_FIXED;
86 }
Brian Carlstrom89521892011-12-07 22:05:07 -080087 UniquePtr<MemMap> map(MemMap::MapFileAtAddress(requested_base,
Brian Carlstrom5b332c82012-02-01 15:02:31 -080088 file.Length(),
Brian Carlstromf5822582012-03-19 22:34:31 -070089 prot,
Brian Carlstrom89521892011-12-07 22:05:07 -080090 flags,
Brian Carlstrom5b332c82012-02-01 15:02:31 -080091 file.Fd(),
Brian Carlstrom89521892011-12-07 22:05:07 -080092 0));
Brian Carlstrome24fa612011-09-29 00:53:55 -070093 if (map.get() == NULL) {
Brian Carlstrom5b332c82012-02-01 15:02:31 -080094 LOG(WARNING) << "Failed to map oat file " << GetLocation();
Brian Carlstrome24fa612011-09-29 00:53:55 -070095 return false;
96 }
Ian Rogers30fab402012-01-23 15:43:46 -080097 CHECK(requested_base == 0 || requested_base == map->Begin())
Brian Carlstromf8bbb842012-03-14 03:01:42 -070098 << GetLocation() << " " << reinterpret_cast<void*>(map->Begin());
Brian Carlstrom5b332c82012-02-01 15:02:31 -080099 DCHECK_EQ(0, memcmp(&oat_header, map->Begin(), sizeof(OatHeader))) << GetLocation();
Brian Carlstrome24fa612011-09-29 00:53:55 -0700100
Elliott Hughese689d512012-01-18 23:39:47 -0800101 off_t code_offset = oat_header.GetExecutableOffset();
Brian Carlstrom5b332c82012-02-01 15:02:31 -0800102 if (code_offset < file.Length()) {
Ian Rogers30fab402012-01-23 15:43:46 -0800103 byte* code_address = map->Begin() + code_offset;
Brian Carlstrom5b332c82012-02-01 15:02:31 -0800104 size_t code_length = file.Length() - code_offset;
Brian Carlstromf5822582012-03-19 22:34:31 -0700105 if (mprotect(code_address, code_length, prot | PROT_EXEC) != 0) {
Brian Carlstrom5b332c82012-02-01 15:02:31 -0800106 PLOG(ERROR) << "Failed to make oat code executable in " << GetLocation();
Brian Carlstrome24fa612011-09-29 00:53:55 -0700107 return false;
108 }
109 } else {
110 // its possible to have no code if all the methods were abstract, native, etc
Brian Carlstrom5b332c82012-02-01 15:02:31 -0800111 DCHECK_EQ(code_offset, RoundUp(file.Length(), kPageSize)) << GetLocation();
Brian Carlstrome24fa612011-09-29 00:53:55 -0700112 }
113
Ian Rogers30fab402012-01-23 15:43:46 -0800114 const byte* oat = map->Begin();
Brian Carlstrom6e3b1d92012-01-11 01:36:32 -0800115
Brian Carlstrome24fa612011-09-29 00:53:55 -0700116 oat += sizeof(OatHeader);
Brian Carlstrom81f3ca12012-03-17 00:27:35 -0700117 oat += oat_header.GetImageFileLocationSize();
118
119 CHECK_LE(oat, map->End())
120 << reinterpret_cast<void*>(map->Begin())
121 << "+" << sizeof(OatHeader)
122 << "+" << oat_header.GetImageFileLocationSize()
123 << "<=" << reinterpret_cast<void*>(map->End())
124 << " " << GetLocation();
Brian Carlstrome24fa612011-09-29 00:53:55 -0700125 for (size_t i = 0; i < oat_header.GetDexFileCount(); i++) {
126 size_t dex_file_location_size = *reinterpret_cast<const uint32_t*>(oat);
Brian Carlstrom5b332c82012-02-01 15:02:31 -0800127 CHECK_GT(dex_file_location_size, 0U) << GetLocation();
Brian Carlstrome24fa612011-09-29 00:53:55 -0700128 oat += sizeof(dex_file_location_size);
Brian Carlstrom5b332c82012-02-01 15:02:31 -0800129 CHECK_LT(oat, map->End()) << GetLocation();
Brian Carlstrome24fa612011-09-29 00:53:55 -0700130
131 const char* dex_file_location_data = reinterpret_cast<const char*>(oat);
132 oat += dex_file_location_size;
Brian Carlstrom5b332c82012-02-01 15:02:31 -0800133 CHECK_LT(oat, map->End()) << GetLocation();
Brian Carlstrome24fa612011-09-29 00:53:55 -0700134
135 std::string dex_file_location(dex_file_location_data, dex_file_location_size);
136
137 uint32_t dex_file_checksum = *reinterpret_cast<const uint32_t*>(oat);
138 oat += sizeof(dex_file_checksum);
Brian Carlstrom5b332c82012-02-01 15:02:31 -0800139 CHECK_LT(oat, map->End()) << GetLocation();
Brian Carlstrome24fa612011-09-29 00:53:55 -0700140
Brian Carlstrom89521892011-12-07 22:05:07 -0800141 uint32_t dex_file_offset = *reinterpret_cast<const uint32_t*>(oat);
Brian Carlstrom5b332c82012-02-01 15:02:31 -0800142 CHECK_GT(dex_file_offset, 0U) << GetLocation();
143 CHECK_LT(dex_file_offset, static_cast<uint32_t>(file.Length())) << GetLocation();
Brian Carlstrom89521892011-12-07 22:05:07 -0800144 oat += sizeof(dex_file_offset);
Brian Carlstrom5b332c82012-02-01 15:02:31 -0800145 CHECK_LT(oat, map->End()) << GetLocation();
Brian Carlstrom89521892011-12-07 22:05:07 -0800146
Ian Rogers30fab402012-01-23 15:43:46 -0800147 uint8_t* dex_file_pointer = map->Begin() + dex_file_offset;
Brian Carlstrom5b332c82012-02-01 15:02:31 -0800148 CHECK(DexFile::IsMagicValid(dex_file_pointer)) << GetLocation() << " " << dex_file_pointer;
149 CHECK(DexFile::IsVersionValid(dex_file_pointer)) << GetLocation() << " " << dex_file_pointer;
Brian Carlstrom6e3b1d92012-01-11 01:36:32 -0800150 const DexFile::Header* header = reinterpret_cast<const DexFile::Header*>(dex_file_pointer);
151 const uint32_t* methods_offsets_pointer = reinterpret_cast<const uint32_t*>(oat);
Brian Carlstrom89521892011-12-07 22:05:07 -0800152
Brian Carlstrom6e3b1d92012-01-11 01:36:32 -0800153 oat += (sizeof(*methods_offsets_pointer) * header->class_defs_size_);
Brian Carlstrom5b332c82012-02-01 15:02:31 -0800154 CHECK_LE(oat, map->End()) << GetLocation();
Brian Carlstrome24fa612011-09-29 00:53:55 -0700155
156 oat_dex_files_[dex_file_location] = new OatDexFile(this,
157 dex_file_location,
158 dex_file_checksum,
Brian Carlstrom89521892011-12-07 22:05:07 -0800159 dex_file_pointer,
Brian Carlstrom6e3b1d92012-01-11 01:36:32 -0800160 methods_offsets_pointer);
Brian Carlstrome24fa612011-09-29 00:53:55 -0700161 }
162
Logan Chien0cc6ab62012-03-20 22:57:52 +0800163 oat = map->Begin() + oat_header.GetElfImageTableOffset();
164 CHECK((reinterpret_cast<uintptr_t>(oat) & 0x3) == 0);
165
166 for (uint32_t i = 0, end = oat_header.GetElfImageCount(); i < end; ++i) {
167 uint32_t elf_offset = *reinterpret_cast<const uint32_t*>(oat);
168 oat += sizeof(uint32_t);
169
170 uint32_t elf_size = *reinterpret_cast<const uint32_t*>(oat);
171 oat += sizeof(uint32_t);
172
173 oat_elf_images_.push_back(
174 new OatElfImage(this, map->Begin() + elf_offset, elf_size));
175 }
176
Brian Carlstrome24fa612011-09-29 00:53:55 -0700177 mem_map_.reset(map.release());
178 return true;
179}
180
181const OatHeader& OatFile::GetOatHeader() const {
Ian Rogers30fab402012-01-23 15:43:46 -0800182 return *reinterpret_cast<const OatHeader*>(Begin());
Brian Carlstrome24fa612011-09-29 00:53:55 -0700183}
184
Ian Rogers30fab402012-01-23 15:43:46 -0800185const byte* OatFile::Begin() const {
186 CHECK(mem_map_->Begin() != NULL);
187 return mem_map_->Begin();
Brian Carlstrome24fa612011-09-29 00:53:55 -0700188}
189
Ian Rogers30fab402012-01-23 15:43:46 -0800190const byte* OatFile::End() const {
191 CHECK(mem_map_->End() != NULL);
192 return mem_map_->End();
Brian Carlstrome24fa612011-09-29 00:53:55 -0700193}
194
Ian Rogers7fe2c692011-12-06 16:35:59 -0800195const OatFile::OatDexFile* OatFile::GetOatDexFile(const std::string& dex_file_location,
196 bool warn_if_not_found) const {
Brian Carlstrom58ae9412011-10-04 00:56:06 -0700197 Table::const_iterator it = oat_dex_files_.find(dex_file_location);
Brian Carlstrome24fa612011-09-29 00:53:55 -0700198 if (it == oat_dex_files_.end()) {
Ian Rogers7fe2c692011-12-06 16:35:59 -0800199 if (warn_if_not_found) {
200 LOG(WARNING) << "Failed to find OatDexFile for DexFile " << dex_file_location;
201 }
Brian Carlstromaded5f72011-10-07 17:15:04 -0700202 return NULL;
Brian Carlstrome24fa612011-09-29 00:53:55 -0700203 }
Brian Carlstromaded5f72011-10-07 17:15:04 -0700204 return it->second;
205}
206
207std::vector<const OatFile::OatDexFile*> OatFile::GetOatDexFiles() const {
208 std::vector<const OatFile::OatDexFile*> result;
Elliott Hughes362f9bc2011-10-17 18:56:41 -0700209 for (Table::const_iterator it = oat_dex_files_.begin(); it != oat_dex_files_.end(); ++it) {
Brian Carlstromaded5f72011-10-07 17:15:04 -0700210 result.push_back(it->second);
211 }
212 return result;
Brian Carlstrome24fa612011-09-29 00:53:55 -0700213}
214
215OatFile::OatDexFile::OatDexFile(const OatFile* oat_file,
Elliott Hughesaa6a5882012-01-13 19:39:16 -0800216 const std::string& dex_file_location,
Brian Carlstrom5b332c82012-02-01 15:02:31 -0800217 uint32_t dex_file_location_checksum,
Brian Carlstrom89521892011-12-07 22:05:07 -0800218 byte* dex_file_pointer,
Brian Carlstrom0755ec52012-01-11 15:19:46 -0800219 const uint32_t* oat_class_offsets_pointer)
Brian Carlstrome24fa612011-09-29 00:53:55 -0700220 : oat_file_(oat_file),
221 dex_file_location_(dex_file_location),
Brian Carlstrom5b332c82012-02-01 15:02:31 -0800222 dex_file_location_checksum_(dex_file_location_checksum),
Brian Carlstrom89521892011-12-07 22:05:07 -0800223 dex_file_pointer_(dex_file_pointer),
Brian Carlstrom0755ec52012-01-11 15:19:46 -0800224 oat_class_offsets_pointer_(oat_class_offsets_pointer) {}
Brian Carlstrome24fa612011-09-29 00:53:55 -0700225
226OatFile::OatDexFile::~OatDexFile() {}
227
Brian Carlstrom89521892011-12-07 22:05:07 -0800228const DexFile* OatFile::OatDexFile::OpenDexFile() const {
229 size_t length = reinterpret_cast<const DexFile::Header*>(dex_file_pointer_)->file_size_;
Brian Carlstrom5b332c82012-02-01 15:02:31 -0800230 return DexFile::Open(dex_file_pointer_, length, dex_file_location_, dex_file_location_checksum_);
Brian Carlstrom89521892011-12-07 22:05:07 -0800231}
232
Brian Carlstromaded5f72011-10-07 17:15:04 -0700233const OatFile::OatClass* OatFile::OatDexFile::GetOatClass(uint32_t class_def_index) const {
Brian Carlstrom0755ec52012-01-11 15:19:46 -0800234 uint32_t oat_class_offset = oat_class_offsets_pointer_[class_def_index];
235
Ian Rogers30fab402012-01-23 15:43:46 -0800236 const byte* oat_class_pointer = oat_file_->Begin() + oat_class_offset;
237 CHECK_LT(oat_class_pointer, oat_file_->End());
Brian Carlstrom0755ec52012-01-11 15:19:46 -0800238 Class::Status status = *reinterpret_cast<const Class::Status*>(oat_class_pointer);
239
240 const byte* methods_pointer = oat_class_pointer + sizeof(status);
Ian Rogers30fab402012-01-23 15:43:46 -0800241 CHECK_LT(methods_pointer, oat_file_->End());
Brian Carlstrom0755ec52012-01-11 15:19:46 -0800242
243 return new OatClass(oat_file_,
244 status,
245 reinterpret_cast<const OatMethodOffsets*>(methods_pointer));
Brian Carlstrome24fa612011-09-29 00:53:55 -0700246}
247
Brian Carlstrom0755ec52012-01-11 15:19:46 -0800248OatFile::OatClass::OatClass(const OatFile* oat_file,
249 Class::Status status,
250 const OatMethodOffsets* methods_pointer)
251 : oat_file_(oat_file), status_(status), methods_pointer_(methods_pointer) {}
Brian Carlstrome24fa612011-09-29 00:53:55 -0700252
253OatFile::OatClass::~OatClass() {}
254
Brian Carlstrom0755ec52012-01-11 15:19:46 -0800255Class::Status OatFile::OatClass::GetStatus() const {
256 return status_;
257}
258
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700259const OatFile::OatMethod OatFile::OatClass::GetOatMethod(uint32_t method_index) const {
260 const OatMethodOffsets& oat_method_offsets = methods_pointer_[method_index];
261 return OatMethod(
Ian Rogers30fab402012-01-23 15:43:46 -0800262 oat_file_->Begin(),
Brian Carlstromae826982011-11-09 01:33:42 -0800263 oat_method_offsets.code_offset_,
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700264 oat_method_offsets.frame_size_in_bytes_,
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700265 oat_method_offsets.core_spill_mask_,
266 oat_method_offsets.fp_spill_mask_,
Brian Carlstromae826982011-11-09 01:33:42 -0800267 oat_method_offsets.mapping_table_offset_,
268 oat_method_offsets.vmap_table_offset_,
Brian Carlstrome7d856b2012-01-11 18:10:55 -0800269 oat_method_offsets.gc_map_offset_,
Brian Carlstromae826982011-11-09 01:33:42 -0800270 oat_method_offsets.invoke_stub_offset_);
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700271}
272
Brian Carlstromae826982011-11-09 01:33:42 -0800273OatFile::OatMethod::OatMethod(const byte* base,
274 const uint32_t code_offset,
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700275 const size_t frame_size_in_bytes,
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700276 const uint32_t core_spill_mask,
277 const uint32_t fp_spill_mask,
Brian Carlstromae826982011-11-09 01:33:42 -0800278 const uint32_t mapping_table_offset,
279 const uint32_t vmap_table_offset,
Brian Carlstrome7d856b2012-01-11 18:10:55 -0800280 const uint32_t gc_map_offset,
Brian Carlstromae826982011-11-09 01:33:42 -0800281 const uint32_t invoke_stub_offset)
Ian Rogers30fab402012-01-23 15:43:46 -0800282 : begin_(base),
Brian Carlstromae826982011-11-09 01:33:42 -0800283 code_offset_(code_offset),
Brian Carlstrom0dd7dda2011-10-25 15:47:53 -0700284 frame_size_in_bytes_(frame_size_in_bytes),
Brian Carlstrom0dd7dda2011-10-25 15:47:53 -0700285 core_spill_mask_(core_spill_mask),
286 fp_spill_mask_(fp_spill_mask),
Brian Carlstromae826982011-11-09 01:33:42 -0800287 mapping_table_offset_(mapping_table_offset),
288 vmap_table_offset_(vmap_table_offset),
Brian Carlstrome7d856b2012-01-11 18:10:55 -0800289 gc_map_offset_(gc_map_offset),
Brian Carlstromae826982011-11-09 01:33:42 -0800290 invoke_stub_offset_(invoke_stub_offset) {
Brian Carlstrom0dd7dda2011-10-25 15:47:53 -0700291#ifndef NDEBUG
Brian Carlstromae826982011-11-09 01:33:42 -0800292 if (mapping_table_offset_ != 0) { // implies non-native, non-stub code
293 if (vmap_table_offset_ == 0) {
Brian Carlstrom0dd7dda2011-10-25 15:47:53 -0700294 DCHECK_EQ(0U, static_cast<uint32_t>(__builtin_popcount(core_spill_mask_) + __builtin_popcount(fp_spill_mask_)));
295 } else {
Ian Rogers30fab402012-01-23 15:43:46 -0800296 const uint16_t* vmap_table_ = reinterpret_cast<const uint16_t*>(begin_ + vmap_table_offset_);
Brian Carlstrom0dd7dda2011-10-25 15:47:53 -0700297 DCHECK_EQ(vmap_table_[0], static_cast<uint32_t>(__builtin_popcount(core_spill_mask_) + __builtin_popcount(fp_spill_mask_)));
298 }
299 } else {
Elliott Hughesba8eee12012-01-24 20:25:24 -0800300 DCHECK_EQ(vmap_table_offset_, 0U);
Brian Carlstrom0dd7dda2011-10-25 15:47:53 -0700301 }
302#endif
303}
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700304
305OatFile::OatMethod::~OatMethod() {}
306
Brian Carlstromae826982011-11-09 01:33:42 -0800307void OatFile::OatMethod::LinkMethodPointers(Method* method) const {
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700308 CHECK(method != NULL);
Brian Carlstromae826982011-11-09 01:33:42 -0800309 method->SetCode(GetCode());
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700310 method->SetFrameSizeInBytes(frame_size_in_bytes_);
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700311 method->SetCoreSpillMask(core_spill_mask_);
312 method->SetFpSpillMask(fp_spill_mask_);
Brian Carlstromae826982011-11-09 01:33:42 -0800313 method->SetMappingTable(GetMappingTable());
314 method->SetVmapTable(GetVmapTable());
Ian Rogers19846512012-02-24 11:42:47 -0800315 method->SetGcMap(GetGcMap()); // Note, used by native methods in work around JNI mode.
Brian Carlstromae826982011-11-09 01:33:42 -0800316 method->SetInvokeStub(GetInvokeStub());
317}
318
319void OatFile::OatMethod::LinkMethodOffsets(Method* method) const {
320 CHECK(method != NULL);
321 method->SetOatCodeOffset(GetCodeOffset());
322 method->SetFrameSizeInBytes(GetFrameSizeInBytes());
323 method->SetCoreSpillMask(GetCoreSpillMask());
324 method->SetFpSpillMask(GetFpSpillMask());
325 method->SetOatMappingTableOffset(GetMappingTableOffset());
326 method->SetOatVmapTableOffset(GetVmapTableOffset());
Brian Carlstrome7d856b2012-01-11 18:10:55 -0800327 method->SetOatGcMapOffset(GetGcMapOffset());
Brian Carlstromae826982011-11-09 01:33:42 -0800328 method->SetOatInvokeStubOffset(GetInvokeStubOffset());
Brian Carlstrome24fa612011-09-29 00:53:55 -0700329}
330
Logan Chien0cc6ab62012-03-20 22:57:52 +0800331OatFile::OatElfImage::OatElfImage(const OatFile* oat_file,
332 const byte* addr,
333 uint32_t size)
334 : oat_file_(oat_file), elf_addr_(addr), elf_size_(size) {
335}
336
Brian Carlstrome24fa612011-09-29 00:53:55 -0700337} // namespace art