Skip to content

Commit 1282bb4

Browse files
committed
---
yaml --- r: 123643 b: refs/heads/try c: f78d2f5 h: refs/heads/master i: 123641: 0714024 123639: 08b7c4a v: v3
1 parent 93ae3b7 commit 1282bb4

File tree

22 files changed

+223
-96
lines changed

22 files changed

+223
-96
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: da4e4e4e0a7778a85748aa4a303b13f603e96b4b
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 8ddd286ea4ba4384a0dc9eae393ed515460a986e
5-
refs/heads/try: 9f460e7af88ca6efc1a58ebe781b47447acdb21b
5+
refs/heads/try: f78d2f59004559fc116fe7ee5e9a4b479fe7a1b0
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/mk/target.mk

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,6 @@ $(foreach host,$(CFG_HOST), \
4444
$(foreach crate,$(CRATES), \
4545
$(eval $(call RUST_CRATE_FULLDEPS,$(stage),$(target),$(host),$(crate)))))))
4646

47-
# NOTE: after a stage0 snap this should be just EXTRA_FILENAME, not with a stage
48-
# bound
49-
EXTRA_FILENAME_0 =
50-
EXTRA_FILENAME_1 = -C extra-filename=-$(CFG_FILENAME_EXTRA)
51-
EXTRA_FILENAME_2 = -C extra-filename=-$(CFG_FILENAME_EXTRA)
52-
EXTRA_FILENAME_3 = -C extra-filename=-$(CFG_FILENAME_EXTRA)
53-
5447
# RUST_TARGET_STAGE_N template: This defines how target artifacts are built
5548
# for all stage/target architecture combinations. This is one giant rule which
5649
# works as follows:
@@ -75,6 +68,15 @@ EXTRA_FILENAME_3 = -C extra-filename=-$(CFG_FILENAME_EXTRA)
7568
# $(4) is the crate name
7669
define RUST_TARGET_STAGE_N
7770

