pike.git / src / program.c

version» Context lines:

pike.git/src/program.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: program.c,v 1.749 2008/08/18 15:18:18 mast Exp $ + || $Id: program.c,v 1.750 2008/08/26 16:13:05 mast Exp $   */      #include "global.h"   #include "program.h"   #include "object.h"   #include "dynamic_buffer.h"   #include "pike_types.h"   #include "stralloc.h"   #include "las.h"   #include "lex.h"
pike.git/src/program.c:8043:    {    /* fprintf(stderr, "Destructing placeholder.\n"); */    if(c->placeholder) {    debug_malloc_touch(c->placeholder);    zap_placeholder(c);    }       if(delayed && c->target)    {    struct program *p = c->target; +     /* Free the constants in the failed program, to untangle the    * cyclic references we might have to this program, typically    * in parent pointers in nested classes. */    if (p->constants) {    int i;    for (i = 0; i < p->num_constants; i++) {    free_svalue(&p->constants[i].sval);    p->constants[i].sval.type = T_INT;    p->constants[i].sval.subtype = NUMBER_NUMBER;    }
pike.git/src/program.c:8066:    * a previous compile() actually failed, even    * if we did not know it at the time    */    CDFPRINTF((stderr, "th(%ld) %p unregistering failed delayed compile.\n",    (long) th_self(), p));    ref_push_program(p);    /* FIXME: Shouldn't the compilation handler be used here? */    SAFE_APPLY_MASTER("unregister",1);    pop_stack();    -  /* Free the target here to avoid false alarms in the debug check -  * below. */ +  { + #ifdef PIKE_DEBUG +  int refs = p->refs; + #endif +  +  /* Free the target here to avoid false alarms in the debug +  * check below. */    free_program (c->target);    c->target = NULL;      #ifdef PIKE_DEBUG -  if (p->refs > 1) { +  if (refs > 1) {    /* Other programs can have indexed out constants from p, which    * might be broken themselves and/or keep references to p    * through the parent pointer. We should find all those other    * programs and invalidate them too, but how can that be done?    * The whole delayed compilation thingie is icky icky icky... :P    * /mast */ -  fprintf(stderr, "Warning: Program still got %d " -  "external refs after unregister:\n", p->refs - 1); +  fprintf(stderr, "Warning: Program %p still got %d " +  "external refs after unregister:\n", p, p->refs);    locate_references(p); -  +  fprintf (stderr, "Describing program:\n", p); +  describe_something (p, T_PROGRAM, 0, 0, 0, NULL);    }   #endif    }    } -  +  }    else    {    if (c->placeholder)    {    if (c->target->flags & PROGRAM_FINISHED) {    JMP_BUF rec;    /* Initialize the placeholder. */   #ifdef PIKE_DEBUG    if (c->placeholder->prog != c->p)    Pike_fatal("Placeholder object got wrong program after second pass.\n");