Skip to content

Commit

Permalink
Update wasm_import_module_map and target_features_whitelist
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoxc committed May 23, 2019
1 parent 9b648f7 commit 46f2511
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
8 changes: 8 additions & 0 deletions src/librustc/arena.rs
Expand Up @@ -83,6 +83,14 @@ macro_rules! arena_types {
[few] features: syntax::feature_gate::Features,
[few] all_traits: Vec<rustc::hir::def_id::DefId>,
[few] privacy_access_levels: rustc::middle::privacy::AccessLevels,
[few] target_features_whitelist: rustc_data_structures::fx::FxHashMap<
String,
Option<syntax::symbol::Symbol>
>,
[few] wasm_import_module_map: rustc_data_structures::fx::FxHashMap<
rustc::hir::def_id::DefId,
String
>,
], $tcx);
)
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/query/mod.rs
Expand Up @@ -155,7 +155,7 @@ rustc_queries! {
}

Linking {
query wasm_import_module_map(_: CrateNum) -> Lrc<FxHashMap<DefId, String>> {
query wasm_import_module_map(_: CrateNum) -> &'tcx FxHashMap<DefId, String> {
desc { "wasm import module map" }
}
}
Expand Down Expand Up @@ -1050,7 +1050,7 @@ rustc_queries! {
}

Other {
query target_features_whitelist(_: CrateNum) -> Lrc<FxHashMap<String, Option<Symbol>>> {
query target_features_whitelist(_: CrateNum) -> &'tcx FxHashMap<String, Option<Symbol>> {
eval_always
desc { "looking up the whitelist of target features" }
}
Expand Down
7 changes: 3 additions & 4 deletions src/librustc_codegen_llvm/attributes.rs
Expand Up @@ -10,7 +10,6 @@ use rustc::ty::{self, TyCtxt, PolyFnSig};
use rustc::ty::layout::HasTyCtxt;
use rustc::ty::query::Providers;
use rustc_data_structures::small_c_str::SmallCStr;
use rustc_data_structures::sync::Lrc;
use rustc_data_structures::fx::FxHashMap;
use rustc_target::spec::PanicStrategy;
use rustc_codegen_ssa::traits::*;
Expand Down Expand Up @@ -320,11 +319,11 @@ pub fn provide(providers: &mut Providers<'_>) {
if tcx.sess.opts.actually_rustdoc {
// rustdoc needs to be able to document functions that use all the features, so
// whitelist them all
Lrc::new(llvm_util::all_known_features()
tcx.arena.alloc(llvm_util::all_known_features()
.map(|(a, b)| (a.to_string(), b))
.collect())
} else {
Lrc::new(llvm_util::target_feature_whitelist(tcx.sess)
tcx.arena.alloc(llvm_util::target_feature_whitelist(tcx.sess)
.iter()
.map(|&(a, b)| (a.to_string(), b))
.collect())
Expand Down Expand Up @@ -364,7 +363,7 @@ pub fn provide_extern(providers: &mut Providers<'_>) {
}));
}

Lrc::new(ret)
tcx.arena.alloc(ret)
};
}

Expand Down
Expand Up @@ -47,8 +47,8 @@ impl CodegenBackend for TheBackend {
fn provide(&self, providers: &mut Providers) {
rustc_codegen_utils::symbol_names::provide(providers);

providers.target_features_whitelist = |_tcx, _cnum| {
Default::default() // Just a dummy
providers.target_features_whitelist = |tcx, _cnum| {
tcx.arena.alloc(Default::default()) // Just a dummy
};
providers.is_reachable_non_generic = |_tcx, _defid| true;
providers.exported_symbols = |_tcx, _crate| Arc::new(Vec::new());
Expand Down

0 comments on commit 46f2511

Please sign in to comment.