This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
10 years agoDon't rely on IPC::Cmd in ExtUtils-Install tests
Chris 'BinGOs' Williams [Mon, 10 Mar 2014 11:55:45 +0000 (11:55 +0000)]
Don't rely on IPC::Cmd in ExtUtils-Install tests

10 years agoIt is and always will be safe to delete the most recent key returned from each.
Paul Johnson [Mon, 10 Mar 2014 07:31:32 +0000 (08:31 +0100)]
It is and always will be safe to delete the most recent key returned from each.

10 years agoIncorporate changes from CPAN release of ExtUtils-CBuilder
Chris 'BinGOs' Williams [Sat, 8 Mar 2014 13:45:29 +0000 (13:45 +0000)]
Incorporate changes from CPAN release of ExtUtils-CBuilder

10 years agoUpgrade to Thread::Queue 3.03
Jerry D. Hedden [Thu, 6 Mar 2014 20:56:39 +0000 (15:56 -0500)]
Upgrade to Thread::Queue 3.03

10 years agomake core safe against HvAUX() realloc
David Mitchell [Fri, 7 Mar 2014 17:45:27 +0000 (17:45 +0000)]
make core safe against HvAUX() realloc

Since the HvAUX structure is just tacked onto the end of the HvARRAY()
struct, code like this can do bad things:

    aux = HvAUX();
    ... something that might split hv ...
    aux->foo = ...; /* SEGV! */

So I've visually audited core for places where HbAUX() is saved and then
re-used, and re-initialised the var if it looks like HvARRAY() could
have changed in the meantime.

I've been very conservative about what might be unsafe. For example,
destructors or __WARN__ handlers could call perl code that modifies the
hash.

10 years agosv.h: add some more flag usage commentary
David Mitchell [Fri, 7 Mar 2014 17:13:07 +0000 (17:13 +0000)]
sv.h: add some more flag usage commentary

Also, move SVphv_SHAREKEYS up to be closer to SVf_UTF8 - they are the same
flag bit, but it wasn't clear, since there was a big gap between them

10 years agoData::Dumper update/changelog and version bump
Steffen Mueller [Fri, 7 Mar 2014 08:02:53 +0000 (09:02 +0100)]
Data::Dumper update/changelog and version bump

10 years agoFilter::Simple update/changelog and version bump
Steffen Mueller [Fri, 7 Mar 2014 07:44:06 +0000 (08:44 +0100)]
Filter::Simple update/changelog and version bump

10 years agoAttribute::Handlers update/changelog and version bump
Steffen Mueller [Fri, 7 Mar 2014 07:33:47 +0000 (08:33 +0100)]
Attribute::Handlers update/changelog and version bump

10 years agoSmarter handling of escaped semicolons in vmsify.
Craig A. Berry [Fri, 7 Mar 2014 00:39:18 +0000 (18:39 -0600)]
Smarter handling of escaped semicolons in vmsify.

In theory, a Unix-format filespec can contain a semicolon and thus
need to be escaped when converted to a VMS-format filespec.  But
a much more common use case is a filespec that has a version
number despite being in Unix format.

So detect a semicolon that delimits a version specification and
pass it through but escape other semicolons.  This is apparently
what decc$to_vms does, so we're being consistent with the CRTL.

10 years agoUpdate META files and remove blead customizations following previous commit
Steve Hay [Thu, 6 Mar 2014 08:38:03 +0000 (08:38 +0000)]
Update META files and remove blead customizations following previous commit

(The customizations were added to "fix" failures caused by the previous
upgrade of CPAN::Meta. This upgrade reverts the offending parts, so those
"fix"es can now be reverted too.)

10 years agoUpgrade CPAN::Meta from version 2.140630 to 2.140640
Steve Hay [Thu, 6 Mar 2014 08:25:07 +0000 (08:25 +0000)]
Upgrade CPAN::Meta from version 2.140630 to 2.140640

10 years agoofficially discourage the use of threads
Ricardo Signes [Thu, 6 Mar 2014 01:39:07 +0000 (20:39 -0500)]
officially discourage the use of threads

some language borrowed from a larger patch by Christian Walde

10 years agonote that the ~~ operator is experimental
Ricardo Signes [Sat, 22 Feb 2014 03:25:19 +0000 (22:25 -0500)]
note that the ~~ operator is experimental

(cherry picked from commit 43c6e0a7ba1950c4a64b59be5d0a9cd7b1807cca)

10 years agoMaintainers.pl: Refer to recent EU::ParseXS release
Steffen Mueller [Wed, 5 Mar 2014 17:40:16 +0000 (18:40 +0100)]
Maintainers.pl: Refer to recent EU::ParseXS release

10 years agoEU::ParseXS: Code cleanup
Steffen Mueller [Wed, 5 Mar 2014 17:06:25 +0000 (18:06 +0100)]
EU::ParseXS: Code cleanup

General refactoring to make the code (marginally) easier to follow
and more consistent. This should not result in a change in behaviour.
Includes version bump to 3.24.

10 years agoTemporary fixes for test failures after (Parse::)CPAN::Meta upgrades
Steve Hay [Wed, 5 Mar 2014 10:11:53 +0000 (10:11 +0000)]
Temporary fixes for test failures after (Parse::)CPAN::Meta upgrades

10 years agoUpgrade Locale-Codes from version 3.29 to 3.30
Steve Hay [Wed, 5 Mar 2014 09:06:11 +0000 (09:06 +0000)]
Upgrade Locale-Codes from version 3.29 to 3.30

10 years agoUpdate META files following previous two commits
Steve Hay [Wed, 5 Mar 2014 08:55:03 +0000 (08:55 +0000)]
Update META files following previous two commits

10 years agoUpgrade Parse-CPAN-Meta from version 1.4413 to 1.4414
Steve Hay [Wed, 5 Mar 2014 08:47:42 +0000 (08:47 +0000)]
Upgrade Parse-CPAN-Meta from version 1.4413 to 1.4414

