This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
10 years agopp_match(): refactor intuit-only code
David Mitchell [Sun, 16 Jun 2013 14:45:20 +0000 (15:45 +0100)]
pp_match(): refactor intuit-only code

change

    if (intuit_only)
        goto yup:
    ...
  yup:
    A; B; X; Y;

to

    if (intuit_only)
        A; B;
        goto yup:
    ...
  yup:
    X; Y;

where A and B are intuit_only-specific steps while X and Y are done by the
regexec() branch too. This will shortly allow us to merge the two
branches.

10 years agopp_match(): minor refactor: consolidate RETPUSHYES
David Mitchell [Sun, 16 Jun 2013 14:38:56 +0000 (15:38 +0100)]
pp_match(): minor refactor: consolidate RETPUSHYES

Make the code slightly simpler by doing an early RETPUSHYES after success
where possible.

10 years agopp_match(): factor out some common code
David Mitchell [Sun, 16 Jun 2013 13:27:19 +0000 (14:27 +0100)]
pp_match(): factor out some common code

Some identical code is used in two separate branches to set pos()
after a successful match. Hoist the common code to above the branch.

10 years agore-enable intuit-only matches
David Mitchell [Sun, 16 Jun 2013 12:26:30 +0000 (13:26 +0100)]
re-enable intuit-only matches

The COW changes inadvertently disabled intuit-only matches.
These are where calling intuit_start() to find the starting point for a
match is enough to know that the whole pattern will match, and so you can
skip calling regexec() too. For example, fixed strings without captures
such as /abc/.

The COW breakage meant that regexec was always called, making something
like /abc/ abut 3 times slower.

This commit re-enables intuit-only matches.

However, it turns out that this opens up a can of worms.
Normally, recording the just-matched-against string so that things like $&
and captures work, is done within regexec(). When this is skipped,
pp_match has to do a similar thing itself. The code that does this (which
is in principle a copy of the code in regexec()) is a bit of a mess. Due
to a logic error, a big chunk of it has actually been dead code for 10+
years.  Its had lots of modifications (e.g. people have made the same
changes to regexec() and pp_match()), but since it never gets executed,
errors aren't detected. And the bits that are executed haven't completely
received all the COW and SAWAMERSAND updates that have happened recently.

The Best way to fix this is is to extract out the capture code in
regexec() into a separate function (which we did in the previous commit),
then throw away all the broken capture code in pp_match() and replace it
with a call to the new function (which this commit does).

One side effect of this commit is that as well as restoring intuit-only
behaviour for the patterns that used to pre-COW, it also enables this
behaviour for patterns which formerly didn't, namely where $& or //p are
seen.

This commit is the barest minimum necessary to fix this; subsequent
commits will clean and improve this.

10 years agoadd Perl_reg_set_capture_string() function
David Mitchell [Sat, 15 Jun 2013 16:54:10 +0000 (17:54 +0100)]
add Perl_reg_set_capture_string() function

Cut and paste into a separate function, the block of code in
regexec_flags() that is responsible (on successful match) for setting
RX_SAVED_COPY, RX_SUBBEG etc, ready for use by capture vars like $1, $&.

Although this function is currently only called from one place, we will
shortly use it elsewhere too.

This should contain no functional changes.

