diff options
| author | Eric Reed <ereed@mozilla.com> | 2013-07-08 13:03:18 -0700 |
|---|---|---|
| committer | Eric Reed <ereed@mozilla.com> | 2013-07-08 13:03:18 -0700 |
| commit | cf2329201098c6e3b417548651a1c3dbf19c0dc0 (patch) | |
| tree | e970715357ad65a22f289bd708e3e9ede49f9ad2 /src/rt/rust_task.cpp | |
| parent | b60cf0c5b0cf36625083c2624df9fb35d0af3578 (diff) | |
| parent | 1098d6980b13dc00e3f20deae987423e3bcae9ce (diff) | |
| download | rust-cf2329201098c6e3b417548651a1c3dbf19c0dc0.tar.gz rust-cf2329201098c6e3b417548651a1c3dbf19c0dc0.zip | |
Merge remote-tracking branch 'upstream/io' into io
Conflicts: src/libstd/rt/uvio.rs
Diffstat (limited to 'src/rt/rust_task.cpp')
| -rw-r--r-- | src/rt/rust_task.cpp | 62 |
1 files changed, 19 insertions, 43 deletions
diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index fe1b4622137..4d6d2567cd4 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -54,8 +54,7 @@ rust_task::rust_task(rust_sched_loop *sched_loop, rust_task_state state, disallow_yield(0), c_stack(NULL), next_c_sp(0), - next_rust_sp(0), - big_stack(NULL) + next_rust_sp(0) { LOGPTR(sched_loop, "new task", (uintptr_t)this); DLOG(sched_loop, task, "sizeof(task) = %d (0x%x)", @@ -183,7 +182,11 @@ void task_start_wrapper(spawn_args *a) if(env) { // free the environment (which should be a unique closure). const type_desc *td = env->td; - td->drop_glue(NULL, NULL, box_body(env)); + td->drop_glue(NULL, +#ifdef _RUST_STAGE0 + NULL, +#endif + box_body(env)); task->kernel->region()->free(env); } @@ -562,14 +565,8 @@ rust_task::cleanup_after_turn() { while (stk->next) { stk_seg *new_next = stk->next->next; - - if (stk->next->is_big) { - assert (big_stack == stk->next); - sched_loop->return_big_stack(big_stack); - big_stack = NULL; - } else { - free_stack(stk->next); - } + assert (!stk->next->is_big); + free_stack(stk->next); stk->next = new_next; } @@ -580,38 +577,20 @@ rust_task::cleanup_after_turn() { bool rust_task::new_big_stack() { assert(stk); - // If we have a cached big stack segment, use it. - if (big_stack) { - // Check to see if we're already on the big stack. - stk_seg *ss = stk; - while (ss != NULL) { - if (ss == big_stack) - return false; - ss = ss->prev; - } - // Unlink the big stack. - if (big_stack->next) - big_stack->next->prev = big_stack->prev; - if (big_stack->prev) - big_stack->prev->next = big_stack->next; - } else { - stk_seg *borrowed_big_stack = sched_loop->borrow_big_stack(); - if (!borrowed_big_stack) { - abort(); - } else { - big_stack = borrowed_big_stack; - } + stk_seg *borrowed_big_stack = sched_loop->borrow_big_stack(); + if (!borrowed_big_stack) { + return false; } - big_stack->task = this; - big_stack->next = stk->next; - if (big_stack->next) - big_stack->next->prev = big_stack; - big_stack->prev = stk; - stk->next = big_stack; + borrowed_big_stack->task = this; + borrowed_big_stack->next = stk->next; + if (borrowed_big_stack->next) + borrowed_big_stack->next->prev = borrowed_big_stack; + borrowed_big_stack->prev = stk; + stk->next = borrowed_big_stack; - stk = big_stack; + stk = borrowed_big_stack; return true; } @@ -636,10 +615,9 @@ void rust_task::reset_stack_limit() { uintptr_t sp = get_sp(); while (!sp_in_stk_seg(sp, stk)) { - stk = stk->prev; + prev_stack(); assert(stk != NULL && "Failed to find the current stack"); } - record_stack_limit(); } void @@ -663,8 +641,6 @@ rust_task::delete_all_stacks() { stk = prev; } - - big_stack = NULL; } /* |
