This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
9 years agoFix assertion failure with qr/\Q(?{})/
Father Chrysostomos [Mon, 1 Dec 2014 01:46:38 +0000 (17:46 -0800)]
Fix assertion failure with qr/\Q(?{})/

\Q and \u  create ops that need targets, and hence use the pad of
the anonymous sub created temporarily when parsing something like
qr/\Q(?{})/.  If it turns out we don’t have a code block (in this
case), that anon sub is thrown away, but there is an assertion that
makes sure its pad has not been used, which fails:

$ ./perl -e 'qr/\Q(?{})/'
Assertion failed: (AvFILLp(PL_comppad) == 0), function Perl_pmruntime, file op.c, line 5395.
Abort trap: 6

(That assertion was added by d63c20f27.)

If we have had \Q or \l, then the length of the pad may be more than
1, but constant folding should have stolen the values from the pad, so
assert that instead.

9 years agopp.c: dont work around glibc 2.2.5 _moddi3 bugs past 2.7
Jim Cromie [Thu, 20 Nov 2014 21:45:02 +0000 (14:45 -0700)]
pp.c: dont work around glibc 2.2.5 _moddi3 bugs past 2.7

Add glibc version checks to avoid runtime workarounds for an ancient bug.

p1- 224ec32361 in 2003 added a per-op one-time test to detect the bug,
    and patch around it in op_ppaddr.
p2- befad5d118 in 2007 limited the workaround to GLIBC and IVSIZE == 8
p3- a5bd31f4dc in 2012 suppressed it for defined(PERL_DEBUG_READONLY_OPS)

https://bugzilla.redhat.com/show_bug.cgi?id=65612
describes the test implemented in [p1]

Per wikipedia:
v2.2.5 isnt dated, but 2.2.4 is 7/2001.  redhat fixed theirs in 9/2002
v2.3 is 10/2002, and likely never had the bug released.
v2.3.2 in debian sarge, 2.3.4 in RHEL4

So picking v2.7 (10/2007) as last version pessimized is still quite
conservative, but also already 7 years old, 2x++ our perlpolicy support
window.  Its unlikely that such a platform would be seeing an install
of v5.22 or later.

9 years agofix incomplete mathoming of Perl_pad_compname_type
Daniel Dragan [Sun, 30 Nov 2014 21:31:13 +0000 (16:31 -0500)]
fix incomplete mathoming of Perl_pad_compname_type

commit 09d7a3ba91 moved Perl_pad_compname_type to mathoms but didn't
update makedef.pl. This causes a link failure of perl521.dll on Win32.

9 years ago[Merge] Inflict PADNAMEs on everyone
Father Chrysostomos [Sun, 30 Nov 2014 19:49:11 +0000 (11:49 -0800)]
[Merge] Inflict PADNAMEs on everyone

This makes PADNAME into a separate type from SV.  See
<https://rt.perl.org/rt3/Ticket/Display.html?id=123223> for the
reasoning.

9 years agoMinimise the size of padname + string buffer
Father Chrysostomos [Fri, 28 Nov 2014 22:35:40 +0000 (14:35 -0800)]
Minimise the size of padname + string buffer

If we define the struct a little differently, we can begin the string
buffer two bytes into a pointer, rather than pointer-aligned.  In case
some platforms can compare pointer-aligned string faster, I added a
#define to allow that.  But on 64-bit darwin the speed is identical
either way:

$ time ./miniperl -e 'eval q|my$a;|x50000 . q|eval q<my $A>|'

I ran this three times in each mode, and the average of the user times
differed by less than 1%.

9 years agoRemove proto magic type
Father Chrysostomos [Fri, 28 Nov 2014 06:35:17 +0000 (22:35 -0800)]
Remove proto magic type

It is no longer in use, as of two commits ago.

9 years agopad.c: Various doc updates
Father Chrysostomos [Fri, 28 Nov 2014 06:33:20 +0000 (22:33 -0800)]
pad.c: Various doc updates

