pike.git / src / program.c

version» Context lines:

pike.git/src/program.c:3915:    *    * 0: First pass.    * 1: Last pass.    * 2: Called from decode_value().    */   struct program *end_first_pass(int finish)   {    struct compilation *c = THIS_COMPILATION;    int e;    struct program *prog = Pike_compiler->new_program; -  struct pike_string *s; +  struct pike_string *init_name;    int num_refs = prog->num_identifier_references;    union idptr dispatch_fun;       dispatch_fun.c_fun = f_dispatch_variant;       /* Collect variant functions that have been defined in this program,    * and add the corresponding dispatchers.    */    for (e = 0; e < num_refs; e++) {    struct identifier *id;
pike.git/src/program.c:3984:    id->type = type;    id->opt_flags = opt_flags;    prog->identifier_references[e].id_flags |= id_flags & ~(ID_VARIANT|ID_LOCAL);    next_ref:    ;    }       debug_malloc_touch(Pike_compiler->fake_object);    debug_malloc_touch(Pike_compiler->fake_object->storage);    -  MAKE_CONST_STRING(s,"__INIT"); +  init_name = lfun_strings[LFUN___INIT];    -  +     /* Collect references to inherited __INIT functions */    if (!(Pike_compiler->new_program->flags & PROGRAM_AVOID_CHECK)) {    for(e=Pike_compiler->new_program->num_inherits-1;e;e--)    {    int id;    if(Pike_compiler->new_program->inherits[e].inherit_level!=1) continue;    id = Pike_compiler->new_program->inherits[e].prog->lfuns[LFUN___INIT];    id = really_low_reference_inherited_identifier(0, e, id);    if(id!=-1)    {
pike.git/src/program.c:4012:    }    }       if (finish == 1) {    if (Pike_compiler->compiler_pass == 1) {    /* Called from end_program(). */    if (Pike_compiler->init_node) {    /* Make sure that the __INIT symbol exists, so that    * we won't get a fatal when we add the actual code    * further down when we have entered pass 2. +  * +  * Also make sure that it is marked as having side effects, +  * or it will be optimized away when inherited...    */ -  define_function(s, function_type_string, ID_PROTECTED, -  IDENTIFIER_PIKE_FUNCTION, NULL, 0); +  define_function(init_name, function_type_string, ID_PROTECTED, +  IDENTIFIER_PIKE_FUNCTION, NULL, +  OPT_SIDE_EFFECT|OPT_EXTERNAL_DEPEND);    }    }    Pike_compiler->compiler_pass = 2;    }       /*    * Define the __INIT function, but only if there was any code    * to initialize.    */       if(Pike_compiler->init_node)    { -  +  /* Inhibit this_function. */    Pike_compiler->compiler_frame->current_function_number = -2; -  e=dooptcode(s, +  +  e=dooptcode(init_name,    mknode(F_COMMA_EXPR,    Pike_compiler->init_node,    mknode(F_RETURN,mkintnode(0),0)),    function_type_string,    ID_PROTECTED);    Pike_compiler->init_node=0;    } else if (finish == 2) {    /* Called from decode_value(). */    e = low_find_lfun(Pike_compiler->new_program, LFUN___INIT);    if ((e != -1) &&