Skip to content

Commit cc4c7c7

Browse files
committed
---
yaml --- r: 39675 b: refs/heads/incoming c: 7b245d4 h: refs/heads/master i: 39673: d313112 39671: 2f5cb18 v: v3
1 parent a9ccace commit cc4c7c7

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 3d5418789064fdb463e872a4e651af1c628a3650
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278
9-
refs/heads/incoming: 9abcacc0f371206a66cd1b346f5e46ac6063d9bd
9+
refs/heads/incoming: 7b245d46ed5fc93d3251e9e07f50e9b09b1f42c4
1010
refs/heads/dist-snap: 22efa39382d41b084fde1719df7ae8ce5697d8c9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/librustc/middle/trans/common.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,6 +1094,8 @@ fn C_cstr(cx: @crate_ctxt, s: ~str) -> ValueRef {
10941094
return g;
10951095
}
10961096
1097+
// NB: Do not use `do_spill_noroot` to make this into a constant string, or
1098+
// you will be kicked off fast isel. See issue #4352 for an example of this.
10971099
fn C_estr_slice(cx: @crate_ctxt, s: ~str) -> ValueRef {
10981100
let cs = llvm::LLVMConstPointerCast(C_cstr(cx, s), T_ptr(T_i8()));
10991101
C_struct(~[cs, C_uint(cx, str::len(s) + 1u /* +1 for null */)])

branches/incoming/src/librustc/middle/trans/reflect.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,17 @@ impl reflector {
4646
}
4747

4848
fn c_slice(s: ~str) -> ValueRef {
49-
let ss = C_estr_slice(self.bcx.ccx(), s);
50-
do_spill_noroot(self.bcx, ss)
49+
// We're careful to not use first class aggregates here because that
50+
// will kick us off fast isel. (Issue #4352.)
51+
let bcx = self.bcx;
52+
let str_vstore = ty::vstore_slice(ty::re_static);
53+
let str_ty = ty::mk_estr(bcx.tcx(), str_vstore);
54+
let scratch = scratch_datum(bcx, str_ty, false);
55+
let c_str = PointerCast(bcx, C_cstr(bcx.ccx(), s), T_ptr(T_i8()));
56+
Store(bcx, c_str, GEPi(bcx, scratch.val, [ 0, 0 ]));
57+
let len = C_uint(bcx.ccx(), s.len() + 1);
58+
Store(bcx, len, GEPi(bcx, scratch.val, [ 0, 1 ]));
59+
scratch.val
5160
}
5261

5362
fn c_size_and_align(t: ty::t) -> ~[ValueRef] {

0 commit comments

Comments
 (0)