Skip to content

Commit 5384771

Browse files
committed
---
yaml --- r: 76991 b: refs/heads/snap-stage3 c: 0ea2a20 h: refs/heads/master i: 76989: 132edec 76987: 1c9b2c1 76983: 0b356b1 76975: 330ff36 76959: b324363 76927: 9eecc99 v: v3
1 parent 9cb7b41 commit 5384771

Some content is hidden

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

69 files changed

+1065
-1914
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: f1132496dddbdd88f321a7919eec3d65136b3f75
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 293660d44347967cbb724d1ff94b90d635c2c64f
4+
refs/heads/snap-stage3: 0ea2a20397497a33af4d5d602e51cc50a8e15b4f
55
refs/heads/try: ebfe63cd1c0b5d23f7ea60c69b4fde2e30cfd42a
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/mk/rt.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,10 @@ rt/$(1)/stage$(2)/arch/$$(HOST_$(1))/libmorestack.a: $$(MORESTACK_OBJ_$(1)_$(2))
147147
$$(Q)$(AR_$(1)) rcs $$@ $$<
148148

149149
rt/$(1)/stage$(2)/$(CFG_RUNTIME_$(1)): $$(RUNTIME_OBJS_$(1)_$(2)) $$(MKFILE_DEPS) \
150-
$$(RUNTIME_DEF_$(1)_$(2)) $$(LIBUV_LIB_$(1)_$(2)) $$(JEMALLOC_LIB_$(1)_$(2))
150+
$$(RUNTIME_DEF_$(1)_$(2)) $$(LIBUV_LIB_$(1)_$(2))
151151
@$$(call E, link: $$@)
152152
$$(Q)$$(call CFG_LINK_CXX_$(1),$$@, $$(RUNTIME_OBJS_$(1)_$(2)) \
153-
$$(JEMALLOC_LIB_$(1)_$(2)) $$(CFG_GCCISH_POST_LIB_FLAGS_$(1)) $$(LIBUV_LIB_$(1)_$(2)) \
153+
$$(CFG_GCCISH_POST_LIB_FLAGS_$(1)) $$(LIBUV_LIB_$(1)_$(2)) \
154154
$$(CFG_LIBUV_LINK_FLAGS_$(1)),$$(RUNTIME_DEF_$(1)_$(2)),$$(CFG_RUNTIME_$(1)))
155155

156156
# FIXME: For some reason libuv's makefiles can't figure out the

branches/snap-stage3/src/compiletest/runtest.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use std::os;
2626
use std::str;
2727
use std::task::{spawn_sched, SingleThreaded};
2828
use std::vec;
29-
use std::unstable::running_on_valgrind;
3029

3130
use extra::test::MetricMap;
3231

