Remove remaining address space related code
This commit is contained in:
parent
761fc16c60
commit
fb6dc957d6
@ -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;
|
||||
|
@ -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());
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user