about summary refs log tree commit diff
path: root/src/comp
diff options
context:
space:
mode:
authorGraydon Hoare <graydon@mozilla.com>2011-03-28 11:10:47 -0700
committerGraydon Hoare <graydon@mozilla.com>2011-03-28 11:11:03 -0700
commit8b5968165f48860c1916be0c9e3534403e765522 (patch)
tree9791d90c4d2b5040923a21a604ae61df302ed6d4 /src/comp
parent1cb3ce89dd6bd33201871e914f35aef262c287eb (diff)
downloadrust-8b5968165f48860c1916be0c9e3534403e765522.tar.gz
rust-8b5968165f48860c1916be0c9e3534403e765522.zip
Fix get_tydesc to alloca enough room for root; remove hack that was attempting to paper over it. Fix from espindola.
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/middle/trans.rs11
1 files 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.