diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-08-05 11:03:53 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-08-06 18:45:40 +0900 |
commit | acd27e3ec3f89d06fb63c24e0fb4ee597af9ad36 (patch) | |
tree | 298f74f8b8f6e027b636192c2665fc30e2a58a3a /gc.c | |
parent | 3651f985f0d950b636b3b75528855a25293c48b6 (diff) |
Move `GC_CAN_COMPILE_COMPACTION` definition before used
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/8181
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 20 |
1 files changed, 13 insertions, 7 deletions
@@ -327,6 +327,14 @@ rb_gc_guarded_ptr_val(volatile VALUE *ptr, VALUE val) #define GC_OLDMALLOC_LIMIT_MAX (128 * 1024 * 1024 /* 128MB */) #endif +#ifndef GC_CAN_COMPILE_COMPACTION +#if defined(__wasi__) /* WebAssembly doesn't support signals */ +# define GC_CAN_COMPILE_COMPACTION 0 +#else +# define GC_CAN_COMPILE_COMPACTION 1 +#endif +#endif + #ifndef PRINT_MEASURE_LINE #define PRINT_MEASURE_LINE 0 #endif @@ -2249,6 +2257,7 @@ heap_assign_page(rb_objspace_t *objspace, rb_size_pool_t *size_pool, rb_heap_t * heap_add_freepage(heap, page); } +#if GC_CAN_COMPILE_COMPACTION static void heap_add_pages(rb_objspace_t *objspace, rb_size_pool_t *size_pool, rb_heap_t *heap, size_t add) { @@ -2262,6 +2271,7 @@ heap_add_pages(rb_objspace_t *objspace, rb_size_pool_t *size_pool, rb_heap_t *he GC_ASSERT(size_pool->allocatable_pages == 0); } +#endif static size_t minimum_pages_for_size_pool(rb_objspace_t *objspace, int size_pool_idx) @@ -5183,14 +5193,8 @@ gc_unprotect_pages(rb_objspace_t *objspace, rb_heap_t *heap) } static void gc_update_references(rb_objspace_t * objspace); +#if GC_CAN_COMPILE_COMPACTION static void invalidate_moved_page(rb_objspace_t *objspace, struct heap_page *page); - -#ifndef GC_CAN_COMPILE_COMPACTION -#if defined(__wasi__) /* WebAssembly doesn't support signals */ -# define GC_CAN_COMPILE_COMPACTION 0 -#else -# define GC_CAN_COMPILE_COMPACTION 1 -#endif #endif #if defined(__MINGW32__) || defined(_WIN32) @@ -5879,6 +5883,7 @@ gc_sweep_continue(rb_objspace_t *objspace, rb_size_pool_t *sweep_size_pool, rb_h gc_sweeping_exit(objspace); } +#if GC_CAN_COMPILE_COMPACTION static void invalidate_moved_plane(rb_objspace_t *objspace, struct heap_page *page, uintptr_t p, bits_t bitset) { @@ -5951,6 +5956,7 @@ invalidate_moved_page(rb_objspace_t *objspace, struct heap_page *page) p += BITS_BITLENGTH * BASE_SLOT_SIZE; } } +#endif static void gc_compact_start(rb_objspace_t *objspace) |