summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLepton Wu <[email protected]>2019-10-29 17:52:21 -0700
committerMatt Turner <[email protected]>2019-10-29 20:50:05 -0700
commit1abf05764bacaa8828ffc8b08848d07b1ad3272c (patch)
treeaeee1a2e6ba2f44b2262a0ec2033a3c31b1f0a70
parent41407d5e9fcf9b73d402292e64fa9db02c372b5f (diff)
mapi: Improve the x86 tsd stubs performance.
This skips touching %ebx most times and it shows that glGetString performance increased from 114M/s to 120M/s on my desktop. Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Lepton Wu <[email protected]>
-rw-r--r--src/mapi/entry_x86_tsd.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/mapi/entry_x86_tsd.h b/src/mapi/entry_x86_tsd.h
index bd8db7b19f9..9526cdcef1a 100644
--- a/src/mapi/entry_x86_tsd.h
+++ b/src/mapi/entry_x86_tsd.h
@@ -44,18 +44,19 @@ __asm__(".text\n"
func ":"
#define STUB_ASM_CODE(slot) \
- "push %ebx\n\t" \
"call 1f\n\t" \
"1:\n\t" \
- "popl %ebx\n\t" \
- "addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx\n\t" \
- "movl " ENTRY_CURRENT_TABLE "@GOT(%ebx), %eax\n\t" \
+ "popl %ecx\n\t" \
+ "addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx\n\t" \
+ "movl " ENTRY_CURRENT_TABLE "@GOT(%ecx), %eax\n\t" \
"mov (%eax), %eax\n\t" \
"testl %eax, %eax\n\t" \
"jne 1f\n\t" \
+ "push %ebx\n\t" \
+ "movl %ecx, %ebx\n\t" \
"call " ENTRY_CURRENT_TABLE_GET "@PLT\n\t" \
+ "popl %ebx\n\t" \
"1:\n\t" \
- "pop %ebx\n\t" \
"jmp *(4 * " slot ")(%eax)"
#define MAPI_TMP_STUB_ASM_GCC