move reset_stack_limit off C stack (closes #2679)
This commit is contained in:
@@ -615,13 +615,6 @@ struct reset_args {
|
|||||||
|
|
||||||
void
|
void
|
||||||
reset_stack_limit_on_c_stack(reset_args *args) {
|
reset_stack_limit_on_c_stack(reset_args *args) {
|
||||||
rust_task *task = args->task;
|
|
||||||
uintptr_t sp = args->sp;
|
|
||||||
while (!sp_in_stk_seg(sp, task->stk)) {
|
|
||||||
task->stk = task->stk->prev;
|
|
||||||
assert(task->stk != NULL && "Failed to find the current stack");
|
|
||||||
}
|
|
||||||
task->record_stack_limit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -632,12 +625,11 @@ when unwinding through __morestack).
|
|||||||
void
|
void
|
||||||
rust_task::reset_stack_limit() {
|
rust_task::reset_stack_limit() {
|
||||||
uintptr_t sp = get_sp();
|
uintptr_t sp = get_sp();
|
||||||
// Have to do the rest on the C stack because it involves
|
while (!sp_in_stk_seg(sp, stk)) {
|
||||||
// freeing stack segments, logging, etc.
|
stk = stk->prev;
|
||||||
// FIXME (#2679): This probably doesn't need to happen on the C
|
assert(stk != NULL && "Failed to find the current stack");
|
||||||
// stack now
|
}
|
||||||
reset_args ra = {this, sp};
|
record_stack_limit();
|
||||||
call_on_c_stack(&ra, (void*)reset_stack_limit_on_c_stack);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ call_upcall_on_c_stack(rust_task *task, void *args, void *fn_ptr) {
|
|||||||
task->call_on_c_stack(args, fn_ptr);
|
task->call_on_c_stack(args, fn_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void record_sp_limit(void *limit);
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* Switches to the C-stack and invokes |fn_ptr|, passing |args| as argument.
|
* Switches to the C-stack and invokes |fn_ptr|, passing |args| as argument.
|
||||||
* This is used by the C compiler to call foreign functions and by other
|
* This is used by the C compiler to call foreign functions and by other
|
||||||
|
|||||||
Reference in New Issue
Block a user