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.484 2003/11/25 18:29:30 jonasw Exp $ + || $Id: program.c,v 1.485 2004/03/13 13:22:39 grubba Exp $   */      #include "global.h" - RCSID("$Id: program.c,v 1.484 2003/11/25 18:29:30 jonasw Exp $"); + RCSID("$Id: program.c,v 1.485 2004/03/13 13:22:39 grubba 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:1400:   {    INT32 i,e,t;    struct program *p=Pike_compiler->new_program;       if(p->flags & PROGRAM_FIXED) return;   #ifdef PIKE_DEBUG    if(p->flags & PROGRAM_OPTIMIZED)    Pike_fatal("Cannot fixate optimized program\n");   #endif    +  /* Fixup identifier overrides. */ +  for (i = 0; i < p->num_identifier_references; i++) { +  struct reference *ref = p->identifier_references + i; +  if (ref->id_flags & ID_HIDDEN) continue; +  if (ref->inherit_offset != 0) continue; +  override_identifier (ref, ID_FROM_PTR (p, ref)->name); +  } +     /* Ok, sort for binsearch */    for(e=i=0;i<(int)p->num_identifier_references;i++)    {    struct reference *funp;    struct identifier *fun;    funp=p->identifier_references+i;    if(funp->id_flags & (ID_HIDDEN|ID_STATIC)) continue;    fun=ID_FROM_PTR(p, funp);    if(funp->id_flags & ID_INHERITED)    {
pike.git/src/program.c:1475:    p);          /* Yes, it is supposed to start at 1 /Hubbe */    for(i=1;i<NUM_LFUNS;i++) {    p->lfuns[i] = low_find_lfun(p, i);    }       p->flags |= PROGRAM_FIXED;    -  if(Pike_compiler->check_final) +  if(Pike_compiler->flags & COMPILATION_CHECK_FINAL)    {    for(i=0;i<(int)p->num_identifier_references;i++)    {    if((p->identifier_references[i].id_flags & (ID_NOMASK|ID_HIDDEN)) ==    ID_NOMASK)    {    struct pike_string *name=ID_FROM_INT(p, i)->name;       e=find_shared_string_identifier(name,p);    if(e == -1)
pike.git/src/program.c:1588:       DOUBLELINK(first_program, p);    GETTIMEOFDAY(& p->timestamp);    return p;   }      /*    * Start building a new program    */   void low_start_new_program(struct program *p, +  int pass,    struct pike_string *name,    int flags,    int *idp)   { -  int e,id=0; +  int id=0;    struct svalue tmp;      #if 0   #ifdef SHARED_NODES    if (!node_hash.table) {    node_hash.table = malloc(sizeof(node *)*32831);    if (!node_hash.table) {    Pike_fatal("Out of memory!\n");    }    MEMSET(node_hash.table, 0, sizeof(node *)*32831);
pike.git/src/program.c:1633: Inside #if 0
  #if 0    fprintf(stderr,"Compiling class %s, depth=%d\n",name->str,compilation_depth);    }else{    fprintf(stderr,"Compiling file %s, depth=%d\n",    lex.current_file ? lex.current_file->str : "-",    compilation_depth);   #endif    }    if(compilation_depth >= 1)    add_ref(p->parent = Pike_compiler->new_program); -  e=1; +     }else{    tmp.u.program=p;    add_ref(p);    if(name)    {    struct identifier *i;    id=isidentifier(name);    if (id < 0)    Pike_fatal("Program constant disappeared in second pass.\n");    i=ID_FROM_INT(Pike_compiler->new_program, id);    free_type(i->type);    i->type=get_type_of_svalue(&tmp);    } -  e=2; +     }    p->flags &=~ PROGRAM_VIRGIN;    Pike_compiler->parent_identifier=id;    if(idp) *idp=id;       CDFPRINTF((stderr, "th(%ld) %p low_start_new_program() %s "    "pass=%d: threads_disabled:%d, compilation_depth:%d\n",    (long)th_self(), p, name ? name->str : "-",    Pike_compiler->compiler_pass,    threads_disabled, compilation_depth));       init_type_stack();      #define PUSH   #include "compilation.h"    -  Pike_compiler->compiler_pass=e; +  Pike_compiler->compiler_pass = pass;       Pike_compiler->num_used_modules=0;       if(p && (p->flags & PROGRAM_FINISHED))    {    yyerror("Pass2: Program already done");    p=0;    }       Pike_compiler->malloc_size_program = ALLOC_STRUCT(program);
pike.git/src/program.c:1847:       lex.current_file = make_shared_string(f);    lex.current_line = line;    }       CDFPRINTF((stderr,    "th(%ld) start_new_program(%d, %s): "    "threads_disabled:%d, compilation_depth:%d\n",    (long)th_self(), line, file, threads_disabled, compilation_depth));    -  low_start_new_program(0,0,0,0); +  low_start_new_program(0,1,0,0,0);    store_linenumber(line,lex.current_file);    debug_malloc_name(Pike_compiler->new_program, file, line);       free_string(lex.current_file);    lex.current_file = save_file;    lex.current_line = save_line;   }         static void exit_program_struct(struct program *p)
pike.git/src/program.c:3263:    struct reference fun;    struct pike_string *name;       fun = p->identifier_references[e]; /* Make a copy */       name=ID_FROM_PTR(p,&fun)->name;    fun.inherit_offset += inherit_offset;       if (fun.id_flags & ID_NOMASK)    { -  Pike_compiler->check_final++; +  Pike_compiler->flags |= COMPILATION_CHECK_FINAL;    }       if(fun.id_flags & ID_PRIVATE) fun.id_flags|=ID_HIDDEN;       if (fun.id_flags & ID_PUBLIC)    fun.id_flags |= flags & ~ID_PRIVATE;    else    fun.id_flags |= flags;       fun.id_flags |= ID_INHERITED;
pike.git/src/program.c:5210:    yyparse(); /* Parse da program */ \    if(save_sp != Pike_sp) \    Pike_fatal("yyparse() left %"PRINTPTRDIFFT"d droppings on the stack!\n", \    Pike_sp - save_sp); \   }while(0)   #else   #define do_yyparse() yyparse()   #endif      struct Supporter *current_supporter=0; - int force_resolve = 0; +          #ifdef PIKE_DEBUG      struct supporter_marker   {    struct supporter_marker *next;    void *data;    int level, verified;   };
pike.git/src/program.c:5415:    verify_supporters();    }    return ok;   }      int report_compiler_dependency(struct program *p)   {    int ret=0;    struct Supporter *c,*cc;    verify_supporters(); -  if (force_resolve) +  if (Pike_compiler->flags & COMPILATION_FORCE_RESOLVE)    return 0;    for(cc=current_supporter;cc;cc=cc->previous)    {    if(cc->prog &&    !(cc->prog->flags & PROGRAM_PASS_1_DONE))    {    c=cc->depends_on;    if(!c) c=cc->previous;    for(;c;c=c->previous)    {
pike.git/src/program.c:5617:    (long)th_self(),compilation_depth));   #endif       if(c->placeholder && c->placeholder->prog != null_program)    Pike_error("Placeholder object is not a null_program clone!\n");    debug_malloc_touch(c->placeholder);       if(c->target && !(c->target->flags & PROGRAM_VIRGIN))    Pike_error("Placeholder program is not virgin!\n");    -  low_start_new_program(c->target,0,0,0); +  low_start_new_program(c->target,1,0,0,0);    c->supporter.prog = Pike_compiler->new_program;       CDFPRINTF((stderr,    "th(%ld) %p run_pass1() start: "    "threads_disabled:%d, compilation_depth:%d\n",    (long)th_self(), Pike_compiler->new_program,    threads_disabled, compilation_depth));       Pike_compiler->compiler_pass=1;    run_init2(c);
pike.git/src/program.c:5697:    verify_supporters();    return ret;   }      void run_pass2(struct compilation *c)   {    debug_malloc_touch(c);    debug_malloc_touch(c->placeholder);       run_init(c); -  low_start_new_program(c->p,0,0,0); +  low_start_new_program(c->p,2,0,0,0);    free_program(c->p);    c->p=0;       Pike_compiler->compiler_pass=2;       run_init2(c);       CDFPRINTF((stderr,    "th(%ld) %p run_pass2() start: "    "threads_disabled:%d, compilation_depth:%d\n",