diff options
| -rw-r--r-- | build/Android.common.mk | 13 | ||||
| -rw-r--r-- | build/Android.oat.mk | 4 | ||||
| -rw-r--r-- | src/gc/atomic_stack.h | 6 | ||||
| -rw-r--r-- | src/gc/card_table.cc | 6 | ||||
| -rw-r--r-- | src/heap.cc | 5 | ||||
| -rw-r--r-- | src/image_test.cc | 14 | ||||
| -rw-r--r-- | src/mem_map.cc | 11 | ||||
| -rw-r--r-- | src/oat/runtime/mips/runtime_support_mips.S | 57 |
8 files changed, 66 insertions, 50 deletions
diff --git a/build/Android.common.mk b/build/Android.common.mk index 0d31237766..193afbfb51 100644 --- a/build/Android.common.mk +++ b/build/Android.common.mk @@ -78,11 +78,20 @@ art_debug_cflags := \ -DDYNAMIC_ANNOTATIONS_ENABLED=1 \ -UNDEBUG -ART_HOST_CFLAGS := $(art_cflags) -DANDROID_SMP=1 +# start of image reserved address space +IMG_HOST_BASE_ADDRESS := 0x60000000 + +ifeq ($(TARGET_ARCH),mips) +IMG_TARGET_BASE_ADDRESS := 0x30000000 +else +IMG_TARGET_BASE_ADDRESS := 0x60000000 +endif + +ART_HOST_CFLAGS := $(art_cflags) -DANDROID_SMP=1 -DART_BASE_ADDRESS=$(IMG_HOST_BASE_ADDRESS) # The host GCC isn't necessarily new enough to support -Wthread-safety (GCC 4.4). ART_HOST_CFLAGS := $(filter-out -Wthread-safety,$(ART_HOST_CFLAGS)) -ART_TARGET_CFLAGS := $(art_cflags) -DART_TARGET +ART_TARGET_CFLAGS := $(art_cflags) -DART_TARGET -DART_BASE_ADDRESS=$(IMG_TARGET_BASE_ADDRESS) ifeq ($(TARGET_CPU_SMP),true) ART_TARGET_CFLAGS += -DANDROID_SMP=1 else diff --git a/build/Android.oat.mk b/build/Android.oat.mk index cdb7349b80..78682048e8 100644 --- a/build/Android.oat.mk +++ b/build/Android.oat.mk @@ -27,10 +27,6 @@ OATDUMPD := $(HOST_OUT_EXECUTABLES)/oatdumpd$(HOST_EXECUTABLE_SUFFIX) # TODO: for now, override with debug version for better error reporting OATDUMP := $(OATDUMPD) -# start of image reserved address space -IMG_HOST_BASE_ADDRESS := 0x60000000 -IMG_TARGET_BASE_ADDRESS := 0x60000000 - PRELOADED_CLASSES := frameworks/base/preloaded-classes ######################################################################## diff --git a/src/gc/atomic_stack.h b/src/gc/atomic_stack.h index 349486101d..d67d2f2868 100644 --- a/src/gc/atomic_stack.h +++ b/src/gc/atomic_stack.h @@ -136,11 +136,7 @@ class AtomicStack { // Size in number of elements. void Init() { mem_map_.reset(MemMap::MapAnonymous(name_.c_str(), NULL, capacity_ * sizeof(T), PROT_READ | PROT_WRITE)); - if (mem_map_.get() == NULL) { - std::string maps; - ReadFileToString("/proc/self/maps", &maps); - LOG(FATAL) << "couldn't allocate mark stack\n" << maps; - } + CHECK(mem_map_.get() != NULL) << "couldn't allocate mark stack"; byte* addr = mem_map_->Begin(); CHECK(addr != NULL); begin_ = reinterpret_cast<T*>(addr); diff --git a/src/gc/card_table.cc b/src/gc/card_table.cc index 5a1e9b5ef7..a5531d8fa0 100644 --- a/src/gc/card_table.cc +++ b/src/gc/card_table.cc @@ -54,11 +54,7 @@ CardTable* CardTable::Create(const byte* heap_begin, size_t heap_capacity) { /* Allocate an extra 256 bytes to allow fixed low-byte of base */ UniquePtr<MemMap> mem_map(MemMap::MapAnonymous("dalvik-card-table", NULL, capacity + 256, PROT_READ | PROT_WRITE)); - if (mem_map.get() == NULL) { - std::string maps; - ReadFileToString("/proc/self/maps", &maps); - LOG(FATAL) << "couldn't allocate card table\n" << maps; - } + CHECK(mem_map.get() != NULL) << "couldn't allocate card table"; // All zeros is the correct initial value; all clean. Anonymous mmaps are initialized to zero, we // don't clear the card table to avoid unnecessary pages being allocated COMPILE_ASSERT(kCardClean == 0, card_clean_must_be_0); diff --git a/src/heap.cc b/src/heap.cc index 33f83660bb..2ed467f2d4 100644 --- a/src/heap.cc +++ b/src/heap.cc @@ -87,7 +87,8 @@ static bool GenerateImage(const std::string& image_file_name) { const char* oat_file_option = oat_file_option_string.c_str(); arg_vector.push_back(strdup(oat_file_option)); - arg_vector.push_back(strdup("--base=0x60000000")); + std::string base_option_string(StringPrintf("--base=0x%x", ART_BASE_ADDRESS)); + arg_vector.push_back(strdup(base_option_string.c_str())); std::string command_line(Join(arg_vector, ' ')); LOG(INFO) << command_line; @@ -233,8 +234,8 @@ Heap::Heap(size_t initial_size, size_t growth_limit, size_t min_free, size_t max growth_limit, capacity, requested_begin)); alloc_space_ = alloc_space.release(); - alloc_space_->SetFootprintLimit(alloc_space_->Capacity()); CHECK(alloc_space_ != NULL) << "Failed to create alloc space"; + alloc_space_->SetFootprintLimit(alloc_space_->Capacity()); AddSpace(alloc_space_); // Spaces are sorted in order of Begin(). diff --git a/src/image_test.cc b/src/image_test.cc index b72226ba85..feb490c651 100644 --- a/src/image_test.cc +++ b/src/image_test.cc @@ -48,13 +48,15 @@ TEST_F(ImageTest, WriteRead) { } } - ImageWriter writer(NULL); ScratchFile tmp_image; - const uintptr_t requested_image_base = 0x60000000; - bool success_image = writer.Write(tmp_image.GetFilename(), requested_image_base, - tmp_oat.GetFilename(), tmp_oat.GetFilename(), - *compiler_.get()); - ASSERT_TRUE(success_image); + const uintptr_t requested_image_base = ART_BASE_ADDRESS; + { + ImageWriter writer(NULL); + bool success_image = writer.Write(tmp_image.GetFilename(), requested_image_base, + tmp_oat.GetFilename(), tmp_oat.GetFilename(), + *compiler_.get()); + ASSERT_TRUE(success_image); + } { UniquePtr<File> file(OS::OpenFile(tmp_image.GetFilename().c_str(), false)); diff --git a/src/mem_map.cc b/src/mem_map.cc index 653eb3ffe4..f322773f97 100644 --- a/src/mem_map.cc +++ b/src/mem_map.cc @@ -87,8 +87,11 @@ MemMap* MemMap::MapAnonymous(const char* name, byte* addr, size_t byte_count, in byte* actual = reinterpret_cast<byte*>(mmap(addr, page_aligned_byte_count, prot, flags, fd.get(), 0)); if (actual == MAP_FAILED) { + std::string maps; + ReadFileToString("/proc/self/maps", &maps); PLOG(ERROR) << "mmap(" << reinterpret_cast<void*>(addr) << ", " << page_aligned_byte_count - << ", " << prot << ", " << flags << ", " << fd.get() << ", 0) failed for " << name; + << ", " << prot << ", " << flags << ", " << fd.get() << ", 0) failed for " << name + << "\n" << maps; return NULL; } return new MemMap(name, actual, byte_count, actual, page_aligned_byte_count, prot); @@ -110,7 +113,11 @@ MemMap* MemMap::MapFileAtAddress(byte* addr, size_t byte_count, int prot, int fl fd, page_aligned_offset)); if (actual == MAP_FAILED) { - PLOG(ERROR) << "mmap failed"; + std::string maps; + ReadFileToString("/proc/self/maps", &maps); + PLOG(ERROR) << "mmap(" << reinterpret_cast<void*>(addr) << ", " << page_aligned_byte_count + << ", " << prot << ", " << flags << ", " << fd << ", " << page_aligned_offset + << ") failed\n" << maps; return NULL; } return new MemMap("file", actual + page_offset, byte_count, actual, page_aligned_byte_count, diff --git a/src/oat/runtime/mips/runtime_support_mips.S b/src/oat/runtime/mips/runtime_support_mips.S index 349e802d26..bc0aecfbcd 100644 --- a/src/oat/runtime/mips/runtime_support_mips.S +++ b/src/oat/runtime/mips/runtime_support_mips.S @@ -22,7 +22,7 @@ /* Deliver the given exception */ .extern artDeliverExceptionFromCode /* Deliver an exception pending on a thread */ - .extern artDeliverPendingException + .extern artDeliverPendingExceptionFromCode /* Cache alignment for function entry */ .macro ALIGN_FUNCTION_ENTRY @@ -115,16 +115,17 @@ * exception is Thread::Current()->exception_ */ .macro DELIVER_PENDING_EXCEPTION - SETUP_SAVE_ALL_CALLEE_SAVE_FRAME # save callee saves for throw - move $a0, rSELF # pass Thread::Current - jal artDeliverPendingExceptionFromCode # artDeliverPendingExceptionFromCode(Thread*, $sp) - move $a1, $sp # pass $sp + SETUP_SAVE_ALL_CALLEE_SAVE_FRAME # save callee saves for throw + move $a0, rSELF # pass Thread::Current + la $t9, artDeliverPendingExceptionFromCode + jr $t9 # artDeliverPendingExceptionFromCode(Thread*, $sp) + move $a1, $sp # pass $sp .endm .macro RETURN_IF_NO_EXCEPTION lw $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ RESTORE_REF_ONLY_CALLEE_SAVE_FRAME - bnez $t0, 1f # success if no exception is pending + bnez $t0, 1f # success if no exception is pending nop jr $ra nop @@ -254,9 +255,10 @@ art_do_long_jump: art_deliver_exception_from_code: .cpload $25 SETUP_SAVE_ALL_CALLEE_SAVE_FRAME - move $a1, rSELF # pass Thread::Current - jal artDeliverExceptionFromCode # artDeliverExceptionFromCode(Throwable*, Thread*, $sp) - move $a2, $sp # pass $sp + move $a1, rSELF # pass Thread::Current + la $t9, artDeliverExceptionFromCode + jr $t9 # artDeliverExceptionFromCode(Throwable*, Thread*, $sp) + move $a2, $sp # pass $sp .global art_throw_null_pointer_exception_from_code .extern artThrowNullPointerExceptionFromCode @@ -267,9 +269,10 @@ art_deliver_exception_from_code: art_throw_null_pointer_exception_from_code: .cpload $25 SETUP_SAVE_ALL_CALLEE_SAVE_FRAME - move $a0, rSELF # pass Thread::Current - jal artThrowNullPointerExceptionFromCode # artThrowNullPointerExceptionFromCode(Thread*, $sp) - move $a1, $sp # pass $sp + move $a0, rSELF # pass Thread::Current + la $t9, artThrowNullPointerExceptionFromCode + jr $t9 # artThrowNullPointerExceptionFromCode(Thread*, $sp) + move $a1, $sp # pass $sp .global art_throw_div_zero_from_code .extern artThrowDivZeroFromCode @@ -281,7 +284,8 @@ art_throw_div_zero_from_code: .cpload $25 SETUP_SAVE_ALL_CALLEE_SAVE_FRAME move $a0, rSELF # pass Thread::Current - jal artThrowDivZeroFromCode # artThrowDivZeroFromCode(Thread*, $sp) + la $t9, artThrowDivZeroFromCode + jr $t9 # artThrowDivZeroFromCode(Thread*, $sp) move $a1, $sp # pass $sp .global art_throw_array_bounds_from_code @@ -293,9 +297,10 @@ art_throw_div_zero_from_code: art_throw_array_bounds_from_code: .cpload $25 SETUP_SAVE_ALL_CALLEE_SAVE_FRAME - move $a2, rSELF # pass Thread::Current - jal artThrowArrayBoundsFromCode # artThrowArrayBoundsFromCode(index, limit, Thread*, $sp) - move $a3, $sp # pass $sp + move $a2, rSELF # pass Thread::Current + la $t9, artThrowArrayBoundsFromCode + jr $t9 # artThrowArrayBoundsFromCode(index, limit, Thread*, $sp) + move $a3, $sp # pass $sp .global art_throw_stack_overflow_from_code .extern artThrowStackOverflowFromCode @@ -306,9 +311,10 @@ art_throw_array_bounds_from_code: art_throw_stack_overflow_from_code: .cpload $25 SETUP_SAVE_ALL_CALLEE_SAVE_FRAME - move $a0, rSELF # pass Thread::Current - jal artThrowStackOverflowFromCode # artThrowStackOverflowFromCode(Thread*, $sp) - move $a1, $sp # pass $sp + move $a0, rSELF # pass Thread::Current + la $t9, artThrowStackOverflowFromCode + jr $t9 # artThrowStackOverflowFromCode(Thread*, $sp) + move $a1, $sp # pass $sp .global art_throw_no_such_method_from_code .extern artThrowNoSuchMethodFromCode @@ -319,9 +325,10 @@ art_throw_stack_overflow_from_code: art_throw_no_such_method_from_code: .cpload $25 SETUP_SAVE_ALL_CALLEE_SAVE_FRAME - move $a1, rSELF # pass Thread::Current - jal artThrowNoSuchMethodFromCode # artThrowNoSuchMethodFromCode(method_idx, Thread*, $sp) - move $a2, $sp # pass $sp + move $a1, rSELF # pass Thread::Current + la $t9, artThrowNoSuchMethodFromCode + jr $t9 # artThrowNoSuchMethodFromCode(method_idx, Thread*, $sp) + move $a2, $sp # pass $sp /* * All generated callsites for interface invokes and invocation slow paths will load arguments @@ -349,8 +356,10 @@ art_throw_no_such_method_from_code: move $t0, $sp # save $sp addiu $sp, $sp, -16 # make space for extra args move $a3, rSELF # pass Thread::Current + sw $gp, 12($sp) # save $gp jal \cxx_name # (method_idx, this, caller, Thread*, $sp) sw $t0, 16($sp) # pass $sp + lw $gp, 12($sp) # restore $gp addiu $sp, $sp, 16 # release out args move $a0, $v0 # save target Method* move $t9, $v1 # save $v0->code_ @@ -866,12 +875,12 @@ art_trace_entry_from_code: move $a2, $ra # pass $ra jal artTraceMethodEntryFromCode # (Method*, Thread*, LR) move $a1, rSELF # pass Thread::Current - move $t0, $v0 # $t0 holds reference to code + move $t9, $v0 # $t9 holds reference to code lw $a0, 0($sp) lw $a1, 4($sp) lw $a2, 8($sp) lw $a3, 12($sp) - jalr $t0 # call method + jalr $t9 # call method addiu $sp, $sp, 16 /* intentional fallthrough */ |