Skip to content

Commit b911252

Browse files
committed
Move to a more lightweight builder system
You now do bld::Ret(bcx, someval) where you used to say bcx.build.Ret(someval) Two fewer boxes are allocated for each block context, and build calls no longer go through a vtable.
1 parent 9f44df6 commit b911252

File tree

9 files changed

+1147
-1194
lines changed

9 files changed

+1147
-1194
lines changed

src/comp/lib/llvm.rs

Lines changed: 0 additions & 519 deletions
Large diffs are not rendered by default.

src/comp/middle/gc.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import std::unsafe;
1515
import std::vec;
1616

1717
import lll = lib::llvm::llvm;
18+
import bld = trans_build;
1819

1920
type ctxt = @{mutable next_tydesc_num: uint};
2021

@@ -47,13 +48,13 @@ fn add_gc_root(cx: &@block_ctxt, llval: ValueRef, ty: ty::t) -> @block_ctxt {
4748
let lltydesc = td_r.result.val;
4849

4950
let gcroot = bcx_ccx(bcx).intrinsics.get("llvm.gcroot");
50-
let llvalptr = bcx.build.PointerCast(llval, T_ptr(T_ptr(T_i8())));
51+
let llvalptr = bld::PointerCast(bcx, llval, T_ptr(T_ptr(T_i8())));
5152

5253
alt td_r.kind {
5354
tk_derived. {
5455
// It's a derived type descriptor. First, spill it.
5556
let lltydescptr = trans::alloca(bcx, val_ty(lltydesc));
56-
bcx.build.Store(lltydesc, lltydescptr);
57+
bld::Store(bcx, lltydesc, lltydescptr);
5758

5859
let number = gc_cx.next_tydesc_num;
5960
gc_cx.next_tydesc_num += 1u;
@@ -69,10 +70,10 @@ fn add_gc_root(cx: &@block_ctxt, llval: ValueRef, ty: ty::t) -> @block_ctxt {
6970
llsrcindex = lll::LLVMConstPointerCast(llsrcindex, T_ptr(T_i8()));
7071

7172
lltydescptr =
72-
bcx.build.PointerCast(lltydescptr, T_ptr(T_ptr(T_i8())));
73+
bld::PointerCast(bcx, lltydescptr, T_ptr(T_ptr(T_i8())));
7374

74-
bcx.build.Call(gcroot, [lltydescptr, lldestindex]);
75-
bcx.build.Call(gcroot, [llvalptr, llsrcindex]);
75+
bld::Call(bcx, gcroot, [lltydescptr, lldestindex]);
76+
bld::Call(bcx, gcroot, [llvalptr, llsrcindex]);
7677
}
7778
tk_param. {
7879
bcx_tcx(cx).sess.bug("we should never be trying to root values " +
@@ -87,7 +88,7 @@ fn add_gc_root(cx: &@block_ctxt, llval: ValueRef, ty: ty::t) -> @block_ctxt {
8788
let llstaticgcmetaptr =
8889
lll::LLVMConstPointerCast(llstaticgcmeta, T_ptr(T_i8()));
8990

90-
bcx.build.Call(gcroot, [llvalptr, llstaticgcmetaptr]);
91+
bld::Call(bcx, gcroot, [llvalptr, llstaticgcmetaptr]);
9192
}
9293
}
9394

0 commit comments

Comments
 (0)