Ruby
2.5.0dev(2017-10-22revision60238)
|
#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 "debug_counter.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 | 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_DEBUG_ENABLED(level) ((RGENGC_DEBUG) >= (level)) |
#define | RGENGC_CHECK_MODE 0 |
#define | GC_ASSERT(expr) ((void)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_ENABLED(0)) {} 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_CHECK2(name, x, pred) |
#define | FL_TEST2(x, f) FL_CHECK2("FL_TEST2", x, FL_TEST_RAW((x),(f)) != 0) |
#define | FL_SET2(x, f) FL_CHECK2("FL_SET2", x, RBASIC(x)->flags |= (f)) |
#define | FL_UNSET2(x, f) FL_CHECK2("FL_UNSET2", x, RBASIC(x)->flags &= ~(f)) |
#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(&ec->machine.stack_end) |
#define | STACK_START (ec->machine.stack_start) |
#define | STACK_END (ec->machine.stack_end) |
#define | STACK_LEVEL_MAX (ec->machine.stack_maxsize/sizeof(VALUE)) |
#define | STACK_LENGTH |
#define | PREVENT_STACK_OVERFLOW 1 |
#define | STACKFRAME_FOR_CALL_CFUNC 838 |
#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 *) |
Variables | |
volatile VALUE | rb_gc_guarded_val |
int | ruby_rgengc_debug |
VALUE * | ruby_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 |
#define ARY_EMBED_P | ( | ary | ) |
#define ARY_SHARED_P | ( | ary | ) |
#define BITMAP_BIT | ( | p | ) | ((bits_t)1 << BITMAP_OFFSET(p)) |
#define BITMAP_INDEX | ( | p | ) | (NUM_IN_PAGE(p) / BITS_BITLENGTH ) |
#define BITMAP_OFFSET | ( | p | ) | (NUM_IN_PAGE(p) & (BITS_BITLENGTH-1)) |
#define C | ( | c, | |
s | |||
) | ((c) != 0 ? (s) : " ") |
#define CLEAR_IN_BITMAP | ( | bits, | |
p | |||
) | ((bits)[BITMAP_INDEX(p)] = (bits)[BITMAP_INDEX(p)] & ~BITMAP_BIT(p)) |
#define dont_gc objspace->flags.dont_gc |
Definition at line 754 of file gc.c.
Referenced by rb_gc_disable(), and rb_gc_enable().
#define during_gc objspace->flags.during_gc |
Definition at line 755 of file gc.c.
Referenced by rb_during_gc(), rb_memerror(), and rb_threadptr_during_gc().
#define finalizer_table objspace->finalizer_table |
Definition at line 757 of file gc.c.
Referenced by rb_gc_copy_finalizer(), and rb_undefine_finalizer().
#define FL_CHECK2 | ( | name, | |
x, | |||
pred | |||
) |
#define FL_TEST2 | ( | x, | |
f | |||
) | FL_CHECK2("FL_TEST2", x, FL_TEST_RAW((x),(f)) != 0) |
#define GC_ASSERT | ( | expr | ) | ((void)0) |
Definition at line 252 of file gc.c.
Referenced by rb_wb_protected_newobj_of(), and rb_wb_unprotected_newobj_of().
#define GC_ENABLE_INCREMENTAL_MARK USE_RINCGC |
#define gc_event_hook | ( | objspace, | |
event, | |||
data | |||
) |
#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_mode_set | ( | objspace, | |
mode | |||
) | ((objspace)->flags.mode = (unsigned int)gc_mode_verify(mode)) |
#define gc_prof_enabled | ( | objspace | ) | ((objspace)->profile.run && (objspace)->profile.current_record) |
#define gc_prof_record | ( | objspace | ) | (objspace)->profile.current_record |
#define gc_report if (!RGENGC_DEBUG_ENABLED(0)) {} else gc_report_body |
Definition at line 917 of file gc.c.
Referenced by rb_gc_writebarrier_remember().
#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 GET_HEAP_MARK_BITS | ( | x | ) | (&GET_HEAP_PAGE(x)->mark_bits[0]) |
#define GET_HEAP_MARKING_BITS | ( | x | ) | (&GET_HEAP_PAGE(x)->marking_bits[0]) |
#define GET_HEAP_PAGE | ( | x | ) | (GET_PAGE_HEADER(x)->page) |
#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_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_STACK_BOUNDS | ( | start, | |
end, | |||
appendix | |||
) |
Definition at line 4241 of file gc.c.
Referenced by rb_gc_mark_machine_stack().
#define global_list objspace->global_list |
Definition at line 758 of file gc.c.
Referenced by rb_gc_register_address(), rb_gc_unregister_address(), and rb_objspace_free().
#define heap_allocatable_pages objspace->heap_pages.allocatable_pages |
#define heap_allocated_pages objspace->heap_pages.allocated_pages |
Definition at line 744 of file gc.c.
Referenced by rb_objspace_free().
#define heap_eden (&objspace->eden_heap) |
Definition at line 752 of file gc.c.
Referenced by rb_objspace_free().
#define heap_pages_deferred_final objspace->heap_pages.deferred_final |
#define heap_pages_final_slots objspace->heap_pages.final_slots |
#define heap_pages_freeable_pages objspace->heap_pages.freeable_pages |
#define heap_pages_himem objspace->heap_pages.range[1] |
#define heap_pages_lomem objspace->heap_pages.range[0] |
#define heap_pages_sorted objspace->heap_pages.sorted |
Definition at line 743 of file gc.c.
Referenced by rb_objspace_free().
#define heap_pages_sorted_length objspace->heap_pages.sorted_length |
#define I | ( | s | ) | ID_##s = rb_intern(#s); |
#define IMEMO_NAME | ( | x | ) | case imemo_##x: imemo_name = #x; break; |
#define is_full_marking | ( | objspace | ) | ((objspace)->flags.during_minor_gc == FALSE) |
#define is_incremental_marking | ( | objspace | ) | ((objspace)->flags.during_incremental_marking != FALSE) |
Definition at line 794 of file gc.c.
Referenced by rb_gc_writebarrier().
#define is_lazy_sweeping | ( | heap | ) | (GC_ENABLE_LAZY_SWEEP && has_sweeping_pages(heap)) |
Definition at line 804 of file gc.c.
Referenced by rb_objspace_free().
#define is_marking | ( | objspace | ) | (gc_mode(objspace) == gc_mode_marking) |
#define is_sweeping | ( | objspace | ) | (gc_mode(objspace) == gc_mode_sweeping) |
#define malloc_allocated_size objspace->malloc_params.allocated_size |
#define malloc_limit objspace->malloc_params.limit |
Definition at line 740 of file gc.c.
Referenced by rb_objspace_alloc().
#define MARK_CHECKPOINT | ( | category | ) |
#define MARK_CHECKPOINT_PRINT_TICK | ( | category | ) |
#define MARK_IN_BITMAP | ( | bits, | |
p | |||
) | ((bits)[BITMAP_INDEX(p)] = (bits)[BITMAP_INDEX(p)] | BITMAP_BIT(p)) |
#define MARK_OBJECT_ARY_BUCKET_SIZE 1024 |
Definition at line 6223 of file gc.c.
Referenced by rb_gc_register_mark_object().
#define MARKED_IN_BITMAP | ( | bits, | |
p | |||
) | ((bits)[BITMAP_INDEX(p)] & BITMAP_BIT(p)) |
#define NEW_SYM | ( | s | ) | gc_stat_symbols[gc_stat_sym_##s] |
#define nomem_error GET_VM()->special_exceptions[ruby_error_nomemory] |
#define nonspecial_obj_id | ( | obj | ) | (VALUE)((SIGNED_VALUE)(obj)|FIXNUM_FLAG) |
Definition at line 807 of file gc.c.
Referenced by rb_obj_id().
#define NUM2PTR | ( | x | ) | NUM2ULONG(x) |
#define NUM_IN_PAGE | ( | p | ) | (((bits_t)(p) & HEAP_PAGE_ALIGN_MASK)/sizeof(RVALUE)) |
#define obj_id_to_ref | ( | objid | ) | ((objid) ^ FIXNUM_FLAG) /* unset FIXNUM_FLAG */ |
#define OLD_SYM | ( | s | ) | gc_stat_compat_symbols[gc_stat_compat_sym_##s] |
#define OPT | ( | o | ) | if (o) rb_ary_push(opts, rb_fstring_lit(#o)) |
#define POP_MARK_FUNC_DATA | ( | ) | objspace->mark_func_data = prev_mark_func_data;} while (0) |
#define PUSH_MARK_FUNC_DATA | ( | v | ) |
#define RANY | ( | o | ) | ((RVALUE*)(o)) |
Definition at line 817 of file gc.c.
Referenced by rb_obj_info_dump().
#define rb_jmp_buf rb_jmpbuf_t |
#define rb_objspace (*rb_objspace_of(GET_VM())) |
Definition at line 729 of file gc.c.
Referenced by Init_heap(), rb_copy_wb_protected_attribute(), rb_during_gc(), rb_gc(), rb_gc_copy_finalizer(), rb_gc_disable(), rb_gc_enable(), rb_gc_force_recycle(), rb_gc_latest_gc_info(), rb_gc_mark_machine_stack(), rb_gc_mark_values(), rb_gc_register_address(), rb_gc_unregister_address(), rb_gc_writebarrier(), rb_gc_writebarrier_remember(), rb_obj_info_dump(), rb_objspace_alloc(), rb_objspace_garbage_object_p(), rb_objspace_markable_object_p(), rb_objspace_reachable_objects_from(), rb_objspace_reachable_objects_from_root(), rb_objspace_set_event_hook(), and rb_undefine_finalizer().
#define rb_objspace_of | ( | vm | ) | ((vm)->objspace) |
Definition at line 730 of file gc.c.
Referenced by rb_memerror(), and rb_threadptr_during_gc().
#define RESTORE_FINALIZER | ( | ) |
#define RGENGC_CHECK_MODE 0 |
Definition at line 246 of file gc.c.
Referenced by rb_gc_writebarrier().
#define RGENGC_DEBUG_ENABLED | ( | level | ) | ((RGENGC_DEBUG) >= (level)) |
#define RGENGC_OBJ_INFO (RGENGC_DEBUG | RGENGC_CHECK_MODE) |
#define RVALUE_AGE_SHIFT 5 /* FL_PROMOTED0 bit */ |
#define RVALUE_MARK_BITMAP | ( | obj | ) | MARKED_IN_BITMAP(GET_HEAP_MARK_BITS(obj), (obj)) |
#define RVALUE_MARKING_BITMAP | ( | obj | ) | MARKED_IN_BITMAP(GET_HEAP_MARKING_BITS(obj), (obj)) |
#define RVALUE_PAGE_MARKED | ( | page, | |
obj | |||
) | MARKED_IN_BITMAP((page)->mark_bits, (obj)) |
#define RVALUE_PAGE_MARKING | ( | page, | |
obj | |||
) | MARKED_IN_BITMAP((page)->marking_bits, (obj)) |
#define RVALUE_PAGE_UNCOLLECTIBLE | ( | page, | |
obj | |||
) | MARKED_IN_BITMAP((page)->uncollectible_bits, (obj)) |
#define RVALUE_PAGE_WB_UNPROTECTED | ( | page, | |
obj | |||
) | MARKED_IN_BITMAP((page)->wb_unprotected_bits, (obj)) |
#define RVALUE_UNCOLLECTIBLE_BITMAP | ( | obj | ) | MARKED_IN_BITMAP(GET_HEAP_UNCOLLECTIBLE_BITS(obj), (obj)) |
#define RVALUE_WB_UNPROTECTED_BITMAP | ( | obj | ) | MARKED_IN_BITMAP(GET_HEAP_WB_UNPROTECTED_BITS(obj), (obj)) |
#define S | ( | s | ) | sym_##s = ID2SYM(rb_intern_const(#s)) |
Referenced by ruby_dtoa().
#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 SET | ( | name, | |
attr | |||
) |
#define SET | ( | name, | |
attr | |||
) |
#define SET_STACK_END SET_MACHINE_STACK_END(&ec->machine.stack_end) |
Definition at line 3979 of file gc.c.
Referenced by ruby_stack_length().
#define STACK_END (ec->machine.stack_end) |
Definition at line 3983 of file gc.c.
Referenced by ruby_stack_length().
#define STACK_LENGTH |
#define STACK_LEVEL_MAX (ec->machine.stack_maxsize/sizeof(VALUE)) |
#define STACK_START (ec->machine.stack_start) |
Definition at line 3982 of file gc.c.
Referenced by ruby_stack_length().
#define TF | ( | c | ) | ((c) != 0 ? "true" : "false") |
#define TRY_WITH_GC | ( | alloc | ) |
#define TYPE_NAME | ( | t | ) | case (t): return #t; |
#define USE_TICK_T (PRINT_ENTER_EXIT_TICK || PRINT_MEASURE_LINE || PRINT_ROOT_TICKS) |
#define will_be_incremental_marking | ( | objspace | ) | ((objspace)->rgengc.need_major_gc != GPR_FLAG_NONE) |
typedef struct gc_profile_record gc_profile_record |
typedef struct mark_stack mark_stack_t |
typedef struct rb_heap_struct rb_heap_t |
typedef struct rb_objspace rb_objspace_t |
typedef struct stack_chunk stack_chunk_t |
anonymous enum |
anonymous enum |
enum gc_mode |
enum gc_stat_compat_sym |
enum gc_stat_sym |
enum memop_type |
void Init_GC | ( | void | ) |
Definition at line 9604 of file gc.c.
References rb_define_module(), and rb_define_singleton_method().
void Init_heap | ( | void | ) |
void Init_stack | ( | volatile VALUE * | addr | ) |
Definition at line 6659 of file gc.c.
References ruby_init_stack().
NOINLINE | ( | static VALUE | newobj_slowpath_wb_protectedVALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3, rb_objspace_t *objspace | ) |
NOINLINE | ( | static void | gc_mark_ptrrb_objspace_t *objspace, VALUE obj | ) |
NOINLINE | ( | static void | gc_writebarrier_generationalVALUE a, VALUE b, rb_objspace_t *objspace | ) |
PRINTF_ARGS | ( | static void | gc_report_bodyint level, rb_objspace_t *objspace, const char *fmt,..., |
3 | , | ||
4 | |||
) |
PUREFUNC | ( | static inline int | is_id_valuerb_objspace_t *objspace, VALUE ptr | ) |
Referenced by rb_objspace_data_type_name().
void* rb_alloc_tmp_buffer | ( | volatile VALUE * | store, |
long | len | ||
) |
Definition at line 8136 of file gc.c.
References cnt, rb_alloc_tmp_buffer_with_count(), rb_eArgError, rb_raise(), and roomof.
void* rb_alloc_tmp_buffer_with_count | ( | volatile VALUE * | store, |
size_t | size, | ||
size_t | cnt | ||
) |
Definition at line 8120 of file gc.c.
References imemo_alloc, and rb_imemo_new().
Referenced by rb_alloc_tmp_buffer().
Definition at line 6104 of file gc.c.
References rb_objspace.
VALUE rb_data_object_wrap | ( | VALUE | klass, |
void * | datap, | ||
RUBY_DATA_FUNC | dmark, | ||
RUBY_DATA_FUNC | dfree | ||
) |
Definition at line 2037 of file gc.c.
References Check_Type, and T_CLASS.
Referenced by RUBY_ALIAS_FUNCTION().
VALUE rb_data_typed_object_wrap | ( | VALUE | klass, |
void * | datap, | ||
const rb_data_type_t * | type | ||
) |
Definition at line 2058 of file gc.c.
References Check_Type, and T_CLASS.
Referenced by RUBY_ALIAS_FUNCTION().
int rb_during_gc | ( | void | ) |
Definition at line 6735 of file gc.c.
References during_gc, and rb_objspace.
Referenced by rb_threadptr_stack_overflow().
void rb_free_const_table | ( | struct rb_id_table * | tbl | ) |
Definition at line 2140 of file gc.c.
References rb_id_table_foreach_values().
void rb_free_tmp_buffer | ( | volatile VALUE * | store | ) |
Definition at line 8148 of file gc.c.
References ATOMIC_PTR_EXCHANGE, ATOMIC_VALUE_EXCHANGE, rb_objspace::malloc_params, RNODE, ruby_xfree(), and UINT2NUM.
void rb_gc | ( | void | ) |
Definition at line 6727 of file gc.c.
References rb_objspace.
Referenced by rb_fdopen(), rb_gc_for_fd(), rb_gc_start(), and rb_reg_region_copy().
Definition at line 2756 of file gc.c.
References finalizer_table, FL_FINALIZE, FL_SET, FL_TEST, rb_objspace, st_data_t, st_insert, and st_lookup.
size_t rb_gc_count | ( | void | ) |
Definition at line 6766 of file gc.c.
References rb_objspace::count, and rb_objspace::profile.
VALUE rb_gc_disable | ( | void | ) |
Definition at line 7389 of file gc.c.
References dont_gc, and rb_objspace.
VALUE rb_gc_enable | ( | void | ) |
void rb_gc_force_recycle | ( | VALUE | obj | ) |
Definition at line 6175 of file gc.c.
References rb_objspace.
Referenced by rb_parser_free(), and rb_str_tmp_frozen_release().
Definition at line 97 of file gc.c.
References rb_gc_guarded_val, and val.
Definition at line 6881 of file gc.c.
References rb_objspace.
void rb_gc_mark | ( | VALUE | ptr | ) |
Definition at line 4464 of file gc.c.
Referenced by rb_fiber_mark_self(), rb_gc_mark_node(), rb_iseq_mark(), rb_vm_mark(), and rb_vm_trace_mark_event_hooks().
void rb_gc_mark_machine_stack | ( | const rb_execution_context_t * | ec | ) |
Definition at line 4274 of file gc.c.
References GET_STACK_BOUNDS, and rb_objspace.
void rb_gc_mark_maybe | ( | VALUE | obj | ) |
Definition at line 4320 of file gc.c.
Referenced by rb_gc_mark_node(), rb_gvar_val_marker(), and rb_gvar_var_marker().
Definition at line 4097 of file gc.c.
References rb_objspace.
Referenced by rb_execution_context_mark(), and rb_vm_mark().
void rb_gc_register_address | ( | VALUE * | addr | ) |
Definition at line 6241 of file gc.c.
References ALLOC, global_list, gc_list::next, rb_objspace, and gc_list::varptr.
Referenced by rb_global_variable().
void rb_gc_register_mark_object | ( | VALUE | obj | ) |
Definition at line 6227 of file gc.c.
References GET_THREAD, MARK_OBJECT_ARY_BUCKET_SIZE, Qnil, RARRAY_LEN, rb_ary_last(), rb_ary_push(), and rb_ary_tmp_new().
Referenced by rb_define_class_id_under(), rb_define_module_id_under(), rb_iseq_defined_string(), rb_sym_to_proc(), and rb_vm_register_special_exception_str().
void rb_gc_unprotect_logging | ( | void * | objptr, |
const char * | filename, | ||
int | line | ||
) |
Definition at line 6075 of file gc.c.
References st_init_strtable.
void rb_gc_unregister_address | ( | VALUE * | addr | ) |
Definition at line 6253 of file gc.c.
References global_list, gc_list::next, rb_objspace, gc_list::varptr, and xfree().
Definition at line 5984 of file gc.c.
References is_incremental_marking, rb_bug(), rb_objspace, RGENGC_CHECK_MODE, and SPECIAL_CONST_P.
void rb_gc_writebarrier_remember | ( | VALUE | obj | ) |
Definition at line 6041 of file gc.c.
References gc_report, and rb_objspace.
Referenced by rb_hash_keys(), and rb_hash_values().
void rb_gcdebug_print_obj_condition | ( | VALUE | obj | ) |
Referenced by rb_obj_info_dump().
void rb_global_variable | ( | VALUE * | var | ) |
Definition at line 6276 of file gc.c.
References rb_gc_register_address().
Referenced by Init_openssl().
Definition at line 2020 of file gc.c.
References FL_USHIFT, and T_IMEMO.
Referenced by rb_alloc_tmp_buffer_with_count().
Definition at line 70 of file iseq.c.
References rb_iseq_struct::body, rb_iseq_constant_body::catch_table, rb_iseq_constant_body::cc_entries, rb_iseq_constant_body::ci_entries, rb_iseq_constant_body::ci_kw_size, rb_iseq_constant_body::ci_size, rb_iseq_constant_body::is_entries, rb_iseq_constant_body::iseq_encoded, rb_iseq_constant_body::keyword, rb_call_info_with_kwarg::kw_arg, rb_iseq_constant_body::line_info_table, rb_iseq_constant_body::local_table, NULL, rb_iseq_constant_body::opt_table, rb_iseq_constant_body::param, RUBY_FREE_ENTER, and ruby_xfree().
Definition at line 106 of file iseq.c.
References rb_iseq_struct::aux, rb_iseq_location_struct::base_label, rb_iseq_struct::body, iseq_compile_data::catch_table_ary, iseq_compile_data::err_info, FL_TEST, ISEQ_COMPILE_DATA, ISEQ_NOT_LOADED_YET, rb_iseq_location_struct::label, rb_iseq_struct::loader, rb_iseq_constant_body::location, iseq_compile_data::mark_ary, rb_iseq_constant_body::mark_ary, rb_iseq_constant_body::parent_iseq, rb_iseq_location_struct::pathobj, rb_gc_mark(), RUBY_MARK_ENTER, RUBY_MARK_LEAVE, and RUBY_MARK_UNLESS_NULL.
void rb_mark_tbl | ( | st_table * | tbl | ) |
Definition at line 4302 of file gc.c.
Referenced by rb_vm_mark().
void rb_memerror | ( | void | ) |
Definition at line 7700 of file gc.c.
References during_gc, GET_THREAD, rb_objspace_of, and rb_thread_struct::vm.
Definition at line 3158 of file gc.c.
References FIXNUM_FLAG, FLONUM_P, LONG2NUM, nonspecial_obj_id, SIGNED_VALUE, SPECIAL_CONST_P, STATIC_SYM_P, and SYM2ID.
void rb_obj_info_dump | ( | VALUE | obj | ) |
Definition at line 9453 of file gc.c.
References RANY, rb_gcdebug_print_obj_condition(), rb_objspace, and rb_raw_obj_info().
Definition at line 6136 of file gc.c.
References OBJ_PROMOTED, Qfalse, and Qtrue.
rb_objspace_t* rb_objspace_alloc | ( | void | ) |
Definition at line 1327 of file gc.c.
References calloc, malloc_limit, ruby_gc_params_t::malloc_limit_min, and rb_objspace.
size_t rb_objspace_data_type_memsize | ( | VALUE | obj | ) |
Definition at line 2078 of file gc.c.
References rb_data_type_struct::dsize, rb_data_type_struct::function, RTYPEDDATA_DATA, RTYPEDDATA_P, and RTYPEDDATA_TYPE.
Definition at line 2091 of file gc.c.
References PUREFUNC(), RTYPEDDATA_P, and RTYPEDDATA_TYPE.
void rb_objspace_each_objects | ( | each_obj_callback * | callback, |
void * | data | ||
) |
void rb_objspace_each_objects_without_setup | ( | each_obj_callback * | callback, |
void * | data | ||
) |
void rb_objspace_free | ( | rb_objspace_t * | objspace | ) |
Definition at line 1343 of file gc.c.
References free(), global_list, heap_allocated_pages, heap_eden, heap_pages_sorted, is_lazy_sweeping, list, gc_list::next, rb_objspace::profile, rb_bug(), rb_objspace::records, and xfree().
int rb_objspace_garbage_object_p | ( | VALUE | obj | ) |
Definition at line 3072 of file gc.c.
References rb_objspace.
int rb_objspace_markable_object_p | ( | VALUE | obj | ) |
Definition at line 3065 of file gc.c.
References rb_objspace.
Definition at line 7599 of file gc.c.
References rb_objspace.
void rb_objspace_reachable_objects_from_root | ( | void(func)(const char *category, VALUE, void *) | , |
void * | passing_data | ||
) |
Definition at line 7627 of file gc.c.
References root_objects_data::data, root_objects_data::func, and rb_objspace.
void rb_objspace_set_event_hook | ( | const rb_event_flag_t | event | ) |
Definition at line 1811 of file gc.c.
References rb_objspace::flags, rb_objspace::has_hook, rb_objspace::hook_events, rb_objspace, and RUBY_INTERNAL_EVENT_OBJSPACE_MASK.
Definition at line 9290 of file gc.c.
References snprintf, and SPECIAL_CONST_P.
Referenced by rb_obj_info_dump(), and ruby_debug_print_value().
int rb_threadptr_during_gc | ( | rb_thread_t * | th | ) |
Definition at line 6742 of file gc.c.
References during_gc, rb_objspace_of, and rb_thread_struct::vm.
int rb_threadptr_stack_check | ( | rb_thread_t * | th | ) |
Definition at line 2653 of file gc.c.
References finalizer_table, FL_FINALIZE, FL_UNSET, rb_check_frozen, rb_objspace, st_data_t, and st_delete.
Definition at line 1989 of file gc.c.
References FL_WB_PROTECTED, and GC_ASSERT.
Definition at line 1982 of file gc.c.
References FL_WB_PROTECTED, and GC_ASSERT.
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 2044 of file gc.c.
References DATA_PTR, rb_data_object_wrap(), and xcalloc.
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 2065 of file gc.c.
References DATA_PTR, rb_data_typed_object_wrap(), and xcalloc.
int ruby_get_stack_grow_direction | ( | volatile VALUE * | addr | ) |
Definition at line 3997 of file gc.c.
References SET_MACHINE_STACK_END.
void ruby_malloc_size_overflow | ( | size_t | count, |
size_t | elsize | ||
) |
Definition at line 8006 of file gc.c.
References PRIuSIZE, rb_eArgError, and rb_raise().
void* ruby_mimmalloc | ( | size_t | size | ) |
void ruby_sized_xfree | ( | void * | x, |
size_t | size | ||
) |
Definition at line 8077 of file gc.c.
Referenced by rb_ary_free(), rb_str_free(), and ruby_xfree().
void* ruby_sized_xrealloc | ( | void * | ptr, |
size_t | new_size, | ||
size_t | old_size | ||
) |
Definition at line 8039 of file gc.c.
Referenced by ruby_xrealloc().
void* ruby_sized_xrealloc2 | ( | void * | ptr, |
size_t | n, | ||
size_t | size, | ||
size_t | old_n | ||
) |
Definition at line 8058 of file gc.c.
References len, rb_eArgError, and rb_raise().
Referenced by ruby_xrealloc2().
void* ruby_xcalloc | ( | size_t | n, |
size_t | size | ||
) |
Definition at line 8030 of file gc.c.
Referenced by rb_iseq_defined_string().
void ruby_xfree | ( | void * | x | ) |
Definition at line 8085 of file gc.c.
References ruby_sized_xfree().
Referenced by freeifaddrs(), Init_fiddle(), rb_fiddle_free(), rb_free_tmp_buffer(), rb_iseq_free(), and rb_thread_recycle_stack_release().
void* ruby_xrealloc | ( | void * | ptr, |
size_t | new_size | ||
) |
Definition at line 8049 of file gc.c.
References ruby_sized_xrealloc().
void* ruby_xrealloc2 | ( | void * | ptr, |
size_t | n, | ||
size_t | size | ||
) |
Definition at line 8068 of file gc.c.
References ruby_sized_xrealloc2().
volatile VALUE rb_gc_guarded_val |
Definition at line 95 of file gc.c.
Referenced by rb_gc_guarded_ptr_val().
VALUE* ruby_initial_gc_stress_ptr = &ruby_initial_gc_stress |
Definition at line 738 of file gc.c.
Referenced by ruby_env_debug_option().
int ruby_rgengc_debug |
Definition at line 235 of file gc.c.
Referenced by ruby_debug_breakpoint(), and ruby_env_debug_option().