This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Father Chrysostomos [Sun, 16 Nov 2014 20:46:29 +0000 (12:46 -0800)]
perldelta: Sort updated modules
Father Chrysostomos [Sun, 16 Nov 2014 20:45:24 +0000 (12:45 -0800)]
Karen Etheridge [Sun, 16 Nov 2014 18:40:05 +0000 (10:40 -0800)]
Update ExtUtils-Manifest to CPAN version 1.69
[DELTA]
1.69 2014-11-16
- also skip _build_params, generated by Module::Build::Tiny
Father Chrysostomos [Sun, 16 Nov 2014 19:30:16 +0000 (11:30 -0800)]
perldelta for #123103 /
1d5686ec7b
Father Chrysostomos [Sun, 16 Nov 2014 19:27:52 +0000 (11:27 -0800)]
Father Chrysostomos [Sun, 16 Nov 2014 19:25:55 +0000 (11:25 -0800)]
Father Chrysostomos [Sun, 16 Nov 2014 19:22:25 +0000 (11:22 -0800)]
perldelta for #122782 /
e660c409
Father Chrysostomos [Sun, 16 Nov 2014 19:17:34 +0000 (11:17 -0800)]
perldelta for #122829 /
00e40766a
Father Chrysostomos [Sun, 16 Nov 2014 19:15:18 +0000 (11:15 -0800)]
perldelta for #121374 /
a2b5b206
Father Chrysostomos [Sun, 16 Nov 2014 19:13:11 +0000 (11:13 -0800)]
perldelta for #123057 /
e4e95921
Father Chrysostomos [Sun, 16 Nov 2014 19:09:24 +0000 (11:09 -0800)]
perldelta for
03d05f6e34e
Father Chrysostomos [Sun, 16 Nov 2014 19:07:29 +0000 (11:07 -0800)]
Father Chrysostomos [Sun, 16 Nov 2014 19:03:54 +0000 (11:03 -0800)]
perldelta for 82209a5
Father Chrysostomos [Sun, 16 Nov 2014 19:01:22 +0000 (11:01 -0800)]
Father Chrysostomos [Sun, 16 Nov 2014 19:00:32 +0000 (11:00 -0800)]
Father Chrysostomos [Sun, 16 Nov 2014 18:59:17 +0000 (10:59 -0800)]
perldelta for #122695 /
51a82aa9fb
Father Chrysostomos [Sun, 16 Nov 2014 18:57:15 +0000 (10:57 -0800)]
perldelta for #122680 /
e1729dc6ad
Father Chrysostomos [Sun, 16 Nov 2014 18:53:41 +0000 (10:53 -0800)]
perldelta for #123029
Inadvertently fixed by
c0683843e92.
Follow-up commits specific to this bug:
c4a33ec [perl #123029]: add regression test
a4f1ca6 state.t: Improve test for #123029
9f53080 sv.c: Always #define COW threshold constants
Father Chrysostomos [Sun, 16 Nov 2014 18:43:41 +0000 (10:43 -0800)]
Father Chrysostomos [Sun, 16 Nov 2014 18:34:32 +0000 (10:34 -0800)]
Increase $I18N::Langinfo::VERSION to 0.12
Slaven Rezic [Tue, 19 May 2009 20:50:45 +0000 (22:50 +0200)]
$@ check in I18N::Langinfo documentation is reversed
Daniel Dragan [Sun, 16 Nov 2014 04:45:19 +0000 (23:45 -0500)]
misc optimizing in DynaLoader
dl_last_error is "#define dl_last_error (SvPVX(MY_CXT.x_dl_last_error))"
since the data is already in a SV *, use newSVsv instead of turning it into
a strlen-ed (eventually) char *.
-win32 dl_load_file never uses flags, so don't do a SvIV in void context
- dl_load_file cant use "flags=NULL" because of test
"calling DynaLoader::dl_load_file() with no argument" in DynaLoader.t
-OS_Error_String stop repeatedly computing address into MY_CXT and
derefing after PerlProc_GetOSError
function sizes in machine code bytes on VC 2003
b4 0x69 OS_Error_String af 0x67
b4 0x9D _XS_DynaLoader_dl_error af 0x6B
b4 0x108 _XS_DynaLoader_dl_load_file af 0xD6
Daniel Dragan [Sun, 16 Nov 2014 02:00:16 +0000 (21:00 -0500)]
readd noreturn and silence "noreturn that returns" warning on MSVC
Based on commit
73758d77 (by me), in commit
117af67d629 more things got
noreturn removed on MSVC. See also ML post
"(Hugmeir) Re: [perl.git] branch blead, updated. v5.21.0-377-gdc3bf40"
This caused a measurable increase in machine code size in
117af67d629 .
In commit
73758d77 , the reason there was no increase is
Perl_magic_regdatum_set is called only through a magic vtable. Optimizing
this to noreturn is forbidden unless the struct member type specifies it
(and it obviously doesn't, since this is the magic vtable).
The other not-noreturn on MSVC function, Perl_screaminstr, has no core
usage (its only reference is in the export table) or CPAN grep usage so
therefore it is being removed. It was made fatal in commit
9e3f0d16db .
before .text section of perl521.dll on VC 2003 32b, 0xc66a3 bytes, after
0xc6453
Father Chrysostomos [Sun, 16 Nov 2014 01:39:08 +0000 (17:39 -0800)]
perldiag: Correct ‘Can't use %s for loop variable’
It is no longer true that the variable can only be a simple scalar.
More to the point, this message should never be reached. If you try
to use something prohibited as your loop variable, you get a syntax
error or ‘Missing $’.
Father Chrysostomos [Sun, 16 Nov 2014 01:26:42 +0000 (17:26 -0800)]
op.c: cmmoent typo
Father Chrysostomos [Sun, 16 Nov 2014 01:09:18 +0000 (17:09 -0800)]
op.c: Correct comment added by
c427f4d2d
Father Chrysostomos [Sat, 15 Nov 2014 21:31:40 +0000 (13:31 -0800)]
Fix double free with unterminated /(?{ <<END })/
If we are parsing from a stream (file), and we are inside a quote-like
operator, and we find a here-doc marker that tries to extract the
here-doc body from the stream (this is the last line of the quote-like
operator, or it only has one line), and the the here-doc terminator
cannot be found, then we end up trying to free a scalar twice:
$ ./miniperl -e '"${ print <<END"'
Can't find string terminator "END" anywhere before EOF at -e line 1.
Attempt to free temp prematurely: SV 0x7fcafb82fd98, Perl interpreter: 0x7fcafb803200 at -e line 1.
Attempt to free unreferenced scalar: SV 0x7fcafb82fd98, Perl interpreter: 0x7fcafb803200 at -e line 1.
I caused that in v5.17.3-187-g3328ab5.
The current line of code in the parser is usually stored in
PL_parser->linestr (aka PL_linestr) and gets freed when the parser
itself is freed.
The heredoc parser, when extracting the body from a stream, tempor-
arily sets aside PL_linestr, replacing it with another SV. If it
doesn’t find the terminator, it frees the PL_linestr value that has
been set aside, under the assumption that parser_free will take care
of freeing the new value.
Inside quote-like operators that does not work, because PL_linestr has
been localised and set to a new value, already prospectively freed via
SAVEFREESV, in sublex_push. So we can’t free that value again.
Chad Granum [Sat, 15 Nov 2014 14:39:19 +0000 (06:39 -0800)]
Update Test-Simple to alpha 074
Father Chrysostomos [Sat, 15 Nov 2014 18:31:06 +0000 (10:31 -0800)]
Don’t always skip in-memory tests is t/base/rs.t
There is no PerlIO::via::scalar, as far as I can tell. In-memory han-
dles just use PerlIO::scalar.
The code was added by
cd1a9f552. I’m not sure it was ever cor-
rect. It was intended to skip tests under -Uuseperlio (see <
20080614182005.yxuyk1mntwkog0o0@horde.wizbit.be>), but
skipped them on all builds. I’m not sure that we even support
-Uuseperlio any more.
In the mean time,
1ab48e3a screwed up the test count.
Father Chrysostomos [Sat, 15 Nov 2014 18:19:47 +0000 (10:19 -0800)]
t/base/rs.t: Suppress warning
Father Chrysostomos [Sat, 15 Nov 2014 18:09:24 +0000 (10:09 -0800)]
Put PL_cop_seqmax++ code in one spot
Father Chrysostomos [Sat, 15 Nov 2014 17:56:50 +0000 (09:56 -0800)]
[perl #115066] Fix wrongly nested ‘use’ deparsing
B::Deparse was incorrectly putting ‘use’ statements and BEGIN blocks
inside other ‘use’ statements containing do-blocks, even if they were
originally outside.
Subroutines (except for cloned closures, which we don’t have to worry
about here) have an OUTSIDE pointer, pointing to the outer sub con-
taining the declaration of the sub in question. So we can check that
to make sure we are putting the sub declaration in the right place.
Not only does this fix the reported case, but it also will allow
sequence numbers in inner subs to be reused by statements in outer
subs, which I may need in a future commit.
Father Chrysostomos [Sat, 15 Nov 2014 17:31:46 +0000 (09:31 -0800)]
Revert the ‘return’ part of
6edcbed6
The gotos were jumping over initializations, causing
C+++threads+debugging to fail.
Karl Williamson [Sat, 15 Nov 2014 16:51:28 +0000 (09:51 -0700)]
t/loc_tools.pl: try code page 1252 locales
This makes sure this common locale on Windows doesn't get overlooked.
Karl Williamson [Sat, 15 Nov 2014 16:50:51 +0000 (09:50 -0700)]
t/loc_tools.pl: Nits in comments, white-space only
Karl Williamson [Sat, 15 Nov 2014 16:48:14 +0000 (09:48 -0700)]
Silence spurious locale warnings
When testing the locales on the system, we don't want to be warned that
particular ones may not work well with Perl, as the point of the test is
to find and list the incompatibilities.
When looking for locales suitable for some purpose, we try every one
possible until we find one that matches what we're looking for. This
may entail briefly switching into locales that aren't fully compatible
with Perl. Again we don't want to be warned about such a locale. We're
not using it for anything except to determine suitability anyway.
Craig A. Berry [Sat, 15 Nov 2014 16:01:52 +0000 (10:01 -0600)]
Remove unused exit handler in vms/vms.c.
This code became obsolete in
ff7adb5275976 and has just been
sitting there taking up space.
Father Chrysostomos [Sat, 15 Nov 2014 14:41:17 +0000 (06:41 -0800)]
Spell behaviour consistently in perlsub
We had six instances without U, and two with it.
Daniel Dragan [Tue, 20 May 2014 07:23:01 +0000 (03:23 -0400)]
make debugging easier in memory allocator code in perl.c and util.c
-show intermediate values to make C debugging easier
-Perl_safesysfree overwrote var where with a different value, this caused
alot of confusion for me of trying to hunt for a pointer from a stack
trace with conditional breakpoints, so don't change var where in an
unoptimized build
-in Perl_safesysrealloc and Perl_safesysmalloc provide 1 exit path, so
the returned value is easily seen and BPed on unoptimized builds
Father Chrysostomos [Sat, 15 Nov 2014 14:34:22 +0000 (06:34 -0800)]
Deparse.t: To-do test for #115066
Jarkko Hietaniemi [Sat, 15 Nov 2014 12:59:50 +0000 (07:59 -0500)]
Helper function for 'close enough with epsilon'.
Jarkko Hietaniemi [Sat, 15 Nov 2014 12:52:12 +0000 (07:52 -0500)]
The skip count was all wrong.
Though that shows that acosh must be quite widely supported.
Jarkko Hietaniemi [Sat, 15 Nov 2014 12:46:39 +0000 (07:46 -0500)]
The
0d71ffa7 was quite sloppy with the sub-skips.
Craig A. Berry [Sat, 15 Nov 2014 03:23:19 +0000 (21:23 -0600)]
Remove vmsish pragma from one-liners in Test::Simple's exit.t.
Awaiting upstream application at:
https://github.com/Test-More/test-more/pull/494
This was broken by a recent change that added double quotes around
the double quotes that were already there.
It also hasn't been working as intended for these tests for some
time as they manipulate the exit code directly in an END block,
and that sneaks by the effects of the pragma when run at compile
time.
This works:
$ perl -e "require vmsish; import vmsish 'hushed'; END {$? = 1};"
This (which is what the tests are doing) doesn't work:
$ perl -Mvmsish=hushed -e "END {$? = 1};"
%SYSTEM-F-ABORT, abort
So we'll just live with the noise from the exit messages. They
don't seem to cause any trouble for the core test suite.
Father Chrysostomos [Sat, 15 Nov 2014 02:16:18 +0000 (18:16 -0800)]
Make $/=-1 warning default like other dep warnings
Father Chrysostomos [Sat, 15 Nov 2014 02:13:17 +0000 (18:13 -0800)]
Fold t/lib/warnings/irs into mg
It took me a while to find these tests. Most of these tests are arranged
by which C file they occur in. (These warning tests were originally
added to make sure all warnings in all C files get tested.)
Father Chrysostomos [Sat, 15 Nov 2014 02:06:38 +0000 (18:06 -0800)]
t/lib/warnings/mg: Remove comment
The warning this refers to was removed (or moved to perl5db.pl) in
commit
bbdae7b29367.
Jarkko Hietaniemi [Sat, 15 Nov 2014 02:03:47 +0000 (21:03 -0500)]
The miniperl skip in utf8cache.t was wrong.
But also test.pl needed fixing to be able to skip correctly.
Jarkko Hietaniemi [Sat, 15 Nov 2014 01:48:36 +0000 (20:48 -0500)]
quadmath: try finding if only available as gcc internal library.
Jarkko Hietaniemi [Mon, 10 Nov 2014 03:09:29 +0000 (22:09 -0500)]
C99 math: lgamma and tgamma emulations.
Jarkko Hietaniemi [Sat, 15 Nov 2014 00:42:21 +0000 (19:42 -0500)]
fdim NaN guard.
Jarkko Hietaniemi [Thu, 13 Nov 2014 23:59:38 +0000 (18:59 -0500)]
These are all emulated, so can be tested.
Jarkko Hietaniemi [Thu, 13 Nov 2014 23:49:47 +0000 (18:49 -0500)]
Emulate signbit() if necessary.
Jarkko Hietaniemi [Thu, 13 Nov 2014 12:10:01 +0000 (07:10 -0500)]
fpclassify is emulated if necessary.
Jarkko Hietaniemi [Thu, 13 Nov 2014 11:42:31 +0000 (06:42 -0500)]
checkcfgvar.pl needs autodie needs Fatal needs Scalar::Util needs lib.
Jarkko Hietaniemi [Thu, 13 Nov 2014 01:41:29 +0000 (20:41 -0500)]
We no more need to guard these with HAS_ACOSH.
Jarkko Hietaniemi [Thu, 13 Nov 2014 01:33:23 +0000 (20:33 -0500)]
Remove Cygwin cases. Case.
Jarkko Hietaniemi [Thu, 13 Nov 2014 01:33:07 +0000 (20:33 -0500)]
Remove unneeded Win32 cases.
Jarkko Hietaniemi [Thu, 13 Nov 2014 01:32:06 +0000 (20:32 -0500)]
undef c99_foo ifndef HAS_FOO
Jarkko Hietaniemi [Thu, 13 Nov 2014 01:18:23 +0000 (20:18 -0500)]
cosh and log10 are already C89.
Jarkko Hietaniemi [Thu, 13 Nov 2014 00:09:04 +0000 (19:09 -0500)]
Remove now empty case.
Jarkko Hietaniemi [Thu, 13 Nov 2014 12:01:57 +0000 (07:01 -0500)]
Tru64 more undef hints.
Jarkko Hietaniemi [Thu, 13 Nov 2014 00:07:35 +0000 (19:07 -0500)]
Remove unneeded Tru64 cases.
Jarkko Hietaniemi [Thu, 13 Nov 2014 00:05:50 +0000 (19:05 -0500)]
VMS should now be handled.
Jarkko Hietaniemi [Thu, 13 Nov 2014 00:04:47 +0000 (19:04 -0500)]
We now have symbols for llrint and llround.
Jarkko Hietaniemi [Thu, 13 Nov 2014 00:03:25 +0000 (19:03 -0500)]
Android should be doing the Configure scans.
Jarkko Hietaniemi [Wed, 12 Nov 2014 23:49:14 +0000 (18:49 -0500)]
Remove trivial unneeded cases of not having C99 math.
Jarkko Hietaniemi [Wed, 12 Nov 2014 23:47:41 +0000 (18:47 -0500)]
Only #ifndef gcc cases remain.
Jarkko Hietaniemi [Wed, 12 Nov 2014 23:47:01 +0000 (18:47 -0500)]
Remove unneeded HP-UX cases.
Jarkko Hietaniemi [Wed, 12 Nov 2014 23:35:04 +0000 (18:35 -0500)]
quadmath has tgammaq, not tgammal.
Jarkko Hietaniemi [Wed, 12 Nov 2014 12:00:56 +0000 (07:00 -0500)]
Make the C99 *l test a little bit more accepting.
Jarkko Hietaniemi [Wed, 12 Nov 2014 11:56:15 +0000 (06:56 -0500)]
The NO_C99_LONG_DOUBLE_MATH is no more used.
Jarkko Hietaniemi [Wed, 12 Nov 2014 11:54:47 +0000 (06:54 -0500)]
AIX: Configure now detect this, leave the comment.
(Some AIX do not have long double math interfaces.)
Jarkko Hietaniemi [Thu, 13 Nov 2014 01:04:41 +0000 (20:04 -0500)]
VMS configure.com C99 math symbols
Jarkko Hietaniemi [Thu, 13 Nov 2014 00:21:31 +0000 (19:21 -0500)]
checkcfgvar.pl --regen --default=undef; make regen
Jarkko Hietaniemi [Tue, 11 Nov 2014 02:12:33 +0000 (21:12 -0500)]
Add Configure symbols to all the missing C99 math APIs.
Almost all - e.g. isless() will stand in for the other isfoo()
order comparison macros.
Also not going for all the *l() versions of each interface.
Father Chrysostomos [Fri, 14 Nov 2014 20:52:27 +0000 (12:52 -0800)]
Sort perldiag
Father Chrysostomos [Fri, 14 Nov 2014 04:26:21 +0000 (20:26 -0800)]
B.pm: Document COP_SEQ_RANGE_*
Karl Williamson [Fri, 14 Nov 2014 02:59:43 +0000 (19:59 -0700)]
lib/locale.t: Display debug information under harness
This just changes any debugging (which is by default off) goes to
STDERR.
Karl Williamson [Wed, 12 Nov 2014 17:32:47 +0000 (10:32 -0700)]
Reinstate "Raise warnings for poorly supported locales"
This reverts commit
1244bd171b8d1fd4b6179e537f7b95c38bd8f099,
thus reinstating commit
3d3a881c1b0eb9c855d257a2eea1f72666e30fbc.
Karl Williamson [Fri, 14 Nov 2014 02:48:14 +0000 (19:48 -0700)]
handy.h: Add missing parentheses to macro #define
These being missing caused
3d3a881c1b0eb9c855d257a2eea1f72666e30fbc
to have to be reverted. It only shows up on platforms that don't have
an isblank() libc function.
Karl Williamson [Thu, 6 Nov 2014 05:44:17 +0000 (22:44 -0700)]
perlfunc: Fix typo
Karl Williamson [Thu, 6 Nov 2014 05:43:18 +0000 (22:43 -0700)]
Add warning message for locale/Unicode intermixing
This is explained in the added perldiag entry.
Father Chrysostomos [Fri, 14 Nov 2014 04:08:11 +0000 (20:08 -0800)]
tie.t: Don’t skip base.pm test unconditionally
but only if we are under miniperl and base has not been built yet.
I made a mistake in
19295df3 by omitting the ?. Thanks to Karl
Williamson for noticing it.
Father Chrysostomos [Fri, 14 Nov 2014 02:13:01 +0000 (18:13 -0800)]
Stop crypt($tied,...) from calling FETCH twice
It was doing so if FETCH returned a UTF8 string the first time. It
then turned on the UTF8 flag on the result of the second FETCH, even
if it wasn’t UTF8:
$ ./miniperl -e 'sub TIESCALAR{bless[substr(chr 256,0,0), chr 255]} sub FETCH{shift @{$_[0]}}tie $t, ""; crypt $t, ""'
Wide character in crypt at -e line 1.
(There are no wide characters fed to crypt() there.)
Father Chrysostomos [Fri, 14 Nov 2014 02:00:46 +0000 (18:00 -0800)]
Turn off UTF8 flag on crypt ret val
crypt was not turning off the UTF8 flag on its return value. On some
systems, such as VMS, it returns a string of random bytes, not neces-
sarily ASCII. If the UTF8 flag is already turned on on its target
(the SV used to return the value), then the return value is scrambled.
Normally crypt’s target is its own, and never gets the UTF8 flag
turned on. However, $lexical = crypt(...) gets optimised, such that
$lexical becomes the target of crypt, and crypt writes to it directly.
So it very well may have the UTF8 flag on already.
There are already tests in lex_assign.t that fail
on VMS because of this (see the thread that includes
<CA+vYcVyvq=j-vdWcODSfCjzM9-cYFYfY4hE-B1aWRRP4-=3KNA@mail.gom>), but
those tests are fragile, and this should be tested more explicitly.
Father Chrysostomos [Fri, 14 Nov 2014 00:08:49 +0000 (16:08 -0800)]
Revert "t/TEST: add -w to shebang, fix a used-once warning"
This reverts commit
da6e3e61d3d3194e7f769b7ddf7e6d16904c24d3.
This causes problems for deparse mode, which emits pages of warnings.
If we are going to add -w, we ought first to fix deparse testing to
work with it.
Father Chrysostomos [Thu, 13 Nov 2014 13:34:15 +0000 (05:34 -0800)]
‘%s found where op expected’ under fatal warnings
This is related to ticket #123195.
This code:
use warnings FATAL => 'all';
use strict;
$foo;
myfunc 1,2,3
__END__
was giving this:
Global symbol "$foo" requires explicit package name (did you forget to declare "my $foo"?) at - line 3.
(Do you need to predeclare myfunc?)
syntax error at - line 4, near "myfunc 1"
Execution of - aborted due to compilation errors.
How can we have ‘Do you need to predeclare myfunc?’ without any prior
mention of myfunc in the diagnostics? Fatal warnings were modified in
594b6fac to queue compile-time warning and emit them as part of the
error message. But the logic was not quite right for yywarn, which is
used for ‘foo found where operator expected’. The warning was just
disappearing outside of an eval. qerror was treating PL_in_eval as
a boolean, so we need to clear the flag we have just set, before
we call it.
Steve Hay [Thu, 13 Nov 2014 13:14:42 +0000 (13:14 +0000)]
Father Chrysostomos [Thu, 13 Nov 2014 12:46:30 +0000 (04:46 -0800)]
Alphabetise perldiag
Father Chrysostomos [Thu, 13 Nov 2014 12:52:55 +0000 (04:52 -0800)]
[Merge] Constant inlining clean-up
This branch makes perl more consistent in how it turns sub(){...} into
a constant.
Previously, it did not behave as documented, or at least not all the
time. And whether an anonymous sub was clonable made a difference to
the behaviour. Clonable subs are usually closures, but they could
also be anonymous subs containing state declarations or string evals,
or any anonymous subs under the debugger. ‘Closures’ below includes
any clonable subs.
• Explicit return never makes a constant (as promised in the docs).
• Statements optimised away are ignored (not just with closures).
• Lvalue and custom attributes now prevent constants with closures,
as they have already done for non-closures.
• Method attributes no longer prevent constants with non-closures.
• Closing over a variable potentially modified elsewhere will con-
tinue to make a constant as before, but is detected and deprecated.
• More complex cases than sub(){$x}, such as sub(){foo() if 0; $x}
just follow the new behaviour, which is not to make a constant if
$x is modifiable elsewhere.
And a few other bug fixes.
Father Chrysostomos [Thu, 13 Nov 2014 06:29:27 +0000 (22:29 -0800)]
Document sub inlining changes
Most of the changes do not need to be documented, because the previous
behaviour did not match the documentation or was just plain buggy.
Father Chrysostomos [Tue, 4 Nov 2014 21:25:49 +0000 (13:25 -0800)]
pad.c:cv_clone_pad: Avoid copying sv
When we capture the lexical variable in order to make sub () {$x}
constant, we don’t have to copy it if it is not modified or referenced
elsewhere.
Father Chrysostomos [Tue, 4 Nov 2014 06:28:08 +0000 (22:28 -0800)]
Account for state vars when const-izing sub(){$x}
If the only lvalue use of a lexical ‘my’ variable is its declaration,
then it is fine to turn a sub that closes over it into a constant.
But with state variables we have to be a little more careful.
This is fine:
state $x = something();
sub () { $x }
because the variable is only assigned to once. But this modifies the
same variable every time the enclosing sub is called:
state $x++;
sub () { $x }
So that closure must remain a closure, and not become a constant.
(However, for a simple lexical scalar in the sub like that, we still
make it a constant, but deprecate the usage.)
Father Chrysostomos [Tue, 4 Nov 2014 06:18:11 +0000 (22:18 -0800)]
Account for string eval when const-izing sub(){$x}
If we have a string eval in the same scope as the variable, it is
potentially in value context.
Father Chrysostomos [Tue, 4 Nov 2014 01:56:11 +0000 (17:56 -0800)]
Make op.c:op_const_sv static
It is no longer called from any other file.
Father Chrysostomos [Tue, 4 Nov 2014 01:53:01 +0000 (17:53 -0800)]
Inline op_const_sv into cv_clone
op_const_sv is actually two functions in one. This particular calling
convention (CvCONST) was used only by cv_clone.
Half the code was not even necessary for cv_clone’s use (the other
half only for its use), so this reduces the total number of lines.
Father Chrysostomos [Mon, 3 Nov 2014 06:24:32 +0000 (22:24 -0800)]
Make sub () { 0; 3 } inlinable once more
It probably stopped being inlinable in commit
beab0874143b.
Following op_next pointers to see whether a sub’s execution chain con-
sists of a constant followed by sub exit does not make sense if the
op_next pointers have not been set up yet.
So call LINKLIST earlier, so that we can merge the two calls to
op_const_sv in newATTRSUB (no need to search for constants twice).
That will allow sub () { 0; 3 } to be inlined once more, as it was in
perl 5.005 (I checked) and probably in 5.6, too (I didn’t check).
This also allows us to remove initial the OP_LINESEQ check, which
was added to help this function into the block when we have no
op_next pointers.
op_const_sv is now called only before the peephole optimiser and
finalize_op, which removes the need for the special explicit return
check (it hasn’t been optimised out of the execution chain yet) and
the need to account for constants that have been relocated to the pad
by finalize_op.
Father Chrysostomos [Mon, 3 Nov 2014 05:54:22 +0000 (21:54 -0800)]
Allow sub():method{CONSTANT} to be inlined
This brings non-closure subs into conformity with closures.
Father Chrysostomos [Mon, 3 Nov 2014 05:34:23 +0000 (21:34 -0800)]
First arg to op_const_sv is never null