diff options
| author | 2011-10-09 17:10:22 -0700 | |
|---|---|---|
| committer | 2011-10-09 18:23:51 -0700 | |
| commit | ae67599981e17cdfd51418c35e56e2a7c5ef4c72 (patch) | |
| tree | 628f154344135cb51c94a9885b5cfae9e7a35f37 /src | |
| parent | c10717a0b86d5719556ac3286fcb47aa2f2416fc (diff) | |
Various assembly fixes.
Change-Id: I42655af8dc3d7201d53c3393cdc585d9faa8cb82
Diffstat (limited to 'src')
| -rw-r--r-- | src/assembler_arm.cc | 8 | ||||
| -rw-r--r-- | src/assembler_arm.h | 1 | ||||
| -rw-r--r-- | src/jni_internal_arm.cc | 11 | ||||
| -rw-r--r-- | src/object.h | 4 | ||||
| -rw-r--r-- | src/runtime_support_asm.S | 32 | ||||
| -rw-r--r-- | src/stub_arm.cc | 8 |
6 files changed, 36 insertions, 28 deletions
diff --git a/src/assembler_arm.cc b/src/assembler_arm.cc index cd0c5f59e2..e1976d7bdb 100644 --- a/src/assembler_arm.cc +++ b/src/assembler_arm.cc @@ -1046,6 +1046,14 @@ void ArmAssembler::blx(Register rm, Condition cond) { Emit(encoding); } +void ArmAssembler::bx(Register rm, Condition cond) { + CHECK_NE(rm, kNoRegister); + CHECK_NE(cond, kNoCondition); + int32_t encoding = (static_cast<int32_t>(cond) << kConditionShift) | + B24 | B21 | (0xfff << 8) | B4 | + (static_cast<int32_t>(rm) << kRmShift); + Emit(encoding); +} void ArmAssembler::MarkExceptionHandler(Label* label) { EmitType01(AL, 1, TST, 1, PC, R0, ShifterOperand(0)); diff --git a/src/assembler_arm.h b/src/assembler_arm.h index 3f979c62d9..e1d43e4ed1 100644 --- a/src/assembler_arm.h +++ b/src/assembler_arm.h @@ -346,6 +346,7 @@ class ArmAssembler : public Assembler { void b(Label* label, Condition cond = AL); void bl(Label* label, Condition cond = AL); void blx(Register rm, Condition cond = AL); + void bx(Register rm, Condition cond = AL); // Macros. // Add signed constant value to rd. May clobber IP. diff --git a/src/jni_internal_arm.cc b/src/jni_internal_arm.cc index 93380b1076..f1ed092d1b 100644 --- a/src/jni_internal_arm.cc +++ b/src/jni_internal_arm.cc @@ -46,7 +46,7 @@ CompiledInvokeStub* ArmCreateInvokeStub(const Method* method) { // Move the managed thread pointer into R9. __ mov(R9, ShifterOperand(R2)); - // Reset R4 to suspend check intercal + // Reset R4 to suspend check interval __ LoadImmediate(R4, SUSPEND_CHECK_INTERVAL); // Move frame down for arguments less 3 pushed values above @@ -106,15 +106,10 @@ CompiledInvokeStub* ArmCreateInvokeStub(const Method* method) { __ blx(IP); // If the method returns a value, store it to the result pointer. - char ch = method->GetShorty()->CharAt(0); - if (ch != 'V') { + if (!method->IsReturnVoid()) { // Load the result JValue pointer of the stub caller's out args. __ LoadFromOffset(kLoadWord, IP, SP, frame_size); - if (ch == 'D' || ch == 'J') { - __ StoreToOffset(kStoreWordPair, R0, IP, 0); - } else { - __ StoreToOffset(kStoreWord, R0, IP, 0); - } + __ StoreToOffset(method->IsReturnALongOrDouble() ? kStoreWordPair : kStoreWord, R0, IP, 0); } // Remove the frame less the spilled R4, R9 and LR diff --git a/src/object.h b/src/object.h index 80a4ce92d1..e5036e61a7 100644 --- a/src/object.h +++ b/src/object.h @@ -755,6 +755,10 @@ class MANAGED Method : public AccessibleObject { bool IsReturnALong() const; + bool IsReturnALongOrDouble() const { + return IsReturnALong() || IsReturnADouble(); + } + bool IsReturnVoid() const; // "Args" may refer to any of the 3 levels of "Args." diff --git a/src/runtime_support_asm.S b/src/runtime_support_asm.S index 2017c40181..38eaf82ce5 100644 --- a/src/runtime_support_asm.S +++ b/src/runtime_support_asm.S @@ -182,7 +182,7 @@ art_handle_fill_data_from_code: bl artHandleFillArrayDataFromCode @ (Array* array, const uint16_t* table, Thread*, SP) RESTORE_REF_ONLY_CALLEE_SAVE_FRAME cmp r0, #0 @ success? - moveq pc, lr @ return on success + bxeq lr @ return on success DELIVER_PENDING_EXCEPTION .global art_lock_object_from_code @@ -209,7 +209,7 @@ art_unlock_object_from_code: bl artUnlockObjectFromCode @ (Object* obj, Thread*, SP) RESTORE_REF_ONLY_CALLEE_SAVE_FRAME cmp r0, #0 @ success? - moveq pc, lr @ return on success + bxeq lr @ return on success DELIVER_PENDING_EXCEPTION .global art_check_cast_from_code @@ -224,7 +224,7 @@ art_check_cast_from_code: bl artCheckCastFromCode @ (Class* a, Class* b, Thread*, SP) RESTORE_REF_ONLY_CALLEE_SAVE_FRAME cmp r0, #0 @ success? - moveq pc, lr @ return on success + bxeq lr @ return on success DELIVER_PENDING_EXCEPTION .global art_can_put_array_element_from_code @@ -235,14 +235,14 @@ art_check_cast_from_code: */ art_can_put_array_element_from_code: cmp r0, #0 @ return if element == NULL - moveq pc, lr + bxeq lr SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case exception allocation triggers GC mov r2, r9 @ pass Thread::Current mov r3, sp @ pass SP bl artCanPutArrayElementFromCode @ (Object* element, Class* array_class, Thread*, SP) RESTORE_REF_ONLY_CALLEE_SAVE_FRAME cmp r0, #0 @ success? - moveq pc, lr @ return on success + bxeq lr @ return on success DELIVER_PENDING_EXCEPTION .global art_initialize_static_storage_from_code @@ -260,7 +260,7 @@ art_initialize_static_storage_from_code: bl artInitializeStaticStorageFromCode RESTORE_REF_ONLY_CALLEE_SAVE_FRAME cmp r0, #0 @ success if result is non-null - movne pc, lr @ return on success + bxne lr @ return on success DELIVER_PENDING_EXCEPTION .global art_find_instance_field_from_code @@ -275,7 +275,7 @@ art_find_instance_field_from_code: bl artFindInstanceFieldFromCode @ (uint32_t field_idx, const Method* referrer, Thread*, SP) RESTORE_REF_ONLY_CALLEE_SAVE_FRAME cmp r0, #0 @ success if result is non-null - movne pc, lr @ return on success + bxne lr @ return on success DELIVER_PENDING_EXCEPTION .global art_get32_static_from_code @@ -291,7 +291,7 @@ art_get32_static_from_code: ldr r12, [r9, #THREAD_EXCEPTION_OFFSET] @ load Thread::Current()->exception_ RESTORE_REF_ONLY_CALLEE_SAVE_FRAME cmp r12, #0 @ success if no exception is pending - moveq pc, lr @ return on success + bxeq lr @ return on success DELIVER_PENDING_EXCEPTION .global art_get64_static_from_code @@ -307,7 +307,7 @@ art_get64_static_from_code: ldr r12, [r9, #THREAD_EXCEPTION_OFFSET] @ load Thread::Current()->exception_ RESTORE_REF_ONLY_CALLEE_SAVE_FRAME cmp r12, #0 @ success if no exception is pending - moveq pc, lr @ return on success + bxeq lr @ return on success DELIVER_PENDING_EXCEPTION .global art_get_obj_static_from_code @@ -323,7 +323,7 @@ art_get_obj_static_from_code: ldr r12, [r9, #THREAD_EXCEPTION_OFFSET] @ load Thread::Current()->exception_ RESTORE_REF_ONLY_CALLEE_SAVE_FRAME cmp r12, #0 @ success if no exception is pending - moveq pc, lr @ return on success + bxeq lr @ return on success DELIVER_PENDING_EXCEPTION .global art_set32_static_from_code @@ -338,7 +338,7 @@ art_set32_static_from_code: bl artSet32StaticFromCode @ (field_idx, referrer, new_val, Thread*, SP) RESTORE_REF_ONLY_CALLEE_SAVE_FRAME cmp r0, #0 @ success if result is 0 - moveq pc, lr @ return on success + bxeq lr @ return on success DELIVER_PENDING_EXCEPTION .global art_set64_static_from_code @@ -355,7 +355,7 @@ art_set64_static_from_code: add sp, #16 @ release out args RESTORE_REF_ONLY_CALLEE_SAVE_FRAME @ TODO: we can clearly save an add here cmp r0, #0 @ success if result is 0 - moveq pc, lr @ return on success + bxeq lr @ return on success DELIVER_PENDING_EXCEPTION .global art_set_obj_static_from_code @@ -370,7 +370,7 @@ art_set_obj_static_from_code: bl artSetObjStaticFromCode @ (field_idx, referrer, new_val, Thread*, SP) RESTORE_REF_ONLY_CALLEE_SAVE_FRAME cmp r0, #0 @ success if result is 0 - moveq pc, lr @ return on success + bxeq lr @ return on success DELIVER_PENDING_EXCEPTION .global art_alloc_object_from_code @@ -385,7 +385,7 @@ art_alloc_object_from_code: bl artAllocObjectFromCode @ (uint32_t type_idx, Method* method, Thread*, SP) RESTORE_REF_ONLY_CALLEE_SAVE_FRAME cmp r0, #0 @ success if result is non-null - movne pc, lr @ return on success + bxne lr @ return on success DELIVER_PENDING_EXCEPTION .global art_alloc_array_from_code @@ -401,7 +401,7 @@ art_alloc_array_from_code: bl artAllocArrayFromCode RESTORE_REF_ONLY_CALLEE_SAVE_FRAME cmp r0, #0 @ success if result is non-null - movne pc, lr @ return on success + bxne lr @ return on success DELIVER_PENDING_EXCEPTION .global art_check_and_alloc_array_from_code @@ -417,7 +417,7 @@ art_check_and_alloc_array_from_code: bl artCheckAndAllocArrayFromCode RESTORE_REF_ONLY_CALLEE_SAVE_FRAME cmp r0, #0 @ success if result is non-null - movne pc, lr @ return on success + bxne lr @ return on success DELIVER_PENDING_EXCEPTION .global art_test_suspend diff --git a/src/stub_arm.cc b/src/stub_arm.cc index bb36415586..b9593773d4 100644 --- a/src/stub_arm.cc +++ b/src/stub_arm.cc @@ -32,7 +32,7 @@ ByteArray* ArmCreateResolutionTrampoline(Runtime::TrampolineType type) { // Restore registers which may have been modified by GC and R0 which will now hold the method* __ DecreaseFrameSize(12); __ PopList(save); - __ mov(PC, ShifterOperand(R12)); // Leaf call to method's code + __ bx(R12); // Leaf call to method's code __ bkpt(0); @@ -89,11 +89,11 @@ ByteArray* CreateJniStub() { __ LoadFromOffset(kLoadWord, R12, TR, OFFSETOF_MEMBER(Thread, pFindNativeMethod)); __ blx(R12); __ mov(R12, ShifterOperand(R0)); // Save result of FindNativeMethod in R12 - __ AddConstant(SP, 12); // Restore registers (including outgoing arguments) + __ AddConstant(SP, 12); // Restore registers (including outgoing arguments) __ PopList(save); __ cmp(R12, ShifterOperand(0)); - __ mov(PC, ShifterOperand(R12), NE); // If R12 != 0 tail call into native code - __ mov(PC, ShifterOperand(LR)); // Return to caller to handle exception + __ bx(R12, NE); // If R12 != 0 tail call into native code + __ bx(LR); // Return to caller to handle exception assembler->EmitSlowPaths(); |