Working dex2oat and oatexec
adb shell dex2oatd --dex-file=/system/framework/core.jar --image=/system/framework/boot.oat --base=0x50000000 "'--method=Ljava/lang/System;logI(Ljava/lang/String;)V'" "'--method=Ljava/lang/System;log(CLjava/lang/String;Ljava/lang/Throwable;)V'"
adb shell dex2oatd --boot-dex-file=/system/framework/core.jar --boot=/system/framework/boot.oat --dex-file=/system/framework/art-test-dex-HelloWorld.jar --image=/system/framework/art-test-dex-HelloWorld.oat
adb shell oatexecd -Xbootclasspath:/system/framework/core.jar -Xbootimage:/system/framework/boot.oat -classpath /system/framework/art-test-dex-HelloWorld.jar -Ximage:/system/framework/art-test-dex-HelloWorld.oat HelloWorld
09-05 17:58:18.912 2385 2385 I System : Hello, world!
Change-Id: I53e534068584f0c3a837313e4d517a0e4a7154fc
diff --git a/src/heap.cc b/src/heap.cc
index be3d154..86d19a8 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -37,7 +37,9 @@
MemberOffset Heap::reference_pendingNext_offset_ = MemberOffset(0);
MemberOffset Heap::finalizer_reference_zombie_offset_ = MemberOffset(0);
-bool Heap::Init(size_t initial_size, size_t maximum_size, const char* boot_image_file_name) {
+bool Heap::Init(size_t initial_size, size_t maximum_size,
+ const char* boot_image_file_name,
+ std::vector<const char*>& image_file_names) {
Space* boot_space;
byte* requested_base;
if (boot_image_file_name == NULL) {
@@ -46,14 +48,28 @@
} else {
boot_space = Space::Create(boot_image_file_name);
if (boot_space == NULL) {
+ LOG(WARNING) << "Failed to create space from " << boot_image_file_name;
return false;
}
spaces_.push_back(boot_space);
requested_base = boot_space->GetBase() + RoundUp(boot_space->Size(), kPageSize);
}
+ std::vector<Space*> image_spaces;
+ for (size_t i = 0; i < image_file_names.size(); i++) {
+ Space* space = Space::Create(image_file_names[i]);
+ if (space == NULL) {
+ LOG(WARNING) << "Failed to create space from " << image_file_names[i];
+ return false;
+ }
+ image_spaces.push_back(space);
+ spaces_.push_back(space);
+ requested_base = space->GetBase() + RoundUp(space->Size(), kPageSize);
+ }
+
Space* space = Space::Create(initial_size, maximum_size, requested_base);
if (space == NULL) {
+ LOG(WARNING) << "Failed to create alloc space";
return false;
}
@@ -68,12 +84,14 @@
// Allocate the initial live bitmap.
UniquePtr<HeapBitmap> live_bitmap(HeapBitmap::Create(base, num_bytes));
if (live_bitmap.get() == NULL) {
+ LOG(WARNING) << "Failed to create live bitmap";
return false;
}
// Allocate the initial mark bitmap.
UniquePtr<HeapBitmap> mark_bitmap(HeapBitmap::Create(base, num_bytes));
if (mark_bitmap.get() == NULL) {
+ LOG(WARNING) << "Failed to create mark bitmap";
return false;
}
@@ -93,6 +111,9 @@
boot_space_ = boot_space;
RecordImageAllocations(boot_space);
}
+ for (size_t i = 0; i < image_spaces.size(); i++) {
+ RecordImageAllocations(image_spaces[i]);
+ }
return true;
}