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.523 2003/09/04 15:02:02 grubba Exp $ + || $Id: program.c,v 1.524 2003/09/08 20:05:21 mast Exp $   */      #include "global.h" - RCSID("$Id: program.c,v 1.523 2003/09/04 15:02:02 grubba Exp $"); + RCSID("$Id: program.c,v 1.524 2003/09/08 20:05:21 mast Exp $");   #include "program.h"   #include "object.h"   #include "dynamic_buffer.h"   #include "pike_types.h"   #include "stralloc.h"   #include "las.h"   #include "language.h"   #include "lex.h"   #include "pike_macros.h"   #include "fsort.h"
pike.git/src/program.c:6564:    free_pike_scope(THIS->frame);    THIS->frame=0;    }   }      static void gc_check_frame(struct pike_frame *f)   {    if(f->flags & PIKE_FRAME_MALLOCED_LOCALS)    {    if(f->current_object) -  debug_gc_check2(f->current_object, T_PIKE_FRAME, f, -  " as current_object in trampoline frame"); +  debug_gc_check (f->current_object, " as current_object in trampoline frame");    if(f->context.prog) -  debug_gc_check2(f->context.prog, T_PIKE_FRAME, f, -  " as context.prog in trampoline frame"); +  debug_gc_check (f->context.prog, " as context.prog in trampoline frame");    if(f->context.parent) -  debug_gc_check2(f->context.parent, T_PIKE_FRAME, f, -  " as context.parent in trampoline frame"); +  debug_gc_check (f->context.parent, " as context.parent in trampoline frame");    if(f->flags & PIKE_FRAME_MALLOCED_LOCALS) -  debug_gc_check_svalues2(f->locals, f->num_locals, T_PIKE_FRAME, f, -  " in locals of trampoline frame"); -  if(f->scope && !debug_gc_check2(f->scope, T_PIKE_FRAME, f, -  " as scope frame of trampoline frame")) +  debug_gc_check_svalues (f->locals, f->num_locals, " in locals of trampoline frame"); +  if(f->scope && !debug_gc_check (f->scope, " as scope frame of trampoline frame"))    gc_check_frame(f->scope);    }   }      static void gc_check_trampoline(struct object *o)   {    if (THIS->frame && -  !debug_gc_check2(THIS->frame, T_OBJECT, o, " as trampoline frame")) +  !debug_gc_check (THIS->frame, " as trampoline frame"))    gc_check_frame(THIS->frame);   }      static void gc_recurse_frame(struct pike_frame *f)   {    if(f->current_object) gc_recurse_object(f->current_object);    if(f->context.prog) gc_recurse_program(f->context.prog);    if(f->context.parent) gc_recurse_object(f->context.parent);    if(f->flags & PIKE_FRAME_MALLOCED_LOCALS)    gc_recurse_svalues(f->locals,f->num_locals);
pike.git/src/program.c:6634:    return;    }       pop_n_elems (args);    MAKE_CONST_STRING (s, "__placeholder_object");    ref_push_string (s);   }      void init_program(void)   { -  int i; +  size_t i;    struct svalue key;    struct svalue val;    struct svalue id;    init_program_blocks();       MAKE_CONST_STRING(this_program_string,"this_program");    MAKE_CONST_STRING(this_string,"this");    MAKE_CONST_STRING(UNDEFINED_string,"UNDEFINED");       lfun_ids = allocate_mapping(NUM_LFUNS);
pike.git/src/program.c:6706:       s.type=T_OBJECT;    s.u.object=placeholder_object;    low_add_constant("__placeholder_object",&s);    debug_malloc_touch(placeholder_object);    }   }      void cleanup_program(void)   { -  int e; +  size_t e;       free_mapping(lfun_types);    free_mapping(lfun_ids);    for (e=0; e < NELEM(lfun_names); e++) {    free_string(lfun_strings[e]);    }   #ifdef FIND_FUNCTION_HASHSIZE    for(e=0;e<FIND_FUNCTION_HASHSIZE;e++)    {    if(cache[e].name)
pike.git/src/program.c:6757: Inside #if defined(DO_PIKE_CLEANUP)
   }       if(placeholder_program)    {    free_program(placeholder_program);    placeholder_program=0;    }   #endif   }    - #ifdef GC2 -  +    void gc_mark_program_as_referenced(struct program *p)   {    debug_malloc_touch(p);       if (p->flags & PROGRAM_AVOID_CHECK) {    /* Program is in an inconsistent state.    * don't look closer at it.    */    debug_malloc_touch(p);   
