Skip to content

Commit cca14fa

Browse files
committed
wip - remove
1 parent ceecc07 commit cca14fa

File tree

5 files changed

+103
-0
lines changed

5 files changed

+103
-0
lines changed

Diff for: Cargo.lock

+1
Original file line numberDiff line numberDiff line change
@@ -1967,6 +1967,7 @@ dependencies = [
19671967
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
19681968
"parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
19691969
"polonius-engine 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
1970+
"rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
19701971
"rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
19711972
"rustc-rayon-core 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
19721973
"rustc_apfloat 0.0.0",

Diff for: src/librustc/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ log = { version = "0.4", features = ["release_max_level_info", "std"] }
2020
polonius-engine = "0.5.0"
2121
rustc-rayon = "0.1.1"
2222
rustc-rayon-core = "0.1.1"
23+
rustc-hash = "1.0.1"
2324
rustc_apfloat = { path = "../librustc_apfloat" }
2425
rustc_target = { path = "../librustc_target" }
2526
rustc_data_structures = { path = "../librustc_data_structures" }

Diff for: src/librustc/dep_graph/graph.rs

+30
Original file line numberDiff line numberDiff line change
@@ -1176,6 +1176,36 @@ pub fn test3(a: &mut SmallVec<[DepNodeIndex; 8]>) {
11761176
pub fn test2(a: &mut DepGraph, dep_node_index: DepNodeIndex) {
11771177
a.read_index(dep_node_index)
11781178
}
1179+
use hir::def_id::DefId;
1180+
use std::hash::{BuildHasher, Hasher};
1181+
use rustc_hash::FxHasher;
1182+
#[no_mangle]
1183+
pub fn test4(a: DefId) -> u64 {
1184+
let mut hasher = FxHasher::default();
1185+
a.hash(&mut hasher);
1186+
hasher.finish()
1187+
}
1188+
use hir::def_id::CrateNum;
1189+
#[no_mangle]
1190+
pub fn test7(a: CrateNum) -> u64 {
1191+
let mut hasher = FxHasher::default();
1192+
a.hash(&mut hasher);
1193+
hasher.finish()
1194+
}
1195+
use syntax::ast::NodeId;
1196+
#[no_mangle]
1197+
pub fn test5(a: NodeId) -> u64 {
1198+
let mut hasher = FxHasher::default();
1199+
a.hash(&mut hasher);
1200+
hasher.finish()
1201+
}
1202+
use hir::HirId;
1203+
#[no_mangle]
1204+
pub fn test6(a: HirId) -> u64 {
1205+
let mut hasher = FxHasher::default();
1206+
a.hash(&mut hasher);
1207+
hasher.finish()
1208+
}
11791209

11801210
pub struct AnonOpenTask {
11811211
reads: SmallVec<[DepNodeIndex; 8]>,

Diff for: src/librustc/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,14 @@
7373
#![feature(transpose_result)]
7474
#![feature(arbitrary_self_types)]
7575
#![feature(hash_raw_entry)]
76+
#![feature(maybe_uninit)]
7677

7778
#![recursion_limit="512"]
7879

7980
#![warn(elided_lifetimes_in_paths)]
8081

8182
extern crate arena;
83+
extern crate rustc_hash;
8284
#[macro_use] extern crate bitflags;
8385
extern crate core;
8486
extern crate fmt_macros;

Diff for: src/librustc/ty/query/plumbing.rs

+69
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,75 @@ pub(super) struct JobOwner<'a, 'tcx: 'a, Q: QueryDescription<'tcx> + 'a> {
103103
layout_depth: usize,
104104
}
105105

106+
use std::mem::MaybeUninit;
107+
#[inline(never)]
108+
pub fn may_panic<'tcx>(job: Lrc<QueryJob<'tcx>>) {
109+
Box::new(job);
110+
}
111+
112+
#[inline(never)]
113+
pub fn test_space() {
114+
}
115+
116+
#[no_mangle]
117+
fn test_moves2<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
118+
key: &::hir::def_id::DefId, key_hash: u64,
119+
span: Span,
120+
parent: &Option<Lrc<QueryJob<'tcx>>>,
121+
mut job_storage: MoveSlot<'a, JobOwner<'a, 'tcx, ::ty::query::queries::type_of<'tcx>>>,
122+
) -> TryGetJob<'a, 'tcx, ::ty::query::queries::type_of<'tcx>> {
123+
use ty::query::config::QueryAccessors;
124+
let mut job = Lrc::new(MaybeUninit::uninitialized());
125+
let parent = parent.clone();
126+
let info = QueryInfo {
127+
span,
128+
query: ::ty::query::queries::type_of::query(*key),
129+
};
130+
*Lrc::get_mut(&mut job).unwrap() =
131+
MaybeUninit::new(QueryJob::new(info, parent));
132+
let job: Lrc<QueryJob<'tcx>> = unsafe { std::mem::transmute(job) };
133+
let job_clone = job.clone();
134+
may_panic(job);
135+
let owner = job_storage.init(JobOwner {
136+
cache: ::ty::query::queries::type_of::query_cache(tcx),
137+
job: job_clone,
138+
key: (*key).clone(),
139+
key_hash,
140+
layout_depth: 83952,
141+
});
142+
TryGetJob::NotYetStarted(owner)
143+
}
144+
145+
#[no_mangle]
146+
fn test_moves<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
147+
key: &::hir::def_id::DefId, key_hash: u64,
148+
span: Span,
149+
mut job_storage: MoveSlot<'a, JobOwner<'a, 'tcx, ::ty::query::queries::type_of<'tcx>>>,
150+
) -> TryGetJob<'a, 'tcx, ::ty::query::queries::type_of<'tcx>> {
151+
use ty::query::config::QueryAccessors;
152+
tls::with_related_context(tcx, |icx| {
153+
let mut job = Lrc::new(MaybeUninit::uninitialized());
154+
let parent = icx.query.clone();
155+
let info = QueryInfo {
156+
span,
157+
query: ::ty::query::queries::type_of::query(*key),
158+
};
159+
*Lrc::get_mut(&mut job).unwrap() =
160+
MaybeUninit::new(QueryJob::new(info, parent));
161+
let job: Lrc<QueryJob<'tcx>> = unsafe { std::mem::transmute(job) };
162+
let job_clone = job.clone();
163+
may_panic(job);
164+
let owner = job_storage.init(JobOwner {
165+
cache: ::ty::query::queries::type_of::query_cache(tcx),
166+
job: job_clone,
167+
key: (*key).clone(),
168+
key_hash,
169+
layout_depth: icx.layout_depth,
170+
});
171+
TryGetJob::NotYetStarted(owner)
172+
})
173+
}
174+
106175
impl<'a, 'tcx, Q: QueryDescription<'tcx>> JobOwner<'a, 'tcx, Q> {
107176
/// Either gets a JobOwner corresponding the query, allowing us to
108177
/// start executing the query, or it returns with the result of the query.

0 commit comments

Comments
 (0)