Skip to content

Commit 3830040

Browse files
committed
auto merge of #5887 : jdm/rust/stackbounds, r=brson
This is needed to allow GC to work in SpiderMonkey.
2 parents 6a31525 + 5cc6a0b commit 3830040

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

src/libcore/gc.rs

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ pub mod rustrt {
7373
pub unsafe fn rust_gc_metadata() -> *Word;
7474

7575
pub unsafe fn rust_get_stack_segment() -> *StackSegment;
76+
pub unsafe fn rust_get_c_stack() -> *StackSegment;
7677
}
7778
}
7879

src/rt/rust_builtin.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,11 @@ rust_get_stack_segment() {
549549
return rust_get_current_task()->stk;
550550
}
551551

552+
extern "C" CDECL stk_seg *
553+
rust_get_c_stack() {
554+
return rust_get_current_task()->get_c_stack();
555+
}
556+
552557
extern "C" CDECL void
553558
start_task(rust_task *target, fn_env_pair *f) {
554559
target->start(f->f, f->env, NULL);

src/rt/rust_task.h

+1
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ rust_task : public kernel_owned<rust_task>
374374
void call_on_c_stack(void *args, void *fn_ptr);
375375
void call_on_rust_stack(void *args, void *fn_ptr);
376376
bool have_c_stack() { return c_stack != NULL; }
377+
stk_seg *get_c_stack() { return c_stack; }
377378

378379
rust_task_state get_state() { return state; }
379380
rust_cond *get_cond() { return cond; }

src/rt/rustrt.def.in

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ rust_task_is_unwinding
4949
rust_get_task
5050
rust_try_get_task
5151
rust_get_stack_segment
52+
rust_get_c_stack
5253
rust_log_str
5354
start_task
5455
vec_reserve_shared_actual

0 commit comments

Comments
 (0)