pike.git / src / interpret.c

version» Context lines:

pike.git/src/interpret.c:2191:    *    * APPLY_LOW: Apply function #arg2 in object arg1.    *    * Return values:    *    * Returns zero if the function was invalid or has been executed.    *    * Returns one if a frame has been set up to start the function    * with eval_instruction(Pike_fp->pc - ENTRY_PROLOGUE_SIZE). After    * eval_instruction() is done the frame needs to be removed by a call -  * to low_return() or low_return_pop(). +  * to low_return().    */   void* low_mega_apply(enum apply_type type, INT32 args, void *arg1, void *arg2)   {    struct object *o = NULL;    struct pike_frame *scope=0;    ptrdiff_t fun=0;    struct svalue *save_sp=Pike_sp-args;      #if defined(PIKE_DEBUG) && defined(_REENTRANT)    if(d_flag)
pike.git/src/interpret.c:2732:       if (PIKE_FN_DONE_ENABLED()) {    do_dtrace_func_return(o, fun);    }       return 0;   }          - #define basic_low_return(save_sp) \ -  DO_IF_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"); \ -  ) \ -  \ -  Pike_mark_sp=Pike_fp->save_mark_sp; \ -  \ -  POP_PIKE_FRAME() -  -  +    void low_return(void)   { -  struct svalue *save_sp = frame_get_save_sp(Pike_fp)+1; +  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    */    char *fn = "(unknown)";    if (o && o->prog) {    struct identifier *id = ID_FROM_INT(o->prog, fun);    fn = id->name->size_shift == 0 ? id->name->str : "[widestring fn name]";    }
pike.git/src/interpret.c:2774: Inside #if defined (PIKE_USE_MACHINE_CODE) && defined (OPCODE_RETURN_JUMPADDR)
   /* If the function that returns is the only ref to the current    * object and its program then the program would be freed in    * destruct_objects_to_destruct below. However, we're still    * executing in an opcode in its code so we need prog->program to    * stick around for a little while more to handle the returned    * address. We therefore add a ref to the current object so that    * it'll live through this function. */    add_ref (o);   #endif    -  basic_low_return (save_sp); + #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 +  Pike_mark_sp=Pike_fp->save_mark_sp; +  POP_PIKE_FRAME();    -  stack_pop_n_elems_keep_top (Pike_sp - save_sp); +  if (pop) +  pop_n_elems(Pike_sp-save_sp); +  else +  stack_pop_n_elems_keep_top (Pike_sp - save_sp - 1); +     {    /* consider using a flag for immediate destruct instead... */    extern struct object *objects_to_destruct;    if( objects_to_destruct )    destruct_objects_to_destruct();    }      #ifdef PIKE_DEBUG -  if(save_sp > Pike_sp) -  Pike_fatal("Pike function did not leave an return value\n"); +  if(save_sp+1 > Pike_sp && !pop) +  Pike_fatal("Pike function did not leave a return value\n");   #endif       if(UNLIKELY(Pike_interpreter.trace_level>1))    do_trace_func_return (1, o, fun);      #if defined (PIKE_USE_MACHINE_CODE) && defined (OPCODE_RETURN_JUMPADDR)    free_object (o);   #endif   }    - void low_return_pop(void) - { -  struct svalue *save_sp = frame_get_save_sp(Pike_fp); - #if defined (PIKE_USE_MACHINE_CODE) && defined (OPCODE_RETURN_JUMPADDR) -  /* See note above. */ -  struct object *o = Pike_fp->current_object; -  add_ref (o); - #endif -  -  if (PIKE_FN_DONE_ENABLED()) { -  /* DTrace leave probe -  arg0: function name -  */ -  char *fn = "(unknown)"; -  struct object *o = Pike_fp->current_object; -  int fun = Pike_fp->fun; -  if (o && o->prog) { -  struct identifier *id = ID_FROM_INT(o->prog, fun); -  fn = id->name->size_shift == 0 ? id->name->str : "[widestring fn name]"; -  } -  PIKE_FN_DONE(fn); -  } -  -  basic_low_return (save_sp); -  -  pop_n_elems(Pike_sp-save_sp); -  /* consider using a flag for immediate destruct instead... */ -  destruct_objects_to_destruct(); -  - #if defined (PIKE_USE_MACHINE_CODE) && defined (OPCODE_RETURN_JUMPADDR) -  free_object (o); - #endif - } -  -  +    void unlink_previous_frame(void)   {    struct pike_frame *current, *prev;       current=Pike_interpreter.frame_pointer;    prev=current->next;   #ifdef PIKE_DEBUG    {    JMP_BUF *rec;