Skip to content

Commit fb6dc95

Browse files
author
James Miller
committed
Remove remaining address space related code
1 parent 761fc16 commit fb6dc95

File tree

4 files changed

+4
-33
lines changed

4 files changed

+4
-33
lines changed

src/librustc/middle/trans/_match.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -1389,19 +1389,15 @@ pub fn compile_submatch(bcx: block,
13891389
if any_box_pat(m, col) {
13901390
bcx = root_pats_as_necessary(bcx, m, col, val);
13911391
let llbox = Load(bcx, val);
1392-
let box_no_addrspace = non_gc_box_cast(bcx, llbox);
1393-
let unboxed =
1394-
GEPi(bcx, box_no_addrspace, [0u, abi::box_field_body]);
1392+
let unboxed = GEPi(bcx, llbox, [0u, abi::box_field_body]);
13951393
compile_submatch(bcx, enter_box(bcx, dm, m, col, val),
13961394
vec::append(~[unboxed], vals_left), chk);
13971395
return;
13981396
}
13991397

14001398
if any_uniq_pat(m, col) {
14011399
let llbox = Load(bcx, val);
1402-
let box_no_addrspace = non_gc_box_cast(bcx, llbox);
1403-
let unboxed =
1404-
GEPi(bcx, box_no_addrspace, [0u, abi::box_field_body]);
1400+
let unboxed = GEPi(bcx, llbox, [0u, abi::box_field_body]);
14051401
compile_submatch(bcx, enter_uniq(bcx, dm, m, col, val),
14061402
vec::append(~[unboxed], vals_left), chk);
14071403
return;

src/librustc/middle/trans/base.rs

+1-24
Original file line numberDiff line numberDiff line change
@@ -279,18 +279,6 @@ pub fn malloc_raw_dyn(bcx: block,
279279
r
280280
}
281281

282-
/**
283-
* Get the type of a box in the default address space.
284-
*
285-
* Shared box pointers live in address space 1 so the GC strategy can find
286-
* them. Before taking a pointer to the inside of a box it should be cast into
287-
* address space 0. Otherwise the resulting (non-box) pointer will be in the
288-
* wrong address space and thus be the wrong type.
289-
*/
290-
pub fn non_gc_box_cast(_: block, val: ValueRef) -> ValueRef {
291-
val
292-
}
293-
294282
// malloc_raw: expects an unboxed type and returns a pointer to
295283
// enough space for a box of that type. This includes a rust_opaque_box
296284
// header.
@@ -312,8 +300,7 @@ pub fn malloc_general_dyn(bcx: block, t: ty::t, heap: heap, size: ValueRef)
312300
-> MallocResult {
313301
let _icx = push_ctxt("malloc_general");
314302
let Result {bcx: bcx, val: llbox} = malloc_raw_dyn(bcx, t, heap, size);
315-
let non_gc_box = non_gc_box_cast(bcx, llbox);
316-
let body = GEPi(bcx, non_gc_box, [0u, abi::box_field_body]);
303+
let body = GEPi(bcx, llbox, [0u, abi::box_field_body]);
317304

318305
MallocResult { bcx: bcx, box: llbox, body: body }
319306
}
@@ -1829,16 +1816,6 @@ pub fn trans_closure(ccx: @mut CrateContext,
18291816
set_fixed_stack_segment(fcx.llfn);
18301817
}
18311818

1832-
// Set GC for function.
1833-
if ccx.sess.opts.gc {
1834-
do str::as_c_str("generic") |strategy| {
1835-
unsafe {
1836-
llvm::LLVMSetGC(fcx.llfn, strategy);
1837-
}
1838-
}
1839-
ccx.uses_gc = true;
1840-
}
1841-
18421819
// Create the first basic block in the function and keep a handle on it to
18431820
// pass to finish_fn later.
18441821
let bcx_top = top_scope_block(fcx, body.info());

src/librustc/middle/trans/glue.rs

-2
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,6 @@ pub fn make_free_glue(bcx: block, v: ValueRef, t: ty::t) {
375375
ty::ty_box(body_mt) => {
376376
let v = Load(bcx, v);
377377
let body = GEPi(bcx, v, [0u, abi::box_field_body]);
378-
// Cast away the addrspace of the box pointer.
379-
let body = PointerCast(bcx, body, type_of(ccx, body_mt.ty).ptr_to());
380378
let bcx = drop_ty(bcx, body, body_mt.ty);
381379
trans_free(bcx, v)
382380
}

src/librustc/middle/trans/tvec.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub fn get_alloc(bcx: block, vptr: ValueRef) -> ValueRef {
6464
}
6565

6666
pub fn get_bodyptr(bcx: block, vptr: ValueRef) -> ValueRef {
67-
base::non_gc_box_cast(bcx, GEPi(bcx, vptr, [0u, abi::box_field_body]))
67+
GEPi(bcx, vptr, [0u, abi::box_field_body])
6868
}
6969

7070
pub fn get_dataptr(bcx: block, vptr: ValueRef) -> ValueRef {

0 commit comments

Comments
 (0)