Skip to content

Commit 0f327e6

Browse files
author
Jakub Bukaj
committed
---
yaml --- r: 156537 b: refs/heads/master c: 3e9ce5a h: refs/heads/master i: 156535: 8b20224 v: v3
1 parent 20e73a9 commit 0f327e6

File tree

22 files changed

+50
-803
lines changed

22 files changed

+50
-803
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 172b59abe510dde5826fec24377f208a19418c04
2+
refs/heads/master: 3e9ce5afb776bf5a187cafa8cfe5ad677bfd3acc
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: d44ea720fa9dfe062ef06d0eb49a58d4e7e92344
55
refs/heads/try: 6601b0501e31d08d3892a2d5a7d8a57ab120bf75

trunk/src/libcore/intrinsics.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -260,17 +260,6 @@ extern "rust-intrinsic" {
260260
/// NB: This is very different from the `unreachable!()` macro!
261261
pub fn unreachable() -> !;
262262

263-
/// Inform the optimizer that a condition is always true.
264-
/// If the condition is false, the behavior is undefined.
265-
///
266-
/// No code is generated for this intrinsic, but the optimizer will try
267-
/// to preserve it (and its condition) between passes, which may interfere
268-
/// with optimization of surrounding code and reduce performance. It should
269-
/// not be used if the invariant can be discovered by the optimizer on its
270-
/// own, or if it does not enable any significant optimizations.
271-
#[cfg(not(stage0))]
272-
pub fn assume(b: bool);
273-
274263
/// Execute a breakpoint trap, for inspection by a debugger.
275264
pub fn breakpoint();
276265

trunk/src/libgreen/simple.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ impl Runtime for SimpleTask {
8181
}
8282
fn local_io<'a>(&'a mut self) -> Option<rtio::LocalIo<'a>> { None }
8383
fn stack_bounds(&self) -> (uint, uint) { fail!() }
84-
fn stack_guard(&self) -> Option<uint> { fail!() }
8584
fn can_block(&self) -> bool { true }
8685
fn wrap(self: Box<SimpleTask>) -> Box<Any+'static> { fail!() }
8786
}

trunk/src/libgreen/stack.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,6 @@ impl Stack {
8282
}
8383
}
8484

85-
/// Point to the last writable byte of the stack
86-
pub fn guard(&self) -> *const uint {
87-
(self.start() as uint + page_size()) as *const uint
88-
}
89-
9085
/// Point to the low end of the allocated stack
9186
pub fn start(&self) -> *const uint {
9287
self.buf.as_ref().map(|m| m.data() as *const uint)

trunk/src/libgreen/task.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -486,13 +486,6 @@ impl Runtime for GreenTask {
486486
c.current_stack_segment.end() as uint)
487487
}
488488

489-
fn stack_guard(&self) -> Option<uint> {
490-
let c = self.coroutine.as_ref()
491-
.expect("GreenTask.stack_guard called without a coroutine");
492-
493-
Some(c.current_stack_segment.guard() as uint)
494-
}
495-
496489
fn can_block(&self) -> bool { false }
497490

498491
fn wrap(self: Box<GreenTask>) -> Box<Any+'static> {

trunk/src/libnative/io/c_unix.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,16 @@ mod signal {
252252
pub status: libc::c_int,
253253
}
254254

