summaryrefslogtreecommitdiffstats
path: root/runtime/oat_file_assistant_test.cc
diff options
context:
space:
mode:
authorRichard Uhler <ruhler@google.com>2015-03-31 15:29:23 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-03-31 15:29:23 +0000
commit2910e15a5c67821c935e310ca51772d82095def2 (patch)
tree45ee30790bb879e67b859d04937f4f4e151ab484 /runtime/oat_file_assistant_test.cc
parentebbb1e322d8c89e69424a543faa03402e5b63673 (diff)
parent3efe979d4292330c8fab1708a4361e58681a88cb (diff)
downloadart-2910e15a5c67821c935e310ca51772d82095def2.zip
art-2910e15a5c67821c935e310ca51772d82095def2.tar.gz
art-2910e15a5c67821c935e310ca51772d82095def2.tar.bz2
Merge "Fix oat_file_assistant_test's ReserveImageSpace()."
Diffstat (limited to 'runtime/oat_file_assistant_test.cc')
-rw-r--r--runtime/oat_file_assistant_test.cc22
1 files changed, 11 insertions, 11 deletions
diff --git a/runtime/oat_file_assistant_test.cc b/runtime/oat_file_assistant_test.cc
index 0422fcd..a8b0876 100644
--- a/runtime/oat_file_assistant_test.cc
+++ b/runtime/oat_file_assistant_test.cc
@@ -210,29 +210,29 @@ class OatFileAssistantTest : public CommonRuntimeTest {
// image in case of the GSS collector.
+ 384 * MB;
- std::string error_msg;
std::unique_ptr<BacktraceMap> map(BacktraceMap::Create(getpid(), true));
ASSERT_TRUE(map.get() != nullptr) << "Failed to build process map";
for (BacktraceMap::const_iterator it = map->begin();
reservation_start < reservation_end && it != map->end(); ++it) {
- if (it->end <= reservation_start) {
- continue;
- }
-
- if (it->start < reservation_start) {
- reservation_start = std::min(reservation_end, it->end);
- }
+ ReserveImageSpaceChunk(reservation_start, std::min(it->start, reservation_end));
+ reservation_start = std::max(reservation_start, it->end);
+ }
+ ReserveImageSpaceChunk(reservation_start, reservation_end);
+ }
+ // Reserve a chunk of memory for the image space in the given range.
+ // Only has effect for chunks with a positive number of bytes.
+ void ReserveImageSpaceChunk(uintptr_t start, uintptr_t end) {
+ if (start < end) {
+ std::string error_msg;
image_reservation_.push_back(std::unique_ptr<MemMap>(
MemMap::MapAnonymous("image reservation",
- reinterpret_cast<uint8_t*>(reservation_start),
- std::min(it->start, reservation_end) - reservation_start,
+ reinterpret_cast<uint8_t*>(start), end - start,
PROT_NONE, false, false, &error_msg)));
ASSERT_TRUE(image_reservation_.back().get() != nullptr) << error_msg;
LOG(INFO) << "Reserved space for image " <<
reinterpret_cast<void*>(image_reservation_.back()->Begin()) << "-" <<
reinterpret_cast<void*>(image_reservation_.back()->End());
- reservation_start = it->end;
}
}