1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-01 04:10:18 +02:00
guile/module/language/cps
Andy Wingo 27f0490801 Use Whippet API to boot threads
* libguile/scm.h (scm_tc7_thread): Give threads their own tc7.
* libguile/threads.h (struct scm_thread): Add a tag, so that struct
thread can be a SCM directly.  Add a struct gc_mutator* member.
(scm_thread_handle): New inline function.
(SCM_I_IS_THREAD, SCM_I_THREAD_DATA, SCM_VALIDATE_THREAD): Update to use
tc7 instead of SMOB tags.

* libguile/continuations.c (scm_i_with_continuation_barrier)
* libguile/finalizers.c (queue_finalizer_async)
* libguile/jit.c (compile_current_thread)
* libguile/threads.c (block_self, guilify_self_2)
(lock_mutex, unlock_mutex, timed_wait scm_current_thread)
(scm_all_threads)
* libguile/vm-engine.c (current-thread): Use scm_thread_handle instead
of thread->handle.

* libguile/evalext.c (scm_self_evaluating_p):
* libguile/goops.c (class_thread, scm_class_of, scm_sys_goops_early_init)
* libguile/print.c (iprin1)
* module/language/cps/compile-bytecode.scm (compile-function)
* module/oop/goops.scm (<thread>)
* module/system/base/types.scm (cell->object)
* module/system/base/types/internal.scm (heap-tags)
* module/system/vm/assembler.scm: (emit-thread?): Adapt to
scm_tc7_thread.

* libguile/gc-internal.h: Move init functions that take "struct
gc_stack_addr" here, so that internal Whippet uses don't cause Whippet
to be added to public headers.
* libguile/gc.c (scm_storage_prehistory): Take struct gc_stack_addr as
arg, and pass to gc_init.  Return a mutator pointer.
* libguile/init.c (scm_i_init_guile): Pass mutator and stack base to GC
and thread init routines.
* libguile/threads.c (scm_trace_dynstack, scm_trace_thread)
(scm_trace_thread_mutator_roots): New infra for marking threads in terms
of Whippet API.
* libguile/threads.c (guilify_self_1): Since we don't use a separate GC
kind for threads any more, and thread marking is keyed off
gc_mutator_set_roots, we can avoid some of the gnarly synchronization.
(on_thread_exit): Arrange to gc_finish_for_thread.
(scm_i_init_thread_for_guile): Use gc_init_for_thread.
(init_main_thread, with_guile, scm_i_with_guile): Use Whippet API.
(scm_threads_prehistory): Take main-thread mutator and the stack base as
arguments.
* libguile/vm.c (scm_trace_vm): Rework in terms of Whippet API.
* libguile/whippet-embedder.h (gc_trace_mutator_roots): Arrange to trace
the current mutator's SCM thread object.
* libguile/trace.h: New file, to declare implementations of trace
routines.
* libguile/Makefile.am (noinst_HEADERS): Add trace.h.
2025-04-22 10:36:30 +02:00
..
guile-vm CPS conversion does not introduce "throw" 2023-11-23 10:25:02 +01:00
closure-conversion.scm Add new $calli expression type. 2023-08-17 14:16:12 +02:00
compile-bytecode.scm Use Whippet API to boot threads 2025-04-22 10:36:30 +02:00
contification.scm Add new $calli expression type. 2023-08-17 14:16:12 +02:00
cse.scm Add new $calli expression type. 2023-08-17 14:16:12 +02:00
dce.scm Add new $calli expression type. 2023-08-17 14:16:12 +02:00
devirtualize-integers.scm Add new $calli expression type. 2023-08-17 14:16:12 +02:00
dump.scm Add new $calli expression type. 2023-08-17 14:16:12 +02:00
effects-analysis.scm Fix effects analysis: field writes clobber object reads 2024-03-20 11:50:53 +01:00
elide-arity-checks.scm New pass: elide-arity-checks 2021-04-21 22:41:12 +02:00
graphs.scm Use transient intset/intmap optimizations when computing SCCs 2025-01-22 16:50:52 +01:00
guile-vm.scm Allow targets to preclude unbound variables 2023-11-23 12:31:38 +01:00
intmap.scm Fix intmap-intersect edge case 2019-06-11 12:56:23 +02:00
intset.scm Fix intset-fold-right on transient intsets 2024-08-15 12:18:02 +02:00
licm.scm Add $switch CPS term kind 2020-08-12 23:30:08 +02:00
optimize.scm Introduce target-runtime parameter for backend-specific CPS lowering 2023-08-17 14:16:12 +02:00
peel-loops.scm Add new $calli expression type. 2023-08-17 14:16:12 +02:00
prune-top-level-scopes.scm cache-current-module, etc use immediate primcall parameters 2017-11-05 15:00:16 +01:00
renumber.scm Add new $calli expression type. 2023-08-17 14:16:12 +02:00
return-types.scm Add new pass to optimize away return value count checks 2021-11-15 15:32:54 +01:00
rotate-loops.scm Add new $calli expression type. 2023-08-17 14:16:12 +02:00
self-references.scm Add new $calli expression type. 2023-08-17 14:16:12 +02:00
simplify.scm Add new $calli expression type. 2023-08-17 14:16:12 +02:00
slot-allocation.scm More precise value representations for bv-contents, $code 2023-08-17 14:16:12 +02:00
spec.scm Define new "lowering" phase in compiler 2020-05-08 17:07:56 +02:00
specialize-numbers.scm Run sigbits fixpoint based on use/def graph, not cfg 2024-09-26 11:14:52 +02:00
specialize-primcalls.scm Compiler allocates boxed flonums in unmarked space 2019-08-26 10:19:24 +02:00
split-rec.scm Add new $calli expression type. 2023-08-17 14:16:12 +02:00
switch.scm Allow target runtime to override symbol hash 2023-11-20 14:23:14 +01:00
type-checks.scm $branch is now a distinct CPS term type 2018-01-03 16:16:39 +01:00
type-fold.scm Fix bug lowering logand/immediate to ulogand/immediate 2023-11-20 16:45:35 +01:00
types.scm Tighten up range inference for scm->u64/truncate 2024-09-25 17:27:17 +02:00
utils.scm Fix string-utf8-length to have unboxed representation 2025-02-20 12:38:28 +01:00
verify.scm Add new $calli expression type. 2023-08-17 14:16:12 +02:00
with-cps.scm Add missing files 2015-07-22 18:27:37 +02:00