mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-01 12:20:26 +02:00
Whether the returned object needs to be cleared or not depends on a couple things: - Whether the embedder actually needs the object to be cleared. - Whether the collector allocated the object from memory that was all zeroes already. The goal of course would be to prevent clearing memory if the mutator was just going to write all over it. But it's hard to know statically if the memory would have been all zeroes anyway, and in that case if you did clear it you'd be doing double work. In the end it's simpler to just require collectors to clear memory in bulk. We can revisit this later if it is an issue.
69 lines
2.6 KiB
C
69 lines
2.6 KiB
C
#ifndef GC_ATTRS_H
|
|
#define GC_ATTRS_H
|
|
|
|
#include "gc-inline.h"
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
enum gc_allocator_kind {
|
|
GC_ALLOCATOR_INLINE_BUMP_POINTER,
|
|
GC_ALLOCATOR_INLINE_FREELIST,
|
|
GC_ALLOCATOR_INLINE_NONE
|
|
};
|
|
|
|
static inline enum gc_allocator_kind gc_allocator_kind(void) GC_ALWAYS_INLINE;
|
|
static inline size_t gc_allocator_large_threshold(void) GC_ALWAYS_INLINE;
|
|
static inline size_t gc_allocator_small_granule_size(void) GC_ALWAYS_INLINE;
|
|
|
|
static inline size_t gc_allocator_allocation_pointer_offset(void) GC_ALWAYS_INLINE;
|
|
static inline size_t gc_allocator_allocation_limit_offset(void) GC_ALWAYS_INLINE;
|
|
|
|
static inline size_t gc_allocator_freelist_offset(size_t size) GC_ALWAYS_INLINE;
|
|
|
|
static inline size_t gc_allocator_alloc_table_alignment(void) GC_ALWAYS_INLINE;
|
|
static inline uint8_t gc_allocator_alloc_table_begin_pattern(void) GC_ALWAYS_INLINE;
|
|
static inline uint8_t gc_allocator_alloc_table_end_pattern(void) GC_ALWAYS_INLINE;
|
|
|
|
enum gc_old_generation_check_kind {
|
|
GC_OLD_GENERATION_CHECK_NONE,
|
|
GC_OLD_GENERATION_CHECK_ALLOC_TABLE,
|
|
GC_OLD_GENERATION_CHECK_SMALL_OBJECT_NURSERY,
|
|
GC_OLD_GENERATION_CHECK_SLOW
|
|
};
|
|
|
|
static inline enum gc_old_generation_check_kind gc_old_generation_check_kind(size_t obj_size) GC_ALWAYS_INLINE;
|
|
|
|
static inline uint8_t gc_old_generation_check_alloc_table_bit_pattern(void) GC_ALWAYS_INLINE;
|
|
|
|
enum gc_write_barrier_kind {
|
|
GC_WRITE_BARRIER_NONE,
|
|
GC_WRITE_BARRIER_CARD,
|
|
GC_WRITE_BARRIER_FIELD,
|
|
GC_WRITE_BARRIER_SLOW
|
|
};
|
|
|
|
static inline enum gc_write_barrier_kind gc_write_barrier_kind(size_t obj_size) GC_ALWAYS_INLINE;
|
|
static inline size_t gc_write_barrier_card_table_alignment(void) GC_ALWAYS_INLINE;
|
|
static inline size_t gc_write_barrier_card_size(void) GC_ALWAYS_INLINE;
|
|
static inline size_t gc_write_barrier_field_table_alignment(void) GC_ALWAYS_INLINE;
|
|
static inline ptrdiff_t gc_write_barrier_field_table_offset(void) GC_ALWAYS_INLINE;
|
|
static inline size_t gc_write_barrier_field_fields_per_byte(void) GC_ALWAYS_INLINE;
|
|
static inline uint8_t gc_write_barrier_field_first_bit_pattern(void) GC_ALWAYS_INLINE;
|
|
|
|
enum gc_safepoint_mechanism {
|
|
GC_SAFEPOINT_MECHANISM_COOPERATIVE,
|
|
GC_SAFEPOINT_MECHANISM_SIGNAL,
|
|
};
|
|
static inline enum gc_safepoint_mechanism gc_safepoint_mechanism(void) GC_ALWAYS_INLINE;
|
|
|
|
enum gc_cooperative_safepoint_kind {
|
|
GC_COOPERATIVE_SAFEPOINT_NONE,
|
|
GC_COOPERATIVE_SAFEPOINT_MUTATOR_FLAG,
|
|
GC_COOPERATIVE_SAFEPOINT_HEAP_FLAG,
|
|
};
|
|
static inline enum gc_cooperative_safepoint_kind gc_cooperative_safepoint_kind(void) GC_ALWAYS_INLINE;
|
|
|
|
static inline int gc_can_pin_objects(void) GC_ALWAYS_INLINE;
|
|
|
|
#endif // GC_ATTRS_H
|