pike.git / src / interpret.c

version» Context lines:

pike.git/src/interpret.c:3253:   }      PMOD_EXPORT void callsite_resolve_fun(struct pike_callsite *c, struct object *o, INT16 fun) {    struct program *p = o->prog;    struct inherit *context;    struct reference *ref;    struct identifier *function;    struct pike_frame *scope = NULL;    INT32 args = c->args;    -  if(!p) +  if(UNLIKELY(!p))    PIKE_ERROR("destructed object->function",    "Cannot call functions in destructed objects.\n", Pike_sp, args);    -  if(!(p->flags & PROGRAM_PASS_1_DONE) || (p->flags & PROGRAM_AVOID_CHECK)) +  if(UNLIKELY(!(p->flags & PROGRAM_PASS_1_DONE) || (p->flags & PROGRAM_AVOID_CHECK)))    PIKE_ERROR("__empty_program() -> function",    "Cannot call functions in unfinished objects.\n", Pike_sp, args);    -  if(p == pike_trampoline_program && -  fun == QUICK_FIND_LFUN(pike_trampoline_program, LFUN_CALL)) +  if(UNLIKELY(p == pike_trampoline_program && +  fun == QUICK_FIND_LFUN(pike_trampoline_program, LFUN_CALL)))    {    scope = ((struct pike_trampoline *)(o->storage))->frame;    fun = ((struct pike_trampoline *)(o->storage))->func;    o = scope->current_object;    callsite_resolve_fun(c, o, fun);    c->frame->scope = scope;    add_ref(scope);    return;    }   
pike.git/src/interpret.c:3297:       context = p->inherits + ref->inherit_offset;      #ifdef PIKE_DEBUG    if(ref->inherit_offset>=p->num_inherits)    Pike_fatal("Inherit offset out of range in program.\n");   #endif       function = context->prog->identifiers + ref->identifier_offset;    -  if(function->func.offset == -1) { +  if(UNLIKELY(function->func.offset == -1)) {    generic_error(NULL, Pike_sp, args,    "Calling undefined function.\n");    }       switch(function->identifier_flags & (IDENTIFIER_TYPE_MASK|IDENTIFIER_ALIAS))    {    case IDENTIFIER_C_FUNCTION:    c->type = CALLTYPE_CFUN;    c->ptr = function->func.c_fun;    break;
pike.git/src/interpret.c:3380: Inside #if defined(PIKE_DEBUG)
  #ifdef PIKE_DEBUG    Pike_fatal("Unknown identifier type.\n");   #endif    UNREACHABLE(break);    }    /*    * The cases which do _not_ return, have a frame created. These are:    * CALLTYPE_CFUN, CALLTYPE_PIKEFUN and CALLTYPE_PARENT_CLONE.    */    -  +     struct pike_frame *frame = c->frame;       if (!frame || c->type != CALLTYPE_PIKEFUN) {    add_ref(o);    add_ref(p);    frame = alloc_pike_frame();       c->frame = frame;    frame->current_object = o;    frame->current_program = p;
pike.git/src/interpret.c:3442:    callsite_trace_call_fun(c);   }      PMOD_EXPORT void callsite_resolve_lfun(struct pike_callsite *c, struct object *o, int lfun) {    struct program *p = o->prog;      #ifdef PIKE_DEBUG    if(lfun < 0 || lfun >= NUM_LFUNS)    Pike_fatal("Illegal lfun.\n");   #endif -  if(!p) +  if(UNLIKELY(!p))    PIKE_ERROR("destructed object", "Apply on destructed object.\n", Pike_sp, c->args);       int fun = FIND_LFUN(p, lfun);    -  if (fun < 0) +  if (UNLIKELY(fun < 0))    Pike_error ("Cannot call undefined lfun %s.\n", lfun_names[lfun]);       callsite_resolve_fun(c, o, fun);   }      PMOD_EXPORT void callsite_resolve_svalue(struct pike_callsite *c, struct svalue *s) {    switch(TYPEOF(*s))    {    default:    callsite_svalue_error(c, s);
pike.git/src/interpret.c:3525:    Pike_fatal("Resetting frame which is not Pike_fp\n");   #endif       Pike_mark_sp=frame->save_mark_sp;       if (LIKELY(frame->refs == 1)) {    /* reset some entries which are changed during    * execution of Pike code. We can probably    * make most of these PIKE_DEBUG stuff */    frame->pc = c->ptr; + #ifdef PIKE_DEBUG    frame->num_locals = 0;    frame->num_args = 0;    frame->return_addr = NULL; -  + #endif    if (UNLIKELY(frame->save_locals_bitmask)) {    free(frame->save_locals_bitmask);    frame->save_locals_bitmask = NULL;    }    frame->flags &= PIKE_FRAME_NO_REUSE;    return;    }       struct pike_frame *n = alloc_pike_frame();       *n = *frame;    n->refs = 1;    n->flags = frame->flags & PIKE_FRAME_NO_REUSE;    n->pc = c->ptr; -  + #ifdef PIKE_DEBUG    n->num_locals = 0;    n->num_args = 0;    n->return_addr = NULL; -  + #endif    if (n->scope) add_ref(n->scope);    add_ref(n->current_object);    add_ref(n->current_program);       LOW_POP_PIKE_FRAME(frame);       c->frame = n;    Pike_fp = n;       /*