Skip to content

Commit 2391b17

Browse files
committed
---
yaml --- r: 6300 b: refs/heads/master c: d77968d h: refs/heads/master v: v3
1 parent 3100ee0 commit 2391b17

File tree

3 files changed

+30
-14
lines changed

3 files changed

+30
-14
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 4f28419d0c5af1302848da98e592726816cb4df5
2+
refs/heads/master: d77968dd7c79d5d16a8ce5733a910d0018b382be

trunk/configure

+12-4
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ opt docs 1 "build documentation"
253253
opt optimize 1 "build optimized rust code"
254254
opt mingw-cross 0 "cross-compile for win32 using mingw"
255255
opt clang 0 "prefer gcc to clang for building the runtime"
256+
opt debug-llvm "build LLVM in debug mode"
256257
valopt prefix "/usr/local" "set installation prefix"
257258
valopt llvm-root "" "set LLVM root"
258259
valopt target-triples "" "LLVM target triples (defaults to host if unset)"
@@ -433,15 +434,22 @@ do
433434
step_msg "configuring LLVM for $t"
434435

435436
LLVM_BUILD_DIR=$CFG_BUILD_DIR/llvm/$t
436-
# Just use LLVM straight from its build directory to
437-
# avoid 'make install' time
438-
LLVM_INST_DIR=$LLVM_BUILD_DIR/Release+Asserts
439437

440438
LLVM_TARGETS="--enable-targets=x86,x86_64"
441439
LLVM_BUILD="--build=$t"
442440
LLVM_HOST="--host=$t"
443441
LLVM_TARGET="--target=$t"
444-
LLVM_OPTS="--enable-optimized --disable-docs"
442+
if [ -z "$CFG_ENABLE_DEBUG_LLVM" ]
443+
then
444+
LLVM_DBG_OPTS=""
445+
# Just use LLVM straight from its build directory to
446+
# avoid 'make install' time
447+
LLVM_INST_DIR=$LLVM_BUILD_DIR/Debug+Asserts
448+
else
449+
LLVM_DBG_OPTS="--enabled-optimized"
450+
LLVM_INST_DIR=$LLVM_BUILD_DIR/Release+Asserts
451+
fi
452+
LLVM_OPTS="$LLVM_DBG_OPTS --disable-docs"
445453

446454
LLVM_CXX_32="g++ -m32"
447455
LLVM_CC_32="gcc -m32"

trunk/src/comp/middle/trans.rs

+17-9
Original file line numberDiff line numberDiff line change
@@ -3851,23 +3851,31 @@ fn trans_c_stack_native_call(bcx: @block_ctxt, f: @ast::expr,
38513851
check type_has_static_size(ccx, ret_ty);
38523852
let llretty = type_of(ccx, f.span, ret_ty);
38533853

3854-
// Allocate the argument bundle.
3855-
let llargbundlety = T_struct(llargtys + [llretty]);
3856-
let llargbundlesz = llsize_of(ccx, llargbundlety);
3857-
let llrawargbundle = Call(bcx, ccx.upcalls.alloc_c_stack,
3858-
[llargbundlesz]);
3859-
let llargbundle = PointerCast(bcx, llrawargbundle, T_ptr(llargbundlety));
3860-
3861-
// Translate arguments and store into bundle.
3854+
// Translate arguments.
3855+
// n.b.: We must do this before allocating the argument
3856+
// bundle in order to avoid problems with nested function calls.
38623857
let (to_zero, to_revoke) = ([], []);
38633858
let i = 0u, n = vec::len(args);
3859+
let llargs = [];
38643860
while i < n {
38653861
let ty_arg = fn_arg_tys[i];
38663862
let arg = args[i];
38673863
let llargty = llargtys[i];
38683864
let r = trans_arg_expr(bcx, ty_arg, llargty, to_zero, to_revoke, arg);
38693865
bcx = r.bcx;
3870-
store_inbounds(bcx, r.val, llargbundle, [0, i as int]);
3866+
llargs += [r.val];
3867+
i += 1u;
3868+
}
3869+
3870+
// Allocate the argument bundle and store arguments.
3871+
let llargbundlety = T_struct(llargtys + [llretty]);
3872+
let llargbundlesz = llsize_of(ccx, llargbundlety);
3873+
let llrawargbundle = Call(bcx, ccx.upcalls.alloc_c_stack,
3874+
[llargbundlesz]);
3875+
let llargbundle = PointerCast(bcx, llrawargbundle, T_ptr(llargbundlety));
3876+
i = 0u;
3877+
while i < n {
3878+
store_inbounds(bcx, llargs[i], llargbundle, [0, i as int]);
38713879
i += 1u;
38723880
}
38733881

0 commit comments

Comments
 (0)