pike.git / src / interpret.c

version» Context lines:

pike.git/src/interpret.c:23:   #include "lex.h"   #include "builtin_functions.h"   #include "signal_handler.h"   #include "gc.h"   #include "threads.h"   #include "callback.h"   #include "fd_control.h"   #include "bignum.h"   #include "pike_types.h"   #include "pikecode.h" + #include "pike_compiler.h"      #include <fcntl.h>   #include <errno.h>   #include <ctype.h>      #ifdef HAVE_MMAP      #ifdef HAVE_SYS_MMAN_H   #include <sys/mman.h>   #endif
pike.git/src/interpret.c:2956:    * since this is needed for opcodes that use INHERIT_FROM_*    * (eg F_EXTERN) to work.    */    for (fun = prog->num_identifier_references; fun--;) {    if (!prog->identifier_references[fun].inherit_offset) {    use_dummy_reference = 0;    break;    }    }    -  if (use_dummy_reference) { +  if (use_dummy_reference && +  /* NB: add_to_*() are only valid in the first pass! */ +  (Pike_compiler->compiler_pass == COMPILER_PASS_FIRST) && +  (Pike_compiler->new_program == prog)) {    /* No suitable function was found, so add one. */    struct identifier dummy;    struct reference dummy_ref = {    0, 0, ID_HIDDEN,    PIKE_T_UNKNOWN, { 0, },    };    /* FIXME: Assert that o->prog == Pike_compiler->new_program */    copy_shared_string(dummy.name, empty_pike_string);    copy_pike_type(dummy.type, function_type_string);    dummy.filename_strno = -1;    dummy.linenumber = 0;    dummy.run_time_type = PIKE_T_FUNCTION;    dummy.identifier_flags = IDENTIFIER_PIKE_FUNCTION|IDENTIFIER_HAS_BODY;    dummy.func.offset = offset;    dummy.opt_flags = 0;    dummy_ref.identifier_offset = prog->num_identifiers;    add_to_identifiers(dummy);    fun = prog->num_identifier_references;    add_to_identifier_references(dummy_ref); -  +  } else if (use_dummy_reference) { +  /* FIXME: Hope that we don't have any F_EXTERN et al. */ +  fun = 0; +  use_dummy_reference = 0;    }       /* FIXME: Is this up-to-date with mega_apply? */    new_frame->next = Pike_fp;    add_ref(new_frame->current_object = o);    add_ref(new_frame->current_program = prog);    new_frame->context = prog->inherits;    new_frame->locals = Pike_sp;    new_frame->args = 0;    new_frame->num_args=0;