1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-07-02 23:50:47 +02:00

Allow precise tracing of dynstacks

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.
This commit is contained in:
Andy Wingo 2025-06-19 16:32:56 +02:00
parent 923bfdc7ed
commit 278ba99027
7 changed files with 155 additions and 43 deletions

View file

@ -1,7 +1,7 @@
#ifndef SCM_DYNWIND_H
#define SCM_DYNWIND_H
/* Copyright 1995-1996,1998-2000,2003-2004,2006,2008,2011-2012,2018
/* Copyright 1995-1996,1998-2000,2003-2004,2006,2008,2011-2012,2018,2025
Free Software Foundation, Inc.
This file is part of Guile.
@ -37,7 +37,8 @@ typedef enum {
} scm_t_dynwind_flags;
typedef enum {
SCM_F_WIND_EXPLICITLY = SCM_F_DYNSTACK_WINDER_EXPLICIT
SCM_F_WIND_EXPLICITLY = SCM_F_DYNSTACK_WINDER_EXPLICIT,
SCM_F_WIND_MANAGED = SCM_F_DYNSTACK_WINDER_MANAGED
} scm_t_wind_flags;
SCM_API void scm_dynwind_begin (scm_t_dynwind_flags);