mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-07-01 07:20:20 +02:00
Gosh this was a slog * libguile/dynstack.c (dynstack_ensure_space): Use malloc and free. Threads have off-heap dynstacks, with manual marking. (scm_trace_dynstack): Implement tracing. (trace_pinned_trampoline, scm_trace_dynstack_roots): Implement tracing for active threads. (scm_dynstack_capture): Tag dynstacks. * libguile/dynstack.h (scm_t_dynstack): Add a tag. (scm_t_dynstack_winder_flags): Add SCM_F_DYNSTACK_WINDER_MANAGED. * libguile/dynwind.h (scm_t_wind_flags): Add SCM_F_WIND_MANAGED. * libguile/dynwind.c (scm_dynwind_unwind_handler_with_scm) (scm_dynwind_rewind_handler_with_scm): These values need to be traced by GC. * libguile/scm.h (scm_tc16_dynstack_slice): New typecode. No need for equality etc because it shouldn't escape to Scheme (currently). * libguile/trace.h: Add trace decls. * libguile/threads.c (scm_trace_thread_roots): Trace dynstacks explicitly here, as they are off-heap.
99 lines
3.6 KiB
C
99 lines
3.6 KiB
C
#ifndef SCM_THREADS_INTERNAL_H
|
||
#define SCM_THREADS_INTERNAL_H
|
||
|
||
/* Copyright 2025 Free Software Foundation, Inc.
|
||
|
||
This file is part of Guile.
|
||
|
||
Guile is free software: you can redistribute it and/or modify it
|
||
under the terms of the GNU Lesser General Public License as published
|
||
by the Free Software Foundation, either version 3 of the License, or
|
||
(at your option) any later version.
|
||
|
||
Guile is distributed in the hope that it will be useful, but WITHOUT
|
||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||
License for more details.
|
||
|
||
You should have received a copy of the GNU Lesser General Public
|
||
License along with Guile. If not, see
|
||
<https://www.gnu.org/licenses/>. */
|
||
|
||
|
||
|
||
#include "libguile/scm.h"
|
||
#include "gc-ref.h"
|
||
#include "gc-edge.h"
|
||
|
||
|
||
|
||
struct scm_thread;
|
||
struct scm_vm;
|
||
struct scm_dynstack;
|
||
struct gc_heap;
|
||
struct gc_heap_roots { int unused; };
|
||
|
||
static inline SCM
|
||
scm_from_ref (struct gc_ref ref)
|
||
{
|
||
return SCM_PACK (gc_ref_value (ref));
|
||
}
|
||
|
||
static inline struct gc_ref
|
||
scm_to_ref (SCM scm)
|
||
{
|
||
return gc_ref (SCM_UNPACK (scm));
|
||
}
|
||
|
||
SCM_INTERNAL void
|
||
scm_trace_thread_roots (struct scm_thread *thread,
|
||
void (*trace_pinned) (struct gc_ref ref,
|
||
struct gc_heap *heap,
|
||
void *trace_data),
|
||
void (*trace_ambiguous) (uintptr_t lo,
|
||
uintptr_t hi,
|
||
int possibly_interior,
|
||
struct gc_heap *heap,
|
||
void *trace_data),
|
||
struct gc_heap *heap,
|
||
void *trace_data);
|
||
|
||
SCM_INTERNAL void
|
||
scm_trace_vm_roots (struct scm_vm *vp,
|
||
void (*trace_pinned) (struct gc_ref ref,
|
||
struct gc_heap *heap,
|
||
void *trace_data),
|
||
void (*trace_ambiguous) (uintptr_t lo,
|
||
uintptr_t hi,
|
||
int possibly_interior,
|
||
struct gc_heap *heap,
|
||
void *trace_data),
|
||
struct gc_heap *heap,
|
||
void *trace_data);
|
||
|
||
SCM_INTERNAL void
|
||
scm_trace_loader_roots (void (*trace_ambiguous) (uintptr_t lo,
|
||
uintptr_t hi,
|
||
int possibly_interior,
|
||
struct gc_heap *heap,
|
||
void *trace_data),
|
||
struct gc_heap *heap,
|
||
void *trace_data);
|
||
|
||
SCM_INTERNAL void
|
||
scm_trace_dynstack (struct scm_dynstack *dynstack,
|
||
void (*trace) (struct gc_edge edge,
|
||
struct gc_heap *heap,
|
||
void *trace_data),
|
||
struct gc_heap *heap,
|
||
void *trace_data);
|
||
|
||
SCM_INTERNAL void
|
||
scm_trace_dynstack_roots (struct scm_dynstack *dynstack,
|
||
void (*trace_pinned) (struct gc_ref ref,
|
||
struct gc_heap *heap,
|
||
void *trace_data),
|
||
struct gc_heap *heap,
|
||
void *trace_data);
|
||
|
||
#endif /* SCM_THREADS_INTERNAL_H */
|