pike.git / src / interpret.c

version» Context lines:

pike.git/src/interpret.c:1575:      #define DONE return   #define FETCH   #define INTER_RETURN {SET_PROG_COUNTER(do_inter_return_label);JUMP_DONE;}      #if defined(PIKE_USE_MACHINE_CODE) && defined(_M_IX86)   /* Disable frame pointer optimization */   #pragma optimize("y", off)   #endif    + static void do_trace_efun_call(const struct svalue *s, INT32 args); + static void do_trace_efun_return(const struct svalue *s, int got_retval); +    #include "interpret_functions_fixed.h"      #if defined(PIKE_USE_MACHINE_CODE) && defined(_M_IX86)   /* Restore optimization */   #pragma optimize("", on)   #endif      #ifdef PIKE_SMALL_EVAL_INSTRUCTION   #undef SET_PROG_COUNTER   #undef PROG_COUNTER
pike.git/src/interpret.c:1754:   #endif         #endif /* PIKE_USE_MACHINE_CODE */      #undef REAL_PIKE_DEBUG   #undef DO_IF_REAL_DEBUG   #undef DO_IF_NOT_REAL_DEBUG       + ATTRIBUTE((noinline))   static void do_trace_call(struct byte_buffer *b, INT32 args)   {    struct pike_string *filep = NULL;    char *file;    const char *s;    INT_TYPE linep;    INT32 e;    ptrdiff_t len = 0;       buffer_add_str(b, "(");
pike.git/src/interpret.c:1820:    } else {    fprintf(stderr, "- %s: %s\n", file, s);    }       if (filep) {    free_string(filep);    }    buffer_free(b);   }    + ATTRIBUTE((noinline)) + static void do_trace_function_call(const struct object *o, const struct identifier *function, INT32 args) { +  struct byte_buffer buffer = BUFFER_INIT(); +  char buf[50]; +  +  sprintf(buf, "%lx->", (long) PTR_TO_INT (o)); +  buffer_add_str(&buffer, buf); +  if (function->name->size_shift) +  buffer_add_str (&buffer, "[widestring function name]"); +  else +  buffer_add_str(&buffer, function->name->str); +  do_trace_call(&buffer, args); + } +  + ATTRIBUTE((noinline)) + static void do_trace_efun_call(const struct svalue *s, INT32 args) { +  struct byte_buffer buf = BUFFER_INIT(); +  if (s->u.efun->name->size_shift) +  buffer_add_str (&buf, "[widestring function name]"); +  else +  buffer_add_str (&buf, s->u.efun->name->str); +  do_trace_call(&buf, args); + } +  + ATTRIBUTE((noinline)) + static void do_trace_svalue_call(const struct svalue *s, INT32 args) { +  struct byte_buffer buf = BUFFER_INIT(); +  safe_describe_svalue(&buf, s,0,0); +  do_trace_call(&buf, args); + } +  +  + ATTRIBUTE((noinline))   static void do_trace_func_return (int got_retval, struct object *o, int fun)   {    struct byte_buffer b = BUFFER_INIT();    if (o) {    if (o->prog) {    struct identifier *id = ID_FROM_INT (o->prog, fun);    char buf[50];    sprintf(buf, "%lx->", (long) PTR_TO_INT (o));    buffer_add_str(&b, buf);    if (id->name->size_shift)
pike.git/src/interpret.c:1841:    else    buffer_add_str(&b, id->name->str);    buffer_add_str (&b, "() ");    }    else    buffer_add_str (&b, "function in destructed object ");    }    do_trace_return (&b, got_retval);   }    + #ifdef PIKE_DEBUG + ATTRIBUTE((noinline)) + static void do_trace_efun_return(const struct svalue *s, int got_retval) { +  struct byte_buffer buf = BUFFER_INIT(); +  if (s->u.efun->name->size_shift) +  buffer_add_str (&buf, "[widestring function name]"); +  else +  buffer_add_str (&buf, s->u.efun->name->str); +  buffer_add_str (&buf, "() "); +  do_trace_return (&buf, got_retval); + } + #endif +  + ATTRIBUTE((noinline))   static void do_trace_return (struct byte_buffer *b, int got_retval)   {    struct pike_string *filep = NULL;    char *file;    const char *s;    INT_TYPE linep;       if (got_retval) {    buffer_add_str (b, "returns: ");    safe_describe_svalue(b, Pike_sp-1,0,0);
pike.git/src/interpret.c:2095:    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))    { -  struct byte_buffer buffer = BUFFER_INIT(); -  char buf[50]; -  -  sprintf(buf, "%lx->", (long) PTR_TO_INT (o)); -  buffer_add_str(&buffer, buf); -  if (function->name->size_shift) -  buffer_add_str (&buffer, "[widestring function name]"); -  else -  buffer_add_str(&buffer, function->name->str); -  do_trace_call(&buffer, args); +  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
pike.git/src/interpret.c:2255:    break;       case T_FUNCTION:    if(SUBTYPEOF(*s) == FUNCTION_BUILTIN)    {   #ifdef PIKE_DEBUG    struct svalue *expected_stack = Pike_sp-args;   #endif    if(Pike_interpreter.trace_level>1)    { -  struct byte_buffer buf = BUFFER_INIT(); -  if (s->u.efun->name->size_shift) -  buffer_add_str (&buf, "[widestring function name]"); -  else -  buffer_add_str (&buf, s->u.efun->name->str); -  do_trace_call(&buf, args); +  do_trace_efun_call(s, args);    }    if (PIKE_FN_START_ENABLED()) {    /* DTrace enter probe    arg0: function name    arg1: object    */    PIKE_FN_START(s->u.efun->name->size_shift == 0 ?    s->u.efun->name->str : "[widestring fn name]",    "");    }
pike.git/src/interpret.c:2319:    scope=((struct pike_trampoline *)(o->storage))->frame;    o=scope->current_object;    }    goto apply_low;    }    break;       case T_ARRAY:    if(Pike_interpreter.trace_level)    { -  struct byte_buffer buf = BUFFER_INIT(); -  safe_describe_svalue(&buf, s,0,0); -  do_trace_call(&buf, args); +  do_trace_svalue_call(s, args);    }    if (PIKE_FN_START_ENABLED()) {    /* DTrace enter probe    arg0: function name    arg1: object    */    PIKE_FN_START("[array]", "");    }    apply_array(s->u.array, args, (type == APPLY_STACK));    break;
pike.git/src/interpret.c:2344:    if (args != 1) {    /* FIXME: Casts to object ought to propagate to apply program below. */    SIMPLE_WRONG_NUM_ARGS_ERROR("cast", 1);    }    o_cast(s->u.type, compile_type_to_runtime_type(s->u.type));    break;       case T_PROGRAM:    if(Pike_interpreter.trace_level)    { -  struct byte_buffer buf = BUFFER_INIT(); -  safe_describe_svalue(&buf, s,0,0); -  do_trace_call(&buf, args); +  do_trace_svalue_call(s, args);    }    if (PIKE_FN_START_ENABLED()) {    /* DTrace enter probe    arg0: function name    arg1: object    */    struct byte_buffer buf = BUFFER_INIT();    safe_describe_svalue(&buf, s,0,0);    PIKE_FN_START("[program]", buffer_get_string(&buf));    buffer_free(&buf);