Rename GC_COMPACTION_SUPPORTED
Naming this macro GC_COMPACTION_SUPPORTED is misleading because it only checks whether compaction is supported at compile time. [Bug #18829]
This commit is contained in:
parent
2223eb082a
commit
52d42e7023
Notes:
git
2022-06-16 23:19:13 +09:00
28
gc.c
28
gc.c
@ -5184,15 +5184,15 @@ gc_unprotect_pages(rb_objspace_t *objspace, rb_heap_t *heap)
|
||||
static void gc_update_references(rb_objspace_t * objspace);
|
||||
static void invalidate_moved_page(rb_objspace_t *objspace, struct heap_page *page);
|
||||
|
||||
#ifndef GC_COMPACTION_SUPPORTED
|
||||
#ifndef GC_CAN_COMPILE_COMPACTION
|
||||
#if defined(__wasi__) /* WebAssembly doesn't support signals */
|
||||
# define GC_COMPACTION_SUPPORTED 0
|
||||
# define GC_CAN_COMPILE_COMPACTION 0
|
||||
#else
|
||||
# define GC_COMPACTION_SUPPORTED 1
|
||||
# define GC_CAN_COMPILE_COMPACTION 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if GC_COMPACTION_SUPPORTED
|
||||
#if GC_CAN_COMPILE_COMPACTION
|
||||
static void
|
||||
read_barrier_handler(uintptr_t address)
|
||||
{
|
||||
@ -5215,7 +5215,7 @@ read_barrier_handler(uintptr_t address)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !GC_COMPACTION_SUPPORTED
|
||||
#if !GC_CAN_COMPILE_COMPACTION
|
||||
static void
|
||||
uninstall_handlers(void)
|
||||
{
|
||||
@ -9575,7 +9575,7 @@ gc_start_internal(rb_execution_context_t *ec, VALUE self, VALUE full_mark, VALUE
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !GC_COMPACTION_SUPPORTED
|
||||
#if !GC_CAN_COMPILE_COMPACTION
|
||||
rb_raise(rb_eNotImpError, "Compaction isn't available on this platform");
|
||||
#endif
|
||||
|
||||
@ -9742,7 +9742,7 @@ gc_move(rb_objspace_t *objspace, VALUE scan, VALUE free, size_t src_slot_size, s
|
||||
return (VALUE)src;
|
||||
}
|
||||
|
||||
#if GC_COMPACTION_SUPPORTED
|
||||
#if GC_CAN_COMPILE_COMPACTION
|
||||
static int
|
||||
compare_free_slots(const void *left, const void *right, void *dummy)
|
||||
{
|
||||
@ -10491,7 +10491,7 @@ gc_update_references(rb_objspace_t *objspace)
|
||||
gc_update_table_refs(objspace, finalizer_table);
|
||||
}
|
||||
|
||||
#if GC_COMPACTION_SUPPORTED
|
||||
#if GC_CAN_COMPILE_COMPACTION
|
||||
/*
|
||||
* call-seq:
|
||||
* GC.latest_compact_info -> {:considered=>{:T_CLASS=>11}, :moved=>{:T_CLASS=>11}}
|
||||
@ -10544,7 +10544,7 @@ gc_compact_stats(VALUE self)
|
||||
# define gc_compact_stats rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#if GC_COMPACTION_SUPPORTED
|
||||
#if GC_CAN_COMPILE_COMPACTION
|
||||
static void
|
||||
root_obj_check_moved_i(const char *category, VALUE obj, void *data)
|
||||
{
|
||||
@ -10623,7 +10623,7 @@ gc_compact(VALUE self)
|
||||
# define gc_compact rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#if GC_COMPACTION_SUPPORTED
|
||||
#if GC_CAN_COMPILE_COMPACTION
|
||||
static VALUE
|
||||
gc_verify_compaction_references(rb_execution_context_t *ec, VALUE self, VALUE double_heap, VALUE toward_empty)
|
||||
{
|
||||
@ -11250,7 +11250,7 @@ gc_disable(rb_execution_context_t *ec, VALUE _)
|
||||
return rb_gc_disable();
|
||||
}
|
||||
|
||||
#if GC_COMPACTION_SUPPORTED
|
||||
#if GC_CAN_COMPILE_COMPACTION
|
||||
/*
|
||||
* call-seq:
|
||||
* GC.auto_compact = flag
|
||||
@ -11279,7 +11279,7 @@ gc_set_auto_compact(VALUE _, VALUE v)
|
||||
# define gc_set_auto_compact rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#if GC_COMPACTION_SUPPORTED
|
||||
#if GC_CAN_COMPILE_COMPACTION
|
||||
/*
|
||||
* call-seq:
|
||||
* GC.auto_compact -> true or false
|
||||
@ -14154,7 +14154,7 @@ Init_GC(void)
|
||||
rb_define_singleton_method(rb_mGC, "auto_compact", gc_get_auto_compact, 0);
|
||||
rb_define_singleton_method(rb_mGC, "auto_compact=", gc_set_auto_compact, 1);
|
||||
rb_define_singleton_method(rb_mGC, "latest_compact_info", gc_compact_stats, 0);
|
||||
#if !GC_COMPACTION_SUPPORTED
|
||||
#if !GC_CAN_COMPILE_COMPACTION
|
||||
rb_define_singleton_method(rb_mGC, "verify_compaction_references", rb_f_notimplement, -1);
|
||||
#endif
|
||||
|
||||
@ -14180,7 +14180,7 @@ Init_GC(void)
|
||||
OPT(MALLOC_ALLOCATED_SIZE);
|
||||
OPT(MALLOC_ALLOCATED_SIZE_CHECK);
|
||||
OPT(GC_PROFILE_DETAIL_MEMORY);
|
||||
OPT(GC_COMPACTION_SUPPORTED);
|
||||
OPT(GC_CAN_COMPILE_COMPACTION);
|
||||
#undef OPT
|
||||
OBJ_FREEZE(opts);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user