pike.git / src / interpret.c

version» Context lines:

pike.git/src/interpret.c:3069:   int apply_low_safe_and_stupid(struct object *o, INT32 offset)   {    JMP_BUF tmp;    struct pike_frame *new_frame=alloc_pike_frame();    int ret;    volatile int use_dummy_reference = 1;    struct program *prog = o->prog;    int p_flags = prog->flags;    LOW_JMP_BUF *saved_jmpbuf;    int fun = -1; +  int save_compiler_pass = Pike_compiler->compiler_pass;       /* Search for a function that belongs to the current program,    * 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 && + #ifdef PIKE_DEBUG +  if (Pike_compiler->new_program != prog) { +  Pike_fatal("Invalid use of apply_low_save_and_stupid().\n"); +  } + #endif /* PIKE_DEBUG */ +     /* NB: add_to_*() are only valid in the first pass! */ -  (Pike_compiler->compiler_pass == COMPILER_PASS_FIRST) && -  (Pike_compiler->new_program == prog)) { +  Pike_compiler->compiler_pass = COMPILER_PASS_FIRST; +  if (use_dummy_reference) {    /* 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;
pike.git/src/interpret.c:3155: Inside #if defined(PIKE_DEBUG)
   if (tmp != -1)    Pike_fatal ("Unexpected return value from eval_instruction: %d\n", tmp);    if(Pike_sp<Pike_interpreter.evaluator_stack)    Pike_fatal("Stack error (simple).\n");   #endif    ret=0;    }    UNSETJMP(tmp);       Pike_interpreter.catching_eval_jmpbuf = saved_jmpbuf; +  Pike_compiler->compiler_pass = save_compiler_pass;       if (use_dummy_reference) {    /* Pop the dummy identifier. */    free_type(function_type_string);    free_string(empty_pike_string);    prog->num_identifier_references--;    prog->num_identifiers--;    }       assert (new_frame == Pike_fp);