pike.git
/
src
/
operators.c
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/operators.c:1:
/*\ ||| 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. \*/ /**/ #include "global.h" #include <math.h>
-
RCSID("$Id: operators.c,v 1.
154
2002/06/17
16
:
44
:
31
grubba Exp $");
+
RCSID("$Id: operators.c,v 1.
155
2002/06/17
17
:
35
:
20
grubba Exp $");
#include "interpret.h" #include "svalue.h" #include "multiset.h" #include "mapping.h" #include "array.h" #include "stralloc.h" #include "opcodes.h" #include "operators.h" #include "language.h" #include "pike_memory.h"
pike.git/src/operators.c:750:
/* !search(string a, string b) => has_prefix(a, b) */ ADD_NODE_REF(*more_args); return mkefuncallnode("has_prefix", search_args); } } } return 0; }
+
static node *may_have_side_effects(node *n)
+
{
+
node **arg;
+
int argno;
+
for (argno = 0; (arg = my_get_arg(&_CDR(n), argno)); argno++) {
+
if (match_types(object_type_string, (*arg)->type)) {
+
n->node_info |= OPT_SIDE_EFFECT;
+
n->tree_info |= OPT_SIDE_EFFECT;
+
return NULL;
+
}
+
}
+
return NULL;
+
}
static node *optimize_binary(node *n) { node **first_arg, **second_arg, *ret; if(count_args(CDR(n))==2) { first_arg=my_get_arg(&_CDR(n), 0); second_arg=my_get_arg(&_CDR(n), 1); #ifdef PIKE_DEBUG
pike.git/src/operators.c:3749:
ADD_EFUN2("`|",f_or,LOG_TYPE,OPT_TRY_OPTIMIZE,optimize_binary,generate_or); ADD_EFUN2("`^",f_xor,LOG_TYPE,OPT_TRY_OPTIMIZE,optimize_binary,generate_xor); #define SHIFT_TYPE \ tOr3(tOr(tFuncV(tMix tObj,tMix,tMix), \ tFuncV(tObj tMix,tMix,tMix)), \ tFuncV(tInt,tInt,tInt), \ tFuncV(tStr,tInt,tStr))
-
ADD_EFUN2("`<<",f_lsh,SHIFT_TYPE,OPT_TRY_OPTIMIZE,
0
,generate_lsh);
-
ADD_EFUN2("`>>",f_rsh,SHIFT_TYPE,OPT_TRY_OPTIMIZE,
0
,generate_rsh);
+
ADD_EFUN2("`<<",
f_lsh,
SHIFT_TYPE,
OPT_TRY_OPTIMIZE,
+
may_have_side_effects
,
generate_lsh);
+
ADD_EFUN2("`>>",
f_rsh,
SHIFT_TYPE,
OPT_TRY_OPTIMIZE,
+
may_have_side_effects
,
generate_rsh);
/* !function(!object...:mixed)&function(mixed...:mixed)|" "function(array(array(1=mixed)),array(1=mixed):array(1))|" "function(int...:int)|" "!function(int...:mixed)&function(float|int...:float)|" "function(string*,string:string)|" "function(array(0=mixed),int:array(0))|" "function(array(0=mixed),float:array(0))|" "function(string,int:string) "function(string,float:string)