diff options
author | Father Chrysostomos <sprout@cpan.org> | 2014-11-07 14:55:24 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-11-07 20:14:36 -0800 |
commit | 6abbd373e741488741fdb8a7d9b6ef6ae89ed48c (patch) | |
tree | 375e4ad7208cb9b3ef12faec0cba43adac66396e /lib | |
parent | db098081e3682316e8cf22b9705c2563fc91eaec (diff) | |
download | perl-6abbd373e741488741fdb8a7d9b6ef6ae89ed48c.tar.gz |
Allow OPpTARGET_MY optimisation for x
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 can be extended to x. Despite what the comment in op_private
says, list return values do not matter here, because the OPpTARGET_MY
optimisation only happens when the operator is in scalar context. And
the scalar code paths use TARG and push TARG on to the stack.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/B/Op_private.pm | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/B/Op_private.pm b/lib/B/Op_private.pm index a09b8ca538..d9dbb8bce6 100644 --- a/lib/B/Op_private.pm +++ b/lib/B/Op_private.pm @@ -144,7 +144,7 @@ $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_negate i_postdec i_postinc i_subtract index int kill left_shift length link log match mkdir modulo multiply oct ord pow push rand rename right_shift rindex rmdir schomp setpgrp setpriority sin sleep sqrt srand stringify subst subtract symlink system time trans transr unlink unshift utime vec wait waitpid); +$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_negate i_postdec i_postinc i_subtract index int kill left_shift length link log match mkdir modulo multiply oct ord pow push rand rename repeat right_shift rindex rmdir schomp setpgrp setpriority sin sleep sqrt srand stringify subst subtract symlink system time trans transr unlink unshift utime vec wait waitpid); $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); |