10 years agoUpgrade CPAN-Meta from version 2.133380 to 2.140630
Steve Hay [Wed, 5 Mar 2014 08:42:20 +0000 (08:42 +0000)]
Upgrade CPAN-Meta from version 2.133380 to 2.140630

10 years agoregcomp.c: Use minimal struct formal parameter
Karl Williamson [Wed, 5 Mar 2014 00:55:10 +0000 (17:55 -0700)]
regcomp.c: Use minimal struct formal parameter

The static function get_ANYOF_cp_list_for_ssc() takes a struct formal
parameter that is a superset of what it actually uses.  The calls to it
have to cast to that superset.  By setting the parameter to the smallest
structure it uses, we simplify things.

10 years agoregcomp.c: Don't read uninitialized data
Karl Williamson [Wed, 5 Mar 2014 00:43:11 +0000 (17:43 -0700)]
regcomp.c: Don't read uninitialized data

The blamed commit failed to check whether the data is present before
reading it.

I believe that this creates false positives in te optimizer, so no
actual failures ensued.

10 years agodist/IO: Allow to be dual-lived
Karl Williamson [Tue, 4 Mar 2014 23:13:36 +0000 (16:13 -0700)]
dist/IO: Allow to be dual-lived

This dual-lived module has not been able to be compiled on releases
earlier than 5.10.1 since, I believe, that release, and not outside of
blead since commit 6f2d5cbc in the 5.19 series, both due to using macros
that were not backported.

This commit suitably defines the current missing macro when it isn't
available.

