rt: Remove set_min_stack
This commit is contained in:
parent
cad4918b2a
commit
fa13fd9d64
6 changed files with 1 additions and 33 deletions
|
@ -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
|
extern "C" CDECL int
|
||||||
sched_threads() {
|
sched_threads() {
|
||||||
rust_task *task = rust_scheduler::get_task();
|
rust_task *task = rust_scheduler::get_task();
|
||||||
|
|
|
@ -65,18 +65,6 @@ const uint8_t stack_canary[] = {0xAB, 0xCD, 0xAB, 0xCD,
|
||||||
0xAB, 0xCD, 0xAB, 0xCD,
|
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
|
static size_t
|
||||||
get_next_stk_size(rust_scheduler *sched, rust_task *task,
|
get_next_stk_size(rust_scheduler *sched, rust_task *task,
|
||||||
size_t min, size_t current, size_t requested) {
|
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
|
// 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
|
// Try to reuse an existing stack segment
|
||||||
if (task->stk != NULL && task->stk->prev != NULL) {
|
if (task->stk != NULL && task->stk->prev != NULL) {
|
||||||
|
|
|
@ -49,7 +49,6 @@ rust_getcwd
|
||||||
rust_task_is_unwinding
|
rust_task_is_unwinding
|
||||||
rust_task_sleep
|
rust_task_sleep
|
||||||
rust_get_task
|
rust_get_task
|
||||||
set_min_stack
|
|
||||||
sched_threads
|
sched_threads
|
||||||
shape_log_str
|
shape_log_str
|
||||||
squareroot
|
squareroot
|
||||||
|
|
|
@ -4,10 +4,6 @@
|
||||||
|
|
||||||
use std;
|
use std;
|
||||||
|
|
||||||
native mod rustrt {
|
|
||||||
fn set_min_stack(size: uint);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn getbig_and_fail(&&i: int) {
|
fn getbig_and_fail(&&i: int) {
|
||||||
let r = and_then_get_big_again(@0);
|
let r = and_then_get_big_again(@0);
|
||||||
if i != 0 {
|
if i != 0 {
|
||||||
|
@ -21,7 +17,6 @@ resource and_then_get_big_again(_i: @int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
rustrt::set_min_stack(256u);
|
|
||||||
task::spawn {||
|
task::spawn {||
|
||||||
getbig_and_fail(1);
|
getbig_and_fail(1);
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,10 +3,6 @@
|
||||||
use std;
|
use std;
|
||||||
import task;
|
import task;
|
||||||
|
|
||||||
native mod rustrt {
|
|
||||||
fn set_min_stack(size: uint);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn getbig(&&i: int) {
|
fn getbig(&&i: int) {
|
||||||
if i != 0 {
|
if i != 0 {
|
||||||
getbig(i - 1);
|
getbig(i - 1);
|
||||||
|
@ -16,7 +12,6 @@ fn getbig(&&i: int) {
|
||||||
fn main() {
|
fn main() {
|
||||||
let sz = 400u;
|
let sz = 400u;
|
||||||
while sz < 500u {
|
while sz < 500u {
|
||||||
rustrt::set_min_stack(sz);
|
|
||||||
task::join(task::spawn_joinable {|| getbig(200) });
|
task::join(task::spawn_joinable {|| getbig(200) });
|
||||||
sz += 1u;
|
sz += 1u;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import task;
|
||||||
import std::rand;
|
import std::rand;
|
||||||
|
|
||||||
native mod rustrt {
|
native mod rustrt {
|
||||||
fn set_min_stack(size: uint);
|
|
||||||
fn debug_get_stk_seg() -> *u8;
|
fn debug_get_stk_seg() -> *u8;
|
||||||
|
|
||||||
fn unsupervise();
|
fn unsupervise();
|
||||||
|
@ -71,7 +70,6 @@ fn main() {
|
||||||
for f in fns {
|
for f in fns {
|
||||||
let sz = rng.next() % 256u32 + 256u32;
|
let sz = rng.next() % 256u32 + 256u32;
|
||||||
let frame_backoff = rng.next() % 10u32 + 1u32;
|
let frame_backoff = rng.next() % 10u32 + 1u32;
|
||||||
rustrt::set_min_stack(sz as uint);
|
|
||||||
task::join(task::spawn_joinable {|| runtest(f, frame_backoff);});
|
task::join(task::spawn_joinable {|| runtest(f, frame_backoff);});
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue