Skip to content

Commit de0e6d0

Browse files
committed
---
yaml --- r: 14298 b: refs/heads/try c: a53a08e h: refs/heads/master v: v3
1 parent 1cda0f3 commit de0e6d0

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: 44d4889bc24a09259cf8a7fbf89ded78ab1e64bc
5+
refs/heads/try: a53a08e1b980e5cf5f9707ef1d1f27b89ff7ed99
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/rt/rust_task.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ rust_task : public kernel_owned<rust_task>, rust_cond
205205

206206
void call_on_c_stack(void *args, void *fn_ptr);
207207
void call_on_rust_stack(void *args, void *fn_ptr);
208+
bool have_c_stack() { return c_stack != NULL; }
208209
};
209210

210211
// This stuff is on the stack-switching fast path

branches/try/src/rt/rust_task_thread.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ rust_task_thread::activate(rust_task *task) {
7070
task->ctx.next = &c_context;
7171
DLOG(this, task, "descheduling...");
7272
lock.unlock();
73-
prepare_c_stack();
73+
prepare_c_stack(task);
7474
task->ctx.swap(c_context);
7575
unprepare_c_stack();
7676
lock.lock();
@@ -367,9 +367,9 @@ rust_task_thread::exit() {
367367
// stack), because once we're on the Rust stack we won't have enough
368368
// room to do the allocation
369369
void
370-
rust_task_thread::prepare_c_stack() {
370+
rust_task_thread::prepare_c_stack(rust_task *task) {
371371
I(this, !extra_c_stack);
372-
if (!cached_c_stack) {
372+
if (!cached_c_stack && !task->have_c_stack()) {
373373
cached_c_stack = create_stack(kernel, C_STACK_SIZE);
374374
prepare_valgrind_stack(cached_c_stack);
375375
}

branches/try/src/rt/rust_task_thread.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ struct rust_task_thread : public kernel_owned<rust_task_thread>,
9898
stk_seg *cached_c_stack;
9999
stk_seg *extra_c_stack;
100100

101-
void prepare_c_stack();
101+
void prepare_c_stack(rust_task *task);
102102
void unprepare_c_stack();
103103

104104
public:

0 commit comments

Comments
 (0)