Ruby
2.0.0p645(2015-04-13revision50299)
|
#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 "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 <setjmp.h>
#include <sys/types.h>
#include <assert.h>
Go to the source code of this file.
Data Structures | |
struct | ruby_gc_params_t |
struct | gc_profile_record |
struct | RVALUE |
struct | heaps_slot |
struct | heaps_header |
struct | heaps_free_bitmap |
struct | gc_list |
struct | stack_chunk |
struct | mark_stack |
struct | rb_objspace |
struct | rb_objspace::mark_func_data_struct |
struct | each_obj_args |
struct | os_each_struct |
struct | force_finalize_list |
struct | mark_tbl_arg |
struct | weakmap |
Macros | |
#define | VALGRIND_MAKE_MEM_DEFINED(p, n) 0 |
#define | VALGRIND_MAKE_MEM_UNDEFINED(p, n) 0 |
#define | rb_setjmp(env) RUBY_SETJMP(env) |
#define | rb_jmp_buf rb_jmpbuf_t |
#define | GC_MALLOC_LIMIT 8000000 |
#define | HEAP_MIN_SLOTS 10000 |
#define | FREE_MIN 4096 |
#define | nomem_error GET_VM()->special_exceptions[ruby_error_nomemory] |
#define | GC_PROFILE_MORE_DETAIL 0 |
#define | STACK_CHUNK_SIZE 500 |
#define | CALC_EXACT_MALLOC_SIZE 0 |
#define | rb_objspace (*GET_VM()->objspace) |
#define | ruby_initial_gc_stress initial_params.gc_stress |
#define | malloc_limit objspace->malloc_params.limit |
#define | malloc_increase objspace->malloc_params.increase |
#define | heaps objspace->heap.ptr |
#define | heaps_length objspace->heap.length |
#define | heaps_used objspace->heap.used |
#define | lomem objspace->heap.range[0] |
#define | himem objspace->heap.range[1] |
#define | heaps_inc objspace->heap.increment |
#define | heaps_freed objspace->heap.freed |
#define | dont_gc objspace->flags.dont_gc |
#define | during_gc objspace->flags.during_gc |
#define | finalizing objspace->flags.finalizing |
#define | finalizer_table objspace->final.table |
#define | deferred_final_list objspace->final.deferred |
#define | global_List objspace->global_list |
#define | ruby_gc_stress objspace->gc_stress |
#define | initial_malloc_limit initial_params.initial_malloc_limit |
#define | initial_heap_min_slots initial_params.initial_heap_min_slots |
#define | initial_free_min initial_params.initial_free_min |
#define | is_lazy_sweeping(objspace) ((objspace)->heap.sweep_slots != 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 | has_free_object (objspace->heap.free_slots && objspace->heap.free_slots->freelist) |
#define | HEAP_HEADER(p) ((struct heaps_header *)(p)) |
#define | GET_HEAP_HEADER(x) (HEAP_HEADER((uintptr_t)(x) & ~(HEAP_ALIGN_MASK))) |
#define | GET_HEAP_SLOT(x) (GET_HEAP_HEADER(x)->base) |
#define | GET_HEAP_BITMAP(x) (GET_HEAP_HEADER(x)->bits) |
#define | NUM_IN_SLOT(p) (((uintptr_t)(p) & HEAP_ALIGN_MASK)/sizeof(RVALUE)) |
#define | BITMAP_INDEX(p) (NUM_IN_SLOT(p) / (sizeof(uintptr_t) * CHAR_BIT)) |
#define | BITMAP_OFFSET(p) (NUM_IN_SLOT(p) & ((sizeof(uintptr_t) * CHAR_BIT)-1)) |
#define | MARKED_IN_BITMAP(bits, p) (bits[BITMAP_INDEX(p)] & ((uintptr_t)1 << BITMAP_OFFSET(p))) |
#define | HEAP_ALIGN_LOG 14 |
#define | CEILDIV(i, mod) (((i) + (mod) - 1)/(mod)) |
#define | NUM2PTR(x) NUM2ULONG(x) |
#define | COUNT_TYPE(t) case (t): type = ID2SYM(rb_intern(#t)); break; |
#define | MARK_IN_BITMAP(bits, p) (bits[BITMAP_INDEX(p)] = bits[BITMAP_INDEX(p)] | ((uintptr_t)1 << BITMAP_OFFSET(p))) |
#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 | numberof(array) (int)(sizeof(array) / sizeof((array)[0])) |
#define | STR_ASSOC FL_USER3 /* copied from string.c */ |
#define | GC_NOTIFY 0 |
#define | TRY_WITH_GC(alloc) |
#define | GC_PROFILE_RECORD_DEFAULT_SIZE 100 |
Typedefs | |
typedef struct gc_profile_record | gc_profile_record |
typedef struct RVALUE | RVALUE |
typedef struct stack_chunk | stack_chunk_t |
typedef struct mark_stack | mark_stack_t |
typedef struct rb_objspace | rb_objspace_t |
typedef int | each_obj_callback (void *, void *, size_t, void *) |
Enumerations | |
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 heaps_header))/sizeof(struct RVALUE)), HEAP_BITMAP_LIMIT = CEILDIV(CEILDIV(HEAP_SIZE, sizeof(struct RVALUE)), sizeof(uintptr_t) * CHAR_BIT) } |
Variables | |
static ruby_gc_params_t | initial_params |
int * | ruby_initial_gc_stress_ptr = &ruby_initial_gc_stress |
int | ruby_gc_debug_indent = 0 |
VALUE | rb_mGC |
st_table * | rb_class_tbl |
int | ruby_disable_gc_stress = 0 |
int | ruby_stack_grow_direction |
static const rb_data_type_t | weakmap_type |
Referenced by count_objects().
#define deferred_final_list objspace->final.deferred |
Definition at line 285 of file gc.c.
Referenced by finalize_deferred(), rb_objspace_call_finalizer(), and slot_sweep().
#define dont_gc objspace->flags.dont_gc |
Definition at line 281 of file gc.c.
Referenced by garbage_collect_with_gvl(), newobj(), rb_gc_disable(), rb_gc_enable(), and ready_to_gc().
#define during_gc objspace->flags.during_gc |
Definition at line 282 of file gc.c.
Referenced by allocate_sorted_heaps(), assign_heap_slot(), garbage_collect(), gc_prepare_free_objects(), gc_sweep(), lazy_sweep(), newobj(), rb_during_gc(), rb_objspace_call_finalizer(), and ready_to_gc().
#define finalizer_table objspace->final.table |
Definition at line 284 of file gc.c.
Referenced by define_final0(), gc_marks(), init_heap(), rb_gc_copy_finalizer(), rb_objspace_call_finalizer(), rb_undefine_final(), and run_final().
#define finalizing objspace->flags.finalizing |
Definition at line 283 of file gc.c.
Referenced by rb_gc(), rb_gc_finalize_deferred(), rb_objspace_call_finalizer(), and slot_sweep().
#define GC_NOTIFY 0 |
Definition at line 3023 of file gc.c.
Referenced by garbage_collect().
#define GC_PROFILE_RECORD_DEFAULT_SIZE 100 |
Definition at line 3880 of file gc.c.
Referenced by gc_prof_timer_start(), and gc_profile_clear().
#define GET_HEAP_BITMAP | ( | x | ) | (GET_HEAP_HEADER(x)->bits) |
Definition at line 311 of file gc.c.
Referenced by gc_mark_ptr(), is_dead_object(), rb_gc_force_recycle(), and slot_sweep().
#define GET_HEAP_HEADER | ( | x | ) | (HEAP_HEADER((uintptr_t)(x) & ~(HEAP_ALIGN_MASK))) |
#define GET_HEAP_SLOT | ( | x | ) | (GET_HEAP_HEADER(x)->base) |
Definition at line 310 of file gc.c.
Referenced by add_slot_local_freelist().
#define GET_STACK_BOUNDS | ( | start, | |
end, | |||
appendix | |||
) |
Definition at line 2494 of file gc.c.
Referenced by mark_current_machine_context(), and rb_gc_mark_machine_stack().
#define global_List objspace->global_list |
Definition at line 286 of file gc.c.
Referenced by gc_marks(), rb_gc_register_address(), rb_gc_unregister_address(), and rb_objspace_free().
#define has_free_object (objspace->heap.free_slots && objspace->heap.free_slots->freelist) |
Definition at line 306 of file gc.c.
Referenced by gc_prepare_free_objects(), lazy_sweep(), newobj(), and ready_to_gc().
#define HEAP_HEADER | ( | p | ) | ((struct heaps_header *)(p)) |
#define HEAP_MIN_SLOTS 10000 |
Definition at line 72 of file gc.c.
Referenced by init_heap().
#define heaps objspace->heap.ptr |
Definition at line 274 of file gc.c.
Referenced by assign_heap_slot(), before_gc_sweep(), garbage_collect(), rb_objspace_free(), and unlink_heap_slot().
#define heaps_freed objspace->heap.freed |
Definition at line 280 of file gc.c.
Referenced by free_unused_heaps().
#define heaps_inc objspace->heap.increment |
Definition at line 279 of file gc.c.
Referenced by add_heap_slots(), heaps_increment(), and set_heaps_increment().
#define heaps_length objspace->heap.length |
Definition at line 275 of file gc.c.
Referenced by add_heap_slots(), and set_heaps_increment().
#define heaps_used objspace->heap.used |
Definition at line 276 of file gc.c.
Referenced by add_heap_slots(), after_gc_sweep(), allocate_sorted_heaps(), assign_heap_slot(), before_gc_sweep(), count_objects(), free_unused_heaps(), gc_prepare_free_objects(), gc_prof_set_heap_info(), initial_expand_heap(), is_pointer_to_heap(), objspace_each_objects(), rb_objspace_call_finalizer(), rb_objspace_free(), and set_heaps_increment().
#define himem objspace->heap.range[1] |
Definition at line 278 of file gc.c.
Referenced by assign_heap_slot(), and is_pointer_to_heap().
#define initial_free_min initial_params.initial_free_min |
Definition at line 290 of file gc.c.
Referenced by before_gc_sweep(), and rb_gc_set_params().
#define initial_heap_min_slots initial_params.initial_heap_min_slots |
Definition at line 289 of file gc.c.
Referenced by initial_expand_heap(), and rb_gc_set_params().
#define initial_malloc_limit initial_params.initial_malloc_limit |
Definition at line 288 of file gc.c.
Referenced by after_gc_sweep(), rb_gc_set_params(), and rb_objspace_alloc().
#define is_lazy_sweeping | ( | objspace | ) | ((objspace)->heap.sweep_slots != 0) |
Definition at line 292 of file gc.c.
Referenced by is_dead_object().
#define lomem objspace->heap.range[0] |
Definition at line 277 of file gc.c.
Referenced by assign_heap_slot().
#define malloc_increase objspace->malloc_params.increase |
Definition at line 273 of file gc.c.
Referenced by after_gc_sweep(), vm_malloc_fixup(), vm_malloc_prepare(), and vm_xrealloc().
#define malloc_limit objspace->malloc_params.limit |
Definition at line 272 of file gc.c.
Referenced by after_gc_sweep(), rb_objspace_alloc(), and vm_malloc_prepare().
#define MARK_IN_BITMAP | ( | bits, | |
p | |||
) | (bits[BITMAP_INDEX(p)] = bits[BITMAP_INDEX(p)] | ((uintptr_t)1 << BITMAP_OFFSET(p))) |
Definition at line 2245 of file gc.c.
Referenced by gc_mark_ptr().
#define MARKED_IN_BITMAP | ( | bits, | |
p | |||
) | (bits[BITMAP_INDEX(p)] & ((uintptr_t)1 << BITMAP_OFFSET(p))) |
Definition at line 315 of file gc.c.
Referenced by gc_mark_ptr(), is_dead_object(), rb_gc_force_recycle(), and slot_sweep().
#define nomem_error GET_VM()->special_exceptions[ruby_error_nomemory] |
Definition at line 93 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 295 of file gc.c.
Referenced by rb_obj_id(), run_finalizer(), and wmap_aset().
Definition at line 2499 of file gc.c.
Referenced by mark_current_machine_context().
#define obj_id_to_ref | ( | objid | ) | ((objid) ^ FIXNUM_FLAG) /* unset FIXNUM_FLAG */ |
Definition at line 296 of file gc.c.
Referenced by id2ref(), and wmap_finalize().
#define RANY | ( | o | ) | ((RVALUE*)(o)) |
Definition at line 305 of file gc.c.
Referenced by gc_mark_children(), is_pointer_to_heap(), markable_object_p(), newobj(), obj_free(), and rb_objspace_call_finalizer().
#define rb_gc_mark_locations | ( | start, | |
end | |||
) | gc_mark_locations(objspace, (start), (end)) |
Definition at line 2348 of file gc.c.
Referenced by cont_mark(), env_mark(), mark_current_machine_context(), name_err_mesg_mark(), rb_gc_mark_machine_stack(), rb_gc_mark_symbols(), rb_thread_mark(), and rb_vm_mark().
#define rb_jmp_buf rb_jmpbuf_t |
Definition at line 67 of file gc.c.
Referenced by mark_current_machine_context().
#define rb_objspace (*GET_VM()->objspace) |
Definition at line 265 of file gc.c.
Referenced by count_objects(), define_final0(), gc_profile_clear(), gc_profile_disable(), gc_profile_dump_on(), gc_profile_enable(), gc_profile_enable_get(), gc_profile_record_get(), gc_profile_total_time(), gc_stat(), gc_stress_get(), gc_stress_set(), id2ref(), lazy_sweep_enable(), newobj(), objspace_each_objects(), rb_during_gc(), rb_gc(), rb_gc_copy_finalizer(), rb_gc_disable(), rb_gc_enable(), rb_gc_finalize_deferred(), rb_gc_force_recycle(), rb_gc_mark_machine_stack(), rb_gc_register_address(), rb_gc_unregister_address(), rb_objspace_each_objects(), rb_objspace_reachable_objects_from(), rb_undefine_final(), and wmap_aref().
Definition at line 66 of file gc.c.
Referenced by mark_current_machine_context().
#define ruby_gc_stress objspace->gc_stress |
Definition at line 287 of file gc.c.
Referenced by gc_stress_get(), gc_stress_set(), newobj(), rb_objspace_alloc(), vm_malloc_prepare(), and vm_xrealloc().
#define ruby_initial_gc_stress initial_params.gc_stress |
Definition at line 266 of file gc.c.
Referenced by rb_objspace_alloc().
#define SET_STACK_END SET_MACHINE_STACK_END(&th->machine_stack_end) |
Definition at line 2251 of file gc.c.
Referenced by gc_marks(), mark_current_machine_context(), ruby_stack_length(), and stack_check().
#define STACK_CHUNK_SIZE 500 |
Definition at line 188 of file gc.c.
Referenced by init_mark_stack().
#define STACK_END (th->machine_stack_end) |
Definition at line 2255 of file gc.c.
Referenced by mark_current_machine_context(), and ruby_stack_length().
#define STACK_LENGTH |
Definition at line 2256 of file gc.c.
Referenced by stack_check().
#define STACK_START (th->machine_stack_start) |
Definition at line 2254 of file gc.c.
Referenced by mark_current_machine_context(), and ruby_stack_length().
#define STACKFRAME_FOR_CALL_CFUNC 512 |
Definition at line 2306 of file gc.c.
Referenced by ruby_stack_check().
#define TRY_WITH_GC | ( | alloc | ) |
Definition at line 3509 of file gc.c.
Referenced by vm_xcalloc(), and vm_xmalloc().
Definition at line 62 of file gc.c.
Referenced by mark_locations_array().
Definition at line 63 of file gc.c.
Referenced by add_slot_local_freelist(), and slot_sweep().
typedef struct gc_profile_record gc_profile_record |
typedef struct mark_stack mark_stack_t |
typedef struct rb_objspace rb_objspace_t |
typedef struct stack_chunk stack_chunk_t |
anonymous enum |
|
static |
Definition at line 558 of file gc.c.
References add, allocate_sorted_heaps(), assign_heap_slot(), heaps_inc, heaps_length, heaps_used, and i.
Referenced by init_heap(), and initial_expand_heap().
|
static |
Definition at line 823 of file gc.c.
References RVALUE::as, RVALUE::free, heaps_slot::freelist, GET_HEAP_SLOT, p, VALGRIND_MAKE_MEM_UNDEFINED, and void.
Referenced by finalize_list(), and rb_gc_force_recycle().
|
static |
Definition at line 2135 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 |
Definition at line 1988 of file gc.c.
References ATOMIC_SIZE_EXCHANGE, rb_objspace::free_min, rb_objspace::free_num, free_unused_heaps(), gc_prof_set_malloc_info(), rb_objspace::heap, HEAP_OBJ_LIMIT, heaps_increment(), heaps_used, initial_malloc_limit, malloc_increase, malloc_limit, rb_objspace::marked_num, and set_heaps_increment().
Referenced by gc_prepare_free_objects(), gc_sweep(), and rest_sweep().
Definition at line 3461 of file gc.c.
References free.
Referenced by assign_heap_slot(), free_unused_heaps(), and rb_objspace_free().
|
static |
|
static |
Definition at line 432 of file gc.c.
References add, during_gc, rb_objspace::free_bitmap, rb_objspace::heap, HEAP_BITMAP_LIMIT, heaps_used, i, malloc(), heaps_free_bitmap::next, p, rb_memerror(), realloc(), size, and rb_objspace::sorted.
Referenced by add_heap_slots(), and set_heaps_increment().
|
static |
Definition at line 481 of file gc.c.
References aligned_free(), aligned_malloc(), RVALUE::as, assert, heaps_header::base, heaps_header::bits, during_gc, heaps_header::end, RVALUE::free, rb_objspace::free_bitmap, rb_objspace::heap, HEAP_ALIGN, HEAP_BITMAP_LIMIT, HEAP_OBJ_LIMIT, HEAP_SIZE, heaps, heaps_used, hi, himem, if(), heaps_header::limit, link_free_heap_slot(), lo, lomem, malloc(), MEMMOVE, memset(), MEMZERO, heaps_slot::next, heaps_free_bitmap::next, NULL, p, PRIuVALUE, rb_bug(), rb_memerror(), rb_objspace::sorted, and heaps_header::start.
Referenced by add_heap_slots(), and heaps_increment().
|
static |
Definition at line 1968 of file gc.c.
References rb_objspace::do_heap_free, rb_objspace::free_min, rb_objspace::free_num, rb_objspace::free_slots, GET_VM, rb_objspace::heap, HEAP_OBJ_LIMIT, heaps, heaps_used, initial_free_min, NULL, rb_sweep_method_entry(), and rb_objspace::sweep_slots.
Referenced by gc_prepare_free_objects(), and gc_sweep().
Definition at line 1771 of file gc.c.
References RVALUE::as, RVALUE::basic, BUILTIN_TYPE, COUNT_TYPE, RBasic::flags, hash, rb_objspace::heap, heaps_used, i, ID2SYM, INT2NUM, heaps_header::limit, p, Qnil, rb_eTypeError, rb_hash_aset(), rb_hash_new(), rb_intern, rb_objspace, rb_raise(), rb_scan_args(), RB_TYPE_P, RHASH_EMPTY_P, RHASH_TBL, set_zero(), SIZET2NUM, rb_objspace::sorted, st_foreach(), heaps_header::start, T_ARRAY, T_BIGNUM, T_CLASS, T_COMPLEX, T_DATA, T_FALSE, T_FILE, T_FIXNUM, T_FLOAT, T_HASH, T_ICLASS, T_MASK, T_MATCH, T_MODULE, T_NIL, T_NODE, T_NONE, T_OBJECT, T_RATIONAL, T_REGEXP, T_STRING, T_STRUCT, T_SYMBOL, T_TRUE, T_UNDEF, T_ZOMBIE, and type.
Referenced by Init_GC().
Definition at line 1292 of file gc.c.
References block, define_final0(), obj, rb_block_proc(), rb_check_frozen, rb_eArgError, rb_intern, rb_obj_classname(), rb_raise(), rb_respond_to(), and rb_scan_args().
Referenced by Init_GC().
Definition at line 1310 of file gc.c.
References block, data, finalizer_table, FL_ABLE, FL_FINALIZE, INT2FIX, OBJ_FREEZE, rb_ary_new3(), rb_ary_push(), rb_eArgError, rb_obj_classname(), rb_objspace, rb_raise(), rb_safe_level, RBASIC, st_add_direct(), st_lookup(), and table.
Referenced by define_final(), and rb_define_final().
|
static |
Definition at line 1447 of file gc.c.
References ATOMIC_PTR_EXCHANGE, deferred_final_list, finalize_list(), and p.
Referenced by rb_gc(), rb_gc_finalize_deferred(), and rb_objspace_call_finalizer().
|
static |
Definition at line 1428 of file gc.c.
References add_slot_local_freelist(), RVALUE::as, FL_SINGLETON, FL_TEST, RVALUE::free, rb_objspace::free_num, heaps_slot::header, rb_objspace::heap, heaps_header::limit, RDATA, run_final(), tmp, and rb_objspace::total_freed_object_num.
Referenced by finalize_deferred(), and rb_objspace_call_finalizer().
Definition at line 1472 of file gc.c.
References ALLOC, key, force_finalize_list::next, force_finalize_list::obj, ST_CONTINUE, force_finalize_list::table, and val.
Referenced by rb_objspace_call_finalizer().
|
static |
Definition at line 807 of file gc.c.
References ST_CONTINUE, and xfree.
Referenced by rb_free_const_table().
|
static |
Definition at line 791 of file gc.c.
References rb_method_entry_struct::mark, rb_free_method_entry(), and ST_CONTINUE.
Referenced by rb_free_m_table().
|
static |
Definition at line 2191 of file gc.c.
References mark_stack::chunk, free, heaps_slot::next, stack_chunk::next, and NULL.
Referenced by rb_objspace_free().
|
static |
Definition at line 852 of file gc.c.
References aligned_free(), heaps_header::bits, rb_objspace::free_bitmap, rb_objspace::heap, heaps_freed, heaps_used, i, last, heaps_header::limit, heaps_free_bitmap::next, and rb_objspace::sorted.
Referenced by after_gc_sweep(), and rb_gc().
|
static |
Definition at line 3026 of file gc.c.
References during_gc, FALSE, gc_marks(), GC_NOTIFY, gc_prof_sweep_timer_start(), gc_prof_sweep_timer_stop(), gc_prof_timer_start(), gc_prof_timer_stop(), gc_sweep(), heaps, Qtrue, ready_to_gc(), rest_sweep(), and TRUE.
Referenced by garbage_collect_with_gvl(), gc_prepare_free_objects(), gc_with_gvl(), newobj(), rb_garbage_collect(), and rb_gc().
|
static |
Definition at line 3060 of file gc.c.
References dont_gc, EXIT_FAILURE, garbage_collect(), gc_with_gvl(), rb_thread_call_with_gvl(), ruby_native_thread_p, ruby_thread_has_gvl_p(), and TRUE.
Referenced by vm_malloc_prepare(), and vm_xrealloc().
|
static |
Definition at line 1870 of file gc.c.
References heaps_slot::bits, HEAP_BITMAP_LIMIT, and memset().
Referenced by slot_sweep().
Definition at line 3136 of file gc.c.
References rb_objspace::count, and UINT2NUM.
Referenced by Init_GC().
|
static |
Definition at line 2584 of file gc.c.
References rb_objspace::mark_func_data_struct::data, gc_mark_ptr(), LIKELY, rb_objspace::mark_func_data_struct::mark_func, rb_objspace::mark_func_data, rb_objspace::mark_stack, markable_object_p(), and push_mark_stack().
Referenced by gc_mark_children(), mark_const_entry_i(), mark_entry(), mark_key(), mark_keyvalue(), mark_locations_array(), mark_method_entry(), rb_gc_mark(), and rb_gc_mark_maybe().
|
static |
Definition at line 2606 of file gc.c.
References RNode::args, args, RVALUE::as, BUILTIN_TYPE, RNode::cnt, FL_EXIVAR, FL_TEST, gc_mark(), gc_mark_ptr(), if(), is_pointer_to_heap(), LIKELY, rb_objspace::mark_func_data, mark_locations_array(), markable_object_p(), nd_type, RVALUE::node, RNode::node, 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, RANY, rb_bug(), rb_mark_generic_ivar(), T_FIXNUM, T_NIL, T_NODE, RNode::u1, RNode::u2, RNode::u3, and RNode::value.
Referenced by gc_mark_stacked_objects(), and rb_objspace_reachable_objects_from().
|
static |
Definition at line 2333 of file gc.c.
References mark_locations_array(), and n.
Referenced by rb_gc_mark_locations().
|
static |
Definition at line 2557 of file gc.c.
References GET_HEAP_BITMAP, rb_objspace::heap, MARK_IN_BITMAP, MARKED_IN_BITMAP, and rb_objspace::marked_num.
Referenced by gc_mark(), gc_mark_children(), and wmap_mark_map().
|
static |
Definition at line 2900 of file gc.c.
References gc_mark_children(), mark_stack::index, rb_objspace::mark_stack, obj, pop_mark_stack(), and shrink_stack_chunk_cache().
Referenced by gc_marks().
|
static |
Definition at line 2913 of file gc.c.
References rb_objspace::count, finalizer_table, gc_mark_stacked_objects(), gc_prof_mark_timer_start(), gc_prof_mark_timer_stop(), GET_THREAD(), global_List, rb_objspace::heap, list, mark_current_machine_context(), rb_objspace::mark_func_data, mark_tbl(), rb_objspace::marked_num, gc_list::next, rb_gc_mark(), rb_gc_mark_encodings(), rb_gc_mark_global_tbl(), rb_gc_mark_maybe(), rb_gc_mark_parser(), rb_gc_mark_symbols(), rb_gc_mark_unlinked_live_method_entries(), rb_mark_end_proc(), rb_mark_generic_ivar_tbl(), rb_vm_mark(), rb_vm_struct::self, SET_STACK_END, th, gc_list::varptr, and rb_thread_struct::vm.
Referenced by garbage_collect(), and gc_prepare_free_objects().
|
static |
Definition at line 2040 of file gc.c.
References after_gc_sweep(), before_gc_sweep(), rb_objspace::dont_lazy_sweep, during_gc, rb_objspace::flags, rb_objspace::free_min, garbage_collect(), gc_marks(), gc_prof_set_malloc_info(), gc_prof_sweep_timer_start(), gc_prof_sweep_timer_stop(), gc_prof_timer_start(), gc_prof_timer_stop(), has_free_object, rb_objspace::heap, HEAP_OBJ_LIMIT, heaps_increment(), heaps_used, lazy_sweep(), rb_objspace::marked_num, Qfalse, Qtrue, ready_to_gc(), res, set_heaps_increment(), rb_objspace::sweep_slots, and TRUE.
Referenced by newobj().
|
inlinestatic |
Definition at line 3980 of file gc.c.
References RUBY_DTRACE_GC_MARK_BEGIN, and RUBY_DTRACE_GC_MARK_BEGIN_ENABLED.
Referenced by gc_marks().
|
inlinestatic |
Definition at line 3988 of file gc.c.
References RUBY_DTRACE_GC_MARK_END, and RUBY_DTRACE_GC_MARK_END_ENABLED.
Referenced by gc_marks().
|
inlinestatic |
Definition at line 4017 of file gc.c.
References HEAP_OBJ_LIMIT, gc_profile_record::heap_total_objects, gc_profile_record::heap_total_size, gc_profile_record::heap_use_size, heaps_used, and objspace_live_num().
Referenced by gc_prof_timer_stop().
|
inlinestatic |
Definition at line 4012 of file gc.c.
Referenced by after_gc_sweep(), and gc_prepare_free_objects().
|
inlinestatic |
Definition at line 3996 of file gc.c.
References RUBY_DTRACE_GC_SWEEP_BEGIN, and RUBY_DTRACE_GC_SWEEP_BEGIN_ENABLED.
Referenced by garbage_collect(), and gc_prepare_free_objects().
|
inlinestatic |
Definition at line 4004 of file gc.c.
References RUBY_DTRACE_GC_SWEEP_END, and RUBY_DTRACE_GC_SWEEP_END_ENABLED.
Referenced by garbage_collect(), and gc_prepare_free_objects().
|
inlinestatic |
Definition at line 3937 of file gc.c.
References count, rb_objspace::count, gc_profile_record::gc_invoke_time, GC_PROFILE_RECORD_DEFAULT_SIZE, gc_profile_record::gc_time, getrusage_time(), rb_objspace::invoke_time, malloc(), MEMZERO, rb_objspace::profile, rb_bug(), realloc(), rb_objspace::record, rb_objspace::run, and rb_objspace::size.
Referenced by garbage_collect(), and gc_prepare_free_objects().
|
inlinestatic |
Definition at line 3961 of file gc.c.
References count, rb_objspace::count, gc_prof_set_heap_info(), gc_profile_record::gc_time, getrusage_time(), gc_profile_record::is_marked, rb_objspace::profile, rb_objspace::record, and rb_objspace::run.
Referenced by garbage_collect(), and gc_prepare_free_objects().
Definition at line 4128 of file gc.c.
References rb_objspace::count, GC_PROFILE_RECORD_DEFAULT_SIZE, MEMZERO, rb_objspace::profile, Qnil, rb_memerror(), rb_objspace, realloc(), rb_objspace::record, and rb_objspace::size.
Referenced by Init_GC().
Definition at line 4376 of file gc.c.
References FALSE, rb_objspace::profile, Qnil, rb_objspace, and rb_objspace::run.
Referenced by Init_GC().
Definition at line 4231 of file gc.c.
References count, rb_objspace::count, gc_profile_record::gc_invoke_time, gc_profile_record::gc_time, gc_profile_record::heap_total_objects, gc_profile_record::heap_total_size, gc_profile_record::heap_use_size, i, index, gc_profile_record::is_marked, PRIuSIZE, rb_objspace::profile, r, rb_objspace, rb_sprintf(), rb_str_new_cstr(), rb_objspace::record, and rb_objspace::run.
Referenced by gc_profile_report(), and gc_profile_result().
Definition at line 4359 of file gc.c.
References rb_objspace::profile, Qnil, rb_objspace, rb_objspace::run, and TRUE.
Referenced by Init_GC().
Definition at line 4344 of file gc.c.
References rb_objspace::profile, Qfalse, Qtrue, rb_objspace, and rb_objspace::run.
Referenced by Init_GC().
Definition at line 4195 of file gc.c.
References rb_objspace::count, DBL2NUM, gc_profile_record::gc_invoke_time, gc_profile_record::gc_time, gc_profile_record::heap_total_objects, gc_profile_record::heap_total_size, gc_profile_record::heap_use_size, i, ID2SYM, gc_profile_record::is_marked, rb_objspace::profile, Qnil, rb_ary_new(), rb_ary_push(), rb_hash_aset(), rb_hash_new(), rb_intern, rb_objspace, rb_objspace::record, rb_objspace::run, and SIZET2NUM.
Referenced by Init_GC().
Definition at line 4299 of file gc.c.
References gc_profile_dump_on(), out, Qnil, rb_io_write(), rb_scan_args(), and rb_stdout.
Referenced by Init_GC().
Definition at line 4282 of file gc.c.
References gc_profile_dump_on(), rb_str_buf_append(), rb_str_buf_new(), and str.
Referenced by Init_GC().
Definition at line 4322 of file gc.c.
References rb_objspace::count, DBL2NUM, gc_profile_record::gc_time, i, rb_objspace::profile, rb_objspace, rb_objspace::record, rb_objspace::run, and time.
Referenced by Init_GC().
Definition at line 3169 of file gc.c.
References rb_objspace::count, rb_objspace::final_num, rb_objspace::free_num, hash, rb_objspace::heap, ID2SYM, rb_objspace::increment, rb_objspace::length, objspace_live_num(), Qnil, rb_eTypeError, rb_hash_aset(), rb_hash_new(), rb_intern_const, rb_objspace, rb_raise(), rb_scan_args(), RB_TYPE_P, rest_sweep(), SIZET2NUM, T_HASH, rb_objspace::total_allocated_object_num, rb_objspace::total_freed_object_num, and rb_objspace::used.
Referenced by Init_GC().
Definition at line 3222 of file gc.c.
References Qfalse, Qtrue, rb_objspace, and ruby_gc_stress.
Referenced by Init_GC().
Definition at line 3241 of file gc.c.
References flag, rb_objspace, rb_secure(), RTEST, and ruby_gc_stress.
Referenced by Init_GC().
|
static |
Definition at line 2093 of file gc.c.
References after_gc_sweep(), before_gc_sweep(), during_gc, rb_objspace::heap, heaps_slot::next, slot_sweep(), and rb_objspace::sweep_slots.
Referenced by garbage_collect().
Definition at line 3054 of file gc.c.
References garbage_collect(), and ptr.
Referenced by garbage_collect_with_gvl().
|
static |
Definition at line 3883 of file gc.c.
References e, getrusage(), memcpy(), q, t, timespec::tv_nsec, timeval::tv_sec, timespec::tv_sec, and timeval::tv_usec.
Referenced by gc_prof_timer_start(), gc_prof_timer_stop(), and init_heap().
|
static |
Definition at line 624 of file gc.c.
References assign_heap_slot(), FALSE, heaps_inc, and TRUE.
Referenced by after_gc_sweep(), gc_prepare_free_objects(), lazy_sweep(), and ready_to_gc().
Definition at line 1617 of file gc.c.
References FIXNUM_P, FLONUM_P, ID2SYM, is_id_value(), is_live_object(), NUM2PTR, obj_id_to_ref, ptr, Qfalse, Qnil, Qtrue, rb_eRangeError, rb_id2name(), rb_objspace, rb_raise(), and rb_secure().
Referenced by Init_GC().
Definition at line 4498 of file gc.c.
References count_objects(), define_final(), gc_count(), gc_profile_clear(), gc_profile_disable(), gc_profile_enable(), gc_profile_enable_get(), gc_profile_record_get(), gc_profile_report(), gc_profile_result(), gc_profile_total_time(), gc_stat(), gc_stress_get(), gc_stress_set(), id2ref(), nomem_error, OBJ_FREEZE, OBJ_TAINT, os_each_obj(), rb_cBasicObject, rb_cObject, rb_define_alloc_func(), rb_define_class_under(), rb_define_method(), rb_define_module(), rb_define_module_function(), rb_define_module_under(), rb_define_private_method(), rb_define_singleton_method(), rb_eNoMemError, rb_exc_new3(), rb_gc_disable(), rb_gc_enable(), rb_gc_start(), rb_mKernel, rb_obj_freeze(), rb_obj_id(), rb_str_new2, undefine_final(), wmap_allocate(), wmap_aref(), wmap_aset(), and wmap_finalize().
|
static |
Definition at line 577 of file gc.c.
References add_heap_slots(), finalizer_table, free, GET_THREAD(), getrusage_time(), HEAP_MIN_SLOTS, HEAP_OBJ_LIMIT, init_mark_stack(), rb_objspace::invoke_time, malloc(), rb_objspace::mark_stack, rb_objspace::profile, rb_sigaltstack_size(), st_init_numtable(), th, and tmp.
Referenced by Init_heap().
|
static |
Definition at line 2229 of file gc.c.
References add_stack_chunk_cache(), mark_stack::cache_size, i, mark_stack::limit, push_mark_stack_chunk(), stack_chunk_alloc(), STACK_CHUNK_SIZE, and mark_stack::unused_cache_size.
Referenced by init_heap().
Definition at line 3087 of file gc.c.
References ruby_init_stack().
|
static |
Definition at line 597 of file gc.c.
References add_heap_slots(), HEAP_OBJ_LIMIT, heaps_used, and initial_heap_min_slots.
Referenced by rb_gc_set_params().
Definition at line 1147 of file gc.c.
References RVALUE::as, RVALUE::basic, BUILTIN_TYPE, FL_SINGLETON, FL_TEST, RBasic::flags, RBasic::klass, p, T_CLASS, T_ICLASS, T_NODE, T_NONE, and T_ZOMBIE.
Referenced by os_obj_of_i(), and rb_objspace_internal_object_p().
|
inlinestatic |
Definition at line 1585 of file gc.c.
References FALSE, GET_HEAP_BITMAP, is_lazy_sweeping, is_swept_object(), MARKED_IN_BITMAP, and TRUE.
Referenced by is_live_object().
|
inlinestatic |
Definition at line 1563 of file gc.c.
References BUILTIN_TYPE, FALSE, is_pointer_to_heap(), T_FIXNUM, T_ICLASS, and TRUE.
Referenced by id2ref(), and wmap_aref().
|
inlinestatic |
Definition at line 1595 of file gc.c.
References BUILTIN_TYPE, FALSE, is_dead_object(), klass, RBASIC, and TRUE.
Referenced by id2ref(), and wmap_aref().
|
inlinestatic |
Definition at line 2129 of file gc.c.
References mark_stack::chunk, and NULL.
Referenced by pop_mark_stack().
|
inlinestatic |
Definition at line 763 of file gc.c.
References end, FALSE, rb_objspace::heap, heaps_used, hi, himem, lo, p, RANY, rb_objspace::sorted, heaps_header::start, and TRUE.
Referenced by gc_mark_children(), is_id_value(), mark_locations_array(), and rb_gc_mark_maybe().
|
inlinestatic |
Definition at line 1572 of file gc.c.
References heaps_header::end, FALSE, heaps_slot::header, rb_objspace::heap, heaps_slot::next, heaps_header::start, rb_objspace::sweep_slots, and TRUE.
Referenced by is_dead_object().
|
static |
Definition at line 2009 of file gc.c.
References during_gc, FALSE, has_free_object, rb_objspace::heap, heaps_increment(), heaps_slot::next, slot_sweep(), rb_objspace::sweep_slots, and TRUE.
Referenced by gc_prepare_free_objects(), and rest_sweep().
Definition at line 1861 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 |
Definition at line 467 of file gc.c.
References heaps_slot::free_next, rb_objspace::free_slots, and rb_objspace::heap.
Referenced by assign_heap_slot(), rb_gc_force_recycle(), and slot_sweep().
Definition at line 889 of file gc.c.
References RVALUE::as, RVALUE::basic, RBasic::flags, T_MASK, and T_ZOMBIE.
Referenced by make_io_deferred(), obj_free(), and rb_objspace_call_finalizer().
Definition at line 895 of file gc.c.
References RVALUE::as, RVALUE::data, RData::data, RData::dfree, RVALUE::file, RFile::fptr, make_deferred(), rb_io_fptr_finalize(), and void.
Referenced by obj_free(), and rb_objspace_call_finalizer().
|
static |
Definition at line 2472 of file gc.c.
References arg, rb_const_entry_struct::file, gc_mark(), mark_tbl_arg::objspace, ST_CONTINUE, and rb_const_entry_struct::value.
Referenced by mark_const_tbl().
|
static |
Definition at line 2481 of file gc.c.
References mark_const_entry_i(), mark_tbl_arg::objspace, and st_foreach().
|
static |
Definition at line 2502 of file gc.c.
References FLUSH_REGISTER_WINDOWS, GET_STACK_BOUNDS, mark_locations_array(), numberof, rb_gc_mark_locations, rb_jmp_buf, rb_setjmp, SET_STACK_END, STACK_END, STACK_START, and v.
Referenced by gc_marks().
Definition at line 2355 of file gc.c.
References arg, gc_mark(), mark_tbl_arg::objspace, and ST_CONTINUE.
Referenced by mark_tbl().
|
static |
Definition at line 2404 of file gc.c.
References mark_keyvalue(), mark_tbl_arg::objspace, and st_foreach().
Referenced by rb_mark_hash().
Definition at line 2372 of file gc.c.
References arg, gc_mark(), mark_tbl_arg::objspace, and ST_CONTINUE.
Referenced by mark_set().
Definition at line 2395 of file gc.c.
References arg, gc_mark(), mark_tbl_arg::objspace, and ST_CONTINUE.
Referenced by mark_hash().
|
static |
Definition at line 2319 of file gc.c.
References gc_mark(), is_pointer_to_heap(), v, VALGRIND_MAKE_MEM_DEFINED, and void.
Referenced by gc_mark_children(), gc_mark_locations(), and mark_current_machine_context().
|
static |
Definition at line 2463 of file gc.c.
References mark_method_entry_i(), mark_tbl_arg::objspace, and st_foreach().
|
static |
Definition at line 2419 of file gc.c.
References rb_method_definition_struct::attr, rb_method_definition_struct::body, rb_method_entry_struct::def, gc_mark(), rb_method_definition_struct::iseq, rb_method_entry_struct::klass, rb_method_attr_struct::location, rb_method_definition_struct::orig_me, rb_method_definition_struct::proc, rb_iseq_struct::self, rb_method_definition_struct::type, VM_METHOD_TYPE_ATTRSET, VM_METHOD_TYPE_BMETHOD, VM_METHOD_TYPE_ISEQ, VM_METHOD_TYPE_IVAR, and VM_METHOD_TYPE_REFINED.
Referenced by mark_method_entry_i(), and rb_mark_method_entry().
|
static |
Definition at line 2455 of file gc.c.
References arg, mark_method_entry(), mark_tbl_arg::objspace, and ST_CONTINUE.
Referenced by mark_m_tbl().
|
static |
Definition at line 2380 of file gc.c.
References mark_key(), mark_tbl_arg::objspace, and st_foreach().
Referenced by rb_mark_set().
|
static |
Definition at line 2363 of file gc.c.
References mark_entry(), st_table::num_entries, mark_tbl_arg::objspace, and st_foreach().
Referenced by gc_marks(), and rb_mark_tbl().
|
static |
Definition at line 2567 of file gc.c.
References RVALUE::as, RVALUE::basic, RBasic::flags, obj, RANY, and rb_special_const_p().
Referenced by gc_mark(), gc_mark_children(), rb_objspace_markable_object_p(), and rb_objspace_reachable_objects_from().
Definition at line 3366 of file gc.c.
References EXIT_FAILURE, negative_size_allocation_error_with_gvl(), rb_eNoMemError, rb_raise(), rb_thread_call_with_gvl(), ruby_native_thread_p, and ruby_thread_has_gvl_p().
Referenced by vm_malloc_prepare(), and vm_xrealloc().
Definition at line 3359 of file gc.c.
References rb_eNoMemError, and rb_raise().
Referenced by negative_size_allocation_error().
Definition at line 635 of file gc.c.
References dont_gc, during_gc, rb_objspace::free_slots, heaps_slot::freelist, garbage_collect(), gc_prepare_free_objects(), has_free_object, rb_objspace::heap, MEMZERO, NULL, obj, RANY, rb_bug(), rb_memerror(), rb_objspace, rb_sourcefile, rb_sourceline(), ruby_gc_stress, rb_objspace::total_allocated_object_num, UNLIKELY, and unlink_free_heap_slot().
Referenced by rb_newobj(), and rb_newobj_of().
|
static |
Definition at line 904 of file gc.c.
References BUILTIN_TYPE, rmatch::char_offset, DATA_PTR(), FL_EXIVAR, FL_TEST, FL_UNSET, flags, make_deferred(), make_io_deferred(), nd_type, NODE_ALLOCA, NODE_ARGS, NODE_SCOPE, onig_free(), onig_region_free(), PRIxVALUE, RANY, rb_ary_free(), rb_bug(), rb_clear_cache_by_class(), rb_free_const_table(), rb_free_generic_ivar(), rb_free_m_table(), rb_str_free(), RBASIC, RBIGNUM_DIGITS, RBIGNUM_EMBED_FLAG, RCLASS_CONST_TBL, RCLASS_IV_INDEX_TBL, RCLASS_IV_TBL, RCLASS_M_TBL, RDATA, rmatch::regs, ROBJECT_EMBED, RSTRUCT_EMBED_LEN_MASK, RTYPEDDATA_P, st_free_table(), T_ARRAY, T_BIGNUM, T_CLASS, T_COMPLEX, T_DATA, T_FALSE, T_FILE, T_FIXNUM, T_FLOAT, T_HASH, T_ICLASS, T_MATCH, T_MODULE, T_NIL, T_NODE, T_OBJECT, T_RATIONAL, T_REGEXP, T_STRING, T_STRUCT, T_TRUE, and xfree.
Referenced by slot_sweep().
Definition at line 1052 of file gc.c.
References args, RVALUE::as, RVALUE::basic, each_obj_args::callback, each_obj_args::data, RBasic::flags, for(), rb_objspace::heap, heaps_used, i, heaps_header::limit, Qnil, RB_GC_GUARD, rb_objspace, rb_objspace::sorted, heaps_header::start, and v.
Referenced by rb_objspace_each_objects().
|
static |
Definition at line 1876 of file gc.c.
References rb_objspace::total_allocated_object_num, and rb_objspace::total_freed_object_num.
Referenced by gc_prof_set_heap_info(), and gc_stat().
Definition at line 1242 of file gc.c.
References os_each_struct::of, os_obj_of(), rb_scan_args(), rb_secure(), and RETURN_ENUMERATOR.
Referenced by Init_GC().
Definition at line 1195 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().
Definition at line 1176 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 |
Definition at line 2214 of file gc.c.
References mark_stack::chunk, stack_chunk::data, FALSE, mark_stack::index, is_mark_stask_empty(), pop_mark_stack_chunk(), and TRUE.
Referenced by gc_mark_stacked_objects().
|
static |
Definition at line 2178 of file gc.c.
References add_stack_chunk_cache(), assert, mark_stack::chunk, mark_stack::index, mark_stack::limit, stack_chunk::next, and heaps_slot::prev.
Referenced by pop_mark_stack().
|
static |
Definition at line 2205 of file gc.c.
References mark_stack::chunk, stack_chunk::data, data, mark_stack::index, mark_stack::limit, and push_mark_stack_chunk().
Referenced by gc_mark().
|
static |
Definition at line 2157 of file gc.c.
References assert, mark_stack::cache, mark_stack::cache_size, mark_stack::chunk, mark_stack::index, mark_stack::limit, heaps_slot::next, stack_chunk::next, stack_chunk_alloc(), and mark_stack::unused_cache_size.
Referenced by init_mark_stack(), and push_mark_stack().
size_t rb_ary_memsize | ( | VALUE | ary | ) |
Definition at line 479 of file array.c.
References ARY_OWNS_HEAP_P, and RARRAY.
Referenced by memsize_of(), and wmap_memsize_map().
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 | ||
) |
Definition at line 722 of file gc.c.
References Check_Type, data, NEWOBJ, OBJSETUP, T_CLASS, T_DATA, and type.
Referenced by iow_newobj().
Definition at line 1338 of file gc.c.
References define_final0(), rb_check_frozen, rb_eArgError, rb_intern, rb_obj_classname(), rb_raise(), and rb_respond_to().
Referenced by wmap_aset().
Definition at line 3119 of file gc.c.
References during_gc, and rb_objspace.
Definition at line 814 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().
Definition at line 800 of file gc.c.
References free_method_entry_i(), st_foreach(), and st_free_table().
Referenced by obj_free(), and rb_mod_init_copy().
Definition at line 3079 of file gc.c.
References garbage_collect().
Definition at line 3110 of file gc.c.
References finalize_deferred(), finalizing, free_unused_heaps(), garbage_collect(), and rb_objspace.
Referenced by dir_initialize(), getDevice(), rb_fdopen(), rb_gc_start(), rb_pipe(), rb_sysopen(), rsock_s_accept(), rsock_socket(), and ruby_dup().
Definition at line 1484 of file gc.c.
References rb_objspace_call_finalizer().
Referenced by ruby_finalize_1().
Definition at line 1349 of file gc.c.
References data, finalizer_table, FL_FINALIZE, FL_SET, FL_TEST, rb_objspace, st_insert(), st_lookup(), and table.
Referenced by init_copy().
Definition at line 3285 of file gc.c.
References dont_gc, Qfalse, Qtrue, rb_objspace, rest_sweep(), and TRUE.
Referenced by Init_GC(), and tcl_protect_core().
Definition at line 3263 of file gc.c.
References dont_gc, FALSE, Qfalse, Qtrue, and rb_objspace.
Referenced by if(), Init_GC(), and tcl_protect_core().
Definition at line 1457 of file gc.c.
References ATOMIC_EXCHANGE, ATOMIC_SET, finalize_deferred(), finalizing, and rb_objspace.
Referenced by rb_threadptr_execute_interrupts().
Definition at line 2963 of file gc.c.
References add_slot_local_freelist(), heaps_slot::free_next, rb_objspace::free_num, GET_HEAP_BITMAP, rb_objspace::heap, link_free_heap_slot(), MARKED_IN_BITMAP, NULL, rb_objspace, and rb_objspace::total_freed_object_num.
Referenced by dispose_string(), fixup_nodes(), if(), literal_concat_gen(), parser_heredoc_restore(), parser_yylex(), rb_ary_decrement_share(), rb_parser_free(), RUBY_ALIAS_FUNCTION(), ruby_vm_destruct(), and switch().
Definition at line 2600 of file gc.c.
References gc_mark().
Referenced by _thread_call_proc_arg_mark(), addrinfo_mark(), argf_mark(), autoload_i_mark(), backtrace_mark(), bm_mark(), call_queue_mark(), cont_mark(), cparse_params_mark(), d_lite_gc_mark(), dir_mark(), dlcfunc_mark(), dlptr_mark(), enumerator_mark(), eval_queue_mark(), fiber_mark(), fiddle_ptr_mark(), gc_marks(), generator_mark(), givar_mark_i(), gzfile_mark(), invoke_queue_mark(), iow_mark(), location_mark(), location_mark_entry(), mark_dump_arg(), mark_exec_arg(), mark_marshal_compat_i(), parser_mark(), random_mark(), rb_mark_end_proc(), rb_thread_mark(), rb_vm_mark(), strio_mark(), strscan_mark(), thread_shield_mark(), time_mark(), tp_mark(), vm_mark_each_thread_func(), vm_trace_mark_event_hooks(), wmap_mark(), yielder_mark(), and zstream_mark().
Definition at line 2343 of file gc.c.
References gc_mark_locations().
void rb_gc_mark_machine_stack | ( | rb_thread_t * | th | ) |
Definition at line 2530 of file gc.c.
References GET_STACK_BOUNDS, rb_gc_mark_locations, and rb_objspace.
Referenced by rb_thread_mark().
Definition at line 2549 of file gc.c.
References gc_mark(), and is_pointer_to_heap().
Referenced by gc_marks(), JSON_mark(), mark_global_entry(), val_marker(), and var_marker().
Definition at line 2989 of file gc.c.
References ALLOC, global_List, gc_list::next, rb_objspace, tmp, and gc_list::varptr.
Referenced by Init_coverage(), Init_curses(), and rb_global_variable().
Definition at line 2982 of file gc.c.
References ary, GET_THREAD(), rb_vm_struct::mark_object_ary, rb_ary_push(), and rb_thread_struct::vm.
Referenced by date__strptime_internal(), date_zone_to_diff(), Init_Bignum(), Init_date_core(), Init_Encoding(), Init_IO(), Init_load(), Init_marshal(), Init_Random(), Init_VM(), Init_win32ole(), power_cache_get_power0(), pruby_init(), rb_define_class_id_under(), rb_define_module_id_under(), rb_w32_init_file(), regcomp(), rt_complete_frags(), ruby_process_options(), and sym_to_proc().
Definition at line 3297 of file gc.c.
References getenv(), initial_expand_heap(), initial_free_min, initial_heap_min_slots, initial_malloc_limit, NULL, rb_safe_level, RTEST, and ruby_verbose.
Definition at line 3001 of file gc.c.
References global_List, gc_list::next, rb_objspace, t, tmp, gc_list::varptr, and xfree.
Referenced by curses_finalize().
Definition at line 426 of file gc.c.
References rb_gc_register_address().
Referenced by Init_ossl_asn1(), Init_RandomSeed(), Init_Regexp(), Init_tcltklib(), and Init_tkutil().
Definition at line 2413 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 2449 of file gc.c.
References mark_method_entry().
Referenced by bm_mark(), rb_gc_mark_unlinked_live_method_entries(), and rb_thread_mark().
Definition at line 2543 of file gc.c.
References mark_tbl().
Referenced by autoload_mark(), mark_load_arg(), rb_gc_mark_symbols(), rb_mark_generic_ivar(), rb_thread_mark(), and rb_vm_mark().
Definition at line 3408 of file gc.c.
References rb_thread_struct::errinfo, EXIT_FAILURE, GET_THREAD(), JUMP_TAG, nomem_error, RAISED_NOMEMORY, rb_exc_raise(), rb_safe_level, rb_thread_raised_clear, rb_thread_raised_p, rb_thread_raised_set, TAG_RAISE, and th.
Referenced by allocate_sorted_heaps(), assign_heap_slot(), gc_profile_clear(), newobj(), nsdr(), readline_attempted_completion_function(), ruby_memerror(), ruby_memerror_body(), and stack_chunk_alloc().
Definition at line 677 of file gc.c.
References newobj(), and T_NONE.
Referenced by rb_node_newnode().
Definition at line 694 of file gc.c.
References RNode::flags, n, nd_set_type, rb_newobj(), T_NODE, RNode::u1, RNode::u2, RNode::u3, and RNode::value.
Definition at line 1690 of file gc.c.
References FIXNUM_FLAG, FLONUM_P, LONG2NUM, nonspecial_obj_id, SIGNED_VALUE, SPECIAL_CONST_P, SYM2ID, and SYMBOL_P.
Referenced by exec_recursive(), Init_GC(), iow_internal_object_id(), rb_exec_recursive_paired(), rb_exec_recursive_paired_outer(), and rb_obj_hash().
rb_objspace_t* rb_objspace_alloc | ( | void | ) |
Definition at line 374 of file gc.c.
References initial_malloc_limit, malloc(), malloc_limit, memset(), ruby_gc_stress, and ruby_initial_gc_stress.
Referenced by Init_BareVM().
|
static |
Definition at line 1490 of file gc.c.
References assert, ATOMIC_EXCHANGE, ATOMIC_SET, BUILTIN_TYPE, DATA_PTR(), deferred_final_list, during_gc, finalize_deferred(), finalize_list(), finalizer_table, finalizing, force_chain_object(), rb_objspace::heap, heaps_used, i, heaps_header::limit, list, make_deferred(), make_io_deferred(), force_finalize_list::next, force_finalize_list::obj, obj, p, RANY, rb_obj_is_fiber(), rb_obj_is_mutex(), rb_obj_is_thread(), RDATA, rest_sweep(), RTYPEDDATA_P, run_finalizer(), rb_objspace::sorted, st_delete(), st_foreach(), st_free_table(), heaps_header::start, T_DATA, T_FILE, force_finalize_list::table, and xfree.
Referenced by rb_gc_call_finalizer_at_exit().
size_t rb_objspace_data_type_memsize | ( | VALUE | obj | ) |
Definition at line 738 of file gc.c.
References RTYPEDDATA_DATA, RTYPEDDATA_P, and RTYPEDDATA_TYPE.
Referenced by memsize_of().
Definition at line 749 of file gc.c.
References RTYPEDDATA_P, and RTYPEDDATA_TYPE.
Referenced by cto_i().
void rb_objspace_each_objects | ( | each_obj_callback * | callback, |
void * | data | ||
) |
Definition at line 1128 of file gc.c.
References callback(), each_obj_args::callback, each_obj_args::data, data, lazy_sweep_enable(), objspace_each_objects(), Qnil, rb_ensure(), rb_objspace, rest_sweep(), and TRUE.
Referenced by count_nodes(), count_objects_size(), count_tdata_objects(), memsize_of_all_m(), and os_obj_of().
void rb_objspace_free | ( | rb_objspace_t * | objspace | ) |
Definition at line 389 of file gc.c.
References aligned_free(), heaps_header::bits, free, rb_objspace::free_bitmap, free_stack_chunks(), global_List, rb_objspace::heap, heaps, heaps_used, i, list, rb_objspace::mark_stack, heaps_free_bitmap::next, gc_list::next, rb_objspace::profile, rb_objspace::record, rest_sweep(), rb_objspace::sorted, and xfree.
Referenced by ruby_vm_destruct().
Definition at line 1170 of file gc.c.
References internal_object_p().
Referenced by reachable_object_from_i().
Definition at line 2578 of file gc.c.
References markable_object_p().
Referenced by reachable_object_from_i(), and reachable_objects_from().
Definition at line 3338 of file gc.c.
References data, func, gc_mark_children(), rb_objspace::mark_func_data, markable_object_p(), and rb_objspace.
Referenced by reachable_objects_from().
Definition at line 1272 of file gc.c.
References data, finalizer_table, FL_FINALIZE, FL_UNSET, obj, rb_check_frozen, rb_objspace, and st_delete().
Referenced by undefine_final().
|
static |
Definition at line 1953 of file gc.c.
References dont_gc, during_gc, FALSE, has_free_object, heaps_increment(), set_heaps_increment(), and TRUE.
Referenced by garbage_collect(), and gc_prepare_free_objects().
|
static |
Definition at line 2027 of file gc.c.
References after_gc_sweep(), rb_objspace::heap, lazy_sweep(), and rb_objspace::sweep_slots.
Referenced by garbage_collect(), gc_stat(), rb_gc_disable(), rb_objspace_call_finalizer(), rb_objspace_each_objects(), and rb_objspace_free().
Definition at line 2269 of file gc.c.
References end, and SET_MACHINE_STACK_END.
Definition at line 3390 of file gc.c.
References EXIT_FAILURE, rb_memerror(), rb_thread_call_with_gvl(), ruby_memerror_body(), ruby_native_thread_p, and ruby_thread_has_gvl_p().
Referenced by vm_xrealloc().
void* ruby_mimmalloc | ( | size_t | size | ) |
void* ruby_xcalloc | ( | size_t | n, |
size_t | size | ||
) |
Definition at line 3631 of file gc.c.
References vm_xcalloc().
Referenced by rb_iseq_defined_string().
Definition at line 3653 of file gc.c.
References vm_xfree().
Referenced by backtrace_free(), binding_free(), compile_data_free(), cont_free(), cState_array_nl_set(), cState_indent_set(), cState_object_nl_set(), cState_space_before_set(), cState_space_set(), env_free(), fbuffer_free(), free_sdbm(), Init_dl(), Init_fiddle(), inst_free(), iseq_free(), JSON_free(), location_free(), mutex_free(), ossl_cipher_free(), ossl_hmac_free(), proc_free(), rb_dl_free(), rb_fiddle_free(), rb_thread_recycle_stack_release(), ruby_vm_destruct(), State_free(), strscan_free(), and thread_free().
void* ruby_xmalloc | ( | size_t | size | ) |
Definition at line 3596 of file gc.c.
References vm_xmalloc().
Referenced by bt_init(), rb_dl_malloc(), rb_dlptr_malloc(), rb_fiddle_malloc(), and rb_fiddle_ptr_malloc().
void* ruby_xmalloc2 | ( | size_t | n, |
size_t | size | ||
) |
Definition at line 3612 of file gc.c.
References vm_xmalloc(), and xmalloc2_size().
Definition at line 3637 of file gc.c.
References vm_xrealloc().
Referenced by iseq_set_sequence(), rb_dl_realloc(), rb_fiddle_realloc(), ruby_xrealloc2(), and zstream_expand_buffer_without_gvl().
Definition at line 3643 of file gc.c.
References n, rb_eArgError, rb_raise(), and ruby_xrealloc().
|
static |
Definition at line 1402 of file gc.c.
References DATA_PTR(), rb_objspace::final_num, finalizer_table, rb_objspace::heap, key, RBASIC, RDATA, RTYPEDDATA_P, RTYPEDDATA_TYPE, run_finalizer(), st_delete(), and table.
Referenced by finalize_list().
|
static |
Definition at line 1372 of file gc.c.
References args, rb_thread_struct::errinfo, FIX2INT, GET_THREAD(), i, nonspecial_obj_id, Qnil, RARRAY_LEN, RARRAY_PTR(), rb_ary_new3(), rb_errinfo, rb_obj_freeze(), rb_protect(), rb_safe_level, rb_set_errinfo(), run_single_final(), and status.
Referenced by rb_objspace_call_finalizer(), and run_final().
Definition at line 1364 of file gc.c.
References args, Qnil, and rb_eval_cmd().
Referenced by run_finalizer().
|
static |
Definition at line 607 of file gc.c.
References allocate_sorted_heaps(), heaps_inc, heaps_length, and heaps_used.
Referenced by after_gc_sweep(), gc_prepare_free_objects(), and ready_to_gc().
Definition at line 1737 of file gc.c.
References hash, INT2FIX, rb_hash_aset(), and ST_CONTINUE.
Referenced by count_objects().
|
static |
Definition at line 2143 of file gc.c.
References mark_stack::cache, mark_stack::cache_size, free, stack_chunk::next, and mark_stack::unused_cache_size.
Referenced by gc_mark_stacked_objects().
|
static |
Definition at line 1882 of file gc.c.
References RVALUE::as, assert, RVALUE::basic, heaps_slot::bits, BUILTIN_TYPE, deferred_final_list, rb_objspace::do_heap_free, rb_objspace::final_num, finalizing, FL_FINALIZE, FL_SINGLETON, FL_TEST, RBasic::flags, RVALUE::free, heaps_slot::free_next, rb_objspace::free_num, heaps_slot::freelist, gc_clear_slot_bits(), GET_HEAP_BITMAP, GET_THREAD(), heaps_slot::header, rb_objspace::heap, heaps_header::limit, link_free_heap_slot(), MARKED_IN_BITMAP, NULL, obj_free(), p, RDATA, RUBY_VM_SET_FINALIZER_INTERRUPT, heaps_header::start, T_ZOMBIE, th, rb_objspace::total_freed_object_num, unlink_heap_slot(), VALGRIND_MAKE_MEM_UNDEFINED, and void.
Referenced by gc_sweep(), and lazy_sweep().
Definition at line 2290 of file gc.c.
References GET_THREAD(), ret, SET_STACK_END, STACK_LENGTH, STACK_LEVEL_MAX, and th.
Referenced by ruby_stack_check().
|
static |
Definition at line 2117 of file gc.c.
References malloc(), rb_memerror(), and res.
Referenced by init_mark_stack(), and push_mark_stack_chunk().
|
static |
Definition at line 474 of file gc.c.
References heaps_slot::free_next, rb_objspace::free_slots, rb_objspace::heap, and NULL.
Referenced by newobj().
|
static |
Definition at line 837 of file gc.c.
References rb_objspace::heap, heaps, heaps_slot::next, NULL, heaps_slot::prev, and rb_objspace::sweep_slots.
Referenced by slot_sweep().
|
inlinestatic |
Definition at line 3495 of file gc.c.
References ATOMIC_SIZE_ADD, ATOMIC_SIZE_INC, malloc_increase, rb_objspace::malloc_params, and size.
Referenced by vm_xcalloc(), and vm_xmalloc().
|
inlinestatic |
Definition at line 3475 of file gc.c.
References garbage_collect_with_gvl(), malloc_increase, malloc_limit, negative_size_allocation_error(), ruby_gc_stress, and size.
Referenced by vm_xcalloc(), and vm_xmalloc().
|
static |
Definition at line 3618 of file gc.c.
References calloc, size, TRY_WITH_GC, vm_malloc_fixup(), vm_malloc_prepare(), and xmalloc2_size().
Referenced by ruby_xcalloc().
|
static |
Definition at line 3580 of file gc.c.
References ATOMIC_SIZE_DEC, ATOMIC_SIZE_SUB, free, rb_objspace::malloc_params, and size.
Referenced by ruby_xfree(), and vm_xrealloc().
|
static |
Definition at line 3518 of file gc.c.
References malloc(), TRY_WITH_GC, vm_malloc_fixup(), and vm_malloc_prepare().
Referenced by ruby_xmalloc(), ruby_xmalloc2(), and vm_xrealloc().
|
static |
Definition at line 3528 of file gc.c.
References ATOMIC_SIZE_ADD, garbage_collect_with_gvl(), malloc_increase, rb_objspace::malloc_params, negative_size_allocation_error(), realloc(), ruby_gc_stress, ruby_memerror(), size, vm_xfree(), and vm_xmalloc().
Referenced by ruby_xrealloc().
Definition at line 3783 of file gc.c.
References weakmap::final, ID2SYM, obj, weakmap::obj2wmap, rb_intern, rb_obj_method(), st_init_numtable(), TypedData_Make_Struct, and weakmap::wmap2obj.
Referenced by Init_GC().
Definition at line 3859 of file gc.c.
References data, is_id_value(), is_live_object(), obj, Qnil, rb_objspace, st_lookup(), TypedData_Get_Struct, and weakmap::wmap2obj.
Referenced by Init_GC().
Definition at line 3836 of file gc.c.
References data, weakmap::final, nonspecial_obj_id, weakmap::obj2wmap, rb_ary_push(), rb_ary_tmp_new(), rb_define_final(), st_insert(), st_lookup(), TypedData_Get_Struct, and weakmap::wmap2obj.
Referenced by Init_GC().
|
static |
Definition at line 3794 of file gc.c.
References ary, RARRAY_LEN, rb_ary_delete_same(), ST_CONTINUE, ST_DELETE, ST_STOP, and value.
Referenced by wmap_finalize().
Definition at line 3805 of file gc.c.
References data, i, NULL, obj, weakmap::obj2wmap, obj_id_to_ref, RARRAY_LEN, RARRAY_PTR(), st_delete(), st_update(), TypedData_Get_Struct, weakmap::wmap2obj, and wmap_final_func().
Referenced by Init_GC().
Definition at line 3744 of file gc.c.
References weakmap::obj2wmap, ptr, st_foreach(), st_free_table(), weakmap::wmap2obj, and wmap_free_map().
Definition at line 3737 of file gc.c.
References rb_ary_resize(), and ST_CONTINUE.
Referenced by wmap_free().
Definition at line 3729 of file gc.c.
References weakmap::final, weakmap::obj2wmap, ptr, rb_gc_mark(), st_foreach(), and wmap_mark_map().
Definition at line 3722 of file gc.c.
References gc_mark_ptr(), and ST_CONTINUE.
Referenced by wmap_mark().
Definition at line 3761 of file gc.c.
References weakmap::obj2wmap, ptr, size, st_foreach(), st_memsize(), weakmap::wmap2obj, and wmap_memsize_map().
Definition at line 3754 of file gc.c.
References rb_ary_memsize(), ST_CONTINUE, and val.
Referenced by wmap_memsize().
|
inlinestatic |
Definition at line 3602 of file gc.c.
References len, n, rb_eArgError, and rb_raise().
Referenced by ruby_xmalloc2(), and vm_xcalloc().
|
static |
int* ruby_initial_gc_stress_ptr = &ruby_initial_gc_stress |
Definition at line 267 of file gc.c.
Referenced by set_debug_option().
|
static |