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

Merge remote-tracking branch 'whippet/main' into wip-whippet

This commit is contained in:
Andy Wingo 2025-04-18 15:11:40 +02:00
commit b6236fdcdc
13 changed files with 82 additions and 48 deletions

View file

@ -11,6 +11,7 @@
#include "gc-inline.h"
#include "gc-options.h"
#include "gc-ref.h"
#include "gc-stack-addr.h"
#include "gc-visibility.h"
#include <stdatomic.h>
@ -20,13 +21,8 @@
struct gc_heap;
struct gc_mutator;
struct gc_stack_addr;
GC_API_ void* gc_call_with_stack_addr(void* (*f)(struct gc_stack_addr *,
void *),
void *data) GC_NEVER_INLINE;
GC_API_ int gc_init(const struct gc_options *options,
struct gc_stack_addr *base, struct gc_heap **heap,
struct gc_stack_addr base, struct gc_heap **heap,
struct gc_mutator **mutator,
struct gc_event_listener event_listener,
void *event_listener_data);
@ -50,7 +46,7 @@ struct gc_extern_space;
GC_API_ void gc_heap_set_extern_space(struct gc_heap *heap,
struct gc_extern_space *space);
GC_API_ struct gc_mutator* gc_init_for_thread(struct gc_stack_addr *base,
GC_API_ struct gc_mutator* gc_init_for_thread(struct gc_stack_addr base,
struct gc_heap *heap);
GC_API_ void gc_finish_for_thread(struct gc_mutator *mut);
GC_API_ void* gc_call_without_gc(struct gc_mutator *mut, void* (*f)(void*),

View file

@ -0,0 +1,36 @@
#ifndef GC_STACK_ADDR_H
#define GC_STACK_ADDR_H
#include "gc-assert.h"
#include "gc-visibility.h"
struct gc_stack_addr {
uintptr_t addr;
};
static inline struct gc_stack_addr gc_empty_stack_addr (void) {
return (struct gc_stack_addr){ 0 };
};
static inline int gc_stack_addr_is_empty (struct gc_stack_addr addr) {
return addr.addr == 0;
};
static inline char* gc_stack_addr_as_pointer (struct gc_stack_addr addr) {
GC_ASSERT(!gc_stack_addr_is_empty(addr));
return (char*)addr.addr;
};
static inline struct gc_stack_addr gc_stack_addr (uintptr_t addr) {
GC_ASSERT(addr);
return (struct gc_stack_addr){ addr };
};
GC_API_ void* gc_call_with_stack_addr(void* (*f)(struct gc_stack_addr,
void *),
void *data) GC_NEVER_INLINE;
GC_API_ int gc_stack_addr_is_colder(struct gc_stack_addr a,
struct gc_stack_addr b);
#endif // GC_STACK_ADDR_H