platform/upstream/perl.git
12 years agoop.c: Memory funcs need dVAR
Father Chrysostomos [Wed, 27 Jun 2012 03:27:37 +0000 (20:27 -0700)]
op.c: Memory funcs need dVAR

12 years agofresh_perl.t: Skip #112312 tests on miniperl
Father Chrysostomos [Tue, 26 Jun 2012 21:30:40 +0000 (14:30 -0700)]
fresh_perl.t: Skip #112312 tests on miniperl

They require attributes.pm.

12 years agoEnlarge the last slot on an op slab to fit
Father Chrysostomos [Tue, 26 Jun 2012 20:24:13 +0000 (13:24 -0700)]
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.

12 years agoDefine cv_forget_slab under PL_OP_SLAB_ALLOC
Father Chrysostomos [Tue, 26 Jun 2012 17:08:58 +0000 (10:08 -0700)]
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.

12 years agoTest perl #112312, crash on syntax error
Father Chrysostomos [Sun, 24 Jun 2012 06:34:13 +0000 (23:34 -0700)]
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:

# ** DO NOT ADD ANY MORE TESTS HERE **

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

Putting it here seemed slightly better than putting it in
its own file.

12 years agoTest bug #111462, Safe + %^H + disallowed ops
Father Chrysostomos [Sun, 24 Jun 2012 01:24:52 +0000 (18:24 -0700)]
Test bug #111462, Safe + %^H + disallowed ops

12 years agoperlhacktips: Update PERL_DEBUG_READONLY_OPS
Father Chrysostomos [Sun, 24 Jun 2012 00:47:33 +0000 (17:47 -0700)]
perlhacktips: Update PERL_DEBUG_READONLY_OPS

12 years agoPERL_IMPLICIT_SYS can use the new slab allocator
Father Chrysostomos [Sun, 24 Jun 2012 00:44:23 +0000 (17:44 -0700)]
PERL_IMPLICIT_SYS can use the new slab allocator

12 years agoAdd slab allocation diagnostics (under perl -DS)
Father Chrysostomos [Sat, 23 Jun 2012 16:56:53 +0000 (09:56 -0700)]
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.

12 years ago-DS option for slab allocation
Father Chrysostomos [Sat, 23 Jun 2012 16:56:07 +0000 (09:56 -0700)]
-DS option for slab allocation

12 years agoCV-based slab allocation for ops
Father Chrysostomos [Sat, 23 Jun 2012 16:54:31 +0000 (09:54 -0700)]
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.

12 years agoAdd OP_FREED op type
Father Chrysostomos [Sat, 23 Jun 2012 16:50:15 +0000 (09:50 -0700)]
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.

12 years agoFlag ops that are on the savestack
Father Chrysostomos [Sat, 23 Jun 2012 16:48:34 +0000 (09:48 -0700)]
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.

12 years agodump.c: Dump CVf_SLABBED
Father Chrysostomos [Sat, 23 Jun 2012 16:43:33 +0000 (09:43 -0700)]
dump.c: Dump CVf_SLABBED

12 years agoAdd CVf_SLABBED flag
Father Chrysostomos [Sat, 23 Jun 2012 16:43:10 +0000 (09:43 -0700)]
Add CVf_SLABBED flag

This will indicate that a CV has a reference count on, and ownership
of, a slab used for allocating ops.

12 years agofix 386a548 for fallback => undef
Jesse Luehrs [Fri, 29 Jun 2012 06:56:27 +0000 (01:56 -0500)]
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).

12 years agoperldelta for 27c6f44
Jesse Luehrs [Fri, 29 Jun 2012 05:40:42 +0000 (00:40 -0500)]
perldelta for 27c6f44

