Branch: refs/heads/smoke-me/khw-env Home: https://github.com/Perl/perl5 Commit: e4072a83eac14631fe4ca5d14905adac58ec6977 https://github.com/Perl/perl5/commit/e4072a83eac14631fe4ca5d14905adac58ec6977 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023)
Changed paths: M embed.fnc M embed.h M embedvar.h M handy.h M inline.h M intrpvar.h M locale.c M makedef.pl M mg.c M perl.c M perl.h M pod/perlvar.pod M proto.h M sv.c Log Message: ----------- Add ability to emulate thread-safe locale operations Locale information was originally global for an entire process. Later, it was realized that different threads could want to be running in different locales. Windows added this ability, and POSIX 2008 followed suit (though using a completely different API). When available, perl automatically uses these capabilities. But many platforms have neither, or their implementation, such as on Darwin, is buggy. This commit adds the capability for Perl programs to operate as if the platform were thread-safe. This implementation is based on the observation that the underlying locale matters only to relatively few libc calls, and only during their execution. It can be anything at all at any other time. perl keeps what the proper locale should be for each category in a a per-thread array. Each locale-dependent operation must be wrapped in mutex lock/unlock operations. The lock additionally compares what libc knows the locale to be, and what it should be for this thread at this time, and changes the actual locale to the proper value if necessary. That's all that is needed. This commit adds macros to perl.h, for example "MBTOWC_LOCK_", that expand to do the mutex lock, and change the global locale to the expected value. On perls built without this emulation capability, they are no-ops. All code in the perl core (unless I've missed something), are changed to use these macros (there weren't actually many places that needed this). Thus, any pure perl program will automatically become locale-thread-safe under this Configuration. In order for XS code to also become locale-thread-safe, it must use these macros to wrap calls to locale-dependent functions. Relatively few modules call such functions. For example, the only one I found that ships with the perl core is Time::Piece, and it has more fundamental issues with running under threads than this. I am preparing pull requests for it. Thus, this is not completely transparent to code like native-thread-safe locale handling is. Therefore ${^SAFE_LOCALES} returns 2 (instead of 1) for this type of thread-safety. Another deficiency compared to the native thread safety is when a thread calls a non-perl library that accesses the locale. The typical example is Gtk (though this particular application can be configured to not be problematic). With the native safe threads, everything works as long as only one such thread is used per Perl program. That thread would then be the only one operating in the global locale, hence there are no conflicts. With this emulation, all threads are operating in the global locale, and mutexes would have to be used to prevent conflicts. To minimize those, the code added in this commit restores the global locale when through to the state it was in when started. A major concern is the performance impact. This is after all trading speed for accuracy. lib/locale_threads.t is noticeably slower when this is being used. But that is doing multiple threads constantly using locale-dependent operations. I don't notice any change with the rest of the test suite. In pure perl, this only comes into play while in the scope of 'use locale' or when using some of the few POSIX:: functions that are locale-dependent. And to some extent when formatting, but the regular overhead there should dwarf what this adds. This commit leaves this feature off by default. The next commit changes that for the next few 5.39 development releases, so we can see if there is actually an issue. Commit: 86070c1931554cd30146ae7de94433bdb0f0804c https://github.com/Perl/perl5/commit/86070c1931554cd30146ae7de94433bdb0f0804c Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M locale.c M makedef.pl M perl.h Log Message: ----------- Experimentally enable per-thread locale emulation This is set to end in 5.39.10, but will give us field experience in the meantime. Commit: 2014e1130918ffbd36550e3ba29b8173297aa05f https://github.com/Perl/perl5/commit/2014e1130918ffbd36550e3ba29b8173297aa05f Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M perl.h Log Message: ----------- XXX perl.h maybe drop Commit: 7c27b93485c066e6b15aba7a57986c48f77144d0 https://github.com/Perl/perl5/commit/7c27b93485c066e6b15aba7a57986c48f77144d0 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M makedef.pl Log Message: ----------- makedef.pl: PL_cur_locale_obj is only POSIX 2008 multiplicity Commit: 2536fcdfc061fd90eeb95b4b24653d0a55f2977e https://github.com/Perl/perl5/commit/2536fcdfc061fd90eeb95b4b24653d0a55f2977e Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M makedef.pl Log Message: ----------- makedef.pl: Move comment Commit: 8037c4592f4ef31e23d9e8dfc4b6be3c00638aa1 https://github.com/Perl/perl5/commit/8037c4592f4ef31e23d9e8dfc4b6be3c00638aa1 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M perl.h Log Message: ----------- Add DEBUG_SETLOCALE_INCONSISTENCIES Commit: d0f3f143216799a45d70f0c01e928d595dcecc18 https://github.com/Perl/perl5/commit/d0f3f143216799a45d70f0c01e928d595dcecc18 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M perl.h Log Message: ----------- Enable DEBUG_SETLOCALE_INCONSISTENCIES Commit: 56ecd3f1accfd5d96e2f5b1d12e348d5f4f2d60d https://github.com/Perl/perl5/commit/56ecd3f1accfd5d96e2f5b1d12e348d5f4f2d60d Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M embed.fnc M embed.h M locale.c M proto.h Log Message: ----------- add is_cur_locale_utf8 Commit: 030589872977f4881c25589d73561fb8d5123d12 https://github.com/Perl/perl5/commit/030589872977f4881c25589d73561fb8d5123d12 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M cpan/Time-Piece/Piece.xs Log Message: ----------- Time::Piece: Use reentrant API This single line magically makes this work much better under threading, though critical section locks need to be added as well. Commit: 873644f73c22358d58ed401b3e1f5601acdbfdb0 https://github.com/Perl/perl5/commit/873644f73c22358d58ed401b3e1f5601acdbfdb0 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M cpan/Time-Piece/Piece.xs Log Message: ----------- Time-Piece: Use foldEQ_locale() if available This core function available since 5.13.2 is thread-safe and knows about Perl internals, so is preferable to the similar libc function, which is now used only as a fallback. This commit also bomb proofs the code by adding an additional fallback, specified in C89, which isn't a great substitute, but far better than nothing. Commit: afe19fa7b74524153643931dcf87e8e14fdf30ca https://github.com/Perl/perl5/commit/afe19fa7b74524153643931dcf87e8e14fdf30ca Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M cpan/Time-Piece/Piece.xs Log Message: ----------- Time-Piece: Use isSPACE_LC, not isspace; etc isDIGIT_LC() does the same thing as isdigit when everything goes well, but is more robust when things get more complicated. The _LC forms are thread safe, for example. But note that this code doesn't work properly for a UTF-8 locale, as it assumes that a byte and character are the same thing. A major overhaul would be needed to handle that. Commit: 0d56fc65192c3f135acc02f36ed15471a2669f76 https://github.com/Perl/perl5/commit/0d56fc65192c3f135acc02f36ed15471a2669f76 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M thread.h Log Message: ----------- thread.h: White space only Indent some nested preproccessor defines Commit: dd2516f06440628ae0b491115590a0c841b308f6 https://github.com/Perl/perl5/commit/dd2516f06440628ae0b491115590a0c841b308f6 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M cpan/Time-Piece/Piece.pm M cpan/Time-Piece/Piece.xs M cpan/Time-Piece/Seconds.pm M dist/Module-CoreList/lib/Module/CoreList.pm Log Message: ----------- Time::Piece: Add critical sections This calls various macros to make certain libc calls uninterruptible, so that they can be used safely in threaded applications, when this module is loaded with a perl that supports this. The macros are defined to do nothing if the perl doesn't contain working versions of them. In such perls, the macros are also defined to do nothing except on configurations that could have races. Typically, an extra problem is that the libc calls return in a global static buffer, subject to being overwritten by another thread. But an earlier commit defined PERL_REENTRANT, which makes those functions transparently return in a thread-local buffer instead. That doesn't help if the function gets interrupted by another thread; this commit completes the process. Commit: e0a1ac6ae85215c5e3b71f1eaaccab0a25e54ffc https://github.com/Perl/perl5/commit/e0a1ac6ae85215c5e3b71f1eaaccab0a25e54ffc Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M cpan/Time-Piece/Piece.xs Log Message: ----------- XXX Time::Piece strftime Commit: d4b5775530c18a6f4dbe41d7875692ae17742cd8 https://github.com/Perl/perl5/commit/d4b5775530c18a6f4dbe41d7875692ae17742cd8 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M cpan/Time-Piece/Piece.xs Log Message: ----------- Time-Piece: notes to myself Commit: 5412de856296485a6b2510953cb902b192f89f9c https://github.com/Perl/perl5/commit/5412de856296485a6b2510953cb902b192f89f9c Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Slightly change wording of DEBUG messages This makes them more consistent with the other messages in this file. Commit: 66fcf379ac16f2a9777227174949c18e0c6df5cb https://github.com/Perl/perl5/commit/66fcf379ac16f2a9777227174949c18e0c6df5cb Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M util.c M win32/perlhost.h Log Message: ----------- XXX Win32 mem log Commit: 257b164e6efae6ce5d3046c1b7621df65836661b https://github.com/Perl/perl5/commit/257b164e6efae6ce5d3046c1b7621df65836661b Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M util.c Log Message: ----------- XXX util add thread to mem_log Commit: e1e767f1691eb82cf4b81a8bfc5dbb5349cb08f9 https://github.com/Perl/perl5/commit/e1e767f1691eb82cf4b81a8bfc5dbb5349cb08f9 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M locale.c Log Message: ----------- Debug wrap wset Commit: 176f608eda488c164d0380660a5553a9e00504f1 https://github.com/Perl/perl5/commit/176f608eda488c164d0380660a5553a9e00504f1 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Change some -DLv statements to -DL These debug statements show something isn't quite normal, so shouldn't require a verbose option to be displayed Commit: 8719a13f683d8aa31823c6c5de40ffee6309dc7f https://github.com/Perl/perl5/commit/8719a13f683d8aa31823c6c5de40ffee6309dc7f Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M pod/perlhacktips.pod Log Message: ----------- XXX incomplete perlhacktips: Commit: 3292e1481857b4b289d98eba6e4602569f6d19cb https://github.com/Perl/perl5/commit/3292e1481857b4b289d98eba6e4602569f6d19cb Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M iperlsys.h Log Message: ----------- iperlsys.h: TODO need to look at adding mutexes Commit: 3a3338fe8665eda4eca2e9f17a54bc73cee5a90e https://github.com/Perl/perl5/commit/3a3338fe8665eda4eca2e9f17a54bc73cee5a90e Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M regen/reentr.pl Log Message: ----------- reentr.pl: XXX about needing mutex Commit: 5f2c15b9e8423ee45fc909f09d4a8ce54eec987b https://github.com/Perl/perl5/commit/5f2c15b9e8423ee45fc909f09d4a8ce54eec987b Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M dist/ExtUtils-ParseXS/lib/perlxs.pod M t/porting/known_pod_issues.dat Log Message: ----------- perlxs Commit: f7a06246d9ff3a3a1ebc8d3798187a778658ecee https://github.com/Perl/perl5/commit/f7a06246d9ff3a3a1ebc8d3798187a778658ecee Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M pod/perlmod.pod Log Message: ----------- perlmod Commit: 3035eabbf21d4450eca1567a28f3fb3aa8f27b76 https://github.com/Perl/perl5/commit/3035eabbf21d4450eca1567a28f3fb3aa8f27b76 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M pod/perllocale.pod Log Message: ----------- perllocale Xxx start of changes Commit: d534c14247c16e650d0ed5b7082a4f159d57f636 https://github.com/Perl/perl5/commit/d534c14247c16e650d0ed5b7082a4f159d57f636 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M win32/config_H.gc M win32/config_h.PL M win32/config_sh.PL Log Message: ----------- XXX config Commit: 4dbf2d4e017b4247a8f399a91c22f75617b9e4d6 https://github.com/Perl/perl5/commit/4dbf2d4e017b4247a8f399a91c22f75617b9e4d6 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M hints/openbsd.sh Log Message: ----------- openbsd Commit: fb72142cb92d97008ceb0dc861083d6a4d5a537e https://github.com/Perl/perl5/commit/fb72142cb92d97008ceb0dc861083d6a4d5a537e Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M t/run/locale.t Log Message: ----------- XXX t/run/locale.t Commit: be3bcf89cde2f22137ceb206b8e5e65dc64a183f https://github.com/Perl/perl5/commit/be3bcf89cde2f22137ceb206b8e5e65dc64a183f Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M pod/perlembed.pod Log Message: ----------- f perlembed Commit: 2c73c5569fac6f9c1ee4f370ea6822df77ad0963 https://github.com/Perl/perl5/commit/2c73c5569fac6f9c1ee4f370ea6822df77ad0963 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M charclass_invlists.h M lib/unicore/uni_keywords.pl M regcharclass.h M uni_keywords.h Log Message: ----------- fmktables Commit: 56dbed82c088f09f4c4dc585edda5e9e2cb5ad2f https://github.com/Perl/perl5/commit/56dbed82c088f09f4c4dc585edda5e9e2cb5ad2f Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M locale.c Log Message: ----------- final commit Commit: af59aefa4be44599b990c5cb93171b8345ac3575 https://github.com/Perl/perl5/commit/af59aefa4be44599b990c5cb93171b8345ac3575 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Win32: We don't know the locale here And, so we don't know whether it is a UTF-8 locale or not. So use the proper enum value to indicate that. Commit: 9417212382d906942893c1b560cd9fb23354e1f0 https://github.com/Perl/perl5/commit/9417212382d906942893c1b560cd9fb23354e1f0 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M locale.c Log Message: ----------- XXX more work mingw Commit: cc798f0b27844f5d37ee308e682c90efa22854be https://github.com/Perl/perl5/commit/cc798f0b27844f5d37ee308e682c90efa22854be Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M pp.c Log Message: ----------- pp Commit: 21b4b0dd35e226b30a69a5a2a63d284a77f7f4b4 https://github.com/Perl/perl5/commit/21b4b0dd35e226b30a69a5a2a63d284a77f7f4b4 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M pp.c Log Message: ----------- Revert "pp" This reverts commit 1133b83f4bd637f8641d66b48abd2bf7b5525ee3. Commit: fcc73a5f1380e67b14d5b23fd5fb72413a6ec874 https://github.com/Perl/perl5/commit/fcc73a5f1380e67b14d5b23fd5fb72413a6ec874 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M pp.c Log Message: ----------- Revert "pp.c" This reverts commit 6b8211cf799406b7044deceefb3b3f1a31515bda. Commit: df939bed8f44b9031c3fc4b4b796d790a1666fbb https://github.com/Perl/perl5/commit/df939bed8f44b9031c3fc4b4b796d790a1666fbb Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M lib/locale_threads.t Log Message: ----------- locale_threads: start of using platform locales Commit: 9803ed409d7ddf2ede30c3cba80c68abb8d9e2b3 https://github.com/Perl/perl5/commit/9803ed409d7ddf2ede30c3cba80c68abb8d9e2b3 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M lib/locale_threads.t Log Message: ----------- Revert "locale_threads: start of using platform locales" This reverts commit a7a8dea3aabb81a05aacaf3a26c49854a5854111. Commit: d79d8ad94714a485fcca7cc516d1a2159d9f398d https://github.com/Perl/perl5/commit/d79d8ad94714a485fcca7cc516d1a2159d9f398d Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M locale.c M perl.c M sv.c Log Message: ----------- define numeric values to be C when no USE_NUMERIC Commit: 0cd795d6634478d8a5ced38b263ef04dd516d41f https://github.com/Perl/perl5/commit/0cd795d6634478d8a5ced38b263ef04dd516d41f Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M locale.c M perl.c M sv.c Log Message: ----------- Revert "define numeric values to be C when no USE_NUMERIC" This reverts commit 9bb7ff6531bf9e28d635a71e6d55c752a995da2d. Commit: 7823b45c91ccf43ffedc05d654d486a1afca2178 https://github.com/Perl/perl5/commit/7823b45c91ccf43ffedc05d654d486a1afca2178 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Silence some compiler warnings These only occur when pretending that this is a MingW compilation, which is a development-only tool to catch errors before they show up on a real MingW box. This would never get compiled for real. Commit: 2a2a278304af82ceea4e6d4694e202ca4a4ba975 https://github.com/Perl/perl5/commit/2a2a278304af82ceea4e6d4694e202ca4a4ba975 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Add braces, indent code Prior to this commit, the 'switch' immediately followed the 'if' without a left brace for the 'if'. This conserved indentation and was feasible because the scopes were identical.. But a future commit will want to have the scope of the 'if' be larger than that of the 'switch', so add the braces for the 'if' and indent the 'switch' code. This commit also fixes white space on another line Commit: c6e0ebbe5f38a82738d3f1868bd354c155a00a8e https://github.com/Perl/perl5/commit/c6e0ebbe5f38a82738d3f1868bd354c155a00a8e Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Simplify loop A slight restructuring saves some lines. Commit: f68e5a675a3abf5747b22da7e4e3e09fc8a52a65 https://github.com/Perl/perl5/commit/f68e5a675a3abf5747b22da7e4e3e09fc8a52a65 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Change two #define names They will soon have a more general meaning than currently. Commit: b8e7c1999bbd69263ec15b594ed0ce3ddce03594 https://github.com/Perl/perl5/commit/b8e7c1999bbd69263ec15b594ed0ce3ddce03594 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Change parameter specification S_populate_hash_from_localeconv() takes a mask of one or two bits that specify which of LC_NUMERIC and/or LC_MONETARY to operate on. Prior to this commit, the appropriate bit was based on our internal index for the relevant category(ies). But we already have #defines of 0 for NUMERIC, and 1 for MONETARY. These are adjacent and start at 0, desirable properties that the internal index doesn't necessarily have. This commit changes to base the parameter on these 0,1 values. This will allow simplification in the next commit, and going forward. Commit: 4bed297a442d550807e1ea73e432ce6953eb4175 https://github.com/Perl/perl5/commit/4bed297a442d550807e1ea73e432ce6953eb4175 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Simplify some localeconv() code The previous commits have allowed this code to determine by looking at the position of a bit in a mask what is going on, and so the code that used to be there to cope with not having that can be removed. Commit: 402799a07f6ad4bffc094484506ffed7ccf3b2bc https://github.com/Perl/perl5/commit/402799a07f6ad4bffc094484506ffed7ccf3b2bc Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M embed.fnc M locale.c M proto.h Log Message: ----------- locale.c: Don't need a U32 Previous commits have caused only the lowest two bits in this variable to be used; don't need anything as explicit as a U32. Commit: 76eef9e1f3f845c6ec2ab59ab4ae45900c510144 https://github.com/Perl/perl5/commit/76eef9e1f3f845c6ec2ab59ab4ae45900c510144 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Move code to earlier in function This is in preparation for the object created here to be needed earlier. This commit also cleans up a comment related to the moved code Commit: 9b3375c17c24f01347cb61995ba89d8e86c69f59 https://github.com/Perl/perl5/commit/9b3375c17c24f01347cb61995ba89d8e86c69f59 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Reorder some statements in a switch() This unifies the common text in two case: statements, and makes all of them do their business in the same order. This makes it easier to compare and contrast the actions of the various case:s Commit: ce25c9cfd37ab501141e0ca6ab26d05c2862c1c0 https://github.com/Perl/perl5/commit/ce25c9cfd37ab501141e0ca6ab26d05c2862c1c0 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Remove unused #define Commit: 1cdc22ff172b3d31c22fcd83ece8d315e8ac3ebb https://github.com/Perl/perl5/commit/1cdc22ff172b3d31c22fcd83ece8d315e8ac3ebb Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Add some #defines And collapse an existing one into one of the new ones, so as to use a parallel naming convention These will be used in future commits Commit: e37328d65904639a89aee37233d853d115d9d452 https://github.com/Perl/perl5/commit/e37328d65904639a89aee37233d853d115d9d452 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Special case some C locale values On Windows and MingW, some of this code can be frequently called, and often with the C locale in effect. Normally localeconv() is called to fill in these values, but that is expensive in part because of a bunch of setlocale() calls, some of which are extra, needed because of bugs in the Windows libc. We can short circuit that for the common C locale case, as the values are specified by the C standard, so are known at compile time. Commit: 8ec4ae09a82c0f742d4b72d2ed0a9802ca9c5816 https://github.com/Perl/perl5/commit/8ec4ae09a82c0f742d4b72d2ed0a9802ca9c5816 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M embed.fnc M locale.c M proto.h Log Message: ----------- locale.c: Use parallel array to simplify This allows the numeric fields returned by localeconv() to have the same logic as the string fields, simplifying the code a bit. They weren't previously handled the same because one category doesn't have any numeric fields. But this is now handled by creating an array and making its corresponding element NULL, so the strings and numeric fields are handled in the same way. Commit: 0401b2a435b55c889ac398fd3aa5335de7cd4a29 https://github.com/Perl/perl5/commit/0401b2a435b55c889ac398fd3aa5335de7cd4a29 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M embed.fnc M embed.h M locale.c M proto.h Log Message: ----------- Special case localeconv when NUMERIC, MONETARY must be C When both these categories are C, we don't need to call localeconv(), which can be expensive because it may mean toggling locales. Instead the answers are well defined by the C Standard. This adds a function that returns those, and #ifdef's to locale.c to compile to use the special function instead of the more general one if both categories must be C. A future commit will extend the use of this new function to more cases. Commit: 080980ed643e1cd010ad2f5b0c4123417b44ac51 https://github.com/Perl/perl5/commit/080980ed643e1cd010ad2f5b0c4123417b44ac51 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Move some code When called with just a single item, we only need a single call to the populating function, so move this code ahead of the 2nd call. This also clarifies the comments. Commit: 97741c536d46ee11956a8227954b944d9a7aea05 https://github.com/Perl/perl5/commit/97741c536d46ee11956a8227954b944d9a7aea05 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M locale.c Log Message: ----------- locale.c Special case localeconv for C locale An earlier commit created a function that speedily works when both LC_NUMERIC and LC_MONETARY are confined to the C locale, such as in OpenBSD. This commit extends that to use this function whenever a category happens to be in the C locale. This is a common case, that is thus sped up. Over the course of the development of locale.c, the meaning of not having the various categories changed from not being on the machine, or not paying attention to them, to instead mean, even if they are on the machine, they are always kept in the C locale. This code was not updated to reflect that; and this commit also does that updating. Commit: bf2be0d351e54b19c0b742dd35f0b938bc5001a5 https://github.com/Perl/perl5/commit/bf2be0d351e54b19c0b742dd35f0b938bc5001a5 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Use out-of-bounds value for illegality This was using 0 as a parameter, which is a legal value and could have been confused by the called subroutine as being legitimate. It is not a bug because of the way the subroutine is currently written given the other parameters in this call. But it is more robust to use an out-of-bounds value, so that if the function were to change, we would sooner find out about any improper call. Commit: 2f559a6942b40b3202ad742f3d3c20831683d475 https://github.com/Perl/perl5/commit/2f559a6942b40b3202ad742f3d3c20831683d475 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Skip locale utf8ness calculation if feasible I originally wrote this to save time processing the strings returned by localeconv(). If we know that the locale isn't UTF-8, then we don't have to calculate this for each string returned, Thus "Calculate once, not many times". But I hadn't realized that likely only one string is ever going to be non-ASCII: the currency symbol. (The decimal and thousands separators could also be, but of the >500 locales on my Linux box, only ps_AF has them so. That is the Pashtun language in Afghanistan; not a frequently occurring locale.) So it comes down to either case is effectively "calculate once". And it is generally more expensive to calculate the UTF8ness of a locale than a particular string in it, especially when those strings are going to be ASCII, as in this case. This commit changes to not calculate the locale's UTF8ness. Commit: 8c0de5c639fd17fb5c5857a3b4e1b9ad42c1b255 https://github.com/Perl/perl5/commit/8c0de5c639fd17fb5c5857a3b4e1b9ad42c1b255 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Avoid unnecessary work around localeconv() There are now two different functions that return the values for localeconv(). One is for when the locale is "C"; the other for everything else. The C one returns values that don't need adjusting, so skip that for this case. This commit removes the SvPOK check which was recently added by fe048cfaa3b42320785bd0c34896ac834634db22. It was needed for before we got values when -DNO_LOCALE_MONETARY is specified. Now that we do get those values, the SV always will contain a PV at this point. Commit: 0b3e94832fd1b1f8ffb70b39b3a55ca453138f45 https://github.com/Perl/perl5/commit/0b3e94832fd1b1f8ffb70b39b3a55ca453138f45 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Do an adjustment in a critical section This adjustment was deferred until after the critical section, but it is only an extra conditional and variable set, whose time should be dwarfed by the store to the hash, so I think it's all right to add it to the critical section. Commit: ccdad10db52e44915e320201f1045f80dc5c91aa https://github.com/Perl/perl5/commit/ccdad10db52e44915e320201f1045f80dc5c91aa Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M locale.c Log Message: ----------- Do localeconv() adjustments immediately unthreaded localeconv() must be called and its struct processed in a critical section when other threads or embedded perls could also be using it. Something like StructCopy can't be used to save its values, as a deep copy is needed. Some of the processing can be expensive, so is deferred to a separate pass after the critical section. But if no critical section is needed, it's cheaper to do the processing as we go along doing the copy. A comment removed in this commit said that the reason this wasn't done was because of an extra maintenance cost (having to maintain the code in two places). But when I actually looked at what it would like like to do this, I found it is essentially just an extra function call, not enough "extra" to worry about. Commit: 348c1c53b8452d6003e5e8f6cafd1a7528543b58 https://github.com/Perl/perl5/commit/348c1c53b8452d6003e5e8f6cafd1a7528543b58 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M embed.fnc M embed.h M locale.c M proto.h Log Message: ----------- locale.c: Better handle the case of no localeconv() localeconv() is a C89 function, but we have long checked for its absence, and returned an empty hash if missing. Now the code has been changed so that it's trivial for us to instead return the hash filled in as if the C locale is in effect. This commit does that. There are two possible reasons for localeconv to be listed as missing. One is if the Configure probe we've long had for it didn't find it, and the other is that it is irreparably broken, so a hints file says don't use it. localeconv() historically has been buggy in various implementations, so I think its worthwhile to retain this little bit of code related to it's being broken. If it truly is absent from the platform, its struct definition isn't likely to be there either, so I added a definition for convenience, #ifdef'd out Commit: 623352d00a1127004c35c9b0a4c97d2762a98b05 https://github.com/Perl/perl5/commit/623352d00a1127004c35c9b0a4c97d2762a98b05 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M lib/locale_threads.t Log Message: ----------- Revert "locale_threads.t: Skip on OpenBSD and DragonFly threaded builds" This reverts commit 1d74e8214dd53cf0fa9e8c5aab3e6187685eadcd, as they have been modified Commit: 3600f6cc07b87705ab6cfb018f3aff83a641ff65 https://github.com/Perl/perl5/commit/3600f6cc07b87705ab6cfb018f3aff83a641ff65 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M hints/openbsd.sh Log Message: ----------- openbsd: Not thread safe locales Commit: 017ae99f55be63ddb5b159f9c6c5fe977adbea82 https://github.com/Perl/perl5/commit/017ae99f55be63ddb5b159f9c6c5fe977adbea82 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M locale.c Log Message: ----------- mismatched ctype Commit: 3d4985821c08052f79b9ecec43cfbb158ce1396a https://github.com/Perl/perl5/commit/3d4985821c08052f79b9ecec43cfbb158ce1396a Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M hints/openbsd.sh Log Message: ----------- openbsd hints Commit: 64cb81b9b09b1b90fb957218e84aaf6b8aeaec1a https://github.com/Perl/perl5/commit/64cb81b9b09b1b90fb957218e84aaf6b8aeaec1a Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M hints/openbsd.sh Log Message: ----------- openbsd mismatched ctype hints Commit: d5722c913e1914214363ecb306cb24346be1f6d9 https://github.com/Perl/perl5/commit/d5722c913e1914214363ecb306cb24346be1f6d9 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M locale.c Log Message: ----------- langinfo_l Commit: 37ced6c14a9d8d5ab74162c0bb729eab8101be94 https://github.com/Perl/perl5/commit/37ced6c14a9d8d5ab74162c0bb729eab8101be94 Author: Karl Williamson <k...@cpan.org> Date: 2023-11-22 (Wed, 22 Nov 2023) Changed paths: M locale.c Log Message: ----------- wrap uselocale Compare: https://github.com/Perl/perl5/compare/33968aea5a83...37ced6c14a9d