Branch: Tag:

1998-06-06

1998-06-06 03:25:37 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

fix for APPLY_AND_RETURN inside catch()

Rev: src/interpret.c:1.87
Rev: src/interpret.h:1.21

4:   ||| See the files COPYING and DISCLAIMER for more information.   \*/   #include "global.h" - RCSID("$Id: interpret.c,v 1.86 1998/06/01 20:49:33 grubba Exp $"); + RCSID("$Id: interpret.c,v 1.87 1998/06/06 03:25:36 hubbe Exp $");   #include "interpret.h"   #include "object.h"   #include "program.h"
1373:    CASE(F_APPLY_AND_RETURN);    {    INT32 args=sp - *--mark_sp; -  if(fp->locals >= sp-args) +  if(fp->expendible >= sp-args)    {    MEMMOVE(sp-args+1,sp-args,args*sizeof(struct svalue));    sp++;
1387:    CASE(F_CALL_LFUN_AND_RETURN);    {    INT32 args=sp - *--mark_sp; -  if(fp->locals >= sp-args) +  if(fp->expendible >= sp-args)    {    MEMMOVE(sp-args+1,sp-args,args*sizeof(struct svalue));    sp++;
1924:   #endif       new_frame.locals = sp - args; +  new_frame.expendible = new_frame.locals;    new_frame.args = args;    new_frame.fun = fun;    new_frame.current_storage = o->storage+new_frame.context.storage_offset;
2093:   static int o_catch(unsigned char *pc)   {    JMP_BUF tmp; +  struct svalue *expendible=fp->expendible;    if(SETJMP(tmp))    {    *sp=throw_value;    throw_value.type=T_INT;    sp++;    UNSETJMP(tmp); -  +  fp->expendible=expendible;    return 0;    }else{    int x=eval_instruction(pc);    if(x!=-1) mega_apply(APPLY_STACK, x, 0,0);    UNSETJMP(tmp); -  +  fp->expendible=expendible;    return 1;    }   }
2123:    new_frame.current_object = o;    new_frame.context=o->prog->inherits[0];    new_frame.locals = evaluator_stack; +  new_frame.expendible=new_frame.locals;    new_frame.args = 0;    new_frame.num_args=0;    new_frame.num_locals=0;