Ruby  2.1.10p492(2016-04-01revision54464)
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
gc.c File Reference
#include "ruby/ruby.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 "internal.h"
#include "gc.h"
#include "constant.h"
#include "ruby_atomic.h"
#include "probes.h"
#include <stdio.h>
#include <stdarg.h>
#include <setjmp.h>
#include <sys/types.h>
#include <assert.h>
#include "regint.h"

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  each_obj_args
 
struct  os_each_struct
 
struct  force_finalize_list
 
struct  mark_tbl_arg
 
struct  verify_internal_consistency_struct
 
struct  objspace_and_reason
 
struct  root_objects_data
 
struct  weakmap
 
struct  wmap_iter_arg
 

Macros

#define __has_feature(x)   0
 
#define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS
 
#define rb_setjmp(env)   RUBY_SETJMP(env)
 
#define rb_jmp_buf   rb_jmpbuf_t
 
#define GC_HEAP_FREE_SLOTS   4096
 
#define GC_HEAP_INIT_SLOTS   10000
 
#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_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 GC_DEBUG   0
 
#define RGENGC_DEBUG   0
 
#define RGENGC_CHECK_MODE   0
 
#define RGENGC_PROFILE   0
 
#define RGENGC_THREEGEN   0
 
#define RGENGC_ESTIMATE_OLDMALLOC   1
 
#define GC_PROFILE_MORE_DETAIL   0
 
#define GC_PROFILE_DETAIL_MEMORY   0
 
#define GC_ENABLE_LAZY_SWEEP   1
 
#define CALC_EXACT_MALLOC_SIZE   0
 
#define MALLOC_ALLOCATED_SIZE   0
 
#define MALLOC_ALLOCATED_SIZE_CHECK   0
 
#define STACK_CHUNK_SIZE   500
 
#define HEAP_ALIGN_LOG   14
 
#define CEILDIV(i, mod)   (((i) + (mod) - 1)/(mod))
 
#define GET_PAGE_BODY(x)   ((struct heap_page_body *)((bits_t)(x) & ~(HEAP_ALIGN_MASK)))
 
#define GET_PAGE_HEADER(x)   (&GET_PAGE_BODY(x)->header)
 
#define GET_HEAP_PAGE(x)   (GET_PAGE_HEADER(x)->page)
 
#define GET_HEAP_MARK_BITS(x)   (&GET_HEAP_PAGE(x)->mark_bits[0])
 
#define GET_HEAP_REMEMBERSET_BITS(x)   (&GET_HEAP_PAGE(x)->rememberset_bits[0])
 
#define GET_HEAP_OLDGEN_BITS(x)   (&GET_HEAP_PAGE(x)->oldgen_bits[0])
 
#define NUM_IN_PAGE(p)   (((bits_t)(p) & HEAP_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 rb_objspace   (*GET_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_pages_used   objspace->heap_pages.used
 
#define heap_pages_length   objspace->heap_pages.length
 
#define heap_pages_lomem   objspace->heap_pages.range[0]
 
#define heap_pages_himem   objspace->heap_pages.range[1]
 
#define heap_pages_swept_slots   objspace->heap_pages.swept_slots
 
#define heap_pages_increment   objspace->heap_pages.increment
 
#define heap_pages_min_free_slots   objspace->heap_pages.min_free_slots
 
#define heap_pages_max_free_slots   objspace->heap_pages.max_free_slots
 
#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->flags.finalizing
 
#define finalizer_table   objspace->finalizer_table
 
#define global_List   objspace->global_list
 
#define ruby_gc_stress   objspace->gc_stress
 
#define monitor_level   objspace->rgengc.monitor_level
 
#define monitored_object_table   objspace->rgengc.monitored_object_table
 
#define is_lazy_sweeping(heap)   ((heap)->sweep_pages != 0)
 
#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 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 rgengc_report   if (RGENGC_DEBUG) rgengc_report_body
 
#define FL_TEST2(x, f)   ((RGENGC_CHECK_MODE && SPECIAL_CONST_P(x)) ? (rb_bug("FL_TEST2: SPECIAL_CONST"), 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_WB_PROTECTED_RAW(obj)   FL_TEST2((obj), FL_WB_PROTECTED)
 
#define RVALUE_WB_PROTECTED(obj)   RVALUE_WB_PROTECTED_RAW(check_gen_consistency((VALUE)obj))
 
#define RVALUE_OLDGEN_BITMAP(obj)   MARKED_IN_BITMAP(GET_HEAP_OLDGEN_BITS(obj), (obj))
 
#define gc_event_hook(objspace, event, data)
 
#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 rb_gc_mark_locations(start, end)   gc_mark_locations(objspace, (start), (end))
 
#define GET_STACK_BOUNDS(start, end, appendix)
 
#define STR_ASSOC   FL_USER3 /* copied from string.c */
 
#define RGENGC_PRINT_TICK   0
 
#define MARK_CHECKPOINT_PRINT_TICK(category)
 
#define MARK_CHECKPOINT(category)
 
#define I(s)   ID_##s = rb_intern(#s);
 
#define GC_NOTIFY   0
 
#define S(s)   sym_##s = ID2SYM(rb_intern_const(#s))
 
#define SET(name, attr)
 
#define S(s)   sym_##s = ID2SYM(rb_intern_const(#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 TYPE_NAME(t)   case (t): return #t;
 
#define OPT(o)   if (o) rb_ary_push(opts, rb_str_new2(#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_RESCAN = 0x008, GPR_FLAG_MAJOR_BY_STRESS = 0x010, 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  {
  HEAP_ALIGN = (1UL << HEAP_ALIGN_LOG), HEAP_ALIGN_MASK = (~(~0UL << HEAP_ALIGN_LOG)), REQUIRED_SIZE_BY_MALLOC = (sizeof(size_t) * 5), HEAP_SIZE = (HEAP_ALIGN - REQUIRED_SIZE_BY_MALLOC),
  HEAP_OBJ_LIMIT = (unsigned int)((HEAP_SIZE - sizeof(struct heap_page_header))/sizeof(struct RVALUE)), HEAP_BITMAP_LIMIT = CEILDIV(CEILDIV(HEAP_SIZE, sizeof(struct RVALUE)), BITS_BITLENGTH), HEAP_BITMAP_SIZE = ( BITS_SIZE * HEAP_BITMAP_LIMIT), HEAP_BITMAP_PLANES = USE_RGENGC ? 3 : 1
}
 
enum  memop_type { MEMOP_TYPE_MALLOC = 1, MEMOP_TYPE_FREE = 2, MEMOP_TYPE_REALLOC = 3 }
 

Functions

volatile VALUErb_gc_guarded_ptr (volatile VALUE *ptr)
 
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 voidaligned_malloc (size_t, size_t)
 
static void aligned_free (void *)
 
static void init_mark_stack (mark_stack_t *stack)
 
static VALUE lazy_sweep_enable (void)
 
static int ready_to_gc (rb_objspace_t *objspace)
 
static int heap_ready_to_gc (rb_objspace_t *objspace, rb_heap_t *heap)
 
static int garbage_collect (rb_objspace_t *, int full_mark, int immediate_sweep, int reason)
 
static int garbage_collect_body (rb_objspace_t *, int full_mark, int immediate_sweep, int reason)
 
static int gc_heap_lazy_sweep (rb_objspace_t *objspace, rb_heap_t *heap)
 
static void gc_rest_sweep (rb_objspace_t *objspace)
 
static void gc_heap_rest_sweep (rb_objspace_t *objspace, rb_heap_t *heap)
 
static void gc_mark_stacked_objects (rb_objspace_t *)
 
static void gc_mark (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 size_t obj_memsize_of (VALUE obj, int use_tdata)
 
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 *)
 
static void rgengc_report_body (int level, rb_objspace_t *objspace, const char *fmt,...)
 
static const char * type_name (int type, VALUE obj)
 
