summaryrefslogtreecommitdiff
path: root/regen
Commit message (Collapse)AuthorAgeFilesLines
* end the pp_mapstart trickeryJim Cromie2014-11-021-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* regen/ebcdic.pl: Allow making tables in hexKarl Williamson2014-11-011-2/+13
| | | | | | | 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.
* fix typo in regen/opcode.plDavid Mitchell2014-10-201-1/+1
|
* Use srefgen for anoncodeFather Chrysostomos2014-10-181-1/+1
| | | | | | | | 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.
* Rename lvalue referencesFather Chrysostomos2014-10-173-5/+5
| | | | | Also correct the description of lvref magic. When it was first added, it was for list assignments only, but that soon changed.
* mention 'switch' is experimental in feature.pmDoug Bell2014-10-171-0/+6
| | | | The other experimental features already have nice warnings in feature.pm
* Change OA_DANGEROUS description in regen/opcode*Father Chrysostomos2014-10-142-2/+2
| | | | | | | | | | | | | | | | | | | ‘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.)
* remove excess whitespace from warnings.pmDaniel Dragan2014-10-131-31/+31
| | | | | | 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].
* move POD in warnings.pm to end of file to reduce module load I/O callsDaniel Dragan2014-10-131-240/+240
| | | | | | | | 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].
* [perl #122965] aelemfast in list assignmentFather Chrysostomos2014-10-131-1/+1
| | | | | | | 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.
* Optimise "@_" to a single joinFather Chrysostomos2014-10-122-1/+2
| | | | instead of stringify(join(...)).
* Fold join to const or stringify where possibleFather Chrysostomos2014-10-121-1/+1
| | | | | | | | | | | | | | 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.
* Document lvalue referencesFather Chrysostomos2014-10-111-0/+23
|
* Handle state vars correctly in ref assignmentFather Chrysostomos2014-10-111-1/+1
| | | | | Only \state(@_) was handling this correctly, as pp_lvavref calls pp_padav.
* Add OPpLVREF_ITER flagFather Chrysostomos2014-10-111-0/+1
| | | | | An lvalue reference used as an iterator variable will be implemented using an lvref op with this flag set.
* lvavref needs OPpLVAL_INTRO and OPpPAD_STATEFather Chrysostomos2014-10-111-2/+3
|
* Add lvavref op typeFather Chrysostomos2014-10-111-0/+1
| | | | | This will be used for slurpy array ref assignments. \(@a) = \(@b) will make @a share the same elements as @b.
* lvref is actually a baseop/unopFather Chrysostomos2014-10-111-1/+1
| | | | When used for pad vars, it is childless.
* Renumber OPpLVREF_TYPEFather Chrysostomos2014-10-101-1/+2
| | | | to avoid conflicting with OPpPAD_STATE.
* Add priv flags for the type of lvalue refFather Chrysostomos2014-10-101-0/+9
|
* lvrefslice gets OPpLVAL_INTROFather Chrysostomos2014-10-101-1/+1
|
* Add lvrefslice op typeFather Chrysostomos2014-10-101-0/+1
|
* Assignment to array elem refsFather Chrysostomos2014-10-101-0/+7
|
* List assignment to lexical scalar refsFather Chrysostomos2014-10-101-1/+1
| | | | \($x,$y)=... does not work yet, but \(my $x) and (\$x, \$y) do.
* Capitalise magic descriptions consistentlyFather Chrysostomos2014-10-101-6/+6
|
* Add lvref magic typeFather Chrysostomos2014-10-101-9/+18
| | | | | I just couldn’t resist using the backslash for the character, even though I had to tweak mg_vtable.pl to make it work.
* Add lvref op typeFather Chrysostomos2014-10-102-1/+2
|
* Implement \my $x = ...Father Chrysostomos2014-10-101-1/+1
|
* First stab at lexical scalar aliasesFather Chrysostomos2014-10-101-1/+1
| | | | | | | | | | | | | | | 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.
* Add refassign op typeFather Chrysostomos2014-10-101-0/+1
|
* Increase $warnings::VERSION to 1.27Father Chrysostomos2014-10-101-1/+1
|
* Add experimental::lvalue_refs warnings categoryFather Chrysostomos2014-10-101-0/+2
|
* Increase $feature::VERSION to 1.38Father Chrysostomos2014-10-101-1/+1
|
* Add lvalue_refs feature featureFather Chrysostomos2014-10-101-0/+1
|
* Deparse split-to-our-array correctlyFather Chrysostomos2014-10-101-1/+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.
* [perl #122445] use magic on $DB::single etc to avoid overload issuesTony Cook2014-10-091-0/+3
| | | | | | | | | 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.
* Make OP_METHOD* to be of new class METHOPsyber2014-10-033-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* Tighten uses of regex synthetic start classKarl Williamson2014-09-291-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* OPpLVAL_INTRO: not used by pos substr vecDavid Mitchell2014-09-231-1/+4
| | | | | These three ops apparently don't use this private flag, so mark them as such. Also add a comment explaining what OPpLVAL_INTRO means.
* regen/op_private: tidy up rv2cv entryDavid Mitchell2014-09-191-17/+11
| | | | | Remove some temporary comments, and merge the two places where rv2cv flags are defined.
* move OPpTARGET_MY comments from opcode.plDavid Mitchell2014-09-192-55/+57
| | | | | | | | 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.
* regen/op_private: update TARGLEX comments.David Mitchell2014-09-191-7/+4
| | | | | | 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.
* regen/op_private: fix assorted typosDavid Mitchell2014-09-191-8/+8
|
* add $VERSION to B::Op_privateDavid Mitchell2014-09-192-0/+22
| | | | | | | | | | | 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.)
* silence diagnostics in regen/regcomp.pl for nowYves Orton2014-09-171-2/+2
|
* only produce diagnostic warnings in regen/regcomp.pl when STDERR is a terminalYves Orton2014-09-171-1/+2
|
* Eliminate the duplicative regops BOL and EOLYves Orton2014-09-171-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
* Wrap long pod lines in B::Op_private for realFather Chrysostomos2014-09-101-3/+4
| | | | I forgot to re-run podcheck.t with PERL_POD_PEDANTIC set last time.
* Update rv2cv flags comment following 211a4342c9Father Chrysostomos2014-09-101-1/+1
|
* Note where B::Op_private’s pod is to be editedFather Chrysostomos2014-09-101-1/+2
|