Skip to content

Commit

Permalink
Remove remaining address space related code
Browse files Browse the repository at this point in the history
  • Loading branch information
James Miller committed Jun 22, 2013
1 parent 761fc16 commit fb6dc95
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 33 deletions.
8 changes: 2 additions & 6 deletions src/librustc/middle/trans/_match.rs
Expand Up @@ -1389,19 +1389,15 @@ 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;
}

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;
Expand Down
25 changes: 1 addition & 24 deletions src/librustc/middle/trans/base.rs
Expand Up @@ -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.
Expand All @@ -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 }
}
Expand Down Expand Up @@ -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());
Expand Down
2 changes: 0 additions & 2 deletions src/librustc/middle/trans/glue.rs
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/trans/tvec.rs
Expand Up @@ -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 {
Expand Down

0 comments on commit fb6dc95

Please sign in to comment.