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 /opcode.h | |
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 'opcode.h')
-rw-r--r-- | opcode.h | 578 |
1 files changed, 289 insertions, 289 deletions
@@ -1802,7 +1802,7 @@ EXTCONST U32 PL_opargs[] = { 0x0001121e, /* i_divide */ 0x0001123e, /* modulo */ 0x0001121e, /* i_modulo */ - 0x0001220b, /* repeat */ + 0x0001221b, /* repeat */ 0x0001123e, /* add */ 0x0001121e, /* i_add */ 0x0001123e, /* subtract */ @@ -2428,326 +2428,326 @@ EXTCONST I16 PL_op_private_bitdef_ix[] = { 123, /* modulo */ 125, /* i_modulo */ 127, /* repeat */ - 129, /* add */ - 131, /* i_add */ - 133, /* subtract */ - 135, /* i_subtract */ - 137, /* concat */ - 139, /* stringify */ - 141, /* left_shift */ - 143, /* right_shift */ - 145, /* lt */ - 146, /* i_lt */ - 147, /* gt */ - 148, /* i_gt */ - 149, /* le */ - 150, /* i_le */ - 151, /* ge */ - 152, /* i_ge */ - 153, /* eq */ - 154, /* i_eq */ - 155, /* ne */ - 156, /* i_ne */ - 157, /* ncmp */ - 158, /* i_ncmp */ - 159, /* slt */ - 160, /* sgt */ - 161, /* sle */ - 162, /* sge */ - 163, /* seq */ - 164, /* sne */ - 165, /* scmp */ - 166, /* bit_and */ - 167, /* bit_xor */ - 168, /* bit_or */ - 169, /* negate */ - 170, /* i_negate */ - 172, /* not */ - 173, /* complement */ - 174, /* smartmatch */ - 175, /* atan2 */ - 177, /* sin */ - 179, /* cos */ - 181, /* rand */ - 183, /* srand */ - 185, /* exp */ - 187, /* log */ - 189, /* sqrt */ - 191, /* int */ - 193, /* hex */ - 195, /* oct */ - 197, /* abs */ - 199, /* length */ - 201, /* substr */ - 204, /* vec */ - 207, /* index */ - 209, /* rindex */ - 211, /* sprintf */ - 212, /* formline */ - 213, /* ord */ - 215, /* chr */ - 217, /* crypt */ - 219, /* ucfirst */ - 220, /* lcfirst */ - 221, /* uc */ - 222, /* lc */ - 223, /* quotemeta */ - 224, /* rv2av */ - 230, /* aelemfast */ - 231, /* aelemfast_lex */ - 232, /* aelem */ - 237, /* aslice */ - 240, /* kvaslice */ - 241, /* aeach */ - 242, /* akeys */ - 243, /* avalues */ - 244, /* each */ - 245, /* values */ - 246, /* keys */ - 248, /* delete */ - 251, /* exists */ - 253, /* rv2hv */ - 261, /* helem */ - 266, /* hslice */ - 269, /* kvhslice */ - 270, /* unpack */ - 271, /* pack */ - 272, /* split */ - 274, /* join */ - 275, /* list */ - 277, /* lslice */ - 278, /* anonlist */ - 279, /* anonhash */ - 280, /* splice */ - 281, /* push */ - 283, /* pop */ - 284, /* shift */ - 285, /* unshift */ - 287, /* sort */ - 294, /* reverse */ - 296, /* grepstart */ - 297, /* grepwhile */ - 299, /* mapstart */ - 300, /* mapwhile */ - 302, /* range */ - 303, /* flip */ - 305, /* flop */ - 307, /* and */ - 308, /* or */ - 309, /* xor */ - 310, /* dor */ - 311, /* cond_expr */ - 313, /* andassign */ - 314, /* orassign */ - 315, /* dorassign */ - 316, /* method */ - 317, /* entersub */ - 324, /* leavesub */ - 326, /* leavesublv */ - 328, /* caller */ - 330, /* warn */ - 331, /* die */ - 332, /* reset */ + 130, /* add */ + 132, /* i_add */ + 134, /* subtract */ + 136, /* i_subtract */ + 138, /* concat */ + 140, /* stringify */ + 142, /* left_shift */ + 144, /* right_shift */ + 146, /* lt */ + 147, /* i_lt */ + 148, /* gt */ + 149, /* i_gt */ + 150, /* le */ + 151, /* i_le */ + 152, /* ge */ + 153, /* i_ge */ + 154, /* eq */ + 155, /* i_eq */ + 156, /* ne */ + 157, /* i_ne */ + 158, /* ncmp */ + 159, /* i_ncmp */ + 160, /* slt */ + 161, /* sgt */ + 162, /* sle */ + 163, /* sge */ + 164, /* seq */ + 165, /* sne */ + 166, /* scmp */ + 167, /* bit_and */ + 168, /* bit_xor */ + 169, /* bit_or */ + 170, /* negate */ + 171, /* i_negate */ + 173, /* not */ + 174, /* complement */ + 175, /* smartmatch */ + 176, /* atan2 */ + 178, /* sin */ + 180, /* cos */ + 182, /* rand */ + 184, /* srand */ + 186, /* exp */ + 188, /* log */ + 190, /* sqrt */ + 192, /* int */ + 194, /* hex */ + 196, /* oct */ + 198, /* abs */ + 200, /* length */ + 202, /* substr */ + 205, /* vec */ + 208, /* index */ + 210, /* rindex */ + 212, /* sprintf */ + 213, /* formline */ + 214, /* ord */ + 216, /* chr */ + 218, /* crypt */ + 220, /* ucfirst */ + 221, /* lcfirst */ + 222, /* uc */ + 223, /* lc */ + 224, /* quotemeta */ + 225, /* rv2av */ + 231, /* aelemfast */ + 232, /* aelemfast_lex */ + 233, /* aelem */ + 238, /* aslice */ + 241, /* kvaslice */ + 242, /* aeach */ + 243, /* akeys */ + 244, /* avalues */ + 245, /* each */ + 246, /* values */ + 247, /* keys */ + 249, /* delete */ + 252, /* exists */ + 254, /* rv2hv */ + 262, /* helem */ + 267, /* hslice */ + 270, /* kvhslice */ + 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 */ -1, /* lineseq */ - 333, /* nextstate */ - 336, /* dbstate */ + 334, /* nextstate */ + 337, /* dbstate */ -1, /* unstack */ -1, /* enter */ - 339, /* leave */ + 340, /* leave */ -1, /* scope */ - 341, /* enteriter */ - 345, /* iter */ + 342, /* enteriter */ + 346, /* iter */ -1, /* enterloop */ - 346, /* leaveloop */ + 347, /* leaveloop */ -1, /* return */ - 348, /* last */ - 350, /* next */ - 352, /* redo */ - 354, /* dump */ - 356, /* goto */ - 358, /* exit */ - 359, /* method_named */ - 360, /* entergiven */ - 361, /* leavegiven */ - 362, /* enterwhen */ - 363, /* leavewhen */ + 349, /* last */ + 351, /* next */ + 353, /* redo */ + 355, /* dump */ + 357, /* goto */ + 359, /* exit */ + 360, /* method_named */ + 361, /* entergiven */ + 362, /* leavegiven */ + 363, /* enterwhen */ + 364, /* leavewhen */ -1, /* break */ -1, /* continue */ - 364, /* open */ - 369, /* close */ - 370, /* pipe_op */ - 371, /* fileno */ - 372, /* umask */ - 373, /* binmode */ - 374, /* tie */ - 375, /* untie */ - 376, /* tied */ - 377, /* dbmopen */ - 378, /* dbmclose */ - 379, /* sselect */ - 380, /* select */ - 381, /* getc */ - 382, /* read */ - 383, /* enterwrite */ - 384, /* leavewrite */ + 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 */ -1, /* prtf */ -1, /* print */ -1, /* say */ - 386, /* sysopen */ - 387, /* sysseek */ - 388, /* sysread */ - 389, /* syswrite */ - 390, /* eof */ - 391, /* tell */ - 392, /* seek */ - 393, /* truncate */ - 394, /* fcntl */ - 395, /* ioctl */ - 396, /* flock */ - 398, /* send */ - 399, /* recv */ - 400, /* socket */ - 401, /* sockpair */ - 402, /* bind */ - 403, /* connect */ - 404, /* listen */ - 405, /* accept */ - 406, /* shutdown */ - 407, /* gsockopt */ - 408, /* ssockopt */ - 409, /* getsockname */ - 410, /* getpeername */ - 411, /* lstat */ - 412, /* stat */ - 413, /* ftrread */ - 418, /* ftrwrite */ - 423, /* ftrexec */ - 428, /* fteread */ - 433, /* ftewrite */ - 438, /* fteexec */ - 443, /* ftis */ - 447, /* ftsize */ - 451, /* ftmtime */ - 455, /* ftatime */ - 459, /* ftctime */ - 463, /* ftrowned */ - 467, /* fteowned */ - 471, /* ftzero */ - 475, /* ftsock */ - 479, /* ftchr */ - 483, /* ftblk */ - 487, /* ftfile */ - 491, /* ftdir */ - 495, /* ftpipe */ - 499, /* ftsuid */ - 503, /* ftsgid */ - 507, /* ftsvtx */ - 511, /* ftlink */ - 515, /* fttty */ - 519, /* fttext */ - 523, /* ftbinary */ - 527, /* chdir */ - 529, /* chown */ - 531, /* chroot */ - 533, /* unlink */ - 535, /* chmod */ - 537, /* utime */ - 539, /* rename */ - 541, /* link */ - 543, /* symlink */ - 545, /* readlink */ - 546, /* mkdir */ - 548, /* rmdir */ - 550, /* open_dir */ - 551, /* readdir */ - 552, /* telldir */ - 553, /* seekdir */ - 554, /* rewinddir */ - 555, /* closedir */ + 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 */ -1, /* fork */ - 556, /* wait */ - 557, /* waitpid */ - 559, /* system */ - 561, /* exec */ - 563, /* kill */ - 565, /* getppid */ - 566, /* getpgrp */ - 568, /* setpgrp */ - 570, /* getpriority */ - 572, /* setpriority */ - 574, /* time */ + 557, /* wait */ + 558, /* waitpid */ + 560, /* system */ + 562, /* exec */ + 564, /* kill */ + 566, /* getppid */ + 567, /* getpgrp */ + 569, /* setpgrp */ + 571, /* getpriority */ + 573, /* setpriority */ + 575, /* time */ -1, /* tms */ - 575, /* localtime */ - 576, /* gmtime */ - 577, /* alarm */ - 578, /* sleep */ - 580, /* shmget */ - 581, /* shmctl */ - 582, /* shmread */ - 583, /* shmwrite */ - 584, /* msgget */ - 585, /* msgctl */ - 586, /* msgsnd */ - 587, /* msgrcv */ - 588, /* semop */ - 589, /* semget */ - 590, /* semctl */ - 591, /* require */ - 592, /* dofile */ + 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 */ -1, /* hintseval */ - 593, /* entereval */ - 599, /* leaveeval */ - 601, /* entertry */ + 594, /* entereval */ + 600, /* leaveeval */ + 602, /* entertry */ -1, /* leavetry */ - 602, /* ghbyname */ - 603, /* ghbyaddr */ + 603, /* ghbyname */ + 604, /* ghbyaddr */ -1, /* ghostent */ - 604, /* gnbyname */ - 605, /* gnbyaddr */ + 605, /* gnbyname */ + 606, /* gnbyaddr */ -1, /* gnetent */ - 606, /* gpbyname */ - 607, /* gpbynumber */ + 607, /* gpbyname */ + 608, /* gpbynumber */ -1, /* gprotoent */ - 608, /* gsbyname */ - 609, /* gsbyport */ + 609, /* gsbyname */ + 610, /* gsbyport */ -1, /* gservent */ - 610, /* shostent */ - 611, /* snetent */ - 612, /* sprotoent */ - 613, /* sservent */ + 611, /* shostent */ + 612, /* snetent */ + 613, /* sprotoent */ + 614, /* sservent */ -1, /* ehostent */ -1, /* enetent */ -1, /* eprotoent */ -1, /* eservent */ - 614, /* gpwnam */ - 615, /* gpwuid */ + 615, /* gpwnam */ + 616, /* gpwuid */ -1, /* gpwent */ -1, /* spwent */ -1, /* epwent */ - 616, /* ggrnam */ - 617, /* ggrgid */ + 617, /* ggrnam */ + 618, /* ggrgid */ -1, /* ggrent */ -1, /* sgrent */ -1, /* egrent */ -1, /* getlogin */ - 618, /* syscall */ - 619, /* lock */ - 620, /* once */ + 619, /* syscall */ + 620, /* lock */ + 621, /* once */ -1, /* custom */ - 621, /* reach */ - 622, /* rkeys */ - 624, /* rvalues */ - 625, /* coreargs */ - 629, /* runcv */ - 630, /* fc */ + 622, /* reach */ + 623, /* rkeys */ + 625, /* rvalues */ + 626, /* coreargs */ + 630, /* runcv */ + 631, /* fc */ -1, /* padcv */ -1, /* introcv */ -1, /* clonecv */ - 631, /* padrange */ - 633, /* refassign */ - 639, /* lvref */ - 645, /* lvrefslice */ - 646, /* lvavref */ + 632, /* padrange */ + 634, /* refassign */ + 640, /* lvref */ + 646, /* lvrefslice */ + 647, /* lvavref */ }; @@ -2823,7 +2823,7 @@ EXTCONST U16 PL_op_private_bitdefs[] = { /* i_divide */ 0x3d30, 0x0067, /* modulo */ 0x3d30, 0x0067, /* i_modulo */ 0x3d30, 0x0067, - /* repeat */ 0x0f78, 0x0067, + /* repeat */ 0x0f78, 0x3d30, 0x0067, /* add */ 0x3d30, 0x0067, /* i_add */ 0x3d30, 0x0067, /* subtract */ 0x3d30, 0x0067, @@ -3180,7 +3180,7 @@ EXTCONST U8 PL_op_private_valid[] = { /* I_DIVIDE */ (OPpARG2_MASK|OPpTARGET_MY), /* MODULO */ (OPpARG2_MASK|OPpTARGET_MY), /* I_MODULO */ (OPpARG2_MASK|OPpTARGET_MY), - /* REPEAT */ (OPpARG2_MASK|OPpREPEAT_DOLIST), + /* REPEAT */ (OPpARG2_MASK|OPpTARGET_MY|OPpREPEAT_DOLIST), /* ADD */ (OPpARG2_MASK|OPpTARGET_MY), /* I_ADD */ (OPpARG2_MASK|OPpTARGET_MY), /* SUBTRACT */ (OPpARG2_MASK|OPpTARGET_MY), |