This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Father Chrysostomos [Thu, 18 Sep 2014 06:21:11 +0000 (23:21 -0700)]
Remove GVf_IN_PAD
Nothing on CPAN uses it, but some CPAN modules use the associ-
ated macros.
Father Chrysostomos [Thu, 18 Sep 2014 06:18:54 +0000 (23:18 -0700)]
Only #define IS_(PADGV|CONST) if !PERL_CORE
and give IS_PADGV a simpler definition.
These are not used in the perl core any more and shouldn’t be.
The IS_PADGV definition checked for the IN_PAD flag, which flag never
made much sense (see the prev. commit’s message). Since any GV could
end up with that flag, and since any GV coming near a pad would get
it, it might as well have been turned on for all GVs (except copies).
So just check whether the thingy is a GV.
Father Chrysostomos [Thu, 18 Sep 2014 06:13:33 +0000 (23:13 -0700)]
pad.c: Stop turning on GvIN_PAD
This flag never really made any sense. It allows us to identify
whether a GV is being used by a pad (e.g., for *foo under ithreads),
but *any* GV could have this set and there is no way to know whether
it was set for the pad we are currently looking at.
Father Chrysostomos [Thu, 18 Sep 2014 05:10:47 +0000 (22:10 -0700)]
Remove !IS_PADGV assertions
Commit
60779a30f stopped setting PADTMP on GVs in pads,
and changed many instances of if(SvPADTMP && !IS_PADGV) to
if(SvPADTMP){assert(!IS_PADGV)...}.
This PADTMP was leftover from the original ithreads implementation
that marked these as PADTMP under the assumption that anything in a
pad had to be marked PADMY or PADTMP.
Since we don’t want these GVs copied the way operator targets are
(PADTMP indicates the latter), we needed this !IS_PADGV check all over
the place.
60779a30f was actually right in removing the flag and the !IS_PADGV
check, because it should be possible for XS modules to create ops that
return copiable GVs. But the assertions prevent that from working.
More importantly (to me at least), this IS_PADGV doesn’t quite make
sense and I am trying to eliminate it.
BTW, you have to be doubly naughty, but it is possible to fail these
assertions:
$ ./perl -Ilib -e 'BEGIN { sub { $::{foo} = \@_; constant::_make_const(@_) }->(*bar) } \ foo'
Assertion failed: (!IS_PADGV(sv)), function S_refto, file pp.c, line 576.
Abort trap: 6
Father Chrysostomos [Thu, 18 Sep 2014 03:35:15 +0000 (20:35 -0700)]
Change IS_PADGV to isGV in op.c:newPADOP
IS_PADGV is about to go bye-bye. IS_PADGV was returning true only
for GVs marked as being present in the pad. But since any GV can
make its way in there (just mention *foo under threads), it’s actually
somewhat meaningless.
This check in newPADOP is perhaps useless, too, since it is only called
by newGVOP in core (so sv is always a GV), and by B::Generate on CPAN,
which, again, gives it a GV.
Father Chrysostomos [Thu, 18 Sep 2014 03:30:00 +0000 (20:30 -0700)]
pad.c:padlist_clone: Don’t bother with IS_PADGV
As of
c9859fbde1 and
c2bad63bb3, PadnamePV(name) will be non-null
for all pad GVs.
Father Chrysostomos [Thu, 18 Sep 2014 03:28:21 +0000 (20:28 -0700)]
pad.c:pad_push: Don’t bother with IS_PADGV
As of
c9859fbde1 and
c2bad63bb3, PadnamePV(name) will be true for
all pad GVs.
Father Chrysostomos [Thu, 18 Sep 2014 03:27:46 +0000 (20:27 -0700)]
pad.c:cv_clone_pad: Don’t bother with IS_PADGV
As of
c9859fbde1 and
c2bad63bb3, namesv && PadnamePV(namesv) will be
true for all pad GVs.
Father Chrysostomos [Thu, 18 Sep 2014 03:25:54 +0000 (20:25 -0700)]
pad.c:pad_tidy: Remove IS_PADCONST and another IS_PADGV
Checking these is no longer necessary, since the only thing this loop
does is handle entries that close over variables from outer subrou-
tines. IS_PADGV and IS_PADCONST will never be true for those.
Father Chrysostomos [Thu, 18 Sep 2014 03:23:29 +0000 (20:23 -0700)]
pad.c:pad_tidy: Remove redundant IS_PADGV
GVs are stored in the pads in two code paths, newPADOP when called by
newGVOP, and ck_rvconst. Both of those now set the pad name to
&PL_sv_no, as of
c9859fbde1 and
c2bad63bb3. So GVs are now excluded
from the check a few lines below, just like constants.
Father Chrysostomos [Thu, 18 Sep 2014 03:20:53 +0000 (20:20 -0700)]
pad.c:pad_alloc: Remove redundant IS_PADGV
GVs are stored in the pads in two code paths, newPADOP when called by
newGVOP, and ck_rvconst. Both of those now set the pad name to
&PL_sv_no, as of
c9859fbde1 and
c2bad63bb3. So by the time this
check is reached, IS_PADGV can never be true.
Karl Williamson [Fri, 5 Sep 2014 04:48:22 +0000 (22:48 -0600)]
regcomp.c: White-space only
Karl Williamson [Thu, 18 Sep 2014 04:42:17 +0000 (22:42 -0600)]
perlop: Nits
Karl Williamson [Thu, 18 Sep 2014 02:58:20 +0000 (20:58 -0600)]
bisect-runner.pl: Correct pod misspelling
Jarkko Hietaniemi [Sat, 13 Sep 2014 23:10:54 +0000 (19:10 -0400)]
POSIX pod tweaks.
Steve Hay [Wed, 17 Sep 2014 20:52:31 +0000 (21:52 +0100)]
perldelta - Fix a typo and remove a trailing space
Jarkko Hietaniemi [Wed, 17 Sep 2014 17:42:22 +0000 (13:42 -0400)]
Use more NAN_COMPARE_BROKEN.
VC6 landed on new code paths thanks to more NaN.
Jarkko Hietaniemi [Wed, 17 Sep 2014 17:40:10 +0000 (13:40 -0400)]
If numtype is inf/nan, don't bother with Atof.
Jarkko Hietaniemi [Wed, 17 Sep 2014 17:01:03 +0000 (13:01 -0400)]
If numtype is inf/nan, don't do Atof and iv/uv cast.
The return values are bogus, especially so for nan, but what can you do.
Yves Orton [Wed, 17 Sep 2014 14:14:01 +0000 (16:14 +0200)]
silence diagnostics in regen/regcomp.pl for now
Jarkko Hietaniemi [Wed, 17 Sep 2014 13:45:02 +0000 (09:45 -0400)]
Use the Perl_isfinite multiplication fallback last.
Otherwise we shadow e.g. the Win32 _isfinite.
Steve Hay [Wed, 17 Sep 2014 13:12:12 +0000 (14:12 +0100)]
regen_config_h for GCC
(Note: Had to locally undo
c69a26e800 to avoid trouble redefining stdio to
PerlIO when building in a minimal configuration with USE_PERLIO=undef!)
Steve Hay [Wed, 17 Sep 2014 13:08:47 +0000 (14:08 +0100)]
Define PERL_PRI[efg]ldbl and PERL_SCNfldbl in Win32 canned config files
Without PERL_PRIgldbl, the gcc build on Win32 is completely broken,
stopping at sv.c in the miniperl build since
61cd60c6c5 added a use of
PERL_PRIgldbl in its new FV_GF.
Steve Hay [Wed, 17 Sep 2014 12:59:04 +0000 (13:59 +0100)]
regen_config_h for VC++
(Note: Had to locally undo
c69a26e800 to avoid trouble redefining stdio to
PerlIO when building in a minimal configuration with USE_PERLIO=undef!)
Steve Hay [Wed, 17 Sep 2014 12:57:18 +0000 (13:57 +0100)]
Eliminate pointless win32/makefile.mk macro
As per
6e75769d30 and previous commit.
Steve Hay [Wed, 17 Sep 2014 12:36:30 +0000 (13:36 +0100)]
Remove pointless variable in win32/config_sh.PL
$int64f is always 'I64' since
6e75769d30 so there is no longer any point
in it.
Steve Hay [Wed, 17 Sep 2014 07:48:26 +0000 (08:48 +0100)]
Module::CoreList - re-order so that Porting/corelist.pl runs ok
Steve Hay [Wed, 17 Sep 2014 07:38:47 +0000 (08:38 +0100)]
perldelta - Add links for rt.perl.org bugs
Steve Hay [Wed, 17 Sep 2014 07:33:31 +0000 (08:33 +0100)]
perldelta - Start updating modules
Steve Hay [Wed, 17 Sep 2014 07:26:26 +0000 (08:26 +0100)]
Remove reference to obsolete threads version in Porting/cmpVERSION.pl
Steve Hay [Wed, 17 Sep 2014 07:24:56 +0000 (08:24 +0100)]
Teach Porting/cmpVERSION.pl about Scalar-List-Utils (broken by
cb8c84586a)
Yves Orton [Wed, 17 Sep 2014 04:57:26 +0000 (06:57 +0200)]
only produce diagnostic warnings in regen/regcomp.pl when STDERR is a terminal
Yves Orton [Wed, 17 Sep 2014 02:36:57 +0000 (04:36 +0200)]
Perl RT #122761 - split /\A/ should not behave like split /^/m
Long ago a weird special case was hacked into split so that it
treated C<split /^/> as if it was C<split /^/m>. At the time this
was done by letting the split PP code inspect the pattern, and IFF
it matched "^\0" the special behavior was enabled (which also
bypasses using the regex engine for matching.)
Later on when we added pluggable regex engines and when we
encountered various counter-intuitive behaviors related to split
we changed who this worked so that the regex engine would
set flags appropriate for split to use. This meant that regex
plugins using totally different regex syntax could still enable
the optimisation. At the same time I modified how we detected
this pattern type by looking at the *compiled* regops, and not
the raw pattern. This had the side effect of making things like
C< split /(?:)^/ > also enable the optimisation.
Unfortunately this did not play nicely with the fact that /^/
produces an SBOL node, as does /\A/, but we definitely don't want
C<split /\A/> to behave like C<split /^/m>. In fact C<split /\A/>
should behave like a noop (which means there is room for a future
optimisation here if someone cares to implement it.)
In the discussion attached to the ticket I propose what I consider
to be a better fix, default split patterns to be compiled by default
with the /m modifier enabled. This patch does NOT do this. It is
instead the "simple" patch. This means that C<split /^/> behaves like
C<split /^/m> but C<split /^x/> does NOT behave like C<split /^x/m>
which I consider to be a bug which I will fix in a future patch.
Yves Orton [Wed, 17 Sep 2014 02:10:35 +0000 (04:10 +0200)]
change NODE_ALIGN_FILL to set flags to 0
In
075abff3 Andy Lester set the flags field of regops
to default to 0xde. I find this really weird, and possibly dangerous,
as it seems to me reasonable to assume a new regop would have this
field set to 0, so that later on code can set it to something else
if necessary. (Which is what I wanted to do.)
Since nothing breaks if I set it to 0x0 and I find that to be a much
more natural default than 0xde (the prefix of 0xdeadbeef), I am
changing this to set it to 0.
Yves Orton [Tue, 16 Sep 2014 22:23:01 +0000 (00:23 +0200)]
Eliminate the duplicative regops BOL and EOL
See also perl5porters thread titled: "Perl MBOLism in regex engine"
In the perl 5.000 release (
a0d0e21ea6ea90a22318550944fe6cb09ae10cda)
the BOL regop was split into two behaviours MBOL and SBOL, with SBOL
and BOL behaving identically. Similarly the EOL regop was split into
two behaviors SEOL and MEOL, with EOL and SEOL behaving identically.
This then resulted in various duplicative code related to flags and
case statements in various parts of the regex engine.
It appears that perhaps BOL and EOL were kept because they are the
type ("regkind") for SBOL/MBOL and SEOL/MEOL/EOS. Reworking regcomp.pl
to handle aliases for the type data so that SBOL/MBOL are of type
BOL, even though BOL == SBOL seems to cover that case without adding
to the confusion.
This means two regops, a regstate, and an internal regex flag can
be removed (and used for other things), and various logic relating
to them can be removed.
For the uninitiated, SBOL is /^/ and /\A/ (with or without /m) and
MBOL is /^/m. (I consider it a fail we have no way to say MBOL without
the /m modifier). Similarly SEOL is /$/ and MEOL is /$/m (there is
also a /\z/ which is EOS "end of string" with or without the /m).
Jarkko Hietaniemi [Tue, 16 Sep 2014 20:59:46 +0000 (16:59 -0400)]
Do not test inf/nan if utterly broken.
(The test for the brokenness was ... broken.)
(I think FC pointed this out some weeks ago.)
Jarkko Hietaniemi [Tue, 16 Sep 2014 21:20:54 +0000 (17:20 -0400)]
[perl #122788] broken nan on win32
Apparently VS 2003 smartly optimizes (HUGE_VAL-HUGE_VAL) into zero,
so using that for NaN was quite a disaster. Let instead Win32 fall
thru to the __PL_nan_u option. (HUGE_VAL for Inf is fine.)
Father Chrysostomos [Tue, 16 Sep 2014 22:50:49 +0000 (15:50 -0700)]
op.c: new is a keyword in C++
Father Chrysostomos [Tue, 16 Sep 2014 21:52:11 +0000 (14:52 -0700)]
Father Chrysostomos [Tue, 16 Sep 2014 21:51:17 +0000 (14:51 -0700)]
Father Chrysostomos [Tue, 16 Sep 2014 21:49:03 +0000 (14:49 -0700)]
Fix $DB::sub in DB::goto for lexical subs
$ PERL5DB='sub DB::DB{}' ./perl -Ilib -XMfeature=:all -de '
state sub f{};
sub DB::goto { warn $DB::sub }
$^P|=0x80;
sub {goto &f}->()'
main::f at -e line 1.
There should not be a package name. Lexical subs should be treated
like anonymous subs here; $DB::sub should contain a reference.
This bug was introduced recently, in
ae77754ae. Before that the
output was:
CODE(0x7fdbf102de58) at -e line 1.
Though before
9d8e4b9b3 it was:
Segmentation fault: 11
Steve Hay [Tue, 16 Sep 2014 21:39:39 +0000 (22:39 +0100)]
Make "NEWS" an IGNORABLE file
Term-ANSIColor-4.03 added a NEWS file which wasn't pulled in by
5e64492f64,
probably in the belief that it was IGNORABLE. Now it is!
Steve Hay [Tue, 16 Sep 2014 21:39:04 +0000 (22:39 +0100)]
Add new Digest-SHA file missed by
207902b174, and note a CUSTOMIZED file
Father Chrysostomos [Tue, 16 Sep 2014 20:10:38 +0000 (13:10 -0700)]
Make sort bareword respect lexical subs
—something I completely missed when implementing them.
Chris 'BinGOs' Williams [Tue, 16 Sep 2014 17:31:23 +0000 (18:31 +0100)]
Update ExtUtils-Manifest to CPAN version 1.68
[DELTA]
1.68 Tue, Sep 16, 2014
- Fix regression with manifind() and following symlinks
Father Chrysostomos [Tue, 16 Sep 2014 16:43:31 +0000 (09:43 -0700)]
Make ‘No comma allowed’ respect lex subs
$ ./perl -lIlib -XMfeature=:all -e 'sub foo {} print foo,bar'
bar
$ ./perl -lIlib -XMfeature=:all -e 'state sub foo {} print foo,bar'
No comma allowed after filehandle at -e line 1.
This commit makes the latter behave like the former.
Father Chrysostomos [Tue, 16 Sep 2014 12:47:17 +0000 (05:47 -0700)]
lexsub.t: To-do tests for sort lex_sub
Father Chrysostomos [Tue, 16 Sep 2014 12:32:35 +0000 (05:32 -0700)]
toke.c: Remove obsolete comment
345b37853 removed the associated parameter.
Chris 'BinGOs' Williams [Tue, 16 Sep 2014 12:12:40 +0000 (13:12 +0100)]
Update ExtUtils-Install to CPAN version 2.04
[DELTA]
2.04
- Cosmetic change as forgot to update version information in POD on last two
releases
2.02
- Reverted change to pm_to_blib that causes write-only directory paths to
be created
2.00
- Formal release to change META information and synchronise versioning
Chris 'BinGOs' Williams [Tue, 16 Sep 2014 09:01:26 +0000 (10:01 +0100)]
Synchronise Maintainers.pl for Module-CoreList
Steve Hay [Tue, 16 Sep 2014 08:24:11 +0000 (09:24 +0100)]
Note that one MakeMaker test is currently CUSTOMIZED
Steve Hay [Tue, 16 Sep 2014 08:11:18 +0000 (09:11 +0100)]
Remove IGNORABLE files from ExtUtils-Install as per
8db6555210
(now that it's under cpan/, rather than dist/, since
d393d7e5ec)
Steve Hay [Tue, 16 Sep 2014 08:00:39 +0000 (09:00 +0100)]
Upgrade Archive-Tar from version 2.00 to 2.02
Steve Hay [Tue, 16 Sep 2014 07:53:07 +0000 (08:53 +0100)]
Update 5.20 release schedule: Plan for 5.20.2 in January
And add a missing development release engineer to the list.
Father Chrysostomos [Tue, 16 Sep 2014 05:27:05 +0000 (22:27 -0700)]
Exclude lex sub package name from (caller $n)[3]
Commit
ae77754ae caused it to start including the package name. Pre-
viously, lexical subs were reported as ‘(unknown)’.
Now we have more expected output:
$ ./perl -Ilib -XMfeature=:all -e 'my sub x{warn +(caller 0)[3]} x'
x at -e line 1.
Father Chrysostomos [Tue, 16 Sep 2014 03:39:22 +0000 (20:39 -0700)]
mg.c: Avoid reifying GV for undefined sig handler
Father Chrysostomos [Tue, 16 Sep 2014 03:34:32 +0000 (20:34 -0700)]
Make ‘SIG handler not defined’ UTF8- and null-safe
Father Chrysostomos [Tue, 16 Sep 2014 01:03:41 +0000 (18:03 -0700)]
Avoid reifing GVs in gv.c:gv_try_downgrade
I’m not sure that it’s even possible for a CV with a name hek to reach
this code path, but if that happens this avoids reifying the GV.
Father Chrysostomos [Tue, 16 Sep 2014 00:54:51 +0000 (17:54 -0700)]
Fix compiler warnings
See ticket #116735.
Father Chrysostomos [Mon, 15 Sep 2014 23:56:46 +0000 (16:56 -0700)]
Father Chrysostomos [Mon, 15 Sep 2014 23:11:03 +0000 (16:11 -0700)]
Avoid reifying GVs when lex subs are used for overload
Takes more code, but I think the new code is clearer....
Father Chrysostomos [Mon, 15 Sep 2014 22:53:31 +0000 (15:53 -0700)]
Stop undef &foo from temporarily anonymising
Instead of setting aside the name, calling cv_undef, and then naming
the sub anew, just pass a flag to tell cv_undef not to unname it.
Father Chrysostomos [Mon, 15 Sep 2014 21:50:00 +0000 (14:50 -0700)]
Avoid reifying GV when lex stub is used as method
Ricardo Signes [Mon, 15 Sep 2014 23:03:36 +0000 (19:03 -0400)]
delete/exists on array elements is discouraged, not deprecated
For further discussion, see (among other things)
http://nntp.perl.org/group/perl.perl5.porters/218752
Ricardo Signes [Mon, 15 Sep 2014 22:19:41 +0000 (18:19 -0400)]
document how to graduate from experimental status
Ricardo Signes [Mon, 15 Sep 2014 22:19:28 +0000 (18:19 -0400)]
release schedule: Max M. will do December 2014
Father Chrysostomos [Mon, 15 Sep 2014 21:28:22 +0000 (14:28 -0700)]
Fix assertion failure with undef &my_sub/&anon
$ ./perl -Ilib -le 'use experimental lexical_subs; my sub x; undef &x;'
Assertion failed: (isGV_with_GP(_gvname_hek)), function Perl_leave_scope, file scope.c, line 1035.
Abort trap: 6
pp_undef undefines a subroutine via cv_undef, which wipes out the
name, and then restores the name again afterwards.
For subs with GVs, it would call CvGV_set afterwards with the same gv.
But cv_undef could have freed the GV, if the CV held the only refer-
ence count.
I caused this for lexical subs a few commits ago in
ae77754ae (because
CvGV will always return non-null; in fact the CvNAME_HEK code in
pp_undef is no longer exercised, but I will address that soon).
For anonymous subs it is older:
$ perl5.14.4 -e '$_ = sub{}; delete $::{__ANON__}; undef &$_; use Devel::Peek; Dump $_'
SV = IV(0x7fed9982f9c0) at 0x7fed9982f9d0
REFCNT = 1
FLAGS = (ROK)
RV = 0x7fed9982f9e8
SV = PVCV(0x7fed9982e290) at 0x7fed9982f9e8
REFCNT = 2
FLAGS = (PADMY,WEAKOUTSIDE,CVGV_RC)
COMP_STASH = 0x7fed99806b68 "main"
ROOT = 0x0
GVGV::GV = 0x7fed9982fa48Assertion failed: (isGV_with_GP(_gvname_hek)), function Perl_do_gvgv_dump, file dump.c, line 1477.
Abort trap: 6
(Probably commit
803f2748.)
Presumably that could be made to crash in other ways than introspec-
tion, but it is much harder.
This commit fixes the problem by fiddling with reference counts. But
this is only a temporary fix. I think I plan to stop cv_undef from
removing the name (gv/hek) when called from pp_undef.
Father Chrysostomos [Mon, 15 Sep 2014 16:35:50 +0000 (09:35 -0700)]
Peek.t needs to know about the prev. change
Father Chrysostomos [Mon, 15 Sep 2014 16:34:41 +0000 (09:34 -0700)]
dump.c: Don’t dump GvFLAGS as part of GP
The flags are not actually stored in the GP. Dumping them as part of
it implies that they are shared between globs that share the same GP,
which is not the case.
Father Chrysostomos [Mon, 15 Sep 2014 16:41:57 +0000 (09:41 -0700)]
Father Chrysostomos [Mon, 15 Sep 2014 16:42:13 +0000 (09:42 -0700)]
perldelta: Insert missing =item
Father Chrysostomos [Mon, 15 Sep 2014 06:03:08 +0000 (23:03 -0700)]
Increase $Term::ReadLine::VERSION to 1.15
Father Chrysostomos [Mon, 15 Sep 2014 06:02:01 +0000 (23:02 -0700)]
Term::ReadLine: Check $^O before -e
Put faster checks first. $^O is internal to perl, but -e has to go
out to the file system.
Father Chrysostomos [Mon, 15 Sep 2014 13:22:30 +0000 (06:22 -0700)]
universal.c:croak_xs_usage: Don’t fetch context twice
Father Chrysostomos [Mon, 15 Sep 2014 13:20:16 +0000 (06:20 -0700)]
[Merge] CVs without GVs
Subroutines in packages no longer need typeglobs to live in. Concep-
tually the typeglobs still exist, and will be reified as necessary.
(This was already the case with constant subs, which could be stored
in the stash as refs to constants, but now the stash can have sub
refs, too.)
Currently this optimisation is undone if a sub is exported or used as
a method. Also, it does not apply to XSUBs.
Here is the full list of notable changes:
Internal:
• CvGV now reifies the GV if necessary.
• Lexical subs now have notional GVs, which are likewise rei-
fied by CvGV.
• The new CVf_LEXICAL flag indicates that the package name should be
dropped in error messages.
XS API:
• New cv_name function
• New cv_set_call_checker_flags function
Perl-visible changes:
• New B::safename function
Father Chrysostomos [Sat, 13 Sep 2014 03:26:04 +0000 (20:26 -0700)]
concise-xs.t needs to know about B::safename
Father Chrysostomos [Fri, 12 Sep 2014 21:14:07 +0000 (14:14 -0700)]
Tweak Peek.t again
Father Chrysostomos [Fri, 12 Sep 2014 20:40:41 +0000 (13:40 -0700)]
dump.c: Missing comma from CVf_HASEVAL output
Father Chrysostomos [Fri, 12 Sep 2014 20:38:23 +0000 (13:38 -0700)]
Teach Deparse about coderefs in stashes
Father Chrysostomos [Fri, 12 Sep 2014 20:33:55 +0000 (13:33 -0700)]
Increase $B::VERSION to 1.51
Father Chrysostomos [Fri, 12 Sep 2014 20:33:29 +0000 (13:33 -0700)]
Add safename() func to B
Father Chrysostomos [Fri, 12 Sep 2014 06:53:36 +0000 (23:53 -0700)]
Remove no-longer-used op.c:S_gv_ename
Father Chrysostomos [Fri, 12 Sep 2014 06:52:41 +0000 (23:52 -0700)]
Teach ck_entersub_args_proto about non-GV names
Now ck_subr no longer needs to vivify GVs:
$ ./miniperl -e 'sub foo{} BEGIN { warn $::{foo} } foo(); BEGIN { warn $::{foo} }'
CODE(0x7fc98282ad98) at -e line 1.
CODE(0x7fc98282ad98) at -e line 1.
Previously it was like this:
$ ./miniperl -e 'sub foo{} BEGIN { warn $::{foo} } foo(); BEGIN { warn $::{foo} }'
CODE(0x7f8ef082ad98) at -e line 1.
*main::foo at -e line 1.
Father Chrysostomos [Fri, 12 Sep 2014 06:44:45 +0000 (23:44 -0700)]
Inline op.c:too_many_arguments_sv into its only caller
I’m about to change this code anyway, and it’s easier in one spot.
Father Chrysostomos [Fri, 12 Sep 2014 06:42:45 +0000 (23:42 -0700)]
Inline op.c:too_few_arguments_sv into its only caller
I’m about to change this code anyway, and it’s easier in one spot.
Father Chrysostomos [Fri, 12 Sep 2014 05:49:44 +0000 (22:49 -0700)]
Teach dump.c about CVf_LEXICAL
Father Chrysostomos [Fri, 12 Sep 2014 05:49:18 +0000 (22:49 -0700)]
Teach dump.c about CVf_NAMED
I should have added this in perl 5.18.
Father Chrysostomos [Fri, 12 Sep 2014 00:59:11 +0000 (17:59 -0700)]
op.c:ck_subr: reify GVs based on call checker
Instead of faking up a GV to pass to the call checker if we have a
lexical sub, just get the GV from CvGV (since that will reify the GV,
even for lexical subs), unless the call checker has not specifically
requested GVs.
For now, we assume the default call checker cannot handle non-GV sub
names, as indeed it cannot. An imminent commit will rectify that.
The code in scope.c was getting the name hek from the proto CV (stowed
in magic on the pad name) if the CV in the pad had lost it. Now, the
proto CV can lose it at compile time via CvGV, so that does not work
anymore. Instead, just get it from the GV.
Father Chrysostomos [Fri, 12 Sep 2014 05:53:42 +0000 (22:53 -0700)]
Use cv_name in pp_hot.c:sub_crush_depth
The next commit will allow lexical subs with GVs to reach this code
path, so use cv_name, since it knows how to handle those.
Father Chrysostomos [Thu, 11 Sep 2014 20:37:15 +0000 (13:37 -0700)]
Add cv_set_call_checker_flags
This is like cv_set_call_checker, except that it allows the caller to
decide whether the call checker needs a GV.
Currently the GV flag is recorded, but ck_subr does not do anything
with it yet.
Father Chrysostomos [Thu, 11 Sep 2014 05:06:10 +0000 (22:06 -0700)]
pad.c: Avoid struct name followed by colon
Some old clang++ versions have trouble with this. See ticket #112786.
Father Chrysostomos [Thu, 11 Sep 2014 05:01:15 +0000 (22:01 -0700)]
pad.c:cv_name: Reword docs for future extensibility
Father Chrysostomos [Thu, 11 Sep 2014 03:29:19 +0000 (20:29 -0700)]
Avoid reifying GVs in rv2cv
\&foo no longer reifies GVs in the stash:
$ ./miniperl -e 'sub foo{} warn $::{foo}; \&foo; warn $::{foo}'
CODE(0x7fab6282ad98) at -e line 1.
CODE(0x7fab6282ad98) at -e line 1.
Sub calls still reify them though, because of the way ck_subr cur-
rently works.
Constant proxies are still upgraded to full GVs for now, just to mini-
mise the churn per patch.
This makes it possible for OP_GVs to point to things other than GVs,
and these things are stored in the pad under threads. Hence, pad_tidy
could turn on PADTMP, and then IS_PADGV becomes true when it is
upgraded to a glob, so refgen will fail assertions. There is actually
no need to turn on PADTMP in pad_tidy, since it will already be on for
op targets. (We need to get rid of IS_PADGV one of these days. It
doesn’t actually do anything.)
Father Chrysostomos [Wed, 10 Sep 2014 21:23:53 +0000 (14:23 -0700)]
op.c: ck_rvconst: Inline the noexpand var
It is only used once now, and its name is about to become confusing,
as GV_NOEXPAND will be used for all CVs.
Father Chrysostomos [Sun, 7 Sep 2014 05:59:36 +0000 (22:59 -0700)]
Increase $Attribute::Handlers::VERSION to 0.97
Father Chrysostomos [Sat, 6 Sep 2014 23:22:53 +0000 (16:22 -0700)]
Tweak Peek.t
beab08741 introduced XSUB constants, but the code it added to
newATTRSUB does not set CvSTASH if there is already a CV stub. It
does set it if there is no sub there at all (because it goes through
newCONSTSUB).
Recent changes have made constant declarations like ‘sub foo(){}’
put just a constant reference in the stash if possible, the way con-
stant.pm does. When this gets upgraded to a typeglob, the CV is rei-
fied via newCONSTSUB, so it gets a CvSTASH pointer.
CvSTASH on a constant sub really makes no difference in practice.
It’s mostly cosmetic.
This exercises the two code paths with the oldest perl installa-
tion I have:
$ /opt/bin/perl5.8.8 -MDevel::Peek -e 'BEGIN{\&foo} sub foo(){3} Dump \&foo'
SV = RV(0x9baa18) at 0x98d580
REFCNT = 1
FLAGS = (TEMP,ROK)
RV = 0x9b7398
SV = PVCV(0x9b4810) at 0x9b7398
REFCNT = 2
FLAGS = (POK,pPOK,CONST)
IV = 0
NV = 0
PROTOTYPE = ""
COMP_STASH = 0x98d4a8 "main" <----------
ROOT = 0x0
XSUB = 0x5bb44
XSUBANY =
10018864
GVGV::GV = 0x98df7c "main" :: "foo"
FILE = "-e"
DEPTH = 0
FLAGS = 0x200
OUTSIDE_SEQ = 96
PADLIST = 0x98e228
PADNAME = 0x98e24c(0x0) PAD = 0x98e264(0x22d560)
OUTSIDE = 0x98df34 (UNIQUE)
$ /opt/bin/perl5.8.8 -MDevel::Peek -e 'sub foo(){3} Dump \&foo'
SV = RV(0xc11018) at 0xbe3b80
REFCNT = 1
FLAGS = (TEMP,ROK)
RV = 0xbe4570
SV = PVCV(0xc0ae10) at 0xbe4570
REFCNT = 2
FLAGS = (POK,pPOK,CONST)
IV = 0
NV = 0
PROTOTYPE = ""
COMP_STASH = 0x0 <--------------------------
ROOT = 0x0
XSUB = 0x5bb44
XSUBANY =
12469628
GVGV::GV = 0xbe3c40 "main" :: "foo"
FILE = "-e"
DEPTH = 0
FLAGS = 0x200
OUTSIDE_SEQ = 0
PADLIST = 0x0
OUTSIDE = 0x0 (null)
Father Chrysostomos [Sat, 6 Sep 2014 20:09:05 +0000 (13:09 -0700)]
Fix-ups for Attribute::Handlers
It was making unreliable assumptions about the contents of stashes.
Father Chrysostomos [Mon, 1 Sep 2014 01:05:49 +0000 (18:05 -0700)]
sv.h: Expand comment about potential SVf_UTF8 conflict
Father Chrysostomos [Mon, 1 Sep 2014 03:13:21 +0000 (20:13 -0700)]
Avoid creating GVs when subs are declared
This patch changes ‘sub foo {...}’ declarations to store subroutine
references in the stash, to save memory.
Typeglobs still notionally exist. Accessing CvGV(cv) will reify them.
Hence, currently the savings are lost when a sub call is compiled.
$ ./miniperl -e 'sub foo{} BEGIN { warn $::{foo} } foo(); BEGIN { warn $::{foo} }'
CODE(0x7f8ef082ad98) at -e line 1.
*main::foo at -e line 1.
This optimisation is skipped if the subroutine declaration contains a
package separator.
Concerning the changes in caller.t, this code:
sub foo { print +(caller(0))[3],"\n" }
my $fooref = delete $::{foo};
$fooref -> ();
used to crash in 5.7.3 or thereabouts. It was fixed by 16658 (aka
07b8c804e8) to produce ‘(unknown)’ instead. Then in 5.13.3 it was
changed (by 803f274) to produce ‘main::__ANON__’ instead. So the
tests are really checking that we don’t get a crash. I think it is
acceptable that it has now changed to ‘main::foo’.
Father Chrysostomos [Sun, 7 Sep 2014 05:51:15 +0000 (22:51 -0700)]
Remove bogus gv-handling code from toke.c
This code was added by
211a4342c, which was actually restoring some
code that
f74617600 removed.
Its purpose was to expand a proxy to a real GV after we found out that
we really are going to compile a sub call op.
This code is actually unreachable at present (sub call lookup via
rv2cv ops expands stub declarations, but not references to constants;
references to constants are not compiled to sub calls), which is a
good thing, because (1) it does not take UTF8 names into account and
(2) it does not work with rv2cv hooks or our subs, because it assumes
that the value of PL_tokenbuf is normative and can be used to
reify a glob.