1 commit fafafbaf705adfdf05ff97b6ab5149ba4ee3c039
2 Author: Rick Delaney <rick@consumercontact.com>
3 Date: Sun Jan 6 09:14:39 2008 -0500
5 Big slowdown in 5.10 @_ parameter passing
6 Message-ID: <20080106191439.GF13935@bort.ca>
8 p4raw-id: //depot/perl@32891
10 diff --git a/op.c b/op.c
11 index a732aa4..af52a3a 100644
14 @@ -3992,6 +3992,7 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right)
15 static const char no_list_state[] = "Initialization of state variables"
16 " in list context currently forbidden";
18 + bool maybe_common_vars = TRUE;
21 /* Grandfathering $[ assignment here. Bletch.*/
22 @@ -4009,6 +4010,65 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right)
23 o = newBINOP(OP_AASSIGN, flags, list(force_list(right)), curop);
24 o->op_private = (U8)(0 | (flags >> 8));
26 + if ((left->op_type == OP_LIST
27 + || (left->op_type == OP_NULL && left->op_targ == OP_LIST)))
29 + OP* lop = ((LISTOP*)left)->op_first;
30 + maybe_common_vars = FALSE;
32 + if (lop->op_type == OP_PADSV ||
33 + lop->op_type == OP_PADAV ||
34 + lop->op_type == OP_PADHV ||
35 + lop->op_type == OP_PADANY) {
36 + if (!(lop->op_private & OPpLVAL_INTRO))
37 + maybe_common_vars = TRUE;
39 + if (lop->op_private & OPpPAD_STATE) {
40 + if (left->op_private & OPpLVAL_INTRO) {
41 + /* Each variable in state($a, $b, $c) = ... */
44 + /* Each state variable in
45 + (state $a, my $b, our $c, $d, undef) = ... */
47 + yyerror(no_list_state);
49 + /* Each my variable in
50 + (state $a, my $b, our $c, $d, undef) = ... */
52 + } else if (lop->op_type == OP_UNDEF ||
53 + lop->op_type == OP_PUSHMARK) {
54 + /* undef may be interesting in
55 + (state $a, undef, state $c) */
57 + /* Other ops in the list. */
58 + maybe_common_vars = TRUE;
60 + lop = lop->op_sibling;
63 + else if ((left->op_private & OPpLVAL_INTRO)
64 + && ( left->op_type == OP_PADSV
65 + || left->op_type == OP_PADAV
66 + || left->op_type == OP_PADHV
67 + || left->op_type == OP_PADANY))
69 + maybe_common_vars = FALSE;
70 + if (left->op_private & OPpPAD_STATE) {
71 + /* All single variable list context state assignments, hence
81 + yyerror(no_list_state);
85 /* PL_generation sorcery:
86 * an assignment like ($a,$b) = ($c,$d) is easier than
87 * ($a,$b) = ($c,$a), since there is no need for temporary vars.
88 @@ -4023,7 +4083,7 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right)
89 * to store these values, evil chicanery is done with SvUVX().
93 + if (maybe_common_vars) {
96 for (curop = LINKLIST(o); curop != o; curop = LINKLIST(curop)) {
97 @@ -4084,54 +4144,6 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right)
98 o->op_private |= OPpASSIGN_COMMON;
101 - if ((left->op_type == OP_LIST
102 - || (left->op_type == OP_NULL && left->op_targ == OP_LIST))) {
103 - OP* lop = ((LISTOP*)left)->op_first;
105 - if (lop->op_type == OP_PADSV ||
106 - lop->op_type == OP_PADAV ||
107 - lop->op_type == OP_PADHV ||
108 - lop->op_type == OP_PADANY) {
109 - if (lop->op_private & OPpPAD_STATE) {
110 - if (left->op_private & OPpLVAL_INTRO) {
111 - /* Each variable in state($a, $b, $c) = ... */
114 - /* Each state variable in
115 - (state $a, my $b, our $c, $d, undef) = ... */
117 - yyerror(no_list_state);
119 - /* Each my variable in
120 - (state $a, my $b, our $c, $d, undef) = ... */
123 - /* Other ops in the list. undef may be interesting in
124 - (state $a, undef, state $c) */
126 - lop = lop->op_sibling;
129 - else if (((left->op_private & (OPpLVAL_INTRO | OPpPAD_STATE))
130 - == (OPpLVAL_INTRO | OPpPAD_STATE))
131 - && ( left->op_type == OP_PADSV
132 - || left->op_type == OP_PADAV
133 - || left->op_type == OP_PADHV
134 - || left->op_type == OP_PADANY))
136 - /* All single variable list context state assignments, hence
146 - yyerror(no_list_state);
149 if (right && right->op_type == OP_SPLIT && !PL_madskills) {
150 OP* tmpop = ((LISTOP*)right)->op_first;
151 if (tmpop && (tmpop->op_type == OP_PUSHRE)) {