Skip to content

Commit 3c88628

Browse files
committed
---
yaml --- r: 151185 b: refs/heads/try2 c: 58ab4a0 h: refs/heads/master i: 151183: 13d5b80 v: v3
1 parent 010746c commit 3c88628

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+659
-528
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 95f2c4bcc390b5d2bcd6e48d137af7392d089cc8
8+
refs/heads/try2: 58ab4a0064641ca5a27b0998ee7d0e33f9c677cd
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/mk/tests.mk

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -349,16 +349,6 @@ TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(SREQ$(1)_T_$(2)_H_$(3)) \
349349
$$(foreach crate,$$(TARGET_CRATES),\
350350
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)) \
351351
$$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4))
352-
353-
# The regex crate depends on the regex_macros crate during testing, but it
354-
# notably depend on the *host* regex_macros crate, not the target version.
355-
# Additionally, this is not a dependency in stage1, only in stage2.
356-
ifeq ($(4),regex)
357-
ifneq ($(1),1)
358-
TESTDEP_$(1)_$(2)_$(3)_$(4) += $$(TLIB$(1)_T_$(3)_H_$(3))/stamp.regex_macros
359-
endif
360-
endif
361-
362352
else
363353
TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(RSINPUTS_$(4))
364354
endif

branches/try2/src/librustc/back/link.rs

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ pub mod write {
152152
(sess.targ_cfg.os == abi::OsMacos &&
153153
sess.targ_cfg.arch == abi::X86_64);
154154

155+
// OSX has -dead_strip, which doesn't rely on ffunction_sections
156+
// FIXME(#13846) this should be enabled for windows
157+
let ffunction_sections = sess.targ_cfg.os != abi::OsMacos &&
158+
sess.targ_cfg.os != abi::OsWin32;
159+
let fdata_sections = ffunction_sections;
160+
155161
let reloc_model = match sess.opts.cg.relocation_model.as_slice() {
156162
"pic" => lib::llvm::RelocPIC,
157163
"static" => lib::llvm::RelocStatic,
@@ -173,9 +179,11 @@ pub mod write {
173179
lib::llvm::CodeModelDefault,
174180
reloc_model,
175181
opt_level,
176-
true,
182+
true /* EnableSegstk */,
177183
use_softfp,
178-
no_fp_elim
184+
no_fp_elim,
185+
ffunction_sections,
186+
fdata_sections,
179187
)
180188
})
181189
})
@@ -1136,32 +1144,26 @@ fn link_args(sess: &Session,
11361144
args.push("-nodefaultlibs".to_owned());
11371145
}
11381146

1147+
// If we're building a dylib, we don't use --gc-sections because LLVM has
1148+
// already done the best it can do, and we also don't want to eliminate the
1149+
// metadata. If we're building an executable, however, --gc-sections drops
1150+
// the size of hello world from 1.8MB to 597K, a 67% reduction.
1151+
if !dylib && sess.targ_cfg.os != abi::OsMacos {
1152+
args.push("-Wl,--gc-sections".to_owned());
1153+
}
1154+
11391155
if sess.targ_cfg.os == abi::OsLinux {
11401156
// GNU-style linkers will use this to omit linking to libraries which
11411157
// don't actually fulfill any relocations, but only for libraries which
11421158
// follow this flag. Thus, use it before specifying libraries to link to.
11431159
args.push("-Wl,--as-needed".to_owned());
11441160

1145-
// GNU-style linkers support optimization with -O. --gc-sections
1146-
// removes metadata and potentially other useful things, so don't
1147-
// include it. GNU ld doesn't need a numeric argument, but other linkers
1148-
// do.
1161+
// GNU-style linkers support optimization with -O. GNU ld doesn't need a
1162+
// numeric argument, but other linkers do.
11491163
if sess.opts.optimize == session::Default ||
11501164
sess.opts.optimize == session::Aggressive {
11511165
args.push("-Wl,-O1".to_owned());
11521166
}
1153-
} else if sess.targ_cfg.os == abi::OsMacos {
1154-
// The dead_strip option to the linker specifies that functions and data
1155-
// unreachable by the entry point will be removed. This is quite useful
1156-
// with Rust's compilation model of compiling libraries at a time into
1157-
// one object file. For example, this brings hello world from 1.7MB to
1158-
// 458K.
1159-
//
1160-
// Note that this is done for both executables and dynamic libraries. We
1161-
// won't get much benefit from dylibs because LLVM will have already
1162-
// stripped away as much as it could. This has not been seen to impact
1163-
// link times negatively.
1164-
args.push("-Wl,-dead_strip".to_owned());
11651167
}
11661168

