pike.git / src / interpret.c

version» Context lines:

pike.git/src/interpret.c:2125:    if (C.type == CALLTYPE_PIKEFUN) {    return C.ptr;    }       callsite_execute(&C);    callsite_free(&C);       return NULL;   }    + static void pike_pop_locals(struct svalue *save_sp, ptrdiff_t n); +    /* TAILCALL optimization variants. They try to reuse the current frame */   void* low_mega_apply_tailcall(enum apply_type type, INT32 args, void *arg1, void *arg2) {    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);       /* 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) { -  C.frame = Pike_fp; +  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:
pike.git/src/interpret.c:2175:    callsite_free(&C);       return NULL;   }      /* 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) { -  C.frame = Pike_fp; +  C.frame = frame;    }       callsite_resolve_fun(&C, o, fun);       if (C.frame == frame) {    if (C.type == CALLTYPE_PIKEFUN) {    return C.ptr;    } else C.frame = NULL;    }       callsite_prepare(&C);    callsite_execute(&C);    callsite_free(&C);       return NULL;   }    - static void pike_pop_locals(struct svalue *save_sp, ptrdiff_t n); -  +    void low_return(void)   {    struct svalue *save_sp = frame_get_save_sp(Pike_fp);    struct object *o = Pike_fp->current_object;    int fun = Pike_fp->fun;    int pop = Pike_fp->flags & PIKE_FRAME_RETURN_POP;       if (PIKE_FN_DONE_ENABLED()) {    /* DTrace leave probe    arg0: function name