summaryrefslogtreecommitdiff
path: root/libguile/whippet/api/gc-embedder-api.h
blob: c1b272a5190652573d5a2782a060c2f236299cfb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef GC_EMBEDDER_API_H
#define GC_EMBEDDER_API_H

#include <stddef.h>

#include "gc-config.h"
#include "gc-edge.h"
#include "gc-inline.h"
#include "gc-forwarding.h"

#ifndef GC_EMBEDDER_API
#define GC_EMBEDDER_API static
#endif

struct gc_mutator_roots;
struct gc_heap_roots;
struct gc_atomic_forward;
struct gc_heap;
struct gc_extern_space;

GC_EMBEDDER_API inline int gc_is_valid_conservative_ref_displacement(uintptr_t displacement);
GC_EMBEDDER_API inline size_t gc_finalizer_priority_count(void);

GC_EMBEDDER_API inline int gc_extern_space_visit(struct gc_extern_space *space,
                                                 struct gc_edge edge,
                                                 struct gc_ref ref) GC_ALWAYS_INLINE;
GC_EMBEDDER_API inline void gc_extern_space_start_gc(struct gc_extern_space *space,
                                                     int is_minor_gc);
GC_EMBEDDER_API inline void gc_extern_space_finish_gc(struct gc_extern_space *space,
                                                      int is_minor_gc);

GC_EMBEDDER_API inline void gc_trace_object(struct gc_ref ref,
                                            void (*visit)(struct gc_edge edge,
                                                          struct gc_heap *heap,
                                                          void *visit_data),
                                            struct gc_heap *heap,
                                            void *trace_data,
                                            size_t *size) GC_ALWAYS_INLINE;

GC_EMBEDDER_API inline void gc_trace_mutator_roots(struct gc_mutator_roots *roots,
                                                   void (*trace_edge)(struct gc_edge edge,
                                                                      struct gc_heap *heap,
                                                                      void *trace_data),
                                                   struct gc_heap *heap,
                                                   void *trace_data);
GC_EMBEDDER_API inline void gc_trace_heap_roots(struct gc_heap_roots *roots,
                                                void (*trace_edge)(struct gc_edge edge,
                                                                   struct gc_heap *heap,
                                                                   void *trace_data),
                                                struct gc_heap *heap,
                                                void *trace_data);

GC_EMBEDDER_API inline uintptr_t gc_object_forwarded_nonatomic(struct gc_ref ref);
GC_EMBEDDER_API inline void gc_object_forward_nonatomic(struct gc_ref ref,
                                                        struct gc_ref new_ref);

GC_EMBEDDER_API inline struct gc_atomic_forward gc_atomic_forward_begin(struct gc_ref ref);
GC_EMBEDDER_API inline void gc_atomic_forward_acquire(struct gc_atomic_forward *);
GC_EMBEDDER_API inline int gc_atomic_forward_retry_busy(struct gc_atomic_forward *);
GC_EMBEDDER_API inline void gc_atomic_forward_abort(struct gc_atomic_forward *);
GC_EMBEDDER_API inline size_t gc_atomic_forward_object_size(struct gc_atomic_forward *);
GC_EMBEDDER_API inline void gc_atomic_forward_commit(struct gc_atomic_forward *,
                                                     struct gc_ref new_ref);
GC_EMBEDDER_API inline uintptr_t gc_atomic_forward_address(struct gc_atomic_forward *);


#endif // GC_EMBEDDER_API_H