mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-07-04 16:50:25 +02:00
Merge remote-tracking branch 'whippet/main' into wip-whippet
This commit is contained in:
commit
24f5e43e61
9 changed files with 53 additions and 100 deletions
|
@ -92,4 +92,8 @@ static inline int gc_can_pin_objects(void) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int gc_can_move_objects(void) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // BDW_ATTRS_H
|
#endif // BDW_ATTRS_H
|
||||||
|
|
|
@ -65,6 +65,7 @@ enum gc_cooperative_safepoint_kind {
|
||||||
static inline enum gc_cooperative_safepoint_kind gc_cooperative_safepoint_kind(void) GC_ALWAYS_INLINE;
|
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;
|
static inline int gc_can_pin_objects(void) GC_ALWAYS_INLINE;
|
||||||
|
static inline int gc_can_move_objects(void) GC_ALWAYS_INLINE;
|
||||||
|
|
||||||
#ifndef GC_IMPL
|
#ifndef GC_IMPL
|
||||||
#ifdef GC_ATTRS
|
#ifdef GC_ATTRS
|
||||||
|
|
|
@ -35,30 +35,18 @@ static inline uint8_t gc_allocator_alloc_table_begin_pattern(enum gc_allocation_
|
||||||
uint8_t trace_precisely = 0;
|
uint8_t trace_precisely = 0;
|
||||||
uint8_t trace_none = 8;
|
uint8_t trace_none = 8;
|
||||||
uint8_t trace_conservatively = 16;
|
uint8_t trace_conservatively = 16;
|
||||||
uint8_t pinned = 16;
|
switch (kind) {
|
||||||
if (GC_CONSERVATIVE_TRACE) {
|
case GC_ALLOCATION_TAGGED:
|
||||||
switch (kind) {
|
return young | trace_precisely;
|
||||||
case GC_ALLOCATION_TAGGED:
|
case GC_ALLOCATION_UNTAGGED_CONSERVATIVE:
|
||||||
case GC_ALLOCATION_UNTAGGED_CONSERVATIVE:
|
if (!GC_CONSERVATIVE_TRACE)
|
||||||
return young | trace_conservatively;
|
GC_CRASH ();
|
||||||
case GC_ALLOCATION_TAGGED_POINTERLESS:
|
return young | trace_conservatively;
|
||||||
case GC_ALLOCATION_UNTAGGED_POINTERLESS:
|
case GC_ALLOCATION_TAGGED_POINTERLESS:
|
||||||
return young | trace_none;
|
case GC_ALLOCATION_UNTAGGED_POINTERLESS:
|
||||||
default:
|
return young | trace_none;
|
||||||
GC_CRASH();
|
default:
|
||||||
};
|
GC_CRASH();
|
||||||
} else {
|
|
||||||
switch (kind) {
|
|
||||||
case GC_ALLOCATION_TAGGED:
|
|
||||||
return young | trace_precisely;
|
|
||||||
case GC_ALLOCATION_TAGGED_POINTERLESS:
|
|
||||||
return young | trace_none;
|
|
||||||
case GC_ALLOCATION_UNTAGGED_POINTERLESS:
|
|
||||||
return young | trace_none | pinned;
|
|
||||||
case GC_ALLOCATION_UNTAGGED_CONSERVATIVE:
|
|
||||||
default:
|
|
||||||
GC_CRASH();
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static inline uint8_t gc_allocator_alloc_table_end_pattern(void) {
|
static inline uint8_t gc_allocator_alloc_table_end_pattern(void) {
|
||||||
|
@ -117,4 +105,8 @@ static inline int gc_can_pin_objects(void) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int gc_can_move_objects(void) {
|
||||||
|
return GC_CONSERVATIVE_TRACE ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // MMC_ATTRS_H
|
#endif // MMC_ATTRS_H
|
||||||
|
|
|
@ -89,4 +89,8 @@ static inline int gc_can_pin_objects(void) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int gc_can_move_objects(void) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // PCC_ATTRS_H
|
#endif // PCC_ATTRS_H
|
||||||
|
|
|
@ -78,4 +78,8 @@ static inline int gc_can_pin_objects(void) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int gc_can_move_objects(void) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // SEMI_ATTRS_H
|
#endif // SEMI_ATTRS_H
|
||||||
|
|
|
@ -12,13 +12,12 @@ static inline size_t gc_finalizer_priority_count(void) { return 2; }
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
gc_is_valid_conservative_ref_displacement(uintptr_t displacement) {
|
gc_is_valid_conservative_ref_displacement(uintptr_t displacement) {
|
||||||
#if GC_CONSERVATIVE_ROOTS || GC_CONSERVATIVE_TRACE
|
if (GC_CONSERVATIVE_ROOTS || GC_CONSERVATIVE_TRACE)
|
||||||
// Here is where you would allow tagged heap object references.
|
// Here is where you would allow tagged heap object references.
|
||||||
return displacement == 0;
|
return displacement == 0;
|
||||||
#else
|
|
||||||
// Shouldn't get here.
|
// Shouldn't get here.
|
||||||
GC_CRASH();
|
GC_CRASH();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// No external objects in simple benchmarks.
|
// No external objects in simple benchmarks.
|
||||||
|
@ -40,10 +39,6 @@ static inline void gc_trace_object(struct gc_ref ref,
|
||||||
struct gc_heap *heap,
|
struct gc_heap *heap,
|
||||||
void *trace_data,
|
void *trace_data,
|
||||||
size_t *size) {
|
size_t *size) {
|
||||||
#if GC_CONSERVATIVE_TRACE
|
|
||||||
// Shouldn't get here.
|
|
||||||
GC_CRASH();
|
|
||||||
#else
|
|
||||||
switch (tag_live_alloc_kind(*tag_word(ref))) {
|
switch (tag_live_alloc_kind(*tag_word(ref))) {
|
||||||
#define SCAN_OBJECT(name, Name, NAME) \
|
#define SCAN_OBJECT(name, Name, NAME) \
|
||||||
case ALLOC_KIND_##NAME: \
|
case ALLOC_KIND_##NAME: \
|
||||||
|
@ -58,7 +53,6 @@ static inline void gc_trace_object(struct gc_ref ref,
|
||||||
default:
|
default:
|
||||||
GC_CRASH();
|
GC_CRASH();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void visit_roots(struct handle *roots,
|
static inline void visit_roots(struct handle *roots,
|
||||||
|
|
|
@ -31,8 +31,7 @@ static inline int gc_has_conservative_roots(void) {
|
||||||
enum gc_trace_kind {
|
enum gc_trace_kind {
|
||||||
GC_TRACE_PRECISELY,
|
GC_TRACE_PRECISELY,
|
||||||
GC_TRACE_NONE,
|
GC_TRACE_NONE,
|
||||||
GC_TRACE_CONSERVATIVELY,
|
GC_TRACE_CONSERVATIVELY
|
||||||
GC_TRACE_EPHEMERON,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct gc_trace_plan {
|
struct gc_trace_plan {
|
||||||
|
|
|
@ -435,10 +435,6 @@ trace_one(struct gc_ref ref, struct gc_heap *heap,
|
||||||
heap, worker);
|
heap, worker);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GC_TRACE_EPHEMERON:
|
|
||||||
gc_trace_ephemeron(gc_ref_heap_object(ref), tracer_visit, heap,
|
|
||||||
worker);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
GC_CRASH();
|
GC_CRASH();
|
||||||
}
|
}
|
||||||
|
@ -1031,28 +1027,18 @@ void gc_safepoint_signal_reallow(struct gc_mutator *mut) { GC_CRASH(); }
|
||||||
|
|
||||||
static enum gc_trace_kind
|
static enum gc_trace_kind
|
||||||
compute_trace_kind(enum gc_allocation_kind kind) {
|
compute_trace_kind(enum gc_allocation_kind kind) {
|
||||||
if (GC_CONSERVATIVE_TRACE) {
|
switch (kind) {
|
||||||
switch (kind) {
|
case GC_ALLOCATION_TAGGED:
|
||||||
case GC_ALLOCATION_TAGGED:
|
return GC_TRACE_PRECISELY;
|
||||||
case GC_ALLOCATION_UNTAGGED_CONSERVATIVE:
|
case GC_ALLOCATION_UNTAGGED_CONSERVATIVE:
|
||||||
return GC_TRACE_CONSERVATIVELY;
|
if (!GC_CONSERVATIVE_TRACE)
|
||||||
case GC_ALLOCATION_TAGGED_POINTERLESS:
|
GC_CRASH ();
|
||||||
case GC_ALLOCATION_UNTAGGED_POINTERLESS:
|
return GC_TRACE_CONSERVATIVELY;
|
||||||
return GC_TRACE_NONE;
|
case GC_ALLOCATION_TAGGED_POINTERLESS:
|
||||||
default:
|
case GC_ALLOCATION_UNTAGGED_POINTERLESS:
|
||||||
GC_CRASH();
|
return GC_TRACE_NONE;
|
||||||
};
|
default:
|
||||||
} else {
|
GC_CRASH();
|
||||||
switch (kind) {
|
|
||||||
case GC_ALLOCATION_TAGGED:
|
|
||||||
return GC_TRACE_PRECISELY;
|
|
||||||
case GC_ALLOCATION_TAGGED_POINTERLESS:
|
|
||||||
case GC_ALLOCATION_UNTAGGED_POINTERLESS:
|
|
||||||
return GC_TRACE_NONE;
|
|
||||||
case GC_ALLOCATION_UNTAGGED_CONSERVATIVE:
|
|
||||||
default:
|
|
||||||
GC_CRASH();
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1164,11 +1150,7 @@ gc_write_barrier_slow(struct gc_mutator *mut, struct gc_ref obj,
|
||||||
|
|
||||||
struct gc_ephemeron*
|
struct gc_ephemeron*
|
||||||
gc_allocate_ephemeron(struct gc_mutator *mut) {
|
gc_allocate_ephemeron(struct gc_mutator *mut) {
|
||||||
struct gc_ref ret =
|
return gc_allocate (mut, gc_ephemeron_size(), GC_ALLOCATION_TAGGED);
|
||||||
gc_ref_from_heap_object(gc_allocate(mut, gc_ephemeron_size(),
|
|
||||||
GC_ALLOCATION_TAGGED));
|
|
||||||
nofl_space_set_ephemeron_flag(ret);
|
|
||||||
return gc_ref_heap_object(ret);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1367,20 +1349,13 @@ gc_init(const struct gc_options *options, struct gc_stack_addr stack_base,
|
||||||
GC_ASSERT_EQ(gc_allocator_alloc_table_alignment(), NOFL_SLAB_SIZE);
|
GC_ASSERT_EQ(gc_allocator_alloc_table_alignment(), NOFL_SLAB_SIZE);
|
||||||
GC_ASSERT_EQ(gc_allocator_alloc_table_begin_pattern(GC_ALLOCATION_TAGGED_POINTERLESS),
|
GC_ASSERT_EQ(gc_allocator_alloc_table_begin_pattern(GC_ALLOCATION_TAGGED_POINTERLESS),
|
||||||
NOFL_METADATA_BYTE_YOUNG | NOFL_METADATA_BYTE_TRACE_NONE);
|
NOFL_METADATA_BYTE_YOUNG | NOFL_METADATA_BYTE_TRACE_NONE);
|
||||||
if (GC_CONSERVATIVE_TRACE) {
|
GC_ASSERT_EQ(gc_allocator_alloc_table_begin_pattern(GC_ALLOCATION_TAGGED),
|
||||||
GC_ASSERT_EQ(gc_allocator_alloc_table_begin_pattern(GC_ALLOCATION_TAGGED),
|
NOFL_METADATA_BYTE_YOUNG | NOFL_METADATA_BYTE_TRACE_PRECISELY);
|
||||||
NOFL_METADATA_BYTE_YOUNG | NOFL_METADATA_BYTE_TRACE_CONSERVATIVELY);
|
if (GC_CONSERVATIVE_TRACE)
|
||||||
GC_ASSERT_EQ(gc_allocator_alloc_table_begin_pattern(GC_ALLOCATION_UNTAGGED_CONSERVATIVE),
|
GC_ASSERT_EQ(gc_allocator_alloc_table_begin_pattern(GC_ALLOCATION_UNTAGGED_CONSERVATIVE),
|
||||||
NOFL_METADATA_BYTE_YOUNG | NOFL_METADATA_BYTE_TRACE_CONSERVATIVELY);
|
NOFL_METADATA_BYTE_YOUNG | NOFL_METADATA_BYTE_TRACE_CONSERVATIVELY);
|
||||||
GC_ASSERT_EQ(gc_allocator_alloc_table_begin_pattern(GC_ALLOCATION_UNTAGGED_POINTERLESS),
|
GC_ASSERT_EQ(gc_allocator_alloc_table_begin_pattern(GC_ALLOCATION_UNTAGGED_POINTERLESS),
|
||||||
NOFL_METADATA_BYTE_YOUNG | NOFL_METADATA_BYTE_TRACE_NONE);
|
NOFL_METADATA_BYTE_YOUNG | NOFL_METADATA_BYTE_TRACE_NONE);
|
||||||
} else {
|
|
||||||
GC_ASSERT_EQ(gc_allocator_alloc_table_begin_pattern(GC_ALLOCATION_TAGGED),
|
|
||||||
NOFL_METADATA_BYTE_YOUNG | NOFL_METADATA_BYTE_TRACE_PRECISELY);
|
|
||||||
GC_ASSERT_EQ(gc_allocator_alloc_table_begin_pattern(GC_ALLOCATION_UNTAGGED_POINTERLESS),
|
|
||||||
NOFL_METADATA_BYTE_YOUNG | NOFL_METADATA_BYTE_TRACE_NONE |
|
|
||||||
NOFL_METADATA_BYTE_PINNED);
|
|
||||||
}
|
|
||||||
GC_ASSERT_EQ(gc_allocator_alloc_table_end_pattern(), NOFL_METADATA_BYTE_END);
|
GC_ASSERT_EQ(gc_allocator_alloc_table_end_pattern(), NOFL_METADATA_BYTE_END);
|
||||||
if (GC_GENERATIONAL) {
|
if (GC_GENERATIONAL) {
|
||||||
GC_ASSERT_EQ(gc_write_barrier_field_table_alignment(), NOFL_SLAB_SIZE);
|
GC_ASSERT_EQ(gc_write_barrier_field_table_alignment(), NOFL_SLAB_SIZE);
|
||||||
|
|
|
@ -250,7 +250,7 @@ enum nofl_metadata_byte {
|
||||||
NOFL_METADATA_BYTE_TRACE_PRECISELY = 0,
|
NOFL_METADATA_BYTE_TRACE_PRECISELY = 0,
|
||||||
NOFL_METADATA_BYTE_TRACE_NONE = 8,
|
NOFL_METADATA_BYTE_TRACE_NONE = 8,
|
||||||
NOFL_METADATA_BYTE_TRACE_CONSERVATIVELY = 16,
|
NOFL_METADATA_BYTE_TRACE_CONSERVATIVELY = 16,
|
||||||
NOFL_METADATA_BYTE_TRACE_EPHEMERON = 24,
|
NOFL_METADATA_BYTE_TRACE_UNUSED = 24,
|
||||||
NOFL_METADATA_BYTE_TRACE_KIND_MASK = 0|8|16|24,
|
NOFL_METADATA_BYTE_TRACE_KIND_MASK = 0|8|16|24,
|
||||||
NOFL_METADATA_BYTE_PINNED = 16,
|
NOFL_METADATA_BYTE_PINNED = 16,
|
||||||
NOFL_METADATA_BYTE_END = 32,
|
NOFL_METADATA_BYTE_END = 32,
|
||||||
|
@ -971,22 +971,6 @@ nofl_finish_sweeping(struct nofl_allocator *alloc,
|
||||||
while (nofl_allocator_next_hole(alloc, space, 0)) {}
|
while (nofl_allocator_next_hole(alloc, space, 0)) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
|
||||||
nofl_is_ephemeron(struct gc_ref ref) {
|
|
||||||
uint8_t meta = *nofl_metadata_byte_for_object(ref);
|
|
||||||
uint8_t kind = meta & NOFL_METADATA_BYTE_TRACE_KIND_MASK;
|
|
||||||
return kind == NOFL_METADATA_BYTE_TRACE_EPHEMERON;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
nofl_space_set_ephemeron_flag(struct gc_ref ref) {
|
|
||||||
if (gc_has_conservative_intraheap_edges()) {
|
|
||||||
uint8_t *metadata = nofl_metadata_byte_for_object(ref);
|
|
||||||
uint8_t byte = *metadata & ~NOFL_METADATA_BYTE_TRACE_KIND_MASK;
|
|
||||||
*metadata = byte | NOFL_METADATA_BYTE_TRACE_EPHEMERON;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct gc_trace_worker;
|
struct gc_trace_worker;
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
|
@ -1828,8 +1812,6 @@ nofl_metadata_byte_trace_kind(uint8_t byte)
|
||||||
#if GC_CONSERVATIVE_TRACE
|
#if GC_CONSERVATIVE_TRACE
|
||||||
case NOFL_METADATA_BYTE_TRACE_CONSERVATIVELY:
|
case NOFL_METADATA_BYTE_TRACE_CONSERVATIVELY:
|
||||||
return GC_TRACE_CONSERVATIVELY;
|
return GC_TRACE_CONSERVATIVELY;
|
||||||
case NOFL_METADATA_BYTE_TRACE_EPHEMERON:
|
|
||||||
return GC_TRACE_EPHEMERON;
|
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
GC_CRASH();
|
GC_CRASH();
|
||||||
|
@ -1849,8 +1831,6 @@ nofl_space_object_trace_plan(struct nofl_space *space, struct gc_ref ref) {
|
||||||
size_t granules = nofl_space_live_object_granules(loc);
|
size_t granules = nofl_space_live_object_granules(loc);
|
||||||
return (struct gc_trace_plan){ kind, granules * NOFL_GRANULE_SIZE };
|
return (struct gc_trace_plan){ kind, granules * NOFL_GRANULE_SIZE };
|
||||||
}
|
}
|
||||||
case GC_TRACE_EPHEMERON:
|
|
||||||
return (struct gc_trace_plan){ kind, };
|
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
GC_CRASH();
|
GC_CRASH();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue