about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2013-04-26 15:36:19 -0700
committerBrian Anderson <banderson@mozilla.com>2013-04-26 15:39:54 -0700
commit149047e55d8eace3ea9d005905577f17b25c54e2 (patch)
treebfbb6e340da8d530646f2fd4940c22ff14d38614
parent64412eca10399d64d25346d5f8220c1b1f88cd29 (diff)
downloadrust-149047e55d8eace3ea9d005905577f17b25c54e2.tar.gz
rust-149047e55d8eace3ea9d005905577f17b25c54e2.zip
rt: Set the stack depth limit to 1GB. Abort on error.
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.cpp2
-rw-r--r--src/rt/rust_task.cpp4
-rw-r--r--src/test/run-fail/issue-2144.rs19
-rw-r--r--src/test/run-fail/out-of-stack-managed-box.rs25
-rw-r--r--src/test/run-fail/out-of-stack-owned-box.rs21
-rw-r--r--src/test/run-fail/too-much-recursion.rs18
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();
-}