@@ -39,21 +38,11 @@ pub fn run(config: config, testfile: ~str) {
3938
// that destroys parallelism if we let normal schedulers block.
4039
// It should be possible to remove this spawn once std::run is
4140
// rewritten to be non-blocking.
42-
//
43-
// We do _not_ create another thread if we're running on V because
44-
// it serializes all threads anyways.
45-
if running_on_valgrind() {
41+
do spawn_sched(SingleThreaded) {
4642
let config = config.take();
4743
let testfile = testfile.take();
4844
let mut _mm = MetricMap::new();
4945
run_metrics(config, testfile, &mut _mm);
50-
} else {
51-
do spawn_sched(SingleThreaded) {
52-
let config = config.take();
53-
let testfile = testfile.take();
54-
let mut _mm = MetricMap::new();
55-
run_metrics(config, testfile, &mut _mm);
56-
}
5746
}
5847
}
5948

branches/snap-stage3/src/librustc/back/passes.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ pub static transform_passes : &'static [(&'static str, &'static str)] = &'static
293293
("scalarrepl", "Scalar Replacement of Aggregates (DT)"),
294294
("scalarrepl-ssa", "Scalar Replacement of Aggregates (SSAUp)"),
295295
("sccp", "Sparse Conditional Constant Propagation"),
296+
("simplify-libcalls", "Simplify well-known library calls"),
296297
("simplifycfg", "Simplify the CFG"),
297298
("sink", "Code sinking"),
298299
("strip", "Strip all symbols from a module"),

branches/snap-stage3/src/librustc/lib/llvm.rs

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ pub enum Attribute {
8989
ReturnsTwiceAttribute = 1 << 29,
9090
UWTableAttribute = 1 << 30,
9191
NonLazyBindAttribute = 1 << 31,
92+
93+
// Not added to LLVM yet, so may need to stay updated if LLVM changes.
94+
// FIXME(#8199): if this changes, be sure to change the relevant constant
95+
// down below
96+
// FixedStackSegment = 1 << 41,
9297
}
9398

9499
// enum for the LLVM IntPredicate type
@@ -842,9 +847,7 @@ pub mod llvm {
842847
#[fast_ffi]
843848
pub fn LLVMSetGC(Fn: ValueRef, Name: *c_char);
844849
#[fast_ffi]
845-
pub fn LLVMAddFunctionAttr(Fn: ValueRef, PA: c_uint);
846-
#[fast_ffi]
847-
pub fn LLVMAddFunctionAttrString(Fn: ValueRef, Name: *c_char);
850+
pub fn LLVMAddFunctionAttr(Fn: ValueRef, PA: c_uint, HighPA: c_uint);
848851
#[fast_ffi]
849852
pub fn LLVMGetFunctionAttr(Fn: ValueRef) -> c_ulonglong;
850853
#[fast_ffi]
@@ -2135,7 +2138,23 @@ pub fn ConstFCmp(Pred: RealPredicate, V1: ValueRef, V2: ValueRef) -> ValueRef {
21352138

21362139
pub fn SetFunctionAttribute(Fn: ValueRef, attr: Attribute) {
21372140
unsafe {
2138-
llvm::LLVMAddFunctionAttr(Fn, attr as c_uint)
2141+
let attr = attr as u64;
2142+
let lower = attr & 0xffffffff;
2143+
let upper = (attr >> 32) & 0xffffffff;
2144+
llvm::LLVMAddFunctionAttr(Fn, lower as c_uint, upper as c_uint);
2145+
}
2146+
}
2147+
2148+
// FIXME(#8199): this shouldn't require this hackery. On i686
2149+
// (FixedStackSegment as u64) will return 0 instead of 1 << 41.
2150+
// Furthermore, if we use a match of any sort then an LLVM
2151+
// assertion is generated!
2152+
pub fn SetFixedStackSegmentAttribute(Fn: ValueRef) {
2153+
unsafe {
2154+
let attr = 1u64 << 41;
2155+
let lower = attr & 0xffffffff;
2156+
let upper = (attr >> 32) & 0xffffffff;
2157+
llvm::LLVMAddFunctionAttr(Fn, lower as c_uint, upper as c_uint);
21392158
}
21402159
}
21412160
/* Memory-managed object interface to type handles. */

branches/snap-stage3/src/librustc/middle/astencode.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -586,13 +586,8 @@ impl tr for method_origin {
586586
}
587587
)
588588
}
589-
typeck::method_object(ref mo) => {
590-
typeck::method_object(
591-
typeck::method_object {
592-
trait_id: mo.trait_id.tr(xcx),
593-
.. *mo
594-
}
595-
)
589+
typeck::method_trait(did, m) => {
590+
typeck::method_trait(did.tr(xcx), m)
596591
}
597592
}
598593
}

branches/snap-stage3/src/librustc/middle/borrowck/check_loans.rs

Lines changed: 34 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ use syntax::ast::{m_mutbl, m_imm, m_const};
2727
use syntax::ast;
2828
use syntax::ast_util;
2929
use syntax::codemap::span;
30-
use syntax::visit;
31-
use syntax::visit::Visitor;
30+
use syntax::oldvisit;
3231
use util::ppaux::Repr;
3332

