pike.git / src / interpret.c

version» Context lines:

pike.git/src/interpret.c:2133:    return C.ptr;    }    /* This is only needed for pike functions right now:    * callsite_prepare(&C); */    callsite_execute(&C);    callsite_return(&C);    callsite_free(&C);    return NULL;   }    + void* lower_mega_apply_tailcall(INT32 args, struct object *o, ptrdiff_t fun) { +  struct pike_frame *frame = Pike_fp; +  void *ret; +  +  if (frame->flags & PIKE_FRAME_NO_REUSE) { +  /* We cannot reuse this frame. So we simply call mega_apply_low and are done. */ +  mega_apply_low(args, o, fun); +  return NULL; +  } +  +  ret = lower_mega_apply(args, o, fun); +  +  if (ret) { + #ifdef PIKE_DEBUG +  frame->pc = 0; + #endif +  unlink_previous_frame(); +  } +  +  return ret; + } +    /* Apply a function.    *    * Application types:    *    * APPLY_STACK: Apply Pike_sp[-args] with args-1 arguments.    *    * APPLY_SVALUE: Apply the svalue at arg1, and adjust the stack    * to leave a return value.    *    * APPLY_SVALUE_STRICT: Apply the svalue at arg1, and don't adjust the
pike.git/src/interpret.c:2190:    return C.ptr;    }       callsite_execute(&C);    callsite_return(&C);    callsite_free(&C);       return NULL;   }    + void* low_mega_apply_tailcall(enum apply_type type, INT32 args, void *arg1, void *arg2) { +  struct pike_frame *frame = Pike_fp; +  void *ret;    -  +  if (frame->flags & PIKE_FRAME_NO_REUSE) { +  /* We cannot reuse this frame. So we simply call mega_apply and are done. */ +  mega_apply(type, args, arg1, arg2); +  return NULL; +  }    -  +  ret = low_mega_apply(type, args, arg1, arg2); +  +  if (ret) { + #ifdef PIKE_DEBUG +  frame->pc = 0; + #endif +  unlink_previous_frame(); +  } +  +  +  return ret; + } +    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
pike.git/src/interpret.c:2359: Inside #if defined(ENTRY_PROLOGUE_SIZE)
   eval_instruction(Pike_fp->pc   #ifdef ENTRY_PROLOGUE_SIZE    - ENTRY_PROLOGUE_SIZE   #endif /* ENTRY_PROLOGUE_SIZE */    );    low_return();    }    CALL_AND_UNSET_ONERROR(uwp);   }    - PMOD_EXPORT void mega_apply_low(INT32 args, void *arg1, ptrdiff_t arg2) + PMOD_EXPORT void mega_apply_low(INT32 args, struct object *o, ptrdiff_t fun)   {    /* Save and clear Pike_interpreter.catching_eval_jmpbuf so that the    * following eval_instruction will install a LOW_JMP_BUF of its    * own to handle catches. */    LOW_JMP_BUF *saved_jmpbuf = Pike_interpreter.catching_eval_jmpbuf;    ONERROR uwp;    Pike_interpreter.catching_eval_jmpbuf = NULL;    SET_ONERROR (uwp, restore_catching_eval_jmpbuf, saved_jmpbuf);       /* The C stack margin is normally 8 kb, but if we get here during a    * lowered margin then don't fail just because of that, unless it's    * practically zero. */    check_c_stack(Pike_interpreter.c_stack_margin ?    Pike_interpreter.c_stack_margin : 100); -  if( lower_mega_apply( args, arg1, arg2 ) ) +  if( lower_mega_apply( args, o, fun ) )    {    eval_instruction(Pike_fp->pc   #ifdef ENTRY_PROLOGUE_SIZE    - ENTRY_PROLOGUE_SIZE   #endif /* ENTRY_PROLOGUE_SIZE */    );    low_return();    }    CALL_AND_UNSET_ONERROR(uwp);   }