Skip to content

Commit 18155ff

Browse files
committed
---
yaml --- r: 60606 b: refs/heads/auto c: 8a4bffc h: refs/heads/master v: v3
1 parent b37e4de commit 18155ff

File tree

10 files changed

+87
-185
lines changed

10 files changed

+87
-185
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: f8af2b50eee70ea912c18e5acb510789e59dd535
17+
refs/heads/auto: 8a4bffc7eee07d895e32db9a4a366c23995d260a
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

branches/auto/src/libcore/rt/context.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,9 @@ fn new_regs() -> ~Registers { ~([0, .. 32]) }
165165

166166
#[cfg(target_arch = "arm")]
167167
fn initialize_call_frame(regs: &mut Registers, fptr: *c_void, arg: *c_void, sp: *mut uint) {
168-
let sp = mut_offset(sp, -1);
168+
let sp = align_down(sp);
169+
// sp of arm eabi is 8-byte aligned
170+
let sp = mut_offset(sp, -2);
169171

170172
// The final return address. 0 indicates the bottom of the stack
171173
unsafe { *sp = 0; }

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

Lines changed: 15 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -498,27 +498,10 @@ pub fn specialize(cx: @MatchCheckCtxt,
498498
lookup_const_by_id(cx.tcx, did).get();
499499
let e_v = eval_const_expr(cx.tcx, const_expr);
500500
let match_ = match *ctor_id {
501-
val(ref v) => {
502-
match compare_const_vals(&e_v, v) {
503-
Some(val1) => (val1 == 0),
504-
None => {
505-
cx.tcx.sess.span_err(pat_span,
506-
"mismatched types between arms");
507-
false
508-
}
509-
}
510-
},
501+
val(ref v) => compare_const_vals(&e_v, v) == 0,
511502
range(ref c_lo, ref c_hi) => {
512-
let m1 = compare_const_vals(c_lo, &e_v),
513-
m2 = compare_const_vals(c_hi, &e_v);
514-
match (m1, m2) {
515-
(Some(val1), Some(val2)) => (val1 >= 0 && val2 <= 0),
516-
_ => {
517-
cx.tcx.sess.span_err(pat_span,
518-
"mismatched types between ranges");
519-
false
520-
}
521-
}
503+
compare_const_vals(c_lo, &e_v) >= 0 &&
504+
compare_const_vals(c_hi, &e_v) <= 0
522505
}
523506
single => true,
524507
_ => fail!("type error")
@@ -546,26 +529,10 @@ pub fn specialize(cx: @MatchCheckCtxt,
546529
lookup_const_by_id(cx.tcx, did).get();
547530
let e_v = eval_const_expr(cx.tcx, const_expr);
548531
let match_ = match *ctor_id {
549-
val(ref v) =>
550-
match compare_const_vals(&e_v, v) {
551-
Some(val1) => (val1 == 0),
552-
None => {
553-
cx.tcx.sess.span_err(pat_span,
554-
"mismatched types between arms");
555-
false
556-
}
557-
},
532+
val(ref v) => compare_const_vals(&e_v, v) == 0,
558533
range(ref c_lo, ref c_hi) => {
559-
let m1 = compare_const_vals(c_lo, &e_v),
560-
m2 = compare_const_vals(c_hi, &e_v);
561-
match (m1, m2) {
562-
(Some(val1), Some(val2)) => (val1 >= 0 && val2 <= 0),
563-
_ => {
564-
cx.tcx.sess.span_err(pat_span,
565-
"mismatched types between ranges");
566-
false
567-
}
568-
}
534+
compare_const_vals(c_lo, &e_v) >= 0 &&
535+
compare_const_vals(c_hi, &e_v) <= 0
569536
}
570537
single => true,
571538
_ => fail!("type error")
@@ -652,27 +619,10 @@ pub fn specialize(cx: @MatchCheckCtxt,
652619
pat_lit(expr) => {
653620
let e_v = eval_const_expr(cx.tcx, expr);
654621
let match_ = match *ctor_id {
655-
val(ref v) => {
656-
match compare_const_vals(&e_v, v) {
657-
Some(val1) => val1 == 0,
658-
None => {
659-
cx.tcx.sess.span_err(pat_span,
660-
"mismatched types between arms");
661-
false
662-
}
663-
}
664-
},
622+
val(ref v) => compare_const_vals(&e_v, v) == 0,
665623
range(ref c_lo, ref c_hi) => {
666-
let m1 = compare_const_vals(c_lo, &e_v),
667-
m2 = compare_const_vals(c_hi, &e_v);
668-
match (m1, m2) {
669-
(Some(val1), Some(val2)) => (val1 >= 0 && val2 <= 0),
670-
_ => {
671-
cx.tcx.sess.span_err(pat_span,
672-
"mismatched types between ranges");
673-
false
674-
}
675-
}
624+
compare_const_vals(c_lo, &e_v) >= 0 &&
625+
compare_const_vals(c_hi, &e_v) <= 0
676626
}
677627
single => true,
678628
_ => fail!("type error")
@@ -688,22 +638,11 @@ pub fn specialize(cx: @MatchCheckCtxt,
688638
_ => fail!("type error")
689639
};
690640
let v_lo = eval_const_expr(cx.tcx, lo),
691-
v_hi = eval_const_expr(cx.tcx, hi);
692-
693-
let m1 = compare_const_vals(&c_lo, &v_lo),
694-
m2 = compare_const_vals(&c_hi, &v_hi);
695-
match (m1, m2) {
696-
(Some(val1), Some(val2)) if val1 >= 0 && val2 <= 0 => {
697-
Some(vec::to_owned(r.tail()))
698-
},
699-
(Some(_), Some(_)) => None,
700-
_ => {
701-
cx.tcx.sess.span_err(pat_span,
702-
"mismatched types between ranges");
703-
None
704-
}
705-
}
706-
}
641+
v_hi = eval_const_expr(cx.tcx, hi);
642+
let match_ = compare_const_vals(&c_lo, &v_lo) >= 0 &&
643+
compare_const_vals(&c_hi, &v_hi) <= 0;
644+
if match_ { Some(vec::to_owned(r.tail())) } else { None }
645+
}
707646
pat_vec(before, slice, after) => {
708647
match *ctor_id {
709648
vec(_) => {

branches/auto/src/librustc/middle/const_eval.rs

Lines changed: 23 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -420,73 +420,65 @@ pub fn lit_to_const(lit: @lit) -> const_val {
420420
}
421421
}
422422

423-
pub fn compare_const_vals(a: &const_val, b: &const_val) -> Option<int> {
423+
pub fn compare_const_vals(a: &const_val, b: &const_val) -> int {
424424
match (a, b) {
425425
(&const_int(a), &const_int(b)) => {
426426
if a == b {
427-
Some(0)
427+
0
428428
} else if a < b {
429-
Some(-1)
429+
-1
430430
} else {
431-
Some(1)
431+
1
432432
}
433433
}
434434
(&const_uint(a), &const_uint(b)) => {
435435
if a == b {
436-
Some(0)
436+
0
437437
} else if a < b {
438-
Some(-1)
438+
-1
439439
} else {
440-
Some(1)
440+
1
441441
}
442442
}
443443
(&const_float(a), &const_float(b)) => {
444444
if a == b {
445-
Some(0)
445+
0
446446
} else if a < b {
447-
Some(-1)
447+
-1
448448
} else {
449-
Some(1)
449+
1
450450
}
451451
}
452452
(&const_str(ref a), &const_str(ref b)) => {
453453
if (*a) == (*b) {
454-
Some(0)
454+
0
455455
} else if (*a) < (*b) {
456-
Some(-1)
456+
-1
457457
} else {
458-
Some(1)
458+
1
459459
}
460460
}
461461
(&const_bool(a), &const_bool(b)) => {
462462
if a == b {
463-
Some(0)
463+
0
464464
} else if a < b {
465-
Some(-1)
465+
-1
466466
} else {
467-
Some(1)
467+
1
468468
}
469469
}
470-
_ => {
471-
None
472-
}
470+
_ => fail!("compare_const_vals: ill-typed comparison")
473471
}
474472
}
475473

476-
pub fn compare_lit_exprs(tcx: middle::ty::ctxt, a: @expr, b: @expr) -> Option<int> {
477-
compare_const_vals(&eval_const_expr(tcx, a), &eval_const_expr(tcx, b))
474+
pub fn compare_lit_exprs(tcx: middle::ty::ctxt, a: @expr, b: @expr) -> int {
475+
compare_const_vals(&eval_const_expr(tcx, a), &eval_const_expr(tcx, b))
478476
}
479477

480-
pub fn lit_expr_eq(tcx: middle::ty::ctxt, a: @expr, b: @expr) -> Option<bool> {
481-
match compare_lit_exprs(tcx, a, b) {
482-
Some(val) => Some(val == 0),
483-
None => None,
484-
}
478+
pub fn lit_expr_eq(tcx: middle::ty::ctxt, a: @expr, b: @expr) -> bool {
479+
compare_lit_exprs(tcx, a, b) == 0
485480
}
486481

487-
pub fn lit_eq(a: @lit, b: @lit) -> Option<bool> {
488-
match compare_const_vals(&lit_to_const(a), &lit_to_const(b)) {
489-
Some(val) => Some(val == 0),
490-
None => None,
491-
}
482+
pub fn lit_eq(a: @lit, b: @lit) -> bool {
483+
compare_const_vals(&lit_to_const(a), &lit_to_const(b)) == 0
492484
}

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

Lines changed: 35 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -193,55 +193,48 @@ pub enum Opt {
193193

194194
pub fn opt_eq(tcx: ty::ctxt, a: &Opt, b: &Opt) -> bool {
195195
match (a, b) {
196-
(&lit(a), &lit(b)) => {
197-
match (a, b) {
198-
(UnitLikeStructLit(a), UnitLikeStructLit(b)) => a == b,
199-
_ => {
200-
let a_expr;
201-
match a {
202-
ExprLit(existing_a_expr) => a_expr = existing_a_expr,
203-
ConstLit(a_const) => {
204-
let e = const_eval::lookup_const_by_id(tcx, a_const);
205-
a_expr = e.get();
206-
}
207-
UnitLikeStructLit(_) => {
208-
fail!("UnitLikeStructLit should have been handled \
209-
above")
210-
}
196+
(&lit(a), &lit(b)) => {
197+
match (a, b) {
198+
(UnitLikeStructLit(a), UnitLikeStructLit(b)) => a == b,
199+
_ => {
200+
let a_expr;
201+
match a {
202+
ExprLit(existing_a_expr) => a_expr = existing_a_expr,
203+
ConstLit(a_const) => {
204+
let e = const_eval::lookup_const_by_id(tcx, a_const);
205+
a_expr = e.get();
211206
}
212-
213-
let b_expr;
214-
match b {
215-
ExprLit(existing_b_expr) => b_expr = existing_b_expr,
216-
ConstLit(b_const) => {
217-
let e = const_eval::lookup_const_by_id(tcx, b_const);
218-
b_expr = e.get();
219-
}
220-
UnitLikeStructLit(_) => {
221-
fail!("UnitLikeStructLit should have been handled \
222-
above")
223-
}
207+
UnitLikeStructLit(_) => {
208+
fail!("UnitLikeStructLit should have been handled \
209+
above")
224210
}
211+
}
225212

226-
match const_eval::compare_lit_exprs(tcx, a_expr, b_expr) {
227-
Some(val1) => val1 == 0,
228-
None => fail!("compare_list_exprs: type mismatch"),
213+
let b_expr;
214+
match b {
215+
ExprLit(existing_b_expr) => b_expr = existing_b_expr,
216+
ConstLit(b_const) => {
217+
let e = const_eval::lookup_const_by_id(tcx, b_const);
218+
b_expr = e.get();
219+
}
220+
UnitLikeStructLit(_) => {
221+
fail!("UnitLikeStructLit should have been handled \
222+
above")
229223
}
230224
}
225+
226+
const_eval::compare_lit_exprs(tcx, a_expr, b_expr) == 0
231227
}
232228
}
233-
(&range(a1, a2), &range(b1, b2)) => {
234-
let m1 = const_eval::compare_lit_exprs(tcx, a1, b1);
235-
let m2 = const_eval::compare_lit_exprs(tcx, a2, b2);
236-
match (m1, m2) {
237-
(Some(val1), Some(val2)) => (val1 == 0 && val2 == 0),
238-
_ => fail!("compare_list_exprs: type mismatch"),
239-
}
240-
}
241-
(&var(a, _), &var(b, _)) => a == b,
242-
(&vec_len_eq(a), &vec_len_eq(b)) => a == b,
243-
(&vec_len_ge(a, _), &vec_len_ge(b, _)) => a == b,
244-
_ => false
229+
}
230+
(&range(a1, a2), &range(b1, b2)) => {
231+
const_eval::compare_lit_exprs(tcx, a1, b1) == 0 &&
232+
const_eval::compare_lit_exprs(tcx, a2, b2) == 0
233+
}
234+
(&var(a, _), &var(b, _)) => a == b,
235+
(&vec_len_eq(a), &vec_len_eq(b)) => a == b,
236+
(&vec_len_ge(a, _), &vec_len_ge(b, _)) => a == b,
237+
_ => false
245238
}
246239
}
247240

branches/auto/src/librustc/middle/typeck/check/_match.rs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -408,18 +408,8 @@ pub fn check_pat(pcx: &pat_ctxt, pat: @ast::pat, expected: ty::t) {
408408
// no-op
409409
} else if !ty::type_is_numeric(b_ty) {
410410
tcx.sess.span_err(pat.span, "non-numeric type used in range");
411-
} else {
412-
match valid_range_bounds(fcx.ccx, begin, end) {
413-
Some(false) => {
414-
tcx.sess.span_err(begin.span,
415-
"lower range bound must be less than upper");
416-
},
417-
None => {
418-
tcx.sess.span_err(begin.span,
419-
"mismatched types in range");
420-
},
421-
_ => { },
422-
}
411+
} else if !valid_range_bounds(fcx.ccx, begin, end) {
412+
tcx.sess.span_err(begin.span, "lower range bound must be less than upper");
423413
}
424414
fcx.write_ty(pat.id, b_ty);
425415
}

branches/auto/src/librustc/middle/typeck/check/mod.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -1044,11 +1044,8 @@ pub fn check_lit(fcx: @mut FnCtxt, lit: @ast::lit) -> ty::t {
10441044
pub fn valid_range_bounds(ccx: @mut CrateCtxt,
10451045
from: @ast::expr,
10461046
to: @ast::expr)
1047-
-> Option<bool> {
1048-
match const_eval::compare_lit_exprs(ccx.tcx, from, to) {
1049-
Some(val) => Some(val <= 0),
1050-
None => None
1051-
}
1047+
-> bool {
1048+
const_eval::compare_lit_exprs(ccx.tcx, from, to) <= 0
10521049
}
10531050

10541051
pub fn check_expr_has_type(

branches/auto/src/rt/arch/arm/context.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ void context::call(void *f, void *arg, void *stack)
2626

2727
// set up the stack
2828
uint32_t *sp = ( uint32_t *)stack;
29-
//sp = align_down(sp);
29+
sp = align_down(sp);
3030
// The final return address. 0 indicates the bottom of the stack
31-
*--sp = 0;
31+
// sp of arm eabi is 8-byte aligned
32+
sp -= 2;
33+
*sp = 0;
3234

3335
regs.data[0] = ( uint32_t )arg; // r0
3436
regs.data[13] = ( uint32_t )sp; //#52 sp, r13

0 commit comments

Comments
 (0)