static const char * obj_type_name (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 is_pointer_to_heap (rb_objspace_t *objspace, void *ptr)
 
static int gc_marked (rb_objspace_t *objspace, VALUE ptr)
 
static VALUE check_gen_consistency (VALUE obj)
 
static VALUE RVALUE_INFANT_P (VALUE obj)
 
static VALUE RVALUE_OLD_BITMAP_P (VALUE obj)
 
static VALUE RVALUE_OLD_P (VALUE obj)
 
static VALUE RVALUE_PROMOTED_P (VALUE obj)
 
static void RVALUE_PROMOTE_INFANT (VALUE obj)
 
static void RVALUE_DEMOTE_FROM_OLD (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 (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 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 void heap_set_increment (rb_objspace_t *objspace, size_t minimum_limit)
 
static int heap_increment (rb_objspace_t *objspace, rb_heap_t *heap)
 
static struct heap_pageheap_prepare_freepage (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 (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_objspace_t *objspace, const rb_event_flag_t event, VALUE data)
 
static VALUE newobj_of (VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3)
 
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_data_object_alloc (VALUE klass, void *datap, RUBY_DATA_FUNC dmark, RUBY_DATA_FUNC dfree)
 
VALUE rb_data_typed_object_alloc (VALUE klass, void *datap, const rb_data_type_t *type)
 
size_t rb_objspace_data_type_memsize (VALUE obj)
 
const char * rb_objspace_data_type_name (VALUE obj)
 
static int free_method_entry_i (ID key, rb_method_entry_t *me, st_data_t data)
 
void rb_free_m_tbl (st_table *tbl)
 
void rb_free_m_tbl_wrapper (struct method_table_wrapper *wrapper)
 
static int free_const_entry_i (ID key, rb_const_entry_t *ce, st_data_t data)
 
void rb_free_const_table (st_table *tbl)
 
static void make_deferred (rb_objspace_t *objspace, RVALUE *p)
 
static void make_io_deferred (rb_objspace_t *objspace, RVALUE *p)
 
static int obj_free (rb_objspace_t *objspace, VALUE obj)
 
void Init_heap (void)
 
static VALUE objspace_each_objects (VALUE arg)
 
void rb_objspace_each_objects (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 arg)
 
static void run_finalizer (rb_objspace_t *objspace, VALUE obj, VALUE table)
 
static void run_final (rb_objspace_t *objspace, VALUE obj)
 
static void finalize_list (rb_objspace_t *objspace, RVALUE *p)
 
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 (void)
 
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)
 
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_dead_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)
 
static VALUE id2ref (VALUE obj, VALUE objid)
 
VALUE rb_obj_id (VALUE obj)
 
size_t rb_str_memsize (VALUE)
 
size_t rb_ary_memsize (VALUE)
 
size_t rb_io_memsize (const rb_io_t *)
 
size_t rb_generic_ivar_memsize (VALUE)
 
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_live_slot (rb_objspace_t *objspace)
 
static size_t objspace_total_slot (rb_objspace_t *objspace)
 
static size_t objspace_free_slot (rb_objspace_t *objspace)
 
static void gc_setup_mark_bits (struct heap_page *page)
 
static void 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 void gc_before_heap_sweep (rb_objspace_t *objspace, rb_heap_t *heap)
 
static void gc_before_sweep (rb_objspace_t *objspace)
 
static void gc_after_sweep (rb_objspace_t *objspace)
 
static void gc_sweep (rb_objspace_t *objspace, int immediate_sweep)
 
static void push_mark_stack (mark_stack_t *, VALUE)
 
static int pop_mark_stack (mark_stack_t *, VALUE *)
 
static void shrink_stack_chunk_cache (mark_stack_t *stack)
 
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)
 
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 VALUE *x, register long n)
 
static void gc_mark_locations (rb_objspace_t *objspace, VALUE *start, VALUE *end)
 
void rb_gc_mark_locations (VALUE *start, VALUE *end)
 
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)
 
void rb_mark_method_entry (const rb_method_entry_t *me)
 
static int mark_method_entry_i (ID key, const rb_method_entry_t *me, st_data_t data)
 
static void mark_m_tbl_wrapper (rb_objspace_t *objspace, struct method_table_wrapper *wrapper)
 
static int mark_const_entry_i (ID key, const rb_const_entry_t *ce, st_data_t data)
 
static void mark_const_tbl (rb_objspace_t *objspace, st_table *tbl)
 
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_mark_ptr (rb_objspace_t *objspace, VALUE ptr)
 
static void rgengc_check_relation (rb_objspace_t *objspace, VALUE obj)
 
void rb_gc_mark (VALUE ptr)
 
void rb_gc_resurrect (VALUE obj)
 
static void gc_mark_roots (rb_objspace_t *objspace, int full_mark, const char **categoryp)
 
static void gc_marks_body (rb_objspace_t *objspace, int full_mark)
 
static void verify_internal_consistency_reachable_i (VALUE child, void *ptr)
 
static int verify_internal_consistency_i (void *page_start, void *page_end, size_t stride, void *ptr)
 
static VALUE gc_verify_internal_consistency (VALUE self)
 
static void gc_marks (rb_objspace_t *objspace, int full_mark)
 
static int rgengc_remembersetbits_get (rb_objspace_t *objspace, VALUE obj)
 
static int rgengc_remembersetbits_set (rb_objspace_t *objspace, VALUE obj)
 
void rb_gc_writebarrier (VALUE a, VALUE b)
 
void rb_gc_writebarrier_unprotect_promoted (VALUE obj)
 
void rb_gc_writebarrier_remember_promoted (VALUE obj)
 
static int rgengc_unprotect_logging_exit_func_i (st_data_t key, st_data_t val)
 
static void rgengc_unprotect_logging_exit_func (void)
 
void rb_gc_unprotect_logging (void *objptr, const char *filename, int line)
 
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 p)
 
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 voidgc_with_gvl (void *ptr)
 
static int garbage_collect_with_gvl (rb_objspace_t *objspace, int full_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 (int flags, VALUE hash_or_key)
 
VALUE rb_gc_latest_gc_info (VALUE key)
 
static VALUE gc_latest_gc_info (int argc, VALUE *argv, VALUE self)
 
static VALUE gc_stat_internal (VALUE hash_or_sym, size_t *out)
 
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 (VALUE self, VALUE flag)
 
VALUE rb_gc_enable (void)
 
VALUE rb_gc_disable (void)
 
static int get_envparam_int (const char *name, unsigned int *default_value, int lower_bound)
 
static int get_envparam_double (const char *name, double *default_value, double lower_bound)
 
static void gc_set_initial_pages (void)
 
void ruby_gc_set_params (int safe_level)
 
void rb_gc_set_params (void)
 
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 voidnegative_size_allocation_error_with_gvl (void *ptr)
 
static voidruby_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_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 voidobjspace_malloc_fixup (rb_objspace_t *objspace, void *mem, size_t size)
 
static voidobjspace_xmalloc (rb_objspace_t *objspace, size_t size)
 
static voidobjspace_xrealloc (rb_objspace_t *objspace, void *ptr, size_t new_size, size_t old_size)
 
voidruby_xmalloc (size_t size)
 
static size_t xmalloc2_size (size_t n, size_t size)
 
voidruby_xmalloc2 (size_t n, size_t size)
 
static voidobjspace_xcalloc (rb_objspace_t *objspace, size_t count, size_t elsize)
 
voidruby_xcalloc (size_t n, size_t size)
 
voidruby_sized_xrealloc (void *ptr, size_t new_size, size_t old_size)
 
voidruby_xrealloc (void *ptr, size_t new_size)
 
voidruby_sized_xrealloc2 (void *ptr, size_t n, size_t size, size_t old_n)
 
voidruby_xrealloc2 (void *ptr, size_t n, size_t size)
 
void ruby_sized_xfree (void *x, size_t size)
 
void ruby_xfree (void *x)
 
voidruby_mimmalloc (size_t size)
 
void ruby_mimfree (void *ptr)
 
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)
 
void Init_GC (void)
 

Variables

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_stress = 0
 
int ruby_stack_grow_direction
 
static st_tablergengc_unprotect_logging_table
 
static const rb_data_type_t weakmap_type
 

Macro Definition Documentation

#define __has_feature (   x)    0

Definition at line 35 of file gc.c.

#define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS

Definition at line 64 of file gc.c.

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

Definition at line 591 of file gc.c.

Referenced by gc_page_sweep().

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

Definition at line 589 of file gc.c.

Referenced by gc_page_sweep().

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

Definition at line 590 of file gc.c.

#define CALC_EXACT_MALLOC_SIZE   0

Definition at line 247 of file gc.c.

Referenced by gc_profile_dump_on(), and Init_GC().

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

Definition at line 551 of file gc.c.

#define CLEAR_IN_BITMAP (   bits,
  p 
)    ((bits)[BITMAP_INDEX(p)] = (bits)[BITMAP_INDEX(p)] & ~BITMAP_BIT(p))
#define COUNT_TYPE (   t)    case (t): type = ID2SYM(rb_intern(#t)); break;

Referenced by count_objects().

#define dont_gc   objspace->flags.dont_gc
#define during_gc   objspace->flags.during_gc
#define finalizer_table   objspace->finalizer_table
#define finalizing   objspace->flags.finalizing
#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 705 of file gc.c.

Referenced by RVALUE_PROMOTE_INFANT().

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

Definition at line 704 of file gc.c.

Referenced by check_gen_consistency(), RVALUE_INFANT_P(), RVALUE_OLD_P(), and RVALUE_PROMOTED_P().

#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 706 of file gc.c.

Referenced by RVALUE_DEMOTE_FROM_OLD().

#define GC_DEBUG   0

Definition at line 173 of file gc.c.

Referenced by Init_GC().

#define GC_ENABLE_LAZY_SWEEP   1

Definition at line 244 of file gc.c.

Referenced by garbage_collect_body(), heap_prepare_freepage(), and Init_GC().

#define gc_event_hook (   objspace,
  event,
  data 
)
Value:
do { \
if (UNLIKELY((objspace)->hook_events & (event))) { \
gc_event_hook_body((objspace), (event), (data)); \
} \
} while (0)
VALUE data
Definition: tcltklib.c:3360
if(args--[1]==0)
Definition: array.c:3187
#define UNLIKELY(x)
Definition: vm_core.h:109
static void gc_event_hook_body(rb_objspace_t *objspace, const rb_event_flag_t event, VALUE data)
Definition: gc.c:1272

Definition at line 1278 of file gc.c.

Referenced by garbage_collect_body(), gc_after_sweep(), gc_marks_body(), newobj_of(), and obj_free().

#define GC_HEAP_FREE_SLOTS   4096

Definition at line 100 of file gc.c.

#define GC_HEAP_GROWTH_FACTOR   1.8

Definition at line 106 of file gc.c.

#define GC_HEAP_GROWTH_MAX_SLOTS   0 /* 0 is disable */

Definition at line 109 of file gc.c.

#define GC_HEAP_INIT_SLOTS   10000

Definition at line 103 of file gc.c.

#define GC_HEAP_OLDOBJECT_LIMIT_FACTOR   2.0

Definition at line 112 of file gc.c.

#define GC_MALLOC_LIMIT_GROWTH_FACTOR   1.4

Definition at line 122 of file gc.c.

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

Definition at line 119 of file gc.c.

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

Definition at line 116 of file gc.c.

#define GC_NOTIFY   0

Definition at line 4970 of file gc.c.

Referenced by garbage_collect_body().

#define GC_OLDMALLOC_LIMIT_GROWTH_FACTOR   1.2

Definition at line 129 of file gc.c.

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

Definition at line 132 of file gc.c.

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

Definition at line 126 of file gc.c.

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

Definition at line 241 of file gc.c.

Referenced by gc_profile_dump_on(), and Init_GC().

#define GC_PROFILE_MORE_DETAIL   0

Definition at line 238 of file gc.c.

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

#define GC_PROFILE_RECORD_DEFAULT_SIZE   100

Definition at line 6706 of file gc.c.

Referenced by gc_prof_setup_new_record(), and gc_profile_clear().

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

Definition at line 585 of file gc.c.

Referenced by gc_mark_ptr(), gc_marked(), is_dead_object(), rb_gc_force_recycle(), and rb_obj_gc_flags().

#define GET_HEAP_OLDGEN_BITS (   x)    (&GET_HEAP_PAGE(x)->oldgen_bits[0])

Definition at line 587 of file gc.c.

Referenced by obj_free(), rb_gc_force_recycle(), RVALUE_DEMOTE_FROM_OLD(), and RVALUE_PROMOTE_INFANT().

#define GET_HEAP_PAGE (   x)    (GET_PAGE_HEADER(x)->page)
#define GET_HEAP_REMEMBERSET_BITS (   x)    (&GET_HEAP_PAGE(x)->rememberset_bits[0])
#define GET_PAGE_BODY (   x)    ((struct heap_page_body *)((bits_t)(x) & ~(HEAP_ALIGN_MASK)))

Definition at line 582 of file gc.c.

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

Definition at line 583 of file gc.c.

#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:3227
#define STACK_END
Definition: gc.c:3228
gz end
Definition: zlib.c:2272

Definition at line 3472 of file gc.c.

Referenced by mark_current_machine_context(), and rb_gc_mark_machine_stack().

#define global_List   objspace->global_list
#define HEAP_ALIGN_LOG   14

Definition at line 549 of file gc.c.

#define heap_eden   (&objspace->eden_heap)
#define heap_pages_deferred_final   objspace->heap_pages.deferred_final
#define heap_pages_final_slots   objspace->heap_pages.final_slots

Definition at line 619 of file gc.c.

Referenced by gc_page_sweep(), gc_stat_internal(), objspace_free_slot(), and run_final().

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

Definition at line 614 of file gc.c.

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

#define heap_pages_increment   objspace->heap_pages.increment
#define heap_pages_length   objspace->heap_pages.length
#define heap_pages_lomem   objspace->heap_pages.range[0]

Definition at line 613 of file gc.c.

Referenced by heap_page_allocate(), and rb_objspace_free().

#define heap_pages_max_free_slots   objspace->heap_pages.max_free_slots

Definition at line 618 of file gc.c.

Referenced by gc_before_sweep(), and heap_pages_free_unused_pages().

#define heap_pages_min_free_slots   objspace->heap_pages.min_free_slots

Definition at line 617 of file gc.c.

Referenced by gc_after_sweep(), and gc_before_sweep().

#define heap_pages_sorted   objspace->heap_pages.sorted
#define heap_pages_swept_slots   objspace->heap_pages.swept_slots
#define heap_pages_used   objspace->heap_pages.used
#define heap_tomb   (&objspace->tomb_heap)
#define I (   s)    ID_##s = rb_intern(#s);

Referenced by rb_obj_gc_flags().

#define is_lazy_sweeping (   heap)    ((heap)->sweep_pages != 0)
#define MALLOC_ALLOCATED_SIZE   0

Definition at line 254 of file gc.c.

Referenced by Init_GC().

#define malloc_allocated_size   objspace->malloc_params.allocated_size

Definition at line 609 of file gc.c.

Referenced by gc_prof_setup_new_record().

#define MALLOC_ALLOCATED_SIZE_CHECK   0

Definition at line 257 of file gc.c.

Referenced by Init_GC().

#define malloc_increase   objspace->malloc_params.increase
#define malloc_limit   objspace->malloc_params.limit
#define MARK_CHECKPOINT (   category)
Value:
do { \
if (categoryp) *categoryp = category; \
} while (0)
#define MARK_CHECKPOINT_PRINT_TICK(category)
if(args--[1]==0)
Definition: array.c:3187

Referenced by gc_mark_roots().

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

Definition at line 594 of file gc.c.

Referenced by gc_mark_ptr(), rgengc_remembersetbits_set(), and RVALUE_PROMOTE_INFANT().

#define MARKED_IN_BITMAP (   bits,
  p 
)    ((bits)[BITMAP_INDEX(p)] & BITMAP_BIT(p))
#define monitor_level   objspace->rgengc.monitor_level

Definition at line 629 of file gc.c.

#define monitored_object_table   objspace->rgengc.monitored_object_table

Definition at line 630 of file gc.c.

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

Definition at line 646 of file gc.c.

Referenced by Init_GC(), and rb_memerror().

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

Definition at line 634 of file gc.c.

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

#define NUM2PTR (   x)    NUM2ULONG(x)

Referenced by id2ref().

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

Definition at line 588 of file gc.c.

Referenced by gc_page_sweep(), and rgengc_rememberset_mark().

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

Definition at line 635 of file gc.c.

Referenced by id2ref(), and wmap_finalize().

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

Referenced by Init_GC().

#define RANY (   o)    ((RVALUE*)(o))
#define rb_gc_mark_locations (   start,
  end 
)    gc_mark_locations(objspace, (start), (end))
#define rb_jmp_buf   rb_jmpbuf_t

Definition at line 89 of file gc.c.

Referenced by mark_current_machine_context().

#define rb_objspace   (*GET_VM()->objspace)
#define rb_setjmp (   env)    RUBY_SETJMP(env)

Definition at line 88 of file gc.c.

Referenced by mark_current_machine_context().

#define RGENGC_CHECK_MODE   0
#define RGENGC_DEBUG   0

Definition at line 185 of file gc.c.

Referenced by Init_GC(), and rgengc_report_body().

#define RGENGC_ESTIMATE_OLDMALLOC   1

Definition at line 224 of file gc.c.

Referenced by Init_GC().

#define RGENGC_PRINT_TICK   0

Definition at line 3987 of file gc.c.

#define RGENGC_PROFILE   0

Definition at line 205 of file gc.c.

Referenced by gc_profile_dump_on(), Init_GC(), and rgengc_remember().

#define rgengc_report   if (RGENGC_DEBUG) rgengc_report_body
#define RGENGC_THREEGEN   0

Definition at line 214 of file gc.c.

Referenced by gc_after_sweep(), and Init_GC().

#define ruby_gc_stress   objspace->gc_stress
#define ruby_initial_gc_stress   gc_params.gc_stress

Definition at line 600 of file gc.c.

Referenced by rb_objspace_alloc().

#define RVALUE_OLDGEN_BITMAP (   obj)    MARKED_IN_BITMAP(GET_HEAP_OLDGEN_BITS(obj), (obj))

Definition at line 711 of file gc.c.

Referenced by check_gen_consistency(), and RVALUE_OLD_BITMAP_P().

#define RVALUE_WB_PROTECTED (   obj)    RVALUE_WB_PROTECTED_RAW(check_gen_consistency((VALUE)obj))
#define RVALUE_WB_PROTECTED_RAW (   obj)    FL_TEST2((obj), FL_WB_PROTECTED)

Definition at line 708 of file gc.c.

Referenced by check_gen_consistency().

