1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-06 20:20:20 +02:00

SCM_GC_MALLOC avoids BDW API

* libguile/gc.h (SCM_GC_MALLOC, SCM_GC_MALLOC_POINTERLESS): Always
redirect to scm_gc_malloc{,_pointerless}.  Don't include bdw-gc.h.
* libguile/gc-malloc.c (scm_realloc): Use Whippet gc_collect API.
* libguile/loader.c:
* libguile/scmsigs.c:
* libguile/weak-vector.c: Include bdw-gc.
This commit is contained in:
Andy Wingo 2025-05-04 11:13:52 +02:00
parent fcf8fa3d10
commit b1d7d3538a
5 changed files with 8 additions and 11 deletions

View file

@ -78,8 +78,8 @@ scm_realloc (void *mem, size_t size)
if (ptr || size == 0) if (ptr || size == 0)
return ptr; return ptr;
/* Time is hard: trigger a full, ``stop-the-world'' GC, and try again. */ /* Time is hard; attempt to reclaim memory before trying again. */
GC_gcollect_and_unmap (); gc_collect (SCM_I_CURRENT_THREAD->mutator, GC_COLLECTION_COMPACTING);
ptr = do_realloc (mem, size); ptr = do_realloc (mem, size);
if (ptr) if (ptr)

View file

@ -135,14 +135,8 @@ SCM_API char *scm_gc_strndup (const char *str, size_t n, const char *what)
#define scm_gc_typed_calloc(t) ((t *) scm_gc_calloc (sizeof (t), #t)) #define scm_gc_typed_calloc(t) ((t *) scm_gc_calloc (sizeof (t), #t))
#ifdef BUILDING_LIBGUILE
#include "libguile/bdw-gc.h"
#define SCM_GC_MALLOC(size) GC_MALLOC (size)
#define SCM_GC_MALLOC_POINTERLESS(size) GC_MALLOC_ATOMIC (size)
#else
#define SCM_GC_MALLOC(size) scm_gc_malloc (size, NULL) #define SCM_GC_MALLOC(size) scm_gc_malloc (size, NULL)
#define SCM_GC_MALLOC_POINTERLESS(size) scm_gc_malloc_pointerless (size, NULL) #define SCM_GC_MALLOC_POINTERLESS(size) scm_gc_malloc_pointerless (size, NULL)
#endif
SCM_INLINE SCM scm_cell (scm_t_bits car, scm_t_bits cdr); SCM_INLINE SCM scm_cell (scm_t_bits car, scm_t_bits cdr);

View file

@ -1,4 +1,4 @@
/* Copyright 2001,2009-2015,2017-2018,2021 /* Copyright 2001,2009-2015,2017-2018,2021,2025
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of Guile. This file is part of Guile.
@ -37,6 +37,7 @@
#include <sys/mman.h> #include <sys/mman.h>
#endif #endif
#include "bdw-gc.h"
#include "boolean.h" #include "boolean.h"
#include "bytevectors.h" #include "bytevectors.h"
#include "elf.h" #include "elf.h"

View file

@ -1,4 +1,4 @@
/* Copyright 1995-2002, 2004, 2006-2009, 2011, 2013-2014, 2017-2018, 2023-2024 /* Copyright 1995-2002, 2004, 2006-2009, 2011, 2013-2014, 2017-2018, 2023-2025
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of Guile. This file is part of Guile.
@ -43,6 +43,7 @@
#include <full-write.h> #include <full-write.h>
#include "async.h" #include "async.h"
#include "bdw-gc.h"
#include "boolean.h" #include "boolean.h"
#include "dynwind.h" #include "dynwind.h"
#include "eval.h" #include "eval.h"

View file

@ -1,4 +1,4 @@
/* Copyright 1995-1996,1998,2000-2001,2003,2006,2008-2014,2018 /* Copyright 1995-1996,1998,2000-2001,2003,2006,2008-2014,2018,2025
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of Guile. This file is part of Guile.
@ -26,6 +26,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "bdw-gc.h"
#include "boolean.h" #include "boolean.h"
#include "extensions.h" #include "extensions.h"
#include "gsubr.h" #include "gsubr.h"