71+
# NOTE: after a stage0 snap this should be just EXTRA_FILENAME, not with a stage
72+
# or target bound
73+
EXTRA_FILENAME_$(1)_$(2) = -C extra-filename=-$$(CFG_FILENAME_EXTRA)
74+
ifeq ($(1),0)
75+
ifeq ($$(CFG_BUILD),$(2))
76+
EXTRA_FILENAME_$(1)_$(2) =
77+
endif
78+
endif
79+
7880
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): CFG_COMPILER_HOST_TRIPLE = $(2)
7981
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): \
8082
$$(CRATEFILE_$(4)) \
@@ -93,7 +95,7 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): \
9395
-L "$$(dir $$(LLVM_STDCPP_LOCATION_$(2)))" \
9496
$$(RUSTFLAGS_$(4)) \
9597
--out-dir $$(@D) \
96-
$$(EXTRA_FILENAME_$(1)) \
98+
$$(EXTRA_FILENAME_$(1)_$(2)) \
9799
$$<
98100
@touch $$@
99101
$$(call LIST_ALL_OLD_GLOB_MATCHES,\

branches/try/src/doc/guide.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ You should see some output that looks something like this:
9191

9292
```{ignore}
9393
rustc 0.11.0-pre (443a1cd 2014-06-08 14:56:52 -0700)
94-
host: x86_64-unknown-linux-gnu
9594
```
9695

9796
If you did, Rust has been installed successfully! Congrats!

branches/try/src/libcollections/string.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ impl String {
208208
/// Appends a byte to this string buffer. The caller must preserve the valid UTF-8 property.
209209
#[inline]
210210
pub unsafe fn push_byte(&mut self, byte: u8) {
211-
self.push_bytes([byte])
211+
self.vec.push(byte)
212212
}
213213

214214
/// Removes the last byte from the string buffer and returns it. Returns `None` if this string

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ pub fn trans_case<'a>(bcx: &'a Block<'a>, r: &Repr, discr: Disr)
618618
RawNullablePointer { .. } |
619619
StructWrappedNullablePointer { .. } => {
620620
assert!(discr == 0 || discr == 1);
621-
_match::single_result(Result::new(bcx, C_i1(bcx.ccx(), discr != 0)))
621+
_match::single_result(Result::new(bcx, C_bool(bcx.ccx(), discr != 0)))
622622
}
623623
}
624624
}
@@ -641,7 +641,7 @@ pub fn trans_start_init(bcx: &Block, r: &Repr, val: ValueRef, discr: Disr) {
641641
}
642642
Univariant(ref st, true) => {
643643
assert_eq!(discr, 0);
644-
Store(bcx, C_bool(bcx.ccx(), true),
644+
Store(bcx, C_u8(bcx.ccx(), 1),
645645
GEPi(bcx, val, [0, st.fields.len() - 1]))
646646
}
647647
Univariant(..) => {

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

Lines changed: 53 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,8 @@ pub fn compare_scalar_values<'a>(
538538
// We don't need to do actual comparisons for nil.
539539
// () == () holds but () < () does not.
540540
match op {
541-
ast::BiEq | ast::BiLe | ast::BiGe => return C_i1(cx.ccx(), true),
542-
ast::BiNe | ast::BiLt | ast::BiGt => return C_i1(cx.ccx(), false),
541+
ast::BiEq | ast::BiLe | ast::BiGe => return C_bool(cx.ccx(), true),
542+
ast::BiNe | ast::BiLt | ast::BiGt => return C_bool(cx.ccx(), false),
543543
// refinements would be nice
544544
_ => die(cx)
545545
}
@@ -958,10 +958,42 @@ pub fn need_invoke(bcx: &Block) -> bool {
958958

959959
pub fn load_if_immediate(cx: &Block, v: ValueRef, t: ty::t) -> ValueRef {
960960
let _icx = push_ctxt("load_if_immediate");
961-
if type_is_immediate(cx.ccx(), t) { return Load(cx, v); }
961+
if type_is_immediate(cx.ccx(), t) { return load_ty(cx, v, t); }
962962
return v;
963963
}
964964

965+
pub fn load_ty(cx: &Block, ptr: ValueRef, t: ty::t) -> ValueRef {
966+
/*!
967+
* Helper for loading values from memory. Does the necessary conversion if
968+
* the in-memory type differs from the type used for SSA values. Also
969+
* handles various special cases where the type gives us better information
970+
* about what we are loading.
971+
*/
972+
if type_is_zero_size(cx.ccx(), t) {
973+
C_undef(type_of::type_of(cx.ccx(), t))
974+
} else if ty::type_is_bool(t) {
975+
Trunc(cx, LoadRangeAssert(cx, ptr, 0, 2, lib::llvm::False), Type::i1(cx.ccx()))
976+
} else if ty::type_is_char(t) {
977+
// a char is a unicode codepoint, and so takes values from 0
978+
// to 0x10FFFF inclusive only.
979+
LoadRangeAssert(cx, ptr, 0, 0x10FFFF + 1, lib::llvm::False)
980+
} else {
981+
Load(cx, ptr)
982+
}
983+
}
984+
985+
pub fn store_ty(cx: &Block, v: ValueRef, dst: ValueRef, t: ty::t) {
986+
/*!
987+
* Helper for storing values in memory. Does the necessary conversion if
988+
* the in-memory type differs from the type used for SSA values.
989+
*/
990+
if ty::type_is_bool(t) {
991+
Store(cx, ZExt(cx, v, Type::i8(cx.ccx())), dst);
992+
} else {
993+
Store(cx, v, dst);
994+
};
995+
}
996+
965997
pub fn ignore_lhs(_bcx: &Block, local: &ast::Local) -> bool {
966998
match local.pat.node {
967999
ast::PatWild => true, _ => false
@@ -1013,7 +1045,7 @@ pub fn call_memcpy(cx: &Block, dst: ValueRef, src: ValueRef, n_bytes: ValueRef,
10131045
let dst_ptr = PointerCast(cx, dst, Type::i8p(ccx));
10141046
let size = IntCast(cx, n_bytes, ccx.int_type);
10151047
let align = C_i32(ccx, align as i32);
1016-
let volatile = C_i1(ccx, false);
1048+
let volatile = C_bool(ccx, false);
10171049
Call(cx, memcpy, [dst_ptr, src_ptr, size, align, volatile], []);
10181050
}
10191051

@@ -1058,7 +1090,7 @@ fn memzero(b: &Builder, llptr: ValueRef, ty: Type) {
10581090
let llzeroval = C_u8(ccx, 0);
10591091
let size = machine::llsize_of(ccx, ty);
10601092
let align = C_i32(ccx, llalign_of_min(ccx, ty) as i32);
1061-
let volatile = C_i1(ccx, false);
1093+
let volatile = C_bool(ccx, false);
10621094
b.call(llintrinsicfn, [llptr, llzeroval, size, align, volatile], []);
10631095
}
10641096

@@ -1282,9 +1314,14 @@ fn copy_args_to_allocas<'a>(fcx: &FunctionContext<'a>,
12821314
// Ties up the llstaticallocas -> llloadenv -> lltop edges,
12831315
// and builds the return block.
12841316
pub fn finish_fn<'a>(fcx: &'a FunctionContext<'a>,
1285-
last_bcx: &'a Block<'a>) {
1317+
last_bcx: &'a Block<'a>,
1318+
retty: ty::t) {
12861319
let _icx = push_ctxt("finish_fn");
12871320

1321+
// This shouldn't need to recompute the return type,
1322+
// as new_fn_ctxt did it already.
1323+
let substd_retty = retty.substp(fcx.ccx.tcx(), fcx.param_substs);
1324+
12881325
let ret_cx = match fcx.llreturn.get() {
12891326
Some(llreturn) => {
12901327
if !last_bcx.terminated.get() {
@@ -1294,13 +1331,13 @@ pub fn finish_fn<'a>(fcx: &'a FunctionContext<'a>,
12941331
}
12951332
None => last_bcx
12961333
};
1297-
build_return_block(fcx, ret_cx);
1334+
build_return_block(fcx, ret_cx, substd_retty);
12981335
debuginfo::clear_source_location(fcx);
12991336
fcx.cleanup();
13001337
}
13011338

13021339
// Builds the return block for a function.
1303-
pub fn build_return_block(fcx: &FunctionContext, ret_cx: &Block) {
1340+
pub fn build_return_block(fcx: &FunctionContext, ret_cx: &Block, retty: ty::t) {
13041341
// Return the value if this function immediate; otherwise, return void.
13051342
if fcx.llretptr.get().is_none() || fcx.caller_expects_out_pointer {
13061343
return RetVoid(ret_cx);
@@ -1318,13 +1355,16 @@ pub fn build_return_block(fcx: &FunctionContext, ret_cx: &Block) {
13181355
retptr.erase_from_parent();
13191356
}
13201357

1321-
retval
1358+
if ty::type_is_bool(retty) {
1359+
Trunc(ret_cx, retval, Type::i1(fcx.ccx))
1360+
} else {
1361+
retval
1362+
}
13221363
}
13231364
// Otherwise, load the return value from the ret slot
1324-
None => Load(ret_cx, fcx.llretptr.get().unwrap())
1365+
None => load_ty(ret_cx, fcx.llretptr.get().unwrap(), retty)
13251366
};
13261367

1327-
13281368
Ret(ret_cx, retval);
13291369
}
13301370

@@ -1422,7 +1462,7 @@ pub fn trans_closure(ccx: &CrateContext,
14221462
}
14231463

14241464
// Insert the mandatory first few basic blocks before lltop.
1425-
finish_fn(&fcx, bcx);
1465+
finish_fn(&fcx, bcx, output_type);
14261466
}
14271467

14281468
// trans_fn: creates an LLVM function corresponding to a source language
@@ -1512,7 +1552,7 @@ fn trans_enum_variant_or_tuple_like_struct(ccx: &CrateContext,
15121552
}
15131553
}
15141554

1515-
finish_fn(&fcx, bcx);
1555+
finish_fn(&fcx, bcx, result_ty);
15161556
}
15171557

15181558
fn trans_enum_def(ccx: &CrateContext, enum_definition: &ast::EnumDef,

branches/try/src/librustc/middle/trans/cabi_arm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ fn ty_size(ty: Type) -> uint {
8585

8686
fn classify_ret_ty(ccx: &CrateContext, ty: Type) -> ArgType {
8787
if is_reg_ty(ty) {
88-
let attr = if ty == Type::bool(ccx) { Some(ZExtAttribute) } else { None };
88+
let attr = if ty == Type::i1(ccx) { Some(ZExtAttribute) } else { None };
8989
return ArgType::direct(ty, None, None, attr);
9090
}
9191
let size = ty_size(ty);
@@ -104,7 +104,7 @@ fn classify_ret_ty(ccx: &CrateContext, ty: Type) -> ArgType {
104104

105105
fn classify_arg_ty(ccx: &CrateContext, ty: Type) -> ArgType {
106106
if is_reg_ty(ty) {
107-
let attr = if ty == Type::bool(ccx) { Some(ZExtAttribute) } else { None };
107+
let attr = if ty == Type::i1(ccx) { Some(ZExtAttribute) } else { None };
108108
return ArgType::direct(ty, None, None, attr);
109109
}
110110
let align = ty_align(ty);

branches/try/src/librustc/middle/trans/cabi_mips.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ fn ty_size(ty: Type) -> uint {
8585

8686
fn classify_ret_ty(ccx: &CrateContext, ty: Type) -> ArgType {
8787
if is_reg_ty(ty) {
88-
let attr = if ty == Type::bool(ccx) { Some(ZExtAttribute) } else { None };
88+
let attr = if ty == Type::i1(ccx) { Some(ZExtAttribute) } else { None };
8989
ArgType::direct(ty, None, None, attr)
9090
} else {
9191
ArgType::indirect(ty, Some(StructRetAttribute))
@@ -102,7 +102,7 @@ fn classify_arg_ty(ccx: &CrateContext, ty: Type, offset: &mut uint) -> ArgType {
102102
*offset += align_up_to(size, align * 8) / 8;
103103

104104
if is_reg_ty(ty) {
105-
let attr = if ty == Type::bool(ccx) { Some(ZExtAttribute) } else { None };
105+
let attr = if ty == Type::i1(ccx) { Some(ZExtAttribute) } else { None };
106106
ArgType::direct(ty, None, None, attr)
107107
} else {
108108
ArgType::direct(

branches/try/src/librustc/middle/trans/cabi_x86.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub fn compute_abi_info(ccx: &CrateContext,
5959
}
6060
}
6161
} else {
62-
let attr = if rty == Type::bool(ccx) { Some(ZExtAttribute) } else { None };
62+
let attr = if rty == Type::i1(ccx) { Some(ZExtAttribute) } else { None };
6363
ret_ty = ArgType::direct(rty, None, None, attr);
6464
}
6565

@@ -74,7 +74,7 @@ pub fn compute_abi_info(ccx: &CrateContext,
7474
}
7575
}
7676
_ => {
77-
let attr = if t == Type::bool(ccx) { Some(ZExtAttribute) } else { None };
77+
let attr = if t == Type::i1(ccx) { Some(ZExtAttribute) } else { None };
7878
ArgType::direct(t, None, None, attr)
7979
}
8080
};

branches/try/src/librustc/middle/trans/cabi_x86_64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ pub fn compute_abi_info(ccx: &CrateContext,
350350
None)
351351
}
352352
} else {
353-
let attr = if ty == Type::bool(ccx) { Some(ZExtAttribute) } else { None };
353+
let attr = if ty == Type::i1(ccx) { Some(ZExtAttribute) } else { None };
354354
ArgType::direct(ty, None, None, attr)
355355
}
356356
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ pub fn trans_unboxing_shim(bcx: &Block,
345345
}).bcx;
346346

347347
bcx = fcx.pop_and_trans_custom_cleanup_scope(bcx, arg_scope);
348-
finish_fn(&fcx, bcx);
348+
finish_fn(&fcx, bcx, return_type);
349349

350350
llfn
351351
}
@@ -757,7 +757,7 @@ pub fn trans_call_inner<'a>(
757757
if !type_of::return_uses_outptr(bcx.ccx(), ret_ty) &&
758758
!type_is_zero_size(bcx.ccx(), ret_ty)
759759
{
760-
Store(bcx, llret, llretslot);
760+
store_ty(bcx, llret, llretslot, ret_ty)
761761
}
762762
}
763763
None => {}

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -522,10 +522,6 @@ pub fn C_nil(ccx: &CrateContext) -> ValueRef {
522522
}
523523

524524
pub fn C_bool(ccx: &CrateContext, val: bool) -> ValueRef {
525-
C_integral(Type::bool(ccx), val as u64, false)
526-
}
527-
528-
pub fn C_i1(ccx: &CrateContext, val: bool) -> ValueRef {
529525
C_integral(Type::i1(ccx), val as u64, false)
530526
}
531527

branches/try/src/librustc/middle/trans/datum.rs

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@
1313
* Datums are and how they are intended to be used.
1414
*/
1515

16-
use lib;
1716
use lib::llvm::ValueRef;
1817
use middle::trans::base::*;
19-
use middle::trans::build::*;
2018
use middle::trans::common::*;
2119
use middle::trans::cleanup;
2220
use middle::trans::cleanup::CleanupMethods;
@@ -344,7 +342,7 @@ impl Datum<Rvalue> {
344342
match self.kind.mode {
345343
ByValue => DatumBlock::new(bcx, self),
346344
ByRef => {
347-
let llval = load(bcx, self.val, self.ty);
345+
let llval = load_ty(bcx, self.val, self.ty);
348346
DatumBlock::new(bcx, Datum::new(llval, self.ty, Rvalue::new(ByValue)))
349347
}
350348
}
@@ -471,7 +469,7 @@ impl Datum<Expr> {
471469
DatumBlock::new(bcx, scratch)
472470
}
473471
ByValue => {
474-
let v = load(bcx, l.val, l.ty);
472+
let v = load_ty(bcx, l.val, l.ty);
475473
bcx = l.kind.post_store(bcx, l.val, l.ty);
476474
DatumBlock::new(bcx, Datum::new(v, l.ty, Rvalue::new(ByValue)))
477475
}
@@ -516,24 +514,6 @@ impl Datum<Lvalue> {
516514
}
517515
}
518516

519-
fn load<'a>(bcx: &'a Block<'a>, llptr: ValueRef, ty: ty::t) -> ValueRef {
520-
/*!
521-
* Private helper for loading from a by-ref datum. Handles various
522-
* special cases where the type gives us better information about
523-
* what we are loading.
524-
*/
525-
526-
if type_is_zero_size(bcx.ccx(), ty) {
527-
C_undef(type_of::type_of(bcx.ccx(), ty))
528-
} else if ty::type_is_char(ty) {
529-
// a char is a unicode codepoint, and so takes values from 0
530-
// to 0x10FFFF inclusive only.
531-
LoadRangeAssert(bcx, llptr, 0, 0x10FFFF + 1, lib::llvm::False)
532-
} else {
533-
Load(bcx, llptr)
534-
}
535-
}
536-
537517
/**
538518
* Generic methods applicable to any sort of datum.
539519
*/
@@ -591,7 +571,7 @@ impl<K:KindOps> Datum<K> {
591571
if self.kind.is_by_ref() {
592572
memcpy_ty(bcx, dst, self.val, self.ty);
593573
} else {
594-
Store(bcx, self.val, dst);
574+
store_ty(bcx, self.val, dst, self.ty);
595575
}
596576

597577
return bcx;
@@ -642,7 +622,7 @@ impl<K:KindOps> Datum<K> {
642622
assert!(!ty::type_needs_drop(bcx.tcx(), self.ty));
643623
assert!(self.appropriate_rvalue_mode(bcx.ccx()) == ByValue);
644624
if self.kind.is_by_ref() {
645-
load(bcx, self.val, self.ty)
625+
load_ty(bcx, self.val, self.ty)
646626
} else {
647627
self.val
648628
}

0 commit comments

Comments
 (0)