Skip to content

Commit 5dffa44

Browse files
committed
---
yaml --- r: 5217 b: refs/heads/master c: 4bced5e h: refs/heads/master i: 5215: 50b619c v: v3
1 parent 00084fa commit 5dffa44

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 9f4b4d89cee40a04bf4b3227e378588e438e588a
2+
refs/heads/master: 4bced5e5f2fcf7e1c7725e747ac3110ef0a9c1e4

trunk/src/comp/middle/trans.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3761,7 +3761,7 @@ fn trans_call(in_cx: &@block_ctxt, f: &@ast::expr,
37613761
for the call itself is unreachable. */
37623762
let retval = C_nil();
37633763
if !is_terminated(bcx) {
3764-
FastCall(bcx, faddr, llargs);
3764+
bcx = invoke_fastcall(bcx, faddr, llargs).bcx;
37653765
alt lliterbody {
37663766
none. {
37673767
if !ty::type_is_nil(bcx_tcx(cx), ret_ty) {
@@ -3794,6 +3794,22 @@ fn trans_call(in_cx: &@block_ctxt, f: &@ast::expr,
37943794
ret rslt(bcx, retval);
37953795
}
37963796

3797+
fn invoke_fastcall(bcx: &@block_ctxt, llfn: ValueRef,
3798+
llargs: &[ValueRef]) -> result {
3799+
3800+
let normal_bcx = new_sub_block_ctxt(bcx, "normal return");
3801+
let unwind_bcx = new_sub_block_ctxt(bcx, "unwind");
3802+
let retval = trans_build::FastInvoke(bcx, llfn, llargs,
3803+
normal_bcx.llbb,
3804+
unwind_bcx.llbb);
3805+
trans_landing_pad(unwind_bcx);
3806+
ret rslt(normal_bcx, retval);
3807+
}
3808+
3809+
fn trans_landing_pad(bcx: &@block_ctxt) {
3810+
Unreachable(bcx);
3811+
}
3812+
37973813
fn trans_tup(cx: &@block_ctxt, elts: &[@ast::expr], id: ast::node_id) ->
37983814
result {
37993815
let bcx = cx;

trunk/src/comp/middle/trans_build.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,21 @@ fn Invoke(cx: &@block_ctxt, Fn: ValueRef, Args: &[ValueRef],
6868
});
6969
}
7070

71+
fn FastInvoke(cx: &@block_ctxt, Fn: ValueRef, Args: &[ValueRef],
72+
Then: BasicBlockRef, Catch: BasicBlockRef) -> ValueRef {
73+
assert (!cx.terminated);
74+
cx.terminated = true;
75+
let v = str::as_buf("",
76+
{|buf|
77+
llvm::LLVMBuildInvoke(B(cx), Fn,
78+
vec::to_ptr(Args),
79+
vec::len(Args), Then,
80+
Catch, buf)
81+
});
82+
llvm::LLVMSetInstructionCallConv(v, lib::llvm::LLVMFastCallConv);
83+
ret v;
84+
}
85+
7186
fn Unreachable(cx: &@block_ctxt) -> ValueRef {
7287
assert (!cx.terminated);
7388
cx.terminated = true;

0 commit comments

Comments
 (0)