diff options
| author | Marijn Haverbeke <marijnh@gmail.com> | 2012-03-11 12:09:38 +0100 |
|---|---|---|
| committer | Marijn Haverbeke <marijnh@gmail.com> | 2012-03-15 15:08:30 +0100 |
| commit | c3a93ecd3fb58a7041c192adc8e1235a2f793ff5 (patch) | |
| tree | 5383c9fa5755b9a38a2218065dbcfbaadbadab4b /src/rustc | |
| parent | bc8a43a77665cc65ba3d3bf4bd2db00b6cb9ec8a (diff) | |
| download | rust-c3a93ecd3fb58a7041c192adc8e1235a2f793ff5.tar.gz rust-c3a93ecd3fb58a7041c192adc8e1235a2f793ff5.zip | |
Remove dynastack code from compiler
Diffstat (limited to 'src/rustc')
| -rw-r--r-- | src/rustc/back/upcall.rs | 10 | ||||
| -rw-r--r-- | src/rustc/middle/trans/base.rs | 51 | ||||
| -rw-r--r-- | src/rustc/middle/trans/common.rs | 2 |
3 files changed, 2 insertions, 61 deletions
diff --git a/src/rustc/back/upcall.rs b/src/rustc/back/upcall.rs index 584e04adfd8..7ac370c1ee0 100644 --- a/src/rustc/back/upcall.rs +++ b/src/rustc/back/upcall.rs @@ -23,9 +23,6 @@ type upcalls = vec_push: ValueRef, cmp_type: ValueRef, log_type: ValueRef, - dynastack_mark: ValueRef, - dynastack_alloc: ValueRef, - dynastack_free: ValueRef, alloc_c_stack: ValueRef, call_shim_on_c_stack: ValueRef, call_shim_on_rust_stack: ValueRef, @@ -93,13 +90,6 @@ fn declare_upcalls(targ_cfg: @session::config, T_i8()]), log_type: dv("log_type", [T_ptr(tydesc_type), T_ptr(T_i8()), T_i32()]), - dynastack_mark: - d("dynastack_mark", [], T_ptr(T_i8())), - dynastack_alloc: - d("dynastack_alloc_2", [size_t, T_ptr(tydesc_type)], - T_ptr(T_i8())), - dynastack_free: - dv("dynastack_free", [T_ptr(T_i8())]), alloc_c_stack: d("alloc_c_stack", [size_t], T_ptr(T_i8())), call_shim_on_c_stack: diff --git a/src/rustc/middle/trans/base.rs b/src/rustc/middle/trans/base.rs index 7574e826a23..85f81fb84d5 100644 --- a/src/rustc/middle/trans/base.rs +++ b/src/rustc/middle/trans/base.rs @@ -253,35 +253,6 @@ fn alloca(cx: block, t: TypeRef) -> ValueRef { ret Alloca(raw_block(cx.fcx, cx.fcx.llstaticallocas), t); } -fn dynastack_alloca(cx: block, t: TypeRef, n: ValueRef, ty: ty::t) -> - ValueRef { - if cx.unreachable { ret llvm::LLVMGetUndef(T_ptr(t)); } - let bcx = cx; - let dy_cx = raw_block(cx.fcx, cx.fcx.lldynamicallocas); - alt cx.fcx.llobstacktoken { - none { - cx.fcx.llobstacktoken = some(mk_obstack_token(cx.ccx(), cx.fcx)); - } - some(_) {/* no-op */ } - } - - let dynastack_alloc = bcx.ccx().upcalls.dynastack_alloc; - let llsz = Mul(dy_cx, - C_uint(bcx.ccx(), llsize_of_real(bcx.ccx(), t)), - n); - - let lltydesc = get_tydesc_simple(cx, ty).val; - - let llresult = Call(dy_cx, dynastack_alloc, [llsz, lltydesc]); - ret PointerCast(dy_cx, llresult, T_ptr(t)); -} - -fn mk_obstack_token(ccx: @crate_ctxt, fcx: fn_ctxt) -> - ValueRef { - let cx = raw_block(fcx, fcx.lldynamicallocas); - ret Call(cx, ccx.upcalls.dynastack_mark, []); -} - // Given a pointer p, returns a pointer sz(p) (i.e., inc'd by sz bytes). // The type of the returned pointer is always i8*. If you care about the // return type, use bump_ptr(). @@ -3686,12 +3657,6 @@ fn with_cond(bcx: block, val: ValueRef, f: fn(block) -> block) -> block { next_cx } -fn trans_fn_cleanups(fcx: fn_ctxt, cx: block) { - option::may(fcx.llobstacktoken) {|lltoken| - Call(cx, fcx.ccx.upcalls.dynastack_free, [lltoken]); - } -} - fn block_locals(b: ast::blk, it: fn(@ast::local)) { for s: @ast::stmt in b.node.stmts { alt s.node { @@ -3711,18 +3676,8 @@ fn block_locals(b: ast::blk, it: fn(@ast::local)) { fn alloc_ty(cx: block, t: ty::t) -> result { let bcx = cx, ccx = cx.ccx(); let llty = type_of(ccx, t); - let val = if type_has_static_size(ccx, t) { - alloca(bcx, llty) - } else { - // NB: we have to run this particular 'size_of' in a - // block built on the llderivedtydescs block for the fn, - // so that the size dominates the array_alloca that - // comes next. - let n = size_of(raw_block(cx.fcx, cx.fcx.llderivedtydescs), - t); - bcx.fcx.llderivedtydescs = n.bcx.llbb; - PointerCast(bcx, dynastack_alloca(bcx, T_i8(), n.val, t), T_ptr(llty)) - }; + assert type_has_static_size(ccx, t); + let val = alloca(bcx, llty); // NB: since we've pushed all size calculations in this // function up to the alloca block, we actually return the @@ -3824,7 +3779,6 @@ fn new_fn_ctxt_w_id(ccx: @crate_ctxt, path: path, mutable llderivedtydescs: llbbs.dt, mutable lldynamicallocas: llbbs.da, mutable llreturn: llbbs.rt, - mutable llobstacktoken: none::<ValueRef>, mutable llself: none, mutable personality: none, llargs: int_hash::<local_val>(), @@ -3923,7 +3877,6 @@ fn copy_args_to_allocas(fcx: fn_ctxt, bcx: block, args: [ast::arg], fn finish_fn(fcx: fn_ctxt, lltop: BasicBlockRef) { tie_up_header_blocks(fcx, lltop); let ret_cx = raw_block(fcx, fcx.llreturn); - trans_fn_cleanups(fcx, ret_cx); RetVoid(ret_cx); } diff --git a/src/rustc/middle/trans/common.rs b/src/rustc/middle/trans/common.rs index 27372f9912b..ade82e3d3fb 100644 --- a/src/rustc/middle/trans/common.rs +++ b/src/rustc/middle/trans/common.rs @@ -159,8 +159,6 @@ type fn_ctxt = @{ // information computed from derived tydescs. mutable lldynamicallocas: BasicBlockRef, mutable llreturn: BasicBlockRef, - // The token used to clear the dynamic allocas at the end of this frame. - mutable llobstacktoken: option<ValueRef>, // The 'self' value currently in use in this function, if there // is one. mutable llself: option<val_self_pair>, |
