-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#410: Dependent Epochs rewritten #2204
base: develop
Are you sure you want to change the base?
Changes from 1 commit
ccd5afd
b393469
9a1efe8
72fbfec
5cd8599
10147f4
1db25fa
a9816c6
4de8a74
bfdc3f4
3c1ac7f
cdf69ab
9764708
a974aba
3e76af5
3d2b117
f746269
cb2b519
4b3a9c6
48f7a8c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,22 +120,33 @@ void Scheduler::enqueue(MsgT* msg, RunT r) { | |
template <typename UnitT> | ||
void Scheduler::enqueueOrPostpone(UnitT unit) { | ||
auto r = unit.getRunnable(); | ||
auto ep = r->getEpoch(); | ||
|
||
bool const is_dep = epoch::EpochManip::isDep(ep); | ||
|
||
if (is_dep) { | ||
auto obj = r->getObj(); | ||
if (ep != no_epoch and ep != term::any_epoch_sentinel) { | ||
if (obj and r->isObjGroup()) { | ||
auto proxy = objgroup::getProxyFromPtr(obj); | ||
if (released_objgroups_[ep].find(proxy) == released_objgroups_[ep].end()) { | ||
pending_objgroup_work_[ep][proxy].push(unit); | ||
auto m = r->getMsg(); | ||
|
||
// If it's a system message we can schedule it right away | ||
if (m and not m->env.system_msg) { | ||
auto ep = r->getEpoch(); | ||
bool const is_dep = epoch::EpochManip::isDep(ep); | ||
if (is_dep) { | ||
auto obj = r->getObj(); | ||
if (ep != no_epoch and ep != term::any_epoch_sentinel) { | ||
Comment on lines
+130
to
+131
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with Phil's comment about peeling off cases. If you're not going to do that, you might at least reverse the order of these two lines. |
||
if (obj) { | ||
if (r->isObjGroup()) { | ||
auto proxy = objgroup::getProxyFromPtr(obj); | ||
if (released_objgroups_[ep].find(proxy) == released_objgroups_[ep].end()) { | ||
pending_objgroup_work_[ep][proxy].push(unit); | ||
return; | ||
} | ||
} else { | ||
auto untyped = static_cast<UntypedCollection*>(obj); | ||
if (not untyped->isReleasedEpoch(ep)) { | ||
pending_collection_work_[ep][untyped].push(unit); | ||
return; | ||
} | ||
} | ||
} else if (not theTerm()->epochReleased(ep)) { | ||
pending_work_[ep].push(unit); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The nesting is getting really deep here. It might be nice to peel off some of the cases as early returns, if/as possible. |
||
return; | ||
} | ||
} else if (not theTerm()->epochReleased(ep)) { | ||
pending_work_[ep].push(unit); | ||
return; | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe better to
move
the values fromcontainer
, rather than actually removing them, so that no work needs to be done on the structure ofcontainer
itself, which is going away right after this loop.I.e.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem with this is that
container
is not iterable. The container is a hybrid queue implemented differently depending on whether priorities are enabled. If they are not, it is a 64 entry circular buffer with an overflowstd::queue
container. We could make it iterable, but it would need a custom iterator.