mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-20 02:43:45 +00:00
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:
commit
88dd53a754
@ -97,7 +97,7 @@ get_max_stk_size() {
|
||||
return strtol(maxsz, NULL, 0);
|
||||
}
|
||||
else {
|
||||
return 1024*1024*8;
|
||||
return 1024*1024*1024;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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 );
|
||||
}
|
@ -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)
|
||||
}
|
@ -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)
|
||||
}
|
@ -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();
|
||||
}
|
Loading…
Reference in New Issue
Block a user