Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 89713b94b24f215a6be00d89c4617ae0f7a5bef7
      
https://github.com/Perl/perl5/commit/89713b94b24f215a6be00d89c4617ae0f7a5bef7
  Author: Karl Williamson <[email protected]>
  Date:   2022-09-01 (Thu, 01 Sep 2022)

  Changed paths:
    M embed.fnc
    M locale.c
    M proto.h

  Log Message:
  -----------
  locale.c: Rmv unused code in changing LC_COLLATE

The code to handle changing LC_COLLATE handled the possibility of being
passed a NULL locale name.  But we're not changing things unless we have
a new locale, and know its name, so a name is always passed


  Commit: 076763411b13b655be5ffd7f333401e18aaec81b
      
https://github.com/Perl/perl5/commit/076763411b13b655be5ffd7f333401e18aaec81b
  Author: Karl Williamson <[email protected]>
  Date:   2022-09-01 (Thu, 01 Sep 2022)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Don't assume LC_CTYPE, LC_COLLATE are same

This code is using isCNTRL_LC which depends on LC_CTYPE to verify that
something in the LC_COLLATE locale is a control.  That only works
properly if the two locales are the same.  This commit adds code to
ensure they are.


  Commit: 1915ba89671f6be36a1d93d99e6fb283ef3e1469
      
https://github.com/Perl/perl5/commit/1915ba89671f6be36a1d93d99e6fb283ef3e1469
  Author: Karl Williamson <[email protected]>
  Date:   2022-09-01 (Thu, 01 Sep 2022)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: strxfrm() requires LC_CTYPE eq LC_COLLATE

The libc functions strxfrm() on some platforms requires the LC_CTYPE
locale to be the same as the LC_COLLATE locale (or rather, probably that
they have the same code set, but checking for locale is cheaper).
Otherwise mojibake would result, or more likely the function will fail,
setting errno.

This commit brings the locales into alignment if necessary


  Commit: ef054375a834ab87fd0f1744c71a119333ff36bd
      
https://github.com/Perl/perl5/commit/ef054375a834ab87fd0f1744c71a119333ff36bd
  Author: Karl Williamson <[email protected]>
  Date:   2022-09-01 (Thu, 01 Sep 2022)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Use strxfrm_l() if available

This more modern version of the function doesn't require us to change
locales.


  Commit: 1362b2644fe28482093e6a00619d9f8a45013388
      
https://github.com/Perl/perl5/commit/1362b2644fe28482093e6a00619d9f8a45013388
  Author: Karl Williamson <[email protected]>
  Date:   2022-09-01 (Thu, 01 Sep 2022)

  Changed paths:
    M embed.fnc
    M embed.h
    M locale.c
    M proto.h
    M sv.c

  Log Message:
  -----------
  Change internal function name to be standards compliant

This is in preparation for working on it; the new name, mem_collxfrm_ is
in compliance with the C Standard; the old was not.


  Commit: 467b0d670252dc354cb1d7f51f44fd6ae198df61
      
https://github.com/Perl/perl5/commit/467b0d670252dc354cb1d7f51f44fd6ae198df61
  Author: Karl Williamson <[email protected]>
  Date:   2022-09-01 (Thu, 01 Sep 2022)

  Changed paths:
    M embed.fnc
    M embed.h
    M locale.c
    M proto.h

  Log Message:
  -----------
  locale.c: Improve debugging for mem_collxfrm()

This prints out more information, better organized.

It also moves up the info from -DLv to plain -DL


  Commit: f42ab9041bbeafc84bdc81081d142318ffcfb797
      
https://github.com/Perl/perl5/commit/f42ab9041bbeafc84bdc81081d142318ffcfb797
  Author: Karl Williamson <[email protected]>
  Date:   2022-09-01 (Thu, 01 Sep 2022)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Add debug statement for collation failure

Perhaps this should be a warning to the user that we couldn't calculate
collation info for the locale, but at least there should be a way to
get that info from a DEBUG statement


  Commit: 5fdda5120fe8ccbc9a4a67519d3e15fdd76c06e0
      
https://github.com/Perl/perl5/commit/5fdda5120fe8ccbc9a4a67519d3e15fdd76c06e0
  Author: Karl Williamson <[email protected]>
  Date:   2022-09-01 (Thu, 01 Sep 2022)

  Changed paths:
    M intrpvar.h
    M locale.c

  Log Message:
  -----------
  locale.c: Add 'Lazy' location changing

When comparing two strings for order under 'use locale', one can call
strcoll() which creates hidden modified versions of the strings based on
the locale's collation ordering, does the comparison, and then throws
away the modified versions.

Or one can call strxfrm() to create a non-hidden modified version of
each string, and then do a straight comparison.  The advantage here is
that you are in control of when to discard the modified version, and the
(expensive) transformation is done just once, no matter how many times a
comparison is done.

Perl assumes that a string will be compared multiple times, so the first
time it happens under 'use locale', strxfrm() is called, and the
modified string is attached via magic to the SV.  The modified string is
discarded if the string changes, or is recomputed if the locale has
changed since the computation was done.

The transformation generally occupies some multiple of size of the
original string.  Memory must be allocated to hold it.  For any given
locale, the amount is predictable for all strings, roughly via a linear
equation "mx+b", where x is the size of the original string.  By
computing 'm' and 'b' once, Perl can allocate enough memory to hold the
transformation, but not too much.  (m and b are adjusted up as necessary
as more strings get transformed.)  This minimizes mallocs.

But the calculation of m and b is somewhat expensive, and only necessary
if the program actually does a string compare under 'use locale'.

This commit defers the calculation until needed.  It does the bare
minimum of changes accomplish this.  The next commit will rearrange
things.


  Commit: 21afce673d6a6fb9bf757bcdad21ded54f5d351b
      
https://github.com/Perl/perl5/commit/21afce673d6a6fb9bf757bcdad21ded54f5d351b
  Author: Karl Williamson <[email protected]>
  Date:   2022-09-01 (Thu, 01 Sep 2022)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Move S_compute_collxfrm_coefficients in file

This moves this function, created in the previous commit by simply
wrapping existing code, to a more logical place in the file.


  Commit: cd55125d69f5f698ef7cbdd650cda7d2e59fc388
      
https://github.com/Perl/perl5/commit/cd55125d69f5f698ef7cbdd650cda7d2e59fc388
  Author: Karl Williamson <[email protected]>
  Date:   2022-09-01 (Thu, 01 Sep 2022)

  Changed paths:
    M embed.fnc
    M embed.h
    M intrpvar.h
    M locale.c
    M proto.h
    M sv.c

  Log Message:
  -----------
  Merge branch 'locale.c: Improve newcollate' into blead

newcollate is called when LC_COLLATE is set to a new locale. This series
of commits improves its operation

Some platforms require LC_CTYPE and LC_COLLATE to be the same locale in
order to operate properly. These commits now bring LC_CTYPE into sync
with LC_COLLATE for the duration of the calculations.

More and better debugging statements are added

Memory is allocated when a string is collated. The amount is roughly a
linear function of the string length, varying depending on the locale.
To save some recalculations, perl calculates and saves coefficients for
the current locale's equation once, revising them if necessary. Prior to
this commit, this somewhat expensive calculation was done every time the
locale changed. Now it is deferred until the first time it is needed.


Compare: https://github.com/Perl/perl5/compare/992e38c75c34...cd55125d69f5

Reply via email to