Mesa (master): mapi: Inline call x86_current_tls.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Oct 30 00:19:42 UTC 2019
Module: Mesa
Branch: master
Commit: 41407d5e9fcf9b73d402292e64fa9db02c372b5f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=41407d5e9fcf9b73d402292e64fa9db02c372b5f
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 123M
to 141M.
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1997
Reviewed-by: Matt Turner <mattst88 at gmail.com>
Signed-off-by: Lepton Wu <lepton at chromium.org>
---
src/mapi/entry_x86_tls.h | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/mapi/entry_x86_tls.h b/src/mapi/entry_x86_tls.h
index b9386799792..58a27cef18e 100644
--- a/src/mapi/entry_x86_tls.h
+++ b/src/mapi/entry_x86_tls.h
@@ -33,7 +33,7 @@
#define HIDDEN
#endif
-#define X86_ENTRY_SIZE 16
+#define X86_ENTRY_SIZE 32
__asm__(".text");
@@ -58,9 +58,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