platform/upstream/perl.git
11 years agosilence warning in toke.c charnames support
Yves Orton [Fri, 26 Oct 2012 09:41:10 +0000 (11:41 +0200)]
silence warning in toke.c charnames support

In a C sprintf the expectation is that * parameters are type "int".

11 years agoRT #115488 cxstack -1 at nested scan_heredoc
Reini Urban [Fri, 26 Oct 2012 21:44:57 +0000 (16:44 -0500)]
RT #115488 cxstack -1 at nested scan_heredoc

print <<E1 eq "foo\n\n" ? "ok 19\n" : "not ok 19\n";
@{[ <<E2 ]}
foo
E2
E1
checked for a CxTYPE(cx) == CXt_EVAL with an invalid cxstack -1, detected by asan.

11 years agoAllow cow with $magic = $hashkey
Father Chrysostomos [Fri, 26 Oct 2012 23:23:11 +0000 (16:23 -0700)]
Allow cow with $magic = $hashkey

This was brought up in
<https://rt.perl.org/rt3/Ticket/Display.html?id=114820#txn-1165898>.

There is no reason we cannot assigned a shared hash key to a magical
scalar.  The only destination flag in CAN_COW_MASK that makes COW
assignment questionable is SVf_BREAK.  If such an assignment can hap-
pen (and I don’t believe it actually can), we will end up with unbal-
anced string table warnings.  So change the CAN_COW_MASK check to an
SVf_BREAK check.

11 years agoMake private variable static in regexec.c.
Craig A. Berry [Fri, 26 Oct 2012 15:01:13 +0000 (10:01 -0500)]
Make private variable static in regexec.c.

11 years agoDe-globalize regcomp inversion lists.
Craig A. Berry [Fri, 26 Oct 2012 21:33:26 +0000 (16:33 -0500)]
De-globalize regcomp inversion lists.

These lists are declared at file scope so will be global unless
made static.  Actual use of these lists is via the various PL_xxx
global variables that point to them and that (except for
NonL1_Perl_Non_Final_Folds_invlist) are initialized in
Perl_re_op_compile in regcomp.c (but not in its incarnation as
ext/re/re_comp.c).

So change the lists to be static, and also skip declaring and
initializing them in ext/re/re_comp.c except for the one case that
is actually used in the extension version.

11 years agostart to make ext/B work with 5.14.x
David Mitchell [Fri, 26 Oct 2012 09:14:06 +0000 (10:14 +0100)]
start to make ext/B work with 5.14.x

This fixes up a couple of test files to work under 5.14.x.
Lots more needs fixing up to make the whole distribution work
under 5.14.x, but I've lost the will for now.,

11 years agoB.xs: move all B::*OP methods to B::OP::next
David Mitchell [Thu, 25 Oct 2012 13:48:06 +0000 (14:48 +0100)]
B.xs: move all B::*OP methods to B::OP::next

The previous commit moved all B::*OP methods capable of using direct field
offsets into next(). This commit moves the remaining B::*OP methods onto
it too (apart from oplist(), which returns a list rather than a single
item).

This simplifies the code, reduces the object size, and will also make it
easier to add an overlay facility, which will be coming soon.

11 years agoB.xs: rationalise all methods aliased to next()
David Mitchell [Wed, 24 Oct 2012 20:53:38 +0000 (21:53 +0100)]
B.xs: rationalise all methods aliased to next()

The code for B::OP::next() actually implements all B::*OP::* methods
that work by directly returning a field at a known offset in the OP
structure. Methods that can't do direct access usually have their own
body, rather than sharing with next().

However, whether a method can do direct field access is often dependent on
threading and/or perl version; so the same method is sometimes implemented
by next(), and sometimes by one or more individual method bodies. This is
all very confusing.

This commit takes all methods that *may* be implemented within next(),
and makes them always implemented by next(), using a table of data that
describes each method's offset, or -1 if it needs special handling.

This makes it a lot easier to see what's going on, and will also make it
easier to add an overlay facility, which will be coming soon.

The following commit will consolidate the remaining B::*OP methods within
next().

11 years agoext/B: remove pre-5.10 support
David Mitchell [Wed, 24 Oct 2012 17:10:22 +0000 (18:10 +0100)]
ext/B: remove pre-5.10 support

Expunge all conditional code that supports 5.6.x through 5.9.x,
making 5.10.0 the oldest release notionally supported.
This simplifies things considerably.

See p5p thread starting at
    Message-ID: <20121018122941.GE1908@iabyn.com>

11 years agomake ext/B work with 5.16.x
David Mitchell [Wed, 24 Oct 2012 14:50:25 +0000 (15:50 +0100)]
make ext/B work with 5.16.x

The modules and tests under ext/B are notionally supposed to be
portable to older perl versions; in practice, extensive bit-rot
has occurred; often attempts have been made to add version-specific
code, which haven't actually been tested against older perl versions.

This commit does the minimum necessary to get the tests under ext/B
working with 5.16.0 and 5.16.1, threaded and unthreaded. It makes no
assertions as to whether it will work with the rest of the 5.16.x test
suite.

The side effects of this fix-up are:

* a facility has been added to OptreeCheck.pm (the test module that
checks the Concise output of various constructs) that allows
version-specific matching, e.g.:

    # 4  <$> const(PV "junk") s*      < 5.017002
    # 4  <$> const(PV "junk") s*/FOLD >=5.017002

