combine PL_strategy_* bools into 1 exported symbol #23532
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.
Not part of commit msg, I'm not sure what these bools even do since they are highly POSIX specific, and the extra descriptions I added might be missing a couple bullet points for future readers.
The original commit that added them in 2018 by davem at 999d65e was following Win16 ABI, Symbian ABI, and perhaps the WinCE ABI rules before I revived the WinCE ABI. Maybe
a.out
ShLib ABI rules too for whatevera.out
was.And perhaps was also following the Perl 5.6.0-5.10.0 rules thats its 100% safe to forever delete your employers
Receivables.xs
file from your employersAccounts::Receivables.pm
tarball, since P5P promised "never recompile you CPAN XS binaries again!!!" with each newer stable libperl at that time.They can be safely collapsed into 1 struct nowadays. The OSes are long gone that required perl.bin's or libperl.so.dll's funcs and visible to CPAN global vars, to be hard coded U32 offsets in the so called "symbol table". Those OSes never had a symbol table in the first place!!!
I'm leaving the illegal atomic reads/writes notes in there. Since checking various publishers of C11/C++11 headers show, certain vendors and publishers of those C11/C++11 headers, DO NOT believe any Intel or AMD CPU chips, that either company has ever produced, not the i386 or i486 or Pentium Classic/Pentium MMX or Pentium II, or any Intel Core iSeries, or any Athlon 64/Opteron/Ryzen that AMD has ever made, nope, not one of those chips are electrically capable of doing a 1 byte "char" atomic read or write in C89 or C99 or any version of C++. I wish that were a joke, I think it is, but some authors of certain FOSS/source available C++11 compliant header projects, say otherwise.
original commit msg below
These 9 symbols are just 2 bits wide bools. I presume each one is declared as a 4 byte int because either they are lvals taking a 4 byte enum assignment or because C doesn't acknowledge the SMP concept and doesn't describe any unit tests for threads or SMP address spaces. ISO C stopped describing what volatile and register do on a HW level long ago.
Considering all current former and future CPU archs Perl has executed on, there is no money-back guarentee from all CPU mfgs that doing R/Ws to the same mem addr by 2 CPU cores will not shard or be atomic.
As of 5.43, metaconfig and perl.h still don't know about the std::atomic API that first appeared in C11/C++11. PL_strategy_* is required de-jure, not de-facto, by C11/C++11 to be using the atomic_load() token. It is very overkill to use the atomic_load() token on these PL_strategy_* vars.
atomic_load() can be added to PL_strategy_* after a verified and reproduced bug ticket on the correct permutation of hardware and compiler that needs it. Dr Memory, Asan, and Valgrind aren't hardware.
These 9 different exported linker symbols take up significant screen space in various C dev tools. These vars will never be part of a copy paste backtrace SEGV report. They are undocumented, not public CPAN API. The only user is doio.c They take up alot of bytes inside of libperl since symbol PL_strategy_mkstemp can't be smaller than 24 == (sizeof("PL_strategy_mkstemp") + sizeof(U32))
Dynamic instrumenting all dereferences of PL_strategy_dup but not instrumenting PL_strategy_mkstemp, using LD_PRELOAD inside a private + obsolete + proprietary + closed source + lost source build of libperl.so ...
All of the PL_strategy_* symbols have no references to them on Win32. The Win32 doio.o/doio.obj file doesn't link against the PL_strategy_* symbols. They would've been discarded on Windows, but their names appeared inside perldll.def so that is that and ABI is ABI.
The easiest step is to combine the symbols into 1 ascii C string name. Any other improvements will be more complex and can be done another time.
This step is beneficial on all OS since the shared library loaders on all OSes have to loop over the array of "Symbols" to connect 2 files, or 2 User Services (TM IBM), or 2 Subroutines (TM Larry Wall) atleast once on startup.
If this io_strategy code needs to be stepped debeg (unlikely) keeping all the bools together in 1 struct is easier to see their state in the watch window since its 1 name to type in vs 9 names.
The amount of vertical screen space these exported symbols occupy in C devel tools if they are drawn, and need to be scrolled or glanced by, or more partial match letters to type, vs what these syms/vars do and the state they hold, is the main reason this commit was written.