In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/383542ae1cd5bd3ea345ac36fdd19216afcf9e87?hp=5513c2cfd695ea6a900a29be8b479bea61614429>
- Log ----------------------------------------------------------------- commit 383542ae1cd5bd3ea345ac36fdd19216afcf9e87 Author: Father Chrysostomos <[email protected]> Date: Sat Nov 8 00:09:54 2014 -0800 Fix up f_map.t following "\L$_" optimisation M ext/B/t/f_map.t commit 0f0d5355d61bc4f2a5913d289b94e1b2e16bea31 Author: Father Chrysostomos <[email protected]> Date: Fri Nov 7 22:23:16 2014 -0800 Make B constants depend on perl headers Making the Makefile depend on the headers where the constants are found will force Makefile.PL to be re-run, and it is Makefile.PL that generates the constants. M ext/B/Makefile.PL commit 710b427f06fc8860948ab350c617766ec710b158 Author: Father Chrysostomos <[email protected]> Date: Fri Nov 7 21:50:37 2014 -0800 Optimise stringify away for "\Q$_" "\u$_" etc. M op.c commit d8cdf5739e500a4f72aa611694308d7244c29573 Author: Father Chrysostomos <[email protected]> Date: Fri Nov 7 21:46:58 2014 -0800 Allow OPpTARGET_MY optimisation for split Many operators have a special SV allocated in the pad which is used for return values (the target). If we make that pad offset point to a lexical variable, then we can optimise, say, $lexical = "$foo" into just "$foo", where $lexical is stringifyâs âtargetâ. And pp_stringify doesnât need to know any better. We already do that for many ops. This is safe to extend to split. split only uses its target in this code at the end: GETTARGET; PUSHi(iters); so there is no danger of modifying its argument before reading it. M lib/B/Deparse.pm M lib/B/Op_private.pm M opcode.h M regen/op_private M regen/opcodes commit 12cea2fa656447eef8848bac6de2e3fe413eb787 Author: Father Chrysostomos <[email protected]> Date: Fri Nov 7 23:34:11 2014 -0800 Fix Deparse OPpLVAL_INTRO handling in lists The renumbering of private flags a few commits ago caused an exist- ing Deparse bug to occur more often. It was assuming that the OPpLVAL_INTRO and OPpOUR_INTRO flags could occur on any ops for which it did not have explicit exceptions. This commit changes it to check for only those ops known to use those flags, thus fixing bug #119815. M lib/B/Deparse.pm M lib/B/Deparse.t commit 9e209402444aedd210f045f2557e631ca974dda2 Author: Father Chrysostomos <[email protected]> Date: Fri Nov 7 21:42:54 2014 -0800 Renumber op flags so TARGET_MY and OUR_INTRO differ I need split to be able to take both flags. Renumbering OUR_INTRO sets off a chain reaction requiring that various other flags be renum- bered. These are the affected ops: gvsv rv2sv rv2av rv2hv enteriter split rv2gv padsv aelem helem entersub padav padhv lvavref lvref refassign pushmark rv2cv ---------------------------------------------------------------------------------------------------------------------------------- 0 inargs 1 strct strct strct strct strct strct 2 slicw silcw reversed noinit targ slicw slicw elem elem targ 3 lvsub lvsub def lvsub lvsub lvsub amper lvsub lvsub iter iter amper 4 our our our our our our fake state defer defer dbg state state state state state state dbg 5-6 dref bool dref dref dref dref dref bool type type const(6) 7 intro intro intro intro intro implim intro intro intro intro intro intro intro intro intro intro intro nopar If we use 6 for OUR_INTRO and shift 5-6 down to 4-5, that frees up 4 (aka OPpTARGET_MY) for use on split. op.c:scalarvoid was testing the OPpOUR_INTRO flag on ops that donât take it, so it needed adjustment. M lib/B/Op_private.pm M op.c M opcode.h M regen/op_private commit 68606d04067f960af540499bbdd712185cb9a125 Author: Father Chrysostomos <[email protected]> Date: Fri Nov 7 20:33:51 2014 -0800 op_private: Remove incorrect OPpLVREF_TYPE comment At the time, I was trying to rearrange the magic flags so that OPpLVREF_TYPE could be copied into mg->mg_flags for lvref magic. Then I saw that mg_private was available and gave up on the whole idea; but this comment remained. M regen/op_private ----------------------------------------------------------------------- Summary of changes: ext/B/Makefile.PL | 15 +- ext/B/t/f_map.t | 52 +++--- lib/B/Deparse.pm | 50 +++--- lib/B/Deparse.t | 3 + lib/B/Op_private.pm | 72 ++++---- op.c | 30 ++-- opcode.h | 498 ++++++++++++++++++++++++++-------------------------- regen/op_private | 35 ++-- regen/opcodes | 2 +- 9 files changed, 385 insertions(+), 372 deletions(-) diff --git a/ext/B/Makefile.PL b/ext/B/Makefile.PL index e70e8fd..cc16ad9 100644 --- a/ext/B/Makefile.PL +++ b/ext/B/Makefile.PL @@ -6,12 +6,6 @@ use warnings; my $core = grep { $_ eq 'PERL_CORE=1' } @ARGV; -WriteMakefile( - NAME => "B", - VERSION_FROM => "B.pm", - realclean => {FILES=> 'const-c.inc const-xs.inc'}, -); - my $headerpath; if ($core) { $headerpath = File::Spec->catdir(File::Spec->updir, File::Spec->updir); @@ -23,6 +17,7 @@ if ($core) { my @names = ({ name => 'HEf_SVKEY', macro => 1, type => "IV" }, qw(SVTYPEMASK SVt_PVGV SVt_PVHV PAD_FAKELEX_ANON PAD_FAKELEX_MULTI)); +my @depend; # First element in each tuple is the file; second is a regex snippet # giving the prefix to limit the names of symbols to define that come @@ -40,6 +35,7 @@ foreach my $tuple (['cop.h'], my $file = $tuple->[0]; my $pfx = $tuple->[1] || ''; my $path = File::Spec->catfile($headerpath, $file); + push @depend, $path; open my $fh, '<', $path or die "Cannot open $path: $!"; while (<$fh>) { push @names, $1 if (/ \#define \s+ ( $pfx \w+ ) \s+ @@ -55,6 +51,13 @@ foreach my $tuple (['cop.h'], close $fh; } +WriteMakefile( + NAME => "B", + VERSION_FROM => "B.pm", + realclean => {FILES=> 'const-c.inc const-xs.inc'}, + depend => {'Makefile' => "@depend"}, +); + # Currently only SVt_PVGV and SVt_PVHV aren't macros, but everything we name # should exist, so ensure that the C compile breaks if anything does not. WriteConstants( diff --git a/ext/B/t/f_map.t b/ext/B/t/f_map.t index 675cd43..66d2a8a 100644 --- a/ext/B/t/f_map.t +++ b/ext/B/t/f_map.t @@ -239,14 +239,13 @@ checkOptree(note => q{}, # 7 <|> mapwhile(other->8)[t9] lK # 8 <#> gvsv[*_] s # 9 <1> lc[t4] sK/1 -# a <@> stringify[t5] sK/1 -# b <$> const[IV 1] s +# a <$> const[IV 1] s # goto 7 -# c <0> pushmark s -# d <#> gv[*hash] s -# e <1> rv2hv lKRM*/1 -# f <2> aassign[t10] KS/COMMON -# g <1> leavesub[1 ref] K/REFC,1 +# b <0> pushmark s +# c <#> gv[*hash] s +# d <1> rv2hv lKRM*/1 +# e <2> aassign[t10] KS/COMMON +# f <1> leavesub[1 ref] K/REFC,1 EOT_EOT # 1 <;> nextstate(main 560 (eval 15):1) v # 2 <0> pushmark s @@ -257,14 +256,13 @@ EOT_EOT # 7 <|> mapwhile(other->8)[t5] lK # 8 <$> gvsv(*_) s # 9 <1> lc[t2] sK/1 -# a <@> stringify[t3] sK/1 -# b <$> const(IV 1) s +# a <$> const(IV 1) s # goto 7 -# c <0> pushmark s -# d <$> gv(*hash) s -# e <1> rv2hv lKRM*/1 -# f <2> aassign[t6] KS/COMMON -# g <1> leavesub[1 ref] K/REFC,1 +# b <0> pushmark s +# c <$> gv(*hash) s +# d <1> rv2hv lKRM*/1 +# e <2> aassign[t6] KS/COMMON +# f <1> leavesub[1 ref] K/REFC,1 EONT_EONT @@ -287,14 +285,13 @@ checkOptree(note => q{}, # 7 <|> mapwhile(other->8)[t9] lK # 8 <#> gvsv[*_] s # 9 <1> lc[t4] sK/1 -# a <@> stringify[t5] sK/1 -# b <$> const[IV 1] s +# a <$> const[IV 1] s # goto 7 -# c <0> pushmark s -# d <#> gv[*hash] s -# e <1> rv2hv lKRM*/1 -# f <2> aassign[t10] KS/COMMON -# g <1> leavesub[1 ref] K/REFC,1 +# b <0> pushmark s +# c <#> gv[*hash] s +# d <1> rv2hv lKRM*/1 +# e <2> aassign[t10] KS/COMMON +# f <1> leavesub[1 ref] K/REFC,1 EOT_EOT # 1 <;> nextstate(main 560 (eval 15):1) v # 2 <0> pushmark s @@ -305,14 +302,13 @@ EOT_EOT # 7 <|> mapwhile(other->8)[t5] lK # 8 <$> gvsv(*_) s # 9 <1> lc[t2] sK/1 -# a <@> stringify[t3] sK/1 -# b <$> const(IV 1) s +# a <$> const(IV 1) s # goto 7 -# c <0> pushmark s -# d <$> gv(*hash) s -# e <1> rv2hv lKRM*/1 -# f <2> aassign[t6] KS/COMMON -# g <1> leavesub[1 ref] K/REFC,1 +# b <0> pushmark s +# c <$> gv(*hash) s +# d <1> rv2hv lKRM*/1 +# e <2> aassign[t6] KS/COMMON +# f <1> leavesub[1 ref] K/REFC,1 EONT_EONT diff --git a/lib/B/Deparse.pm b/lib/B/Deparse.pm index ef22e06..a8782fb 100644 --- a/lib/B/Deparse.pm +++ b/lib/B/Deparse.pm @@ -3057,6 +3057,21 @@ sub pp_grepwhile { mapop(@_, "grep") } sub pp_mapstart { baseop(@_, "map") } sub pp_grepstart { baseop(@_, "grep") } +my %uses_intro; +BEGIN { + @uses_intro{ + eval { require B::Op_private } + ? grep +($B::Op_private::bits{$_}{log(OPpLVAL_INTRO) / log 2} + ||'') + eq 'OPpLVAL_INTRO', + keys %B::Op_private::bits + : qw(gvsv rv2sv rv2hv rv2gv rv2av aelem helem aslice + hslice delete padsv padav padhv enteriter entersub padrange + pushmark cond_expr refassign list) + } = (); + delete @uses_intro{qw( lvref lvrefslice lvavref )}; +} + sub pp_list { my $self = shift; my($op, $cx) = @_; @@ -3067,27 +3082,10 @@ sub pp_list { my $local = "either"; # could be local(...), my(...), state(...) or our(...) my $type; for ($lop = $kid; !null($lop); $lop = $lop->sibling) { - # This assumes that no other private flags equal 128, and that - # OPs that store things other than flags in their op_private, - # like OP_AELEMFAST, won't be immediate children of a list. - # - # OP_ENTERSUB and OP_SPLIT can break this logic, so check for them. - # I suspect that open and exit can too. - # XXX This really needs to be rewritten to accept only those ops - # known to take the OPpLVAL_INTRO flag. - my $lopname = $lop->name; my $loppriv = $lop->private; - if (!($loppriv & (OPpLVAL_INTRO|OPpOUR_INTRO) - or $lopname eq "undef") - or $lopname =~ /^(?:entersub|exit|open|split - |lv(?:av)?ref(?:slice)?)\z/x) - { - $local = ""; # or not - last; - } my $newtype; - if ($lopname =~ /^pad[ash]v$/) { + if ($lopname =~ /^pad[ash]v$/ && $loppriv & OPpLVAL_INTRO) { if ($loppriv & OPpPAD_STATE) { # state() ($local = "", last) if $local !~ /^(?:either|state)$/; $local = "state"; @@ -3113,10 +3111,15 @@ sub pp_list { )) { $newtype = $t; } - } elsif ($lopname ne "undef" - # specifically avoid the "reverse sort" optimisation, - # where "reverse" is nullified - && !($lopname eq 'sort' && ($lop->flags & OPpSORT_REVERSE))) + } elsif ($lopname ne 'undef' + and !($loppriv & OPpLVAL_INTRO) + || !exists $uses_intro{$lopname eq 'null' + ? substr B::ppname($lop->targ), 3 + : $lopname}) + { + $local = ""; # or not + last; + } elsif ($lopname ne "undef") { # local() ($local = "", last) if $local !~ /^(?:either|local)$/; @@ -4999,6 +5002,9 @@ sub pp_qr { matchop(@_, "qr", "") } sub pp_runcv { unop(@_, "__SUB__"); } sub pp_split { + maybe_targmy(@_, \&split); +} +sub split { my $self = shift; my($op, $cx) = @_; my($kid, @exprs, $ary, $expr); diff --git a/lib/B/Deparse.t b/lib/B/Deparse.t index 6b2799e..d05e3af 100644 --- a/lib/B/Deparse.t +++ b/lib/B/Deparse.t @@ -1103,6 +1103,9 @@ s/foo/\(3);/eg; # y///r tr/a/b/r; #### +# y///d in list [perl #119815] +() = tr/a//d; +#### # [perl #90898] <a,>; #### diff --git a/lib/B/Op_private.pm b/lib/B/Op_private.pm index d9dbb8b..7fc1de6 100644 --- a/lib/B/Op_private.pm +++ b/lib/B/Op_private.pm @@ -113,7 +113,7 @@ our %bits; our $VERSION = "5.021006"; $bits{$_}{3} = 'OPpENTERSUB_AMPER' for qw(entersub rv2cv); -$bits{$_}{4} = 'OPpENTERSUB_DB' for qw(entersub rv2cv); +$bits{$_}{6} = 'OPpENTERSUB_DB' for qw(entersub rv2cv); $bits{$_}{2} = 'OPpENTERSUB_HASTARG' for qw(entersub rv2cv); $bits{$_}{6} = 'OPpFLIP_LINENUM' for qw(flip flop); $bits{$_}{1} = 'OPpFT_ACCESS' for qw(fteexec fteread ftewrite ftrexec ftrread ftrwrite); @@ -127,24 +127,24 @@ $bits{$_}{1} = 'OPpHINT_STRICT_REFS' for qw(entersub rv2av rv2cv rv2gv rv2hv rv2 $bits{$_}{5} = 'OPpHUSH_VMSISH' for qw(dbstate nextstate); $bits{$_}{2} = 'OPpITER_REVERSED' for qw(enteriter iter); $bits{$_}{7} = 'OPpLVALUE' for qw(leave leaveloop); -$bits{$_}{4} = 'OPpLVAL_DEFER' for qw(aelem helem); +$bits{$_}{6} = 'OPpLVAL_DEFER' for qw(aelem helem); $bits{$_}{7} = 'OPpLVAL_INTRO' for qw(aelem aslice cond_expr delete enteriter entersub gvsv helem hslice list lvavref lvref lvrefslice padav padhv padrange padsv pushmark refassign rv2av rv2gv rv2hv ... [7 chars truncated] $bits{$_}{2} = 'OPpLVREF_ELEM' for qw(lvref refassign); $bits{$_}{3} = 'OPpLVREF_ITER' for qw(lvref refassign); $bits{$_}{3} = 'OPpMAYBE_LVSUB' for qw(aassign aelem aslice av2arylen helem hslice keys kvaslice kvhslice padav padhv pos rkeys rv2av rv2gv rv2hv substr vec); -$bits{$_}{6} = 'OPpMAYBE_TRUEBOOL' for qw(padhv rv2hv); +$bits{$_}{4} = 'OPpMAYBE_TRUEBOOL' for qw(padhv rv2hv); $bits{$_}{7} = 'OPpOFFBYONE' for qw(caller runcv wantarray); $bits{$_}{5} = 'OPpOPEN_IN_CRLF' for qw(backtick open); $bits{$_}{4} = 'OPpOPEN_IN_RAW' for qw(backtick open); $bits{$_}{7} = 'OPpOPEN_OUT_CRLF' for qw(backtick open); $bits{$_}{6} = 'OPpOPEN_OUT_RAW' for qw(backtick open); -$bits{$_}{4} = 'OPpOUR_INTRO' for qw(enteriter gvsv rv2av rv2hv rv2sv split); -$bits{$_}{4} = 'OPpPAD_STATE' for qw(lvavref lvref padav padhv padsv pushmark refassign); +$bits{$_}{6} = 'OPpOUR_INTRO' for qw(enteriter gvsv rv2av rv2hv rv2sv split); +$bits{$_}{6} = 'OPpPAD_STATE' for qw(lvavref lvref padav padhv padsv pushmark refassign); $bits{$_}{7} = 'OPpPV_IS_UTF8' for qw(dump goto last next redo); $bits{$_}{6} = 'OPpREFCOUNTED' for qw(leave leaveeval leavesub leavesublv leavewrite); $bits{$_}{6} = 'OPpRUNTIME' for qw(match pushre qr subst substcont); $bits{$_}{2} = 'OPpSLICEWARNING' for qw(aslice hslice padav padhv rv2av rv2hv); -$bits{$_}{4} = 'OPpTARGET_MY' for qw(abs add atan2 chdir chmod chomp chown chr chroot concat cos crypt divide exec exp flock getpgrp getppid getpriority hex i_add i_divide i_modulo i_multiply i_negat ... [309 chars truncated] +$bits{$_}{4} = 'OPpTARGET_MY' for qw(abs add atan2 chdir chmod chomp chown chr chroot concat cos crypt divide exec exp flock getpgrp getppid getpriority hex i_add i_divide i_modulo i_multiply i_negat ... [315 chars truncated] $bits{$_}{5} = 'OPpTRANS_COMPLEMENT' for qw(trans transr); $bits{$_}{7} = 'OPpTRANS_DELETE' for qw(trans transr); $bits{$_}{0} = 'OPpTRANS_FROM_UTF' for qw(trans transr); @@ -199,9 +199,9 @@ my @bf = ( }, { mask_def => 'OPpDEREF', - bitmin => 5, - bitmax => 6, - bitmask => 96, + bitmin => 4, + bitmax => 5, + bitmask => 48, enum => [ 1, 'OPpDEREF_AV', 'DREFAV', 2, 'OPpDEREF_HV', 'DREFHV', @@ -210,9 +210,9 @@ my @bf = ( }, { mask_def => 'OPpLVREF_TYPE', - bitmin => 5, - bitmax => 6, - bitmask => 96, + bitmin => 4, + bitmax => 5, + bitmask => 48, enum => [ 0, 'OPpLVREF_SV', 'SV', 1, 'OPpLVREF_AV', 'AV', @@ -227,7 +227,7 @@ $bits{abs}{0} = $bf[0]; @{$bits{accept}}{3,2,1,0} = ($bf[3], $bf[3], $bf[3], $bf[3]); @{$bits{add}}{1,0} = ($bf[1], $bf[1]); $bits{aeach}{0} = $bf[0]; -@{$bits{aelem}}{6,5,1,0} = ($bf[6], $bf[6], $bf[1], $bf[1]); +@{$bits{aelem}}{5,4,1,0} = ($bf[6], $bf[6], $bf[1], $bf[1]); @{$bits{aelemfast}}{7,6,5,4,3,2,1,0} = ($bf[5], $bf[5], $bf[5], $bf[5], $bf[5], $bf[5], $bf[5], $bf[5]); @{$bits{aelemfast_lex}}{7,6,5,4,3,2,1,0} = ($bf[5], $bf[5], $bf[5], $bf[5], $bf[5], $bf[5], $bf[5], $bf[5]); $bits{akeys}{0} = $bf[0]; @@ -278,7 +278,7 @@ $bits{each}{0} = $bf[0]; @{$bits{entereval}}{5,4,3,2,1,0} = ('OPpEVAL_RE_REPARSING', 'OPpEVAL_COPHH', 'OPpEVAL_BYTES', 'OPpEVAL_UNICODE', 'OPpEVAL_HAS_HH', $bf[0]); $bits{entergiven}{0} = $bf[0]; $bits{enteriter}{3} = 'OPpITER_DEF'; -@{$bits{entersub}}{6,5,0} = ($bf[6], $bf[6], 'OPpENTERSUB_INARGS'); +@{$bits{entersub}}{5,4,0} = ($bf[6], $bf[6], 'OPpENTERSUB_INARGS'); $bits{entertry}{0} = $bf[0]; $bits{enterwhen}{0} = $bf[0]; @{$bits{enterwrite}}{3,2,1,0} = ($bf[3], $bf[3], $bf[3], $bf[3]); @@ -348,7 +348,7 @@ $bits{grepwhile}{0} = $bf[0]; @{$bits{gsockopt}}{3,2,1,0} = ($bf[3], $bf[3], $bf[3], $bf[3]); @{$bits{gt}}{1,0} = ($bf[1], $bf[1]); $bits{gv}{5} = 'OPpEARLY_CV'; -@{$bits{helem}}{6,5,1,0} = ($bf[6], $bf[6], $bf[1], $bf[1]); +@{$bits{helem}}{5,4,1,0} = ($bf[6], $bf[6], $bf[1], $bf[1]); $bits{hex}{0} = $bf[0]; @{$bits{i_add}}{1,0} = ($bf[1], $bf[1]); @{$bits{i_divide}}{1,0} = ($bf[1], $bf[1]); @@ -396,7 +396,7 @@ $bits{log}{0} = $bf[0]; $bits{lstat}{0} = $bf[0]; @{$bits{lt}}{1,0} = ($bf[1], $bf[1]); $bits{lvavref}{0} = $bf[0]; -@{$bits{lvref}}{6,5,0} = ($bf[7], $bf[7], $bf[0]); +@{$bits{lvref}}{5,4,0} = ($bf[7], $bf[7], $bf[0]); $bits{mapwhile}{0} = $bf[0]; $bits{method}{0} = $bf[0]; $bits{method_named}{0} = $bf[0]; @@ -421,7 +421,7 @@ $bits{orassign}{0} = $bf[0]; $bits{ord}{0} = $bf[0]; @{$bits{pack}}{3,2,1,0} = ($bf[3], $bf[3], $bf[3], $bf[3]); @{$bits{padrange}}{6,5,4,3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4], $bf[4], $bf[4], $bf[4]); -@{$bits{padsv}}{6,5} = ($bf[6], $bf[6]); +@{$bits{padsv}}{5,4} = ($bf[6], $bf[6]); @{$bits{pipe_op}}{3,2,1,0} = ($bf[3], $bf[3], $bf[3], $bf[3]); $bits{pop}{0} = $bf[0]; $bits{pos}{0} = $bf[0]; @@ -443,7 +443,7 @@ $bits{readlink}{0} = $bf[0]; @{$bits{recv}}{3,2,1,0} = ($bf[3], $bf[3], $bf[3], $bf[3]); $bits{redo}{0} = $bf[0]; $bits{ref}{0} = $bf[0]; -@{$bits{refassign}}{6,5,1,0} = ($bf[7], $bf[7], $bf[1], $bf[1]); +@{$bits{refassign}}{5,4,1,0} = ($bf[7], $bf[7], $bf[1], $bf[1]); $bits{refgen}{0} = $bf[0]; $bits{regcmaybe}{0} = $bf[0]; $bits{regcomp}{0} = $bf[0]; @@ -459,10 +459,10 @@ $bits{rewinddir}{0} = $bf[0]; $bits{rkeys}{0} = $bf[0]; $bits{rmdir}{0} = $bf[0]; $bits{rv2av}{0} = $bf[0]; -@{$bits{rv2cv}}{7,6,0} = ('OPpENTERSUB_NOPAREN', 'OPpMAY_RETURN_CONSTANT', $bf[0]); -@{$bits{rv2gv}}{6,5,4,2,0} = ($bf[6], $bf[6], 'OPpALLOW_FAKE', 'OPpDONT_INIT_GV', $bf[0]); +@{$bits{rv2cv}}{7,5,0} = ('OPpENTERSUB_NOPAREN', 'OPpMAY_RETURN_CONSTANT', $bf[0]); +@{$bits{rv2gv}}{6,5,4,2,0} = ('OPpALLOW_FAKE', $bf[6], $bf[6], 'OPpDONT_INIT_GV', $bf[0]); $bits{rv2hv}{0} = $bf[0]; -@{$bits{rv2sv}}{6,5,0} = ($bf[6], $bf[6], $bf[0]); +@{$bits{rv2sv}}{5,4,0} = ($bf[6], $bf[6], $bf[0]); $bits{rvalues}{0} = $bf[0]; @{$bits{sassign}}{7,6,1,0} = ('OPpASSIGN_CV_TO_GV', 'OPpASSIGN_BACKWARDS', $bf[1], $bf[1]); $bits{scalar}{0} = $bf[0]; @@ -543,7 +543,7 @@ $bits{values}{0} = $bf[0]; our %defines = ( - OPpALLOW_FAKE => 16, + OPpALLOW_FAKE => 64, OPpARG1_MASK => 1, OPpARG2_MASK => 3, OPpARG3_MASK => 7, @@ -560,14 +560,14 @@ our %defines = ( OPpCOREARGS_DEREF2 => 2, OPpCOREARGS_PUSHMARK => 128, OPpCOREARGS_SCALARMOD => 64, - OPpDEREF => 96, - OPpDEREF_AV => 32, - OPpDEREF_HV => 64, - OPpDEREF_SV => 96, + OPpDEREF => 48, + OPpDEREF_AV => 16, + OPpDEREF_HV => 32, + OPpDEREF_SV => 48, OPpDONT_INIT_GV => 4, OPpEARLY_CV => 32, OPpENTERSUB_AMPER => 8, - OPpENTERSUB_DB => 16, + OPpENTERSUB_DB => 64, OPpENTERSUB_HASTARG => 4, OPpENTERSUB_INARGS => 1, OPpENTERSUB_NOPAREN => 128, @@ -591,27 +591,27 @@ our %defines = ( OPpITER_REVERSED => 4, OPpLIST_GUESSED => 64, OPpLVALUE => 128, - OPpLVAL_DEFER => 16, + OPpLVAL_DEFER => 64, OPpLVAL_INTRO => 128, - OPpLVREF_AV => 32, - OPpLVREF_CV => 96, + OPpLVREF_AV => 16, + OPpLVREF_CV => 48, OPpLVREF_ELEM => 4, - OPpLVREF_HV => 64, + OPpLVREF_HV => 32, OPpLVREF_ITER => 8, OPpLVREF_SV => 0, - OPpLVREF_TYPE => 96, + OPpLVREF_TYPE => 48, OPpMAYBE_LVSUB => 8, - OPpMAYBE_TRUEBOOL => 64, - OPpMAY_RETURN_CONSTANT => 64, + OPpMAYBE_TRUEBOOL => 16, + OPpMAY_RETURN_CONSTANT => 32, OPpOFFBYONE => 128, OPpOPEN_IN_CRLF => 32, OPpOPEN_IN_RAW => 16, OPpOPEN_OUT_CRLF => 128, OPpOPEN_OUT_RAW => 64, - OPpOUR_INTRO => 16, + OPpOUR_INTRO => 64, OPpPADRANGE_COUNTMASK => 127, OPpPADRANGE_COUNTSHIFT => 7, - OPpPAD_STATE => 16, + OPpPAD_STATE => 64, OPpPV_IS_UTF8 => 128, OPpREFCOUNTED => 64, OPpREPEAT_DOLIST => 64, diff --git a/op.c b/op.c index 0b34518..a08cb6a 100644 --- a/op.c +++ b/op.c @@ -1662,14 +1662,9 @@ Perl_scalarvoid(pTHX_ OP *arg) if (o->op_private == 4) break; /* FALLTHROUGH */ - case OP_GVSV: case OP_WANTARRAY: case OP_GV: case OP_SMARTMATCH: - case OP_PADSV: - case OP_PADAV: - case OP_PADHV: - case OP_PADANY: case OP_AV2ARYLEN: case OP_REF: case OP_REFGEN: @@ -1682,13 +1677,7 @@ Perl_scalarvoid(pTHX_ OP *arg) case OP_INDEX: case OP_RINDEX: case OP_SPRINTF: - case OP_AELEM: - case OP_AELEMFAST: - case OP_AELEMFAST_LEX: - case OP_ASLICE: case OP_KVASLICE: - case OP_HELEM: - case OP_HSLICE: case OP_KVHSLICE: case OP_UNPACK: case OP_PACK: @@ -1736,6 +1725,20 @@ Perl_scalarvoid(pTHX_ OP *arg) case OP_PROTOTYPE: case OP_RUNCV: func_ops: + useless = OP_DESC(o); + break; + + case OP_GVSV: + case OP_PADSV: + case OP_PADAV: + case OP_PADHV: + case OP_PADANY: + case OP_AELEM: + case OP_AELEMFAST: + case OP_AELEMFAST_LEX: + case OP_ASLICE: + case OP_HELEM: + case OP_HSLICE: if (!(o->op_private & (OPpLVAL_INTRO|OPpOUR_INTRO))) /* Otherwise it's "Useless use of grep iterator" */ useless = OP_DESC(o); @@ -10782,7 +10785,10 @@ Perl_ck_stringify(pTHX_ OP *o) { OP * const kid = OP_SIBLING(cUNOPo->op_first); PERL_ARGS_ASSERT_CK_STRINGIFY; - if (kid->op_type == OP_JOIN) { + if (kid->op_type == OP_JOIN || kid->op_type == OP_QUOTEMETA + || kid->op_type == OP_LC || kid->op_type == OP_LCFIRST + || kid->op_type == OP_UC || kid->op_type == OP_UCFIRST) + { assert(!OP_HAS_SIBLING(kid)); op_sibling_splice(o, cUNOPo->op_first, -1, NULL); op_free(o); diff --git a/opcode.h b/opcode.h index 04fdbfd..350eed1 100644 --- a/opcode.h +++ b/opcode.h @@ -1887,7 +1887,7 @@ EXTCONST U32 PL_opargs[] = { 0x00024401, /* kvhslice */ 0x00091480, /* unpack */ 0x0002140f, /* pack */ - 0x00111408, /* split */ + 0x00111418, /* split */ 0x0002140f, /* join */ 0x00002401, /* list */ 0x00224200, /* lslice */ @@ -2169,50 +2169,50 @@ END_EXTERN_C #define OPpSORT_INPLACE 0x08 #define OPpTRANS_SQUASH 0x08 #define OPpARG4_MASK 0x0f -#define OPpALLOW_FAKE 0x10 #define OPpCONST_ENTERED 0x10 -#define OPpENTERSUB_DB 0x10 +#define OPpDEREF_AV 0x10 #define OPpEVAL_COPHH 0x10 #define OPpFT_AFTER_t 0x10 -#define OPpLVAL_DEFER 0x10 +#define OPpLVREF_AV 0x10 +#define OPpMAYBE_TRUEBOOL 0x10 #define OPpOPEN_IN_RAW 0x10 -#define OPpOUR_INTRO 0x10 -#define OPpPAD_STATE 0x10 #define OPpSORT_DESCEND 0x10 #define OPpSUBSTR_REPL_FIRST 0x10 #define OPpTARGET_MY 0x10 -#define OPpDEREF_AV 0x20 +#define OPpDEREF_HV 0x20 #define OPpEARLY_CV 0x20 #define OPpEVAL_RE_REPARSING 0x20 #define OPpHUSH_VMSISH 0x20 -#define OPpLVREF_AV 0x20 +#define OPpLVREF_HV 0x20 +#define OPpMAY_RETURN_CONSTANT 0x20 #define OPpOPEN_IN_CRLF 0x20 #define OPpSORT_QSORT 0x20 #define OPpTRANS_COMPLEMENT 0x20 #define OPpTRUEBOOL 0x20 +#define OPpDEREF 0x30 +#define OPpDEREF_SV 0x30 +#define OPpLVREF_CV 0x30 +#define OPpLVREF_TYPE 0x30 +#define OPpALLOW_FAKE 0x40 #define OPpASSIGN_BACKWARDS 0x40 #define OPpASSIGN_COMMON 0x40 #define OPpCONST_BARE 0x40 #define OPpCOREARGS_SCALARMOD 0x40 -#define OPpDEREF_HV 0x40 +#define OPpENTERSUB_DB 0x40 #define OPpEXISTS_SUB 0x40 #define OPpFLIP_LINENUM 0x40 #define OPpHINT_M_VMSISH_STATUS 0x40 #define OPpLIST_GUESSED 0x40 -#define OPpLVREF_HV 0x40 -#define OPpMAYBE_TRUEBOOL 0x40 -#define OPpMAY_RETURN_CONSTANT 0x40 +#define OPpLVAL_DEFER 0x40 #define OPpOPEN_OUT_RAW 0x40 +#define OPpOUR_INTRO 0x40 +#define OPpPAD_STATE 0x40 #define OPpREFCOUNTED 0x40 #define OPpREPEAT_DOLIST 0x40 #define OPpRUNTIME 0x40 #define OPpSLICE 0x40 #define OPpSORT_STABLE 0x40 #define OPpTRANS_GROWS 0x40 -#define OPpDEREF 0x60 -#define OPpDEREF_SV 0x60 -#define OPpLVREF_CV 0x60 -#define OPpLVREF_TYPE 0x60 #define OPpPADRANGE_COUNTMASK 0x7f #define OPpASSIGN_CV_TO_GV 0x80 #define OPpCOREARGS_PUSHMARK 0x80 @@ -2355,8 +2355,8 @@ EXTCONST I16 PL_op_private_bitfields[] = { 0, 8, -1, 0, 8, -1, 0, 8, -1, - 5, -1, 1, 130, 2, 137, 3, 144, -1, - 5, -1, 0, 481, 1, 26, 2, 250, 3, 83, -1, + 4, -1, 1, 130, 2, 137, 3, 144, -1, + 4, -1, 0, 481, 1, 26, 2, 250, 3, 83, -1, }; @@ -2513,241 +2513,241 @@ EXTCONST I16 PL_op_private_bitdef_ix[] = { 271, /* unpack */ 272, /* pack */ 273, /* split */ - 275, /* join */ - 276, /* list */ - 278, /* lslice */ - 279, /* anonlist */ - 280, /* anonhash */ - 281, /* splice */ - 282, /* push */ - 284, /* pop */ - 285, /* shift */ - 286, /* unshift */ - 288, /* sort */ - 295, /* reverse */ - 297, /* grepstart */ - 298, /* grepwhile */ - 300, /* mapstart */ - 301, /* mapwhile */ - 303, /* range */ - 304, /* flip */ - 306, /* flop */ - 308, /* and */ - 309, /* or */ - 310, /* xor */ - 311, /* dor */ - 312, /* cond_expr */ - 314, /* andassign */ - 315, /* orassign */ - 316, /* dorassign */ - 317, /* method */ - 318, /* entersub */ - 325, /* leavesub */ - 327, /* leavesublv */ - 329, /* caller */ - 331, /* warn */ - 332, /* die */ - 333, /* reset */ + 276, /* join */ + 277, /* list */ + 279, /* lslice */ + 280, /* anonlist */ + 281, /* anonhash */ + 282, /* splice */ + 283, /* push */ + 285, /* pop */ + 286, /* shift */ + 287, /* unshift */ + 289, /* sort */ + 296, /* reverse */ + 298, /* grepstart */ + 299, /* grepwhile */ + 301, /* mapstart */ + 302, /* mapwhile */ + 304, /* range */ + 305, /* flip */ + 307, /* flop */ + 309, /* and */ + 310, /* or */ + 311, /* xor */ + 312, /* dor */ + 313, /* cond_expr */ + 315, /* andassign */ + 316, /* orassign */ + 317, /* dorassign */ + 318, /* method */ + 319, /* entersub */ + 326, /* leavesub */ + 328, /* leavesublv */ + 330, /* caller */ + 332, /* warn */ + 333, /* die */ + 334, /* reset */ -1, /* lineseq */ - 334, /* nextstate */ - 337, /* dbstate */ + 335, /* nextstate */ + 338, /* dbstate */ -1, /* unstack */ -1, /* enter */ - 340, /* leave */ + 341, /* leave */ -1, /* scope */ - 342, /* enteriter */ - 346, /* iter */ + 343, /* enteriter */ + 347, /* iter */ -1, /* enterloop */ - 347, /* leaveloop */ + 348, /* leaveloop */ -1, /* return */ - 349, /* last */ - 351, /* next */ - 353, /* redo */ - 355, /* dump */ - 357, /* goto */ - 359, /* exit */ - 360, /* method_named */ - 361, /* entergiven */ - 362, /* leavegiven */ - 363, /* enterwhen */ - 364, /* leavewhen */ + 350, /* last */ + 352, /* next */ + 354, /* redo */ + 356, /* dump */ + 358, /* goto */ + 360, /* exit */ + 361, /* method_named */ + 362, /* entergiven */ + 363, /* leavegiven */ + 364, /* enterwhen */ + 365, /* leavewhen */ -1, /* break */ -1, /* continue */ - 365, /* open */ - 370, /* close */ - 371, /* pipe_op */ - 372, /* fileno */ - 373, /* umask */ - 374, /* binmode */ - 375, /* tie */ - 376, /* untie */ - 377, /* tied */ - 378, /* dbmopen */ - 379, /* dbmclose */ - 380, /* sselect */ - 381, /* select */ - 382, /* getc */ - 383, /* read */ - 384, /* enterwrite */ - 385, /* leavewrite */ + 366, /* open */ + 371, /* close */ + 372, /* pipe_op */ + 373, /* fileno */ + 374, /* umask */ + 375, /* binmode */ + 376, /* tie */ + 377, /* untie */ + 378, /* tied */ + 379, /* dbmopen */ + 380, /* dbmclose */ + 381, /* sselect */ + 382, /* select */ + 383, /* getc */ + 384, /* read */ + 385, /* enterwrite */ + 386, /* leavewrite */ -1, /* prtf */ -1, /* print */ -1, /* say */ - 387, /* sysopen */ - 388, /* sysseek */ - 389, /* sysread */ - 390, /* syswrite */ - 391, /* eof */ - 392, /* tell */ - 393, /* seek */ - 394, /* truncate */ - 395, /* fcntl */ - 396, /* ioctl */ - 397, /* flock */ - 399, /* send */ - 400, /* recv */ - 401, /* socket */ - 402, /* sockpair */ - 403, /* bind */ - 404, /* connect */ - 405, /* listen */ - 406, /* accept */ - 407, /* shutdown */ - 408, /* gsockopt */ - 409, /* ssockopt */ - 410, /* getsockname */ - 411, /* getpeername */ - 412, /* lstat */ - 413, /* stat */ - 414, /* ftrread */ - 419, /* ftrwrite */ - 424, /* ftrexec */ - 429, /* fteread */ - 434, /* ftewrite */ - 439, /* fteexec */ - 444, /* ftis */ - 448, /* ftsize */ - 452, /* ftmtime */ - 456, /* ftatime */ - 460, /* ftctime */ - 464, /* ftrowned */ - 468, /* fteowned */ - 472, /* ftzero */ - 476, /* ftsock */ - 480, /* ftchr */ - 484, /* ftblk */ - 488, /* ftfile */ - 492, /* ftdir */ - 496, /* ftpipe */ - 500, /* ftsuid */ - 504, /* ftsgid */ - 508, /* ftsvtx */ - 512, /* ftlink */ - 516, /* fttty */ - 520, /* fttext */ - 524, /* ftbinary */ - 528, /* chdir */ - 530, /* chown */ - 532, /* chroot */ - 534, /* unlink */ - 536, /* chmod */ - 538, /* utime */ - 540, /* rename */ - 542, /* link */ - 544, /* symlink */ - 546, /* readlink */ - 547, /* mkdir */ - 549, /* rmdir */ - 551, /* open_dir */ - 552, /* readdir */ - 553, /* telldir */ - 554, /* seekdir */ - 555, /* rewinddir */ - 556, /* closedir */ + 388, /* sysopen */ + 389, /* sysseek */ + 390, /* sysread */ + 391, /* syswrite */ + 392, /* eof */ + 393, /* tell */ + 394, /* seek */ + 395, /* truncate */ + 396, /* fcntl */ + 397, /* ioctl */ + 398, /* flock */ + 400, /* send */ + 401, /* recv */ + 402, /* socket */ + 403, /* sockpair */ + 404, /* bind */ + 405, /* connect */ + 406, /* listen */ + 407, /* accept */ + 408, /* shutdown */ + 409, /* gsockopt */ + 410, /* ssockopt */ + 411, /* getsockname */ + 412, /* getpeername */ + 413, /* lstat */ + 414, /* stat */ + 415, /* ftrread */ + 420, /* ftrwrite */ + 425, /* ftrexec */ + 430, /* fteread */ + 435, /* ftewrite */ + 440, /* fteexec */ + 445, /* ftis */ + 449, /* ftsize */ + 453, /* ftmtime */ + 457, /* ftatime */ + 461, /* ftctime */ + 465, /* ftrowned */ + 469, /* fteowned */ + 473, /* ftzero */ + 477, /* ftsock */ + 481, /* ftchr */ + 485, /* ftblk */ + 489, /* ftfile */ + 493, /* ftdir */ + 497, /* ftpipe */ + 501, /* ftsuid */ + 505, /* ftsgid */ + 509, /* ftsvtx */ + 513, /* ftlink */ + 517, /* fttty */ + 521, /* fttext */ + 525, /* ftbinary */ + 529, /* chdir */ + 531, /* chown */ + 533, /* chroot */ + 535, /* unlink */ + 537, /* chmod */ + 539, /* utime */ + 541, /* rename */ + 543, /* link */ + 545, /* symlink */ + 547, /* readlink */ + 548, /* mkdir */ + 550, /* rmdir */ + 552, /* open_dir */ + 553, /* readdir */ + 554, /* telldir */ + 555, /* seekdir */ + 556, /* rewinddir */ + 557, /* closedir */ -1, /* fork */ - 557, /* wait */ - 558, /* waitpid */ - 560, /* system */ - 562, /* exec */ - 564, /* kill */ - 566, /* getppid */ - 567, /* getpgrp */ - 569, /* setpgrp */ - 571, /* getpriority */ - 573, /* setpriority */ - 575, /* time */ + 558, /* wait */ + 559, /* waitpid */ + 561, /* system */ + 563, /* exec */ + 565, /* kill */ + 567, /* getppid */ + 568, /* getpgrp */ + 570, /* setpgrp */ + 572, /* getpriority */ + 574, /* setpriority */ + 576, /* time */ -1, /* tms */ - 576, /* localtime */ - 577, /* gmtime */ - 578, /* alarm */ - 579, /* sleep */ - 581, /* shmget */ - 582, /* shmctl */ - 583, /* shmread */ - 584, /* shmwrite */ - 585, /* msgget */ - 586, /* msgctl */ - 587, /* msgsnd */ - 588, /* msgrcv */ - 589, /* semop */ - 590, /* semget */ - 591, /* semctl */ - 592, /* require */ - 593, /* dofile */ + 577, /* localtime */ + 578, /* gmtime */ + 579, /* alarm */ + 580, /* sleep */ + 582, /* shmget */ + 583, /* shmctl */ + 584, /* shmread */ + 585, /* shmwrite */ + 586, /* msgget */ + 587, /* msgctl */ + 588, /* msgsnd */ + 589, /* msgrcv */ + 590, /* semop */ + 591, /* semget */ + 592, /* semctl */ + 593, /* require */ + 594, /* dofile */ -1, /* hintseval */ - 594, /* entereval */ - 600, /* leaveeval */ - 602, /* entertry */ + 595, /* entereval */ + 601, /* leaveeval */ + 603, /* entertry */ -1, /* leavetry */ - 603, /* ghbyname */ - 604, /* ghbyaddr */ + 604, /* ghbyname */ + 605, /* ghbyaddr */ -1, /* ghostent */ - 605, /* gnbyname */ - 606, /* gnbyaddr */ + 606, /* gnbyname */ + 607, /* gnbyaddr */ -1, /* gnetent */ - 607, /* gpbyname */ - 608, /* gpbynumber */ + 608, /* gpbyname */ + 609, /* gpbynumber */ -1, /* gprotoent */ - 609, /* gsbyname */ - 610, /* gsbyport */ + 610, /* gsbyname */ + 611, /* gsbyport */ -1, /* gservent */ - 611, /* shostent */ - 612, /* snetent */ - 613, /* sprotoent */ - 614, /* sservent */ + 612, /* shostent */ + 613, /* snetent */ + 614, /* sprotoent */ + 615, /* sservent */ -1, /* ehostent */ -1, /* enetent */ -1, /* eprotoent */ -1, /* eservent */ - 615, /* gpwnam */ - 616, /* gpwuid */ + 616, /* gpwnam */ + 617, /* gpwuid */ -1, /* gpwent */ -1, /* spwent */ -1, /* epwent */ - 617, /* ggrnam */ - 618, /* ggrgid */ + 618, /* ggrnam */ + 619, /* ggrgid */ -1, /* ggrent */ -1, /* sgrent */ -1, /* egrent */ -1, /* getlogin */ - 619, /* syscall */ - 620, /* lock */ - 621, /* once */ + 620, /* syscall */ + 621, /* lock */ + 622, /* once */ -1, /* custom */ - 622, /* reach */ - 623, /* rkeys */ - 625, /* rvalues */ - 626, /* coreargs */ - 630, /* runcv */ - 631, /* fc */ + 623, /* reach */ + 624, /* rkeys */ + 626, /* rvalues */ + 627, /* coreargs */ + 631, /* runcv */ + 632, /* fc */ -1, /* padcv */ -1, /* introcv */ -1, /* clonecv */ - 632, /* padrange */ - 634, /* refassign */ - 640, /* lvref */ - 646, /* lvrefslice */ - 647, /* lvavref */ + 633, /* padrange */ + 635, /* refassign */ + 641, /* lvref */ + 647, /* lvrefslice */ + 648, /* lvavref */ }; @@ -2767,20 +2767,20 @@ EXTCONST I16 PL_op_private_bitdef_ix[] = { EXTCONST U16 PL_op_private_bitdefs[] = { /* scalar */ 0x0003, - /* pushmark */ 0x281c, 0x3a11, + /* pushmark */ 0x281c, 0x3a19, /* wantarray */ 0x00bd, /* const */ 0x03b8, 0x1490, 0x3acc, 0x3588, 0x2be5, - /* gvsv */ 0x281c, 0x2d31, + /* gvsv */ 0x281c, 0x2d39, /* gv */ 0x12f5, /* gelem */ 0x0067, - /* padsv */ 0x281c, 0x025a, 0x3a11, - /* padav */ 0x281c, 0x3a10, 0x290c, 0x3709, - /* padhv */ 0x281c, 0x05d8, 0x0534, 0x3a10, 0x290c, 0x3709, + /* padsv */ 0x281c, 0x3a18, 0x0257, + /* padav */ 0x281c, 0x3a18, 0x290c, 0x3709, + /* padhv */ 0x281c, 0x3a18, 0x0534, 0x05d0, 0x290c, 0x3709, /* pushre */ 0x34d9, - /* rv2gv */ 0x281c, 0x025a, 0x1590, 0x290c, 0x2b08, 0x3ac4, 0x0003, - /* rv2sv */ 0x281c, 0x025a, 0x2d30, 0x3ac4, 0x0003, + /* rv2gv */ 0x281c, 0x1598, 0x0256, 0x290c, 0x2b08, 0x3ac4, 0x0003, + /* rv2sv */ 0x281c, 0x2d38, 0x0256, 0x3ac4, 0x0003, /* av2arylen */ 0x290c, 0x0003, - /* rv2cv */ 0x2a7c, 0x08f8, 0x0b90, 0x028c, 0x3c88, 0x3ac4, 0x0003, + /* rv2cv */ 0x2a7c, 0x0b98, 0x08f4, 0x028c, 0x3c88, 0x3ac4, 0x0003, /* prototype */ 0x0003, /* refgen */ 0x0003, /* srefgen */ 0x0003, @@ -2888,10 +2888,10 @@ EXTCONST U16 PL_op_private_bitdefs[] = { /* uc */ 0x0003, /* lc */ 0x0003, /* quotemeta */ 0x0003, - /* rv2av */ 0x281c, 0x2d30, 0x290c, 0x3708, 0x3ac4, 0x0003, + /* rv2av */ 0x281c, 0x2d38, 0x290c, 0x3708, 0x3ac4, 0x0003, /* aelemfast */ 0x01ff, /* aelemfast_lex */ 0x01ff, - /* aelem */ 0x281c, 0x025a, 0x2710, 0x290c, 0x0067, + /* aelem */ 0x281c, 0x2718, 0x0256, 0x290c, 0x0067, /* aslice */ 0x281c, 0x290c, 0x3709, /* kvaslice */ 0x290d, /* aeach */ 0x0003, @@ -2902,13 +2902,13 @@ EXTCONST U16 PL_op_private_bitdefs[] = { /* keys */ 0x290c, 0x0003, /* delete */ 0x281c, 0x3658, 0x0003, /* exists */ 0x3bb8, 0x0003, - /* rv2hv */ 0x281c, 0x05d8, 0x0534, 0x2d30, 0x290c, 0x3708, 0x3ac4, 0x0003, - /* helem */ 0x281c, 0x025a, 0x2710, 0x290c, 0x0067, + /* rv2hv */ 0x281c, 0x2d38, 0x0534, 0x05d0, 0x290c, 0x3708, 0x3ac4, 0x0003, + /* helem */ 0x281c, 0x2718, 0x0256, 0x290c, 0x0067, /* hslice */ 0x281c, 0x290c, 0x3709, /* kvhslice */ 0x290d, /* unpack */ 0x012f, /* pack */ 0x012f, - /* split */ 0x207c, 0x2d31, + /* split */ 0x207c, 0x2d38, 0x3d31, /* join */ 0x012f, /* list */ 0x281c, 0x1cd9, /* lslice */ 0x0067, @@ -2937,7 +2937,7 @@ EXTCONST U16 PL_op_private_bitdefs[] = { /* orassign */ 0x0003, /* dorassign */ 0x0003, /* method */ 0x0003, - /* entersub */ 0x281c, 0x025a, 0x0b90, 0x028c, 0x3c88, 0x3ac4, 0x2141, + /* entersub */ 0x281c, 0x0b98, 0x0256, 0x028c, 0x3c88, 0x3ac4, 0x2141, /* leavesub */ 0x3098, 0x0003, /* leavesublv */ 0x3098, 0x0003, /* caller */ 0x00bc, 0x012f, @@ -2947,7 +2947,7 @@ EXTCONST U16 PL_op_private_bitdefs[] = { /* nextstate */ 0x40dc, 0x3f18, 0x1eb5, /* dbstate */ 0x40dc, 0x3f18, 0x1eb5, /* leave */ 0x26bc, 0x3099, - /* enteriter */ 0x281c, 0x2d30, 0x0c0c, 0x33a9, + /* enteriter */ 0x281c, 0x2d38, 0x0c0c, 0x33a9, /* iter */ 0x33a9, /* leaveloop */ 0x26bc, 0x0067, /* last */ 0x3e9c, 0x0003, @@ -3106,10 +3106,10 @@ EXTCONST U16 PL_op_private_bitdefs[] = { /* runcv */ 0x00bd, /* fc */ 0x0003, /* padrange */ 0x281c, 0x019b, - /* refassign */ 0x281c, 0x037a, 0x3a10, 0x250c, 0x13e8, 0x0067, - /* lvref */ 0x281c, 0x037a, 0x3a10, 0x250c, 0x13e8, 0x0003, + /* refassign */ 0x281c, 0x3a18, 0x0376, 0x250c, 0x13e8, 0x0067, + /* lvref */ 0x281c, 0x3a18, 0x0376, 0x250c, 0x13e8, 0x0003, /* lvrefslice */ 0x281d, - /* lvavref */ 0x281c, 0x3a10, 0x0003, + /* lvavref */ 0x281c, 0x3a18, 0x0003, }; @@ -3127,15 +3127,15 @@ EXTCONST U8 PL_op_private_valid[] = { /* GVSV */ (OPpOUR_INTRO|OPpLVAL_INTRO), /* GV */ (OPpEARLY_CV), /* GELEM */ (OPpARG2_MASK), - /* PADSV */ (OPpPAD_STATE|OPpDEREF|OPpLVAL_INTRO), + /* PADSV */ (OPpDEREF|OPpPAD_STATE|OPpLVAL_INTRO), /* PADAV */ (OPpSLICEWARNING|OPpMAYBE_LVSUB|OPpPAD_STATE|OPpLVAL_INTRO), - /* PADHV */ (OPpSLICEWARNING|OPpMAYBE_LVSUB|OPpPAD_STATE|OPpTRUEBOOL|OPpMAYBE_TRUEBOOL|OPpLVAL_INTRO), + /* PADHV */ (OPpSLICEWARNING|OPpMAYBE_LVSUB|OPpMAYBE_TRUEBOOL|OPpTRUEBOOL|OPpPAD_STATE|OPpLVAL_INTRO), /* PADANY */ (0), /* PUSHRE */ (OPpRUNTIME), - /* RV2GV */ (OPpARG1_MASK|OPpHINT_STRICT_REFS|OPpDONT_INIT_GV|OPpMAYBE_LVSUB|OPpALLOW_FAKE|OPpDEREF|OPpLVAL_INTRO), - /* RV2SV */ (OPpARG1_MASK|OPpHINT_STRICT_REFS|OPpOUR_INTRO|OPpDEREF|OPpLVAL_INTRO), + /* RV2GV */ (OPpARG1_MASK|OPpHINT_STRICT_REFS|OPpDONT_INIT_GV|OPpMAYBE_LVSUB|OPpDEREF|OPpALLOW_FAKE|OPpLVAL_INTRO), + /* RV2SV */ (OPpARG1_MASK|OPpHINT_STRICT_REFS|OPpDEREF|OPpOUR_INTRO|OPpLVAL_INTRO), /* AV2ARYLEN */ (OPpARG1_MASK|OPpMAYBE_LVSUB), - /* RV2CV */ (OPpARG1_MASK|OPpHINT_STRICT_REFS|OPpENTERSUB_HASTARG|OPpENTERSUB_AMPER|OPpENTERSUB_DB|OPpMAY_RETURN_CONSTANT|OPpENTERSUB_NOPAREN), + /* RV2CV */ (OPpARG1_MASK|OPpHINT_STRICT_REFS|OPpENTERSUB_HASTARG|OPpENTERSUB_AMPER|OPpMAY_RETURN_CONSTANT|OPpENTERSUB_DB|OPpENTERSUB_NOPAREN), /* ANONCODE */ (0), /* PROTOTYPE */ (OPpARG1_MASK), /* REFGEN */ (OPpARG1_MASK), @@ -3248,7 +3248,7 @@ EXTCONST U8 PL_op_private_valid[] = { /* RV2AV */ (OPpARG1_MASK|OPpHINT_STRICT_REFS|OPpSLICEWARNING|OPpMAYBE_LVSUB|OPpOUR_INTRO|OPpLVAL_INTRO), /* AELEMFAST */ (255), /* AELEMFAST_LEX */ (255), - /* AELEM */ (OPpARG2_MASK|OPpMAYBE_LVSUB|OPpLVAL_DEFER|OPpDEREF|OPpLVAL_INTRO), + /* AELEM */ (OPpARG2_MASK|OPpMAYBE_LVSUB|OPpDEREF|OPpLVAL_DEFER|OPpLVAL_INTRO), /* ASLICE */ (OPpSLICEWARNING|OPpMAYBE_LVSUB|OPpLVAL_INTRO), /* KVASLICE */ (OPpMAYBE_LVSUB), /* AEACH */ (OPpARG1_MASK), @@ -3259,13 +3259,13 @@ EXTCONST U8 PL_op_private_valid[] = { /* KEYS */ (OPpARG1_MASK|OPpMAYBE_LVSUB), /* DELETE */ (OPpARG1_MASK|OPpSLICE|OPpLVAL_INTRO), /* EXISTS */ (OPpARG1_MASK|OPpEXISTS_SUB), - /* RV2HV */ (OPpARG1_MASK|OPpHINT_STRICT_REFS|OPpSLICEWARNING|OPpMAYBE_LVSUB|OPpOUR_INTRO|OPpTRUEBOOL|OPpMAYBE_TRUEBOOL|OPpLVAL_INTRO), - /* HELEM */ (OPpARG2_MASK|OPpMAYBE_LVSUB|OPpLVAL_DEFER|OPpDEREF|OPpLVAL_INTRO), + /* RV2HV */ (OPpARG1_MASK|OPpHINT_STRICT_REFS|OPpSLICEWARNING|OPpMAYBE_LVSUB|OPpMAYBE_TRUEBOOL|OPpTRUEBOOL|OPpOUR_INTRO|OPpLVAL_INTRO), + /* HELEM */ (OPpARG2_MASK|OPpMAYBE_LVSUB|OPpDEREF|OPpLVAL_DEFER|OPpLVAL_INTRO), /* HSLICE */ (OPpSLICEWARNING|OPpMAYBE_LVSUB|OPpLVAL_INTRO), /* KVHSLICE */ (OPpMAYBE_LVSUB), /* UNPACK */ (OPpARG4_MASK), /* PACK */ (OPpARG4_MASK), - /* SPLIT */ (OPpOUR_INTRO|OPpSPLIT_IMPLIM), + /* SPLIT */ (OPpTARGET_MY|OPpOUR_INTRO|OPpSPLIT_IMPLIM), /* JOIN */ (OPpARG4_MASK), /* LIST */ (OPpLIST_GUESSED|OPpLVAL_INTRO), /* LSLICE */ (OPpARG2_MASK), @@ -3294,7 +3294,7 @@ EXTCONST U8 PL_op_private_valid[] = { /* ORASSIGN */ (OPpARG1_MASK), /* DORASSIGN */ (OPpARG1_MASK), /* METHOD */ (OPpARG1_MASK), - /* ENTERSUB */ (OPpENTERSUB_INARGS|OPpHINT_STRICT_REFS|OPpENTERSUB_HASTARG|OPpENTERSUB_AMPER|OPpENTERSUB_DB|OPpDEREF|OPpLVAL_INTRO), + /* ENTERSUB */ (OPpENTERSUB_INARGS|OPpHINT_STRICT_REFS|OPpENTERSUB_HASTARG|OPpENTERSUB_AMPER|OPpDEREF|OPpENTERSUB_DB|OPpLVAL_INTRO), /* LEAVESUB */ (OPpARG1_MASK|OPpREFCOUNTED), /* LEAVESUBLV */ (OPpARG1_MASK|OPpREFCOUNTED), /* CALLER */ (OPpARG4_MASK|OPpOFFBYONE), @@ -3497,8 +3497,8 @@ EXTCONST U8 PL_op_private_valid[] = { /* INTROCV */ (0), /* CLONECV */ (0), /* PADRANGE */ (OPpPADRANGE_COUNTMASK|OPpLVAL_INTRO), - /* REFASSIGN */ (OPpARG2_MASK|OPpLVREF_ELEM|OPpLVREF_ITER|OPpPAD_STATE|OPpLVREF_TYPE|OPpLVAL_INTRO), - /* LVREF */ (OPpARG1_MASK|OPpLVREF_ELEM|OPpLVREF_ITER|OPpPAD_STATE|OPpLVREF_TYPE|OPpLVAL_INTRO), + /* REFASSIGN */ (OPpARG2_MASK|OPpLVREF_ELEM|OPpLVREF_ITER|OPpLVREF_TYPE|OPpPAD_STATE|OPpLVAL_INTRO), + /* LVREF */ (OPpARG1_MASK|OPpLVREF_ELEM|OPpLVREF_ITER|OPpLVREF_TYPE|OPpPAD_STATE|OPpLVAL_INTRO), /* LVREFSLICE */ (OPpLVAL_INTRO), /* LVAVREF */ (OPpARG1_MASK|OPpPAD_STATE|OPpLVAL_INTRO), diff --git a/regen/op_private b/regen/op_private index a341a97..dc46b8a 100644 --- a/regen/op_private +++ b/regen/op_private @@ -35,7 +35,7 @@ bit bit field. Here's a general example: addbits('aelem', 7 => qw(OPpLVAL_INTRO LVINTRO), - '5..6' => { + '4..5' => { mask_def => 'OPpDEREF', enum => [ qw( 1 OPpDEREF_AV DREFAV @@ -43,7 +43,7 @@ bit bit field. Here's a general example: 3 OPpDEREF_SV DREFSV )], }, - 4 => qw(OPpLVAL_DEFER LVDEFER), + 6 => qw(OPpLVAL_DEFER LVDEFER), ); Here for the op C<aelem>, bits 4 and 7 (bits are numbered 0..7) are @@ -336,7 +336,7 @@ addbits($_, 7 => qw(OPpLVAL_INTRO LVINTRO)) # trans not OK (dTARG; TARG = sv_newmortal();) # ucfirst etc not OK: TMP arg processed inplace # quotemeta not OK (unsafe when TARG == arg) -# pack split - unknown whether they are safe +# pack - unknown whether it is safe # sprintf: is calling do_sprintf(TARG,...) which can act on TARG # before other args are processed. # @@ -402,7 +402,7 @@ addbits($_, 6 => qw(OPpRUNTIME RTIME)) # autovivify: Want ref to something for (qw(rv2gv rv2sv padsv aelem helem entersub)) { - addbits($_, '5..6' => { + addbits($_, '4..5' => { mask_def => 'OPpDEREF', enum => [ qw( 1 OPpDEREF_AV DREFAV @@ -416,7 +416,7 @@ for (qw(rv2gv rv2sv padsv aelem helem entersub)) { # Defer creation of array/hash elem -addbits($_, 4 => qw(OPpLVAL_DEFER LVDEFER)) for qw(aelem helem); +addbits($_, 6 => qw(OPpLVAL_DEFER LVDEFER)) for qw(aelem helem); @@ -427,7 +427,7 @@ addbits($_, 2 => qw(OPpSLICEWARNING SLICEWARN)) # warn about @hash{$scalar} # XXX Concise seemed to think that OPpOUR_INTRO is used in rv2gv too, # but I can't see it - DAPM -addbits($_, 4 => qw(OPpOUR_INTRO OURINTR)) # Variable was in an our() +addbits($_, 6 => qw(OPpOUR_INTRO OURINTR)) # Variable was in an our() for qw(gvsv rv2sv rv2av rv2hv enteriter split); @@ -441,8 +441,8 @@ addbits($_, 3 => qw(OPpMAYBE_LVSUB LVSUB)) for (qw(rv2hv padhv)) { addbits($_, # e.g. %hash in (%hash || $foo) ... + 4 => qw(OPpMAYBE_TRUEBOOL BOOL?), # ... cx not known till run time 5 => qw(OPpTRUEBOOL BOOL), # ... in void cxt - 6 => qw(OPpMAYBE_TRUEBOOL BOOL?), # ... cx not known till run time ); } @@ -471,7 +471,7 @@ addbits($_, 7 => qw(OPpPV_IS_UTF8 UTF)) for qw(last redo next goto dump); -addbits($_, 4 => qw(OPpPAD_STATE STATE)) for qw(padav padhv padsv lvavref +addbits($_, 6 => qw(OPpPAD_STATE STATE)) for qw(padav padhv padsv lvavref lvref refassign pushmark); @@ -526,9 +526,9 @@ addbits('repeat', 6 => qw(OPpREPEAT_DOLIST DOLIST)); # List replication # 1 HINT_STRICT_REFS check HINT_STRICT_REFS check # 2 OPpENTERSUB_HASTARG checki OPpENTERSUB_HASTARG # 3 OPpENTERSUB_AMPER check OPpENTERSUB_AMPER parser -# 4 OPpENTERSUB_DB check OPpENTERSUB_DB -# 5 OPpDEREF_AV context -# 6 OPpDEREF_HV context OPpMAY_RETURN_CONSTANT parser/context +# 4 OPpDEREF_AV context +# 5 OPpDEREF_HV context OPpMAY_RETURN_CONSTANT parser/context +# 6 OPpENTERSUB_DB check OPpENTERSUB_DB # 7 OPpLVAL_INTRO context OPpENTERSUB_NOPAREN parser # NB: OPpHINT_STRICT_REFS must equal HINT_STRICT_REFS @@ -538,8 +538,8 @@ addbits('entersub', 1 => qw(OPpHINT_STRICT_REFS STRICT), # 'use strict' in scope 2 => qw(OPpENTERSUB_HASTARG TARG ), # Called from OP tree 3 => qw(OPpENTERSUB_AMPER AMPER), # Used & form to call - 4 => qw(OPpENTERSUB_DB DBG ), # Debug subroutine - # 5..6 => OPpDEREF, already defined above + # 4..5 => OPpDEREF, already defined above + 6 => qw(OPpENTERSUB_DB DBG ), # Debug subroutine # 7 => OPpLVAL_INTRO, already defined above ); @@ -550,9 +550,9 @@ addbits('rv2cv', 1 => qw(OPpHINT_STRICT_REFS STRICT), # 'use strict' in scope 2 => qw(OPpENTERSUB_HASTARG TARG ), # If const sub, return the const 3 => qw(OPpENTERSUB_AMPER AMPER ), # Used & form to call - 4 => qw(OPpENTERSUB_DB DBG ), # Debug subroutine - 6 => qw(OPpMAY_RETURN_CONSTANT CONST ), + 5 => qw(OPpMAY_RETURN_CONSTANT CONST ), + 6 => qw(OPpENTERSUB_DB DBG ), # Debug subroutine 7 => qw(OPpENTERSUB_NOPAREN NO() ), # bare sub call (without parens) ); @@ -594,7 +594,7 @@ addbits('rv2gv', 2 => qw(OPpDONT_INIT_GV NOINIT), # Call gv_fetchpv with GV_NOINIT # (Therefore will return whatever is currently in # the symbol table, not guaranteed to be a PVGV) - 4 => qw(OPpALLOW_FAKE FAKE), # OK to return fake glob + 6 => qw(OPpALLOW_FAKE FAKE), # OK to return fake glob ); @@ -717,11 +717,10 @@ addbits('split', 7 => qw(OPpSPLIT_IMPLIM IMPLIM)); # implicit limit -# OPpLVREF_TYPE must not conflict with generic magic flags in mg.h. addbits($_, 2 => qw(OPpLVREF_ELEM ELEM ), 3 => qw(OPpLVREF_ITER ITER ), -'5..6'=> { +'4..5'=> { mask_def => 'OPpLVREF_TYPE', enum => [ qw( 0 OPpLVREF_SV SV diff --git a/regen/opcodes b/regen/opcodes index 6328b0e..be3bffe 100644 --- a/regen/opcodes +++ b/regen/opcodes @@ -239,7 +239,7 @@ kvhslice key/value hash slice ck_null m@ H L unpack unpack ck_fun u@ S S? pack pack ck_fun fmst@ S L -split split ck_split t@ S S S +split split ck_split T@ S S S join join or string ck_join fmst@ S L # List operators. -- Perl5 Master Repository