pike.git/src/program.c:6784: Inside #if defined(GC2)
   else {    DOUBLEUNLINK(first_program, p);    DOUBLELINK(first_program, p); /* Linked in first. */    }    }       return;    }       if(gc_mark(p)) -  { +  GC_ENTER (p, T_PROGRAM) {    int e;       if (p == gc_mark_program_pos)    gc_mark_program_pos = p->next;    if (p == gc_internal_program)    gc_internal_program = p->next;    else {    DOUBLEUNLINK(first_program, p);    DOUBLELINK(first_program, p); /* Linked in first. */    }
pike.git/src/program.c:6811: Inside #if defined(GC2)
      for(e=0;e<p->num_inherits;e++)    {    if(p->inherits[e].parent)    gc_mark_object_as_referenced(p->inherits[e].parent);       if(e && p->inherits[e].prog)    gc_mark_program_as_referenced(p->inherits[e].prog);    }    +  } GC_LEAVE;   } - } +       void real_gc_cycle_check_program(struct program *p, int weak)   { -  GC_CYCLE_ENTER(p, weak) { +  GC_CYCLE_ENTER(p, T_PROGRAM, weak) {    int e;       if (!(p->flags & PROGRAM_AVOID_CHECK))    {    for(e=0;e<p->num_constants;e++)    gc_cycle_check_svalues(& p->constants[e].sval, 1);       for(e=0;e<p->num_inherits;e++)    {    if(p->inherits[e].parent)
pike.git/src/program.c:6857: Inside #if defined(GC2)
   debug_malloc_touch(p);       if (p->flags & PROGRAM_AVOID_CHECK) {    /* Program is in an inconsistent state.    * don't look closer at it.    */    debug_malloc_touch(p);    return;    }    +  GC_ENTER (p, T_PROGRAM) {    if(p->parent) -  debug_gc_check2(p->parent, T_PROGRAM, p, " as parent program of a program"); +  debug_gc_check (p->parent, " as parent program of a program");       for(e=0;e<p->num_constants;e++) { -  debug_gc_check_svalues(& p->constants[e].sval, 1, T_PROGRAM, p); +  debug_gc_check_svalues (&p->constants[e].sval, 1, " as program constant");    }       for(e=0;e<p->num_inherits;e++)    {    if(p->inherits[e].parent)    { -  debug_gc_check2(p->inherits[e].parent, T_PROGRAM, p, +  debug_gc_check (p->inherits[e].parent,    " as inherited parent object of a program");    }      #ifdef PIKE_DEBUG    if(d_flag && p->inherits[e].name && check_for != (void *)(ptrdiff_t)1) -  debug_gc_check(p->inherits[e].name, T_PROGRAM, p); +  debug_gc_check (p->inherits[e].name, " as inherit name");   #endif       if(e && p->inherits[e].prog) -  debug_gc_check2(p->inherits[e].prog, T_PROGRAM, p, -  " as inherited program of a program"); +  debug_gc_check (p->inherits[e].prog, " as inherited program of a program");    }      #ifdef PIKE_DEBUG    if(d_flag && check_for != (void *)(ptrdiff_t)1)    {    int e;    for(e=0;e<(int)p->num_strings;e++) -  debug_gc_check(p->strings[e], T_PROGRAM, p); +  debug_gc_check (p->strings[e], " as program string");       for(e=0;e<(int)p->num_identifiers;e++)    { -  debug_gc_check(p->identifiers[e].name, T_PROGRAM, p); -  debug_gc_check(p->identifiers[e].type, T_PROGRAM, p); +  debug_gc_check (p->identifiers[e].name, " as program identifier name"); +  debug_gc_check (p->identifiers[e].type, " as program identifier type");    }    }   #endif -  +  } GC_LEAVE;   }      unsigned gc_touch_all_programs(void)   {    unsigned n = 0;    struct program *p;    struct program_state *ps;    if (first_program && first_program->prev)    Pike_fatal("Error in program link list.\n");    for (p = first_program; p; p = p->next) {
pike.git/src/program.c:6949: Inside #if defined(GC2)
  }      void gc_zap_ext_weak_refs_in_programs(void)   {    gc_mark_program_pos = first_program;    while (gc_mark_program_pos != gc_internal_program && gc_ext_weak_refs) {    struct program *p = gc_mark_program_pos;    gc_mark_program_pos = p->next;    gc_mark_program_as_referenced(p);    } -  discard_queue(&gc_mark_queue); +  gc_mark_discard_queue();   }      size_t gc_free_all_unreferenced_programs(void)   {    struct program *p,*next;    size_t unreferenced = 0;   #ifdef PIKE_DEBUG    int first = 1;   #endif   
pike.git/src/program.c:7026: Inside #if defined(GC2) and #if defined(PIKE_DEBUG)
   tmp++;    }    if(tmp >= p->refs)    gc_fatal(p, 1 ,"garbage collector failed to free program!!!\n");    }   #endif       return unreferenced;   }    - #endif /* GC2 */ +     -  +    void push_compiler_frame(int lexical_scope)   {    struct compiler_frame *f;    f=ALLOC_STRUCT(compiler_frame);    f->previous=Pike_compiler->compiler_frame;    f->lexical_scope=lexical_scope;    f->current_type=0;    f->current_return_type=0;       f->current_number_of_locals=0;