11671169
if sess.targ_cfg.os == abi::OsWin32 {

branches/try2/src/librustc/lib/llvm.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1748,7 +1748,9 @@ pub mod llvm {
17481748
Level: CodeGenOptLevel,
17491749
EnableSegstk: bool,
17501750
UseSoftFP: bool,
1751-
NoFramePointerElim: bool) -> TargetMachineRef;
1751+
NoFramePointerElim: bool,
1752+
FunctionSections: bool,
1753+
DataSections: bool) -> TargetMachineRef;
17521754
pub fn LLVMRustDisposeTargetMachine(T: TargetMachineRef);
17531755
pub fn LLVMRustAddAnalysisPasses(T: TargetMachineRef,
17541756
PM: PassManagerRef,

branches/try2/src/librustc/metadata/tydecode.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,23 @@ pub fn parse_substs_data(data: &[u8], crate_num: ast::CrateNum, pos: uint, tcx:
138138
parse_substs(&mut st, conv)
139139
}
140140

141+
fn parse_vstore(st: &mut PState, conv: conv_did) -> ty::Vstore {
142+
assert_eq!(next(st), '/');
143+
144+
let c = peek(st);
145+
if '0' <= c && c <= '9' {
146+
let n = parse_uint(st);
147+
assert_eq!(next(st), '|');
148+
return ty::VstoreFixed(n);
149+
}
150+
151+
match next(st) {
152+
'~' => ty::VstoreUniq,
153+
'&' => ty::VstoreSlice(parse_region(st, conv)),
154+
c => st.tcx.sess.bug(format!("parse_vstore(): bad input '{}'", c))
155+
}
156+
}
157+
141158
fn parse_size(st: &mut PState) -> Option<uint> {
142159
assert_eq!(next(st), '/');
143160

@@ -344,7 +361,8 @@ fn parse_ty(st: &mut PState, conv: conv_did) -> ty::t {
344361
return ty::mk_vec(st.tcx, mt, sz);
345362
}
346363
'v' => {
347-
return ty::mk_str(st.tcx);
364+
let v = parse_vstore(st, |x,y| conv(x,y));
365+
return ty::mk_str(st.tcx, v);
348366
}
349367
'T' => {
350368
assert_eq!(next(st), '[');

branches/try2/src/librustc/metadata/tyencode.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,21 @@ fn enc_bound_region(w: &mut MemWriter, cx: &ctxt, br: ty::BoundRegion) {
177177
}
178178
}
179179

180+
pub fn enc_vstore(w: &mut MemWriter, cx: &ctxt,
181+
v: ty::Vstore,
182+
enc_mut: |&mut MemWriter|) {
183+
mywrite!(w, "/");
184+
match v {
185+
ty::VstoreFixed(u) => mywrite!(w, "{}|", u),
186+
ty::VstoreUniq => mywrite!(w, "~"),
187+
ty::VstoreSlice(r) => {
188+
mywrite!(w, "&");
189+
enc_region(w, cx, r);
190+
enc_mut(w);
191+
}
192+
}
193+
}
194+
180195
pub fn enc_trait_ref(w: &mut MemWriter, cx: &ctxt, s: &ty::TraitRef) {
181196
mywrite!(w, "{}|", (cx.ds)(s.def_id));
182197
enc_substs(w, cx, &s.substs);
@@ -260,8 +275,9 @@ fn enc_sty(w: &mut MemWriter, cx: &ctxt, st: &ty::sty) {
260275
None => mywrite!(w, "|"),
261276
}
262277
}
263-
ty::ty_str => {
278+
ty::ty_str(v) => {
264279
mywrite!(w, "v");
280+
enc_vstore(w, cx, v, |_| {});
265281
}
266282
ty::ty_closure(ref f) => {
267283
mywrite!(w, "f");

branches/try2/src/librustc/middle/check_match.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,6 @@ fn missing_ctor(cx: &MatchCheckCtxt,
405405
ty::ty_struct(..) => check_matrix_for_wild(cx, m),
406406
ty::ty_uniq(ty) | ty::ty_rptr(_, ty::mt{ty: ty, ..}) => match ty::get(ty).sty {
407407
ty::ty_vec(_, None) => ctor_for_slice(m),
408-
ty::ty_str => Some(single),
409408
_ => check_matrix_for_wild(cx, m),
410409
},
411410
ty::ty_enum(eid, _) => {

branches/try2/src/librustc/middle/effect.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,7 @@ impl<'a> EffectCheckVisitor<'a> {
6868
debug!("effect: checking index with base type {}",
6969
ppaux::ty_to_str(self.tcx, base_type));
7070
match ty::get(base_type).sty {
71-
ty::ty_uniq(ty) | ty::ty_rptr(_, ty::mt{ty, ..}) => match ty::get(ty).sty {
72-
ty::ty_str => {
73-
self.tcx.sess.span_err(e.span,
74-
"modification of string types is not allowed");
75-
}
76-
_ => {}
77-
},
78-
ty::ty_str => {
71+
ty::ty_str(..) => {
7972
self.tcx.sess.span_err(e.span,
8073
"modification of string types is not allowed");
8174
}

branches/try2/src/librustc/middle/lint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ fn check_heap_type(cx: &Context, span: Span, ty: ty::t) {
911911
ty::ty_box(_) => {
912912
n_box += 1;
913913
}
914-
ty::ty_uniq(_) |
914+
ty::ty_uniq(_) | ty::ty_str(ty::VstoreUniq) |
915915
ty::ty_trait(~ty::TyTrait { store: ty::UniqTraitStore, .. }) |
916916
ty::ty_closure(~ty::ClosureTy { store: ty::UniqTraitStore, .. }) => {
917917
n_uniq += 1;

branches/try2/src/librustc/middle/mem_categorization.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ pub fn opt_deref_kind(t: ty::t) -> Option<deref_kind> {
174174
match ty::get(t).sty {
175175
ty::ty_uniq(_) |
176176
ty::ty_trait(~ty::TyTrait { store: ty::UniqTraitStore, .. }) |
177+
ty::ty_str(ty::VstoreUniq) |
177178
ty::ty_closure(~ty::ClosureTy {store: ty::UniqTraitStore, ..}) => {
178179
Some(deref_ptr(OwnedPtr))
179180
}
@@ -187,6 +188,7 @@ pub fn opt_deref_kind(t: ty::t) -> Option<deref_kind> {
187188
Some(deref_ptr(BorrowedPtr(kind, r)))
188189
}
189190

191+
ty::ty_str(ty::VstoreSlice(r)) |
190192
ty::ty_closure(~ty::ClosureTy {store: ty::RegionTraitStore(r, _), ..}) => {
191193
Some(deref_ptr(BorrowedPtr(ty::ImmBorrow, r)))
192194
}
@@ -204,7 +206,8 @@ pub fn opt_deref_kind(t: ty::t) -> Option<deref_kind> {
204206
Some(deref_interior(InteriorField(PositionalField(0))))
205207
}
206208

207-
ty::ty_vec(_, Some(_)) => {
209+
ty::ty_vec(_, Some(_)) |
210+
ty::ty_str(ty::VstoreFixed(_)) => {
208211
Some(deref_interior(InteriorElement(element_kind(t))))
209212
}
210213

@@ -1303,10 +1306,10 @@ fn element_kind(t: ty::t) -> ElementKind {
13031306
ty::ty_rptr(_, ty::mt{ty:ty, ..}) |
13041307
ty::ty_uniq(ty) => match ty::get(ty).sty {
13051308
ty::ty_vec(_, None) => VecElement,
1306-
ty::ty_str => StrElement,
13071309
_ => OtherElement
13081310
},
13091311
ty::ty_vec(..) => VecElement,
1312+
ty::ty_str(..) => StrElement,
13101313
_ => OtherElement
13111314
}
13121315
}

branches/try2/src/librustc/middle/trans/_match.rs

Lines changed: 28 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,50 +1293,40 @@ fn compare_values<'a>(
12931293
rhs: ValueRef,
12941294
rhs_t: ty::t)
12951295
-> Result<'a> {
1296-
fn compare_str<'a>(cx: &'a Block<'a>,
1297-
lhs: ValueRef,
1298-
rhs: ValueRef,
1299-
rhs_t: ty::t)
1300-
-> Result<'a> {
1301-
let did = langcall(cx, None,
1302-
format!("comparison of `{}`", cx.ty_to_str(rhs_t)),
1303-
StrEqFnLangItem);
1304-
let result = callee::trans_lang_call(cx, did, [lhs, rhs], None);
1305-
Result {
1306-
bcx: result.bcx,
1307-
val: bool_to_i1(result.bcx, result.val)
1308-
}
1309-
}
1310-
13111296
let _icx = push_ctxt("compare_values");
13121297
if ty::type_is_scalar(rhs_t) {
1313-
let rs = compare_scalar_types(cx, lhs, rhs, rhs_t, ast::BiEq);
1314-
return rslt(rs.bcx, rs.val);
1298+
let rs = compare_scalar_types(cx, lhs, rhs, rhs_t, ast::BiEq);
1299+
return rslt(rs.bcx, rs.val);
13151300
}
13161301

13171302
match ty::get(rhs_t).sty {
1318-
ty::ty_uniq(t) => match ty::get(t).sty {
1319-
ty::ty_str => {
1320-
let scratch_lhs = alloca(cx, val_ty(lhs), "__lhs");
1321-
Store(cx, lhs, scratch_lhs);
1322-
let scratch_rhs = alloca(cx, val_ty(rhs), "__rhs");
1323-
Store(cx, rhs, scratch_rhs);
1324-
let did = langcall(cx, None,
1325-
format!("comparison of `{}`", cx.ty_to_str(rhs_t)),
1326-
UniqStrEqFnLangItem);
1327-
let result = callee::trans_lang_call(cx, did, [scratch_lhs, scratch_rhs], None);
1328-
Result {
1329-
bcx: result.bcx,
1330-
val: bool_to_i1(result.bcx, result.val)
1331-
}
1303+
ty::ty_str(ty::VstoreUniq) => {
1304+
let scratch_lhs = alloca(cx, val_ty(lhs), "__lhs");
1305+
Store(cx, lhs, scratch_lhs);
1306+
let scratch_rhs = alloca(cx, val_ty(rhs), "__rhs");
1307+
Store(cx, rhs, scratch_rhs);
1308+
let did = langcall(cx, None,
1309+
format!("comparison of `{}`", cx.ty_to_str(rhs_t)),
1310+
UniqStrEqFnLangItem);
1311+
let result = callee::trans_lang_call(cx, did, [scratch_lhs, scratch_rhs], None);
1312+
Result {
1313+
bcx: result.bcx,
1314+
val: bool_to_i1(result.bcx, result.val)
1315+
}
1316+
}
1317+
ty::ty_str(_) => {
1318+
let did = langcall(cx, None,
1319+
format!("comparison of `{}`", cx.ty_to_str(rhs_t)),
1320+
StrEqFnLangItem);
1321+
let result = callee::trans_lang_call(cx, did, [lhs, rhs], None);
1322+
Result {
1323+
bcx: result.bcx,
1324+
val: bool_to_i1(result.bcx, result.val)
13321325
}
1333-
_ => cx.sess().bug("only scalars and strings supported in compare_values"),
1334-
},
1335-
ty::ty_rptr(_, mt) => match ty::get(mt.ty).sty {
1336-
ty::ty_str => compare_str(cx, lhs, rhs, rhs_t),
1337-
_ => cx.sess().bug("only scalars and strings supported in compare_values"),
1338-
},
1339-
_ => cx.sess().bug("only scalars and strings supported in compare_values"),
1326+
}
1327+
_ => {
1328+
cx.sess().bug("only scalars and strings supported in compare_values");
1329+
}
13401330
}
13411331
}
13421332

branches/try2/src/librustc/middle/trans/adt.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,11 @@ impl Case {
270270
self.tys.iter().position(|&ty| {
271271
match ty::get(ty).sty {
272272
ty::ty_rptr(_, mt) => match ty::get(mt.ty).sty {
273-
ty::ty_vec(_, None) | ty::ty_str => false,
273+
ty::ty_vec(_, None) => false,
274274
_ => true,
275275
},
276276
ty::ty_uniq(..) | ty::ty_box(..) |
277+
ty::ty_str(ty::VstoreUniq) |
277278
ty::ty_bare_fn(..) => true,
278279
// Is that everything? Would closures or slices qualify?
279280
_ => false

branches/try2/src/librustc/middle/trans/base.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ fn decl_fn(llmod: ModuleRef, name: &str, cc: lib::llvm::CallConv,
188188
// `~` pointer return values never alias because ownership is transferred
189189
// FIXME #6750 ~Trait cannot be directly marked as
190190
// noalias because the actual object pointer is nested.
191-
ty::ty_uniq(..) // | ty::ty_trait(_, _, ty::UniqTraitStore, _, _)
192-
=> {
191+
ty::ty_uniq(..) | // ty::ty_trait(_, _, ty::UniqTraitStore, _, _) |
192+
ty::ty_str(ty::VstoreUniq) => {
193193
unsafe {
194194
llvm::LLVMAddReturnAttribute(llfn, lib::llvm::NoAliasAttribute as c_uint);
195195
}
@@ -261,6 +261,7 @@ pub fn decl_rust_fn(ccx: &CrateContext, has_env: bool,
261261
// FIXME #6750 ~Trait cannot be directly marked as
262262
// noalias because the actual object pointer is nested.
263263
ty::ty_uniq(..) | // ty::ty_trait(_, _, ty::UniqTraitStore, _, _) |
264+
ty::ty_str(ty::VstoreUniq) |
264265
ty::ty_closure(~ty::ClosureTy {store: ty::UniqTraitStore, ..}) => {
265266
unsafe {
266267
llvm::LLVMAddAttribute(llarg, lib::llvm::NoAliasAttribute as c_uint);
@@ -664,6 +665,11 @@ pub fn iter_structural_ty<'r,
664665
}
665666
})
666667
}
668+
ty::ty_str(ty::VstoreFixed(n)) => {
669+
let unit_ty = ty::sequence_element_type(cx.tcx(), t);
670+
let (base, len) = tvec::get_fixed_base_and_byte_len(cx, av, unit_ty, n);
671+
cx = tvec::iter_vec_raw(cx, base, unit_ty, len, f);
672+
}
667673
ty::ty_vec(_, Some(n)) => {
668674
let unit_ty = ty::sequence_element_type(cx.tcx(), t);
669675
let (base, len) = tvec::get_fixed_base_and_byte_len(cx, av, unit_ty, n);

branches/try2/src/librustc/middle/trans/callee.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -659,10 +659,9 @@ pub fn trans_call_inner<'a>(
659659
match ty::get(ret_ty).sty {
660660
// `~` pointer return values never alias because ownership
661661
// is transferred
662-
ty::ty_uniq(ty) => match ty::get(ty).sty {
663-
ty::ty_str => {}
664-
_ => attrs.push((0, NoAliasAttribute)),
665-
},
662+
ty::ty_uniq(..) => {
663+
attrs.push((0, NoAliasAttribute));
664+
}
666665
_ => {}
667666
}
668667

0 commit comments

Comments
 (0)