mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-10 15:50:50 +02:00
Add bdw-inline.h
This commit is contained in:
parent
8f2f4f7c69
commit
33aa5230da
4 changed files with 59 additions and 54 deletions
52
bdw-inline.h
Normal file
52
bdw-inline.h
Normal file
|
@ -0,0 +1,52 @@
|
|||
#ifndef BDW_INLINE_H
|
||||
#define BDW_INLINE_H
|
||||
|
||||
#include "gc-api.h"
|
||||
|
||||
static inline enum gc_allocator_kind gc_allocator_kind(void) {
|
||||
return GC_ALLOCATOR_INLINE_FREELIST;
|
||||
}
|
||||
static inline size_t gc_allocator_small_granule_size(void) {
|
||||
return 2 * sizeof(void *);
|
||||
}
|
||||
static inline size_t gc_allocator_large_threshold(void) {
|
||||
return 256;
|
||||
}
|
||||
|
||||
static inline size_t gc_allocator_allocation_pointer_offset(void) {
|
||||
abort();
|
||||
}
|
||||
static inline size_t gc_allocator_allocation_limit_offset(void) {
|
||||
abort();
|
||||
}
|
||||
|
||||
static inline size_t gc_allocator_freelist_offset(size_t size) {
|
||||
GC_ASSERT(size);
|
||||
return sizeof(void*) * ((size - 1) / gc_allocator_small_granule_size());
|
||||
}
|
||||
|
||||
static inline size_t gc_allocator_alloc_table_alignment(void) {
|
||||
return 0;
|
||||
}
|
||||
static inline uint8_t gc_allocator_alloc_table_begin_pattern(void) {
|
||||
abort();
|
||||
}
|
||||
static inline uint8_t gc_allocator_alloc_table_end_pattern(void) {
|
||||
abort();
|
||||
}
|
||||
|
||||
static inline int gc_allocator_needs_clear(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline enum gc_write_barrier_kind gc_small_write_barrier_kind(void) {
|
||||
return GC_WRITE_BARRIER_NONE;
|
||||
}
|
||||
static inline size_t gc_small_write_barrier_card_table_alignment(void) {
|
||||
abort();
|
||||
}
|
||||
static inline size_t gc_small_write_barrier_card_size(void) {
|
||||
abort();
|
||||
}
|
||||
|
||||
#endif // BDW_INLINE_H
|
57
bdw.h
57
bdw.h
|
@ -1,6 +1,7 @@
|
|||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "bdw-inline.h"
|
||||
#include "conservative-roots.h"
|
||||
|
||||
// When pthreads are used, let `libgc' know about it and redirect
|
||||
|
@ -45,34 +46,6 @@ static inline size_t gc_inline_freelist_object_size(size_t idx) {
|
|||
return (idx + 1U) * GC_INLINE_GRANULE_BYTES;
|
||||
}
|
||||
|
||||
static inline enum gc_allocator_kind gc_allocator_kind(void) {
|
||||
return GC_ALLOCATOR_INLINE_FREELIST;
|
||||
}
|
||||
static inline size_t gc_allocator_small_granule_size(void) {
|
||||
return GC_INLINE_GRANULE_BYTES;
|
||||
}
|
||||
static inline size_t gc_allocator_large_threshold(void) {
|
||||
return 256;
|
||||
}
|
||||
|
||||
static inline size_t gc_allocator_allocation_pointer_offset(void) {
|
||||
abort();
|
||||
}
|
||||
static inline size_t gc_allocator_allocation_limit_offset(void) {
|
||||
abort();
|
||||
}
|
||||
|
||||
static inline size_t gc_allocator_freelist_offset(size_t size) {
|
||||
GC_ASSERT(size);
|
||||
return sizeof(void*) * gc_inline_bytes_to_freelist_index(size);
|
||||
}
|
||||
|
||||
static inline void gc_allocator_inline_success(struct mutator *mut,
|
||||
struct gc_ref obj,
|
||||
uintptr_t aligned_size) {}
|
||||
static inline void gc_allocator_inline_failure(struct mutator *mut,
|
||||
uintptr_t aligned_size) {}
|
||||
|
||||
// The values of these must match the internal POINTERLESS and NORMAL
|
||||
// definitions in libgc, for which unfortunately there are no external
|
||||
// definitions. Alack.
|
||||
|
@ -131,30 +104,6 @@ static inline void collect(struct mutator *mut) {
|
|||
GC_gcollect();
|
||||
}
|
||||
|
||||
static inline enum gc_write_barrier_kind gc_small_write_barrier_kind(void) {
|
||||
return GC_WRITE_BARRIER_NONE;
|
||||
}
|
||||
static inline size_t gc_small_write_barrier_card_table_alignment(void) {
|
||||
abort();
|
||||
}
|
||||
static inline size_t gc_small_write_barrier_card_size(void) {
|
||||
abort();
|
||||
}
|
||||
|
||||
static inline size_t gc_allocator_alloc_table_alignment(void) {
|
||||
return 0;
|
||||
}
|
||||
static inline uint8_t gc_allocator_alloc_table_begin_pattern(void) {
|
||||
abort();
|
||||
}
|
||||
static inline uint8_t gc_allocator_alloc_table_end_pattern(void) {
|
||||
abort();
|
||||
}
|
||||
|
||||
static inline int gc_allocator_needs_clear(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline struct mutator *add_mutator(struct heap *heap) {
|
||||
struct mutator *ret = GC_malloc(sizeof(struct mutator));
|
||||
ret->heap = heap;
|
||||
|
@ -230,6 +179,10 @@ static int parse_options(int argc, struct gc_option argv[],
|
|||
|
||||
static int gc_init(int argc, struct gc_option argv[],
|
||||
struct heap **heap, struct mutator **mutator) {
|
||||
GC_ASSERT_EQ(gc_allocator_small_granule_size(), GC_INLINE_GRANULE_BYTES);
|
||||
GC_ASSERT_EQ(gc_allocator_large_threshold(),
|
||||
GC_INLINE_FREELIST_COUNT * GC_INLINE_GRANULE_BYTES);
|
||||
|
||||
struct options options = { 0, };
|
||||
if (!parse_options(argc, argv, &options))
|
||||
return 0;
|
||||
|
|
|
@ -12,4 +12,6 @@
|
|||
#define GC_ASSERT(x) do { } while (0)
|
||||
#endif
|
||||
|
||||
#define GC_ASSERT_EQ(a, b) GC_ASSERT((a) == (b))
|
||||
|
||||
#endif // GC_ASSERT_H
|
||||
|
|
2
semi.h
2
semi.h
|
@ -302,8 +302,6 @@ static int parse_options(int argc, struct gc_option argv[],
|
|||
return 1;
|
||||
}
|
||||
|
||||
#define GC_ASSERT_EQ(a, b) GC_ASSERT((a) == (b))
|
||||
|
||||
static int gc_init(int argc, struct gc_option argv[],
|
||||
struct heap **heap, struct mutator **mut) {
|
||||
GC_ASSERT_EQ(gc_allocator_allocation_pointer_offset(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue