Alexandre Julliard : kernel: Implement FT_Exit directly in assembly
to avoid the overhead
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Jan 10 14:13:56 CST 2006
Module: wine
Branch: refs/heads/master
Commit: 52bce47b1463d5da3b39fb5bf0f2d786b5ac5ed4
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=52bce47b1463d5da3b39fb5bf0f2d786b5ac5ed4
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Jan 10 17:43:05 2006 +0100
kernel: Implement FT_Exit directly in assembly to avoid the overhead
of register functions.
---
dlls/kernel/kernel32.spec | 30 +++++++++++++++---------------
dlls/kernel/thunk.c | 36 ++++++++++--------------------------
2 files changed, 25 insertions(+), 41 deletions(-)
diff --git a/dlls/kernel/kernel32.spec b/dlls/kernel/kernel32.spec
index a467c5c..5524cd1 100644
--- a/dlls/kernel/kernel32.spec
+++ b/dlls/kernel/kernel32.spec
@@ -348,21 +348,21 @@
@ stub ExpungeConsoleCommandHistoryA
@ stub ExpungeConsoleCommandHistoryW
@ stub ExtendVirtualBuffer
-@ stdcall -i386 -register FT_Exit0()
-@ stdcall -i386 -register FT_Exit12()
-@ stdcall -i386 -register FT_Exit16()
-@ stdcall -i386 -register FT_Exit20()
-@ stdcall -i386 -register FT_Exit24()
-@ stdcall -i386 -register FT_Exit28()
-@ stdcall -i386 -register FT_Exit32()
-@ stdcall -i386 -register FT_Exit36()
-@ stdcall -i386 -register FT_Exit40()
-@ stdcall -i386 -register FT_Exit44()
-@ stdcall -i386 -register FT_Exit48()
-@ stdcall -i386 -register FT_Exit4()
-@ stdcall -i386 -register FT_Exit52()
-@ stdcall -i386 -register FT_Exit56()
-@ stdcall -i386 -register FT_Exit8()
+@ stdcall -i386 -norelay FT_Exit0()
+@ stdcall -i386 -norelay FT_Exit12()
+@ stdcall -i386 -norelay FT_Exit16()
+@ stdcall -i386 -norelay FT_Exit20()
+@ stdcall -i386 -norelay FT_Exit24()
+@ stdcall -i386 -norelay FT_Exit28()
+@ stdcall -i386 -norelay FT_Exit32()
+@ stdcall -i386 -norelay FT_Exit36()
+@ stdcall -i386 -norelay FT_Exit40()
+@ stdcall -i386 -norelay FT_Exit44()
+@ stdcall -i386 -norelay FT_Exit48()
+@ stdcall -i386 -norelay FT_Exit4()
+@ stdcall -i386 -norelay FT_Exit52()
+@ stdcall -i386 -norelay FT_Exit56()
+@ stdcall -i386 -norelay FT_Exit8()
@ stdcall -i386 -register FT_Prolog()
@ stdcall -i386 -register FT_Thunk()
@ stdcall FatalAppExitA(long str)
diff --git a/dlls/kernel/thunk.c b/dlls/kernel/thunk.c
index 863547a..c16df31 100644
--- a/dlls/kernel/thunk.c
+++ b/dlls/kernel/thunk.c
@@ -626,6 +626,8 @@ void WINAPI __regs_FT_Thunk( CONTEXT86 *
DEFINE_REGS_ENTRYPOINT( FT_Thunk, 0, 0 );
#endif
+#ifdef __i386__
+
/***********************************************************************
* FT_Exit0 (KERNEL32.@)
* FT_Exit4 (KERNEL32.@)
@@ -651,33 +653,15 @@ DEFINE_REGS_ENTRYPOINT( FT_Thunk, 0, 0 )
* and perform a return to the CALLER of the thunk code (while removing
* the given number of arguments from the caller's stack).
*/
-static inline void FT_Exit(CONTEXT86 *context)
-{
- /* Return value is in EBX */
- context->Eax = context->Ebx;
-
- /* Restore EBX, ESI, and EDI registers */
- context->Ebx = *(DWORD *)(context->Ebp - 4);
- context->Esi = *(DWORD *)(context->Ebp - 8);
- context->Edi = *(DWORD *)(context->Ebp - 12);
-
- /* Clean up stack frame */
- context->Esp = context->Ebp;
- context->Ebp = stack32_pop(context);
-
- /* Pop return address to CALLER of thunk code */
- context->Eip = stack32_pop(context);
-}
-
-#ifdef DEFINE_REGS_ENTRYPOINT
+#define FT_EXIT_RESTORE_REGS \
+ "movl %ebx,%eax\n\t" \
+ "movl -4(%ebp),%ebx\n\t" \
+ "movl -8(%ebp),%esi\n\t" \
+ "movl -12(%ebp),%edi\n\t" \
+ "leave\n\t"
#define DEFINE_FT_Exit(n) \
-void WINAPI __regs_FT_Exit ## n(CONTEXT86 *context) \
-{ \
- FT_Exit(context); \
- context->Esp += n; \
-} \
-DEFINE_REGS_ENTRYPOINT( FT_Exit ## n, 0, 0 )
+ __ASM_GLOBAL_FUNC( FT_Exit ## n, FT_EXIT_RESTORE_REGS "ret $" #n );
DEFINE_FT_Exit(0);
DEFINE_FT_Exit(4);
@@ -695,7 +679,7 @@ DEFINE_FT_Exit(48);
DEFINE_FT_Exit(52);
DEFINE_FT_Exit(56);
-#endif /* DEFINE_REGS_ENTRYPOINT */
+#endif /* __i386__ */
/***********************************************************************
More information about the wine-cvs
mailing list