Branch: Tag:

2009-02-26

2009-02-26 23:44:56 by Martin Stjernholm <mast@lysator.liu.se>

Improved RXML_PCODE_UPDATE_DEBUG logging.

Rev: server/etc/modules/RXML.pmod/module.pmod:1.391

2:   //   // Created 1999-07-30 by Martin Stjernholm.   // - // $Id: module.pmod,v 1.390 2009/02/16 16:43:36 jonasw Exp $ + // $Id: module.pmod,v 1.391 2009/02/26 23:44:56 mast Exp $      // Kludge: Must use "RXML.refs" somewhere for the whole module to be   // loaded correctly.
416:    else { \    if (PCode p_code = _parser->p_code) { \    PCODE_UPDATE_MSG ( \ -  "%O: Restoring p-code update count from %d to %d " \ -  "since the frame is stored unevaluated " \ +  "%O (frame %O): Restoring p-code update count " \ +  "from %d to %d since the frame is stored unevaluated " \    "due to exception.\n", \ -  _frame, _ctx->state_updated, orig_state_updated); \ +  _ctx, _frame, _ctx->state_updated, orig_state_updated); \    _ctx->state_updated = orig_state_updated; \    p_code->add_frame (_ctx, _frame, PCode, 1); \    } \
1645:    //! implementors that means whenever the value that    //! @[RXML.Frame.save] would return changes.    { - #ifdef RXML_PCODE_UPDATE_DEBUG -  array a = backtrace(); -  PCODE_UPDATE_MSG ("%O: P-code update by request from %s", -  this_object(), -  describe_backtrace (a[sizeof (a) - 2..sizeof (a) - 2])); - #endif +  PCODE_UPDATE_MSG ("%O: P-code update to %d by request from %s", +  this_object(), state_updated + 1, +  describe_backtrace (backtrace()[<1..<1]));    state_updated++;    }   
4360:    }       in_args = _prepare (ctx, type, args && args + ([]), comp); -  PCODE_UPDATE_MSG ("%O: P-code update since args has been compiled.\n", -  this_object()); +     ctx->state_updated++; -  +  PCODE_UPDATE_MSG ("%O (frame %O): P-code update to %d " +  "since args have been compiled.\n", +  ctx, this_object(), ctx->state_updated);    break eval_only;    }   
4695:    if (unevaled_content) {    unevaled_content->finish();    in_content = unevaled_content; -  PCODE_UPDATE_MSG ("%O: P-code update since content " -  "has been compiled.\n", this_object()); +     ctx->state_updated++; -  +  PCODE_UPDATE_MSG ("%O (frame %O): P-code update to %d " +  "since content has been compiled.\n", +  ctx, this_object(), ctx->state_updated);    ctx->make_p_code = orig_make_p_code; // Reset before do_return.    }    flags |= FLAG_MAY_CACHE_RESULT;
8036:   {    if (sizeof (args)) msg = sprintf (msg, @args);    array bt = backtrace(); +  PCODE_UPDATE_MSG ("Throwing PCodeStaleError: %s\n", describe_backtrace (bt));    throw (PCodeStaleError (msg, bt[..sizeof (bt) - 2]));   }   
8079:    //! Returns whether the p-code is stale or not. Should be called    //! before @[eval] to ensure it won't fail for that reason.    { - #ifdef TAGSET_GENERATION_DEBUG + #if defined (TAGSET_GENERATION_DEBUG) || defined (RXML_PCODE_UPDATE_DEBUG) +  if (tag_set && tag_set->generation != generation)    werror ("%O is_stale test: generation=%d, %O->generation=%d\n", -  this_object(), generation, tag_set, tag_set && tag_set->generation); +  this_object(), generation, +  tag_set, tag_set && tag_set->generation);   #endif    return tag_set && tag_set->generation != generation;    }
8093:    {    int updated = flags & UPDATED;    flags &= ~UPDATED; +  PCODE_UPDATE_MSG ("%O: is_updated returns %s and resets flag " +  "by request from %s", this, +  updated ? "true" : "false", +  describe_backtrace (backtrace()[<1..<1]));    return updated;    }   
8171:    exec = allocate (16);    length = 0;    flags |= UPDATED; +  PCODE_UPDATE_MSG ("%O (ctx %O): Marked as updated by create or reset.\n", +  this, ctx);    protocol_cache_time = -1;    p_code_comp = _p_code_comp || PikeCompile();    PCODE_MSG ("create or reset (with %s %O)\n",
8714:    exec[pos + 1] = exec[pos + 2] = nil;    flags |= UPDATED;    update_count = ++ctx->state_updated; +  PCODE_UPDATE_MSG ("%O (ctx %O, frame %O): P-code update to " +  "%d due to result collection.\n", +  this, ctx, frame, update_count);    if (new_p_code) new_p_code->add_frame (ctx, frame, item, 1);    }   
8729:    p_code_comp->resolve (frame_state[0]);    exec[pos + 2] = frame_state;    flags |= UPDATED; +  PCODE_UPDATE_MSG ("%O (ctx %O, frame %O): Marked as " +  "updated due to ctx->state_updated " +  "%d > %d.\n", this, ctx, frame, +  ctx->state_updated, update_count);    update_count = ctx->state_updated;    }    if (!exec[pos + 1]) {
8760:    ctx->eval_finish (1);    ctx->id->eval_status["rxmlpcode"] = 1;    -  if (ctx->state_updated > update_count) flags |= UPDATED; +  if (ctx->state_updated > update_count) { +  PCODE_UPDATE_MSG ("%O (ctx %O): Marked as updated due to " +  "ctx->state_updated %d > %d.\n", this, ctx, frame, +  ctx->state_updated, update_count); +  flags |= UPDATED; +  }       if (!ppos)    return type->sequential ? type->empty_value : nil;
8779:       else {    PCODE_UPDATE_MSG ( -  "%O: Restoring p-code update count from %d to %d " -  "since the frame is stored unevaluated " +  "%O (item %O): Restoring p-code update count " +  "from %d to %d since the frame is stored unevaluated "    "due to exception.\n", -  item, ctx->state_updated, update_count); +  ctx, item, ctx->state_updated, update_count);    ctx->state_updated = update_count;       if (new_p_code)
9040:    else parser->finish(); // Might unwind.    res = parser->eval(); // Might undwind.    flags |= UPDATED; +  PCODE_UPDATE_MSG ("%O (ctx %O): Marked as updated after " +  "reevaluation.\n", this, ctx);    }) {    ctx->make_p_code = orig_make_p_code;    if (objectp (err) && err->thrown_at_unwind) {
9052:    renewed_p_code->finish();    if (new_p_code) new_p_code->finish();    renewed_p_code->flags |= UPDATED; +  PCODE_UPDATE_MSG ("%O (ctx %O): Marked as updated after " +  "reevaluation.\n", renewed_p_code, ctx);    _take (renewed_p_code); // Assumed to be atomic.       type->give_back (parser, tag_set);