From 14d85ca87a076d674e4a434d4c27e0fed8335f19 Mon Sep 17 00:00:00 2001 From: Michael Sullivan Date: Mon, 15 Aug 2011 17:33:08 -0700 Subject: [PATCH] Make bind glue do an llvm tail call to the target. Closes #2. Now, llvm probably won't actually *emit* a tail call with the compiler options and configuration we have, but this should punt it over to the more general "do tail calls" bug. --- src/comp/middle/trans.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index b257e8e13755..e2f9f7682e12 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -4436,7 +4436,7 @@ fn trans_bind_thunk(cx: &@local_ctxt, sp: &span, incoming_fty: &ty::t, type_of_fn_from_ty(bcx_ccx(bcx), sp, outgoing_fty, ty_param_count); lltargetfn = bcx.build.PointerCast(lltargetfn, T_ptr(T_ptr(lltargetty))); lltargetfn = bcx.build.Load(lltargetfn); - bcx.build.FastCall(lltargetfn, llargs); + llvm::LLVMSetTailCall(bcx.build.FastCall(lltargetfn, llargs), 1); bcx.build.RetVoid(); finish_fn(fcx, lltop); ret {val: llthunk, ty: llthunk_ty};