3433
#[deriving(Clone)]
@@ -40,27 +39,6 @@ struct CheckLoanCtxt<'self> {
4039
reported: @mut HashSet<ast::NodeId>,
4140
}
4241

43-
struct CheckLoanVisitor;
44-
45-
impl<'self> Visitor<CheckLoanCtxt<'self>> for CheckLoanVisitor {
46-
fn visit_expr<'a>(&mut self, ex:@ast::expr, e:CheckLoanCtxt<'a>) {
47-
check_loans_in_expr(self, ex, e);
48-
}
49-
fn visit_local(&mut self, l:@ast::Local, e:CheckLoanCtxt) {
50-
check_loans_in_local(self, l, e);
51-
}
52-
fn visit_block(&mut self, b:&ast::Block, e:CheckLoanCtxt) {
53-
check_loans_in_block(self, b, e);
54-
}
55-
fn visit_pat(&mut self, p:@ast::pat, e:CheckLoanCtxt) {
56-
check_loans_in_pat(self, p, e);
57-
}
58-
fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&ast::fn_decl,
59-
b:&ast::Block, s:span, n:ast::NodeId, e:CheckLoanCtxt) {
60-
check_loans_in_fn(self, fk, fd, b, s, n, e);
61-
}
62-
}
63-
6442
pub fn check_loans(bccx: @BorrowckCtxt,
6543
dfcx_loans: &LoanDataFlow,
6644
move_data: move_data::FlowedMoveData,
@@ -76,8 +54,15 @@ pub fn check_loans(bccx: @BorrowckCtxt,
7654
reported: @mut HashSet::new(),
7755
};
7856

79-
let mut vt = CheckLoanVisitor;
80-
vt.visit_block(body, clcx);
57+
let vt = oldvisit::mk_vt(@oldvisit::Visitor {
58+
visit_expr: check_loans_in_expr,
59+
visit_local: check_loans_in_local,
60+
visit_block: check_loans_in_block,
61+
visit_pat: check_loans_in_pat,
62+
visit_fn: check_loans_in_fn,
63+
.. *oldvisit::default_visitor()
64+
});
65+
(vt.visit_block)(body, (clcx, vt));
8166
}
8267

8368
enum MoveError {
@@ -641,27 +626,27 @@ impl<'self> CheckLoanCtxt<'self> {
641626
}
642627
}
643628