12 years ago"use overload fallback => 0" should enable overloading [perl #113010]
Jesse Luehrs [Fri, 29 Jun 2012 05:38:04 +0000 (00:38 -0500)]
"use overload fallback => 0" should enable overloading [perl #113010]

This makes

  package Foo;
  use overload fallback => 0;

and

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

behave identically when an operator other than '+' is used.

12 years agoFormats in closures called outside closures → crash
Father Chrysostomos [Fri, 29 Jun 2012 03:28:09 +0000 (20:28 -0700)]
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.

12 years agofix storing objects with reftype REF [perl #113880]
Jesse Luehrs [Fri, 29 Jun 2012 03:17:23 +0000 (22:17 -0500)]
fix storing objects with reftype REF [perl #113880]

12 years agoperldelta updates for 6728836, d60d201, 82f9620, 7878705
Jesse Luehrs [Fri, 29 Jun 2012 01:27:07 +0000 (20:27 -0500)]
perldelta updates for 6728836, d60d201, 82f9620, 7878705

12 years agoDon’t let formats outlive their outer subs
Father Chrysostomos [Thu, 28 Jun 2012 23:31:17 +0000 (16:31 -0700)]
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 =
@||||||
$x
.
  }
}
undef *bar;
write;

(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 421f30ed1e95009450bdc7905bf3433ee806ea4f
Author: Zefram <zefram@fysh.org>
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;
 #endif
+   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.

12 years agodiagnostics.t: Restore test name removed by f0e510f
Father Chrysostomos [Thu, 28 Jun 2012 16:24:46 +0000 (09:24 -0700)]
diagnostics.t: Restore test name removed by f0e510f

12 years agoperldiag: Add missing regexp delims
Father Chrysostomos [Thu, 28 Jun 2012 04:32:08 +0000 (21:32 -0700)]
perldiag: Add missing regexp delims

12 years agopropagate context into overloads [perl #47119]
Jesse Luehrs [Wed, 27 Jun 2012 02:12:18 +0000 (21:12 -0500)]
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
possible.

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.

12 years agomore in depth tests for 8e4ecf2
Jesse Luehrs [Thu, 28 Jun 2012 05:39:11 +0000 (00:39 -0500)]
more in depth tests for 8e4ecf2

12 years agofix 4f8dbb2d
Jesse Luehrs [Wed, 27 Jun 2012 19:49:10 +0000 (14:49 -0500)]
fix 4f8dbb2d

12 years agoperly.*: update regen_perly checksum
Father Chrysostomos [Wed, 27 Jun 2012 19:49:28 +0000 (12:49 -0700)]
perly.*: update regen_perly checksum

12 years agoregen_perly.pl: support latest bison-2.5.1
Reini Urban [Thu, 21 Jun 2012 14:26:56 +0000 (09:26 -0500)]
regen_perly.pl: support latest bison-2.5.1

bison-2.5.1 adds less superfluous semicolons at the end of action blocks,
but works fine.

12 years agopp.c: Restore uninit warning to study
Father Chrysostomos [Wed, 27 Jun 2012 19:41:56 +0000 (12:41 -0700)]
pp.c: Restore uninit warning to study

Also, prevent a crash when SvCUR is used on a non-PV.

12 years agoclean up compilation warnings
Jesse Luehrs [Wed, 27 Jun 2012 18:40:49 +0000 (13:40 -0500)]
clean up compilation warnings

12 years agoadd a few comments to bisect-runner.pl docs
Jesse Luehrs [Wed, 27 Jun 2012 18:10:58 +0000 (13:10 -0500)]
add a few comments to bisect-runner.pl 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

12 years ago[Merge] [perl #109408] Documentation that refers to Perl 5 as new
Father Chrysostomos [Wed, 27 Jun 2012 16:15:27 +0000 (09:15 -0700)]
[Merge] [perl #109408] Documentation that refers to Perl 5 as new

Quoting Brian Fraser:

So.
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.

12 years ago[perl #109408] Documentation that refers to Perl 5 as new
Brian Fraser [Wed, 27 Jun 2012 15:55:08 +0000 (08:55 -0700)]
[perl #109408] Documentation that refers to Perl 5 as new

Regened known_pod_issues.dat for the previous commits.

12 years agoperlvar: #109408
Brian Fraser [Wed, 27 Jun 2012 15:54:06 +0000 (08:54 -0700)]
perlvar: #109408

12 years agoperlutil: #109408
Brian Fraser [Wed, 1 Feb 2012 02:43:19 +0000 (23:43 -0300)]
perlutil: #109408

12 years agoperluniintro: #109408
Brian Fraser [Wed, 27 Jun 2012 15:51:26 +0000 (08:51 -0700)]
perluniintro: #109408

12 years agoperlunifaq: #109408
Brian Fraser [Wed, 1 Feb 2012 02:42:58 +0000 (23:42 -0300)]
perlunifaq: #109408

12 years agoperlunicode: #109408
Brian Fraser [Wed, 1 Feb 2012 02:42:48 +0000 (23:42 -0300)]
perlunicode: #109408

12 years agoperltrap: #109408
Brian Fraser [Wed, 1 Feb 2012 02:41:55 +0000 (23:41 -0300)]
perltrap: #109408

12 years agoperlthrtut: #109408
Brian Fraser [Wed, 1 Feb 2012 02:41:45 +0000 (23:41 -0300)]
perlthrtut: #109408

12 years agoperlsub: #109408
Brian Fraser [Wed, 1 Feb 2012 02:41:24 +0000 (23:41 -0300)]
perlsub: #109408

12 years agoperlsec: #109408
Brian Fraser [Wed, 1 Feb 2012 02:41:16 +0000 (23:41 -0300)]
perlsec: #109408

12 years agoperlrun: #109408
Brian Fraser [Wed, 27 Jun 2012 15:45:13 +0000 (08:45 -0700)]
perlrun: #109408

12 years agoperlretut: #109408
Brian Fraser [Wed, 1 Feb 2012 02:40:59 +0000 (23:40 -0300)]
perlretut: #109408

12 years agoperlreftut: #109408
Brian Fraser [Wed, 1 Feb 2012 02:40:48 +0000 (23:40 -0300)]
perlreftut: #109408

12 years agoperlref: #109408
Brian Fraser [Wed, 1 Feb 2012 02:40:39 +0000 (23:40 -0300)]
perlref: #109408

12 years agoperlrebackslash: #109408
Brian Fraser [Wed, 1 Feb 2012 02:40:27 +0000 (23:40 -0300)]
perlrebackslash: #109408

12 years agoperlre: #109408
Brian Fraser [Wed, 1 Feb 2012 02:40:08 +0000 (23:40 -0300)]
perlre: #109408

12 years agoperlport: #109408
Brian Fraser [Wed, 1 Feb 2012 02:39:52 +0000 (23:39 -0300)]
perlport: #109408

12 years agoperlpod: #109408
Brian Fraser [Wed, 1 Feb 2012 02:39:46 +0000 (23:39 -0300)]
perlpod: #109408

12 years agoperlop: #109408
Brian Fraser [Wed, 1 Feb 2012 02:39:36 +0000 (23:39 -0300)]
perlop: #109408

12 years agoperlmod: #109408
Brian Fraser [Wed, 1 Feb 2012 02:39:27 +0000 (23:39 -0300)]
perlmod: #109408

12 years agoperllocale: #109408
Brian Fraser [Wed, 1 Feb 2012 02:39:06 +0000 (23:39 -0300)]
perllocale: #109408

12 years agoperlipc: #109408
Brian Fraser [Wed, 1 Feb 2012 02:38:51 +0000 (23:38 -0300)]
perlipc: #109408

12 years agoperlfunc: #109408
Brian Fraser [Wed, 27 Jun 2012 15:40:38 +0000 (08:40 -0700)]
perlfunc: #109408

12 years agoperlform: #109408
Brian Fraser [Wed, 1 Feb 2012 02:38:26 +0000 (23:38 -0300)]
perlform: #109408

12 years agoperldsc: #109408
Brian Fraser [Wed, 1 Feb 2012 02:38:15 +0000 (23:38 -0300)]
perldsc: #109408

12 years agoperldata: #109408
Brian Fraser [Wed, 1 Feb 2012 02:38:03 +0000 (23:38 -0300)]
perldata: #109408

12 years agoperlcall: #109408
Brian Fraser [Wed, 1 Feb 2012 02:37:46 +0000 (23:37 -0300)]
perlcall: #109408

12 years agodiag.t: Skip, rather than, TODO for cat tests
Father Chrysostomos [Wed, 27 Jun 2012 15:15:27 +0000 (08:15 -0700)]
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.

12 years agodiag.t: Don’t emit erroneous passing to-do tests
Father Chrysostomos [Wed, 27 Jun 2012 13:03:35 +0000 (06:03 -0700)]
diag.t: Don’t emit erroneous passing to-do tests

The __CATEGORIES__ entries by definition exist in perldiag.

12 years agodiagnostics.t: Tweak to get tests passing
Father Chrysostomos [Wed, 27 Jun 2012 13:01:29 +0000 (06:01 -0700)]
diagnostics.t: Tweak to get tests passing

I thought I had run it, hmm.

12 years ago[Merge] perldiag.pod severity/category cleanup
Father Chrysostomos [Wed, 27 Jun 2012 07:53:14 +0000 (00:53 -0700)]
[Merge] perldiag.pod severity/category cleanup

12 years agodiag.t: Check categories and severity
Father Chrysostomos [Wed, 27 Jun 2012 07:47:24 +0000 (00:47 -0700)]
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.

12 years agodiag.t: Use correct variable
Father Chrysostomos [Wed, 27 Jun 2012 07:45:34 +0000 (00:45 -0700)]
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.

12 years agodiag.t: Load test.pl in BEGIN
Father Chrysostomos [Wed, 27 Jun 2012 07:41:49 +0000 (00:41 -0700)]
diag.t: Load test.pl in BEGIN

so that parentheses can be omitted in tests to be added.

12 years agoperldiag: ‘Unicode surrogate is illegal’ is a default warning
Father Chrysostomos [Wed, 27 Jun 2012 07:36:24 +0000 (00:36 -0700)]
perldiag: ‘Unicode surrogate is illegal’ is a default warning

12 years agoperldiag: ‘Code point is not Unicode’ is a default warning
Father Chrysostomos [Wed, 27 Jun 2012 07:35:11 +0000 (00:35 -0700)]
perldiag: ‘Code point is not Unicode’ is a default warning

12 years agoperldiag: ‘Operation returns its argument’ is a default warning
Father Chrysostomos [Wed, 27 Jun 2012 07:32:27 +0000 (00:32 -0700)]
perldiag: ‘Operation returns its argument’ is a default warning

12 years agoperldiag: ‘...illegal for interchange’ is a default warning
Father Chrysostomos [Wed, 27 Jun 2012 07:30:36 +0000 (00:30 -0700)]
perldiag: ‘...illegal for interchange’ is a default warning

12 years agoperldiag: ‘UTF-16 surrogate U+%X’ is a default warning
Father Chrysostomos [Wed, 27 Jun 2012 07:11:09 +0000 (00:11 -0700)]
perldiag: ‘UTF-16 surrogate U+%X’ is a default warning

12 years agoperldiag: ‘Ambiguous use resolved as’ is always S
Father Chrysostomos [Wed, 27 Jun 2012 07:07:22 +0000 (00:07 -0700)]
perldiag: ‘Ambiguous use resolved as’ is always S

12 years agoperldiag: Add cat for Lost precision
Father Chrysostomos [Wed, 27 Jun 2012 06:17:43 +0000 (23:17 -0700)]
perldiag: Add cat for Lost precision

12 years agoperldiag: ‘Regexp modifier after "-"’ should have no cat
Father Chrysostomos [Wed, 27 Jun 2012 06:14:20 +0000 (23:14 -0700)]
perldiag: ‘Regexp modifier after "-"’ should have no cat

Only warnings have categories.

12 years agoperldiag: ‘Opening fh also as dir’ is a default warning
Father Chrysostomos [Wed, 27 Jun 2012 06:09:37 +0000 (23:09 -0700)]
perldiag: ‘Opening fh also as dir’ is a default warning

12 years agoperldiag: ‘Opening dirhandle also as file’ is a default warning
Father Chrysostomos [Wed, 27 Jun 2012 06:08:59 +0000 (23:08 -0700)]
perldiag: ‘Opening dirhandle also as file’ is a default warning

12 years agoperldiag: Add cat for Duplicate modifier
Father Chrysostomos [Wed, 27 Jun 2012 06:07:54 +0000 (23:07 -0700)]
perldiag: Add cat for Duplicate modifier

12 years agoperldiag: ‘invalid option -D%c’ is a warning
Father Chrysostomos [Wed, 27 Jun 2012 05:35:51 +0000 (22:35 -0700)]
perldiag: ‘invalid option -D%c’ is a warning

12 years agoperldiag: Don’t use L<<>>
Father Chrysostomos [Wed, 27 Jun 2012 05:34:28 +0000 (22:34 -0700)]
perldiag: Don’t use L<<>>

diagnostics.pm isn’t smart enough to handle it, and programming it
for one case seems like overkill.

12 years agoperldiag: Add cat for PERL_SIGNALS illegal
Father Chrysostomos [Wed, 27 Jun 2012 05:34:20 +0000 (22:34 -0700)]
perldiag: Add cat for PERL_SIGNALS illegal

12 years agoperldiag: ‘Unbalanced context’ is a default warning
Father Chrysostomos [Wed, 27 Jun 2012 05:26:53 +0000 (22:26 -0700)]
perldiag: ‘Unbalanced context’ is a default warning

12 years agoperldiag: ‘Unbalanced tmps’ is a default warning
Father Chrysostomos [Wed, 27 Jun 2012 05:26:15 +0000 (22:26 -0700)]
perldiag: ‘Unbalanced tmps’ is a default warning

12 years agoperldiag: ‘Unbalanced saves’ is a default warning
Father Chrysostomos [Wed, 27 Jun 2012 05:25:54 +0000 (22:25 -0700)]
perldiag: ‘Unbalanced saves’ is a default warning

12 years agoperldiag: ‘Unbalanced scopes’ is a default warning
Father Chrysostomos [Wed, 27 Jun 2012 05:25:37 +0000 (22:25 -0700)]
perldiag: ‘Unbalanced scopes’ is a default warning

12 years agoperldiag: ‘Variable is not imported’ is a default warning
Father Chrysostomos [Wed, 27 Jun 2012 05:24:56 +0000 (22:24 -0700)]
perldiag: ‘Variable is not imported’ is a default warning

12 years agoperldiag: ‘Scalars leaked’ is a warning
Father Chrysostomos [Wed, 27 Jun 2012 05:22:41 +0000 (22:22 -0700)]
perldiag: ‘Scalars leaked’ is a warning

12 years agoperldiag: Add cat for ‘Attempt to set length of freed array’
Father Chrysostomos [Wed, 27 Jun 2012 05:17:15 +0000 (22:17 -0700)]
perldiag: Add cat for ‘Attempt to set length of freed array’

12 years agoSquash repetitive code in pp.c:S_delete_local
Father Chrysostomos [Wed, 27 Jun 2012 04:31:53 +0000 (21:31 -0700)]
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.

12 years agoNull HeVAL and local delete → crash
Father Chrysostomos [Wed, 27 Jun 2012 03:21:29 +0000 (20:21 -0700)]
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 746f6409), but missed localised deletions.

12 years agoMake pp.c:pp_srand slightly less repetitive
Father Chrysostomos [Wed, 27 Jun 2012 03:05:55 +0000 (20:05 -0700)]
Make pp.c:pp_srand slightly less repetitive

12 years agoMake srand treat "-1" as -1
Father Chrysostomos [Wed, 27 Jun 2012 01:04:02 +0000 (18:04 -0700)]
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.

12 years agoMake srand respect magic
Father Chrysostomos [Wed, 27 Jun 2012 00:41:40 +0000 (17:41 -0700)]
Make srand respect magic

It was returning U+FFFD for negative numbers, but only for non-magical
variables.

12 years agoAIX Hints file change
Darin McBride [Mon, 25 Jun 2012 23:36:32 +0000 (17:36 -0600)]
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 <h.m.brand@xs4all.nl>
12 years agofix off-by-one when restoring hashes [perl #73972]
Jesse Luehrs [Tue, 26 Jun 2012 21:47:51 +0000 (16:47 -0500)]
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
things.

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.

12 years agoRemove C++isms from doio.c
Steve Hay [Tue, 26 Jun 2012 19:52:25 +0000 (20:52 +0100)]
Remove C++isms from doio.c

(Introduced by c2fd40cb02 and not tolerated by VC++ compiling a C file.)

12 years agoperlrun typos from argrath@ub32.org [perl #113852]
Jesse Luehrs [Tue, 26 Jun 2012 18:31:28 +0000 (13:31 -0500)]
perlrun typos from argrath@ub32.org [perl #113852]

12 years ago[perl #112990] Simplify kill implementation and docs
Darin McBride [Tue, 26 Jun 2012 16:24:56 +0000 (09:24 -0700)]
[perl #112990] Simplify kill implementation and docs

Clean up kill implementation and clear up the docs in perlfunc to be less
ambiguous and encompass more of its behaviour.

a)   kill -INT => $pid;

was surprisingly doing a "kill 0, $pid" instead of being the same as "kill -2,
$pid" (killing the process group for $pid with an interrupt).  Now negative
signal names will be allowed and be the same as if the name was replaced with
the signal number it represents.

b) remove all calls to killpg() as killpg is defined in terms of kill anyway.

c) Clarify the use of signal names vs numbers in perlfunc so that using names
is not so well hidden, as well as explaining the usage of negative signal
numbers as well as negative process IDs.

12 years ago[perl #113812] Handle null CvOUTSIDE in cv_clone
Father Chrysostomos [Tue, 26 Jun 2012 16:23:06 +0000 (09:23 -0700)]
[perl #113812] Handle null CvOUTSIDE in cv_clone

Commit a0d2bbd stopped closures from hanging on to their
enclosing subs.

This means that the outer sub can be freed before the closure.  Since
it is only the outer sub that references the closure prototype (in a
'&' entry in its pad), when the outer sub is freed the closure proto-
type goes with it.  Now if that closure itself contains a closure
(more precisely, a closure prototype in its pad, referenced by an
anoncode op), that inner closure prototype’s CvOUTSIDE points to the
first closure prototype.  When that first closure prototype is freed
the innermost closure prototype has its CvOUTSIDE set to whatever the
outermost sub’s CvOUTSIDE was set to, which could be null if it is
in its own file.  So when the first closure is called, it passes to
cv_clone a closure prototype with no CvOUTSIDE.

cv_clone used to crash if CvOUTSIDE was null.

Example:
$ cat foo.pl

# the main CV of the file is the outer sub in this case
my $x
$first_closure = sub {
    $inner_closure = sub { $x }
}
$ perl -e 'require "./foo.pl"; $first_closure->()'
Bus error

This commit makes it use find_runcv when CvOUTSIDE is null.

12 years agoperldiag: Two space after dots
Father Chrysostomos [Tue, 26 Jun 2012 15:28:13 +0000 (08:28 -0700)]
perldiag: Two space after dots

Also rewrap for slightly better splain output