Ruby
2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)
|
#include "ruby/encoding.h"
#include "ruby/io.h"
#include "ruby/st.h"
#include "ruby/re.h"
#include "ruby/thread.h"
#include "ruby/util.h"
#include "ruby/debug.h"
#include "internal.h"
#include "eval_intern.h"
#include "vm_core.h"
#include "builtin.h"
#include "gc.h"
#include "constant.h"
#include "ruby_atomic.h"
#include "probes.h"
#include "id_table.h"
#include "symbol.h"
#include <stdio.h>
#include <stdarg.h>
#include <setjmp.h>
#include <sys/types.h>
#include "ruby_assert.h"
#include "debug_counter.h"
#include "transient_heap.h"
#include "mjit.h"
#include "regint.h"
#include "gc.rbinc"
Go to the source code of this file.
Data Structures | |
struct | optional |
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 | heap_cursor |
struct | root_objects_data |
struct | gc_raise_tag |
struct | malloc_obj_info |
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 | 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) RUBY_ASSERT_MESG_WHEN(RGENGC_CHECK_MODE > 0, expr, #expr) |
#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 USE_GC_MALLOC_OBJ_INFO_DETAILS |
#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 | popcount_bits rb_popcount_intptr |
#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_PINNED_BITS(x) (&GET_HEAP_PAGE(x)->pinned_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)->sweeping_page != 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 | TYPED_UPDATE_IF_MOVED(_objspace, _type, _thing) |
#define | UPDATE_IF_MOVED(_objspace, _thing) TYPED_UPDATE_IF_MOVED(_objspace, VALUE, _thing) |
#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_PIN_BITMAP(obj) MARKED_IN_BITMAP(GET_HEAP_PINNED_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 | UNEXPECTED_NODE(func) |
#define | OBJ_ID_INCREMENT (sizeof(RVALUE) / 2) |
#define | OBJ_ID_INITIAL (OBJ_ID_INCREMENT * 2) |
#define | RESTORE_FINALIZER() |
#define | NUM2PTR(x) NUM2ULONG(x) |
#define | COUNT_TYPE(t) case (t): return 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 2048 |
#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 | global_symbols ruby_global_symbols |
#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 | BUFF_ARGS buff + pos, buff_size - pos |
#define | APPENDF(f) if ((pos += snprintf f) >= buff_size) goto end |
#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 *) |
typedef int | page_compare_func_t(const void *, const void *, void *) |
#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 BUFF_ARGS buff + pos, buff_size - pos |
#define C | ( | c, | |
s | |||
) | ((c) != 0 ? (s) : " ") |
#define CALC_EXACT_MALLOC_SIZE USE_GC_MALLOC_OBJ_INFO_DETAILS |
#define CLEAR_IN_BITMAP | ( | bits, | |
p | |||
) | ((bits)[BITMAP_INDEX(p)] = (bits)[BITMAP_INDEX(p)] & ~BITMAP_BIT(p)) |
#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 | ) | RUBY_ASSERT_MESG_WHEN(RGENGC_CHECK_MODE > 0, expr, #expr) |
#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_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 |
#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_PINNED_BITS | ( | x | ) | (&GET_HEAP_PAGE(x)->pinned_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_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 | |||
) |
#define global_symbols ruby_global_symbols |
#define has_sweeping_pages | ( | heap | ) | ((heap)->sweeping_page != 0) |
#define heap_allocatable_pages objspace->heap_pages.allocatable_pages |
#define heap_allocated_pages objspace->heap_pages.allocated_pages |
#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_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) |
#define is_lazy_sweeping | ( | heap | ) | (GC_ENABLE_LAZY_SWEEP && has_sweeping_pages(heap)) |
#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 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 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) |
#define NUM2PTR | ( | x | ) | NUM2ULONG(x) |
#define NUM_IN_PAGE | ( | p | ) | (((bits_t)(p) & HEAP_PAGE_ALIGN_MASK)/sizeof(RVALUE)) |
#define OBJ_ID_INITIAL (OBJ_ID_INCREMENT * 2) |
#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 rb_jmp_buf rb_jmpbuf_t |
#define rb_objspace (*rb_objspace_of(GET_VM())) |
#define rb_setjmp | ( | env | ) | RUBY_SETJMP(env) |
#define RESTORE_FINALIZER | ( | ) |
#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_PIN_BITMAP | ( | obj | ) | MARKED_IN_BITMAP(GET_HEAP_PINNED_BITS(obj), (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)) |
#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) |
#define STACK_LENGTH |
#define STACK_LEVEL_MAX (ec->machine.stack_maxsize/sizeof(VALUE)) |
#define TF | ( | c | ) | ((c) != 0 ? "true" : "false") |
#define TRY_WITH_GC | ( | alloc | ) |
#define TYPE_NAME | ( | t | ) | case (t): return #t; |
#define TYPED_UPDATE_IF_MOVED | ( | _objspace, | |
_type, | |||
_thing | |||
) |
#define UNEXPECTED_NODE | ( | func | ) |
#define UPDATE_IF_MOVED | ( | _objspace, | |
_thing | |||
) | TYPED_UPDATE_IF_MOVED(_objspace, VALUE, _thing) |
#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 |
ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS | ( | static void | mark_locations_arrayrb_objspace_t *objspace, register const VALUE *x, register long n | ) |
Definition at line 11832 of file gc.c.
References HEAP_PAGE_BITMAP_PLANES, HEAP_PAGE_BITMAP_SIZE, HEAP_PAGE_OBJ_LIMIT, ID2SYM, OBJ_FREEZE, rb_define_const(), rb_define_module(), rb_define_module_under(), rb_define_singleton_method(), rb_hash_aset(), rb_hash_new(), rb_intern, rb_mGC, and SIZET2NUM.
Definition at line 2929 of file gc.c.
References rb_objspace.
Definition at line 2909 of file gc.c.
References rb_objspace::id_to_obj_tbl, INT2FIX, rb_objspace::next_object_id, OBJ_ID_INITIAL, rb_objspace, and st_init_table().
Referenced by ruby_setup().
NO_SANITIZE | ( | "memory" | , |
static inline int | is_pointer_to_heaprb_objspace_t *objspace, void *ptr | ||
) |
NO_SANITIZE | ( | "memory" | , |
static void | gc_mark_mayberb_objspace_t *objspace, VALUE ptr | ||
) |
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 | ) |
NORETURN | ( | static void | negative_size_allocation_errorconst char * | ) |
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 | ) |
Definition at line 9610 of file gc.c.
References GC_ASSERT, malloc(), memalign(), NULL, posix_memalign(), and size.
Definition at line 10227 of file gc.c.
Referenced by rb_alloc_tmp_buffer().
Definition at line 6938 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 2376 of file gc.c.
References Check_Type, klass, 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 2397 of file gc.c.
References Check_Type, klass, and T_CLASS.
Referenced by RUBY_ALIAS_FUNCTION().
Definition at line 8687 of file gc.c.
References during_gc, and rb_objspace.
Referenced by rb_ec_stack_overflow().
MJIT_FUNC_EXPORTED int rb_ec_stack_check | ( | rb_execution_context_t * | ec | ) |
void rb_free_const_table | ( | struct rb_id_table * | tbl | ) |
Definition at line 2491 of file gc.c.
References rb_id_table_foreach_values().
Definition at line 8679 of file gc.c.
References GPR_DEFAULT_REASON, and rb_objspace.
Referenced by rb_fdopen(), rb_gc_for_fd(), rb_gc_start(), and rb_reg_region_copy().
Definition at line 3295 of file gc.c.
References finalizer_table, FL_FINALIZE, FL_SET, FL_TEST, obj, rb_objspace, st_insert(), and st_lookup().
Definition at line 8711 of file gc.c.
References rb_objspace::count, and rb_objspace::profile.
Definition at line 9235 of file gc.c.
References rb_objspace.
Definition at line 7011 of file gc.c.
References rb_objspace.
Referenced by rb_parser_free(), and rb_str_tmp_frozen_release().
Definition at line 250 of file gc.c.
References ptr, and rb_gc_guarded_val.
Definition at line 8816 of file gc.c.
References rb_objspace.
Definition at line 8111 of file gc.c.
References SPECIAL_CONST_P.
Referenced by rb_execution_context_update(), rb_fiber_update_self(), and rb_iseq_update_references().
Definition at line 5212 of file gc.c.
Referenced by rb_ast_mark(), rb_hook_list_mark(), rb_iseq_mark_insn_storage(), rb_strterm_mark(), and rb_vm_mark().
void rb_gc_mark_machine_stack | ( | const rb_execution_context_t * | ec | ) |
Definition at line 4981 of file gc.c.
References GET_STACK_BOUNDS, and rb_objspace.
Definition at line 5044 of file gc.c.
Referenced by rb_gvar_val_marker(), and rb_gvar_var_marker().
Definition at line 5206 of file gc.c.
Referenced by rb_fiber_mark_self().
Definition at line 4739 of file gc.c.
References rb_objspace.
Referenced by rb_execution_context_mark().
Definition at line 7983 of file gc.c.
References rb_objspace.
Referenced by rb_vm_update_references().
MJIT_FUNC_EXPORTED void rb_gc_writebarrier_remember | ( | VALUE | obj | ) |
Definition at line 6875 of file gc.c.
References gc_report, and rb_objspace.
Definition at line 2306 of file gc.c.
References FL_USHIFT, RVALUE::flags, and T_IMEMO.
rb_imemo_tmpbuf_t* rb_imemo_tmpbuf_parser_heap | ( | void * | buf, |
rb_imemo_tmpbuf_t * | old_heap, | ||
size_t | cnt | ||
) |
Definition at line 89 of file iseq.c.
References rb_iseq_constant_body::iseq_insn_info::body, rb_iseq_struct::body, rb_iseq_constant_body::call_data, rb_iseq_constant_body::catch_table, rb_kwarg_call_data::ci_kw, rb_iseq_constant_body::ci_kw_size, rb_iseq_constant_body::ci_size, i, rb_iseq_constant_body::insns_info, rb_iseq_constant_body::is_entries, iseq, rb_iseq_constant_body::iseq_encoded, rb_iseq_constant_body::keyword, rb_call_info_with_kwarg::kw_arg, LIKELY, rb_iseq_constant_body::local_table, mjit_free_iseq(), NULL, rb_iseq_constant_body::opt_table, rb_iseq_constant_body::param, rb_iseq_constant_body::iseq_insn_info::positions, rb_iseq_shared_exc_local_tbl, RUBY_FREE_ENTER, ruby_xfree(), and rb_iseq_constant_body::iseq_insn_info::succ_index_table.
Definition at line 287 of file iseq.c.
References rb_iseq_struct::body, FL_TEST, iseq, ISEQ_MARKABLE_ISEQ, RUBY_MARK_ENTER, RUBY_MARK_UNLESS_NULL, and rb_iseq_struct::wrapper.
Definition at line 373 of file iseq.c.
References rb_iseq_struct::body, rb_iseq_constant_body::call_data, rb_iseq_constant_body::catch_table, rb_iseq_constant_body::ci_size, rb_iseq_constant_body::insns_info, int, iseq, ISEQ_EXECUTABLE_P, rb_iseq_constant_body::iseq_size, rb_iseq_constant_body::local_table_size, size, rb_iseq_constant_body::iseq_insn_info::size, and unsigned.
Definition at line 221 of file iseq.c.
References rb_iseq_location_struct::base_label, rb_iseq_struct::body, rb_iseq_constant_body::coverage, FL_TEST, iseq, ISEQ_MARKABLE_ISEQ, rb_iseq_location_struct::label, rb_iseq_constant_body::local_iseq, rb_iseq_constant_body::location, rb_iseq_constant_body::parent_iseq, rb_iseq_location_struct::pathobj, rb_iseq_constant_body::pc2branchindex, rb_gc_location(), and rb_iseq_constant_body::variable.
Definition at line 9979 of file gc.c.
Referenced by ruby_default_signal().
Definition at line 4798 of file gc.c.
Referenced by rb_iseq_build_from_ary().
Definition at line 5005 of file gc.c.
Referenced by rb_vm_mark().
Definition at line 9578 of file gc.c.
References GET_EC, and rb_objspace_of.
const char* rb_method_type_name | ( | rb_method_type_t | type | ) |
Definition at line 11378 of file gc.c.
References rb_bug(), VM_METHOD_TYPE_ALIAS, VM_METHOD_TYPE_ATTRSET, VM_METHOD_TYPE_BMETHOD, VM_METHOD_TYPE_CFUNC, VM_METHOD_TYPE_ISEQ, VM_METHOD_TYPE_IVAR, VM_METHOD_TYPE_MISSING, VM_METHOD_TYPE_NOTIMPLEMENTED, VM_METHOD_TYPE_OPTIMIZED, VM_METHOD_TYPE_REFINED, VM_METHOD_TYPE_UNDEF, and VM_METHOD_TYPE_ZSUPER.
rb_objspace_t* rb_objspace_alloc | ( | void | ) |
void rb_objspace_call_finalizer | ( | rb_objspace_t * | objspace | ) |
Definition at line 2417 of file gc.c.
References obj, ptr, RTYPEDDATA_DATA, RTYPEDDATA_P, and RTYPEDDATA_TYPE.
Definition at line 2430 of file gc.c.
References obj, RTYPEDDATA_P, and RTYPEDDATA_TYPE.
void rb_objspace_each_objects | ( | each_obj_callback * | callback, |
void * | data | ||
) |
Definition at line 3025 of file gc.c.
Referenced by rb_iseq_remove_coverage_all(), and rb_iseq_trace_set_all().
void rb_objspace_each_objects_without_setup | ( | each_obj_callback * | callback, |
void * | data | ||
) |
void rb_objspace_free | ( | rb_objspace_t * | objspace | ) |
Definition at line 1600 of file gc.c.
References free, global_list, heap_allocated_pages, heap_eden, heap_pages_sorted, i, is_lazy_sweeping, list, gc_list::next, rb_objspace::profile, rb_bug(), rb_objspace::records, and xfree.
Definition at line 3605 of file gc.c.
References rb_objspace.
Definition at line 3598 of file gc.c.
References rb_objspace.
Definition at line 9448 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 9476 of file gc.c.
References rb_objspace.
void rb_objspace_set_event_hook | ( | const rb_event_flag_t | event | ) |
Definition at line 2080 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 11419 of file gc.c.
References APPENDF, BUFF_ARGS, obj, and SPECIAL_CONST_P.
Referenced by rb_obj_info_dump(), rb_obj_info_dump_loc(), and ruby_debug_print_value().
Definition at line 3191 of file gc.c.
References finalizer_table, FL_FINALIZE, FL_UNSET, obj, rb_check_frozen, rb_objspace, and st_delete().
Definition at line 2234 of file vm.c.
References rb_vm_struct::frozen_strings, ptr, and rb_gc_update_tbl_refs().
Definition at line 2279 of file gc.c.
References FL_WB_PROTECTED, RVALUE::flags, and GC_ASSERT.
Definition at line 2272 of file gc.c.
References FL_WB_PROTECTED, RVALUE::flags, 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) | |||
) |
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 4620 of file gc.c.
References ruby_stack_grow_direction, and SET_MACHINE_STACK_END.
Definition at line 10074 of file gc.c.
References count, PRIuSIZE, rb_eArgError, and rb_raise().
Definition at line 10187 of file gc.c.
References malloc(), NULL, size, and malloc_obj_info::size.
Referenced by Init_BareVM(), and rb_threadptr_root_fiber_setup().
Definition at line 10142 of file gc.c.
Referenced by ruby_xfree().
Definition at line 10107 of file gc.c.
Referenced by ruby_xrealloc_body().
Definition at line 11970 of file gc.c.
References n, ruby_xcalloc_body(), and size.
Referenced by rb_iseq_defined_string().
Definition at line 10098 of file gc.c.
Referenced by ruby_xcalloc().
Definition at line 10150 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_iseq_insns_info_encode_positions().
Definition at line 11950 of file gc.c.
References ruby_xmalloc_body(), and size.
Definition at line 11960 of file gc.c.
References n, ruby_xmalloc2_body(), and size.
Definition at line 10082 of file gc.c.
Referenced by ruby_xmalloc2().
Definition at line 11980 of file gc.c.
References ptr, and ruby_xrealloc_body().
Definition at line 11990 of file gc.c.
References n, ptr, and ruby_xrealloc2_body().
Definition at line 10133 of file gc.c.
References n, ptr, ruby_sized_xrealloc2(), and size.
Referenced by ruby_xrealloc2().
Definition at line 10117 of file gc.c.
References ptr, and ruby_sized_xrealloc().
Referenced by ruby_xrealloc().
volatile VALUE rb_gc_guarded_val |
Definition at line 248 of file gc.c.
Referenced by rb_gc_guarded_ptr_val().
const struct st_hash_type rb_hashtype_ident |
rb_symbols_t ruby_global_symbols |
VALUE* ruby_initial_gc_stress_ptr = &ruby_initial_gc_stress |
Definition at line 905 of file gc.c.
Referenced by ruby_env_debug_option().
int ruby_rgengc_debug |
Definition at line 388 of file gc.c.
Referenced by ruby_env_debug_option().
int ruby_stack_grow_direction |
Definition at line 4618 of file gc.c.
Referenced by ruby_get_stack_grow_direction().