From fa13fd9d64c3ed60a65e5897467b2d3742aa933f Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Sun, 29 Jan 2012 21:26:21 -0800 Subject: [PATCH] rt: Remove set_min_stack --- src/rt/rust_builtin.cpp | 7 ------- src/rt/rust_task.cpp | 14 +------------- src/rt/rustrt.def.in | 1 - src/test/run-fail/morestack4.rs | 5 ----- src/test/run-pass/morestack5.rs | 5 ----- src/test/run-pass/morestack6.rs | 2 -- 6 files changed, 1 insertion(+), 33 deletions(-) diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index 4bf51da214b..89d8c6d12f2 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -445,13 +445,6 @@ migrate_alloc(void *alloc, rust_task_id tid) { } } -// defined in rust_task.cpp -extern size_t g_custom_min_stack_size; -extern "C" CDECL void -set_min_stack(uintptr_t stack_size) { - g_custom_min_stack_size = stack_size; -} - extern "C" CDECL int sched_threads() { rust_task *task = rust_scheduler::get_task(); diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index d6f43ca0794..1bf62e42f01 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -65,18 +65,6 @@ const uint8_t stack_canary[] = {0xAB, 0xCD, 0xAB, 0xCD, 0xAB, 0xCD, 0xAB, 0xCD, 0xAB, 0xCD, 0xAB, 0xCD}; -// Stack size -size_t g_custom_min_stack_size = 0; - -static size_t -get_min_stk_size(size_t default_size) { - if (g_custom_min_stack_size != 0) { - return g_custom_min_stack_size; - } else { - return default_size; - } -} - static size_t get_next_stk_size(rust_scheduler *sched, rust_task *task, size_t min, size_t current, size_t requested) { @@ -157,7 +145,7 @@ new_stk(rust_scheduler *sched, rust_task *task, size_t requested_sz) } // The minimum stack size, in bytes, of a Rust stack, excluding red zone - size_t min_sz = get_min_stk_size(sched->min_stack_size); + size_t min_sz = sched->min_stack_size; // Try to reuse an existing stack segment if (task->stk != NULL && task->stk->prev != NULL) { diff --git a/src/rt/rustrt.def.in b/src/rt/rustrt.def.in index 052f4a42779..50981882ecd 100644 --- a/src/rt/rustrt.def.in +++ b/src/rt/rustrt.def.in @@ -49,7 +49,6 @@ rust_getcwd rust_task_is_unwinding rust_task_sleep rust_get_task -set_min_stack sched_threads shape_log_str squareroot diff --git a/src/test/run-fail/morestack4.rs b/src/test/run-fail/morestack4.rs index b36372d74e1..8f0ccec560f 100644 --- a/src/test/run-fail/morestack4.rs +++ b/src/test/run-fail/morestack4.rs @@ -4,10 +4,6 @@ use std; -native mod rustrt { - fn set_min_stack(size: uint); -} - fn getbig_and_fail(&&i: int) { let r = and_then_get_big_again(@0); if i != 0 { @@ -21,7 +17,6 @@ resource and_then_get_big_again(_i: @int) { } fn main() { - rustrt::set_min_stack(256u); task::spawn {|| getbig_and_fail(1); }; diff --git a/src/test/run-pass/morestack5.rs b/src/test/run-pass/morestack5.rs index 6c1d906e1e6..ecd187ae44a 100644 --- a/src/test/run-pass/morestack5.rs +++ b/src/test/run-pass/morestack5.rs @@ -3,10 +3,6 @@ use std; import task; -native mod rustrt { - fn set_min_stack(size: uint); -} - fn getbig(&&i: int) { if i != 0 { getbig(i - 1); @@ -16,7 +12,6 @@ fn getbig(&&i: int) { fn main() { let sz = 400u; while sz < 500u { - rustrt::set_min_stack(sz); task::join(task::spawn_joinable {|| getbig(200) }); sz += 1u; } diff --git a/src/test/run-pass/morestack6.rs b/src/test/run-pass/morestack6.rs index 2e30b942c1e..66954c29d98 100644 --- a/src/test/run-pass/morestack6.rs +++ b/src/test/run-pass/morestack6.rs @@ -6,7 +6,6 @@ import task; import std::rand; native mod rustrt { - fn set_min_stack(size: uint); fn debug_get_stk_seg() -> *u8; fn unsupervise(); @@ -71,7 +70,6 @@ fn main() { for f in fns { let sz = rng.next() % 256u32 + 256u32; let frame_backoff = rng.next() % 10u32 + 1u32; - rustrt::set_min_stack(sz as uint); task::join(task::spawn_joinable {|| runtest(f, frame_backoff);}); } } \ No newline at end of file