10 years ago[perl #121362] overload optimisation added a SEGV
David Mitchell [Tue, 4 Mar 2014 19:03:02 +0000 (19:03 +0000)]
[perl #121362] overload optimisation added a SEGV

My recent commit 3d147ac29d12abdb to "speed up (non)overloaded derefs"
introduced a potential SEGV. In Perl_Gv_AMupdate(), the 'aux' variable is
set to HvAUX(hv). My patch used the value of the variable later on in the
function, but it turns out that by then, S_hsplit() may have been called,
and thus HvARRAY (and HvAUX()) may have been reallocated.

Issue first spotted by Andreas' awesome BBC service, and diagnosed by
Nicholas Clark.

10 years agoBump Carp to version 1.33
Chris 'BinGOs' Williams [Mon, 3 Mar 2014 22:51:18 +0000 (22:51 +0000)]
Bump Carp to version 1.33

Triggered by commit b82e68e8acf012df784511a23ba8b2dfbc3853b8

10 years agoBump autouse version to 1.08
Chris 'BinGOs' Williams [Mon, 3 Mar 2014 22:45:52 +0000 (22:45 +0000)]
Bump autouse version to 1.08

Triggered by the following:
commit 0c6e98c726c248c4e5b9b4d00c6c9ea74f783997
commit aa86db36e6778689f4a9d13c9af25e2020f46bf4

10 years agoRefactor and reduce VMS-specific workarounds in POSIX.xs.
Craig A. Berry [Sun, 2 Mar 2014 23:58:31 +0000 (17:58 -0600)]
Refactor and reduce VMS-specific workarounds in POSIX.xs.

Most of this code presupposes pre-7.0 VMS systems, but v7.0 was
released in 1995 and pre-7.0 was desupported in Perl in 5.16. So
slim down to what's needed for the most recent couple of decades.

10 years agotbuffer_t no longer exists on VMS.
Craig A. Berry [Sun, 2 Mar 2014 14:33:28 +0000 (08:33 -0600)]
tbuffer_t no longer exists on VMS.

It was replaced by the standard tms struct in v7.0, released in
1995.  Explicit support for pre-7.0 was removed in 32995a382d65b
for Perl 5.16, but I missed the tbuffer_t bit, which tripped up
Nicholas in 25983af42cdcf2dc, because he asked for:

  struct tbuffer_t

which via macro expansion became:

  struct struct tms

which failed to compile.  So remove code that's unnecessarily
different on VMS, leaving only a tbuffer_t compatibility macro
with a more appropriate comment so it will hopefully be less
likely to get used in new code.

10 years agoMerge changes to make_ext.pl that build simple extensions directly.
Nicholas Clark [Sun, 2 Mar 2014 06:17:28 +0000 (07:17 +0100)]
Merge changes to make_ext.pl that build simple extensions directly.

This adds complexity and duplicate logic to make_ext.pl, but reduces build
times. The build time reduction can be significant on platforms which can't
run parallel builds - VMS build time decreased by 39%.

10 years agoOn VMS, lib is lib.DIR, etc. make_ext.pl needs to account for this.
Nicholas Clark [Sat, 1 Mar 2014 10:39:27 +0000 (11:39 +0100)]
On VMS, lib is lib.DIR, etc. make_ext.pl needs to account for this.

Likewise regular files without periods in the names get one appended.

Also, the file generated is pm_to_blib.ts, not pm_to_blib.

10 years agoDescribe the improvements to make_ext.pl in perldelta.
Nicholas Clark [Thu, 27 Feb 2014 15:40:54 +0000 (16:40 +0100)]
Describe the improvements to make_ext.pl in perldelta.

10 years agoGenerate fallback shell cleanup code for the extensions make_ext.pl handles.
Nicholas Clark [Thu, 27 Feb 2014 12:34:46 +0000 (13:34 +0100)]
Generate fallback shell cleanup code for the extensions make_ext.pl handles.

These try to ensure that `make clean` followed by `make distclean` is the
same as running just `make distclean`.

10 years agomake_ext.pl can handle 4 extensions in dist/ which need a Makefile.PL for CPAN.
Nicholas Clark [Thu, 27 Feb 2014 11:52:32 +0000 (12:52 +0100)]
make_ext.pl can handle 4 extensions in dist/ which need a Makefile.PL for CPAN.

10 years agomake_ext.pl can also handle extensions with a module tree at the top level.
Nicholas Clark [Thu, 27 Feb 2014 11:21:54 +0000 (12:21 +0100)]
make_ext.pl can also handle extensions with a module tree at the top level.

This gets us Digest and Memoize.

10 years agomake_ext.pl can also handle extensions with a module file at the top level.
Nicholas Clark [Thu, 27 Feb 2014 10:50:56 +0000 (11:50 +0100)]
make_ext.pl can also handle extensions with a module file at the top level.

Processing this old-style layout gains us another 6 extensions.

10 years agoFor simple extensions make_ext.pl can emulate the entire MakeMaker/make dance.
Nicholas Clark [Thu, 27 Feb 2014 10:04:19 +0000 (11:04 +0100)]
For simple extensions make_ext.pl can emulate the entire MakeMaker/make dance.

For simple extensions consisting only of Perl modules and Pod, EU::MM
generates a Makefile where the only target that does any work as part of
'all' is 'pm_to_blib', and *that* is just running perl to call
ExtUtils::Installed::pm_to_blib() with those files as arguments, and then
touching pm_to_blib.

Because the top level Makefile's dependency rule for "is an extension built"
is looking for that file pm_to_blib, and all builds (and cleans) of
extension directories are performed by running make_ext.pl, not a direct
recursive make, it means that make_ext.pl can actually directly emulate the
entire work done by EU::MM and make in this particular case. This means that
we save (at least) three subprocesses:

* miniperl to run Makefile.PL
* make
* miniperl to run ExtUtils::Installed::pm_to_blib()

This change obviously adds some logic duplication, but it roughly halves the
time taken for `make test_prep` to figure out that nothing needs doing.
And obviously also saves at least that much time on the actual build, which
may well be 60 seconds / number of cores.

10 years agoChange the test to use itself as test file, instead of the generated Makefile.
Nicholas Clark [Thu, 27 Feb 2014 09:56:11 +0000 (10:56 +0100)]
Change the test to use itself as test file, instead of the generated Makefile.

The generated Makefile is about to go away :-)

10 years agoExtract fallback_cleanup() to hold the code that writes cleanup shell scripts.
Nicholas Clark [Thu, 27 Feb 2014 09:21:52 +0000 (10:21 +0100)]
Extract fallback_cleanup() to hold the code that writes cleanup shell scripts.

10 years agomake_ext.pl should validate exactly which clean targets it can be used for.
Nicholas Clark [Thu, 27 Feb 2014 09:20:38 +0000 (10:20 +0100)]
make_ext.pl should validate exactly which clean targets it can be used for.

Previously it would accept anything matching /clean$/. Now we check for the 4
names that we know the top level Makefile defines.

10 years agoregen/regcharclass.pl: Forbid non-safe macros for multi-char matches
Karl Williamson [Sun, 2 Mar 2014 02:35:00 +0000 (19:35 -0700)]
regen/regcharclass.pl: Forbid non-safe macros for multi-char matches

For matches that can match more than a single code point, one should
always use a macro that makes sure that one doesn't read off the end of
the buffer.  This is because the buffer might end with the first N
characters of a sequence with at least N+1 in it, and we don't want to
read that N+1 position in the buffer.

If this had been in place, buggy commit 3a8bbffbce would not have
happened.

10 years agoregen/regcharclass.pl: Don't generate unused macros
Karl Williamson [Sun, 2 Mar 2014 02:27:43 +0000 (19:27 -0700)]
regen/regcharclass.pl: Don't generate unused macros

The macros generated by these options are not needed in the core;
generating them just clutters up the header file, and some will actually
be forbidden by the next commit.

10 years agoRevert most of 3a8bbffbce: Avoid unnecessary malformed checking
Karl Williamson [Sun, 2 Mar 2014 01:47:10 +0000 (18:47 -0700)]
Revert most of 3a8bbffbce: Avoid unnecessary malformed checking

My thinking was muddled when I made that commit, and this reverts the
essence of it.  The theory was that since we have already processed the
regex pattern, we don't need to check it for malformedness, hence we
don't need the "safe" form of certain macros that check for and avoid
running off the end of the buffer.  It is true that we don't have to
worry about malformedness indicating that the buffer is bigger than it
really is, but these macros can match up to three well-formed
characters, so we do have to make sure that all three are in the buffer,
and that the input isn't just the first two at the buffer's end.

This was caught by running valgrind.

10 years agoperluniprops: Show property name without braces
Karl Williamson [Sun, 2 Mar 2014 01:28:30 +0000 (18:28 -0700)]
perluniprops: Show property name without braces

Properties wth single letter names may be expressed with and without the
brakces; \p{L} and \pL are synonymous.  This commit makes both forms
be in perluniprops, so someone who doesn't know the detailed rules can
search for either to see what it is.

This was suggested by Zsbán Ambrus.

10 years agoregen/regcharclass.pl: White-space; comment nits only
Karl Williamson [Fri, 28 Feb 2014 18:46:10 +0000 (11:46 -0700)]
regen/regcharclass.pl: White-space; comment nits only

Indent to account for new block added in the previous commit

10 years agoregen/regcharclass.pl: Simplify generated safe macros
Karl Williamson [Fri, 28 Feb 2014 18:24:01 +0000 (11:24 -0700)]
regen/regcharclass.pl: Simplify generated safe macros

This simplifies the macros generated which make sure there are no read
errors.  Prior to this commit, the code generated looked like

      (e - s) > 3
      ? see if things of at most length 4 match
      : (e - s) > 2
        ? see if things of at most length 3 match
        : (e - s) > 1
          ? see if things of at most length 2 match
          : (e - s) > 0
            ? see if things of at most length 1 match

For things that are a single character, the ones greater than length 2
must be in UTF8, and their needed length can be determined by UTF8SKIP,
so we can get rid of most of the (e-s) tests.

This doesn't change the macros which can match multiple characters; that
is a harder to do.

10 years agoUnicode/UCD.t: Fix broken test
Karl Williamson [Fri, 28 Feb 2014 17:27:49 +0000 (10:27 -0700)]
Unicode/UCD.t: Fix broken test

The test file special cases certain properties by name.  However, it
turns out that a Unihan property that isn't normally compiled by Perl
also should be included.  And all these properties share the same format
given in their files.  So, instead of using the property names, use that
format; this leads to code which is general, and simpler at the same time.

10 years agomktables: Allow Unicode Unihan files to compile
Karl Williamson [Fri, 28 Feb 2014 16:58:33 +0000 (09:58 -0700)]
mktables: Allow Unicode Unihan files to compile

Perl normally doesn't include the Unicode Unihan files, but someone is
free to recompile Perl with these.  However, starting with commit
9e65c3f47e483ee7e33b5d748a06f4addd830d60, mktables checks for the
version number on the input files and refuses to compile if incorrect.
(This is to catch Perl trying to compile from a DB with inconsistent
files; I believe Perl used to be shipped with these synchronization
errors.)  However, the Unihan files in Unicode 6.3 do not have the same
syntax as the rest of the files, so since that commit Perl refuses to
compile Unihan.

The files are being updated in 7.0 to use the same syntax as the rest,
so rather than hard-code the current syntax as an exception into
mktables, this just skips checking these files until 7.0.

10 years agoregen/regcharclass.pl: Warn that macros are internal only
Karl Williamson [Thu, 27 Feb 2014 17:25:24 +0000 (10:25 -0700)]
regen/regcharclass.pl: Warn that macros are internal only

This adds a comment to the generated file that the macros are not to be
generally used.

10 years agoNo need for code conditional on S_IFMT being defined, as perl.h has a fallback.
Nicholas Clark [Sat, 1 Mar 2014 16:58:05 +0000 (17:58 +0100)]
No need for code conditional on S_IFMT being defined, as perl.h has a fallback.

Commit c623bd54707a8bf9 (Jan 1991) added code conditionally compiled if
S_IFMT was defined. However, the checks were immediately redundant, because
the same commit also added code to perl.h to define a fallback value for
S_IFMT if the OS headers did not define it, which is unchanged to this day.
Hence the code added in an #else as part of commit 99b89507a1fb507c (Nov
1991) has never ever been needed.