255+
#[cfg(any(target_os = "macos", target_os = "ios"))]
256+
#[repr(C)]
257+
pub struct sigaction {
258+
pub sa_handler: extern fn(libc::c_int),
259+
sa_tramp: *mut libc::c_void,
260+
pub sa_mask: sigset_t,
261+
pub sa_flags: libc::c_int,
262+
}
263+
264+
#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
255265
#[repr(C)]
256266
pub struct sigaction {
257267
pub sa_handler: extern fn(libc::c_int),

trunk/src/libnative/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,7 @@ pub fn start(argc: int, argv: *const *const u8, main: proc()) -> int {
132132
rt::init(argc, argv);
133133
let mut exit_code = None;
134134
let mut main = Some(main);
135-
let mut task = task::new((my_stack_bottom, my_stack_top),
136-
rt::thread::main_guard_page());
135+
let mut task = task::new((my_stack_bottom, my_stack_top));
137136
task.name = Some(str::Slice("<main>"));
138137
drop(task.run(|| {
139138
unsafe {

trunk/src/libnative/task.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,10 @@ use io;
2929
use std::task::{TaskBuilder, Spawner};
3030

3131
/// Creates a new Task which is ready to execute as a 1:1 task.
32-
pub fn new(stack_bounds: (uint, uint), stack_guard: uint) -> Box<Task> {
32+
pub fn new(stack_bounds: (uint, uint)) -> Box<Task> {
3333
let mut task = box Task::new();
3434
let mut ops = ops();
3535
ops.stack_bounds = stack_bounds;
36-
ops.stack_guard = stack_guard;
3736
task.put_runtime(ops);
3837
return task;
3938
}
@@ -45,7 +44,6 @@ fn ops() -> Box<Ops> {
4544
io: io::IoFactory::new(),
4645
// these *should* get overwritten
4746
stack_bounds: (0, 0),
48-
stack_guard: 0
4947
}
5048
}
5149

@@ -84,7 +82,6 @@ impl Spawner for NativeSpawner {
8482
my_stack);
8583
}
8684
let mut ops = ops;
87-
ops.stack_guard = rt::thread::current_guard_page();
8885
ops.stack_bounds = (my_stack - stack + 1024, my_stack);
8986

9087
let mut f = Some(f);
@@ -118,8 +115,6 @@ struct Ops {
118115
// native tasks necessarily know their precise bounds, hence this is
119116
// optional.
120117
stack_bounds: (uint, uint),
121-
122-
stack_guard: uint
123118
}
124119

125120
impl rt::Runtime for Ops {
@@ -143,14 +138,6 @@ impl rt::Runtime for Ops {
143138

144139
fn stack_bounds(&self) -> (uint, uint) { self.stack_bounds }
145140

146-
fn stack_guard(&self) -> Option<uint> {
147-
if self.stack_guard != 0 {
148-
Some(self.stack_guard)
149-
} else {
150-
None
151-
}
152-
}
153-
154141
fn can_block(&self) -> bool { true }
155142

156143
// This function gets a little interesting. There are a few safety and

trunk/src/librustc/middle/resolve.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5077,7 +5077,6 @@ impl<'a> Resolver<'a> {
50775077
PatEnum(ref path, _) => {
50785078
// This must be an enum variant, struct or const.
50795079
match self.resolve_path(pat_id, path, ValueNS, false) {
5080-
Some(def @ (DefFn(..), _)) |
50815080
Some(def @ (DefVariant(..), _)) |
50825081
Some(def @ (DefStruct(..), _)) |
50835082
Some(def @ (DefConst(..), _)) => {

trunk/src/librustc/middle/trans/context.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,6 @@ fn declare_intrinsic(ccx: &CrateContext, key: & &'static str) -> Option<ValueRef
860860
ifn!("llvm.lifetime.end" fn(t_i64, i8p) -> void);
861861

862862
ifn!("llvm.expect.i1" fn(i1, i1) -> i1);
863-
ifn!("llvm.assume" fn(i1) -> void);
864863

865864
// Some intrinsics were introduced in later versions of LLVM, but they have
866865
// fallbacks in libc or libm and such. Currently, all of these intrinsics

trunk/src/librustc/middle/trans/intrinsic.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ pub fn get_simple_intrinsic(ccx: &CrateContext, item: &ast::ForeignItem) -> Opti
8181
"bswap16" => "llvm.bswap.i16",
8282
"bswap32" => "llvm.bswap.i32",
8383
"bswap64" => "llvm.bswap.i64",
84-
"assume" => "llvm.assume",
8584
_ => return None
8685
};
8786
Some(ccx.get_intrinsic(&name))

trunk/src/librustc/middle/typeck/check/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5703,8 +5703,6 @@ pub fn check_intrinsic_type(ccx: &CrateCtxt, it: &ast::ForeignItem) {
57035703

57045704
"return_address" => (0, vec![], ty::mk_imm_ptr(tcx, ty::mk_u8())),
57055705

5706-
"assume" => (0, vec![ty::mk_bool()], ty::mk_nil()),
5707-
57085706
ref other => {
57095707
span_err!(tcx.sess, it.span, E0093,
57105708
"unrecognized intrinsic function: `{}`", *other);

trunk/src/librustrt/lib.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ mod local_ptr;
5151
mod thread_local_storage;
5252
mod util;
5353
mod libunwind;
54-
mod stack_overflow;
5554

5655
pub mod args;
5756
pub mod bookkeeping;
@@ -93,8 +92,6 @@ pub trait Runtime {
9392
fn local_io<'a>(&'a mut self) -> Option<rtio::LocalIo<'a>>;
9493
/// The (low, high) edges of the current stack.
9594
fn stack_bounds(&self) -> (uint, uint); // (lo, hi)
96-
/// The last writable byte of the stack next to the guard page
97-
fn stack_guard(&self) -> Option<uint>;
9895
fn can_block(&self) -> bool;
9996

10097
// FIXME: This is a serious code smell and this should not exist at all.
@@ -116,7 +113,6 @@ pub fn init(argc: int, argv: *const *const u8) {
116113
args::init(argc, argv);
117114
local_ptr::init();
118115
at_exit_imp::init();
119-
thread::init();
120116
}
121117

122118
// FIXME(#14344) this shouldn't be necessary
@@ -155,7 +151,6 @@ pub unsafe fn cleanup() {
155151
bookkeeping::wait_for_other_tasks();
156152
at_exit_imp::run();
157153
args::cleanup();
158-
thread::cleanup();
159154
local_ptr::cleanup();
160155
}
161156

trunk/src/librustrt/stack.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ pub const RED_ZONE: uint = 20 * 1024;
5555
#[cfg(not(test))] // in testing, use the original libstd's version
5656
#[lang = "stack_exhausted"]
5757
extern fn stack_exhausted() {
58+
use core::prelude::*;
59+
use alloc::boxed::Box;
60+
use local::Local;
61+
use task::Task;
5862
use core::intrinsics;
5963

6064
unsafe {
@@ -100,7 +104,21 @@ extern fn stack_exhausted() {
100104
// #9854 - unwinding on windows through __morestack has never worked
101105
// #2361 - possible implementation of not using landing pads
102106

103-
::stack_overflow::report();
107+
let task: Option<Box<Task>> = Local::try_take();
108+
let name = match task {
109+
Some(ref task) => {
110+
task.name.as_ref().map(|n| n.as_slice())
111+
}
112+
None => None
113+
};
114+
let name = name.unwrap_or("<unknown>");
115+
116+
// See the message below for why this is not emitted to the
117+
// task's logger. This has the additional conundrum of the
118+
// logger may not be initialized just yet, meaning that an FFI
119+
// call would happen to initialized it (calling out to libuv),
120+
// and the FFI call needs 2MB of stack when we just ran out.
121+
rterrln!("task '{}' has overflowed its stack", name);
104122

105123
intrinsics::abort();
106124
}

0 commit comments

Comments
 (0)