This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
5 years agoUpgrade to Thread::Queue 3.13
jdhedden [Wed, 18 Jul 2018 02:00:31 +0000 (22:00 -0400)]
Upgrade to Thread::Queue 3.13

5 years agoperldelta: Note illegality of some former deprecations
Karl Williamson [Tue, 17 Jul 2018 22:04:07 +0000 (16:04 -0600)]
perldelta: Note illegality of some former deprecations

5 years agoRemove updated modules from list of needing dot in @INC
Karl Williamson [Tue, 17 Jul 2018 20:17:11 +0000 (14:17 -0600)]
Remove updated modules from list of needing dot in @INC

Apparently the maintainers of all but two modules have updated them to
not need a dot in @INC.

The two remaining ones are

libnet
Filter-Util-Call

5 years agoMake utf8_to_uvchr() safer
Karl Williamson [Tue, 17 Jul 2018 19:57:54 +0000 (13:57 -0600)]
Make utf8_to_uvchr() safer

This function is deprecated because the API doesn't allow it to
determine the end of the input string, so it can read off the far end.
But I just realized that since many strings are NUL-terminated, so we
can forbid it from reading past the next NUL, and hence make it safe in
many cases.

5 years agoutf8.c: Add comments
Karl Williamson [Tue, 17 Jul 2018 19:32:01 +0000 (13:32 -0600)]
utf8.c: Add comments

