Ruby  2.4.2p198(2017-09-14revision59899)
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
gc.c File Reference
#include "internal.h"
#include "ruby/st.h"
#include "ruby/re.h"
#include "ruby/io.h"
#include "ruby/thread.h"
#include "ruby/util.h"
#include "ruby/debug.h"
#include "eval_intern.h"
#include "vm_core.h"
#include "gc.h"
#include "constant.h"
#include "ruby_atomic.h"
#include "probes.h"
#include "id_table.h"
#include <stdio.h>
#include <stdarg.h>
#include <setjmp.h>
#include <sys/types.h>
#include "ruby_assert.h"
#include "regint.h"
Include dependency graph for gc.c:

Go to the source code of this file.

Data Structures

struct  ruby_gc_params_t
 
struct  gc_profile_record
 
struct  RVALUE
 
struct  heap_page_header
 
struct  heap_page_body
 
struct  gc_list
 
struct  stack_chunk
 
struct  mark_stack
 
struct  rb_heap_struct
 
struct  rb_objspace
 
struct  rb_objspace::mark_func_data_struct
 
struct  heap_page
 
struct  RZombie
 
struct  each_obj_args
 
struct  os_each_struct
 
struct  force_finalize_list
 
struct  verify_internal_consistency_struct
 
struct  objspace_and_reason
 
struct  root_objects_data
 
struct  weakmap
 
struct  wmap_iter_arg
 

Macros

#define rb_data_object_alloc   rb_data_object_alloc
 
#define rb_data_typed_object_alloc   rb_data_typed_object_alloc
 
#define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS
 
#define rb_setjmp(env)   RUBY_SETJMP(env)
 
#define rb_jmp_buf   rb_jmpbuf_t
 
#define GC_HEAP_INIT_SLOTS   10000
 
#define GC_HEAP_FREE_SLOTS   4096
 
#define GC_HEAP_GROWTH_FACTOR   1.8
 
#define GC_HEAP_GROWTH_MAX_SLOTS   0 /* 0 is disable */
 
#define GC_HEAP_OLDOBJECT_LIMIT_FACTOR   2.0
 
#define GC_HEAP_FREE_SLOTS_MIN_RATIO   0.20
 
#define GC_HEAP_FREE_SLOTS_GOAL_RATIO   0.40
 
#define GC_HEAP_FREE_SLOTS_MAX_RATIO   0.65
 
#define GC_MALLOC_LIMIT_MIN   (16 * 1024 * 1024 /* 16MB */)
 
#define GC_MALLOC_LIMIT_MAX   (32 * 1024 * 1024 /* 32MB */)
 
#define GC_MALLOC_LIMIT_GROWTH_FACTOR   1.4
 
#define GC_OLDMALLOC_LIMIT_MIN   (16 * 1024 * 1024 /* 16MB */)
 
#define GC_OLDMALLOC_LIMIT_GROWTH_FACTOR   1.2
 
#define GC_OLDMALLOC_LIMIT_MAX   (128 * 1024 * 1024 /* 128MB */)
 
#define PRINT_MEASURE_LINE   0
 
#define PRINT_ENTER_EXIT_TICK   0
 
#define PRINT_ROOT_TICKS   0
 
#define USE_TICK_T   (PRINT_ENTER_EXIT_TICK || PRINT_MEASURE_LINE || PRINT_ROOT_TICKS)
 
#define TICK_TYPE   1
 
#define GC_DEBUG   0
 
#define RGENGC_DEBUG   0
 
#define RGENGC_CHECK_MODE   0
 
#define RGENGC_OLD_NEWOBJ_CHECK   0
 
#define RGENGC_PROFILE   0
 
#define RGENGC_ESTIMATE_OLDMALLOC   1
 
#define RGENGC_FORCE_MAJOR_GC   0
 
#define GC_PROFILE_MORE_DETAIL   0
 
#define GC_PROFILE_DETAIL_MEMORY   0
 
#define GC_ENABLE_INCREMENTAL_MARK   USE_RINCGC
 
#define GC_ENABLE_LAZY_SWEEP   1
 
#define CALC_EXACT_MALLOC_SIZE   0
 
#define MALLOC_ALLOCATED_SIZE   0
 
#define MALLOC_ALLOCATED_SIZE_CHECK   0
 
#define GC_DEBUG_STRESS_TO_CLASS   0
 
#define RGENGC_OBJ_INFO   (RGENGC_DEBUG | RGENGC_CHECK_MODE)
 
#define STACK_CHUNK_SIZE   500
 
#define HEAP_PAGE_ALIGN_LOG   14
 
#define CEILDIV(i, mod)   (((i) + (mod) - 1)/(mod))
 
#define GET_PAGE_BODY(x)   ((struct heap_page_body *)((bits_t)(x) & ~(HEAP_PAGE_ALIGN_MASK)))
 
#define GET_PAGE_HEADER(x)   (&GET_PAGE_BODY(x)->header)
 
#define GET_HEAP_PAGE(x)   (GET_PAGE_HEADER(x)->page)
 
#define NUM_IN_PAGE(p)   (((bits_t)(p) & HEAP_PAGE_ALIGN_MASK)/sizeof(RVALUE))
 
#define BITMAP_INDEX(p)   (NUM_IN_PAGE(p) / BITS_BITLENGTH )
 
#define BITMAP_OFFSET(p)   (NUM_IN_PAGE(p) & (BITS_BITLENGTH-1))
 
#define BITMAP_BIT(p)   ((bits_t)1 << BITMAP_OFFSET(p))
 
#define MARKED_IN_BITMAP(bits, p)   ((bits)[BITMAP_INDEX(p)] & BITMAP_BIT(p))
 
#define MARK_IN_BITMAP(bits, p)   ((bits)[BITMAP_INDEX(p)] = (bits)[BITMAP_INDEX(p)] | BITMAP_BIT(p))
 
#define CLEAR_IN_BITMAP(bits, p)   ((bits)[BITMAP_INDEX(p)] = (bits)[BITMAP_INDEX(p)] & ~BITMAP_BIT(p))
 
#define GET_HEAP_MARK_BITS(x)   (&GET_HEAP_PAGE(x)->mark_bits[0])
 
#define GET_HEAP_UNCOLLECTIBLE_BITS(x)   (&GET_HEAP_PAGE(x)->uncollectible_bits[0])
 
#define GET_HEAP_WB_UNPROTECTED_BITS(x)   (&GET_HEAP_PAGE(x)->wb_unprotected_bits[0])
 
#define GET_HEAP_MARKING_BITS(x)   (&GET_HEAP_PAGE(x)->marking_bits[0])
 
#define rb_objspace   (*rb_objspace_of(GET_VM()))
 
#define rb_objspace_of(vm)   ((vm)->objspace)
 
#define ruby_initial_gc_stress   gc_params.gc_stress
 
#define malloc_limit   objspace->malloc_params.limit
 
#define malloc_increase   objspace->malloc_params.increase
 
#define malloc_allocated_size   objspace->malloc_params.allocated_size
 
#define heap_pages_sorted   objspace->heap_pages.sorted
 
#define heap_allocated_pages   objspace->heap_pages.allocated_pages
 
#define heap_pages_sorted_length   objspace->heap_pages.sorted_length
 
#define heap_pages_lomem   objspace->heap_pages.range[0]
 
#define heap_pages_himem   objspace->heap_pages.range[1]
 
#define heap_allocatable_pages   objspace->heap_pages.allocatable_pages
 
#define heap_pages_freeable_pages   objspace->heap_pages.freeable_pages
 
#define heap_pages_final_slots   objspace->heap_pages.final_slots
 
#define heap_pages_deferred_final   objspace->heap_pages.deferred_final
 
#define heap_eden   (&objspace->eden_heap)
 
#define heap_tomb   (&objspace->tomb_heap)
 
#define dont_gc   objspace->flags.dont_gc
 
#define during_gc   objspace->flags.during_gc
 
#define finalizing   objspace->atomic_flags.finalizing
 
#define finalizer_table   objspace->finalizer_table
 
#define global_list   objspace->global_list
 
#define ruby_gc_stressful   objspace->flags.gc_stressful
 
#define ruby_gc_stress_mode   objspace->gc_stress_mode
 
#define stress_to_class   0
 
#define gc_mode(objspace)   gc_mode_verify((enum gc_mode)(objspace)->flags.mode)
 
#define gc_mode_set(objspace, mode)   ((objspace)->flags.mode = (unsigned int)gc_mode_verify(mode))
 
#define is_marking(objspace)   (gc_mode(objspace) == gc_mode_marking)
 
#define is_sweeping(objspace)   (gc_mode(objspace) == gc_mode_sweeping)
 
#define is_full_marking(objspace)   ((objspace)->flags.during_minor_gc == FALSE)
 
#define is_incremental_marking(objspace)   ((objspace)->flags.during_incremental_marking != FALSE)
 
#define will_be_incremental_marking(objspace)   ((objspace)->rgengc.need_major_gc != GPR_FLAG_NONE)
 
#define has_sweeping_pages(heap)   ((heap)->sweep_pages != 0)
 
#define is_lazy_sweeping(heap)   (GC_ENABLE_LAZY_SWEEP && has_sweeping_pages(heap))
 
#define nonspecial_obj_id(obj)   (VALUE)((SIGNED_VALUE)(obj)|FIXNUM_FLAG)
 
#define obj_id_to_ref(objid)   ((objid) ^ FIXNUM_FLAG) /* unset FIXNUM_FLAG */
 
#define RANY(o)   ((RVALUE*)(o))
 
#define RZOMBIE(o)   ((struct RZombie *)(o))
 
#define nomem_error   GET_VM()->special_exceptions[ruby_error_nomemory]
 
#define gc_prof_record(objspace)   (objspace)->profile.current_record
 
#define gc_prof_enabled(objspace)   ((objspace)->profile.run && (objspace)->profile.current_record)
 
#define gc_report   if (!(RGENGC_DEBUG)) {} else gc_report_body
 
#define PUSH_MARK_FUNC_DATA(v)
 
#define POP_MARK_FUNC_DATA()   objspace->mark_func_data = prev_mark_func_data;} while (0)
 
#define MEASURE_LINE(expr)   expr
 
#define FL_TEST2(x, f)   ((RGENGC_CHECK_MODE && SPECIAL_CONST_P(x)) ? (rb_bug("FL_TEST2: SPECIAL_CONST (%p)", (void *)(x)), 0) : FL_TEST_RAW((x),(f)) != 0)
 
#define FL_SET2(x, f)   do {if (RGENGC_CHECK_MODE && SPECIAL_CONST_P(x)) rb_bug("FL_SET2: SPECIAL_CONST"); RBASIC(x)->flags |= (f);} while (0)
 
#define FL_UNSET2(x, f)   do {if (RGENGC_CHECK_MODE && SPECIAL_CONST_P(x)) rb_bug("FL_UNSET2: SPECIAL_CONST"); RBASIC(x)->flags &= ~(f);} while (0)
 
#define RVALUE_MARK_BITMAP(obj)   MARKED_IN_BITMAP(GET_HEAP_MARK_BITS(obj), (obj))
 
#define RVALUE_PAGE_MARKED(page, obj)   MARKED_IN_BITMAP((page)->mark_bits, (obj))
 
#define RVALUE_WB_UNPROTECTED_BITMAP(obj)   MARKED_IN_BITMAP(GET_HEAP_WB_UNPROTECTED_BITS(obj), (obj))
 
#define RVALUE_UNCOLLECTIBLE_BITMAP(obj)   MARKED_IN_BITMAP(GET_HEAP_UNCOLLECTIBLE_BITS(obj), (obj))
 
#define RVALUE_MARKING_BITMAP(obj)   MARKED_IN_BITMAP(GET_HEAP_MARKING_BITS(obj), (obj))
 
#define RVALUE_PAGE_WB_UNPROTECTED(page, obj)   MARKED_IN_BITMAP((page)->wb_unprotected_bits, (obj))
 
#define RVALUE_PAGE_UNCOLLECTIBLE(page, obj)   MARKED_IN_BITMAP((page)->uncollectible_bits, (obj))
 
#define RVALUE_PAGE_MARKING(page, obj)   MARKED_IN_BITMAP((page)->marking_bits, (obj))
 
#define RVALUE_OLD_AGE   3
 
#define RVALUE_AGE_SHIFT   5 /* FL_PROMOTED0 bit */
 
#define gc_event_hook_available_p(objspace)   ((objspace)->flags.has_hook)
 
#define gc_event_hook_needed_p(objspace, event)   ((objspace)->hook_events & (event))
 
#define gc_event_hook(objspace, event, data)
 
#define RESTORE_FINALIZER()
 
#define NUM2PTR(x)   NUM2ULONG(x)
 
#define COUNT_TYPE(t)   case (t): type = ID2SYM(rb_intern(#t)); break;
 
#define SET_STACK_END   SET_MACHINE_STACK_END(&th->machine.stack_end)
 
#define STACK_START   (th->machine.stack_start)
 
#define STACK_END   (th->machine.stack_end)
 
#define STACK_LEVEL_MAX   (th->machine.stack_maxsize/sizeof(VALUE))
 
#define STACK_LENGTH
 
#define STACKFRAME_FOR_CALL_CFUNC   512
 
#define GET_STACK_BOUNDS(start, end, appendix)
 
#define MARK_CHECKPOINT_PRINT_TICK(category)
 
#define MARK_CHECKPOINT(category)
 
#define PROFILE_REMEMBERSET_MARK   0
 
#define I(s)   ID_##s = rb_intern(#s);
 
#define MARK_OBJECT_ARY_BUCKET_SIZE   1024
 
#define GC_NOTIFY   0
 
#define gc_stress_full_mark_after_malloc_p()   (FIXNUM_P(ruby_gc_stress_mode) && (FIX2LONG(ruby_gc_stress_mode) & (1<<gc_stress_full_mark_after_malloc)))
 
#define S(s)   sym_##s = ID2SYM(rb_intern_const(#s))
 
#define SET(name, attr)
 
#define S(s)   gc_stat_symbols[gc_stat_sym_##s] = ID2SYM(rb_intern_const(#s))
 
#define S(s)   gc_stat_compat_symbols[gc_stat_compat_sym_##s] = ID2SYM(rb_intern_const(#s))
 
#define OLD_SYM(s)   gc_stat_compat_symbols[gc_stat_compat_sym_##s]
 
#define NEW_SYM(s)   gc_stat_symbols[gc_stat_sym_##s]
 
#define SET(name, attr)
 
#define TRY_WITH_GC(alloc)
 
#define WMAP_DELETE_DEAD_OBJECT_IN_MARK   0
 
#define GC_PROFILE_RECORD_DEFAULT_SIZE   100
 
#define RUBY_DTRACE_GC_HOOK(name)   do {if (RUBY_DTRACE_GC_##name##_ENABLED()) RUBY_DTRACE_GC_##name();} while (0)
 
#define TYPE_NAME(t)   case (t): return #t;
 
#define ARY_SHARED_P(ary)
 
#define ARY_EMBED_P(ary)
 
#define TF(c)   ((c) != 0 ? "true" : "false")
 
#define C(c, s)   ((c) != 0 ? (s) : " ")
 
#define IMEMO_NAME(x)   case imemo_##x: imemo_name = #x; break;
 
#define OPT(o)   if (o) rb_ary_push(opts, rb_fstring_lit(#o))
 

Typedefs

typedef struct gc_profile_record gc_profile_record
 
typedef struct RVALUE RVALUE
 
typedef uintptr_t bits_t
 
typedef struct stack_chunk stack_chunk_t
 
typedef struct mark_stack mark_stack_t
 
typedef struct rb_heap_struct rb_heap_t
 
typedef struct rb_objspace rb_objspace_t
 
typedef int each_obj_callback(void *, void *, size_t, void *)
 

Enumerations

enum  gc_profile_record_flag {
  GPR_FLAG_NONE = 0x000, GPR_FLAG_MAJOR_BY_NOFREE = 0x001, GPR_FLAG_MAJOR_BY_OLDGEN = 0x002, GPR_FLAG_MAJOR_BY_SHADY = 0x004,
  GPR_FLAG_MAJOR_BY_FORCE = 0x008, GPR_FLAG_MAJOR_BY_OLDMALLOC = 0x020, GPR_FLAG_MAJOR_MASK = 0x0ff, GPR_FLAG_NEWOBJ = 0x100,
  GPR_FLAG_MALLOC = 0x200, GPR_FLAG_METHOD = 0x400, GPR_FLAG_CAPI = 0x800, GPR_FLAG_STRESS = 0x1000,
  GPR_FLAG_IMMEDIATE_SWEEP = 0x2000, GPR_FLAG_HAVE_FINALIZE = 0x4000
}
 
enum  { BITS_SIZE = sizeof(bits_t), BITS_BITLENGTH = ( BITS_SIZE * CHAR_BIT ) }
 
enum  gc_mode { gc_mode_none, gc_mode_marking, gc_mode_sweeping }
 
enum  {
  HEAP_PAGE_ALIGN = (1UL << HEAP_PAGE_ALIGN_LOG), HEAP_PAGE_ALIGN_MASK = (~(~0UL << HEAP_PAGE_ALIGN_LOG)), REQUIRED_SIZE_BY_MALLOC = (sizeof(size_t) * 5), HEAP_PAGE_SIZE = (HEAP_PAGE_ALIGN - REQUIRED_SIZE_BY_MALLOC),
  HEAP_PAGE_OBJ_LIMIT = (unsigned int)((HEAP_PAGE_SIZE - sizeof(struct heap_page_header))/sizeof(struct RVALUE)), HEAP_PAGE_BITMAP_LIMIT = CEILDIV(CEILDIV(HEAP_PAGE_SIZE, sizeof(struct RVALUE)), BITS_BITLENGTH), HEAP_PAGE_BITMAP_SIZE = (BITS_SIZE * HEAP_PAGE_BITMAP_LIMIT), HEAP_PAGE_BITMAP_PLANES = USE_RGENGC ? 4 : 1
}
 
enum  { gc_stress_no_major, gc_stress_no_immediate_sweep, gc_stress_full_mark_after_malloc, gc_stress_max }
 
enum  gc_stat_sym {
  gc_stat_sym_count, gc_stat_sym_heap_allocated_pages, gc_stat_sym_heap_sorted_length, gc_stat_sym_heap_allocatable_pages,
  gc_stat_sym_heap_available_slots, gc_stat_sym_heap_live_slots, gc_stat_sym_heap_free_slots, gc_stat_sym_heap_final_slots,
  gc_stat_sym_heap_marked_slots, gc_stat_sym_heap_eden_pages, gc_stat_sym_heap_tomb_pages, gc_stat_sym_total_allocated_pages,
  gc_stat_sym_total_freed_pages, gc_stat_sym_total_allocated_objects, gc_stat_sym_total_freed_objects, gc_stat_sym_malloc_increase_bytes,
  gc_stat_sym_malloc_increase_bytes_limit, gc_stat_sym_minor_gc_count, gc_stat_sym_major_gc_count, gc_stat_sym_remembered_wb_unprotected_objects,
  gc_stat_sym_remembered_wb_unprotected_objects_limit, gc_stat_sym_old_objects, gc_stat_sym_old_objects_limit, gc_stat_sym_oldmalloc_increase_bytes,
  gc_stat_sym_oldmalloc_increase_bytes_limit, gc_stat_sym_last
}
 
enum  gc_stat_compat_sym {
  gc_stat_compat_sym_gc_stat_heap_used, gc_stat_compat_sym_heap_eden_page_length, gc_stat_compat_sym_heap_tomb_page_length, gc_stat_compat_sym_heap_increment,
  gc_stat_compat_sym_heap_length, gc_stat_compat_sym_heap_live_slot, gc_stat_compat_sym_heap_free_slot, gc_stat_compat_sym_heap_final_slot,
  gc_stat_compat_sym_heap_swept_slot, gc_stat_compat_sym_remembered_shady_object, gc_stat_compat_sym_remembered_shady_object_limit, gc_stat_compat_sym_old_object,
  gc_stat_compat_sym_old_object_limit, gc_stat_compat_sym_total_allocated_object, gc_stat_compat_sym_total_freed_object, gc_stat_compat_sym_malloc_increase,
  gc_stat_compat_sym_malloc_limit, gc_stat_compat_sym_oldmalloc_increase, gc_stat_compat_sym_oldmalloc_limit, gc_stat_compat_sym_last
}
 
