From: Martin Quinson Date: Sat, 30 Jun 2018 13:29:44 +0000 (+0200) Subject: Partially snake_case ActorImpl X-Git-Tag: v3_21~589 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/4ebc53f4ea63c0ec84680e5484ad9c9a81c85ff3 Partially snake_case ActorImpl I'm sick of snake casing, this one will have to wait. --- diff --git a/include/simgrid/s4u/Actor.hpp b/include/simgrid/s4u/Actor.hpp index 46e268b5b3..e3a0f6b8b5 100644 --- a/include/simgrid/s4u/Actor.hpp +++ b/include/simgrid/s4u/Actor.hpp @@ -230,7 +230,7 @@ public: void yield(); /** Returns true if the actor is suspended. */ - int is_suspended(); + bool is_suspended(); /** If set to true, the actor will automatically restart when its host reboots */ void set_auto_restart(bool autorestart); diff --git a/src/bindings/java/JavaContext.cpp b/src/bindings/java/JavaContext.cpp index 87c5e9e229..e6029143af 100644 --- a/src/bindings/java/JavaContext.cpp +++ b/src/bindings/java/JavaContext.cpp @@ -48,7 +48,7 @@ JavaContext* JavaContextFactory::create_context( void JavaContextFactory::run_all() { for (smx_actor_t const& process : simgrid::simix::process_get_runnable()) { - static_cast(process->context)->resume(); + static_cast(process->context_)->resume(); } } diff --git a/src/bindings/java/jmsg_process.cpp b/src/bindings/java/jmsg_process.cpp index 1d68839c45..d1e554b84e 100644 --- a/src/bindings/java/jmsg_process.cpp +++ b/src/bindings/java/jmsg_process.cpp @@ -25,7 +25,8 @@ jfieldID jprocess_field_Process_ppid; jobject jprocess_from_native(msg_process_t process) { - simgrid::kernel::context::JavaContext* context = (simgrid::kernel::context::JavaContext*)process->get_impl()->context; + simgrid::kernel::context_::JavaContext* context = + (simgrid::kernel::context_::JavaContext*)process->get_impl()->context_; return context->jprocess; } @@ -73,7 +74,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_create(JNIEnv* env, jobject jstring jname = (jstring)env->GetObjectField(jprocess, jprocess_field_Process_name); const char* name = env->GetStringUTFChars(jname, 0); msg_process_t process = - MSG_process_create_from_stdfunc(name, [jprocess]() { simgrid::kernel::context::java_main_jprocess(jprocess); }, + MSG_process_create_from_stdfunc(name, [jprocess]() { simgrid::kernel::context_::java_main_jprocess(jprocess); }, /*data*/ nullptr, jhost_get_native(env, jhost), /* properties*/ nullptr); env->ReleaseStringUTFChars(jname, name); diff --git a/src/kernel/activity/ConditionVariableImpl.cpp b/src/kernel/activity/ConditionVariableImpl.cpp index 84190d0180..d59d8997e9 100644 --- a/src/kernel/activity/ConditionVariableImpl.cpp +++ b/src/kernel/activity/ConditionVariableImpl.cpp @@ -28,7 +28,7 @@ static void _SIMIX_cond_wait(smx_cond_t cond, smx_mutex_t mutex, double timeout, mutex->unlock(issuer); } - synchro = SIMIX_synchro_wait(issuer->host, timeout); + synchro = SIMIX_synchro_wait(issuer->host_, timeout); synchro->simcalls_.push_front(simcall); issuer->waiting_synchro = synchro; cond->sleeping.push_back(*simcall->issuer); diff --git a/src/kernel/activity/MutexImpl.cpp b/src/kernel/activity/MutexImpl.cpp index 2a68661fd7..9581637a40 100644 --- a/src/kernel/activity/MutexImpl.cpp +++ b/src/kernel/activity/MutexImpl.cpp @@ -34,7 +34,7 @@ void MutexImpl::lock(smx_actor_t issuer) if (this->locked) { /* FIXME: check if the host is active ? */ /* Somebody using the mutex, use a synchronization to get host failures */ - synchro = SIMIX_synchro_wait(issuer->host, -1); + synchro = SIMIX_synchro_wait(issuer->host_, -1); synchro->simcalls_.push_back(&issuer->simcall); issuer->waiting_synchro = synchro; this->sleeping.push_back(*issuer); @@ -81,7 +81,7 @@ void MutexImpl::unlock(smx_actor_t issuer) /* If the mutex is not owned by the issuer, that's not good */ if (issuer != this->owner) THROWF(mismatch_error, 0, "Cannot release that mutex: it was locked by %s (pid:%ld), not by you.", - this->owner->get_cname(), this->owner->pid); + this->owner->get_cname(), this->owner->pid_); if (not this->sleeping.empty()) { /*process to wake up */ diff --git a/src/kernel/activity/SleepImpl.cpp b/src/kernel/activity/SleepImpl.cpp index aea4da1f48..041440eeda 100644 --- a/src/kernel/activity/SleepImpl.cpp +++ b/src/kernel/activity/SleepImpl.cpp @@ -34,7 +34,7 @@ void simgrid::kernel::activity::SleepImpl::post() e_smx_state_t result; switch (surf_sleep->get_state()) { case simgrid::kernel::resource::Action::State::FAILED: - simcall->issuer->context->iwannadie = 1; + simcall->issuer->context_->iwannadie = 1; result = SIMIX_SRC_HOST_FAILURE; break; @@ -46,14 +46,14 @@ void simgrid::kernel::activity::SleepImpl::post() THROW_IMPOSSIBLE; break; } - if (simcall->issuer->host->is_off()) { - simcall->issuer->context->iwannadie = 1; + if (simcall->issuer->host_->is_off()) { + simcall->issuer->context_->iwannadie = 1; } simcall_process_sleep__set__result(simcall, result); simcall->issuer->waiting_synchro = nullptr; - if (simcall->issuer->suspended) { + if (simcall->issuer->suspended_) { XBT_DEBUG("Wait! This process is suspended and can't wake up now."); - simcall->issuer->suspended = 0; + simcall->issuer->suspended_ = 0; simcall_HANDLER_process_suspend(simcall, simcall->issuer); } else { SIMIX_simcall_answer(simcall); diff --git a/src/kernel/context/Context.cpp b/src/kernel/context/Context.cpp index b1af4dc6aa..dfa1791933 100644 --- a/src/kernel/context/Context.cpp +++ b/src/kernel/context/Context.cpp @@ -77,7 +77,7 @@ void Context::stop() { if (this->cleanup_func_) this->cleanup_func_(this->process_); - this->process_->suspended = 0; + this->process_->suspended_ = 0; this->iwannadie = false; simgrid::simix::simcall([this] { SIMIX_process_cleanup(this->process_); }); diff --git a/src/kernel/context/ContextBoost.cpp b/src/kernel/context/ContextBoost.cpp index 567329504a..b458eed2e3 100644 --- a/src/kernel/context/ContextBoost.cpp +++ b/src/kernel/context/ContextBoost.cpp @@ -77,13 +77,13 @@ BoostContext::BoostContext(std::function code, void_pfn_smxprocess_t cle #endif ASAN_ONLY(this->asan_stack_ = stack); #if BOOST_VERSION < 106100 - this->fc_ = boost::context::make_fcontext(stack, smx_context_usable_stack_size, BoostContext::wrapper); + this->fc_ = boost::context_::make_fcontext(stack, smx_context_usable_stack_size, BoostContext::wrapper); #else this->fc_ = boost::context::detail::make_fcontext(stack, smx_context_usable_stack_size, BoostContext::wrapper); #endif } else { #if BOOST_VERSION < 105600 - this->fc_ = new boost::context::fcontext_t(); + this->fc_ = new boost::context_::fcontext_t(); #endif if (BoostContext::maestro_context_ == nullptr) BoostContext::maestro_context_ = this; @@ -104,11 +104,11 @@ BoostContext::~BoostContext() void BoostContext::wrapper(BoostContext::arg_type arg) { #if BOOST_VERSION < 106100 - BoostContext* context = reinterpret_cast(arg); + BoostContext* context_ = reinterpret_cast(arg); #else BoostContext* context = static_cast(arg.data)[1]; - ASAN_ONLY(xbt_assert(context->asan_ctx_ == static_cast(arg.data)[0])); - ASAN_FINISH_SWITCH(nullptr, &context->asan_ctx_->asan_stack_, &context->asan_ctx_->asan_stack_size_); + ASAN_ONLY(xbt_assert(context_->asan_ctx_ == static_cast(arg.data)[0])); + ASAN_FINISH_SWITCH(nullptr, &context_->asan_ctx_->asan_stack_, &context_->asan_ctx_->asan_stack_size_); static_cast(arg.data)[0]->fc_ = arg.fctx; #endif try { @@ -117,16 +117,16 @@ void BoostContext::wrapper(BoostContext::arg_type arg) } catch (StopRequest const&) { XBT_DEBUG("Caught a StopRequest"); } - ASAN_ONLY(context->asan_stop_ = true); + ASAN_ONLY(context_->asan_stop_ = true); context->suspend(); } inline void BoostContext::swap(BoostContext* from, BoostContext* to) { #if BOOST_VERSION < 105600 - boost::context::jump_fcontext(from->fc_, to->fc_, reinterpret_cast(to)); + boost::context_::jump_fcontext(from->fc_, to->fc_, reinterpret_cast(to)); #elif BOOST_VERSION < 106100 - boost::context::jump_fcontext(&from->fc_, to->fc_, reinterpret_cast(to)); + boost::context_::jump_fcontext(&from->fc_, to->fc_, reinterpret_cast(to)); #else BoostContext* ctx[2] = {from, to}; ASAN_ONLY(void* fake_stack = nullptr); @@ -159,7 +159,7 @@ void SerialBoostContext::suspend() if (i < simix_global->process_to_run.size()) { /* execute the next process */ XBT_DEBUG("Run next process"); - next_context = static_cast(simix_global->process_to_run[i]->context); + next_context = static_cast(simix_global->process_to_run[i]->context_); } else { /* all processes were run, return to maestro */ XBT_DEBUG("No more process to run"); @@ -182,7 +182,7 @@ void SerialBoostContext::run_all() smx_actor_t first_process = simix_global->process_to_run.front(); process_index_ = 1; /* execute the first process */ - static_cast(first_process->context)->resume(); + static_cast(first_process->context_)->resume(); } // ParallelBoostContext @@ -217,7 +217,7 @@ void ParallelBoostContext::run_all() parmap_ = new simgrid::xbt::Parmap(SIMIX_context_get_nthreads(), SIMIX_context_get_parallel_mode()); parmap_->apply( [](smx_actor_t process) { - ParallelBoostContext* context = static_cast(process->context); + ParallelBoostContext* context = static_cast(process->context_); context->resume(); }, simix_global->process_to_run); @@ -229,7 +229,7 @@ void ParallelBoostContext::suspend() ParallelBoostContext* next_context; if (next_work) { XBT_DEBUG("Run next process"); - next_context = static_cast(next_work.get()->context); + next_context = static_cast(next_work.get()->context_); } else { XBT_DEBUG("No more processes to run"); uintptr_t worker_id = reinterpret_cast(xbt_os_thread_get_specific(worker_id_key_)); diff --git a/src/kernel/context/ContextRaw.cpp b/src/kernel/context/ContextRaw.cpp index fbaec9ba82..c522d8224d 100644 --- a/src/kernel/context/ContextRaw.cpp +++ b/src/kernel/context/ContextRaw.cpp @@ -258,14 +258,14 @@ RawContext::~RawContext() void RawContext::wrapper(void* arg) { RawContext* context = static_cast(arg); - ASAN_FINISH_SWITCH(nullptr, &context->asan_ctx_->asan_stack_, &context->asan_ctx_->asan_stack_size_); + ASAN_FINISH_SWITCH(nullptr, &context_->asan_ctx_->asan_stack_, &context_->asan_ctx_->asan_stack_size_); try { (*context)(); context->Context::stop(); } catch (StopRequest const&) { XBT_DEBUG("Caught a StopRequest"); } - ASAN_ONLY(context->asan_stop_ = true); + ASAN_ONLY(context_->asan_stop_ = true); context->suspend(); } @@ -297,7 +297,7 @@ void SerialRawContext::suspend() if (i < simix_global->process_to_run.size()) { /* execute the next process */ XBT_DEBUG("Run next process"); - next_context = static_cast(simix_global->process_to_run[i]->context); + next_context = static_cast(simix_global->process_to_run[i]->context_); } else { /* all processes were run, return to maestro */ XBT_DEBUG("No more process to run"); @@ -319,7 +319,7 @@ void SerialRawContext::run_all() return; smx_actor_t first_process = simix_global->process_to_run.front(); process_index_ = 1; - static_cast(first_process->context)->resume(); + static_cast(first_process->context_)->resume(); } // ParallelRawContext @@ -355,7 +355,7 @@ void ParallelRawContext::run_all() parmap_ = new simgrid::xbt::Parmap(SIMIX_context_get_nthreads(), SIMIX_context_get_parallel_mode()); parmap_->apply( [](smx_actor_t process) { - ParallelRawContext* context = static_cast(process->context); + ParallelRawContext* context = static_cast(process->context_); context->resume(); }, simix_global->process_to_run); @@ -369,7 +369,7 @@ void ParallelRawContext::suspend() if (next_work) { /* there is a next process to resume */ XBT_DEBUG("Run next process"); - next_context = static_cast(next_work.get()->context); + next_context = static_cast(next_work.get()->context_); } else { /* all processes were run, go to the barrier */ XBT_DEBUG("No more processes to run"); diff --git a/src/kernel/context/ContextThread.cpp b/src/kernel/context/ContextThread.cpp index 26d0b219a3..7362e84138 100644 --- a/src/kernel/context/ContextThread.cpp +++ b/src/kernel/context/ContextThread.cpp @@ -169,7 +169,7 @@ void ThreadContext::suspend() void ThreadContext::attach_start() { // We're breaking the layers here by depending on the upper layer: - ThreadContext* maestro = (ThreadContext*) simix_global->maestro_process->context; + ThreadContext* maestro = (ThreadContext*)simix_global->maestro_process->context_; xbt_os_sem_release(maestro->begin_); xbt_assert(not this->isMaestro()); this->start(); @@ -180,7 +180,7 @@ void ThreadContext::attach_stop() xbt_assert(not this->isMaestro()); this->yield(); - ThreadContext* maestro = (ThreadContext*) simix_global->maestro_process->context; + ThreadContext* maestro = (ThreadContext*)simix_global->maestro_process->context_; xbt_os_sem_acquire(maestro->end_); xbt_os_thread_set_extra_data(nullptr); @@ -192,7 +192,7 @@ void SerialThreadContext::run_all() { for (smx_actor_t const& process : simix_global->process_to_run) { XBT_DEBUG("Handling %p", process); - ThreadContext* context = static_cast(process->context); + ThreadContext* context = static_cast(process->context_); context->release(); context->wait(); } @@ -216,9 +216,9 @@ void ParallelThreadContext::finalize() void ParallelThreadContext::run_all() { for (smx_actor_t const& process : simix_global->process_to_run) - static_cast(process->context)->release(); + static_cast(process->context_)->release(); for (smx_actor_t const& process : simix_global->process_to_run) - static_cast(process->context)->wait(); + static_cast(process->context_)->wait(); } void ParallelThreadContext::start_hook() diff --git a/src/kernel/context/ContextUnix.cpp b/src/kernel/context/ContextUnix.cpp index af76c2ccbe..362b0140be 100644 --- a/src/kernel/context/ContextUnix.cpp +++ b/src/kernel/context/ContextUnix.cpp @@ -118,14 +118,14 @@ void UContext::smx_ctx_sysv_wrapper(int i1, int i2) simgrid::kernel::context::UContext* context; memcpy(&context, ctx_addr, sizeof context); - ASAN_FINISH_SWITCH(nullptr, &context->asan_ctx_->asan_stack_, &context->asan_ctx_->asan_stack_size_); + ASAN_FINISH_SWITCH(nullptr, &context_->asan_ctx_->asan_stack_, &context_->asan_ctx_->asan_stack_size_); try { (*context)(); context->Context::stop(); } catch (simgrid::kernel::context::Context::StopRequest const&) { XBT_DEBUG("Caught a StopRequest"); } - ASAN_ONLY(context->asan_stop_ = true); + ASAN_ONLY(context_->asan_stop_ = true); context->suspend(); } @@ -170,7 +170,7 @@ void SerialUContext::suspend() if (i < simix_global->process_to_run.size()) { /* execute the next process */ XBT_DEBUG("Run next process"); - next_context = static_cast(simix_global->process_to_run[i]->context); + next_context = static_cast(simix_global->process_to_run[i]->context_); } else { /* all processes were run, return to maestro */ XBT_DEBUG("No more process to run"); @@ -192,7 +192,7 @@ void SerialUContext::run_all() return; smx_actor_t first_process = simix_global->process_to_run.front(); process_index_ = 1; - static_cast(first_process->context)->resume(); + static_cast(first_process->context_)->resume(); } // ParallelUContext @@ -233,7 +233,7 @@ void ParallelUContext::run_all() parmap_ = new simgrid::xbt::Parmap(SIMIX_context_get_nthreads(), SIMIX_context_get_parallel_mode()); parmap_->apply( [](smx_actor_t process) { - ParallelUContext* context = static_cast(process->context); + ParallelUContext* context = static_cast(process->context_); context->resume(); }, simix_global->process_to_run); @@ -255,7 +255,7 @@ void ParallelUContext::suspend() if (next_work) { // There is a next soul to embody (ie, a next process to resume) XBT_DEBUG("Run next process"); - next_context = static_cast(next_work.get()->context); + next_context = static_cast(next_work.get()->context_); } else { // All processes were run, go to the barrier XBT_DEBUG("No more processes to run"); diff --git a/src/mc/checker/CommunicationDeterminismChecker.cpp b/src/mc/checker/CommunicationDeterminismChecker.cpp index 0d1aa71c36..5b8d3ff1bd 100644 --- a/src/mc/checker/CommunicationDeterminismChecker.cpp +++ b/src/mc/checker/CommunicationDeterminismChecker.cpp @@ -103,8 +103,8 @@ static void update_comm_pattern(simgrid::mc::PatternCommunication* comm_pattern, smx_actor_t src_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->src_proc)); smx_actor_t dst_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->dst_proc)); - comm_pattern->src_proc = src_proc->pid; - comm_pattern->dst_proc = dst_proc->pid; + comm_pattern->src_proc = src_proc->pid_; + comm_pattern->dst_proc = dst_proc->pid_; comm_pattern->src_host = MC_smx_actor_get_host_name(src_proc); comm_pattern->dst_host = MC_smx_actor_get_host_name(dst_proc); if (comm_pattern->data.size() == 0 && comm->src_buff != nullptr) { @@ -173,8 +173,8 @@ void CommunicationDeterminismChecker::get_comm_pattern(xbt_dynar_t list, smx_sim { const smx_actor_t issuer = MC_smx_simcall_get_issuer(request); simgrid::mc::PatternCommunicationList* initial_pattern = - xbt_dynar_get_as(initial_communications_pattern, issuer->pid, simgrid::mc::PatternCommunicationList*); - xbt_dynar_t incomplete_pattern = xbt_dynar_get_as(incomplete_communications_pattern, issuer->pid, xbt_dynar_t); + xbt_dynar_get_as(initial_communications_pattern, issuer->pid_, simgrid::mc::PatternCommunicationList*); + xbt_dynar_t incomplete_pattern = xbt_dynar_get_as(incomplete_communications_pattern, issuer->pid_, xbt_dynar_t); std::unique_ptr pattern = std::unique_ptr(new simgrid::mc::PatternCommunication()); @@ -194,7 +194,7 @@ void CommunicationDeterminismChecker::get_comm_pattern(xbt_dynar_t list, smx_sim char* remote_name = mc_model_checker->process().read( RemotePtr((uint64_t)(synchro->mbox ? &synchro->mbox->name_ : &synchro->mbox_cpy->name_))); pattern->rdv = mc_model_checker->process().read_string(RemotePtr(remote_name)); - pattern->src_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(synchro->src_proc))->pid; + pattern->src_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(synchro->src_proc))->pid_; pattern->src_host = MC_smx_actor_get_host_name(issuer); simgrid::smpi::Request mpi_request = mc_model_checker->process().read( @@ -238,13 +238,13 @@ void CommunicationDeterminismChecker::get_comm_pattern(xbt_dynar_t list, smx_sim &remote_name, remote(comm->mbox ? &simgrid::xbt::string::to_string_data(comm->mbox->name_).data : &simgrid::xbt::string::to_string_data(comm->mbox_cpy->name_).data)); pattern->rdv = mc_model_checker->process().read_string(RemotePtr(remote_name)); - pattern->dst_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->dst_proc))->pid; + pattern->dst_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->dst_proc))->pid_; pattern->dst_host = MC_smx_actor_get_host_name(issuer); } else xbt_die("Unexpected call_type %i", (int) call_type); - XBT_DEBUG("Insert incomplete comm pattern %p for process %ld", pattern.get(), issuer->pid); - xbt_dynar_t dynar = xbt_dynar_get_as(incomplete_communications_pattern, issuer->pid, xbt_dynar_t); + XBT_DEBUG("Insert incomplete comm pattern %p for process %ld", pattern.get(), issuer->pid_); + xbt_dynar_t dynar = xbt_dynar_get_as(incomplete_communications_pattern, issuer->pid_, xbt_dynar_t); simgrid::mc::PatternCommunication* pattern2 = pattern.release(); xbt_dynar_push(dynar, &pattern2); } diff --git a/src/mc/checker/SafetyChecker.cpp b/src/mc/checker/SafetyChecker.cpp index b44a106d39..9aeaff790e 100644 --- a/src/mc/checker/SafetyChecker.cpp +++ b/src/mc/checker/SafetyChecker.cpp @@ -230,7 +230,7 @@ void SafetyChecker::backtrack() state->num); } - if (not prev_state->actorStates[issuer->pid].isDone()) + if (not prev_state->actorStates[issuer->pid_].isDone()) prev_state->addInterleavingSet(issuer); else XBT_DEBUG("Process %p is in done set", req->issuer); @@ -246,11 +246,8 @@ void SafetyChecker::backtrack() const smx_actor_t previous_issuer = MC_smx_simcall_get_issuer(&prev_state->internal_req); XBT_DEBUG("Simcall %d, process %ld (state %d) and simcall %d, process %ld (state %d) are independent", - req->call, issuer->pid, state->num, - prev_state->internal_req.call, - previous_issuer->pid, + req->call, issuer->pid_, state->num, prev_state->internal_req.call, previous_issuer->pid_, prev_state->num); - } } } diff --git a/src/mc/mc_base.cpp b/src/mc/mc_base.cpp index b525f40b24..b9baf9148d 100644 --- a/src/mc/mc_base.cpp +++ b/src/mc/mc_base.cpp @@ -73,7 +73,7 @@ bool actor_is_enabled(smx_actor_t actor) #if SIMGRID_HAVE_MC // If in the MCer, ask the client app since it has all the data if (mc_model_checker != nullptr) { - return mc_model_checker->process().actor_is_enabled(actor->pid); + return mc_model_checker->process().actor_is_enabled(actor->pid_); } #endif @@ -116,7 +116,7 @@ bool actor_is_enabled(smx_actor_t actor) if (mutex->owner == nullptr) return true; - return mutex->owner->pid == req->issuer->pid; + return mutex->owner->pid_ == req->issuer->pid_; } case SIMCALL_SEM_ACQUIRE: { diff --git a/src/mc/mc_checkpoint.cpp b/src/mc/mc_checkpoint.cpp index 8e872d906c..e57904026b 100644 --- a/src/mc/mc_checkpoint.cpp +++ b/src/mc/mc_checkpoint.cpp @@ -1,5 +1,4 @@ -/* Copyright (c) 2008-2018. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2008-2018. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -549,7 +548,7 @@ std::shared_ptr take_snapshot(int num_state) std::shared_ptr snapshot = std::make_shared(mc_process, num_state); for (auto const& p : mc_model_checker->process().actors()) - snapshot->enabled_processes.insert(p.copy.getBuffer()->pid); + snapshot->enabled_processes.insert(p.copy.getBuffer()->pid_); snapshot_handle_ignore(snapshot.get()); diff --git a/src/mc/mc_comm_pattern.cpp b/src/mc/mc_comm_pattern.cpp index 3bcefee5c5..8baa20ad17 100644 --- a/src/mc/mc_comm_pattern.cpp +++ b/src/mc/mc_comm_pattern.cpp @@ -95,8 +95,7 @@ void MC_handle_comm_pattern( value, sizeof(comm_addr)); comm_addr = remote(addr); } - checker->complete_comm_pattern(pattern, comm_addr, - MC_smx_simcall_get_issuer(req)->pid, backtracking); + checker->complete_comm_pattern(pattern, comm_addr, MC_smx_simcall_get_issuer(req)->pid_, backtracking); } break; default: diff --git a/src/mc/mc_global.cpp b/src/mc/mc_global.cpp index ac4ccd4c99..9b8ce3c1b4 100644 --- a/src/mc/mc_global.cpp +++ b/src/mc/mc_global.cpp @@ -175,11 +175,11 @@ double MC_process_clock_get(smx_actor_t process) if (simgrid::mc::processes_time.empty()) return 0; if (process != nullptr) - return simgrid::mc::processes_time[process->pid]; + return simgrid::mc::processes_time[process->pid_]; return -1; } void MC_process_clock_add(smx_actor_t process, double amount) { - simgrid::mc::processes_time[process->pid] += amount; + simgrid::mc::processes_time[process->pid_] += amount; } diff --git a/src/mc/mc_request.cpp b/src/mc/mc_request.cpp index 09f9c889ac..86f9ce8a30 100644 --- a/src/mc/mc_request.cpp +++ b/src/mc/mc_request.cpp @@ -221,11 +221,11 @@ std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid type = "iSend"; char* p = pointer_to_string(simcall_comm_isend__get__src_buff(req)); char* bs = buff_size_to_string(simcall_comm_isend__get__src_buff_size(req)); - if (issuer->host) - args = bprintf("src=(%ld)%s (%s), buff=%s, size=%s", issuer->pid, MC_smx_actor_get_host_name(issuer), + if (issuer->host_) + args = bprintf("src=(%ld)%s (%s), buff=%s, size=%s", issuer->pid_, MC_smx_actor_get_host_name(issuer), MC_smx_actor_get_name(issuer), p, bs); else - args = bprintf("src=(%ld)%s, buff=%s, size=%s", issuer->pid, MC_smx_actor_get_name(issuer), p, bs); + args = bprintf("src=(%ld)%s, buff=%s, size=%s", issuer->pid_, MC_smx_actor_get_name(issuer), p, bs); xbt_free(bs); xbt_free(p); break; @@ -241,11 +241,11 @@ std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid type = "iRecv"; char* p = pointer_to_string(simcall_comm_irecv__get__dst_buff(req)); char* bs = buff_size_to_string(size); - if (issuer->host) - args = bprintf("dst=(%ld)%s (%s), buff=%s, size=%s", issuer->pid, MC_smx_actor_get_host_name(issuer), + if (issuer->host_) + args = bprintf("dst=(%ld)%s (%s), buff=%s, size=%s", issuer->pid_, MC_smx_actor_get_host_name(issuer), MC_smx_actor_get_name(issuer), p, bs); else - args = bprintf("dst=(%ld)%s, buff=%s, size=%s", issuer->pid, MC_smx_actor_get_name(issuer), p, bs); + args = bprintf("dst=(%ld)%s, buff=%s, size=%s", issuer->pid_, MC_smx_actor_get_name(issuer), p, bs); xbt_free(bs); xbt_free(p); break; @@ -275,9 +275,9 @@ std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid smx_actor_t src_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(act->src_proc)); smx_actor_t dst_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(act->dst_proc)); args = - bprintf("comm=%s [(%ld)%s (%s)-> (%ld)%s (%s)]", p, src_proc ? src_proc->pid : 0, + bprintf("comm=%s [(%ld)%s (%s)-> (%ld)%s (%s)]", p, src_proc ? src_proc->pid_ : 0, src_proc ? MC_smx_actor_get_host_name(src_proc) : "", src_proc ? MC_smx_actor_get_name(src_proc) : "", - dst_proc ? dst_proc->pid : 0, dst_proc ? MC_smx_actor_get_host_name(dst_proc) : "", + dst_proc ? dst_proc->pid_ : 0, dst_proc ? MC_smx_actor_get_host_name(dst_proc) : "", dst_proc ? MC_smx_actor_get_name(dst_proc) : ""); } xbt_free(p); @@ -307,8 +307,8 @@ std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid smx_actor_t src_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(act->src_proc)); smx_actor_t dst_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(act->dst_proc)); - args = bprintf("comm=%s [(%ld)%s (%s) -> (%ld)%s (%s)]", p, src_proc->pid, MC_smx_actor_get_name(src_proc), - MC_smx_actor_get_host_name(src_proc), dst_proc->pid, MC_smx_actor_get_name(dst_proc), + args = bprintf("comm=%s [(%ld)%s (%s) -> (%ld)%s (%s)]", p, src_proc->pid_, MC_smx_actor_get_name(src_proc), + MC_smx_actor_get_host_name(src_proc), dst_proc->pid_, MC_smx_actor_get_name(dst_proc), MC_smx_actor_get_host_name(dst_proc)); } xbt_free(p); @@ -363,7 +363,7 @@ std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid args = bprintf("locked = %d, owner = %d, sleeping = n/a", mutex.getBuffer()->locked, mutex.getBuffer()->owner != nullptr - ? (int)mc_model_checker->process().resolveActor(simgrid::mc::remote(mutex.getBuffer()->owner))->pid + ? (int)mc_model_checker->process().resolveActor(simgrid::mc::remote(mutex.getBuffer()->owner))->pid_ : -1); break; } @@ -381,10 +381,10 @@ std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid std::string str; if (args != nullptr) - str = simgrid::xbt::string_printf("[(%ld)%s (%s)] %s(%s)", issuer->pid, MC_smx_actor_get_host_name(issuer), + str = simgrid::xbt::string_printf("[(%ld)%s (%s)] %s(%s)", issuer->pid_, MC_smx_actor_get_host_name(issuer), MC_smx_actor_get_name(issuer), type, args); else - str = simgrid::xbt::string_printf("[(%ld)%s (%s)] %s ", issuer->pid, MC_smx_actor_get_host_name(issuer), + str = simgrid::xbt::string_printf("[(%ld)%s (%s)] %s ", issuer->pid_, MC_smx_actor_get_host_name(issuer), MC_smx_actor_get_name(issuer), type); xbt_free(args); return str; @@ -452,25 +452,25 @@ std::string request_get_dot_output(smx_simcall_t req, int value) switch (req->call) { case SIMCALL_COMM_ISEND: - if (issuer->host) - label = simgrid::xbt::string_printf("[(%ld)%s] iSend", issuer->pid, MC_smx_actor_get_host_name(issuer)); + if (issuer->host_) + label = simgrid::xbt::string_printf("[(%ld)%s] iSend", issuer->pid_, MC_smx_actor_get_host_name(issuer)); else - label = bprintf("[(%ld)] iSend", issuer->pid); + label = bprintf("[(%ld)] iSend", issuer->pid_); break; case SIMCALL_COMM_IRECV: - if (issuer->host) - label = simgrid::xbt::string_printf("[(%ld)%s] iRecv", issuer->pid, MC_smx_actor_get_host_name(issuer)); + if (issuer->host_) + label = simgrid::xbt::string_printf("[(%ld)%s] iRecv", issuer->pid_, MC_smx_actor_get_host_name(issuer)); else - label = simgrid::xbt::string_printf("[(%ld)] iRecv", issuer->pid); + label = simgrid::xbt::string_printf("[(%ld)] iRecv", issuer->pid_); break; case SIMCALL_COMM_WAIT: if (value == -1) { - if (issuer->host) - label = simgrid::xbt::string_printf("[(%ld)%s] WaitTimeout", issuer->pid, MC_smx_actor_get_host_name(issuer)); + if (issuer->host_) + label = simgrid::xbt::string_printf("[(%ld)%s] WaitTimeout", issuer->pid_, MC_smx_actor_get_host_name(issuer)); else - label = simgrid::xbt::string_printf("[(%ld)] WaitTimeout", issuer->pid); + label = simgrid::xbt::string_printf("[(%ld)] WaitTimeout", issuer->pid_); } else { simgrid::kernel::activity::ActivityImpl* remote_act = simcall_comm_wait__getraw__comm(req); simgrid::mc::Remote temp_comm; @@ -480,15 +480,13 @@ std::string request_get_dot_output(smx_simcall_t req, int value) smx_actor_t src_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->src_proc)); smx_actor_t dst_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->dst_proc)); - if (issuer->host) - label = simgrid::xbt::string_printf("[(%ld)%s] Wait [(%ld)->(%ld)]", issuer->pid, - MC_smx_actor_get_host_name(issuer), src_proc ? src_proc->pid : 0, - dst_proc ? dst_proc->pid : 0); + if (issuer->host_) + label = simgrid::xbt::string_printf("[(%ld)%s] Wait [(%ld)->(%ld)]", issuer->pid_, + MC_smx_actor_get_host_name(issuer), src_proc ? src_proc->pid_ : 0, + dst_proc ? dst_proc->pid_ : 0); else - label = simgrid::xbt::string_printf("[(%ld)] Wait [(%ld)->(%ld)]", - issuer->pid, - src_proc ? src_proc->pid : 0, - dst_proc ? dst_proc->pid : 0); + label = simgrid::xbt::string_printf("[(%ld)] Wait [(%ld)->(%ld)]", issuer->pid_, src_proc ? src_proc->pid_ : 0, + dst_proc ? dst_proc->pid_ : 0); } break; @@ -498,15 +496,15 @@ std::string request_get_dot_output(smx_simcall_t req, int value) mc_model_checker->process().read(temp_comm, remote(static_cast(remote_act))); simgrid::kernel::activity::CommImpl* comm = temp_comm.getBuffer(); if (comm->src_proc == nullptr || comm->dst_proc == nullptr) { - if (issuer->host) - label = simgrid::xbt::string_printf("[(%ld)%s] Test FALSE", issuer->pid, MC_smx_actor_get_host_name(issuer)); + if (issuer->host_) + label = simgrid::xbt::string_printf("[(%ld)%s] Test FALSE", issuer->pid_, MC_smx_actor_get_host_name(issuer)); else - label = bprintf("[(%ld)] Test FALSE", issuer->pid); + label = bprintf("[(%ld)] Test FALSE", issuer->pid_); } else { - if (issuer->host) - label = simgrid::xbt::string_printf("[(%ld)%s] Test TRUE", issuer->pid, MC_smx_actor_get_host_name(issuer)); + if (issuer->host_) + label = simgrid::xbt::string_printf("[(%ld)%s] Test TRUE", issuer->pid_, MC_smx_actor_get_host_name(issuer)); else - label = simgrid::xbt::string_printf("[(%ld)] Test TRUE", issuer->pid); + label = simgrid::xbt::string_printf("[(%ld)] Test TRUE", issuer->pid_); } break; } @@ -514,55 +512,53 @@ std::string request_get_dot_output(smx_simcall_t req, int value) case SIMCALL_COMM_WAITANY: { unsigned long comms_size = read_length( mc_model_checker->process(), remote(simcall_comm_waitany__get__comms(req))); - if (issuer->host) - label = simgrid::xbt::string_printf("[(%ld)%s] WaitAny [%d of %lu]", issuer->pid, + if (issuer->host_) + label = simgrid::xbt::string_printf("[(%ld)%s] WaitAny [%d of %lu]", issuer->pid_, MC_smx_actor_get_host_name(issuer), value + 1, comms_size); else - label = simgrid::xbt::string_printf("[(%ld)] WaitAny [%d of %lu]", - issuer->pid, value + 1, comms_size); + label = simgrid::xbt::string_printf("[(%ld)] WaitAny [%d of %lu]", issuer->pid_, value + 1, comms_size); break; } case SIMCALL_COMM_TESTANY: if (value == -1) { - if (issuer->host) - label = simgrid::xbt::string_printf("[(%ld)%s] TestAny FALSE", issuer->pid, MC_smx_actor_get_host_name(issuer)); + if (issuer->host_) + label = + simgrid::xbt::string_printf("[(%ld)%s] TestAny FALSE", issuer->pid_, MC_smx_actor_get_host_name(issuer)); else - label = simgrid::xbt::string_printf("[(%ld)] TestAny FALSE", issuer->pid); + label = simgrid::xbt::string_printf("[(%ld)] TestAny FALSE", issuer->pid_); } else { - if (issuer->host) - label = simgrid::xbt::string_printf("[(%ld)%s] TestAny TRUE [%d of %lu]", issuer->pid, + if (issuer->host_) + label = simgrid::xbt::string_printf("[(%ld)%s] TestAny TRUE [%d of %lu]", issuer->pid_, MC_smx_actor_get_host_name(issuer), value + 1, simcall_comm_testany__get__count(req)); else - label = simgrid::xbt::string_printf("[(%ld)] TestAny TRUE [%d of %lu]", - issuer->pid, - value + 1, - simcall_comm_testany__get__count(req)); + label = simgrid::xbt::string_printf("[(%ld)] TestAny TRUE [%d of %lu]", issuer->pid_, value + 1, + simcall_comm_testany__get__count(req)); } break; case SIMCALL_MUTEX_TRYLOCK: - label = simgrid::xbt::string_printf("[(%ld)] Mutex TRYLOCK", issuer->pid); + label = simgrid::xbt::string_printf("[(%ld)] Mutex TRYLOCK", issuer->pid_); break; case SIMCALL_MUTEX_LOCK: - label = simgrid::xbt::string_printf("[(%ld)] Mutex LOCK", issuer->pid); + label = simgrid::xbt::string_printf("[(%ld)] Mutex LOCK", issuer->pid_); break; case SIMCALL_MC_RANDOM: - if (issuer->host) - label = simgrid::xbt::string_printf("[(%ld)%s] MC_RANDOM (%d)", issuer->pid, MC_smx_actor_get_host_name(issuer), + if (issuer->host_) + label = simgrid::xbt::string_printf("[(%ld)%s] MC_RANDOM (%d)", issuer->pid_, MC_smx_actor_get_host_name(issuer), value); else - label = simgrid::xbt::string_printf("[(%ld)] MC_RANDOM (%d)", issuer->pid, value); + label = simgrid::xbt::string_printf("[(%ld)] MC_RANDOM (%d)", issuer->pid_, value); break; default: THROW_UNIMPLEMENTED; } - const char* color = get_color(issuer->pid - 1); + const char* color = get_color(issuer->pid_ - 1); return simgrid::xbt::string_printf( "label = \"%s\", color = %s, fontcolor = %s", label.c_str(), color, color); diff --git a/src/mc/mc_smx.cpp b/src/mc/mc_smx.cpp index 7191cb4001..c591270b81 100644 --- a/src/mc/mc_smx.cpp +++ b/src/mc/mc_smx.cpp @@ -117,7 +117,7 @@ smx_actor_t MC_smx_simcall_get_issuer(s_smx_simcall const* req) const char* MC_smx_actor_get_host_name(smx_actor_t actor) { if (mc_model_checker == nullptr) - return actor->host->get_cname(); + return actor->host_->get_cname(); simgrid::mc::RemoteClient* process = &mc_model_checker->process(); @@ -141,7 +141,7 @@ const char* MC_smx_actor_get_host_name(smx_actor_t actor) // Read the simgrid::xbt::string in the MCed process: simgrid::mc::ActorInformation* info = actor_info_cast(actor); - auto remote_string_address = remote((simgrid::xbt::string_data*)((char*)actor->host + offset)); + auto remote_string_address = remote((simgrid::xbt::string_data*)((char*)actor->host_ + offset)); simgrid::xbt::string_data remote_string = process->read(remote_string_address); char hostname[remote_string.len]; process->read_bytes(hostname, remote_string.len + 1, remote(remote_string.data)); @@ -153,11 +153,11 @@ const char* MC_smx_actor_get_name(smx_actor_t actor) { simgrid::mc::RemoteClient* process = &mc_model_checker->process(); if (mc_model_checker == nullptr) - return actor->name.c_str(); + return actor->get_cname(); simgrid::mc::ActorInformation* info = actor_info_cast(actor); if (info->name.empty()) { - simgrid::xbt::string_data string_data = simgrid::xbt::string::to_string_data(actor->name); + simgrid::xbt::string_data string_data = simgrid::xbt::string::to_string_data(actor->name_); info->name = process->read_string(remote(string_data.data), string_data.len); } return info->name.c_str(); diff --git a/src/mc/mc_state.cpp b/src/mc/mc_state.cpp index 92aff1f6c8..491f2dcbc4 100644 --- a/src/mc/mc_state.cpp +++ b/src/mc/mc_state.cpp @@ -70,7 +70,7 @@ Transition State::getTransition() const static inline smx_simcall_t MC_state_get_request_for_process(simgrid::mc::State* state, smx_actor_t actor) { /* reset the outgoing transition */ - simgrid::mc::ProcessState* procstate = &state->actorStates[actor->pid]; + simgrid::mc::ProcessState* procstate = &state->actorStates[actor->pid_]; state->transition.pid = -1; state->transition.argument = -1; state->executed_req.call = SIMCALL_NONE; @@ -152,7 +152,7 @@ static inline smx_simcall_t MC_state_get_request_for_process(simgrid::mc::State* if (not req) return nullptr; - state->transition.pid = actor->pid; + state->transition.pid = actor->pid_; state->executed_req = *req; // Fetch the data of the request and translate it: state->internal_req = *req; @@ -212,7 +212,7 @@ smx_simcall_t MC_state_get_request(simgrid::mc::State* state) { for (auto& actor : mc_model_checker->process().actors()) { /* Only consider the actors that were marked as interleaving by the checker algorithm */ - if (not state->actorStates[actor.copy.getBuffer()->pid].isTodo()) + if (not state->actorStates[actor.copy.getBuffer()->pid_].isTodo()) continue; smx_simcall_t res = MC_state_get_request_for_process(state, actor.copy.getBuffer()); diff --git a/src/mc/mc_state.hpp b/src/mc/mc_state.hpp index ed4ce9ad6e..dc3a52b9ec 100644 --- a/src/mc/mc_state.hpp +++ b/src/mc/mc_state.hpp @@ -129,7 +129,7 @@ public: explicit State(unsigned long state_number); std::size_t interleaveSize() const; - void addInterleavingSet(smx_actor_t actor) { this->actorStates[actor->pid].consider(); } + void addInterleavingSet(smx_actor_t actor) { this->actorStates[actor->pid_].consider(); } Transition getTransition() const; }; } diff --git a/src/mc/remote/Client.cpp b/src/mc/remote/Client.cpp index df02e4acd3..055a90af62 100644 --- a/src/mc/remote/Client.cpp +++ b/src/mc/remote/Client.cpp @@ -259,7 +259,7 @@ void Client::declareStack(void* stack, size_t size, smx_actor_t process, ucontex region.block = ((char*)stack - (char*)heap->heapbase) / BLOCKSIZE + 1; #if HAVE_SMPI if (smpi_privatize_global_variables == SmpiPrivStrategies::MMAP && process) - region.process_index = process->pid - 1; + region.process_index = process->pid_ - 1; else #endif region.process_index = -1; diff --git a/src/msg/msg_process.cpp b/src/msg/msg_process.cpp index 12084ff278..2c6ef6346f 100644 --- a/src/msg/msg_process.cpp +++ b/src/msg/msg_process.cpp @@ -40,7 +40,7 @@ void MSG_process_cleanup_from_SIMIX(smx_actor_t smx_actor) msg_actor = (simgrid::msg::ActorExt*)SIMIX_process_self_get_data(); SIMIX_process_self_set_data(nullptr); } else { - msg_actor = (simgrid::msg::ActorExt*)smx_actor->getUserData(); + msg_actor = (simgrid::msg::ActorExt*)smx_actor->get_user_data(); simcall_process_set_data(smx_actor, nullptr); } @@ -210,7 +210,7 @@ void* MSG_process_get_data(msg_process_t process) xbt_assert(process != nullptr, "Invalid parameter: first parameter must not be nullptr!"); /* get from SIMIX the MSG process data, and then the user data */ - simgrid::msg::ActorExt* msgExt = (simgrid::msg::ActorExt*)process->get_impl()->getUserData(); + simgrid::msg::ActorExt* msgExt = (simgrid::msg::ActorExt*)process->get_impl()->get_user_data(); if (msgExt) return msgExt->data; else @@ -226,7 +226,7 @@ msg_error_t MSG_process_set_data(msg_process_t process, void *data) { xbt_assert(process != nullptr, "Invalid parameter: first parameter must not be nullptr!"); - static_cast(process->get_impl()->getUserData())->data = data; + static_cast(process->get_impl()->get_user_data())->data = data; return MSG_OK; } @@ -264,7 +264,7 @@ int MSG_process_get_number() int MSG_process_self_PID() { smx_actor_t self = SIMIX_process_self(); - return self == nullptr ? 0 : self->pid; + return self == nullptr ? 0 : self->pid_; } /** \ingroup m_process_management @@ -296,7 +296,7 @@ msg_process_t MSG_process_self() } smx_context_t MSG_process_get_smx_ctx(msg_process_t process) { // deprecated -- smx_context_t should die afterward - return process->get_impl()->context; + return process->get_impl()->context_; } /** * \ingroup m_process_management diff --git a/src/plugins/vm/VirtualMachineImpl.cpp b/src/plugins/vm/VirtualMachineImpl.cpp index 19a7b8cbe7..0b89632746 100644 --- a/src/plugins/vm/VirtualMachineImpl.cpp +++ b/src/plugins/vm/VirtualMachineImpl.cpp @@ -143,7 +143,7 @@ void VirtualMachineImpl::suspend(smx_actor_t issuer) { if (get_state() != s4u::VirtualMachine::state::RUNNING) THROWF(vm_error, 0, "Cannot suspend VM %s: it is not running.", piface_->get_cname()); - if (issuer->host == piface_) + if (issuer->host_ == piface_) THROWF(vm_error, 0, "Actor %s cannot suspend the VM %s in which it runs", issuer->get_cname(), piface_->get_cname()); @@ -153,7 +153,7 @@ void VirtualMachineImpl::suspend(smx_actor_t issuer) action_->suspend(); for (auto& smx_process : process_list) { - XBT_DEBUG("suspend %s", smx_process.name.c_str()); + XBT_DEBUG("suspend %s", smx_process.get_cname()); smx_process.suspend(issuer); } @@ -213,7 +213,7 @@ void VirtualMachineImpl::shutdown(smx_actor_t issuer) for (auto& smx_process : process_list) { XBT_DEBUG("kill %s@%s on behalf of %s which shutdown that VM.", smx_process.get_cname(), - smx_process.host->get_cname(), issuer->get_cname()); + smx_process.host_->get_cname(), issuer->get_cname()); SIMIX_process_kill(&smx_process, issuer); } diff --git a/src/s4u/s4u_Actor.cpp b/src/s4u/s4u_Actor.cpp index 105cd93859..4dc113374c 100644 --- a/src/s4u/s4u_Actor.cpp +++ b/src/s4u/s4u_Actor.cpp @@ -71,7 +71,7 @@ void Actor::join(double timeout) void Actor::set_auto_restart(bool autorestart) { - simgrid::simix::simcall([this, autorestart]() { pimpl_->auto_restart = autorestart; }); + simgrid::simix::simcall([this, autorestart]() { pimpl_->auto_restart_ = autorestart; }); } void Actor::on_exit(int_f_pvoid_pvoid_t fun, void* data) /* deprecated */ @@ -114,7 +114,7 @@ void Actor::migrate(Host* new_host) s4u::Host* Actor::get_host() { - return this->pimpl_->host; + return this->pimpl_->host_; } void Actor::daemonize() @@ -124,7 +124,7 @@ void Actor::daemonize() bool Actor::is_daemon() const { - return this->pimpl_->isDaemon(); + return this->pimpl_->is_daemon(); } const simgrid::xbt::string& Actor::get_name() const @@ -139,12 +139,12 @@ const char* Actor::get_cname() const aid_t Actor::get_pid() const { - return this->pimpl_->pid; + return this->pimpl_->pid_; } aid_t Actor::get_ppid() const { - return this->pimpl_->ppid; + return this->pimpl_->ppid_; } void Actor::suspend() @@ -159,9 +159,9 @@ void Actor::resume() s4u::Actor::on_resume(this); } -int Actor::is_suspended() +bool Actor::is_suspended() { - return simgrid::simix::simcall([this] { return pimpl_->suspended; }); + return simgrid::simix::simcall([this] { return pimpl_->suspended_; }); } void Actor::set_kill_time(double time) @@ -321,12 +321,12 @@ ExecPtr exec_async(double flops) aid_t get_pid() { - return SIMIX_process_self()->pid; + return SIMIX_process_self()->pid_; } aid_t get_ppid() { - return SIMIX_process_self()->ppid; + return SIMIX_process_self()->ppid_; } std::string get_name() @@ -341,7 +341,7 @@ const char* get_cname() Host* get_host() { - return SIMIX_process_self()->host; + return SIMIX_process_self()->host_; } void suspend() @@ -362,7 +362,7 @@ void resume() bool is_suspended() { smx_actor_t process = SIMIX_process_self(); - return simgrid::simix::simcall([process] { return process->suspended; }); + return simgrid::simix::simcall([process] { return process->suspended_; }); } void kill() diff --git a/src/s4u/s4u_Host.cpp b/src/s4u/s4u_Host.cpp index 476ea1c7d9..f897380f3d 100644 --- a/src/s4u/s4u_Host.cpp +++ b/src/s4u/s4u_Host.cpp @@ -86,7 +86,7 @@ Host* Host::current() smx_actor_t smx_proc = SIMIX_process_self(); if (smx_proc == nullptr) xbt_die("Cannot call Host::current() from the maestro context"); - return smx_proc->host; + return smx_proc->host_; } void Host::turn_on() @@ -117,7 +117,7 @@ void Host::turn_off() for (auto& process : host->process_list) { SIMIX_process_kill(&process, self); XBT_DEBUG("Killing %s@%s on behalf of %s which turned off that host.", process.get_cname(), - process.host->get_cname(), self->get_cname()); + process.host_->get_cname(), self->get_cname()); } } @@ -644,5 +644,5 @@ void sg_host_get_actor_list(sg_host_t host, xbt_dynar_t whereto) sg_host_t sg_host_self() { smx_actor_t process = SIMIX_process_self(); - return (process == nullptr) ? nullptr : process->host; + return (process == nullptr) ? nullptr : process->host_; } diff --git a/src/simix/ActorImpl.cpp b/src/simix/ActorImpl.cpp index fe72f94c8e..943889d085 100644 --- a/src/simix/ActorImpl.cpp +++ b/src/simix/ActorImpl.cpp @@ -54,10 +54,10 @@ int SIMIX_process_has_pending_comms(smx_actor_t process) { */ void SIMIX_process_cleanup(smx_actor_t process) { - XBT_DEBUG("Cleanup process %s (%p), waiting synchro %p", process->name.c_str(), process, + XBT_DEBUG("Cleanup process %s (%p), waiting synchro %p", process->get_cname(), process, process->waiting_synchro.get()); - process->finished = true; + process->finished_ = true; SIMIX_process_on_exit_runall(process); /* Unregister from the kill timer if any */ @@ -99,16 +99,16 @@ void SIMIX_process_cleanup(smx_actor_t process) } XBT_DEBUG("%p should not be run anymore",process); - simix_global->process_list.erase(process->pid); - if (process->host && process->host_process_list_hook.is_linked()) - simgrid::xbt::intrusive_erase(process->host->extension()->process_list, *process); + simix_global->process_list.erase(process->pid_); + if (process->host_ && process->host_process_list_hook.is_linked()) + simgrid::xbt::intrusive_erase(process->host_->extension()->process_list, *process); if (not process->smx_destroy_list_hook.is_linked()) { #if SIMGRID_HAVE_MC xbt_dynar_push_as(simix_global->dead_actors_vector, smx_actor_t, process); #endif simix_global->process_to_destroy.push_back(*process); } - process->context->iwannadie = 0; + process->context_->iwannadie = 0; xbt_os_mutex_release(simix_global->mutex); } @@ -138,7 +138,7 @@ namespace actor { ActorImpl::~ActorImpl() { - delete this->context; + delete this->context_; } static void dying_daemon(int /*exit_status*/, void* data) @@ -156,8 +156,8 @@ static void dying_daemon(int /*exit_status*/, void* data) /** This process will be terminated automatically when the last non-daemon process finishes */ void ActorImpl::daemonize() { - if (not daemon) { - daemon = true; + if (not daemon_) { + daemon_ = true; simix_global->daemons.push_back(this); SIMIX_process_on_exit(this, dying_daemon, this); } @@ -165,18 +165,18 @@ void ActorImpl::daemonize() simgrid::s4u::Actor* ActorImpl::restart() { - XBT_DEBUG("Restarting process %s on %s", get_cname(), host->get_cname()); + XBT_DEBUG("Restarting process %s on %s", get_cname(), host_->get_cname()); // retrieve the arguments of the old process // FIXME: Factorize this with SIMIX_host_add_auto_restart_process ? simgrid::kernel::actor::ProcessArg arg; - arg.name = name; + arg.name = name_; arg.code = code; - arg.host = host; + arg.host = host_; arg.kill_time = SIMIX_timer_get_date(kill_timer); - arg.data = userdata; + arg.data = userdata_; arg.properties = nullptr; - arg.auto_restart = auto_restart; + arg.auto_restart = auto_restart_; // kill the old process SIMIX_process_kill(this, (this == simix_global->maestro_process) ? this : SIMIX_process_self()); @@ -187,19 +187,19 @@ simgrid::s4u::Actor* ActorImpl::restart() if (arg.kill_time >= 0) simcall_process_set_kill_time(actor, arg.kill_time); if (arg.auto_restart) - actor->auto_restart = arg.auto_restart; + actor->auto_restart_ = arg.auto_restart; return actor->ciface(); } smx_activity_t ActorImpl::suspend(ActorImpl* issuer) { - if (suspended) { - XBT_DEBUG("Actor '%s' is already suspended", name.c_str()); + if (suspended_) { + XBT_DEBUG("Actor '%s' is already suspended", get_cname()); return nullptr; } - suspended = 1; + suspended_ = 1; /* If we are suspending another actor that is waiting on a sync, suspend its synchronization. */ if (this != issuer) { @@ -209,7 +209,7 @@ smx_activity_t ActorImpl::suspend(ActorImpl* issuer) return nullptr; } else { - return SIMIX_execution_start("suspend", 0.0, 1.0, 0.0, this->host); + return SIMIX_execution_start("suspend", 0.0, 1.0, 0.0, this->host_); } } @@ -217,14 +217,14 @@ void ActorImpl::resume() { XBT_IN("process = %p", this); - if (context->iwannadie) { + if (context_->iwannadie) { XBT_VERB("Ignoring request to suspend an actor that is currently dying."); return; } - if (not suspended) + if (not suspended_) return; - suspended = 0; + suspended_ = 0; /* resume the synchronization that was blocking the resumed actor. */ if (waiting_synchro) @@ -235,12 +235,12 @@ void ActorImpl::resume() smx_activity_t ActorImpl::sleep(double duration) { - if (host->is_off()) - THROWF(host_error, 0, "Host %s failed, you cannot sleep there.", host->get_cname()); + if (host_->is_off()) + THROWF(host_error, 0, "Host %s failed, you cannot sleep there.", host_->get_cname()); simgrid::kernel::activity::SleepImpl* synchro = new simgrid::kernel::activity::SleepImpl(); - synchro->host = host; - synchro->surf_sleep = host->pimpl_cpu->sleep(duration); + synchro->host = host_; + synchro->surf_sleep = host_->pimpl_cpu->sleep(duration); synchro->surf_sleep->set_data(synchro); XBT_DEBUG("Create sleep synchronization %p", synchro); @@ -252,16 +252,16 @@ void create_maestro(simgrid::simix::ActorCode code) smx_actor_t maestro = nullptr; /* Create maestro process and initialize it */ maestro = new simgrid::kernel::actor::ActorImpl(); - maestro->pid = simix_process_maxpid++; - maestro->name = ""; - maestro->setUserData(nullptr); + maestro->pid_ = simix_process_maxpid++; + maestro->name_ = ""; + maestro->set_user_data(nullptr); if (not code) { - maestro->context = SIMIX_context_new(simgrid::simix::ActorCode(), nullptr, maestro); + maestro->context_ = SIMIX_context_new(simgrid::simix::ActorCode(), nullptr, maestro); } else { if (not simix_global) xbt_die("simix is not initialized, please call MSG_init first"); - maestro->context = simix_global->context_factory->create_maestro(code, maestro); + maestro->context_ = simix_global->context_factory->create_maestro(code, maestro); } maestro->simcall.issuer = maestro; @@ -302,20 +302,20 @@ smx_actor_t SIMIX_process_create(const char* name, simgrid::simix::ActorCode cod xbt_assert(code && host != nullptr, "Invalid parameters"); /* Process data */ - process->pid = simix_process_maxpid++; - process->name = simgrid::xbt::string(name); - process->host = host; - process->setUserData(data); + process->pid_ = simix_process_maxpid++; + process->name_ = simgrid::xbt::string(name); + process->host_ = host; + process->set_user_data(data); process->simcall.issuer = process; if (parent_process != nullptr) { - process->ppid = parent_process->pid; + process->ppid_ = parent_process->pid_; } process->code = code; - XBT_VERB("Create context %s", process->name.c_str()); - process->context = SIMIX_context_new(std::move(code), simix_global->cleanup_process_function, process); + XBT_VERB("Create context %s", process->get_cname()); + process->context_ = SIMIX_context_new(std::move(code), simix_global->cleanup_process_function, process); /* Add properties */ if (properties != nullptr) @@ -329,10 +329,10 @@ smx_actor_t SIMIX_process_create(const char* name, simgrid::simix::ActorCode cod /* Add the process to its host's process list */ host->extension()->process_list.push_back(*process); - XBT_DEBUG("Start context '%s'", process->name.c_str()); + XBT_DEBUG("Start context '%s'", process->get_cname()); /* Now insert it in the global process list and in the process to run list */ - simix_global->process_list[process->pid] = process; + simix_global->process_list[process->pid_] = process; XBT_DEBUG("Inserting %s(%s) in the to_run list", process->get_cname(), host->get_cname()); simix_global->process_to_run.push_back(process); intrusive_ptr_add_ref(process); @@ -360,23 +360,23 @@ smx_actor_t SIMIX_process_attach(const char* name, void* data, const char* hostn smx_actor_t process = new simgrid::kernel::actor::ActorImpl(); /* Process data */ - process->pid = simix_process_maxpid++; - process->name = std::string(name); - process->host = host; - process->setUserData(data); + process->pid_ = simix_process_maxpid++; + process->name_ = std::string(name); + process->host_ = host; + process->set_user_data(data); process->simcall.issuer = process; if (parent_process != nullptr) { - process->ppid = parent_process->pid; + process->ppid_ = parent_process->pid_; } /* Process data for auto-restart */ process->code = nullptr; - XBT_VERB("Create context %s", process->name.c_str()); + XBT_VERB("Create context %s", process->get_cname()); if (not simix_global) xbt_die("simix is not initialized, please call MSG_init first"); - process->context = simix_global->context_factory->attach(simix_global->cleanup_process_function, process); + process->context_ = simix_global->context_factory->attach(simix_global->cleanup_process_function, process); /* Add properties */ if (properties != nullptr) @@ -387,13 +387,12 @@ smx_actor_t SIMIX_process_attach(const char* name, void* data, const char* hostn host->extension()->process_list.push_back(*process); /* Now insert it in the global process list and in the process to run list */ - simix_global->process_list[process->pid] = process; + simix_global->process_list[process->pid_] = process; XBT_DEBUG("Inserting %s(%s) in the to_run list", process->get_cname(), host->get_cname()); simix_global->process_to_run.push_back(process); intrusive_ptr_add_ref(process); - - auto* context = dynamic_cast(process->context); + auto* context = dynamic_cast(process->context_); if (not context) xbt_die("Not a suitable context"); @@ -445,18 +444,18 @@ void SIMIX_process_runall() */ void SIMIX_process_kill(smx_actor_t process, smx_actor_t issuer) { - if (process->finished) { + if (process->finished_) { XBT_DEBUG("Ignoring request to kill process %s@%s that is already dead", process->get_cname(), - process->host->get_cname()); + process->host_->get_cname()); return; } - XBT_DEBUG("Actor '%s'@%s is killing actor '%s'@%s", issuer->get_cname(), issuer->host->get_cname(), - process->get_cname(), process->host->get_cname()); + XBT_DEBUG("Actor '%s'@%s is killing actor '%s'@%s", issuer->get_cname(), issuer->host_->get_cname(), + process->get_cname(), process->host_->get_cname()); - process->context->iwannadie = 1; - process->blocked = 0; - process->suspended = 0; + process->context_->iwannadie = 1; + process->blocked_ = 0; + process->suspended_ = 0; process->exception = nullptr; /* destroy the blocking synchro if any */ @@ -503,7 +502,7 @@ void SIMIX_process_kill(smx_actor_t process, smx_actor_t issuer) { if (std::find(begin(simix_global->process_to_run), end(simix_global->process_to_run), process) == end(simix_global->process_to_run) && process != issuer) { - XBT_DEBUG("Inserting %s in the to_run list", process->name.c_str()); + XBT_DEBUG("Inserting %s in the to_run list", process->get_cname()); simix_global->process_to_run.push_back(process); } } @@ -518,7 +517,7 @@ void SIMIX_process_kill(smx_actor_t process, smx_actor_t issuer) { void SIMIX_process_throw(smx_actor_t process, xbt_errcat_t cat, int value, const char *msg) { SMX_EXCEPTION(process, cat, value, msg); - if (process->suspended) + if (process->suspended_) process->resume(); /* cancel the blocking synchro if any */ @@ -543,7 +542,7 @@ void SIMIX_process_throw(smx_actor_t process, xbt_errcat_t cat, int value, const if (std::find(begin(simix_global->process_to_run), end(simix_global->process_to_run), process) == end(simix_global->process_to_run) && process != SIMIX_process_self()) { - XBT_DEBUG("Inserting %s in the to_run list", process->name.c_str()); + XBT_DEBUG("Inserting %s in the to_run list", process->get_cname()); simix_global->process_to_run.push_back(process); } } @@ -578,8 +577,8 @@ void SIMIX_process_killall(smx_actor_t issuer) void SIMIX_process_change_host(smx_actor_t actor, sg_host_t dest) { xbt_assert((actor != nullptr), "Invalid parameters"); - simgrid::xbt::intrusive_erase(actor->host->extension()->process_list, *actor); - actor->host = dest; + simgrid::xbt::intrusive_erase(actor->host_->extension()->process_list, *actor); + actor->host_ = dest; dest->extension()->process_list.push_back(*actor); } @@ -613,12 +612,12 @@ void* SIMIX_process_self_get_data() if (not self) { return nullptr; } - return self->getUserData(); + return self->get_user_data(); } void SIMIX_process_self_set_data(void *data) { - SIMIX_process_self()->setUserData(data); + SIMIX_process_self()->set_user_data(data); } @@ -630,12 +629,12 @@ const char* SIMIX_process_self_get_name() { if (process == nullptr || process == simix_global->maestro_process) return "maestro"; - return process->name.c_str(); + return process->get_cname(); } void simcall_HANDLER_process_join(smx_simcall_t simcall, smx_actor_t process, double timeout) { - if (process->finished) { + if (process->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); @@ -698,30 +697,30 @@ void SIMIX_process_yield(smx_actor_t self) XBT_DEBUG("Yield actor '%s'", self->get_cname()); /* Go into sleep and return control to maestro */ - self->context->suspend(); + self->context_->suspend(); /* Ok, maestro returned control to us */ - XBT_DEBUG("Control returned to me: '%s'", self->name.c_str()); + XBT_DEBUG("Control returned to me: '%s'", self->get_cname()); - if (self->context->iwannadie){ + if (self->context_->iwannadie) { XBT_DEBUG("I wanna die!"); - self->finished = true; + self->finished_ = true; /* execute the on_exit functions */ SIMIX_process_on_exit_runall(self); /* Add the process to the list of process to restart, only if the host is down */ - if (self->auto_restart && self->host->is_off()) { - SIMIX_host_add_auto_restart_process(self->host, self->get_cname(), self->code, self->getUserData(), + if (self->auto_restart_ && self->host_->is_off()) { + SIMIX_host_add_auto_restart_process(self->host_, self->get_cname(), self->code, self->get_user_data(), SIMIX_timer_get_date(self->kill_timer), self->get_properties(), - self->auto_restart); + self->auto_restart_); } - XBT_DEBUG("Process %s@%s is dead", self->get_cname(), self->host->get_cname()); - self->context->stop(); + XBT_DEBUG("Process %s@%s is dead", self->get_cname(), self->host_->get_cname()); + self->context_->stop(); } - if (self->suspended) { + if (self->suspended_) { XBT_DEBUG("Hey! I'm suspended."); xbt_assert(self->exception != nullptr, "Gasp! This exception may be lost by subsequent calls."); - self->suspended = 0; + self->suspended_ = 0; self->suspend(self); } @@ -732,7 +731,7 @@ void SIMIX_process_yield(smx_actor_t self) std::rethrow_exception(std::move(exception)); } - if (SMPI_switch_data_segment && not self->finished) { + if (SMPI_switch_data_segment && not self->finished_) { SMPI_switch_data_segment(self->iface()); } } @@ -752,7 +751,7 @@ smx_actor_t SIMIX_process_from_PID(aid_t PID) void SIMIX_process_on_exit_runall(smx_actor_t process) { simgrid::s4u::Actor::on_destruction(process->iface()); - smx_process_exit_status_t exit_status = (process->context->iwannadie) ? SMX_EXIT_FAILURE : SMX_EXIT_SUCCESS; + smx_process_exit_status_t exit_status = (process->context_->iwannadie) ? SMX_EXIT_FAILURE : SMX_EXIT_SUCCESS; while (not process->on_exit.empty()) { s_smx_process_exit_fun_t exit_fun = process->on_exit.back(); process->on_exit.pop_back(); @@ -777,7 +776,7 @@ void SIMIX_process_on_exit(smx_actor_t process, std::function * If set to 1, the process will be automatically restarted when its host comes back. */ void SIMIX_process_auto_restart_set(smx_actor_t process, int auto_restart) { - process->auto_restart = auto_restart; + process->auto_restart_ = auto_restart; } /** @brief Restart a process, starting it again from the beginning. */ diff --git a/src/simix/ActorImpl.hpp b/src/simix/ActorImpl.hpp index c650cd2027..605e6d857f 100644 --- a/src/simix/ActorImpl.hpp +++ b/src/simix/ActorImpl.hpp @@ -26,14 +26,14 @@ namespace actor { class ProcessArg { public: std::string name; - simgrid::simix::ActorCode code; + std::function code; void* data = nullptr; s4u::Host* host = nullptr; double kill_time = 0.0; std::shared_ptr> properties; bool auto_restart = false; ProcessArg() = default; - explicit ProcessArg(std::string name, simgrid::simix::ActorCode code, void* data, s4u::Host* host, double kill_time, + explicit ProcessArg(std::string name, std::function code, void* data, s4u::Host* host, double kill_time, std::shared_ptr> properties, bool auto_restart) : name(name) , code(std::move(code)) @@ -55,30 +55,30 @@ public: boost::intrusive::list_member_hook<> smx_destroy_list_hook; /* simix_global->process_to_destroy */ boost::intrusive::list_member_hook<> smx_synchro_hook; /* {mutex,cond,sem}->sleeping */ - aid_t pid = 0; - aid_t ppid = -1; - simgrid::xbt::string name; - const simgrid::xbt::string& get_name() const { return name; } - const char* get_cname() const { return name.c_str(); } - s4u::Host* host = nullptr; /* the host on which the process is running */ - smx_context_t context = nullptr; /* the context (uctx/raw/thread) that executes the user function */ + aid_t pid_ = 0; + aid_t ppid_ = -1; + simgrid::xbt::string name_; + const simgrid::xbt::string& get_name() const { return name_; } + const char* get_cname() const { return name_.c_str(); } + s4u::Host* host_ = nullptr; /* the host on which the process is running */ + smx_context_t context_ = nullptr; /* the context (uctx/raw/thread) that executes the user function */ std::exception_ptr exception; - bool finished = false; - bool blocked = false; - bool suspended = false; - bool auto_restart = false; + bool finished_ = false; + bool blocked_ = false; + bool suspended_ = false; + bool auto_restart_ = false; smx_activity_t waiting_synchro = nullptr; /* the current blocking synchro if any */ std::list comms; /* the current non-blocking communication synchros */ s_smx_simcall simcall; std::vector on_exit; /* list of functions executed when the process dies */ - simgrid::simix::ActorCode code; + std::function code; smx_timer_t kill_timer = nullptr; private: - void* userdata = nullptr; /* kept for compatibility, it should be replaced with moddata */ + void* userdata_ = nullptr; /* kept for compatibility, it should be replaced with moddata */ /* Refcounting */ std::atomic_int_fast32_t refcount_{0}; @@ -111,17 +111,17 @@ public: /* Daemon actors are automatically killed when the last non-daemon leaves */ private: - bool daemon = false; + bool daemon_ = false; public: void daemonize(); - bool isDaemon() const { return daemon; } /** Whether this actor has been daemonized */ - bool isSuspended() const { return suspended; } + bool is_daemon() { return daemon_; } /** Whether this actor has been daemonized */ + bool is_suspended() { return suspended_; } simgrid::s4u::Actor* restart(); smx_activity_t suspend(ActorImpl* issuer); void resume(); smx_activity_t sleep(double duration); - void setUserData(void* data) { userdata = data; } - void* getUserData() const { return userdata; } + void set_user_data(void* data) { userdata_ = data; } + void* get_user_data() { return userdata_; } }; /* Used to keep the list of actors blocked on a synchro */ @@ -129,14 +129,14 @@ typedef boost::intrusive::list> SynchroList; -XBT_PUBLIC void create_maestro(simgrid::simix::ActorCode code); +XBT_PUBLIC void create_maestro(std::function code); } } // namespace kernel } // namespace simgrid typedef simgrid::kernel::actor::ActorImpl* smx_actor_t; -XBT_PRIVATE smx_actor_t SIMIX_process_create(const char* name, simgrid::simix::ActorCode code, void* data, sg_host_t host, +XBT_PRIVATE smx_actor_t SIMIX_process_create(const char* name, std::function code, void* data, sg_host_t host, std::unordered_map* properties, smx_actor_t parent_process); diff --git a/src/simix/libsmx.cpp b/src/simix/libsmx.cpp index 41b201c9d7..ed1d0cb79e 100644 --- a/src/simix/libsmx.cpp +++ b/src/simix/libsmx.cpp @@ -193,7 +193,7 @@ void simcall_process_suspend(smx_actor_t process) */ void simcall_process_set_data(smx_actor_t process, void *data) { - simgrid::simix::simcall([process, data] { process->setUserData(data); }); + simgrid::simix::simcall([process, data] { process->set_user_data(data); }); } /** @@ -205,7 +205,7 @@ void simcall_process_set_kill_time(smx_actor_t process, double kill_time) if (kill_time <= SIMIX_get_clock() || simix_global->kill_process_function == nullptr) return; - XBT_DEBUG("Set kill time %f for process %s@%s", kill_time, process->get_cname(), process->host->get_cname()); + XBT_DEBUG("Set kill time %f for process %s@%s", kill_time, process->get_cname(), process->host_->get_cname()); process->kill_timer = SIMIX_timer_set(kill_time, [process] { simix_global->kill_process_function(process); process->kill_timer=nullptr; diff --git a/src/simix/popping.cpp b/src/simix/popping.cpp index 2fdbeb8459..34e4a71043 100644 --- a/src/simix/popping.cpp +++ b/src/simix/popping.cpp @@ -22,7 +22,7 @@ void SIMIX_simcall_answer(smx_simcall_t simcall) { if (simcall->issuer != simix_global->maestro_process){ XBT_DEBUG("Answer simcall %s (%d) issued by %s (%p)", SIMIX_simcall_name(simcall->call), (int)simcall->call, - simcall->issuer->name.c_str(), simcall->issuer); + simcall->issuer->get_cname(), simcall->issuer); simcall->issuer->simcall.call = SIMCALL_NONE; #if 0 /* This check should be useless and slows everyone. Reactivate if you see something weird in process scheduling. */ diff --git a/src/simix/popping_bodies.cpp b/src/simix/popping_bodies.cpp index 9c65c5c7fa..e282a76b00 100644 --- a/src/simix/popping_bodies.cpp +++ b/src/simix/popping_bodies.cpp @@ -28,8 +28,8 @@ inline static R simcall(e_smx_simcall_t call, T const&... t) smx_actor_t self = SIMIX_process_self(); simgrid::simix::marshal(&self->simcall, call, t...); if (self != simix_global->maestro_process) { - XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(), - SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); + XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->get_cname(), SIMIX_simcall_name(self->simcall.call), + (int)self->simcall.call); SIMIX_process_yield(self); } else { SIMIX_simcall_handle(&self->simcall, 0); diff --git a/src/simix/popping_generated.cpp b/src/simix/popping_generated.cpp index 3a7ae4223b..e8875d3c70 100644 --- a/src/simix/popping_generated.cpp +++ b/src/simix/popping_generated.cpp @@ -64,7 +64,7 @@ const char* simcall_names[] = { void SIMIX_simcall_handle(smx_simcall_t simcall, int value) { XBT_DEBUG("Handling simcall %p: %s", simcall, SIMIX_simcall_name(simcall->call)); SIMCALL_SET_MC_VALUE(simcall, value); - if (simcall->issuer->context->iwannadie) + if (simcall->issuer->context_->iwannadie) return; switch (simcall->call) { case SIMCALL_PROCESS_SUSPEND: @@ -184,10 +184,8 @@ case SIMCALL_RUN_BLOCKING: case NUM_SIMCALLS: break; case SIMCALL_NONE: - THROWF(arg_error,0,"Asked to do the noop syscall on %s@%s", - simcall->issuer->name.c_str(), - sg_host_get_name(simcall->issuer->host) - ); + THROWF(arg_error, 0, "Asked to do the noop syscall on %s@%s", simcall->issuer->get_cname(), + sg_host_get_name(simcall->issuer->host_)); break; default: THROW_IMPOSSIBLE; diff --git a/src/simix/simcalls.py b/src/simix/simcalls.py index 500b75e3d7..2a140d4ae6 100755 --- a/src/simix/simcalls.py +++ b/src/simix/simcalls.py @@ -340,7 +340,7 @@ if __name__ == '__main__': ' XBT_DEBUG("Handling simcall %p: %s", simcall, SIMIX_simcall_name(simcall->call));\n') fd.write(' SIMCALL_SET_MC_VALUE(simcall, value);\n') fd.write( - ' if (simcall->issuer->context->iwannadie)\n') + ' if (simcall->issuer->context_->iwannadie)\n') fd.write(' return;\n') fd.write(' switch (simcall->call) {\n') @@ -350,8 +350,8 @@ if __name__ == '__main__': fd.write(' break;\n') fd.write(' case SIMCALL_NONE:\n') fd.write(' THROWF(arg_error,0,"Asked to do the noop syscall on %s@%s",\n') - fd.write(' simcall->issuer->name.c_str(),\n') - fd.write(' sg_host_get_name(simcall->issuer->host)\n') + fd.write(' simcall->issuer->get_cname(),\n') + fd.write(' sg_host_get_name(simcall->issuer->host_)\n') fd.write(' );\n') fd.write(' break;\n') fd.write(' default:\n') @@ -380,7 +380,7 @@ inline static R simcall(e_smx_simcall_t call, T const&... t) smx_actor_t self = SIMIX_process_self(); simgrid::simix::marshal(&self->simcall, call, t...); if (self != simix_global->maestro_process) { - XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(), + XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->get_cname(), SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { diff --git a/src/simix/smx_global.cpp b/src/simix/smx_global.cpp index f0b03adfdb..f16fa8980c 100644 --- a/src/simix/smx_global.cpp +++ b/src/simix/smx_global.cpp @@ -284,8 +284,8 @@ void SIMIX_clean() #endif /* Let's free maestro now */ - delete simix_global->maestro_process->context; - simix_global->maestro_process->context = nullptr; + delete simix_global->maestro_process->context_; + simix_global->maestro_process->context_ = nullptr; delete simix_global->maestro_process; simix_global->maestro_process = nullptr; @@ -648,12 +648,12 @@ void SIMIX_display_process_status() if (boost::dynamic_pointer_cast(process->waiting_synchro) != nullptr) synchro_description = "I/O"; - XBT_INFO("Process %ld (%s@%s): waiting for %s synchro %p (%s) in state %d to finish", process->pid, - process->get_cname(), process->host->get_cname(), synchro_description, process->waiting_synchro.get(), + XBT_INFO("Process %ld (%s@%s): waiting for %s synchro %p (%s) in state %d to finish", process->pid_, + process->get_cname(), process->host_->get_cname(), synchro_description, process->waiting_synchro.get(), process->waiting_synchro->name_.c_str(), (int)process->waiting_synchro->state_); } else { - XBT_INFO("Process %ld (%s@%s)", process->pid, process->get_cname(), process->host->get_cname()); + XBT_INFO("Process %ld (%s@%s)", process->pid_, process->get_cname(), process->host_->get_cname()); } } } diff --git a/src/simix/smx_host.cpp b/src/simix/smx_host.cpp index ecd86340d7..afd0d0c928 100644 --- a/src/simix/smx_host.cpp +++ b/src/simix/smx_host.cpp @@ -55,7 +55,7 @@ namespace simgrid { if (arg->kill_time >= 0) simcall_process_set_kill_time(actor, arg->kill_time); if (arg->auto_restart) - actor->auto_restart = arg->auto_restart; + actor->auto_restart_ = arg->auto_restart; } } @@ -107,7 +107,7 @@ void SIMIX_host_autorestart(sg_host_t host) if (arg->kill_time >= 0) simcall_process_set_kill_time(actor, arg->kill_time); if (arg->auto_restart) - actor->auto_restart = arg->auto_restart; + actor->auto_restart_ = arg->auto_restart; } process_list.clear(); } @@ -213,8 +213,8 @@ void SIMIX_execution_finish(smx_activity_t synchro) break; case SIMIX_FAILED: - XBT_DEBUG("SIMIX_execution_finished: host '%s' failed", simcall->issuer->host->get_cname()); - simcall->issuer->context->iwannadie = 1; + XBT_DEBUG("SIMIX_execution_finished: host '%s' failed", simcall->issuer->host_->get_cname()); + simcall->issuer->context_->iwannadie = 1; SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed"); break; @@ -232,8 +232,8 @@ void SIMIX_execution_finish(smx_activity_t synchro) xbt_die("Internal error in SIMIX_execution_finish: unexpected synchro state %d", (int)exec->state_); } /* Fail the process if the host is down */ - if (simcall->issuer->host->is_off()) - simcall->issuer->context->iwannadie = 1; + if (simcall->issuer->host_->is_off()) + simcall->issuer->context_->iwannadie = 1; simcall->issuer->waiting_synchro = nullptr; simcall_execution_wait__set__result(simcall, exec->state_); diff --git a/src/simix/smx_io.cpp b/src/simix/smx_io.cpp index b114804429..d2a31185c2 100644 --- a/src/simix/smx_io.cpp +++ b/src/simix/smx_io.cpp @@ -80,8 +80,8 @@ void SIMIX_io_finish(smx_activity_t synchro) xbt_die("Internal error in SIMIX_io_finish: unexpected synchro state %d", static_cast(synchro->state_)); } - if (simcall->issuer->host->is_off()) { - simcall->issuer->context->iwannadie = 1; + if (simcall->issuer->host_->is_off()) { + simcall->issuer->context_->iwannadie = 1; } simcall->issuer->waiting_synchro = nullptr; diff --git a/src/simix/smx_network.cpp b/src/simix/smx_network.cpp index c95d8b3b98..b2327ed30d 100644 --- a/src/simix/smx_network.cpp +++ b/src/simix/smx_network.cpp @@ -322,7 +322,7 @@ void simcall_HANDLER_comm_wait(smx_simcall_t simcall, smx_activity_t synchro, do SIMIX_comm_finish(synchro); } else { /* we need a surf sleep action even when there is no timeout, otherwise surf won't tell us when the host fails */ - simgrid::kernel::resource::Action* sleep = simcall->issuer->host->pimpl_cpu->sleep(timeout); + simgrid::kernel::resource::Action* sleep = simcall->issuer->host_->pimpl_cpu->sleep(timeout); sleep->set_data(synchro.get()); simgrid::kernel::activity::CommImplPtr comm = @@ -455,8 +455,8 @@ static inline void SIMIX_comm_start(simgrid::kernel::activity::CommImplPtr comm) /* If both the sender and the receiver are already there, start the communication */ if (comm->state_ == SIMIX_READY) { - simgrid::s4u::Host* sender = comm->src_proc->host; - simgrid::s4u::Host* receiver = comm->dst_proc->host; + simgrid::s4u::Host* sender = comm->src_proc->host_; + simgrid::s4u::Host* receiver = comm->dst_proc->host_; comm->surfAction_ = surf_network_model->communicate(sender, receiver, comm->task_size, comm->rate); comm->surfAction_->set_data(comm.get()); @@ -475,15 +475,15 @@ static inline void SIMIX_comm_start(simgrid::kernel::activity::CommImplPtr comm) /* If any of the process is suspended, create the synchro but stop its execution, it will be restarted when the sender process resume */ - if (comm->src_proc->isSuspended() || comm->dst_proc->isSuspended()) { - if (comm->src_proc->isSuspended()) + if (comm->src_proc->is_suspended() || comm->dst_proc->is_suspended()) { + if (comm->src_proc->is_suspended()) XBT_DEBUG("The communication is suspended on startup because src (%s@%s) was suspended since it initiated the " "communication", - comm->src_proc->get_cname(), comm->src_proc->host->get_cname()); + comm->src_proc->get_cname(), comm->src_proc->host_->get_cname()); else XBT_DEBUG("The communication is suspended on startup because dst (%s@%s) was suspended since it initiated the " "communication", - comm->dst_proc->get_cname(), comm->dst_proc->host->get_cname()); + comm->dst_proc->get_cname(), comm->dst_proc->host_->get_cname()); comm->surfAction_->suspend(); } @@ -528,8 +528,8 @@ void SIMIX_comm_finish(smx_activity_t synchro) /* Check out for errors */ - if (simcall->issuer->host->is_off()) { - simcall->issuer->context->iwannadie = 1; + if (simcall->issuer->host_->is_off()) { + simcall->issuer->context_->iwannadie = 1; SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed"); } else { switch (comm->state_) { @@ -549,14 +549,14 @@ void SIMIX_comm_finish(smx_activity_t synchro) case SIMIX_SRC_HOST_FAILURE: if (simcall->issuer == comm->src_proc) - simcall->issuer->context->iwannadie = 1; + simcall->issuer->context_->iwannadie = 1; else SMX_EXCEPTION(simcall->issuer, network_error, 0, "Remote peer failed"); break; case SIMIX_DST_HOST_FAILURE: if (simcall->issuer == comm->dst_proc) - simcall->issuer->context->iwannadie = 1; + simcall->issuer->context_->iwannadie = 1; else SMX_EXCEPTION(simcall->issuer, network_error, 0, "Remote peer failed"); break; @@ -564,8 +564,8 @@ void SIMIX_comm_finish(smx_activity_t synchro) case SIMIX_LINK_FAILURE: XBT_DEBUG("Link failure in synchro %p between '%s' and '%s': posting an exception to the issuer: %s (%p) " "detached:%d", - synchro.get(), comm->src_proc ? comm->src_proc->host->get_cname() : nullptr, - comm->dst_proc ? comm->dst_proc->host->get_cname() : nullptr, simcall->issuer->get_cname(), + synchro.get(), comm->src_proc ? comm->src_proc->host_->get_cname() : nullptr, + comm->dst_proc ? comm->dst_proc->host_->get_cname() : nullptr, simcall->issuer->get_cname(), simcall->issuer, comm->detached); if (comm->src_proc == simcall->issuer) { XBT_DEBUG("I'm source"); @@ -616,8 +616,8 @@ void SIMIX_comm_finish(smx_activity_t synchro) } } - if (simcall->issuer->host->is_off()) { - simcall->issuer->context->iwannadie = 1; + if (simcall->issuer->host_->is_off()) { + simcall->issuer->context_->iwannadie = 1; } simcall->issuer->waiting_synchro = nullptr; @@ -688,8 +688,8 @@ void SIMIX_comm_copy_data(smx_activity_t synchro) return; XBT_DEBUG("Copying comm %p data from %s (%p) -> %s (%p) (%zu bytes)", comm.get(), - comm->src_proc ? comm->src_proc->host->get_cname() : "a finished process", comm->src_buff, - comm->dst_proc ? comm->dst_proc->host->get_cname() : "a finished process", comm->dst_buff, buff_size); + comm->src_proc ? comm->src_proc->host_->get_cname() : "a finished process", comm->src_buff, + comm->dst_proc ? comm->dst_proc->host_->get_cname() : "a finished process", comm->dst_buff, buff_size); /* Copy at most dst_buff_size bytes of the message to receiver's buffer */ if (comm->dst_buff_size) diff --git a/src/simix/smx_synchro.cpp b/src/simix/smx_synchro.cpp index 233f61c331..cf91e4a819 100644 --- a/src/simix/smx_synchro.cpp +++ b/src/simix/smx_synchro.cpp @@ -68,7 +68,7 @@ void SIMIX_synchro_finish(smx_activity_t synchro) if (synchro->state_ != SIMIX_SRC_TIMEOUT) { if (synchro->state_ == SIMIX_FAILED) - simcall->issuer->context->iwannadie = 1; + simcall->issuer->context_->iwannadie = 1; else THROW_IMPOSSIBLE; } @@ -146,7 +146,7 @@ static void _SIMIX_sem_wait(smx_sem_t sem, double timeout, smx_actor_t issuer, XBT_DEBUG("Wait semaphore %p (timeout:%f)", sem, timeout); if (sem->value <= 0) { - synchro = SIMIX_synchro_wait(issuer->host, timeout); + synchro = SIMIX_synchro_wait(issuer->host_, timeout); synchro->simcalls_.push_front(simcall); issuer->waiting_synchro = synchro; sem->sleeping.push_back(*issuer); diff --git a/src/smpi/internals/smpi_global.cpp b/src/smpi/internals/smpi_global.cpp index d176b7b297..9518a17884 100644 --- a/src/smpi/internals/smpi_global.cpp +++ b/src/smpi/internals/smpi_global.cpp @@ -104,7 +104,7 @@ simgrid::smpi::Process* smpi_process() ActorPtr me = Actor::self(); if (me == nullptr) // This happens sometimes (eg, when linking against NS3 because it pulls openMPI...) return nullptr; - simgrid::msg::ActorExt* msgExt = static_cast(me->get_impl()->getUserData()); + simgrid::msg::ActorExt* msgExt = static_cast(me->get_impl()->get_user_data()); return static_cast(msgExt->data); } diff --git a/src/smpi/internals/smpi_process.cpp b/src/smpi/internals/smpi_process.cpp index 0fd9fd0b17..d5edd03495 100644 --- a/src/smpi/internals/smpi_process.cpp +++ b/src/smpi/internals/smpi_process.cpp @@ -66,7 +66,7 @@ void Process::set_data(int* argc, char*** argv) finalization_barrier_ = barrier; actor_ = simgrid::s4u::Actor::self(); - static_cast(actor_->get_impl()->getUserData())->data = this; + static_cast(actor_->get_impl()->get_user_data())->data = this; if (*argc > 3) { memmove(&(*argv)[0], &(*argv)[2], sizeof(char*) * (*argc - 2)); @@ -243,7 +243,7 @@ void Process::init(int *argc, char ***argv){ } if (argc != nullptr && argv != nullptr) { simgrid::s4u::ActorPtr proc = simgrid::s4u::Actor::self(); - proc->get_impl()->context->set_cleanup(&MSG_process_cleanup_from_SIMIX); + proc->get_impl()->context_->set_cleanup(&MSG_process_cleanup_from_SIMIX); char* instance_id = (*argv)[1]; try { diff --git a/src/smpi/mpi/smpi_comm.cpp b/src/smpi/mpi/smpi_comm.cpp index 58dd774e0f..02b66fb946 100644 --- a/src/smpi/mpi/smpi_comm.cpp +++ b/src/smpi/mpi/smpi_comm.cpp @@ -310,7 +310,7 @@ void Comm::init_smp(){ int intra_comm_size = 0; int min_index = INT_MAX; // the minimum index will be the leader for (auto& actor : process_list) { - int index = actor.pid; + int index = actor.pid_; if (this->group()->rank(actor.iface()) != MPI_UNDEFINED) { // Is this process in the current group? intra_comm_size++; if (index < min_index)