diff options
| author | bors <bors@rust-lang.org> | 2013-04-27 16:24:34 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-04-27 16:24:34 -0700 |
| commit | 88dd53a75441d25a060fb7dc7131ea3772383562 (patch) | |
| tree | e547dfa01cda27dcef11ba9af5e40c61fa0aa3f0 | |
| parent | 9f118865a207cb4a64aa3dac81ae74ba1f7bba69 (diff) | |
| parent | 149047e55d8eace3ea9d005905577f17b25c54e2 (diff) | |
| download | rust-88dd53a75441d25a060fb7dc7131ea3772383562.tar.gz rust-88dd53a75441d25a060fb7dc7131ea3772383562.zip | |
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
| -rw-r--r-- | src/rt/rust_env.cpp | 2 | ||||
| -rw-r--r-- | src/rt/rust_task.cpp | 4 | ||||
| -rw-r--r-- | src/test/run-fail/issue-2144.rs | 19 | ||||
| -rw-r--r-- | src/test/run-fail/out-of-stack-managed-box.rs | 25 | ||||
| -rw-r--r-- | src/test/run-fail/out-of-stack-owned-box.rs | 21 | ||||
| -rw-r--r-- | src/test/run-fail/too-much-recursion.rs | 18 |
6 files changed, 3 insertions, 86 deletions
diff --git a/src/rt/rust_env.cpp b/src/rt/rust_env.cpp index cade5f1ed2c..041b4efac52 100644 --- a/src/rt/rust_env.cpp +++ b/src/rt/rust_env.cpp @@ -97,7 +97,7 @@ get_max_stk_size() { return strtol(maxsz, NULL, 0); } else { - return 1024*1024*8; + return 1024*1024*1024; } } diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index 7e146cce68e..e6293aa5c1d 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -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; diff --git a/src/test/run-fail/issue-2144.rs b/src/test/run-fail/issue-2144.rs deleted file mode 100644 index 56b7acc7f0f..00000000000 --- a/src/test/run-fail/issue-2144.rs +++ /dev/null @@ -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 ); -} diff --git a/src/test/run-fail/out-of-stack-managed-box.rs b/src/test/run-fail/out-of-stack-managed-box.rs deleted file mode 100644 index 9dcdaacb3c1..00000000000 --- a/src/test/run-fail/out-of-stack-managed-box.rs +++ /dev/null @@ -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) -} diff --git a/src/test/run-fail/out-of-stack-owned-box.rs b/src/test/run-fail/out-of-stack-owned-box.rs deleted file mode 100644 index d4bc70f43ef..00000000000 --- a/src/test/run-fail/out-of-stack-owned-box.rs +++ /dev/null @@ -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) -} diff --git a/src/test/run-fail/too-much-recursion.rs b/src/test/run-fail/too-much-recursion.rs deleted file mode 100644 index 04514b13455..00000000000 --- a/src/test/run-fail/too-much-recursion.rs +++ /dev/null @@ -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(); -} |
