From 8b5968165f48860c1916be0c9e3534403e765522 Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Mon, 28 Mar 2011 11:10:47 -0700 Subject: [PATCH] Fix get_tydesc to alloca enough room for root; remove hack that was attempting to paper over it. Fix from espindola. --- src/comp/middle/trans.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 8216ab7a873..2d7c5559b26 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -1467,7 +1467,7 @@ fn get_tydesc(&@block_ctxt cx, @ty.t t) -> result { auto root = cx.fcx.ccx.tydescs.get(t).tydesc; auto tydescs = cx.build.Alloca(T_array(T_ptr(T_tydesc(cx.fcx.ccx.tn)), - n_params)); + 1u /* for root*/ + n_params)); auto i = 0; auto tdp = cx.build.GEP(tydescs, vec(C_int(0), C_int(i))); @@ -5076,13 +5076,8 @@ fn new_block_ctxt(@fn_ctxt cx, block_parent parent, // Use this when you're at the top block of a function or the like. fn new_top_block_ctxt(@fn_ctxt fcx) -> @block_ctxt { - auto cx = new_block_ctxt(fcx, parent_none, SCOPE_BLOCK, - "function top level"); - - // FIXME: hack to give us some spill room to make up for an LLVM - // bug where it destroys its own callee-saves. - cx.build.Alloca(T_array(T_int(), 10u)); - ret cx; + ret new_block_ctxt(fcx, parent_none, SCOPE_BLOCK, + "function top level"); } // Use this when you're at a curly-brace or similar lexical scope.