pike.git / src / interpret.c

version» Context lines:

pike.git/src/interpret.c:2194:    struct pike_callsite C;       if(Pike_sp != frame->locals + args)    pike_pop_locals(frame->locals, args);       callsite_init(&C, args);       /* We can reuse the current frame, so we set it into C here    * to allow callsite_resolve_* to pick it up    */ -  if (!(frame->flags & PIKE_FRAME_NO_REUSE) && frame->refs == 1) { +  if (frame_can_reuse(frame))    C.frame = frame; -  } +        switch (type) {    case APPLY_STACK:    C.args--;    callsite_resolve_svalue(&C, Pike_sp - args);    break;    case APPLY_SVALUE_STRICT:    C.flags |= CALL_NEED_NO_RETVAL;    case APPLY_SVALUE:    callsite_resolve_svalue(&C, arg1);
pike.git/src/interpret.c:2239:   /* NOTE: see comments in low_mega_apply_tailcall() */   void* lower_mega_apply_tailcall(INT32 args, struct object *o, ptrdiff_t fun) {    struct pike_frame *frame = Pike_fp;    struct pike_callsite C;       if(Pike_sp != frame->locals + args)    pike_pop_locals(frame->locals, args);       callsite_init(&C, args);    -  if (!(frame->flags & PIKE_FRAME_NO_REUSE) && frame->refs == 1) { +  if (frame_can_reuse(frame))    C.frame = frame; -  } +        callsite_resolve_identifier(&C, o, fun);       if (C.frame == frame) {    if (C.type == CALLTYPE_PIKEFUN) {    return C.ptr;    } else C.frame = NULL;    }       callsite_prepare(&C);
pike.git/src/interpret.c:3396:    frame->next = Pike_fp;    Pike_fp = frame;    c->frame = frame;       frame->save_mark_sp=Pike_mark_sp;    frame->locals = Pike_sp - args;    frame_set_save_sp(frame, c->retval);    frame->current_object = o;    frame->current_program = p;    } else { + #ifdef PIKE_DEBUG +  if (!frame_can_reuse(frame)) +  Pike_error("Invalid frame reused in tailcall.\n"); + #endif    if (o != frame->current_object) {    free_object(frame->current_object);    add_ref(frame->current_object = o);       if (p != frame->current_program) {    free_program(frame->current_program);    add_ref(frame->current_program = p);    }    }    struct svalue *save_sp = frame_get_save_sp(frame);