summaryrefslogtreecommitdiff
path: root/makedef.pl
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2021-06-20 17:24:15 +0000
committerTony Cook <tony@develop-help.com>2021-09-07 15:46:16 +1000
commit3683a9ee5ad61f8cb5eac30e61b4936bd0445bdb (patch)
tree8ed6466fad66406cddf2e95282cbd438a9846271 /makedef.pl
parent65f7068160bfc9a3f4b195a579c881188cc4fff3 (diff)
downloadperl-3683a9ee5ad61f8cb5eac30e61b4936bd0445bdb.tar.gz
If we have thread local storage, use it instead of posix_getspecific().
Declare and use a variable PL_current_context to store a pointer to the thread's interpreter struct. Use this to implement implicit context undef ITHREADS, instead of a call to posix_getspecific(). For normal threaded code, this will eliminate function calls. For threaded code in shared objects (the typical configuration for Linux distribution builds) there still needs to be a function call to get the pointer to thread local variables, but there will only be one per function, not one per read of the variable.
Diffstat (limited to 'makedef.pl')
-rw-r--r--makedef.pl3
1 files changed, 3 insertions, 0 deletions
diff --git a/makedef.pl b/makedef.pl
index b5b07a7ece..f13573171e 100644
--- a/makedef.pl
+++ b/makedef.pl
@@ -189,6 +189,9 @@ my %skip;
# All platforms export boot_DynaLoader unconditionally.
my %export = ( boot_DynaLoader => 1 );
+++$export{PL_current_context}
+ if defined $Config{perl_thread_local} && $define{USE_ITHREADS};
+
sub try_symbols {
foreach my $symbol (@_) {
++$export{$symbol} unless exists $skip{$symbol};