pike.git / src / interpret.c

version» Context lines:

pike.git/src/interpret.c:2057: Inside #if defined(PIKE_DEBUG)
   free(scope->locals);   #ifdef PIKE_DEBUG    scope->flags&=~PIKE_FRAME_MALLOCED_LOCALS;   #endif    }    really_free_pike_frame(scope);   }      void *lower_mega_apply( INT32 args, struct object *o, ptrdiff_t fun )   { -  struct program *p; -  check_stack(256); -  check_mark_stack(256); -  -  if( (p = o->prog) ) -  { -  struct svalue *save_sp = Pike_sp - args; -  struct reference *ref = p->identifier_references + fun; -  struct inherit *context = p->inherits + ref->inherit_offset; -  struct identifier *function = context->prog->identifiers + ref->identifier_offset; -  struct svalue *constant = NULL; -  struct pike_frame *new_frame = NULL; -  -  int type = (function->identifier_flags & (IDENTIFIER_TYPE_MASK|IDENTIFIER_ALIAS)); -  if( o->prog != pike_trampoline_program && function->func.offset != -1 ) -  { -  switch( type ) -  { -  case IDENTIFIER_CONSTANT: -  constant = &context->prog->constants[function->func.const_info.offset].sval; -  if( TYPEOF(*constant) != PIKE_T_PROGRAM ) -  break; -  case IDENTIFIER_C_FUNCTION: -  case IDENTIFIER_PIKE_FUNCTION: -  if( !new_frame ) -  { -  new_frame=alloc_pike_frame(); -  debug_malloc_touch(new_frame); -  } - #ifdef PROFILING -  new_frame->children_base = Pike_interpreter.accounted_time; -  new_frame->start_time = get_cpu_time() - Pike_interpreter.unlocked_time; -  -  /* This is mostly for profiling, but -  * could also be used to find out the name of a function -  * in a destructed object. -hubbe -  * -  * Since it not used for anything but profiling yet, I will -  * put it here until someone needs it. -Hubbe -  */ -  new_frame->ident = ref->identifier_offset; -  W_PROFILING_DEBUG("%p{: Push at %" PRINT_CPU_TIME -  " %" PRINT_CPU_TIME "\n", -  Pike_interpreter.thread_state, -  new_frame->start_time, -  new_frame->children_base); - #endif -  new_frame->next = Pike_fp; -  add_ref(new_frame->current_object = o); -  add_ref(new_frame->current_program = p); -  new_frame->context = context; -  new_frame->fun = (unsigned INT16)fun; -  new_frame->locals = save_sp; -  new_frame->args = args; -  new_frame->save_sp_offset = 0; -  new_frame->expendible_offset = 0; -  - #ifdef PIKE_DEBUG -  if (Pike_in_gc > GC_PASS_PREPARE && Pike_in_gc < GC_PASS_FREE) -  Pike_fatal("Pike code called within gc.\n"); - #endif -  -  Pike_fp = new_frame; -  debug_malloc_touch(Pike_fp); - #ifdef PROFILING -  function->num_calls++; -  function->recur_depth++; - #endif - #ifdef PIKE_USE_MACHINE_CODE -  call_check_threads_etc(); - #endif -  -  if( !constant ) -  { -  if (PIKE_FN_START_ENABLED()) -  { -  /* DTrace enter probe -  arg0: function name -  arg1: object -  */ -  struct byte_buffer obj_name = BUFFER_INIT(); -  struct svalue obj_sval; -  SET_SVAL(obj_sval, T_OBJECT, 0, object, o); -  safe_describe_svalue(&obj_name, &obj_sval, 0, NULL); -  PIKE_FN_START(function->name->size_shift == 0 ? -  function->name->str : "[widestring fn name]", -  buffer_get_string(s)); -  buffer_free(&obj_name); -  } -  if(UNLIKELY(Pike_interpreter.trace_level)) -  { -  do_trace_function_call(o, function, args); -  } -  new_frame->current_storage = o->storage+context->storage_offset; -  if( type == IDENTIFIER_C_FUNCTION ) -  { -  new_frame->num_args = args; -  new_frame->num_locals = args; -  new_frame->pc = 0; - #ifndef PIKE_USE_MACHINE_CODE -  FAST_CHECK_THREADS_ON_CALL(); - #endif -  (*function->func.c_fun)(args); -  -  /* .. and below follows what is basically a copy of the -  * low_return function... -  */ -  if(save_sp+1 > Pike_sp) -  { -  push_int(0); -  } else if(save_sp+1 < Pike_sp) { -  stack_pop_n_elems_keep_top( Pike_sp-save_sp-1 ); -  } -  if(UNLIKELY(Pike_interpreter.trace_level>1)) -  do_trace_func_return (1, o, fun); -  goto pop; -  } -  new_frame->save_mark_sp=Pike_mark_sp; -  new_frame->pc = new_frame->context->prog->program + function->func.offset - #ifdef ENTRY_PROLOGUE_SIZE -  + ENTRY_PROLOGUE_SIZE - #endif /* ENTRY_PROLOGUE_SIZE */ -  ; -  return new_frame->pc; -  } -  else -  { -  struct object *tmp; -  new_frame->pc = 0; -  new_frame->num_args = 0; -  tmp=parent_clone_object(constant->u.program, -  o, -  fun, -  args); -  push_object(tmp); -  pop: -  POP_PIKE_FRAME(); -  return 0; -  } -  } -  } -  } +     return low_mega_apply( APPLY_LOW, args, o, (void*)fun );   }      /* Apply a function.    *    * Application types:    *    * APPLY_STACK: Apply Pike_sp[-args] with args-1 arguments.    *    * APPLY_SVALUE: Apply the svalue at arg1, and adjust the stack