Skip to content

Commit c00232d

Browse files
committed
---
yaml --- r: 34398 b: refs/heads/snap-stage3 c: 7b245d4 h: refs/heads/master v: v3
1 parent 303875d commit c00232d

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
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 9abcacc0f371206a66cd1b346f5e46ac6063d9bd
4+
refs/heads/snap-stage3: 7b245d46ed5fc93d3251e9e07f50e9b09b1f42c4
55
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/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/snap-stage3/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)