}
}
+void ActorImpl::simcall_answer()
+{
+ if (this != simix_global->maestro_process){
+ XBT_DEBUG("Answer simcall %s (%d) issued by %s (%p)", SIMIX_simcall_name(simcall.call), (int)simcall.call,
+ get_cname(), this);
+ simcall.call = SIMCALL_NONE;
+ xbt_assert(not XBT_LOG_ISENABLED(simix_process, xbt_log_priority_debug) ||
+ std::find(begin(simix_global->actors_to_run), end(simix_global->actors_to_run), this) ==
+ end(simix_global->actors_to_run),
+ "Actor %p should not exist in actors_to_run!", this);
+ simix_global->actors_to_run.push_back(this);
+ }
+}
+
void ActorImpl::set_host(s4u::Host* dest)
{
xbt::intrusive_erase(host_->pimpl_->process_list_, *this);
smx_activity_t sync_suspend = actor->suspend(simcall->issuer);
if (actor != simcall->issuer) {
- SIMIX_simcall_answer(simcall);
+ simcall->issuer->simcall_answer();
} else {
sync_suspend->simcalls_.push_back(simcall);
actor->waiting_synchro = sync_suspend;
return process->get_cname();
}
-void simcall_HANDLER_process_join(smx_simcall_t simcall, smx_actor_t process, double timeout)
+void simcall_HANDLER_process_join(smx_simcall_t simcall, smx_actor_t actor, double timeout)
{
- if (process->finished_) {
+ if (actor->finished_) {
// The joined process is already finished, just wake up the issuer process right away
simcall_process_sleep__set__result(simcall, SIMIX_DONE);
- SIMIX_simcall_answer(simcall);
+ simcall->issuer->simcall_answer();
return;
}
- smx_activity_t sync = simcall->issuer->join(process, timeout);
+ smx_activity_t sync = simcall->issuer->join(actor, timeout);
sync->simcalls_.push_back(simcall);
simcall->issuer->waiting_synchro = sync;
}
if (MC_is_active() || MC_record_replay_is_active()) {
MC_process_clock_add(simcall->issuer, duration);
simcall_process_sleep__set__result(simcall, SIMIX_DONE);
- SIMIX_simcall_answer(simcall);
+ simcall->issuer->simcall_answer();
return;
}
smx_activity_t sync = simcall->issuer->sleep(duration);
*
* This function is generated from src/simix/simcalls.in
*/
-void simgrid::kernel::actor::ActorImpl::simcall_handle(int value)
-{
+void simgrid::kernel::actor::ActorImpl::simcall_handle(int value) {
XBT_DEBUG("Handling simcall %p: %s", &simcall, SIMIX_simcall_name(simcall.call));
SIMCALL_SET_MC_VALUE(simcall, value);
if (context_->iwannadie)
break;
case SIMCALL_PROCESS_JOIN:
- simcall_HANDLER_process_join(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]),
- simgrid::simix::unmarshal<double>(simcall.args[1]));
+ simcall_HANDLER_process_join(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]), simgrid::simix::unmarshal<double>(simcall.args[1]));
break;
case SIMCALL_PROCESS_SLEEP:
break;
case SIMCALL_EXECUTION_WAIT:
- simcall_HANDLER_execution_wait(&simcall,
- simgrid::simix::unmarshal<simgrid::kernel::activity::ExecImpl*>(simcall.args[0]));
+ simcall_HANDLER_execution_wait(&simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::ExecImpl*>(simcall.args[0]));
break;
case SIMCALL_EXECUTION_WAITANY_FOR:
- simcall_HANDLER_execution_waitany_for(
- &simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::ExecImpl**>(simcall.args[0]),
- simgrid::simix::unmarshal<size_t>(simcall.args[1]), simgrid::simix::unmarshal<double>(simcall.args[2]));
+ simcall_HANDLER_execution_waitany_for(&simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::ExecImpl**>(simcall.args[0]), simgrid::simix::unmarshal<size_t>(simcall.args[1]), simgrid::simix::unmarshal<double>(simcall.args[2]));
break;
case SIMCALL_EXECUTION_TEST:
- simcall_HANDLER_execution_test(&simcall,
- simgrid::simix::unmarshal<simgrid::kernel::activity::ExecImpl*>(simcall.args[0]));
+ simcall_HANDLER_execution_test(&simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::ExecImpl*>(simcall.args[0]));
break;
case SIMCALL_COMM_SEND:
- simcall_HANDLER_comm_send(
- &simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]),
- simgrid::simix::unmarshal<smx_mailbox_t>(simcall.args[1]), simgrid::simix::unmarshal<double>(simcall.args[2]),
- simgrid::simix::unmarshal<double>(simcall.args[3]),
- simgrid::simix::unmarshal<unsigned char*>(simcall.args[4]),
- simgrid::simix::unmarshal<size_t>(simcall.args[5]),
- simgrid::simix::unmarshal<simix_match_func_t>(simcall.args[6]),
- simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall.args[7]),
- simgrid::simix::unmarshal<void*>(simcall.args[8]), simgrid::simix::unmarshal<double>(simcall.args[9]));
+ simcall_HANDLER_comm_send(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]), simgrid::simix::unmarshal<smx_mailbox_t>(simcall.args[1]), simgrid::simix::unmarshal<double>(simcall.args[2]), simgrid::simix::unmarshal<double>(simcall.args[3]), simgrid::simix::unmarshal<unsigned char*>(simcall.args[4]), simgrid::simix::unmarshal<size_t>(simcall.args[5]), simgrid::simix::unmarshal<simix_match_func_t>(simcall.args[6]), simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall.args[7]), simgrid::simix::unmarshal<void*>(simcall.args[8]), simgrid::simix::unmarshal<double>(simcall.args[9]));
break;
case SIMCALL_COMM_ISEND:
- simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(
- simcall.result, simcall_HANDLER_comm_isend(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]),
- simgrid::simix::unmarshal<smx_mailbox_t>(simcall.args[1]),
- simgrid::simix::unmarshal<double>(simcall.args[2]),
- simgrid::simix::unmarshal<double>(simcall.args[3]),
- simgrid::simix::unmarshal<unsigned char*>(simcall.args[4]),
- simgrid::simix::unmarshal<size_t>(simcall.args[5]),
- simgrid::simix::unmarshal<simix_match_func_t>(simcall.args[6]),
- simgrid::simix::unmarshal<simix_clean_func_t>(simcall.args[7]),
- simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall.args[8]),
- simgrid::simix::unmarshal<void*>(simcall.args[9]),
- simgrid::simix::unmarshal<bool>(simcall.args[10])));
- SIMIX_simcall_answer(&simcall);
+ simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall.result, simcall_HANDLER_comm_isend(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]), simgrid::simix::unmarshal<smx_mailbox_t>(simcall.args[1]), simgrid::simix::unmarshal<double>(simcall.args[2]), simgrid::simix::unmarshal<double>(simcall.args[3]), simgrid::simix::unmarshal<unsigned char*>(simcall.args[4]), simgrid::simix::unmarshal<size_t>(simcall.args[5]), simgrid::simix::unmarshal<simix_match_func_t>(simcall.args[6]), simgrid::simix::unmarshal<simix_clean_func_t>(simcall.args[7]), simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall.args[8]), simgrid::simix::unmarshal<void*>(simcall.args[9]), simgrid::simix::unmarshal<bool>(simcall.args[10])));
+ simcall_answer();
break;
case SIMCALL_COMM_RECV:
- simcall_HANDLER_comm_recv(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]),
- simgrid::simix::unmarshal<smx_mailbox_t>(simcall.args[1]),
- simgrid::simix::unmarshal<unsigned char*>(simcall.args[2]),
- simgrid::simix::unmarshal<size_t*>(simcall.args[3]),
- simgrid::simix::unmarshal<simix_match_func_t>(simcall.args[4]),
- simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall.args[5]),
- simgrid::simix::unmarshal<void*>(simcall.args[6]),
- simgrid::simix::unmarshal<double>(simcall.args[7]),
- simgrid::simix::unmarshal<double>(simcall.args[8]));
+ simcall_HANDLER_comm_recv(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]), simgrid::simix::unmarshal<smx_mailbox_t>(simcall.args[1]), simgrid::simix::unmarshal<unsigned char*>(simcall.args[2]), simgrid::simix::unmarshal<size_t*>(simcall.args[3]), simgrid::simix::unmarshal<simix_match_func_t>(simcall.args[4]), simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall.args[5]), simgrid::simix::unmarshal<void*>(simcall.args[6]), simgrid::simix::unmarshal<double>(simcall.args[7]), simgrid::simix::unmarshal<double>(simcall.args[8]));
break;
case SIMCALL_COMM_IRECV:
- simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(
- simcall.result, simcall_HANDLER_comm_irecv(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]),
- simgrid::simix::unmarshal<smx_mailbox_t>(simcall.args[1]),
- simgrid::simix::unmarshal<unsigned char*>(simcall.args[2]),
- simgrid::simix::unmarshal<size_t*>(simcall.args[3]),
- simgrid::simix::unmarshal<simix_match_func_t>(simcall.args[4]),
- simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall.args[5]),
- simgrid::simix::unmarshal<void*>(simcall.args[6]),
- simgrid::simix::unmarshal<double>(simcall.args[7])));
- SIMIX_simcall_answer(&simcall);
+ simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall.result, simcall_HANDLER_comm_irecv(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]), simgrid::simix::unmarshal<smx_mailbox_t>(simcall.args[1]), simgrid::simix::unmarshal<unsigned char*>(simcall.args[2]), simgrid::simix::unmarshal<size_t*>(simcall.args[3]), simgrid::simix::unmarshal<simix_match_func_t>(simcall.args[4]), simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall.args[5]), simgrid::simix::unmarshal<void*>(simcall.args[6]), simgrid::simix::unmarshal<double>(simcall.args[7])));
+ simcall_answer();
break;
case SIMCALL_COMM_WAITANY:
- simcall_HANDLER_comm_waitany(
- &simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl**>(simcall.args[0]),
- simgrid::simix::unmarshal<size_t>(simcall.args[1]), simgrid::simix::unmarshal<double>(simcall.args[2]));
+ simcall_HANDLER_comm_waitany(&simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl**>(simcall.args[0]), simgrid::simix::unmarshal<size_t>(simcall.args[1]), simgrid::simix::unmarshal<double>(simcall.args[2]));
break;
case SIMCALL_COMM_WAIT:
- simcall_HANDLER_comm_wait(&simcall,
- simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall.args[0]),
- simgrid::simix::unmarshal<double>(simcall.args[1]));
+ simcall_HANDLER_comm_wait(&simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall.args[0]), simgrid::simix::unmarshal<double>(simcall.args[1]));
break;
case SIMCALL_COMM_TEST:
- simcall_HANDLER_comm_test(&simcall,
- simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall.args[0]));
+ simcall_HANDLER_comm_test(&simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall.args[0]));
break;
case SIMCALL_COMM_TESTANY:
- simcall_HANDLER_comm_testany(&simcall,
- simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl**>(simcall.args[0]),
- simgrid::simix::unmarshal<size_t>(simcall.args[1]));
+ simcall_HANDLER_comm_testany(&simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl**>(simcall.args[0]), simgrid::simix::unmarshal<size_t>(simcall.args[1]));
break;
case SIMCALL_MUTEX_LOCK:
break;
case SIMCALL_MUTEX_TRYLOCK:
- simgrid::simix::marshal<int>(
- simcall.result,
- simcall_HANDLER_mutex_trylock(&simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall.args[0])));
- SIMIX_simcall_answer(&simcall);
+ simgrid::simix::marshal<int>(simcall.result, simcall_HANDLER_mutex_trylock(&simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall.args[0])));
+ simcall_answer();
break;
case SIMCALL_MUTEX_UNLOCK:
simcall_HANDLER_mutex_unlock(&simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall.args[0]));
- SIMIX_simcall_answer(&simcall);
+ simcall_answer();
break;
case SIMCALL_COND_WAIT:
- simcall_HANDLER_cond_wait(&simcall, simgrid::simix::unmarshal<smx_cond_t>(simcall.args[0]),
- simgrid::simix::unmarshal<smx_mutex_t>(simcall.args[1]));
+ simcall_HANDLER_cond_wait(&simcall, simgrid::simix::unmarshal<smx_cond_t>(simcall.args[0]), simgrid::simix::unmarshal<smx_mutex_t>(simcall.args[1]));
break;
case SIMCALL_COND_WAIT_TIMEOUT:
- simcall_HANDLER_cond_wait_timeout(&simcall, simgrid::simix::unmarshal<smx_cond_t>(simcall.args[0]),
- simgrid::simix::unmarshal<smx_mutex_t>(simcall.args[1]),
- simgrid::simix::unmarshal<double>(simcall.args[2]));
+ simcall_HANDLER_cond_wait_timeout(&simcall, simgrid::simix::unmarshal<smx_cond_t>(simcall.args[0]), simgrid::simix::unmarshal<smx_mutex_t>(simcall.args[1]), simgrid::simix::unmarshal<double>(simcall.args[2]));
break;
case SIMCALL_SEM_ACQUIRE:
break;
case SIMCALL_SEM_ACQUIRE_TIMEOUT:
- simcall_HANDLER_sem_acquire_timeout(&simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall.args[0]),
- simgrid::simix::unmarshal<double>(simcall.args[1]));
+ simcall_HANDLER_sem_acquire_timeout(&simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall.args[0]), simgrid::simix::unmarshal<double>(simcall.args[1]));
break;
case SIMCALL_IO_WAIT:
break;
case SIMCALL_MC_RANDOM:
- simgrid::simix::marshal<int>(simcall.result,
- simcall_HANDLER_mc_random(&simcall, simgrid::simix::unmarshal<int>(simcall.args[0]),
- simgrid::simix::unmarshal<int>(simcall.args[1])));
- SIMIX_simcall_answer(&simcall);
+ simgrid::simix::marshal<int>(simcall.result, simcall_HANDLER_mc_random(&simcall, simgrid::simix::unmarshal<int>(simcall.args[0]), simgrid::simix::unmarshal<int>(simcall.args[1])));
+ simcall_answer();
break;
case SIMCALL_RUN_KERNEL:
SIMIX_run_kernel(simgrid::simix::unmarshal<std::function<void()> const*>(simcall.args[0]));
- SIMIX_simcall_answer(&simcall);
+ simcall_answer();
break;
case SIMCALL_RUN_BLOCKING:
case NUM_SIMCALLS:
break;
case SIMCALL_NONE:
- throw std::invalid_argument(simgrid::xbt::string_printf("Asked to do the noop syscall on %s@%s", get_cname(),
+ throw std::invalid_argument(simgrid::xbt::string_printf("Asked to do the noop syscall on %s@%s",
+ get_cname(),
sg_host_get_name(get_host())));
default:
THROW_IMPOSSIBLE;