pike.git / src / interpret.c

version» Context lines:

pike.git/src/interpret.c:3993:    case T_PROGRAM:    c->type = CALLTYPE_CLONE;    c->ptr = s->u.program;    break;    case T_OBJECT:    callsite_resolve_lfun(c, s->u.object, LFUN_CALL);    return;    }   }    - PMOD_EXPORT void callsite_reset(struct pike_callsite *c) { + PMOD_EXPORT void callsite_reset_pikecall(struct pike_callsite *c) {    struct pike_frame *frame;    -  /* nothing to do, only frames for pike functions -  * might need to be reallocatd */ -  if (c->type != CALLTYPE_PIKEFUN) return; + #ifdef PIKE_DEBUG +  if (c->type != CALLTYPE_PIKEFUN) +  Pike_fatal("Calling callsite_reset_pikecall() on non pike frame.\n"); + #endif       frame = c->frame;      #ifdef PIKE_DEBUG    if (frame != Pike_fp)    Pike_fatal("Resetting frame which is not Pike_fp\n");   #endif       Pike_mark_sp=frame->save_mark_sp;   
pike.git/src/interpret.c:4081:    tmp=parent_clone_object(c->ptr,    c->frame->current_object,    c->frame->fun,    c->args);    push_object(tmp);    }    break;    }   }    - PMOD_EXPORT void callsite_init(struct pike_callsite *c) { -  c->type = CALLTYPE_NONE; -  c->flags = 0; -  c->frame = NULL; -  c->saved_jmpbuf = NULL; - } + PMOD_EXPORT void callsite_save_jmpbuf(struct pike_callsite *c) { + #ifdef PIKE_DEBUG +  if (c->type != CALLTYPE_PIKEFUN) +  Pike_fatal("callsite_save_jmpbuf called for non pike frame.\n"); + #endif    - PMOD_EXPORT void callsite_set_args(struct pike_callsite *c, INT32 args) { -  c->args = args; -  c->retval = Pike_sp - args; - } -  - PMOD_EXPORT void callsite_prepare(struct pike_callsite *c) { -  if (c->type != CALLTYPE_PIKEFUN) return; -  +     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; + PMOD_EXPORT void callsite_free_frame(struct pike_callsite *c) { + #ifdef PIKE_DEBUG +  if (!c->frame) +  Pike_fatal("callsite_free_frame called without frame.\n"); + #endif       /* 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) { + PMOD_EXPORT void callsite_return_slowpath(struct pike_callsite *c) {    const struct svalue *sp = Pike_sp;    struct svalue *retval = c->retval;    struct pike_frame *frame = c->frame;    int got_retval = 1;    int pop = 0;       /* NOTE: this is necessary because of recursion */    if (c->type == CALLTYPE_PIKEFUN) {    c->frame = frame = Pike_fp;    pop = frame->flags & PIKE_FRAME_RETURN_POP;    }    -  + #ifdef PIKE_DEBUG    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"); -  + #endif       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) && !pop) {    push_int(0);    } else got_retval = 0;    } else if (retval+1 < sp) {    /* garbage left on the stack */    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; +    } -  } - } +       /* Without fancy accounting stuff. This one can't assume there is an    * identifier corresponding to the frame (i.e. _fp_->ident might be    * bogus). */   void LOW_POP_PIKE_FRAME(struct pike_frame *frame) {    struct pike_frame *tmp_=frame->next;    if(!sub_ref(frame))    {    really_free_pike_frame(frame);    }else{