Branch: Tag:

2001-01-10

2001-01-10 19:56:37 by Martin Stjernholm <mast@lysator.liu.se>

Added F_ESCAPE_CATCH opcode and extended the return value from
eval_instruction to implement it.

Rev: src/interpret.c:1.179
Rev: src/interpret_functions.h:1.37

1:   /* -  * $Id: interpret_functions.h,v 1.36 2001/01/08 20:04:48 mast Exp $ +  * $Id: interpret_functions.h,v 1.37 2001/01/10 19:56:37 mast Exp $    *    * Opcode definitions for the interpreter.    */
849:    break;       CASE(F_CATCH); -  if(o_catch(pc+sizeof(INT32))) +  switch (o_catch(pc+sizeof(INT32))) { +  case 1:    return -1; /* There was a return inside the evaluated code */ -  else +  case 2: +  pc = Pike_fp->pc; +  break; +  default:    pc+=EXTRACT_INT(pc); -  +  }    break;    -  + OPCODE0(F_ESCAPE_CATCH, "escape catch") + { +  Pike_fp->pc = pc; +  return -2; + } + BREAK; +    OPCODE0(F_THROW_ZERO, "throw(0)")    push_int(0);    f_throw(1);
1503:    Pike_sp += num_locals - args;       x=eval_instruction(addr); +  EVAL_INSTR_RET_CHECK(x);   #ifdef PIKE_DEBUG    if(Pike_mark_sp < save_mark_sp)    fatal("mark Pike_sp underflow in F_RECUR.\n");   #endif    Pike_mark_sp=save_mark_sp; -  if(x!=-1) mega_apply(APPLY_STACK, x, 0,0); +  if(x>=0) mega_apply(APPLY_STACK, x, 0,0);    pc+=sizeof(INT32);    if(save_sp+1 < Pike_sp)    {
1568:    Pike_sp += num_locals - args;       x=eval_instruction(addr); +  EVAL_INSTR_RET_CHECK(x);   #ifdef PIKE_DEBUG    if(Pike_mark_sp < save_mark_sp)    fatal("mark Pike_sp underflow in F_RECUR.\n");   #endif    Pike_mark_sp=save_mark_sp; -  if(x!=-1) mega_apply(APPLY_STACK, x, 0,0); +  if(x>=0) mega_apply(APPLY_STACK, x, 0,0);    pc+=sizeof(INT32);    if(save_sp+1 < Pike_sp)    {