mc_comm_pattern_t comm;
unsigned int cursor;
state->incomplete_comm_pattern = xbt_dynar_new(sizeof(xbt_dynar_t), xbt_dynar_free_voidp);
- for (i=0; i<simix_process_maxpid; i++) {
+ for (i=0; i < MC_smx_get_maxpid(); i++) {
incomplete_process_comms = xbt_dynar_get_as(incomplete_communications_pattern, i, xbt_dynar_t);
xbt_dynar_t incomplete_process_comms_copy = xbt_dynar_new(sizeof(mc_comm_pattern_t), comm_pattern_free_voidp);
xbt_dynar_foreach(incomplete_process_comms, cursor, comm) {
*/
mc_state_t MC_state_new()
{
- mc_state_t state = NULL;
-
- state = xbt_new0(s_mc_state_t, 1);
- state->max_pid = simix_process_maxpid;
+ mc_state_t state = xbt_new0(s_mc_state_t, 1);
+ state->max_pid = MC_smx_get_maxpid();
state->proc_status = xbt_new0(s_mc_procstate_t, state->max_pid);
state->system_state = NULL;
state->num = ++mc_stats->expanded_states;
case SIMCALL_COMM_WAITANY:
state->internal_req.call = SIMCALL_COMM_WAIT;
state->internal_req.issuer = req->issuer;
- // FIXME, read from remote process
- state->internal_comm =
- *xbt_dynar_get_as(simcall_comm_waitany__get__comms(req), value,
- smx_synchro_t);
+ MC_process_read_dynar_element(&mc_model_checker->process,
+ &state->internal_comm, simcall_comm_waitany__get__comms(req),
+ sizeof(state->internal_comm));
simcall_comm_wait__set__comm(&state->internal_req, &state->internal_comm);
simcall_comm_wait__set__timeout(&state->internal_req, 0);
break;
if (value > 0)
// FIXME, read from remote process
- state->internal_comm =
- *xbt_dynar_get_as(simcall_comm_testany__get__comms(req), value,
- smx_synchro_t);
+ MC_process_read_dynar_element(&mc_model_checker->process,
+ &state->internal_comm, simcall_comm_testany__get__comms(req),
+ sizeof(state->internal_comm));
simcall_comm_test__set__comm(&state->internal_req, &state->internal_comm);
simcall_comm_test__set__result(&state->internal_req, value);
case SIMCALL_COMM_WAIT:
state->internal_req = *req;
- // FIXME, read from remote process
- state->internal_comm = *(simcall_comm_wait__get__comm(req));
+ MC_process_read_simple(&mc_model_checker->process, &state->internal_comm ,
+ simcall_comm_wait__get__comm(req), sizeof(state->internal_comm));
simcall_comm_wait__set__comm(&state->executed_req, &state->internal_comm);
simcall_comm_wait__set__comm(&state->internal_req, &state->internal_comm);
break;
case SIMCALL_COMM_TEST:
state->internal_req = *req;
- // FIXME, read from remote process
- state->internal_comm = *simcall_comm_test__get__comm(req);
+ MC_process_read_simple(&mc_model_checker->process, &state->internal_comm,
+ simcall_comm_test__get__comm(req), sizeof(state->internal_comm));
simcall_comm_test__set__comm(&state->executed_req, &state->internal_comm);
simcall_comm_test__set__comm(&state->internal_req, &state->internal_comm);
break;
MC_EACH_SIMIX_PROCESS(process,
procstate = &state->proc_status[process->pid];
- if (procstate->state == MC_INTERLEAVE
- || procstate->state == MC_MORE_INTERLEAVE) {
- if (MC_process_is_enabled(process)) {
- switch (process->simcall.call) {
+ if (procstate->state != MC_INTERLEAVE
+ && procstate->state != MC_MORE_INTERLEAVE)
+ continue;
+ if (!MC_process_is_enabled(process))
+ continue;
+
+ switch (process->simcall.call) {
case SIMCALL_COMM_WAITANY:
*value = -1;
while (procstate->interleave_count <
*value = 0;
return &process->simcall;
break;
- }
- }
+
}
);