Skip to content

Commit

Permalink
#1941: simplify TD member functions
Browse files Browse the repository at this point in the history
  • Loading branch information
stmcgovern committed Sep 19, 2022
1 parent f4183f5 commit 7c36300
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions src/vt/context/runnable_context/td.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

namespace vt { namespace ctx {


TD::TD(EpochType in_ep)
: ep_(in_ep == no_epoch ? term::any_epoch_sentinel : in_ep)
{
Expand All @@ -56,34 +57,33 @@ TD::TD(EpochType in_ep)
}

/*virtual*/ TD::~TD() {
if (ep_ != no_epoch) {
theTerm()->consume(ep_);
}
// auto& epoch_stack = theTerm()->getEpochStack();
// // Pop all extraneous epochs off the stack greater than 1
// auto stack_size = epoch_stack.size();
// while (stack_size > 1) {
// stack_size = (epoch_stack.pop(), epoch_stack.size());
// }
// // Pop off the last epoch: term::any_epoch_sentinel
// auto const ret_epoch = theTerm()->popEpoch(term::any_epoch_sentinel);
// vtAssertInfo(
// ret_epoch == term::any_epoch_sentinel, "Last pop must be any epoch",
// ret_epoch, term::any_epoch_sentinel, epoch_stack.size()
// );
// vtAssertExpr(epoch_stack.size() == 0);
// if (ep_ != no_epoch) {
// theTerm()->consume(ep_);
// }
}

void TD::begin() {
theTerm()->pushEpoch(ep_);

auto& epoch_stack = theTerm()->getEpochStack();


base_epoch_stack_size_ = epoch_stack.size();
theTerm()->pushEpochFast(ep_);
}

void TD::end() {
auto& epoch_stack = theTerm()->getEpochStack();


vtAssert(
base_epoch_stack_size_ <= epoch_stack.size(),
"Epoch stack popped below preceding push size in handler"
);

while (epoch_stack.size() > base_epoch_stack_size_) {
theTerm()->popEpoch();
}

theTerm()->popEpoch(ep_);
theTerm()->popEpochFast(ep_);
theTerm()->consume(ep_);
}

void TD::suspend() {
Expand Down

0 comments on commit 7c36300

Please sign in to comment.