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.577 2004/11/06 08:41:30 nilsson Exp $ + || $Id: program.c,v 1.578 2004/12/08 15:38:35 grubba 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:1630:   }      #define ID_TO_PROGRAM_CACHE_SIZE 512   struct program *id_to_program_cache[ID_TO_PROGRAM_CACHE_SIZE];      struct program *id_to_program(INT32 id)   {    struct program *p;    INT32 h;    if(!id) return 0; +  +  /* fprintf(stderr, "id_to_program(%d)... ", id); */ +     h=id & (ID_TO_PROGRAM_CACHE_SIZE-1);       if((p=id_to_program_cache[h])) -  if(p->id==id) +  if(p->id==id) { +  /* fprintf(stderr, "cached: %p\n", p); */    return p; -  +  }       for(p=first_program;p;p=p->next)    {    if(id==p->id)    {    id_to_program_cache[h]=p; -  +  /* fprintf(stderr, "found: %p\n", p); */    return p;    }    }       if ((id > 0) && (id < PROG_DYNAMIC_ID_START)) {    /* Reserved id. Attempt to load the proper dynamic module    * to resolv the id.    */    char *module = NULL;    -  +  /* fprintf(stderr, "reserved "); */ +     switch(id) {    case PROG_PARSER_HTML_ID:    module = "Parser._parser";    break;    case PROG_GMP_MPZ_ID:    module = "Gmp";    break;    case PROG_MODULE_MIME_ID:    module = "___MIME";    break;    default:    if ((id >= 100) && (id <= 300)) {    module = "Image";    } else if ((id >= 1000) && (id <= 2000)) {    module = "___GTK";    }    break;    }    if (module) { -  +  /* fprintf(stderr, "%s... ", module); */    push_text(module);    SAFE_APPLY_MASTER("resolv", 1);    pop_stack();       /* Try again... */    for(p=first_program;p;p=p->next)    {    if(id==p->id)    {    id_to_program_cache[h]=p; -  +  /* fprintf(stderr, "found: %p\n", p); */    return p;    }    }    }    } -  +  /* fprintf(stderr, "not found\n"); */    return 0;   }      /* Here starts routines which are used to build new programs */      /* Re-allocate all the memory in the program in one chunk. because:    * 1) The individual blocks are much bigger than they need to be    * 2) cuts down on malloc overhead (maybe)    * 3) localizes memory access (decreases paging)    */
pike.git/src/program.c:2081:   #endif /* SHARED_NODES */   #endif /* 0 */       /* We don't want to change thread, but we don't want to    * wait for the other threads to complete.    */    low_init_threads_disable();       compilation_depth++;    +  if (!Pike_compiler->compiler_frame) { +  new_node_s_context(); +  } +     tmp.type=T_PROGRAM;    if(!p)    {    p=low_allocate_program();    if(name)    {    tmp.u.program=p;    id=add_constant(name, &tmp, flags & ~ID_EXTERN);   #if 0    fprintf(stderr,"Compiling class %s, depth=%d\n",name->str,compilation_depth);