about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rustdoc-json-types/lib.rs2
-rw-r--r--src/tools/coverage-dump/src/covfun.rs42
-rw-r--r--src/tools/wasm-component-ld/Cargo.toml2
3 files changed, 44 insertions, 2 deletions
diff --git a/src/rustdoc-json-types/lib.rs b/src/rustdoc-json-types/lib.rs
index b3707cf6157..c8b54728d90 100644
--- a/src/rustdoc-json-types/lib.rs
+++ b/src/rustdoc-json-types/lib.rs
@@ -677,7 +677,7 @@ pub struct FunctionHeader {
 /// on unwinding for more info.
 #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
 pub enum Abi {
-    // We only have a concrete listing here for stable ABI's because their are so many
+    // We only have a concrete listing here for stable ABI's because there are so many
     // See rustc_ast_passes::feature_gate::PostExpansionVisitor::check_abi for the list
     /// The default ABI, but that can also be written explicitly with `extern "Rust"`.
     Rust,
diff --git a/src/tools/coverage-dump/src/covfun.rs b/src/tools/coverage-dump/src/covfun.rs
index c779dd0583c..33fac3edccd 100644
--- a/src/tools/coverage-dump/src/covfun.rs
+++ b/src/tools/coverage-dump/src/covfun.rs
@@ -56,6 +56,7 @@ pub(crate) fn dump_covfun_mappings(
             expression_resolver.push_operands(lhs, rhs);
         }
 
+        let mut max_counter = None;
         for i in 0..num_files {
             let num_mappings = parser.read_uleb128_u32()?;
             println!("Number of file {i} mappings: {num_mappings}");
@@ -63,6 +64,11 @@ pub(crate) fn dump_covfun_mappings(
             for _ in 0..num_mappings {
                 let (kind, region) = parser.read_mapping_kind_and_region()?;
                 println!("- {kind:?} at {region:?}");
+                kind.for_each_term(|term| {
+                    if let CovTerm::Counter(n) = term {
+                        max_counter = max_counter.max(Some(n));
+                    }
+                });
 
                 match kind {
                     // Also print expression mappings in resolved form.
@@ -83,6 +89,16 @@ pub(crate) fn dump_covfun_mappings(
         }
 
         parser.ensure_empty()?;
+
+        // Printing the highest counter ID seen in the functions mappings makes
+        // it easier to determine whether a change to coverage instrumentation
+        // has increased or decreased the number of physical counters needed.
+        // (It's possible for the generated code to have more counters that
+        // aren't used by any mappings, but that should hopefully be rare.)
+        println!("Highest counter ID seen: {}", match max_counter {
+            Some(id) => format!("c{id}"),
+            None => "(none)".to_owned(),
+        });
         println!();
     }
     Ok(())
@@ -271,6 +287,32 @@ enum MappingKind {
     },
 }
 
+impl MappingKind {
+    fn for_each_term(&self, mut callback: impl FnMut(CovTerm)) {
+        match *self {
+            Self::Code(term) => callback(term),
+            Self::Gap(term) => callback(term),
+            Self::Expansion(_id) => {}
+            Self::Skip => {}
+            Self::Branch { r#true, r#false } => {
+                callback(r#true);
+                callback(r#false);
+            }
+            Self::MCDCBranch {
+                r#true,
+                r#false,
+                condition_id: _,
+                true_next_id: _,
+                false_next_id: _,
+            } => {
+                callback(r#true);
+                callback(r#false);
+            }
+            Self::MCDCDecision { bitmap_idx: _, conditions_num: _ } => {}
+        }
+    }
+}
+
 struct MappingRegion {
     /// Offset of this region's start line, relative to the *start line* of
     /// the *previous mapping* (or 0). Line numbers are 1-based.
diff --git a/src/tools/wasm-component-ld/Cargo.toml b/src/tools/wasm-component-ld/Cargo.toml
index 49f4e59650e..acdb1aa1ab7 100644
--- a/src/tools/wasm-component-ld/Cargo.toml
+++ b/src/tools/wasm-component-ld/Cargo.toml
@@ -10,4 +10,4 @@ name = "wasm-component-ld"
 path = "src/main.rs"
 
 [dependencies]
-wasm-component-ld = "0.5.9"
+wasm-component-ld = "0.5.10"