pike.git/
src/
docode.c
Branch:
Tag:
Non-build tags
All tags
No tags
2004-10-28
2004-10-28 20:13:47 by Martin Stjernholm <mast@lysator.liu.se>
2d74b40a3c3a6a988faedf814ea498467ec3e0d2 (
19
lines) (+
11
/-
8
)
[
Show
|
Annotate
]
Branch:
7.9
Fixed the foreach (x
[start..]
, y) optimization so that it actually
kicks in.
Rev: src/docode.c:1.180
2:
|| This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information.
-
|| $Id: docode.c,v 1.
179
2004/
09
/
18
20:
50
:
48
nilsson
Exp $
+
|| $Id: docode.c,v 1.
180
2004/
10
/
28
20:
13
:
47
mast
Exp $
*/ #include "global.h"
1277:
if(CAR(arr) && CAR(arr)->token==F_RANGE) {
-
node **a1=my_get_arg(&_
CAR
(
arr
),0);
-
node **a2=my_get_arg(&_
CAR
(
arr
),1);
-
if(
a1 &&
a2
&& a2
[0]->token==F_CONSTANT &&
+
node *
range = CAR(arr);
+
node
*
*
a1=my_get_arg(&_
CDR
(
range
),0);
+
node **a2=my_get_arg(&_
CDR
(
range
),1);
+
if(a2[0]->token==F_CONSTANT &&
a2[0]->u.sval.type==T_INT && a2[0]->u.sval.u.integer==MAX_INT_TYPE &&
-
a1[0]->type
==
int_type_string)
+
match_types (
a1[0]->type
,
int_type_string)
)
{ /* Optimize foreach(x[start..],y). */
-
do_docode(CAR(
arr
),DO_NOT_COPY_TOPLEVEL);
-
do_docode(*a1,DO_NOT_COPY);
+
do_docode
(CAR(
range
),
DO_NOT_COPY_TOPLEVEL);
+
do_docode
(
CDR(arr), DO_NOT_COPY|DO_LVALUE);
+
do_docode (
*a1,
DO_NOT_COPY);
goto foreach_arg_pushed; } }
-
do_docode(
CAR(n)
,DO_NOT_COPY);
+
do_docode(
arr
,DO_NOT_COPY);
emit0(F_CONST0); current_stack_depth++; foreach_arg_pushed: