Branch: Tag:

2001-01-14

2001-01-14 20:02:42 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Added F_LOOP for use in integer loops where the loop variable isn't used
in the loop body, and neither break nor continue are used in the loop body.

Rev: src/interpret_functions.h:1.40

1:   /* -  * $Id: interpret_functions.h,v 1.39 2001/01/12 01:58:40 mast Exp $ +  * $Id: interpret_functions.h,v 1.40 2001/01/14 20:02:42 grubba Exp $    *    * Opcode definitions for the interpreter.    */
916:          /* FIXME: Does this need bignum tests? /Fixed - Hubbe */ +  /* LOOP(OPCODE, INCREMENT, OPERATOR, IS_OPERATOR) */    LOOP(F_INC_LOOP, 1, <, is_lt);    LOOP(F_DEC_LOOP, -1, >, is_gt);    LOOP(F_INC_NEQ_LOOP, 1, !=, !is_eq);    LOOP(F_DEC_NEQ_LOOP, -1, !=, !is_eq);    -  + /* Use like: +  * +  * push(loopcnt) +  * branch(l2) +  * l1: +  * sync_mark +  * code +  * pop_sync_mark +  * l2: +  * loop(l1) +  */ + OPCODE0_JUMP(F_LOOP, "loop") /* loopcnt */ + { +  /* Use ge and 1 to be able to reuse the 1 for the subtraction. */ +  push_int(1); +  if (is_ge(sp-2, sp-1)) { +  o_subtract(); +  DOJUMP(); +  } else { +  pop_n_elems(2); +  SKIPJUMP(); +  } + } + BREAK; +     CASE(F_FOREACH) /* array, lvalue, X, i */    {    if(Pike_sp[-4].type != PIKE_T_ARRAY)