pike.git / src / interpret.c

version» Context lines:

pike.git/src/interpret.c:4054:    c->saved_jmpbuf = Pike_interpreter.catching_eval_jmpbuf;    SET_ONERROR (c->onerror, restore_catching_eval_jmpbuf, c->saved_jmpbuf);    Pike_interpreter.catching_eval_jmpbuf = NULL;   }      PMOD_EXPORT void callsite_free(struct pike_callsite *c) {    if (!c->frame) return;       /* FREE FRAME */    +  if (c->type == CALLTYPE_PIKEFUN) +  Pike_mark_sp=Pike_fp->save_mark_sp;    POP_PIKE_FRAME();       if (c->type != CALLTYPE_PIKEFUN) return;       /* restore catching_eval_jmpbuf */       Pike_interpreter.catching_eval_jmpbuf = c->saved_jmpbuf;    UNSET_ONERROR(c->onerror);   }      PMOD_EXPORT void callsite_return(struct pike_callsite *c) {    const struct svalue *sp = Pike_sp;    struct svalue *retval = c->retval; -  struct pike_frame *frame = c->frame; +  struct pike_frame *frame;    int got_retval = 1; -  +  int pop;    -  +  /* NOTE: this is necessary because of recursion */ +  c->frame = frame = Pike_fp; +  +  pop = frame->flags & PIKE_FRAME_RETURN_POP; +  +  if(Pike_mark_sp < Pike_fp->save_mark_sp) +  Pike_fatal("Popped below save_mark_sp!\n"); +  if(Pike_sp<Pike_interpreter.evaluator_stack) +  Pike_fatal("Stack error (also simple).\n"); +     if (retval >= sp) {   #ifdef PIKE_DEBUG    if (retval - sp > 1)    Pike_fatal("Stack too small after function call.\n");   #endif    /* return value missing */ -  if (!(c->flags & CALL_NEED_NO_RETVAL)) { +  if (!(c->flags & CALL_NEED_NO_RETVAL) && !pop) {    push_int(0);    } else got_retval = 0;    } else if (retval+1 < sp) {    /* garbage left on the stack */ -  assign_svalue(retval,sp-1); -  pop_n_elems(sp-retval-1); +  if (pop) +  pop_n_elems(sp-retval); +  else +  stack_pop_n_elems_keep_top (sp - retval - 1);    low_destruct_objects_to_destruct();    }       if (c->frame) {    if (c->frame != Pike_fp) {    fprintf(stderr, "frame changed %p vs %p\n", c->frame, Pike_fp);    c->frame = Pike_fp;    }    }   }