summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/arch/x86/portable_entrypoints_x86.S82
1 files changed, 43 insertions, 39 deletions
diff --git a/runtime/arch/x86/portable_entrypoints_x86.S b/runtime/arch/x86/portable_entrypoints_x86.S
index 24fa98be15..a0cacd0344 100644
--- a/runtime/arch/x86/portable_entrypoints_x86.S
+++ b/runtime/arch/x86/portable_entrypoints_x86.S
@@ -66,59 +66,63 @@ return_float_portable:
END_FUNCTION art_portable_invoke_stub
DEFINE_FUNCTION art_portable_proxy_invoke_handler
- // Fake callee save ref and args frame set up, note portable doesn't use callee save frames.
- // TODO: just save the registers that are needed in artPortableProxyInvokeHandler.
- PUSH edi // Save callee saves
- PUSH esi
- PUSH ebp
- PUSH ebx // Save args
- PUSH edx
- PUSH ecx
- PUSH eax // Align stack, eax will be clobbered by Method*
- // Begin argument set up.
- PUSH esp // pass SP
- pushl %fs:THREAD_SELF_OFFSET // pass Thread::Current()
- .cfi_adjust_cfa_offset 4
- PUSH ecx // pass receiver
- PUSH eax // pass proxy method
- call SYMBOL(artPortableProxyInvokeHandler) // (proxy method, receiver, Thread*, SP)
- movd %eax, %xmm0 // place return value also into floating point return value
+ PUSH ebp // Set up frame.
+ movl %esp, %ebp
+ .cfi_def_cfa_register %ebp
+ subl LITERAL(8), %esp // Align stack
+ leal 8(%ebp), %edx // %edx = ArtMethod** called_addr
+ movl 12(%ebp), %ecx // %ecx = receiver
+ movl 0(%edx), %eax // %eax = ArtMethod* called
+ pushl %edx // Pass called_addr.
+ pushl %fs:THREAD_SELF_OFFSET // Pass thread.
+ pushl %ecx // Pass receiver.
+ pushl %eax // Pass called.
+ call SYMBOL(artPortableProxyInvokeHandler) // (called, receiver, Thread*, &called)
+ leave
+ .cfi_restore %ebp
+ .cfi_def_cfa %esp, 4
+ movd %eax, %xmm0 // Place return value also into floating point return value.
movd %edx, %xmm1
punpckldq %xmm1, %xmm0
- addl LITERAL(44), %esp // pop arguments
- .cfi_adjust_cfa_offset -44
ret
END_FUNCTION art_portable_proxy_invoke_handler
DEFINE_FUNCTION art_portable_resolution_trampoline
- pushl %ebp
- movl %esp, %ebp // save ESP
+ PUSH ebp // Set up frame.
+ movl %esp, %ebp
+ .cfi_def_cfa_register %ebp
subl LITERAL(8), %esp // Align stack
- movl 8(%ebp), %eax // Method* called
- leal 8(%ebp), %edx // Method** called_addr
- pushl %edx // pass called_addr
- pushl %fs:THREAD_SELF_OFFSET // pass thread
- pushl %ecx // pass receiver
- pushl %eax // pass called
- call SYMBOL(artPortableResolutionTrampoline)
+ leal 8(%ebp), %edx // %edx = ArtMethod** called_addr
+ movl 12(%ebp), %ecx // %ecx = receiver
+ movl 0(%edx), %eax // %eax = ArtMethod* called
+ pushl %edx // Pass called_addr.
+ pushl %fs:THREAD_SELF_OFFSET // Pass thread.
+ pushl %ecx // Pass receiver.
+ pushl %eax // Pass called.
+ call SYMBOL(artPortableResolutionTrampoline) // (called, receiver, Thread*, &called)
leave
- cmpl LITERAL(0), %eax
- je resolve_fail
+ .cfi_restore %ebp
+ .cfi_def_cfa %esp, 4
+ testl %eax, %eax
+ jz resolve_fail
jmp * %eax
-resolve_fail:
+resolve_fail: // Resolution failed, return with exception pending.
ret
END_FUNCTION art_portable_resolution_trampoline
DEFINE_FUNCTION art_portable_to_interpreter_bridge
- pushl %ebp
- movl %esp, %ebp // save ESP
+ PUSH ebp // Set up frame.
+ movl %esp, %ebp
+ .cfi_def_cfa_register %ebp
subl LITERAL(12), %esp // Align stack
- movl 8(%ebp), %eax // Method* called
- leal 8(%ebp), %edx // Method** called_addr
- pushl %edx // pass called_addr
- pushl %fs:THREAD_SELF_OFFSET // pass thread
- pushl %eax // pass called
- call SYMBOL(artPortableToInterpreterBridge)
+ leal 8(%ebp), %edx // %edx = ArtMethod** called_addr
+ movl 0(%edx), %eax // %eax = ArtMethod* called
+ pushl %edx // Pass called_addr.
+ pushl %fs:THREAD_SELF_OFFSET // Pass thread.
+ pushl %eax // Pass called.
+ call SYMBOL(artPortableToInterpreterBridge) // (called, Thread*, &called)
leave
+ .cfi_restore %ebp
+ .cfi_def_cfa %esp, 4
ret
END_FUNCTION art_quick_to_interpreter_bridge