blob: a8b89a95c3c995f86eac2abfd28c072a7055e6a4 [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 Carlstrom7a967b32012-03-28 15:23:10 -070038 CHECK(!filename.empty()) << location;
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 Carlstrom7a967b32012-03-28 15:23:10 -070050 CHECK(!location.empty());
51 if (!IsValidOatFilename(location)) {
52 LOG(WARNING) << "Attempting to open dex file with unknown extension '" << location << "'";
53 }
Brian Carlstrom5b332c82012-02-01 15:02:31 -080054 UniquePtr<OatFile> oat_file(new OatFile(location));
Brian Carlstromf5822582012-03-19 22:34:31 -070055 bool success = oat_file->Map(file, requested_base, writable);
Brian Carlstrome24fa612011-09-29 00:53:55 -070056 if (!success) {
57 return NULL;
58 }
59 return oat_file.release();
60}
61
Brian Carlstroma004aa92012-02-08 18:05:09 -080062OatFile::OatFile(const std::string& location) : location_(location) {
63 CHECK(!location_.empty());
64}
Brian Carlstrome24fa612011-09-29 00:53:55 -070065
66OatFile::~OatFile() {
67 STLDeleteValues(&oat_dex_files_);
Logan Chien0cc6ab62012-03-20 22:57:52 +080068 STLDeleteElements(&oat_elf_images_);
Brian Carlstrome24fa612011-09-29 00:53:55 -070069}
70
Brian Carlstromf5822582012-03-19 22:34:31 -070071bool OatFile::Map(File& file, byte* requested_base, bool writable) {
Brian Carlstrome24fa612011-09-29 00:53:55 -070072 OatHeader oat_header;
Brian Carlstrom5b332c82012-02-01 15:02:31 -080073 bool success = file.ReadFully(&oat_header, sizeof(oat_header));
Brian Carlstrome24fa612011-09-29 00:53:55 -070074 if (!success || !oat_header.IsValid()) {
Brian Carlstrom5b332c82012-02-01 15:02:31 -080075 LOG(WARNING) << "Invalid oat header " << GetLocation();
Brian Carlstrome24fa612011-09-29 00:53:55 -070076 return false;
77 }
78
Brian Carlstromf5822582012-03-19 22:34:31 -070079 int flags = 0;
80 int prot = 0;
81 if (writable) {
82 flags |= MAP_SHARED; // So changes will write through to file
83 prot |= (PROT_READ | PROT_WRITE);
84 } else {
85 flags |= MAP_PRIVATE;
86 prot |= PROT_READ;
87 }
88 if (requested_base != NULL) {
89 flags |= MAP_FIXED;
90 }
Brian Carlstrom89521892011-12-07 22:05:07 -080091 UniquePtr<MemMap> map(MemMap::MapFileAtAddress(requested_base,
Brian Carlstrom5b332c82012-02-01 15:02:31 -080092 file.Length(),
Brian Carlstromf5822582012-03-19 22:34:31 -070093 prot,
Brian Carlstrom89521892011-12-07 22:05:07 -080094 flags,
Brian Carlstrom5b332c82012-02-01 15:02:31 -080095 file.Fd(),
Brian Carlstrom89521892011-12-07 22:05:07 -080096 0));
Brian Carlstrome24fa612011-09-29 00:53:55 -070097 if (map.get() == NULL) {
Brian Carlstrom5b332c82012-02-01 15:02:31 -080098 LOG(WARNING) << "Failed to map oat file " << GetLocation();
Brian Carlstrome24fa612011-09-29 00:53:55 -070099 return false;
100 }
Ian Rogers30fab402012-01-23 15:43:46 -0800101 CHECK(requested_base == 0 || requested_base == map->Begin())
Brian Carlstromf8bbb842012-03-14 03:01:42 -0700102 << GetLocation() << " " << reinterpret_cast<void*>(map->Begin());
Brian Carlstrom5b332c82012-02-01 15:02:31 -0800103 DCHECK_EQ(0, memcmp(&oat_header, map->Begin(), sizeof(OatHeader))) << GetLocation();
Brian Carlstrome24fa612011-09-29 00:53:55 -0700104
Elliott Hughese689d512012-01-18 23:39:47 -0800105 off_t code_offset = oat_header.GetExecutableOffset();
Brian Carlstrom5b332c82012-02-01 15:02:31 -0800106 if (code_offset < file.Length()) {
Ian Rogers30fab402012-01-23 15:43:46 -0800107 byte* code_address = map->Begin() + code_offset;
Brian Carlstrom5b332c82012-02-01 15:02:31 -0800108 size_t code_length = file.Length() - code_offset;
Brian Carlstromf5822582012-03-19 22:34:31 -0700109 if (mprotect(code_address, code_length, prot | PROT_EXEC) != 0) {
Brian Carlstrom5b332c82012-02-01 15:02:31 -0800110 PLOG(ERROR) << "Failed to make oat code executable in " << GetLocation();
Brian Carlstrome24fa612011-09-29 00:53:55 -0700111 return false;
112 }
113 } else {
114 // its possible to have no code if all the methods were abstract, native, etc
Brian Carlstrom5b332c82012-02-01 15:02:31 -0800115 DCHECK_EQ(code_offset, RoundUp(file.Length(), kPageSize)) << GetLocation();
Brian Carlstrome24fa612011-09-29 00:53:55 -0700116 }
117
Ian Rogers30fab402012-01-23 15:43:46 -0800118 const byte* oat = map->Begin();
Brian Carlstrom6e3b1d92012-01-11 01:36:32 -0800119
Brian Carlstrome24fa612011-09-29 00:53:55 -0700120 oat += sizeof(OatHeader);
Brian Carlstrom81f3ca12012-03-17 00:27:35 -0700121 oat += oat_header.GetImageFileLocationSize();
122
123 CHECK_LE(oat, map->End())
124 << reinterpret_cast<void*>(map->Begin())
125 << "+" << sizeof(OatHeader)
126 << "+" << oat_header.GetImageFileLocationSize()
127 << "<=" << reinterpret_cast<void*>(map->End())
128 << " " << GetLocation();
Brian Carlstrome24fa612011-09-29 00:53:55 -0700129 for (size_t i = 0; i < oat_header.GetDexFileCount(); i++) {
130 size_t dex_file_location_size = *reinterpret_cast<const uint32_t*>(oat);
Brian Carlstrom5b332c82012-02-01 15:02:31 -0800131 CHECK_GT(dex_file_location_size, 0U) << GetLocation();
Brian Carlstrome24fa612011-09-29 00:53:55 -0700132 oat += sizeof(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 const char* dex_file_location_data = reinterpret_cast<const char*>(oat);
136 oat += dex_file_location_size;
Brian Carlstrom5b332c82012-02-01 15:02:31 -0800137 CHECK_LT(oat, map->End()) << GetLocation();
Brian Carlstrome24fa612011-09-29 00:53:55 -0700138
139 std::string dex_file_location(dex_file_location_data, dex_file_location_size);
140
141 uint32_t dex_file_checksum = *reinterpret_cast<const uint32_t*>(oat);
142 oat += sizeof(dex_file_checksum);
Brian Carlstrom5b332c82012-02-01 15:02:31 -0800143 CHECK_LT(oat, map->End()) << GetLocation();
Brian Carlstrome24fa612011-09-29 00:53:55 -0700144
Brian Carlstrom89521892011-12-07 22:05:07 -0800145 uint32_t dex_file_offset = *reinterpret_cast<const uint32_t*>(oat);
Brian Carlstrom5b332c82012-02-01 15:02:31 -0800146 CHECK_GT(dex_file_offset, 0U) << GetLocation();
147 CHECK_LT(dex_file_offset, static_cast<uint32_t>(file.Length())) << GetLocation();
Brian Carlstrom89521892011-12-07 22:05:07 -0800148 oat += sizeof(dex_file_offset);
Brian Carlstrom5b332c82012-02-01 15:02:31 -0800149 CHECK_LT(oat, map->End()) << GetLocation();
Brian Carlstrom89521892011-12-07 22:05:07 -0800150
Ian Rogers30fab402012-01-23 15:43:46 -0800151 uint8_t* dex_file_pointer = map->Begin() + dex_file_offset;
Brian Carlstrom5b332c82012-02-01 15:02:31 -0800152 CHECK(DexFile::IsMagicValid(dex_file_pointer)) << GetLocation() << " " << dex_file_pointer;
153 CHECK(DexFile::IsVersionValid(dex_file_pointer)) << GetLocation() << " " << dex_file_pointer;
Brian Carlstrom6e3b1d92012-01-11 01:36:32 -0800154 const DexFile::Header* header = reinterpret_cast<const DexFile::Header*>(dex_file_pointer);
155 const uint32_t* methods_offsets_pointer = reinterpret_cast<const uint32_t*>(oat);
Brian Carlstrom89521892011-12-07 22:05:07 -0800156
Brian Carlstrom6e3b1d92012-01-11 01:36:32 -0800157 oat += (sizeof(*methods_offsets_pointer) * header->class_defs_size_);
Brian Carlstrom5b332c82012-02-01 15:02:31 -0800158 CHECK_LE(oat, map->End()) << GetLocation();
Brian Carlstrome24fa612011-09-29 00:53:55 -0700159
160 oat_dex_files_[dex_file_location] = new OatDexFile(this,
161 dex_file_location,
162 dex_file_checksum,
Brian Carlstrom89521892011-12-07 22:05:07 -0800163 dex_file_pointer,
Brian Carlstrom6e3b1d92012-01-11 01:36:32 -0800164 methods_offsets_pointer);
Brian Carlstrome24fa612011-09-29 00:53:55 -0700165 }
166
Logan Chien0cc6ab62012-03-20 22:57:52 +0800167 oat = map->Begin() + oat_header.GetElfImageTableOffset();
168 CHECK((reinterpret_cast<uintptr_t>(oat) & 0x3) == 0);
169
170 for (uint32_t i = 0, end = oat_header.GetElfImageCount(); i < end; ++i) {
171 uint32_t elf_offset = *reinterpret_cast<const uint32_t*>(oat);
172 oat += sizeof(uint32_t);
173
174 uint32_t elf_size = *reinterpret_cast<const uint32_t*>(oat);
175 oat += sizeof(uint32_t);
176
177 oat_elf_images_.push_back(
178 new OatElfImage(this, map->Begin() + elf_offset, elf_size));
179 }
180
Brian Carlstrome24fa612011-09-29 00:53:55 -0700181 mem_map_.reset(map.release());
182 return true;
183}
184
185const OatHeader& OatFile::GetOatHeader() const {
Ian Rogers30fab402012-01-23 15:43:46 -0800186 return *reinterpret_cast<const OatHeader*>(Begin());
Brian Carlstrome24fa612011-09-29 00:53:55 -0700187}
188
Ian Rogers30fab402012-01-23 15:43:46 -0800189const byte* OatFile::Begin() const {
190 CHECK(mem_map_->Begin() != NULL);
191 return mem_map_->Begin();
Brian Carlstrome24fa612011-09-29 00:53:55 -0700192}
193
Ian Rogers30fab402012-01-23 15:43:46 -0800194const byte* OatFile::End() const {
195 CHECK(mem_map_->End() != NULL);
196 return mem_map_->End();
Brian Carlstrome24fa612011-09-29 00:53:55 -0700197}
198
Ian Rogers7fe2c692011-12-06 16:35:59 -0800199const OatFile::OatDexFile* OatFile::GetOatDexFile(const std::string& dex_file_location,
200 bool warn_if_not_found) const {
Brian Carlstrom58ae9412011-10-04 00:56:06 -0700201 Table::const_iterator it = oat_dex_files_.find(dex_file_location);
Brian Carlstrome24fa612011-09-29 00:53:55 -0700202 if (it == oat_dex_files_.end()) {
Ian Rogers7fe2c692011-12-06 16:35:59 -0800203 if (warn_if_not_found) {
204 LOG(WARNING) << "Failed to find OatDexFile for DexFile " << dex_file_location;
205 }
Brian Carlstromaded5f72011-10-07 17:15:04 -0700206 return NULL;
Brian Carlstrome24fa612011-09-29 00:53:55 -0700207 }
Brian Carlstromaded5f72011-10-07 17:15:04 -0700208 return it->second;
209}
210
211std::vector<const OatFile::OatDexFile*> OatFile::GetOatDexFiles() const {
212 std::vector<const OatFile::OatDexFile*> result;
Elliott Hughes362f9bc2011-10-17 18:56:41 -0700213 for (Table::const_iterator it = oat_dex_files_.begin(); it != oat_dex_files_.end(); ++it) {
Brian Carlstromaded5f72011-10-07 17:15:04 -0700214 result.push_back(it->second);
215 }
216 return result;
Brian Carlstrome24fa612011-09-29 00:53:55 -0700217}
218
219OatFile::OatDexFile::OatDexFile(const OatFile* oat_file,
Elliott Hughesaa6a5882012-01-13 19:39:16 -0800220 const std::string& dex_file_location,
Brian Carlstrom5b332c82012-02-01 15:02:31 -0800221 uint32_t dex_file_location_checksum,
Brian Carlstrom89521892011-12-07 22:05:07 -0800222 byte* dex_file_pointer,
Brian Carlstrom0755ec52012-01-11 15:19:46 -0800223 const uint32_t* oat_class_offsets_pointer)
Brian Carlstrome24fa612011-09-29 00:53:55 -0700224 : oat_file_(oat_file),
225 dex_file_location_(dex_file_location),
Brian Carlstrom5b332c82012-02-01 15:02:31 -0800226 dex_file_location_checksum_(dex_file_location_checksum),
Brian Carlstrom89521892011-12-07 22:05:07 -0800227 dex_file_pointer_(dex_file_pointer),
Brian Carlstrom0755ec52012-01-11 15:19:46 -0800228 oat_class_offsets_pointer_(oat_class_offsets_pointer) {}
Brian Carlstrome24fa612011-09-29 00:53:55 -0700229
230OatFile::OatDexFile::~OatDexFile() {}
231
Brian Carlstrom89521892011-12-07 22:05:07 -0800232const DexFile* OatFile::OatDexFile::OpenDexFile() const {
233 size_t length = reinterpret_cast<const DexFile::Header*>(dex_file_pointer_)->file_size_;
Brian Carlstrom5b332c82012-02-01 15:02:31 -0800234 return DexFile::Open(dex_file_pointer_, length, dex_file_location_, dex_file_location_checksum_);
Brian Carlstrom89521892011-12-07 22:05:07 -0800235}
236
Brian Carlstromaded5f72011-10-07 17:15:04 -0700237const OatFile::OatClass* OatFile::OatDexFile::GetOatClass(uint32_t class_def_index) const {
Brian Carlstrom0755ec52012-01-11 15:19:46 -0800238 uint32_t oat_class_offset = oat_class_offsets_pointer_[class_def_index];
239
Ian Rogers30fab402012-01-23 15:43:46 -0800240 const byte* oat_class_pointer = oat_file_->Begin() + oat_class_offset;
241 CHECK_LT(oat_class_pointer, oat_file_->End());
Brian Carlstrom0755ec52012-01-11 15:19:46 -0800242 Class::Status status = *reinterpret_cast<const Class::Status*>(oat_class_pointer);
243
244 const byte* methods_pointer = oat_class_pointer + sizeof(status);
Ian Rogers30fab402012-01-23 15:43:46 -0800245 CHECK_LT(methods_pointer, oat_file_->End());
Brian Carlstrom0755ec52012-01-11 15:19:46 -0800246
247 return new OatClass(oat_file_,
248 status,
249 reinterpret_cast<const OatMethodOffsets*>(methods_pointer));
Brian Carlstrome24fa612011-09-29 00:53:55 -0700250}
251
Brian Carlstrom0755ec52012-01-11 15:19:46 -0800252OatFile::OatClass::OatClass(const OatFile* oat_file,
253 Class::Status status,
254 const OatMethodOffsets* methods_pointer)
255 : oat_file_(oat_file), status_(status), methods_pointer_(methods_pointer) {}
Brian Carlstrome24fa612011-09-29 00:53:55 -0700256
257OatFile::OatClass::~OatClass() {}
258
Brian Carlstrom0755ec52012-01-11 15:19:46 -0800259Class::Status OatFile::OatClass::GetStatus() const {
260 return status_;
261}
262
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700263const OatFile::OatMethod OatFile::OatClass::GetOatMethod(uint32_t method_index) const {
264 const OatMethodOffsets& oat_method_offsets = methods_pointer_[method_index];
265 return OatMethod(
Ian Rogers30fab402012-01-23 15:43:46 -0800266 oat_file_->Begin(),
Brian Carlstromae826982011-11-09 01:33:42 -0800267 oat_method_offsets.code_offset_,
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700268 oat_method_offsets.frame_size_in_bytes_,
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700269 oat_method_offsets.core_spill_mask_,
270 oat_method_offsets.fp_spill_mask_,
Brian Carlstromae826982011-11-09 01:33:42 -0800271 oat_method_offsets.mapping_table_offset_,
272 oat_method_offsets.vmap_table_offset_,
Brian Carlstrome7d856b2012-01-11 18:10:55 -0800273 oat_method_offsets.gc_map_offset_,
Brian Carlstromae826982011-11-09 01:33:42 -0800274 oat_method_offsets.invoke_stub_offset_);
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700275}
276
Brian Carlstromae826982011-11-09 01:33:42 -0800277OatFile::OatMethod::OatMethod(const byte* base,
278 const uint32_t code_offset,
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700279 const size_t frame_size_in_bytes,
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700280 const uint32_t core_spill_mask,
281 const uint32_t fp_spill_mask,
Brian Carlstromae826982011-11-09 01:33:42 -0800282 const uint32_t mapping_table_offset,
283 const uint32_t vmap_table_offset,
Brian Carlstrome7d856b2012-01-11 18:10:55 -0800284 const uint32_t gc_map_offset,
Brian Carlstromae826982011-11-09 01:33:42 -0800285 const uint32_t invoke_stub_offset)
Ian Rogers30fab402012-01-23 15:43:46 -0800286 : begin_(base),
Brian Carlstromae826982011-11-09 01:33:42 -0800287 code_offset_(code_offset),
Brian Carlstrom0dd7dda2011-10-25 15:47:53 -0700288 frame_size_in_bytes_(frame_size_in_bytes),
Brian Carlstrom0dd7dda2011-10-25 15:47:53 -0700289 core_spill_mask_(core_spill_mask),
290 fp_spill_mask_(fp_spill_mask),
Brian Carlstromae826982011-11-09 01:33:42 -0800291 mapping_table_offset_(mapping_table_offset),
292 vmap_table_offset_(vmap_table_offset),
Brian Carlstrome7d856b2012-01-11 18:10:55 -0800293 gc_map_offset_(gc_map_offset),
Brian Carlstromae826982011-11-09 01:33:42 -0800294 invoke_stub_offset_(invoke_stub_offset) {
Brian Carlstrom0dd7dda2011-10-25 15:47:53 -0700295#ifndef NDEBUG
Brian Carlstromae826982011-11-09 01:33:42 -0800296 if (mapping_table_offset_ != 0) { // implies non-native, non-stub code
297 if (vmap_table_offset_ == 0) {
Brian Carlstrom0dd7dda2011-10-25 15:47:53 -0700298 DCHECK_EQ(0U, static_cast<uint32_t>(__builtin_popcount(core_spill_mask_) + __builtin_popcount(fp_spill_mask_)));
299 } else {
Ian Rogers30fab402012-01-23 15:43:46 -0800300 const uint16_t* vmap_table_ = reinterpret_cast<const uint16_t*>(begin_ + vmap_table_offset_);
Brian Carlstrom0dd7dda2011-10-25 15:47:53 -0700301 DCHECK_EQ(vmap_table_[0], static_cast<uint32_t>(__builtin_popcount(core_spill_mask_) + __builtin_popcount(fp_spill_mask_)));
302 }
303 } else {
Elliott Hughesba8eee12012-01-24 20:25:24 -0800304 DCHECK_EQ(vmap_table_offset_, 0U);
Brian Carlstrom0dd7dda2011-10-25 15:47:53 -0700305 }
306#endif
307}
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700308
309OatFile::OatMethod::~OatMethod() {}
310
Brian Carlstromae826982011-11-09 01:33:42 -0800311void OatFile::OatMethod::LinkMethodPointers(Method* method) const {
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700312 CHECK(method != NULL);
Brian Carlstromae826982011-11-09 01:33:42 -0800313 method->SetCode(GetCode());
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700314 method->SetFrameSizeInBytes(frame_size_in_bytes_);
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700315 method->SetCoreSpillMask(core_spill_mask_);
316 method->SetFpSpillMask(fp_spill_mask_);
Brian Carlstromae826982011-11-09 01:33:42 -0800317 method->SetMappingTable(GetMappingTable());
318 method->SetVmapTable(GetVmapTable());
Ian Rogers19846512012-02-24 11:42:47 -0800319 method->SetGcMap(GetGcMap()); // Note, used by native methods in work around JNI mode.
Brian Carlstromae826982011-11-09 01:33:42 -0800320 method->SetInvokeStub(GetInvokeStub());
321}
322
323void OatFile::OatMethod::LinkMethodOffsets(Method* method) const {
324 CHECK(method != NULL);
325 method->SetOatCodeOffset(GetCodeOffset());
326 method->SetFrameSizeInBytes(GetFrameSizeInBytes());
327 method->SetCoreSpillMask(GetCoreSpillMask());
328 method->SetFpSpillMask(GetFpSpillMask());
329 method->SetOatMappingTableOffset(GetMappingTableOffset());
330 method->SetOatVmapTableOffset(GetVmapTableOffset());
Brian Carlstrome7d856b2012-01-11 18:10:55 -0800331 method->SetOatGcMapOffset(GetGcMapOffset());
Brian Carlstromae826982011-11-09 01:33:42 -0800332 method->SetOatInvokeStubOffset(GetInvokeStubOffset());
Brian Carlstrome24fa612011-09-29 00:53:55 -0700333}
334
Logan Chien0cc6ab62012-03-20 22:57:52 +0800335OatFile::OatElfImage::OatElfImage(const OatFile* oat_file,
336 const byte* addr,
337 uint32_t size)
338 : oat_file_(oat_file), elf_addr_(addr), elf_size_(size) {
339}
340
Brian Carlstrome24fa612011-09-29 00:53:55 -0700341} // namespace art