mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
Eagerly initialize thread VM; remove scm_the_vm
* libguile/threads.c (thread_mark): Unconditionally call scm_i_vm_mark_stack. (guilify_self_1): Eagerly prepare the thread stack, before entering Guile mode. It's only a page of mmap, after all. * libguile/vm.c (scm_i_vm_prepare_stack): Rename from init_vm. (thread_vm, scm_the_vm): Remove. (VM_DEFINE_HOOK, scm_vm_trace_level, scm_set_vm_trace_level_x) (scm_vm_engine, scm_c_set_vm_engine_x, scm_i_capture_current_stack) (scm_call_n, scm_call_with_stack_overflow_handler): Adapt to get VM from thread. (scm_i_vm_free_stack): Memset the whole thing to 0 when we're done. * libguile/control.c (scm_abort_to_prompt_star) * libguile/eval.c (eval): * libguile/throw.c (catch, abort_to_prompt): Get VM from thread.
This commit is contained in:
parent
2480761bde
commit
7f7169847e
6 changed files with 62 additions and 71 deletions
|
@ -114,9 +114,8 @@ thread_mark (GC_word *addr, struct GC_ms_entry *mark_stack_ptr,
|
|||
}
|
||||
}
|
||||
|
||||
if (t->vm.stack_bottom)
|
||||
mark_stack_ptr = scm_i_vm_mark_stack (&t->vm, mark_stack_ptr,
|
||||
mark_stack_limit);
|
||||
mark_stack_ptr = scm_i_vm_mark_stack (&t->vm, mark_stack_ptr,
|
||||
mark_stack_limit);
|
||||
|
||||
return mark_stack_ptr;
|
||||
}
|
||||
|
@ -391,6 +390,7 @@ guilify_self_1 (struct GC_stack_base *base, int needs_unregister)
|
|||
t.continuation_root = SCM_EOL;
|
||||
t.continuation_base = t.base;
|
||||
scm_i_pthread_cond_init (&t.sleep_cond, NULL);
|
||||
scm_i_vm_prepare_stack (&t.vm);
|
||||
|
||||
if (pipe2 (t.sleep_pipe, O_CLOEXEC) != 0)
|
||||
/* FIXME: Error conditions during the initialization phase are handled
|
||||
|
@ -491,6 +491,10 @@ on_thread_exit (void *v)
|
|||
}
|
||||
thread_count--;
|
||||
|
||||
/* Prevent any concurrent or future marker from visiting this
|
||||
thread. */
|
||||
t->handle = SCM_PACK (0);
|
||||
|
||||
/* If there's only one other thread, it could be the signal delivery
|
||||
thread, so we need to notify it to shut down by closing its read pipe.
|
||||
If it's not the signal delivery thread, then closing the read pipe isn't
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue