about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLuqman Aden <laden@csclub.uwaterloo.ca>2014-12-24 22:04:35 -0500
committerLuqman Aden <laden@csclub.uwaterloo.ca>2014-12-30 01:45:22 -0500
commit82ebd2bc2077184f5f93d8320e6af3cea5e22479 (patch)
tree828076c1da16977af4f273a65c1d260f1dabf5fb
parent19f73b4ef6fb1d24f19738a8665889396fc1b0c8 (diff)
downloadrust-82ebd2bc2077184f5f93d8320e6af3cea5e22479.tar.gz
rust-82ebd2bc2077184f5f93d8320e6af3cea5e22479.zip
librustc_trans: Remove some dead code now that procs are gone.
-rw-r--r--src/librustc_trans/trans/base.rs28
-rw-r--r--src/librustc_trans/trans/closure.rs32
2 files changed, 7 insertions, 53 deletions
diff --git a/src/librustc_trans/trans/base.rs b/src/librustc_trans/trans/base.rs
index dd5809730d6..295d09f83bb 100644
--- a/src/librustc_trans/trans/base.rs
+++ b/src/librustc_trans/trans/base.rs
@@ -55,7 +55,7 @@ use trans::cleanup::CleanupMethods;
 use trans::cleanup;
 use trans::closure;
 use trans::common::{Block, C_bool, C_bytes_in_context, C_i32, C_integral};
-use trans::common::{C_null, C_struct_in_context, C_u64, C_u8, C_uint, C_undef};
+use trans::common::{C_null, C_struct_in_context, C_u64, C_u8, C_undef};
 use trans::common::{CrateContext, ExternMap, FunctionContext};
 use trans::common::{NodeInfo, Result};
 use trans::common::{node_id_type, return_type_is_void};
@@ -73,7 +73,7 @@ use trans::glue;
 use trans::inline;
 use trans::intrinsic;
 use trans::machine;
-use trans::machine::{llsize_of, llsize_of_real, llalign_of_min};
+use trans::machine::{llsize_of, llsize_of_real};
 use trans::meth;
 use trans::monomorphize;
 use trans::tvec;
@@ -394,30 +394,6 @@ pub fn malloc_raw_dyn<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     Result::new(r.bcx, PointerCast(r.bcx, r.val, llty_ptr))
 }
 
-pub fn malloc_raw_dyn_proc<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, t: Ty<'tcx>)
-                                       -> Result<'blk, 'tcx> {
-    let _icx = push_ctxt("malloc_raw_dyn_proc");
-    let ccx = bcx.ccx();
-
-    // Grab the TypeRef type of ptr_ty.
-    let ptr_ty = ty::mk_uniq(bcx.tcx(), t);
-    let ptr_llty = type_of(ccx, ptr_ty);
-
-    let llty = type_of(bcx.ccx(), t);
-    let size = llsize_of(bcx.ccx(), llty);
-    let llalign = C_uint(ccx, llalign_of_min(bcx.ccx(), llty));
-
-    // Allocate space and store the destructor pointer:
-    let Result {bcx, val: llbox} = malloc_raw_dyn(bcx, ptr_llty, t, size, llalign);
-    let dtor_ptr = GEPi(bcx, llbox, &[0u, abi::BOX_FIELD_DROP_GLUE]);
-    let drop_glue_field_ty = type_of(ccx, ty::mk_nil_ptr(bcx.tcx()));
-    let drop_glue = PointerCast(bcx, glue::get_drop_glue(ccx, ty::mk_uniq(bcx.tcx(), t)),
-                                drop_glue_field_ty);
-    Store(bcx, drop_glue, dtor_ptr);
-
-    Result::new(bcx, llbox)
-}
-
 // Type descriptor and type glue stuff
 
 pub fn get_tydesc<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
diff --git a/src/librustc_trans/trans/closure.rs b/src/librustc_trans/trans/closure.rs
index 0ae9de8c891..f3f8be4efb2 100644
--- a/src/librustc_trans/trans/closure.rs
+++ b/src/librustc_trans/trans/closure.rs
@@ -137,26 +137,6 @@ fn tuplify_box_ty<'tcx>(tcx: &ty::ctxt<'tcx>, t: Ty<'tcx>) -> Ty<'tcx> {
     ty::mk_tup(tcx, vec!(ty::mk_uint(), ty::mk_nil_ptr(tcx), ptr, ptr, t))
 }
 
-fn allocate_cbox<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
-                             store: ty::TraitStore,
-                             cdata_ty: Ty<'tcx>)
-                             -> Result<'blk, 'tcx> {
-    let _icx = push_ctxt("closure::allocate_cbox");
-    let tcx = bcx.tcx();
-
-    // Allocate and initialize the box:
-    let cbox_ty = tuplify_box_ty(tcx, cdata_ty);
-    match store {
-        ty::UniqTraitStore => {
-            malloc_raw_dyn_proc(bcx, cbox_ty)
-        }
-        ty::RegionTraitStore(..) => {
-            let llbox = alloc_ty(bcx, cbox_ty, "__closure");
-            Result::new(bcx, llbox)
-        }
-    }
-}
-
 pub struct ClosureResult<'blk, 'tcx: 'blk> {
     llbox: ValueRef,        // llvalue of ptr to closure
     cdata_ty: Ty<'tcx>,     // type of the closure data
@@ -168,8 +148,7 @@ pub struct ClosureResult<'blk, 'tcx: 'blk> {
 // heap allocated closure that copies the upvars into environment.
 // Otherwise, it is stack allocated and copies pointers to the upvars.
 pub fn store_environment<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
-                                     bound_values: Vec<EnvValue<'tcx>> ,
-                                     store: ty::TraitStore)
+                                     bound_values: Vec<EnvValue<'tcx>>)
                                      -> ClosureResult<'blk, 'tcx> {
     let _icx = push_ctxt("closure::store_environment");
     let ccx = bcx.ccx();
@@ -193,7 +172,7 @@ pub fn store_environment<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     }
 
     // allocate closure in the heap
-    let Result {bcx, val: llbox} = allocate_cbox(bcx, store, cdata_ty);
+    let llbox = alloc_ty(bcx, cbox_ty, "__closure");
 
     let llbox = PointerCast(bcx, llbox, llboxptr_ty);
     debug!("tuplify_box_ty = {}", ty_to_string(tcx, cbox_ty));
@@ -227,8 +206,7 @@ pub fn store_environment<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
 // collects the upvars and packages them up for store_environment.
 fn build_closure<'blk, 'tcx>(bcx0: Block<'blk, 'tcx>,
                              freevar_mode: ast::CaptureClause,
-                             freevars: &Vec<ty::Freevar>,
-                             store: ty::TraitStore)
+                             freevars: &Vec<ty::Freevar>)
                              -> ClosureResult<'blk, 'tcx> {
     let _icx = push_ctxt("closure::build_closure");
 
@@ -242,7 +220,7 @@ fn build_closure<'blk, 'tcx>(bcx0: Block<'blk, 'tcx>,
         env_vals.push(EnvValue {action: freevar_mode, datum: datum});
     }
 
-    store_environment(bcx, env_vals, store)
+    store_environment(bcx, env_vals)
 }
 
 // Given an enclosing block context, a new function context, a closure type,
@@ -456,7 +434,7 @@ pub fn trans_expr_fn<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
         llbox,
         cdata_ty,
         bcx
-    } = build_closure(bcx, freevar_mode, &freevars, store);
+    } = build_closure(bcx, freevar_mode, &freevars);
 
     trans_closure(ccx,
                   decl,