diff options
author | 2018-01-17 18:11:30 +0000 | |
---|---|---|
committer | 2018-01-17 18:19:32 +0000 | |
commit | bf92b3f2d3374eab6bc40cc41574b51aae5a3718 (patch) | |
tree | e61d010ac4ce27810d0d34ffeca694a46c2a2fd5 | |
parent | fa0b0db6fbdcbf20bf78c53500ac98cfc3a26208 (diff) |
Clean up art_quick_check_instance_of entrypoints.
Test: Rely on TreeHugger.
Change-Id: I848b8b711ac6bfa90999701a518e2e70b42c3d57
-rw-r--r-- | runtime/arch/arm/quick_entrypoints_arm.S | 23 | ||||
-rw-r--r-- | runtime/arch/arm64/quick_entrypoints_arm64.S | 5 | ||||
-rw-r--r-- | runtime/arch/x86/quick_entrypoints_x86.S | 7 | ||||
-rw-r--r-- | runtime/arch/x86_64/quick_entrypoints_x86_64.S | 10 |
4 files changed, 22 insertions, 23 deletions
diff --git a/runtime/arch/arm/quick_entrypoints_arm.S b/runtime/arch/arm/quick_entrypoints_arm.S index c09baea72a..737d2a86a1 100644 --- a/runtime/arch/arm/quick_entrypoints_arm.S +++ b/runtime/arch/arm/quick_entrypoints_arm.S @@ -794,27 +794,24 @@ END art_quick_unlock_object_no_inline .extern artInstanceOfFromCode .extern artThrowClassCastExceptionForObject ENTRY art_quick_check_instance_of - push {r0-r1, lr} @ save arguments, link register and pad - .cfi_adjust_cfa_offset 12 + push {r0-r2, lr} @ save arguments, padding (r2) and link register + .cfi_adjust_cfa_offset 16 .cfi_rel_offset r0, 0 .cfi_rel_offset r1, 4 - .cfi_rel_offset lr, 8 - sub sp, #4 - .cfi_adjust_cfa_offset 4 + .cfi_rel_offset r2, 8 + .cfi_rel_offset lr, 12 bl artInstanceOfFromCode cbz r0, .Lthrow_class_cast_exception - add sp, #4 - .cfi_adjust_cfa_offset -4 - pop {r0-r1, pc} - .cfi_adjust_cfa_offset 4 @ Reset unwind info so following code unwinds. + pop {r0-r2, pc} + .Lthrow_class_cast_exception: - add sp, #4 - .cfi_adjust_cfa_offset -4 - pop {r0-r1, lr} - .cfi_adjust_cfa_offset -12 + pop {r0-r2, lr} + .cfi_adjust_cfa_offset -16 .cfi_restore r0 .cfi_restore r1 + .cfi_restore r2 .cfi_restore lr + SETUP_SAVE_ALL_CALLEE_SAVES_FRAME r2 @ save all registers as basis for long jump context mov r2, r9 @ pass Thread::Current bl artThrowClassCastExceptionForObject @ (Object*, Class*, Thread*) diff --git a/runtime/arch/arm64/quick_entrypoints_arm64.S b/runtime/arch/arm64/quick_entrypoints_arm64.S index 96a1cadab9..b0e7b0a964 100644 --- a/runtime/arch/arm64/quick_entrypoints_arm64.S +++ b/runtime/arch/arm64/quick_entrypoints_arm64.S @@ -1341,12 +1341,14 @@ ENTRY art_quick_check_instance_of // Call runtime code bl artInstanceOfFromCode + // Restore LR. + RESTORE_REG xLR, 24 + // Check for exception cbz x0, .Lthrow_class_cast_exception // Restore and return .cfi_remember_state - RESTORE_REG xLR, 24 RESTORE_TWO_REGS_DECREASE_FRAME x0, x1, 32 ret .cfi_restore_state // Reset unwind info so following code unwinds. @@ -1354,7 +1356,6 @@ ENTRY art_quick_check_instance_of .Lthrow_class_cast_exception: // Restore - RESTORE_REG xLR, 24 RESTORE_TWO_REGS_DECREASE_FRAME x0, x1, 32 SETUP_SAVE_ALL_CALLEE_SAVES_FRAME // save all registers as basis for long jump context diff --git a/runtime/arch/x86/quick_entrypoints_x86.S b/runtime/arch/x86/quick_entrypoints_x86.S index 93cb6656dc..5a28120b30 100644 --- a/runtime/arch/x86/quick_entrypoints_x86.S +++ b/runtime/arch/x86/quick_entrypoints_x86.S @@ -1436,17 +1436,18 @@ DEFINE_FUNCTION art_quick_check_instance_of PUSH eax // pass arg1 - obj call SYMBOL(artInstanceOfFromCode) // (Object* obj, Class* ref_klass) testl %eax, %eax - jz 1f // jump forward if not assignable + jz .Lthrow_class_cast_exception // jump forward if not assignable addl LITERAL(12), %esp // pop arguments CFI_ADJUST_CFA_OFFSET(-12) ret - CFI_ADJUST_CFA_OFFSET(12) // Reset unwind info so following code unwinds. -1: + +.Lthrow_class_cast_exception: POP eax // pop arguments POP ecx addl LITERAL(4), %esp CFI_ADJUST_CFA_OFFSET(-4) + SETUP_SAVE_ALL_CALLEE_SAVES_FRAME ebx, ebx // save all registers as basis for long jump context // Outgoing argument set up PUSH eax // alignment padding diff --git a/runtime/arch/x86_64/quick_entrypoints_x86_64.S b/runtime/arch/x86_64/quick_entrypoints_x86_64.S index 85f972309b..781ade99ce 100644 --- a/runtime/arch/x86_64/quick_entrypoints_x86_64.S +++ b/runtime/arch/x86_64/quick_entrypoints_x86_64.S @@ -1410,21 +1410,21 @@ DEFINE_FUNCTION art_quick_check_instance_of SETUP_FP_CALLEE_SAVE_FRAME call SYMBOL(artInstanceOfFromCode) // (Object* obj, Class* ref_klass) testq %rax, %rax - jz 1f // jump forward if not assignable + jz .Lthrow_class_cast_exception // jump forward if not assignable + CFI_REMEMBER_STATE RESTORE_FP_CALLEE_SAVE_FRAME addq LITERAL(24), %rsp // pop arguments CFI_ADJUST_CFA_OFFSET(-24) - -.Lreturn: ret + CFI_RESTORE_STATE // Reset unwind info so following code unwinds. - CFI_ADJUST_CFA_OFFSET(24 + 4 * 8) // Reset unwind info so following code unwinds. -1: +.Lthrow_class_cast_exception: RESTORE_FP_CALLEE_SAVE_FRAME addq LITERAL(8), %rsp // pop padding CFI_ADJUST_CFA_OFFSET(-8) POP rsi // Pop arguments POP rdi + SETUP_SAVE_ALL_CALLEE_SAVES_FRAME // save all registers as basis for long jump context mov %gs:THREAD_SELF_OFFSET, %rdx // pass Thread::Current() call SYMBOL(artThrowClassCastExceptionForObject) // (Object* src, Class* dest, Thread*) |