Skip to content

Commit 46cabaa

Browse files
authored
Fix some documentation issues (#716)
- Fix outdated text in tutorial - Deny warnings in ci-doc - Fix some links in rustdoc
1 parent 2300ce1 commit 46cabaa

File tree

14 files changed

+29
-35
lines changed

14 files changed

+29
-35
lines changed

.github/scripts/ci-doc.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
# rustdoc.yml will copy the docs from respective directories to a directory for publishing.
44
# If the output path is changed in this script, we need to update rustdoc.yml as well.
55

6+
# deny warnings for rustdoc
7+
export RUSTFLAGS="-D warnings"
8+
69
# Check cargo doc
710
# We generate two versions of docs: one with only public items for binding developers for our API, and
811
# the other with both public and private items for MMTk developers (GC implementers).

docs/tutorial/code/mygc_semispace/gc_work.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ impl<VM: VMBinding> crate::scheduler::GCWorkContext for MyGCWorkContext2<VM> {
2525
}
2626
// ANCHOR: workcontext_plan
2727

28-
use crate::util::{Address, ObjectReference};
28+
use crate::util::ObjectReference;
2929
use crate::util::copy::CopySemantics;
3030
use crate::MMTK;
3131
use crate::policy::space::Space;

docs/tutorial/code/mygc_semispace/global.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,12 @@ use crate::policy::space::Space;
1313
use crate::scheduler::*; // Modify
1414
use crate::util::alloc::allocators::AllocatorSelector;
1515
use crate::util::copy::*;
16-
use crate::util::heap::layout::heap_layout::Mmapper;
17-
use crate::util::heap::layout::heap_layout::VMMap;
18-
use crate::util::heap::HeapMeta;
1916
use crate::util::heap::VMRequest;
2017
use crate::util::metadata::side_metadata::{SideMetadataSanity, SideMetadataContext};
21-
use crate::util::options::Options;
2218
use crate::util::opaque_pointer::*;
2319
use crate::vm::VMBinding;
2420
use enum_map::EnumMap;
2521
use std::sync::atomic::{AtomicBool, Ordering}; // Add
26-
use std::sync::Arc;
2722
// ANCHOR_END: imports_no_gc_work
2823

2924
// Remove #[allow(unused_imports)].

docs/tutorial/code/mygc_semispace/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// This module's code is unused When we compile this module with MMTk core. Allow it.
2+
#![allow(dead_code)]
3+
14
mod gc_work; // Add
25
mod global;
36
mod mutator;

docs/tutorial/src/mygc/ss/alloc.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@ Finished code (step 2):
6666
{{#include ../../../code/mygc_semispace/global.rs:plan_def}}
6767
```
6868

69+
Note that we have attributes on some fields. These attributes tell MMTk's macros on
70+
how to generate code to trace objects in this plan. Although there are other approaches that
71+
you can implement object tracing, in this tutorial we use the macros, as it is the simplest.
72+
Make sure you import the macros. We will discuss on what those attributes mean in later sections.
73+
74+
```rust
75+
use mmtk_macros::PlanTraceObject;
76+
```
77+
6978
### Implement the Plan trait for MyGC
7079

7180
#### Constructor
@@ -88,16 +97,6 @@ that you just defined.
8897
{{#include ../../../code/mygc_semispace/global.rs:plan_new}}
8998
```
9099

91-
#### Initializer
92-
93-
Find `gc_init()`. Change it to initialise the common plan and the two
94-
copyspaces, rather than the base plan and mygc_space. The contents of the
95-
initializer calls are identical.
96-
97-
```rust
98-
{{#include ../../../code/mygc_semispace/global.rs:gc_init}}
99-
```
100-
101100
### Access MyGC spaces
102101

103102
Add a new section of methods for MyGC:

src/memory_manager.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ use crate::vm::ReferenceGlue;
2828
use crate::vm::VMBinding;
2929
use std::sync::atomic::Ordering;
3030

31-
/// Initialize an MMTk instance. A VM should call this method after creating an [MMTK](../mmtk/struct.MMTK.html)
31+
/// Initialize an MMTk instance. A VM should call this method after creating an [`crate::MMTK`]
3232
/// instance but before using any of the methods provided in MMTk (except `process()` and `process_bulk()`).
3333
///
3434
/// We expect a binding to ininitialize MMTk in the following steps:
3535
///
36-
/// 1. Create an [MMTKBuilder](../mmtk/struct.MMTKBuilder.html) instance.
37-
/// 2. Set command line options for MMTKBuilder by [process()](./fn.process.html) or [process_bulk()](./fn.process_bulk.html).
36+
/// 1. Create an [`crate::MMTKBuilder`] instance.
37+
/// 2. Set command line options for MMTKBuilder by [`crate::memory_manager::process`] or [`crate::memory_manager::process_bulk`].
3838
/// 3. Initialize MMTk by calling this function, `mmtk_init()`, and pass the builder earlier. This call will return an MMTK instance.
3939
/// Usually a binding store the MMTK instance statically as a singleton. We plan to allow multiple instances, but this is not yet fully
4040
/// supported. Currently we assume a binding will only need one MMTk instance.
41-
/// 4. Enable garbage collection in MMTk by [enable_collection()](./fn.enable_collection.html). A binding should only call this once its
41+
/// 4. Enable garbage collection in MMTk by [`crate::memory_manager::enable_collection`]. A binding should only call this once its
4242
/// thread system is ready. MMTk will not trigger garbage collection before this call.
4343
///
4444
/// Note that this method will attempt to initialize a logger. If the VM would like to use its own logger, it should initialize the logger before calling this method.

src/plan/global.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,7 @@ pub enum AllocationSemantics {
10271027
Immortal = 1,
10281028
/// Large objects. It is usually desirable to allocate large objects specially. Large objects
10291029
/// are allocated with page granularity and will not be moved.
1030-
/// Each plan provides `max_non_los_default_alloc_bytes` (see [`crate::plan::plan_constraints::PlanConstraints`]),
1030+
/// Each plan provides `max_non_los_default_alloc_bytes` (see [`crate::plan::PlanConstraints`]),
10311031
/// which defines a threshold for objects that can be allocated with the default semantic. Any object that is larger than the
10321032
/// threshold must be allocated with the `Los` semantic.
10331033
/// This semantic may get removed and MMTk will transparently allocate into large object space for large objects.

src/policy/copy_context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::vm::VMBinding;
99
/// mature space is ImmixSpace. When we copy from nursery to mature, ImmixCopyContext should be
1010
/// used.
1111
/// Note that this trait should only be implemented with policy specific behaviors. Please
12-
/// refer to [GCWorkerCopyContext](util/copy/struct.GCWorkerCopyContext.html) which implements common
12+
/// refer to [`crate::util::copy::GCWorkerCopyContext`] which implements common
1313
/// behaviors for copying.
1414
pub trait PolicyCopyContext: 'static + Send {
1515
type VM: VMBinding;

src/scheduler/gc_work.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ use crate::plan::Plan;
763763
use crate::plan::PlanTraceObject;
764764
use crate::policy::gc_work::TraceKind;
765765

766-
/// This provides an implementation of [`ProcessEdgesWork`](scheduler/gc_work/ProcessEdgesWork). A plan that implements
766+
/// This provides an implementation of [`crate::scheduler::gc_work::ProcessEdgesWork`]. A plan that implements
767767
/// `PlanTraceObject` can use this work packet for tracing objects.
768768
pub struct PlanProcessEdges<
769769
VM: VMBinding,

src/util/copy/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const MAX_IMMIX_COPY_ALLOCATORS: usize = 2;
2424
type CopySpaceMapping<VM> = Vec<(CopySelector, &'static dyn Space<VM>)>;
2525

2626
/// A configuration for GCWorkerCopyContext.
27-
/// Similar to [MutatorConfig](plan/mutator_context/struct.MutatorConfig.html),
27+
/// Similar to a `MutatorConfig`,
2828
/// We expect each copying plan to provide a CopyConfig.
2929
pub struct CopyConfig<VM: VMBinding> {
3030
/// Mapping CopySemantics to the actual copying allocators (CopySelector)

0 commit comments

Comments
 (0)