diff options
author | Father Chrysostomos <sprout@cpan.org> | 2014-11-07 21:46:58 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-11-08 00:33:02 -0800 |
commit | d8cdf5739e500a4f72aa611694308d7244c29573 (patch) | |
tree | 652494e1385679221ab2551bb565fd2304cfd5c5 /regen | |
parent | 12cea2fa656447eef8848bac6de2e3fe413eb787 (diff) | |
download | perl-d8cdf5739e500a4f72aa611694308d7244c29573.tar.gz |
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.
Diffstat (limited to 'regen')
-rw-r--r-- | regen/op_private | 2 | ||||
-rw-r--r-- | regen/opcodes | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/regen/op_private b/regen/op_private index 090df37006..dc46b8ae1a 100644 --- a/regen/op_private +++ b/regen/op_private @@ -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. # diff --git a/regen/opcodes b/regen/opcodes index 6328b0ed29..be3bffe5f3 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. |