Skip to content
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

Add missing docs for the rest of the code base (merge after #1026) #1028

Merged
merged 25 commits into from
Nov 23, 2023

Conversation

qinsoon
Copy link
Member

@qinsoon qinsoon commented Nov 20, 2023

This is the last PR for adding missing docs, and it closes #309. All the public items should be documented properly now, and #![deny(missing_docs)] is used so any new public item that does not have rustdoc will cause the build to fail.

@qinsoon qinsoon added the PR-testing Run binding tests for the pull request (deprecated: use PR-extended-testing instead) label Nov 20, 2023
@qinsoon
Copy link
Member Author

qinsoon commented Nov 23, 2023

binding-refs
JIKESRVM_BINDING_REPO=qinsoon/mmtk-jikesrvm
JIKESRVM_BINDING_REF=update-mmtk-core-pr-1028

@qinsoon qinsoon requested a review from wks November 23, 2023 02:22
@qinsoon
Copy link
Member Author

qinsoon commented Nov 23, 2023

#![deny(missing_docs)] could be a bit annoying for prototyping and developing, as the build will fail. I will remove it, and only check and deny missing_docs in the CI script (ci-doc.sh).

src/plan/global.rs Outdated Show resolved Hide resolved
src/plan/mutator_context.rs Outdated Show resolved Hide resolved
src/plan/plan_constraints.rs Outdated Show resolved Hide resolved
src/plan/semispace/global.rs Outdated Show resolved Hide resolved
Comment on lines 345 to 349
/// Explicitly execute a work packet in the current context (the given worker, and the current work packet).
/// The statistics collected for executing the work are counted into the current context.
/// This is NOT the normal way to execute a work packet: most work packets are polled and executed in
/// the worker's main loop ([`GCWorker::run`]). This method is only intended for cases where you would like to
/// explicitly execute a work packet under the current context.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this method be public (or exist at all)? This method is only called in one place (start_or_dispatch_scan_work), but there are more use patters of calling GCWork::do_work directly, for example, ProcessModBuf::do_work and ProcessRegionModBuf::do_work.

I think we can simply remove this method and let the user call GCWork::do_work directly if they have to, and add similar warnings to the doc comments of GCWork::do_work.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed both methods.

Comment on lines 354 to 359
/// Explicitly execute a boxed work packet in the current context.
/// See [`GCWorker::do_work`] for more information.
pub fn do_boxed_work(&'static mut self, mut work: Box<dyn GCWork<VM>>) {
work.do_work(self, self.mmtk);
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to do_work, but do_boxed_work is not used in mmtk-core at all. We may remove this function, too.

@qinsoon qinsoon removed the PR-testing Run binding tests for the pull request (deprecated: use PR-extended-testing instead) label Nov 23, 2023
Comment on lines 17 to 21
/// Only call this method if you would like to explicitly execute a work packet in the current context
/// (the given worker, and the current work packet). The statistics collected for executing the work are
/// counted into the current context. This is NOT the normal way to execute a work packet: most work packets
/// are polled and executed in the worker's main loop ([`GCWorker::run`]) using `do_work_with_stat`.
/// This method should only be called directly if you would like to explicitly execute a work packet under the current context.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We never used the term "context" to refer to the worker and the work packet in other places, so it should be easier to understand if we don't use that word, or be more specific.

Suggested change
/// Only call this method if you would like to explicitly execute a work packet in the current context
/// (the given worker, and the current work packet). The statistics collected for executing the work are
/// counted into the current context. This is NOT the normal way to execute a work packet: most work packets
/// are polled and executed in the worker's main loop ([`GCWorker::run`]) using `do_work_with_stat`.
/// This method should only be called directly if you would like to explicitly execute a work packet under the current context.
///
/// Most work packets are polled and executed in the worker's main loop ([`GCWorker::run`])
/// using `do_work_with_stat`. If `do_work` is called directly during the execution of another
/// work packet, bypassing `do_work_with_stat()`, this work packet will not be counted into the
/// number of work packets executed, and the execution time of this work packet will be counted
/// as part of the execution time of the other work packet. Only call this method directly if
/// this is what you intended. But you should always consider putting the other work packet
/// into a bucket so that other GC workers can execute it in parallel, unless the context-
/// switching overhead is a problem.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the comments, and used most of your suggestions.

@qinsoon qinsoon added the PR-testing Run binding tests for the pull request (deprecated: use PR-extended-testing instead) label Nov 23, 2023
Copy link
Collaborator

@wks wks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@qinsoon qinsoon added this pull request to the merge queue Nov 23, 2023
Merged via the queue into mmtk:master with commit a87636c Nov 23, 2023
25 of 26 checks passed
@qinsoon qinsoon deleted the missing-docs-rest branch November 23, 2023 12:45
mmtkgc-bot added a commit to mmtk/mmtk-jikesrvm that referenced this pull request Nov 23, 2023
* Update to mmtk/mmtk-core#1028
* Move `num_specialized_scans` to the binding.

---------

Co-authored-by: mmtkgc-bot <mmtkgc.bot@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-testing Run binding tests for the pull request (deprecated: use PR-extended-testing instead)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing documents/comments for public items
2 participants