auto merge of #6081 : brson/rust/out-of-stack, r=thestinger

People hit the recursion depth limit too often, it's not possible
to unwind reliably from out-of-stack.

Issues #3555, #3695
This commit is contained in:
bors 2013-04-27 16:24:34 -07:00
commit 88dd53a754
6 changed files with 3 additions and 86 deletions

View File

@ -97,7 +97,7 @@ get_max_stk_size() {
return strtol(maxsz, NULL, 0);
}
else {
return 1024*1024*8;
return 1024*1024*1024;
}
}

View File

@ -530,11 +530,11 @@ rust_task::new_stack(size_t requested_sz) {
// arbitrarily selected as 2x the maximum stack size.
if (!unwinding && used_stack > max_stack) {
LOG_ERR(this, task, "task %" PRIxPTR " ran out of stack", this);
fail();
abort();
} else if (unwinding && used_stack > max_stack * 2) {
LOG_ERR(this, task,
"task %" PRIxPTR " ran out of stack during unwinding", this);
fail();
abort();
}
size_t sz = rust_stk_sz + RED_ZONE_SIZE;

View File

@ -1,19 +0,0 @@
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:ran out of stack
// Don't leak when the landing pads need to request more stack
// than is allowed during normal execution
fn useBlock(f: ~fn() -> uint) { useBlock(|| 22u ) }
fn main() {
useBlock(|| 22u );
}

View File

@ -1,25 +0,0 @@
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// xfail-test iloops with optimizations on
// NB: Not sure why this works. I expect the box argument to leak when
// we run out of stack. Maybe the box annihilator works it out?
// error-pattern:ran out of stack
fn main() {
eat(@0);
}
fn eat(
+a: @int
) {
eat(a)
}

View File

@ -1,21 +0,0 @@
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// xfail-test
// error-pattern:ran out of stack
fn main() {
eat(~0);
}
fn eat(
+a: ~int
) {
eat(a)
}

View File

@ -1,18 +0,0 @@
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:ran out of stack
// Test that the task fails after hiting the recursion limit
fn main() {
debug!(~"don't optimize me out");
main();
}