rt: Remove upcall_shared_malloc/free/realloc

This commit is contained in:
Brian Anderson 2012-05-25 17:22:14 -07:00
parent 80dc2e11a1
commit a2bbdd3f52
8 changed files with 6 additions and 115 deletions

View file

@ -16,9 +16,6 @@ type upcalls =
exchange_malloc_dyn: ValueRef,
exchange_free: ValueRef,
validate_box: ValueRef,
shared_malloc: ValueRef,
shared_free: ValueRef,
shared_realloc: ValueRef,
mark: ValueRef,
vec_grow: ValueRef,
str_new_uniq: ValueRef,
@ -75,13 +72,6 @@ fn declare_upcalls(targ_cfg: @session::config,
nothrow(dv("exchange_free", [T_ptr(T_i8())])),
validate_box:
nothrow(dv("validate_box", [T_ptr(T_i8())])),
shared_malloc:
nothrow(d("shared_malloc", [size_t], T_ptr(T_i8()))),
shared_free:
nothrow(dv("shared_free", [T_ptr(T_i8())])),
shared_realloc:
nothrow(d("shared_realloc", [T_ptr(T_i8()), size_t],
T_ptr(T_i8()))),
mark:
d("mark", [T_ptr(T_i8())], int_t),
vec_grow:

View file

@ -236,13 +236,6 @@ fn trans_free(cx: block, v: ValueRef) -> block {
cx
}
fn trans_shared_free(cx: block, v: ValueRef) -> block {
let _icx = cx.insn_ctxt("trans_shared_free");
Call(cx, cx.ccx().upcalls.shared_free,
[PointerCast(cx, v, T_ptr(T_i8()))]);
ret cx;
}
fn trans_unique_free(cx: block, v: ValueRef) -> block {
let _icx = cx.insn_ctxt("trans_shared_free");
Call(cx, cx.ccx().upcalls.exchange_free,
@ -333,15 +326,6 @@ fn GEP_enum(bcx: block, llblobptr: ValueRef, enum_id: ast::def_id,
GEPi(bcx, typed_blobptr, [0u, ix])
}
// trans_shared_malloc: expects a type indicating which pointer type we want
// and a size indicating how much space we want malloc'd.
fn shared_malloc(cx: block, llptr_ty: TypeRef, llsize: ValueRef)
-> ValueRef {
let _icx = cx.insn_ctxt("opaque_shared_malloc");
let rval = Call(cx, cx.ccx().upcalls.shared_malloc, [llsize]);
PointerCast(cx, rval, llptr_ty)
}
// Returns a pointer to the body for the box. The box may be an opaque
// box. The result will be casted to the type of body_t, if it is statically
// known.

View file

@ -271,7 +271,7 @@ fn add_clean_temp_mem(cx: block, val: ValueRef, ty: ty::t) {
}
}
fn add_clean_free(cx: block, ptr: ValueRef, shared: bool) {
let free_fn = if shared { bind base::trans_shared_free(_, ptr) }
let free_fn = if shared { bind base::trans_unique_free(_, ptr) }
else { bind base::trans_free(_, ptr) };
in_scope_cx(cx) {|info|
info.cleanups += [clean_temp(ptr, free_fn,

View file

@ -2,7 +2,7 @@ import syntax::ast;
import driver::session::session;
import lib::llvm::{ValueRef, TypeRef};
import back::abi;
import base::{call_memmove, shared_malloc,
import base::{call_memmove,
INIT, copy_val, load_if_immediate, get_tydesc,
sub_block, do_spill_noroot,
dest, bcx_icx};
@ -115,7 +115,7 @@ fn make_free_glue(bcx: block, vptr: ValueRef, vec_ty: ty::t) ->
let bcx = if ty::type_needs_drop(tcx, unit_ty) {
iter_vec(bcx, vptr, vec_ty, base::drop_ty)
} else { bcx };
base::trans_shared_free(bcx, vptr)
base::trans_unique_free(bcx, vptr)
}
}