Re-use cranelift_codegen::ir::Function for every function

Fixes #844
This commit is contained in:
bjorn3 2020-01-04 17:58:38 +01:00
parent c5a7fca527
commit 1bb848d4ac
4 changed files with 17 additions and 29 deletions

View file

@ -63,11 +63,11 @@ pub fn get_vtable<'tcx>(
ty: Ty<'tcx>,
trait_ref: Option<ty::PolyExistentialTraitRef<'tcx>>,
) -> Value {
let data_id = if let Some(data_id) = fx.caches.vtables.get(&(ty, trait_ref)) {
let data_id = if let Some(data_id) = fx.vtables.get(&(ty, trait_ref)) {
*data_id
} else {
let data_id = build_vtable(fx, ty, trait_ref);
fx.caches.vtables.insert((ty, trait_ref), data_id);
fx.vtables.insert((ty, trait_ref), data_id);
data_id
};