pike.git / src / interpret.c

version» Context lines:

pike.git/src/interpret.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: interpret.c,v 1.297 2004/02/09 22:02:56 mast Exp $ + || $Id: interpret.c,v 1.298 2004/06/01 19:12:05 mast Exp $   */      #include "global.h" - RCSID("$Id: interpret.c,v 1.297 2004/02/09 22:02:56 mast Exp $"); + RCSID("$Id: interpret.c,v 1.298 2004/06/01 19:12:05 mast Exp $");   #include "interpret.h"   #include "object.h"   #include "program.h"   #include "svalue.h"   #include "array.h"   #include "mapping.h"   #include "pike_error.h"   #include "language.h"   #include "stralloc.h"   #include "constants.h"
pike.git/src/interpret.c:56:      /*    * 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 8000 /* Tested in 7.1: 3000 was enough, 2600 wasn't. */ + /* Observed in 7.1: 40 was enough, 30 wasn't. */ + #define SVALUE_STACK_MARGIN (100 + LOW_SVALUE_STACK_MARGIN) + /* Observed in 7.4: 11000 was enough, 10000 wasn't. */ + #define C_STACK_MARGIN (20000 + LOW_C_STACK_MARGIN)    -  + /* Another extra margin to use while dumping the raw error in +  * exit_on_error, so that backtrace_frame._sprintf can be called +  * then. */ + #define LOW_SVALUE_STACK_MARGIN 20 + #define LOW_C_STACK_MARGIN 500 +    #ifdef HAVE_COMPUTED_GOTO   PIKE_OPCODE_T *fcode_to_opcode = NULL;   struct op_2_f *opcode_to_fcode = NULL;   #endif /* HAVE_COMPUTED_GOTO */      PMOD_EXPORT const char Pike_check_stack_errmsg[] =    "Svalue stack overflow. "    "(%ld of %ld entries on stack, needed %ld more entries)\n";   PMOD_EXPORT const char Pike_check_mark_stack_errmsg[] =    "Mark stack overflow.\n";
pike.git/src/interpret.c:1740:    Pike_fp->mark_sp_base,    sizeof(struct svalue **)*(Pike_mark_sp - Pike_fp->mark_sp_base));    Pike_fp->mark_sp_base-=freespace;    Pike_mark_sp-=freespace;    }   }         void mega_apply(enum apply_type type, INT32 args, void *arg1, void *arg2)   { -  check_c_stack(8192); +  /* 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(low_mega_apply(type, args, arg1, arg2))    {    eval_instruction(Pike_fp->pc   #ifdef ENTRY_PROLOGUE_SIZE    - ENTRY_PROLOGUE_SIZE   #endif /* ENTRY_PROLOGUE_SIZE */    );    low_return();    }   }
pike.git/src/interpret.c:1814:    */   PMOD_EXPORT void f_call_function(INT32 args)   {    mega_apply(APPLY_STACK,args,0,0);   }      PMOD_EXPORT void call_handle_error(void)   {    dmalloc_touch_svalue(&throw_value);    -  if (Pike_interpreter.svalue_stack_margin) { +  if (Pike_interpreter.svalue_stack_margin > LOW_SVALUE_STACK_MARGIN) {    int old_t_flag = t_flag;    t_flag = 0; -  Pike_interpreter.svalue_stack_margin = 0; -  Pike_interpreter.c_stack_margin = 0; +  Pike_interpreter.svalue_stack_margin = LOW_SVALUE_STACK_MARGIN; +  Pike_interpreter.c_stack_margin = LOW_C_STACK_MARGIN;    *(Pike_sp++) = throw_value;    throw_value.type=T_INT;       if (get_master()) {    ONERROR tmp;    SET_ONERROR(tmp,exit_on_error,"Error in handle_error in master object!");    APPLY_MASTER("handle_error", 1);    UNSET_ONERROR(tmp);    }    else {