summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2015-01-04 23:16:21 -0800
committerFather Chrysostomos <sprout@cpan.org>2015-01-05 06:30:32 -0800
commit33de0f79097a068801b9c5ffeb855e0b988703f6 (patch)
tree5e73179707fb0c41660b14b086c86e2f91d9840e
parent90207ba1bd77fb10e2c39594d954b43a9e8ee948 (diff)
downloadperl-33de0f79097a068801b9c5ffeb855e0b988703f6.tar.gz
complement can have OPpTARGET_MY
It always reads its argument out the outset and always returns its target, so there is no reason its target cannot be a lexical. (The OPpTARGET_MY optimisation makes $lexical = <some op> have the op write directly to the lexical; the assignment gets optimised away.)
-rw-r--r--lib/B/Op_private.pm4
-rw-r--r--opcode.h10
-rw-r--r--regen/opcodes2
3 files changed, 8 insertions, 8 deletions
diff --git a/lib/B/Op_private.pm b/lib/B/Op_private.pm
index e9e9ec30c4..32f8e20e6b 100644
--- a/lib/B/Op_private.pm
+++ b/lib/B/Op_private.pm
@@ -150,7 +150,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_ncmp 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 scmp setpgrp setpriority sin sleep split 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 complement concat cos crypt divide exec exp flock getpgrp getppid getpriority hex i_add i_divide i_modulo i_multiply i_ncmp 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 scmp setpgrp setpriority sin sleep split 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);
@@ -781,7 +781,7 @@ our %ops_using = (
OPpSORT_DESCEND => [qw(sort)],
OPpSPLIT_IMPLIM => [qw(split)],
OPpSUBSTR_REPL_FIRST => [qw(substr)],
- OPpTARGET_MY => [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_ncmp 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 scmp setpgrp setpriority sin sleep split sqrt srand stringify subst subtract symlink system time trans transr unlink unshift utime vec wait waitpid)],
+ OPpTARGET_MY => [qw(abs add atan2 chdir chmod chomp chown chr chroot complement concat cos crypt divide exec exp flock getpgrp getppid getpriority hex i_add i_divide i_modulo i_multiply i_ncmp 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 scmp setpgrp setpriority sin sleep split sqrt srand stringify subst subtract symlink system time trans transr unlink unshift utime vec wait waitpid)],
OPpTRANS_COMPLEMENT => [qw(trans transr)],
);
diff --git a/opcode.h b/opcode.h
index 0cbf277994..33e7e3d341 100644
--- a/opcode.h
+++ b/opcode.h
@@ -1854,7 +1854,7 @@ EXTCONST U32 PL_opargs[] = {
0x0000112e, /* negate */
0x0000110e, /* i_negate */
0x00001106, /* not */
- 0x0000110e, /* complement */
+ 0x0000111e, /* complement */
0x00000204, /* smartmatch */
0x0001141e, /* atan2 */
0x00009b9e, /* sin */
@@ -2483,7 +2483,7 @@ EXTCONST I16 PL_op_private_bitdef_ix[] = {
0, /* negate */
0, /* i_negate */
0, /* not */
- 0, /* complement */
+ 72, /* complement */
12, /* smartmatch */
79, /* atan2 */
72, /* sin */
@@ -2790,7 +2790,7 @@ EXTCONST I16 PL_op_private_bitdef_ix[] = {
*/
EXTCONST U16 PL_op_private_bitdefs[] = {
- 0x0003, /* scalar, prototype, refgen, srefgen, ref, readline, regcmaybe, regcreset, regcomp, chop, schop, defined, undef, study, preinc, i_preinc, predec, i_predec, postinc, i_postinc, postdec, i_postdec, negate, i_negate, not, complement, ucfirst, lcfirst, uc, lc, quotemeta, aeach, akeys, avalues, each, values, pop, shift, range, and, or, dor, andassign, orassign, dorassign, method, method_named, method_super, method_redir, method_redir_super, entergiven, leavegiven, enterwhen, leavewhen, untie, tied, dbmclose, getsockname, getpeername, lstat, stat, readlink, readdir, telldir, rewinddir, closedir, localtime, alarm, require, dofile, entertry, ghbyname, gnbyname, gpbyname, shostent, snetent, sprotoent, sservent, gpwnam, gpwuid, ggrnam, ggrgid, lock, once, reach, rvalues, fc */
+ 0x0003, /* scalar, prototype, refgen, srefgen, ref, readline, regcmaybe, regcreset, regcomp, chop, schop, defined, undef, study, preinc, i_preinc, predec, i_predec, postinc, i_postinc, postdec, i_postdec, negate, i_negate, not, ucfirst, lcfirst, uc, lc, quotemeta, aeach, akeys, avalues, each, values, pop, shift, range, and, or, dor, andassign, orassign, dorassign, method, method_named, method_super, method_redir, method_redir_super, entergiven, leavegiven, enterwhen, leavewhen, untie, tied, dbmclose, getsockname, getpeername, lstat, stat, readlink, readdir, telldir, rewinddir, closedir, localtime, alarm, require, dofile, entertry, ghbyname, gnbyname, gpbyname, shostent, snetent, sprotoent, sservent, gpwnam, gpwuid, ggrnam, ggrgid, lock, once, reach, rvalues, fc */
0x29dc, 0x3bd9, /* pushmark */
0x00bd, /* wantarray, runcv */
0x03b8, 0x1570, 0x3c8c, 0x3748, 0x2da5, /* const */
@@ -2812,7 +2812,7 @@ EXTCONST U16 PL_op_private_bitdefs[] = {
0x0c9c, 0x1dd8, 0x0834, 0x3ef0, 0x3a0c, 0x2168, 0x01e4, 0x0141, /* trans, transr */
0x0adc, 0x0458, 0x0067, /* sassign */
0x0758, 0x2acc, 0x0067, /* aassign */
- 0x3ef0, 0x0003, /* chomp, schomp, sin, cos, exp, log, sqrt, int, hex, oct, abs, length, ord, chr, chroot, rmdir */
+ 0x3ef0, 0x0003, /* chomp, schomp, complement, sin, cos, exp, log, sqrt, int, hex, oct, abs, length, ord, chr, chroot, rmdir */
0x3ef0, 0x0067, /* pow, multiply, i_multiply, divide, i_divide, modulo, i_modulo, add, i_add, subtract, i_subtract, concat, left_shift, right_shift, i_ncmp, scmp */
0x1058, 0x3ef0, 0x0067, /* repeat */
0x3ef0, 0x012f, /* stringify, atan2, rand, srand, index, rindex, crypt, push, unshift, flock, chdir, chown, unlink, chmod, utime, rename, link, symlink, mkdir, waitpid, system, exec, kill, getpgrp, setpgrp, getpriority, setpriority, sleep */
@@ -2961,7 +2961,7 @@ EXTCONST U8 PL_op_private_valid[] = {
/* NEGATE */ (OPpARG1_MASK),
/* I_NEGATE */ (OPpARG1_MASK),
/* NOT */ (OPpARG1_MASK),
- /* COMPLEMENT */ (OPpARG1_MASK),
+ /* COMPLEMENT */ (OPpARG1_MASK|OPpTARGET_MY),
/* SMARTMATCH */ (OPpARG2_MASK),
/* ATAN2 */ (OPpARG4_MASK|OPpTARGET_MY),
/* SIN */ (OPpARG1_MASK|OPpTARGET_MY),
diff --git a/regen/opcodes b/regen/opcodes
index 11df1448bf..f585cd2727 100644
--- a/regen/opcodes
+++ b/regen/opcodes
@@ -169,7 +169,7 @@ bit_or bitwise or (|) ck_bitop fst2 S S
negate negation (-) ck_null Ifst1 S
i_negate integer negation (-) ck_null ifst1 S
not not ck_null ifs1 S
-complement 1's complement (~) ck_bitop fst1 S
+complement 1's complement (~) ck_bitop fsT1 S
smartmatch smart match ck_smartmatch s2