Skip to content

Commit 34b738b

Browse files
committed
---
yaml --- r: 1254 b: refs/heads/master c: 58bf592 h: refs/heads/master v: v3
1 parent bfd176d commit 34b738b

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
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: 5f591c37671ad1e3932d8a5c27124eb52903026c
2+
refs/heads/master: 58bf592dcc14a6b7c9609536f2094c3de135f337

trunk/src/comp/middle/trans.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2014,8 +2014,7 @@ impure fn trans_args(@block_ctxt cx,
20142014
auto retty = ty.ty_fn_ret(fn_ty);
20152015
auto llretty = type_of(cx.fcx.ccx, retty);
20162016
auto llretslot = cx.build.Alloca(llretty);
2017-
llretslot = cx.build.PointerCast(llretslot, T_ptr(T_i8()));
2018-
vs += llretslot;
2017+
vs += cx.build.PointerCast(llretslot, T_ptr(T_i8()));
20192018
llretslot_opt = some[ValueRef](llretslot);
20202019
}
20212020
}
@@ -2318,19 +2317,22 @@ impure fn trans_call(@block_ctxt cx, @ast.expr f,
23182317

23192318
auto bcx = args_res._0;
23202319
auto real_retval = bcx.build.FastCall(faddr, args_res._1);
2321-
auto retval;
2320+
auto retval = real_retval;
2321+
2322+
if (ty.type_is_nil(ret_ty)) {
2323+
retval = C_nil();
2324+
}
23222325

23232326
// Check for a generic retslot.
23242327
alt (args_res._2) {
2328+
23252329
case (some[ValueRef](?llretslot)) {
2326-
retval = bcx.build.Load(llretslot);
2330+
retval = load_scalar_or_boxed(bcx, llretslot, ret_ty);
23272331
}
2328-
case (none[ValueRef]) {
2329-
retval = real_retval;
23302332

2331-
if (ty.type_is_nil(ret_ty)) {
2332-
retval = C_nil();
2333-
} else if (ty.type_is_structural(ret_ty)) {
2333+
case (none[ValueRef]) {
2334+
if (! (ty.type_is_scalar(ret_ty) ||
2335+
ty.type_is_boxed(ret_ty))) {
23342336
// Structured returns come back as first-class values. This is
23352337
// nice for LLVM but wrong for us; we treat structured values
23362338
// by pointer in most of our code here. So spill it to an
@@ -2342,8 +2344,6 @@ impure fn trans_call(@block_ctxt cx, @ast.expr f,
23422344
}
23432345
}
23442346

2345-
2346-
23472347
// Retval doesn't correspond to anything really tangible in the frame, but
23482348
// it's a ref all the same, so we put a note here to drop it when we're
23492349
// done in this scope.

0 commit comments

Comments
 (0)