This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
9 years agoregcomp.c: Add comment.
Yves Orton [Sun, 19 Oct 2014 20:48:44 +0000 (22:48 +0200)]
regcomp.c: Add comment.

9 years agoregcomp.c: study_chunk(): Reset the entire data struct, not just a bit of it.
Yves Orton [Sun, 19 Oct 2014 20:48:14 +0000 (22:48 +0200)]
regcomp.c: study_chunk(): Reset the entire data struct, not just a bit of it.

9 years agoregcomp.c: Improve advanced re debug output
Yves Orton [Sun, 19 Oct 2014 20:45:35 +0000 (22:45 +0200)]
regcomp.c: Improve advanced re debug output

use pv_pretty(), add better flags information, and a more compact
recurse bitmap frame outpute, etc.

9 years agodump.c: Add PERL_PV_PRETTY_EXACTSIZE option
Yves Orton [Sun, 19 Oct 2014 20:43:21 +0000 (22:43 +0200)]
dump.c: Add PERL_PV_PRETTY_EXACTSIZE option

Sometimes we want things to fit exactly into a specific number
of chars, elipses, quotes and all. Includes make regen update
to make dsv argument nullok.

9 years agoregcomp.c: Fixup debug output so it matches other messages in context
Yves Orton [Sun, 19 Oct 2014 15:19:50 +0000 (17:19 +0200)]
regcomp.c: Fixup debug output so it matches other messages in context

9 years agoregcomp.c: Improve re debug output by showing buffer names if they exist
Yves Orton [Wed, 15 Oct 2014 21:03:35 +0000 (23:03 +0200)]
regcomp.c: Improve re debug output by showing buffer names if they exist

Requires adding a new optional argument to regprop as we do not
have a completed regexp object to give us the names, and we need
to get it from RExC_state.

9 years agoregcomp.c: study_chunk(): improve branch-branch comment
Yves Orton [Sun, 12 Oct 2014 21:08:42 +0000 (23:08 +0200)]
regcomp.c: study_chunk(): improve branch-branch comment

9 years agoregcomp.c: study_chunk(): whitespace fixup for legibility
Yves Orton [Sun, 12 Oct 2014 21:05:11 +0000 (23:05 +0200)]
regcomp.c: study_chunk(): whitespace fixup for legibility

9 years agoregcomp.c: eliminate memory leak from GOSUB/GOSTART regops
Yves Orton [Sun, 12 Oct 2014 19:28:57 +0000 (21:28 +0200)]
regcomp.c: eliminate memory leak from GOSUB/GOSTART regops

We can reuse previously allocated frames and avoid blowing
up memory during regex compile of complex recursive patterns.

A pattern like that reported in RT #122283 would chew up all
avaiable memory allocating new frames each time it recursed.

9 years agoregcomp.c: reuse temporary debugging temp sv's
Yves Orton [Sun, 12 Oct 2014 19:26:31 +0000 (21:26 +0200)]
regcomp.c: reuse temporary debugging temp sv's

For dumping regex debug state we need some temporary SV's on hand
to pass into regprop() which writes into an SV to do it's thing.
Allocating a new mortal SV every time we want to do this is very
wasteful, and manifests as a "leak" in very long compiles such as
when debugging issues like RT #122283.

By storing the SV's in RExC_state_t we can reuse them during the
compilation process and avoid leaking memory for nothing.

9 years agoregcomp.c: struct scan_frame: rename members for clarity
Yves Orton [Sun, 12 Oct 2014 16:18:38 +0000 (18:18 +0200)]
regcomp.c: struct scan_frame: rename members for clarity

Rename some members of scan_frame so it is easier to understand what
they are for, in preparation for adding some more members.

9 years ago/tmp can have (low) quotas on the number of files.
Jarkko Hietaniemi [Sun, 19 Oct 2014 21:50:22 +0000 (17:50 -0400)]
/tmp can have (low) quotas on the number of files.

/tmp, or wherever tempdir happens.

Happened in IRIX, but applicable anywhere.

9 years agoIRIX: fsync documented to fail on read-only filehandles.
Jarkko Hietaniemi [Sun, 19 Oct 2014 21:37:42 +0000 (17:37 -0400)]
IRIX: fsync documented to fail on read-only filehandles.

9 years agoFix crash with ‘join,’ caused by 987c96916
Father Chrysostomos [Sun, 19 Oct 2014 18:06:48 +0000 (11:06 -0700)]
Fix crash with ‘join,’ caused by 987c96916

9 years agoperldelta: Update the Inf and Nan entry.
Abigail [Sun, 19 Oct 2014 17:30:44 +0000 (19:30 +0200)]
perldelta: Update the Inf and Nan entry.

jhi says properly explaining the long-double and double-double requires
much more detail, so he suggested dropping mentioning it.