9 years ago[perl #123223] Make PADNAME a separate type
Father Chrysostomos [Fri, 28 Nov 2014 06:30:54 +0000 (22:30 -0800)]
[perl #123223] Make PADNAME a separate type

distinct from SV.  This should fix the CPAN modules that were failing
when the PadnameLVALUE flag was added, because it shared the same
bit as SVs_OBJECT and pad names were going through code paths not
designed to handle pad names.

Unfortunately, it will probably break other CPAN modules, but I think
this change is for the better, as it makes both pad names and SVs sim-
pler and makes pad names take less memory.

9 years agopad.h: Mention ‘fake’ under PadnameOUTER
Father Chrysostomos [Fri, 28 Nov 2014 06:20:47 +0000 (22:20 -0800)]
pad.h: Mention ‘fake’ under PadnameOUTER

We refer to ‘fake’ entries in various places in the documentation,
and we still have the word FAKE in PARENT_FAKELEX_FLAGS, so noting
this should be helpful.

9 years agopad.h: Update PadnamePV description
Father Chrysostomos [Fri, 28 Nov 2014 06:18:31 +0000 (22:18 -0800)]
pad.h: Update PadnamePV description

GVs have been using ‘constant’ pad names for a while now, since
v5.21.3-188-gc2bad63.

9 years agoUse PADNAME rather than SV in pad.c:padlist_dup
Father Chrysostomos [Fri, 28 Nov 2014 06:14:39 +0000 (22:14 -0800)]
Use PADNAME rather than SV in pad.c:padlist_dup

9 years agoUse PADNAME rather than SV in pad.c:pad_push
Father Chrysostomos [Fri, 28 Nov 2014 06:14:08 +0000 (22:14 -0800)]
Use PADNAME rather than SV in pad.c:pad_push

9 years agoUse PADNAME rather than SV in pad.c:cv_clone_pad
Father Chrysostomos [Fri, 28 Nov 2014 06:12:56 +0000 (22:12 -0800)]
Use PADNAME rather than SV in pad.c:cv_clone_pad

9 years agoUse PADNAME rather than SV in pad.c:do_dump_pad
Father Chrysostomos [Fri, 28 Nov 2014 06:12:11 +0000 (22:12 -0800)]
Use PADNAME rather than SV in pad.c:do_dump_pad

9 years agoUse PADNAME rather than SV in pad.c:pad_tidy
Father Chrysostomos [Fri, 28 Nov 2014 06:11:29 +0000 (22:11 -0800)]
Use PADNAME rather than SV in pad.c:pad_tidy

9 years agoUse PADNAME rather than SV in pad.c:pad_leavemy
Father Chrysostomos [Fri, 28 Nov 2014 06:10:31 +0000 (22:10 -0800)]
Use PADNAME rather than SV in pad.c:pad_leavemy

9 years agoUse PADNAME rather than SV in pad.c:intro_my
Father Chrysostomos [Fri, 28 Nov 2014 06:09:38 +0000 (22:09 -0800)]
Use PADNAME rather than SV in pad.c:intro_my

9 years agopad.c: Don’t mk temp SVs for unavailable warnings
Father Chrysostomos [Fri, 28 Nov 2014 06:07:53 +0000 (22:07 -0800)]
pad.c: Don’t mk temp SVs for unavailable warnings

We already have the name SVs available, not just the string and length.

9 years agoUse PADNAME rather than SV in pad.c:S_unavailable
Father Chrysostomos [Fri, 28 Nov 2014 06:04:56 +0000 (22:04 -0800)]
Use PADNAME rather than SV in pad.c:S_unavailable

9 years agoUse PADNAME rather than SV in pad.c:pad_check_dup
Father Chrysostomos [Fri, 28 Nov 2014 03:30:06 +0000 (19:30 -0800)]
Use PADNAME rather than SV in pad.c:pad_check_dup

9 years agoUse PADNAME rather than SV in pad.c:pad_alloc
Father Chrysostomos [Fri, 28 Nov 2014 03:28:44 +0000 (19:28 -0800)]
Use PADNAME rather than SV in pad.c:pad_alloc

9 years agoUse PADNAME rather than SV in pad.c:cv_undef_flags
Father Chrysostomos [Fri, 28 Nov 2014 03:26:14 +0000 (19:26 -0800)]
Use PADNAME rather than SV in pad.c:cv_undef_flags

9 years agopad.c apidocs: Note the separate state for state
Father Chrysostomos [Fri, 28 Nov 2014 03:25:18 +0000 (19:25 -0800)]
pad.c apidocs: Note the separate state for state

9 years agoTeach diag.t about PNf
Father Chrysostomos [Fri, 28 Nov 2014 01:58:49 +0000 (17:58 -0800)]
Teach diag.t about PNf

9 years agoUse PadnameSV in op.c:newMYSUB
Father Chrysostomos [Fri, 28 Nov 2014 01:38:36 +0000 (17:38 -0800)]
Use PadnameSV in op.c:newMYSUB

9 years agoUse PNf rather than SVf in op.c:op_lvalue_flags
Father Chrysostomos [Fri, 28 Nov 2014 01:36:54 +0000 (17:36 -0800)]
Use PNf rather than SVf in op.c:op_lvalue_flags

9 years agoUse PADNAME rather than SV in op.c:finalize_op
Father Chrysostomos [Fri, 28 Nov 2014 01:36:26 +0000 (17:36 -0800)]
Use PADNAME rather than SV in op.c:finalize_op

9 years agoAdd ‘immortal’ pad name intrp vars
Father Chrysostomos [Fri, 28 Nov 2014 01:35:34 +0000 (17:35 -0800)]
Add ‘immortal’ pad name intrp vars

These will replace the current use of &PL_sv_undef and &PL_sv_no as
pad names.

9 years agoPrepare B typemap for upcoming pad name changes
Father Chrysostomos [Fri, 28 Nov 2014 01:07:44 +0000 (17:07 -0800)]
Prepare B typemap for upcoming pad name changes

9 years agoIncrease $B::Showlex::VERSION to 1.05
Father Chrysostomos [Fri, 28 Nov 2014 01:05:54 +0000 (17:05 -0800)]
Increase $B::Showlex::VERSION to 1.05

9 years agoPrepare B::Concise for upcoming pad name changes
Father Chrysostomos [Fri, 28 Nov 2014 01:02:44 +0000 (17:02 -0800)]
Prepare B::Concise for upcoming pad name changes

When pad names become their own type, separate from SVs, the ‘immor-
tal’ pad names, &PL_padname_undef and &PL_padname_const (to replace
&PL_sv_undef and &PL_sv_no), will no longer be B::SPECIAL objects,
but B::PADNAMEs.  The way to distinguish them is to check the
length.  This method happens to work both before and after the pad
name changes.

9 years agoB.pm: Clarify classes used for pad names
Father Chrysostomos [Fri, 28 Nov 2014 00:59:39 +0000 (16:59 -0800)]
B.pm: Clarify classes used for pad names

9 years agoB.pm: Document upcoming PADLIST changes
Father Chrysostomos [Fri, 28 Nov 2014 00:57:39 +0000 (16:57 -0800)]
B.pm: Document upcoming PADLIST changes

9 years agoUse PADNAME rather than SV in dump.c:debop
Father Chrysostomos [Fri, 28 Nov 2014 00:48:48 +0000 (16:48 -0800)]
Use PADNAME rather than SV in dump.c:debop

9 years agoperl.h: Add PNf and PNfARG
Father Chrysostomos [Fri, 28 Nov 2014 00:48:03 +0000 (16:48 -0800)]
perl.h: Add PNf and PNfARG

for pad names.  Currently equivalent to SVf(ARG), they will be changed
shortly when I make pad names a separate type.

9 years agofetch_pad_names.t: Emit all test names
Father Chrysostomos [Mon, 24 Nov 2014 08:42:20 +0000 (00:42 -0800)]
fetch_pad_names.t: Emit all test names

They were defined in the structure passed to the general_tests func-
tion, but not all of them were used.

9 years ago‘Subroutine (not var) "&x" will not stay shared’
Father Chrysostomos [Mon, 24 Nov 2014 08:33:35 +0000 (00:33 -0800)]
‘Subroutine (not var) "&x" will not stay shared’

Another ‘variable’ warning about lexical subs that I missed.

9 years agodiag.t: Allow multiline diag_listed_as
Father Chrysostomos [Mon, 24 Nov 2014 08:27:12 +0000 (00:27 -0800)]
diag.t: Allow multiline diag_listed_as

9 years agopad.c: Use UTF8f for ‘will not stay shared’
Father Chrysostomos [Mon, 24 Nov 2014 08:05:33 +0000 (00:05 -0800)]
pad.c: Use UTF8f for ‘will not stay shared’

This is more efficient than creating a temporary SV.

9 years agoMake pad names always UTF8
Father Chrysostomos [Mon, 24 Nov 2014 08:00:51 +0000 (00:00 -0800)]
Make pad names always UTF8

Prior to 5.16, pad names never used the UTF8 flag, and all non-ASCII
pad names were in UTF8.  Because the latter was consistently true,
everything just worked anyway.

In 5.16, UTF8 handling was done ‘properly’, so that non-ASCII UTF8
strings were always accompanied by the UTF8 flag.

Now, it is still the case that the only non-ASCII names to make their
way into pad name code are in UTF8.  Since ASCII is a subset of UTF8,
we effectively *always* have UTF8 pad names.  So the flag handling is
actually redundant.

If we just assume that all pad names are UTF8 (which is true), then
we don’t need to bother with the flag checking.  There is actually
no reason why we should have two different encodings for storing
pad names.

So this commit enforces what has always been the case and removes the
extra code for converting between Latin-1 and UTF8.  Nothing on CPAN
is using the UTF8 flag with pads, so nothing should break.  In fact,
we never documented padadd_UTF8_NAME.

9 years agopad.c:padlist_dup: Remove refcnt check
Father Chrysostomos [Sun, 23 Nov 2014 22:51:21 +0000 (14:51 -0800)]
pad.c:padlist_dup: Remove refcnt check

This was added by 6de654a5, and the assert that makes sure the
reference count is exactly 1 was added in the same commit.  After
several years, I think we can be sure now that the reference count
is indeed always 1.  We don’t need to ‘play it safe’ for non-debug-
ging builds.

9 years agoMake PADNAMELIST a separate type
Father Chrysostomos [Sun, 23 Nov 2014 22:25:22 +0000 (14:25 -0800)]
Make PADNAMELIST a separate type

This is in preparation for making PADNAME a separate type.

9 years agopad.c: Remove encoding handling
Father Chrysostomos [Fri, 21 Nov 2014 22:54:50 +0000 (14:54 -0800)]
pad.c: Remove encoding handling

When encoding.pm affects variable names, it decodes them to UTF-8, and
when it doesn’t non-ASCII lexical variable names are prohibited.  So
this code is not necessary.

9 years agoMathomise pad_compname_type
Father Chrysostomos [Fri, 21 Nov 2014 08:22:38 +0000 (00:22 -0800)]
Mathomise pad_compname_type

9 years agopad.h: Don’t use pad_compname_type
Father Chrysostomos [Fri, 21 Nov 2014 08:19:27 +0000 (00:19 -0800)]
pad.h: Don’t use pad_compname_type

We only use PAD_COMPNAME_TYPE in one place, so wrapping it in a func-
tion doesn’t save us anything, and probably slows things down if
anything.  Furthermore, PadnameTYPE will soon become even simpler
than before.

9 years agoUse PADNAME rather than SV in the source
Father Chrysostomos [Fri, 21 Nov 2014 08:17:08 +0000 (00:17 -0800)]
Use PADNAME rather than SV in the source

This is in preparation for making PADNAME a separate type.

This commit is not perfect.  What I did was temporarily make PADNAME a
separate struct identical to struct sv and make whatever changes were
necessary to avoid compiler warnings.  In some cases I had to add tem-
porary SV casts.

9 years agoFix qr/@array(?{block})/
Father Chrysostomos [Sun, 30 Nov 2014 16:19:59 +0000 (08:19 -0800)]
Fix qr/@array(?{block})/

For qr/(?{})/ to work closurewise, it has to have an implicit anony-
mous sub that the blocks run in.  To that end, the parser compiles the
entire thing in the context of a new anonymous sub.

For a run-time, pattern (with @a or $b outside the block), since the
ops have been compiled in the context of that anonymous sub, they must
be run within it, too (otherwise the ops point to the wrong pad), so
at compile time the ‘arguments’ to qr are turned into a call to an
anonymous sub that looks like like sub { @a, "(?{...})", ...}.

This was causing a bizarre copy:

$ perl5.18.1 -e 'qr/@a(?{})/'
Bizarre copy of ARRAY in subroutine exit at -e line 1.

Bisect points to v5.17.10-92-g491453b:

$  ../perl.git/Porting/bisect.pl --target=miniperl  --start=v5.14.0   --end=v5.18.1 -e 'BEGIN{$^H|=0x00200000} qr/@a(?{})/'
...
491453ba443e114f751f325a4734b3d07b897606 is the first bad commit
commit 491453ba443e114f751f325a4734b3d07b897606
Author: David Mitchell <davem@iabyn.com>
Date:   Wed Apr 17 17:51:16 2013 +0100

    Handle /@a/ array expansion within regex engine

The array op was not being flagged as a flattening op, and sub exit
was trying to copy an unflattened array.  We don’t want the array
flattened.  To allow it to pass through sub exit unscathed, we need to
make this an lvalue sub.  That fixes it and everything just works.  It
even makes non-array cases slightly faster, because nothing is copied
at sub exit now:

before$ time ./miniperl -e 'qr/$a(?{})/ for 1..1000000'

real 0m3.321s
user 0m3.312s
sys 0m0.006s
after$ time ./miniperl -e 'qr/$a(?{})/ for 1..1000000'

real 0m2.855s
user 0m2.845s
sys 0m0.006s

9 years agoFix newRV_noinc assertions
Father Chrysostomos [Sun, 30 Nov 2014 15:04:04 +0000 (07:04 -0800)]
Fix newRV_noinc assertions

As of 7777302a PERL_ARGS_ASSERT_NEWRV_NOINC has been failing an asser-
tion, because the variable mentioned in embed.fnc (which the macro
uses) is not the function’s parameter, but another, uninitial-
ised variable.

This disparity between the variable names in the function definition
and its prototype goes back to e3b8966e2a.

9 years agoB::Concise: Dump regexp code blocks
Father Chrysostomos [Sun, 30 Nov 2014 05:53:14 +0000 (21:53 -0800)]
B::Concise: Dump regexp code blocks

As of perl 5.18, pmops have a code_list pointer that points to a list
of ops representing the constants, variables and code blocks that
make up the regular expression.  For run-time compilation, these ops
are also accessible via pmop->op_first->op_first (i.e., the kids of
the regcomp op), so they are already dumped.  But for regexp compiled
at compile time, these ops were not being dumped.  So this commit
makes them appear as kids of the pmop, right before the replacement
block in the case of subst.

9 years agoAttempt to bring newSViv/uv optimization to newRV
Steffen Mueller [Fri, 28 Nov 2014 17:05:34 +0000 (18:05 +0100)]
Attempt to bring newSViv/uv optimization to newRV

Cf. bd30fe8921c88e4677c2279b442a56a11ae037b4 for details.

9 years agoRepeat newSViv optimization for newSVuv
Steffen Mueller [Fri, 28 Nov 2014 16:34:00 +0000 (17:34 +0100)]
Repeat newSViv optimization for newSVuv

Pretty much the same change as
bd30fe8921c88e4677c2279b442a56a11ae037b4 was for newSViv.

9 years agoBranch predictor hint for exceptional branch
Steffen Mueller [Fri, 28 Nov 2014 16:33:42 +0000 (17:33 +0100)]
Branch predictor hint for exceptional branch

9 years agoWrap long verbatim pod lines in bench.pl
Father Chrysostomos [Sun, 30 Nov 2014 06:08:21 +0000 (22:08 -0800)]
Wrap long verbatim pod lines in bench.pl

9 years agoExpose qr_anoncv via B::REGEXP
Father Chrysostomos [Sun, 30 Nov 2014 02:47:36 +0000 (18:47 -0800)]
Expose qr_anoncv via B::REGEXP

This is necessary to get to the code blocks in qr/(?{...})/.

9 years agoB.pm: Document the B::REGEXP methods
Father Chrysostomos [Sun, 30 Nov 2014 01:38:03 +0000 (17:38 -0800)]
B.pm: Document the B::REGEXP methods

9 years agoDeparse.pm: Update docs concerning lex subs
Father Chrysostomos [Sun, 30 Nov 2014 01:24:11 +0000 (17:24 -0800)]
Deparse.pm: Update docs concerning lex subs

9 years agoDeparse: Qualify pkg CVs that conflict w. lex CVs
Father Chrysostomos [Sun, 30 Nov 2014 01:18:52 +0000 (17:18 -0800)]
Deparse: Qualify pkg CVs that conflict w. lex CVs

9 years agoDeparse lexical subs
Father Chrysostomos [Fri, 14 Nov 2014 06:32:26 +0000 (22:32 -0800)]
Deparse lexical subs

We currently have a problem with the hints to allow lexical subs to
begin with not necessarily being in scope at the point of the declara-
tion.  So the fix for that (which is a bit of a kludge) is to emit
‘use feature 'lexical_subs'’ and the equivalent of turning off the
corresponding warnings category, which may result in a surfeit of
^WARNING_BITS gibberish.  But at least it works. :-)

Also, package subs are not yet disambiguated with package name pre-
fixes if they fall in the same scope as lexical subs of the same name.

9 years agoadd Porting/bench.pl
David Mitchell [Fri, 14 Nov 2014 12:18:12 +0000 (12:18 +0000)]
add Porting/bench.pl

This tool runs code snippets found in t/perf/benchmarks (or similar) under
cachegrind, in order to calculate how many instruction reads, data writes,
branches, cache misses, etc. that one execution of the snippet uses. It
will run them against two or more perl executables and show how much each
test has gotten better or worse.

It is modelled on the perlbench tool, but since it measures instruction
reads etc., rather than timings, it is much more precise and reproducible.
It is also considerably faster, and is capable or running tests in
parallel. Rather than displaying a single relative percentage per
test/perl combination, it displays values for 13 different measurements,
such as instruction reads, conditional branch misses etc.

This commit also changes the format of t/perf/benchmarks slightly; it
becomes an AoH rather than a HoH (to allow checking for duplicate keys),
and the test names themselves become a :: hierarchy.

9 years agoComment tweak.
Jarkko Hietaniemi [Fri, 28 Nov 2014 17:30:35 +0000 (12:30 -0500)]
Comment tweak.

9 years agoIf neither quad nor long double, %Ld etc need to fail.
Jarkko Hietaniemi [Sat, 29 Nov 2014 20:50:28 +0000 (15:50 -0500)]
If neither quad nor long double, %Ld etc need to fail.

(hpux 10.20 has no quad, and its long double is non-standard)

9 years agoUse LONG_DOUBLEKIND only if HAS_LONG_DOUBLE.
Jarkko Hietaniemi [Sat, 29 Nov 2014 16:12:24 +0000 (11:12 -0500)]
Use LONG_DOUBLEKIND only if HAS_LONG_DOUBLE.

9 years agoHP-UX 10.20 has pseudo-long-double which shouldn't be used.
Jarkko Hietaniemi [Fri, 28 Nov 2014 16:53:57 +0000 (11:53 -0500)]
HP-UX 10.20 has pseudo-long-double which shouldn't be used.

9 years agoComment tweak.
Jarkko Hietaniemi [Fri, 28 Nov 2014 17:30:35 +0000 (12:30 -0500)]
Comment tweak.

9 years agoUse LONG_DOUBLEKIND only if HAS_LONG_DOUBLE.
Jarkko Hietaniemi [Sat, 29 Nov 2014 16:12:24 +0000 (11:12 -0500)]
Use LONG_DOUBLEKIND only if HAS_LONG_DOUBLE.

9 years agoHP-UX 10.20 has pseudo-long-double which shouldn't be used.
Jarkko Hietaniemi [Fri, 28 Nov 2014 16:53:57 +0000 (11:53 -0500)]
HP-UX 10.20 has pseudo-long-double which shouldn't be used.

9 years agoUpdate libnet to CPAN version 3.04
Chris 'BinGOs' Williams [Sat, 29 Nov 2014 19:47:50 +0000 (19:47 +0000)]
Update libnet to CPAN version 3.04

  [DELTA]

3.04 2014-11-29

    - SNI is now only used for SSL connections if it is supported by
      IO::Socket::SSL (i.e. OpenSSL version >= 1).  (The previous release
      switched to using SNI by default, which caused some CPAN Testers
      failures.)  [Steffen Ullrich, PR#10]

9 years agoUpdate libnet to CPAN version 3.03
Chris 'BinGOs' Williams [Sat, 29 Nov 2014 15:21:12 +0000 (15:21 +0000)]
Update libnet to CPAN version 3.03

  [DELTA]

3.03 2014-11-28

    - Remodelled SSL support in Net::NNTP in the manner of Net::POP3 and
      Net::SMTP.  [Steffen Ullrich, PR#9]

    - Increased minimum requred IO::Socket::SSL version from 1.999 to 2.007 to
      fix data connection problems in Net::FTP.  [Steffen Ullrich, CPAN
      RT#100529]

    - Fixed a broken port() call in pasv_xfer()/pasv_xfer_unique() in Net::FTP.
      [Mario Preksavec, PR#8]

    - Increased minimum required Socket version from 1.3 to 2.016.  This may be
      required when those modules that can support IPv6 load IO::Socket::IP (on
      some OSes, at least).  It does not appear to be necessary if they load
      IO::Socket::INET6 or IO::Socket::INET instead, but this is not easy for
      the end-user to control so it is simpler to always insist on Socket 2.016
      or higher.  [CPAN RT#100020]

    - Fixed "Argument ... isn't numeric in subroutine entry" warnings when using
      older versions of Perl.  [CPAN RT#100020]

    - Added optional Changes testing (skipped unless AUTHOR_TESTING).

    - Reformatted Changes file as per CPAN::Changes::Spec.

9 years agoscalar($#foo) needs to propagate lvalue context
Father Chrysostomos [Sat, 29 Nov 2014 14:35:41 +0000 (06:35 -0800)]
scalar($#foo) needs to propagate lvalue context

$ ./perl -Ilib -le 'for($#foo) { $_ = 3 } print $#foo'
3
$ ./perl -Ilib -le 'for(scalar $#foo) { $_ = 3 } print $#foo'
-1

If I replace $#foo with $foo, I get the same results from both
one-liners.

In commit d408447cb6 (pre-5.16) I tried propagating lvalue context,
but I did not take into account things like \scalar @array, which
ended up being equivalent to \@array, instead of a returning a refer-
ence to a scalar holding the length of the array.  So I reverted it in
41b1a11c.  See bug #106288.

The $#foo example above, which I recently ran into, shows that we
really do need to propagate lvalue context.  (Come to think of it, it
is just a variant of the test I added in d408447cb6.)  But we need to
be careful what kind we propagate.  If scalar itself is in lvalue con-
text, then, regardless of the type, we need to apply ‘entersub’ lvalue
context to its argument.  Also, to preserve existing behaviour as much
as possible, this time scalar(...)= still dies.

9 years agodefine and use STATIC_ASSERT_STMT for compile-time invariants
Lukas Mai [Sat, 29 Nov 2014 11:17:05 +0000 (12:17 +0100)]
define and use STATIC_ASSERT_STMT for compile-time invariants

9 years agomake more use of NOT_REACHED
Lukas Mai [Sat, 29 Nov 2014 11:37:50 +0000 (12:37 +0100)]
make more use of NOT_REACHED

In particular, remove all instances of 'assert(0);'.

9 years ago[perl #123313] sub { f(); BEGIN{} } was void cx
Father Chrysostomos [Sat, 29 Nov 2014 14:04:38 +0000 (06:04 -0800)]
[perl #123313] sub { f(); BEGIN{} } was void cx

In v5.21.6-11-g34b5495 I accidentally put the last statement in a
block in void context when followed by a sub declaration.  scalarseq,
and not just scalar, needs to know about the extra ex-cop kid.

9 years agoop.c: Fix linux g++ compilation
Father Chrysostomos [Sat, 29 Nov 2014 05:33:03 +0000 (21:33 -0800)]
op.c: Fix linux g++ compilation

On darwin, passing a const char* to strchr just works.  On linux,
the compiler throws a tantrum.

9 years agofix off-by-one error in version check
Lukas Mai [Fri, 28 Nov 2014 23:07:38 +0000 (00:07 +0100)]
fix off-by-one error in version check

9 years agoOpcode.pm: wrap long verbatim pod line
Father Chrysostomos [Sat, 29 Nov 2014 04:14:53 +0000 (20:14 -0800)]
Opcode.pm: wrap long verbatim pod line

9 years agospeedup for SUPER::method() calls.
syber [Fri, 28 Nov 2014 18:22:25 +0000 (21:22 +0300)]
speedup for SUPER::method() calls.

In ck_method:
Scan for '/::. If found SUPER::, create OP_METHOD_SUPER op
with precomputed hash value for method name.

In B::*, added support for method_super

In pp_hot.c, pp_method_*:
S_method_common removed, code related to getting stash is
moved to S_opmethod_stash, other code is moved to
pp_method_* functions.

As a result, SUPER::func() calls speeded up by 50%.

9 years agoIncrease $XS::APItest::VERSION to 0.69
Father Chrysostomos [Sat, 29 Nov 2014 00:04:50 +0000 (16:04 -0800)]
Increase $XS::APItest::VERSION to 0.69

9 years agoFix newFOROP with PERL_OP_PARENT and no slab
Father Chrysostomos [Fri, 28 Nov 2014 22:50:33 +0000 (14:50 -0800)]
Fix newFOROP with PERL_OP_PARENT and no slab

It wasn’t updating the parent pointer after reallocating the op.

9 years agoperl5220delta: Future is fixed
Father Chrysostomos [Thu, 27 Nov 2014 22:48:32 +0000 (14:48 -0800)]
perl5220delta: Future is fixed

9 years agoext/Fcntl/Makefile.PL: Make S_IFMT unsigned
Tony Cook [Wed, 26 Nov 2014 22:50:47 +0000 (15:50 -0700)]
ext/Fcntl/Makefile.PL: Make S_IFMT unsigned

See <20141126223250.GS19835@mars.tony.develop-help.com>
S_IFMT on os390 has the upper bit set but Perl is expecting an unsigned,
so force it to be so.

9 years agoSpeed up newSViv()
Eric Herman [Fri, 28 Nov 2014 14:08:04 +0000 (15:08 +0100)]
Speed up newSViv()

newSViv() is not used a whole lot by the core. But it is frequently
used in XS modules. In a nutshell, it allocates a new EMPTY SV just to
call sv_setiv which calls sv_upgrade which in turn spends inordinate
amounts of time looking at the properties of the SV to make it an
SVt_IV. But the properties of that SV are always the same: a clean
slate! Therefore, inlining the very simple bits of sv_setiv that are
actually necessary gives a very tangible speed-up.

It's not very easy to benchmark with with a language-level one-liner
because newSViv() isn't too common in the core. Thus follow XS
micro-benchmarks:

Benchmark 1: Virtually no-op XS function.

  SV *
  echo_integer(int in)
    CODE:
      RETVAL = newSViv(in);
    OUTPUT: RETVAL

  $ dumbbench -i50 --pin-frequency -- ./perl -Ilib \
    -MXS::APItest -e 'XS::APItest::echo_integer($_) for 1..1000000'

Before: 3.2782e-01 seconds
After:  3.0530e-01 seconds

A small change, but considering the massive overhead of a function call,
quite surprisingly noticeable.

Benchmark 2: XS function that constructs multiple integer values.

SV *
echo_integer_array(int in)
  PREINIT:
    int i;
    AV *av;
  CODE:
    av = newAV();
    RETVAL = newRV_noinc((SV *)av);
    av_extend(av, in-1);
    for (i = 0; i < in; ++i)
      av_store(av, i, newSViv(i));
  OUTPUT: RETVAL

  $ dumbbench -i50 --pin-frequency -- ./perl -Ilib \
    -MXS::APItest -e 'XS::APItest::echo_integer_array(100) for 1..10000'

Before: 1.18363e-01 seconds
After:  0.92050e-01 seconds

While in the grand scheme of things, this might seem like a very small
optimization, there are many XS modules that actually generate a lot of
integer values, de-serializers being good examples.

9 years agoSpeed up assigning an IV to a previously cleared SV
Eric Herman [Fri, 28 Nov 2014 11:08:46 +0000 (12:08 +0100)]
Speed up assigning an IV to a previously cleared SV

This change simply avoids calling sv_upgrade (which will do a ton of
work to determine source and destination types) in a hot code path where
at that very location, we've already just done all the same leg work to
figure out source and destination types of the SV type conversion. In
this particularly common and simple variant (SVt_NULL to SVt_IV), it's
easy to do much better than sv_upgrade.

Micro-benchmark used to validate this:

  $ dumbbench -i50 --pin-frequency -- \
    ./perl -Ilib -e 'for my $x (1..1000){my @a = (1..2000);}'

Before:

  Rounded run time per iteration: 2.4311e-01 +/- 1.4e-04 (0.1%)

After:

  Rounded run time per iteration: 1.99354e-01 +/- 5.5e-05 (0.0%)

That's 18% faster. While the micro-benchmark is very heavy on exercising
this code path, it's a common code path. This is expected to have some
real-world impact. There are likely more, similar optimizations that
could have similar impact.

NB: A similar change to newSViv also speeds up newSViv significantly,
but newSViv is hardly used in the core. On the other hand, XS modules
exercise it a lot. The Sereal decoder would be significantly, positively
affected by doing a similar change there.

9 years agoRefactor bodyless-IV/NV hacks into define
Eric Herman [Fri, 28 Nov 2014 08:58:46 +0000 (09:58 +0100)]
Refactor bodyless-IV/NV hacks into define

This commit adds documentation of the bodyless-IV/NV hacks as well as
moving the offset calculation into a somewhat sensibly-named define
instead of cargo-culting the obscure logic in many different places.

9 years agoAdd Eric Herman to Perl AUTHORS
Steffen Mueller [Fri, 28 Nov 2014 09:02:22 +0000 (10:02 +0100)]
Add Eric Herman to Perl AUTHORS

9 years agoBump Dynloader version to satisfy porting/cmp_version.t
Chris 'BinGOs' Williams [Thu, 27 Nov 2014 22:44:37 +0000 (22:44 +0000)]
Bump Dynloader version to satisfy porting/cmp_version.t

9 years agoUpdate Encode to CPAN version 2.65
Chris 'BinGOs' Williams [Thu, 27 Nov 2014 22:27:32 +0000 (22:27 +0000)]
Update Encode to CPAN version 2.65

  [DELTA]

$Revision: 2.65 $ $Date: 2014/11/27 14:08:33 $
! Changes Encode.xs bin/enc2xs
  Applied 3 patches from jhi:
    0001-For-C-don-t-use-the-array-size-in-forward-declaratiotion
    0002-Unused-variables
    0003-1-needs-casting-to-STRLEN
  Message-Id: <54753674.6070909@iki.fi>

9 years agoHoist switch-local variables.
Jarkko Hietaniemi [Thu, 27 Nov 2014 16:52:56 +0000 (11:52 -0500)]
Hoist switch-local variables.

Additionally, svp was shadowed.

(clang -Wunreachable-code)

9 years agoswitch-local variables are a bad idea.
Jarkko Hietaniemi [Thu, 27 Nov 2014 16:46:27 +0000 (11:46 -0500)]
switch-local variables are a bad idea.

(another weirdness is that the mg and stash are not explicitly
used in the code, so the macros must be assuming their existence.)

(clang -Wunreachable-code)

9 years agoHP-UX dynaloading uses shl_t, not void ptr.
Jarkko Hietaniemi [Thu, 27 Nov 2014 15:32:13 +0000 (10:32 -0500)]
HP-UX dynaloading uses shl_t, not void ptr.

9 years agohv_store_ent() return value unused.
Jarkko Hietaniemi [Thu, 27 Nov 2014 15:26:48 +0000 (10:26 -0500)]
hv_store_ent() return value unused.

mg.c: In function 'Perl_magic_setlvref':
mg.c:2549:2: warning: value computed is not used [-Wunused-value]
pp.c: In function 'Perl_pp_refassign':
pp.c:6263:2: warning: value computed is not used [-Wunused-value]

9 years agoprintf type-matching.
Jarkko Hietaniemi [Thu, 27 Nov 2014 15:25:16 +0000 (10:25 -0500)]
printf type-matching.

9 years agoUpdate IO-Socket-IP to CPAN version 0.33
Chris 'BinGOs' Williams [Thu, 27 Nov 2014 13:58:44 +0000 (13:58 +0000)]
Update IO-Socket-IP to CPAN version 0.33

  [DELTA]

0.33    2014/11/21 16:17:39
        [BUGFIXES]
         * Use SOL_SOCKET/SO_ERROR sockopt rather than 2nd connect() error
           hoisting to detect nonblocking connect/failure when implementing
           Timeout (RT98976) (thanks Arthur Axel 'fREW' Schmidt)

9 years agoEnable POSIX::strtold() on Windows (GCC) USE_LONG_DOUBLE builds
Steve Hay [Thu, 27 Nov 2014 09:08:56 +0000 (09:08 +0000)]
Enable POSIX::strtold() on Windows (GCC) USE_LONG_DOUBLE builds

9 years agoModule-CoreList is at 5.20141120 on teh CPAN
Chris 'BinGOs' Williams [Thu, 27 Nov 2014 11:54:30 +0000 (11:54 +0000)]
Module-CoreList is at 5.20141120 on teh CPAN

9 years agoallow PERL_DISABLE_PMC to be defined from anywhere
Daniel Dragan [Sun, 23 Nov 2014 21:14:40 +0000 (16:14 -0500)]
allow PERL_DISABLE_PMC to be defined from anywhere

I enable PERL_DISABLE_PMC in a .h, not in CCFLAGS. CCFLAGS on Unix
typically has no -Ds in it, build options go into config.h, not
Config.pm's CCFLAGS. This change allows PERL_DISABLE_PMC option to pass
tests regardless of where it is defined. cpan/parent/t/parent-pmc.t is not
fixed by this patch.

9 years agoIf no cuserid(), s is unused.
Jarkko Hietaniemi [Thu, 27 Nov 2014 01:52:05 +0000 (20:52 -0500)]
If no cuserid(), s is unused.

9 years agoRevert "Remove -std=c89/-ansi if freebsd has "inline static" in <fenv.h>"
Jarkko Hietaniemi [Wed, 26 Nov 2014 22:15:51 +0000 (17:15 -0500)]
Revert "Remove -std=c89/-ansi if freebsd has "inline static" in <fenv.h>"

This reverts commit f5fdb0259d5e9470e8291544a8b209e202d36334.

(the theory is that 7ff69a2d made this unnecessary)

9 years agoUpdate Test-Simple to alpha 079
Chad Granum [Mon, 24 Nov 2014 04:57:26 +0000 (20:57 -0800)]
Update Test-Simple to alpha 079

9 years agoSuppress ‘-e syntax OK’ in concise.t
Father Chrysostomos [Wed, 26 Nov 2014 18:17:18 +0000 (10:17 -0800)]
Suppress ‘-e syntax OK’ in concise.t

On Windows, the output was including

# 490-e syntax OK
# :      $l->concise($level);

which does not match /(?^:\# 4\d\d: \s+ \$l->concise\(\$level\);)/,
hence the test failure.

9 years agoMake coresub.t faster by eschewing B::Deparse
Father Chrysostomos [Wed, 26 Nov 2014 06:41:27 +0000 (22:41 -0800)]
Make coresub.t faster by eschewing B::Deparse

Just use B directly to look at the op tree, instead of checking that
deparsed op trees are identical.

Before:

real 0m4.021s
user 0m3.668s
sys 0m0.191s

After:

real 0m0.388s
user 0m0.251s
sys 0m0.080s