10 years agopp_tms should use a local struct tms, instead of PL_timesbuf.
Nicholas Clark [Sat, 1 Mar 2014 16:40:05 +0000 (17:40 +0100)]
pp_tms should use a local struct tms, instead of PL_timesbuf.

PL_timesbuf is effectively a vestige of Perl 1, and doesn't actually need to
be an interpreter variable. It will be removed early in v5.21.x, but it's a
good idea to refactor the code not to use it before then. A local struct tms
will be on the C stack, which will be in the CPU's L1 cache, whereas the
relevant part of the interpreter struct may well not be in the CPU cache at
all. Therefore this change might reduce cache pressure fractionally. A local
variable access should also be simpler machine code on most CPU architectures.

10 years agoCommit 5c85b638cb45ea2b inadvertently broke the -DDEBUGGING build.
Nicholas Clark [Sat, 1 Mar 2014 12:35:16 +0000 (13:35 +0100)]
Commit 5c85b638cb45ea2b inadvertently broke the -DDEBUGGING build.

The macros assert_not_ROK(sv) and assert_not_glob(sv) are intended to be used
in expressions, and finish with a trailing comma, so they shouldn't have a ;
after them.

10 years ago[MERGE] tweak in-place branch of SAVEt_CLEARSV
David Mitchell [Fri, 28 Feb 2014 19:46:15 +0000 (19:46 +0000)]
[MERGE] tweak in-place branch of SAVEt_CLEARSV

clean up the code that clears lexical vars on scope exit; chiefly, wrap
all the individual 'unusual case' flag tests in a single big test of the
union of all such flags, so that simple lexical vars skip all the tests.

10 years agoSAVEt_CLEARSV: only clear-in-place if RC==1
David Mitchell [Fri, 28 Feb 2014 19:25:51 +0000 (19:25 +0000)]
SAVEt_CLEARSV: only clear-in-place if RC==1

Currently it takes the 'clear-in-place' branch on lexical vars if
the ref count is <= 1. However, RC < 1 is a "should never happen"
condition, so rather than keeping that damaged var, take the other branch,
which will call SvREFCNT_dec() on it, which will Do the Right Thing
(like emitting a warning).

10 years agoSAVEt_CLEARSV: handle SvOOK() specially
David Mitchell [Fri, 28 Feb 2014 18:40:10 +0000 (18:40 +0000)]
SAVEt_CLEARSV: handle SvOOK() specially

Add SVf_OOK to the list of flags that are handled in the 'slow' branch.
This allows us to avoid checking for hv_kill_backrefs() or sv_backoff()
for the majority of lexicals which won't require it.

10 years agoSAVEt_CLEARSV: expand SvOK_off() macro
David Mitchell [Fri, 28 Feb 2014 18:35:02 +0000 (18:35 +0000)]
SAVEt_CLEARSV: expand SvOK_off() macro

the next commit will change thinks that affect only part of the macro

10 years agoSAVEt_CLEARSV: simplify SvREADONLY_off() condition
David Mitchell [Fri, 28 Feb 2014 17:51:47 +0000 (17:51 +0000)]
SAVEt_CLEARSV: simplify SvREADONLY_off() condition

SAVEt_CLEARSV should always be called with SvPADMY() true, so don't test
for it, but assert it instead. Then change this:

    if (SvPADMY(sv) && !SvFAKE(sv))
         SvREADONLY_off(sv);

The SvPADMY() isn't needed, but we should test for RO-ness instead, to
avoid an unnecessary SvREADONLY_off().

10 years agoSAVEt_CLEARSV: reindent after previous commit
David Mitchell [Fri, 28 Feb 2014 17:45:37 +0000 (17:45 +0000)]
SAVEt_CLEARSV: reindent after previous commit

whitespace-only changes

10 years agoSAVEt_CLEARSV: check common flags
David Mitchell [Fri, 28 Feb 2014 17:32:57 +0000 (17:32 +0000)]
SAVEt_CLEARSV: check common flags

In the 'clear' branch of SAVEt_CLEARSV, there are several individual
if (SvSOMEFLAG(sv)) {...} tests. Wrap all these tests in a single
if (SvFLAGS(sv) & (union|of|all|flags)), so that for the common case
of boring lexicals that don't need special clear up, we can skip all the
individual tests

10 years agoS_regmatch(): merge BOL and SBOL branches
David Mitchell [Fri, 28 Feb 2014 14:48:16 +0000 (14:48 +0000)]
S_regmatch(): merge BOL and SBOL branches

The code body is the same for both of them.

10 years agocopy xhv_rand and xhv_last_rand in threads clone
David Mitchell [Fri, 28 Feb 2014 14:37:13 +0000 (14:37 +0000)]
copy xhv_rand and xhv_last_rand in threads clone

valgrind complains about these fields being uninitialised when cloned into a
new thread, because they aren't copied. It's fairly harmless, since these
fields are just used to perturb hash key iteration; but for completeness,
clone these fields too.

10 years ago[perl #121230] fix kill -SIG on win32
David Mitchell [Sun, 23 Feb 2014 13:25:05 +0000 (13:25 +0000)]
[perl #121230] fix kill -SIG on win32

v5.17.1-137-gc2fd40c tidied up perl's kill() implementation, making
-SIGNAME be handled correctly, It also eliminated the use of the killpg()
system/library call, which these days is usually just a thin wrapper over
kill(). By doing this, it assumed that the following are functionally
equivalent:

 killpg(pgrp, sig)
 kill(-pgrp, sig).

Unfortunately this broke Window's use of the (perl-level)

    kill negative_value, pid, ...

since under Windows, the killpg()/kill() identity doesn't hold
(win32_kill() uses negative ids for fake-PIds, not process groups).

Fix this by restoring the use of killpg() where available.

10 years agospeed up (non)overloaded derefs
David Mitchell [Sat, 15 Feb 2014 22:47:16 +0000 (22:47 +0000)]
speed up (non)overloaded derefs

Consider a class that has some minimal overloading added - e.g. to give
pretty stringification of objects - but which *doesn't* overload
dereference methods such as '@[]'. '%[]' etc.

In this case, simple dereferencing, such as $obj->[0] or  $obj->{foo}
becomes much slower than if the object was blessed into a non-overloaded
class.

This is because every time a dereferencing is performed in pp_rv2av for
example, the "normal" code path has to go through the full checking of:

  * is the stash into which the referent is blessed overloaded? If so,
  * retrieve the overload magic from the stash;
  * check whether the overload method cache has been invalidated and if so
    rebuild it;
  * check whether we are in the scope of 'no overloading', and if so
    is the current method disabled in this scope?
  * Is there a '@{}' or whatever (or 'nomethod') method in the cache?
    If not, then process the ref as normal.

That's a lot of extra overhead to decide that an overloaded method doesn't
in fact need to be called.

This commit adds a new flag to the newish xhv_aux_flags field,
HvAUXf_NO_DEREF, which signals that the overloading of this stash
contains no deref (nor 'nomethod') overloaded methods. Thus a quick check
for this flag in the common case allows us to short-circuit all the above
checks except the first one.

Before this commit, a simple $obj->[0] was about 40-50% slower if the
class it was blessed into was overloaded (but didn't have deref methods);
after the commit, the slowdown is 0-10%. (These timings are very
approximate, given the vagaries of nano benchmarks.)

10 years agoDocument what the gv_check() function does
David Mitchell [Sat, 15 Feb 2014 16:46:40 +0000 (16:46 +0000)]
Document what the gv_check() function does

10 years agogv_check(): use aux flag rather than IsCOW
David Mitchell [Sat, 15 Feb 2014 16:38:31 +0000 (16:38 +0000)]
gv_check(): use aux flag rather than IsCOW

Currently the SVf_IsCOW flag doesn't have any meaning for HVs,
except that it is used in the specific case of gv_check() to temporarily
mark a stash as being scanned. Since stashes will have the HV_AUX fields,
we can use a flags bit in the new xhv_aux_flags field instead.

This then potentially frees up the SVf_IsCOW for use as a new general flag
bit for *all* HVs (including non-stash ones).

10 years agoadd aux_flags field to HVs with aux struct
David Mitchell [Sat, 15 Feb 2014 16:15:11 +0000 (16:15 +0000)]
add aux_flags field to HVs with aux struct

Add an extra U32 general flags field to the xpvhv_aux struct (which is
used on HVs such as stashes, that need extra fields).

On 64-bit systems, this doesn't consume any extra space since there's
already an odd number of I32/U32 fields. On 32-bit systems it will consume
an  extra 4 bytes. But of course only on those hashes that have the aux
struct.

As well as providing extra flags in the AUX case, it will also allow
us to free up at least one general flag bit for HVs - see next commit.

10 years agomake OP_AELEMFAST work with negative indices
David Mitchell [Sun, 23 Feb 2014 00:53:17 +0000 (00:53 +0000)]
make OP_AELEMFAST work with negative indices

Use aelemfast for literal index array access where the index is in the
range -128..127, rather than 0..255.

You'd expect something like $a[-1] or $a[-2] to be a lot more common than
$a[100] say. In fact a quick CPAN grep shows 66 distributions
matching /\$\w+\[\d{3,}\]/, but "at least" 1000 matching /\$\w+\[\-\d\]/.
And most of the former appear to be table initialisations.

10 years ago[MERGE] optmise pp_entersub code
David Mitchell [Thu, 27 Feb 2014 16:32:34 +0000 (16:32 +0000)]
[MERGE] optmise pp_entersub code

Do various bits of minor fiddling with the code of Perl_pp_entersub
to make the binary smaller and hopefully faster. All the usual stuff:
sprinkling LIKELY(), altering scope of vars etc.

All of this should make no functional difference, expect conceivably the
"SvPADTMP() not on IS_PADGV()" change (which also affects code outside
pp_entersub()).

This series of commits reduces the size of the pp_entersub object on gcc
x86_64 by about 11%, and shows no measurable change in performance (i.e.
noise dominates).

10 years agodon't set SvPADTMP() on PADGV's
David Mitchell [Thu, 27 Feb 2014 15:30:26 +0000 (15:30 +0000)]
don't set SvPADTMP() on PADGV's

Under threaded builds, GVs for OPs are stored in the pad rather than
being directly attached to the op. For some reason, all such GV's were
getting the SvPADTMP flag set. There seems to be be no good reason for
this, and after skipping setting the flag, all tests still pass.

The advantage of not setting this flag is that there are quite a few
hot places in the code that do

    if (SvPADTMP(sv) && !IS_PADGV(sv)) {
        ...

I've replaced them all with

    if (SvPADTMP(sv)) {
        assert(!IS_PADGV(sv));
        ...

Since the IS_PADGV() macro expands to something quite heavyweight, this is
quite a saving: for example this commit reduces the size of pp_entersub by
111 bytes.

10 years agopp_entersub(): simplify XSUB arg cleanup code
David Mitchell [Wed, 26 Feb 2014 22:39:52 +0000 (22:39 +0000)]
pp_entersub(): simplify XSUB arg cleanup code

The code that reduces the returned XS args to 1 arg in scalar context
was a bit messy. This makes it smaller, more comprehensible, with slighylu
smaller object size.

10 years agomove PL_defgv nearer the top of intrvar.h
David Mitchell [Wed, 26 Feb 2014 20:54:05 +0000 (20:54 +0000)]
move PL_defgv nearer the top of intrvar.h

on the grounds that its a reasonably hot variable.

10 years agopp_entersub(): tweak some vars
David Mitchell [Wed, 26 Feb 2014 20:47:32 +0000 (20:47 +0000)]
pp_entersub(): tweak some vars

make the scope of item be smaller;
don't assign +1 to MARK when we will shortly overwrite it;
use a local var to to store &GvAV(PL_defgv) to avoid recalculating it
use a _NN variant of SvREFCNT_inc

Shaves 2% off the object size of pp_entersub.

10 years agopp_entersub(): assign CvDEPTH to a local var
David Mitchell [Wed, 26 Feb 2014 18:03:56 +0000 (18:03 +0000)]
pp_entersub(): assign CvDEPTH to a local var

stop repeatedly retrieving it

10 years agopp_entersub(): re-indent block
David Mitchell [Wed, 26 Feb 2014 17:47:47 +0000 (17:47 +0000)]
pp_entersub(): re-indent block

the previous commit wrapped a switch statement in an if(), so re-indent
accordingly. Whitespace-only change.

10 years agotweak pp_entersub
David Mitchell [Wed, 26 Feb 2014 17:38:33 +0000 (17:38 +0000)]
tweak pp_entersub

liberally sprinkle some LIKELY()s, initialise gimme closer to where
it's first needed, and shortcut the common case of a GV with valid CV,
skipping the switch statement.

With gcc and x86_64, this reduces the code size of the function by
about 5%.

10 years agoRemove spurious assert
Steffen Mueller [Thu, 27 Feb 2014 07:22:17 +0000 (08:22 +0100)]
Remove spurious assert

kid is always dereferenced before the assert.

10 years agoRemove leftover Windows 95 / Windows NT4 support code
Steve Hay [Wed, 26 Feb 2014 22:26:45 +0000 (22:26 +0000)]
Remove leftover Windows 95 / Windows NT4 support code

We only support building or running on Windows 2000 or higher, as of the
Windows 95 Chainsaw Massacre commit (8cbe99e5b6). These three chunks of
code escaped the massacre, but the chainsaw has finally caught up with them
now.

10 years agoList-OP removal: Fix compile fail on C90
Steffen Mueller [Wed, 26 Feb 2014 20:51:56 +0000 (21:51 +0100)]
List-OP removal: Fix compile fail on C90

Apologies. I'd applied Reini's patch to my optimization branch. I think
it got lost when I switched to Dave's variant my original code (which
didn't have Reini's C90 fix). Sorry!

10 years agoOptimization: Remove needless list/pushmark pairs from the OP execution
Steffen Mueller [Sat, 22 Feb 2014 09:08:25 +0000 (10:08 +0100)]
Optimization: Remove needless list/pushmark pairs from the OP execution

This is an optimization for OP trees that involve list OPs in list
context. In list context, the list OP's first child, a pushmark, will do
what its name claims and push a mark to the mark stack, indicating the
start of a list of parameters to another OP. Then the list's other
child OPs will do their stack pushing. Finally, the list OP will be
executed and do nothing but undo what the pushmark has done. This is
because the main effect of the list OP only really kicks in if it's
not in array context (actually, it should probably only kick in if
it's in scalar context, but I don't know of any valid examples of
list OPs in void contexts).

This optimization is quite a measurable speed-up for array or hash
slicing and some other situations. Another (contrived) example is
that (1,2,(3,4)) now actually is the same, performance-wise as
(1,2,3,4), albeit that's rarely relevant.

The price to pay for this is a slightly convoluted (by standards other
than the perl core) bit of optimization logic that has to do minor
look-ahead on certain OPs in the peephole optimizer.

A number of tests failed after the first attack on this problem. The
failures were in two categories:

a) Tests that are sensitive to details of the OP tree structure and did
verbatim text comparisons of B::Concise output (ouch). These are just
patched according to the new red in this commit.

b) Test that validly failed because certain conditions in op.c were
expecting OP_LISTs where there are now OP_NULLs (with op_targ=OP_LIST).
For these, the respective conditions in op.c were adjusted.

The change includes modifying B::Deparse to handle the new OP tree
structure in the face of nulled OP_LISTs.

10 years agoMacro for common OP checks: "is this X or was it before NULLing?"
Steffen Mueller [Fri, 21 Feb 2014 17:58:04 +0000 (18:58 +0100)]
Macro for common OP checks: "is this X or was it before NULLing?"

For example,

    if (OP_TYPE_IS_OR_WAS(o, OP_LIST))
        ...

is now available instead of either of the following:

    if ( o
         && ( o->op_type == OP_LIST
              || (o->op_type == OP_NULL
                  && o->op_targ == OP_LIST) ) )
        ...

    if ( o &&
         (o->op_type == OP_NULL ? o->op_targ ? o->op_type) == OP_LIST )
        ...

In case the above logic is a bit unclear: It checks whether that OP is
an OP_LIST or used to be one before being NULLed using op_null.
(FTR, the resulting OP_NULLs have their op_targ set to the old OP type).

This sort of check (and it's reverse "isn't and didn't use to be") are a
relatively common pattern in the part of op.c that tries to intuit
structures from optimization-mangled OP trees. Hopefully, using these
macros will make some code a fair amount clearer.

10 years agoRemove IO::Socket::IP examples as per Porting/Maintainers.pl
Steve Hay [Wed, 26 Feb 2014 08:19:11 +0000 (08:19 +0000)]
Remove IO::Socket::IP examples as per Porting/Maintainers.pl

10 years agoUpdate Pod-Perldoc to CPAN version 3.23
Chris 'BinGOs' Williams [Tue, 25 Feb 2014 11:16:00 +0000 (11:16 +0000)]
Update Pod-Perldoc to CPAN version 3.23

  [DELTA]

3.23 - Sun Feb 23 18:54:43 UTC 2014
    * Release 3.23

    Yes, this is a packaging error. Mea culpa. In the future
    test releases will be 3.23_01, etc.

    See https://twitter.com/frioux/status/429245594180128769
    for context.

3.22_02 - Wed Feb  5 05:08:34 UTC 2014
    * Add a pager that doesn't redirect stdin RT#85173
      Added a special pager environment variable for use
      when perldoc is in the -m mode that doesn't
      redirect STDIN.  Set PERLDOC_SRC_PAGER to use.

      As in:

      PERLDOC_SRC_PAGER=/usr/bin/vim perldoc -m File::Temp

    * Teach ToTerm.pm to get terminal width RT#85467
      Get a terminal width and pass it to Pod::Text::Termcap
      from one of these sources (in order):
          1. An explicit width set from command line with -w
          2. MANWIDTH environment variable
          3. stty output
          4. The default width of 76 (same as Pod::Text)

3.22_01 - Sat Feb  1 05:00:13 UTC 2014
    * Match =item more carefully when scanning perlfunc.
      Fixes RT #86795. Previously matches could be generated
      on words like 'size' and 'precision' which are not
      Perl functions.
    * Cleanup code related to mandoc RT #85844
      Patch by Ingo Schwarze
    * Re-add '-U' flag to skip attempting to drop
      privileges. RT #87837
    * Do not install to INSTALLDIRS after Perl 5.11 RT #89756
    * Refactor search_perlop (finds operators like 'q'
      'qq' 'tr' and others) RT #86506. Previously most of
      the text generated was incorrect.
    * Fix wrong version in DEBUG output from ToTerm.pm RT #85468
    * Fix POD errors when scanning parts of perlfunc RT #86472
      Patch by Shlomi Fish.

10 years agoUpdate CPAN-Meta-YAML to CPAN version 0.012
Chris 'BinGOs' Williams [Tue, 25 Feb 2014 11:10:09 +0000 (11:10 +0000)]
Update CPAN-Meta-YAML to CPAN version 0.012

Includes cc53c151 fix for VMS

  [DELTA]

0.012     2014-02-24 13:07:18-05:00 America/New_York

  - Generated from ETHER/YAML-Tiny-1.61.tar.gz

10 years agoUpdate IO-Socket-IP to CPAN version 0.29
Chris 'BinGOs' Williams [Tue, 25 Feb 2014 11:04:29 +0000 (11:04 +0000)]
Update IO-Socket-IP to CPAN version 0.29

  [DELTA]

  0.29  2014/02/24 16:06:29
        [BUGFIXES]
         * Workaround for OSes that disobey AI_ADDRCONFIG and yield AIs on
           families the kernel will not support anyway (e.g. HPUX)
         * Workaround for OSes that lack getprotobyname() (e.g. Android)

10 years agoFix RT #121321 - Fencepost error causes infinite loop in regex compilation
Yves Orton [Tue, 25 Feb 2014 11:07:18 +0000 (12:07 +0100)]
Fix RT #121321 - Fencepost error causes infinite loop in regex compilation

Due to a fencepost error if a pattern had more than 9 capture buffers
and after the last capture buffer there was an octal style escape which
when interpreted as decimal evaluated to one more than the number of
defined buffers then the regex compiler would go into an infinite loop.

This fixes the fencepost error, adds tests, and adds some comments to
explain what is going on.

10 years agoUse a temporary file instead of $^X when testing stat.
Nicholas Clark [Tue, 25 Feb 2014 10:36:26 +0000 (11:36 +0100)]
Use a temporary file instead of $^X when testing stat.

Otherwise there's a subtle race condition on the last access time, which can
cause the test to spuriously fail. I'm surprised that we've not seen this
failure until today.

10 years agoSilence some VC++ compiler warnings
Steve Hay [Tue, 25 Feb 2014 08:59:07 +0000 (08:59 +0000)]
Silence some VC++ compiler warnings

gv.c(1455) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
gv.c(1586) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
gv.c(2122) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
toke.c(12423) : warning C4244: '=' : conversion from 'I32' to 'char', possible loss of data
win32.c(3017) : warning C4022: 'SetHandleInformation' : pointer mismatch for actual parameter 1
win32.c(2971) : warning C4101: 'old_h' : unreferenced local variable
win32.c(2967) : warning C4101: 'oldfd' : unreferenced local variable

10 years agolib/locale.t: Make more tests not fail unless is bad for enough locales
Karl Williamson [Mon, 24 Feb 2014 19:00:03 +0000 (12:00 -0700)]
lib/locale.t: Make more tests not fail unless is bad for enough locales

locale.t has some tests that fail even one locale fails; and it has some
tests where failure doesn't happen unless a sufficient percentage of
locales have the same problem.

The first set should be for tests whose failure indicates a basic
problem in locale handling; and the second set should be for tests where
it could be that just a locale definition is bad.

Prior to this patch, tests dealing with radix problems were considered
in the first category, but in fact it's possible that just the locale
definition for the radix is wrong.  This is what happened for some older
Darwin versions for their Basque locales, which caused locale.t to show
failures, whereas it was just these locales that were bad, and the
generic handling was ok, or good enough.  (The actual failures had the
radix be the two character string: apostrophe followed by a blank.  It
would be a lot of work to make Perl deal with having a quote character
also mean a decimal point, and that work isn't worth it, especially as
this was a locale definition error, and we don't know of any locale in
the world where an apostrophe is legitimately a radix character.)

For this commit, I looked through the tests, and I added the tests where
it seemed that the problem could just be a bad locale definition to the
list of such tests.  Note that failures here could mean an internal Perl
error, but in that case, it should affect many more locales, so will
show up anyway as the failure rate should exceed the acceptable one.

10 years agolib/locale.t: Change an array to a hash
Karl Williamson [Mon, 24 Feb 2014 18:56:47 +0000 (11:56 -0700)]
lib/locale.t: Change an array to a hash

This is more naturally a hash in that it is a list of numbers, not
necessarily consecutive, and each time through the loop the same number
was getting pushed, so had multiple entries for each by the time it was
finished.

10 years agoMissing version bump for Deparse
Steffen Mueller [Mon, 24 Feb 2014 17:07:16 +0000 (18:07 +0100)]
Missing version bump for Deparse

Not a good run, I am having. But also not anything tangible
that our silly tests caught me on. :(

10 years agoTest fix: Update list of B::Concise functions
Steffen Mueller [Mon, 24 Feb 2014 17:00:08 +0000 (18:00 +0100)]
Test fix: Update list of B::Concise functions

Imagine there was a test that actually broken open a core module's
package and looked at all of its subs and compared it to a hardcoded
list of "constant" and "xs" functions. That would be madness, wouldn't
it? Breaking encapsulation, no less? Require tedious synchronization?

m(

10 years agoB::Deparse: Padrange deparse fix
Steffen Mueller [Mon, 24 Feb 2014 13:39:08 +0000 (14:39 +0100)]
B::Deparse: Padrange deparse fix

The PADRANGE support fakes up a PUSHMARK OP but until this commit, it
did so incompletely since it never overrode the OP type (that was still
an OP_PADRANGE). This addresses that.

On top of it, there's two minor changes that switch from "eq" to "=="
for comparing numeric OP types.

10 years agofix RT #121299 - Inconsistent behavior with backreferences nested inside subpattern...
Yves Orton [Sun, 23 Feb 2014 19:53:51 +0000 (20:53 +0100)]
fix RT #121299 - Inconsistent behavior with backreferences nested inside subpattern references

Match variables should be dynamically scoped during GOSUB and GOSTART.
The callers state should be inherited by the callee, but once the callee
returns, the callers state should be restored.

This is different from EVAL, where the callers and callees state are
expected to not be the same (although might be the same), and where
the "reasonable" match semantics differ. Currently the following two
one liners will produce different results:

$ ./perl -Ilib -le'"<ab><>>" =~/ < (?: \1 | [ab]+ ) (>) (?0)? /x and print $&;'
<ab><>>

$ ./perl -Ilib -le'$qr= qr/ < (?: \1 | [ab]+ ) (>) (??{ $qr })? /x; "<ab><>>" =~ m/$qr/ and print $&;'
<ab>

While I think reasonable people could argue that we should special case
things when we know that the return from (??{ ... }) is the same as the
currently executing pattern I think explaining the difference would be
harder than necessary.

On the contrary making GOSUB/GOSTART exactly the same as EVAL, so that
the match vars were totally independent seems to throw away an
opportunity for much more powerful semantics than can be offered by
EVAL.

10 years agoImprove how regprop dumps REF-like nodes during execution
Yves Orton [Sun, 23 Feb 2014 17:59:48 +0000 (18:59 +0100)]
Improve how regprop dumps REF-like nodes during execution

We pass in the regmatch_info struct, which allows us to dump
what a given REF is going to match.

10 years agocomments and whitespace fixups to inprove clarity of the code
Yves Orton [Fri, 21 Feb 2014 11:54:02 +0000 (12:54 +0100)]
comments and whitespace fixups to inprove clarity of the code

10 years agotest nit in CPAN-Meta-YAML/t/31_local_tml.t
Craig A. Berry [Mon, 24 Feb 2014 02:47:07 +0000 (20:47 -0600)]
test nit in CPAN-Meta-YAML/t/31_local_tml.t

Directories on VMS have a .DIR extension.  This test appears to be
constructing method names from directory names, so we need to trim off
the extension to get it to pass.

Awaiting upstream application at:

https://rt.cpan.org/Public/Bug/Display.html?id=93297

10 years agofix win32 build
David Mitchell [Sun, 23 Feb 2014 16:04:38 +0000 (16:04 +0000)]
fix win32 build

dca36a0cc embedded #ifdefs within a macro call, which is naughty (I
think). So have the ifdef outside the macro instead

10 years ago[perl #121259] Always allow COW after $input=<>
Father Chrysostomos [Mon, 17 Feb 2014 06:25:27 +0000 (22:25 -0800)]
[perl #121259] Always allow COW after $input=<>

sv_grow provides an extra byte for the sake of copy-on-write’s buffer
reference count, but skips this for multiples of 256 (though the com-
ments there say powers of two).

When we do

    $input=<>

The assignment is optimised away and the allocation takes place in
sv_gets.  In that code path, we know we don’t need a nice power of
two and allocating an extra byte won’t hurt, so go ahead and add an
extra byte.

This speeds up code doing m//g on $input, because it avoids the pre-
match copy.

10 years agoModule-CoreList 3.07 released to CPAN, bump core version to 3.08
Chris 'BinGOs' Williams [Fri, 21 Feb 2014 16:08:01 +0000 (16:08 +0000)]
Module-CoreList 3.07 released to CPAN, bump core version to 3.08

10 years agoFix syncing of Config-Perl-V with CPAN version 0.20
Steve Hay [Fri, 21 Feb 2014 08:37:37 +0000 (08:37 +0000)]
Fix syncing of Config-Perl-V with CPAN version 0.20

Commit d0fa2fb96e removed some erroneous changes made by commit 0b39d4dc4a
but didn't quite restore 21_plv518.t to match the CPAN version.