* OptreeCheck.pm's skip mechanism was found to be broken: checkOptree()
allows you to specify skipping, but only skipped one test, even though
a single call to checkOptree() could generate multiple lines of test
output.

11 years agoBetter documentation for internal SV types
Father Chrysostomos [Fri, 26 Oct 2012 15:32:23 +0000 (08:32 -0700)]
Better documentation for internal SV types

11 years agofix a compile warning and refactor some diagnostics in regexec.c
Yves Orton [Sun, 21 Oct 2012 13:04:47 +0000 (15:04 +0200)]
fix a compile warning and refactor some diagnostics in regexec.c

11 years agoimprove diagnostics of dbm_filter_util.pl by using Data::Dumper::qquote
Yves Orton [Wed, 29 Aug 2012 07:38:07 +0000 (09:38 +0200)]
improve diagnostics of dbm_filter_util.pl by using Data::Dumper::qquote

We are testing things like packed strings. If we output the bytes raw
via diag we upset terminal layers expecting utf8, and generally output
unreadable garbage regardless. So use Data::Dumper::qqoute() to
preprocess diagnositics output.

11 years agoFix hash ordering dependency in DBM_Filter/t/int32.t
Yves Orton [Wed, 29 Aug 2012 07:47:03 +0000 (09:47 +0200)]
Fix hash ordering dependency in DBM_Filter/t/int32.t

Under the filtering rules in place undef() and "" and 0 map to a
packed representation of 0.

In the StoreData call we pass in an anonymous perl (untied) hash
containing an "undef" key (which is actually treated as "") with a
value of undef(), along with a key 0 with a value of 1. This hash
will store both values as distinct key/value pairs.

When this hash is used to set up the *tied* %h1 hash both the "" key
and the 0 key will be converted into the same packed value "\0\0\0\0",
which means that whichever is last in the each() of the input hashref
will be the one stored in %h1.

This means the test breaks if we change the PL_hash_seed or the hash
implementation in such a way that "" comes before 0 in the keys of
the hash.

This patch changes the input test hash to verify that undef() => 1 is
treated the same as 0 => 1, and eliminates the potential key collision.
The reason this test was reliable in the wild is that pretty well all
perls use a 0 hash seed and the same hash function.

This test probably would have broken in other enviornments as well.

11 years agofix hash key ordering dependency in t/warnings.t
Yves Orton [Mon, 27 Aug 2012 06:52:51 +0000 (08:52 +0200)]
fix hash key ordering dependency in t/warnings.t

Hash seed randomization causes these tests to fail occasionally.

11 years agofix a hash order dependency in t/re_funcs_u.t
Yves Orton [Tue, 28 Aug 2012 07:23:15 +0000 (09:23 +0200)]
fix a hash order dependency in t/re_funcs_u.t

11 years agofix hash order dependency in ext/B/t/b.t
Yves Orton [Mon, 27 Aug 2012 06:53:54 +0000 (08:53 +0200)]
fix hash order dependency in ext/B/t/b.t

Hash seed randomization causes these tests to fail occasionally.

11 years agofix a very subtle hash ordering dependency in op/smartkve.t
Yves Orton [Tue, 28 Aug 2012 08:15:40 +0000 (10:15 +0200)]
fix a very subtle hash ordering dependency in op/smartkve.t

Currently our hash implementation is order dependent on insertion.

When two keys collide and have to be stored in the same bucket the
order in which they are inserted into the hash will govern the order
in which they are fetched out by things like keys() and values().

This means that a copy of such a hash may be different. It is possible
this can be fixed with a low cost, but until then you cannot rely on
two hashes with the same keys having the same ordering of those keys

Depending on the hash algorithm and the seed values used this test
would fail. By changing it so there is one initial hash and then all
tests are done on copies of that hash we avoid the problem.

11 years agofix hash key ordering dependency in t/op/defins.t
Yves Orton [Mon, 27 Aug 2012 06:51:39 +0000 (08:51 +0200)]
fix hash key ordering dependency in t/op/defins.t

These tests break if we change the hash function or
randomly initialize the hash seed.

11 years agoperl5180delta: List mods broken by padlist changes
Father Chrysostomos [Fri, 26 Oct 2012 01:11:11 +0000 (18:11 -0700)]
perl5180delta: List mods broken by padlist changes

that have at least five dependents.

11 years agoRe-enable static op allocation with obslab
Reini Urban [Sun, 21 Oct 2012 23:56:11 +0000 (18:56 -0500)]
Re-enable static op allocation with obslab

obslab and the removal of the op_latefree logic, which allowed static
ops, removed support for the compiler modules, which allocates ops statically.
Add an op_static flag to replace the old latefree(d) op_free logic.

11 years agooptimize memory wrap croaks, often used in MEM_WRAP_CHECK
Daniel Dragan [Wed, 24 Oct 2012 20:15:51 +0000 (16:15 -0400)]
optimize memory wrap croaks, often used in MEM_WRAP_CHECK

