Skip to content

Commit fc45d14

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 169886 b: refs/heads/auto c: 6438261 h: refs/heads/master v: v3
1 parent 264f091 commit fc45d14

File tree

5 files changed

+5
-117
lines changed

5 files changed

+5
-117
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: 5d6a6f59575ab389bb6c2f199e5723923a68ab1d
13+
refs/heads/auto: 643826150b502eddcc9b736e4320cb76ccedff8a
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/librustc_trans/trans/callee.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub use self::CalleeData::*;
1919
pub use self::CallArgs::*;
2020

2121
use arena::TypedArena;
22-
use back::{abi,link};
22+
use back::link;
2323
use session;
2424
use llvm::{ValueRef};
2525
use llvm::get_param;
@@ -100,7 +100,7 @@ fn trans<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, expr: &ast::Expr)
100100

101101
fn datum_callee<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, expr: &ast::Expr)
102102
-> Callee<'blk, 'tcx> {
103-
let DatumBlock {mut bcx, datum} = expr::trans(bcx, expr);
103+
let DatumBlock { datum, .. } = expr::trans(bcx, expr);
104104
match datum.ty.sty {
105105
ty::ty_bare_fn(..) => {
106106
let llval = datum.to_llscalarish(bcx);

branches/auto/src/librustc_trans/trans/closure.rs

Lines changed: 1 addition & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use trans::base::*;
1919
use trans::build::*;
2020
use trans::cleanup::{CleanupMethods, ScopeId};
2121
use trans::common::*;
22-
use trans::datum::{Datum, DatumBlock, Expr, Lvalue, rvalue_scratch_datum};
22+
use trans::datum::{Datum, Lvalue, rvalue_scratch_datum};
2323
use trans::datum::{Rvalue, ByValue};
2424
use trans::debuginfo;
2525
use trans::expr;
@@ -29,10 +29,8 @@ use trans::type_::Type;
2929
use middle::ty::{self, Ty, UnboxedClosureTyper};
3030
use middle::subst::{Substs};
3131
use session::config::FullDebugInfo;
32-
use util::ppaux::Repr;
3332
use util::ppaux::ty_to_string;
3433

35-
use arena::TypedArena;
3634
use syntax::ast;
3735
use syntax::ast_util;
3836

@@ -581,97 +579,3 @@ pub fn trans_unboxed_closure<'blk, 'tcx>(
581579

582580
bcx
583581
}
584-
585-
pub fn get_wrapper_for_bare_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
586-
closure_ty: Ty<'tcx>,
587-
def_id: ast::DefId,
588-
fn_ptr: ValueRef,
589-
is_local: bool) -> ValueRef {
590-
591-
match ccx.closure_bare_wrapper_cache().borrow().get(&fn_ptr) {
592-
Some(&llval) => return llval,
593-
None => {}
594-
}
595-
596-
let tcx = ccx.tcx();
597-
598-
debug!("get_wrapper_for_bare_fn(closure_ty={})", closure_ty.repr(tcx));
599-
600-
let f = match closure_ty.sty {
601-
_ => {
602-
ccx.sess().bug(format!("get_wrapper_for_bare_fn: \
603-
expected a closure ty, got {}",
604-
closure_ty.repr(tcx))[]);
605-
}
606-
};
607-
608-
let name = ty::with_path(tcx, def_id, |path| {
609-
mangle_internal_name_by_path_and_seq(path, "as_closure")
610-
});
611-
let llfn = if is_local {
612-
decl_internal_rust_fn(ccx, closure_ty, name[])
613-
} else {
614-
decl_rust_fn(ccx, closure_ty, name[])
615-
};
616-
617-
ccx.closure_bare_wrapper_cache().borrow_mut().insert(fn_ptr, llfn);
618-
619-
// This is only used by statics inlined from a different crate.
620-
if !is_local {
621-
// Don't regenerate the wrapper, just reuse the original one.
622-
return llfn;
623-
}
624-
625-
let _icx = push_ctxt("closure::get_wrapper_for_bare_fn");
626-
627-
let arena = TypedArena::new();
628-
let empty_param_substs = Substs::trans_empty();
629-
let fcx = new_fn_ctxt(ccx, llfn, ast::DUMMY_NODE_ID, true, f.sig.0.output,
630-
&empty_param_substs, None, &arena);
631-
let bcx = init_function(&fcx, true, f.sig.0.output);
632-
633-
let args = create_datums_for_fn_args(&fcx,
634-
ty::ty_fn_args(closure_ty)
635-
[]);
636-
let mut llargs = Vec::new();
637-
match fcx.llretslotptr.get() {
638-
Some(llretptr) => {
639-
assert!(!fcx.needs_ret_allocas);
640-
llargs.push(llretptr);
641-
}
642-
None => {}
643-
}
644-
llargs.extend(args.iter().map(|arg| arg.val));
645-
646-
let retval = Call(bcx, fn_ptr, llargs.as_slice(), None);
647-
match f.sig.0.output {
648-
ty::FnConverging(output_type) => {
649-
if return_type_is_void(ccx, output_type) || fcx.llretslotptr.get().is_some() {
650-
RetVoid(bcx);
651-
} else {
652-
Ret(bcx, retval);
653-
}
654-
}
655-
ty::FnDiverging => {
656-
RetVoid(bcx);
657-
}
658-
}
659-
660-
// HACK(eddyb) finish_fn cannot be used here, we returned directly.
661-
debuginfo::clear_source_location(&fcx);
662-
fcx.cleanup();
663-
664-
llfn
665-
}
666-
667-
pub fn make_closure_from_bare_fn<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
668-
closure_ty: Ty<'tcx>,
669-
def_id: ast::DefId,
670-
fn_ptr: ValueRef)
671-
-> DatumBlock<'blk, 'tcx, Expr> {
672-
let scratch = rvalue_scratch_datum(bcx, closure_ty, "__adjust");
673-
let wrapper = get_wrapper_for_bare_fn(bcx.ccx(), closure_ty, def_id, fn_ptr, true);
674-
fill_fn_pair(bcx, scratch.val, wrapper, C_null(Type::i8p(bcx.ccx())));
675-
676-
DatumBlock::new(bcx, scratch.to_expr_datum())
677-
}

branches/auto/src/librustc_trans/trans/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use llvm::{ConstFCmp, ConstICmp, SetLinkage, PrivateLinkage, ValueRef, Bool, Tru
1515
use llvm::{IntEQ, IntNE, IntUGT, IntUGE, IntULT, IntULE, IntSGT, IntSGE, IntSLT, IntSLE,
1616
RealOEQ, RealOGT, RealOGE, RealOLT, RealOLE, RealONE};
1717
use middle::{const_eval, def};
18-
use trans::{adt, closure, consts, debuginfo, expr, inline, machine};
18+
use trans::{adt, consts, debuginfo, expr, inline, machine};
1919
use trans::base::{self, push_ctxt};
2020
use trans::common::*;
2121
use trans::type_::Type;

branches/auto/src/librustc_trans/trans/expr.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -473,22 +473,6 @@ fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
473473

474474
DatumBlock::new(bcx, scratch.to_expr_datum())
475475
}
476-
477-
fn add_env<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
478-
def_id: ast::DefId,
479-
expr: &ast::Expr,
480-
datum: Datum<'tcx, Expr>)
481-
-> DatumBlock<'blk, 'tcx, Expr> {
482-
// This is not the most efficient thing possible; since closures
483-
// are two words it'd be better if this were compiled in
484-
// 'dest' mode, but I can't find a nice way to structure the
485-
// code and keep it DRY that accommodates that use case at the
486-
// moment.
487-
488-
let closure_ty = expr_ty_adjusted(bcx, expr);
489-
let fn_ptr = datum.to_llscalarish(bcx);
490-
closure::make_closure_from_bare_fn(bcx, closure_ty, def_id, fn_ptr)
491-
}
492476
}
493477

494478
/// Translates an expression in "lvalue" mode -- meaning that it returns a reference to the memory

0 commit comments

Comments
 (0)