| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Current codebase wires Perl_pp_mapstart to Perl_unimplemented_op (by
regen/opcode.pl) [1], but then avoids runtime panics by Perl_ck_grep
changing all OP_MAPSTART nodes to use PL_ppaddr[OP_GREPSTART] [2].
This is all too clever by half, so this patch undoes the trickery, and
treats these 2 OPS like 93bad3fd5548 did for OP_AELEMFAST and \1_LEX.
I cant glean a reason for this historical arrangement:
Looking at regen/opcode.pl blamelog..
65bca31a68 added Perl_unimplemented_op() used by 3 'unreachable' ops,
and replaced a 'panic: mapstart' diag with a common one, so the trick
goes further back.
c78ff9799bf moved a minimal/DIEing pp_mapstart implementation to
mathoms.c from pp_ctl.c. Perl_ck_grep also did the GREPSTART patching
back then.
f54cb97a39f did minor tweaks to a full pp_mapstart implementation. I
couldnt find the commit between it and c78ff that changed pp_mapstart
to a DIEing one, or I fat-fingered it, or I got distracted.
looking at ck-grep(), the code doing [2] is from 22c35a8c23 in 1998.
So anyway, I tried the following, it worked, it seems the historical
reason is no longer relevant.
[1] change regen/opcode.pl generated mapping
-#define Perl_pp_mapstart Perl_unimplemented_op
+#define Perl_pp_mapstart Perl_pp_grepstart
this sets PL_ppaddr[OP_MAPSTART] = PL_ppaddr[OP_GREPSTART] during
init, which makes the optype trickery in ck_grep[2] unneeded.
[2] Drop re-type-ing of MAPSTARTs as GREPSTARTs by Perl_ck_grep(OP* o)
Given 1, mapstart & grepstart share code, so just leave optype alone.
|
|
|
|
|
|
|
| |
This allows the source to be easily edited to create ebcdic translations
tables in hex which is easier to debug, but won't fit in an 80 column
window. I suppose it could be controlled by an environment variable,
but for now, it's just going to be hard-set to 1 or 0.
|
| |
|
|
|
|
|
|
|
|
| |
srefgen is faster than refgen, since it doesn’t have to loop through
the arguments (there is only one) and there is no pushmark to execute.
OA_RETSCALAR causes scalar context to be applied to anoncode ops, but
it always returns one item anyway, so that causes no problems.
|
|
|
|
|
| |
Also correct the description of lvref magic. When it was first added,
it was for list assignments only, but that soon changed.
|
|
|
|
| |
The other experimental features already have nice warnings in feature.pm
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
‘Has side effects’ can be misleading. The OA_DANGEROUS flag is only
used by the common-vars search that checks to see whether it is possi-
ble to skip making temporary copies.
We have to make copies in cases like this:
($a,$b) = func();
because func() could return ($b,$a).
If any op on either side is marked OA_DANGEROUS and not handled spe-
cially in op.c:S_aassign_scommon_vars, then it is assumed it could
return a scalar that is also elsewhere in the list, so a temp copy
is needed.
(I think some of the existing ops with this flag could drop it.)
|
|
|
|
|
|
| |
Some lines end with spaces, remove that, use tabs instead of spaces in code
so the perl code is less bytes to read from disk. This patch saved 183
bytes. Part of [perl #122955].
|
|
|
|
|
|
|
|
| |
warnings.pm is the hottest file/takes the most read() calls of any
module during a make all. By moving POD to the end, ~40KB of OS read()
IO was reduced to ~16KB of OS read() IO calls. Also the parser doesn't need
to search for Perl code in the POD further lessining load time because of
the __END__ token. Filed as [perl #122955].
|
|
|
|
|
|
|
| |
I accidentally broke ($_[0],$_[1])=($_[1],$_[0]) in be9de18, which was
only supposed to be a refactoring. Since it now happens later in the
compilation phase when optimisations like aelemfast have happened, the
search for common vars needs to take aelemfast into account.
|
|
|
|
| |
instead of stringify(join(...)).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Due to the exigencies of the implementation, "$_->$*" ends up with a
join op (join $", $$_), which is unnecessary. This gave me the idea
of folding it where possible (instead of trying to tackle it in
toke.c), which would also make explicit joins benefit, too.
If the arguments are a simple scalar or constant followed by a
single-item list, then the join can become a stringify, and the sepa-
rator can simply disappear.
Further (and this is unrelated to "$_->$*"), if all of join’s argu-
ments are constant, the whole thing can be folded to a const op.
|
| |
|
|
|
|
|
| |
Only \state(@_) was handling this correctly, as pp_lvavref
calls pp_padav.
|
|
|
|
|
| |
An lvalue reference used as an iterator variable will be implemented
using an lvref op with this flag set.
|
| |
|
|
|
|
|
| |
This will be used for slurpy array ref assignments. \(@a) = \(@b)
will make @a share the same elements as @b.
|
|
|
|
| |
When used for pad vars, it is childless.
|
|
|
|
| |
to avoid conflicting with OPpPAD_STATE.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
\($x,$y)=... does not work yet, but \(my $x) and (\$x, \$y) do.
|
| |
|
|
|
|
|
| |
I just couldn’t resist using the backslash for the character, even
though I had to tweak mg_vtable.pl to make it work.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
No \my$x= yet. Only my $x; \$x =....
It does not work properly with variables closed over from outside;
hence, all the to-do tests fail still, since they do the assign-
ment in evals.
But this much works:
$ ./miniperl -Ilib -Mfeature=:all -e 'my $m; \$m = \$n; warn \$m; warn \$n'
Lvalue references are experimental at -e line 1.
SCALAR(0x7fa04b805510) at -e line 1.
SCALAR(0x7fa04b805510) at -e line 1.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
$ ./perl -Ilib -MO=Deparse -e 'our @x = split //, $a'
@x = split(//, $a, 0);
The ‘our’ disappears because ‘split’ swallows up the assignment and
writes to @x directly. But the result is that no OUR_INTRO flag is
left in the op tree.
Fixing this based on the current op tree is very complicated. So
this commit sets the flag on the split op and makes B::Deparse
look for it.
|
|
|
|
|
|
|
|
|
| |
This prevents perl recursing infinitely when an overloaded object is
assigned to $DB::single, $DB::trace or $DB::signal
This is done by referencing their values as IVs instead of as SVs in
dbstate, and by adding magic to those variables so that assignments to
the scalars update the PL_DBcontrol array.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Introduce a new opcode class, METHOP, which will hold class/method related
info needed at runtime to improve performance of class/object method
calls, then change OP_METHOD and OP_METHOD_NAMED from being UNOP/SVOP to
being METHOP.
Note that because OP_METHOD is a UNOP with an op_first, while
OP_METHOD_NAMED is an SVOP, the first field of the METHOP structure
is a union holding either op_first or op_sv. This was seen as less messy
than having to introduce two new op classes.
The new op class's character is '.'
Nothing has changed in functionality and/or performance by this commit.
It just introduces new structure which will be extended with extra
fields and used in later commits.
Added METHOP constructors:
- newMETHOP() for method ops with dynamic method names.
The only optype for this op is OP_METHOD.
- newMETHOP_named() for method ops with constant method names.
Optypes for this op are: OP_METHOD_NAMED (currently) and (later)
OP_METHOD_SUPER, OP_METHOD_REDIR, OP_METHOD_NEXT, OP_METHOD_NEXTCAN,
OP_METHOD_MAYBENEXT
(This commit includes fixups by davem)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A synthetic start class (SSC) is generated by the regular expression
pattern compiler to give a consolidation of all the possible things that
can match at the beginning of where a pattern can possibly match.
For example
qr/a?bfoo/;
requires the match to begin with either an 'a' or a 'b'. There are no
other possibilities. We can set things up to quickly scan for either of
these in the target string, and only when one of these is found do we
need to look for 'foo'.
There is an overhead associated with using SSCs. If the number of
possibilities that the SSC excludes is relatively small, it can be
counter-productive to use them.
This patch creates a crude sieve to decide whether to use an SSC or not.
If the SSC doesn't exclude at least half the "likely" possiblities, it
is discarded. This patch is a starting point, and can be refined if
necessary as we gain experience.
See thread beginning with
http://nntp.perl.org/group/perl.perl5.porters/212644
In many patterns, no SSC is generated; and with the advent of tries,
SSC's have become less important, so whatever we do is not terribly
critical.
|
|
|
|
|
| |
These three ops apparently don't use this private flag, so mark them as
such. Also add a comment explaining what OPpLVAL_INTRO means.
|
|
|
|
|
| |
Remove some temporary comments, and merge the two places where rv2cv flags
are defined.
|
|
|
|
|
|
|
|
| |
There is a section in regen/opcode.pl explaining when its okay to
use the T flag / OPpTARGET_MY define.
Move that text to regen/op_private, at the spot where it defines
OPpTARGET_MY. It's more likely to be seen there.
|
|
|
|
|
|
| |
Explain a bit more about how OPpTARGET_MY is used, and remove a temporary
comment I make about inconsistencies in which ops can use the flag as
defined by the old Concise.pm and regen/opcodes T flags.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Since this is an auto-generated .pm file, set $VERSION to the perl
version (i.e. 5.mmmnnn), the same trick that Config.pm does.
Since regen scripts are usually executed by a different perl, and the
current perl may not be built yet, don't rely on $]; instead get the
info from patchlevel.h. Add a new sub for this purpose, perl_version(),
to regen/regen_lib.pl. (I feel that such a routine should already exist
somewhere, but I couldn't find such a beastie.)
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
| |
I forgot to re-run podcheck.t with PERL_POD_PEDANTIC set last time.
|
| |
|
| |
|