X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d9c1e4df4ecfc39d84e55527fa05e9bd19f70c6c..8d0b1f2f1840a16bb9551f1cfd74f2488599f95b:/src/kernel/activity/CommImpl.cpp?ds=sidebyside diff --git a/src/kernel/activity/CommImpl.cpp b/src/kernel/activity/CommImpl.cpp index e5c1ddf071..f264993204 100644 --- a/src/kernel/activity/CommImpl.cpp +++ b/src/kernel/activity/CommImpl.cpp @@ -23,21 +23,12 @@ namespace simgrid::kernel::activity { unsigned CommImpl::next_id_ = 0; -/* In stateful MC, we need to ignore some private memory that is not relevant to the application state */ -void CommImpl::setup_mc() -{ - MC_ignore(&CommImpl::next_id_, sizeof(CommImpl::next_id_)); -} - -CommImpl::CommImpl() -{ - MC_ignore((void*)&id_, sizeof(id_)); -} - std::function CommImpl::copy_data_callback_ = [](kernel::activity::CommImpl* comm, void* buff, size_t buff_size) { xbt_assert((buff_size == sizeof(void*)), "Cannot copy %zu bytes: must be sizeof(void*)", buff_size); - *(void**)(comm->dst_buff_) = buff; + if (comm->dst_buff_ != nullptr) // get_async provided a buffer + *(void**)(comm->dst_buff_) = buff; + comm->payload_ = buff; // Setup what will be retrieved by s4u::Comm::get_payload() }; void CommImpl::set_copy_data_callback(const std::function& callback) @@ -122,8 +113,6 @@ CommImpl::~CommImpl() } else if (mbox_) { mbox_->remove(this); } - - MC_unignore((void*)&id_, sizeof(id_)); } /** @brief Starts the simulation of a communication synchro. */ @@ -179,7 +168,7 @@ CommImpl* CommImpl::start() std::vector CommImpl::get_traversed_links() const { - xbt_assert(get_state() != State::WAITING, "You cannot use %s() if your communication is not ready (%s)", __FUNCTION__, + xbt_assert(get_state() != State::WAITING, "You cannot use %s() if your communication is not ready (%s)", __func__, get_state_str()); std::vector vlinks; XBT_ATTRIB_UNUSED double res = 0; @@ -192,7 +181,7 @@ void CommImpl::copy_data() { size_t buff_size = src_buff_size_; /* If there is no data to copy then return */ - if (not src_buff_ || not dst_buff_ || copied_) + if (not src_buff_ || not dst_buff_size_ || copied_) return; XBT_DEBUG("Copying comm %p data from %s (%p) -> %s (%p) (%zu bytes)", this,