Skip to content

Commit ad9ecc4

Browse files
committed
Split exported_symbols for generic and non-generic symbols
This reduces metadata decoder overhead during the monomorphization collector.
1 parent b19d928 commit ad9ecc4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/bin/miri.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ fn entry_fn(tcx: TyCtxt<'_>) -> (DefId, MiriEntryFnType) {
8585
return (def_id, MiriEntryFnType::Rustc(entry_type));
8686
}
8787
// Look for a symbol in the local crate named `miri_start`, and treat that as the entry point.
88-
let sym = tcx.exported_symbols(LOCAL_CRATE).iter().find_map(|(sym, _)| {
88+
let sym = tcx.exported_non_generic_symbols(LOCAL_CRATE).iter().find_map(|(sym, _)| {
8989
if sym.symbol_name_for_local_instance(tcx).name == "miri_start" { Some(sym) } else { None }
9090
});
9191
if let Some(ExportedSymbol::NonGeneric(id)) = sym {
@@ -249,10 +249,10 @@ impl rustc_driver::Callbacks for MiriBeRustCompilerCalls {
249249
// Queries overridden here affect the data stored in `rmeta` files of dependencies,
250250
// which will be used later in non-`MIRI_BE_RUSTC` mode.
251251
config.override_queries = Some(|_, local_providers| {
252-
// `exported_symbols` and `reachable_non_generics` provided by rustc always returns
252+
// `exported_non_generic_symbols` and `reachable_non_generics` provided by rustc always returns
253253
// an empty result if `tcx.sess.opts.output_types.should_codegen()` is false.
254254
// In addition we need to add #[used] symbols to exported_symbols for `lookup_link_section`.
255-
local_providers.exported_symbols = |tcx, LocalCrate| {
255+
local_providers.exported_non_generic_symbols = |tcx, LocalCrate| {
256256
let reachable_set = tcx.with_stable_hashing_context(|hcx| {
257257
tcx.reachable_set(()).to_sorted(&hcx, true)
258258
});

src/helpers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ pub fn iter_exported_symbols<'tcx>(
162162

163163
// We can ignore `_export_info` here: we are a Rust crate, and everything is exported
164164
// from a Rust crate.
165-
for &(symbol, _export_info) in tcx.exported_symbols(cnum) {
165+
for &(symbol, _export_info) in tcx.exported_non_generic_symbols(cnum) {
166166
if let ExportedSymbol::NonGeneric(def_id) = symbol {
167167
f(cnum, def_id)?;
168168
}

0 commit comments

Comments
 (0)