target/whirl.c
static void reset_to_after_jump(WhirlCodeSegment *segment, RingState *state) {
    generate_op_command(segment, state, OP_ZERO);
    generate_op_command(segment, state, OP_STORE);

    if (state->cur_math_pos != MATH_NOOP || state->math_dir != CLOCKWISE) {
        if (state->active_ring == OPERATION_RING) {
            emit_zero(segment, state);
            emit_zero(segment, state);
        }
        if (state->cur_math_pos == MATH_NOOP) {
            emit_one(segment, state);
            emit_zero(segment, state);
            emit_one(segment, state);
        }
        else {
            if (state->math_dir == COUNTERCLOCKWISE) {
                emit_zero(segment, state);
            }
            while (state->cur_math_pos != MATH_NOOP) {
                emit_one(segment, state);
            }
        }
    }

    if (state->active_ring == MATH_RING) {
        emit_zero(segment, state);
        emit_zero(segment, state);
    }

    if (state->op_dir != CLOCKWISE) {
        if (state->cur_op_pos == OP_IF) {
            emit_one(segment, state);
            emit_zero(segment, state);
            emit_one(segment, state);
        }
        else {
            emit_zero(segment, state);
        }
    }

    while (state->cur_op_pos != OP_IF) {
        emit_one(segment, state);
    }

    emit_zero(segment, state);
    emit_zero(segment, state);
}
// Resets the rings so that they're in the state that we're expecting after
// executing a jump instruction. The state we expect is: math ring is selected,
// both rings are going clockwise, and the selected commands are MATH_NOP and OP_IF
Resets the rings so that they're in the state that we're expecting after
executing a jump instruction. The state we expect is: math ring is selected,
both rings are going clockwise, and the selected commands are MATH_NOP and OP_IF
Resets the rings so that they ' re in the state that we ' re expecting after executing a jump instruction . The state we expect is : math ring is selected both rings are going clockwise and the selected commands are MATH_NOP and OP_IF
static void reset_to_after_jump(WhirlCodeSegment *segment, RingState *state) {
    generate_op_command(segment, state, OP_ZERO);
    generate_op_command(segment, state, OP_STORE);
    if (state->cur_math_pos != MATH_NOOP || state->math_dir != CLOCKWISE) {
        if (state->active_ring == OPERATION_RING) {
            emit_zero(segment, state);
            emit_zero(segment, state);
        }
        if (state->cur_math_pos == MATH_NOOP) {
            emit_one(segment, state);
            emit_zero(segment, state);
            emit_one(segment, state);
        }
        else {
            if (state->math_dir == COUNTERCLOCKWISE) {
                emit_zero(segment, state);
            }
            while (state->cur_math_pos != MATH_NOOP) {
                emit_one(segment, state);
            }
        }
    }
    if (state->active_ring == MATH_RING) {
        emit_zero(segment, state);
        emit_zero(segment, state);
    }
    if (state->op_dir != CLOCKWISE) {
        if (state->cur_op_pos == OP_IF) {
            emit_one(segment, state);
            emit_zero(segment, state);
            emit_one(segment, state);
        }
        else {
            emit_zero(segment, state);
        }
    }
    while (state->cur_op_pos != OP_IF) {
        emit_one(segment, state);
    }
    emit_zero(segment, state);
    emit_zero(segment, state);
}
static void reset_to_after_jump ( WhirlCodeSegment * segment , RingState * state ) { generate_op_command ( segment , state , OP_ZERO ) ; generate_op_command ( segment , state , OP_STORE ) ; if ( state -> cur_math_pos != MATH_NOOP || state -> math_dir != CLOCKWISE ) { if ( state -> active_ring == OPERATION_RING ) { emit_zero ( segment , state ) ; emit_zero ( segment , state ) ; } if ( state -> cur_math_pos == MATH_NOOP ) { emit_one ( segment , state ) ; emit_zero ( segment , state ) ; emit_one ( segment , state ) ; } else { if ( state -> math_dir == COUNTERCLOCKWISE ) { emit_zero ( segment , state ) ; } while ( state -> cur_math_pos != MATH_NOOP ) { emit_one ( segment , state ) ; } } } if ( state -> active_ring == MATH_RING ) { emit_zero ( segment , state ) ; emit_zero ( segment , state ) ; } if ( state -> op_dir != CLOCKWISE ) { if ( state -> cur_op_pos == OP_IF ) { emit_one ( segment , state ) ; emit_zero ( segment , state ) ; emit_one ( segment , state ) ; } else { emit_zero ( segment , state ) ; } } while ( state -> cur_op_pos != OP_IF ) { emit_one ( segment , state ) ; } emit_zero ( segment , state ) ; emit_zero ( segment , state ) ; }
Resets the rings so that they're in the state that we're expecting after
executing a jump instruction.
Resets the rings so that they ' re in the state that we ' re expecting after executing a jump instruction .