]> git.pld-linux.org Git - packages/perl.git/blame - perl-parameter_passing.patch
- reverted
[packages/perl.git] / perl-parameter_passing.patch
CommitLineData
7cd63964 1commit fafafbaf705adfdf05ff97b6ab5149ba4ee3c039
2Author: Rick Delaney <rick@consumercontact.com>
3Date: Sun Jan 6 09:14:39 2008 -0500
4
5 Big slowdown in 5.10 @_ parameter passing
6 Message-ID: <20080106191439.GF13935@bort.ca>
7
8 p4raw-id: //depot/perl@32891
9
10diff --git a/op.c b/op.c
11index a732aa4..af52a3a 100644
12--- a/op.c
13+++ b/op.c
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";
17 OP *curop;
18+ bool maybe_common_vars = TRUE;
19
20 PL_modcount = 0;
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));
25
26+ if ((left->op_type == OP_LIST
27+ || (left->op_type == OP_NULL && left->op_targ == OP_LIST)))
28+ {
29+ OP* lop = ((LISTOP*)left)->op_first;
30+ maybe_common_vars = FALSE;
31+ while (lop) {
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;
38+
39+ if (lop->op_private & OPpPAD_STATE) {
40+ if (left->op_private & OPpLVAL_INTRO) {
41+ /* Each variable in state($a, $b, $c) = ... */
42+ }
43+ else {
44+ /* Each state variable in
45+ (state $a, my $b, our $c, $d, undef) = ... */
46+ }
47+ yyerror(no_list_state);
48+ } else {
49+ /* Each my variable in
50+ (state $a, my $b, our $c, $d, undef) = ... */
51+ }
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) */
56+ } else {
57+ /* Other ops in the list. */
58+ maybe_common_vars = TRUE;
59+ }
60+ lop = lop->op_sibling;
61+ }
62+ }
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))
68+ {
69+ maybe_common_vars = FALSE;
70+ if (left->op_private & OPpPAD_STATE) {
71+ /* All single variable list context state assignments, hence
72+ state ($a) = ...
73+ (state $a) = ...
74+ state @a = ...
75+ state (@a) = ...
76+ (state @a) = ...
77+ state %a = ...
78+ state (%a) = ...
79+ (state %a) = ...
80+ */
81+ yyerror(no_list_state);
82+ }
83+ }
84+
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().
90 */
91
92- {
93+ if (maybe_common_vars) {
94 OP *lastop = o;
95 PL_generation++;
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;
99 }
100
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;
104- while (lop) {
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) = ... */
112- }
113- else {
114- /* Each state variable in
115- (state $a, my $b, our $c, $d, undef) = ... */
116- }
117- yyerror(no_list_state);
118- } else {
119- /* Each my variable in
120- (state $a, my $b, our $c, $d, undef) = ... */
121- }
122- } else {
123- /* Other ops in the list. undef may be interesting in
124- (state $a, undef, state $c) */
125- }
126- lop = lop->op_sibling;
127- }
128- }
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))
135- {
136- /* All single variable list context state assignments, hence
137- state ($a) = ...
138- (state $a) = ...
139- state @a = ...
140- state (@a) = ...
141- (state @a) = ...
142- state %a = ...
143- state (%a) = ...
144- (state %a) = ...
145- */
146- yyerror(no_list_state);
147- }
148-
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)) {
This page took 0.101719 seconds and 4 git commands to generate.