Branch: Tag:

2017-03-20

2017-03-20 21:34:13 by Arne Goedeke <el@laramies.com>

Interpreter: pop temporary locals in tailcalls

2132:    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) {
2182:    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);
2203:    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);