Example #1
0
/**
 * move a stack state to the completed SCC set
 */
static void
move_scc (wctx_t *ctx, ref_t state)
{
    alg_local_t        *loc     = ctx->local;
    hash32_t            hash;
    int                 success;

    Debug ("Marking %zu as SCC", state);

    // remove reference to stack state
    hash    = ref_hash (state);
    success = fset_delete (loc->visited_states, &hash, &state);
    HREassert (success, "Could not remove SCC state from set");

    // set SCC globally
    state_store_try_color (state, SCC_STATE, 0);
}
Example #2
0
static void
endfs_handle_red (void *arg, state_info_t *successor, transition_info_t *ti, int seen)
{
    wctx_t             *ctx = (wctx_t *) arg;
    alg_local_t        *loc = ctx->local;
    cndfs_alg_local_t  *cloc = (cndfs_alg_local_t *) ctx->local;
    int                 onstack;

    /* Find cycle back to the seed */
    HREassert (cloc->accepting_depth > 0);
    size_t             *level;
    onstack = ctx->state->ref == loc->seed->ref;
    if (!onstack) {
        onstack = fset_find (cloc->pink, NULL, &successor->ref, (void**)&level, false);
        HREassert (onstack != FSET_FULL);
    }

    if ( onstack && *level < cloc->accepting_depth )
        ndfs_report_cycle (ctx, ctx->model, loc->stack, successor);
    /* Mark states dangerous if necessary */
    if ( Strat_ENDFS == loc->strat &&
         pins_state_is_accepting(ctx->model, state_info_state(successor)) &&
         state_store_get_colors (successor->ref) != CRED )
        state_store_try_color(successor->ref, GDANGEROUS, loc->rec_bits);

    if ( !onstack && state_store_get_colors (successor->ref) != CRED ) {
        raw_data_t stack_loc = dfs_stack_push (loc->stack, NULL);
        state_info_serialize (successor, stack_loc);
    }

    // check proviso
    if (PINS_POR && proviso == Proviso_CNDFS && cloc->successors == NONEC) {
        if (ti->por_proviso != 0) { // state already fully expanded
            cloc->successors = SRCINV;
        } else if (onstack) { // cycle check
            if (onstack) cloc->successors = CYCLE;
        }
        // avoid full exploration (proviso is enforced later in backtrack)
        ti->por_proviso = 1; // avoid full exploration
    }
    (void) seen;
}