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.239 2001/08/03 17:45:10 grubba Exp $"); + RCSID("$Id: interpret.c,v 1.240 2001/08/15 03:31:55 hubbe 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:611:    }   #endif /* DEBUG_MALLOC */    }       TRACE((4,"--find_external_context: parent_id=%d (%s)\n",    loc->parent_identifier,    ID_FROM_INT(loc->o->prog,loc->parent_identifier)->name->str    ));   }    -  +    #ifdef PIKE_DEBUG   void print_return_value(void)   {    if(t_flag>3)    {    char *s;       init_buf();    describe_svalue(Pike_sp-1,0,0);    s=simple_free_buf();
pike.git/src/interpret.c:1028:   #define EXIT_BLOCK(X) do { \    free_object(X->current_object); \    if(X->context.prog) free_program(X->context.prog); \    if(X->context.parent) free_object(X->context.parent); \    if(X->scope) free_pike_frame(X->scope); \    DO_IF_SECURITY( if(X->current_creds) { \    free_object(X->current_creds); \    }) \    if(X->flags & PIKE_FRAME_MALLOCED_LOCALS) \    { \ -  free_svalues(X->locals,X->num_locals,BIT_MIXED); \ +  free_mixed_svalues(X->locals,X->num_locals); \    free((char *)(X->locals)); \    } \    DO_IF_DMALLOC( \    X->context.prog=0; \    X->context.parent=0; \    X->context.name=0; \    X->scope=0; \    X->current_object=0; \    X->flags=0; \    X->expendible=0; \    X->locals=0; \    DO_IF_SECURITY( X->current_creds=0; ) \    ) \   }while(0)      BLOCK_ALLOC(pike_frame,128)    -  +    int low_mega_apply(enum apply_type type, INT32 args, void *arg1, void *arg2)   {    struct object *o;    struct pike_frame *scope=0;    ptrdiff_t fun;    struct svalue *save_sp=Pike_sp-args;    int tailrecurse=-1;         #if defined(PIKE_DEBUG) && defined(_REENTRANT)
pike.git/src/interpret.c:1521:    goto apply_stack;    }    }    }       if(save_sp+1 < Pike_sp)    {    assign_svalue(save_sp,Pike_sp-1);    pop_n_elems(Pike_sp-save_sp-1);    -  destruct_objects_to_destruct(); /* consider using a flag for immediate destruct instead... */ +  low_destruct_objects_to_destruct(); /* consider using a flag for immediate destruct instead... */    }       if(save_sp+1 > Pike_sp)    {    if(type != APPLY_SVALUE_STRICT)    push_int(0);    }else{    if(t_flag>1) trace_return_value();    }    return 0;   }       - void low_return(void) - { -  struct svalue *save_sp=Pike_fp->save_sp; - #ifdef PIKE_DEBUG -  if(Pike_mark_sp < Pike_fp->save_mark_sp) -  fatal("Popped below save_mark_sp!\n"); -  if(Pike_sp<Pike_interpreter.evaluator_stack) -  fatal("Stack error (also simple).\n"); - #endif -  Pike_mark_sp=Pike_fp->save_mark_sp; +     -  + #define low_return_profiling() +    #ifdef PROFILING   #ifdef HAVE_GETHRTIME -  { -  struct identifier *function; -  long long time_passed, time_in_children, self_time; -  time_in_children= Pike_interpreter.accounted_time - Pike_fp->children_base; -  time_passed = gethrtime() - Pike_interpreter.time_base - Pike_fp->start_time; -  self_time=time_passed - time_in_children; -  Pike_interpreter.accounted_time+=self_time; -  function = Pike_fp->context.prog->identifiers + Pike_fp->ident; -  function->total_time=Pike_fp->self_time_base + (INT32)(time_passed /1000); -  function->self_time+=(INT32)( self_time /1000); -  } + #undef low_return_profiling + #define low_return_profiling() do { \ +  struct identifier *function; \ +  long long time_passed, time_in_children, self_time; \ +  time_in_children=Pike_interpreter.accounted_time-Pike_fp->children_base; \ +  time_passed = gethrtime()-Pike_interpreter.time_base - Pike_fp->start_time; \ +  self_time=time_passed - time_in_children; \ +  Pike_interpreter.accounted_time+=self_time; \ +  function = Pike_fp->context.prog->identifiers + Pike_fp->ident; \ +  function->total_time=Pike_fp->self_time_base + (INT32)(time_passed /1000); \ +  function->self_time+=(INT32)( self_time /1000); \ + }while(0)   #endif   #endif    -  POP_PIKE_FRAME(); +     -  + #define basic_low_return() \ +  struct svalue *save_sp=Pike_fp->save_sp; \ +  DO_IF_DEBUG( \ +  if(Pike_mark_sp < Pike_fp->save_mark_sp) \ +  fatal("Popped below save_mark_sp!\n"); \ +  if(Pike_sp<Pike_interpreter.evaluator_stack) \ +  fatal("Stack error (also simple).\n"); \ +  ) \ +  \ +  Pike_mark_sp=Pike_fp->save_mark_sp; \ +  \ +  POP_PIKE_FRAME() +  +  + void low_return(void) + { +  basic_low_return();    if(save_sp+1 < Pike_sp)    {    assign_svalue(save_sp,Pike_sp-1);    pop_n_elems(Pike_sp-save_sp-1);    -  destruct_objects_to_destruct(); /* consider using a flag for immediate destruct instead... */ +  /* consider using a flag for immediate destruct instead... */ +  destruct_objects_to_destruct();    } -  -  if(save_sp+1 > Pike_sp) +  else if(save_sp+1 > Pike_sp)    {    push_int(0);    }else{    if(t_flag>1) trace_return_value();    }   }    -  + void low_return_pop(void) + { +  basic_low_return(); +  +  if(save_sp < Pike_sp) +  { +  pop_n_elems(Pike_sp-save_sp); +  /* consider using a flag for immediate destruct instead... */ +  destruct_objects_to_destruct(); +  } + } +  +    void unlink_previous_frame(void)   {    struct pike_frame *current, *prev;    struct svalue *target, **smsp;    int freespace;       current=Pike_interpreter.frame_pointer;    prev=current->next;   #ifdef PIKE_DEBUG    {
pike.git/src/interpret.c:1674:       debug_malloc_touch(Pike_fp);    if(SETJMP(tmp))    {    *Pike_sp=throw_value;    throw_value.type=T_INT;    Pike_sp++;    UNSETJMP(tmp);    Pike_fp->expendible=expendible;    Pike_fp->flags=flags; -  destruct_objects_to_destruct(); +  low_destruct_objects_to_destruct();    return 0;    }else{    struct svalue **save_mark_sp=Pike_mark_sp;    int x;    Pike_fp->expendible=Pike_fp->locals + Pike_fp->num_locals;       Pike_fp->flags&=~PIKE_FRAME_RETURN_INTERNAL;       x=eval_instruction(pc);   #ifdef PIKE_DEBUG