Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
This comparison is big! We’re only showing the most recent 250 commits
Commits on Jun 26, 2012
@steve-m-hay steve-m-hay Remove C++isms from doio.c
(Introduced by c2fd40c and not tolerated by VC++ compiling a C file.)
@doy doy fix off-by-one when restoring hashes [perl #73972]
Storable tries to preallocate enough space for all of the elements it's
going to receive, both for efficiency reasons and because reallocation
triggers throwing away all of the placeholders in the hash (which are
used for restricted hashes) if the hash isn't already READONLY, and
since Storable rebuilds restricted hashes by first populating all of the
placeholders and then setting it READONLY at the end, this would break

Unfortunately, it was allocating just slightly less than enough space -
hashes reallocate when they hit their limit, not when they exceed it,
and so if you tried to store a restricted hash with a number of keys
right on the boundary, it would trigger a reallocation and lose all of
the allowed keys that it had just stored. This fixes the issue by
allocating the correct amount of space to ensure that reallocation
doesn't happen.
Commits on Jun 27, 2012
@dmcbride dmcbride AIX Hints file change
Ok, I think my earlier problem came from not cleaning up properly between
multiple compiles.  So I don't need to modify any test.

Proposed log entry:

When compiling many of the perl modules available from CPAN, an expectation
of C99 support seems implied by many authors.  Unfortunately, xlC doesn't
do this by default, we have to add -qlanglvl=extc99 to the ccflags to get
this to work.  And by the time we get to installing modules, this flag
is already set in Config.

So, add the flag unconditionally at the outset.  Also, remove
-qlonglong and -qlanglvl=extended from the flags to silence the warning that
extc99 includes them and that xlC is going to ignore it, using extc99 instead.

Signed-off-by: H.Merijn Brand <>
Father Chrysostomos Make srand respect magic
It was returning U+FFFD for negative numbers, but only for non-magical
Father Chrysostomos Make srand treat "-1" as -1
It was returning U+FFFD for negative numbers, unless they
were strings.

The SvOK is to avoid double uninit warnings.  The !SvIsUV is for
efficiency.  We don’t need to coerce it to an NV if it is a UV
already, because we know it won’t pass that test.
Father Chrysostomos Make pp.c:pp_srand slightly less repetitive 7173950
Father Chrysostomos Null HeVAL and local delete → crash
The XS API allows hash entries to be created with null values.  perl
itself uses these internally, too.

Though they should rarely be seen by Perl code, Perl ops should still
be able to handle them without crashing (by croaking).  I fixed helem
and hslice in 5.16 (commit 746f640), but missed localised deletions.
Father Chrysostomos Squash repetitive code in pp.c:S_delete_local
The two branches of this were almost identical.  Not only is it unnec-
essary to repeat the code, but it is error-prone, as bug fixes have to
be done in both branches.
Father Chrysostomos perldiag: Add cat for ‘Attempt to set length of freed array’ 0c5c527
Father Chrysostomos perldiag: ‘Scalars leaked’ is a warning 4f5966a
Father Chrysostomos perldiag: ‘Variable is not imported’ is a default warning 120b0f8
Father Chrysostomos perldiag: ‘Unbalanced scopes’ is a default warning 090cebb
Father Chrysostomos perldiag: ‘Unbalanced saves’ is a default warning 4a983e4
Father Chrysostomos perldiag: ‘Unbalanced tmps’ is a default warning 2092d7c
Father Chrysostomos perldiag: ‘Unbalanced context’ is a default warning c632e77
Father Chrysostomos perldiag: Add cat for PERL_SIGNALS illegal 806b6d0
Father Chrysostomos perldiag: Don’t use L<<>> isn’t smart enough to handle it, and programming it
for one case seems like overkill.
Father Chrysostomos perldiag: ‘invalid option -D%c’ is a warning 8ff21bf
Father Chrysostomos perldiag: Add cat for Duplicate modifier 35f0cd7
Father Chrysostomos perldiag: ‘Opening dirhandle also as file’ is a default warning 713e261
Father Chrysostomos perldiag: ‘Opening fh also as dir’ is a default warning 2803863
Father Chrysostomos perldiag: ‘Regexp modifier after "-"’ should have no cat
Only warnings have categories.
Father Chrysostomos perldiag: Add cat for Lost precision e63e8a9
Father Chrysostomos perldiag: ‘Ambiguous use resolved as’ is always S 7c7af29
Father Chrysostomos perldiag: ‘UTF-16 surrogate U+%X’ is a default warning 968342a
Father Chrysostomos perldiag: ‘...illegal for interchange’ is a default warning e2f7b30
Father Chrysostomos perldiag: ‘Operation returns its argument’ is a default warning 3fc8aa0
Father Chrysostomos perldiag: ‘Code point is not Unicode’ is a default warning e2f4a21
Father Chrysostomos perldiag: ‘Unicode surrogate is illegal’ is a default warning d2bb714
Father Chrysostomos diag.t: Load in BEGIN
so that parentheses can be omitted in tests to be added.
Father Chrysostomos diag.t: Use correct variable
Multiline messages are listed in the __DATA__ section with spaces
instead of line breaks.  When adding proper support for multiline err-
ors earlier, I made a slight mistake and caused multiline to-do mess-
ages to skip the to-do code path, because I was looking them up via
the name with line breaks ($name), rather than the name with line
breaks modified ($key).

This was causing it to fall down to the pass($key) below.

I want to add more tests down there, which will fail for multiline
to-do items.
Father Chrysostomos diag.t: Check categories and severity
There was code already started for this, but never finished.  This
commit makes it work for the most part.

This is not smart enough yet to understand nested categories.  There
is a new exceptions list in the __DATA__ section for cases it can’t
handle, which are precious few.
Father Chrysostomos [Merge] perldiag.pod severity/category cleanup 1e911c9
Father Chrysostomos diagnostics.t: Tweak to get tests passing
I thought I had run it, hmm.
Father Chrysostomos diag.t: Don’t emit erroneous passing to-do tests
The __CATEGORIES__ entries by definition exist in perldiag.
Father Chrysostomos diag.t: Skip, rather than, TODO for cat tests
Each item in the exception list for category/severity tests passes
either one or the other, so just skip them, to avoid passing to-do
tests, which are just a distraction.  Separating them into two lists
is probably overkill.
@Hugmeir Hugmeir perlcall: #109408 94a37a2
@Hugmeir Hugmeir perldata: #109408 0568ecc
@Hugmeir Hugmeir perldsc: #109408 cb1e035
@Hugmeir Hugmeir perlform: #109408 1e29b8f
@Hugmeir Hugmeir perlfunc: #109408 e9fa405
@Hugmeir Hugmeir perlipc: #109408 e6aa8b8
@Hugmeir Hugmeir perllocale: #109408 589e2f5
@Hugmeir Hugmeir perlmod: #109408 8f416bb
@Hugmeir Hugmeir perlop: #109408 3ff8ecf
@Hugmeir Hugmeir perlpod: #109408 684c7e3
@Hugmeir Hugmeir perlport: #109408 1bcbdd3
@Hugmeir Hugmeir perlre: #109408 db7cd43
@Hugmeir Hugmeir perlrebackslash: #109408 69a6e56
@Hugmeir Hugmeir perlref: #109408 0480bf3
@Hugmeir Hugmeir perlreftut: #109408 67744fa
@Hugmeir Hugmeir perlretut: #109408 13e5d9c
@Hugmeir Hugmeir perlrun: #109408 6898e86
@Hugmeir Hugmeir perlsec: #109408 dde0c55
@Hugmeir Hugmeir perlsub: #109408 9d42615
@Hugmeir Hugmeir perlthrtut: #109408 b6d2d44
@Hugmeir Hugmeir perltrap: #109408 4197fe3
@Hugmeir Hugmeir perlunicode: #109408 b9cedb1
@Hugmeir Hugmeir perlunifaq: #109408 9c98089
@Hugmeir Hugmeir perluniintro: #109408 c2fb32e
@Hugmeir Hugmeir perlutil: #109408 7c2e2b3
@Hugmeir Hugmeir perlvar: #109408 60cf491
@Hugmeir Hugmeir [perl #109408] Documentation that refers to Perl 5 as new
Regened known_pod_issues.dat for the previous commits.
Father Chrysostomos [Merge] [perl #109408] Documentation that refers to Perl 5 as new
Quoting Brian Fraser:

I more or less went ahead and did this, to some extent. To some other
extent the changes are stylistic, like consistently using v5.x.y instead of
5.x or 5.x.y or whatnot in perlvar (and only in perlvar, so as to avoid
bikeshedding). I also bumped most odd versions, post 5.6, to the next
stable release (so, for example, 5.7.1 became 5.8.0, and 5.9.0 became
5.10.0, but 5.005 is still 5.005).

There's only one big deletion, which was most of perltrap.pod -- It dealt
with traps for Perl 4 programmers migrating to Perl 5. It would be really
swell if someone could update perltrap for their other favorite language of
choice, since right now the document is severely lacking, only dealing with
awk, shell, C/C++, and Perl itself.

There's some stuff that I didn't really know about, so I left it alone,
including all of perlhack(tips)? and perl(re|deb)?guts.
One thing that came up in IRC while I was doing this is that having a table
in perlvar detailing in which version each variable became available would
be really swell. And I know that brian d foy compiled one for string/regex
escapes, which strikes me like a good candidate to get in as well.
@doy doy add a few comments to docs
./perl -Ilib t/op/sort.t won't do what you want, because tests that
don't use Test::More don't set an error code on their own, you need to
run it under the harness
@doy doy clean up compilation warnings 4f8dbb2
Father Chrysostomos pp.c: Restore uninit warning to study
Also, prevent a crash when SvCUR is used on a non-PV.
@rurban rurban support latest bison-2.5.1
bison-2.5.1 adds less superfluous semicolons at the end of action blocks,
but works fine.
Father Chrysostomos perly.*: update regen_perly checksum 3c60b34
@doy doy fix 4f8dbb2 cf54f63
Commits on Jun 28, 2012
@doy doy more in depth tests for 8e4ecf2 591097e
@doy doy propagate context into overloads [perl #47119]
amagic_call now does its best to propagate the operator's context into
the overload callback. It's not always possible - for instance,
dereferencing and stringify/boolify/numify always have to return a
value, even if it's not used, due to the way the overload callback works
in those cases - but the majority of cases should now work. In
particular, overloading <> to handle list context properly is now

For backcompat reasons (amagic_call and friends are technically public
api functions), list context will not be propagated unless specifically
requested via the AMGf_want_list flag. If this is passed, and the
operator is called in list context, amagic_call returns an AV* holding
all of the returned values instead of an SV*. Void context always
results in amagic_call returning &PL_sv_undef.
Father Chrysostomos perldiag: Add missing regexp delims f9d4ccd
Father Chrysostomos diagnostics.t: Restore test name removed by f0e510f d142a07
Father Chrysostomos Don’t let formats outlive their outer subs
This began crashing in 5.11.3:

sub foo {
  sub bar {
    my ($a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k,$l,$m,$n,$o,$p,$q,$r,$s,$x);
    format =
undef *bar;

(On some systems, you need more alphabet soup to make it crash.)

This commit (just the perly.y part shown) caused it to crash:

commit 421f30e
Author: Zefram <>
Date:   Tue Dec 15 11:48:31 2009 +0100

    [perl #22977] Bug in format/write

diff --git a/perly.y b/perly.y
index 18e5875..a61a6b3 100644
--- a/perly.y
+++ b/perly.y
@@ -511,7 +511,9 @@ peg	:	PEG

 format	:	FORMAT startformsub formname block
-			{ SvREFCNT_inc_simple_void(PL_compcv);
+			{
+			  CV *fmtcv = PL_compcv;
+			  SvREFCNT_inc_simple_void(PL_compcv);
 #ifdef MAD
 			  $$ = newFORM($2, $3, $4);
 			  prepend_madprops($1->tk_mad, $$, 'F');
@@ -521,6 +523,10 @@ format	:	FORMAT startformsub formname block
 			  newFORM($2, $3, $4);
 			  $$ = (OP*)NULL;
+			  if (CvOUTSIDE(fmtcv) && !CvUNIQUE(CvOUTSIDE(fmtcv))) {
+			    SvREFCNT_inc_simple_void(fmtcv);
+			    pad_add_anon((SV*)fmtcv, OP_NULL);
+			  }

Unfortunately, adding the format to the pad like that (to allow
pad_fixup_inner_anons to fix up formats as well as subs) is proble-
matic.  It causes the format’s CvOUTSIDE to be weak.  Since the for-
mat does not hold a reference count on its outer sub, that sub can be
freed before the format.  When that happens, regular subs are fixed
up by having CvOUTSIDE change to point to the grandparent.  If you
do that for formats, you run into a problem: Formats can be cloned
even when the outer sub is not running.  Formats are cloned whenever
invoked *by name* via write.  If CvOUTSIDE points to a different sub,
then closing over the scalars in specific pad offsets in that sub can
result in reading past the end of the pad.  If you don’t read past the
end of the pad, you are still making variables close over unrelated variables, so the inner $x could close over an outer @y, etc.  Subrou-
tines don’t have that problem, as they can only be cloned when they
have an outer sub.  (Even though the outer sub’s prototype, if it is a
closure, might have been freed, the outer sub itself is still running
and referenced by the context stack.)

This commit changes the direction of the weak reference between an
outer sub’s pad and an inner format, fixing the crash.

To do so, it has to store, not the format itself, but a weak RV point-
ing to the format, in the outer sub’s pad.
Commits on Jun 29, 2012
@doy doy perldelta updates for 6728836, d60d201, 82f9620, 7878705 e013ada
@doy doy fix storing objects with reftype REF [perl #113880] cc4aa37
Father Chrysostomos Formats in closures called outside closures → crash
If a format closing over lexical variables is defined inside a clo-
sure, it must only be called directly inside that closure, not from
any other eval, sub, or format.

Calling it from anywhere else started causing a crash in 5.10.0,
because the format would try to close over variables in the currently-
running sub, using padoffsets intended for a completely unrelated pad.

This commit stops it from crashing by checking whether the currently-
running sub is a clone of the format’s outer sub (a closure proto-
type).  If it is not, the outer closure prototype is used, resulting
in ‘Variable is not available’ warnings.

This makes things work as well as they did in 5.8.  Ideally, we should
search the call stack for the topmost clone of the format’s outer sub;
but I’m saving that for another commit.
@doy doy "use overload fallback => 0" should enable overloading [perl #113010]
This makes

  package Foo;
  use overload fallback => 0;


  package Bar;
  use overload '+' => \&add, fallback => 0;

behave identically when an operator other than '+' is used.
@doy doy perldelta for 27c6f44 56185ad
@doy doy fix 386a548 for fallback => undef
The default case for non-overloaded classes is fallback => 1, so saying
fallback => 1 on its own shouldn't enable overloading, but saying
fallback => undef on its own should (even though undef is the default
for overloaded classes).
Father Chrysostomos Add CVf_SLABBED flag
This will indicate that a CV has a reference count on, and ownership
of, a slab used for allocating ops.
Father Chrysostomos dump.c: Dump CVf_SLABBED bfbc3ad
Father Chrysostomos Flag ops that are on the savestack
This is to allow future commits to free dangling ops after errors.

If an op is on the savestack, then it is going to be freed by scope.c,
and op_free must not be called on it by anyone else.

So we flag such ops new.
Father Chrysostomos Add OP_FREED op type
This is a dummy op type that should never be seen by any code except
op allocation code (to come).

So it is not in the usual list of opcodes, but is #defined outside the
range valid of opcodes.
Father Chrysostomos CV-based slab allocation for ops
This addresses bugs #111462 and #112312 and part of #107000.

When a longjmp occurs during lexing, parsing or compilation, any ops
in C autos that are not referenced anywhere are leaked.

This commit introduces op slabs that are attached to the currently-
compiling CV.  New ops are allocated on the slab.  When an error
occurs and the CV is freed, any ops remaining are freed.

This is based on Nick Ing-Simmons’ old experimental op slab implemen-
tation, but it had to be rewritten to work this way.

The old slab allocator has a pointer before each op that points to a
reference count stored at the beginning of the slab.  Freed ops are
never reused.  When the last op on a slab is freed, the slab itself is
freed.  When a slab fills up, a new one is created.

To allow iteration through the slab to free everything, I had to have
two pointers; one points to the next item (op slot); the other points
to the slab, for accessing the reference count.  Ops come in different
sizes, so adding sizeof(OP) to a pointer won’t work.

The old slab allocator puts the ops at the end of the slab first, the
idea being that the leaves are allocated first, so the order will be
cache-friendly as a result.  I have preserved that order for a dif-
ferent reason:  We don’t need to store the size of the slab (slabs
vary in size; see below) if we can simply follow pointers to find
the last op.

I tried eliminating reference counts altogether, by having all ops
implicitly attached to PL_compcv when allocated and freed when the CV
is freed.  That also allowed op_free to skip FreeOp altogether, free-
ing ops faster.  But that doesn’t work in those cases where ops need
to survive beyond their CVs; e.g., re-evals.

The CV also has to have a reference count on the slab.  Sometimes the
first op created is immediately freed.  If the reference count of
the slab reaches 0, then it will be freed with the CV still point-
ing to it.

CVs use the new CVf_SLABBED flag to indicate that the CV has a refer-
ence count on the slab.  When this flag is set, the slab is accessible
via CvSTART when CvROOT is not set, or by subtracting two pointers
(2*sizeof(I32 *)) from CvROOT when it is set.  I decided to sneak the
slab into CvSTART during compilation, because enlarging the xpvcv
struct by another pointer would make all CVs larger, even though this
patch only benefits few (programs using string eval).

When the CVf_SLABBED flag is set, the CV takes responsibility for
freeing the slab.  If CvROOT is not set when the CV is freed or
undeffed, it is assumed that a compilation error has occurred, so the
op slab is traversed and all the ops are freed.

Under normal circumstances, the CV forgets about its slab (decrement-
ing the reference count) when the root is attached.  So the slab ref-
erence counting that happens when ops are freed takes care of free-
ing the slab.  In some cases, the CV is told to forget about the slab
(cv_forget_slab) precisely so that the ops can survive after the CV is
done away with.

Forgetting the slab when the root is attached is not strictly neces-
sary, but avoids potential problems with CvROOT being written over.
There is code all over the place, both in core and on CPAN, that does
things with CvROOT, so forgetting the slab makes things more robust
and avoids potential problems.

Since the CV takes ownership of its slab when flagged, that flag is
never copied when a CV is cloned, as one CV could free a slab that
another CV still points to, since forced freeing of ops ignores the
reference count (but asserts that it looks right).

To avoid slab fragmentation, freed ops are marked as freed and
attached to the slab’s freed chain (an idea stolen from DBM::Deep).
Those freed ops are reused when possible.  I did consider not reusing
freed ops, but realised that would result in significantly higher mem-
ory using for programs with large ‘if (DEBUG) {...}’ blocks.

SAVEFREEOP was slightly problematic.  Sometimes it can cause an op to
be freed after its CV.  If the CV has forcibly freed the ops on its
slab and the slab itself, then we will be fiddling with a freed slab.
Making SAVEFREEOP a no-op won’t help, as sometimes an op can be
savefreed when there is no compilation error, so the op would never
be freed.  It holds a reference count on the slab, so the whole
slab would leak.  So SAVEFREEOP now sets a special flag on the op
(->op_savefree).  The forced freeing of ops after a compilation error
won’t free any ops thus marked.

Since many pieces of code create tiny subroutines consisting of only
a few ops, and since a huge slab would be quite a bit of baggage for
those to carry around, the first slab is always very small.  To avoid
allocating too many slabs for a single CV, each subsequent slab is
twice the size of the previous.

Smartmatch expects to be able to allocate an op at run time, run it,
and then throw it away.  For that to work the op is simply mallocked
when PL_compcv has’t been set up.  So all slab-allocated ops are
marked as such (->op_slabbed), to distinguish them from mallocked ops.

All of this is kept under lock and key via #ifdef PERL_CORE, as it
should be completely transparent.  If it isn’t transparent, I would
consider that a bug.

I have left the old slab allocator (PL_OP_SLAB_ALLOC) in place, as
it is used by PERL_DEBUG_READONLY_OPS, which I am not about to
rewrite. :-)

Concerning the change from A to X for slab allocation functions:
Many times in the past, A has been used for functions that were
not intended to be public but were used for public macros.  Since
PL_OP_SLAB_ALLOC is rarely used, it didn’t make sense for Perl_Slab_*
to be API functions, since they were rarely actually available.  To
avoid propagating this mistake further, they are now X.
Father Chrysostomos -DS option for slab allocation 5696720
Father Chrysostomos Add slab allocation diagnostics (under perl -DS)
These proved extremely useful for getting this slab allocator to work.

We might as well leave them in place for future debugging.
Father Chrysostomos PERL_IMPLICIT_SYS can use the new slab allocator 01995fc
Father Chrysostomos perlhacktips: Update PERL_DEBUG_READONLY_OPS 7e0f24e
Father Chrysostomos Test bug #111462, Safe + %^H + disallowed ops 42440e3
Father Chrysostomos Test perl #112312, crash on syntax error
I am having difficulty getting these tests to fail.  They crash when
run standalone, but always pass when run via fresh_perl.t.  Hopefully,
they will fail somewhere. :-)

Yes, fresh_perl.t does begin with this:


But t/comp/parser.t does not (and should not) use, so it is
very hard to test something like this.

Putting it here seemed slightly better than putting it in
its own file.
Father Chrysostomos Define cv_forget_slab under PL_OP_SLAB_ALLOC
Instead of using #ifndef every time we call cv_forget_slab, just
define it as a no-op under PL_OP_SLAB_ALLOC.
Father Chrysostomos Enlarge the last slot on an op slab to fit
For simplicity, op slots are never resized once they are allocated.
But they are reused after they are freed, if they are big enough.

When allocating the last op slot that will fit on a slab, we might as
well enlarge the slot to contain whatever space is left over, so this
slot, after being freed, can be reused for a larger op.
Father Chrysostomos fresh_perl.t: Skip #112312 tests on miniperl
They require
Father Chrysostomos op.c: Memory funcs need dVAR 20429ba
Father Chrysostomos -DS should not invoke warnhook
I was using Perl_warn, both for its convenience, and because the line
numbers were extremely helpful in tracking bugs.

But it invokes the warnhook, if present, and also respects tied
STDERR.  We should be using Perl_debug_log.

Changing this also avoids the need for /* diag_listed_as: SKIPME */
all over the place.
Father Chrysostomos When reusing op slots, only zero as much as needed
If an op slot is reused for a smaller op, we only need to zero out the
space used for the op, not the whole slot.
Father Chrysostomos perldiag: Document ‘Slab leaked from cv’ efc859f
Father Chrysostomos Increase $diagnostics::VERSION to 1.30 9b6decb
Father Chrysostomos Teach about %p 01bfea8
Father Chrysostomos [Merge] CV-based slab allocator for ops
This branch uses per-CV slabs for ops, so that ops can all be freed
after compilation errors, fixing memory leaks and a crash.

See commit 8be227a for how it works.
Father Chrysostomos [perl #113812] Always use find_runcv when cloning a sub
A closure prototype’s CvOUTSIDE pointer might have been modified if
its containing sub is freed first.  When a sub is cloned, the enclos-
ing sub is always the currently-running sub (not so for formats).

So this commit makes subs always use find_runcv, the way they did
before 71f882d.

So the closure logic which was needed for formats is now moved into an
else branch that is used only for them.
Father Chrysostomos Make formats close over the right closure
This was brought up in ticket #113812.

Formats that are nested inside closures only work if invoked from
directly inside that closure.  Calling the format from an inner sub
call won’t work.

Commit af41786 stopped it from crashing, making it work as well
as 5.8, in that closed-over variables would be undefined, being

This commit adds a variation of the find_runcv function that can check
whether CvROOT matches an argument passed in.  So we look not for the
current sub, but for the topmost sub on the call stack that is a clone
of the closure prototype that the format’s CvOUTSIDE field points to.
@doy doy fix compiler warning 94b67eb
Commits on Jun 30, 2012
Karl Williamson no_utf8_pm.t: Add blank between 'not' and 'ok' in .t f74da94
Karl Williamson handy.h: Fix isBLANK_uni and isBLANK_utf8
These macros have never worked outside the Latin1 range, so this extends
them to work.

There are no tests I could find for things in handy.h, except that many
of them are called all over the place during the normal course of
events.  This commit adds a new file for such testing, containing for
now only with a few tests for the isBLANK's
Karl Williamson regcomp.c: Use more inversion lists in [] char classes
This changes the building of bracketed character classes to use
inversion lists instead of a bitmap/inversion list combination.

This will lead in later commits to simplification and extending
optimizations to beyond the Latin1 range.
Karl Williamson regcomp.c: Remove unnecessary 'if' test
A previous commit has refactored things, so this test is always true
Karl Williamson regcomp.c: White-space, comments only
This indents, outdents previous code, based on new/removed outer blocks.
It reflows comments and code to fit into 80 columns, add/removes blank
lines, minor comment rewording
Karl Williamson regcomp.c: Remove obsolete code
A previous commit has removed all calls to these two functions (moving a
large portion of the bit_fold() one to another place, and no longer sets
the variable.
Karl Williamson regcomp.c: Have a subroutine do the work
Since this code was originally written, the fold function has added
input flags that cause it to do the same thing this code does.  So do it
in the subroutine.
Karl Williamson regcomp.c: Rename variable to reflect new purpose
This variable really holds the list of all code points the bracketed
character class matches; it's not just the ones not in the bitmap.
Karl Williamson regcomp.c: Simplify compile time [^..] complement
This simply moves the code that populates the bitmap and combines the
two inversion lists to after the inversion (the differences are shown
much greater than there really are, since a move is done.)  This greatly
simplifies complementing the character class.
Karl Williamson reg_fold.t: Make test cases non-optimizable away
This commit changes the bracketed character classes to include a
non-related character.  This is in preparation for a future commit which
would cause the current character classes to be optimized into EXACTish
nodes which would start passing TODO tests, but don't fix the underlying
problem with character classes.  That bug is that you can't split a
multi-char fold across nodes. It probably is not fixable in Perl without
a total restructuring of the regular expression mechanism.  For example,
"\N{LATIN SMALL LIGATURE FFI}" doesn't match /[f][f][i]/i.  But it would
if those got optimized into a single EXACTF node.  (The problem is not
limited to character classes, /(f)(f)(i)/i also doesn't match, and
can't, as $1, $2, and $3 are not well-defined.)
Karl Williamson regcomp.sym: Reorder a couple of nodes
This causes all the nodes that depend on the regex modifier, BOUND,
BOUNDL, etc. to have the same relative ordering.  This will enable a
future commit to simplify generation of the correct node.
Karl Williamson regcomp.c: Simply some node calculations
For the node types that have differing versions depending on the
character set regex modifiers, /d, /l, /u, /a, and /aa, we can use the
enum values as offsets from the base node number to derive the correct
one.  This eliminates a number of tests.

Because there is no DIGITU node type, I added placeholders for it (and
NDIGITU) to avoid some special casing of it (more important in future
commits).  We currently have many available node types, so can afford to
waste these two.
Karl Williamson regcomp.c: Optimize e.g., /[^\w]/, /[[^:word:]]/ into /\W/
This optimizes character classes that have a single element that is one
of the ops that have the same meaning outside (namely \d, \h, \s, \w,
\v, :word:, :digit: and their complements) to that op.  Those
ops take less space than a character class and run faster.   An initial
'^' for complementing the class is also handled.
Karl Williamson regcomp.c: Optimize /[0-9]/ into /\d/a
The commonly used [0-9] can be optimized into a smaller, faster node
that means the same thing.
Karl Williamson perlguts: Document that PV can point to non-string 61984ee
Father Chrysostomos Don’t crash with formats in special blocks
Commit 421f30e didn’t go far enough.  If a special block happens
to replace a stub, then a format trying to close over variables in the
special block will be pointing to the wrong outer sub.

Such stubs shouldn’t usually happen, but perl shouldn’t crash.
Father Chrysostomos op.c: Remove unnecessary variable
This is left over from when I had the partially-filled slab at the end
of the chain, instead of second (which was never committed).
Father Chrysostomos [perl #113006] perllocale: change Spanish to traditional Spanish
Nowadays, Spanish collation does not treat ch as a separate letter.
Father Chrysostomos [perl #113012] String negation under ‘use integer’
This makes the negation operator under the integer pragma (i_int) use
the same logic for determining whether to do string negation as the
regular negation operator.

Before, this did not happen at all under the integer pragma, except
for barewords, resulting in strange inconsistencies:

$ perl -le 'use integer; print -foo'
$ perl -le 'use integer; print -"foo"'

The code for string negation is now in a static routine in pp.c and is
used by both types of negation.
Father Chrysostomos pad.c: Update comments 1b5aaca
Father Chrysostomos op.c: S_op_integerize: -foo no longer needs an exception 077da62
@dmcbride dmcbride perldelta for 9d7bf4 b81e0e2
@shlomif shlomif Fix perl -d’s "l" command.
The "l" command (without any arguments) got broken in blead, due to the
"use strict" patch because "$max = ..." was changed into "my $max = ..."
while $max should always be a global.
Father Chrysostomos Cloning a format whose outside has been undefined
This has crashed ever since 71f882d, because the format tries to
close over a pad that does not exist:

sub x {
    {my ($a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k,$l,$m,$n,$o,$p,$q,$r,$s,$t,$u)}
    my $z;
    format =
undef &x;

This commit adds checks for nonexistent pads, producing the ‘Variable
is not available’ warning in cases like this.
Commits on Jul 01, 2012
Karl Williamson Fix up pod references to deprecated function 49f4c4e
Commits on Jul 02, 2012
@tonycoz tonycoz [ #61577] sockdomain and socktype undef on newly accepted …

There appears to be a flaw in IO::Socket where some IO::Socket objects
are unable to properly report their socktype, sockdomain, or protocol
(they return undef, even when the underlying socket is sufficiently
initialized to have these properties).

The attached patch should cover IO::Socket objects created via accept(),
new_from_fd(), new(), and anywhere else whose details haven't been
properly cached.

No new code should be executed on IO::Socket objects whose details are
already cached and present.

These tests were original written by Daniel Kahn Gillmor
<>, I've mangled them for use in a hopefully
final fix for the issue.
@tonycoz tonycoz [ #61577] propagate socket details on accept 76d04ca
@tonycoz tonycoz [ #61577] try to populate socket info when not cached
The fixes are originally by Daniel Kahn Gillmor
<>, but I've made other changes.
@tonycoz tonycoz document the limitations of protocol(), sockdomain(), socktype()
Determining these for a new_from_fd() socket has the following problems:

protocol() depends on SO_PROTOCOL, and socktype() on SO_TYPE, not
implemented on all systems.

sockdomain() depends on sockname(), which is documented as
unimplemented for AF_UNIX sockets on HP-UX.

I'm not sure that detail is useful in the documentation.
@tonycoz tonycoz bump IO::Socket version 40bf447
@jmdh jmdh add Test::More as a prereq to Makefile.PL f4ea075
@tonycoz tonycoz [ #61577] try harder to get socket information
also [perl #112736][debian #659075]

One of the tests may fail on HP-UX (but doesn't on the machine I have
access to)  I plan to monitor smokes and add skips as needed.
@tonycoz tonycoz bump version
cmpVERSION doesn't pick this up - should it?
@tonycoz tonycoz perldelta for 1804235, 9adbac0 df2c1bb
Nicholas Clark s/thinngy/thingy/ in a comment in sv.c 21dfaee
Father Chrysostomos Use find_runcv_where for pp_coreargs and pp_runcv b4b0692
Father Chrysostomos Put a cap on op slab sizes
If a subroutine is *really* big, we don’t want to allocate, say, 4MB
for ops when just over 2 will do, just because there was one op more
than could fit in 2MB.
Father Chrysostomos pad.c: Improve intro_my docs bf95456
@doy doy fix 64-bit compiler warning 9f4db4e
Commits on Jul 03, 2012
@craigberry craigberry Fix ill-named Test::Harness test and bump version.
env.opts.t by its very existence causes the test suite to die on
VMS with:

$ perl TEST ../cpan/Test-Harness/t/compat/env.opts.t
Can't read ../cpan/test-harness/t/compat/env.opts.t.
%RMS-F-SYN, file specification syntax error

Enabling the extended filename character set will fix this but that's
not (yet) the default setting.  So here we simply rename the file to
something legal.

Reported upstream as [ #78127].
Father Chrysostomos op.c:newFOROP: Fall back to realloc for unslabbed ops
When an op is allocated, PL_compcv is checked to see whether it can
hold an op slab if it does not hold one already.  If PL_compcv is not
usable, for whatever reason, it falls back to malloc.

Since the new slab allocator was added in commit 8be227a, newFOROP has
been assuming, probably correctly, that its listop which it needs to
enlarge to a loopop was allocated by slab.

Since newFOROP is an API function, we should err on the safe side and
check first whether the op is slab-allocated, falling back to realloc
if it is not.

To trigger this potential bug, one has to set things up such that
there is a usable pad available, but no usable PL_compcv.  I said
‘probably correctly’ above because this situation is highly unlikely
and probably indicative of bugs elsewhere.  (But we should still err
on the side of safety.)
Father Chrysostomos perlfunc: Fix do-sub mistake
do &foo() is the do-file operator on the return value of the sub,
not just a sub call.
@wolfsage For #16249 - Overwrite PL_last_lop_op when eval() is called.
Otherwise, parsing later on down the road may use the previous value, which, if it was OP_PRINT, causes the parser to fail
Father Chrysostomos toke.c: Merge UNI2 and UNIBRACK
The only difference between them is the PL_expect assignment,
which can be controlled by a constant parameter that the C
compiler will optimise away.
@doy doy constant folding shouldn't change return value of while [perl #73618]
If the expression in while (EXPR) is a false constant, just return that
constant expression rather than OP_NULL during optimization.

Doesn't handle until loops yet, because "until (1)" is converted to
"while (!1)" by the parser, and so "!1" is already constant-folded to ''
by the time the while loop optree is constructed. Not sure what to do
about that.
@ikegami ikegami Avoid needless use of deprecated exists on array elements 5e5bb7c
@tonycoz tonycoz [ #61577] VMS doesn't support UNIX sockets
A casual reading of t/io_unix.t might lead you to believe it might,
but VMS also doesn't support fork, so the io_unix.t tests are skipped
Nicholas Clark Add another address for Colin Kuskie to 201da6f
@perlDreamer perlDreamer Refactor t/op/splice.t to use t/ instead of making TAP by hand. ce6d40e
@doy doy fix compile warnings in malloc.c [perl #75340] 8c2f25b
Father Chrysostomos sv.h: Improve docs of Sv[GS]ETMAGIC f7e029a
Father Chrysostomos parser.h: Correct comment explaining last_lop_op 5ed5d9d
Father Chrysostomos parser.h: Add comments explaining *bufptr a0dffe9
Commits on Jul 04, 2012
@doy doy fix perlobj SUPER example [perl #113972] 77d38c8
Father Chrysostomos sv.c: Correct comment
S_varname is no longer static.
Father Chrysostomos [perl #86136] Downgrade sort {my $a} to a warning
The code in toke.c for detecting lexical $a or $b used in a comparison
in a sort block was simply horrible.  If the last-used named list or
unary op (PL_last_lop_op) was sort, then it would scan for <=> or cmp
anywhere on the current line of code.  That meant that, although this
would die:

    my $a; sort { $a <=> $b } ()

This would do the wrong thing without complaint:

    my $a; sort { print; $a <=> $b } ()

And this would die, completely gratuitously:

    my $a; sort @t; $a + $cmp;

Since perl is only guessing that lexical $a or $b *might* have
been used accidentally, this should be a warning, and certainly
not an error.

Also, scanning the source code like that for <=> (even inside a
string!) can never work.  One would have to parse it and examine the
resulting op tree.

In fact, since we *are* parsing it anyway, we *can* examine
the op tree.

So that’s exactly what this commit does.  Based on the existing behav-
iour, but with far fewer false positives, it checks for a cmp or <=>
op as the last statement of a sort block and warns about any operand
that is a lexical $a or $b.
@tonycoz tonycoz perldelta: move several change notes to Selected Bug Fixes
They were in Configuration and Compilation
Father Chrysostomos op.c: Merge some code 8023b71
Father Chrysostomos Use ‘state’ in warning about sort {state $a} a2e3921
@utrace utrace [perl #113980] pp_syscall: "I32 retval" truncates the returned value
I noticed today that syscall(9, ...) (mmap) doesn't work for me.

The problem is obvious, pp_syscall() uses I32 for retval and the
"long" address doesn't fit into "int".

The one-liner below should fix the problem.
Father Chrysostomos Add Oleg Nesterov to AUTHORS aba33b8
Commits on Jul 05, 2012
Father Chrysostomos Record folded constants in the op tree cc2ebcd
Father Chrysostomos [perl #78064] print(const || bare) and const folding
Constant folding should not be able to change the meaning of print
followed by || or && or ?: with barewords as operands.

The previous commit recorded which constant ops are the result of con-
stant folding (including collapsing of conditionals).

This commit uses that information (OpCONST_FOLDED) to fix this.
Father Chrysostomos Increase $B::Concise::VERSION to 0.91 5111234
@doy doy perldelta for 317f3b6 c0c1943
Nicholas Clark [perl #112820] t/op/sprintf.t failure on FreeBSD 4.6
t/op/sprintf.t fails one test on FreeBSD 4.6
*Everything* else passes. This is a pleasant surprise.

Patch adds a skip for FreeBSD 4, and should not skip on FreeBSD 5 and later.
Tested on FreeBSD 7 too. Due to the way versions don't map to real numbers,
4.6 > 4.11, whereas 4.6 <= 4.9 (and 4.9 <= 4.9, 4.10 <= 4.9 and 4.11 <= 4.9)
so the skip skips for all releases of FreeBSD 4.
@xdg xdg perlfunc: clarify docs for 'our' [perl #113974]
In response to the thread, this attempts to clarify the aliasing and
scope of 'our' (as well as 'use vars').
Commits on Jul 06, 2012
@rjbs rjbs correct the perlfunc explanation of use vars 0edb7bc
@xdg xdg remove 'obsolete' description [perl #113974]
The phrase 'obsolete' in the abstract is not well defined
and may be inappropriate.  This commit removes it and clarifies
that use of is discouraged when 'our' could be used

No perldelta note was added, as the change is trivial, despite
the version number bump.
@xdg xdg perlfunc: clarify docs for 'package' [perl #113974]
This one word change clarifies that 'package' applies to
'lexically-scoped' variables rather than 'lexical' variables, which
people may misunderstand to mean only my/state declarations and thus be
confused by the nearby statements about it applying to 'our' as well.

No perldelta note was added as the change was trivial.
@xdg xdg perlfunc: clarify 'our' again for behavior
rjbs discovered that docs lie and it works within
a package, even across file scopes
@tonycoz tonycoz rt #72232 - ignore wday/yday in mini_mktime as indirectly documented a64f08c
@doy doy both INT64_C and UINT64_C should be guarded [perl #76306] 80524f3
Father Chrysostomos Test ‘Missing name in "my sub"’ ca8ffed
Father Chrysostomos do.t: Load at BEGIN time
so that parentheses can be omitted.
Father Chrysostomos Let do.t run from the top level ed430ca
Father Chrysostomos do-file should not force a bareword
A word following do is forced to be a bareword for do-sub’s sake.  But
if it is going to be interpreted as do-file after all, that does not
make sense.  ‘do subname;’ should call the sub and run the file whose
name it returns, instead of running the file named ‘subname’.
@craigberry craigberry Unquote spawned command verbs on VMS.
Prior to the current change,

$ foo "A" "b" "c"

worked, but the following didn't:

$ "foo" "A" "b" "c"
%DCL-E-PARSEFAIL, error parsing DCL$PATH:"foo".*
-RMS-F-FNM, error in file name

even if foo was a valid command or path.  It's illegal in DCL to
quote the command verb even if it's often necessary to quote the
parameters to it.

But various things in the wild (such as Test::Harness::_filtered_inc),
find it convenient or necessary to quote the command verb, so the
easiest way to support that is to unquote it before DCL sees it, and
that's what this change does.

Also, spaces within the first quoted item are now escaped so that
an image path containing spaces doesn't run afoul of subsequent
tokenizing based on spaces.
@craigberry craigberry perldelta for 22831cc. 5edb02d
@doy doy document the append parameter to sv_gets [perl #72244] f05ec71
Commits on Jul 07, 2012
@tonycoz tonycoz perldelta: note a few interesting changes 7ab2ea4
Father Chrysostomos toke.c: Correct comment a4fd4a8
Father Chrysostomos rv2cv hooks should not create 2nd-class subs
$ perl5.17.2 -Mblib -e 'sub foo{}; foo $bar; use Lexical::Sub baz => sub{}; baz $bar'
Can't call method "baz" on an undefined value at -e line 1.
$ perl5.17.2 -Mblib -e 'sub foo{}; foo bar; use Lexical::Sub baz => sub{}; baz bar'
Can't locate object method "baz" via package "bar" (perhaps you forgot to load "bar"?) at -e line 1.

So if you use Lexical::Sub, your sub doesn’t get to participate in
determining whether ‘foo $bar’ or ‘foo bar’ is a method call.

This is because Lexical::Sub uses an rv2cv hook to intercept sub
lookup.  And toke.c:S_intuit_method thinks there cannot be a CV with-
out a GV (which was the case when it was first written).

Commit f746176 introduced this rv2cv hooking for bareword lookup, but
failed to update S_intuit_method accordingly.
Father Chrysostomos [perl #113016] Parse CORE::foo::bar as a bareword
CORE::print::foo was being parsed as CORE::print followed by
::foo, making it impossible to call a global override directly as

The logic in toke.c that does the CORE:: special-casing was faulty.
This commit fixes it, by checking for a package separator after the
potential keyword.

That d = s part of the KEY_CORE case in yylex was added in perl 5.001
(748a930) but apparently wasn’t doing anything.  That means I get to
move it before s+=2, now that I have a use for it.

I added the tests a little above the ‘Add new tests HERE’ label in
parser.t, to avoid conflicting with other patches I’m working on.
Commits on Jul 08, 2012
@tonycoz tonycoz perldelta: fix typo noticed by rurban f4df6cb
@tonycoz tonycoz fix -Uusedl builds
without the "static" linking produced a duplicate symbol error on
Father Chrysostomos Let rv2cv-hook CVs’ protos participate in method intuition
Commit 39c012b wasn’t enough.  If a subroutine has a proto-
type beginning with * then its name is treated as a sub call, even
when followed by a package name:

    {package Foo}
    sub Foo {}
    foo Foo; # Foo->foo

    {package Bar}
    sub bar (*) {}
    bar Bar; # bar(Bar)

This was not applying to subs looked up via rv2cv hooks.
Father Chrysostomos anonsub.t: Improve test for [perl #71154]
When I authored commit 2c37437, I thought I was just correcting the
error message at the time (from ‘Not a CODE reference’ to ‘Undefined
sub called’, since there is a sub), but it turns out I actually fixed
another bug at the same time.  Undefined anonymous subs were falling
back to supposedly-autoloaded __ANON__ subs.

Take this example, for instance:

    sub __ANON__ { warn 42 }
    $x = sub {};
    undef &$x;

This is the output I get:

$ pbpaste|perl5.14.0
42 at - line 1.
$ pbpaste|perl5.16.0
Undefined subroutine called at - line 4.
Father Chrysostomos Correct err msg when calling stub w/no autoload fb
If an AUTOLOAD subroutine loads a sub by assigning to the glob, there
may be code elsewhere that has a reference to a stub, that is now
assigned over.  To cope with this situation, calls to undefined sub-
routines will fall back to whatever sub is in the subroutine’s owner
typeglob.  This has been the case since Perl 5.000.

But the error message that occurs if the typeglob happens to have no
sub in it is wrong:

$ perl -e '
   my $foosub = \&foo;
   undef *foo;
Not a CODE reference at -e line 4.

as opposed to this:

$ perl -e '
   my $foosub = \&foo;
Undefined subroutine &main::foo called at -e line 3.

They should both produce the same error message, because $foosub is a
code reference, albeit without a body.
Karl Williamson handy.h: Fix broken is_ASCII_utf8()
Tests to follow in a future commit.
Karl Williamson handy.: Add some tests for its API c9c0535
Commits on Jul 09, 2012
@steve-m-hay steve-m-hay Improve support for building on Windows with binaries
The cross-compiler has headers and libraries in a sub-directory called
x86_64-w64-mingw32\, which is also copied to mingw\ in the automated
builds but not in other builds (e.g. rubenvb's build), so rely on the
folder which is always present.

The DLLs required for op\taint.t to work are nomrally found in \bin\, but
for the cross-compiler are found in the same folder as the libraries since
they are 64-bit DLLs, whereas the compiler binaries themselves are 32-bit.

With these fixes we now support the following MinGW/gcc compilers:

Native 32-bit compilers (WIN64=undef GCCCROSS=undef):, rubenvb's
build of, Mark Dootson's build of the same (used in
Strawberry Perl).

Native 64-bit compilers (WIN64=define GCCCROSS=undef): rubenvb's build of, Mark Dootson's build of the same (used in Strawberry

32-bit cross-compilers producing 64-bit binaries (WIN64=define
GCCCROSS=define): rubenvb's build of, the automated build
of the same.

There is currently no automated build of a native 64-bit compiler on, and their automated build of a native 32-bit compiler is
not currently supported since it uses an anomalous naming convention
compared to the other options above.

for discussion.
@perlDreamer perlDreamer Refactor t/lib/commonsense.t to use t/ instead of making TAP b…
…y hand. Add a BAIL_OUT method to for lib/commonsense.t to use.
Commits on Jul 10, 2012
Nicholas Clark In configpm, switch to using sprintf for part of generating Config_he…

This will make subsequent changes easier.
Nicholas Clark Expand $^O at build time when generating Config::_V()
Config::_V() is how perl -V is implemented internally, and is called called
directly from the interpreter's switch passing routine. Hence the value of
$^O at runtime will always be the same as the value of $^O at build time,
so conditionals dependent on the value of $^O will always take the same
execution path. So only generate the relevant code, and hence avoid shipping
VMS and Cygwin specific code except on those platforms. (But add a sanity
test in Config::_V() to ensure that the runtime $^O has the correct value -
ie that the Perl code and the perl binary correspond.)
@perlDreamer perlDreamer Refactor t/op/join.t to use instead of making TAP by hand.
Added a utility sub to the test for the byte vs character tests.
Commits on Jul 11, 2012
@chipdude chipdude hold pid in Pid_t, not I32, for kill() 6008229
@chipdude chipdude ensure shmread() calls get and set magic once b399897
@chipdude chipdude remove silly redundant SvGMAGICAL() test for $\
  that was introduced by some guy named Chip in 1997 (e3c19b7)
@chipdude chipdude use right type for offset in sysread() or syswrite() d5f981b
@tonycoz tonycoz AIX isn't a new platform, move its note to the right place 42d72fc
@craigberry craigberry Cast following 22831cc.
C++ insists on casting the return values of the malloc family.
@dmcbride dmcbride Add AIX7 APAR requirement to get Time::Piece tests to pass.
Signed-off-by: H.Merijn Brand <>
@Tux Tux Add IP probe for ip_mreq
Backport 2f1eb816b5cba6977b1a8159
Commits on Jul 12, 2012
@bingos bingos Update File-Fetch to CPAN version 0.36

  Changes for 0.36        Thu Jun 28 13:41:31 2012
  * Added 'file_default' option for URLs that do
    not have a file component (Andrew Kirkpatrick)
@bingos bingos Update autodie to CPAN version 2.12

  2.12  Tue Jun 26 14:55:04 PDT 2012
        * BUGFIX: autodie now plays nicely with the 'open' pragma
        (RT #54777, thanks to Schwern).

        * BUILD: Updated to Module::Install 1.06

        * BUILD: Makefile.PL is less redundant.

        * TEST: t/pod-coverage.t no longer thinks LEXICAL_TAG is
          a user-visible subroutine.
@steve-m-hay steve-m-hay Ensure wildcard expansion is enabled for perlglob.exe on Windows
This is provided by linking in setargv.obj for Visual C++, which the
makefiles already do, but for MinGW(-w64)/gcc we must explicitly ensure
that wildcard expansion is enabled rather than relying on the C-runtime
defaults of the particular compiler suite in question.

This currently only seems to be necessary for the automated build of the
MinGW-w64 cross-compiler (other builds have it enabled by default anyway),
but there's no harm in making sure for others too.
Father Chrysostomos PERL_DEBUG_READONLY_OPS with the new allocator
I want to eliminate the old slab allocator (PL_OP_SLAB_ALLOC),
but this useful debugging tool needs to be rewritten for the new
one first.

This is slightly better than under PL_OP_SLAB_ALLOC, in that CVs cre-
ated after the main CV starts running will get read-only ops, too.  It
is when a CV finishes compiling and relinquishes ownership of the slab
that the slab is made read-only, because at that point it should not
be used again for allocation.

BEGIN blocks are exempt, as they are processed before the Slab_to_ro
call in newATTRSUB.  The Slab_to_ro call must come at the very end,
after LEAVE_SCOPE, because otherwise the ops freed via the stack (the
SAVEFREEOP calls near the top of newATTRSUB) will make the slab writa-
ble again.  At that point, the BEGIN block has already been run and
its slab freed.  Maybe slabs belonging to BEGIN blocks can be made
read-only later.

Under PERL_DEBUG_READONLY_OPS, op slabs have two extra fields to
record the size and readonliness of each slab.  (Only the first slab
in a CV’s slab chain uses the readonly flag, since it is conceptually
simpler to treat them all as one unit.)  Without recording this infor-
mation manually, things become unbearably slow, the tests taking hours
and hours instead of minutes.
Father Chrysostomos op.c:pmruntime: Remove redundant cv_forget_slab
This comes after newATTRSUB, which itself causes the CV to forget its
slab, except after a parse error, in which case the slab will be
cleaned up shortly anyway when the CV is freed.
Father Chrysostomos Eliminate PL_OP_SLAB_ALLOC
This commit eliminates the old slab allocator.  It had bugs in it, in
that ops would not be cleaned up properly after syntax errors.  So why
not fix it?  Well, the new slab allocator *is* the old one fixed.

Now that this is gone, we don’t have to worry as much about ops leak-
ing when errors occur, because it won’t happen any more.

Recent commits eliminated the only reason to hang on to it:
Father Chrysostomos todo.pod: Clean up entries related to op slabs
Note about storing the current pad with the ops:  If each slab belongs
to a CV (which is the case), then we would only ever walk the slab to
free its ops when the CV itself is freed.  When that happens, the pad
is about to freed anyway, so freeing pad entries for each op is unnec-
essary, and has probably always been so.  Note that cv_undef actually
sets PL_comppad and PL_curpad to null before freeing ops, to avoid
having to have them point at the right pad, and probably also to avoid
the unnecessary overhead of tracking which pad entries are available
for reuse.
Father Chrysostomos perlhacktips: PERL_DEBUG_READONLY_OPS update
I don’t know when this changed, but I *can* build F<perl> with
PERL_DEBUG_READONLY_OPS, and I could before I rewrote it to use the
new slab allocator.  So that particular note in perlhacktips may have
been wrong for quite some time.  I assume it had to do with redefini-
tion sub warnings that try to set the line number of the current cop
(which is still a problem).
Father Chrysostomos perldelta update 90519d0
Father Chrysostomos op.c: Make slabs sizes powers of two
It wasn’t exactly doubling the size of the previous slab, but making
it two less than that.  I’m assuming that malloc implementations round
things up to powers of two, and trying to take advantage of that, so
we don’t have wasted gaps at the ends of slabs.
Commits on Jul 13, 2012
Father Chrysostomos Fix *ISA = *glob_without_array
I broke this in 5.14 with commit 6624142.

In trying to make *ISA = *Other::ISA work, I added logic to make
@Other::ISA’s existing magic now point to *ISA’s stash.  I skipped
that logic if *Other::ISA did not contain an array.  But in so
doing, I inadvertently skipped the call to mro_isa_changed_in at the
same time.
Father Chrysostomos Fix @{*ISA} autovivification
It was not attaching magic to the array, preventing subsequent changes
to the array from updating isa caches.
Father Chrysostomos Mention all generated files 130e6ef
Robin Barker silence compiler warning - casting void* to IV
This warns when void* and IV have different sizes
There is already a macro to do this conversion cleanly: PTR2IV
Robin Barker silence warning about use of --libpods
--lipods warns, and I don't think it is needed in this test,
so I have removed it
Father Chrysostomos mro/basic.t: Squelch warning 40099ff
Robin Barker silence override warning
The test is trying to test the behaviour being warned about,
so the code is right but the warning can be suppressed.
Commits on Jul 14, 2012
Father Chrysostomos [perl #113020] INSTALL: Clarify CPAN::autobundle c75cfcf
Father Chrysostomos [perl #113470] Constant folding for pack
This takes the pessimistic approach of skipping it for any first argu-
ment that is not a plain non-magical PV, just in case there is a 'p'
or 'P' in the stringified form.

Otherwise it scans the PV for 'p' or 'P' and skips the folding if either
is present.

Then it falls through to the usual op-filtering logic.

I nearly made ‘pack;’ crash, so I added a test to bproto.t.
Father Chrysostomos [perl #113576] Restore err msg for &{+undef}
This ‘Can't use an undefined value as a subroutine reference’ message
used to occur for &{+undef}, until commit 15ff848 in 1997.

Then it started happening only for magic variables.

Non-magical variables would treat it the same as "", possibly dying
with ‘Undefined subroutine main:: called’, and possibly calling the
subroutine with that name.

Magical variables (&{$tied_undef}) started behaving the same way
(treating undef as "") with commit 7c75014, in 2010.

This commit restores that message.
@demerphq demerphq fix RT#114068 optimizer handles MEOL in middle of pattern improperly
It seems that under certain circumstances the optimiser handles the
MEOL operator (what $ turns into under /m), improperly including
things that follow. This results in compilation like this:

    Compiling REx "( [^z] $ [^z]+ )"
    Final program:
        1: OPEN1 (3)
        3:   ANYOF[\x00-y{-\xff][{unicode}0100-INFINITY] (14)
       14:   MEOL (15)
       15:   PLUS (27)
       16:     ANYOF[\x00-y{-\xff][{unicode}0100-INFINITY] (0)
       27: CLOSE1 (29)
       29: END (0)
    anchored ""$ at 2 stclass ANYOF[\x00-y{-\xff][{unicode}0100-INFINITY]

Where the '""$ at 2' is sign of the bug. The problem is that the optimiser
does not "commit" the string when it encounters an MEOL, which means that
text that follows it is included. This has probably always been wrong as
$ is a multichar pattern (it matches before an \n or including an \n). This
failure to commit then interacts with the implementation for PLUS leading to
an incorrect offset. By adding a SCAN_COMMIT() as part of the optimisers
handling of EOL constructs this problem is avoided. Note that most uses of
$ were ok due to other reasons.
Father Chrysostomos [perl #113710] Make __SUB__ work in sort block
When the peephole optimiser encounters a __SUB__, it looks to see
whether the current sub is clonable.  If it is not, it inlines the
__SUB__ as a const op.

This works most of the time.  A forward declaration will cause the sub
definition to reuse the existing stub.  When that happens, the sub
visible during compilation in PL_compcv is not the sub that the
op tree will finally be attached to.  But the peephole optimiser
is called after that, with PL_compcv set to the other CV (what
was a stub).

ck_sort was calling the peephole optimiser on the sort block ahead of
time.  So this caused __SUB__ to point to the wrong subroutine.

By removing the CALL_PEEP call from ck_sort and adding logic to the
peephole optimiser itself to traverse the sort block (it is not in the
usual op_next chain), this bug is eliminated.

I modified the DEFER macro to work as a single statement.  You don’t
want to know how much time I spent debugging the bus errors that were
occurring because if(foo) DEFER; didn’t do what I though.

It turns out that grepstart and mapstart, which also use ck_sort,
had their blocks go through the peephole optimiser twice, because
grepwhile already has special-casing in the peephole optimiser.

This also has the side-effect of making map and grep slightly more
efficient, in that they no longer execute a scope op (which is just
pp_null).  By temporarily disconnecting the subtree before running the
optimiser, ck_sort was hiding a possible optimisation (skipping the
scope op).
Father Chrysostomos Disentangle ck_sort and grep
Originally, sort and grep/map used the same code for handling the
block’s ops.

But that didn’t quite work, so exceptions were added over time.  Now
the thing is a complex sprawling mess.  By folding the grep-specific
code into ck_grep, things are greatly simplified.
Father Chrysostomos op.c: Missing line break 08fdcd9
@shlomif shlomif Update perlop's bignum modules list.
Removed some out-of-date modules and add Math::GMPq, Math::GMPz and
Father Chrysostomos op.c: Consistent tweak; podchecker complaints 70c45be
@tonycoz tonycoz Upgrade Socket to 2.002 3be135d
Commits on Jul 15, 2012
Father Chrysostomos op.c: Further simplify ck_sort
This code currently chases op_next pointers in the sort block to make
sure there is none that can point outside.  To avoid getting stuck in
loops, it has to check for those explicitly.

Instead of nulling out any op_next pointer that points to the leave
op, we can simply turn the leave into a null op (which we already do)
and have the leave op’s op_next pointer point to nothing.

That produces the same result in the end:  Execution of the sort block
is prevented from running rampant and escaping out of it, but exits
the runloop instead, returning control to pp_sort.
Father Chrysostomos Simplify ck_grep
Back in perl 5.000, ck_grep would call ck_sort (which was still the
case until 354dd55 just recently) and the latter would traverse
its way through the op_next pointers to find an op that tried to
escape the block, setting its op_next pointer to null.  Then ck_grep
would traverse op_next pointers itself to find the place where ck_sort
stopped.  That caused problems for grep which were fixed in 748a930
(perl 5.001).  It was fixed by setting op_next to 0 on the first op,
so that the loop in ck_grep would not do anything.  But that loop was
left there.  This commit removes it.

There are also a couple of things I missed when disentangling
ck_grep and ck_sort in commit /354dd559d9.  I accidentally put
if (o->op_flags & OPf_STACKED) inside if (o->op_flags & OPf_STACKED).
And the OPf_SPECIAL flag was only being set for sort’s use, so ck_grep
doesn’t need to copy that.
Father Chrysostomos pp_hot.c: Mention that pp_grepstart calls pp_pushmark 5d8673b
Father Chrysostomos op.c: ck_grep does not need to check num of args
It calls ck_fun first, which does the same check, so it is
Father Chrysostomos op.c:ck_grep: Remove unnecessary op_next assignments
ck_grep is a tangled mess and I am trying to simplify it, but at each
step it is not at all obvious what is happening.

grep/map with a block starts out like this:

          block contents...

The if (o->op_flags & OPf_STACKED) at the top of ck_grep runs for
blocks.  The firstkid var refers to the null above, and gets its
op_next set (this code was in ck_sort until recently [ck_grep used to
call ck_sort], and this particular op_next assignment was specific to
grep and map).

Later, the thing is fed through ck_fun, whose OA_CVREF case transforms
the tree into this:

      null             ← new op
        null           ← original null
            block contents...

Then cUNOPx(cLISTOP->op_first->op_sibling)->op_first gets its op_next
set.  By that point, that expression refers to the original null op,
so setting its op_next pointer to begin with seems pointless.

But it is not actually pointless.  Removing that statement breaks
things.  It turns out, as usual, that everything is more complicated
than it seems.  Setting kid->op_next = (OP*)gwop in the block-specific
if statement after setting the first null op’s op_next pointer results
in op_next pointers like this (the newly-created grepwhile doesn’t
link to the grepstart yet at this point):

      null              -> block contents
        scope/leave     -> grepwhile
          block contents...

So ck_fun’s OA_CVREF handling, when it calls LINKLIST, sees that the
original null op already has its op_next set and does nothing.  With-
out it set, it copies it from the first kid, resulting in this (when
LINKLIST copies the op_next pointer out, it makes the kid it was cop-
ied from point to its sibling or its parent):

        null              -> grepwhile
          scope/leave     -> null (prev line)
            block contents...

That nonsensical arrangement of op_next pointers basically prevents
the block from running, because the grepwhile’s other pointer, copied
from the first null’s kid, ends up pointing to the grepwhile itself.

If we also remove the kid->op_next = (OP*)gwop assignment from the
if(OPf_STACKED) block, then we end up with this after ck_fun:

        null              -> first op in block
          scope/leave     -> null (prev line)
            block contents...

Then the op_next poiner from the first null’s kid is copied to
grepwhile’s op_other pointer, and everything works.

This also means we can remove the now-redundant LINKLIST call from the
if(OPfSTACKED) block, since ck_fun’s OA_CVREF handling also does that.
So now every vestige of the original call to ck_sort is gone.

This also means we no longer have to repeat NewOp(1101, gwop...).
Father Chrysostomos op.c: ck_fun does not need to call LINKLIST
The branch in question is only reached when it is called from ck_grep,
which itself calls LINKLIST on exactly the same op.
Father Chrysostomos op.c: ck_grep does not need to call listkids
It calls ck_fun, which applies list context to all the arguments,
since grepstart and mapstart have an L in regen/opcodes.
Father Chrysostomos perly.y: Remove use of latefree from package foo {}
It is not necessary for the op containing the sv containing the name
of the package to last until the end of the block.  Perl_package can
free the op immediately, as the only information it needs from it it
copies to the sv in PL_curstname.  The version number can be treated
the same way.
Father Chrysostomos Remove op_latefree(d)
This was an early attempt to fix leaking of ops after syntax errors,
disabled because it was deemed to fragile.  The new slab allocator
(8be227a) has solved this problem another way, so latefree(d) no
longer serves any purpose.
Father Chrysostomos dump.c: Dump op->op_s(labbed|avefree) 6e22b38
Father Chrysostomos perldelta updates b8a55fe
@chipdude chipdude Magic flags harmonization.
In restore_magic(), which is called after any magic processing, all of
the public OK flags have been shifted into the private OK flags.  Thus
the lack of an appropriate public OK flags was used to trigger both get
magic and required conversions.  This scheme did not cover ROK, however,
so all properly written code had to make sure mg_get was called the right
number of times anyway.  Meanwhile the private OK flags gained a second
purpose of marking converted but non-authoritative values (e.g. the IV
conversion of an NV), and the inadequate flag shift mechanic broke this
in some cases.

This patch removes the shift mechanic for magic flags, thus exposing (and
fixing) some improper usage of magic SVs in which mg_get() was not called
correctly.  It also has the side effect of making magic get functions
specifically set their SVs to undef if that is desired, as the new behavior
of empty get functions is to leave the value unchanged.  This is a feature,
as now get magic that does not modify its value, e.g. tainting, does not
have to be special cased.

The changes to cpan/ here are only temporary, for development only, to
keep blead working until upstream applies them (or something like them).

Thanks to Rik and Father C for review input.
@chipdude chipdude mark blead-only modifications of Compress::Raw::{Bzip2,Zlib} with ver…
…sion bump
@chipdude chipdude perldelta description of magic flags patch 16e4fcb