9 years agoperldelta: Mention that IRIX and Tru64 are regained platforms.
Abigail [Sun, 19 Oct 2014 16:39:44 +0000 (18:39 +0200)]
perldelta: Mention that IRIX and Tru64 are regained platforms.

9 years agoFix spelling in perldelta
Abigail [Sun, 19 Oct 2014 16:29:19 +0000 (18:29 +0200)]
Fix spelling in perldelta

Using ispell. Ispell does complain about "Acknowledgements", suggesting
"Acknowledgments", but Merriam-Webster recognizes "Acknowledgements" as
a valid variation.

9 years agoAn error cannot be both new, and reworded.
Abigail [Sun, 19 Oct 2014 16:17:17 +0000 (18:17 +0200)]
An error cannot be both new, and reworded.

9 years agoReplace "message" with the actual message.
Abigail [Sun, 19 Oct 2014 16:16:08 +0000 (18:16 +0200)]
Replace "message" with the actual message.

Otherwise, the formatted delta will just list "message" when listing
new errors, instead of the actual messages.

9 years agoAnother perldelta entry
Abigail [Sun, 19 Oct 2014 16:10:32 +0000 (18:10 +0200)]
Another perldelta entry

9 years agoperlvar: Note a deprecation
Karl Williamson [Sun, 19 Oct 2014 14:57:26 +0000 (08:57 -0600)]
perlvar: Note a deprecation

9 years agoperldelta: Typo, clarification
Karl Williamson [Thu, 16 Oct 2014 18:54:53 +0000 (12:54 -0600)]
perldelta: Typo, clarification

9 years agoUpdate Stevan Little's email address
Karl Williamson [Fri, 17 Oct 2014 21:20:07 +0000 (15:20 -0600)]
Update Stevan Little's email address

9 years agoRemove unused stubs and editing notes from perldelta.
Abigail [Sun, 19 Oct 2014 13:59:19 +0000 (15:59 +0200)]
Remove unused stubs and editing notes from perldelta.

9 years agoMore perldelta work
Abigail [Sun, 19 Oct 2014 13:48:37 +0000 (15:48 +0200)]
More perldelta work

9 years agoAdd blank line after =item
Abigail [Sun, 19 Oct 2014 11:50:05 +0000 (13:50 +0200)]
Add blank line after =item

9 years agoperldelta entry for update to perlfaq
James E Keenan [Sun, 19 Oct 2014 12:41:40 +0000 (08:41 -0400)]
perldelta entry for update to perlfaq

9 years agoUpdate perlfaq to version 5.015046
Karen Etheridge [Sun, 19 Oct 2014 02:12:09 +0000 (19:12 -0700)]
Update perlfaq to version 5.015046

9 years agoperldelta for 412989c
Father Chrysostomos [Sun, 19 Oct 2014 05:45:35 +0000 (22:45 -0700)]
perldelta for 412989c

9 years agoTweak multiple nextstate optimisation further
Father Chrysostomos [Sun, 19 Oct 2014 05:31:14 +0000 (22:31 -0700)]
Tweak multiple nextstate optimisation further

There was still one niggling nulled nextstate in the execution
sequence in cases like this (the one numbered 4):

$ ./perl -Ilib  -MO=Concise -e 'time; our $x; our $y; time'
7  <@> leave[1 ref] vKP/REFC ->(end)
1     <0> enter ->2
2     <;> nextstate(main 1 -e:1) v:{ ->3
3     <0> time[t1] v ->4
-     <0> ex-nextstate v ->5
-     <1> rv2sv vK/OURINTR,1 ->4
-        <$> gv(*x) s ->-
4     <0> ex-nextstate v ->5
-     <1> rv2sv vK/OURINTR,1 ->5
-        <$> gv(*y) s ->-
5     <;> nextstate(main 3 -e:1) v:{ ->6
6     <0> time[t4] v ->7
-e syntax OK

9 years agoSkip over state declarations at run time
Father Chrysostomos [Sun, 19 Oct 2014 05:20:43 +0000 (22:20 -0700)]
Skip over state declarations at run time

9 years agoCommon vars check should account for OPpTARGET_MY
Father Chrysostomos [Sat, 18 Oct 2014 23:37:41 +0000 (16:37 -0700)]
Common vars check should account for OPpTARGET_MY

When checking for common vars on either side of a list assignment (to
see whether we need to make temporary copies), we need to account for
the OPpTARGET_MY optimisation which transforms ‘$lex = $foo . $bar’
into a simple ‘$foo . $bar’ that writes directly to $lex instead of
writing to a scratch variable and returning that.

This was printing foofoo instead of foobar:

$ ./perl -Ilib -le 'my ($a,$b); $foo="foo"; $bar="bar"; ($a,$b) = ($b=$foo."", $a=$bar.""); print $a,$b'

9 years agoMerge branch 'blead' of ssh://perl5.git.perl.org/gitroot/perl into blead
Abigail [Sat, 18 Oct 2014 22:09:10 +0000 (00:09 +0200)]
Merge branch 'blead' of ssh://perl5.git.perl.org/gitroot/perl into blead

9 years agoAnother perldelta entry
Abigail [Sat, 18 Oct 2014 22:08:52 +0000 (00:08 +0200)]
Another perldelta entry

9 years agoperldelta for two notable B::Concise changes
Father Chrysostomos [Sat, 18 Oct 2014 20:58:25 +0000 (13:58 -0700)]
perldelta for two notable B::Concise changes

9 years agoB::Concise: Give sequence numbers for null ops
Father Chrysostomos [Sat, 18 Oct 2014 20:50:25 +0000 (13:50 -0700)]
B::Concise: Give sequence numbers for null ops

B::Concise was not giving sequence numbers to null ops even if they
were part of the execution order.  Ideally, there should be no null
ops in the execution order, but, if it did happen, B::Concise was not
helpful in debugging it.  In fact, its output was quite confusing:

1        <;> nextstate(main 1 -e:1) v ->-

You can’t tell which ops it’s pointing at and where the optimisations
need to be tweaked.

(See the thread starting at
<20141016220840.29774.qmail@lists-nntp.develooper.com>.)

9 years agoMerge branch 'blead' of ssh://perl5.git.perl.org/gitroot/perl into blead
Abigail [Sat, 18 Oct 2014 20:05:40 +0000 (22:05 +0200)]
Merge branch 'blead' of ssh://perl5.git.perl.org/gitroot/perl into blead

Conflicts:
pod/perldelta.pod

9 years agoperldelta work
Abigail [Sat, 18 Oct 2014 19:57:14 +0000 (21:57 +0200)]
perldelta work

9 years agoUse srefgen for anoncode
Father Chrysostomos [Sat, 18 Oct 2014 17:23:26 +0000 (10:23 -0700)]
Use srefgen for anoncode

srefgen is faster than refgen, since it doesn’t have to loop through
the arguments (there is only one) and there is no pushmark to execute.

OA_RETSCALAR causes scalar context to be applied to anoncode ops, but
it always returns one item anyway, so that causes no problems.

9 years agoTypo fix
Abigail [Sat, 18 Oct 2014 17:48:43 +0000 (19:48 +0200)]
Typo fix

9 years agoperldelta for 20c88bf
Father Chrysostomos [Sat, 18 Oct 2014 16:57:34 +0000 (09:57 -0700)]
perldelta for 20c88bf

9 years agoApify SV_CATBYTES and SV_CATUTF8
Father Chrysostomos [Sat, 18 Oct 2014 05:32:23 +0000 (22:32 -0700)]
Apify SV_CATBYTES and SV_CATUTF8

When I added them I was not sure at the time whether they would be
stable or whether they might need to be changed.  They seem pretty
stable now, and they are extremely useful, so make them part
of the API.

9 years agoMANIFEST fix for 91d520f1
Jarkko Hietaniemi [Sat, 18 Oct 2014 12:46:32 +0000 (08:46 -0400)]
MANIFEST fix for 91d520f1

9 years agoDigest::SHA HP-UX hints file is not helping the t/woodbury.t crash.
Jarkko Hietaniemi [Sat, 18 Oct 2014 12:24:26 +0000 (08:24 -0400)]
Digest::SHA HP-UX hints file is not helping the t/woodbury.t crash.

(For which it is was created.)

Neither is it in the Digest::SHA CPAN version.

9 years agoAfter Yosemite there's no /usr/include.
Jarkko Hietaniemi [Sat, 18 Oct 2014 01:54:06 +0000 (21:54 -0400)]
After Yosemite there's no /usr/include.

(The headers are under /Applications/Xcode.app/...)

9 years agoDocument variants of ‘Can’t modify’ individually
Father Chrysostomos [Sat, 18 Oct 2014 04:42:39 +0000 (21:42 -0700)]
Document variants of ‘Can’t modify’ individually

9 years agoperldelta for refaliasing
Father Chrysostomos [Sat, 18 Oct 2014 04:34:08 +0000 (21:34 -0700)]
perldelta for refaliasing

9 years agoperlref: \@hash{slices} = too
Father Chrysostomos [Sat, 18 Oct 2014 03:32:36 +0000 (20:32 -0700)]
perlref: \@hash{slices} = too

9 years agoRename lvalue references
Father Chrysostomos [Sat, 18 Oct 2014 01:07:47 +0000 (18:07 -0700)]
Rename lvalue references

Also correct the description of lvref magic.  When it was first added,
it was for list assignments only, but that soon changed.

9 years agomention 'switch' is experimental in feature.pm
Doug Bell [Sat, 18 Oct 2014 02:33:27 +0000 (21:33 -0500)]
mention 'switch' is experimental in feature.pm

The other experimental features already have nice warnings in feature.pm

9 years agoUse sv_catpvn instead of sv_catsv in doop.c:do_join
Father Chrysostomos [Sat, 18 Oct 2014 01:14:40 +0000 (18:14 -0700)]
Use sv_catpvn instead of sv_catsv in doop.c:do_join

Bunchmarking shows that SvPV+sv_catpvn is faster that sv_catsv.  Why
exactly I don’t know, but perhaps fewer functions and flag checks
are the cause.

9 years agoUpdate Perl 5 Porter list archives.
James E Keenan [Thu, 16 Oct 2014 23:07:59 +0000 (19:07 -0400)]
Update Perl 5 Porter list archives.

For: RT # 122996

9 years agoAllow void padrange even without nextstate
Father Chrysostomos [Fri, 17 Oct 2014 20:56:52 +0000 (13:56 -0700)]
Allow void padrange even without nextstate

This allows the padrange optimisation to happen with code like this:

    my ($a, $b), our $c;

The padrange optimisation looks for:

    list
      pushmark
      padsv
      padsv
      ...
    nextstate

if it is in void context.

padsv pushes an sv on to the stack, and then nextstate resets the
stack.  padrange doesn’t bother pushing in void context, which is why
this optimisation was written this way.

However, there are various ops that don’t bother touching the stack in
void context, for efficiency; conversely, there are many that do for
simplicity’s sake.  In all cases, however, things pushed in void con-
text are subsequently reset, usually by list/nextstate/leavesub,
before they can accidentally become part of a list.  So whether pad-
range pushes SVs or not in void context is irrelevant, and it does not
matter whether there is a nextstate op.

Further, this optimisation also allowed:

  ex-list
    pushmark
    ...

pushmark and list ops cancel each other out in list and void context.
padrange does not push a mark in void context, so the list is removed
from the execution chain.  That was also happening for a nulled list,
which is incorrect, as that means a lone pushmark is being removed.  I
don’t believe ex-list+pushmark ever occurs in void context, but if it
does then this code was wrong.

9 years agoop.c: Change a pushre if into assert()
Father Chrysostomos [Fri, 17 Oct 2014 20:21:59 +0000 (13:21 -0700)]
op.c: Change a pushre if into assert()

9 years agoSkip padrange optimisation for one padop
Father Chrysostomos [Fri, 17 Oct 2014 20:07:31 +0000 (13:07 -0700)]
Skip padrange optimisation for one padop

cachegrind shows that padrange is marginally slower than pushmark+padsv
(<20141017140518.GF5204@iabyn.com>).

9 years agoB::Concise: Dump private vars for null ops
Father Chrysostomos [Fri, 17 Oct 2014 00:53:54 +0000 (17:53 -0700)]
B::Concise: Dump private vars for null ops

This can be very helpful for debugging.  For null ops that were not
always null, output the private flags as we would for unnulled ops.

9 years agofix some recent compiler warnings
David Mitchell [Fri, 17 Oct 2014 11:16:40 +0000 (12:16 +0100)]
fix some recent compiler warnings

Currently DBVARMG_SINGLE is deffed to 0, so

    mg->mg_private >= DBVARMG_SINGLE

gives an 'always true' warning.

sv_magicext's last arg is supposed to to be I32, but ARGTARG is a U32 or
U64.

9 years agoe2a5b7204 made dVAR necessary also for unthreaded builds.
Jarkko Hietaniemi [Fri, 17 Oct 2014 10:56:34 +0000 (06:56 -0400)]
e2a5b7204 made dVAR necessary also for unthreaded builds.

9 years ago[perl #122995] Hang with while(1) in a sub-list
Father Chrysostomos [Fri, 17 Oct 2014 00:44:56 +0000 (17:44 -0700)]
[perl #122995] Hang with while(1) in a sub-list

It was hanging at compile time in some cases, e.g.:

sub foo { () = ($a, my $b, ($c, do { while(1) {} })) }

The optimisation added in 5.20 to turn list+pushmark into null ops
when they are in list context (effectively making ($a,($b,$c)) equiva-
lent to ($a,$b,$c) with regard to which ops are executed) followed
op_next pointers to find the last op that was a kid of the sublist.

You can’t just follow op_next pointers like that, because it will loop
at compile time on infinite loops like while (1){}.

In this case, the last kid was being found in order to elide the erst-
while list op from the op_next chain, but that is not necessary, since
later OP_NULL handling takes care of it anyway.

9 years agoImprove void varop optimisation
Father Chrysostomos [Thu, 16 Oct 2014 23:18:59 +0000 (16:18 -0700)]
Improve void varop optimisation

After eliding the varop, the optimisation added in 5afbd733 repro-
cesses the previous op if it is a nextstate op.  But it was doing this
by setting the current op to the one before the nextstate, so that the
o=o->op_next in the loop header would cause it to reprocess the next-
state in the next iteration.  So, if that nextstate op were at the
beginning of a subroutine, the optimisation would be skipped, and this
would still execute two nextstate ops in a row:

sub foo {
    our($a, $b);
    die;
}

So, instead, just use ‘goto’ to reprocess the op, and we can do it
even if there is no op before the nextstate.

9 years agosv.c:sv_catsv: Remove null check
Father Chrysostomos [Thu, 16 Oct 2014 15:28:29 +0000 (08:28 -0700)]
sv.c:sv_catsv: Remove null check

SvPV always returns something.  If it didn’t, we’d be crashing all
over the place, since most other code assumes it does.

9 years agopodcheck.t: Make pod name check less sensitive
Father Chrysostomos [Thu, 16 Oct 2014 15:25:20 +0000 (08:25 -0700)]
podcheck.t: Make pod name check less sensitive

I regularly find myself ignoring the pod name failure after tweaking
the pod or rebasing and not re-running make.  ‘Known’ test failures
are not a good thing.

9 years agoperldelta: reword an entry
Father Chrysostomos [Thu, 16 Oct 2014 12:49:13 +0000 (05:49 -0700)]
perldelta: reword an entry

It was not completely correct, and trying to get it correct is too
complicated.

9 years agoperldelta for our declarations
Father Chrysostomos [Thu, 16 Oct 2014 12:48:18 +0000 (05:48 -0700)]
perldelta for our declarations

f5b5c2a Simplify double-nextstate optimisation
5afbd73 Elide our($foo) from execution order in void cx
8717a76 op.c: Null list and pushmark in void cx

9 years agoUpdate Test-Simple to CPAN version 1.001008
Chris 'BinGOs' Williams [Thu, 16 Oct 2014 12:15:02 +0000 (13:15 +0100)]
Update Test-Simple to CPAN version 1.001008

  [DELTA]

1.001008     Wed Oct 15 20:10:22:00 PST 2014
    * Updated Changes file

1.001007     Wed Oct 15 16:37:11:00 PST 2014
    * Fix subtest name when skip_all is used

9 years agoUpdate B-Debug to CPAN version 1.22
Chris 'BinGOs' Williams [Thu, 16 Oct 2014 11:29:13 +0000 (12:29 +0100)]
Update B-Debug to CPAN version 1.22

  [DELTA]

1.22 2014-10-12 rurban
  * add 5.21.5 support: changed test, from blead for split optim.,
    added METHOP
  * print 0x00000000 as 0x0
  * add -d -MOd=Debug support
  * README: fixed copyright date

9 years agoUpdate experimental to CPAN version 0.012
Chris 'BinGOs' Williams [Thu, 16 Oct 2014 11:27:15 +0000 (12:27 +0100)]
Update experimental to CPAN version 0.012

  [DELTA]

0.012     2014-10-12 12:10:06+02:00 Europe/Amsterdam
          Added lvalue references feature

9 years agoop.c: Null list and pushmark in void cx
Father Chrysostomos [Thu, 16 Oct 2014 03:37:30 +0000 (20:37 -0700)]
op.c: Null list and pushmark in void cx

See 7d3c8a6837 for the explanation.

‘our($foo,$bar);’ is one example of the legitimate use of list+push-
mark in void context.

Here, we can null them and remove them from the execution order, since
they are not necessary.

We only do this if this is an op sequence that padrange would not
optimise, since padrange needs a pushmark, and we don’t want to
disable it.

This combined with other recent optimisations makes code like this:

    our ($foo,@bar,%baz);
    our $a;
    our ($b,$c);
    die;

skip straight over all those variable declarations at run time, going
straight to the ‘die’.

9 years agoElide our($foo) from execution order in void cx
Father Chrysostomos [Wed, 15 Oct 2014 19:58:18 +0000 (12:58 -0700)]
Elide our($foo) from execution order in void cx

our($foo) in void context has a compile-time affect but no run-item
effect, except to execute ops needlessly.  There is no need to execute
those ops.  We can simply remove them from the execution order.

‘our($foo,$fit,$far);’ still leaves a list and a pushmark, which I
plan to eliminate in the next commit.

‘our $foo; our $bar; our $baz;’ has no run-time cost now, because,
once the variables are eliminated, the nextstate ops in betwen them,
now adjacent, are also eliminated by another optimisation.

9 years agort122747.t needs Unicode tables.
Jarkko Hietaniemi [Wed, 15 Oct 2014 02:52:28 +0000 (22:52 -0400)]
rt122747.t needs Unicode tables.

9 years agoeintr.t needs Fcntl.
Jarkko Hietaniemi [Wed, 15 Oct 2014 02:50:34 +0000 (22:50 -0400)]
eintr.t needs Fcntl.

9 years agoIrix: note that prctl comes in different incompatible flavors.
Jarkko Hietaniemi [Mon, 13 Oct 2014 00:44:02 +0000 (20:44 -0400)]
Irix: note that prctl comes in different incompatible flavors.

9 years agoIrix: <float.h> thinks double-double has 107 bits of mantissa.
Jarkko Hietaniemi [Wed, 15 Oct 2014 22:26:41 +0000 (18:26 -0400)]
Irix: <float.h> thinks double-double has 107 bits of mantissa.

As opposed to 106.

Also add comment about the sizeof 12 versus 16 for x86 80-bit format.

9 years agoIrix: MIPSpro 7.4 compiler has broken memcmp.
Jarkko Hietaniemi [Wed, 15 Oct 2014 02:47:33 +0000 (22:47 -0400)]
Irix: MIPSpro 7.4 compiler has broken memcmp.

(Supposedly 7.4.1m is okay in this regard, and there is also 7.5.)

The commit that 'broke' Perl build on IRIX was 57620943
which of course wasn't to blame, the IRIX compiler was.
(Symptom: miniperl crashing, can be narrowed to just /[[:alpha:]]/)

Furthermore: IRIX build was also earlier broken for a long time by
another problem (in the preprocessor), see for example perl #33849.
(Symptom: compile failing in gv.c RvDEEPCP)

Summary: building Perls on IRIX needs either this very commit,
or undoing the 57620943 (for the memcmp brokenness), and possibly
applying both the c297d531 and 08c5d564 (for the cpp brokenness).
(The latter were applied between 5.10.0 and 5.10.1.)

9 years agoModernized an example in perlipc.pod.
Shlomi Fish [Fri, 10 Oct 2014 07:12:09 +0000 (10:12 +0300)]
Modernized an example in perlipc.pod.

1. Convert to use strict + use warnings.

2. Changed a while(++ loop) to while(1) { ++ }.

Committer revised patch per suggestions in RT # 122938.

9 years agoFix typo in 4cad5dc8's perldelta for 157fb5a
Dagfinn Ilmari Mannsåker [Wed, 15 Oct 2014 10:15:53 +0000 (11:15 +0100)]
Fix typo in 4cad5dc8's perldelta for 157fb5a

For: RT # 122981

9 years agoDeparse join("", pos) correctly
Father Chrysostomos [Wed, 15 Oct 2014 05:52:29 +0000 (22:52 -0700)]
Deparse join("", pos) correctly

I optimised join into stringify if it had a list of one scalar-
returning op.

$ ./perl -Ilib -MO=Deparse -e '$_ = join $foo, $bar'
$_ = "$bar";
-e syntax OK

The problem, though, is that we now create op trees that didn’t happen
before,* and B::Deparse can’t handle them correctly:

$ ./perl -Ilib -MO=Deparse -e '$_ = join $foo, pos'
$_ = "pos($_)";
-e syntax OK

So we need to turn that into:

$_ = join('???', pos);

* Actually, in 5.8 it was possible to interpolate arbitrary expres-
sions after ‘$_[0]->’:

$_ = "\n,rekcah lreP rehtona tsuJ"; sub a{chop}
print "${[bless[]]}[0]->a . reverse $_";

And that, consequently, did not deparse properly.

9 years agoChange OA_DANGEROUS description in regen/opcode*
Father Chrysostomos [Wed, 15 Oct 2014 04:56:25 +0000 (21:56 -0700)]
Change OA_DANGEROUS description in regen/opcode*

‘Has side effects’ can be misleading.  The OA_DANGEROUS flag is only
used by the common-vars search that checks to see whether it is possi-
ble to skip making temporary copies.

We have to make copies in cases like this:

   ($a,$b) = func();

because func() could return ($b,$a).

If any op on either side is marked OA_DANGEROUS and not handled spe-
cially in op.c:S_aassign_scommon_vars, then it is assumed it could
return a scalar that is also elsewhere in the list, so a temp copy
is needed.

(I think some of the existing ops with this flag could drop it.)

9 years agoSimplify double-nextstate optimisation
Father Chrysostomos [Tue, 14 Oct 2014 03:37:29 +0000 (20:37 -0700)]
Simplify double-nextstate optimisation

Executing two nextstate ops in a row is equivalent to executing just
the second, so the peephole optimiser eliminates one of them.

The double-nextstate optimisation seems to have been written under
the assumption that the current op cannot be elided from the op_next
change, which is untrue, as we have oldop (the previous op in
the chain).

If the current op and the one following it are both nextstate ops,
then the contents of the second are moved over to the first and the
second is nulled.  Then current_op->op_next is adjusted to skip over
the newly-nulled op.

The the next op in the chain, the one that the first nextstate op now
points to, is processed.

The result is that every other nextstate in sequence of three or more
would be elided:

1        <;> nextstate(main 1 -e:1) v ->2
-        <0> ex-const v ->-
-        <0> null v ->-
-        <0> ex-const v ->2
2        <;> nextstate(main 1 -e:1) v:{ ->3
-        <0> ex-const v ->-
-        <0> null v ->-
-        <0> ex-const v ->3
3        <;> nextstate(main 1 -e:1) v:{ ->4
-        <0> ex-const v ->-
-        <0> null v ->-
-        <0> ex-const v ->4
4        <;> nextstate(main 1 -e:1) v:{ ->5

We don’t need to go through the complication of making the first next-
state equivalent to the second.  Just null the first one and adjust
the previous op’s pointer (oldop->op_next) to point to the second one.

Now all consecutive nextstates get nulled except the last:

-        <0> ex-nextstate v ->-
-        <0> ex-const v ->-
-        <0> ex-nextstate v ->-
-        <0> ex-const v ->-
-        <0> ex-nextstate v ->-
-        <0> ex-const v ->-
-        <0> ex-nextstate v ->-
-        <0> ex-const v ->-
-        <0> ex-nextstate v ->1
-        <0> ex-const v ->-
-        <0> ex-nextstate v ->1
-        <0> ex-const v ->1
1        <;> nextstate(main 1 -e:1) v:{ ->2

The only visible difference this makes is in B::Deparse output, but
this changed in 5.14 when the optimisation was first introduced, so I
think changing it again is acceptable:

$ perl5.12.4 -MO=Deparse -e 'use strict; 0; use warnings; 0'
use strict 'refs';
'???';
use warnings;
'???';
-e syntax OK

$ perl5.14.4 -MO=Deparse -e 'use strict; 0; use warnings; 0'
use warnings;
use strict 'refs';
'???';
;
'???';
-e syntax OK

$ ./perl -Ilib -MO=Deparse -e 'use strict; 0; use warnings; 0'
;
'???';
use warnings;
use strict;
'???';
-e syntax OK

9 years agoperldelta for 594b6face91a
Tony Cook [Wed, 15 Oct 2014 00:44:34 +0000 (11:44 +1100)]
perldelta for 594b6face91a

9 years agotreat fatal warnings after syntax errors as syntax errors
Lukas Mai [Sun, 12 Oct 2014 17:01:09 +0000 (19:01 +0200)]
treat fatal warnings after syntax errors as syntax errors

9 years agofix comment from commit f4eedc6b8c
Daniel Dragan [Tue, 14 Oct 2014 10:25:51 +0000 (06:25 -0400)]
fix comment from commit f4eedc6b8c

9 years agofix op.c under -DPERL_GLOBAL_STRUCT
David Mitchell [Tue, 14 Oct 2014 11:45:24 +0000 (12:45 +0100)]
fix op.c under -DPERL_GLOBAL_STRUCT

9 years agothreads: $#shared = N should destroy
David Mitchell [Tue, 14 Oct 2014 11:26:13 +0000 (12:26 +0100)]
threads: $#shared = N should destroy

When shrinking a shared array by setting $#shared = N,
any freed elements should trigger destructors if they are objects,
but they weren't.

This commit extends the work done by 7d585d2f3001 (which created tmp
proxys when abandoning elements of arrays and hashes) to the STORESIZE
method, which is what is triggered by $#a assignment (and indirectly by
undef @a).

9 years agothreads::shared "$#shared = N" off-by-one error
David Mitchell [Mon, 13 Oct 2014 11:45:14 +0000 (12:45 +0100)]
threads::shared "$#shared = N" off-by-one error

RT #122950

    my @a : shared;
    $#a = 3;  # actually set it to 4

There was a simple off-by-one error in the XS code that handled the
STORESIZE tie method (confusing the array size and fill, which differ
by 1).

Amazingly, there was no test for it, and no-one had noticed up until now.

Note that this commit causes three tests in object2.t to fail: this
is because fixing the $#shared bug exposed another bug that was being
masked by this one. They will be fixed in the next commit

9 years agoperldelta for cae71c5daa29
Tony Cook [Tue, 14 Oct 2014 00:48:33 +0000 (11:48 +1100)]
perldelta for cae71c5daa29

9 years agodeprecate POSIX::tmpnam
Tony Cook [Thu, 2 Oct 2014 03:40:22 +0000 (13:40 +1000)]
deprecate POSIX::tmpnam

This patch avoids repeating the deprecation warning if the same tmpnam()
call is executed multiple times.

9 years agoaelemfast_lex in aassign_common_vars_aliases_only
Father Chrysostomos [Mon, 13 Oct 2014 21:48:13 +0000 (14:48 -0700)]
aelemfast_lex in aassign_common_vars_aliases_only

S_aassign_common_vars_aliases_only needs to handle aelemfast_lex,
otherwise we miss some rare cases where we have aliased scalars and
elements on both sides of the assignment.

9 years agoHandle aelemfast_lex in S_aassign_common_vars
Father Chrysostomos [Mon, 13 Oct 2014 21:46:53 +0000 (14:46 -0700)]
Handle aelemfast_lex in S_aassign_common_vars

This was a missed opportunity for optimisation.  Prior to be9de18 it
was optimised, because S_aassign_common_vars was called earlier in
the compilation phase, before the aelemfast optimisation.

9 years agoop.c: Skip priv flags assert if ppaddr changes
Father Chrysostomos [Mon, 13 Oct 2014 19:35:49 +0000 (12:35 -0700)]
op.c: Skip priv flags assert if ppaddr changes

because an XS module is probably installing its own ppaddr, in which
case it knows more about the private flags than we do.

9 years agospeed up building with less disk IO pod moves+__END__+misc
Daniel Dragan [Sun, 12 Oct 2014 07:42:38 +0000 (03:42 -0400)]
speed up building with less disk IO pod moves+__END__+misc

In Cwd.pm, dont search for pwd on Win32.

Also trim down the list of makefile suffixes on Win32 so it doesn't try
searching for av.pas and perl.f90 and hash.cbl on disk.

Add __END__ tokens to stop the last read() call on the handle which
returns 0 bytes at EOF.

9 years agoremove excess whitespace from warnings.pm
Daniel Dragan [Mon, 13 Oct 2014 02:42:15 +0000 (22:42 -0400)]
remove excess whitespace from warnings.pm

Some lines end with spaces, remove that, use tabs instead of spaces in code
so the perl code is less bytes to read from disk. This patch saved 183
bytes. Part of [perl #122955].

9 years agomove POD in warnings.pm to end of file to reduce module load I/O calls
Daniel Dragan [Mon, 13 Oct 2014 01:57:01 +0000 (21:57 -0400)]
move POD in warnings.pm to end of file to reduce module load I/O calls

warnings.pm is the hottest file/takes the most read() calls of any
module during a make all. By moving POD to the end, ~40KB of OS read()
IO was reduced to ~16KB of OS read() IO calls. Also the parser doesn't need
to search for Perl code in the POD further lessining load time because of
the __END__ token. Filed as [perl #122955].

9 years agosilence warning after "Fold join to const or stringify where possible"
Daniel Dragan [Mon, 13 Oct 2014 19:20:30 +0000 (15:20 -0400)]
silence warning after "Fold join to const or stringify where possible"

VC 2003
op.c(4022) : warning C4244: '=' : conversion from 'unsigned short' to
'char', possible loss of data

9 years ago[perl #122965] aelemfast in list assignment
Father Chrysostomos [Mon, 13 Oct 2014 15:27:02 +0000 (08:27 -0700)]
[perl #122965] aelemfast in list assignment

I accidentally broke ($_[0],$_[1])=($_[1],$_[0]) in be9de18, which was
only supposed to be a refactoring.  Since it now happens later in the
compilation phase when optimisations like aelemfast have happened, the
search for common vars needs to take aelemfast into account.

9 years agoperldelta for 73f4c4f
Father Chrysostomos [Mon, 13 Oct 2014 06:22:39 +0000 (23:22 -0700)]
perldelta for 73f4c4f

9 years agoperldelta for 987c969
Father Chrysostomos [Mon, 13 Oct 2014 06:20:27 +0000 (23:20 -0700)]
perldelta for 987c969

9 years agoperldelta for afc8007
Father Chrysostomos [Mon, 13 Oct 2014 06:17:44 +0000 (23:17 -0700)]
perldelta for afc8007

9 years agoperldelta for split-to-array
Father Chrysostomos [Mon, 13 Oct 2014 06:16:35 +0000 (23:16 -0700)]
perldelta for split-to-array

4ecee20 op.c: Distangle split and common-vars
fd017c0 Optimise @lexarray = split...
ef7999f Optimise my(@array)=split
4574270 opt.t: Test split-to-array optimisation

9 years agoperldelta for 821956c
Father Chrysostomos [Mon, 13 Oct 2014 06:11:16 +0000 (23:11 -0700)]
perldelta for 821956c