10 years agoperl5191delta: deep recursion warnings (07b2687d2/#118521)
Father Chrysostomos [Sun, 28 Jul 2013 06:21:24 +0000 (23:21 -0700)]
perl5191delta: deep recursion warnings (07b2687d2/#118521)

10 years ago[Merge] Constants, inlined subs, TARGs, ...
Father Chrysostomos [Fri, 26 Jul 2013 06:50:01 +0000 (23:50 -0700)]
[Merge] Constants, inlined subs, TARGs, ...

This branch fixes many inconsistencies in the way constants, inlinable
subroutines, and operator return values (TARGs) are handled.

• Constant folding no longer causes operators to return read-only sca-
  lars that would otherwise return mutable scalars (1+2, "thr"."ee").
• Modifying mutable scalars returned from operators no longer affects
  future return values (this affected the range operator).
• Subroutines like sub () {42} always return mutable scalars.
• Constants like 1 and "two" now always produce read-only scalars.
• Constants created by ‘use constant’ always return read-only scalars.
• Referencing an operator return value, or a constant under threads,
  no longer creates a new scalar, causing print \$_, \$_ to print two
  different addresses.

This list is not exhaustive.

10 years agoVersion number tweaks in tests and other cleanup
Father Chrysostomos [Fri, 26 Jul 2013 04:56:18 +0000 (21:56 -0700)]
Version number tweaks in tests and other cleanup

I didn’t have this constant stuff ready as soon as I expected.  I also
left a comment and a couple of ‘local $TODO’s lying around that don’t
need to be there.  As a bonus, correct a typo in constant.pm’s docu-
mentation.

10 years agopad.c apidocs: Clarify use of &PL_sv_no
Father Chrysostomos [Fri, 26 Jul 2013 04:46:22 +0000 (21:46 -0700)]
pad.c apidocs: Clarify use of &PL_sv_no

specifically with regard to possible future changes.

10 years agoFix up IO::Compress tests
Father Chrysostomos [Thu, 25 Jul 2013 07:32:49 +0000 (00:32 -0700)]
Fix up IO::Compress tests

They were expecting \"abc" to return a constant value, but constant
folding no longer causes \ to return a read-only scalar.

10 years agoIncrease $XS::APItest::VERSION to 0.55
Father Chrysostomos [Wed, 24 Jul 2013 18:00:08 +0000 (11:00 -0700)]
Increase $XS::APItest::VERSION to 0.55

10 years agoStop op freeing from interfering with sub(){42} mutability
Father Chrysostomos [Wed, 24 Jul 2013 15:39:01 +0000 (08:39 -0700)]
Stop op freeing from interfering with sub(){42} mutability

The problem is that when an OP_CONST is freed, it calls pad_swipe,
which clears the PADTMP flag when removing the SV from the pad.  Since
PADTMP no longer necessarily means ‘in a pad’, we shouldn’t turn
this flag off.

10 years agofresh_perl.t: Make the test for #3066 more explicit
Father Chrysostomos [Wed, 24 Jul 2013 15:35:46 +0000 (08:35 -0700)]
fresh_perl.t: Make the test for #3066 more explicit

This test was added to make sure that constants don’t become undefined
as a result of being shared between ops.

What was tested, though, was a side-effect, and not the actual bug
itself.

This behaviour has changed (sub(){42} now returns a mutable val-
ue), so this test needs to change, too.  It was only passing under
ithreads, and only as the result of another bug, which the next com-
mit will fix.

10 years agoMake overloaded constants always read-only
Father Chrysostomos [Wed, 3 Jul 2013 02:53:05 +0000 (19:53 -0700)]
Make overloaded constants always read-only

They were not read-only if the constant handler returned a shared
hash key scalar.

This was brought up in bug #109744.

10 years agoDon’t check IS_PADCONST in pad.c:pad_alloc
Father Chrysostomos [Wed, 3 Jul 2013 01:29:43 +0000 (18:29 -0700)]
Don’t check IS_PADCONST in pad.c:pad_alloc

Since recent commits have given constants &PL_sv_no names, this check
is redundant, since any slots for constants will have been skipped
over by the sv != &PL_sv_undef check just above.

10 years agopad.c: Don’t copy shared hash key targets when cloning
Father Chrysostomos [Wed, 3 Jul 2013 01:25:48 +0000 (18:25 -0700)]
pad.c: Don’t copy shared hash key targets when cloning

When creating a new thread, don’t treat shared hash key targets as
constants.  (See the previous commit for explanation.)

This should cause no change in behaviour, because the new target will
not be in use, and its next use will immediately overwrite its value.
It just saves having to copy a string that will be overwritten.

10 years agoStop shared hash key TARGs from being shared
Father Chrysostomos [Wed, 3 Jul 2013 01:18:13 +0000 (18:18 -0700)]
Stop shared hash key TARGs from being shared

A CV has a list of pads containing a different pad for each recursion
level.  pad_push, which adds a new pad to the list, copies some items
from pad no. 1 but not others.  In particular op targets¹ are created
anew, but, under ithreads, constants² are not.  Historically, these
were distinguished from each other by flags on the value.  Any read-
only or shared hash key scalar was considered to be a constant, and
hence shared between pads.  The target returned by ref() is a shared
hash key scalar, so it was being shared between recursion levels.
Recent commits have made it possible to distinguish between constants
and targets based on the name.  Formerly, both were nameless pad
entries.  Now constants have zero-length names (PadnamePV(name) &&
!PadnameLEN(name)).  So we can use that to fix this bug.

¹ Many operators return the same scalar each time, for efficiency.
  This is stored in the pad, and is known as the target, or TARG.
² Constanst are stored in the pad under ithreads, instead of being
  attached directly to ops, as they are under non-threaded builds.

10 years ago[perl #79908] Stop sub inlining from breaking closures
Father Chrysostomos [Mon, 1 Jul 2013 03:26:34 +0000 (20:26 -0700)]
[perl #79908] Stop sub inlining from breaking closures

When a closure closes over a variable, it references the variable
itself, as opposed to taking a snapshot of its value.

This was broken by the constant optimisation added for
constant.pm’s sake:

{
    my $x;
    sub () { $x };  # takes a snapshot of the current value of $x
}

constant.pm no longer uses that mechanism, except on older perls, so
we can remove this hack, causing code like this this to start work-
ing again:

BEGIN{
    my $x = 5;
    *foo = sub(){$x};
    $x = 6
}
print foo; # now prints 6, not 5

10 years agoMake sub(){42} return a mutable value
Father Chrysostomos [Sun, 30 Jun 2013 21:51:37 +0000 (14:51 -0700)]
Make sub(){42} return a mutable value

But only make it do so in lvalue context.  This will be just as fast
in true rvalue context.  In either case, it is still inlined.

This makes sub () { 42 } and sub () { return 42 } do the same thing.

It also means that sub () { '-'x75 } reverts back to returning a muta-
ble value, the way it did in 5.16.  From now on, tweaks to constant
folding will no longer affect the mutability of the return value of a
nullary function.

‘use constant’ is unaffected.  It still returns read-only values.

This was brought up in ticket #109744.

10 years agoTweak optree_constants.t for inlined list consts
Father Chrysostomos [Sun, 30 Jun 2013 07:40:58 +0000 (00:40 -0700)]
Tweak optree_constants.t for inlined list consts

10 years agoUpdate constant.pm to reflect list inlinement
Father Chrysostomos [Sun, 30 Jun 2013 07:26:46 +0000 (00:26 -0700)]
Update constant.pm to reflect list inlinement

I also removed ‘some symbols may be redefined without generating a
warning’.  I know not to what it refers.  It has been there as long as
constant.pm has.  If a constant is clobbered by another constant with
the same value, there is no warning, as it is harmless.  That may be
to what it refers, but we don’t need a caveat for that.

10 years agoInline list constants
Father Chrysostomos [Sun, 30 Jun 2013 07:20:33 +0000 (00:20 -0700)]
Inline list constants

These are inlined the same way as 1..5.  We have two ops:

  rv2av
    |
    `-- const

The const op returns an AV, which is stored in the op tree, and then
rv2av flattens it.

10 years agoconstant.pm: Make list constants read-only
Father Chrysostomos [Sun, 30 Jun 2013 06:59:48 +0000 (23:59 -0700)]
constant.pm: Make list constants read-only

Here we take advantage of the array-ref-stash-elem mechanism added in
the previous commit, which causes the actual elements of the stored
array to be pushed on to the stack.

10 years agoAllow stash elems to be array refs
Father Chrysostomos [Sun, 30 Jun 2013 06:33:14 +0000 (23:33 -0700)]
Allow stash elems to be array refs

These turn into CVs that return the contents of the array.  Future
commits will make constant.pm use these and also make them inlinable.

Even without inlining, these subs are faster, because they are XSUBs:

$ time ./perl -Ilib -e 'my @a=1..1000000; sub foo { @a } () = foo for 1..10'

real 0m3.725s
user 0m3.407s
sys 0m0.227s
$ time ./perl -Ilib -e 'my @a=1..1000000; BEGIN { $::{foo} = \@a } () = foo for 1..10'

real 0m2.153s
user 0m1.949s
sys 0m0.121s

10 years agoIncrease $constant::VERSION to 1.28
Father Chrysostomos [Sat, 29 Jun 2013 01:25:28 +0000 (18:25 -0700)]
Increase $constant::VERSION to 1.28

10 years agoStop constant.pm from (ab)using subs for scalars
Father Chrysostomos [Fri, 28 Jun 2013 08:27:48 +0000 (01:27 -0700)]
Stop constant.pm from (ab)using subs for scalars

under versions that support $::{foo} = \1.

This changes no behaviour.  Future commits will change the way
sub(){42} and sub(){$forty_two} work.  (The former will return a muta-
ble value; the latter will not be inlined at all.)

10 years ago[perl #78194] Make re-evals copy PADTMPs
Father Chrysostomos [Fri, 28 Jun 2013 01:11:48 +0000 (18:11 -0700)]
[perl #78194] Make re-evals copy PADTMPs

So that \$_ == \$_ will be true in "$foo$bar" =~ /(?{...})/.

Many ops return the same scalar each time, for efficiency; refgen (\)
knows about that and copies them, to hide the implementation detail,
but other constructs, such as regular expression code blocks in this
case, need to do the same thing.

10 years ago[perl #78194] Make sort copy PADTMPs
Father Chrysostomos [Thu, 27 Jun 2013 21:37:14 +0000 (14:37 -0700)]
[perl #78194] Make sort copy PADTMPs

Copy PADTMPs (op return values) when there is a sort block/sub that is
not optimised away and we are not sorting in place, so that \$a == \$a
will return true.

Many ops return the same scalar each time, for efficiency; refgen (\)
knows about that and copies them, to hide the implementation detail,
but other ops (sort in this case) need to do the same thing.

10 years ago[perl #78194] Make x copy PADTMPs in lv cx
Father Chrysostomos [Tue, 25 Jun 2013 04:28:36 +0000 (21:28 -0700)]
[perl #78194] Make x copy PADTMPs in lv cx

So that \(("$a")x2) will give two references to the same scalar, the
way that \(($a)x2) does.

10 years ago[perl #78194] Make list slices copy PADTMPs in lv cx
Father Chrysostomos [Tue, 25 Jun 2013 03:16:30 +0000 (20:16 -0700)]
[perl #78194] Make list slices copy PADTMPs in lv cx

So that slices that reference the same value multiple times (such as
(...)[1,1]) will exhibit referential identity (\(...)[1,1] will return
two references to the same scalar).

10 years agoStop folding of ops from changing mutability
Father Chrysostomos [Sun, 23 Jun 2013 14:08:24 +0000 (07:08 -0700)]
Stop folding of ops from changing mutability

If $a+$b produces a mutable value, then so should 1+2.

10 years ago[perl #78194] Make foreach copy pad tmps
Father Chrysostomos [Sun, 23 Jun 2013 14:06:49 +0000 (07:06 -0700)]
[perl #78194] Make foreach copy pad tmps

before aliasing them to $_.

This caused one to-do test in sub.t to pass, but the bug it is testing
for has not been fixed, so I added another one.  I didn’t remove the
to-do test that started passing, because it is still a good test to
have (the only test we have for interactions betwen foreach, shared
hash keys, and recursion).

10 years agoCorrect list.t descr in MANIFEST
Father Chrysostomos [Sun, 23 Jun 2013 06:04:13 +0000 (23:04 -0700)]
Correct list.t descr in MANIFEST

We don’t use the term ‘array’ for lists any more.  Also, mention
slices, since list slices are tested here.

10 years ago[perl #3105] Make 1..3 modification safe
Father Chrysostomos [Sun, 23 Jun 2013 01:46:00 +0000 (18:46 -0700)]
[perl #3105] Make 1..3 modification safe

This construct is optimised at compile time to an anonymous array with
an implicit @{} around it if both arguments are constant.  Modifying
elements of that array produces wrong results the next time the same
code is executed.

If we mark each element of the array as PADTMP, then it will be
treated like an operator’s return value (which it is) and get copied
as appropriate.

10 years agoconstant.t: Correct version
Father Chrysostomos [Sat, 22 Jun 2013 07:26:12 +0000 (00:26 -0700)]
constant.t: Correct version

I didn’t have this done in time for 5.19.1.

10 years ago[perl #78194] Make sub calls copy pad tmps
Father Chrysostomos [Thu, 20 Jun 2013 21:32:15 +0000 (14:32 -0700)]
[perl #78194] Make sub calls copy pad tmps

before aliasing them to elements of @_.

10 years agoIncrease $OptreeCheck::VERSION to 0.10
Father Chrysostomos [Thu, 20 Jun 2013 21:13:20 +0000 (14:13 -0700)]
Increase $OptreeCheck::VERSION to 0.10

though I still don’t understand why it has a version at all.

10 years ago[perl #78194] Make grep/map copy pad tmps
Father Chrysostomos [Thu, 20 Jun 2013 13:04:59 +0000 (06:04 -0700)]
[perl #78194] Make grep/map copy pad tmps

before aliasing them to $_.

And make sure the copies go back on the stack for grep, since modi-
fying $_ in the grep block or expression is supposed to modify the
item returned.

10 years agopad.c: cast before comparing signed with unsigned
Father Chrysostomos [Thu, 20 Jun 2013 12:25:01 +0000 (05:25 -0700)]
pad.c: cast before comparing signed with unsigned

10 years agoop.c: Stop copying constants under ithreads
Father Chrysostomos [Wed, 19 Jun 2013 03:34:21 +0000 (20:34 -0700)]
op.c: Stop copying constants under ithreads

This fixes bugs #21979, #89188, #109746, #114838 and #115388 and
mostly fixes #109744 and #105906 (other issues still remain in those
two tickets).

Because the PADTMP flag was doing double duty, indicating that a
pad slot was in use in addition to indicating a target, constants
could not be shared between pad slots, as freeing one const op (and
turning of its PADTMP flag in pad_free) would mark some other pad
slot as free.

I believe this may have been fixed already by change 3b1c21fabed,
which made const ops use pad_swipe (which removes the SV from the
pad) instead of pad_free (which marks it as available for reuse).  But
the copying still happens.

In any case, as of the previous commit, whether a pad slot for a con-
stant is in use is now stored in the pad name.  Slots in use for const
ops now have &PL_sv_no names.

So there is no longer any reason to copy the constants.

The difference can be observed thus:

Before:

$ ./perl -lIlib -MDevel::Peek -e 'sub foo(){42} Dump foo; Dump foo'
SV = IV(0x7f94ea02ef10) at 0x7f94ea02ef20
  REFCNT = 2
  FLAGS = (PADTMP,IOK,READONLY,pIOK)
  IV = 42
SV = IV(0x7f94ea02eeb0) at 0x7f94ea02eec0
  REFCNT = 1
  FLAGS = (PADTMP,IOK,READONLY,pIOK)
  IV = 42

After:

$ ./perl -lIlib -MDevel::Peek -e 'sub foo(){42} Dump foo; Dump foo'
SV = IV(0x7f894882ef10) at 0x7f894882ef20
  REFCNT = 3
  FLAGS = (IOK,READONLY,pIOK)
  IV = 42
SV = IV(0x7f894882ef10) at 0x7f894882ef20
  REFCNT = 3
  FLAGS = (IOK,READONLY,pIOK)
  IV = 42

Notice the different addresses.

There are still special cases for copying &PL_sv_undef, which I need
to tackle.

Since most constants created by ‘use constant’ have the PADMY flag on
(since they reside in lexical variables inside constant.pm) and PADMY
and PADTMP are exclusive, I have stop turning on PADTMP for constants.
It is no longer necessary now, since before its purpose was to mark
pad entries as being in use.  That means many to-do tests pass.

10 years agopad.c: Expand pad_push SVf_READONLY explanation
Father Chrysostomos [Tue, 18 Jun 2013 23:51:57 +0000 (16:51 -0700)]
pad.c: Expand pad_push SVf_READONLY explanation

10 years agopad.c: Use &PL_sv_no for const pad names
Father Chrysostomos [Sun, 16 Jun 2013 21:00:01 +0000 (14:00 -0700)]
pad.c: Use &PL_sv_no for const pad names

Currently &PL_sv_undef as a pad name can indicate either a free slot
available for use by pad_alloc or a slot used by an op target (or,
under ithreads, a constant or GV).

Currently pad_alloc distinguishes between free slots and unnamed slots
based on whether the value in the pad has PADMY or PADTMP set.  If
neither is set, then the slot is free.  If either is set, the slot
is in use.

This makes it rather difficult to distinguish between constants stored
in the pad (under ithreads) and targets.  The latter need to be copied
when referenced, to give the impression that a new scalar is being
returned by an operator each time.  (So \"$a" has to return a refer-
ence to a new scalar each time, but \1 should return the same one.)
Also, constants are shared between recursion levels.  Currently, if
the value is marked READONLY or is a shared hash key scalar, it is
shared.  But targets can also me shared hash keys, resulting in bugs.

It also makes it impossible for the same constant to be shared by mul-
tiple pad slots, as freeing one const op will turn off the PADTMP flag
while the other slot still uses it, making the latter appear to be
free.  Hence a lot of copying occurs under ithreads.  (Actually, that
may not be true any more since 3b1c21fabed, as freed const ops swipe
their constants from the pad.  But right now, a lot of copying does
still happen.)

Also, XS modules may want to create const ops that return the same
mutable SV each time.  That is currently not possible without
various workarounds including custom ops and references.  (See
<https://rt.perl.org/rt3/Ticket/Display.html?id=105906#txn-1075354>.)

This commit changes pad_alloc and pad_free to use &PL_sv_no for con-
stants and updates other code to keep all tests passing.  Subsequent
commits will actually use that information to fix bugs.

This will probably break PadWalker, but I think it is an acceptable
trade-off.  The alternative would be to make PadnamePV forever more
complex than necessary, by giving it a special case for &PL_sv_no and
having it return NULL.

I gave PadnameLEN a special case for &PL_sv_undef, so it may appear
that I have simply shifted the complexity around.  But if pad names
stop being SVs, then this exception will simply disappear, since the
global &PL_padname_undef will have 0 in its length field.

10 years agoRe(mov|writ)e two comments from pad.c:pad_alloc
Father Chrysostomos [Sun, 16 Jun 2013 19:40:05 +0000 (12:40 -0700)]
Re(mov|writ)e two comments from pad.c:pad_alloc

The thing about "foreach" index vars was added in bbce6d697 (insepar-
able changes from patch from perl5.003_08 to perl5.003_09, presuma-
bly the ‘Lexical scoping cleanup’ part).  It is not valid, because
‘foreach’ doesn’t aliases a pad entry to a non-pad (not marked PADMY
or PADTMP) value until run time, and pad_alloc happens at compile
time.  The real reason we need this loop is that entries that close
over unavailable variables are not marked PADMY.  That may have been a
mistake, but it works because of this loop.  The reason for the loop
also may have changed over time.

The comment about copying to sv is not valid, because it is used later
on in the same condition when compared to &PL_sv_undef.  It was added
in commit dd2155a49b.

10 years agoop.c:S_fold_constants: Add assertion
Father Chrysostomos [Sun, 16 Jun 2013 06:17:59 +0000 (23:17 -0700)]
op.c:S_fold_constants: Add assertion

This code correctly handles a value returned by a folded constant that
is a target or a mortal.

If it is neither, then it takes ownership of a reference count (with-
out doing SvREFCNT_inc), so it ends up sharing a reference count with
whatever owned it before.  That is only safe to do with immortals,
which is (afaict) the only other type of scalar that can get through
this code, so it is actually correct.

Changes elsewhere could easily break this, though, so add an
assertion.

10 years agoChange the tests for #3105 into to-dos
Father Chrysostomos [Sun, 16 Jun 2013 04:52:07 +0000 (21:52 -0700)]
Change the tests for #3105 into to-dos

instead of testing for the incorrect behaviour

10 years agoTest readonliness of overload constants
Father Chrysostomos [Sun, 16 Jun 2013 03:41:49 +0000 (20:41 -0700)]
Test readonliness of overload constants

including one to-do test

10 years agoTo-do test for #109746
Father Chrysostomos [Sun, 16 Jun 2013 03:29:16 +0000 (20:29 -0700)]
To-do test for #109746

10 years agoTest (im)mutability of constants and constant-like subs
Father Chrysostomos [Sun, 16 Jun 2013 03:24:55 +0000 (20:24 -0700)]
Test (im)mutability of constants and constant-like subs

including many to-do tests

10 years agoTest !0 and !1 immutability and singletonness
Father Chrysostomos [Sun, 16 Jun 2013 02:42:35 +0000 (19:42 -0700)]
Test !0 and !1 immutability and singletonness

The latter (for bug #114838) is a to-do test under ithreads.

10 years agoTest that literal numbers and strings are read-only
Father Chrysostomos [Sun, 16 Jun 2013 02:29:27 +0000 (19:29 -0700)]
Test that literal numbers and strings are read-only

including ${\3}, which currently fails under ithreads (and is hence a
to-do test).

10 years agoTo-do tests for perl #78194
Father Chrysostomos [Sun, 16 Jun 2013 02:14:14 +0000 (19:14 -0700)]
To-do tests for perl #78194

plus a regular (not to-do) test for an lvalue sub case that already
works properly.

10 years agoref.t: To-do test for retvals of folded ops
Father Chrysostomos [Sat, 15 Jun 2013 18:57:56 +0000 (11:57 -0700)]
ref.t: To-do test for retvals of folded ops

10 years agosub.t: To-do test for recursive shared-hash-keys TARGs
Father Chrysostomos [Sat, 15 Jun 2013 18:41:57 +0000 (11:41 -0700)]
sub.t: To-do test for recursive shared-hash-keys TARGs

This is only buggy under ithreads.

sub a {
  for (${\""}.${\""}) {
    $_ = $_[0] || __PACKAGE__;
    print "$_\n";
    a("road") unless $_[0];
    print "$_\n";
  }
}
a();

The outer call sets the scalar returned by ${\""}.${\""} to the cur-
rent package name.

The inner call sets it to "road".

Each call prints it twice, the outer call surrounding the inner call.
The output in 5.10-5.18 is:

main
road
road
road

because the inner call is clobbering the same scalar.  If __PACKAGE__
is changed to "main", it works, and prints

main
road
road
main

(as the script above also prints in 5.8.8).

10 years agoperldelta for d7d11da6a3
Tony Cook [Fri, 26 Jul 2013 01:17:02 +0000 (11:17 +1000)]
perldelta for d7d11da6a3

10 years ago[perl #39739] Exporter::Heavy ignores custom $SIG{__WARN__} handlers
Tony Cook [Fri, 26 Jul 2013 01:09:11 +0000 (11:09 +1000)]
[perl #39739] Exporter::Heavy ignores custom $SIG{__WARN__} handlers

10 years agobump $Exporter::VERSION (and hence $Exporter::Heavy::VERSION)
Tony Cook [Fri, 26 Jul 2013 01:00:23 +0000 (11:00 +1000)]
bump $Exporter::VERSION (and hence $Exporter::Heavy::VERSION)

10 years ago[perl #39739] Exporter::Heavy ignores custom $SIG{__WARN__} handlers
Tony Cook [Thu, 18 Jul 2013 06:03:19 +0000 (16:03 +1000)]
[perl #39739] Exporter::Heavy ignores custom $SIG{__WARN__} handlers

10 years ago[perl #39739] TODO test for Exporter respecting warning handlers
Tony Cook [Thu, 18 Jul 2013 06:02:29 +0000 (16:02 +1000)]
[perl #39739] TODO test for Exporter respecting warning handlers

10 years agolet Porting/cmpVERSION.pl know Exporter was moved to dist/
Tony Cook [Fri, 26 Jul 2013 00:54:13 +0000 (10:54 +1000)]
let Porting/cmpVERSION.pl know Exporter was moved to dist/

10 years agoUpdate ExtUtils-MakeMaker to CPAN version 6.72
Chris 'BinGOs' Williams [Wed, 24 Jul 2013 20:31:18 +0000 (21:31 +0100)]
Update ExtUtils-MakeMaker to CPAN version 6.72

  [DELTA]

6.72 Wed Jul 24 18:38:19 BST 2013
    No changes from 6.71_01

6.71_01 Wed Jul 24 09:31:07 BST 2013
    Bug Fixes:
    * Resolved more regressions in parse_version code

10 years agoUpdate Module-CoreList MANIFEST to include Utils.pm
Chris 'BinGOs' Williams [Wed, 24 Jul 2013 20:28:34 +0000 (21:28 +0100)]
Update Module-CoreList MANIFEST to include Utils.pm

10 years agoperlopentut: Fit verbatim lines into 79 columns
Karl Williamson [Wed, 24 Jul 2013 15:15:01 +0000 (09:15 -0600)]
perlopentut: Fit verbatim lines into 79 columns

10 years agoperlvar.pod: add a separate section on $& et al
David Mitchell [Wed, 24 Jul 2013 14:20:22 +0000 (15:20 +0100)]
perlvar.pod: add a separate section on $& et al

Add a new separate section explaining the performance issues of $`, $&
and $'; plus descriptions of the various workarounds like @-, /p and COW,
and which perl version they were each introduced in.

Then in the entries for each individual var, strip out any commentary
about performance, and just include a link to the new performance
section.

10 years agoEnglish.pm: update perl version where perf fixed
David Mitchell [Wed, 24 Jul 2013 13:18:22 +0000 (14:18 +0100)]
English.pm: update perl version where perf fixed

It still said that the performance of $`, $&, $' was fixed in 5.18.
Update that to 5.20, since COW wasn't enabled by default in 5.18.

10 years agoUpdate ExtUtils-MakeMaker to CPAN version 6.70
Chris 'BinGOs' Williams [Wed, 24 Jul 2013 07:04:25 +0000 (08:04 +0100)]
Update ExtUtils-MakeMaker to CPAN version 6.70

  [DELTA]

6.70 Tue Jul 23 21:55:23 BST 2013
    No changes from 6.69_09

6.69_09 Sun Jul 21 09:22:40 BST 2013
    Bug Fixes:
    * RT#86976 Fix version parsing bug introduced in 6.69_05
      Part Deux :)

6.69_08 Wed Jul 17 00:36:28 BST 2013
    Bug Fixes:
    * RT#86976 Fix version parsing bug introduced in 6.69_05

6.69_07 Tue Jul 16 15:32:25 BST 2013
    New features:
    * RT#4550 report the file created after make dist

    Bug Fixes:
    * RT#66113 strip control characters from ABSTRACT
    * RT#20662 Don't check for config.h if it doesn't exist

6.69_06 Fri Jul 12 14:49:32 BST 2013
    Bug Fixes:
    * RT#64163 clean_subdirs infinite loop if subdir already gone
    * RT#79348 doesn't support miniperl in installation paths

    Doc Fixes:
    * Fix META_MERGE example
    * RT#31053 Mention configure_requires in PREREQ_FATAL documentation
    * RT#14680 Document TEST_FILES usage with 'make test'
    * RT#21285 Document 'make veryclean'

6.69_05 Thu Jul 11 22:10:10 BST 2013
    Bug Fixes:
    * Resolve RT#9452 regression with
      parse_version() (Victor Efimov)
    * RT#28632 use LD and OPTIMIZE in recursive Makefile.PL
      invocations (Niko Tyni)

6.69_04 Wed Jul 10 11:48:22 BST 2013
    Cygwin Fixes:
    * Revert RT#54703 and apply patch from RT#69401 to
      resolve /cygdrive issues (Reini Urban)

6.69_03 Tue Jul  9 22:39:54 BST 2013
    Bug Fixes:
    * RT#61419 Avoid invisible interactive question when
      rebuilding Makefile (Slaven Rezic)
    * VERSION also now really handles v-strings correctly.

    Cygwin Fixes:
    * RT#54703 - Don't hardcode /cygdrive (Jerry Hedden)

    Misc:
    * Install into site when 5.12 or above

6.69_02 Tue Jul  2 13:12:51 BST 2013
    Bug Fixes:
    * [RT#86609] VERSION_FROM now handles v-strings correctly.
    * VERSION also now handles v-strings correctly.

    Misc:
    * Updated bundled CPAN::Meta and removed Version::Requirements

6.69_01 Thu Jun 20 12:49:45 BST 2013
    Win32 Fixes:
    * resolve regression on Win32 introduced in 6.67_01
      (bingos)

10 years agoMerge work automating generation of lib/.gitignore and lib/ subdir cleanup.
Nicholas Clark [Wed, 24 Jul 2013 07:36:18 +0000 (09:36 +0200)]
Merge work automating generation of lib/.gitignore and lib/ subdir cleanup.

This makes no changes to any installed code.

10 years agoGenerate the lib/ cleanup rules in the Win32 Makefiles from MANIFEST.
Nicholas Clark [Tue, 23 Jul 2013 08:16:08 +0000 (10:16 +0200)]
Generate the lib/ cleanup rules in the Win32 Makefiles from MANIFEST.

10 years agoGenerate the lib/ cleanup rules in Makefile.SH automatically from MANIFEST.
Nicholas Clark [Mon, 22 Jul 2013 20:10:09 +0000 (22:10 +0200)]
Generate the lib/ cleanup rules in Makefile.SH automatically from MANIFEST.

10 years agoRe-order clean-up rules to give a line for regen/lib_cleanup.pl to key off.
Nicholas Clark [Sat, 20 Jul 2013 19:18:05 +0000 (21:18 +0200)]
Re-order clean-up rules to give a line for regen/lib_cleanup.pl to key off.

The Win32 line C<-del /f *.def *.map> and the start of the Unix line
C<rm -f so_locations> are unlikely to change.

10 years agoRemove the EXTUTILSDIR macro from the Win32 makefiles.
Nicholas Clark [Sat, 20 Jul 2013 19:04:16 +0000 (21:04 +0200)]
Remove the EXTUTILSDIR macro from the Win32 makefiles.

It hasn't been used since commit e3160748789c8366 in Sept 2009 eliminated
the XSUBPP macro.

10 years agoDelete obsolete clean rules from Makefile.SH
Nicholas Clark [Sat, 20 Jul 2013 19:02:56 +0000 (21:02 +0200)]
Delete obsolete clean rules from Makefile.SH

Rules to clean lib/ExtUtils/CBuilder/t and lib/ExtUtils/ParseXS/t haven't
been needed since the modules were moved to cpan/ and dist/

10 years agoMove process() from Porting/pod_rules.pl to Porting/pod_lib.pl
Nicholas Clark [Mon, 22 Jul 2013 19:23:11 +0000 (21:23 +0200)]
Move process() from Porting/pod_rules.pl to Porting/pod_lib.pl

And document it.

10 years agoSome tidying of Porting/pod_rules.pl
Nicholas Clark [Sat, 20 Jul 2013 20:46:34 +0000 (22:46 +0200)]
Some tidying of Porting/pod_rules.pl

Iterate over the files in sorted order, instead of hash iteration order.
This means that in TAP mode test failures will have consistent numbers.
Provide a description for the first test when outputting TAP.
Use clearer variable names in process(), and avoid using // as this code will
soon be exposed to pre-5.10

10 years agoExtract the main processing loop of Porting/pod_rules/pl into process().
Nicholas Clark [Sat, 20 Jul 2013 20:08:37 +0000 (22:08 +0200)]
Extract the main processing loop of Porting/pod_rules/pl into process().

10 years agoMove verify_contiguous() from Porting/pod_rules.pl to Porting/pod_lib.pl
Nicholas Clark [Sat, 20 Jul 2013 14:55:37 +0000 (16:55 +0200)]
Move verify_contiguous() from Porting/pod_rules.pl to Porting/pod_lib.pl

And document it.

10 years agoRefactor the use of verify_contiguous() in pod_rules.pl
Nicholas Clark [Sat, 20 Jul 2013 14:46:02 +0000 (16:46 +0200)]
Refactor the use of verify_contiguous() in pod_rules.pl

Move the substitution from the callers in into verify_contiguous().
Pass in a regex object for the substitution.
Return the modified file contents from verify_contiguous().
Load Carp when verify_contiguous() is called, instead of at compile time.

10 years agoRemove 3 redundant lines from .gitignore
Nicholas Clark [Sat, 20 Jul 2013 12:08:41 +0000 (14:08 +0200)]
Remove 3 redundant lines from .gitignore

These test files are no longer generated in directories beneath lib/

10 years agoGenerate lib/.gitignore from MANIFEST.
Nicholas Clark [Sat, 20 Jul 2013 10:50:21 +0000 (12:50 +0200)]
Generate lib/.gitignore from MANIFEST.

It's possible to programmatically determine almost all the files and
directories which will be created in lib/ by building the extensions.
Hence add a new script regen/lib_cleanup.pl to do this.

This saves having to manually update lib/.gitignore to reflect changes in
the build products of extensions, which has become a small but reoccurring
instance of scut-work.

10 years agoOn failure, regen_lib.pl now generates diagnostics, not just "not ok".
Nicholas Clark [Mon, 22 Jul 2013 07:26:24 +0000 (09:26 +0200)]
On failure, regen_lib.pl now generates diagnostics, not just "not ok".

We have to stop using File::Compare's compare(), as it doesn't return
diagnostics about what went wrong.

10 years agoMove all the "special case" build products from lib/.gitignore to .gitignore
Nicholas Clark [Sat, 20 Jul 2013 09:08:53 +0000 (11:08 +0200)]
Move all the "special case" build products from lib/.gitignore to .gitignore

These are all the build products that we can't programmatically infer will be
generated from extensions in ext, dist and cpan.

10 years agoMake .gitignore and lib/.gitignore more consistent.
Nicholas Clark [Sat, 20 Jul 2013 08:33:00 +0000 (10:33 +0200)]
Make .gitignore and lib/.gitignore more consistent.

Move the ignore of lib/App/, lib/mro.pm, lib/TAP/, lib/Test/Harness.pm,
lib/File/DosGlob.pm, lib/inc/, Win32.pm, Win32API/ and Win32Core.pm from
.gitignore to lib/.gitignore, where they more logically belong.
Consistently use trailing / for ignored directories.
Add a leading / to the ignore of unicore/TestProp.pl
(The line was added by commit 3df51b85ce4a5664 in Nov 2009, and it's not
clear why it did not have a leading / from the start.)

Re-sort lib/.gitignore lexically.

10 years agoPrune some .gitignore files.
Nicholas Clark [Sat, 20 Jul 2013 08:10:12 +0000 (10:10 +0200)]
Prune some .gitignore files.

Class::ISA was removed by 3df51b85ce4a5664 in April 2010.
Module::Pluggable was removed by commit 482cac4d574f8c6c in May 2013.
Module/Build/ConfigData.pm was moved from lib/ to cpan/ by commit
0b93a7997e668a67 in Nov 2009.
Pod::Plainer was removed by commit afbe215fcafe7a92 in April 2010.
Shell was removed by commit a1e75797c204ade8 in June 2011.
Switch was removed by commit 75108aefc8b50fcf in April 2010.

10 years agoperldelta for ea382fac4c7
Tony Cook [Wed, 24 Jul 2013 07:31:03 +0000 (17:31 +1000)]
perldelta for ea382fac4c7

The versioning for dist/bignum was a little confused, hopefully I've
unconfused it

10 years ago[perl #118995] Fix bigrat's $MBI configuration
Tony Cook [Wed, 24 Jul 2013 07:25:42 +0000 (17:25 +1000)]
[perl #118995] Fix bigrat's $MBI configuration

10 years ago[perl #118955] bump $bignum::VERSION to 0.36
Tony Cook [Wed, 24 Jul 2013 07:16:13 +0000 (17:16 +1000)]
[perl #118955] bump $bignum::VERSION to 0.36

set all other modules in dist/bignum to 0.36 too, the CPAN dist has
them all at the same version

10 years agoInitialize BigInt's $MBI correctly with "use bigrat lib => '...'".
Nathan Trapuzzano [Wed, 24 Jul 2013 00:34:16 +0000 (20:34 -0400)]
Initialize BigInt's $MBI correctly with "use bigrat lib => '...'".

10 years agoRefactor t/porting/regen.t to check everything (and the return values!).
Nicholas Clark [Thu, 18 Jul 2013 14:57:00 +0000 (16:57 +0200)]
Refactor t/porting/regen.t to check everything (and the return values!).

Previously it was fire-and-forget for the 3 programs it ran (and for the
programs that regen.pl ran). Now we die if any program fails to return 0.

Also regen.t had an explicit list of programs to test. It turned out that it
was not testing regen/mk_invlists.pl. Now regen.t has a skip list of what
not to test, and everything not skipped it tested. This way any new
additions will not get missed.

This was implemented by refactoring regen.pl to read the list of programs it
runs from <DATA>, so that regen.t can open regen.pl to extract the same
list.

10 years agoSyntax check regen/uconfig_h.pl using t/porting/utils.t
Nicholas Clark [Thu, 18 Jul 2013 13:10:29 +0000 (15:10 +0200)]
Syntax check regen/uconfig_h.pl using t/porting/utils.t

It's the only regen script that we can't run as part of the tests (because it
requires a Unix shell), but can syntax check (because it only uses core
modules).

In theory we could make it skip with --tap if $Config{sh} is not what we
expect, but to be robust this looks to be a problem. Firstly, $Config{sh}
can be undef, or something "non-Unix". To be useful a whitelist needs to be
(at least) (?:/usr)?/bin/sh, and potentially also ksh. But the output is not
valid TAP:

$ ./perl -Ilib regen/uconfig_h.pl --tap
Extracting uconfig.h-new (with variable substitutions)
ok - regen/uconfig_h.pl uconfig.h

and t/TEST would choke, so we'd need to capture it or otherwise comment out
that "Extracting" line which just adds both complexity and fragility.

So the right trade off appears to be just to syntax check it.

10 years agoMissed this when updating Module-Build
Chris 'BinGOs' Williams [Wed, 24 Jul 2013 06:55:36 +0000 (07:55 +0100)]
Missed this when updating Module-Build

10 years agoperldelta for ab5c89ab2
Tony Cook [Wed, 24 Jul 2013 06:08:48 +0000 (16:08 +1000)]
perldelta for ab5c89ab2

10 years ago[perl #118907] Do not call DESTROY on empty objects with STORABLE_attach
Tony Cook [Wed, 24 Jul 2013 06:00:45 +0000 (16:00 +1000)]
[perl #118907] Do not call DESTROY on empty objects with STORABLE_attach

avoids creating temporary objects for STORABLE_attach when they aren't
needed.

10 years ago[perl #118907] bump $Storable::VERSION
Tony Cook [Wed, 24 Jul 2013 05:58:46 +0000 (15:58 +1000)]
[perl #118907] bump $Storable::VERSION

10 years ago[perl #118907] fix some issues with patch
Tony Cook [Mon, 15 Jul 2013 04:17:25 +0000 (14:17 +1000)]
[perl #118907] fix some issues with patch

10 years agoRestore Storable speed after previous fix.
Vladimir Timofeev [Fri, 12 Jul 2013 20:40:23 +0000 (00:40 +0400)]
Restore Storable speed after previous fix.

Pull out getting stash by name from macro BLESS and SEEN.
So results of gv_stashpv may be reused by calling side. This allow
to not evaluate same things twice in retrieve_hook.

10 years agoDo not call DESTROY for empty objects
Vladimir Timofeev [Thu, 11 Jul 2013 23:14:19 +0000 (03:14 +0400)]
Do not call DESTROY for empty objects

Before this fix, deserialization process for object with STORABLE_attach
hook looks like:
1. create SV of needed type
2. lookup classname
3. bless SV to class
4. lookup for STORABLE_attach
5. destroy SV
6. return result of STORABLE_attach call
As a result DESTROY method of target class was called with empty, not
initialized object. This behaviour very bad especially for non
hash-based XS objects.

Fix it, by move blessing temprorary SV after STORABLE_attach hook check.

This commit slowdown deserialization of other objects (with
STORABLE_thaw hook). It will be fixed later.

10 years ago[perl #118923] Add some edge cases to join.t
Tony Cook [Wed, 24 Jul 2013 05:39:46 +0000 (15:39 +1000)]
[perl #118923] Add some edge cases to join.t

10 years agojoin() with an empty list and undef separator may not warn in the future
Tony Cook [Wed, 24 Jul 2013 05:37:37 +0000 (15:37 +1000)]
join() with an empty list and undef separator may not warn in the future

but keep the test to avoid it changing by accident

10 years agoadd Victor Efimov to AUTHORS
Tony Cook [Wed, 24 Jul 2013 05:36:42 +0000 (15:36 +1000)]
add Victor Efimov to AUTHORS

10 years agoAdd some edge cases to join.t test
Victor Efimov [Tue, 16 Jul 2013 16:39:12 +0000 (20:39 +0400)]
Add some edge cases to join.t test

test what join return if called with empty LIST, also
test that it produce warning if separator is undef

10 years agoperldelta: note the perlopentut rewrite
Ricardo Signes [Wed, 24 Jul 2013 04:37:32 +0000 (21:37 -0700)]
perldelta: note the perlopentut rewrite