rt: Stop logging on the Rust stack. Closes #1478

This commit is contained in:
Brian Anderson 2012-02-22 22:29:38 -08:00
parent 27ab663845
commit c16bfbe0c3
2 changed files with 9 additions and 1 deletions

View File

@ -106,6 +106,10 @@ rust_log::trace_ln(char *prefix, char *message) {
void
rust_log::trace_ln(rust_task *task, uint32_t level, char *message) {
if (task) {
// There is not enough room to be logging on the rust stack
assert(!task->on_rust_stack() && "logging on rust stack");
}
// FIXME: The scheduler and task names used to have meaning,
// but they are always equal to 'main' currently

View File

@ -196,7 +196,6 @@ void task_start_wrapper(spawn_args *a)
if(env) {
// free the environment (which should be a unique closure).
const type_desc *td = env->td;
LOG(task, task, "Freeing env %p with td %p", env, td);
td->drop_glue(NULL, NULL, td->first_param, box_body(env));
upcall_free_shared_type_desc(env->td);
upcall_shared_free(env);
@ -720,6 +719,11 @@ Returns true if we're currently running on the Rust stack
*/
bool
rust_task::on_rust_stack() {
if (stk == NULL) {
// This only happens during construction
return false;
}
uintptr_t sp = get_sp();
bool in_first_segment = sp_in_stk_seg(sp, stk);
if (in_first_segment) {