-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable per thread register state cache on libunwind #55049
Merged
IanButterworth
merged 4 commits into
JuliaLang:master
from
andrebsguedes:libunwind-per-thread-cache
Jul 31, 2024
+81
−27
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
6dc43b6
Enable per thread register state cache on libunwind
andrebsguedes 267d0dc
Include function to ensure tls allocation in the patch and call it fr…
andrebsguedes 9ce5f76
Bump LibUnwind_jll to v1.8.1+1 to enable per thread caches
andrebsguedes c4d71d9
Only ensure tls when libunwind is present
andrebsguedes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
diff --git a/include/libunwind-common.h.in b/include/libunwind-common.h.in | ||
index 893fdd69..80ab9648 100644 | ||
--- a/include/libunwind-common.h.in | ||
+++ b/include/libunwind-common.h.in | ||
@@ -340,5 +340,6 @@ extern int unw_get_elf_filename_by_ip (unw_addr_space_t, unw_word_t, char *, | ||
extern const char *unw_strerror (int); | ||
extern int unw_backtrace (void **, int); | ||
extern int unw_backtrace2 (void **, int, unw_context_t*, int); | ||
+extern int unw_ensure_tls (void); | ||
|
||
extern unw_addr_space_t unw_local_addr_space; | ||
diff --git a/src/dwarf/Gparser.c b/src/dwarf/Gparser.c | ||
index 7a5d7e1f..8453ffb0 100644 | ||
--- a/src/dwarf/Gparser.c | ||
+++ b/src/dwarf/Gparser.c | ||
@@ -623,7 +623,7 @@ get_rs_cache (unw_addr_space_t as, intrmask_t *saved_maskp) | ||
#if defined(HAVE___CACHE_PER_THREAD) && HAVE___CACHE_PER_THREAD | ||
if (likely (caching == UNW_CACHE_PER_THREAD)) | ||
{ | ||
- static _Thread_local struct dwarf_rs_cache tls_cache __attribute__((tls_model("initial-exec"))); | ||
+ static _Thread_local struct dwarf_rs_cache tls_cache; | ||
Debug (16, "using TLS cache\n"); | ||
cache = &tls_cache; | ||
} | ||
diff --git a/src/mi/init.c b/src/mi/init.c | ||
index e4431eeb..07cae852 100644 | ||
--- a/src/mi/init.c | ||
+++ b/src/mi/init.c | ||
@@ -82,3 +82,15 @@ mi_init (void) | ||
unw_init_page_size(); | ||
assert(sizeof(struct cursor) <= sizeof(unw_cursor_t)); | ||
} | ||
+ | ||
+int | ||
+unw_ensure_tls (void) | ||
+{ | ||
+#if defined(HAVE___CACHE_PER_THREAD) && HAVE___CACHE_PER_THREAD | ||
+ static _Thread_local int alloc_trigger; | ||
+ alloc_trigger = 1; | ||
+ return alloc_trigger; | ||
+#else | ||
+ return 0; | ||
+#endif | ||
+} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to upstream this patch?