Explain why we don't have to check the return code from
_invlist_search() here.  See [perl #133365]

5 years agoregexec.c: Use macro instead of Perl_invlist_search()
Karl Williamson [Tue, 17 Jul 2018 19:29:50 +0000 (13:29 -0600)]
regexec.c: Use macro instead of Perl_invlist_search()

There's no reason to use the function name, and by using the macro, this
code is insulated against future changes

5 years agoFix typo: IS_NUMBER_INFINITE -> IS_NUMBER_INFINITY
Tina Müller [Mon, 16 Jul 2018 11:10:24 +0000 (13:10 +0200)]
Fix typo: IS_NUMBER_INFINITE -> IS_NUMBER_INFINITY

For: RT # 133380

Committer: Tina Müller is now a Perl AUTHOR.

5 years agoperlop: Clarify tr''' behavior
Karl Williamson [Tue, 17 Jul 2018 13:58:36 +0000 (07:58 -0600)]
perlop: Clarify tr''' behavior

When the delimiter is an apostrophe, hyphens aren't special, and \x{},
for example, isn't interpolated.  This was confusing enough to me that I
filed ticket [perl #130679], which I will now reject

5 years agoperlop: Nits
Karl Williamson [Tue, 17 Jul 2018 13:54:03 +0000 (07:54 -0600)]
perlop: Nits

Add a word for emphasis, and split some unrelated concepts into separate
paragraphs

5 years agoRestore lost line from comment
Hugo van der Sanden [Tue, 17 Jul 2018 13:51:13 +0000 (14:51 +0100)]
Restore lost line from comment

This somehow disappeared in the mro => mro_core rename of 8b371338c1.

5 years agoClarify a comment - it's mini\.exists that gets deleted, not config.h
Steve Hay [Tue, 17 Jul 2018 07:37:47 +0000 (08:37 +0100)]
Clarify a comment - it's mini\.exists that gets deleted, not config.h

5 years agowin32/Makefile: prevent execution without CCTYPE set
Daniel Dragan [Sun, 13 May 2018 02:12:20 +0000 (22:12 -0400)]
win32/Makefile: prevent execution without CCTYPE set

MSVC6 is the oldest CC supported. I dont think many Win32 users use it
anymore since if they use VC Perl at all, it will be the latest
Visual Studio "Community Edition" MS released. win32/GNUMakefile and
win32/makefile.mk autodetect VC versions, the nmake one doesn't. Out of
habit someone (like me) might type "nmake" at cmd prompt with a newer VC
but there aren't any obvious symptoms of something going wrong until

C:\p525\src\miniperl.exe "-I..\..\lib" -MExtUtils::Command -e
chmod -- 755 ..\..\lib\auto\Win32CORE\Win32CORE.lib
..\miniperl.exe -I..\lib list_static_libs.pl > Extensions_static
link -dll -def:perldll.def -base:0x28000000 -out:..\perl528.dll
@Extensions_static @C:\Users\Owner\AppData\Local\Temp\nm9E37.tmp
perldll.def(2) : warning LNK4017: DESCRIPTION statement not supported for
the target platform; ignored
perldll.def : error LNK2001: unresolved external symbol PL_lc_numeric_mutex
..\perl528.lib : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 12.0\
VC\BIN\link.EXE"' : return code '0x460'
Stop.

Hitting this error because CCTYPE wasn't set, is very confusing and I spent
alot of time to debug it. The CCTYPE inside makedef.pl (MSVC60) didn't
match MSVC version inside perl.h (MSC_VER macro) after CPP, so the symbol
didn't exist in object file world but did exist the the synthesized object
file defines inside makedef.pl.

How to implement the check:

Creating a psuedo target that checks that CCTYPE isn't empty and putting
it very early in the dependency tree, like on the mini config.h target,
caused a rebuild the world every time nmake ran. Writing a psuedo target
file to disk would not catch the second wrong nmake run in a a
"nmake CCTYPE=MSVC70 ..\foo.obj" and then a "nmake test" execution list by
a dev. So just put the CCTYPE check on the CC and LINK macros since the
major of all recipies executed will be one or the other binary. A couple
targets, whose recipies are miniperl.exe running a .pl will escape the
CCTYPE check, but checking CCTYPE very late in the build process, becomes
pointless since the build would likely break and stop by that point.

Also mini config.h needs to be deleted if an empty CCTYPE was used since
the mini config.h target will suceed (but write an illogical config.h)
and if the user obeys the error and sets CCTYPE on 2nd nmake run,
mini config.h wont be rebuilt and will be for a different CC version
(a non-existant one) which will cause more undefined behavior further down
the build process.

5 years agowin32/Makefile: put mini config.h in correct place in dep tree
Daniel Dragan [Thu, 10 May 2018 18:00:14 +0000 (14:00 -0400)]
win32/Makefile: put mini config.h in correct place in dep tree

I fixed this for GNUMakefile and makefile.mk when I added the parallel
building feature to those 2 but I left nmake unfixed. Now fix it. This
commit allow a "nmake CCTYPE=MSVC90 av.obj" or
"nmake CCTYPE=MSVC90 mini/av.obj" or other individual build product
targets to work on a cleaned src tree, while previously you'd get with
the above commands
        cl -c -nologo -GF -W3 -I..\lib\CORE -I.\include -I. -I.. -DWIN32
-D_CONSOLE -DNO_STRICT -D_CRT_SECURE_NO_DEPRECATE
-D_CRT_NONSTDC_NO_DEPRECATE -DPERLDLL -DPERL_CORE   -O1 -MD -Zi -DNDEBUG
-GL -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -Fo.\mini\av.obj ..\av.c
av.c
c:\p525\src\perl.h(28) : fatal error C1083: Cannot open include file:
'config.h': No such file or directory
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 12.0
\VC\BIN\cl.EXE"' : return code '0x2'

Basically, "all" was the only target that worked on a clean src tree with
the nmake makefile previously. Also collapse the catting recipies into
single lines to speed up the mini config.h generation through less proc
starts of cmd.exe by nmake.exe. This reduces the mini config.h target time,
see timings in ticket associated with this comit. Also sync the sentinal
command (.exists) between all 3 mkfs for less diff-ness between the 3
mkfs (debugging aid).

5 years agoperlapi: AvFILL isn't deprecated
Karl Williamson [Tue, 17 Jul 2018 00:34:49 +0000 (18:34 -0600)]
perlapi: AvFILL isn't deprecated

See [perl #133278]

5 years agoCorrect POD formatting error.
James E Keenan [Mon, 16 Jul 2018 19:42:37 +0000 (19:42 +0000)]
Correct POD formatting error.

clang 6.0.0 was reporting:

    =cut missing? numeric.c:1087:*/

Add =cut to correspond to previous =for.

5 years agoperllocale: Improve pod appearance
Karl Williamson [Mon, 16 Jul 2018 16:40:47 +0000 (10:40 -0600)]
perllocale: Improve pod appearance

Using Z<> instead of NBSP improves the pod spacing.

5 years agolocale.c: Fix conditional compilation
Francois Perrad [Sun, 1 Jul 2018 22:17:44 +0000 (00:17 +0200)]
locale.c: Fix conditional compilation

With Perl 5.28.0, there are some mismatches between blocks
and conditional compilation in the Perl__is_cur_LC_category_utf8() function.
The compilation of miniperl could fails like this:
```
locale.c: In function `Perl__is_cur_LC_category_utf8`:
locale.c:5481:1: error: expected declaration or statement at end of input
 }
 ^
```

Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
5 years agoUpgrade Test::Simple from version 1.302136 to 1.302138
Steve Hay [Mon, 16 Jul 2018 07:55:18 +0000 (08:55 +0100)]
Upgrade Test::Simple from version 1.302136 to 1.302138

5 years agoUpgrade File::Temp from version 0.2306 to 0.2308
Steve Hay [Mon, 16 Jul 2018 07:49:06 +0000 (08:49 +0100)]
Upgrade File::Temp from version 0.2306 to 0.2308

5 years agoUpgrade DB_File from version 1.841 to 1.842
Steve Hay [Mon, 16 Jul 2018 07:47:01 +0000 (08:47 +0100)]
Upgrade DB_File from version 1.841 to 1.842

5 years agonumeric.c: Silence compiler warning
Karl Williamson [Sun, 15 Jul 2018 17:09:16 +0000 (11:09 -0600)]
numeric.c: Silence compiler warning

It is always expecting non-NULL, so make it so

5 years agoFix uninitialized error in my_atof3()
Karl Williamson [Sun, 15 Jul 2018 18:27:20 +0000 (12:27 -0600)]
Fix uninitialized error in my_atof3()

This function, newly introduced in 5.29, by
6928bedc792ff80f0cb915460a7eacae25fa9bdd, is buggy due to my misreading
the man page for strtoflt128().  There was no man page on my system, and
the one on-line is very terse, and could be interpreted as doing what I
wanted, which is to have the second parameter on input point to the end
position in the input string beyond which the function is not to look.
But in fact the function is expecting a NUL-terminated string.

This commit creates such a string by copying the original when it isn't
NUL-terminated, before calling strtoflt128().

5 years agoFatalize some uses of unescaped '{' in patterns
Karl Williamson [Sat, 14 Jul 2018 19:50:41 +0000 (13:50 -0600)]
Fatalize some uses of unescaped '{' in patterns

This commit follows through with our schedule of making some unescaped
literal left brace usages fatal in 5.30.  Some contexts won't be made
fatal until 5.32, and, in a partial change of plan,  others won't be
made fatal at all.

The goal since before 5.20 is to allow things like \w{foo} to be added
to the language, where the 'w' could be any suitable alphabetic.
This has already been accomplished with \b, \B (for example \b{wb}).
But various impediments have prevented generalizing this.

Another goal is to make the general quantifier, X{a,b}, syntax not so
restrictive, so that spaces can be used within the braces, and the lower
bound could be omitted.

This commit is another step towards allowing this.

Uses of some contexts have been scheduled to be made fatal in 5.30.  But
a discussion I had with Peter Rabbitson at TPC persuaded me to narrow
those contexts to the ones that we actually really need.  This commit
changes those to fatal, and the others where we had previously raised a
deprecation message are changed into a non-deprecation warning.  Keeping
this as a warning prevents a construct, where the user had intended a
quantifier but made a typo, from silently being compiled into a literal
string.

5 years agoperldiag: Add some double quotes
Karl Williamson [Sat, 14 Jul 2018 18:24:20 +0000 (12:24 -0600)]
perldiag: Add some double quotes

There are two areas of text, supposedly identical, and used because of
splain.  They had drifted apart slightly, so this brings them back to
consistency.

5 years agoMake global two interpreter variables
Karl Williamson [Sat, 14 Jul 2018 19:05:52 +0000 (13:05 -0600)]
Make global two interpreter variables

These variables are constant, once initialized, through the life of a
program, so having them be per instance is a waste of time and space

5 years agotreat when(index() > -1) as a boolean expression
David Mitchell [Sat, 14 Jul 2018 09:47:04 +0000 (10:47 +0100)]
treat when(index() > -1) as a boolean expression

RT #133368

when(X) is normally compiled as when($_ ~~ X) *except* when X appears to
be a boolean expression, in which case it's used directly.

5.28.0 introduced an optimisation whereby comparisons involving index
like

    index(...) != -1

eliminated the comparison, and pp_index() returned a boolean value
directly. This defeated the 'look for a boolean op' mechanism, and so

    when(index(...) != -1)

and similar were being incorrectly compiled as

    when($_ ~~ (index(...) != -1))

5 years agoutf8.c: Avoid some unnecessary conversions to UTF-8
Karl Williamson [Wed, 11 Jul 2018 13:44:53 +0000 (07:44 -0600)]
utf8.c: Avoid some unnecessary conversions to UTF-8

The UTF-8 is needed only in some circumstances, so can be skipped unless
needed.

5 years agoutf8.c: Static fnc always passed non-null
Karl Williamson [Wed, 11 Jul 2018 13:25:38 +0000 (07:25 -0600)]
utf8.c: Static fnc always passed non-null

This function was inconsistent until this commit, setting a a value
unconditionally in all but one place.

5 years agoTidy-up from previous commit for consistency with other win32 makefiles
Steve Hay [Tue, 10 Jul 2018 07:40:41 +0000 (08:40 +0100)]
Tidy-up from previous commit for consistency with other win32 makefiles

5 years agoimplement USE_CPLUSPLUS build option in win32/GNUmakefile
Daniel Dragan [Wed, 25 Apr 2018 00:34:21 +0000 (20:34 -0400)]
implement USE_CPLUSPLUS build option in win32/GNUmakefile

win32/makefile.mk has had a C++ build option for a long time, but
GNUmakefile didn't. Over time, GNUmakefile and makefile.mk got more and
more syncronized in their features. There is very little left to implement
USE_CPLUSPLUS in GNUmakefile, so just implement it finally. This allows
the gmake/gcc 3.4.5 bundled with strawberry perl 5.8.9 to be used to build
USE_CPLUSPLUS mode perl since the dmake bundled with 5.8.9 whose version is
"Version 4.8-20070327-SHAY (Windows / MS Visual C++)"
has a bug generating cmd lines passed to cmd.exe which causes EUMM
makefiles to fail with

'..\..\miniperl.exe" "-I..\..\lib' is not recognized as an internal or
external command, operable program or batch file.

but newer dmakes such as "Version 4.12 (Windows / MinGW)" dont have this
bug. Researching the bug/regression with EUMM and ancient dmakes is left
for the future.

5 years agoUpgrade parent from version 0.236 to 0.237
Steve Hay [Tue, 10 Jul 2018 07:32:59 +0000 (08:32 +0100)]
Upgrade parent from version 0.236 to 0.237

5 years agorepair documentation of Archive::Tar update
Karen Etheridge [Mon, 9 Jul 2018 00:30:19 +0000 (17:30 -0700)]
repair documentation of Archive::Tar update

Both the 2.28 and 2.30 releases landed in 5.28.0, and no change was made in 5.29.0.

5 years agoMake new EBCDIC tables global.
Craig A. Berry [Sun, 8 Jul 2018 17:44:27 +0000 (12:44 -0500)]
Make new EBCDIC tables global.

They are defined in the Perl library but referenced in the Perl
executable, but the Perl executable can't see them unless they
are exported by the library, and some linkers only make a symbol
a public export if they've been told to explicitly.

5 years agoFix Berkeley DB function type tests.
Craig A. Berry [Thu, 28 Jun 2018 22:46:40 +0000 (17:46 -0500)]
Fix Berkeley DB function type tests.

These tests fail with clang with a missing return in non-void
function warning, and any warning at all causes the types to
default to int.  It turns out DB::File doesn't use Configure's
types, but we should report the correct thing in case anyone
accesses them via %Config.

5 years agoperl.h: Properly indent a #if
Karl Williamson [Sat, 7 Jul 2018 23:13:14 +0000 (17:13 -0600)]
perl.h: Properly indent a #if

5 years agoPATCH: [perl #133348] BBC JE
Karl Williamson [Sat, 7 Jul 2018 21:16:10 +0000 (15:16 -0600)]
PATCH: [perl #133348] BBC JE

Commit b1d21918e268271d791ff30e83cf9c4f8c351707 was missing a line in
its attempt to partially revert a74bb78e4469c9f5ea806b57b155df6265d07975.

5 years agoregen/mph.pl: Use 'bignum'
Karl Williamson [Sat, 7 Jul 2018 17:29:12 +0000 (11:29 -0600)]
regen/mph.pl: Use 'bignum'

Commit 72196ef94b98987bb277d8bf6db6efaacd624c3c changed to 'use integer'
in one function.  But this was not sufficient to work on a 32 bit
system.  I tried a global 'use integer', which also didn't work; then a
global 'use bigint', which causes the program to not loop and it
generates usable data, but this causes a floating point statistic that is
included to be printed as 0.  The solution is to 'use bignum' instead.

See the thread beginning at
http://nntp.perl.org/group/perl.perl5.porters/251393

5 years agouni_keywords.h: Fix misspelling typo
Karl Williamson [Sat, 7 Jul 2018 16:44:27 +0000 (10:44 -0600)]
uni_keywords.h: Fix misspelling typo

5 years agoUpdate Porting/release_announcement_template.txt for 5.30
Steve Hay [Fri, 6 Jul 2018 07:43:41 +0000 (08:43 +0100)]
Update Porting/release_announcement_template.txt for 5.30

5 years agoFix Porting/perldelta_template.pod
Steve Hay [Fri, 6 Jul 2018 07:41:43 +0000 (08:41 +0100)]
Fix Porting/perldelta_template.pod

This was missed by the version bump in commit e3f7583fd6.

5 years agoMerge branch 'Use dfa for UTF-8' into blead
Karl Williamson [Thu, 5 Jul 2018 20:47:47 +0000 (14:47 -0600)]
Merge branch 'Use dfa for UTF-8' into blead

This series of patches moves to using dfa's for checking the syntax of,
and translating from UTF-8 into an equivalent code point value.  This
speeds things up; one of the commits includes benchmark numbers.

5 years agoperldelta: Note: using dfa for UTF-8 check/xlation
Karl Williamson [Thu, 5 Jul 2018 20:42:23 +0000 (14:42 -0600)]
perldelta: Note: using dfa for UTF-8 check/xlation

5 years agoMake isC9_STRICT_UTF8_CHAR() an inline dfa
Karl Williamson [Sun, 1 Jul 2018 22:00:41 +0000 (16:00 -0600)]
Make isC9_STRICT_UTF8_CHAR() an inline dfa

This replaces a complicated trie with a dfa.  This should cut down the
number of conditionals encountered in parsing many code points.

5 years agoMake isSTRICT_UTF8_CHAR() an inline function
Karl Williamson [Thu, 28 Jun 2018 04:01:53 +0000 (22:01 -0600)]
Make isSTRICT_UTF8_CHAR() an inline function

It was a macro that used a trie.  This changes to use the dfa
constructed in previous commits.  I didn't bother with taking
measurements.  A dfa should have fewer conditionals for many code
points.

5 years agoInline dfa for translating from UTF-8
Karl Williamson [Thu, 28 Jun 2018 03:52:47 +0000 (21:52 -0600)]
Inline dfa for translating from UTF-8

This commit inlines the simple portion of the dfa that translates from
UTF-8 to code points, used in functions like utf8_to_uvchr_buf.

This dfa has been changed in previous commits so that it is small, and
punts on any problematic input, plus 18% of the Hangul syllable code
points.  (These still come out faster than blead.)  The smallness allows
it to be inlined, adding <2000 total bytes to the perl text space.

The inlined part never calls anything that needs thread context, so that
parameter can be removed.  I decided to remove it also from the
Perl_utf8_to_uvchr_buf() and Perl_utf8n_to_uvchr_error() functions.
There is a small risk that someone is actually using those functions
instead of the documented macros utf8_to_uvchr_buf() and
utf8n_to_uvchr_error().  If so, this can be added back in.

Perl_utf8_to_uvchr_msgs() is entirely removed, but the macro
utf8_to_uvchr_msgs() which is the normal interface to it is retained
unchanged, and it is marked as unstable anyway.

This change decreases the number of conditional branches in the Perl
statement

    my $a = ord("\x{foo}")

where foo is a non-problematic code point by about 11%, except for
ASCII characters, where it is 4%, and those Hangul syllables mentioned
above, where it is 7%.  Problematic code points fare much worse here
than in blead.  These are the surrogates, non-characters, and
non-Unicode code points.  We don't care very much about the speed of
handling these code points, which are mostly considered illegal by
Unicode anyway.

The percentage decrease is higher for the just the function itself, as
the measured Perl statement has unchanged overhead.

Here are the annotated benchmarks:

Key:
    Ir   Instruction read
    Dr   Data read
    Dw   Data write
    COND conditional branches
    IND  indirect branches
    _m   branch predict miss
    _m1  level 1 cache miss
    _mm  last cache (e.g. L3) miss
    -    indeterminate percentage (e.g. 1/0)

The numbers represent raw counts per loop iteration.

translate_utf8_to_uv_007f
my $a = ord("\x{007f}")

       blead   dfa Ratio %
       ----- ----- -------
    Ir 395.0 370.0   106.8
    Dr 122.0 115.0   106.1
    Dw  71.0  61.0   116.4
  COND  49.0  47.0   104.3
   IND   5.0   5.0   100.0

In all the measurements, the indirect numbers were all zeros and
unchanged, and are omitted in this message.

translate_utf8_to_uv_07ff
my $a = ord("\x{07ff}")

       blead   dfa Ratio %
       ----- ----- -------
    Ir 438.0 390.0   112.3
    Dr 128.0 118.0   108.5
    Dw  71.0  61.0   116.4
  COND  57.0  51.0   111.8
   IND   5.0   5.0   100.0

translate_utf8_to_uv_cfff
my $a = ord("\x{cfff}")

This is the highest Hangul syllable that gets the full reduction.

       blead   dfa Ratio %
       ----- ----- -------
    Ir 457.0 410.0   111.5
    Dr 131.0 121.0   108.3
    Dw  71.0  61.0   116.4
  COND  61.0  55.0   110.9
   IND   5.0   5.0   100.0

translate_utf8_to_uv_d000
my $a = ord("\x{d000}")

This is the lowest affected Hangul syllable

       blead   dfa Ratio %
       ----- ----- -------
    Ir 457.0 443.0   103.2
    Dr 131.0 132.0    99.2
    Dw  71.0  71.0   100.0
  COND  61.0  57.0   107.0
   IND   5.0   5.0   100.0

translate_utf8_to_uv_d7ff
my $a = ord("\x{d7ff}")

This is the highest affected Hangul syllable

       blead   dfa Ratio %
       ----- ----- -------
    Ir 457.0 443.0   103.2
    Dr 131.0 132.0    99.2
    Dw  71.0  71.0   100.0
  COND  61.0  57.0   107.0
   IND   5.0   5.0   100.0

translate_utf8_to_uv_d800
my $a = ord("\x{d800}")

This is a surrogate, showing much worse performance, but we don't care

       blead   dfa Ratio %
       ----- ----- -------
    Ir 457.0 515.0    88.7
    Dr 131.0 134.0    97.8
    Dw  71.0  73.0    97.3
  COND  61.0  75.0    81.3
   IND   5.0   5.0   100.0

translate_utf8_to_uv_fdd0
my $a = ord("\x{fdd0}")

This is a non-char, showing much worse performance, but we don't care

       blead   dfa Ratio %
       ----- ----- -------
    Ir 457.0 548.0    83.4
    Dr 131.0 139.0    94.2
    Dw  71.0  73.0    97.3
  COND  61.0  81.0    75.3
   IND   5.0   5.0   100.0

translate_utf8_to_uv_fffd
my $a = ord("\x{fffd}")

       blead   dfa Ratio %
       ----- ----- -------
    Ir 457.0 410.0   111.5
    Dr 131.0 121.0   108.3
    Dw  71.0  61.0   116.4
  COND  61.0  55.0   110.9
   IND   5.0   5.0   100.0

translate_utf8_to_uv_ffff
my $a = ord("\x{ffff}")

This is another non-char, showing much worse performance, but we don't
care

       blead   dfa Ratio %
       ----- ----- -------
    Ir 457.0 548.0    83.4
    Dr 131.0 139.0    94.2
    Dw  71.0  73.0    97.3
  COND  61.0  81.0    75.3
   IND   5.0   5.0   100.0

translate_utf8_to_uv_1fffd
my $a = ord("\x{1fffd}")

       blead   dfa Ratio %
       ----- ----- -------
    Ir 476.0 430.0   110.7
    Dr 134.0 124.0   108.1
    Dw  71.0  61.0   116.4
  COND  65.0  59.0   110.2
   IND   5.0   5.0   100.0

translate_utf8_to_uv_10fffd
my $a = ord("\x{10fffd}")

       blead   dfa Ratio %
       ----- ----- -------
    Ir 476.0 430.0   110.7
    Dr 134.0 124.0   108.1
    Dw  71.0  61.0   116.4
  COND  65.0  59.0   110.2
   IND   5.0   5.0   100.0

translate_utf8_to_uv_110000
my $a = ord("\x{110000}")

This is a non-Unicode code point, showing much worse performance, but we
don't care

       blead   dfa Ratio %
       ----- ----- -------
    Ir 476.0 544.0    87.5
    Dr 134.0 137.0    97.8
    Dw  71.0  73.0    97.3
  COND  65.0  81.0    80.2
   IND   5.0   5.0   100.0

5 years agoutf8.c: Avoid unnecessary work xlating utf8 to uv
Karl Williamson [Thu, 28 Jun 2018 03:28:15 +0000 (21:28 -0600)]
utf8.c: Avoid unnecessary work xlating utf8 to uv

This moves the code for the dfa that does the translation of
non-problematic characters to earlier in the function to avoid work that
only needs to be done if the dfa rejects the input.  For example,
calculating how long the sequence is needed to be no longer is done
unless the dfa rejects.

Since the dfa always accepts an invariant if the allowed length is
non-zero, the code that tests for those specifically can be removed.

5 years agoUse strict dfa to translate from UTF-8 to code point
Karl Williamson [Mon, 2 Jul 2018 01:23:35 +0000 (19:23 -0600)]
Use strict dfa to translate from UTF-8 to code point

With this commit, if a sequence passes the dfa, the result can be
returned immediately.  Previously some rare potentially problematic
sequences could pass, which would then need further checking, which then
have to be done always.  So this speeds up the general case.

5 years agoAdd dfa for strict translation from UTF-8
Karl Williamson [Thu, 28 Jun 2018 00:08:12 +0000 (18:08 -0600)]
Add dfa for strict translation from UTF-8

5 years agoFix outdated docs for isUTF8_char()
Karl Williamson [Sun, 1 Jul 2018 19:48:34 +0000 (13:48 -0600)]
Fix outdated docs for isUTF8_char()

It doesn't accept non-negative code points that don't fit in an IV

5 years agoMake isUTF8_char() an inline function
Karl Williamson [Tue, 26 Jun 2018 01:11:46 +0000 (19:11 -0600)]
Make isUTF8_char() an inline function

It was a macro that used a trie.  This changes to use the dfa
constructed in previous commits.  I didn't bother with taking
measurements.  A dfa should require fewer conditionals to be executed
for many code points.

5 years agoExtend dfa for translation of UTF-8 to EBCDIC
Karl Williamson [Mon, 25 Jun 2018 23:01:30 +0000 (17:01 -0600)]
Extend dfa for translation of UTF-8 to EBCDIC

This commit changes to use a dfa for translating from UTF-8 on EBCDIC
platforms.  This makes for fewer #ifdefs, and I realized while I was
working on the dfa, that it wasn't difficult to do for EBCDIC.

5 years agoMake UTF-8 dfa table an EXTCONST
Karl Williamson [Mon, 25 Jun 2018 22:49:22 +0000 (16:49 -0600)]
Make UTF-8 dfa table an EXTCONST

This will allow it to be used inline.

5 years agoRename dfa table for UTF-8
Karl Williamson [Mon, 25 Jun 2018 22:16:04 +0000 (16:16 -0600)]
Rename dfa table for UTF-8

This is in preparation for having additional dfa tables.  This names
this one to reflect its specific purpose.

5 years agoChange dfa table for Perl extended UTF-8
Karl Williamson [Mon, 25 Jun 2018 22:05:39 +0000 (16:05 -0600)]
Change dfa table for Perl extended UTF-8

This restructures the dfa table for translating UTF-8 into U32 to handle
higher code points.  In doing so, I rationalized the numbering scheme
for nodes and byte types.  This makes it easier to see the patterns in
the table.

5 years agoregen/ebcdic.pl: Add capability to generate a dfa table
Karl Williamson [Sun, 1 Jul 2018 19:12:16 +0000 (13:12 -0600)]
regen/ebcdic.pl: Add capability to generate a dfa table

This kind of table is used for the dfa for translating or verifying
UTF-8.

5 years agoregen/ebcdic.pl: Add declaration of generated tables
Karl Williamson [Sun, 1 Jul 2018 18:43:59 +0000 (12:43 -0600)]
regen/ebcdic.pl: Add declaration of generated tables

This adds code to declare and define the tables only under DOINIT, and
otherwise to just declare them.  This allows the includer to not have to
deal with them at all.

5 years agoregen/ebcdic.pl: Always print row headings
Karl Williamson [Thu, 5 Jul 2018 19:27:54 +0000 (13:27 -0600)]
regen/ebcdic.pl: Always print row headings

Previously, this omitted the headings on tables that just barely fit
into 80 columns.  But future commits will create tables that can't fit
into 80 columns, and these headings are useful, so print them.

5 years agoebcdic_tables.h: Add comments
Karl Williamson [Sun, 10 Jun 2018 18:18:44 +0000 (12:18 -0600)]
ebcdic_tables.h: Add comments

5 years agoutf8.c: Change expression to be EBCDIC friendly
Karl Williamson [Thu, 14 Jun 2018 19:35:39 +0000 (13:35 -0600)]
utf8.c: Change expression to be EBCDIC friendly

This actually does two things: 1) it adds macros that evaluate to no
extra code on ASCII platforms, but allow things to work under EBCDIC;
and 2) it changes to use a ternary conditional.  This may not change
anything, or it may cause the compiler to generate slightly smaller
code at the expense of an extra addition instruction.  I am moving to
inlining this code, and want to make it smaller to enable that to
happen.

5 years agoAPItest: Add comprehensive UTF-8 validity tests
Karl Williamson [Mon, 2 Jul 2018 01:20:59 +0000 (19:20 -0600)]
APItest: Add comprehensive UTF-8 validity tests

These test all combinations of bytes at all likely to have any issues.
They are run only when an environment variable is set to a particular
obscure value, as they take a long time.

5 years agoinline.h: Fix typo in comment
Karl Williamson [Thu, 5 Jul 2018 18:54:17 +0000 (12:54 -0600)]
inline.h: Fix typo in comment

5 years agoutf8.h: Remove obsolete comment
Karl Williamson [Thu, 5 Jul 2018 18:52:00 +0000 (12:52 -0600)]
utf8.h: Remove obsolete comment

5 years agoUpgrade Math::BigInt from version 1.999811 to 1.999813
Steve Hay [Wed, 4 Jul 2018 16:54:42 +0000 (17:54 +0100)]
Upgrade Math::BigInt from version 1.999811 to 1.999813

5 years agoUpgrade bignum from version 0.49 to 0.50
Steve Hay [Wed, 4 Jul 2018 16:51:34 +0000 (17:51 +0100)]
Upgrade bignum from version 0.49 to 0.50

5 years agoUpdate Config::Perl::V to 0.30
H.Merijn Brand [Wed, 4 Jul 2018 18:23:50 +0000 (20:23 +0200)]
Update Config::Perl::V to 0.30

5 years agoNote that .appveyor.yml is EXCLUDED from Filter::Util::Call
Steve Hay [Wed, 4 Jul 2018 12:54:41 +0000 (13:54 +0100)]
Note that .appveyor.yml is EXCLUDED from Filter::Util::Call

5 years agoUpgrade Math::BigRat from version 0.2613 to 0.2614
Steve Hay [Tue, 3 Jul 2018 11:18:02 +0000 (12:18 +0100)]
Upgrade Math::BigRat from version 0.2613 to 0.2614

5 years agoUpgrade Math::BigInt::FastCalc from version 0.5006 to 0.5007
Steve Hay [Tue, 3 Jul 2018 11:13:44 +0000 (12:13 +0100)]
Upgrade Math::BigInt::FastCalc from version 0.5006 to 0.5007

5 years agoUpgrade experimental from version 0.019 to 0.020
Steve Hay [Wed, 4 Jul 2018 11:50:46 +0000 (12:50 +0100)]
Upgrade experimental from version 0.019 to 0.020

(This retains blead customizations from da4e040f42 and 14e4cec412.)

5 years agoSync with version-0.9924
Steve Hay [Wed, 4 Jul 2018 08:01:56 +0000 (09:01 +0100)]
Sync with version-0.9924

(There are no material changes to any files in core.)

5 years agoversion is in sync with 0.9923; vxs.inc is not customized
Steve Hay [Wed, 4 Jul 2018 07:51:51 +0000 (08:51 +0100)]
version is in sync with 0.9923; vxs.inc is not customized

5 years agoUpgrade Time::Local from version 1.25 to 1.28
Steve Hay [Tue, 3 Jul 2018 12:49:05 +0000 (13:49 +0100)]
Upgrade Time::Local from version 1.25 to 1.28

5 years agoUpgrade Test::Simple from vesion 1.302133 to 1.302136
Steve Hay [Tue, 3 Jul 2018 12:47:10 +0000 (13:47 +0100)]
Upgrade Test::Simple from vesion 1.302133 to 1.302136

5 years agoUpgrade podlators from version 4.10 to 4.11
Steve Hay [Tue, 3 Jul 2018 12:36:04 +0000 (13:36 +0100)]
Upgrade podlators from version 4.10 to 4.11

(This includes the former blead customization.)

5 years agoUpgrade perlfaq from version 5.021011 to 5.20180605
Steve Hay [Tue, 3 Jul 2018 12:24:10 +0000 (13:24 +0100)]
Upgrade perlfaq from version 5.021011 to 5.20180605

(Existing blead customizations are retained.)

5 years agoUpgrade Locale-Codes from version 3.56 to 3.57
Steve Hay [Tue, 3 Jul 2018 12:16:14 +0000 (13:16 +0100)]
Upgrade Locale-Codes from version 3.56 to 3.57

5 years agoUpgrade IPC::Cmd from version 1.00 to 1.02
Steve Hay [Tue, 3 Jul 2018 08:07:35 +0000 (09:07 +0100)]
Upgrade IPC::Cmd from version 1.00 to 1.02

5 years agoUpgrade IO-Compress from version 2.074 to 2.081
Steve Hay [Tue, 3 Jul 2018 08:06:01 +0000 (09:06 +0100)]
Upgrade IO-Compress from version 2.074 to 2.081

5 years agoUpgrade File::Temp from version 2.034 to 2.036
Steve Hay [Tue, 3 Jul 2018 08:00:48 +0000 (09:00 +0100)]
Upgrade File::Temp from version 2.034 to 2.036

5 years agoUpgrade ExtUtils::Manifest from version 1.70 to 1.71
Steve Hay [Tue, 3 Jul 2018 07:53:53 +0000 (08:53 +0100)]
Upgrade ExtUtils::Manifest from version 1.70 to 1.71

5 years agoExtUtils-Constant is synced with version 0.25
Steve Hay [Tue, 3 Jul 2018 07:49:45 +0000 (08:49 +0100)]
ExtUtils-Constant is synced with version 0.25

5 years agoUpgrade Digest::SHA from version 6.01 to 6.02
Steve Hay [Tue, 3 Jul 2018 07:40:09 +0000 (08:40 +0100)]
Upgrade Digest::SHA from version 6.01 to 6.02

5 years agoUpgrade DB_File from version 1.840 to 1.841
Steve Hay [Tue, 3 Jul 2018 07:34:44 +0000 (08:34 +0100)]
Upgrade DB_File from version 1.840 to 1.841

5 years agoUpgrade Compress::Raw::Zlib from 2.076 to 2.081
Steve Hay [Tue, 3 Jul 2018 07:32:45 +0000 (08:32 +0100)]
Upgrade Compress::Raw::Zlib from 2.076 to 2.081

5 years agoUpgrade Compress::Raw::Bzip2 from version 2.074 to 2.081
Steve Hay [Tue, 3 Jul 2018 07:32:03 +0000 (08:32 +0100)]
Upgrade Compress::Raw::Bzip2 from version 2.074 to 2.081

5 years agoDisable optimizer on pp_pack for HP C-ANSI-C on HP-UX 11.11
H.Merijn Brand [Mon, 2 Jul 2018 16:25:16 +0000 (18:25 +0200)]
Disable optimizer on pp_pack for HP C-ANSI-C on HP-UX 11.11

with optimize levels +O1 and higher:

$ ./miniperl -I./lib -wE'$a = pack "Cn4", 1, 3726, 32, 2'
Character in 'C' format wrapped in pack at -e line 1.

with +O0 (or no -O/+O) all goes well
Chances are too small to care that this will ever be fixed

This was found as the Test::Smoke run on this system created a
log-file of over 350 Mb with 4016149 warnings like the above

5 years agoRegen uni_keywords.h
Karl Williamson [Mon, 2 Jul 2018 14:41:37 +0000 (08:41 -0600)]
Regen uni_keywords.h

This is as a result of 72196ef94b98987bb277d8bf6db6efaacd624c3c.
and the MD5 for the file it changed needing to be recalculated

5 years agofix issue in regen/mph under 32 bit builds
Yves Orton [Mon, 2 Jul 2018 13:46:54 +0000 (15:46 +0200)]
fix issue in regen/mph under 32 bit builds

the multiplication overflows so perl "helpfully" convers to a float,
which then makes things go horribly horribly wrong. `use integer` to the rescue

5 years agoFix to compile under -DNO_LOCALE
Karl Williamson [Wed, 23 May 2018 21:32:47 +0000 (15:32 -0600)]
Fix to compile under -DNO_LOCALE

Several problems with this compile option were not caught before 5.28
was frozen.

5 years agoutf8.h: Add assert for utf8n_to_uvchr_buf()
Karl Williamson [Mon, 11 Jun 2018 18:58:25 +0000 (12:58 -0600)]
utf8.h: Add assert for utf8n_to_uvchr_buf()

The Perl_utf8n_to_uvchr_buf() version of this function has an assert;
this adds it as well to the macro that bypasses the function.

5 years agoperl.h: Add parens around macro arguments
Karl Williamson [Mon, 11 Jun 2018 19:26:24 +0000 (13:26 -0600)]
perl.h: Add parens around macro arguments

Arguments used within macros need to be parenthesized in case they are
called with an expression.  This commit changes
_CHECK_AND_OUTPUT_WIDE_LOCALE_UTF8_MSG() to do that.

5 years agoregexec.c: Call macro with correct args.
Karl Williamson [Mon, 11 Jun 2018 19:28:53 +0000 (13:28 -0600)]
regexec.c: Call macro with correct args.

The second argument to this macro is a pointer to the end, as opposed to
a length.

5 years agoPATCH: [perl #133311] BBC GRANTM/Encoding-FixLatin
Karl Williamson [Sat, 30 Jun 2018 21:17:51 +0000 (15:17 -0600)]
PATCH: [perl #133311] BBC GRANTM/Encoding-FixLatin

This effectively reverts a portion of
a74bb78e4469c9f5ea806b57b155df6265d07975.

I got confused when I wrote that commit, and conflated ASCII and POSIX
regnodes.

5 years agofix stren in PERL_MEM_LOG builds
Jim Cromie [Sat, 30 Jun 2018 02:26:21 +0000 (20:26 -0600)]
fix stren in PERL_MEM_LOG builds

5 years agoperldeprecation: Clean up text about grapheme delims
Karl Williamson [Fri, 29 Jun 2018 14:29:24 +0000 (08:29 -0600)]
perldeprecation: Clean up text about grapheme delims

This changes the text to make more sense in light of the fact that the
the deprecation has changed to illegality.

5 years ago[MERGE] fixups to Perl_my_setenv()
David Mitchell [Fri, 29 Jun 2018 13:38:10 +0000 (14:38 +0100)]
[MERGE] fixups to Perl_my_setenv()

5 years agoPerl_my_setenv(): re-indent cpp directive lines
David Mitchell [Fri, 29 Jun 2018 13:30:17 +0000 (14:30 +0100)]
Perl_my_setenv(): re-indent cpp directive lines

The indentation was all over the place.  Whitespace-only changes apart
from fixing code comments at end of '#endif' lines.

5 years agoPerl_my_setenv: move code comment
David Mitchell [Fri, 29 Jun 2018 13:12:18 +0000 (14:12 +0100)]
Perl_my_setenv: move code comment

This comment about VMS seems to have drifted over time away from the
ifdef it refs to

5 years agoPerl_my_setenv(); handle integer wrap
David Mitchell [Fri, 29 Jun 2018 12:37:03 +0000 (13:37 +0100)]
Perl_my_setenv(); handle integer wrap

RT #133204

Wean this function off int/I32 and onto UV/Size_t.
Also, replace all malloc-ish calls with a wrapper that does
overflow checks,

In particular, it was doing (nlen + vlen + 2) which could wrap when
the combined length of the environment variable name and value
exceeded around 0x7fffffff.

The wrapper check function is probably overkill, but belt and braces...

NB this function has several variant parts, #ifdef'ed by platform
type; I have blindly changed the parts that aren't compiled under linux.

5 years agoutf8.c: Use abbreviations consistently
Karl Williamson [Sun, 20 May 2018 23:09:37 +0000 (17:09 -0600)]
utf8.c: Use abbreviations consistently

Elsewhere in this function some abbreviations were introduced and used.
This is the one area not using them.