Skip to content

Commit

Permalink
#1983: location: pass MsgSharedPtr by const&
Browse files Browse the repository at this point in the history
  • Loading branch information
lifflander committed Sep 27, 2022
1 parent d7d9fdf commit b3683c6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
13 changes: 8 additions & 5 deletions src/vt/topos/location/location.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ struct EntityLocationCoord : LocationCoord {
*/
template <typename MessageT, ActiveTypedFnType<MessageT> *f>
void routeMsgHandler(
EntityID const& id, NodeType const& home_node, MsgSharedPtr<MessageT> msg
EntityID const& id, NodeType const& home_node,
MsgSharedPtr<MessageT> const& msg
);

/**
Expand All @@ -246,7 +247,8 @@ struct EntityLocationCoord : LocationCoord {
*/
template <typename MessageT>
void routeMsg(
EntityID const& id, NodeType const& home_node, MsgSharedPtr<MessageT> msg,
EntityID const& id, NodeType const& home_node,
MsgSharedPtr<MessageT> const& msg,
NodeType from_node = uninitialized_destination
);

Expand Down Expand Up @@ -331,7 +333,7 @@ struct EntityLocationCoord : LocationCoord {
* \return whether it is of eager size
*/
template <typename MessageT>
bool useEagerProtocol(MsgSharedPtr<MessageT> msg) const;
bool useEagerProtocol(MsgSharedPtr<MessageT> const& msg) const;

private:
/**
Expand Down Expand Up @@ -372,7 +374,8 @@ struct EntityLocationCoord : LocationCoord {
*/
template <typename MessageT>
void routeMsgEager(
EntityID const& id, NodeType const& home_node, MsgSharedPtr<MessageT> msg
EntityID const& id, NodeType const& home_node,
MsgSharedPtr<MessageT> const& msg
);

/**
Expand All @@ -386,7 +389,7 @@ struct EntityLocationCoord : LocationCoord {
template <typename MessageT>
void routeMsgNode(
EntityID const& id, NodeType const& home_node, NodeType const& to_node,
MsgSharedPtr<MessageT> msg
MsgSharedPtr<MessageT> const& msg
);

/**
Expand Down
19 changes: 12 additions & 7 deletions src/vt/topos/location/location.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,9 @@ struct IsSerializable<

template <typename EntityID>
template <typename MessageT>
bool EntityLocationCoord<EntityID>::useEagerProtocol(MsgSharedPtr<MessageT> msg) const {
bool EntityLocationCoord<EntityID>::useEagerProtocol(
MsgSharedPtr<MessageT> const& msg
) const {
if (detail::IsSerializable<MessageT>::is_ser) {
return false;
} else {
Expand Down Expand Up @@ -335,7 +337,8 @@ void EntityLocationCoord<EntityID>::insertPendingEntityAction(
template <typename EntityID>
template <typename MessageT>
void EntityLocationCoord<EntityID>::routeMsgEager(
EntityID const& id, NodeType const& home_node, MsgSharedPtr<MessageT> msg
EntityID const& id, NodeType const& home_node,
MsgSharedPtr<MessageT> const& msg
) {
auto const& this_node = theContext()->getNode();
NodeType route_to_node = uninitialized_destination;
Expand Down Expand Up @@ -503,7 +506,7 @@ template <typename EntityID>
template <typename MessageT>
void EntityLocationCoord<EntityID>::routeMsgNode(
EntityID const& id, NodeType const& home_node, NodeType const& to_node,
MsgSharedPtr<MessageT> msg
MsgSharedPtr<MessageT> const& msg
) {
auto const& this_node = theContext()->getNode();
auto const epoch = theMsg()->getEpochContextMsg(msg);
Expand Down Expand Up @@ -533,8 +536,9 @@ void EntityLocationCoord<EntityID>::routeMsgNode(
// set the instance on the message to deliver to the correct manager
msg->setLocInst(this_inst);

auto m = msg;
// send to the node discovered by the location manager
theMsg()->sendMsg<MessageT, routedHandler>(to_node, msg);
theMsg()->sendMsg<MessageT, routedHandler>(to_node, m);
} else {
vt_debug_print(
normal, location,
Expand Down Expand Up @@ -651,7 +655,8 @@ void EntityLocationCoord<EntityID>::routeNonEagerAction(
template <typename EntityID>
template <typename MessageT, ActiveTypedFnType<MessageT> *f>
void EntityLocationCoord<EntityID>::routeMsgHandler(
EntityID const& id, NodeType const& home_node, MsgSharedPtr<MessageT> msg
EntityID const& id, NodeType const& home_node,
MsgSharedPtr<MessageT> const& msg
) {
using auto_registry::HandlerManagerType;

Expand All @@ -670,8 +675,8 @@ void EntityLocationCoord<EntityID>::routeMsgHandler(
template <typename EntityID>
template <typename MessageT>
void EntityLocationCoord<EntityID>::routeMsg(
EntityID const& id, NodeType const& home_node, MsgSharedPtr<MessageT> msg,
NodeType from_node
EntityID const& id, NodeType const& home_node,
MsgSharedPtr<MessageT> const& msg, NodeType from_node
) {
auto const from =
from_node == uninitialized_destination ? theContext()->getNode() :
Expand Down

0 comments on commit b3683c6

Please sign in to comment.