mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-27 13:30:31 +02:00
Merge remote-tracking branch 'whippet/main' into wip-whippet
This commit is contained in:
commit
b6236fdcdc
13 changed files with 82 additions and 48 deletions
|
@ -490,6 +490,10 @@ static void on_collection_event(GC_EventType event) {
|
|||
// Sloppily attribute finalizers and eager reclamation to
|
||||
// ephemerons.
|
||||
HEAP_EVENT(ephemerons_traced);
|
||||
// FIXME: This overestimates the live data size, as blocks that have at
|
||||
// least one live object will be lazily swept, and free space discovered in
|
||||
// those objects will be added to GC_bytes_found, which would need to be
|
||||
// subtracted from this value.
|
||||
HEAP_EVENT(live_data_size, GC_get_heap_size() - GC_get_free_bytes());
|
||||
break;
|
||||
case GC_EVENT_END:
|
||||
|
@ -517,7 +521,7 @@ uint64_t gc_allocation_counter(struct gc_heap *heap) {
|
|||
return GC_get_total_bytes();
|
||||
}
|
||||
|
||||
int gc_init(const struct gc_options *options, struct gc_stack_addr *stack_base,
|
||||
int gc_init(const struct gc_options *options, struct gc_stack_addr stack_base,
|
||||
struct gc_heap **heap, struct gc_mutator **mutator,
|
||||
struct gc_event_listener event_listener,
|
||||
void *event_listener_data) {
|
||||
|
@ -613,9 +617,9 @@ int gc_init(const struct gc_options *options, struct gc_stack_addr *stack_base,
|
|||
return 1;
|
||||
}
|
||||
|
||||
struct gc_mutator* gc_init_for_thread(struct gc_stack_addr *stack_base,
|
||||
struct gc_mutator* gc_init_for_thread(struct gc_stack_addr stack_base,
|
||||
struct gc_heap *heap) {
|
||||
struct GC_stack_base base = { stack_base };
|
||||
struct GC_stack_base base = { gc_stack_addr_as_pointer (stack_base) };
|
||||
GC_register_my_thread(&base);
|
||||
return add_mutator(heap);
|
||||
}
|
||||
|
|
|
@ -26,40 +26,37 @@ static uintptr_t current_thread_hot_stack_addr(void) {
|
|||
// FIXME: check platform stack growth direction.
|
||||
#define HOTTER_THAN <=
|
||||
|
||||
static void capture_current_thread_hot_stack_addr(struct gc_stack_addr *addr) {
|
||||
addr->addr = current_thread_hot_stack_addr();
|
||||
static struct gc_stack_addr capture_current_thread_hot_stack_addr(void) {
|
||||
return gc_stack_addr(current_thread_hot_stack_addr());
|
||||
}
|
||||
|
||||
static void capture_current_thread_cold_stack_addr(struct gc_stack_addr *addr) {
|
||||
addr->addr = gc_platform_current_thread_stack_base();
|
||||
static struct gc_stack_addr capture_current_thread_cold_stack_addr(void) {
|
||||
return gc_stack_addr(gc_platform_current_thread_stack_base());
|
||||
}
|
||||
|
||||
void gc_stack_init(struct gc_stack *stack, struct gc_stack_addr *base) {
|
||||
if (base)
|
||||
stack->cold = *base;
|
||||
else
|
||||
capture_current_thread_cold_stack_addr(&stack->cold);
|
||||
stack->hot = stack->cold;
|
||||
void gc_stack_init(struct gc_stack *stack, struct gc_stack_addr base) {
|
||||
if (gc_stack_addr_is_empty (base))
|
||||
base = capture_current_thread_cold_stack_addr();
|
||||
stack->cold = stack->hot = base;
|
||||
}
|
||||
|
||||
void gc_stack_capture_hot(struct gc_stack *stack) {
|
||||
capture_current_thread_hot_stack_addr(&stack->hot);
|
||||
stack->hot = capture_current_thread_hot_stack_addr();
|
||||
setjmp(stack->registers);
|
||||
GC_ASSERT(stack->hot.addr HOTTER_THAN stack->cold.addr);
|
||||
}
|
||||
|
||||
static void* call_with_stack(void* (*)(struct gc_stack_addr*, void*),
|
||||
struct gc_stack_addr*, void*) GC_NEVER_INLINE;
|
||||
static void* call_with_stack(void* (*f)(struct gc_stack_addr *, void *),
|
||||
struct gc_stack_addr *addr, void *arg) {
|
||||
static void* call_with_stack(void* (*)(struct gc_stack_addr, void*),
|
||||
struct gc_stack_addr, void*) GC_NEVER_INLINE;
|
||||
static void* call_with_stack(void* (*f)(struct gc_stack_addr, void *),
|
||||
struct gc_stack_addr addr, void *arg) {
|
||||
return f(addr, arg);
|
||||
}
|
||||
void* gc_call_with_stack_addr(void* (*f)(struct gc_stack_addr *base,
|
||||
void* gc_call_with_stack_addr(void* (*f)(struct gc_stack_addr base,
|
||||
void *arg),
|
||||
void *arg) {
|
||||
struct gc_stack_addr base;
|
||||
capture_current_thread_hot_stack_addr(&base);
|
||||
return call_with_stack(f, &base, arg);
|
||||
struct gc_stack_addr base = capture_current_thread_hot_stack_addr();
|
||||
return call_with_stack(f, base, arg);
|
||||
}
|
||||
|
||||
void gc_stack_visit(struct gc_stack *stack,
|
||||
|
|
|
@ -6,12 +6,9 @@
|
|||
#endif
|
||||
|
||||
#include "gc-inline.h"
|
||||
#include "gc-stack-addr.h"
|
||||
#include <setjmp.h>
|
||||
|
||||
struct gc_stack_addr {
|
||||
uintptr_t addr;
|
||||
};
|
||||
|
||||
struct gc_stack {
|
||||
struct gc_stack_addr cold;
|
||||
struct gc_stack_addr hot;
|
||||
|
@ -21,7 +18,7 @@ struct gc_stack {
|
|||
struct gc_heap;
|
||||
|
||||
GC_INTERNAL void gc_stack_init(struct gc_stack *stack,
|
||||
struct gc_stack_addr *base);
|
||||
struct gc_stack_addr base);
|
||||
GC_INTERNAL void gc_stack_capture_hot(struct gc_stack *stack);
|
||||
GC_INTERNAL void gc_stack_visit(struct gc_stack *stack,
|
||||
void (*visit)(uintptr_t low, uintptr_t high,
|
||||
|
|
|
@ -1148,7 +1148,7 @@ heap_init(struct gc_heap *heap, const struct gc_options *options) {
|
|||
}
|
||||
|
||||
int
|
||||
gc_init(const struct gc_options *options, struct gc_stack_addr *stack_base,
|
||||
gc_init(const struct gc_options *options, struct gc_stack_addr stack_base,
|
||||
struct gc_heap **heap, struct gc_mutator **mut,
|
||||
struct gc_event_listener event_listener,
|
||||
void *event_listener_data) {
|
||||
|
@ -1217,8 +1217,7 @@ gc_init(const struct gc_options *options, struct gc_stack_addr *stack_base,
|
|||
}
|
||||
|
||||
struct gc_mutator*
|
||||
gc_init_for_thread(struct gc_stack_addr *stack_base,
|
||||
struct gc_heap *heap) {
|
||||
gc_init_for_thread(struct gc_stack_addr stack_base, struct gc_heap *heap) {
|
||||
struct gc_mutator *ret = calloc(1, sizeof(struct gc_mutator));
|
||||
if (!ret)
|
||||
GC_CRASH();
|
||||
|
|
|
@ -1218,7 +1218,7 @@ static int heap_init(struct gc_heap *heap, const struct gc_options *options) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int gc_init(const struct gc_options *options, struct gc_stack_addr *stack_base,
|
||||
int gc_init(const struct gc_options *options, struct gc_stack_addr stack_base,
|
||||
struct gc_heap **heap, struct gc_mutator **mut,
|
||||
struct gc_event_listener event_listener,
|
||||
void *event_listener_data) {
|
||||
|
@ -1294,7 +1294,7 @@ int gc_init(const struct gc_options *options, struct gc_stack_addr *stack_base,
|
|||
return 1;
|
||||
}
|
||||
|
||||
struct gc_mutator* gc_init_for_thread(struct gc_stack_addr *stack_base,
|
||||
struct gc_mutator* gc_init_for_thread(struct gc_stack_addr stack_base,
|
||||
struct gc_heap *heap) {
|
||||
struct gc_mutator *ret = calloc(1, sizeof(struct gc_mutator));
|
||||
if (!ret)
|
||||
|
|
|
@ -670,7 +670,7 @@ int gc_options_parse_and_set(struct gc_options *options, int option,
|
|||
return gc_common_options_parse_and_set(&options->common, option, value);
|
||||
}
|
||||
|
||||
int gc_init(const struct gc_options *options, struct gc_stack_addr *stack_base,
|
||||
int gc_init(const struct gc_options *options, struct gc_stack_addr stack_base,
|
||||
struct gc_heap **heap, struct gc_mutator **mut,
|
||||
struct gc_event_listener event_listener,
|
||||
void *event_listener_data) {
|
||||
|
@ -722,7 +722,7 @@ void gc_heap_set_extern_space(struct gc_heap *heap,
|
|||
heap->extern_space = space;
|
||||
}
|
||||
|
||||
struct gc_mutator* gc_init_for_thread(struct gc_stack_addr *base,
|
||||
struct gc_mutator* gc_init_for_thread(struct gc_stack_addr base,
|
||||
struct gc_heap *heap) {
|
||||
fprintf(stderr,
|
||||
"Semispace copying collector not appropriate for multithreaded use.\n");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue