Skip to content

Commit

Permalink
#1899: Update formating with clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
thearusable committed Aug 25, 2022
1 parent 985a18c commit b138399
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 46 deletions.
102 changes: 66 additions & 36 deletions src/vt/runnable/runnable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -201,57 +201,87 @@ void RunnableNew::run() {

void RunnableNew::begin() {
#if vt_check_enabled(trace_enabled)
if(ctx_trace_) ctx_trace_->begin();
if (ctx_trace_)
ctx_trace_->begin();
#endif
if(ctx_continuation_) ctx_continuation_->begin();
if(ctx_lbdata_) ctx_lbdata_->begin();
if(ctx_setcontext_) ctx_setcontext_->begin();
if(ctx_td_) ctx_td_->begin();
if(ctx_collection_) ctx_collection_->begin();
if (ctx_continuation_)
ctx_continuation_->begin();
if (ctx_lbdata_)
ctx_lbdata_->begin();
if (ctx_setcontext_)
ctx_setcontext_->begin();
if (ctx_td_)
ctx_td_->begin();
if (ctx_collection_)
ctx_collection_->begin();
}

void RunnableNew::end() {
#if vt_check_enabled(trace_enabled)
if(ctx_trace_) ctx_trace_->end();
if (ctx_trace_)
ctx_trace_->end();
#endif
if(ctx_continuation_) ctx_continuation_->end();
if(ctx_lbdata_) ctx_lbdata_->end();
if(ctx_setcontext_) ctx_setcontext_->end();
if(ctx_td_) ctx_td_->end();
if(ctx_collection_) ctx_collection_->end();
if (ctx_continuation_)
ctx_continuation_->end();
if (ctx_lbdata_)
ctx_lbdata_->end();
if (ctx_setcontext_)
ctx_setcontext_->end();
if (ctx_td_)
ctx_td_->end();
if (ctx_collection_)
ctx_collection_->end();
}

void RunnableNew::suspend() {
#if vt_check_enabled(trace_enabled)
if(ctx_trace_) ctx_trace_->suspend();
if (ctx_trace_)
ctx_trace_->suspend();
#endif
if(ctx_continuation_) ctx_continuation_->suspend();
if(ctx_lbdata_) ctx_lbdata_->suspend();
if(ctx_setcontext_) ctx_setcontext_->suspend();
if(ctx_td_) ctx_td_->suspend();
if(ctx_collection_) ctx_collection_->suspend();
if (ctx_continuation_)
ctx_continuation_->suspend();
if (ctx_lbdata_)
ctx_lbdata_->suspend();
if (ctx_setcontext_)
ctx_setcontext_->suspend();
if (ctx_td_)
ctx_td_->suspend();
if (ctx_collection_)
ctx_collection_->suspend();
}

void RunnableNew::resume() {
#if vt_check_enabled(trace_enabled)
if(ctx_trace_) ctx_trace_->resume();
if (ctx_trace_)
ctx_trace_->resume();
#endif
if(ctx_continuation_) ctx_continuation_->resume();
if(ctx_lbdata_) ctx_lbdata_->resume();
if(ctx_setcontext_) ctx_setcontext_->resume();
if(ctx_td_) ctx_td_->resume();
if(ctx_collection_) ctx_collection_->resume();
if (ctx_continuation_)
ctx_continuation_->resume();
if (ctx_lbdata_)
ctx_lbdata_->resume();
if (ctx_setcontext_)
ctx_setcontext_->resume();
if (ctx_td_)
ctx_td_->resume();
if (ctx_collection_)
ctx_collection_->resume();
}

void RunnableNew::send(elm::ElementIDStruct elm, MsgSizeType bytes) {
#if vt_check_enabled(trace_enabled)
if(ctx_trace_) ctx_trace_->send(elm, bytes);
if (ctx_trace_)
ctx_trace_->send(elm, bytes);
#endif
if(ctx_continuation_) ctx_continuation_->send(elm, bytes);
if(ctx_lbdata_) ctx_lbdata_->send(elm, bytes);
if(ctx_setcontext_) ctx_setcontext_->send(elm, bytes);
if(ctx_td_) ctx_td_->send(elm, bytes);
if(ctx_collection_) ctx_collection_->send(elm, bytes);
if (ctx_continuation_)
ctx_continuation_->send(elm, bytes);
if (ctx_lbdata_)
ctx_lbdata_->send(elm, bytes);
if (ctx_setcontext_)
ctx_setcontext_->send(elm, bytes);
if (ctx_td_)
ctx_td_->send(elm, bytes);
if (ctx_collection_)
ctx_collection_->send(elm, bytes);
}

/*static*/ std::unique_ptr<
Expand Down Expand Up @@ -286,33 +316,33 @@ void RunnableNew::addContext(CtxCollectionPtr&& ptr) {
}

#if vt_check_enabled(trace_enabled)
template<>
template <>
ctx::Trace* RunnableNew::get<ctx::Trace>() {
return ctx_trace_.get();
}
#endif

template<>
template <>
ctx::Continuation* RunnableNew::get<ctx::Continuation>() {
return ctx_continuation_.get();
}

template<>
template <>
ctx::LBData* RunnableNew::get<ctx::LBData>() {
return ctx_lbdata_.get();
}

template<>
template <>
ctx::SetContext* RunnableNew::get<ctx::SetContext>() {
return ctx_setcontext_.get();
}

template<>
template <>
ctx::TD* RunnableNew::get<ctx::TD>() {
return ctx_td_.get();
}

template<>
template <>
ctx::Collection* RunnableNew::get<ctx::Collection>() {
return ctx_collection_.get();
}
Expand Down
14 changes: 7 additions & 7 deletions src/vt/runnable/runnable.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ struct RunnableNew {
> up_pool;

private:

#if vt_check_enabled(trace_enabled)
/**
* \internal \brief Store the context pointer in a private member
Expand Down Expand Up @@ -347,13 +346,14 @@ struct RunnableNew {
ThreadIDType tid_ = no_thread_id; /**< The thread ID for the task */

#if vt_check_enabled(trace_enabled)
CtxTracePtr ctx_trace_ = nullptr; /**< The Trace context */
CtxTracePtr ctx_trace_ = nullptr; /**< The Trace context */
#endif
CtxContinuationPtr ctx_continuation_ = nullptr; /**< The Continuation context */
CtxLBDataPtr ctx_lbdata_ = nullptr; /**< The LB Data context */
CtxSetContextPtr ctx_setcontext_ = nullptr; /**< The SetContext context */
CtxTDPtr ctx_td_ = nullptr; /**< The TD context */
CtxCollectionPtr ctx_collection_ = nullptr; /**< The Collection context */
CtxContinuationPtr ctx_continuation_ =
nullptr; /**< The Continuation context */
CtxLBDataPtr ctx_lbdata_ = nullptr; /**< The LB Data context */
CtxSetContextPtr ctx_setcontext_ = nullptr; /**< The SetContext context */
CtxTDPtr ctx_td_ = nullptr; /**< The TD context */
CtxCollectionPtr ctx_collection_ = nullptr; /**< The Collection context */
};

}} /* end namespace vt::runnable */
Expand Down
7 changes: 4 additions & 3 deletions src/vt/runnable/runnable.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ void RunnableNew::addContext(Args&&... args) {
T, detail::runnable_context_max_size
>(*up_pool.get(), std::forward<Args>(args)...);

addContext(vt::util::ptr::unique_fixed_to_base<T, detail::runnable_context_max_size>(
*up_pool.get(), std::move(c)
));
addContext(
vt::util::ptr::unique_fixed_to_base<T, detail::runnable_context_max_size>(
*up_pool.get(), std::move(c)
));
}

}} /* end namespace vt::runnable */
Expand Down

0 comments on commit b138399

Please sign in to comment.