| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
This will make the CPAN dist easier. For the perl core, we still need
substitutions to get the right she-bang as we don't go through EU::MM to fix it
for us. For that, we add utils/pod2html.PL.
|
| |
|
|
|
|
|
|
|
|
| |
This commit allows &CORE::reset to be called through references and
via ampersand syntax. pp_reset is modified to take into account the
nulls pushed on to the stack in pp_coreargs, which happens because
pp_coreargs has no other way to tell reset how many arguments it’s
actually getting. See commit 0163043a for details.
|
|
|
|
|
|
|
|
|
|
| |
Otherwise the GV can be freed before the scope-popping code can put
the old entry back in it:
$ perl -le 'local @{"x"}; delete $::{x}'
Bus error
$ perl -le 'local %{"x"}; delete $::{x}'
Bus error
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These are grouped together because they all have \$ in their
prototypes.
This commit allows the subs in the CORE package under those names to
be called through references and via &ersand syntax.
The coreargs op in the subroutine is marked with the OPpSCALARMOD
flag. (scalar_mod_type in op.c returns true for these three ops,
indicating that the OA_SCALARREF parameter is \$, not \[$@%(&)*].)
pp_coreargs uses that flag to decide what arguments to reject.
|
|
|
|
|
| |
pp_coreargs will use this to distinguish between the \$ and \[$@%*]
prototypes.
|
| |
|
|
|
|
|
|
|
|
| |
Originally, coresubs.t was going to be for generic tests and
coreinline.t was going to be for inlining. But the latter ended
up testing other things than inlining, the former testing just
&ersand() calls. So this commits renames coresubs.t to coreamp.t
and coreinline.t to coresubs.t.
|
|
|
|
|
|
|
|
| |
This commit allows &CORE::rand to be called through references and
via ampersand syntax. pp_rand is modified to take into account the
nulls pushed on to the stack in pp_coreargs, which happens because
pp_coreargs has no other way to tell rand how many arguments it’s
actually getting. See commit 0163043a for details.
|
|
|
|
|
|
| |
This commit allows &CORE::open to be called through references or with
ampersand syntax. It modifies pp_coreargs not to push nulls for ops
that require a pushmark.
|
|
|
|
|
|
| |
so that the first does not make the second always pass.
The bug that 99fc7eca4 fixed would never had occurred if
they had been that way to begin with.
|
|
|
|
|
|
|
|
| |
This commit allows &CORE::mkdir to be called through references and
via ampersand syntax. pp_mkdir is modified to take into account the
nulls pushed on to the stack in pp_coreargs, which happens because
pp_coreargs has no other way to tell mkdir how many arguments it’s
actually getting.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit allows &CORE::lock to be called through references and
via ampersand syntax. It adds code to pp_coreargs for handling the
OA_SCALARREF case, though what it adds is currently lock-specific.
(Subsequent commits will address that.) Since lock returns the scalar
passed to it, not a copy, &CORE::lock needs to use op_leavesublv,
rather than op_leavesub. But it can’t be an lvalue sub, as
&CORE::lock = 3 should be disallowed. So we use the sneaky trick of
turning on the lvalue flag before attaching the op tree to the sub
(which causes newATTRSUB to use op_leavesublv), and then turning it
off afterwards.
|
|
|
|
|
|
|
|
| |
This commit allows &CORE::index and &CORE::rindex to be called through
references and via ampersand syntax. pp_index is modified to take
into account the nulls pushed on to the stack in pp_coreargs, which
happens because pp_coreargs has no other way to tell pp_index how many
arguments it’s actually getting. See commit 0163043a for details.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit allows &CORE::gmtime and &CORE::localtime to be called
through references and via ampersand syntax. pp_gmtime is modified
to take into account the nulls pushed on to the stack in pp_coreargs,
which happens because pp_coreargs has no other way to tell pp_gmtime
how many arguments it’s actually getting.
I was going to say ‘see commit f6a1686942 for more details’, but found
out, to my horror, that most of the commit message was cut off. I
don’t know which commit-munging part of git is responsible, but I’ve
had similar problems with git am and git commit --amend. But, then,
this could have been sloppy copy and paste. Anyway, here is the
missing part:
Usually, an op that has optional arguments has the number of arguments
indicated with flags on the op itself:
$ ./perl -Ilib -MO=Concise -e 'binmode 1'
6 <@> leave[1 ref] vKP/REFC ->(end)
1 <0> enter ->2
2 <;> nextstate(main 1 -e:1) v:{ ->3
5 <@> binmode vK/1 ->6
- <0> ex-pushmark s ->3
4 <1> rv2gv sK*/1 ->5
3 <$> gv(*1) s ->4
-e syntax OK
$ ./perl -Ilib -MO=Concise -e 'binmode 1,2'
7 <@> leave[1 ref] vKP/REFC ->(end)
1 <0> enter ->2
2 <;> nextstate(main 1 -e:1) v:{ ->3
6 <@> binmode vK/2 ->7
- <0> ex-pushmark s ->3
4 <1> rv2gv sK*/1 ->5
3 <$> gv(*1) s ->4
5 <$> const(IV 2) s ->6
-e syntax OK
Notice the /1 vs /2 on the binmode op.
With a CORE sub, we have a single op for both cases. So, what this
commit does is set the number of arguments to the maximum, push nulls
on to the stack in pp_coreargs (actually, it was already set up to
do it, so there is no change there), and have the pp_ functions for
each op that has optional arguments do a null check after popping
the stack.
pp_binmode already does a null check, but other pp_ functions will
need to be modified. Since each one is different, those will come in
separate commits.
This is what &CORE::binmode’s op tree looks like:
$ ./perl -Ilib -MO=Concise,CORE::binmode -e 'BEGIN{\&CORE::binmode}'
CORE::binmode:
3 <1> leavesub[1 ref] K/REFC,1 ->(end)
2 <@> binmode sK/2 ->3
- <0> ex-pushmark s ->1
1 <$> coreargs(IV 212) s ->2
-e syntax OK
|
| |
|
|
|
|
|
| |
This check, added by ed996e63f6, is no longer necessary as of commit
f132ae694c, since PL_sv_undef takes a different path.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit afd1915d made filehandle vivification work on hash and array
elements, but in doing so it accidentally changed
*{;undef} = 3;
to do the same thing as
*{""} = 3;
while leaving
*{$some_undefined_variable}
an error.
This commit adjusts the if() conditions in S_rv2gv (formerly in
pp_rv2gv) in pp.c to make PL_sv_undef follow the same path as before.
It also removes the uninit tests from lib/warnings/pp, since they
are now errors. The uninit warning in rv2gv is only triggered now
when it is implicit, as in close(). That is already tested in
lib/warnings/9uninit.
|
|
|
|
|
| |
Make the indentation in this example match the surrounding
examples.
|
|
|
|
|
|
|
| |
The perlop manpage was stating ‘the left operand’, which was
not entirely correct, as ‘time.shift =>’ quotes just the shift,
not the time (nor does it see the whole as not being an ident-
ifier and refuse to quote anything).
|
|
|
|
| |
This makes porting/regen.t pass again.
|
| |
|
| |
|
|
|
|
|
|
| |
There are too many related problems arising from this change
This reverts commit e820c6d6a6d0a8828aa68a6895696b659c471f2f.
|
|
|
|
|
| |
This has been out of date since the MRO plugin API was added
(5.10.1, I think).
|
|
|
|
|
|
|
| |
This commit allows &CORE::getpgrp to be called through references and
via ampersand syntax. pp_getpgrp is modified to take into account the
nulls pushed on to the stack in pp_coreargs, since pp_coreargs has no
other way to tell getpgrp how many arguments it’s actually getting.
|
|
|
|
|
|
|
| |
This commit allows &CORE::exit to be called through references and
via ampersand syntax. pp_exit is modified to take into account the
nulls pushed on to the stack in pp_coreargs, since pp_coreargs has no
other way to tell exit how many arguments it’s actually getting.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This commit allows the subs in the CORE package for close, getc and
readline to be called through references and via ampersand syntax. A
special case for each of them is added to pp_coreargs to deal with
calls with no arguments. Pushing a null on to the stack (which I’m
doing for other ops) won’t work, as a null already means something for
these cases: close($f) won’t vivify a typeglob if $f is a string, so
the implicit rv2gv pushes a null on to the stack.
|
|
|
|
|
|
|
| |
This commit allows the subs in the CORE package for close, getc and
readline to be called through references and via ampersand syntax. The
pp functions are modified to take into account the nulls that coreargs
pushes on to the stack to indicate that there is no argument.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Without this, the VMS compiler, with warnings cranked up to level 4,
emits pages and pages of things like:
dVAR;
....^
%CC-I-NOPARMLIST, The declaration of the function Perl___notused has
an empty parameter list. If the function has parameters, they should
be declared here; if it has no parameters, "void" should be specified
in the parameter list.
at line number 100 in file MDA0:[SMOKE.blead]perl.c;1
Over 2,000 of these plus other warnings yields a smoke report of 750K,
which is quite a bit over the 400K limit of the perl.org mailing lists,
not to mention being a slow read.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit allows the CORE subroutines for functions with @
and $@ prototypes to be called through references and via amper-
sand syntax.
unlink is not included in this commit, as it requires special casing
due to its use of implicit $_.
Since these functions require a pushmark, and since it has to come
between two things that pp_coreargs does, it’s easiest to flag the
coreargs op (with the OPpCOREARGS_PUSHMARK flag added in the previous
commit) and call pp_pushmark directly from pp_coreargs.
|
|
|
|
|
|
|
|
|
| |
This will be used to tell pp_coreargs when it needs to call
pp_pushmark.
For those functions that need a pushmark, it has to come between
two things that pp_coreargs does; so the easiest way is to use
this flag.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit allows &CORE::caller to be called through references and
via ampersand syntax. pp_caller is modified to take into account
two things:
1) pp_coreargs pushes a null on to the stack, since it has no other
way to tell caller whether it has an argument.
2) The value coming from pp_coreargs (when not null) is off by
one. The OPpOFFYBONE flag was added in commit 93f0bc4935 for
this purpose.
pp_coreargs is also modified, since it assumed till now that an
optional first argument was an implicit $_.
|
|
|
|
|
|
|
| |
This commit allows &CORE::bless to be called through references and
via ampersand syntax. pp_bless is modified to take into account the
nulls pushed on to the stack in pp_coreargs, since pp_coreargs has no
other way to tell bless how many arguments it’s actually getting.
|
|
|
|
|
|
|
|
| |
This commit allows &CORE::binmode to be called through references and
via ampersand syntax.
Usually, an op that has optional arguments has the number of arguments
indicated with flags on the op itself:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This script, from the RT ticket, crashes:
#!/usr/bin/perl
sub cl{
package DB;
@DB::args = ();
return caller(shift);
}
sub f{
local @DB::args;
my @z = cl($_) for (1..3);
}
f(1,2,3); f(1,2,3);
__END__
PL_dbargs is not refcounted, and it’s not set until pp_caller first
tries to write to it. If that happens when @DB::args is localised,
then the array will be freed on scope exit, leaving PL_dbargs pointing
to a freed SV.
This crash can be reproduced more simply this way:
sub {
package DB;
()=caller(0);
undef *DB::args;
()=caller(0);
}->();
So, basically, pp_caller has to re-fetch PL_dbargs from the %DB::
stash each time it sets it. It cannot rely on the cached value.
(So now I’m wondering whether we even need PL_dbargs.)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This enables ampersand calls and calls through references for CORE
subs that have * and $ in their prototypes and a fixed number of
arguments.
Usually, the *-prototyped ops have their child ops wrapped in rv2gv’s
(*{}) implicitly. The rv2gv op is sometimes flagged as an autoviv-
ificatory op, such as the first argument to accept() or open().
S_is_handle_constructor contains the list of ops that turn on
that flag.
This commit makes the coreargs op use a couple of flags to serve the
same purpose. pp_coreargs itself calls S_rv2gv (split out from
pp_rv2gv recently for precisely this purpose) with arguments based on
its own flags.
Currently the autovivified glob gets a name like main::_GEN_0 instead
of main::$a. I think we can live with that.
|
| |
|
|
|
|
|
| |
This allows the glob-deref logic to be use by other functions in pp.c,
like pp_coreargs.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
This fixes some infelicities in the new tests I added to this
file recently.
|
|
|
|
|
|
| |
The list of those that do not support &CORE::foo() syntax is now
shorter than the list of those that do. In subsequent commits
it will get even shorter.
|
| |
|
| |
|