Mesa (master): mapi: Inline call x86_current_tls.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Oct 24 23:49:52 UTC 2019
Module: Mesa
Branch: master
Commit: e137b3a9b71a2711c1f68c8a8b9c0a7407fbcc4b
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e137b3a9b71a2711c1f68c8a8b9c0a7407fbcc4b
Author: Lepton Wu <lepton at chromium.org>
Date: Mon Oct 21 20:22:18 2019 -0700
mapi: Inline call x86_current_tls.
This saves one return and a simple benchmark which calls glGetString
repeatedly on my desktop shows it improves calls per second from 118M
to 128M.
Signed-off-by: Lepton Wu <lepton at chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg at google.com>
---
src/mapi/entry_x86_tls.h | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/mapi/entry_x86_tls.h b/src/mapi/entry_x86_tls.h
index 545b5a3c786..4b3d6bd02ad 100644
--- a/src/mapi/entry_x86_tls.h
+++ b/src/mapi/entry_x86_tls.h
@@ -56,9 +56,13 @@ __asm__(".balign 16\n"
".balign 16\n" \
func ":"
-#define STUB_ASM_CODE(slot) \
- "call x86_current_tls\n\t" \
- "movl %gs:(%eax), %eax\n\t" \
+#define STUB_ASM_CODE(slot) \
+ "call 1f\n" \
+ "1:\n\t" \
+ "popl %eax\n\t" \
+ "addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %eax\n\t" \
+ "movl " ENTRY_CURRENT_TABLE "@GOTNTPOFF(%eax), %eax\n\t" \
+ "movl %gs:(%eax), %eax\n\t" \
"jmp *(4 * " slot ")(%eax)"
#define MAPI_TMP_STUB_ASM_GCC
More information about the mesa-commit
mailing list