This commit is contained in:
Brian Anderson 2011-12-17 16:45:13 -08:00
parent 128621be97
commit aeadc6269e
5 changed files with 88 additions and 1 deletions

View file

@ -7,7 +7,7 @@
class
circular_buffer : public kernel_owned<circular_buffer> {
static const size_t INITIAL_CIRCULAR_BUFFER_SIZE_IN_UNITS = 8;
static const size_t INITIAL_CIRCULAR_BUFFER_SIZE_IN_UNITS = 1;
static const size_t MAX_CIRCULAR_BUFFER_SIZE = 1 << 24;
public:

View file

@ -404,6 +404,9 @@ rust_task::yield(size_t time_in_us, bool *killed) {
*killed = true;
}
// We're not going to need any extra stack for a while
clear_stack_cache();
yield_timer.reset_us(time_in_us);
// Return to the scheduler.
@ -746,6 +749,15 @@ rust_task::del_stack() {
record_stack_limit();
}
void
rust_task::clear_stack_cache() {
A(sched, stk != NULL, "Expected to have a stack");
if (stk->prev != NULL) {
free_stk(this, stk->prev);
stk->prev = NULL;
}
}
void
rust_task::record_stack_limit() {
// The function prolog compares the amount of stack needed to the end of

View file

@ -203,6 +203,7 @@ rust_task : public kernel_owned<rust_task>, rust_cond
void reset_stack_limit();
bool on_rust_stack();
void check_stack_canary();
void clear_stack_cache();
};
//