Skip to content

Commit f25429c

Browse files
committed
---
yaml --- r: 11292 b: refs/heads/master c: a53a08e h: refs/heads/master v: v3
1 parent 515c873 commit f25429c

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
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 44d4889bc24a09259cf8a7fbf89ded78ab1e64bc
2+
refs/heads/master: a53a08e1b980e5cf5f9707ef1d1f27b89ff7ed99
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/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

trunk/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
}

trunk/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)