pike.git / src / pike_types.c

version» Context lines:

pike.git/src/pike_types.c:21:   #include "lex.h"   #include "pike_memory.h"   #include "bignum.h"   #include "main.h"   #include "opcodes.h"   #include "cyclic.h"   #include "gc.h"   #include "pike_compiler.h"   #include "block_allocator.h"   #include "bitvector.h" + #include "gc_header.h"      #ifdef PIKE_DEBUG   #define PIKE_TYPE_DEBUG   #endif /* PIKE_DEBUG */         /* Number of entries in the struct pike_type hash-table. */   /* 256Kb */   #define PIKE_TYPE_HASH_SIZE 32767   
pike.git/src/pike_types.c:252:    *    */   static struct block_allocator type_allocator = BA_INIT(sizeof(struct pike_type), 128);      PMOD_EXPORT void really_free_pike_type(struct pike_type * t) {    ba_free(&type_allocator, t);   }      ATTRIBUTE((malloc))   PMOD_EXPORT struct pike_type * alloc_pike_type(void) { -  return ba_alloc(&type_allocator); +  struct pike_type *t = ba_alloc(&type_allocator); +  gc_init_marker(&t->m); +  return t;   }      PMOD_EXPORT void count_memory_in_pike_types(size_t *n, size_t *s) {    ba_count_all(&type_allocator, n, s);   }      struct pike_type **pike_type_hash = NULL;   size_t pike_type_hash_size = 0;      void debug_free_type(struct pike_type *t)
pike.git/src/pike_types.c:548: Inside #if defined(PIKE_DEBUG)
     #ifdef PIKE_DEBUG    if ((type == T_OR) && (car->type == T_OR)) {    Pike_fatal("Invalid CAR to OR node.\n");    }   #endif       debug_malloc_pass(t = ba_alloc(&type_allocator));       t->refs = 0; +  gc_init_marker(&t->m);    add_ref(t); /* For DMALLOC... */    t->type = type;    t->flags = 0;    t->car = car;    t->cdr = cdr;       t->hash = hash;    t->next = pike_type_hash[index];    pike_type_hash[index] = t;   
pike.git/src/pike_types.c:9083: Inside #if defined (PIKE_DEBUG) || defined (DO_PIKE_CLEANUP)
      GC_ENTER (t, T_TYPE) {    switch (t->type) {    case T_FUNCTION:    case T_MANY:    case T_TUPLE:    case T_MAPPING:    case T_OR:    case T_AND:    case PIKE_T_RING: +  debug_gc_check (t->car, " as car in a type"); +  debug_gc_check (t->cdr, " as cdr in a type"); +  break;    case PIKE_T_ATTRIBUTE:    case PIKE_T_NAME: -  + #ifdef PIKE_DEBUG +  /* this is a string and without PIKE_DEBUG +  * they are not touched by the GC */    debug_gc_check (t->car, " as car in a type"); -  + #endif    debug_gc_check (t->cdr, " as cdr in a type");    break;    case T_ARRAY:    case T_MULTISET:    case T_NOT:    case T_TYPE:    case T_PROGRAM:    case T_STRING:    case PIKE_T_AUTO:    debug_gc_check (t->car, " as car in a type");
pike.git/src/pike_types.c:9138: Inside #if defined (PIKE_DEBUG) || defined (DO_PIKE_CLEANUP)
     void gc_check_all_types (void)   {    size_t e;    for(e=0;e<=pike_type_hash_size;e++)    {    struct pike_type *t;    for(t = pike_type_hash[e]; t; t=t->next) {    if (gc_keep_markers) {    /* Make sure that leaked types also have markers at cleanup... */ -  (void)pmod_get_marker(t); +  (void)get_marker(t);    }    gc_check_type(t);    }    }   }      #endif /* PIKE_DEBUG || DO_PIKE_CLEANUP */