-
Notifications
You must be signed in to change notification settings - Fork 68
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
Introduce a context object for GC controller thread #533
Conversation
This commit introduces the `GCController` struct. It is owned by the GC controller thread. It owns the `GCWorker` for the controller, and has references to objects that it needs to communicate with other threads. Previously, those dependencies were scattered in `ControllerCollectorContext` and `GCWorkScheduler`, which complicated the initialization of the MMTk instance and the GC controller thread.
Move the GCWorkScheduler::wait_for_completion method to the GCController type. This allows us to move controller-specific fields away from GCWorkScheduler, too.
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.
Very nice refactoring. It makes the code much cleaner. As this PR is still a draft, I did not approve it. But I do not see any major issue with the PR.
- Renamed ControllerCollectorContext to GCRequester - Removed initializer and finalizer functions from GCWorkScheduler - The embedded GCController is no longer boxed. - Added comments - Minor adjustment to API functions. - Other minor fixes.
@qinsoon I made changes according to your suggestions. I set this PR to be ready for review. When I was reading the code of |
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.
LGTM
Binding updates for this PR: |
This is one of a series of planned changes to refactor the scheduler. The problems are described in issue #532
This PR introduces the
GCController
struct. LikeGCWorker
, aGCController
shall be owned by the GC controller thread. It owns itsGCWorker
(thecoordinator_worker
) and the receiving end of the worker-to-controller channel. It also has references to the data structures it needs to work with, including the scheduler and theControllerCollectorContext
which is used to trigger GC.Because of this new struct, some related fields and operations are removed from
ControllerCollectorContext
andGCWorkScheduler
.There is also an API change.
spawn_worker_thread
is renamed tospawn_gc_thread
. Now both GC worker threads and the GC controller thread are spawn with a context object.This PR does not change the two-phase initialisation of
GCWorkScheduler
. It will be done in another PR.