pike.git / src / program.c

version» Context lines:

pike.git/src/program.c:1319:      struct program *null_program=0;      struct program *compilation_program = 0;   struct program *compilation_env_program = 0;   struct object *compilation_environment = NULL;      struct program *gc_internal_program = 0;   static struct program *gc_mark_program_pos = 0;    - static struct mapping *resolve_cache=0; -  +    #ifdef PIKE_DEBUG   #define CHECK_FILE_ENTRY(PROG, POS, LEN, SHIFT) \    do { \    if (SHIFT < 0 || SHIFT > 2 || \    POS + (LEN << SHIFT) > PROG->linenumbers + PROG->num_linenumbers) \    Pike_fatal ("Invalid file entry in linenumber info.\n"); \    } while (0)   #else   #define CHECK_FILE_ENTRY(PROG, POS, LEN, SHIFT) do {} while (0)   #endif
pike.git/src/program.c:1600:    c->num_used_modules++;    Pike_compiler->num_used_modules++;    assign_svalue_no_free((struct svalue *)    low_make_buf_space(sizeof(struct svalue),    &c->used_modules), s);    if(Pike_compiler->module_index_cache)    {    free_mapping(Pike_compiler->module_index_cache);    Pike_compiler->module_index_cache=0;    } +  if(c->resolve_cache) +  { +  free_mapping(c->resolve_cache); +  c->resolve_cache=0; +  }    }else{    yyerror("Module is neither mapping nor object");    }   }      void unuse_modules(INT32 howmany)   {    struct compilation *c = THIS_COMPILATION;    if(!howmany) return;   #ifdef PIKE_DEBUG
pike.git/src/program.c:1775:   struct node_s *resolve_identifier(struct pike_string *ident)   {    struct compilation *c = THIS_COMPILATION;    node *ret = NULL;       /* Handle UNDEFINED */    if (ident == UNDEFINED_string) {    return mkconstantsvaluenode(&svalue_undefined);    }    -  if(resolve_cache) +  if(c->resolve_cache)    { -  struct svalue *tmp=low_mapping_string_lookup(resolve_cache,ident); +  struct svalue *tmp=low_mapping_string_lookup(c->resolve_cache,ident);    if(tmp)    {    if(!IS_UNDEFINED (tmp))    return mkconstantsvaluenode(tmp);       return 0;    }    }       CHECK_COMPILER();
pike.git/src/program.c:1824:       if (Pike_compiler->compiler_pass == 2 &&    ((TYPEOF(Pike_sp[-1]) == T_OBJECT &&    Pike_sp[-1].u.object == placeholder_object) ||    (TYPEOF(Pike_sp[-1]) == T_PROGRAM &&    Pike_sp[-1].u.program == placeholder_program))) {    my_yyerror("Got placeholder %s (resolver problem) "    "when resolving '%S'.",    get_name_of_type (TYPEOF(Pike_sp[-1])), ident);    } else { -  if(!resolve_cache) -  resolve_cache=dmalloc_touch(struct mapping *, allocate_mapping(10)); -  mapping_string_insert(resolve_cache,ident,Pike_sp-1); +  if(!c->resolve_cache) +  c->resolve_cache=dmalloc_touch(struct mapping *, allocate_mapping(10)); +  mapping_string_insert(c->resolve_cache,ident,Pike_sp-1);       if(!IS_UNDEFINED (Pike_sp-1))    {    ret=mkconstantsvaluenode(Pike_sp-1);    }    }    pop_stack();       return ret;   }
pike.git/src/program.c:3751:    toss_compilation_resources();      #if 0    CDFPRINTF((stderr,    "th(%ld) end_first_pass(): "    "%p compilation_depth:%d, Pike_compiler->compiler_pass:%d\n",    (long)th_self(), prog,    c->compilation_depth, Pike_compiler->compiler_pass));   #endif    -  if(!Pike_compiler->compiler_frame && (Pike_compiler->compiler_pass==2 || !prog) && resolve_cache) +  if(!Pike_compiler->compiler_frame && (Pike_compiler->compiler_pass==2 || !prog) && c->resolve_cache)    { -  free_mapping(dmalloc_touch(struct mapping *, resolve_cache)); -  resolve_cache=0; +  free_mapping(dmalloc_touch(struct mapping *, c->resolve_cache)); +  c->resolve_cache=0;    }      #ifdef SHARED_NODES    /* free(node_hash.table); */   #endif /* SHARED_NODES */      #define POP   #include "compilation.h"       exit_type_stack();
pike.git/src/program.c:8166:    c->p = NULL;    }    if(c->placeholder) {    free_object(c->placeholder);    c->placeholder = NULL;    }    if(c->lex.current_file) {    free_string(c->lex.current_file);    c->lex.current_file = NULL;    } +  if (c->resolve_cache) { +  free_mapping(c->resolve_cache); +  c->resolve_cache = NULL; +  }    free_svalue(& c->default_module);    SET_SVAL(c->default_module, T_INT, NUMBER_NUMBER, integer, 0);    free_supporter(&c->supporter);    verify_supporters();   }      static void run_init(struct compilation *c)   {    debug_malloc_touch(c);       if (c->compat_handler) free_object(c->compat_handler);    c->compat_handler=0;    -  c->resolve_cache_save = resolve_cache; -  resolve_cache = 0; +  if (c->resolve_cache) { +  free_mapping(c->resolve_cache); +  c->resolve_cache = 0; +  }       c->lex.current_line=1;    free_string(c->lex.current_file);    c->lex.current_file=make_shared_string("-");       if (runtime_options & RUNTIME_STRICT_TYPES)    {    c->lex.pragmas = ID_STRICT_TYPES;    } else {    c->lex.pragmas = 0;
pike.git/src/program.c:8267:    Pike_fatal("Failed to pop modules properly.\n");   #endif      #ifdef PIKE_DEBUG    if (c->compilation_depth != -1) {    fprintf(stderr, "compile(): compilation_depth is %d\n",    c->compilation_depth);    }   #endif /* PIKE_DEBUG */    -  if (resolve_cache) -  free_mapping(resolve_cache); -  resolve_cache = c->resolve_cache_save; +  if (c->resolve_cache) { +  free_mapping(c->resolve_cache); +  c->resolve_cache = NULL; +  }       verify_supporters();   }      static void zap_placeholder(struct compilation *c)   {    /* fprintf(stderr, "Destructing placeholder.\n"); */    if (c->placeholder->storage) {    yyerror("Placeholder already has storage!");   #if 0
pike.git/src/program.c:10201: Inside #if defined(FIND_FUNCTION_HASHSIZE)
   {    if(cache[e].name)    {    free_string(cache[e].name);    cache[e].name=0;    }    }   #endif      #ifdef DO_PIKE_CLEANUP -  if(resolve_cache) -  { -  free_mapping(dmalloc_touch (struct mapping *, resolve_cache)); -  resolve_cache=0; -  } -  +     if(pike_trampoline_program)    {    free_program(pike_trampoline_program);    pike_trampoline_program=0;    }       if(null_program)    {    free_program(null_program);    null_program=0;