Skip to content

Commit f0ab779

Browse files
committed
---
yaml --- r: 161455 b: refs/heads/snap-stage3 c: 64bf5a8 h: refs/heads/master i: 161453: 2821e6b 161451: 698c178 161447: 1b3f5a5 161439: e0a8870 v: v3
1 parent b5cd580 commit f0ab779

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 4eb72d268f337a8f117c86a2ac1b98336cab9e9d
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 39221a013fdbfcc05d44fc7a62650f62c7b833e9
4+
refs/heads/snap-stage3: 64bf5a8687c78cf7dc605cc8c8b63748a2746943
55
refs/heads/try: 0f0d21c1eb5c7be04d323e0b06faf252ad790af6
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/librustc_trans/trans/callee.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,12 @@ pub fn trans_fn_pointer_shim<'a, 'tcx>(
262262
let _icx = push_ctxt("trans_fn_pointer_shim");
263263
let tcx = ccx.tcx();
264264

265+
let bare_fn_ty = ty::normalize_ty(tcx, bare_fn_ty);
266+
match ccx.fn_pointer_shims().borrow().get(&bare_fn_ty) {
267+
Some(&llval) => { return llval; }
268+
None => { }
269+
}
270+
265271
debug!("trans_fn_pointer_shim(bare_fn_ty={})",
266272
bare_fn_ty.repr(tcx));
267273

@@ -345,6 +351,8 @@ pub fn trans_fn_pointer_shim<'a, 'tcx>(
345351

346352
finish_fn(&fcx, bcx, output_ty);
347353

354+
ccx.fn_pointer_shims().borrow_mut().insert(bare_fn_ty, llfn);
355+
348356
llfn
349357
}
350358

branches/snap-stage3/src/librustc_trans/trans/context.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ pub struct LocalCrateContext<'tcx> {
8484
tn: TypeNames,
8585
externs: RefCell<ExternMap>,
8686
item_vals: RefCell<NodeMap<ValueRef>>,
87+
fn_pointer_shims: RefCell<FnvHashMap<Ty<'tcx>, ValueRef>>,
8788
drop_glues: RefCell<FnvHashMap<Ty<'tcx>, ValueRef>>,
8889
tydescs: RefCell<FnvHashMap<Ty<'tcx>, Rc<tydesc_info<'tcx>>>>,
8990
/// Set when running emit_tydescs to enforce that no more tydescs are
@@ -573,6 +574,10 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> {
573574
&self.shared.link_meta
574575
}
575576

577+
pub fn fn_pointer_shims(&self) -> &RefCell<FnvHashMap<Ty<'tcx>, ValueRef>> {
578+
&self.local.fn_pointer_shims
579+
}
580+
576581
pub fn drop_glues<'a>(&'a self) -> &'a RefCell<FnvHashMap<Ty<'tcx>, ValueRef>> {
577582
&self.local.drop_glues
578583
}

0 commit comments

Comments
 (0)