From 0a4900c5291a8b04710abb63bf3f46bca0fa76fe Mon Sep 17 00:00:00 2001 From: Douglas Katzman Date: Sun, 19 Mar 2017 14:18:12 -0400 Subject: [PATCH] Rearrange/comment/remove some stuff * PAGE_BYTES is totally superfluous. * ALLOC_BOXED and ALLOC_UNBOXED are never used. --- src/runtime/gc-internal.h | 14 +++++++------- src/runtime/gc.h | 10 +++------- src/runtime/runtime.c | 2 +- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/runtime/gc-internal.h b/src/runtime/gc-internal.h index 23525e1fa..ae4b4e629 100644 --- a/src/runtime/gc-internal.h +++ b/src/runtime/gc-internal.h @@ -122,20 +122,17 @@ code_n_funs(struct code* code) { return fixnum_value((code)->n_entries) & 0x3FFF #define SIMPLE_FUN_SCAV_START(fun_ptr) &fun_ptr->name #define SIMPLE_FUN_SCAV_NWORDS(fun_ptr) ((lispobj*)fun_ptr->code - &fun_ptr->name) -#define WEAK_POINTER_NWORDS \ - CEILING((sizeof(struct weak_pointer) / sizeof(lispobj)), 2) - /* values for the *_alloc_* parameters, also see the commentary for - * struct page in gencgc-internal.h. FIXME: Perhaps these constants - * should be there, or at least defined on gencgc only? */ + * struct page in gencgc-internal.h. These constants are used in gc-common, + * so they can't easily be made gencgc-only */ #define FREE_PAGE_FLAG 0 #define BOXED_PAGE_FLAG 1 #define UNBOXED_PAGE_FLAG 2 #define OPEN_REGION_PAGE_FLAG 4 #define CODE_PAGE_FLAG (BOXED_PAGE_FLAG|UNBOXED_PAGE_FLAG) -#define ALLOC_BOXED 0 -#define ALLOC_UNBOXED 1 +// Gencgc distinguishes between "quick" and "ordinary" requests. +// Even on cheneygc we need this flag, but it's actually just ignored. #define ALLOC_QUICK 1 #ifdef LISP_FEATURE_GENCGC @@ -330,6 +327,9 @@ static inline boolean immobile_filler_p(lispobj* obj) { #endif /* immobile space */ +#define WEAK_POINTER_NWORDS \ + CEILING((sizeof(struct weak_pointer) / sizeof(lispobj)), 2) + static inline boolean weak_pointer_breakable_p(struct weak_pointer *wp) { lispobj pointee; diff --git a/src/runtime/gc.h b/src/runtime/gc.h index 0057bb8b1..35a783210 100644 --- a/src/runtime/gc.h +++ b/src/runtime/gc.h @@ -17,10 +17,9 @@ #define _GC_H_ #include "sbcl.h" +#include "os.h" #include -#define PAGE_BYTES BACKEND_PAGE_BYTES - typedef intptr_t page_index_t; #ifdef LISP_FEATURE_WIN32 #define PAGE_INDEX_FMT "Id" @@ -30,20 +29,17 @@ typedef intptr_t page_index_t; #define PAGE_INDEX_FMT "d" #endif +// This decl should probably be be in gencgc-internal, +// except it can't be: collect_garbage() receives a generation number. typedef signed char generation_index_t; extern void gc_init(void); extern void gc_initialize_pointers(void); extern void collect_garbage(generation_index_t last_gen); - -#include "os.h" - extern void set_auto_gc_trigger(os_vm_size_t usage); extern void clear_auto_gc_trigger(void); -#include "fixnump.h" - extern boolean maybe_gc(os_context_t *context); extern os_vm_size_t bytes_consed_between_gcs; diff --git a/src/runtime/runtime.c b/src/runtime/runtime.c index 385723f20..26b08dc69 100644 --- a/src/runtime/runtime.c +++ b/src/runtime/runtime.c @@ -615,7 +615,7 @@ main(int argc, char *argv[], char *envp[]) /* Align down to multiple of page_table page size, and to the appropriate * stack alignment. */ - dynamic_space_size &= ~(sword_t)(PAGE_BYTES-1); + dynamic_space_size &= ~(sword_t)(BACKEND_PAGE_BYTES-1); #ifdef LISP_FEATURE_GENCGC dynamic_space_size &= ~(sword_t)(GENCGC_CARD_BYTES-1); #endif -- 2.11.4.GIT