pike.git / src / interpret.c

version» Context lines:

pike.git/src/interpret.c:1:   /*\   ||| This file a part of Pike, and is copyright by Fredrik Hubinette   ||| Pike is distributed as GPL (General Public License)   ||| See the files COPYING and DISCLAIMER for more information.   \*/   /**/   #include "global.h" - RCSID("$Id: interpret.c,v 1.172 2000/10/01 08:51:52 hubbe Exp $"); + RCSID("$Id: interpret.c,v 1.173 2000/11/20 01:20:24 mast Exp $");   #include "interpret.h"   #include "object.h"   #include "program.h"   #include "svalue.h"   #include "array.h"   #include "mapping.h"   #include "error.h"   #include "language.h"   #include "stralloc.h"   #include "constants.h"
pike.git/src/interpret.c:51:   #endif   #endif      /*    * Define the default evaluator stack size, used for just about everything.    */   #define EVALUATOR_STACK_SIZE 100000      #define TRACE_LEN (100 + t_flag * 10)    + /* Keep some margin on the stack space checks. They're lifted when +  * handle_error runs to give it some room. */ + #define SVALUE_STACK_MARGIN 100 /* Tested in 7.1: 40 was enough, 30 wasn't. */ + #define C_STACK_MARGIN 2000 /* Tested in 7.1: 1500 was enough, 1400 wasn't. */    -  +    #ifdef PIKE_DEBUG   static char trace_buffer[2000];   #endif         /* Pike_sp points to first unused value on stack    * (much simpler than letting it point at the last used value.)    */   PMOD_EXPORT struct Pike_interpreter Pike_interpreter;   PMOD_EXPORT int stack_size = EVALUATOR_STACK_SIZE;
pike.git/src/interpret.c:170:    if(!Pike_interpreter.mark_stack)    {    Pike_interpreter.mark_stack=(struct svalue **)xalloc(stack_size*sizeof(struct svalue *));    mark_stack_malloced=1;    }       Pike_sp=Pike_interpreter.evaluator_stack;    Pike_mark_sp=Pike_interpreter.mark_stack;    Pike_fp=0;    +  Pike_interpreter.svalue_stack_margin = SVALUE_STACK_MARGIN; +  Pike_interpreter.c_stack_margin = C_STACK_MARGIN; +    #ifdef PIKE_DEBUG    {    static struct callback *spcb;    if(!spcb)    {    spcb=add_gc_callback(gc_check_stack_callback,0,0);    dmalloc_accept_leak(spcb);    }    }   #endif
pike.git/src/interpret.c:1424:    UNSETJMP(tmp);    return 1;    }   }      PMOD_EXPORT void f_call_function(INT32 args)   {    mega_apply(APPLY_STACK,args,0,0);   }    + PMOD_EXPORT void call_handle_error(void) + { +  if (Pike_interpreter.svalue_stack_margin) { +  ONERROR tmp; +  int old_t_flag = t_flag; +  t_flag = 0; +  Pike_interpreter.svalue_stack_margin = 0; +  Pike_interpreter.c_stack_margin = 0; +  SET_ONERROR(tmp,exit_on_error,"Error in handle_error in master object!"); +  assign_svalue_no_free(Pike_sp++, & throw_value); +  APPLY_MASTER("handle_error", 1); +  pop_stack(); +  UNSET_ONERROR(tmp); +  Pike_interpreter.svalue_stack_margin = SVALUE_STACK_MARGIN; +  Pike_interpreter.c_stack_margin = C_STACK_MARGIN; +  t_flag = old_t_flag; +  } + } +    PMOD_EXPORT int apply_low_safe_and_stupid(struct object *o, INT32 offset)   {    JMP_BUF tmp;    struct pike_frame *new_frame=alloc_pike_frame();    int ret;       new_frame->next = Pike_fp;    new_frame->current_object = o;    new_frame->context=o->prog->inherits[0];    new_frame->locals = Pike_interpreter.evaluator_stack;
pike.git/src/interpret.c:1479:   PMOD_EXPORT void safe_apply_low(struct object *o,int fun,int args)   {    JMP_BUF recovery;       Pike_sp-=args;    free_svalue(& throw_value);    throw_value.type=T_INT;    if(SETJMP(recovery))    {    if(throw_value.type == T_ARRAY) -  { -  static int inside=0; -  if(!inside) -  { -  ONERROR tmp; -  /* We silently ignore errors if we are already describing one.. */ -  inside=1; -  SET_ONERROR(tmp,exit_on_error,"Error in handle_error in master object!"); -  assign_svalue_no_free(Pike_sp++, & throw_value); -  APPLY_MASTER("handle_error", 1); -  pop_stack(); -  UNSET_ONERROR(tmp); -  inside=0; -  } -  } -  +  call_handle_error();    Pike_sp->u.integer = 0;    Pike_sp->subtype=NUMBER_NUMBER;    Pike_sp->type = T_INT;    Pike_sp++;    }else{    ptrdiff_t expected_stack = Pike_sp - Pike_interpreter.evaluator_stack + 1;    Pike_sp+=args;    apply_low(o,fun,args);    if(Pike_sp - Pike_interpreter.evaluator_stack > expected_stack)    pop_n_elems(Pike_sp - Pike_interpreter.evaluator_stack - expected_stack);