about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJames Miller <bladeon@gmail.com>2013-06-21 22:15:26 +1200
committerJames Miller <bladeon@gmail.com>2013-06-22 12:38:40 +1200
commitfb6dc957d6fcd64f01fbaf43ed9b059ae695e5b4 (patch)
tree57e5aec775a039247028df2f496e0f91e949dd27
parent761fc16c60507c1d8f1d56ccc3ae9b7fd4edbc54 (diff)
downloadrust-fb6dc957d6fcd64f01fbaf43ed9b059ae695e5b4.tar.gz
rust-fb6dc957d6fcd64f01fbaf43ed9b059ae695e5b4.zip
Remove remaining address space related code
-rw-r--r--src/librustc/middle/trans/_match.rs8
-rw-r--r--src/librustc/middle/trans/base.rs25
-rw-r--r--src/librustc/middle/trans/glue.rs2
-rw-r--r--src/librustc/middle/trans/tvec.rs2
4 files changed, 4 insertions, 33 deletions
diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs
index 958677eab4a..a6e8cf666da 100644
--- a/src/librustc/middle/trans/_match.rs
+++ b/src/librustc/middle/trans/_match.rs
@@ -1389,9 +1389,7 @@ pub fn compile_submatch(bcx: block,
     if any_box_pat(m, col) {
         bcx = root_pats_as_necessary(bcx, m, col, val);
         let llbox = Load(bcx, val);
-        let box_no_addrspace = non_gc_box_cast(bcx, llbox);
-        let unboxed =
-            GEPi(bcx, box_no_addrspace, [0u, abi::box_field_body]);
+        let unboxed = GEPi(bcx, llbox, [0u, abi::box_field_body]);
         compile_submatch(bcx, enter_box(bcx, dm, m, col, val),
                          vec::append(~[unboxed], vals_left), chk);
         return;
@@ -1399,9 +1397,7 @@ pub fn compile_submatch(bcx: block,
 
     if any_uniq_pat(m, col) {
         let llbox = Load(bcx, val);
-        let box_no_addrspace = non_gc_box_cast(bcx, llbox);
-        let unboxed =
-            GEPi(bcx, box_no_addrspace, [0u, abi::box_field_body]);
+        let unboxed = GEPi(bcx, llbox, [0u, abi::box_field_body]);
         compile_submatch(bcx, enter_uniq(bcx, dm, m, col, val),
                          vec::append(~[unboxed], vals_left), chk);
         return;
diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs
index bd57a709a90..7132af24d45 100644
--- a/src/librustc/middle/trans/base.rs
+++ b/src/librustc/middle/trans/base.rs
@@ -279,18 +279,6 @@ pub fn malloc_raw_dyn(bcx: block,
     r
 }
 
-/**
-* Get the type of a box in the default address space.
-*
-* Shared box pointers live in address space 1 so the GC strategy can find
-* them. Before taking a pointer to the inside of a box it should be cast into
-* address space 0. Otherwise the resulting (non-box) pointer will be in the
-* wrong address space and thus be the wrong type.
-*/
-pub fn non_gc_box_cast(_: block, val: ValueRef) -> ValueRef {
-    val
-}
-
 // malloc_raw: expects an unboxed type and returns a pointer to
 // enough space for a box of that type.  This includes a rust_opaque_box
 // header.
@@ -312,8 +300,7 @@ pub fn malloc_general_dyn(bcx: block, t: ty::t, heap: heap, size: ValueRef)
     -> MallocResult {
     let _icx = push_ctxt("malloc_general");
     let Result {bcx: bcx, val: llbox} = malloc_raw_dyn(bcx, t, heap, size);
-    let non_gc_box = non_gc_box_cast(bcx, llbox);
-    let body = GEPi(bcx, non_gc_box, [0u, abi::box_field_body]);
+    let body = GEPi(bcx, llbox, [0u, abi::box_field_body]);
 
     MallocResult { bcx: bcx, box: llbox, body: body }
 }
@@ -1829,16 +1816,6 @@ pub fn trans_closure(ccx: @mut CrateContext,
         set_fixed_stack_segment(fcx.llfn);
     }
 
-    // Set GC for function.
-    if ccx.sess.opts.gc {
-        do str::as_c_str("generic") |strategy| {
-            unsafe {
-                llvm::LLVMSetGC(fcx.llfn, strategy);
-            }
-        }
-        ccx.uses_gc = true;
-    }
-
     // Create the first basic block in the function and keep a handle on it to
     //  pass to finish_fn later.
     let bcx_top = top_scope_block(fcx, body.info());
diff --git a/src/librustc/middle/trans/glue.rs b/src/librustc/middle/trans/glue.rs
index 127177118a0..b35ec1c09b4 100644
--- a/src/librustc/middle/trans/glue.rs
+++ b/src/librustc/middle/trans/glue.rs
@@ -375,8 +375,6 @@ pub fn make_free_glue(bcx: block, v: ValueRef, t: ty::t) {
       ty::ty_box(body_mt) => {
         let v = Load(bcx, v);
         let body = GEPi(bcx, v, [0u, abi::box_field_body]);
-        // Cast away the addrspace of the box pointer.
-        let body = PointerCast(bcx, body, type_of(ccx, body_mt.ty).ptr_to());
         let bcx = drop_ty(bcx, body, body_mt.ty);
         trans_free(bcx, v)
       }
diff --git a/src/librustc/middle/trans/tvec.rs b/src/librustc/middle/trans/tvec.rs
index d7c8c06c707..d543b2cc61c 100644
--- a/src/librustc/middle/trans/tvec.rs
+++ b/src/librustc/middle/trans/tvec.rs
@@ -64,7 +64,7 @@ pub fn get_alloc(bcx: block, vptr: ValueRef) -> ValueRef {
 }
 
 pub fn get_bodyptr(bcx: block, vptr: ValueRef) -> ValueRef {
-    base::non_gc_box_cast(bcx, GEPi(bcx, vptr, [0u, abi::box_field_body]))
+    GEPi(bcx, vptr, [0u, abi::box_field_body])
 }
 
 pub fn get_dataptr(bcx: block, vptr: ValueRef) -> ValueRef {