#define S (   s)    sym_##s = ID2SYM(rb_intern_const(#s))
#define S (   s)    sym_##s = ID2SYM(rb_intern_const(#s))
#define SET (   name,
  attr 
)
Value:
if (key == sym_##name) \
return (attr); \
else if (hash != Qnil) \
rb_hash_aset(hash, sym_##name, (attr));
return
Definition: bigdecimal.c:5946
VALUE hash
Definition: tkutil.c:267
#define Qnil
Definition: enum.c:67
static int VALUE key
Definition: tkutil.c:265
else
Definition: enum.c:452
rb_hash_aset(hash, RARRAY_AREF(key_value_pair, 0), RARRAY_AREF(key_value_pair, 1))
VALUE name
Definition: enum.c:572
#define SET (   name,
  attr 
)
Value:
if (key == sym_##name) \
return (*out = attr, Qnil); \
else if (hash != Qnil) \
rb_hash_aset(hash, sym_##name, SIZET2NUM(attr));
C_block * out
Definition: crypt.c:308
return
Definition: bigdecimal.c:5946
#define SIZET2NUM(v)
VALUE hash
Definition: tkutil.c:267
#define Qnil
Definition: enum.c:67
static int VALUE key
Definition: tkutil.c:265
else
Definition: enum.c:452
rb_hash_aset(hash, RARRAY_AREF(key_value_pair, 0), RARRAY_AREF(key_value_pair, 1))
VALUE name
Definition: enum.c:572
#define SET_STACK_END   SET_MACHINE_STACK_END(&th->machine.stack_end)

Definition at line 3224 of file gc.c.

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

#define STACK_CHUNK_SIZE   500

Definition at line 391 of file gc.c.

Referenced by init_mark_stack().

#define STACK_END   (th->machine.stack_end)

Definition at line 3228 of file gc.c.

Referenced by mark_current_machine_context(), and ruby_stack_length().

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

Definition at line 3236 of file gc.c.

Referenced by ruby_stack_length(), and stack_check().

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

Definition at line 3229 of file gc.c.

Referenced by stack_check().

#define STACK_START   (th->machine.stack_start)

Definition at line 3227 of file gc.c.

Referenced by mark_current_machine_context(), and ruby_stack_length().

#define STACKFRAME_FOR_CALL_CFUNC   512

Definition at line 3279 of file gc.c.

Referenced by ruby_stack_check().

#define STR_ASSOC   FL_USER3 /* copied from string.c */
#define TRY_WITH_GC (   alloc)
Value:
do { \
if (!(alloc) && \
(!garbage_collect_with_gvl(objspace, 1, 1, GPR_FLAG_MALLOC) || /* full mark && immediate sweep */ \
!(alloc))) { \
} \
} while (0)
static void ruby_memerror(void)
Definition: gc.c:5867
if(args--[1]==0)
Definition: array.c:3187
static int garbage_collect_with_gvl(rb_objspace_t *objspace, int full_mark, int immediate_sweep, int reason)
Definition: gc.c:5095

Definition at line 6083 of file gc.c.

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

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

Referenced by type_name().

#define WMAP_DELETE_DEAD_OBJECT_IN_MARK   0

Definition at line 6321 of file gc.c.

Typedef Documentation

typedef uintptr_t bits_t

Definition at line 370 of file gc.c.

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

Definition at line 1687 of file gc.c.

typedef struct mark_stack mark_stack_t
typedef struct rb_heap_struct rb_heap_t
typedef struct rb_objspace rb_objspace_t
typedef struct RVALUE RVALUE
typedef struct stack_chunk stack_chunk_t

Enumeration Type Documentation

anonymous enum
Enumerator
BITS_SIZE 
BITS_BITLENGTH 

Definition at line 371 of file gc.c.

anonymous enum
Enumerator
HEAP_ALIGN 
HEAP_ALIGN_MASK 
REQUIRED_SIZE_BY_MALLOC 
HEAP_SIZE 
HEAP_OBJ_LIMIT 
HEAP_BITMAP_LIMIT 
HEAP_BITMAP_SIZE 
HEAP_BITMAP_PLANES 

Definition at line 552 of file gc.c.

Enumerator
GPR_FLAG_NONE 
GPR_FLAG_MAJOR_BY_NOFREE 
GPR_FLAG_MAJOR_BY_OLDGEN 
GPR_FLAG_MAJOR_BY_SHADY 
GPR_FLAG_MAJOR_BY_RESCAN 
GPR_FLAG_MAJOR_BY_STRESS 
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 260 of file gc.c.

enum memop_type
Enumerator
MEMOP_TYPE_MALLOC 
MEMOP_TYPE_FREE 
MEMOP_TYPE_REALLOC 

Definition at line 5962 of file gc.c.

Function Documentation

static void add_stack_chunk_cache ( mark_stack_t stack,
stack_chunk_t chunk 
)
static

Definition at line 3111 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().

static void aligned_free ( void ptr)
static

Definition at line 5939 of file gc.c.

References free.

Referenced by heap_page_allocate(), and heap_page_free().

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

Definition at line 5903 of file gc.c.

References assert, malloc(), NULL, and res.

Referenced by heap_page_allocate().

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

Definition at line 5969 of file gc.c.

References ATOMIC_SIZE_CAS, val, and var.

Referenced by objspace_malloc_increase().

static VALUE check_gen_consistency ( VALUE  obj)
inlinestatic
static VALUE count_objects ( int  argc,
VALUE argv,
VALUE  os 
)
static
static VALUE define_final ( int  argc,
VALUE argv,
VALUE  os 
)
static

Definition at line 1949 of file gc.c.

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

Referenced by Init_GC().

static VALUE define_final0 ( VALUE  obj,
VALUE  block 
)
static
static double elapsed_time_from ( double  time)
static

Definition at line 6820 of file gc.c.

References getrusage_time(), and time.

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

static void finalize_deferred ( rb_objspace_t objspace)
static
static void finalize_list ( rb_objspace_t objspace,
RVALUE p 
)
static
static int force_chain_object ( st_data_t  key,
st_data_t  val,
st_data_t  arg 
)
static
static int free_const_entry_i ( ID  key,
rb_const_entry_t ce,
st_data_t  data 
)
static

Definition at line 1459 of file gc.c.

References ST_CONTINUE, and xfree.

Referenced by rb_free_const_table().

static int free_method_entry_i ( ID  key,
rb_method_entry_t me,
st_data_t  data 
)
static

Definition at line 1434 of file gc.c.

References rb_method_entry_struct::mark, rb_free_method_entry(), and ST_CONTINUE.

Referenced by rb_free_m_tbl().

static void free_stack_chunks ( mark_stack_t stack)
static

Definition at line 3167 of file gc.c.

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

Referenced by rb_objspace_free().

static int garbage_collect ( rb_objspace_t objspace,
int  full_mark,
int  immediate_sweep,
int  reason 
)
static
static int garbage_collect_body ( rb_objspace_t objspace,
int  full_mark,
int  immediate_sweep,
int  reason 
)
static
static int garbage_collect_with_gvl ( rb_objspace_t objspace,
int  full_mark,
int  immediate_sweep,
int  reason 
)
static
static void gc_after_sweep ( rb_objspace_t objspace)
static
static void gc_before_heap_sweep ( rb_objspace_t objspace,
rb_heap_t heap 
)
static
static void gc_before_sweep ( rb_objspace_t objspace)
static
static VALUE gc_count ( VALUE  self)
static

Definition at line 5238 of file gc.c.

References rb_gc_count(), and SIZET2NUM.

Referenced by Init_GC().

static void gc_event_hook_body ( rb_objspace_t objspace,
const rb_event_flag_t  event,
VALUE  data 
)
static
static void gc_finalize_deferred ( void dmy)
static
static void gc_finalize_deferred_register ( void  )
static

Definition at line 2118 of file gc.c.

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

Referenced by gc_page_sweep().

static int gc_heap_lazy_sweep ( rb_objspace_t objspace,
rb_heap_t heap 
)
static
static void gc_heap_prepare_minimum_pages ( rb_objspace_t objspace,
rb_heap_t heap 
)
static

Definition at line 2820 of file gc.c.

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

Referenced by gc_sweep().

static void gc_heap_rest_sweep ( rb_objspace_t objspace,
rb_heap_t heap 
)
static

Definition at line 3041 of file gc.c.

References during_gc, gc_heap_lazy_sweep(), and is_lazy_sweeping.

Referenced by gc_rest_sweep(), and gc_sweep().

static VALUE gc_info_decode ( int  flags,
VALUE  hash_or_key 
)
static
static VALUE gc_latest_gc_info ( int  argc,
VALUE argv,
VALUE  self 
)
static
static void gc_mark ( rb_objspace_t objspace,
VALUE  ptr 
)
static
static void gc_mark_children ( rb_objspace_t objspace,
VALUE  ptr 
)
static

Definition at line 3627 of file gc.c.

References args, BUILTIN_TYPE, check_gen_consistency(), rb_objspace::during_minor_gc, FALSE, FL_EXIVAR, FL_TEST, gc_mark(), gc_mark_maybe(), gc_mark_ptr(), if(), is_markable_object(), LIKELY, rb_objspace::mark_func_data, mark_locations_array(), nd_type, NODE_ALIAS, NODE_ALLOCA, NODE_AND, NODE_ARGS, NODE_ARGS_AUX, NODE_ARGSCAT, NODE_ARRAY, NODE_BACK_REF, NODE_BLOCK, NODE_BLOCK_ARG, NODE_BLOCK_PASS, NODE_BREAK, NODE_CALL, NODE_CASE, NODE_CDECL, NODE_CLASS, NODE_COLON2, NODE_COLON3, NODE_CREF, NODE_CVAR, NODE_CVASGN, NODE_DASGN, NODE_DASGN_CURR, NODE_DEFINED, NODE_DEFN, NODE_DEFS, NODE_DOT2, NODE_DOT3, NODE_DREGX, NODE_DREGX_ONCE, NODE_DSTR, NODE_DVAR, NODE_DXSTR, NODE_ENSURE, NODE_ERRINFO, NODE_EVSTR, NODE_FALSE, NODE_FCALL, NODE_FLIP2, NODE_FLIP3, NODE_FOR, NODE_GASGN, NODE_GVAR, NODE_HASH, NODE_IASGN, NODE_IASGN2, NODE_IF, NODE_ITER, NODE_IVAR, NODE_LASGN, NODE_LIT, NODE_LVAR, NODE_MASGN, NODE_MATCH, NODE_MATCH2, NODE_MATCH3, NODE_MODULE, NODE_NEXT, NODE_NIL, NODE_NTH_REF, NODE_OP_ASGN1, NODE_OP_ASGN_AND, NODE_OP_ASGN_OR, NODE_OPT_ARG, NODE_OPT_N, NODE_OR, NODE_POSTEXE, NODE_REDO, NODE_RESBODY, NODE_RESCUE, NODE_RETRY, NODE_RETURN, NODE_SCLASS, NODE_SCOPE, NODE_SELF, NODE_SPLAT, NODE_STR, NODE_SUPER, NODE_TO_ARY, NODE_TRUE, NODE_UNDEF, NODE_UNTIL, NODE_VALIAS, NODE_VCALL, NODE_WHEN, NODE_WHILE, NODE_XSTR, NODE_YIELD, NODE_ZARRAY, NODE_ZSUPER, obj_type_name(), rb_objspace::old_object_count, rb_objspace::parent_object_is_old, RANY, rb_bug(), rb_mark_generic_ivar(), rb_objspace::rgengc, rgengc_check_relation(), rgengc_report, RVALUE_INFANT_P(), RVALUE_PROMOTE_INFANT(), RVALUE_WB_PROTECTED, T_FIXNUM, T_NIL, T_NODE, and TRUE.

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

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

Definition at line 3304 of file gc.c.

References mark_locations_array(), n, and heap_page::start.

Referenced by rb_gc_mark_locations().

static void gc_mark_maybe ( rb_objspace_t objspace,
VALUE  ptr 
)
static
static int gc_mark_ptr ( rb_objspace_t objspace,
VALUE  ptr 
)
inlinestatic
static void gc_mark_roots ( rb_objspace_t objspace,
int  full_mark,
const char **  categoryp 
)
static
static void gc_mark_stacked_objects ( rb_objspace_t objspace)
static
static int gc_marked ( rb_objspace_t objspace,
VALUE  ptr 
)
inlinestatic
static void gc_marks ( rb_objspace_t objspace,
int  full_mark 
)
static
static void gc_marks_body ( rb_objspace_t objspace,
int  full_mark 
)
static
static void gc_page_sweep ( rb_objspace_t objspace,
rb_heap_t heap,
struct heap_page sweep_page 
)
inlinestatic
static void gc_prof_mark_timer_start ( rb_objspace_t objspace)
inlinestatic
static void gc_prof_mark_timer_stop ( rb_objspace_t objspace)
inlinestatic
static void gc_prof_set_heap_info ( rb_objspace_t objspace)
inlinestatic
static void gc_prof_set_malloc_info ( rb_objspace_t objspace)
inlinestatic

Definition at line 6912 of file gc.c.

References gc_prof_enabled, gc_prof_record, malloc_increase, and malloc_limit.

Referenced by gc_before_sweep().

static void gc_prof_setup_new_record ( rb_objspace_t objspace,
int  reason 
)
inlinestatic
static void gc_prof_sweep_timer_start ( rb_objspace_t objspace)
inlinestatic
static void gc_prof_sweep_timer_stop ( rb_objspace_t objspace)
inlinestatic
static void gc_prof_timer_start ( rb_objspace_t objspace)
inlinestatic
static void gc_prof_timer_stop ( rb_objspace_t objspace)
inlinestatic
static VALUE gc_profile_clear ( void  )
static
static VALUE gc_profile_disable ( void  )
static

Definition at line 7304 of file gc.c.

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

Referenced by Init_GC().

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

Definition at line 7287 of file gc.c.

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

Referenced by Init_GC().

static VALUE gc_profile_enable_get ( VALUE  self)
static

Definition at line 7272 of file gc.c.

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

Referenced by Init_GC().

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

Definition at line 7225 of file gc.c.

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

Referenced by Init_GC().

static VALUE gc_profile_result ( void  )
static

Definition at line 7208 of file gc.c.

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

Referenced by Init_GC().

static VALUE gc_profile_total_time ( VALUE  self)
static
static void gc_rest_sweep ( rb_objspace_t objspace)
static
static void gc_set_initial_pages ( void  )
static
static void gc_setup_mark_bits ( struct heap_page page)
static

Definition at line 2707 of file gc.c.

References HEAP_BITMAP_SIZE, heap_page::mark_bits, memcpy(), memset(), and heap_page::oldgen_bits.

Referenced by gc_page_sweep().

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

Definition at line 5536 of file gc.c.

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

Referenced by Init_GC().

static VALUE gc_stat_internal ( VALUE  hash_or_sym,
size_t *  out 
)
static
static VALUE gc_stress_get ( VALUE  self)
static

Definition at line 5578 of file gc.c.

References rb_objspace, and ruby_gc_stress.

Referenced by Init_GC().

static VALUE gc_stress_set ( VALUE  self,
VALUE  flag 
)
static

Definition at line 5597 of file gc.c.

References FIXNUM_P, flag, Qfalse, Qtrue, rb_objspace, rb_secure(), RTEST, and ruby_gc_stress.

Referenced by Init_GC().

static void gc_sweep ( rb_objspace_t objspace,
int  immediate_sweep 
)
static
static VALUE gc_verify_internal_consistency ( VALUE  self)
static
static void* gc_with_gvl ( void ptr)
static
static int get_envparam_double ( const char *  name,
double *  default_value,
double  lower_bound 
)
static

Definition at line 5673 of file gc.c.

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

Referenced by ruby_gc_set_params().

static int get_envparam_int ( const char *  name,
unsigned int default_value,
int  lower_bound 
)
static

Definition at line 5653 of file gc.c.

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

Referenced by ruby_gc_set_params().

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

Definition at line 967 of file gc.c.

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

Referenced by gc_page_sweep(), and heap_assign_page().

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

Definition at line 1149 of file gc.c.

References add, heap_assign_page(), heap_pages_expand_sorted(), heap_pages_increment, and i.

Referenced by gc_set_initial_pages(), and Init_heap().

static void heap_assign_page ( rb_objspace_t objspace,
rb_heap_t heap 
)
static

Definition at line 1141 of file gc.c.

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

Referenced by heap_add_pages(), and heap_increment().

static VALUE heap_get_freeobj ( rb_objspace_t objspace,
rb_heap_t heap 
)
inlinestatic

Definition at line 1249 of file gc.c.

References RVALUE::as, RVALUE::free, rb_heap_struct::freelist, heap_get_freeobj_from_next_freepage(), and p.

Referenced by newobj_of().

static RVALUE* heap_get_freeobj_from_next_freepage ( rb_objspace_t objspace,
rb_heap_t heap 
)
static
static int heap_increment ( rb_objspace_t objspace,
rb_heap_t heap 
)
static
static int heap_is_swept_object ( rb_objspace_t objspace,
rb_heap_t heap,
VALUE  ptr 
)
inlinestatic

Definition at line 2230 of file gc.c.

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

Referenced by is_swept_object().

static void heap_page_add_freeobj ( rb_objspace_t objspace,
struct heap_page page,
VALUE  obj 
)
inlinestatic
static struct heap_page* heap_page_allocate ( rb_objspace_t objspace)
static
static struct heap_page* heap_page_create ( rb_objspace_t objspace)
static
static void heap_page_free ( rb_objspace_t objspace,
struct heap_page page 
)
static

Definition at line 989 of file gc.c.

References aligned_free(), heap_page::body, free, and heap_pages_used.

Referenced by heap_pages_free_unused_pages(), and rb_objspace_free().

static struct heap_page* heap_page_resurrect ( rb_objspace_t objspace)
static

Definition at line 1104 of file gc.c.

References heap_tomb, heap_unlink_page(), and NULL.

Referenced by heap_page_create().

static void heap_pages_expand_sorted ( rb_objspace_t objspace)
static
static void heap_pages_free_unused_pages ( rb_objspace_t objspace)
static
static struct heap_page* heap_prepare_freepage ( rb_objspace_t objspace,
rb_heap_t heap 
)
static
static int heap_ready_to_gc ( rb_objspace_t objspace,
rb_heap_t heap 
)
static
static void heap_set_increment ( rb_objspace_t objspace,
size_t  minimum_limit 
)
static
static void heap_unlink_page ( rb_objspace_t objspace,
rb_heap_t heap,
struct heap_page page 
)
static
static VALUE id2ref ( VALUE  obj,
VALUE  objid 
)
static
void Init_GC ( void  )
void Init_heap ( void  )
static void init_mark_stack ( mark_stack_t stack)
static
void Init_stack ( volatile VALUE addr)

Definition at line 5127 of file gc.c.

References ruby_init_stack().

static int internal_object_p ( VALUE  obj)
static
static int is_dead_object ( rb_objspace_t objspace,
VALUE  ptr 
)
inlinestatic

Definition at line 2248 of file gc.c.

References FALSE, GET_HEAP_MARK_BITS, heap_eden, is_lazy_sweeping, is_swept_object(), MARKED_IN_BITMAP, and TRUE.

Referenced by is_live_object().

static int is_id_value ( rb_objspace_t objspace,
VALUE  ptr 
)
inlinestatic
static int is_live_object ( rb_objspace_t objspace,
VALUE  ptr 
)
inlinestatic
static int is_mark_stack_empty ( mark_stack_t stack)
inlinestatic

Definition at line 3105 of file gc.c.

References mark_stack::chunk, and NULL.

Referenced by pop_mark_stack().

static int is_markable_object ( rb_objspace_t objspace,
VALUE  obj 
)
inlinestatic
static int is_pointer_to_heap ( rb_objspace_t objspace,
void ptr 
)
inlinestatic
static int is_swept_object ( rb_objspace_t objspace,
VALUE  ptr 
)
inlinestatic

Definition at line 2237 of file gc.c.

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

Referenced by is_dead_object(), and rb_gc_resurrect().

static VALUE lazy_sweep_enable ( void  )
static

Definition at line 2680 of file gc.c.

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

Referenced by rb_objspace_each_objects().

static void make_deferred ( rb_objspace_t objspace,
RVALUE p 
)
inlinestatic
static void make_io_deferred ( rb_objspace_t objspace,
RVALUE p 
)
inlinestatic
static int mark_const_entry_i ( ID  key,
const rb_const_entry_t ce,
st_data_t  data 
)
static
static void mark_const_tbl ( rb_objspace_t objspace,
st_table tbl 
)
static

Definition at line 3459 of file gc.c.

References mark_const_entry_i(), mark_tbl_arg::objspace, st_data_t, and st_foreach().

static void mark_current_machine_context ( rb_objspace_t objspace,
rb_thread_t th 
)
static
static int mark_entry ( st_data_t  key,
st_data_t  value,
st_data_t  data 
)
static

Definition at line 3326 of file gc.c.

References arg, gc_mark(), mark_tbl_arg::objspace, and ST_CONTINUE.

Referenced by mark_tbl().

static void mark_hash ( rb_objspace_t objspace,
st_table tbl 
)
static

Definition at line 3375 of file gc.c.

References mark_keyvalue(), mark_tbl_arg::objspace, st_data_t, and st_foreach().

Referenced by rb_mark_hash().

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

Definition at line 3343 of file gc.c.

References arg, gc_mark(), mark_tbl_arg::objspace, and ST_CONTINUE.

Referenced by mark_set().

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

Definition at line 3366 of file gc.c.

References arg, gc_mark(), mark_tbl_arg::objspace, and ST_CONTINUE.

Referenced by mark_hash().

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

Definition at line 3293 of file gc.c.

References gc_mark_maybe(), and v.

Referenced by gc_mark_children(), gc_mark_locations(), and mark_current_machine_context().

static void mark_m_tbl_wrapper ( rb_objspace_t objspace,
struct method_table_wrapper wrapper 
)
static
static void mark_method_entry ( rb_objspace_t objspace,
const rb_method_entry_t me 
)
static
static int mark_method_entry_i ( ID  key,
const rb_method_entry_t me,
st_data_t  data 
)
static

Definition at line 3426 of file gc.c.

References arg, mark_method_entry(), mark_tbl_arg::objspace, and ST_CONTINUE.

Referenced by mark_m_tbl_wrapper().

static void mark_set ( rb_objspace_t objspace,
st_table tbl 
)
static

Definition at line 3351 of file gc.c.

References mark_key(), mark_tbl_arg::objspace, st_data_t, and st_foreach().

Referenced by rb_mark_set().

static void mark_tbl ( rb_objspace_t objspace,
st_table tbl 
)
static

Definition at line 3334 of file gc.c.

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

Referenced by gc_mark_roots(), and rb_mark_tbl().

static void negative_size_allocation_error ( const char *  msg)
static
static void* negative_size_allocation_error_with_gvl ( void ptr)
static

Definition at line 5836 of file gc.c.

References rb_eNoMemError, and rb_raise().

Referenced by negative_size_allocation_error().

static VALUE newobj_of ( VALUE  klass,
VALUE  flags,
VALUE  v1,
VALUE  v2,
VALUE  v3 
)
static
static int obj_free ( rb_objspace_t objspace,
VALUE  obj 
)
static
static size_t obj_memsize_of ( VALUE  obj,
int  use_tdata 
)
static
static const char * obj_type_name ( VALUE  obj)
static
static VALUE objspace_each_objects ( VALUE  arg)
static
static size_t objspace_free_slot ( rb_objspace_t objspace)
static

Definition at line 2701 of file gc.c.

References heap_pages_final_slots, objspace_live_slot(), and objspace_total_slot().

Referenced by gc_stat_internal().

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

Definition at line 6073 of file gc.c.

References size.

Referenced by objspace_xcalloc(), and objspace_xmalloc().

static void objspace_malloc_increase ( rb_objspace_t objspace,
void mem,
size_t  new_size,
size_t  old_size,
enum memop_type  type 
)
static
static size_t objspace_malloc_prepare ( rb_objspace_t objspace,
size_t  size 
)
inlinestatic

Definition at line 6058 of file gc.c.

References negative_size_allocation_error(), and size.

Referenced by objspace_xcalloc(), and objspace_xmalloc().

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

Definition at line 5953 of file gc.c.

Referenced by objspace_xfree(), objspace_xmalloc(), and objspace_xrealloc().

static size_t objspace_total_slot ( rb_objspace_t objspace)
static

Definition at line 2695 of file gc.c.

References heap_eden, and heap_tomb.

Referenced by gc_before_sweep(), and objspace_free_slot().

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

Definition at line 6181 of file gc.c.

References calloc, objspace_malloc_fixup(), objspace_malloc_prepare(), size, TRY_WITH_GC, and xmalloc2_size().

Referenced by ruby_xcalloc().

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

Definition at line 6145 of file gc.c.

References free, MEMOP_TYPE_FREE, objspace_malloc_increase(), and objspace_malloc_size().

Referenced by objspace_xrealloc(), and ruby_sized_xfree().

static void* objspace_xmalloc ( rb_objspace_t objspace,
size_t  size 
)
static
static void* objspace_xrealloc ( rb_objspace_t objspace,
void ptr,
size_t  new_size,
size_t  old_size 
)
static
static VALUE os_each_obj ( int  argc,
VALUE argv,
VALUE  os 
)
static

Definition at line 1882 of file gc.c.

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

Referenced by Init_GC().

static VALUE os_obj_of ( VALUE  of)
static

Definition at line 1835 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().

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

Definition at line 1816 of file gc.c.

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

Referenced by os_obj_of().

static int pop_mark_stack ( mark_stack_t stack,
VALUE data 
)
static
static void pop_mark_stack_chunk ( mark_stack_t stack)
static
static void push_mark_stack ( mark_stack_t stack,
VALUE  data 
)
static
static void push_mark_stack_chunk ( mark_stack_t stack)
static
size_t rb_ary_memsize ( VALUE  )

Definition at line 552 of file array.c.

References ARY_OWNS_HEAP_P, and RARRAY.

Referenced by obj_memsize_of().

VALUE rb_data_object_alloc ( VALUE  klass,
void datap,
RUBY_DATA_FUNC  dmark,
RUBY_DATA_FUNC  dfree 
)

Definition at line 1369 of file gc.c.

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

VALUE rb_data_typed_object_alloc ( VALUE  klass,
void datap,
const rb_data_type_t type 
)

Definition at line 1376 of file gc.c.

References Check_Type(), rb_data_type_struct::flags, newobj_of(), T_CLASS, T_DATA, and T_MASK.

Referenced by iow_newobj().

VALUE rb_define_finalizer ( VALUE  obj,
VALUE  block 
)

Definition at line 1990 of file gc.c.

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

int rb_during_gc ( void  )

Definition at line 5201 of file gc.c.

References during_gc, and rb_objspace.

void rb_free_const_table ( st_table tbl)

Definition at line 1466 of file gc.c.

References free_const_entry_i(), st_foreach(), and st_free_table().

Referenced by init_copy(), obj_free(), and rb_mod_init_copy().

void rb_free_m_tbl ( st_table tbl)

Definition at line 1443 of file gc.c.

References free_method_entry_i(), st_foreach(), and st_free_table().

Referenced by rb_free_m_tbl_wrapper().

void rb_free_m_tbl_wrapper ( struct method_table_wrapper wrapper)

Definition at line 1450 of file gc.c.

References rb_free_m_tbl(), method_table_wrapper::tbl, and xfree.

Referenced by obj_free(), and rb_mod_init_copy().

int rb_garbage_collect ( void  )

Definition at line 5119 of file gc.c.

References garbage_collect(), GPR_FLAG_CAPI, and TRUE.

void rb_gc ( void  )
void rb_gc_call_finalizer_at_exit ( void  )

Definition at line 2144 of file gc.c.

References rb_objspace_call_finalizer().

Referenced by ruby_finalize_1().

void rb_gc_copy_finalizer ( VALUE  dest,
VALUE  obj 
)

Definition at line 1998 of file gc.c.

References data, finalizer_table, FL_FINALIZE, FL_SET, FL_TEST, rb_objspace, st_data_t, st_insert(), st_lookup(), and table.

Referenced by init_copy().

size_t rb_gc_count ( void  )
VALUE rb_gc_disable ( void  )

Definition at line 5641 of file gc.c.

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

Referenced by Init_GC(), and tcl_protect_core().

VALUE rb_gc_enable ( void  )

Definition at line 5619 of file gc.c.

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

Referenced by if(), Init_GC(), and tcl_protect_core().

void rb_gc_finalize_deferred ( void  )

Definition at line 2112 of file gc.c.

References gc_finalize_deferred().

void rb_gc_force_recycle ( VALUE  p)
volatile VALUE* rb_gc_guarded_ptr ( volatile VALUE ptr)

Definition at line 93 of file gc.c.

References ptr.

VALUE rb_gc_latest_gc_info ( VALUE  key)
void rb_gc_mark ( VALUE  ptr)
void rb_gc_mark_locations ( VALUE start,
VALUE end 
)

Definition at line 3314 of file gc.c.

References gc_mark_locations().

void rb_gc_mark_machine_stack ( rb_thread_t th)

Definition at line 3509 of file gc.c.

References GET_STACK_BOUNDS, rb_thread_struct::machine, rb_gc_mark_locations, and rb_objspace.

Referenced by rb_thread_mark().

void rb_gc_mark_maybe ( VALUE  obj)

Definition at line 3540 of file gc.c.

References gc_mark_maybe().

Referenced by gc_mark_roots(), JSON_mark(), mark_global_entry(), val_marker(), and var_marker().

void rb_gc_register_address ( VALUE addr)

Definition at line 4930 of file gc.c.

References ALLOC, global_List, gc_list::next, rb_objspace, tmp, and gc_list::varptr.

Referenced by Init_coverage(), Init_readline(), and rb_global_variable().

void rb_gc_register_mark_object ( VALUE  obj)
void rb_gc_resurrect ( VALUE  obj)

Definition at line 3615 of file gc.c.

References gc_mark_ptr(), gc_marked(), heap_eden, is_lazy_sweeping, is_swept_object(), and rb_objspace.

Referenced by fstr_update_callback().

void rb_gc_set_params ( void  )

Definition at line 5776 of file gc.c.

References rb_safe_level, and ruby_gc_set_params().

VALUE rb_gc_start ( void  )

Definition at line 5186 of file gc.c.

References Qnil, and rb_gc().

size_t rb_gc_stat ( VALUE  key)

Definition at line 5558 of file gc.c.

References gc_stat_internal(), SYMBOL_P, and value.

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

Definition at line 4942 of file gc.c.

References global_List, gc_list::next, rb_objspace, t, tmp, gc_list::varptr, and xfree.

void rb_gc_writebarrier ( VALUE  a,
VALUE  b 
)
void rb_gc_writebarrier_remember_promoted ( VALUE  obj)

Definition at line 4785 of file gc.c.

References rb_objspace, and rgengc_remember().

Referenced by ary_memcpy(), rb_ary_modify(), rb_hash_keys(), and rb_hash_values().

void rb_gc_writebarrier_unprotect_promoted ( VALUE  obj)
void rb_gcdebug_print_obj_condition ( VALUE  obj)
size_t rb_generic_ivar_memsize ( VALUE  )

Definition at line 1040 of file variable.c.

References st_data_t, st_lookup(), st_memsize(), and tbl.

Referenced by obj_memsize_of().

void rb_global_variable ( VALUE var)
size_t rb_io_memsize ( const rb_io_t )
void rb_mark_hash ( st_table tbl)

Definition at line 3384 of file gc.c.

References mark_hash().

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

void rb_mark_method_entry ( const rb_method_entry_t me)

Definition at line 3420 of file gc.c.

References mark_method_entry().

Referenced by bm_mark(), rb_gc_mark_unlinked_live_method_entries(), and rb_thread_mark().

void rb_mark_set ( st_table tbl)

Definition at line 3360 of file gc.c.

References mark_set().

Referenced by mark_dump_arg().

void rb_mark_tbl ( st_table tbl)
void rb_memerror ( void  )
VALUE rb_newobj ( void  )

Definition at line 1348 of file gc.c.

References newobj_of(), and T_NONE.

VALUE rb_newobj_of ( VALUE  klass,
VALUE  flags 
)

Definition at line 1354 of file gc.c.

References newobj_of().

NODE* rb_node_newnode ( enum node_type  type,
VALUE  a0,
VALUE  a1,
VALUE  a2 
)
size_t rb_obj_gc_flags ( VALUE  obj,
ID flags,
size_t  max 
)
VALUE rb_obj_id ( VALUE  obj)
size_t rb_obj_memsize_of ( VALUE  obj)

Definition at line 2551 of file gc.c.

References obj_memsize_of(), and TRUE.

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

VALUE rb_obj_rgengc_promoted_p ( VALUE  obj)

Definition at line 4845 of file gc.c.

References OBJ_PROMOTED, Qfalse, and Qtrue.

VALUE rb_obj_rgengc_writebarrier_protected_p ( VALUE  obj)

Definition at line 4839 of file gc.c.

References OBJ_WB_PROTECTED, Qfalse, and Qtrue.

rb_objspace_t* rb_objspace_alloc ( void  )
static void rb_objspace_call_finalizer ( rb_objspace_t objspace)
static
size_t rb_objspace_data_type_memsize ( VALUE  obj)

Definition at line 1383 of file gc.c.

References RTYPEDDATA_DATA, RTYPEDDATA_P, and RTYPEDDATA_TYPE.

Referenced by obj_memsize_of().

const char* rb_objspace_data_type_name ( VALUE  obj)

Definition at line 1394 of file gc.c.

References RTYPEDDATA_P, and RTYPEDDATA_TYPE.

Referenced by cto_i(), and type_name().

void rb_objspace_each_objects ( each_obj_callback callback,
void data 
)
void rb_objspace_free ( rb_objspace_t objspace)
int rb_objspace_internal_object_p ( VALUE  obj)

Definition at line 1810 of file gc.c.

References internal_object_p().

Referenced by reachable_object_from_i(), and reachable_object_from_root_i().

int rb_objspace_markable_object_p ( VALUE  obj)
void rb_objspace_reachable_objects_from ( VALUE  obj,
void(func)(VALUE, void *)  ,
void data 
)
void rb_objspace_reachable_objects_from_root ( void(func)(const char *category, VALUE, void *)  ,
void passing_data 
)
void rb_objspace_set_event_hook ( const rb_event_flag_t  event)
size_t rb_str_memsize ( VALUE  )

Definition at line 953 of file string.c.

References ELTS_SHARED, FL_TEST, STR_HEAP_SIZE, and STR_NOEMBED.

Referenced by obj_memsize_of().

VALUE rb_undefine_finalizer ( VALUE  obj)

Definition at line 1911 of file gc.c.

References data, finalizer_table, FL_FINALIZE, FL_UNSET, obj, rb_check_frozen, rb_objspace, st_data_t, and st_delete().

Referenced by undefine_final().

static int ready_to_gc ( rb_objspace_t objspace)
static

Definition at line 5050 of file gc.c.

References heap_eden, and heap_ready_to_gc().

Referenced by garbage_collect().

static void rgengc_check_relation ( rb_objspace_t objspace,
VALUE  obj 
)
static
static void rgengc_mark_and_rememberset_clear ( rb_objspace_t objspace,
rb_heap_t heap 
)
static
static int rgengc_remember ( rb_objspace_t objspace,
VALUE  obj 
)
static
static int rgengc_remembered ( rb_objspace_t objspace,
VALUE  obj 
)
static
static void rgengc_rememberset_mark ( rb_objspace_t objspace,
rb_heap_t heap 
)
static
static int rgengc_remembersetbits_get ( rb_objspace_t objspace,
VALUE  obj 
)
static

Definition at line 4580 of file gc.c.

References GET_HEAP_REMEMBERSET_BITS, and MARKED_IN_BITMAP.

Referenced by rgengc_remember(), and rgengc_remembered().

static int rgengc_remembersetbits_set ( rb_objspace_t objspace,
VALUE  obj 
)
static

Definition at line 4587 of file gc.c.

References FALSE, GET_HEAP_REMEMBERSET_BITS, MARK_IN_BITMAP, MARKED_IN_BITMAP, and TRUE.

Referenced by rgengc_remember().

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

Definition at line 4801 of file gc.c.

References rgengc_unprotect_logging_exit_func_i(), and st_foreach().

Referenced by rb_gc_unprotect_logging().

static int rgengc_unprotect_logging_exit_func_i ( st_data_t  key,
st_data_t  val 
)
static

Definition at line 4794 of file gc.c.

References ST_CONTINUE.

Referenced by rgengc_unprotect_logging_exit_func().

static void root_objects_from ( VALUE  obj,
void ptr 
)
static
void ruby_gc_set_params ( int  safe_level)
int ruby_get_stack_grow_direction ( volatile VALUE addr)

Definition at line 3242 of file gc.c.

References end, and SET_MACHINE_STACK_END.

static void ruby_memerror ( void  )
static
static void* ruby_memerror_body ( void dummy)
static

Definition at line 5860 of file gc.c.

References rb_memerror().

Referenced by ruby_memerror().

void ruby_mimfree ( void ptr)

Definition at line 6270 of file gc.c.

References free.

Referenced by ruby_vm_destruct().

void* ruby_mimmalloc ( size_t  size)

Definition at line 6254 of file gc.c.

References malloc().

Referenced by Init_BareVM().

void ruby_sized_xfree ( void x,
size_t  size 
)
void* ruby_sized_xrealloc ( void ptr,
size_t  new_size,
size_t  old_size 
)

Definition at line 6203 of file gc.c.

References objspace_xrealloc().

Referenced by ruby_xrealloc().

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

Definition at line 6218 of file gc.c.

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

void* ruby_xcalloc ( size_t  n,
size_t  size 
)

Definition at line 6194 of file gc.c.

References objspace_xcalloc().

Referenced by getifaddrs(), and rb_iseq_defined_string().

void ruby_xfree ( void x)
void* ruby_xmalloc ( size_t  size)
void* ruby_xmalloc2 ( size_t  n,
size_t  size 
)

Definition at line 6175 of file gc.c.

References objspace_xmalloc(), and xmalloc2_size().

Referenced by wmap_aset_update().

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

Definition at line 6228 of file gc.c.

References ruby_sized_xrealloc2().

static void run_final ( rb_objspace_t objspace,
VALUE  obj 
)
static
static void run_finalizer ( rb_objspace_t objspace,
VALUE  obj,
VALUE  table 
)
static
static VALUE run_single_final ( VALUE  arg)
static

Definition at line 2013 of file gc.c.

References args, Qnil, and rb_eval_cmd().

Referenced by run_finalizer().

static void RVALUE_DEMOTE_FROM_OLD ( VALUE  obj)
inlinestatic
static VALUE RVALUE_INFANT_P ( VALUE  obj)
inlinestatic
static VALUE RVALUE_OLD_BITMAP_P ( VALUE  obj)
inlinestatic

Definition at line 763 of file gc.c.

References check_gen_consistency(), and RVALUE_OLDGEN_BITMAP.

Referenced by rb_gc_writebarrier(), and RVALUE_OLD_P().

static VALUE RVALUE_OLD_P ( VALUE  obj)
inlinestatic
static void RVALUE_PROMOTE_INFANT ( VALUE  obj)
inlinestatic
static VALUE RVALUE_PROMOTED_P ( VALUE  obj)
inlinestatic
static int set_zero ( st_data_t  key,
st_data_t  val,
st_data_t  arg 
)
static

Definition at line 2557 of file gc.c.

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

Referenced by count_objects().

static void should_be_callable ( VALUE  block)
static

Definition at line 1922 of file gc.c.

References rb_eArgError, rb_intern, rb_obj_classname(), rb_obj_respond_to(), rb_raise(), and TRUE.

Referenced by define_final(), and rb_define_finalizer().

static void should_be_finalizable ( VALUE  obj)
static

Definition at line 1930 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().

static void shrink_stack_chunk_cache ( mark_stack_t stack)
static
static int stack_check ( int  water_mark)
static

Definition at line 3263 of file gc.c.

References GET_THREAD(), rb_thread_struct::machine, ret, SET_STACK_END, STACK_LENGTH, STACK_LEVEL_MAX, and th.

Referenced by ruby_stack_check().

static stack_chunk_t* stack_chunk_alloc ( void  )
static

Definition at line 3093 of file gc.c.

References malloc(), rb_memerror(), and res.

Referenced by init_mark_stack(), and push_mark_stack_chunk().

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

Definition at line 1905 of file gc.c.

References rb_undefine_finalizer().

Referenced by Init_GC().

static int verify_internal_consistency_i ( void page_start,
void page_end,
size_t  stride,
void ptr 
)
static
static void verify_internal_consistency_reachable_i ( VALUE  child,
void ptr 
)
static
static VALUE wmap_allocate ( VALUE  klass)
static
static VALUE wmap_aref ( VALUE  self,
VALUE  wmap 
)
static
static VALUE wmap_aset ( VALUE  self,
VALUE  wmap,
VALUE  orig 
)
static
static int wmap_aset_update ( st_data_t key,
st_data_t val,
st_data_t  arg,
int  existing 
)
static

Definition at line 6627 of file gc.c.

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

Referenced by wmap_aset().

static VALUE wmap_each ( VALUE  self)
static

Definition at line 6516 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().

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

Definition at line 6504 of file gc.c.

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

Referenced by wmap_each().

static VALUE wmap_each_key ( VALUE  self)
static

Definition at line 6539 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().

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

Definition at line 6527 of file gc.c.

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

Referenced by wmap_each_key().

static VALUE wmap_each_value ( VALUE  self)
static

Definition at line 6562 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().

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

Definition at line 6550 of file gc.c.

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

Referenced by wmap_each_value().

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

Definition at line 6404 of file gc.c.

References i, j, ptr, ruby_sized_xfree(), ruby_sized_xrealloc2(), size, ST_CONTINUE, st_data_t, ST_DELETE, ST_STOP, and value.

Referenced by wmap_finalize().

static VALUE wmap_finalize ( VALUE  self,
VALUE  objid 
)
static
static void wmap_free ( void ptr)
static

Definition at line 6353 of file gc.c.

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

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

Definition at line 6345 of file gc.c.

References ruby_sized_xfree(), and ST_CONTINUE.

Referenced by wmap_free().

static VALUE wmap_has_key ( VALUE  self,
VALUE  key 
)
static

Definition at line 6682 of file gc.c.

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

Referenced by Init_GC().

static VALUE wmap_inspect ( VALUE  self)
static
static int wmap_inspect_i ( st_data_t  key,
st_data_t  val,
st_data_t  arg 
)
static
static VALUE wmap_keys ( VALUE  self)
static
static int wmap_keys_i ( st_data_t  key,
st_data_t  val,
st_data_t  arg 
)
static
static void wmap_mark ( void ptr)
static

Definition at line 6335 of file gc.c.

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

static size_t wmap_memsize ( const void ptr)
static
static int wmap_memsize_map ( st_data_t  key,
st_data_t  val,
st_data_t  arg 
)
static

Definition at line 6362 of file gc.c.

References ST_CONTINUE.

Referenced by wmap_memsize().

static VALUE wmap_size ( VALUE  self)
static

Definition at line 6688 of file gc.c.

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

Referenced by Init_GC().

static VALUE wmap_values ( VALUE  self)
static
static int wmap_values_i ( st_data_t  key,
st_data_t  val,
st_data_t  arg 
)
static
static size_t xmalloc2_size ( size_t  n,
size_t  size 
)
inlinestatic

Definition at line 6165 of file gc.c.

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

Referenced by objspace_xcalloc(), and ruby_xmalloc2().

Variable Documentation

ruby_gc_params_t gc_params
static
Initial value:
= {
}
#define FALSE
Definition: nkf.h:174
#define GC_HEAP_GROWTH_FACTOR
Definition: gc.c:106
#define GC_HEAP_OLDOBJECT_LIMIT_FACTOR
Definition: gc.c:112
#define GC_MALLOC_LIMIT_MAX
Definition: gc.c:119
#define GC_OLDMALLOC_LIMIT_GROWTH_FACTOR
Definition: gc.c:129
#define GC_HEAP_GROWTH_MAX_SLOTS
Definition: gc.c:109
#define GC_MALLOC_LIMIT_GROWTH_FACTOR
Definition: gc.c:122
#define GC_HEAP_FREE_SLOTS
Definition: gc.c:100
#define GC_HEAP_INIT_SLOTS
Definition: gc.c:103
#define GC_OLDMALLOC_LIMIT_MIN
Definition: gc.c:126
#define GC_MALLOC_LIMIT_MIN
Definition: gc.c:116
#define GC_OLDMALLOC_LIMIT_MAX
Definition: gc.c:132

Definition at line 152 of file gc.c.

VALUE rb_mGC

Definition at line 649 of file gc.c.

st_table* rgengc_unprotect_logging_table
static

Definition at line 4791 of file gc.c.

int ruby_disable_gc_stress = 0

Definition at line 650 of file gc.c.

Referenced by gc_prof_setup_new_record().

int ruby_gc_debug_indent = 0

Definition at line 648 of file gc.c.

VALUE* ruby_initial_gc_stress_ptr = &ruby_initial_gc_stress

Definition at line 601 of file gc.c.

Referenced by set_debug_option().

int ruby_stack_grow_direction

Definition at line 3240 of file gc.c.

const rb_data_type_t weakmap_type
static
Initial value:
= {
"weakmap",
{
},
}
static void wmap_mark(void *ptr)
Definition: gc.c:6335
static size_t wmap_memsize(const void *ptr)
Definition: gc.c:6370
#define RUBY_TYPED_FREE_IMMEDIATELY
static void wmap_free(void *ptr)
Definition: gc.c:6353
#define NULL
Definition: _sdbm.c:102

Definition at line 6382 of file gc.c.