enum  memop_type { MEMOP_TYPE_MALLOC = 1, MEMOP_TYPE_FREE = 2, MEMOP_TYPE_REALLOC = 3 }
 

Functions

volatile VALUErb_gc_guarded_ptr_val (volatile VALUE *ptr, VALUE val)
 
static enum gc_mode gc_mode_verify (enum gc_mode mode)
 
void rb_iseq_mark (const rb_iseq_t *iseq)
 
void rb_iseq_free (const rb_iseq_t *iseq)
 
void rb_gcdebug_print_obj_condition (VALUE obj)
 
static void rb_objspace_call_finalizer (rb_objspace_t *objspace)
 
static VALUE define_final0 (VALUE obj, VALUE block)
 
static void negative_size_allocation_error (const char *)
 
static void * aligned_malloc (size_t, size_t)
 
static void aligned_free (void *)
 
static void init_mark_stack (mark_stack_t *stack)
 
static int ready_to_gc (rb_objspace_t *objspace)
 
static int garbage_collect (rb_objspace_t *, int full_mark, int immediate_mark, int immediate_sweep, int reason)
 
static int gc_start (rb_objspace_t *objspace, const int full_mark, const int immediate_mark, const unsigned int immediate_sweep, int reason)
 
static void gc_rest (rb_objspace_t *objspace)
 
static void gc_enter (rb_objspace_t *objspace, const char *event)
 
static void gc_exit (rb_objspace_t *objspace, const char *event)
 
static void gc_marks (rb_objspace_t *objspace, int full_mark)
 
static void gc_marks_start (rb_objspace_t *objspace, int full)
 
static int gc_marks_finish (rb_objspace_t *objspace)
 
static void gc_marks_rest (rb_objspace_t *objspace)
 
static void gc_marks_step (rb_objspace_t *objspace, int slots)
 
static void gc_marks_continue (rb_objspace_t *objspace, rb_heap_t *heap)
 
static void gc_sweep (rb_objspace_t *objspace)
 
static void gc_sweep_start (rb_objspace_t *objspace)
 
static void gc_sweep_finish (rb_objspace_t *objspace)
 
static int gc_sweep_step (rb_objspace_t *objspace, rb_heap_t *heap)
 
static void gc_sweep_rest (rb_objspace_t *objspace)
 
static void gc_sweep_continue (rb_objspace_t *objspace, rb_heap_t *heap)
 
static void gc_mark (rb_objspace_t *objspace, VALUE ptr)
 
static void gc_mark_ptr (rb_objspace_t *objspace, VALUE ptr)
 
static void gc_mark_maybe (rb_objspace_t *objspace, VALUE ptr)
 
static void gc_mark_children (rb_objspace_t *objspace, VALUE ptr)
 
static int gc_mark_stacked_objects_incremental (rb_objspace_t *, size_t count)
 
static int gc_mark_stacked_objects_all (rb_objspace_t *)
 
static void gc_grey (rb_objspace_t *objspace, VALUE ptr)
 
static int gc_mark_set (rb_objspace_t *objspace, VALUE obj)
 
static int is_pointer_to_heap (rb_objspace_t *objspace, void *ptr)
 
static void push_mark_stack (mark_stack_t *, VALUE)
 
static int pop_mark_stack (mark_stack_t *, VALUE *)
 
static size_t mark_stack_size (mark_stack_t *stack)
 
static void shrink_stack_chunk_cache (mark_stack_t *stack)
 
static size_t obj_memsize_of (VALUE obj, int use_all_types)
 
static VALUE gc_verify_internal_consistency (VALUE self)
 
static int gc_verify_heap_page (rb_objspace_t *objspace, struct heap_page *page, VALUE obj)
 
static int gc_verify_heap_pages (rb_objspace_t *objspace)
 
static void gc_stress_set (rb_objspace_t *objspace, VALUE flag)
 
static double getrusage_time (void)
 
static void gc_prof_setup_new_record (rb_objspace_t *objspace, int reason)
 
static void gc_prof_timer_start (rb_objspace_t *)
 
static void gc_prof_timer_stop (rb_objspace_t *)
 
static void gc_prof_mark_timer_start (rb_objspace_t *)
 
static void gc_prof_mark_timer_stop (rb_objspace_t *)
 
static void gc_prof_sweep_timer_start (rb_objspace_t *)
 
static void gc_prof_sweep_timer_stop (rb_objspace_t *)
 
static void gc_prof_set_malloc_info (rb_objspace_t *)
 
static void gc_prof_set_heap_info (rb_objspace_t *)
 
 PRINTF_ARGS (static void gc_report_body(int level, rb_objspace_t *objspace, const char *fmt,...), 3, 4)
 
static const char * obj_info (VALUE obj)
 
static int rgengc_remembered (rb_objspace_t *objspace, VALUE obj)
 
static int rgengc_remember (rb_objspace_t *objspace, VALUE obj)
 
static void rgengc_mark_and_rememberset_clear (rb_objspace_t *objspace, rb_heap_t *heap)
 
static void rgengc_rememberset_mark (rb_objspace_t *objspace, rb_heap_t *heap)
 
static int RVALUE_FLAGS_AGE (VALUE flags)
 
static VALUE check_rvalue_consistency (const VALUE obj)
 
static int RVALUE_MARKED (VALUE obj)
 
static int RVALUE_WB_UNPROTECTED (VALUE obj)
 
static int RVALUE_MARKING (VALUE obj)
 
static int RVALUE_REMEMBERED (VALUE obj)
 
static int RVALUE_UNCOLLECTIBLE (VALUE obj)
 
static int RVALUE_OLD_P_RAW (VALUE obj)
 
static int RVALUE_OLD_P (VALUE obj)
 
static void RVALUE_PAGE_OLD_UNCOLLECTIBLE_SET (rb_objspace_t *objspace, struct heap_page *page, VALUE obj)
 
static void RVALUE_OLD_UNCOLLECTIBLE_SET (rb_objspace_t *objspace, VALUE obj)
 
static VALUE RVALUE_FLAGS_AGE_SET (VALUE flags, int age)
 
static void RVALUE_AGE_INC (rb_objspace_t *objspace, VALUE obj)
 
static void RVALUE_AGE_SET_OLD (rb_objspace_t *objspace, VALUE obj)
 
static void RVALUE_AGE_SET_CANDIDATE (rb_objspace_t *objspace, VALUE obj)
 
static void RVALUE_DEMOTE_RAW (rb_objspace_t *objspace, VALUE obj)
 
static void RVALUE_DEMOTE (rb_objspace_t *objspace, VALUE obj)
 
static void RVALUE_AGE_RESET_RAW (VALUE obj)
 
static void RVALUE_AGE_RESET (VALUE obj)
 
static int RVALUE_BLACK_P (VALUE obj)
 
static int RVALUE_WHITE_P (VALUE obj)
 
rb_objspace_trb_objspace_alloc (void)
 
static void free_stack_chunks (mark_stack_t *)
 
static void heap_page_free (rb_objspace_t *objspace, struct heap_page *page)
 
void rb_objspace_free (rb_objspace_t *objspace)
 
static void heap_pages_expand_sorted_to (rb_objspace_t *objspace, size_t next_length)
 
static void heap_pages_expand_sorted (rb_objspace_t *objspace)
 
static void heap_page_add_freeobj (rb_objspace_t *objspace, struct heap_page *page, VALUE obj)
 
static void heap_add_freepage (rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *page)
 
static int heap_add_poolpage (rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *page)
 
static void heap_unlink_page (rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *page)
 
static void heap_pages_free_unused_pages (rb_objspace_t *objspace)
 
static struct heap_pageheap_page_allocate (rb_objspace_t *objspace)
 
static struct heap_pageheap_page_resurrect (rb_objspace_t *objspace)
 
static struct heap_pageheap_page_create (rb_objspace_t *objspace)
 
static void heap_add_page (rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *page)
 
static void heap_assign_page (rb_objspace_t *objspace, rb_heap_t *heap)
 
static void heap_add_pages (rb_objspace_t *objspace, rb_heap_t *heap, size_t add)
 
static size_t heap_extend_pages (rb_objspace_t *objspace, size_t free_slots, size_t total_slots)
 
static void heap_set_increment (rb_objspace_t *objspace, size_t additional_pages)
 
static int heap_increment (rb_objspace_t *objspace, rb_heap_t *heap)
 
static void heap_prepare (rb_objspace_t *objspace, rb_heap_t *heap)
 
static RVALUEheap_get_freeobj_from_next_freepage (rb_objspace_t *objspace, rb_heap_t *heap)
 
static VALUE heap_get_freeobj_head (rb_objspace_t *objspace, rb_heap_t *heap)
 
static VALUE heap_get_freeobj (rb_objspace_t *objspace, rb_heap_t *heap)
 
void rb_objspace_set_event_hook (const rb_event_flag_t event)
 
static void gc_event_hook_body (rb_thread_t *th, rb_objspace_t *objspace, const rb_event_flag_t event, VALUE data)
 
static VALUE newobj_init (VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3, int wb_protected, rb_objspace_t *objspace, VALUE obj)
 
static VALUE newobj_slowpath (VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3, rb_objspace_t *objspace, int wb_protected)
 
 NOINLINE (static VALUE newobj_slowpath_wb_protected(VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3, rb_objspace_t *objspace))
 
static VALUE newobj_slowpath_wb_protected (VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3, rb_objspace_t *objspace)
 
static VALUE newobj_slowpath_wb_unprotected (VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3, rb_objspace_t *objspace)
 
static VALUE newobj_of (VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3, int wb_protected)
 
VALUE rb_wb_unprotected_newobj_of (VALUE klass, VALUE flags)
 
VALUE rb_wb_protected_newobj_of (VALUE klass, VALUE flags)
 
VALUE rb_newobj (void)
 
VALUE rb_newobj_of (VALUE klass, VALUE flags)
 
NODErb_node_newnode (enum node_type type, VALUE a0, VALUE a1, VALUE a2)
 
VALUE rb_imemo_new (enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0)
 
VALUE rb_data_object_wrap (VALUE klass, void *datap, RUBY_DATA_FUNC dmark, RUBY_DATA_FUNC dfree)
 
 RUBY_ALIAS_FUNCTION (rb_data_object_alloc(VALUE klass, void *datap, RUBY_DATA_FUNC dmark, RUBY_DATA_FUNC dfree), rb_data_object_wrap,(klass, datap, dmark, dfree))
 
VALUE rb_data_typed_object_wrap (VALUE klass, void *datap, const rb_data_type_t *type)
 
 RUBY_ALIAS_FUNCTION (rb_data_typed_object_alloc(VALUE klass, void *datap, const rb_data_type_t *type), rb_data_typed_object_wrap,(klass, datap, type))
 
size_t rb_objspace_data_type_memsize (VALUE obj)
 
const char * rb_objspace_data_type_name (VALUE obj)
 
static enum rb_id_table_iterator_result free_const_entry_i (VALUE value, void *data)
 
void rb_free_const_table (struct rb_id_table *tbl)
 
static void make_zombie (rb_objspace_t *objspace, VALUE obj, void(*dfree)(void *), void *data)
 
static void make_io_zombie (rb_objspace_t *objspace, VALUE obj)
 
static int obj_free (rb_objspace_t *objspace, VALUE obj)
 
void Init_heap (void)
 
static VALUE objspace_each_objects (VALUE arg)
 
static VALUE incremental_enable (void)
 
void rb_objspace_each_objects (each_obj_callback *callback, void *data)
 
void rb_objspace_each_objects_without_setup (each_obj_callback *callback, void *data)
 
static int internal_object_p (VALUE obj)
 
int rb_objspace_internal_object_p (VALUE obj)
 
static int os_obj_of_i (void *vstart, void *vend, size_t stride, void *data)
 
static VALUE os_obj_of (VALUE of)
 
static VALUE os_each_obj (int argc, VALUE *argv, VALUE os)
 
static VALUE undefine_final (VALUE os, VALUE obj)
 
VALUE rb_undefine_finalizer (VALUE obj)
 
static void should_be_callable (VALUE block)
 
static void should_be_finalizable (VALUE obj)
 
static VALUE define_final (int argc, VALUE *argv, VALUE os)
 
VALUE rb_define_finalizer (VALUE obj, VALUE block)
 
void rb_gc_copy_finalizer (VALUE dest, VALUE obj)
 
static VALUE run_single_final (VALUE final, VALUE objid)
 
static void run_finalizer (rb_objspace_t *objspace, VALUE obj, VALUE table)
 
static void run_final (rb_objspace_t *objspace, VALUE zombie)
 
static void finalize_list (rb_objspace_t *objspace, VALUE zombie)
 
static void finalize_deferred (rb_objspace_t *objspace)
 
static void gc_finalize_deferred (void *dmy)
 
void rb_gc_finalize_deferred (void)
 
static void gc_finalize_deferred_register (rb_objspace_t *objspace)
 
static int force_chain_object (st_data_t key, st_data_t val, st_data_t arg)
 
void rb_gc_call_finalizer_at_exit (void)
 
 PUREFUNC (static inline int is_id_value(rb_objspace_t *objspace, VALUE ptr))
 
static int is_id_value (rb_objspace_t *objspace, VALUE ptr)
 
static int heap_is_swept_object (rb_objspace_t *objspace, rb_heap_t *heap, VALUE ptr)
 
static int is_swept_object (rb_objspace_t *objspace, VALUE ptr)
 
static int is_garbage_object (rb_objspace_t *objspace, VALUE ptr)
 
static int is_live_object (rb_objspace_t *objspace, VALUE ptr)
 
static int is_markable_object (rb_objspace_t *objspace, VALUE obj)
 
int rb_objspace_markable_object_p (VALUE obj)
 
int rb_objspace_garbage_object_p (VALUE obj)
 
static VALUE id2ref (VALUE obj, VALUE objid)
 
VALUE rb_obj_id (VALUE obj)
 
size_t rb_obj_memsize_of (VALUE obj)
 
static int set_zero (st_data_t key, st_data_t val, st_data_t arg)
 
static VALUE count_objects (int argc, VALUE *argv, VALUE os)
 
static size_t objspace_available_slots (rb_objspace_t *objspace)
 
static size_t objspace_live_slots (rb_objspace_t *objspace)
 
static size_t objspace_free_slots (rb_objspace_t *objspace)
 
static void gc_setup_mark_bits (struct heap_page *page)
 
static int gc_page_sweep (rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *sweep_page)
 
static void gc_heap_prepare_minimum_pages (rb_objspace_t *objspace, rb_heap_t *heap)
 
static const char * gc_mode_name (enum gc_mode mode)
 
static void gc_mode_transition (rb_objspace_t *objspace, enum gc_mode mode)
 
static void gc_sweep_start_heap (rb_objspace_t *objspace, rb_heap_t *heap)
 
static stack_chunk_tstack_chunk_alloc (void)
 
static int is_mark_stack_empty (mark_stack_t *stack)
 
static void add_stack_chunk_cache (mark_stack_t *stack, stack_chunk_t *chunk)
 
static void push_mark_stack_chunk (mark_stack_t *stack)
 
static void pop_mark_stack_chunk (mark_stack_t *stack)
 
static int invalidate_mark_stack_chunk (stack_chunk_t *chunk, int limit, VALUE obj)
 
static void invalidate_mark_stack (mark_stack_t *stack, VALUE obj)
 
int ruby_get_stack_grow_direction (volatile VALUE *addr)
 
size_t ruby_stack_length (VALUE **p)
 
static int stack_check (int water_mark)
 
int ruby_stack_check (void)
 
static ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS void mark_locations_array (rb_objspace_t *objspace, register const VALUE *x, register long n)
 
static void gc_mark_locations (rb_objspace_t *objspace, const VALUE *start, const VALUE *end)
 
void rb_gc_mark_locations (const VALUE *start, const VALUE *end)
 
static void gc_mark_values (rb_objspace_t *objspace, long n, const VALUE *values)
 
void rb_gc_mark_values (long n, const VALUE *values)
 
static int mark_entry (st_data_t key, st_data_t value, st_data_t data)
 
static void mark_tbl (rb_objspace_t *objspace, st_table *tbl)
 
static int mark_key (st_data_t key, st_data_t value, st_data_t data)
 
static void mark_set (rb_objspace_t *objspace, st_table *tbl)
 
void rb_mark_set (st_table *tbl)
 
static int mark_keyvalue (st_data_t key, st_data_t value, st_data_t data)
 
static void mark_hash (rb_objspace_t *objspace, st_table *tbl)
 
void rb_mark_hash (st_table *tbl)
 
static void mark_method_entry (rb_objspace_t *objspace, const rb_method_entry_t *me)
 
static enum rb_id_table_iterator_result mark_method_entry_i (VALUE me, void *data)
 
static void mark_m_tbl (rb_objspace_t *objspace, struct rb_id_table *tbl)
 
static enum rb_id_table_iterator_result mark_const_entry_i (VALUE value, void *data)
 
static void mark_const_tbl (rb_objspace_t *objspace, struct rb_id_table *tbl)
 
static void mark_stack_locations (rb_objspace_t *objspace, rb_thread_t *th, const VALUE *stack_start, const VALUE *stack_end)
 
static void mark_current_machine_context (rb_objspace_t *objspace, rb_thread_t *th)
 
void rb_gc_mark_machine_stack (rb_thread_t *th)
 
void rb_mark_tbl (st_table *tbl)
 
void rb_gc_mark_maybe (VALUE obj)
 
static int gc_remember_unprotected (rb_objspace_t *objspace, VALUE obj)
 
static void rgengc_check_relation (rb_objspace_t *objspace, VALUE obj)
 
static void gc_aging (rb_objspace_t *objspace, VALUE obj)
 
 NOINLINE (static void gc_mark_ptr(rb_objspace_t *objspace, VALUE obj))
 
void rb_gc_mark (VALUE ptr)
 
int rb_objspace_marked_object_p (VALUE obj)
 
static void gc_mark_set_parent (rb_objspace_t *objspace, VALUE obj)
 
static void gc_mark_imemo (rb_objspace_t *objspace, VALUE obj)
 
