-
Notifications
You must be signed in to change notification settings - Fork 389
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
scheduler: extract memo invalidation from the status field #10518
scheduler: extract memo invalidation from the status field #10518
Conversation
8166393
to
904bd78
Compare
904bd78
to
38f836a
Compare
src/dune_engine/scheduler.ml
Outdated
@@ -782,17 +782,44 @@ end = struct | |||
;; | |||
end | |||
|
|||
module Trigger : sig | |||
(** Conceptually, a [unit Fiber.Ivar.t] that may be filled more than once. *) |
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.
More precisely, fills past the first one are ignored. So I would call this idempotent instead.
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.
Yes, good point. Note that since the data is unit, ignoring a fill is indistinguishable from not ignoring it. I've expanded the comment with more nuance. Feel free to edit it a bit if you prefer a different wording.
640ed09
to
9c8b43c
Compare
Previously, we had the invariant that when we're building something we have no pending invalidation. That seems kind of an important invariant to me. |
That invariant is still upheld, unless I'm mistaken. I think what you're saying that the types used to enforce the invariant, and with this change they don't; is that right? But I don't think the types were enforcing anything. Just because My ultimate plan is to get rid of the |
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.
I tried to think about how we could misuse an invalidation when status = Building
but couldn't think of anything concrete.W ould it be helpful to add an assertion that the invalidations are empty when transitioning from Building
to Standing_by
?
That might be a good assertion to have, but if we merge the sequel to this PR or the alternative sequel, then it either wouldn't make sense because the status field would be gone, or it wouldn't be true anymore, because we'd actually leave the build in the |
The assert isn't strictly necessary. It was just a suggestion. |
The accumulation of the invalidation is orthogonal to what the build status is. Regardless of how the build progresses, we should always continually combine new build input change into the current invalidation, and we should only set the invalidation to empty when we also call Memo.reset with the current invalidation. At the same time, it also makes sense to cleanup the handling of the "build_input_change" ivar. There is no need for it to be an option that is initialized on-demand, since it is easy and cheap to just create an initial ivar. In addition, we shouldn't care what the current build status is when waiting for a file to change. (I suspect that some of the reason for the complication is due to the "--react-to-insignificant-file changes" flag that no longer exists. This patch doesn't claim to fix any bugs; it's just intended as a code cleanup. Signed-Off-By: Philip White <code@trailingwhite.space>
9c8b43c
to
83c0c79
Compare
The accumulation of the invalidation is orthogonal to what the build status is. Regardless of how the build progresses, we should always continually combine new build input change into the current invalidation, and we should only set the invalidation to empty when we also call Memo.reset with the current invalidation.
At the same time, it also makes sense to cleanup the handling of the
build_input_change
ivar. There is no need for it to be an option that is initialized on-demand, since it is easy and cheap to just create an initial ivar. In addition, we shouldn't care what the current build status is when waiting for a file to change. (I suspect that some of the reason for the complication is due to the--react-to-insignificant-file changes
flag that no longer exists.) I think it should be handled in a similar way to the memo invalidation: it should be accumulated and reset at the same time. Here is an invariant:build_inputs_changed
should be empty if and only if the memo invalidation is empty.This patch doesn't claim to fix any bugs; it's just intended as a code cleanup.