pike.git / src / docode.c

version» Context lines:

pike.git/src/docode.c:2476:    BLOCK_END;    return 0;    }       case F_RETURN: {    struct statement_label *p;    int in_catch = 0;    int continue_label = -1;    do_docode(CAR(n),0);    +  if ((Pike_compiler->compiler_frame->generator_local != -1) && +  CDR(n) && CDR(n)->u.sval.u.integer) { +  /* Continue return. +  * +  * Note that we must save the stack before we start +  * popping marks etc in the label loop below. +  */ +  emit2(F_SAVE_STACK_TO_LOCAL, +  Pike_compiler->compiler_frame->generator_local + 1, 1); +  continue_label = alloc_label(); +  /* NB: Subtract 1 to compensate for starting cases at -1. */ +  emit1(F_NUMBER, +  Pike_compiler->compiler_frame->generator_index-1); +  emit1(F_ASSIGN_LOCAL_AND_POP, +  Pike_compiler->compiler_frame->generator_local); +  } +     /* Insert the appropriate number of F_ESCAPE_CATCH. The rest of    * the cleanup is handled wholesale in low_return et al.    * Alternatively we could handle this too in low_return and    * then allow tail recursion of these kind of returns too. */    for (p = current_label; p; p = p->prev) {    struct cleanup_frame *q;    for (q = p->cleanups; q; q = q->prev) {    if (q->cleanup == (cleanup_func) do_escape_catch) {    in_catch = 1;    do_escape_catch();
pike.git/src/docode.c:2502: Inside #if defined(PIKE_DEBUG)
   q->cleanup == (cleanup_func) do_cleanup_synch_mark) {    /* Use the ordinary pop mark instruction here since we know    * the stack isn't in synch and we don't want debug checks    * for that. */    do_pop_mark (NULL);    }   #endif    }    }    -  if ((Pike_compiler->compiler_frame->generator_local != -1) && -  CDR(n) && CDR(n)->u.sval.u.integer) { -  /* Continue return. */ -  emit1(F_SAVE_STACK_TO_LOCAL, -  Pike_compiler->compiler_frame->generator_local + 1); -  continue_label = alloc_label(); -  /* NB: Subtract 1 to compensate for starting cases at -1. */ -  emit1(F_NUMBER, -  Pike_compiler->compiler_frame->generator_index-1); -  emit1(F_ASSIGN_LOCAL_AND_POP, -  Pike_compiler->compiler_frame->generator_local); -  } -  +     emit0(in_catch ? F_VOLATILE_RETURN : F_RETURN);       if (continue_label != -1) {    modify_stack_depth(-1);    Pike_compiler->compiler_frame->generator_jumptable[    Pike_compiler->compiler_frame->generator_index++] =    ins_label(continue_label);    }    return 0;    }
pike.git/src/docode.c:2948:    emit0(F_START_FUNCTION);       if (Pike_compiler->compiler_frame->generator_local != -1) {    INT32 e, states;       /* Zap any initial junk on the stack. */    emit1(F_MARK_AT, 0);    emit0(F_POP_TO_MARK);       /* Restore the stack content and zap extra references. */ -  emit1(F_LOCAL, Pike_compiler->compiler_frame->generator_local + 1); -  emit0(F_PUSH_ARRAY_AND_EMPTY); +  emit1(F_RESTORE_STACK_FROM_LOCAL, +  Pike_compiler->compiler_frame->generator_local + 1);       /* Emit the state-machine switch for the generator. */    emit1(F_LOCAL, Pike_compiler->compiler_frame->generator_local);    emit1(F_NUMBER, -1);    emit1(F_ASSIGN_LOCAL_AND_POP,    Pike_compiler->compiler_frame->generator_local);    generator_switch = emit1(F_SWITCH, 0);    emit1(F_ALIGN, sizeof(INT32));       /* NB: Three implicit states: