Skip to content

Commit e4fb3a6

Browse files
committed
Auto merge of #143013 - bjorn3:split_exported_symbols, r=oli-obk
Split exported_symbols for generic and non-generic symbols This reduces metadata decoder overhead during the monomorphization collector.
2 parents d79d0ca + ad9ecc4 commit e4fb3a6

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 {
@@ -250,10 +250,10 @@ impl rustc_driver::Callbacks for MiriBeRustCompilerCalls {
250250
// Queries overridden here affect the data stored in `rmeta` files of dependencies,
251251
// which will be used later in non-`MIRI_BE_RUSTC` mode.
252252
config.override_queries = Some(|_, local_providers| {
253-
// `exported_symbols` and `reachable_non_generics` provided by rustc always returns
253+
// `exported_non_generic_symbols` and `reachable_non_generics` provided by rustc always returns
254254
// an empty result if `tcx.sess.opts.output_types.should_codegen()` is false.
255255
// In addition we need to add #[used] symbols to exported_symbols for `lookup_link_section`.
256-
local_providers.exported_symbols = |tcx, LocalCrate| {
256+
local_providers.exported_non_generic_symbols = |tcx, LocalCrate| {
257257
let reachable_set = tcx.with_stable_hashing_context(|hcx| {
258258
tcx.reachable_set(()).to_sorted(&hcx, true)
259259
});

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)