blob: 858582ee0016fad0f49e1637592e70df7dce4943 [file] [log] [blame]
Ian Rogers1d54e732013-05-02 21:10:01 -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
17#include "image_space.h"
18
Brian Carlstrom56d947f2013-07-15 13:14:23 -070019#include "base/stl_util.h"
Ian Rogers1d54e732013-05-02 21:10:01 -070020#include "base/unix_file/fd_file.h"
21#include "gc/accounting/space_bitmap-inl.h"
Brian Carlstromea46f952013-07-30 01:26:50 -070022#include "mirror/art_method.h"
Ian Rogers1d54e732013-05-02 21:10:01 -070023#include "mirror/class-inl.h"
24#include "mirror/object-inl.h"
Brian Carlstrom56d947f2013-07-15 13:14:23 -070025#include "oat_file.h"
Ian Rogers1d54e732013-05-02 21:10:01 -070026#include "os.h"
Ian Rogers1d54e732013-05-02 21:10:01 -070027#include "space-inl.h"
28#include "utils.h"
29
30namespace art {
31namespace gc {
32namespace space {
33
Ian Rogersef7d42f2014-01-06 12:55:46 -080034Atomic<uint32_t> ImageSpace::bitmap_index_(0);
Ian Rogers1d54e732013-05-02 21:10:01 -070035
Narayan Kamath52f84882014-05-02 10:10:39 +010036ImageSpace::ImageSpace(const std::string& image_filename, const char* image_location,
37 MemMap* mem_map, accounting::ContinuousSpaceBitmap* live_bitmap)
38 : MemMapSpace(image_filename, mem_map, mem_map->Begin(), mem_map->End(), mem_map->End(),
39 kGcRetentionPolicyNeverCollect),
40 image_location_(image_location) {
Mathieu Chartier590fee92013-09-13 13:46:47 -070041 DCHECK(live_bitmap != nullptr);
Mathieu Chartier31e89252013-08-28 11:29:12 -070042 live_bitmap_.reset(live_bitmap);
Ian Rogers1d54e732013-05-02 21:10:01 -070043}
44
Narayan Kamath52f84882014-05-02 10:10:39 +010045static bool GenerateImage(const std::string& image_filename, std::string* error_msg) {
Brian Carlstrom56d947f2013-07-15 13:14:23 -070046 const std::string boot_class_path_string(Runtime::Current()->GetBootClassPathString());
47 std::vector<std::string> boot_class_path;
48 Split(boot_class_path_string, ':', boot_class_path);
49 if (boot_class_path.empty()) {
Ian Rogers8d31bbd2013-10-13 10:44:14 -070050 *error_msg = "Failed to generate image because no boot class path specified";
51 return false;
Brian Carlstrom56d947f2013-07-15 13:14:23 -070052 }
53
Mathieu Chartier8bbc8c02013-07-31 16:27:01 -070054 std::vector<std::string> arg_vector;
Brian Carlstrom56d947f2013-07-15 13:14:23 -070055
Mathieu Chartiere5426c92013-08-01 13:55:42 -070056 std::string dex2oat(GetAndroidRoot());
Mathieu Chartier08d7d442013-07-31 18:08:51 -070057 dex2oat += (kIsDebugBuild ? "/bin/dex2oatd" : "/bin/dex2oat");
58 arg_vector.push_back(dex2oat);
Brian Carlstrom56d947f2013-07-15 13:14:23 -070059
60 std::string image_option_string("--image=");
Narayan Kamath52f84882014-05-02 10:10:39 +010061 image_option_string += image_filename;
Mathieu Chartier8bbc8c02013-07-31 16:27:01 -070062 arg_vector.push_back(image_option_string);
Brian Carlstrom56d947f2013-07-15 13:14:23 -070063
Mathieu Chartier8bbc8c02013-07-31 16:27:01 -070064 arg_vector.push_back("--runtime-arg");
65 arg_vector.push_back("-Xms64m");
Brian Carlstrom56d947f2013-07-15 13:14:23 -070066
Mathieu Chartier8bbc8c02013-07-31 16:27:01 -070067 arg_vector.push_back("--runtime-arg");
68 arg_vector.push_back("-Xmx64m");
Brian Carlstrom56d947f2013-07-15 13:14:23 -070069
Dave Allisonb373e092014-02-20 16:06:36 -080070
Brian Carlstrom56d947f2013-07-15 13:14:23 -070071 for (size_t i = 0; i < boot_class_path.size(); i++) {
Mathieu Chartier8bbc8c02013-07-31 16:27:01 -070072 arg_vector.push_back(std::string("--dex-file=") + boot_class_path[i]);
Brian Carlstrom56d947f2013-07-15 13:14:23 -070073 }
74
75 std::string oat_file_option_string("--oat-file=");
Narayan Kamath52f84882014-05-02 10:10:39 +010076 oat_file_option_string += image_filename;
Brian Carlstrom56d947f2013-07-15 13:14:23 -070077 oat_file_option_string.erase(oat_file_option_string.size() - 3);
78 oat_file_option_string += "oat";
Mathieu Chartier8bbc8c02013-07-31 16:27:01 -070079 arg_vector.push_back(oat_file_option_string);
Brian Carlstrom56d947f2013-07-15 13:14:23 -070080
Ian Rogers8afeb852014-04-02 14:55:49 -070081 Runtime::Current()->AddCurrentRuntimeFeaturesAsDex2OatArguments(&arg_vector);
82
Mathieu Chartier8bbc8c02013-07-31 16:27:01 -070083 arg_vector.push_back(StringPrintf("--base=0x%x", ART_BASE_ADDRESS));
Brian Carlstrom56d947f2013-07-15 13:14:23 -070084
85 if (kIsTargetBuild) {
Mathieu Chartier8bbc8c02013-07-31 16:27:01 -070086 arg_vector.push_back("--image-classes-zip=/system/framework/framework.jar");
87 arg_vector.push_back("--image-classes=preloaded-classes");
Brian Carlstrom56d947f2013-07-15 13:14:23 -070088 } else {
Mathieu Chartier8bbc8c02013-07-31 16:27:01 -070089 arg_vector.push_back("--host");
Brian Carlstrom56d947f2013-07-15 13:14:23 -070090 }
91
Brian Carlstrom6449c622014-02-10 23:48:36 -080092 const std::vector<std::string>& compiler_options = Runtime::Current()->GetImageCompilerOptions();
Brian Carlstrom2ec65202014-03-03 15:16:37 -080093 for (size_t i = 0; i < compiler_options.size(); ++i) {
Brian Carlstrom6449c622014-02-10 23:48:36 -080094 arg_vector.push_back(compiler_options[i].c_str());
95 }
96
Brian Carlstrom56d947f2013-07-15 13:14:23 -070097 std::string command_line(Join(arg_vector, ' '));
98 LOG(INFO) << "GenerateImage: " << command_line;
Brian Carlstrom6449c622014-02-10 23:48:36 -080099 return Exec(arg_vector, error_msg);
Brian Carlstrom56d947f2013-07-15 13:14:23 -0700100}
101
Narayan Kamath52f84882014-05-02 10:10:39 +0100102bool ImageSpace::FindImageFilename(const char* image_location,
103 const InstructionSet image_isa,
104 std::string* image_filename,
105 bool *is_system) {
106 if (OS::FileExists(image_location)) {
107 *image_filename = image_location;
108 *is_system = true;
109 return true;
Brian Carlstrom56d947f2013-07-15 13:14:23 -0700110 }
Narayan Kamath52f84882014-05-02 10:10:39 +0100111
Narayan Kamath11d9f062014-04-23 20:24:57 +0100112 const std::string dalvik_cache = GetDalvikCacheOrDie(GetInstructionSetString(image_isa));
Narayan Kamath52f84882014-05-02 10:10:39 +0100113
114 // Always set output location even if it does not exist,
115 // so that the caller knows where to create the image.
116 *image_filename = GetDalvikCacheFilenameOrDie(image_location, dalvik_cache.c_str());
117 *is_system = false;
118 return OS::FileExists(image_filename->c_str());
119}
120
121ImageHeader* ImageSpace::ReadImageHeaderOrDie(const char* image_location,
122 const InstructionSet image_isa) {
123 std::string image_filename;
124 bool is_system = false;
125 if (FindImageFilename(image_location, image_isa, &image_filename, &is_system)) {
126 UniquePtr<File> image_file(OS::OpenFileForReading(image_filename.c_str()));
127 UniquePtr<ImageHeader> image_header(new ImageHeader);
128 const bool success = image_file->ReadFully(image_header.get(), sizeof(ImageHeader));
129 if (!success || !image_header->IsValid()) {
130 LOG(FATAL) << "Invalid Image header for: " << image_filename;
131 return nullptr;
132 }
133
134 return image_header.release();
135 }
136
137 LOG(FATAL) << "Unable to find image file for: " << image_location;
138 return nullptr;
139}
140
141ImageSpace* ImageSpace::Create(const char* image_location,
142 const InstructionSet image_isa) {
143 std::string image_filename;
Ian Rogers8d31bbd2013-10-13 10:44:14 -0700144 std::string error_msg;
Narayan Kamath52f84882014-05-02 10:10:39 +0100145 bool is_system = false;
146 if (FindImageFilename(image_location, image_isa, &image_filename, &is_system)) {
147 ImageSpace* space = ImageSpace::Init(image_filename.c_str(), image_location,
148 !is_system, &error_msg);
149 if (space != nullptr) {
150 return space;
151 }
152
153 // If the /system file exists, it should be up-to-date, don't try to generate it.
154 // If it's not the /system file, log a warning and fall through to GenerateImage.
155 if (is_system) {
156 LOG(FATAL) << "Failed to load image '" << image_filename << "': " << error_msg;
157 return nullptr;
Mathieu Chartierc7cb1902014-03-05 14:41:03 -0800158 } else {
159 LOG(WARNING) << error_msg;
Brian Carlstrom56d947f2013-07-15 13:14:23 -0700160 }
161 }
Narayan Kamath52f84882014-05-02 10:10:39 +0100162
163 CHECK(GenerateImage(image_filename, &error_msg))
164 << "Failed to generate image '" << image_filename << "': " << error_msg;
165 ImageSpace* space = ImageSpace::Init(image_filename.c_str(), image_location, true, &error_msg);
Ian Rogers8d31bbd2013-10-13 10:44:14 -0700166 if (space == nullptr) {
Narayan Kamath52f84882014-05-02 10:10:39 +0100167 LOG(FATAL) << "Failed to load image '" << image_filename << "': " << error_msg;
Ian Rogers8d31bbd2013-10-13 10:44:14 -0700168 }
169 return space;
Brian Carlstrom56d947f2013-07-15 13:14:23 -0700170}
171
Mathieu Chartier31e89252013-08-28 11:29:12 -0700172void ImageSpace::VerifyImageAllocations() {
173 byte* current = Begin() + RoundUp(sizeof(ImageHeader), kObjectAlignment);
174 while (current < End()) {
175 DCHECK_ALIGNED(current, kObjectAlignment);
Ian Rogersef7d42f2014-01-06 12:55:46 -0800176 mirror::Object* obj = reinterpret_cast<mirror::Object*>(current);
Mathieu Chartier31e89252013-08-28 11:29:12 -0700177 CHECK(live_bitmap_->Test(obj));
178 CHECK(obj->GetClass() != nullptr) << "Image object at address " << obj << " has null class";
Hiroshi Yamauchi624468c2014-03-31 15:14:47 -0700179 if (kUseBakerOrBrooksReadBarrier) {
180 obj->AssertReadBarrierPointer();
Hiroshi Yamauchi9d04a202014-01-31 13:35:49 -0800181 }
Mathieu Chartier31e89252013-08-28 11:29:12 -0700182 current += RoundUp(obj->SizeOf(), kObjectAlignment);
183 }
184}
185
Narayan Kamath52f84882014-05-02 10:10:39 +0100186ImageSpace* ImageSpace::Init(const char* image_filename, const char* image_location,
187 bool validate_oat_file, std::string* error_msg) {
188 CHECK(image_filename != nullptr);
189 CHECK(image_location != nullptr);
Ian Rogers1d54e732013-05-02 21:10:01 -0700190
191 uint64_t start_time = 0;
192 if (VLOG_IS_ON(heap) || VLOG_IS_ON(startup)) {
193 start_time = NanoTime();
Narayan Kamath52f84882014-05-02 10:10:39 +0100194 LOG(INFO) << "ImageSpace::Init entering image_filename=" << image_filename;
Ian Rogers1d54e732013-05-02 21:10:01 -0700195 }
196
Narayan Kamath52f84882014-05-02 10:10:39 +0100197 UniquePtr<File> file(OS::OpenFileForReading(image_filename));
Ian Rogers1d54e732013-05-02 21:10:01 -0700198 if (file.get() == NULL) {
Narayan Kamath52f84882014-05-02 10:10:39 +0100199 *error_msg = StringPrintf("Failed to open '%s'", image_filename);
Ian Rogers8d31bbd2013-10-13 10:44:14 -0700200 return nullptr;
Ian Rogers1d54e732013-05-02 21:10:01 -0700201 }
202 ImageHeader image_header;
203 bool success = file->ReadFully(&image_header, sizeof(image_header));
204 if (!success || !image_header.IsValid()) {
Narayan Kamath52f84882014-05-02 10:10:39 +0100205 *error_msg = StringPrintf("Invalid image header in '%s'", image_filename);
Ian Rogers8d31bbd2013-10-13 10:44:14 -0700206 return nullptr;
Ian Rogers1d54e732013-05-02 21:10:01 -0700207 }
Mathieu Chartier31e89252013-08-28 11:29:12 -0700208
209 // Note: The image header is part of the image due to mmap page alignment required of offset.
Ian Rogers1d54e732013-05-02 21:10:01 -0700210 UniquePtr<MemMap> map(MemMap::MapFileAtAddress(image_header.GetImageBegin(),
Mathieu Chartier31e89252013-08-28 11:29:12 -0700211 image_header.GetImageSize(),
Ian Rogers1d54e732013-05-02 21:10:01 -0700212 PROT_READ | PROT_WRITE,
Hiroshi Yamauchi4fb5df82014-03-13 15:10:27 -0700213 MAP_PRIVATE,
Ian Rogers1d54e732013-05-02 21:10:01 -0700214 file->Fd(),
215 0,
Ian Rogers8d31bbd2013-10-13 10:44:14 -0700216 false,
Narayan Kamath52f84882014-05-02 10:10:39 +0100217 image_filename,
Ian Rogers8d31bbd2013-10-13 10:44:14 -0700218 error_msg));
Ian Rogers1d54e732013-05-02 21:10:01 -0700219 if (map.get() == NULL) {
Ian Rogers8d31bbd2013-10-13 10:44:14 -0700220 DCHECK(!error_msg->empty());
221 return nullptr;
Ian Rogers1d54e732013-05-02 21:10:01 -0700222 }
223 CHECK_EQ(image_header.GetImageBegin(), map->Begin());
224 DCHECK_EQ(0, memcmp(&image_header, map->Begin(), sizeof(ImageHeader)));
225
Mathieu Chartier31e89252013-08-28 11:29:12 -0700226 UniquePtr<MemMap> image_map(MemMap::MapFileAtAddress(nullptr, image_header.GetImageBitmapSize(),
227 PROT_READ, MAP_PRIVATE,
228 file->Fd(), image_header.GetBitmapOffset(),
Ian Rogers8d31bbd2013-10-13 10:44:14 -0700229 false,
Narayan Kamath52f84882014-05-02 10:10:39 +0100230 image_filename,
Ian Rogers8d31bbd2013-10-13 10:44:14 -0700231 error_msg));
232 if (image_map.get() == nullptr) {
233 *error_msg = StringPrintf("Failed to map image bitmap: %s", error_msg->c_str());
234 return nullptr;
235 }
Ian Rogersef7d42f2014-01-06 12:55:46 -0800236 uint32_t bitmap_index = bitmap_index_.FetchAndAdd(1);
Narayan Kamath52f84882014-05-02 10:10:39 +0100237 std::string bitmap_name(StringPrintf("imagespace %s live-bitmap %u", image_filename,
Mathieu Chartier31e89252013-08-28 11:29:12 -0700238 bitmap_index));
Mathieu Chartiera8e8f9c2014-04-09 14:51:05 -0700239 UniquePtr<accounting::ContinuousSpaceBitmap> bitmap(
240 accounting::ContinuousSpaceBitmap::CreateFromMemMap(bitmap_name, image_map.release(),
241 reinterpret_cast<byte*>(map->Begin()),
242 map->Size()));
Ian Rogers8d31bbd2013-10-13 10:44:14 -0700243 if (bitmap.get() == nullptr) {
244 *error_msg = StringPrintf("Could not create bitmap '%s'", bitmap_name.c_str());
245 return nullptr;
246 }
Mathieu Chartier31e89252013-08-28 11:29:12 -0700247
Ian Rogers1d54e732013-05-02 21:10:01 -0700248 Runtime* runtime = Runtime::Current();
249 mirror::Object* resolution_method = image_header.GetImageRoot(ImageHeader::kResolutionMethod);
Brian Carlstromea46f952013-07-30 01:26:50 -0700250 runtime->SetResolutionMethod(down_cast<mirror::ArtMethod*>(resolution_method));
Jeff Hao88474b42013-10-23 16:24:40 -0700251 mirror::Object* imt_conflict_method = image_header.GetImageRoot(ImageHeader::kImtConflictMethod);
252 runtime->SetImtConflictMethod(down_cast<mirror::ArtMethod*>(imt_conflict_method));
253 mirror::Object* default_imt = image_header.GetImageRoot(ImageHeader::kDefaultImt);
254 runtime->SetDefaultImt(down_cast<mirror::ObjectArray<mirror::ArtMethod>*>(default_imt));
Ian Rogers1d54e732013-05-02 21:10:01 -0700255
256 mirror::Object* callee_save_method = image_header.GetImageRoot(ImageHeader::kCalleeSaveMethod);
Brian Carlstromea46f952013-07-30 01:26:50 -0700257 runtime->SetCalleeSaveMethod(down_cast<mirror::ArtMethod*>(callee_save_method), Runtime::kSaveAll);
Ian Rogers1d54e732013-05-02 21:10:01 -0700258 callee_save_method = image_header.GetImageRoot(ImageHeader::kRefsOnlySaveMethod);
Brian Carlstromea46f952013-07-30 01:26:50 -0700259 runtime->SetCalleeSaveMethod(down_cast<mirror::ArtMethod*>(callee_save_method), Runtime::kRefsOnly);
Ian Rogers1d54e732013-05-02 21:10:01 -0700260 callee_save_method = image_header.GetImageRoot(ImageHeader::kRefsAndArgsSaveMethod);
Brian Carlstromea46f952013-07-30 01:26:50 -0700261 runtime->SetCalleeSaveMethod(down_cast<mirror::ArtMethod*>(callee_save_method), Runtime::kRefsAndArgs);
Ian Rogers1d54e732013-05-02 21:10:01 -0700262
Narayan Kamath52f84882014-05-02 10:10:39 +0100263 UniquePtr<ImageSpace> space(new ImageSpace(image_filename, image_location,
264 map.release(), bitmap.release()));
Mathieu Chartier31e89252013-08-28 11:29:12 -0700265 if (kIsDebugBuild) {
266 space->VerifyImageAllocations();
267 }
Brian Carlstrom56d947f2013-07-15 13:14:23 -0700268
Narayan Kamath52f84882014-05-02 10:10:39 +0100269 space->oat_file_.reset(space->OpenOatFile(image_filename, error_msg));
Ian Rogers8d31bbd2013-10-13 10:44:14 -0700270 if (space->oat_file_.get() == nullptr) {
271 DCHECK(!error_msg->empty());
272 return nullptr;
Ian Rogers1d54e732013-05-02 21:10:01 -0700273 }
Brian Carlstrom56d947f2013-07-15 13:14:23 -0700274
Ian Rogers8d31bbd2013-10-13 10:44:14 -0700275 if (validate_oat_file && !space->ValidateOatFile(error_msg)) {
276 DCHECK(!error_msg->empty());
277 return nullptr;
Brian Carlstrom56d947f2013-07-15 13:14:23 -0700278 }
279
280 if (VLOG_IS_ON(heap) || VLOG_IS_ON(startup)) {
281 LOG(INFO) << "ImageSpace::Init exiting (" << PrettyDuration(NanoTime() - start_time)
282 << ") " << *space.get();
283 }
284 return space.release();
285}
286
Nicolas Geoffray9583fbc2014-02-28 15:21:07 +0000287OatFile* ImageSpace::OpenOatFile(const char* image_path, std::string* error_msg) const {
Brian Carlstrom56d947f2013-07-15 13:14:23 -0700288 const ImageHeader& image_header = GetImageHeader();
Nicolas Geoffray9583fbc2014-02-28 15:21:07 +0000289 std::string oat_filename = ImageHeader::GetOatLocationFromImageLocation(image_path);
290
Brian Carlstrom56d947f2013-07-15 13:14:23 -0700291 OatFile* oat_file = OatFile::Open(oat_filename, oat_filename, image_header.GetOatDataBegin(),
Ian Rogers8d31bbd2013-10-13 10:44:14 -0700292 !Runtime::Current()->IsCompiler(), error_msg);
Brian Carlstrom56d947f2013-07-15 13:14:23 -0700293 if (oat_file == NULL) {
Ian Rogers8d31bbd2013-10-13 10:44:14 -0700294 *error_msg = StringPrintf("Failed to open oat file '%s' referenced from image %s: %s",
295 oat_filename.c_str(), GetName(), error_msg->c_str());
296 return nullptr;
Brian Carlstrom56d947f2013-07-15 13:14:23 -0700297 }
298 uint32_t oat_checksum = oat_file->GetOatHeader().GetChecksum();
299 uint32_t image_oat_checksum = image_header.GetOatChecksum();
300 if (oat_checksum != image_oat_checksum) {
Ian Rogers8d31bbd2013-10-13 10:44:14 -0700301 *error_msg = StringPrintf("Failed to match oat file checksum 0x%x to expected oat checksum 0x%x"
302 " in image %s", oat_checksum, image_oat_checksum, GetName());
303 return nullptr;
Brian Carlstrom56d947f2013-07-15 13:14:23 -0700304 }
305 return oat_file;
306}
307
Ian Rogers8d31bbd2013-10-13 10:44:14 -0700308bool ImageSpace::ValidateOatFile(std::string* error_msg) const {
Brian Carlstrom56d947f2013-07-15 13:14:23 -0700309 CHECK(oat_file_.get() != NULL);
Mathieu Chartier31e89252013-08-28 11:29:12 -0700310 for (const OatFile::OatDexFile* oat_dex_file : oat_file_->GetOatDexFiles()) {
Brian Carlstrom56d947f2013-07-15 13:14:23 -0700311 const std::string& dex_file_location = oat_dex_file->GetDexFileLocation();
312 uint32_t dex_file_location_checksum;
Ian Rogers8d31bbd2013-10-13 10:44:14 -0700313 if (!DexFile::GetChecksum(dex_file_location.c_str(), &dex_file_location_checksum, error_msg)) {
314 *error_msg = StringPrintf("Failed to get checksum of dex file '%s' referenced by image %s: "
315 "%s", dex_file_location.c_str(), GetName(), error_msg->c_str());
Brian Carlstrom56d947f2013-07-15 13:14:23 -0700316 return false;
317 }
318 if (dex_file_location_checksum != oat_dex_file->GetDexFileLocationChecksum()) {
Ian Rogers8d31bbd2013-10-13 10:44:14 -0700319 *error_msg = StringPrintf("ValidateOatFile found checksum mismatch between oat file '%s' and "
320 "dex file '%s' (0x%x != 0x%x)",
321 oat_file_->GetLocation().c_str(), dex_file_location.c_str(),
322 oat_dex_file->GetDexFileLocationChecksum(),
323 dex_file_location_checksum);
Brian Carlstrom56d947f2013-07-15 13:14:23 -0700324 return false;
325 }
326 }
327 return true;
328}
329
Ian Rogers8d31bbd2013-10-13 10:44:14 -0700330OatFile* ImageSpace::ReleaseOatFile() {
Brian Carlstrom56d947f2013-07-15 13:14:23 -0700331 CHECK(oat_file_.get() != NULL);
Ian Rogers8d31bbd2013-10-13 10:44:14 -0700332 return oat_file_.release();
Ian Rogers1d54e732013-05-02 21:10:01 -0700333}
334
Ian Rogers1d54e732013-05-02 21:10:01 -0700335void ImageSpace::Dump(std::ostream& os) const {
336 os << GetType()
Mathieu Chartier590fee92013-09-13 13:46:47 -0700337 << " begin=" << reinterpret_cast<void*>(Begin())
Ian Rogers1d54e732013-05-02 21:10:01 -0700338 << ",end=" << reinterpret_cast<void*>(End())
339 << ",size=" << PrettySize(Size())
340 << ",name=\"" << GetName() << "\"]";
341}
342
343} // namespace space
344} // namespace gc
345} // namespace art