Skip to content

Commit

Permalink
Assert stk rather than checking null
Browse files Browse the repository at this point in the history
Given that a big stack is never requested before allocating an initial
stack segment, having a non-null stk member here is an invariant.
  • Loading branch information
Ron Dahlgren committed Jun 11, 2013
1 parent 12203a7 commit 301f900
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/rt/rust_task.cpp
Expand Up @@ -587,6 +587,7 @@ rust_task::cleanup_after_turn() {
// stack and false otherwise.
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.
Expand All @@ -612,12 +613,11 @@ rust_task::new_big_stack() {
}

big_stack->task = this;
big_stack->next = stk ? stk->next : NULL;
big_stack->next = stk->next;
if (big_stack->next)
big_stack->next->prev = big_stack;
big_stack->prev = stk;
if (stk)
stk->next = big_stack;
stk->next = big_stack;

stk = big_stack;

Expand Down

4 comments on commit 301f900

@bors
Copy link
Contributor

@bors bors commented on 301f900 Jun 11, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 301f900 Jun 11, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging influenza/rust/rust-7022 = 301f900 into auto

@bors
Copy link
Contributor

@bors bors commented on 301f900 Jun 11, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

influenza/rust/rust-7022 = 301f900 merged ok, testing candidate = 965522e2

@bors
Copy link
Contributor

@bors bors commented on 301f900 Jun 11, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.