644-
fn check_loans_in_fn<'a>(visitor: &mut CheckLoanVisitor,
645-
fk: &visit::fn_kind,
629+
fn check_loans_in_fn<'a>(fk: &oldvisit::fn_kind,
646630
decl: &ast::fn_decl,
647631
body: &ast::Block,
648632
sp: span,
649633
id: ast::NodeId,
650-
this: CheckLoanCtxt<'a>) {
634+
(this, visitor): (CheckLoanCtxt<'a>,
635+
oldvisit::vt<CheckLoanCtxt<'a>>)) {
651636
match *fk {
652-
visit::fk_item_fn(*) |
653-
visit::fk_method(*) => {
637+
oldvisit::fk_item_fn(*) |
638+
oldvisit::fk_method(*) => {
654639
// Don't process nested items.
655640
return;
656641
}
657642

658-
visit::fk_anon(*) |
659-
visit::fk_fn_block(*) => {
643+
oldvisit::fk_anon(*) |
644+
oldvisit::fk_fn_block(*) => {
660645
check_captured_variables(this, id, sp);
661646
}
662647
}
663648

664-
visit::walk_fn(visitor, fk, decl, body, sp, id, this);
649+
oldvisit::visit_fn(fk, decl, body, sp, id, (this, visitor));
665650

666651
fn check_captured_variables(this: CheckLoanCtxt,
667652
closure_id: ast::NodeId,
@@ -704,16 +689,16 @@ fn check_loans_in_fn<'a>(visitor: &mut CheckLoanVisitor,
704689
}
705690
}
706691

707-
fn check_loans_in_local<'a>(vt: &mut CheckLoanVisitor,
708-
local: @ast::Local,
709-
this: CheckLoanCtxt<'a>) {
710-
visit::walk_local(vt, local, this);
692+
fn check_loans_in_local<'a>(local: @ast::Local,
693+
(this, vt): (CheckLoanCtxt<'a>,
694+
oldvisit::vt<CheckLoanCtxt<'a>>)) {
695+
oldvisit::visit_local(local, (this, vt));
711696
}
712697

713-
fn check_loans_in_expr<'a>(vt: &mut CheckLoanVisitor,
714-
expr: @ast::expr,
715-
this: CheckLoanCtxt<'a>) {
716-
visit::walk_expr(vt, expr, this);
698+
fn check_loans_in_expr<'a>(expr: @ast::expr,
699+
(this, vt): (CheckLoanCtxt<'a>,
700+
oldvisit::vt<CheckLoanCtxt<'a>>)) {
701+
oldvisit::visit_expr(expr, (this, vt));
717702

718703
debug!("check_loans_in_expr(expr=%s)",
719704
expr.repr(this.tcx()));
@@ -764,19 +749,19 @@ fn check_loans_in_expr<'a>(vt: &mut CheckLoanVisitor,
764749
}
765750
}
766751

767-
fn check_loans_in_pat<'a>(vt: &mut CheckLoanVisitor,
768-
pat: @ast::pat,
769-
this: CheckLoanCtxt<'a>)
752+
fn check_loans_in_pat<'a>(pat: @ast::pat,
753+
(this, vt): (CheckLoanCtxt<'a>,
754+
oldvisit::vt<CheckLoanCtxt<'a>>))
770755
{
771756
this.check_for_conflicting_loans(pat.id);
772757
this.check_move_out_from_id(pat.id, pat.span);
773-
visit::walk_pat(vt, pat, this);
758+
oldvisit::visit_pat(pat, (this, vt));
774759
}
775760

776-
fn check_loans_in_block<'a>(vt: &mut CheckLoanVisitor,
777-
blk: &ast::Block,
778-
this: CheckLoanCtxt<'a>)
761+
fn check_loans_in_block<'a>(blk: &ast::Block,
762+
(this, vt): (CheckLoanCtxt<'a>,
763+
oldvisit::vt<CheckLoanCtxt<'a>>))
779764
{
780-
visit::walk_block(vt, blk, this);
765+
oldvisit::visit_block(blk, (this, vt));
781766
this.check_for_conflicting_loans(blk.id);
782767
}

branches/snap-stage3/src/librustc/middle/borrowck/gather_loans/restrictions.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl RestrictionsContext {
101101
self.extend(result, cmt.mutbl, LpInterior(i), restrictions)
102102
}
103103

104-
mc::cat_deref(cmt_base, _, mc::uniq_ptr) => {
104+
mc::cat_deref(cmt_base, _, pk @ mc::uniq_ptr) => {
105105
// R-Deref-Send-Pointer
106106
//
107107
// When we borrow the interior of an owned pointer, we
@@ -110,7 +110,7 @@ impl RestrictionsContext {
110110
let result = self.restrict(
111111
cmt_base,
112112
restrictions | RESTR_MUTATE | RESTR_CLAIM);
113-
self.extend(result, cmt.mutbl, LpDeref, restrictions)
113+
self.extend(result, cmt.mutbl, LpDeref(pk), restrictions)
114114
}
115115

116116
mc::cat_copied_upvar(*) | // FIXME(#2152) allow mutation of upvars
@@ -129,7 +129,7 @@ impl RestrictionsContext {
129129
Safe
130130
}
131131

132-
mc::cat_deref(cmt_base, _, mc::gc_ptr(m_mutbl)) => {
132+
mc::cat_deref(cmt_base, _, pk @ mc::gc_ptr(m_mutbl)) => {
133133
// R-Deref-Managed-Borrowed
134134
//
135135
// Technically, no restrictions are *necessary* here.
@@ -170,14 +170,14 @@ impl RestrictionsContext {
170170
match opt_loan_path(cmt_base) {
171171
None => Safe,
172172
Some(lp_base) => {
173-
let lp = @LpExtend(lp_base, cmt.mutbl, LpDeref);
173+
let lp = @LpExtend(lp_base, cmt.mutbl, LpDeref(pk));
174174
SafeIf(lp, ~[Restriction {loan_path: lp,
175175
set: restrictions}])
176176
}
177177
}
178178
}
179179

180-
mc::cat_deref(cmt_base, _, mc::region_ptr(m_mutbl, _)) => {
180+
mc::cat_deref(cmt_base, _, pk @ mc::region_ptr(m_mutbl, _)) => {
181181
// Because an `&mut` pointer does not inherit its
182182
// mutability, we can only prevent mutation or prevent
183183
// freezing if it is not aliased. Therefore, in such
@@ -187,7 +187,7 @@ impl RestrictionsContext {
187187
let result = self.restrict(
188188
cmt_base,
189189
RESTR_ALIAS | RESTR_MUTATE | RESTR_CLAIM);
190-
self.extend(result, cmt.mutbl, LpDeref, restrictions)
190+
self.extend(result, cmt.mutbl, LpDeref(pk), restrictions)
191191
} else {
192192
// R-Deref-Mut-Borrowed-2
193193
Safe

branches/snap-stage3/src/librustc/middle/borrowck/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ pub enum LoanPath {
261261

262262
#[deriving(Eq, IterBytes)]
263263
pub enum LoanPathElem {
264-
LpDeref, // `*LV` in doc.rs
264+
LpDeref(mc::PointerKind), // `*LV` in doc.rs
265265
LpInterior(mc::InteriorKind) // `LV.f` in doc.rs
266266
}
267267

@@ -295,9 +295,9 @@ pub fn opt_loan_path(cmt: mc::cmt) -> Option<@LoanPath> {
295295
Some(@LpVar(id))
296296
}
297297

298-
mc::cat_deref(cmt_base, _, _) => {
298+
mc::cat_deref(cmt_base, _, pk) => {
299299
do opt_loan_path(cmt_base).map_move |lp| {
300-
@LpExtend(lp, cmt.mutbl, LpDeref)
300+
@LpExtend(lp, cmt.mutbl, LpDeref(pk))
301301
}
302302
}
303303

@@ -728,7 +728,7 @@ impl BorrowckCtxt {
728728
loan_path: &LoanPath,
729729
out: &mut ~str) {
730730
match *loan_path {
731-
LpExtend(_, _, LpDeref) => {
731+
LpExtend(_, _, LpDeref(_)) => {
732732
out.push_char('(');
733733
self.append_loan_path_to_str(loan_path, out);
734734
out.push_char(')');
@@ -776,7 +776,7 @@ impl BorrowckCtxt {
776776
out.push_str("[]");
777777
}
778778

779-
LpExtend(lp_base, _, LpDeref) => {
779+
LpExtend(lp_base, _, LpDeref(_)) => {
780780
out.push_char('*');
781781
self.append_loan_path_to_str(lp_base, out);
782782
}
@@ -854,7 +854,7 @@ impl Repr for LoanPath {
854854
fmt!("$(%?)", id)
855855
}
856856

857-
&LpExtend(lp, _, LpDeref) => {
857+
&LpExtend(lp, _, LpDeref(_)) => {
858858
fmt!("%s.*", lp.repr(tcx))
859859
}
860860

0 commit comments

Comments
 (0)