static int gc_mark_stacked_objects (rb_objspace_t *objspace, int incremental, size_t count)
 incremental: 0 -> not incremental (do all) incremental: n -> mark at most `n' objects More...
 
static void gc_mark_roots (rb_objspace_t *objspace, const char **categoryp)
 
static void check_generation_i (const VALUE child, void *ptr)
 
static void check_color_i (const VALUE child, void *ptr)
 
static void check_children_i (const VALUE child, void *ptr)
 
static int verify_internal_consistency_i (void *page_start, void *page_end, size_t stride, void *ptr)
 
static int gc_verify_heap_pages_ (rb_objspace_t *objspace, struct heap_page *page)
 
void rb_gc_verify_internal_consistency (void)
 
static void gc_marks_wb_unprotected_objects (rb_objspace_t *objspace)
 
static struct heap_pageheap_move_pooled_pages_to_free_pages (rb_heap_t *heap)
 
static void gc_report_body (int level, rb_objspace_t *objspace, const char *fmt,...)
 
static int rgengc_remembersetbits_get (rb_objspace_t *objspace, VALUE obj)
 
static int rgengc_remembersetbits_set (rb_objspace_t *objspace, VALUE obj)
 
 NOINLINE (static void gc_writebarrier_generational(VALUE a, VALUE b, rb_objspace_t *objspace))
 
static void gc_writebarrier_generational (VALUE a, VALUE b, rb_objspace_t *objspace)
 
static void gc_mark_from (rb_objspace_t *objspace, VALUE obj, VALUE parent)
 
static void gc_writebarrier_incremental (VALUE a, VALUE b, rb_objspace_t *objspace)
 
void rb_gc_writebarrier (VALUE a, VALUE b)
 
void rb_gc_writebarrier_unprotect (VALUE obj)
 
void rb_gc_writebarrier_remember (VALUE obj)
 
static int rgengc_unprotect_logging_exit_func_i (st_data_t key, st_data_t val, st_data_t arg)
 
static void rgengc_unprotect_logging_exit_func (void)
 
void rb_gc_unprotect_logging (void *objptr, const char *filename, int line)
 
void rb_copy_wb_protected_attribute (VALUE dest, VALUE obj)
 
VALUE rb_obj_rgengc_writebarrier_protected_p (VALUE obj)
 
VALUE rb_obj_rgengc_promoted_p (VALUE obj)
 
size_t rb_obj_gc_flags (VALUE obj, ID *flags, size_t max)
 
void rb_gc_force_recycle (VALUE obj)
 
void rb_gc_register_mark_object (VALUE obj)
 
void rb_gc_register_address (VALUE *addr)
 
void rb_gc_unregister_address (VALUE *addr)
 
void rb_global_variable (VALUE *var)
 
static void heap_ready_to_gc (rb_objspace_t *objspace, rb_heap_t *heap)
 
static void gc_reset_malloc_info (rb_objspace_t *objspace)
 
static void gc_current_status_fill (rb_objspace_t *objspace, char *buff)
 
static const char * gc_current_status (rb_objspace_t *objspace)
 
static void gc_record (rb_objspace_t *objspace, int direction, const char *event)
 
static void * gc_with_gvl (void *ptr)
 
static int garbage_collect_with_gvl (rb_objspace_t *objspace, int full_mark, int immediate_mark, int immediate_sweep, int reason)
 
int rb_garbage_collect (void)
 
void Init_stack (volatile VALUE *addr)
 
static VALUE gc_start_internal (int argc, VALUE *argv, VALUE self)
 
VALUE rb_gc_start (void)
 
void rb_gc (void)
 
int rb_during_gc (void)
 
size_t rb_gc_count (void)
 
static VALUE gc_count (VALUE self)
 
static VALUE gc_info_decode (rb_objspace_t *objspace, const VALUE hash_or_key, const int orig_flags)
 
VALUE rb_gc_latest_gc_info (VALUE key)
 
static VALUE gc_latest_gc_info (int argc, VALUE *argv, VALUE self)
 
static void setup_gc_stat_symbols (void)
 
static VALUE compat_key (VALUE key)
 
static VALUE default_proc_for_compat_func (VALUE hash, VALUE dmy, int argc, VALUE *argv)
 
static size_t gc_stat_internal (VALUE hash_or_sym)
 
static VALUE gc_stat (int argc, VALUE *argv, VALUE self)
 
size_t rb_gc_stat (VALUE key)
 
static VALUE gc_stress_get (VALUE self)
 
static VALUE gc_stress_set_m (VALUE self, VALUE flag)
 
VALUE rb_gc_enable (void)
 
VALUE rb_gc_disable (void)
 
static int get_envparam_size (const char *name, size_t *default_value, size_t lower_bound)
 
static int get_envparam_double (const char *name, double *default_value, double lower_bound, double upper_bound, int accept_zero)
 
static void gc_set_initial_pages (void)
 
void ruby_gc_set_params (int safe_level)
 
void rb_objspace_reachable_objects_from (VALUE obj, void(func)(VALUE, void *), void *data)
 
static void root_objects_from (VALUE obj, void *ptr)
 
void rb_objspace_reachable_objects_from_root (void(func)(const char *category, VALUE, void *), void *passing_data)
 
static void objspace_xfree (rb_objspace_t *objspace, void *ptr, size_t size)
 
static void * negative_size_allocation_error_with_gvl (void *ptr)
 
static void * ruby_memerror_body (void *dummy)
 
static void ruby_memerror (void)
 
void rb_memerror (void)
 
static size_t objspace_malloc_size (rb_objspace_t *objspace, void *ptr, size_t hint)
 
static void atomic_sub_nounderflow (size_t *var, size_t sub)
 
static void objspace_malloc_gc_stress (rb_objspace_t *objspace)
 
static void objspace_malloc_increase (rb_objspace_t *objspace, void *mem, size_t new_size, size_t old_size, enum memop_type type)
 
static size_t objspace_malloc_prepare (rb_objspace_t *objspace, size_t size)
 
static void * objspace_malloc_fixup (rb_objspace_t *objspace, void *mem, size_t size)
 
static void * objspace_xmalloc0 (rb_objspace_t *objspace, size_t size)
 
static void * objspace_xmalloc (rb_objspace_t *objspace, size_t size)
 
static size_t xmalloc2_size (const size_t count, const size_t elsize)
 
static void * objspace_xmalloc2 (rb_objspace_t *objspace, size_t n, size_t size)
 
static void * objspace_xrealloc (rb_objspace_t *objspace, void *ptr, size_t new_size, size_t old_size)
 
static void * ruby_xmalloc0 (size_t size)
 
void * ruby_xmalloc (size_t size)
 
void ruby_malloc_size_overflow (size_t count, size_t elsize)
 
void * ruby_xmalloc2 (size_t n, size_t size)
 
static void * objspace_xcalloc (rb_objspace_t *objspace, size_t count, size_t elsize)
 
void * ruby_xcalloc (size_t n, size_t size)
 
void * ruby_sized_xrealloc (void *ptr, size_t new_size, size_t old_size)
 
void * ruby_xrealloc (void *ptr, size_t new_size)
 
void * ruby_sized_xrealloc2 (void *ptr, size_t n, size_t size, size_t old_n)
 
void * ruby_xrealloc2 (void *ptr, size_t n, size_t size)
 
void ruby_sized_xfree (void *x, size_t size)
 
void ruby_xfree (void *x)
 
void * ruby_mimmalloc (size_t size)
 
void ruby_mimfree (void *ptr)
 
void * rb_alloc_tmp_buffer_with_count (volatile VALUE *store, size_t size, size_t cnt)
 
void * rb_alloc_tmp_buffer (volatile VALUE *store, long len)
 
void rb_free_tmp_buffer (volatile VALUE *store)
 
void rb_gc_adjust_memory_usage (ssize_t diff)
 
static void wmap_mark (void *ptr)
 
static int wmap_free_map (st_data_t key, st_data_t val, st_data_t arg)
 
static void wmap_free (void *ptr)
 
static int wmap_memsize_map (st_data_t key, st_data_t val, st_data_t arg)
 
static size_t wmap_memsize (const void *ptr)
 
static VALUE wmap_allocate (VALUE klass)
 
static int wmap_final_func (st_data_t *key, st_data_t *value, st_data_t arg, int existing)
 
static VALUE wmap_finalize (VALUE self, VALUE objid)
 
static int wmap_inspect_i (st_data_t key, st_data_t val, st_data_t arg)
 
static VALUE wmap_inspect (VALUE self)
 
static int wmap_each_i (st_data_t key, st_data_t val, st_data_t arg)
 
static VALUE wmap_each (VALUE self)
 
static int wmap_each_key_i (st_data_t key, st_data_t val, st_data_t arg)
 
static VALUE wmap_each_key (VALUE self)
 
static int wmap_each_value_i (st_data_t key, st_data_t val, st_data_t arg)
 
static VALUE wmap_each_value (VALUE self)
 
static int wmap_keys_i (st_data_t key, st_data_t val, st_data_t arg)
 
static VALUE wmap_keys (VALUE self)
 
static int wmap_values_i (st_data_t key, st_data_t val, st_data_t arg)
 
static VALUE wmap_values (VALUE self)
 
static int wmap_aset_update (st_data_t *key, st_data_t *val, st_data_t arg, int existing)
 
static VALUE wmap_aset (VALUE self, VALUE wmap, VALUE orig)
 
static VALUE wmap_aref (VALUE self, VALUE wmap)
 
static VALUE wmap_has_key (VALUE self, VALUE key)
 
static VALUE wmap_size (VALUE self)
 
static double elapsed_time_from (double time)
 
static VALUE gc_profile_clear (void)
 
static VALUE gc_profile_record_get (void)
 
static void gc_profile_dump_on (VALUE out, VALUE(*append)(VALUE, VALUE))
 
static VALUE gc_profile_result (void)
 
static VALUE gc_profile_report (int argc, VALUE *argv, VALUE self)
 
static VALUE gc_profile_total_time (VALUE self)
 
static VALUE gc_profile_enable_get (VALUE self)
 
static VALUE gc_profile_enable (void)
 
static VALUE gc_profile_disable (void)
 
static const char * type_name (int type, VALUE obj)
 
static const char * obj_type_name (VALUE obj)
 
static const char * method_type_name (rb_method_type_t type)
 
static void rb_raw_iseq_info (char *buff, const int buff_size, const rb_iseq_t *iseq)
 
const char * rb_raw_obj_info (char *buff, const int buff_size, VALUE obj)
 
const char * rb_obj_info (VALUE obj)
 
void rb_obj_info_dump (VALUE obj)
 
void Init_GC (void)
 

Variables

volatile VALUE rb_gc_guarded_val
 
static ruby_gc_params_t gc_params
 
VALUEruby_initial_gc_stress_ptr = &ruby_initial_gc_stress
 
int ruby_gc_debug_indent = 0
 
VALUE rb_mGC
 
int ruby_disable_gc = 0
 
int ruby_stack_grow_direction
 
static st_tablergengc_unprotect_logging_table
 
static VALUE gc_stat_symbols [gc_stat_sym_last]
 
static VALUE gc_stat_compat_symbols [gc_stat_compat_sym_last]
 
static VALUE gc_stat_compat_table
 
static const rb_data_type_t weakmap_type
 

Macro Definition Documentation

◆ ARY_EMBED_P

#define ARY_EMBED_P (   ary)
Value:
FL_TEST((ary), RARRAY_EMBED_FLAG)!=0)
#define ELTS_SHARED
Definition: ruby.h:944
#define assert(x)
Definition: dlmalloc.c:1176
#define FL_TEST(x, f)
Definition: ruby.h:1284

Definition at line 9203 of file gc.c.

Referenced by rb_raw_obj_info().

◆ ARY_SHARED_P

#define ARY_SHARED_P (   ary)
Value:
FL_TEST((ary),ELTS_SHARED)!=0)
#define ELTS_SHARED
Definition: ruby.h:944
#define assert(x)
Definition: dlmalloc.c:1176
#define FL_TEST(x, f)
Definition: ruby.h:1284

Definition at line 9200 of file gc.c.

Referenced by rb_raw_obj_info().

◆ ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS

#define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS

Definition at line 65 of file gc.c.

Referenced by ruby_stack_check().

◆ BITMAP_BIT

#define BITMAP_BIT (   p)    ((bits_t)1 << BITMAP_OFFSET(p))

Definition at line 694 of file gc.c.

Referenced by gc_page_sweep().

◆ BITMAP_INDEX

#define BITMAP_INDEX (   p)    (NUM_IN_PAGE(p) / BITS_BITLENGTH )

Definition at line 692 of file gc.c.

Referenced by gc_page_sweep().

◆ BITMAP_OFFSET

#define BITMAP_OFFSET (   p)    (NUM_IN_PAGE(p) & (BITS_BITLENGTH-1))

Definition at line 693 of file gc.c.

◆ C

#define C (   c,
 
)    ((c) != 0 ? (s) : " ")

◆ CALC_EXACT_MALLOC_SIZE

#define CALC_EXACT_MALLOC_SIZE   0

Definition at line 303 of file gc.c.

Referenced by gc_profile_dump_on(), and Init_GC().

◆ CEILDIV

#define CEILDIV (   i,
  mod 
)    (((i) + (mod) - 1)/(mod))

Definition at line 647 of file gc.c.

◆ CLEAR_IN_BITMAP

#define CLEAR_IN_BITMAP (   bits,
 
)    ((bits)[BITMAP_INDEX(p)] = (bits)[BITMAP_INDEX(p)] & ~BITMAP_BIT(p))

◆ COUNT_TYPE

#define COUNT_TYPE (   t)    case (t): type = ID2SYM(rb_intern(#t)); break;

Referenced by count_objects().

◆ dont_gc

#define dont_gc   objspace->flags.dont_gc

◆ during_gc

#define during_gc   objspace->flags.during_gc

◆ finalizer_table

#define finalizer_table   objspace->finalizer_table

◆ finalizing

#define finalizing   objspace->atomic_flags.finalizing

◆ FL_SET2

#define FL_SET2 (   x,
  f 
)    do {if (RGENGC_CHECK_MODE && SPECIAL_CONST_P(x)) rb_bug("FL_SET2: SPECIAL_CONST"); RBASIC(x)->flags |= (f);} while (0)

Definition at line 1010 of file gc.c.

◆ FL_TEST2

#define FL_TEST2 (   x,
  f 
)    ((RGENGC_CHECK_MODE && SPECIAL_CONST_P(x)) ? (rb_bug("FL_TEST2: SPECIAL_CONST (%p)", (void *)(x)), 0) : FL_TEST_RAW((x),(f)) != 0)

Definition at line 1009 of file gc.c.

◆ FL_UNSET2

#define FL_UNSET2 (   x,
  f 
)    do {if (RGENGC_CHECK_MODE && SPECIAL_CONST_P(x)) rb_bug("FL_UNSET2: SPECIAL_CONST"); RBASIC(x)->flags &= ~(f);} while (0)

Definition at line 1011 of file gc.c.

◆ GC_DEBUG

#define GC_DEBUG   0

Definition at line 211 of file gc.c.

Referenced by Init_GC().

◆ GC_DEBUG_STRESS_TO_CLASS

#define GC_DEBUG_STRESS_TO_CLASS   0

Definition at line 317 of file gc.c.

◆ GC_ENABLE_INCREMENTAL_MARK

#define GC_ENABLE_INCREMENTAL_MARK   USE_RINCGC

Definition at line 297 of file gc.c.

Referenced by gc_start().

◆ GC_ENABLE_LAZY_SWEEP

#define GC_ENABLE_LAZY_SWEEP   1

Definition at line 300 of file gc.c.

Referenced by gc_start(), and Init_GC().

◆ gc_event_hook

#define gc_event_hook (   objspace,
  event,
  data 
)
Value:
do { \
if (UNLIKELY(gc_event_hook_needed_p(objspace, event))) { \
gc_event_hook_body(GET_THREAD(), (objspace), (event), (data)); \
} \
} while (0)
#define GET_THREAD()
Definition: vm_core.h:1513
#define UNLIKELY(x)
Definition: ffi_common.h:126
#define gc_event_hook_needed_p(objspace, event)
Definition: gc.c:1774

Definition at line 1776 of file gc.c.

Referenced by gc_enter(), gc_exit(), gc_marks_finish(), gc_start(), gc_sweep_finish(), newobj_slowpath(), and obj_free().

◆ gc_event_hook_available_p

#define gc_event_hook_available_p (   objspace)    ((objspace)->flags.has_hook)

Definition at line 1773 of file gc.c.

Referenced by newobj_of().

◆ gc_event_hook_needed_p

#define gc_event_hook_needed_p (   objspace,
  event 
)    ((objspace)->hook_events & (event))

Definition at line 1774 of file gc.c.

◆ GC_HEAP_FREE_SLOTS

#define GC_HEAP_FREE_SLOTS   4096

Definition at line 108 of file gc.c.

◆ GC_HEAP_FREE_SLOTS_GOAL_RATIO

#define GC_HEAP_FREE_SLOTS_GOAL_RATIO   0.40

Definition at line 124 of file gc.c.

◆ GC_HEAP_FREE_SLOTS_MAX_RATIO

#define GC_HEAP_FREE_SLOTS_MAX_RATIO   0.65

Definition at line 127 of file gc.c.

◆ GC_HEAP_FREE_SLOTS_MIN_RATIO

#define GC_HEAP_FREE_SLOTS_MIN_RATIO   0.20

Definition at line 121 of file gc.c.

◆ GC_HEAP_GROWTH_FACTOR

#define GC_HEAP_GROWTH_FACTOR   1.8

Definition at line 111 of file gc.c.

◆ GC_HEAP_GROWTH_MAX_SLOTS

#define GC_HEAP_GROWTH_MAX_SLOTS   0 /* 0 is disable */

Definition at line 114 of file gc.c.

◆ GC_HEAP_INIT_SLOTS

#define GC_HEAP_INIT_SLOTS   10000

Definition at line 105 of file gc.c.

◆ GC_HEAP_OLDOBJECT_LIMIT_FACTOR

#define GC_HEAP_OLDOBJECT_LIMIT_FACTOR   2.0

Definition at line 117 of file gc.c.

◆ GC_MALLOC_LIMIT_GROWTH_FACTOR

#define GC_MALLOC_LIMIT_GROWTH_FACTOR   1.4

Definition at line 137 of file gc.c.

◆ GC_MALLOC_LIMIT_MAX

#define GC_MALLOC_LIMIT_MAX   (32 * 1024 * 1024 /* 32MB */)

Definition at line 134 of file gc.c.

◆ GC_MALLOC_LIMIT_MIN

#define GC_MALLOC_LIMIT_MIN   (16 * 1024 * 1024 /* 16MB */)

Definition at line 131 of file gc.c.

◆ gc_mode

#define gc_mode (   objspace)    gc_mode_verify((enum gc_mode)(objspace)->flags.mode)

Definition at line 765 of file gc.c.

Referenced by gc_info_decode(), gc_mode_transition(), and gc_start().

◆ gc_mode_set

#define gc_mode_set (   objspace,
  mode 
)    ((objspace)->flags.mode = (unsigned int)gc_mode_verify(mode))

Definition at line 766 of file gc.c.

Referenced by gc_mode_transition().

◆ GC_NOTIFY

#define GC_NOTIFY   0

Definition at line 6208 of file gc.c.

◆ GC_OLDMALLOC_LIMIT_GROWTH_FACTOR

#define GC_OLDMALLOC_LIMIT_GROWTH_FACTOR   1.2

Definition at line 144 of file gc.c.

◆ GC_OLDMALLOC_LIMIT_MAX

#define GC_OLDMALLOC_LIMIT_MAX   (128 * 1024 * 1024 /* 128MB */)

Definition at line 147 of file gc.c.

◆ GC_OLDMALLOC_LIMIT_MIN

#define GC_OLDMALLOC_LIMIT_MIN   (16 * 1024 * 1024 /* 16MB */)

Definition at line 141 of file gc.c.

◆ gc_prof_enabled

#define gc_prof_enabled (   objspace)    ((objspace)->profile.run && (objspace)->profile.current_record)

◆ gc_prof_record

#define gc_prof_record (   objspace)    (objspace)->profile.current_record

◆ GC_PROFILE_DETAIL_MEMORY

#define GC_PROFILE_DETAIL_MEMORY   0

Definition at line 294 of file gc.c.

Referenced by gc_profile_dump_on(), and Init_GC().

◆ GC_PROFILE_MORE_DETAIL

#define GC_PROFILE_MORE_DETAIL   0

Definition at line 291 of file gc.c.

Referenced by gc_prof_sweep_timer_start(), gc_prof_sweep_timer_stop(), and Init_GC().

◆ GC_PROFILE_RECORD_DEFAULT_SIZE

#define GC_PROFILE_RECORD_DEFAULT_SIZE   100

Definition at line 8526 of file gc.c.

Referenced by gc_prof_setup_new_record(), and gc_profile_clear().

◆ gc_report

#define gc_report   if (!(RGENGC_DEBUG)) {} else gc_report_body

◆ gc_stress_full_mark_after_malloc_p

#define gc_stress_full_mark_after_malloc_p ( )    (FIXNUM_P(ruby_gc_stress_mode) && (FIX2LONG(ruby_gc_stress_mode) & (1<<gc_stress_full_mark_after_malloc)))

Definition at line 6217 of file gc.c.

Referenced by objspace_malloc_gc_stress().

◆ GET_HEAP_MARK_BITS

#define GET_HEAP_MARK_BITS (   x)    (&GET_HEAP_PAGE(x)->mark_bits[0])

◆ GET_HEAP_MARKING_BITS

#define GET_HEAP_MARKING_BITS (   x)    (&GET_HEAP_PAGE(x)->marking_bits[0])

◆ GET_HEAP_PAGE

#define GET_HEAP_PAGE (   x)    (GET_PAGE_HEADER(x)->page)

◆ GET_HEAP_UNCOLLECTIBLE_BITS

#define GET_HEAP_UNCOLLECTIBLE_BITS (   x)    (&GET_HEAP_PAGE(x)->uncollectible_bits[0])

Definition at line 704 of file gc.c.

Referenced by rb_gc_force_recycle(), and RVALUE_DEMOTE_RAW().

◆ GET_HEAP_WB_UNPROTECTED_BITS

#define GET_HEAP_WB_UNPROTECTED_BITS (   x)    (&GET_HEAP_PAGE(x)->wb_unprotected_bits[0])

◆ GET_PAGE_BODY

#define GET_PAGE_BODY (   x)    ((struct heap_page_body *)((bits_t)(x) & ~(HEAP_PAGE_ALIGN_MASK)))

Definition at line 687 of file gc.c.

Referenced by heap_page_free().

◆ GET_PAGE_HEADER

#define GET_PAGE_HEADER (   x)    (&GET_PAGE_BODY(x)->header)

Definition at line 688 of file gc.c.

◆ GET_STACK_BOUNDS

#define GET_STACK_BOUNDS (   start,
  end,
  appendix 
)
Value:
((start) = STACK_END, (end) = STACK_START) : ((start) = STACK_START, (end) = STACK_END+(appendix)))
#define STACK_START
Definition: gc.c:3921
#define STACK_END
Definition: gc.c:3922

Definition at line 4168 of file gc.c.

Referenced by mark_current_machine_context(), and rb_gc_mark_machine_stack().

◆ global_list

#define global_list   objspace->global_list

◆ has_sweeping_pages

#define has_sweeping_pages (   heap)    ((heap)->sweep_pages != 0)

Definition at line 785 of file gc.c.

Referenced by gc_sweep_rest().

◆ heap_allocatable_pages

#define heap_allocatable_pages   objspace->heap_pages.allocatable_pages

◆ heap_allocated_pages

#define heap_allocated_pages   objspace->heap_pages.allocated_pages

◆ heap_eden

#define heap_eden   (&objspace->eden_heap)

◆ HEAP_PAGE_ALIGN_LOG

#define HEAP_PAGE_ALIGN_LOG   14

Definition at line 645 of file gc.c.

◆ heap_pages_deferred_final

#define heap_pages_deferred_final   objspace->heap_pages.deferred_final

◆ heap_pages_final_slots

#define heap_pages_final_slots   objspace->heap_pages.final_slots

◆ heap_pages_freeable_pages

#define heap_pages_freeable_pages   objspace->heap_pages.freeable_pages

Definition at line 731 of file gc.c.

Referenced by gc_marks_finish(), and gc_sweep_step().

◆ heap_pages_himem

#define heap_pages_himem   objspace->heap_pages.range[1]

Definition at line 729 of file gc.c.

Referenced by heap_page_allocate(), is_pointer_to_heap(), and rb_objspace_free().

◆ heap_pages_lomem

#define heap_pages_lomem   objspace->heap_pages.range[0]

Definition at line 728 of file gc.c.

Referenced by heap_page_allocate(), and rb_objspace_free().

◆ heap_pages_sorted

#define heap_pages_sorted   objspace->heap_pages.sorted

◆ heap_pages_sorted_length

#define heap_pages_sorted_length   objspace->heap_pages.sorted_length

◆ heap_tomb

#define heap_tomb   (&objspace->tomb_heap)

◆ I

#define I (   s)    ID_##s = rb_intern(#s);

Referenced by rb_obj_gc_flags().

◆ IMEMO_NAME

#define IMEMO_NAME (   x)    case imemo_##x: imemo_name = #x; break;

Referenced by rb_raw_obj_info().

◆ is_full_marking

#define is_full_marking (   objspace)    ((objspace)->flags.during_minor_gc == FALSE)

◆ is_incremental_marking

#define is_incremental_marking (   objspace)    ((objspace)->flags.during_incremental_marking != FALSE)

◆ is_lazy_sweeping

#define is_lazy_sweeping (   heap)    (GC_ENABLE_LAZY_SWEEP && has_sweeping_pages(heap))

◆ is_marking

#define is_marking (   objspace)    (gc_mode(objspace) == gc_mode_marking)

◆ is_sweeping

#define is_sweeping (   objspace)    (gc_mode(objspace) == gc_mode_sweeping)

Definition at line 769 of file gc.c.

Referenced by gc_current_status_fill().

◆ MALLOC_ALLOCATED_SIZE

#define MALLOC_ALLOCATED_SIZE   0

Definition at line 310 of file gc.c.

Referenced by Init_GC().

◆ malloc_allocated_size

#define malloc_allocated_size   objspace->malloc_params.allocated_size

Definition at line 724 of file gc.c.

Referenced by gc_prof_setup_new_record().

◆ MALLOC_ALLOCATED_SIZE_CHECK

#define MALLOC_ALLOCATED_SIZE_CHECK   0

Definition at line 313 of file gc.c.

Referenced by Init_GC().

◆ malloc_increase

#define malloc_increase   objspace->malloc_params.increase

◆ malloc_limit

#define malloc_limit   objspace->malloc_params.limit

◆ MARK_CHECKPOINT

#define MARK_CHECKPOINT (   category)
Value:
do { \
if (categoryp) *categoryp = category; \
MARK_CHECKPOINT_PRINT_TICK(category); \
} while (0)

Referenced by gc_mark_roots().

◆ MARK_CHECKPOINT_PRINT_TICK

#define MARK_CHECKPOINT_PRINT_TICK (   category)

◆ MARK_IN_BITMAP

#define MARK_IN_BITMAP (   bits,
 
)    ((bits)[BITMAP_INDEX(p)] = (bits)[BITMAP_INDEX(p)] | BITMAP_BIT(p))

◆ MARK_OBJECT_ARY_BUCKET_SIZE

#define MARK_OBJECT_ARY_BUCKET_SIZE   1024

Definition at line 6150 of file gc.c.

Referenced by rb_gc_register_mark_object().

◆ MARKED_IN_BITMAP

#define MARKED_IN_BITMAP (   bits,
 
)    ((bits)[BITMAP_INDEX(p)] & BITMAP_BIT(p))

◆ MEASURE_LINE

#define MEASURE_LINE (   expr)    expr

Definition at line 1006 of file gc.c.

◆ NEW_SYM

#define NEW_SYM (   s)    gc_stat_symbols[gc_stat_sym_##s]

Referenced by setup_gc_stat_symbols().

◆ nomem_error

#define nomem_error   GET_VM()->special_exceptions[ruby_error_nomemory]

Definition at line 810 of file gc.c.

Referenced by rb_memerror().

◆ nonspecial_obj_id

#define nonspecial_obj_id (   obj)    (VALUE)((SIGNED_VALUE)(obj)|FIXNUM_FLAG)

Definition at line 789 of file gc.c.

Referenced by rb_obj_id(), run_finalizer(), and wmap_aset().

◆ NUM2PTR

#define NUM2PTR (   x)    NUM2ULONG(x)

Referenced by id2ref().

◆ NUM_IN_PAGE

#define NUM_IN_PAGE (   p)    (((bits_t)(p) & HEAP_PAGE_ALIGN_MASK)/sizeof(RVALUE))

Definition at line 691 of file gc.c.

Referenced by gc_marks_wb_unprotected_objects(), gc_page_sweep(), and rgengc_rememberset_mark().

◆ obj_id_to_ref

#define obj_id_to_ref (   objid)    ((objid) ^ FIXNUM_FLAG) /* unset FIXNUM_FLAG */

Definition at line 790 of file gc.c.

Referenced by id2ref(), and wmap_finalize().

◆ OLD_SYM

#define OLD_SYM (   s)    gc_stat_compat_symbols[gc_stat_compat_sym_##s]

Referenced by setup_gc_stat_symbols().

◆ OPT

#define OPT (   o)    if (o) rb_ary_push(opts, rb_fstring_lit(#o))

Referenced by Init_GC().

◆ POP_MARK_FUNC_DATA

#define POP_MARK_FUNC_DATA ( )    objspace->mark_func_data = prev_mark_func_data;} while (0)

◆ PRINT_ENTER_EXIT_TICK

#define PRINT_ENTER_EXIT_TICK   0

Definition at line 154 of file gc.c.

◆ PRINT_MEASURE_LINE

#define PRINT_MEASURE_LINE   0

Definition at line 151 of file gc.c.

◆ PRINT_ROOT_TICKS

#define PRINT_ROOT_TICKS   0

Definition at line 157 of file gc.c.

◆ PROFILE_REMEMBERSET_MARK

#define PROFILE_REMEMBERSET_MARK   0

Definition at line 5741 of file gc.c.

◆ PUSH_MARK_FUNC_DATA

#define PUSH_MARK_FUNC_DATA (   v)
Value:
do { \
struct mark_func_data_struct *prev_mark_func_data = objspace->mark_func_data; \
objspace->mark_func_data = (v);

Definition at line 904 of file gc.c.

Referenced by gc_mark_roots(), gc_marks(), gc_marks_continue(), gc_rest(), rb_objspace_reachable_objects_from(), and rb_objspace_reachable_objects_from_root().

◆ RANY

#define RANY (   o)    ((RVALUE*)(o))

◆ rb_data_object_alloc

#define rb_data_object_alloc   rb_data_object_alloc

Definition at line 14 of file gc.c.

◆ rb_data_typed_object_alloc

#define rb_data_typed_object_alloc   rb_data_typed_object_alloc

Definition at line 15 of file gc.c.

◆ rb_jmp_buf

#define rb_jmp_buf   rb_jmpbuf_t

Definition at line 90 of file gc.c.

Referenced by mark_current_machine_context().

◆ rb_objspace

#define rb_objspace   (*rb_objspace_of(GET_VM()))

◆ rb_objspace_of

#define rb_objspace_of (   vm)    ((vm)->objspace)

Definition at line 712 of file gc.c.

Referenced by rb_gc_mark_machine_stack(), and rb_memerror().

◆ rb_setjmp

#define rb_setjmp (   env)    RUBY_SETJMP(env)

Definition at line 89 of file gc.c.

Referenced by mark_current_machine_context().

◆ RESTORE_FINALIZER

#define RESTORE_FINALIZER ( )
Value:
(\
th->cfp = saved.cfp, \
rb_set_safe_level_force(saved.safe), \
rb_set_errinfo(saved.errinfo))

Referenced by run_finalizer().

◆ RGENGC_CHECK_MODE

#define RGENGC_CHECK_MODE   0

◆ RGENGC_DEBUG

#define RGENGC_DEBUG   0

Definition at line 223 of file gc.c.

Referenced by gc_report_body(), and Init_GC().

◆ RGENGC_ESTIMATE_OLDMALLOC

#define RGENGC_ESTIMATE_OLDMALLOC   1

Definition at line 264 of file gc.c.

Referenced by Init_GC().

◆ RGENGC_FORCE_MAJOR_GC

#define RGENGC_FORCE_MAJOR_GC   0

Definition at line 271 of file gc.c.

Referenced by gc_marks_finish(), and gc_start().

◆ RGENGC_OBJ_INFO

#define RGENGC_OBJ_INFO   (RGENGC_DEBUG | RGENGC_CHECK_MODE)

Definition at line 321 of file gc.c.

◆ RGENGC_OLD_NEWOBJ_CHECK

#define RGENGC_OLD_NEWOBJ_CHECK   0

Definition at line 245 of file gc.c.

Referenced by newobj_init().

◆ RGENGC_PROFILE

#define RGENGC_PROFILE   0

Definition at line 254 of file gc.c.

Referenced by gc_profile_dump_on(), and Init_GC().

◆ RUBY_DTRACE_GC_HOOK

#define RUBY_DTRACE_GC_HOOK (   name)    do {if (RUBY_DTRACE_GC_##name##_ENABLED()) RUBY_DTRACE_GC_##name();} while (0)

◆ ruby_gc_stress_mode

#define ruby_gc_stress_mode   objspace->gc_stress_mode

Definition at line 742 of file gc.c.

Referenced by gc_start(), and gc_stress_get().

◆ ruby_gc_stressful

#define ruby_gc_stressful   objspace->flags.gc_stressful

◆ ruby_initial_gc_stress

#define ruby_initial_gc_stress   gc_params.gc_stress

Definition at line 718 of file gc.c.

Referenced by Init_heap().

◆ RVALUE_AGE_SHIFT

#define RVALUE_AGE_SHIFT   5 /* FL_PROMOTED0 bit */

Definition at line 1026 of file gc.c.

Referenced by RVALUE_FLAGS_AGE(), and RVALUE_FLAGS_AGE_SET().

◆ RVALUE_MARK_BITMAP

#define RVALUE_MARK_BITMAP (   obj)    MARKED_IN_BITMAP(GET_HEAP_MARK_BITS(obj), (obj))

Definition at line 1013 of file gc.c.

Referenced by check_rvalue_consistency(), rb_raw_obj_info(), and RVALUE_MARKED().

◆ RVALUE_MARKING_BITMAP

#define RVALUE_MARKING_BITMAP (   obj)    MARKED_IN_BITMAP(GET_HEAP_MARKING_BITS(obj), (obj))

◆ RVALUE_OLD_AGE

#define RVALUE_OLD_AGE   3

◆ RVALUE_PAGE_MARKED

#define RVALUE_PAGE_MARKED (   page,
  obj 
)    MARKED_IN_BITMAP((page)->mark_bits, (obj))

Definition at line 1014 of file gc.c.

◆ RVALUE_PAGE_MARKING

#define RVALUE_PAGE_MARKING (   page,
  obj 
)    MARKED_IN_BITMAP((page)->marking_bits, (obj))

Definition at line 1023 of file gc.c.

Referenced by gc_verify_heap_page().

◆ RVALUE_PAGE_UNCOLLECTIBLE

#define RVALUE_PAGE_UNCOLLECTIBLE (   page,
  obj 
)    MARKED_IN_BITMAP((page)->uncollectible_bits, (obj))

Definition at line 1022 of file gc.c.

Referenced by gc_aging(), and gc_verify_heap_page().

◆ RVALUE_PAGE_WB_UNPROTECTED

#define RVALUE_PAGE_WB_UNPROTECTED (   page,
  obj 
)    MARKED_IN_BITMAP((page)->wb_unprotected_bits, (obj))

Definition at line 1021 of file gc.c.

Referenced by gc_aging(), and gc_verify_heap_page().

◆ RVALUE_UNCOLLECTIBLE_BITMAP

#define RVALUE_UNCOLLECTIBLE_BITMAP (   obj)    MARKED_IN_BITMAP(GET_HEAP_UNCOLLECTIBLE_BITS(obj), (obj))

Definition at line 1018 of file gc.c.

Referenced by check_rvalue_consistency(), rb_raw_obj_info(), and RVALUE_UNCOLLECTIBLE().

◆ RVALUE_WB_UNPROTECTED_BITMAP

#define RVALUE_WB_UNPROTECTED_BITMAP (   obj)    MARKED_IN_BITMAP(GET_HEAP_WB_UNPROTECTED_BITS(obj), (obj))

Definition at line 1017 of file gc.c.

Referenced by check_rvalue_consistency(), rb_raw_obj_info(), and RVALUE_WB_UNPROTECTED().

◆ RZOMBIE

#define RZOMBIE (   o)    ((struct RZombie *)(o))

Definition at line 808 of file gc.c.

Referenced by finalize_list(), gc_verify_internal_consistency(), make_zombie(), and run_final().

◆ S [1/3]

#define S (   s)    sym_##s = ID2SYM(rb_intern_const(#s))

◆ S [2/3]

#define S (   s)    gc_stat_symbols[gc_stat_sym_##s] = ID2SYM(rb_intern_const(#s))

◆ S [3/3]

#define S (   s)    gc_stat_compat_symbols[gc_stat_compat_sym_##s] = ID2SYM(rb_intern_const(#s))

◆ SET [1/2]

#define SET (   name,
  attr 
)
Value:
if (key == sym_##name) \
return (attr); \
else if (hash != Qnil) \
rb_hash_aset(hash, sym_##name, (attr));
static unsigned int hash(str, len) register const char *str
#define Qnil
Definition: ruby.h:438
const char * name
Definition: nkf.c:208

Referenced by gc_info_decode(), and gc_stat_internal().

◆ SET [2/2]

#define SET (   name,
  attr 
)
Value:
if (key == gc_stat_symbols[gc_stat_sym_##name]) \
return attr; \
else if (hash != Qnil) \
rb_hash_aset(hash, gc_stat_symbols[gc_stat_sym_##name], SIZET2NUM(attr));
static unsigned int hash(str, len) register const char *str
#define Qnil
Definition: ruby.h:438
static VALUE gc_stat_symbols[gc_stat_sym_last]
Definition: gc.c:6905
const char * name
Definition: nkf.c:208
#define SIZET2NUM(v)
Definition: ruby.h:264

◆ SET_STACK_END

#define SET_STACK_END   SET_MACHINE_STACK_END(&th->machine.stack_end)

Definition at line 3918 of file gc.c.

Referenced by gc_mark_roots(), mark_current_machine_context(), ruby_stack_length(), and stack_check().

◆ STACK_CHUNK_SIZE

#define STACK_CHUNK_SIZE   500

Definition at line 464 of file gc.c.

Referenced by init_mark_stack().

◆ STACK_END

#define STACK_END   (th->machine.stack_end)

Definition at line 3922 of file gc.c.

Referenced by ruby_stack_length().

◆ STACK_LENGTH

#define STACK_LENGTH
Value:
: (size_t)(STACK_END - STACK_START + 1))
#define STACK_START
Definition: gc.c:3921
#define STACK_END
Definition: gc.c:3922

Definition at line 3930 of file gc.c.

Referenced by ruby_stack_length(), and stack_check().

◆ STACK_LEVEL_MAX

#define STACK_LEVEL_MAX   (th->machine.stack_maxsize/sizeof(VALUE))

Definition at line 3923 of file gc.c.

Referenced by stack_check().

◆ STACK_START

#define STACK_START   (th->machine.stack_start)

Definition at line 3921 of file gc.c.

Referenced by ruby_stack_length().

◆ STACKFRAME_FOR_CALL_CFUNC

#define STACKFRAME_FOR_CALL_CFUNC   512

Definition at line 3973 of file gc.c.

Referenced by ruby_stack_check().

◆ stress_to_class

#define stress_to_class   0

Definition at line 746 of file gc.c.

Referenced by gc_mark_roots(), newobj_of(), and rb_obj_info_dump().

◆ TF

#define TF (   c)    ((c) != 0 ? "true" : "false")

◆ TICK_TYPE

#define TICK_TYPE   1

Definition at line 161 of file gc.c.

◆ TRY_WITH_GC

#define TRY_WITH_GC (   alloc)
Value:
do { \
objspace_malloc_gc_stress(objspace); \
if (!(alloc) && \
(!garbage_collect_with_gvl(objspace, TRUE, TRUE, TRUE, GPR_FLAG_MALLOC) || /* full/immediate mark && immediate sweep */ \
!(alloc))) { \
ruby_memerror(); \
} \
} while (0)
#define TRUE
Definition: nkf.h:175
static int garbage_collect_with_gvl(rb_objspace_t *objspace, int full_mark, int immediate_mark, int immediate_sweep, int reason)
Definition: gc.c:6555

Definition at line 7824 of file gc.c.

Referenced by objspace_xcalloc(), objspace_xmalloc0(), and objspace_xrealloc().

◆ TYPE_NAME

#define TYPE_NAME (   t)    case (t): return #t;

Referenced by type_name().

◆ USE_TICK_T

Definition at line 160 of file gc.c.

◆ will_be_incremental_marking

#define will_be_incremental_marking (   objspace)    ((objspace)->rgengc.need_major_gc != GPR_FLAG_NONE)

Definition at line 781 of file gc.c.

Referenced by gc_sweep_step(), and heap_prepare().

◆ WMAP_DELETE_DEAD_OBJECT_IN_MARK

#define WMAP_DELETE_DEAD_OBJECT_IN_MARK   0

Definition at line 8142 of file gc.c.

Typedef Documentation

◆ bits_t

typedef uintptr_t bits_t

Definition at line 443 of file gc.c.

◆ each_obj_callback

typedef int each_obj_callback(void *, void *, size_t, void *)

Definition at line 2350 of file gc.c.

◆ gc_profile_record

◆ mark_stack_t

typedef struct mark_stack mark_stack_t

◆ rb_heap_t

typedef struct rb_heap_struct rb_heap_t

◆ rb_objspace_t

typedef struct rb_objspace rb_objspace_t

◆ RVALUE

typedef struct RVALUE RVALUE

◆ stack_chunk_t

typedef struct stack_chunk stack_chunk_t

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
BITS_SIZE 
BITS_BITLENGTH 

Definition at line 444 of file gc.c.

◆ anonymous enum

anonymous enum
Enumerator
HEAP_PAGE_ALIGN 
HEAP_PAGE_ALIGN_MASK 
REQUIRED_SIZE_BY_MALLOC 
HEAP_PAGE_SIZE 
HEAP_PAGE_OBJ_LIMIT 
HEAP_PAGE_BITMAP_LIMIT 
HEAP_PAGE_BITMAP_SIZE 
HEAP_PAGE_BITMAP_PLANES 

Definition at line 648 of file gc.c.

◆ anonymous enum

anonymous enum
Enumerator
gc_stress_no_major 
gc_stress_no_immediate_sweep 
gc_stress_full_mark_after_malloc 
gc_stress_max 

Definition at line 6210 of file gc.c.

◆ gc_mode

enum gc_mode
Enumerator
gc_mode_none 
gc_mode_marking 
gc_mode_sweeping 

Definition at line 494 of file gc.c.

◆ gc_profile_record_flag

Enumerator
GPR_FLAG_NONE 
GPR_FLAG_MAJOR_BY_NOFREE 
GPR_FLAG_MAJOR_BY_OLDGEN 
GPR_FLAG_MAJOR_BY_SHADY 
GPR_FLAG_MAJOR_BY_FORCE 
GPR_FLAG_MAJOR_BY_OLDMALLOC 
GPR_FLAG_MAJOR_MASK 
GPR_FLAG_NEWOBJ 
GPR_FLAG_MALLOC 
GPR_FLAG_METHOD 
GPR_FLAG_CAPI 
GPR_FLAG_STRESS 
GPR_FLAG_IMMEDIATE_SWEEP 
GPR_FLAG_HAVE_FINALIZE 

Definition at line 324 of file gc.c.

◆ gc_stat_compat_sym

Enumerator
gc_stat_compat_sym_gc_stat_heap_used 
gc_stat_compat_sym_heap_eden_page_length 
gc_stat_compat_sym_heap_tomb_page_length 
gc_stat_compat_sym_heap_increment 
gc_stat_compat_sym_heap_length 
gc_stat_compat_sym_heap_live_slot 
gc_stat_compat_sym_heap_free_slot 
gc_stat_compat_sym_heap_final_slot 
gc_stat_compat_sym_heap_swept_slot 
gc_stat_compat_sym_remembered_shady_object 
gc_stat_compat_sym_remembered_shady_object_limit 
gc_stat_compat_sym_old_object 
gc_stat_compat_sym_old_object_limit 
gc_stat_compat_sym_total_allocated_object 
gc_stat_compat_sym_total_freed_object 
gc_stat_compat_sym_malloc_increase 
gc_stat_compat_sym_malloc_limit 
gc_stat_compat_sym_oldmalloc_increase 
gc_stat_compat_sym_oldmalloc_limit 
gc_stat_compat_sym_last 

Definition at line 6878 of file gc.c.

◆ gc_stat_sym

Enumerator
gc_stat_sym_count 
gc_stat_sym_heap_allocated_pages 
gc_stat_sym_heap_sorted_length 
gc_stat_sym_heap_allocatable_pages 
gc_stat_sym_heap_available_slots 
gc_stat_sym_heap_live_slots 
gc_stat_sym_heap_free_slots 
gc_stat_sym_heap_final_slots 
gc_stat_sym_heap_marked_slots 
gc_stat_sym_heap_eden_pages 
gc_stat_sym_heap_tomb_pages 
gc_stat_sym_total_allocated_pages 
gc_stat_sym_total_freed_pages 
gc_stat_sym_total_allocated_objects 
gc_stat_sym_total_freed_objects 
gc_stat_sym_malloc_increase_bytes 
gc_stat_sym_malloc_increase_bytes_limit 
gc_stat_sym_minor_gc_count 
gc_stat_sym_major_gc_count 
gc_stat_sym_remembered_wb_unprotected_objects 
gc_stat_sym_remembered_wb_unprotected_objects_limit 
gc_stat_sym_old_objects 
gc_stat_sym_old_objects_limit 
gc_stat_sym_oldmalloc_increase_bytes 
gc_stat_sym_oldmalloc_increase_bytes_limit 
gc_stat_sym_last 

Definition at line 6837 of file gc.c.

◆ memop_type

enum memop_type
Enumerator
MEMOP_TYPE_MALLOC 
MEMOP_TYPE_FREE 
MEMOP_TYPE_REALLOC 

Definition at line 7703 of file gc.c.

Function Documentation

◆ add_stack_chunk_cache()

static void add_stack_chunk_cache ( mark_stack_t stack,
stack_chunk_t chunk 
)
static

Definition at line 3776 of file gc.c.

References mark_stack::cache, mark_stack::cache_size, and stack_chunk::next.

Referenced by init_mark_stack(), and pop_mark_stack_chunk().

◆ aligned_free()

static void aligned_free ( void *  ptr)
static

Definition at line 7680 of file gc.c.

References free().

Referenced by heap_page_allocate(), and heap_page_free().

◆ aligned_malloc()

static void * aligned_malloc ( size_t  alignment,
size_t  size 
)
static

Definition at line 7644 of file gc.c.

References assert, malloc, and NULL.

Referenced by heap_page_allocate().

◆ atomic_sub_nounderflow()

static void atomic_sub_nounderflow ( size_t *  var,
size_t  sub 
)
inlinestatic

Definition at line 7710 of file gc.c.

References ATOMIC_SIZE_CAS, and val.

Referenced by objspace_malloc_increase().

◆ check_children_i()

static void check_children_i ( const VALUE  child,
void *  ptr 
)
static

Definition at line 5077 of file gc.c.

References check_rvalue_consistency().

Referenced by verify_internal_consistency_i().

◆ check_color_i()

static void check_color_i ( const VALUE  child,
void *  ptr 
)
static

◆ check_generation_i()

static void check_generation_i ( const VALUE  child,
void *  ptr 
)
static

◆ check_rvalue_consistency()

static VALUE check_rvalue_consistency ( const VALUE  obj)
inlinestatic

◆ compat_key()

static VALUE compat_key ( VALUE  key)
static

Definition at line 7016 of file gc.c.

References NIL_P, PRIsVALUE, rb_hash_lookup(), and rb_warn().

Referenced by default_proc_for_compat_func(), and gc_stat_internal().

◆ count_objects()

static VALUE count_objects ( int  argc,
VALUE argv,
VALUE  os 
)
static

◆ default_proc_for_compat_func()

static VALUE default_proc_for_compat_func ( VALUE  hash,
VALUE  dmy,
int  argc,
VALUE argv 
)
static

Definition at line 7035 of file gc.c.

References Check_Type, compat_key(), key, Qnil, rb_check_arity, rb_hash_lookup(), and T_HASH.

Referenced by gc_stat_internal().

◆ define_final()

static VALUE define_final ( int  argc,
VALUE argv,
VALUE  os 
)
static

Definition at line 2635 of file gc.c.

References define_final0(), rb_block_proc(), rb_scan_args(), should_be_callable(), and should_be_finalizable().

Referenced by Init_GC().

◆ define_final0()

static VALUE define_final0 ( VALUE  obj,
VALUE  block 
)
static

◆ elapsed_time_from()

static double elapsed_time_from ( double  time)
static

Definition at line 8644 of file gc.c.

References getrusage_time().

Referenced by gc_prof_mark_timer_stop(), gc_prof_sweep_timer_stop(), and gc_prof_timer_stop().

◆ finalize_deferred()

static void finalize_deferred ( rb_objspace_t objspace)
static

◆ finalize_list()

static void finalize_list ( rb_objspace_t objspace,
VALUE  zombie 
)
static

◆ force_chain_object()

static int force_chain_object ( st_data_t  key,
st_data_t  val,
st_data_t  arg 
)
static

◆ free_const_entry_i()

static enum rb_id_table_iterator_result free_const_entry_i ( VALUE  value,
void *  data 
)
static

Definition at line 2083 of file gc.c.

References ID_TABLE_CONTINUE, and xfree().

Referenced by rb_free_const_table().

◆ free_stack_chunks()

static void free_stack_chunks ( mark_stack_t stack)
static

Definition at line 3832 of file gc.c.

References mark_stack::chunk, free(), stack_chunk::next, heap_page::next, and NULL.

Referenced by gc_mark_roots(), rb_objspace_alloc(), and rb_objspace_free().

◆ garbage_collect()

static int garbage_collect ( rb_objspace_t objspace,
int  full_mark,
int  immediate_mark,
int  immediate_sweep,
int  reason 
)
static

◆ garbage_collect_with_gvl()

static int garbage_collect_with_gvl ( rb_objspace_t objspace,
int  full_mark,
int  immediate_mark,
int  immediate_sweep,
int  reason 
)
static

◆ gc_aging()

static void gc_aging ( rb_objspace_t objspace,
VALUE  obj 
)
static

◆ gc_count()

static VALUE gc_count ( VALUE  self)
static

Definition at line 6704 of file gc.c.

References rb_gc_count(), and SIZET2NUM.

Referenced by Init_GC().

◆ gc_current_status()

static const char* gc_current_status ( rb_objspace_t objspace)
static

◆ gc_current_status_fill()

static void gc_current_status_fill ( rb_objspace_t objspace,
char *  buff 
)
static

Definition at line 6447 of file gc.c.

References heap_eden, is_full_marking, is_incremental_marking, is_lazy_sweeping, is_marking, and is_sweeping.

Referenced by gc_current_status().

◆ gc_enter()

static void gc_enter ( rb_objspace_t objspace,
const char *  event 
)
inlinestatic

◆ gc_event_hook_body()

static void gc_event_hook_body ( rb_thread_t th,
rb_objspace_t objspace,
const rb_event_flag_t  event,
VALUE  data 
)
static

Definition at line 1768 of file gc.c.

References rb_thread_struct::cfp, EXEC_EVENT_HOOK, and rb_control_frame_struct::self.

◆ gc_exit()

static void gc_exit ( rb_objspace_t objspace,
const char *  event 
)
inlinestatic

◆ gc_finalize_deferred()

static void gc_finalize_deferred ( void *  dmy)
static

◆ gc_finalize_deferred_register()

static void gc_finalize_deferred_register ( rb_objspace_t objspace)
static

Definition at line 2824 of file gc.c.

References gc_finalize_deferred(), rb_bug(), and rb_postponed_job_register_one().

Referenced by gc_page_sweep().

◆ gc_grey()

static void gc_grey ( rb_objspace_t objspace,
VALUE  ptr 
)
static

◆ gc_heap_prepare_minimum_pages()

static void gc_heap_prepare_minimum_pages ( rb_objspace_t objspace,
rb_heap_t heap 
)
static

Definition at line 3530 of file gc.c.

References FALSE, rb_heap_struct::free_pages, heap_increment(), heap_set_increment(), and rb_memerror().

Referenced by gc_sweep().

◆ gc_info_decode()

static VALUE gc_info_decode ( rb_objspace_t objspace,
const VALUE  hash_or_key,
const int  orig_flags 
)
static

◆ gc_latest_gc_info()

static VALUE gc_latest_gc_info ( int  argc,
VALUE argv,
VALUE  self 
)
static

Definition at line 6819 of file gc.c.

References gc_info_decode(), Qnil, rb_eTypeError, rb_hash_new(), rb_objspace, rb_raise(), rb_scan_args(), RB_TYPE_P, SYMBOL_P, and T_HASH.

Referenced by Init_GC().

◆ gc_mark()

static void gc_mark ( rb_objspace_t objspace,
VALUE  ptr 
)
inlinestatic

◆ gc_mark_children()

static void gc_mark_children ( rb_objspace_t objspace,
VALUE  ptr 
)
static

Definition at line 4472 of file gc.c.

References RVALUE::array, RVALUE::as, RString::as, RArray::as, RVALUE::basic, BUILTIN_TYPE, RVALUE::complex, RVALUE::data, DATA_PTR, RRational::den, RData::dmark, rb_data_type_struct::dmark, rb_io_t::rb_io_enc_t::ecopts, ELTS_SHARED, rb_io_t::encs, RVALUE::file, FL_EXIVAR, FL_TEST, RFile::fptr, rb_data_type_struct::function, gc_mark(), gc_mark_imemo(), gc_mark_set_parent(), RVALUE::hash, RString::heap, RArray::heap, RHash::ifnone, RComplex::imag, is_pointer_to_heap(), RBasic::klass, len, mark_const_tbl(), mark_hash(), mark_m_tbl(), mark_tbl(), RVALUE::match, RVALUE::node, RHash::ntbl, RRational::num, rb_io_t::pathv, RANY, RARRAY_CONST_PTR, RARRAY_LEN, RVALUE::rational, rb_bug(), rb_gc_mark_node(), rb_gcdebug_print_obj_condition(), rb_mark_generic_ivar(), RCLASS_CALLABLE_M_TBL, RCLASS_CONST_TBL, RCLASS_EXT, RCLASS_IV_TBL, RCLASS_M_TBL, RCLASS_SUPER, RComplex::real, RMatch::regexp, RVALUE::regexp, RICLASS_IS_ORIGIN, ROBJECT_IVPTR, ROBJECT_NUMIV, RSTRUCT_CONST_PTR, RSTRUCT_LEN, RTYPEDDATA_P, RRegexp::src, RMatch::str, STR_SHARED_P, RVALUE::string, T_ARRAY, T_BIGNUM, T_CLASS, T_COMPLEX, T_DATA, T_FILE, T_FIXNUM, T_FLOAT, T_HASH, T_ICLASS, T_IMEMO, T_MATCH, T_MODULE, T_NIL, T_NODE, T_NONE, T_OBJECT, T_RATIONAL, T_REGEXP, T_STRING, T_STRUCT, T_SYMBOL, T_ZOMBIE, rb_io_t::tied_io_for_writing, RTypedData::type, RVALUE::typeddata, rb_io_t::write_lock, rb_io_t::writeconv_asciicompat, and rb_io_t::writeconv_pre_ecopts.

Referenced by gc_mark_stacked_objects(), gc_marks_wb_unprotected_objects(), rb_objspace_reachable_objects_from(), and rgengc_rememberset_mark().

◆ gc_mark_from()

static void gc_mark_from ( rb_objspace_t objspace,
VALUE  obj,
VALUE  parent 
)
static

◆ gc_mark_imemo()

static void gc_mark_imemo ( rb_objspace_t objspace,
VALUE  obj 
)
static

◆ gc_mark_locations()

static void gc_mark_locations ( rb_objspace_t objspace,
const VALUE start,
const VALUE end 
)
static

Definition at line 3998 of file gc.c.

References mark_locations_array(), and heap_page::start.

Referenced by mark_stack_locations(), and rb_gc_mark_locations().

◆ gc_mark_maybe()

static void gc_mark_maybe ( rb_objspace_t objspace,
VALUE  ptr 
)
static

◆ gc_mark_ptr()

static void gc_mark_ptr ( rb_objspace_t objspace,
VALUE  ptr 
)
static

◆ gc_mark_roots()

static void gc_mark_roots ( rb_objspace_t objspace,
const char **  categoryp 
)
static

◆ gc_mark_set()

static int gc_mark_set ( rb_objspace_t objspace,
VALUE  obj 
)
inlinestatic

◆ gc_mark_set_parent()

static void gc_mark_set_parent ( rb_objspace_t objspace,
VALUE  obj 
)
inlinestatic

Definition at line 4410 of file gc.c.

References rb_objspace::parent_object, Qfalse, rb_objspace::rgengc, and RVALUE_OLD_P().

Referenced by gc_mark_children(), and gc_mark_from().

◆ gc_mark_stacked_objects()

static int gc_mark_stacked_objects ( rb_objspace_t objspace,
int  incremental,
size_t  count 
)
inlinestatic

◆ gc_mark_stacked_objects_all()

static int gc_mark_stacked_objects_all ( rb_objspace_t objspace)
static

Definition at line 4682 of file gc.c.

References FALSE, and gc_mark_stacked_objects().

Referenced by gc_marks_rest(), and gc_marks_wb_unprotected_objects().

◆ gc_mark_stacked_objects_incremental()

static int gc_mark_stacked_objects_incremental ( rb_objspace_t objspace,
size_t  count 
)
static

Definition at line 4676 of file gc.c.

References gc_mark_stacked_objects(), and TRUE.

Referenced by gc_marks_rest(), and gc_marks_step().

◆ gc_mark_values()

static void gc_mark_values ( rb_objspace_t objspace,
long  n,
const VALUE values 
)
static

Definition at line 4014 of file gc.c.

References gc_mark().

Referenced by gc_mark_imemo(), and rb_gc_mark_values().

◆ gc_marks()

static void gc_marks ( rb_objspace_t objspace,
int  full_mark 
)
static

◆ gc_marks_continue()

static void gc_marks_continue ( rb_objspace_t objspace,
rb_heap_t heap 
)
static

◆ gc_marks_finish()

static int gc_marks_finish ( rb_objspace_t objspace)
static

◆ gc_marks_rest()

static void gc_marks_rest ( rb_objspace_t objspace)
static

◆ gc_marks_start()

static void gc_marks_start ( rb_objspace_t objspace,
int  full 
)
static

◆ gc_marks_step()

static void gc_marks_step ( rb_objspace_t objspace,
int  slots 
)
static

◆ gc_marks_wb_unprotected_objects()

static void gc_marks_wb_unprotected_objects ( rb_objspace_t objspace)
static

◆ gc_mode_name()

static const char* gc_mode_name ( enum gc_mode  mode)
static

Definition at line 3542 of file gc.c.

References gc_mode_marking, gc_mode_none, gc_mode_sweeping, and rb_bug().

Referenced by gc_mode_transition().

◆ gc_mode_transition()

static void gc_mode_transition ( rb_objspace_t objspace,
enum gc_mode  mode 
)
static

◆ gc_mode_verify()

static enum gc_mode gc_mode_verify ( enum gc_mode  mode)
inlinestatic

Definition at line 750 of file gc.c.

References gc_mode_marking, gc_mode_none, gc_mode_sweeping, and rb_bug().

◆ gc_page_sweep()

static int gc_page_sweep ( rb_objspace_t objspace,
rb_heap_t heap,
struct heap_page sweep_page 
)
inlinestatic

◆ gc_prof_mark_timer_start()

static void gc_prof_mark_timer_start ( rb_objspace_t objspace)
inlinestatic

Definition at line 8668 of file gc.c.

References gc_prof_enabled, gc_prof_record, getrusage_time(), and RUBY_DTRACE_GC_HOOK.

Referenced by gc_marks().

◆ gc_prof_mark_timer_stop()

static void gc_prof_mark_timer_stop ( rb_objspace_t objspace)
inlinestatic

Definition at line 8679 of file gc.c.

References elapsed_time_from(), gc_prof_enabled, gc_prof_record, and RUBY_DTRACE_GC_HOOK.

Referenced by gc_marks().

◆ gc_prof_set_heap_info()

static void gc_prof_set_heap_info ( rb_objspace_t objspace)
inlinestatic

◆ gc_prof_set_malloc_info()

static void gc_prof_set_malloc_info ( rb_objspace_t objspace)
inlinestatic

Definition at line 8730 of file gc.c.

References gc_prof_enabled, gc_prof_record, malloc_increase, and malloc_limit.

Referenced by gc_reset_malloc_info().

◆ gc_prof_setup_new_record()

static void gc_prof_setup_new_record ( rb_objspace_t objspace,
int  reason 
)
inlinestatic

◆ gc_prof_sweep_timer_start()

static void gc_prof_sweep_timer_start ( rb_objspace_t objspace)
inlinestatic

◆ gc_prof_sweep_timer_stop()

static void gc_prof_sweep_timer_stop ( rb_objspace_t objspace)
inlinestatic

◆ gc_prof_timer_start()

static void gc_prof_timer_start ( rb_objspace_t objspace)
inlinestatic

◆ gc_prof_timer_stop()

static void gc_prof_timer_stop ( rb_objspace_t objspace)
inlinestatic

◆ gc_profile_clear()

static VALUE gc_profile_clear ( void  )
static

◆ gc_profile_disable()

static VALUE gc_profile_disable ( void  )
static

Definition at line 9120 of file gc.c.

References rb_objspace::current_record, FALSE, rb_objspace::profile, Qnil, rb_objspace, and rb_objspace::run.

Referenced by Init_GC().

◆ gc_profile_dump_on()

static void gc_profile_dump_on ( VALUE  out,
VALUE(*)(VALUE, VALUE append 
)
static

◆ gc_profile_enable()

static VALUE gc_profile_enable ( void  )
static

Definition at line 9103 of file gc.c.

References rb_objspace::current_record, rb_objspace::profile, Qnil, rb_objspace, rb_objspace::run, and TRUE.

Referenced by Init_GC().

◆ gc_profile_enable_get()

static VALUE gc_profile_enable_get ( VALUE  self)
static

Definition at line 9088 of file gc.c.

References rb_objspace::profile, Qfalse, Qtrue, rb_objspace, and rb_objspace::run.

Referenced by Init_GC().

◆ gc_profile_record_get()

static VALUE gc_profile_record_get ( void  )
static

◆ gc_profile_report()

static VALUE gc_profile_report ( int  argc,
VALUE argv,
VALUE  self 
)
static

Definition at line 9041 of file gc.c.

References gc_profile_dump_on(), Qnil, rb_io_write(), rb_scan_args(), and rb_stdout.

Referenced by Init_GC().

◆ gc_profile_result()

static VALUE gc_profile_result ( void  )
static

Definition at line 9024 of file gc.c.

References gc_profile_dump_on(), rb_str_buf_append(), and rb_str_buf_new().

Referenced by Init_GC().

◆ gc_profile_total_time()

static VALUE gc_profile_total_time ( VALUE  self)
static

◆ gc_record()

static void gc_record ( rb_objspace_t objspace,
int  direction,
const char *  event 
)
inlinestatic

Definition at line 6518 of file gc.c.

Referenced by gc_current_status(), gc_enter(), and gc_exit().

◆ gc_remember_unprotected()

static int gc_remember_unprotected ( rb_objspace_t objspace,
VALUE  obj 
)
static

◆ gc_report_body()

static void gc_report_body ( int  level,
rb_objspace_t objspace,
const char *  fmt,
  ... 
)
static

◆ gc_reset_malloc_info()

static void gc_reset_malloc_info ( rb_objspace_t objspace)
static

◆ gc_rest()

static void gc_rest ( rb_objspace_t objspace)
static

◆ gc_set_initial_pages()

static void gc_set_initial_pages ( void  )
static

◆ gc_setup_mark_bits()

static void gc_setup_mark_bits ( struct heap_page page)
static

Definition at line 3424 of file gc.c.

References HEAP_PAGE_BITMAP_SIZE, heap_page::mark_bits, memcpy, and heap_page::uncollectible_bits.

Referenced by gc_page_sweep().

◆ gc_start()

static int gc_start ( rb_objspace_t objspace,
const int  full_mark,
const int  immediate_mark,
const unsigned int  immediate_sweep,
int  reason 
)
static

◆ gc_start_internal()

static VALUE gc_start_internal ( int  argc,
VALUE argv,
VALUE  self 
)
static

◆ gc_stat()

static VALUE gc_stat ( int  argc,
VALUE argv,
VALUE  self 
)
static

Definition at line 7195 of file gc.c.

References gc_stat_internal(), Qnil, rb_eTypeError, rb_hash_new(), rb_raise(), rb_scan_args(), RB_TYPE_P, SIZET2NUM, SYMBOL_P, and T_HASH.

Referenced by Init_GC().

◆ gc_stat_internal()

static size_t gc_stat_internal ( VALUE  hash_or_sym)
static

◆ gc_stress_get()

static VALUE gc_stress_get ( VALUE  self)
static

Definition at line 7237 of file gc.c.

References rb_objspace, and ruby_gc_stress_mode.

Referenced by Init_GC().

◆ gc_stress_set()

static void gc_stress_set ( rb_objspace_t objspace,
VALUE  flag 
)
static

Definition at line 7244 of file gc.c.

References rb_objspace::flags, rb_objspace::gc_stress_mode, rb_objspace::gc_stressful, and RTEST.

Referenced by gc_stress_set_m(), and Init_heap().

◆ gc_stress_set_m()

static VALUE gc_stress_set_m ( VALUE  self,
VALUE  flag 
)
static

Definition at line 7268 of file gc.c.

References gc_stress_set(), and rb_objspace.

Referenced by Init_GC().

◆ gc_sweep()

static void gc_sweep ( rb_objspace_t objspace)
static

◆ gc_sweep_continue()

static void gc_sweep_continue ( rb_objspace_t objspace,
rb_heap_t heap 
)
static

◆ gc_sweep_finish()

static void gc_sweep_finish ( rb_objspace_t objspace)
static

◆ gc_sweep_rest()

static void gc_sweep_rest ( rb_objspace_t objspace)
static

Definition at line 3685 of file gc.c.

References gc_sweep_step(), has_sweeping_pages, and heap_eden.

Referenced by gc_rest(), and gc_sweep().

◆ gc_sweep_start()

static void gc_sweep_start ( rb_objspace_t objspace)
static

Definition at line 3591 of file gc.c.

References gc_mode_sweeping, gc_mode_transition(), gc_sweep_start_heap(), and heap_eden.

Referenced by gc_sweep().

◆ gc_sweep_start_heap()

static void gc_sweep_start_heap ( rb_objspace_t objspace,
rb_heap_t heap 
)
static

◆ gc_sweep_step()

static int gc_sweep_step ( rb_objspace_t objspace,
rb_heap_t heap 
)
static

◆ gc_verify_heap_page()

static int gc_verify_heap_page ( rb_objspace_t objspace,
struct heap_page page,
VALUE  obj 
)
static

◆ gc_verify_heap_pages()

static int gc_verify_heap_pages ( rb_objspace_t objspace)
static

Definition at line 5201 of file gc.c.

References gc_verify_heap_pages_(), heap_eden, and heap_tomb.

Referenced by gc_marks_finish(), and gc_verify_internal_consistency().

◆ gc_verify_heap_pages_()

static int gc_verify_heap_pages_ ( rb_objspace_t objspace,
struct heap_page page 
)
static

◆ gc_verify_internal_consistency()

static VALUE gc_verify_internal_consistency ( VALUE  self)
static

◆ gc_with_gvl()

static void* gc_with_gvl ( void *  ptr)
static

◆ gc_writebarrier_generational()

static void gc_writebarrier_generational ( VALUE  a,
VALUE  b,
rb_objspace_t objspace 
)
static

◆ gc_writebarrier_incremental()

static void gc_writebarrier_incremental ( VALUE  a,
VALUE  b,
rb_objspace_t objspace 
)
static

◆ get_envparam_double()

static int get_envparam_double ( const char *  name,
double *  default_value,
double  lower_bound,
double  upper_bound,
int  accept_zero 
)
static

Definition at line 7381 of file gc.c.

References getenv, NULL, RTEST, ruby_verbose, strtod, and val.

Referenced by ruby_gc_set_params().

◆ get_envparam_size()

static int get_envparam_size ( const char *  name,
size_t *  default_value,
size_t  lower_bound 
)
static

Definition at line 7323 of file gc.c.

References getenv, NULL, PRIdSIZE, PRIuSIZE, RTEST, ruby_verbose, SIZE_MAX, strtol(), and val.

Referenced by ruby_gc_set_params().

◆ getrusage_time()

static double getrusage_time ( void  )
static

◆ heap_add_freepage()

static void heap_add_freepage ( rb_objspace_t objspace,
rb_heap_t heap,
struct heap_page page 
)
inlinestatic

Definition at line 1411 of file gc.c.

References heap_page::free_next, rb_heap_struct::free_pages, and heap_page::freelist.

Referenced by gc_sweep_step(), and heap_assign_page().

◆ heap_add_page()

static void heap_add_page ( rb_objspace_t objspace,
rb_heap_t heap,
struct heap_page page 
)
static

◆ heap_add_pages()

static void heap_add_pages ( rb_objspace_t objspace,
rb_heap_t heap,
size_t  add 
)
static

Definition at line 1612 of file gc.c.

References add, heap_allocatable_pages, heap_assign_page(), and heap_pages_expand_sorted().

Referenced by gc_set_initial_pages(), and Init_heap().

◆ heap_add_poolpage()

static int heap_add_poolpage ( rb_objspace_t objspace,
rb_heap_t heap,
struct heap_page page 
)
inlinestatic

◆ heap_assign_page()

static void heap_assign_page ( rb_objspace_t objspace,
rb_heap_t heap 
)
static

Definition at line 1604 of file gc.c.

References heap_add_freepage(), heap_add_page(), and heap_page_create().

Referenced by heap_add_pages(), and heap_increment().

◆ heap_extend_pages()

static size_t heap_extend_pages ( rb_objspace_t objspace,
size_t  free_slots,
size_t  total_slots 
)
static

◆ heap_get_freeobj()

static VALUE heap_get_freeobj ( rb_objspace_t objspace,
rb_heap_t heap 
)
inlinestatic

◆ heap_get_freeobj_from_next_freepage()

static RVALUE* heap_get_freeobj_from_next_freepage ( rb_objspace_t objspace,
rb_heap_t heap 
)
static

◆ heap_get_freeobj_head()

static VALUE heap_get_freeobj_head ( rb_objspace_t objspace,
rb_heap_t heap 
)
inlinestatic

Definition at line 1734 of file gc.c.

References RVALUE::as, RVALUE::free, rb_heap_struct::freelist, LIKELY, and NULL.

Referenced by newobj_of().

◆ heap_increment()

static int heap_increment ( rb_objspace_t objspace,
rb_heap_t heap 
)
static

◆ heap_is_swept_object()

static int heap_is_swept_object ( rb_objspace_t objspace,
rb_heap_t heap,
VALUE  ptr 
)
inlinestatic

Definition at line 2949 of file gc.c.

References heap_page::before_sweep, FALSE, heap_page::flags, GET_HEAP_PAGE, and TRUE.

Referenced by is_swept_object().

◆ heap_move_pooled_pages_to_free_pages()

static struct heap_page* heap_move_pooled_pages_to_free_pages ( rb_heap_t heap)
static

◆ heap_page_add_freeobj()

static void heap_page_add_freeobj ( rb_objspace_t objspace,
struct heap_page page,
VALUE  obj 
)
inlinestatic

◆ heap_page_allocate()

static struct heap_page* heap_page_allocate ( rb_objspace_t objspace)
static

◆ heap_page_create()

static struct heap_page* heap_page_create ( rb_objspace_t objspace)
static

◆ heap_page_free()

static void heap_page_free ( rb_objspace_t objspace,
struct heap_page page 
)
static

◆ heap_page_resurrect()

static struct heap_page* heap_page_resurrect ( rb_objspace_t objspace)
static

Definition at line 1563 of file gc.c.

References heap_page::freelist, heap_tomb, heap_unlink_page(), heap_page::next, and NULL.

Referenced by heap_page_create().

◆ heap_pages_expand_sorted()

static void heap_pages_expand_sorted ( rb_objspace_t objspace)
static

◆ heap_pages_expand_sorted_to()

static void heap_pages_expand_sorted_to ( rb_objspace_t objspace,
size_t  next_length 
)
static

◆ heap_pages_free_unused_pages()

static void heap_pages_free_unused_pages ( rb_objspace_t objspace)
static

◆ heap_prepare()

static void heap_prepare ( rb_objspace_t objspace,
rb_heap_t heap 
)
static

◆ heap_ready_to_gc()

static void heap_ready_to_gc ( rb_objspace_t objspace,
rb_heap_t heap 
)
static

◆ heap_set_increment()

static void heap_set_increment ( rb_objspace_t objspace,
size_t  additional_pages 
)
static

◆ heap_unlink_page()

static void heap_unlink_page ( rb_objspace_t objspace,
rb_heap_t heap,
struct heap_page page 
)
static

◆ id2ref()

static VALUE id2ref ( VALUE  obj,
VALUE  objid 
)
static

◆ incremental_enable()

static VALUE incremental_enable ( void  )
static

Definition at line 2386 of file gc.c.

References rb_objspace::dont_incremental, FALSE, rb_objspace::flags, Qnil, and rb_objspace.

Referenced by rb_objspace_each_objects().

◆ Init_GC()

void Init_GC ( void  )

◆ Init_heap()

void Init_heap ( void  )

◆ init_mark_stack()

static void init_mark_stack ( mark_stack_t stack)
static

◆ Init_stack()

void Init_stack ( volatile VALUE addr)

Definition at line 6588 of file gc.c.

References ruby_init_stack().

◆ internal_object_p()

static int internal_object_p ( VALUE  obj)
static

◆ invalidate_mark_stack()

static void invalidate_mark_stack ( mark_stack_t stack,
VALUE  obj 
)
static

◆ invalidate_mark_stack_chunk()

static int invalidate_mark_stack_chunk ( stack_chunk_t chunk,
int  limit,
VALUE  obj 
)
static

Definition at line 3871 of file gc.c.

References stack_chunk::data, FALSE, Qundef, and TRUE.

Referenced by invalidate_mark_stack().

◆ is_garbage_object()

static int is_garbage_object ( rb_objspace_t objspace,
VALUE  ptr 
)
inlinestatic

◆ is_id_value()

static int is_id_value ( rb_objspace_t objspace,
VALUE  ptr 
)
inlinestatic

◆ is_live_object()

static int is_live_object ( rb_objspace_t objspace,
VALUE  ptr 
)
inlinestatic

◆ is_mark_stack_empty()

static int is_mark_stack_empty ( mark_stack_t stack)
inlinestatic

Definition at line 3757 of file gc.c.

References mark_stack::chunk, and NULL.

Referenced by gc_mark_stacked_objects(), gc_marks_finish(), and pop_mark_stack().

◆ is_markable_object()

static int is_markable_object ( rb_objspace_t objspace,
VALUE  obj 
)
inlinestatic

◆ is_pointer_to_heap()

static int is_pointer_to_heap ( rb_objspace_t objspace,
void *  ptr 
)
inlinestatic

◆ is_swept_object()

static int is_swept_object ( rb_objspace_t objspace,
VALUE  ptr 
)
inlinestatic

Definition at line 2956 of file gc.c.

References FALSE, heap_eden, heap_is_swept_object(), and TRUE.

Referenced by is_garbage_object(), and rb_obj_info_dump().

◆ make_io_zombie()

static void make_io_zombie ( rb_objspace_t objspace,
VALUE  obj 
)
inlinestatic

Definition at line 2109 of file gc.c.

References make_zombie(), RANY, and rb_io_fptr_finalize().

Referenced by obj_free(), and rb_objspace_call_finalizer().

◆ make_zombie()

static void make_zombie ( rb_objspace_t objspace,
VALUE  obj,
void(*)(void *)  dfree,
void *  data 
)
inlinestatic

◆ mark_const_entry_i()

static enum rb_id_table_iterator_result mark_const_entry_i ( VALUE  value,
void *  data 
)
static

Definition at line 4146 of file gc.c.

References rb_const_entry_struct::file, gc_mark(), ID_TABLE_CONTINUE, and rb_const_entry_struct::value.

Referenced by mark_const_tbl().

◆ mark_const_tbl()

static void mark_const_tbl ( rb_objspace_t objspace,
struct rb_id_table *  tbl 
)
static

Definition at line 4157 of file gc.c.

References mark_const_entry_i(), and rb_id_table_foreach_values().

Referenced by gc_mark_children().

◆ mark_current_machine_context()

static void mark_current_machine_context ( rb_objspace_t objspace,
rb_thread_t th 
)
static

◆ mark_entry()

static int mark_entry ( st_data_t  key,
st_data_t  value,
st_data_t  data 
)
static

Definition at line 4031 of file gc.c.

References gc_mark(), and ST_CONTINUE.

Referenced by mark_tbl().

◆ mark_hash()

static void mark_hash ( rb_objspace_t objspace,
st_table tbl 
)
static

Definition at line 4077 of file gc.c.

References mark_keyvalue(), st_data_t, and st_foreach.

Referenced by gc_mark_children(), and rb_mark_hash().

◆ mark_key()

static int mark_key ( st_data_t  key,
st_data_t  value,
st_data_t  data 
)
static

Definition at line 4046 of file gc.c.

References gc_mark(), and ST_CONTINUE.

Referenced by mark_set().

◆ mark_keyvalue()

static int mark_keyvalue ( st_data_t  key,
st_data_t  value,
st_data_t  data 
)
static

Definition at line 4067 of file gc.c.

References gc_mark(), and ST_CONTINUE.

Referenced by mark_hash().

◆ mark_locations_array()

static ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS void mark_locations_array ( rb_objspace_t objspace,
register const VALUE x,
register long  n 
)
static

Definition at line 3987 of file gc.c.

References gc_mark_maybe().

Referenced by gc_mark_locations(), and mark_current_machine_context().

◆ mark_m_tbl()

static void mark_m_tbl ( rb_objspace_t objspace,
struct rb_id_table *  tbl 
)
static

Definition at line 4138 of file gc.c.

References mark_method_entry_i(), and rb_id_table_foreach_values().

Referenced by gc_mark_children().

◆ mark_method_entry()

static void mark_method_entry ( rb_objspace_t objspace,
const rb_method_entry_t me 
)
static

◆ mark_method_entry_i()

static enum rb_id_table_iterator_result mark_method_entry_i ( VALUE  me,
void *  data 
)
static

Definition at line 4129 of file gc.c.

References gc_mark(), and ID_TABLE_CONTINUE.

Referenced by mark_m_tbl().

◆ mark_set()

static void mark_set ( rb_objspace_t objspace,
st_table tbl 
)
static

Definition at line 4054 of file gc.c.

References mark_key(), st_data_t, and st_foreach.

Referenced by rb_mark_set().

◆ mark_stack_locations()

static void mark_stack_locations ( rb_objspace_t objspace,
rb_thread_t th,
const VALUE stack_start,
const VALUE stack_end 
)
static

Definition at line 4211 of file gc.c.

References gc_mark_locations(), and rb_thread_struct::machine.

Referenced by mark_current_machine_context(), and rb_gc_mark_machine_stack().

◆ mark_stack_size()

static size_t mark_stack_size ( mark_stack_t stack)
static

◆ mark_tbl()

static void mark_tbl ( rb_objspace_t objspace,
st_table tbl 
)
static

Definition at line 4039 of file gc.c.

References mark_entry(), st_table::num_entries, st_data_t, and st_foreach.

Referenced by gc_mark_children(), gc_mark_roots(), and rb_mark_tbl().

◆ method_type_name()

static const char* method_type_name ( rb_method_type_t  type)
static

◆ negative_size_allocation_error()

static void negative_size_allocation_error ( const char *  msg)
static

◆ negative_size_allocation_error_with_gvl()

static void* negative_size_allocation_error_with_gvl ( void *  ptr)
static

Definition at line 7573 of file gc.c.

References rb_eNoMemError, and rb_raise().

Referenced by negative_size_allocation_error().

◆ newobj_init()

static VALUE newobj_init ( VALUE  klass,
VALUE  flags,
VALUE  v1,
VALUE  v2,
VALUE  v3,
int  wb_protected,
rb_objspace_t objspace,
VALUE  obj 
)
inlinestatic

◆ newobj_of()

static VALUE newobj_of ( VALUE  klass,
VALUE  flags,
VALUE  v1,
VALUE  v2,
VALUE  v3,
int  wb_protected 
)
inlinestatic

◆ newobj_slowpath()

static VALUE newobj_slowpath ( VALUE  klass,
VALUE  flags,
VALUE  v1,
VALUE  v2,
VALUE  v3,
rb_objspace_t objspace,
int  wb_protected 
)
inlinestatic

◆ newobj_slowpath_wb_protected()

static VALUE newobj_slowpath_wb_protected ( VALUE  klass,
VALUE  flags,
VALUE  v1,
VALUE  v2,
VALUE  v3,
rb_objspace_t objspace 
)
static

Definition at line 1893 of file gc.c.

References newobj_slowpath(), and TRUE.

Referenced by newobj_of(), and newobj_slowpath().

◆ newobj_slowpath_wb_unprotected()

static VALUE newobj_slowpath_wb_unprotected ( VALUE  klass,
VALUE  flags,
VALUE  v1,
VALUE  v2,
VALUE  v3,
rb_objspace_t objspace 
)
static

Definition at line 1899 of file gc.c.

References FALSE, and newobj_slowpath().

Referenced by newobj_of(), and newobj_slowpath().

◆ NOINLINE() [1/3]

NOINLINE ( static VALUE   newobj_slowpath_wb_protectedVALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3, rb_objspace_t *objspace)

◆ NOINLINE() [2/3]

NOINLINE ( static void   gc_mark_ptrrb_objspace_t *objspace, VALUE obj)

◆ NOINLINE() [3/3]

NOINLINE ( static void   gc_writebarrier_generationalVALUE a, VALUE b, rb_objspace_t *objspace)

◆ obj_free()

static int obj_free ( rb_objspace_t objspace,
VALUE  obj 
)
static

◆ obj_info()

static const char * obj_info ( VALUE  obj)
static

◆ obj_memsize_of()

static size_t obj_memsize_of ( VALUE  obj,
int  use_all_types 
)
static

◆ obj_type_name()

static const char* obj_type_name ( VALUE  obj)
static

Definition at line 9174 of file gc.c.

References TYPE, and type_name().

Referenced by obj_info(), rb_obj_info(), and rb_raw_obj_info().

◆ objspace_available_slots()

static size_t objspace_available_slots ( rb_objspace_t objspace)
static

Definition at line 3406 of file gc.c.

References heap_eden, and heap_tomb.

Referenced by gc_stat_internal(), and objspace_free_slots().

◆ objspace_each_objects()

static VALUE objspace_each_objects ( VALUE  arg)
static

◆ objspace_free_slots()

static size_t objspace_free_slots ( rb_objspace_t objspace)
static

Definition at line 3418 of file gc.c.

References heap_pages_final_slots, objspace_available_slots(), and objspace_live_slots().

Referenced by gc_stat_internal().

◆ objspace_live_slots()

static size_t objspace_live_slots ( rb_objspace_t objspace)
static

◆ objspace_malloc_fixup()

static void* objspace_malloc_fixup ( rb_objspace_t objspace,
void *  mem,
size_t  size 
)
inlinestatic

Definition at line 7814 of file gc.c.

References size.

Referenced by objspace_xcalloc(), and objspace_xmalloc0().

◆ objspace_malloc_gc_stress()

static void objspace_malloc_gc_stress ( rb_objspace_t objspace)
static

◆ objspace_malloc_increase()

static void objspace_malloc_increase ( rb_objspace_t objspace,
void *  mem,
size_t  new_size,
size_t  old_size,
enum memop_type  type 
)
static

◆ objspace_malloc_prepare()

static size_t objspace_malloc_prepare ( rb_objspace_t objspace,
size_t  size 
)
inlinestatic

Definition at line 7802 of file gc.c.

References size.

Referenced by objspace_xcalloc(), and objspace_xmalloc0().

◆ objspace_malloc_size()

static size_t objspace_malloc_size ( rb_objspace_t objspace,
void *  ptr,
size_t  hint 
)
inlinestatic

Definition at line 7694 of file gc.c.

Referenced by objspace_xcalloc(), objspace_xfree(), objspace_xmalloc0(), and objspace_xrealloc().

◆ objspace_xcalloc()

static void* objspace_xcalloc ( rb_objspace_t objspace,
size_t  count,
size_t  elsize 
)
static

◆ objspace_xfree()

static void objspace_xfree ( rb_objspace_t objspace,
void *  ptr,
size_t  size 
)
static

◆ objspace_xmalloc()

static void* objspace_xmalloc ( rb_objspace_t objspace,
size_t  size 
)
static

Definition at line 7849 of file gc.c.

References negative_size_allocation_error(), and objspace_xmalloc0().

Referenced by objspace_xrealloc(), and ruby_xmalloc().

◆ objspace_xmalloc0()

static void* objspace_xmalloc0 ( rb_objspace_t objspace,
size_t  size 
)
static

◆ objspace_xmalloc2()

static void* objspace_xmalloc2 ( rb_objspace_t objspace,
size_t  n,
size_t  size 
)
static

Definition at line 7868 of file gc.c.

References objspace_xmalloc0(), and xmalloc2_size().

Referenced by ruby_xmalloc2().

◆ objspace_xrealloc()

static void* objspace_xrealloc ( rb_objspace_t objspace,
void *  ptr,
size_t  new_size,
size_t  old_size 
)
static

◆ os_each_obj()

static VALUE os_each_obj ( int  argc,
VALUE argv,
VALUE  os 
)
static

Definition at line 2566 of file gc.c.

References os_each_struct::of, os_obj_of(), rb_scan_args(), and RETURN_ENUMERATOR.

Referenced by Init_GC().

◆ os_obj_of()

static VALUE os_obj_of ( VALUE  of)
static

Definition at line 2519 of file gc.c.

References os_each_struct::num, os_each_struct::of, os_obj_of_i(), rb_objspace_each_objects(), and SIZET2NUM.

Referenced by os_each_obj().

◆ os_obj_of_i()

static int os_obj_of_i ( void *  vstart,
void *  vend,
size_t  stride,
void *  data 
)
static

Definition at line 2500 of file gc.c.

References internal_object_p(), os_each_struct::num, os_each_struct::of, rb_obj_is_kind_of(), and rb_yield().

Referenced by os_obj_of().

◆ pop_mark_stack()

static int pop_mark_stack ( mark_stack_t stack,
VALUE data 
)
static

◆ pop_mark_stack_chunk()

static void pop_mark_stack_chunk ( mark_stack_t stack)
static

◆ PRINTF_ARGS()

PRINTF_ARGS ( static void   gc_report_bodyint level, rb_objspace_t *objspace, const char *fmt,...,
,
 
)

◆ PUREFUNC()

PUREFUNC ( static inline int   is_id_valuerb_objspace_t *objspace, VALUE ptr)

◆ push_mark_stack()

static void push_mark_stack ( mark_stack_t stack,
VALUE  data 
)
static

◆ push_mark_stack_chunk()

static void push_mark_stack_chunk ( mark_stack_t stack)
static

◆ rb_alloc_tmp_buffer()

void* rb_alloc_tmp_buffer ( volatile VALUE store,
long  len 
)

Definition at line 8066 of file gc.c.

References cnt, rb_alloc_tmp_buffer_with_count(), rb_eArgError, rb_raise(), and roomof.

◆ rb_alloc_tmp_buffer_with_count()

void* rb_alloc_tmp_buffer_with_count ( volatile VALUE store,
size_t  size,
size_t  cnt 
)

Definition at line 8052 of file gc.c.

References RNode::cnt, cnt, NODE_ALLOCA, rb_node_newnode(), ruby_xmalloc0(), RNode::u1, RNode::u3, and RNode::value.

Referenced by rb_alloc_tmp_buffer().

◆ rb_copy_wb_protected_attribute()

void rb_copy_wb_protected_attribute ( VALUE  dest,
VALUE  obj 
)

◆ rb_data_object_wrap()

VALUE rb_data_object_wrap ( VALUE  klass,
void *  datap,
RUBY_DATA_FUNC  dmark,
RUBY_DATA_FUNC  dfree 
)

Definition at line 1988 of file gc.c.

References Check_Type, FALSE, newobj_of(), T_CLASS, and T_DATA.

Referenced by rb_data_object_alloc(), rb_data_typed_object_make(), and RUBY_ALIAS_FUNCTION().

◆ rb_data_typed_object_wrap()

VALUE rb_data_typed_object_wrap ( VALUE  klass,
void *  datap,
const rb_data_type_t type 
)

◆ rb_define_finalizer()

VALUE rb_define_finalizer ( VALUE  obj,
VALUE  block 
)

Definition at line 2690 of file gc.c.

References define_final0(), should_be_callable(), and should_be_finalizable().

Referenced by rb_obj_info_dump().

◆ rb_during_gc()

int rb_during_gc ( void  )

◆ rb_free_const_table()

void rb_free_const_table ( struct rb_id_table *  tbl)

Definition at line 2091 of file gc.c.

References free_const_entry_i(), rb_id_table_foreach_values(), and rb_id_table_free().

Referenced by obj_free(), and rb_mod_init_copy().

◆ rb_free_tmp_buffer()

void rb_free_tmp_buffer ( volatile VALUE store)

◆ rb_garbage_collect()

int rb_garbage_collect ( void  )

Definition at line 6580 of file gc.c.

References garbage_collect(), GPR_FLAG_CAPI, and TRUE.

◆ rb_gc()

void rb_gc ( void  )

◆ rb_gc_adjust_memory_usage()

void rb_gc_adjust_memory_usage ( ssize_t  diff)

Definition at line 8121 of file gc.c.

References MEMOP_TYPE_REALLOC, objspace_malloc_increase(), and rb_objspace.

◆ rb_gc_call_finalizer_at_exit()

void rb_gc_call_finalizer_at_exit ( void  )

Definition at line 2850 of file gc.c.

References gc_verify_internal_consistency(), Qnil, and rb_objspace_call_finalizer().

Referenced by ruby_finalize_1().

◆ rb_gc_copy_finalizer()

void rb_gc_copy_finalizer ( VALUE  dest,
VALUE  obj 
)

Definition at line 2698 of file gc.c.

References finalizer_table, FL_FINALIZE, FL_SET, FL_TEST, rb_objspace, st_data_t, st_insert, st_lookup, and code_page_table::table.

Referenced by init_copy().

◆ rb_gc_count()

size_t rb_gc_count ( void  )

Definition at line 6688 of file gc.c.

References rb_objspace::count, and rb_objspace::profile.

Referenced by gc_count(), gc_page_sweep(), gc_reset_malloc_info(), and newobj_i().

◆ rb_gc_disable()

VALUE rb_gc_disable ( void  )

Definition at line 7311 of file gc.c.

References dont_gc, gc_rest(), Qfalse, Qtrue, rb_objspace, and TRUE.

Referenced by gc_mark_roots(), and Init_GC().

◆ rb_gc_enable()

VALUE rb_gc_enable ( void  )

Definition at line 7289 of file gc.c.

References dont_gc, FALSE, Qfalse, Qtrue, and rb_objspace.

Referenced by gc_mark_roots(), and Init_GC().

◆ rb_gc_finalize_deferred()

void rb_gc_finalize_deferred ( void  )

Definition at line 2818 of file gc.c.

References gc_finalize_deferred().

◆ rb_gc_force_recycle()

void rb_gc_force_recycle ( VALUE  obj)

◆ rb_gc_guarded_ptr_val()

volatile VALUE* rb_gc_guarded_ptr_val ( volatile VALUE ptr,
VALUE  val 
)

Definition at line 96 of file gc.c.

References rb_gc_guarded_val, and val.

◆ rb_gc_latest_gc_info()

VALUE rb_gc_latest_gc_info ( VALUE  key)

Definition at line 6803 of file gc.c.

References gc_info_decode(), and rb_objspace.

◆ rb_gc_mark()

void rb_gc_mark ( VALUE  ptr)

◆ rb_gc_mark_locations()

void rb_gc_mark_locations ( const VALUE start,
const VALUE end 
)

Definition at line 4008 of file gc.c.

References gc_mark_locations().

Referenced by cont_mark(), name_err_mesg_mark(), rb_gc_mark_node(), and rb_thread_mark().

◆ rb_gc_mark_machine_stack()

void rb_gc_mark_machine_stack ( rb_thread_t th)

Definition at line 4201 of file gc.c.

References GET_STACK_BOUNDS, mark_stack_locations(), rb_objspace_of, and rb_thread_struct::vm.

Referenced by rb_thread_mark().

◆ rb_gc_mark_maybe()

void rb_gc_mark_maybe ( VALUE  obj)

◆ rb_gc_mark_values()

void rb_gc_mark_values ( long  n,
const VALUE values 
)

Definition at line 4024 of file gc.c.

References gc_mark_values(), and rb_objspace.

Referenced by rb_thread_mark().

◆ rb_gc_register_address()

void rb_gc_register_address ( VALUE addr)

Definition at line 6168 of file gc.c.

References ALLOC, global_list, gc_list::next, rb_objspace, and gc_list::varptr.

Referenced by Init_readline(), and rb_global_variable().

◆ rb_gc_register_mark_object()

void rb_gc_register_mark_object ( VALUE  obj)

◆ rb_gc_start()

VALUE rb_gc_start ( void  )

Definition at line 6649 of file gc.c.

References Qnil, and rb_gc().

◆ rb_gc_stat()

size_t rb_gc_stat ( VALUE  key)

Definition at line 7217 of file gc.c.

References gc_stat_internal(), and SYMBOL_P.

◆ rb_gc_unprotect_logging()

void rb_gc_unprotect_logging ( void *  objptr,
const char *  filename,
int  line 
)

◆ rb_gc_unregister_address()

void rb_gc_unregister_address ( VALUE addr)

Definition at line 6180 of file gc.c.

References global_list, gc_list::next, rb_objspace, gc_list::varptr, and xfree().

◆ rb_gc_verify_internal_consistency()

void rb_gc_verify_internal_consistency ( void  )

Definition at line 5298 of file gc.c.

References gc_verify_internal_consistency(), and Qnil.

Referenced by vm_pop_frame().

◆ rb_gc_writebarrier()

void rb_gc_writebarrier ( VALUE  a,
VALUE  b 
)

◆ rb_gc_writebarrier_remember()

void rb_gc_writebarrier_remember ( VALUE  obj)

◆ rb_gc_writebarrier_unprotect()

void rb_gc_writebarrier_unprotect ( VALUE  obj)

◆ rb_gcdebug_print_obj_condition()

void rb_gcdebug_print_obj_condition ( VALUE  obj)

◆ rb_global_variable()

void rb_global_variable ( VALUE var)

Definition at line 6203 of file gc.c.

References rb_gc_register_address().

Referenced by Init_openssl(), Init_ossl_asn1(), and Init_Regexp().

◆ rb_imemo_new()

VALUE rb_imemo_new ( enum imemo_type  type,
VALUE  v1,
VALUE  v2,
VALUE  v3,
VALUE  v0 
)

◆ rb_iseq_free()

void rb_iseq_free ( const rb_iseq_t iseq)

◆ rb_iseq_mark()

void rb_iseq_mark ( const rb_iseq_t iseq)

◆ rb_mark_hash()

void rb_mark_hash ( st_table tbl)

Definition at line 4084 of file gc.c.

References mark_hash().

Referenced by com_hash_mark(), mark_dump_arg(), and mark_load_arg().

◆ rb_mark_set()

void rb_mark_set ( st_table tbl)

Definition at line 4061 of file gc.c.

References mark_set().

Referenced by mark_dump_arg().

◆ rb_mark_tbl()

void rb_mark_tbl ( st_table tbl)

Definition at line 4229 of file gc.c.

References mark_tbl().

Referenced by autoload_mark(), mark_load_arg(), rb_thread_mark(), and rb_vm_mark().

◆ rb_memerror()

void rb_memerror ( void  )

◆ rb_newobj()

VALUE rb_newobj ( void  )

Definition at line 1949 of file gc.c.

References FALSE, newobj_of(), and T_NONE.

◆ rb_newobj_of()

VALUE rb_newobj_of ( VALUE  klass,
VALUE  flags 
)

Definition at line 1955 of file gc.c.

References FL_WB_PROTECTED, and newobj_of().

Referenced by dsymbol_alloc().

◆ rb_node_newnode()

NODE* rb_node_newnode ( enum node_type  type,
VALUE  a0,
VALUE  a1,
VALUE  a2 
)

Definition at line 1961 of file gc.c.

References FALSE, nd_set_type, newobj_of(), and T_NODE.

Referenced by rb_alloc_tmp_buffer_with_count().

◆ rb_obj_gc_flags()

size_t rb_obj_gc_flags ( VALUE  obj,
ID flags,
size_t  max 
)

◆ rb_obj_id()

VALUE rb_obj_id ( VALUE  obj)

◆ rb_obj_info()

const char* rb_obj_info ( VALUE  obj)

◆ rb_obj_info_dump()

void rb_obj_info_dump ( VALUE  obj)

◆ rb_obj_memsize_of()

size_t rb_obj_memsize_of ( VALUE  obj)

Definition at line 3266 of file gc.c.

References obj_memsize_of(), and TRUE.

Referenced by cos_i(), dump_object(), iow_size(), memsize_of_m(), and total_i().

◆ rb_obj_rgengc_promoted_p()

VALUE rb_obj_rgengc_promoted_p ( VALUE  obj)

Definition at line 6063 of file gc.c.

References OBJ_PROMOTED, Qfalse, and Qtrue.

◆ rb_obj_rgengc_writebarrier_protected_p()

VALUE rb_obj_rgengc_writebarrier_protected_p ( VALUE  obj)

Definition at line 6053 of file gc.c.

References Qfalse, Qtrue, and RVALUE_WB_UNPROTECTED().

◆ rb_objspace_alloc()

rb_objspace_t* rb_objspace_alloc ( void  )

◆ rb_objspace_call_finalizer()

static void rb_objspace_call_finalizer ( rb_objspace_t objspace)
static

◆ rb_objspace_data_type_memsize()

size_t rb_objspace_data_type_memsize ( VALUE  obj)

◆ rb_objspace_data_type_name()

const char* rb_objspace_data_type_name ( VALUE  obj)

Definition at line 2042 of file gc.c.

References is_pointer_to_heap(), PUREFUNC(), RTYPEDDATA_P, and RTYPEDDATA_TYPE.

Referenced by cto_i(), rb_raw_obj_info(), and type_name().

◆ rb_objspace_each_objects()

void rb_objspace_each_objects ( each_obj_callback callback,
void *  data 
)

◆ rb_objspace_each_objects_without_setup()

void rb_objspace_each_objects_without_setup ( each_obj_callback callback,
void *  data 
)

◆ rb_objspace_free()

void rb_objspace_free ( rb_objspace_t objspace)

◆ rb_objspace_garbage_object_p()

int rb_objspace_garbage_object_p ( VALUE  obj)

Definition at line 3014 of file gc.c.

References is_garbage_object(), and rb_objspace.

Referenced by dsymbol_check(), fstr_update_callback(), and symbols_i().

◆ rb_objspace_internal_object_p()

int rb_objspace_internal_object_p ( VALUE  obj)

Definition at line 2494 of file gc.c.

References internal_object_p().

Referenced by reachable_object_from_i(), and reachable_object_from_root_i().

◆ rb_objspace_markable_object_p()

int rb_objspace_markable_object_p ( VALUE  obj)

◆ rb_objspace_marked_object_p()

int rb_objspace_marked_object_p ( VALUE  obj)

Definition at line 4404 of file gc.c.

References FALSE, RVALUE_MARKED(), and TRUE.

◆ rb_objspace_reachable_objects_from()

void rb_objspace_reachable_objects_from ( VALUE  obj,
void(func)(VALUE, void *)  ,
void *  data 
)

◆ rb_objspace_reachable_objects_from_root()

void rb_objspace_reachable_objects_from_root ( void(func)(const char *category, VALUE, void *)  ,
void *  passing_data 
)

◆ rb_objspace_set_event_hook()

void rb_objspace_set_event_hook ( const rb_event_flag_t  event)

◆ rb_raw_iseq_info()

static void rb_raw_iseq_info ( char *  buff,
const int  buff_size,
const rb_iseq_t iseq 
)
static

◆ rb_raw_obj_info()

const char* rb_raw_obj_info ( char *  buff,
const int  buff_size,
VALUE  obj 
)

◆ rb_undefine_finalizer()

VALUE rb_undefine_finalizer ( VALUE  obj)

Definition at line 2595 of file gc.c.

References finalizer_table, FL_FINALIZE, FL_UNSET, rb_check_frozen, rb_objspace, st_data_t, and st_delete.

Referenced by undefine_final().

◆ rb_wb_protected_newobj_of()

VALUE rb_wb_protected_newobj_of ( VALUE  klass,
VALUE  flags 
)

Definition at line 1940 of file gc.c.

References assert, FL_WB_PROTECTED, newobj_of(), RGENGC_CHECK_MODE, and TRUE.

◆ rb_wb_unprotected_newobj_of()

VALUE rb_wb_unprotected_newobj_of ( VALUE  klass,
VALUE  flags 
)

Definition at line 1933 of file gc.c.

References assert, FALSE, FL_WB_PROTECTED, newobj_of(), and RGENGC_CHECK_MODE.

◆ ready_to_gc()

static int ready_to_gc ( rb_objspace_t objspace)
static

Definition at line 6232 of file gc.c.

References dont_gc, during_gc, FALSE, heap_eden, heap_ready_to_gc(), and TRUE.

Referenced by gc_start().

◆ rgengc_check_relation()

static void rgengc_check_relation ( rb_objspace_t objspace,
VALUE  obj 
)
static

◆ rgengc_mark_and_rememberset_clear()

static void rgengc_mark_and_rememberset_clear ( rb_objspace_t objspace,
rb_heap_t heap 
)
static

◆ rgengc_remember()

static int rgengc_remember ( rb_objspace_t objspace,
VALUE  obj 
)
static

◆ rgengc_remembered()

static int rgengc_remembered ( rb_objspace_t objspace,
VALUE  obj 
)
static

◆ rgengc_rememberset_mark()

static void rgengc_rememberset_mark ( rb_objspace_t objspace,
rb_heap_t heap 
)
static

◆ rgengc_remembersetbits_get()

static int rgengc_remembersetbits_get ( rb_objspace_t objspace,
VALUE  obj 
)
static

Definition at line 5679 of file gc.c.

References RVALUE_REMEMBERED().

Referenced by rgengc_remember(), and rgengc_remembered().

◆ rgengc_remembersetbits_set()

static int rgengc_remembersetbits_set ( rb_objspace_t objspace,
VALUE  obj 
)
static

◆ rgengc_unprotect_logging_exit_func()

static void rgengc_unprotect_logging_exit_func ( void  )
static

Definition at line 5995 of file gc.c.

References rgengc_unprotect_logging_exit_func_i(), and st_foreach.

Referenced by rb_gc_unprotect_logging().

◆ rgengc_unprotect_logging_exit_func_i()

static int rgengc_unprotect_logging_exit_func_i ( st_data_t  key,
st_data_t  val,
st_data_t  arg 
)
static

Definition at line 5988 of file gc.c.

References ST_CONTINUE.

Referenced by rgengc_unprotect_logging_exit_func().

◆ root_objects_from()

static void root_objects_from ( VALUE  obj,
void *  ptr 
)
static

◆ RUBY_ALIAS_FUNCTION() [1/2]

RUBY_ALIAS_FUNCTION ( rb_data_object_alloc(VALUE klass, void *datap, RUBY_DATA_FUNC dmark, RUBY_DATA_FUNC dfree)  ,
rb_data_object_wrap  ,
(klass, datap, dmark, dfree)   
)

Definition at line 1995 of file gc.c.

References DATA_PTR, rb_data_object_wrap(), and xcalloc.

◆ RUBY_ALIAS_FUNCTION() [2/2]

RUBY_ALIAS_FUNCTION ( rb_data_typed_object_alloc(VALUE klass, void *datap, const rb_data_type_t *type)  ,
rb_data_typed_object_wrap  ,
(klass, datap, type)   
)

Definition at line 2016 of file gc.c.

References DATA_PTR, rb_data_typed_object_wrap(), and xcalloc.

◆ ruby_gc_set_params()

void ruby_gc_set_params ( int  safe_level)

◆ ruby_get_stack_grow_direction()

int ruby_get_stack_grow_direction ( volatile VALUE addr)

Definition at line 3936 of file gc.c.

References SET_MACHINE_STACK_END.

◆ ruby_malloc_size_overflow()

void ruby_malloc_size_overflow ( size_t  count,
size_t  elsize 
)

Definition at line 7937 of file gc.c.

References PRIuSIZE, rb_eArgError, and rb_raise().

Referenced by rb_alloc_tmp_buffer2(), and xmalloc2_size().

◆ ruby_memerror()

static void ruby_memerror ( void  )
static

◆ ruby_memerror_body()

static void* ruby_memerror_body ( void *  dummy)
static

Definition at line 7597 of file gc.c.

References rb_memerror().

Referenced by ruby_memerror().

◆ ruby_mimfree()

void ruby_mimfree ( void *  ptr)

Definition at line 8042 of file gc.c.

References free().

Referenced by ruby_vm_destruct().

◆ ruby_mimmalloc()

void* ruby_mimmalloc ( size_t  size)

Definition at line 8026 of file gc.c.

References malloc.

Referenced by Init_BareVM().

◆ ruby_sized_xfree()

void ruby_sized_xfree ( void *  x,
size_t  size 
)

◆ ruby_sized_xrealloc()

void* ruby_sized_xrealloc ( void *  ptr,
size_t  new_size,
size_t  old_size 
)

Definition at line 7975 of file gc.c.

References objspace_xrealloc().

Referenced by ruby_xrealloc().

◆ ruby_sized_xrealloc2()

void* ruby_sized_xrealloc2 ( void *  ptr,
size_t  n,
size_t  size,
size_t  old_n 
)

Definition at line 7990 of file gc.c.

References len, objspace_xrealloc(), rb_eArgError, and rb_raise().

Referenced by ruby_xrealloc2(), wmap_aset_update(), and wmap_final_func().

◆ ruby_xcalloc()

void* ruby_xcalloc ( size_t  n,
size_t  size 
)

Definition at line 7966 of file gc.c.

References objspace_xcalloc().

Referenced by getifaddrs(), and rb_iseq_defined_string().

◆ ruby_xfree()

void ruby_xfree ( void *  x)

◆ ruby_xmalloc()

void* ruby_xmalloc ( size_t  size)

◆ ruby_xmalloc0()

static void* ruby_xmalloc0 ( size_t  size)
static

Definition at line 7925 of file gc.c.

References objspace_xmalloc0().

Referenced by rb_alloc_tmp_buffer_with_count().

◆ ruby_xmalloc2()

void* ruby_xmalloc2 ( size_t  n,
size_t  size 
)

Definition at line 7945 of file gc.c.

References objspace_xmalloc2().

Referenced by wmap_aset_update().

◆ ruby_xrealloc()

void* ruby_xrealloc ( void *  ptr,
size_t  new_size 
)

Definition at line 7981 of file gc.c.

References ruby_sized_xrealloc().

Referenced by rb_fiddle_realloc().

◆ ruby_xrealloc2()

void* ruby_xrealloc2 ( void *  ptr,
size_t  n,
size_t  size 
)

Definition at line 8000 of file gc.c.

References ruby_sized_xrealloc2().

◆ run_final()

static void run_final ( rb_objspace_t objspace,
VALUE  zombie 
)
static

Definition at line 2762 of file gc.c.

References finalizer_table, key, run_finalizer(), RZOMBIE, st_data_t, st_delete, and code_page_table::table.

Referenced by finalize_list().

◆ run_finalizer()

static void run_finalizer ( rb_objspace_t objspace,
VALUE  obj,
VALUE  table 
)
static

◆ run_single_final()

static VALUE run_single_final ( VALUE  final,
VALUE  objid 
)
static

◆ RVALUE_AGE_INC()

static void RVALUE_AGE_INC ( rb_objspace_t objspace,
VALUE  obj 
)
inlinestatic

◆ RVALUE_AGE_RESET()

static void RVALUE_AGE_RESET ( VALUE  obj)
inlinestatic

◆ RVALUE_AGE_RESET_RAW()

static void RVALUE_AGE_RESET_RAW ( VALUE  obj)
inlinestatic

Definition at line 1264 of file gc.c.

References RBasic::flags, RBASIC, and RVALUE_FLAGS_AGE_SET().

Referenced by rb_copy_wb_protected_attribute(), and RVALUE_AGE_RESET().

◆ RVALUE_AGE_SET_CANDIDATE()

static void RVALUE_AGE_SET_CANDIDATE ( rb_objspace_t objspace,
VALUE  obj 
)
inlinestatic

◆ RVALUE_AGE_SET_OLD()

static void RVALUE_AGE_SET_OLD ( rb_objspace_t objspace,
VALUE  obj 
)
inlinestatic

◆ RVALUE_BLACK_P()

static int RVALUE_BLACK_P ( VALUE  obj)
inlinestatic

◆ RVALUE_DEMOTE()

static void RVALUE_DEMOTE ( rb_objspace_t objspace,
VALUE  obj 
)
inlinestatic

◆ RVALUE_DEMOTE_RAW()

static void RVALUE_DEMOTE_RAW ( rb_objspace_t objspace,
VALUE  obj 
)
inlinestatic

Definition at line 1238 of file gc.c.

References CLEAR_IN_BITMAP, RBasic::flags, GET_HEAP_UNCOLLECTIBLE_BITS, RBASIC, and RVALUE_FLAGS_AGE_SET().

Referenced by RVALUE_DEMOTE().

◆ RVALUE_FLAGS_AGE()

static int RVALUE_FLAGS_AGE ( VALUE  flags)
inlinestatic

◆ RVALUE_FLAGS_AGE_SET()

static VALUE RVALUE_FLAGS_AGE_SET ( VALUE  flags,
int  age 
)
inlinestatic

◆ RVALUE_MARKED()

static int RVALUE_MARKED ( VALUE  obj)
inlinestatic

◆ RVALUE_MARKING()

static int RVALUE_MARKING ( VALUE  obj)
inlinestatic

◆ RVALUE_OLD_P()

static int RVALUE_OLD_P ( VALUE  obj)
inlinestatic

◆ RVALUE_OLD_P_RAW()

static int RVALUE_OLD_P_RAW ( VALUE  obj)
inlinestatic

Definition at line 1144 of file gc.c.

References FL_PROMOTED0, FL_PROMOTED1, RBasic::flags, and RBASIC.

Referenced by RVALUE_OLD_P().

◆ RVALUE_OLD_UNCOLLECTIBLE_SET()

static void RVALUE_OLD_UNCOLLECTIBLE_SET ( rb_objspace_t objspace,
VALUE  obj 
)
inlinestatic

Definition at line 1179 of file gc.c.

References GET_HEAP_PAGE, and RVALUE_PAGE_OLD_UNCOLLECTIBLE_SET().

Referenced by RVALUE_AGE_INC(), and RVALUE_AGE_SET_OLD().

◆ RVALUE_PAGE_OLD_UNCOLLECTIBLE_SET()

static void RVALUE_PAGE_OLD_UNCOLLECTIBLE_SET ( rb_objspace_t objspace,
struct heap_page page,
VALUE  obj 
)
inlinestatic

◆ RVALUE_REMEMBERED()

static int RVALUE_REMEMBERED ( VALUE  obj)
inlinestatic

◆ RVALUE_UNCOLLECTIBLE()

static int RVALUE_UNCOLLECTIBLE ( VALUE  obj)
inlinestatic

◆ RVALUE_WB_UNPROTECTED()

static int RVALUE_WB_UNPROTECTED ( VALUE  obj)
inlinestatic

◆ RVALUE_WHITE_P()

static int RVALUE_WHITE_P ( VALUE  obj)
inlinestatic

Definition at line 1293 of file gc.c.

References FALSE, and RVALUE_MARKED().

Referenced by check_color_i(), and gc_writebarrier_incremental().

◆ set_zero()

static int set_zero ( st_data_t  key,
st_data_t  val,
st_data_t  arg 
)
static

Definition at line 3272 of file gc.c.

References hash(), INT2FIX, rb_hash_aset(), and ST_CONTINUE.

Referenced by count_objects().

◆ setup_gc_stat_symbols()

static void setup_gc_stat_symbols ( void  )
static

◆ should_be_callable()

static void should_be_callable ( VALUE  block)
static

Definition at line 2606 of file gc.c.

References PRIsVALUE, rb_eArgError, rb_intern, rb_obj_class(), rb_obj_respond_to(), rb_raise(), and TRUE.

Referenced by define_final(), and rb_define_finalizer().

◆ should_be_finalizable()

static void should_be_finalizable ( VALUE  obj)
static

Definition at line 2614 of file gc.c.

References FL_ABLE, rb_check_frozen, rb_eArgError, rb_obj_classname(), and rb_raise().

Referenced by define_final(), rb_define_finalizer(), and wmap_aset().

◆ shrink_stack_chunk_cache()

static void shrink_stack_chunk_cache ( mark_stack_t stack)
static

◆ stack_check()

static int stack_check ( int  water_mark)
static

Definition at line 3957 of file gc.c.

References GET_THREAD, rb_thread_struct::machine, SET_STACK_END, STACK_LENGTH, and STACK_LEVEL_MAX.

Referenced by ruby_stack_check().

◆ stack_chunk_alloc()

static stack_chunk_t* stack_chunk_alloc ( void  )
static

Definition at line 3745 of file gc.c.

References malloc, and rb_memerror().

Referenced by init_mark_stack(), and push_mark_stack_chunk().

◆ type_name()

static const char* type_name ( int  type,
VALUE  obj 
)
static

◆ undefine_final()

static VALUE undefine_final ( VALUE  os,
VALUE  obj 
)
static

Definition at line 2589 of file gc.c.

References rb_undefine_finalizer().

Referenced by Init_GC().

◆ verify_internal_consistency_i()

static int verify_internal_consistency_i ( void *  page_start,
void *  page_end,
size_t  stride,
void *  ptr 
)
static

◆ wmap_allocate()

static VALUE wmap_allocate ( VALUE  klass)
static

◆ wmap_aref()

static VALUE wmap_aref ( VALUE  self,
VALUE  wmap 
)
static

◆ wmap_aset()

static VALUE wmap_aset ( VALUE  self,
VALUE  wmap,
VALUE  orig 
)
static

◆ wmap_aset_update()

static int wmap_aset_update ( st_data_t key,
st_data_t val,
st_data_t  arg,
int  existing 
)
static

Definition at line 8447 of file gc.c.

References ruby_sized_xrealloc2(), ruby_xmalloc2(), size, ST_CONTINUE, st_data_t, and ST_STOP.

Referenced by wmap_aset().

◆ wmap_each()

static VALUE wmap_each ( VALUE  self)
static

Definition at line 8336 of file gc.c.

References rb_objspace, st_data_t, st_foreach, TypedData_Get_Struct, weakmap::wmap2obj, and wmap_each_i().

Referenced by Init_GC().

◆ wmap_each_i()

static int wmap_each_i ( st_data_t  key,
st_data_t  val,
st_data_t  arg 
)
static

Definition at line 8324 of file gc.c.

References is_id_value(), is_live_object(), rb_yield_values(), and ST_CONTINUE.

Referenced by wmap_each().

◆ wmap_each_key()

static VALUE wmap_each_key ( VALUE  self)
static

Definition at line 8359 of file gc.c.

References rb_objspace, st_data_t, st_foreach, TypedData_Get_Struct, weakmap::wmap2obj, and wmap_each_key_i().

Referenced by Init_GC().

◆ wmap_each_key_i()

static int wmap_each_key_i ( st_data_t  key,
st_data_t  val,
st_data_t  arg 
)
static

Definition at line 8347 of file gc.c.

References is_id_value(), is_live_object(), rb_yield(), and ST_CONTINUE.

Referenced by wmap_each_key().

◆ wmap_each_value()

static VALUE wmap_each_value ( VALUE  self)
static

Definition at line 8382 of file gc.c.

References rb_objspace, st_data_t, st_foreach, TypedData_Get_Struct, weakmap::wmap2obj, and wmap_each_value_i().

Referenced by Init_GC().

◆ wmap_each_value_i()

static int wmap_each_value_i ( st_data_t  key,
st_data_t  val,
st_data_t  arg 
)
static

Definition at line 8370 of file gc.c.

References is_id_value(), is_live_object(), rb_yield(), and ST_CONTINUE.

Referenced by wmap_each_value().

◆ wmap_final_func()

static int wmap_final_func ( st_data_t key,
st_data_t value,
st_data_t  arg,
int  existing 
)
static

Definition at line 8224 of file gc.c.

References ruby_sized_xfree(), ruby_sized_xrealloc2(), size, ST_CONTINUE, st_data_t, ST_DELETE, and ST_STOP.

Referenced by wmap_finalize().

◆ wmap_finalize()

static VALUE wmap_finalize ( VALUE  self,
VALUE  objid 
)
static

◆ wmap_free()

static void wmap_free ( void *  ptr)
static

Definition at line 8174 of file gc.c.

References weakmap::obj2wmap, st_foreach, st_free_table, weakmap::wmap2obj, and wmap_free_map().

◆ wmap_free_map()

static int wmap_free_map ( st_data_t  key,
st_data_t  val,
st_data_t  arg 
)
static

Definition at line 8166 of file gc.c.

References ruby_sized_xfree(), and ST_CONTINUE.

Referenced by wmap_free().

◆ wmap_has_key()

static VALUE wmap_has_key ( VALUE  self,
VALUE  key 
)
static

Definition at line 8502 of file gc.c.

References NIL_P, Qfalse, Qtrue, and wmap_aref().

Referenced by Init_GC().

◆ wmap_inspect()

static VALUE wmap_inspect ( VALUE  self)
static

◆ wmap_inspect_i()

static int wmap_inspect_i ( st_data_t  key,
st_data_t  val,
st_data_t  arg 
)
static

◆ wmap_keys()

static VALUE wmap_keys ( VALUE  self)
static

◆ wmap_keys_i()

static int wmap_keys_i ( st_data_t  key,
st_data_t  val,
st_data_t  arg 
)
static

◆ wmap_mark()

static void wmap_mark ( void *  ptr)
static

Definition at line 8156 of file gc.c.

References weakmap::final, weakmap::obj2wmap, rb_gc_mark(), st_data_t, and st_foreach.

◆ wmap_memsize()

static size_t wmap_memsize ( const void *  ptr)
static

◆ wmap_memsize_map()

static int wmap_memsize_map ( st_data_t  key,
st_data_t  val,
st_data_t  arg 
)
static

Definition at line 8183 of file gc.c.

References ST_CONTINUE.

Referenced by wmap_memsize().

◆ wmap_size()

static VALUE wmap_size ( VALUE  self)
static

Definition at line 8508 of file gc.c.

References st_table::num_entries, TypedData_Get_Struct, ULONG2NUM, and weakmap::wmap2obj.

Referenced by Init_GC().

◆ wmap_values()

static VALUE wmap_values ( VALUE  self)
static

◆ wmap_values_i()

static int wmap_values_i ( st_data_t  key,
st_data_t  val,
st_data_t  arg 
)
static

◆ xmalloc2_size()

static size_t xmalloc2_size ( const size_t  count,
const size_t  elsize 
)
inlinestatic

Definition at line 7858 of file gc.c.

References rb_mul_size_overflow(), ruby_malloc_size_overflow(), and SSIZE_MAX.

Referenced by objspace_xcalloc(), and objspace_xmalloc2().

Variable Documentation

◆ gc_params

ruby_gc_params_t gc_params
static
Initial value:
= {
}
#define FALSE
Definition: nkf.h:174
#define GC_HEAP_GROWTH_FACTOR
Definition: gc.c:111
#define GC_HEAP_OLDOBJECT_LIMIT_FACTOR
Definition: gc.c:117
#define GC_HEAP_FREE_SLOTS_MAX_RATIO
Definition: gc.c:127
#define GC_HEAP_FREE_SLOTS_MIN_RATIO
Definition: gc.c:121
#define GC_MALLOC_LIMIT_MAX
Definition: gc.c:134
#define GC_OLDMALLOC_LIMIT_GROWTH_FACTOR
Definition: gc.c:144
#define GC_HEAP_GROWTH_MAX_SLOTS
Definition: gc.c:114
#define GC_MALLOC_LIMIT_GROWTH_FACTOR
Definition: gc.c:137
#define GC_HEAP_FREE_SLOTS_GOAL_RATIO
Definition: gc.c:124
#define GC_HEAP_FREE_SLOTS
Definition: gc.c:108
#define GC_HEAP_INIT_SLOTS
Definition: gc.c:105
#define GC_OLDMALLOC_LIMIT_MIN
Definition: gc.c:141
#define GC_MALLOC_LIMIT_MIN
Definition: gc.c:131
#define GC_OLDMALLOC_LIMIT_MAX
Definition: gc.c:147

Definition at line 185 of file gc.c.

◆ gc_stat_compat_symbols

VALUE gc_stat_compat_symbols[gc_stat_compat_sym_last]
static

Definition at line 6906 of file gc.c.

◆ gc_stat_compat_table

VALUE gc_stat_compat_table
static

Definition at line 6907 of file gc.c.

◆ gc_stat_symbols

VALUE gc_stat_symbols[gc_stat_sym_last]
static

Definition at line 6905 of file gc.c.

◆ rb_gc_guarded_val

volatile VALUE rb_gc_guarded_val

Definition at line 94 of file gc.c.

Referenced by rb_gc_guarded_ptr_val().

◆ rb_mGC

VALUE rb_mGC

Definition at line 813 of file gc.c.

◆ rgengc_unprotect_logging_table

st_table* rgengc_unprotect_logging_table
static

Definition at line 5985 of file gc.c.

◆ ruby_disable_gc

int ruby_disable_gc = 0

Definition at line 814 of file gc.c.

◆ ruby_gc_debug_indent

int ruby_gc_debug_indent = 0

Definition at line 812 of file gc.c.

◆ ruby_initial_gc_stress_ptr

VALUE* ruby_initial_gc_stress_ptr = &ruby_initial_gc_stress

Definition at line 720 of file gc.c.

Referenced by set_debug_option().

◆ ruby_stack_grow_direction

int ruby_stack_grow_direction

Definition at line 3934 of file gc.c.

◆ weakmap_type

const rb_data_type_t weakmap_type
static
Initial value:
= {
"weakmap",
{
},
}
#define RUBY_TYPED_FREE_IMMEDIATELY
Definition: ruby.h:1145
static void wmap_mark(void *ptr)
Definition: gc.c:8156
static size_t wmap_memsize(const void *ptr)
Definition: gc.c:8191
static void wmap_free(void *ptr)
Definition: gc.c:8174

Definition at line 8202 of file gc.c.