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.348 2004/04/06 13:00:42 nilsson Exp $ + || $Id: interpret.c,v 1.349 2004/05/20 20:13:38 grubba Exp $   */      #include "global.h" - RCSID("$Id: interpret.c,v 1.348 2004/04/06 13:00:42 nilsson Exp $"); + RCSID("$Id: interpret.c,v 1.349 2004/05/20 20:13:38 grubba Exp $");   #include "interpret.h"   #include "object.h"   #include "program.h"   #include "svalue.h"   #include "array.h"   #include "mapping.h"   #include "pike_error.h"   #include "stralloc.h"   #include "constants.h"   #include "pike_macros.h"
pike.git/src/interpret.c:255: Inside #if defined(PIKE_DEBUG)
   {    static struct callback *spcb;    if(!spcb)    {    spcb=add_gc_callback(gc_check_stack_callback,0,0);    dmalloc_accept_leak(spcb);    }    }   #endif   #ifdef PROFILING - #ifdef HAVE_GETHRTIME -  Pike_interpreter.time_base = gethrtime(); -  Pike_interpreter.accounted_time =0; +  Pike_interpreter.unlocked_time = 0; +  Pike_interpreter.accounted_time = 0;   #endif - #endif +    #if defined(HAVE_COMPUTED_GOTO) || defined(PIKE_USE_MACHINE_CODE)    {    static int tables_need_init=1;    if(tables_need_init) {    /* Initialize the fcode_to_opcode table / jump labels. */    eval_instruction(NULL);   #if defined(PIKE_USE_MACHINE_CODE) && !defined(PIKE_DEBUG)    /* Simple operator opcodes... */   #define SET_INSTR_ADDRESS(X, Y) (instrs[(X)-F_OFFSET].address = (void *)Y)    SET_INSTR_ADDRESS(F_COMPL, o_compl);
pike.git/src/interpret.c:1790:       }    if(Pike_interpreter.trace_level>1)    do_trace_func_return (1, o, fun);    }    return 0;   }          - #define low_return_profiling() -  - #ifdef PROFILING - #ifdef HAVE_GETHRTIME - #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 -  -  +    #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; \    \
pike.git/src/interpret.c:1925:   #endif    /* Save various fields from the previous frame.    */    current->save_sp=prev->save_sp;    current->save_mark_sp=prev->save_mark_sp;    current->flags=prev->flags;       /* Unlink the top frame temporarily. */    Pike_interpreter.frame_pointer=prev;    + #ifdef PROFILING +  { +  /* We must update the profiling info of the previous frame +  * to account for that the current frame has gone away. +  */ +  cpu_time_t total_time = +  get_cpu_time() - (Pike_interpreter.unlocked_time + current->start_time); +  cpu_time_t child_time = +  Pike_interpreter.accounted_time - current->children_base; +  struct identifier *function = +  current->context.prog->identifiers + current->ident; +  function->total_time += total_time; +  total_time -= child_time; +  function->self_time += total_time; +  Pike_interpreter.accounted_time += total_time; + #ifdef PROFILING_DEBUG +  fprintf(stderr, "%p: Unlinking previous frame.\n" +  "Previous: %" PRINT_CPU_TIME " %" PRINT_CPU_TIME "\n" +  "Current: %" PRINT_CPU_TIME " %" PRINT_CPU_TIME "\n", +  Pike_interpreter.thread_state, +  prev->start_time, prev->children_base, +  current->start_time, current->children_base); + #endif /* PROFILING_DEBUG */ +  } + #endif /* PROFILING */ +     /* Unlink the frame. */    POP_PIKE_FRAME();       /* Hook our frame again. */    current->next=Pike_interpreter.frame_pointer;    Pike_interpreter.frame_pointer=current;    -  + #ifdef PROFILING +  current->children_base = Pike_interpreter.accounted_time; +  current->start_time = get_cpu_time() - Pike_interpreter.unlocked_time; + #endif /* PROFILING */ +    #if 0    /* FIXME: This code is questionable, and the Pike_sp    * adjustment ought to modify the mark stack.    */    {    int freespace;    /* Move svalues down */    freespace=current->locals - current->save_sp;    if(freespace > ((Pike_sp - current->locals)<<2) + 32)    {