Most perls are built with PERL_MALLOC_WRAP. This causes MEM_WRAP_CHECK
macro to perform some checks on the requested allocation size in macro
Newx. The checks are performed at the caller, not in the callee (for me
on Win32 perl the callee in Newx is Perl_safesysmalloc) of Newx.
If the check fails a "Perl_croak_nocontext("%s",PL_memory_wrap)" is done.
In x86 machine code,
"if(bad_alloc) Perl_croak_nocontext("%s",PL_memory_wrap); will be written
as "cond jmp ahead ~15 bytes", "push const pointer", "push const pointer",
"call const pointer". For each Newx where the allocation amount was not a
constant (constant folding would remove the croak memory wrap branch
compleatly), the branch takes 15-19 bytes depending on x86 compiler. There
are about 80 Newx'es in the interp (win32 dynamic linking perl) that do
the memory wrap check and have a
"Perl_croak_nocontext("%s",PL_memory_wrap)" in them after all optimizations
by the compiler.

This patch reduces the memory wrap branch from 15-19 to
5 bytes on x86. Since croak_memory_wrap is a static and a noreturn, a
compiler with IPO may optimize the whole branch to "cond jmp 32 bits
relative" at each callsite. A less optimal complier may do "cond jmp 8 bits
relative (jump past the "call S_croak_memory_wrap" instruction),
then "call S_croak_memory_wrap". Both ways are better than the current
situation. The reason why croak_memory_wrap is a static and not an export
is that the compiler has more opportunity to optimize/reduce the impact of
the memory wrap branch at the call site if the target is in the same image
rather than in a different image, which would require using the platform
specific dynamic linking mechanism/export table/etc, which often requires
a new stack frame per ABI of the platform. If a dynamic linked XS module
does not use S_croak_memory_wrap it will be removed from the image by the
C compiler. If it is included in the XS image, it is a very small block
of code and a 3 byte string litteral. A CPU cache line is typically
32 or 64 bytes and a memory read is typically 16. Cutting the
instructions by 10 to 16 bytes out of "hot code" (10 of the ~80 call
sites are pp_*) is a worthy goal. In a few places the memory wrap croak is
used explictly, not from a MEM_WRAP_CHECK, this patch converts those to use
the static. If PERL_MALLOC_WRAP is undef, there are still a couple uses of
croak memory wrap, so do not keep S_croak_memory_wrap in a ifdef
PERL_MALLOC_WRAP. Also see
http://www.nntp.perl.org/group/perl.perl5.porters/2012/10/msg194383.html
and [perl #115456].

11 years ago[perl #115440] Fix various leaks with fatal FETCH
Father Chrysostomos [Thu, 25 Oct 2012 20:00:55 +0000 (13:00 -0700)]
[perl #115440] Fix various leaks with fatal FETCH

Various pieces of code were creating an SV and then assigning to it
from a value that might be magical.  If the source scalar is magical,
it could die when magic is called, leaking the scalar that would have
been assigned to.

So we call get-magic before creating the new scalar, and then use a
non-magical assignment.

Also, anonhash and anonlist were doing nothing to protect the aggre-
gate if an argument should die on FETCH, resulting in a leak.

11 years agotest memory leaks around magic get dieing
Ruslan Zakirov [Tue, 23 Oct 2012 16:04:37 +0000 (20:04 +0400)]
test memory leaks around magic get dieing

Leaks happen when newSV is allocated, but then
copy operaton dies in get magic leaving not freed
scalar around.

Most of new tests check leaks in code path executing
sv_mortalcopy which has such problem. Two cases has
the same pattern, but don't use sv_mortalcopy. Can be
found with the following command:

grep -n -A3 'newSV\>' *.c | grep -B3 sv_set

11 years agotoke.c: Avoid unnecessary uninitialized value msgs
Karl Williamson [Thu, 25 Oct 2012 03:35:06 +0000 (21:35 -0600)]
toke.c: Avoid unnecessary uninitialized value msgs

\N{uknown character} is now a syntax error.  It also generates a "Use of
uninitialized value" message that is redundant (and confusing) with the
unknown character message.

11 years agocharnames pod: Note that \N{} doesn't accept interpolated $vars
Karl Williamson [Wed, 24 Oct 2012 23:17:35 +0000 (17:17 -0600)]
charnames pod: Note that \N{} doesn't accept interpolated $vars

11 years agoadd missing closing parens to documentation
Ricardo Signes [Wed, 24 Oct 2012 22:51:06 +0000 (18:51 -0400)]
add missing closing parens to documentation

reported by Joaquin Ferrero in [perl #115460] and [perl #115458]

11 years agotest.pl: Fix description of how PREFIX works
Karl Williamson [Wed, 24 Oct 2012 16:38:53 +0000 (10:38 -0600)]
test.pl: Fix description of how PREFIX works

11 years agocharnames.t: Add names for some tests
Karl Williamson [Wed, 24 Oct 2012 16:32:26 +0000 (10:32 -0600)]
charnames.t: Add names for some tests

11 years agotest.pl: Allow NAME to be used with --FILE--
Karl Williamson [Wed, 24 Oct 2012 16:28:55 +0000 (10:28 -0600)]
test.pl: Allow NAME to be used with --FILE--

Prior to this patch the --FILE-- feature of test.pl could not be used on
tests that had a name.  This is because --FILE-- is expecting a \n
before it, and NAME strips that off.  This commit just makes the \n
optional.

11 years agoMake \N{unknown char} a syntax error
Karl Williamson [Wed, 24 Oct 2012 16:02:54 +0000 (10:02 -0600)]
Make \N{unknown char} a syntax error

Previously, it was a warning with the REPLACEMENT CHARACTER substituted.
Unicode recommends that it be a syntax error, and any code that used
this had to be buggy since the REPLACEMENT CHARACTER has no other use in
Unicode.

11 years agocharnames.t: Fix erroneous interpolation of \N{}
Karl Williamson [Wed, 24 Oct 2012 15:30:33 +0000 (09:30 -0600)]
charnames.t: Fix erroneous interpolation of \N{}

This is supposed to print as-is, not interpolate.

11 years agotoke.c: Indent properly
Karl Williamson [Sun, 21 Oct 2012 17:10:32 +0000 (11:10 -0600)]
toke.c: Indent properly

11 years agoregcomp.c: White-space only; no code changes
Karl Williamson [Wed, 24 Oct 2012 03:39:09 +0000 (21:39 -0600)]
regcomp.c: White-space only; no code changes

This outdents code that was previously in an inner block

11 years agoregcomp.c: Remove dead code
Karl Williamson [Wed, 24 Oct 2012 03:36:00 +0000 (21:36 -0600)]
regcomp.c: Remove dead code

Multi-char folds in bracketed character classes are now handled
differently than before commit 9d53c4576e551530162e7cd79ab72ed81b1e1a0f.
This code was overlooked in the clean up commit
e0193e472b025d41438e251be622aad42c9af9cc.

11 years agoregexec.c: Nano optimization: reverse 'if' order
Karl Williamson [Wed, 24 Oct 2012 03:32:46 +0000 (21:32 -0600)]
regexec.c: Nano optimization: reverse 'if' order

It's more likely that the code point is invariant than that the target
is UTF-8, so test it first.  This works even if the target isn't UTF-8.

11 years agoregexec.c: Remove dead code
Karl Williamson [Wed, 24 Oct 2012 03:25:30 +0000 (21:25 -0600)]
regexec.c: Remove dead code

An ANYOF node now no longer matches more than one character, since
9d53c4576e551530162e7cd79ab72ed81b1e1a0f.  This code was overlooked in
the clean up commit e0193e472b025d41438e251be622aad42c9af9cc.  Since the
maximum match is 1 character, there is no point in passing a ptr that
was set to indicate how far the match went, so that parameter is
removed.

11 years agoregexec.c: Add/modify NOTREACHED asserts.
Karl Williamson [Wed, 24 Oct 2012 03:17:32 +0000 (21:17 -0600)]
regexec.c: Add/modify NOTREACHED asserts.

11 years agoregexec.c: Silence compiler warning
Karl Williamson [Wed, 24 Oct 2012 03:11:49 +0000 (21:11 -0600)]
regexec.c: Silence compiler warning

Some compilers are saying that c1 and c2 in this routine are not
initialized.  I hand-verified that there really is no path through the
routine that uses either of these before setting, so this is a compiler
issue.  Nonetheless, its best to silence the warning.

11 years agofork() should return undef on failure, even in list context
Jesse Luehrs [Tue, 23 Oct 2012 19:32:22 +0000 (14:32 -0500)]
fork() should return undef on failure, even in list context

11 years agoMove more X's off the PUSH into EXTEND's
Steffen Mueller [Mon, 22 Oct 2012 18:56:45 +0000 (20:56 +0200)]
Move more X's off the PUSH into EXTEND's

Generally speaking, if there's branching and each branch may contain a
varying number of PUSH operations, EXTENDing to the longest number of
items should generally be more efficient since the stack will eventually
grow to a relatively steady state, but the extra branching incurred by
the X's will cost every time.

11 years agoext/re: Optimize XPUSH's to EXTEND(), PUSH,...
Steffen Mueller [Mon, 22 Oct 2012 18:20:05 +0000 (20:20 +0200)]
ext/re: Optimize XPUSH's to EXTEND(), PUSH,...

11 years agoData::Dumper: Optimize XPUSH's to EXTEND(), PUSH,...
Steffen Mueller [Mon, 22 Oct 2012 18:19:29 +0000 (20:19 +0200)]
Data::Dumper: Optimize XPUSH's to EXTEND(), PUSH,...

11 years agoPushing to stack after EXTEND doesn't require *X*PUSH
Steffen Mueller [Mon, 22 Oct 2012 13:47:04 +0000 (15:47 +0200)]
Pushing to stack after EXTEND doesn't require *X*PUSH

This just converts a few (m)?XPUSH(s|p|...) to (m)?PUSH(s|p|...) that
follow an explicit call to EXTEND.

11 years agoUpdate CPANPLUS-Dist-Build to CPAN version 0.64
Chris 'BinGOs' Williams [Sun, 21 Oct 2012 20:26:55 +0000 (21:26 +0100)]
Update CPANPLUS-Dist-Build to CPAN version 0.64

  [DELTA]

  0.64 Sat Oct 20 23:21:36 BST 2012
    - Update Module::Install, no functional changes.

11 years agoSynchronilise Module-CoreList in Maintainers.pl with CPAN
Chris 'BinGOs' Williams [Sun, 21 Oct 2012 20:24:14 +0000 (21:24 +0100)]
Synchronilise Module-CoreList in Maintainers.pl with CPAN

11 years agoProper skippage for sanity check in B::Deparse's core.t.
Craig A. Berry [Sun, 21 Oct 2012 14:33:53 +0000 (09:33 -0500)]
Proper skippage for sanity check in B::Deparse's core.t.

The check was being skipped when PERL_CORE was not defined or if
running on VMS, but the test count was not being updated, so it
would be wrong and cause the test to fail in these cases.  So use
the standard skip facility to handle the skipping.  Plus the test
works fine on VMS so go ahead and run it there as well.

11 years agoPATCH: [perl #115242] Test
Dagfinn Ilmari MannsĂĄker [Sun, 21 Oct 2012 03:43:20 +0000 (21:43 -0600)]
PATCH: [perl #115242] Test

This commit is a test for this bug.

11 years agoPATCH: [perl #115242]: /m and regex optimizer bug.
Karl Williamson [Sat, 20 Oct 2012 22:55:26 +0000 (16:55 -0600)]
PATCH: [perl #115242]: /m and regex optimizer bug.

This commit turns off string length checking for /m.  A string longer
than the calculated maximum can match under /m because, for example,
trailing new lines in it can come after the $ anchor.

A test for this condition is in the next commit.

11 years agoperlapi.pod: Clarify what a parameter means
Karl Williamson [Sat, 20 Oct 2012 22:22:05 +0000 (16:22 -0600)]
perlapi.pod: Clarify what a parameter means

11 years agofold_grind.t: Set $| if debugging
Karl Williamson [Sat, 20 Oct 2012 22:19:49 +0000 (16:19 -0600)]
fold_grind.t: Set $| if debugging

11 years agoAdd comment
Karl Williamson [Sat, 20 Oct 2012 22:18:32 +0000 (16:18 -0600)]
Add comment

11 years agoregen/mk_PL_charclass.pl: Move code to subroutine
Karl Williamson [Sat, 20 Oct 2012 22:15:48 +0000 (16:15 -0600)]
regen/mk_PL_charclass.pl: Move code to subroutine

This code is for just this property and was kludged in to be executed in
the general loop.  It makes more sense to it to be in the subroutine
that handles the property that was just added in a prior commit.

It also changes the output slightly.  The Latin1 sharp S isn't a
non-final fold, unlike what was said previously

11 years agomktables: Don't generate no-longer needed tables
Karl Williamson [Sat, 20 Oct 2012 22:00:21 +0000 (16:00 -0600)]
mktables: Don't generate no-longer needed tables

These internal tables were only used in regen code, and those have been
modified to not use them; so can be removed.

11 years agoregen/mk_PL_charclass.pl: White-space only; no code changes
Karl Williamson [Sat, 20 Oct 2012 21:59:33 +0000 (15:59 -0600)]
regen/mk_PL_charclass.pl: White-space only; no code changes

Indent a newly formed block

11 years agoregen/mk_PL_charclass.pl: Generate our own tables for certain properties
Karl Williamson [Sat, 20 Oct 2012 21:25:18 +0000 (15:25 -0600)]
regen/mk_PL_charclass.pl: Generate our own tables for certain properties

The two affected inversion lists are used only in regen.  It is wasteful
to have mktables generate these, as they aren't used elsewhere and just
take up disk space.

11 years agoregen/mk_invlists.pl: Generate our own tables for certain properties
Karl Williamson [Sat, 20 Oct 2012 21:13:22 +0000 (15:13 -0600)]
regen/mk_invlists.pl: Generate our own tables for certain properties

The two affected inversion lists are used only in regen.  It is wasteful
to have mktables generate these, as they aren't used elsewhere and just
take up disk space.

11 years agoExclude signal-related symbols on VMS without home-grown signalling.
Craig A. Berry [Sat, 20 Oct 2012 22:27:01 +0000 (17:27 -0500)]
Exclude signal-related symbols on VMS without home-grown signalling.

config.h defines KILL_BY_SIGPRC when we are using our own signal
handling functions based on the sys$sigprc system service.  But
when *not* doing that, and since using makedef.pl to define our
exportable symbols, we have not properly excluded the symbols
involved in the home-grown implementation.  It's not a common
configuration, but since it's configurable, it should work, and
now it will.

11 years agoregen/regcharclass.pl: White space only; no code changes
Karl Williamson [Sat, 20 Oct 2012 19:10:41 +0000 (13:10 -0600)]
regen/regcharclass.pl: White space only; no code changes

Indent as a result of a new block

11 years agoregen/regcharclass.pl: Generate better code for some macros
Karl Williamson [Sat, 20 Oct 2012 19:04:51 +0000 (13:04 -0600)]
regen/regcharclass.pl: Generate better code for some macros

This commit revamps the recently added function calculate_mask() to not
just work to give a single mask/compare value for its input and fail if
there are none, but to return a list of masks/compares when the set can
be split up into subsets that each can be represented by a mask/compare.
If this list taken as a whole yields fewer branches than what we get
otherwise, it is better code, and is used.

Said another way, what we had there before was all or nothing; this
works to improve things even if we can't do it all.

11 years agoregen/regcharclass.pl: White-space only; no code changes
Karl Williamson [Sat, 20 Oct 2012 17:27:44 +0000 (11:27 -0600)]
regen/regcharclass.pl: White-space only; no code changes

This outdents some code that is no longer contained in a block, and
reflows the comments to 80 columns;

11 years agoregen/regcharclass.pl: Refactor a 'return' slightly
Karl Williamson [Sat, 20 Oct 2012 17:25:50 +0000 (11:25 -0600)]
regen/regcharclass.pl: Refactor a 'return' slightly

Instead of having a common return at the end of the function, this does
that same return at an intermediate point.  The reason is that a future
commit will change the final return somewhat, and this seemed the
clearest way to go.

11 years agoTweak psect attributes in VMS initialization code.
Craig A. Berry [Sat, 20 Oct 2012 03:16:17 +0000 (22:16 -0500)]
Tweak psect attributes in VMS initialization code.

noexe is the default and older compilers can't process it, so don't
explicitly specify it.

nopic is mandatory but non-default on VAX and is silently ignored
on Alpha and Itanium, so go ahead and specify it explicitly.

11 years agoShorten command length when generating linker options file.
Craig A. Berry [Sat, 20 Oct 2012 02:38:04 +0000 (21:38 -0500)]
Shorten command length when generating linker options file.

The MINIPERL macro expands to 40 characters longer than the
MINIPERLQ macro in order to include Cwd, but Cwd isn't needed
when doing a simple one-liner, and the extra length can make us
exceed the command buffer on older VMS systems.

11 years agoAdd epigraph link for 5.17.5
Florian Ragwitz [Sat, 20 Oct 2012 17:47:33 +0000 (14:47 -0300)]
Add epigraph link for 5.17.5

11 years agoMerge branch 'post-release-5.17,5' into blead
Florian Ragwitz [Sat, 20 Oct 2012 17:46:19 +0000 (14:46 -0300)]
Merge branch 'post-release-5.17,5' into blead

* post-release-5.17,5:
  Bump the version to 5.17.6
  Add a new perldelta
  Add the 5.17.5 epigraph
  Add 5.17.5 to perlhist
  Update Module::CoreList for 5.17.5
  Finalise perldelta

Conflicts:
pod/perldelta.pod

11 years agofix off-by-one error in key detection logic for uninitialized warnings
Yves Orton [Sat, 20 Oct 2012 12:54:09 +0000 (14:54 +0200)]
fix off-by-one error in key detection logic for uninitialized warnings

Prior to this patch we would not look at the 0th bucket.

11 years agoadd a TODO test for uninitialized warning hash bucket fencepost error
Yves Orton [Sat, 20 Oct 2012 11:45:02 +0000 (13:45 +0200)]
add a TODO test for uninitialized warning hash bucket fencepost error

This test assumes that a fresh hash with one key with keys from
0 to 20 will put a key in every bucket in the hash. Had we better
hash introspection rules we could write this differently and more
correctly. Nevertheless this shows the off-by-one error in key
detection used by the uninitialized warnings logic on my box.

Next patch will untodo the test and fix the bug.

11 years agoNote CPAN upgrade in perldelta.
Craig A. Berry [Fri, 19 Oct 2012 20:44:45 +0000 (15:44 -0500)]
Note CPAN upgrade in perldelta.

11 years agoUdate CPAN to CPAN version 1.99_51
Craig A. Berry [Fri, 19 Oct 2012 20:09:16 +0000 (15:09 -0500)]
Udate CPAN to CPAN version 1.99_51

  * release 1.99_51

  * RT #79969: fix incompatibilities with VMS (Craig Berry)

  * bugfix: distroprefs of type pl/args were dropped for 'perl Build.PL'

  * RT #73742: watch build_dirs and react calmly when one has gone lost

11 years agoregexec.c: regrepeat() change default: handling
Karl Williamson [Fri, 19 Oct 2012 17:57:16 +0000 (11:57 -0600)]
regexec.c: regrepeat() change default: handling

The core of this function is a large switch() statement.  Prior to this
commit, the default: case of it assumed that this meant that the
node-type was a zero-length node.  It is safer to explicitly mention
all the cases you expect to handle, and have the default fail so that
you know sooner that you forgot to handle a situation.  That is how all
other switch statements in this file are set up, and now this one is
too.

I added cases for all the node types in regcomp.c that are SIMPLE, and
hence could conceivably be handled by regrepeat(), and changed the
default: case to croak.

I considered doing an #ifdef DEBUGGING around this, but no other
switches() in the file do so, so I followed that paradigm.

11 years agoregex: Make \R simple again.
Karl Williamson [Fri, 19 Oct 2012 17:40:24 +0000 (11:40 -0600)]
regex: Make \R simple again.

Commit 565fc1bb88638c2490cdab7a1055007f6b2d577c was based on my
misunderstanding of what regrepeat() operates on.  It is designed to
operate on nodes that are quantifiable without having to be
parenthesized.  So, in 'a?', the node generated for 'a' is quantifiable
as-is, but if you want to quantify 'ab', you have to parenthesize them,
like '(?:ab)?'

\R is such a node, since you can say things like '\R+'.  There was
indeed a bug, and that commit fixed it, but suboptimally.

This patch essentially reverts the commit mentioned above, and solves
the problem in a better way; it adds comments so that future
maintainters will be less likely to be led astray than I was.

It also adds a 'SIMPLE' flag for an expression that in my previous
misunderstanding didn't think was simple.  (It's enclosed in
parentheses, and hence can serve as an operand to a quantifier.)

11 years agoBump the version to 5.17.6
Florian Ragwitz [Fri, 19 Oct 2012 18:19:45 +0000 (15:19 -0300)]
Bump the version to 5.17.6

11 years agoregexec.c: Fix bugs in regrepeat()
Karl Williamson [Fri, 19 Oct 2012 17:08:35 +0000 (11:08 -0600)]
regexec.c: Fix bugs in regrepeat()

I realized that commit 613a425dda0dc9e3f838151a5d796c902cfd922e
introduced some bugs into regrepeat().  In looking over the code more
closely, I realized that there were longstanding problems there of a
similar nature.  However, I was unable, for the most part, to come up
with tests that showed up these bugs, and that may explain why there
haven't been field reports for them.  The situations that lead to
problems are typically caught before regrepeat() gets executed.

The problem was that the situation in this function is different
depending on whether the target string is encoded in UTF-8 or not, and
not all of the cases in the switch statement followed that.  I have now
changed things, so that for both the UTF-8 and non-UTF-8 cases, the
switch is entered with things set up so that there is no extra set-up
needed for the most common situation; and comments now explain things.

11 years agoperlre: grammar, typo
Karl Williamson [Fri, 19 Oct 2012 04:04:41 +0000 (22:04 -0600)]
perlre: grammar, typo

11 years agoAdd a new perldelta
Florian Ragwitz [Fri, 19 Oct 2012 17:09:40 +0000 (14:09 -0300)]
Add a new perldelta

11 years agoAdd the 5.17.5 epigraph
Florian Ragwitz [Fri, 19 Oct 2012 16:36:41 +0000 (13:36 -0300)]
Add the 5.17.5 epigraph

11 years agoAdd 5.17.5 to perlhist
Florian Ragwitz [Fri, 19 Oct 2012 15:50:32 +0000 (12:50 -0300)]
Add 5.17.5 to perlhist

11 years agoUpdate Module::CoreList for 5.17.5
Florian Ragwitz [Fri, 19 Oct 2012 15:24:54 +0000 (12:24 -0300)]
Update Module::CoreList for 5.17.5

11 years agoFinalise perldelta
Florian Ragwitz [Fri, 19 Oct 2012 15:04:29 +0000 (12:04 -0300)]
Finalise perldelta

11 years agoCorrect a version number in perl5180delta
Florian Ragwitz [Fri, 19 Oct 2012 14:16:19 +0000 (11:16 -0300)]
Correct a version number in perl5180delta

11 years agoPerldelta up to 1443c94
Florian Ragwitz [Fri, 19 Oct 2012 14:16:07 +0000 (11:16 -0300)]
Perldelta up to 1443c94

11 years ago5.14.3 has been released
Florian Ragwitz [Tue, 16 Oct 2012 20:16:04 +0000 (17:16 -0300)]
5.14.3 has been released

11 years agoregmatch(): fix out bounds array access
David Mitchell [Fri, 19 Oct 2012 09:14:56 +0000 (10:14 +0100)]
regmatch(): fix out bounds array access

The code for EXACTF and similar tests that

    UCHARAT(s) != fold_array[nextchr]

but doesn't check first that nextchr != NEXTCHR_EOS (-10), so it can
access the byte 10 bytes before the start of one of the PL_fold_latin1 or
similar arrays. Although undesirable, it's harmless, as the worst it can
achieve is a false positive match of the first char of the EXACTF string,
which will then still fail on a full compare of the string.

11 years agoregmatch(): add asserts for legal values of nextchr
David Mitchell [Thu, 18 Oct 2012 18:54:20 +0000 (19:54 +0100)]
regmatch(): add asserts for legal values of nextchr

nextchr should always hold the next *byte* of the string, or the
special value NEXTCHR_EOS, so assert this. And when we're moving to the
next char, nextchr shouldn't already be NEXTCHR_EOS.

11 years agoregcomp.c: Use unlikely initialization value; not 0
Karl Williamson [Thu, 18 Oct 2012 16:27:38 +0000 (10:27 -0600)]
regcomp.c: Use unlikely initialization value; not 0

Commit b4295830fe1ff58bc83d963006afeb9a2e4fb2d0 added initialization to
an uninitialized variable.  I meant to change it to a less likely value,
but didn't manage to get the change in, contrary to what its commit
message says.

11 years agoPATCH: [perl #115342] Properly initialize S_regclass value (again)
rurban@cpanel.net [Thu, 18 Oct 2012 14:18:52 +0000 (07:18 -0700)]
PATCH: [perl #115342] Properly initialize S_regclass value (again)

Prevent save_value to carry along uninitialized garbage.
Regression introduced with 9d53c457 Thu Oct 11 21:49:31 2012

Committer changed 0's to OOB_UNICODE.

11 years agoutfebcdic.h: white space only
Karl Williamson [Thu, 18 Oct 2012 03:24:54 +0000 (21:24 -0600)]
utfebcdic.h: white space only

11 years agoadd PERL_CALLCONV_NO_RET to perlhost.h's PerlProcExit and PerlProc_Exit
Daniel Dragan [Wed, 10 Oct 2012 03:17:47 +0000 (23:17 -0400)]
add PERL_CALLCONV_NO_RET to perlhost.h's PerlProcExit and PerlProc_Exit

This gives noreturn to the 2 functions on Visual C Perl.

11 years agoRemove unnecessary overrides in gnukfreebsd and gnuknetbsd hints.
Niko Tyni [Wed, 17 Oct 2012 16:56:43 +0000 (12:56 -0400)]
Remove unnecessary overrides in gnukfreebsd and gnuknetbsd hints.

hints/gnukfreebsd.sh and hints/gnuknetbsd.sh unconditionally
override Configure's values for ccdlflags and lddlflags, even though
the default Configure guesses should be correct for those systems.
Configure was altered in commit fb2e1bc0638d5a5d7ac552a79a71a996a5d604cc
(Perforce change 23909) to get the correct values, but later commit
46c947e8b9def6de34ac831834a3c290ab266515 (Perforce change 24017) included
these now-outdated hints file changes as part of importing a larger set
of patches from Debian.

This patch removes the unnecessary overrides.  Thanks to Niko Tyni for
digging up the history and supplying the hints/gnukfreebsd.sh patch.

11 years agoavoid calling memset with a negative count
Andy Dougherty [Thu, 27 Sep 2012 13:52:18 +0000 (09:52 -0400)]
avoid calling memset with a negative count

Poorly written perl code that allows an attacker to specify the count to
perl's 'x' string repeat operator can already cause a memory exhaustion
denial-of-service attack. A flaw in versions of perl before 5.15.5 can
escalate that into a heap buffer overrun; coupled with versions of glibc
before 2.16, it possibly allows the execution of arbitrary code.

The flaw addressed to this commit has been assigned identifier
CVE-2012-5195.

11 years agowin32_freeenvironmentstrings: convert nonpublic exported function to macro
Daniel Dragan [Sun, 14 Oct 2012 19:30:01 +0000 (15:30 -0400)]
win32_freeenvironmentstrings: convert nonpublic exported function to macro

win32_freeenvironmentstrings was added in commit 4f46e52b008. It is not
documented as public api but is exported. Since it is nothing more than a
renaming of win32_free, replace it with a macro to win32_free. This saves
an entry in the export table, and the string name of the export from
perl517.dll. Also see
http://www.nntp.perl.org/group/perl.perl5.porters/2012/09/msg192954.html

11 years agoperldelta for #115260
Father Chrysostomos [Wed, 17 Oct 2012 03:22:26 +0000 (20:22 -0700)]
perldelta for #115260

11 years agoUsed pad name lists for pad ids
Father Chrysostomos [Wed, 17 Oct 2012 01:04:28 +0000 (18:04 -0700)]
Used pad name lists for pad ids

I added pad IDs so that a pad could record which pad it closes over,
to avoid problems with closures closing over the wrong pad, resulting
in crashes or bizarre copies.  These pad IDs were shared between
clones of the same pad.

In commit 9ef8d56, for efficiency I made clones of the same closure
share the same pad name list.

It has just occurred to be that each padlist containing the same pad
name list also has the same pad ID, so we can just use the pad name
list itself as the ID.

This makes padlists 32 bits smaller and eliminates PL_pad_generation
from the interpreter struct.

11 years agoregcomp.c: Silence compiler warning
Karl Williamson [Wed, 17 Oct 2012 03:20:47 +0000 (21:20 -0600)]
regcomp.c: Silence compiler warning

I didn't notice that I had introduced this warning until now.

11 years agoregex: \R can match either 1 or 2 chars
Karl Williamson [Tue, 16 Oct 2012 18:09:04 +0000 (12:09 -0600)]
regex: \R can match either 1 or 2 chars

Therefore it is not "simple", and should not be compiled as such,
causing things like the test added herein to fail.

11 years agoregcomp.c: Pass NULL instead of &dummy to function
Karl Williamson [Tue, 16 Oct 2012 17:12:22 +0000 (11:12 -0600)]
regcomp.c: Pass NULL instead of &dummy to function

This saves the function from setting a throw-away value

11 years agoregcomp.c, regexec.c: Comments only; no code changes
Karl Williamson [Tue, 16 Oct 2012 17:11:11 +0000 (11:11 -0600)]
regcomp.c, regexec.c: Comments only; no code changes

11 years agoregexec.c: White-space only; no code changes
Karl Williamson [Tue, 16 Oct 2012 17:09:52 +0000 (11:09 -0600)]
regexec.c: White-space only; no code changes

This indents a newly-formed block correctly

11 years agoregexec.c: Tighten loops in regrepeat()
Karl Williamson [Tue, 16 Oct 2012 16:56:28 +0000 (10:56 -0600)]
regexec.c: Tighten loops in regrepeat()

regrepeat() is used to match some simple thing repeatedly in a row.  In
the case of EXACTFish nodes, it will repeat a single character (and its
fold).  Prior to this commit, it was using the full generality of
foldEQ_utf8() whenever the target was encoded in UTF-8.  This full
generality requires quite a bit of processing.  However, most
Unicode folds are of the simple variety containing just a character and
its upper- or lower-cased equivalent, and so the full generality of
foldEQ_utf8() is needed only comparatively infrequently.

This commit takes advantage of the newly added and enhanced
S_setup_EXACTISH_ST_c1_c2() to look at the character being repeated and
decide what level of generality is needed.  regrepeat() then uses a loop
that is only as complicated as needed.

This also adds some asserts that the nodes contain exactly 1 character