Increase $OptreeCheck::VERSION to 0.10

though I still don’t understand why it has a version at all.
[perl #78194] Make sub calls copy pad tmps

before aliasing them to elements of @_.
constant.t: Correct version

I didn’t have this done in time for 5.19.1.
[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.
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.
[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).
Stop folding of ops from changing mutability

If $a+$b produces a mutable value, then so should 1+2.
[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).
[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.
[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.
[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.
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.)
Increase $constant::VERSION to 1.28
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
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.
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.
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.
Tweak optree_constants.t for inlined list consts
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.
[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