pike.git / src / constants.c

version» Context lines:

pike.git/src/constants.c:10:   #include "program.h"   #include "pike_types.h"   #include "stralloc.h"   #include "pike_memory.h"   #include "interpret.h"   #include "mapping.h"   #include "pike_error.h"   #include "security.h"   #include "block_alloc.h"    - RCSID("$Id: constants.c,v 1.30 2001/04/13 19:56:49 grubba Exp $"); + RCSID("$Id: constants.c,v 1.31 2001/07/02 04:09:47 hubbe Exp $");      struct mapping *builtin_constants = 0;      PMOD_EXPORT struct mapping *get_builtin_constants(void)   {    if(!builtin_constants)    builtin_constants=allocate_mapping(20);       return builtin_constants;   }
pike.git/src/constants.c:62:    s.type=T_PROGRAM;    s.subtype=0;    s.u.program=p;    low_add_constant(name, &s);   }      #undef EXIT_BLOCK   #define EXIT_BLOCK(X) do { \    free_type(X->type); \    free_string(X->name); \ +  X->name=0; \    EXIT_PIKE_MEMOBJ(X); \   }while(0)   BLOCK_ALLOC(callable,128)      /* Eats one ref to 'type' and 'name' */   PMOD_EXPORT struct callable *low_make_callable(c_fun fun,    struct pike_string *name,    struct pike_type *type,    INT16 flags,    optimize_fun optimize,
pike.git/src/constants.c:89:    f->flags=flags;    f->docode=docode;    f->optimize=optimize;   #ifdef PIKE_DEBUG    {    struct pike_type *z = check_call(function_type_string, type, 0);    f->may_return_void = (z == void_type_string);    if(!z) fatal("Gnapp!\n");    free_type(z);    } +  f->runs=0; +  f->compiles=0;   #endif    return f;   }      PMOD_EXPORT struct callable *make_callable(c_fun fun,    char *name,    char *type,    INT16 flags,    optimize_fun optimize,    docode_fun docode)
pike.git/src/constants.c:161:    s.type=T_FUNCTION;    s.subtype=FUNCTION_BUILTIN;    add_ref(n);    ret=s.u.efun=low_make_callable(fun, n, t, flags, optimize, docode);    low_add_efun(n, &s);    free_svalue(&s);    free_string(n);    return ret;   }    + #ifdef PIKE_DEBUG + void present_constant_profiling(void) + { +  struct callable_block *b; +  int e; +  for(b=callable_blocks;b;b=b->next) +  { +  for(e=0;e<NELEM(b->x);e++) +  { +  if(b->x[e].name) +  { +  fprintf(stderr,"%010d @E@: %s\n",b->x[e].runs, b->x[e].name->str); +  } +  } +  } + } + #endif +    void cleanup_added_efuns(void)   {   #ifdef DO_PIKE_CLEANUP    if(builtin_constants)    {    free_mapping(builtin_constants);    builtin_constants=0;    }   #endif   }