Skip to content

Commit 20b78ea

Browse files
committed
---
yaml --- r: 118647 b: refs/heads/try c: be9c2d1 h: refs/heads/master i: 118645: 6f5651b 118643: 35aa0a4 118639: 18a20b7 v: v3
1 parent 7850df5 commit 20b78ea

File tree

5 files changed

+48
-25
lines changed

5 files changed

+48
-25
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: b1646cbfd908dc948b251e362669af421100647a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: d6736a1440d42f6af967a8a20ab8d73522112b72
5-
refs/heads/try: 78cb2f5bc0244edeb0f7f042c81f16931c437d27
5+
refs/heads/try: be9c2d13815eb9aa1b6213a46542aa4262127643
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libgreen/stack.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ fn protect_last_page(stack: &MemoryMap) -> bool {
9696
// This may seem backwards: the start of the segment is the last page?
9797
// Yes! The stack grows from higher addresses (the end of the allocated
9898
// block) to lower addresses (the start of the allocated block).
99-
let last_page = stack.data as *mut libc::c_void;
99+
let last_page = stack.data as *libc::c_void;
100100
libc::mprotect(last_page, page_size() as libc::size_t,
101101
libc::PROT_NONE) != -1
102102
}

branches/try/src/liblibc/lib.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2057,7 +2057,7 @@ pub mod consts {
20572057
pub static MAP_FIXED : c_int = 0x0010;
20582058
pub static MAP_ANON : c_int = 0x0020;
20592059

2060-
pub static MAP_FAILED : *mut c_void = -1 as *mut c_void;
2060+
pub static MAP_FAILED : *c_void = -1 as *c_void;
20612061

20622062
pub static MCL_CURRENT : c_int = 0x0001;
20632063
pub static MCL_FUTURE : c_int = 0x0002;
@@ -2268,7 +2268,7 @@ pub mod consts {
22682268
pub static MAP_FIXED : c_int = 0x0010;
22692269
pub static MAP_ANON : c_int = 0x0800;
22702270

2271-
pub static MAP_FAILED : *mut c_void = -1 as *mut c_void;
2271+
pub static MAP_FAILED : *c_void = -1 as *c_void;
22722272

22732273
pub static MCL_CURRENT : c_int = 0x0001;
22742274
pub static MCL_FUTURE : c_int = 0x0002;
@@ -2804,7 +2804,7 @@ pub mod consts {
28042804
pub static MAP_FIXED : c_int = 0x0010;
28052805
pub static MAP_ANON : c_int = 0x1000;
28062806

2807-
pub static MAP_FAILED : *mut c_void = -1 as *mut c_void;
2807+
pub static MAP_FAILED : *c_void = -1 as *c_void;
28082808

28092809
pub static MCL_CURRENT : c_int = 0x0001;
28102810
pub static MCL_FUTURE : c_int = 0x0002;
@@ -3192,7 +3192,7 @@ pub mod consts {
31923192
pub static MAP_FIXED : c_int = 0x0010;
31933193
pub static MAP_ANON : c_int = 0x1000;
31943194

3195-
pub static MAP_FAILED : *mut c_void = -1 as *mut c_void;
3195+
pub static MAP_FAILED : *c_void = -1 as *c_void;
31963196

31973197
pub static MCL_CURRENT : c_int = 0x0001;
31983198
pub static MCL_FUTURE : c_int = 0x0002;
@@ -3951,19 +3951,19 @@ pub mod funcs {
39513951
pub fn mlockall(flags: c_int) -> c_int;
39523952
pub fn munlockall() -> c_int;
39533953

3954-
pub fn mmap(addr: *mut c_void,
3954+
pub fn mmap(addr: *c_void,
39553955
len: size_t,
39563956
prot: c_int,
39573957
flags: c_int,
39583958
fd: c_int,
39593959
offset: off_t)
39603960
-> *mut c_void;
3961-
pub fn munmap(addr: *mut c_void, len: size_t) -> c_int;
3961+
pub fn munmap(addr: *c_void, len: size_t) -> c_int;
39623962

3963-
pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int)
3963+
pub fn mprotect(addr: *c_void, len: size_t, prot: c_int)
39643964
-> c_int;
39653965

3966-
pub fn msync(addr: *mut c_void, len: size_t, flags: c_int)
3966+
pub fn msync(addr: *c_void, len: size_t, flags: c_int)
39673967
-> c_int;
39683968
pub fn shm_open(name: *c_char, oflag: c_int, mode: mode_t)
39693969
-> c_int;
@@ -4208,9 +4208,9 @@ pub mod funcs {
42084208

42094209
extern {
42104210
pub fn getdtablesize() -> c_int;
4211-
pub fn madvise(addr: *mut c_void, len: size_t, advice: c_int)
4211+
pub fn madvise(addr: *c_void, len: size_t, advice: c_int)
42124212
-> c_int;
4213-
pub fn mincore(addr: *mut c_void, len: size_t, vec: *mut c_uchar)
4213+
pub fn mincore(addr: *c_void, len: size_t, vec: *c_uchar)
42144214
-> c_int;
42154215
}
42164216
}

branches/try/src/librustc/middle/cfg/construct.rs

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ impl<'a> CFGBuilder<'a> {
254254
});
255255
let body_exit = self.block(&**body, cond_exit); // 4
256256
self.add_contained_edge(body_exit, loopback); // 5
257+
self.loop_scopes.pop();
257258
expr_exit
258259
}
259260

@@ -427,8 +428,22 @@ impl<'a> CFGBuilder<'a> {
427428
self.straightline(expr, pred, [e])
428429
}
429430

431+
ast::ExprInlineAsm(ref inline_asm) => {
432+
let inputs = inline_asm.inputs.iter();
433+
let outputs = inline_asm.outputs.iter();
434+
fn extract_expr<A>(&(_, expr): &(A, Gc<ast::Expr>)) -> Gc<ast::Expr> { expr }
435+
let post_inputs = self.exprs(inputs.map(|a| {
436+
debug!("cfg::construct InlineAsm id:{} input:{:?}", expr.id, a);
437+
extract_expr(a)
438+
}), pred);
439+
let post_outputs = self.exprs(outputs.map(|a| {
440+
debug!("cfg::construct InlineAsm id:{} output:{:?}", expr.id, a);
441+
extract_expr(a)
442+
}), post_inputs);
443+
self.add_node(expr.id, [post_outputs])
444+
}
445+
430446
ast::ExprMac(..) |
431-
ast::ExprInlineAsm(..) |
432447
ast::ExprFnBlock(..) |
433448
ast::ExprProc(..) |
434449
ast::ExprLit(..) |
@@ -444,15 +459,22 @@ impl<'a> CFGBuilder<'a> {
444459
func_or_rcvr: Gc<ast::Expr>,
445460
args: &[Gc<ast::Expr>]) -> CFGIndex {
446461
let func_or_rcvr_exit = self.expr(func_or_rcvr, pred);
447-
self.straightline(call_expr, func_or_rcvr_exit, args)
462+
let ret = self.straightline(call_expr, func_or_rcvr_exit, args);
463+
464+
let return_ty = ty::node_id_to_type(self.tcx, call_expr.id);
465+
let fails = ty::type_is_bot(return_ty);
466+
if fails {
467+
self.add_node(ast::DUMMY_NODE_ID, [])
468+
} else {
469+
ret
470+
}
448471
}
449472

450-
fn exprs(&mut self,
451-
exprs: &[Gc<ast::Expr>],
452-
pred: CFGIndex) -> CFGIndex {
473+
fn exprs<I:Iterator<Gc<ast::Expr>>>(&mut self,
474+
mut exprs: I,
475+
pred: CFGIndex) -> CFGIndex {
453476
//! Constructs graph for `exprs` evaluated in order
454-
455-
exprs.iter().fold(pred, |p, &e| self.expr(e, p))
477+
exprs.fold(pred, |p, e| self.expr(e, p))
456478
}
457479

458480
fn opt_expr(&mut self,
@@ -469,7 +491,7 @@ impl<'a> CFGBuilder<'a> {
469491
subexprs: &[Gc<ast::Expr>]) -> CFGIndex {
470492
//! Handles case of an expression that evaluates `subexprs` in order
471493
472-
let subexprs_exit = self.exprs(subexprs, pred);
494+
let subexprs_exit = self.exprs(subexprs.iter().map(|&e|e), pred);
473495
self.add_node(expr.id, [subexprs_exit])
474496
}
475497

branches/try/src/libstd/os.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,6 +1338,7 @@ impl MemoryMap {
13381338
/// `ErrZeroLength`.
13391339
pub fn new(min_len: uint, options: &[MapOption]) -> Result<MemoryMap, MapError> {
13401340
use libc::off_t;
1341+
use cmp::Equiv;
13411342

13421343
if min_len == 0 {
13431344
return Err(ErrZeroLength)
@@ -1370,10 +1371,10 @@ impl MemoryMap {
13701371
if fd == -1 && !custom_flags { flags |= libc::MAP_ANON; }
13711372

13721373
let r = unsafe {
1373-
libc::mmap(addr as *mut c_void, len as libc::size_t, prot, flags,
1374-
fd, offset)
1374+
libc::mmap(addr as *c_void, len as libc::size_t, prot, flags, fd,
1375+
offset)
13751376
};
1376-
if r == libc::MAP_FAILED {
1377+
if r.equiv(&libc::MAP_FAILED) {
13771378
Err(match errno() as c_int {
13781379
libc::EACCES => ErrFdNotAvail,
13791380
libc::EBADF => ErrInvalidFd,
@@ -1409,8 +1410,8 @@ impl Drop for MemoryMap {
14091410
if self.len == 0 { /* workaround for dummy_stack */ return; }
14101411

14111412
unsafe {
1412-
// `munmap` only fails due to logic errors
1413-
libc::munmap(self.data as *mut c_void, self.len as libc::size_t);
1413+
// FIXME: what to do if this fails?
1414+
let _ = libc::munmap(self.data as *c_void, self.len as libc::size_t);
14141415
}
14151416
}
14161417
}

0 commit comments

Comments
 (0)