Ruby
1.9.3p448(2013-06-27revision41675)
|
#include "ruby/ruby.h"
#include "ruby/st.h"
#include "ruby/re.h"
#include "ruby/io.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 <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 | sorted_heaps_slot |
struct | gc_list |
struct | stack_chunk |
struct | mark_stack |
struct | rb_objspace |
struct | mark_tbl_arg |
struct | each_obj_args |
struct | os_each_struct |
struct | force_finalize_list |
Macros | |
#define | VALGRIND_MAKE_MEM_DEFINED(p, n) /* empty */ |
#define | VALGRIND_MAKE_MEM_UNDEFINED(p, n) /* empty */ |
#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 | nonspecial_obj_id(obj) (VALUE)((SIGNED_VALUE)(obj)|FIXNUM_FLAG) |
#define | obj_id_to_ref(objid) ((objid) ^ FIXNUM_FLAG) /* unset FIXNUM_FLAG */ |
#define | GC_PROFILE_MORE_DETAIL 0 |
#define | GC_PROF_TIMER_START |
#define | GC_PROF_TIMER_STOP(marked) |
#define | INIT_GC_PROF_PARAMS |
#define | GC_PROF_MARK_TIMER_START |
#define | GC_PROF_MARK_TIMER_STOP |
#define | GC_PROF_SWEEP_TIMER_START |
#define | GC_PROF_SWEEP_TIMER_STOP |
#define | GC_PROF_SET_MALLOC_INFO |
#define | GC_PROF_SET_HEAP_INFO(record) |
#define | GC_PROF_INC_LIVE_NUM |
#define | GC_PROF_DEC_LIVE_NUM |
#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 | freelist objspace->heap.freelist |
#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 | 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 | HEAP_SIZE 0x4000 |
#define | HEAP_OBJ_LIMIT (unsigned int)(HEAP_SIZE / sizeof(struct RVALUE)) |
#define | TRY_WITH_GC(alloc) |
#define | RANY(o) ((RVALUE*)(o)) |
#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 | MARK_STACK_EMPTY (mark_stack_ptr == mark_stack) |
#define | rb_gc_mark_locations(start, end) gc_mark_locations(objspace, (start), (end)) |
#define | STR_ASSOC FL_USER3 /* copied from string.c */ |
#define | GC_NOTIFY 0 |
#define | GET_STACK_BOUNDS(start, end, appendix) |
#define | numberof(array) (int)(sizeof(array) / sizeof((array)[0])) |
#define | NUM2PTR(x) NUM2ULONG(x) |
#define | COUNT_TYPE(t) case (t): type = ID2SYM(rb_intern(#t)); break; |
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 *) |
Variables | |
ruby_gc_params_t | initial_params |
int | ruby_gc_debug_indent = 0 |
int * | ruby_initial_gc_stress_ptr = &ruby_initial_gc_stress |
st_table * | rb_class_tbl |
int | ruby_disable_gc_stress = 0 |
VALUE | rb_mGC |
int | ruby_stack_grow_direction |
#define deferred_final_list objspace->final.deferred |
Definition at line 419 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 416 of file gc.c.
Referenced by garbage_collect_with_gvl(), rb_gc_disable(), rb_gc_enable(), rb_newobj(), and ready_to_gc().
#define during_gc objspace->flags.during_gc |
Definition at line 417 of file gc.c.
Referenced by allocate_sorted_heaps(), assign_heap_slot(), garbage_collect(), gc_lazy_sweep(), gc_sweep(), lazy_sweep(), rb_during_gc(), rb_newobj(), rb_objspace_call_finalizer(), and ready_to_gc().
#define finalizer_table objspace->final.table |
Definition at line 418 of file gc.c.
Referenced by define_final(), gc_marks(), init_heap(), rb_gc_copy_finalizer(), rb_objspace_call_finalizer(), run_final(), and undefine_final().
#define freelist objspace->heap.freelist |
Definition at line 411 of file gc.c.
Referenced by add_freelist(), assign_heap_slot(), before_gc_sweep(), gc_lazy_sweep(), lazy_sweep(), rb_newobj(), ready_to_gc(), and slot_sweep().
#define GC_NOTIFY 0 |
Definition at line 2498 of file gc.c.
Referenced by garbage_collect().
#define GC_PROF_DEC_LIVE_NUM |
Definition at line 272 of file gc.c.
Referenced by finalize_list(), and rb_gc_force_recycle().
#define GC_PROF_INC_LIVE_NUM |
Definition at line 271 of file gc.c.
Referenced by rb_newobj().
#define GC_PROF_MARK_TIMER_START |
Definition at line 259 of file gc.c.
Referenced by gc_marks().
#define GC_PROF_MARK_TIMER_STOP |
Definition at line 260 of file gc.c.
Referenced by gc_marks().
#define GC_PROF_SET_HEAP_INFO | ( | record | ) |
#define GC_PROF_SET_MALLOC_INFO |
Definition at line 263 of file gc.c.
Referenced by after_gc_sweep(), and gc_lazy_sweep().
#define GC_PROF_SWEEP_TIMER_START |
Definition at line 261 of file gc.c.
Referenced by garbage_collect(), and gc_lazy_sweep().
#define GC_PROF_SWEEP_TIMER_STOP |
Definition at line 262 of file gc.c.
Referenced by garbage_collect(), and gc_lazy_sweep().
#define GC_PROF_TIMER_START |
Definition at line 174 of file gc.c.
Referenced by garbage_collect(), and gc_lazy_sweep().
#define GC_PROF_TIMER_STOP | ( | marked | ) |
Definition at line 193 of file gc.c.
Referenced by garbage_collect(), and gc_lazy_sweep().
#define GET_STACK_BOUNDS | ( | start, | |
end, | |||
appendix | |||
) |
Definition at line 2505 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 420 of file gc.c.
Referenced by gc_marks(), rb_gc_register_address(), rb_gc_unregister_address(), and rb_objspace_free().
#define HEAP_MIN_SLOTS 10000 |
Definition at line 82 of file gc.c.
Referenced by init_heap().
Definition at line 537 of file gc.c.
Referenced by after_gc_sweep(), assign_heap_slot(), before_gc_sweep(), gc_lazy_sweep(), init_heap(), and initial_expand_heap().
#define HEAP_SIZE 0x4000 |
Definition at line 529 of file gc.c.
Referenced by assign_heap_slot().
#define heaps objspace->heap.ptr |
Definition at line 408 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 415 of file gc.c.
Referenced by free_unused_heaps().
#define heaps_inc objspace->heap.increment |
Definition at line 414 of file gc.c.
Referenced by add_heap_slots(), heaps_increment(), and set_heaps_increment().
#define heaps_length objspace->heap.length |
Definition at line 409 of file gc.c.
Referenced by add_heap_slots(), allocate_sorted_heaps(), and set_heaps_increment().
#define heaps_used objspace->heap.used |
Definition at line 410 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_lazy_sweep(), 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 413 of file gc.c.
Referenced by assign_heap_slot(), and is_pointer_to_heap().
#define INIT_GC_PROF_PARAMS |
Definition at line 257 of file gc.c.
Referenced by garbage_collect(), and gc_lazy_sweep().
#define initial_free_min initial_params.initial_free_min |
Definition at line 424 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 423 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 422 of file gc.c.
Referenced by after_gc_sweep(), rb_gc_set_params(), and rb_objspace_alloc().
#define lomem objspace->heap.range[0] |
Definition at line 412 of file gc.c.
Referenced by assign_heap_slot().
#define malloc_increase objspace->malloc_params.increase |
Definition at line 407 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 406 of file gc.c.
Referenced by after_gc_sweep(), rb_objspace_alloc(), and vm_malloc_prepare().
#define MARK_STACK_EMPTY (mark_stack_ptr == mark_stack) |
#define nomem_error GET_VM()->special_exceptions[ruby_error_nomemory] |
Definition at line 101 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 104 of file gc.c.
Referenced by rb_obj_id().
#define NUM2PTR | ( | x | ) | NUM2ULONG(x) |
Definition at line 2510 of file gc.c.
Referenced by mark_current_machine_context().
#define obj_id_to_ref | ( | objid | ) | ((objid) ^ FIXNUM_FLAG) /* unset FIXNUM_FLAG */ |
#define RANY | ( | o | ) | ((RVALUE*)(o)) |
Definition at line 1185 of file gc.c.
Referenced by gc_mark(), gc_mark_children(), is_pointer_to_heap(), obj_free(), rb_gc_force_recycle(), rb_newobj(), and rb_objspace_call_finalizer().
#define rb_gc_mark_locations | ( | start, | |
end | |||
) | gc_mark_locations(objspace, (start), (end)) |
Definition at line 1569 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 56 of file gc.c.
Referenced by mark_current_machine_context().
#define rb_objspace (*GET_VM()->objspace) |
Definition at line 399 of file gc.c.
Referenced by count_objects(), define_final(), gc_profile_clear(), gc_profile_disable(), gc_profile_enable(), gc_profile_enable_get(), gc_profile_record_get(), gc_profile_result(), gc_profile_total_time(), gc_stat(), gc_stress_get(), gc_stress_set(), id2ref(), lazy_sweep_enable(), objspace_each_objects(), rb_during_gc(), rb_gc(), rb_gc_copy_finalizer(), rb_gc_disable(), rb_gc_enable(), rb_gc_force_recycle(), rb_gc_mark_machine_stack(), rb_gc_register_address(), rb_gc_unregister_address(), rb_newobj(), rb_objspace_each_objects(), and undefine_final().
Definition at line 55 of file gc.c.
Referenced by mark_current_machine_context().
#define ruby_gc_stress objspace->gc_stress |
Definition at line 421 of file gc.c.
Referenced by gc_stress_get(), gc_stress_set(), rb_newobj(), rb_objspace_alloc(), vm_malloc_prepare(), and vm_xrealloc().
#define ruby_initial_gc_stress initial_params.gc_stress |
Definition at line 400 of file gc.c.
Referenced by rb_objspace_alloc().
#define SET_STACK_END SET_MACHINE_STACK_END(&th->machine_stack_end) |
Definition at line 1295 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 333 of file gc.c.
Referenced by init_mark_stack().
#define STACK_END (th->machine_stack_end) |
Definition at line 1299 of file gc.c.
Referenced by mark_current_machine_context(), and ruby_stack_length().
#define STACK_LENGTH |
Definition at line 1300 of file gc.c.
Referenced by stack_check().
#define STACK_START (th->machine_stack_start) |
Definition at line 1298 of file gc.c.
Referenced by mark_current_machine_context(), and ruby_stack_length().
#define STACKFRAME_FOR_CALL_CFUNC 512 |
Definition at line 1481 of file gc.c.
Referenced by ruby_stack_check().
#define STR_ASSOC FL_USER3 /* copied from string.c */ |
Referenced by gc_mark_children().
#define TRY_WITH_GC | ( | alloc | ) |
Definition at line 782 of file gc.c.
Referenced by vm_xcalloc(), and vm_xmalloc().
#define VALGRIND_MAKE_MEM_DEFINED | ( | p, | |
n | |||
) | /* empty */ |
Definition at line 51 of file gc.c.
Referenced by mark_locations_array().
#define VALGRIND_MAKE_MEM_UNDEFINED | ( | p, | |
n | |||
) | /* empty */ |
Definition at line 52 of file gc.c.
Referenced by add_freelist().
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 |
|
inlinestatic |
Definition at line 2042 of file gc.c.
References RVALUE::as, RVALUE::free, freelist, p, and VALGRIND_MAKE_MEM_UNDEFINED.
Referenced by finalize_list(), rb_gc_force_recycle(), and slot_sweep().
|
static |
Definition at line 1108 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 1348 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 2221 of file gc.c.
References 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, rb_objspace::live_num, malloc_increase, malloc_limit, and set_heaps_increment().
Referenced by gc_lazy_sweep(), gc_sweep(), and rest_sweep().
void* alloca | ( | ) |
|
static |
Definition at line 1012 of file gc.c.
References during_gc, rb_objspace::heap, heaps_length, heaps_used, malloc(), p, rb_memerror(), realloc(), size, and rb_objspace::sorted.
Referenced by add_heap_slots(), and set_heaps_increment().
|
static |
Definition at line 1035 of file gc.c.
References RVALUE::as, during_gc, sorted_heaps_slot::end, RVALUE::free, rb_objspace::free_num, freelist, rb_objspace::heap, HEAP_OBJ_LIMIT, HEAP_SIZE, heaps, heaps_used, hi, himem, lo, lomem, malloc(), heaps_slot::membase, MEMMOVE, MEMZERO, heaps_slot::next, p, PRIuVALUE, rb_bug(), rb_memerror(), heaps_slot::slot, sorted_heaps_slot::slot, rb_objspace::sorted, sorted_heaps_slot::start, and xfree().
Referenced by add_heap_slots(), and heaps_increment().
|
static |
Definition at line 2202 of file gc.c.
References rb_objspace::do_heap_free, rb_objspace::free_min, rb_objspace::free_num, freelist, GET_VM, rb_objspace::heap, HEAP_OBJ_LIMIT, heaps, heaps_used, initial_free_min, rb_sweep_method_entry(), and rb_objspace::sweep_slots.
Referenced by gc_lazy_sweep(), and gc_sweep().
Definition at line 3310 of file gc.c.
References RVALUE::as, RVALUE::basic, BUILTIN_TYPE, COUNT_TYPE, sorted_heaps_slot::end, RBasic::flags, hash(), rb_objspace::heap, heaps_used, i, ID2SYM, INT2NUM(), heaps_slot::limit, p, Qnil, rb_eTypeError, rb_hash_aset(), rb_hash_new(), rb_intern, rb_objspace, rb_raise(), rb_scan_args(), RHASH_EMPTY_P, RHASH_TBL, set_zero(), SIZET2NUM, sorted_heaps_slot::slot, rb_objspace::sorted, st_foreach, sorted_heaps_slot::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, type, and TYPE.
Referenced by Init_GC().
Definition at line 2929 of file gc.c.
References finalizer_table, FL_ABLE, FL_FINALIZE, INT2FIX, OBJ_FREEZE, rb_ary_new3(), rb_ary_push(), rb_block_proc(), rb_check_frozen, rb_eArgError, rb_intern, rb_obj_classname(), rb_objspace, rb_raise(), rb_respond_to(), rb_safe_level, rb_scan_args(), RBASIC, st_add_direct, and st_lookup.
Referenced by Init_GC().
|
static |
Definition at line 3043 of file gc.c.
References deferred_final_list, finalize_list(), and p.
Referenced by rb_gc(), rb_gc_finalize_deferred(), and rb_objspace_call_finalizer().
|
static |
Definition at line 2051 of file gc.c.
References add_freelist(), RVALUE::as, FL_SINGLETON, FL_TEST, RVALUE::free, GC_PROF_DEC_LIVE_NUM, rb_objspace::heap, heaps_slot::limit, RDATA, run_final(), heaps_slot::slot, and rb_objspace::sweep_slots.
Referenced by finalize_deferred(), and rb_objspace_call_finalizer().
Definition at line 3066 of file gc.c.
References ALLOC, key, force_finalize_list::next, force_finalize_list::obj, ST_CONTINUE, and force_finalize_list::table.
Referenced by rb_objspace_call_finalizer().
|
static |
Definition at line 1719 of file gc.c.
References ST_CONTINUE, and xfree().
Referenced by rb_free_const_table().
|
static |
Definition at line 1686 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 1402 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 2090 of file gc.c.
References free(), rb_objspace::heap, heaps_freed, heaps_used, i, last, heaps_slot::limit, heaps_slot::membase, sorted_heaps_slot::slot, and rb_objspace::sorted.
Referenced by after_gc_sweep(), and rb_gc().
|
static |
Definition at line 2584 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, INIT_GC_PROF_PARAMS, Qtrue, ready_to_gc(), rest_sweep(), and TRUE.
Referenced by garbage_collect_with_gvl(), gc_lazy_sweep(), gc_with_gvl(), rb_garbage_collect(), rb_gc(), and rb_newobj().
|
static |
Definition at line 727 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().
Definition at line 3402 of file gc.c.
References count, and UINT2NUM().
Referenced by gc_profile_result(), and Init_GC().
|
static |
Definition at line 2271 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, freelist, 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, rb_objspace::heap, HEAP_OBJ_LIMIT, heaps_increment(), heaps_used, INIT_GC_PROF_PARAMS, lazy_sweep(), rb_objspace::live_num, Qfalse, Qtrue, ready_to_gc(), set_heaps_increment(), rb_objspace::sweep_slots, and TRUE.
Referenced by rb_newobj().
|
static |
Definition at line 1747 of file gc.c.
References RVALUE::as, RVALUE::basic, FL_MARK, RBasic::flags, rb_objspace::heap, rb_objspace::live_num, rb_objspace::mark_stack, push_mark_stack(), RANY, and rb_special_const_p().
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 1768 of file gc.c.
References RVALUE::array, RVALUE::as, RString::as, RArray::as, RVALUE::basic, BUILTIN_TYPE, RNode::cnt, RVALUE::complex, RVALUE::data, DATA_PTR, RRational::den, RData::dmark, rb_data_type_struct::dmark, ELTS_SHARED, rb_io_t::encs, RVALUE::file, FL_ANY, FL_EXIVAR, FL_MARK, FL_TEST, RBasic::flags, RFile::fptr, rb_data_type_struct::function, gc_mark(), RVALUE::hash, rb_objspace::heap, RString::heap, RArray::heap, i, if(), RHash::ifnone, RComplex::imag, is_pointer_to_heap(), RBasic::klass, len, rb_objspace::live_num, mark_const_tbl(), mark_hash(), mark_locations_array(), mark_m_tbl(), mark_tbl(), RVALUE::match, nd_type, RNode::node, RVALUE::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_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_OPTBLOCK, 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, RHash::ntbl, RRational::num, rb_io_t::pathv, RANY, RARRAY_LEN, RARRAY_PTR, RVALUE::rational, rb_bug(), rb_mark_generic_ivar(), rb_special_const_p(), RCLASS_CONST_TBL, RCLASS_IV_TBL, RCLASS_M_TBL, RCLASS_SUPER, RComplex::real, RMatch::regexp, RVALUE::regexp, ROBJECT_IVPTR, ROBJECT_NUMIV, RSTRING_NOEMBED, RSTRUCT_LEN, RSTRUCT_PTR, RTYPEDDATA_P, RRegexp::src, RMatch::str, STR_ASSOC, RVALUE::string, T_ARRAY, T_BIGNUM, T_CLASS, T_COMPLEX, T_DATA, 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_ZOMBIE, rb_io_t::tied_io_for_writing, RTypedData::type, RVALUE::typeddata, RNode::u1, RNode::u2, RNode::u3, RNode::value, rb_io_t::write_lock, rb_io_t::writeconv_asciicompat, and rb_io_t::writeconv_pre_ecopts.
Referenced by gc_mark_stacked_objects().
|
static |
Definition at line 1554 of file gc.c.
References mark_locations_array(), and sorted_heaps_slot::start.
Referenced by rb_gc_mark_locations().
|
static |
Definition at line 1499 of file gc.c.
References gc_mark_children(), mark_stack::index, rb_objspace::mark_stack, pop_mark_stack(), and shrink_stack_chunk_cache().
Referenced by gc_marks().
|
static |
Definition at line 2541 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, rb_objspace::live_num, mark_current_machine_context(), mark_tbl(), 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, gc_list::varptr, and rb_thread_struct::vm.
Referenced by garbage_collect(), and gc_lazy_sweep().
|
static |
Definition at line 688 of file gc.c.
References rb_objspace::count, MEMZERO, rb_objspace::profile, Qnil, rb_objspace, rb_objspace::record, and rb_objspace::size.
Referenced by Init_GC().
|
static |
Definition at line 671 of file gc.c.
References FALSE, rb_objspace::profile, Qnil, rb_objspace, and rb_objspace::run.
Referenced by Init_GC().
|
static |
Definition at line 654 of file gc.c.
References rb_objspace::profile, Qnil, rb_objspace, rb_objspace::run, and TRUE.
Referenced by Init_GC().
Definition at line 639 of file gc.c.
References rb_objspace::profile, Qfalse, Qtrue, rb_objspace, and rb_objspace::run.
Referenced by Init_GC().
|
static |
Definition at line 3495 of file gc.c.
References gc_profile_record::allocate_increase, gc_profile_record::allocate_limit, rb_objspace::count, DBL2NUM, gc_profile_record::gc_invoke_time, gc_profile_record::gc_mark_time, gc_profile_record::gc_sweep_time, gc_profile_record::gc_time, gc_profile_record::have_finalize, gc_profile_record::heap_free_objects, gc_profile_record::heap_live_objects, gc_profile_record::heap_total_objects, gc_profile_record::heap_total_size, gc_profile_record::heap_use_size, gc_profile_record::heap_use_slots, 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 gc_profile_result().
Definition at line 3603 of file gc.c.
References gc_profile_result(), Qnil, rb_io_write(), rb_scan_args(), and rb_stdout.
Referenced by Init_GC().
|
static |
Definition at line 3542 of file gc.c.
References rb_objspace::count, gc_count(), gc_profile_record_get(), i, ID2SYM, NUM2DBL, NUM2INT, NUM2SIZET, PRIuSIZE, rb_objspace::profile, RARRAY_LEN, RARRAY_PTR, rb_hash_aref(), rb_intern, rb_objspace, rb_sprintf(), rb_str_cat2(), rb_str_catf(), rb_str_new2(), result, and rb_objspace::run.
Referenced by gc_profile_report(), and Init_GC().
Definition at line 3626 of file gc.c.
References rb_objspace::count, DBL2NUM, gc_profile_record::gc_time, i, rb_objspace::profile, rb_objspace, rb_objspace::record, and rb_objspace::run.
Referenced by Init_GC().
Definition at line 3433 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, rb_objspace::live_num, Qnil, rb_eTypeError, rb_hash_aset(), rb_hash_new(), rb_intern, rb_objspace, rb_raise(), rb_scan_args(), rest_sweep(), SIZET2NUM, T_HASH, TYPE, and rb_objspace::used.
Referenced by Init_GC().
Definition at line 604 of file gc.c.
References Qfalse, Qtrue, rb_objspace, and ruby_gc_stress.
Referenced by Init_GC().
Definition at line 623 of file gc.c.
References rb_objspace, rb_secure(), RTEST, and ruby_gc_stress.
Referenced by Init_GC().
|
static |
Definition at line 2325 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().
|
static |
Definition at line 721 of file gc.c.
References garbage_collect().
Referenced by garbage_collect_with_gvl().
|
static |
Definition at line 139 of file gc.c.
References getrusage(), timeval::tv_sec, and timeval::tv_usec.
Referenced by init_heap().
|
static |
Definition at line 1168 of file gc.c.
References assign_heap_slot(), FALSE, heaps_inc, and TRUE.
Referenced by after_gc_sweep(), gc_lazy_sweep(), lazy_sweep(), and ready_to_gc().
Definition at line 3175 of file gc.c.
References BUILTIN_TYPE, FIXNUM_P, ID2SYM, is_pointer_to_heap(), NUM2PTR, obj_id_to_ref, Qfalse, Qnil, Qtrue, rb_eRangeError, rb_id2name(), rb_objspace, rb_raise(), rb_secure(), RBASIC, T_FIXNUM, and T_ICLASS.
Referenced by Init_GC().
void Init_GC | ( | void | ) |
Definition at line 3668 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_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_define_method(), rb_define_module(), rb_define_module_function(), rb_define_module_under(), rb_define_singleton_method(), rb_eNoMemError, rb_exc_new3(), rb_gc_disable(), rb_gc_enable(), rb_gc_start(), rb_mGC, rb_mKernel, rb_obj_freeze(), rb_obj_id(), rb_str_new2(), and undefine_final().
|
static |
Definition at line 1123 of file gc.c.
References add_heap_slots(), ALT_STACK_SIZE, 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, and st_init_numtable.
Referenced by Init_heap().
void Init_heap | ( | void | ) |
|
static |
Definition at line 1440 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().
void Init_stack | ( | volatile VALUE * | addr | ) |
Definition at line 2653 of file gc.c.
References ruby_init_stack().
|
static |
Definition at line 1142 of file gc.c.
References add_heap_slots(), HEAP_OBJ_LIMIT, heaps_used, and initial_heap_min_slots.
Referenced by rb_gc_set_params().
|
inlinestatic |
Definition at line 1342 of file gc.c.
References mark_stack::chunk, and NULL.
Referenced by pop_mark_stack().
|
inlinestatic |
Definition at line 1512 of file gc.c.
References sorted_heaps_slot::end, FALSE, rb_objspace::heap, heaps_used, hi, himem, lo, p, RANY, rb_objspace::sorted, sorted_heaps_slot::start, and TRUE.
Referenced by gc_mark_children(), id2ref(), mark_locations_array(), and rb_gc_mark_maybe().
|
static |
Definition at line 2240 of file gc.c.
References during_gc, FALSE, freelist, rb_objspace::heap, heaps_increment(), heaps_slot::next, slot_sweep(), rb_objspace::sweep_slots, and TRUE.
Referenced by gc_lazy_sweep(), and rest_sweep().
|
static |
Definition at line 2696 of file gc.c.
References rb_objspace::dont_lazy_sweep, FALSE, rb_objspace::flags, Qnil, and rb_objspace.
Referenced by rb_objspace_each_objects().
|
inlinestatic |
Definition at line 2356 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().
|
inlinestatic |
Definition at line 2362 of file gc.c.
References RVALUE::as, RVALUE::data, RData::data, RData::dfree, RVALUE::file, RFile::fptr, make_deferred(), and rb_io_fptr_finalize().
Referenced by obj_free(), and rb_objspace_call_finalizer().
|
static |
Definition at line 1702 of file gc.c.
References arg, gc_mark(), mark_tbl_arg::objspace, ST_CONTINUE, and rb_const_entry_struct::value.
Referenced by mark_const_tbl().
|
static |
Definition at line 1710 of file gc.c.
References mark_const_entry_i(), mark_tbl_arg::objspace, and st_foreach.
Referenced by gc_mark_children().
|
static |
Definition at line 2513 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 1576 of file gc.c.
References arg, gc_mark(), mark_tbl_arg::objspace, and ST_CONTINUE.
Referenced by mark_tbl().
|
static |
Definition at line 1625 of file gc.c.
References mark_keyvalue(), mark_tbl_arg::objspace, and st_foreach.
Referenced by gc_mark_children(), and rb_mark_hash().
Definition at line 1593 of file gc.c.
References arg, gc_mark(), mark_tbl_arg::objspace, and ST_CONTINUE.
Referenced by mark_set().
Definition at line 1616 of file gc.c.
References arg, gc_mark(), mark_tbl_arg::objspace, and ST_CONTINUE.
Referenced by mark_hash().
|
static |
Definition at line 1540 of file gc.c.
References gc_mark(), is_pointer_to_heap(), v, and VALGRIND_MAKE_MEM_DEFINED.
Referenced by gc_mark_children(), gc_mark_locations(), and mark_current_machine_context().
|
static |
Definition at line 1677 of file gc.c.
References mark_method_entry_i(), mark_tbl_arg::objspace, and st_foreach.
Referenced by gc_mark_children().
|
static |
Definition at line 1640 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::proc, rb_iseq_struct::self, rb_method_definition_struct::type, VM_METHOD_TYPE_ATTRSET, VM_METHOD_TYPE_BMETHOD, VM_METHOD_TYPE_ISEQ, and VM_METHOD_TYPE_IVAR.
Referenced by mark_method_entry_i(), and rb_mark_method_entry().
|
static |
Definition at line 1669 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 1601 of file gc.c.
References mark_key(), mark_tbl_arg::objspace, and st_foreach.
Referenced by rb_mark_set().
|
static |
Definition at line 1584 of file gc.c.
References mark_entry(), st_table::num_entries, mark_tbl_arg::objspace, and st_foreach.
Referenced by gc_mark_children(), gc_marks(), and rb_mark_tbl().
|
static |
Definition at line 704 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().
|
static |
Definition at line 697 of file gc.c.
References rb_eNoMemError, and rb_raise().
Referenced by negative_size_allocation_error().
|
static |
Definition at line 2371 of file gc.c.
References BUILTIN_TYPE, rmatch::char_offset, DATA_PTR, FL_EXIVAR, FL_TEST, FL_UNSET, make_deferred(), make_io_deferred(), nd_type, NODE_ALLOCA, NODE_SCOPE, onig_free(), onig_region_free(), 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 2712 of file gc.c.
References args, RVALUE::as, RVALUE::basic, each_obj_args::callback, each_obj_args::data, RBasic::flags, rb_objspace::heap, heaps_used, i, heaps_slot::limit, heaps_slot::membase, Qnil, rb_objspace, heaps_slot::slot, sorted_heaps_slot::slot, rb_objspace::sorted, and v.
Referenced by rb_objspace_each_objects().
Definition at line 2885 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 2838 of file gc.c.
References os_each_struct::num, os_each_struct::of, os_obj_of_i(), rb_objspace_each_objects(), and SIZET2NUM.
Referenced by os_each_obj().
|
static |
Definition at line 2806 of file gc.c.
References RVALUE::as, RVALUE::basic, BUILTIN_TYPE, FL_SINGLETON, FL_TEST, RBasic::flags, RBasic::klass, os_each_struct::num, os_each_struct::of, p, rb_obj_is_kind_of(), rb_yield(), T_CLASS, T_ICLASS, T_NODE, T_NONE, T_ZOMBIE, and v.
Referenced by os_obj_of().
|
static |
Definition at line 1425 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 1390 of file gc.c.
References add_stack_chunk_cache(), 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 1416 of file gc.c.
References mark_stack::chunk, stack_chunk::data, mark_stack::index, mark_stack::limit, and push_mark_stack_chunk().
Referenced by gc_mark().
|
static |
Definition at line 1370 of file gc.c.
References mark_stack::cache, mark_stack::cache_size, mark_stack::chunk, mark_stack::index, heaps_slot::next, stack_chunk::next, stack_chunk_alloc(), and mark_stack::unused_cache_size.
Referenced by init_mark_stack(), and push_mark_stack().
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 | ||
) |
int rb_during_gc | ( | void | ) |
Definition at line 1179 of file gc.c.
References during_gc, and rb_objspace.
void rb_free_const_table | ( | st_table * | tbl | ) |
Definition at line 1726 of file gc.c.
References free_const_entry_i(), st_foreach, and st_free_table.
Referenced by init_copy(), obj_free(), and rb_mod_init_copy().
void rb_free_m_table | ( | st_table * | tbl | ) |
Definition at line 1695 of file gc.c.
References free_method_entry_i(), st_foreach, and st_free_table.
Referenced by obj_free(), and rb_mod_init_copy().
int rb_garbage_collect | ( | void | ) |
Definition at line 2614 of file gc.c.
References garbage_collect().
void rb_gc | ( | void | ) |
Definition at line 3153 of file gc.c.
References finalize_deferred(), free_unused_heaps(), garbage_collect(), and rb_objspace.
Referenced by bug_str_cstr_term(), dir_initialize(), getDevice(), iconv_create(), rb_fdopen(), rb_gc_start(), rb_pipe(), rb_sysopen(), rsock_s_accept(), rsock_socket(), and ruby_dup().
void rb_gc_call_finalizer_at_exit | ( | void | ) |
Definition at line 3078 of file gc.c.
References rb_objspace_call_finalizer().
Referenced by ruby_finalize_1().
Definition at line 2966 of file gc.c.
References finalizer_table, FL_FINALIZE, FL_SET, FL_TEST, rb_objspace, st_insert, and st_lookup.
Referenced by init_copy().
VALUE rb_gc_disable | ( | void | ) |
Definition at line 957 of file gc.c.
References dont_gc, Qfalse, Qtrue, rb_objspace, and TRUE.
Referenced by cbsubst_scan_args(), Init_GC(), ip_ruby_cmd(), lib_merge_tklist(), lib_split_tklist_core(), tcl_protect_core(), and tk_conv_args().
VALUE rb_gc_enable | ( | void | ) |
Definition at line 935 of file gc.c.
References dont_gc, FALSE, Qfalse, Qtrue, and rb_objspace.
Referenced by cbsubst_scan_args(), Init_GC(), ip_ruby_cmd(), lib_merge_tklist(), lib_split_tklist_core(), tcl_protect_core(), and tk_conv_args().
void rb_gc_finalize_deferred | ( | void | ) |
Definition at line 3054 of file gc.c.
References finalize_deferred().
Referenced by rb_threadptr_execute_interrupts_common().
void rb_gc_force_recycle | ( | VALUE | p | ) |
Definition at line 2343 of file gc.c.
References add_freelist(), FL_MARK, GC_PROF_DEC_LIVE_NUM, RANY, rb_objspace, and RBASIC.
Referenced by call_queue_handler(), dispose_string(), eval_queue_handler(), fixup_nodes(), invoke_queue_handler(), literal_concat_gen(), parser_heredoc_restore(), parser_yylex(), rb_ary_decrement_share(), rb_parser_free(), ruby_vm_destruct(), and yyparse().
void rb_gc_mark | ( | VALUE | ptr | ) |
Definition at line 1762 of file gc.c.
References gc_mark().
Referenced by _thread_call_proc_arg_mark(), addrinfo_mark(), argf_mark(), barrier_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(), gc_marks(), generator_mark(), givar_mark_i(), gzfile_mark(), invoke_queue_mark(), mark_dump_arg(), mark_event_hooks(), mark_marshal_compat_i(), parser_mark(), random_mark(), rb_mark_end_proc(), rb_thread_mark(), rb_vm_mark(), strio_mark(), strscan_mark(), subst_mark(), syck_mark_emitter(), syck_mark_parser(), syck_node_mark(), time_mark(), vm_mark_each_thread_func(), yielder_mark(), and zstream_mark().
Definition at line 1564 of file gc.c.
References gc_mark_locations().
void rb_gc_mark_machine_stack | ( | rb_thread_t * | th | ) |
Definition at line 2620 of file gc.c.
References GET_STACK_BOUNDS, rb_gc_mark_locations, and rb_objspace.
Referenced by rb_thread_mark().
void rb_gc_mark_maybe | ( | VALUE | obj | ) |
Definition at line 1739 of file gc.c.
References gc_mark(), and is_pointer_to_heap().
Referenced by gc_marks(), JSON_mark(), mark_global_entry(), syck_mark_parser(), syck_node_mark(), val_marker(), and var_marker().
void rb_gc_register_address | ( | VALUE * | addr | ) |
Definition at line 976 of file gc.c.
References ALLOC, global_List, gc_list::next, rb_objspace, and gc_list::varptr.
Referenced by Init_coverage(), Init_curses(), Init_iconv(), and rb_global_variable().
void rb_gc_register_mark_object | ( | VALUE | obj | ) |
Definition at line 969 of file gc.c.
References GET_THREAD, and rb_ary_push().
Referenced by date__strptime_internal(), date_zone_to_diff(), Init_Bignum(), Init_date_core(), Init_Encoding(), Init_IO(), Init_load(), Init_marshal(), Init_VM(), Init_win32ole(), make_patterns(), power_cache_get_power0(), 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().
void rb_gc_set_params | ( | void | ) |
Definition at line 445 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.
Referenced by process_options().
VALUE rb_gc_start | ( | void | ) |
void rb_gc_unregister_address | ( | VALUE * | addr | ) |
Definition at line 988 of file gc.c.
References global_List, gc_list::next, rb_objspace, gc_list::varptr, and xfree().
Referenced by curses_finalize().
void rb_global_variable | ( | VALUE * | var | ) |
Definition at line 548 of file gc.c.
References rb_gc_register_address().
Referenced by Init_ossl_asn1(), Init_Random(), Init_RandomSeed(), Init_Regexp(), Init_syck(), Init_tcltklib(), and Init_tkutil().
void rb_mark_hash | ( | st_table * | tbl | ) |
Definition at line 1634 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 1663 of file gc.c.
References mark_method_entry().
Referenced by bm_mark(), and rb_gc_mark_unlinked_live_method_entries().
void rb_mark_set | ( | st_table * | tbl | ) |
void rb_mark_tbl | ( | st_table * | tbl | ) |
Definition at line 1733 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().
void rb_memerror | ( | void | ) |
Definition at line 579 of file gc.c.
References 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, and TAG_RAISE.
Referenced by allocate_sorted_heaps(), assign_heap_slot(), nsdr(), rb_newobj(), readline_attempted_completion_function(), ruby_memerror(), ruby_memerror_body(), and stack_chunk_alloc().
VALUE rb_newobj | ( | void | ) |
Definition at line 1188 of file gc.c.
References dont_gc, during_gc, freelist, garbage_collect(), gc_lazy_sweep(), GC_PROF_INC_LIVE_NUM, MEMZERO, RANY, rb_bug(), rb_memerror(), rb_objspace, rb_sourcefile, rb_sourceline(), ruby_disable_gc_stress, ruby_gc_stress, and UNLIKELY.
Referenced by rb_node_newnode().
Definition at line 1227 of file gc.c.
References RNode::flags, nd_set_type, rb_newobj(), T_NODE, RNode::u1, RNode::u2, RNode::u3, and RNode::value.
Definition at line 3241 of file gc.c.
References FIXNUM_FLAG, LONG2NUM, nonspecial_obj_id, SIGNED_VALUE, SPECIAL_CONST_P, SYM2ID, and SYMBOL_P.
Referenced by exec_recursive(), Init_GC(), rb_exec_recursive_paired(), rb_obj_hash(), rb_objspace_call_finalizer(), and run_final().
|
read |
Definition at line 430 of file gc.c.
References initial_malloc_limit, malloc(), malloc_limit, ruby_gc_stress, and ruby_initial_gc_stress.
Referenced by Init_BareVM().
|
static |
Definition at line 3084 of file gc.c.
References RVALUE::as, assert, BUILTIN_TYPE, DATA_PTR, deferred_final_list, during_gc, sorted_heaps_slot::end, finalize_deferred(), finalize_list(), finalizer_table, force_chain_object(), RVALUE::free, rb_objspace::heap, heaps_used, i, list, make_deferred(), make_io_deferred(), force_finalize_list::next, force_finalize_list::obj, p, RANY, rb_obj_id(), 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, sorted_heaps_slot::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 1271 of file gc.c.
References RTYPEDDATA_DATA, RTYPEDDATA_P, and RTYPEDDATA_TYPE.
Referenced by memsize_of().
Definition at line 1282 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 2787 of file gc.c.
References callback(), each_obj_args::callback, each_obj_args::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 492 of file gc.c.
References free(), free_stack_chunks(), global_List, rb_objspace::heap, heaps, heaps_used, i, list, rb_objspace::mark_stack, heaps_slot::membase, gc_list::next, rb_objspace::profile, rb_objspace::record, rest_sweep(), sorted_heaps_slot::slot, and rb_objspace::sorted.
Referenced by ruby_vm_destruct().
|
static |
Definition at line 2187 of file gc.c.
References dont_gc, during_gc, FALSE, freelist, heaps_increment(), set_heaps_increment(), and TRUE.
Referenced by garbage_collect(), and gc_lazy_sweep().
|
static |
Definition at line 2258 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_objspace_call_finalizer(), rb_objspace_each_objects(), and rb_objspace_free().
int ruby_get_stack_grow_direction | ( | volatile VALUE * | addr | ) |
Definition at line 1313 of file gc.c.
References ruby_stack_grow_direction, and SET_MACHINE_STACK_END.
|
static |
Definition at line 561 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().
|
static |
int ruby_stack_check | ( | void | ) |
Definition at line 1484 of file gc.c.
References stack_check(), and STACKFRAME_FOR_CALL_CFUNC.
Referenced by stack_check().
size_t ruby_stack_length | ( | VALUE ** | p | ) |
Definition at line 1455 of file gc.c.
References GET_THREAD, SET_STACK_END, STACK_END, STACK_LENGTH, STACK_START, and STACK_UPPER.
void* ruby_xcalloc | ( | size_t | n, |
size_t | size | ||
) |
Definition at line 892 of file gc.c.
References vm_xcalloc().
void ruby_xfree | ( | void * | x | ) |
Definition at line 914 of file gc.c.
References vm_xfree().
Referenced by 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(), iseq_free(), JSON_free(), mutex_free(), ossl_cipher_free(), ossl_hmac_free(), proc_free(), rb_dl_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 857 of file gc.c.
References vm_xmalloc().
Referenced by rb_dl_malloc(), and rb_dlptr_malloc().
void* ruby_xmalloc2 | ( | size_t | n, |
size_t | size | ||
) |
Definition at line 873 of file gc.c.
References vm_xmalloc(), and xmalloc2_size().
void* ruby_xrealloc | ( | void * | ptr, |
size_t | size | ||
) |
Definition at line 898 of file gc.c.
References vm_xrealloc().
Referenced by rb_dl_realloc(), and ruby_xrealloc2().
void* ruby_xrealloc2 | ( | void * | ptr, |
size_t | n, | ||
size_t | size | ||
) |
Definition at line 904 of file gc.c.
References len, rb_eArgError, rb_raise(), and ruby_xrealloc().
|
static |
Definition at line 3015 of file gc.c.
References DATA_PTR, rb_objspace::final_num, finalizer_table, rb_objspace::heap, key, rb_obj_id(), RBASIC, RDATA, RTYPEDDATA_P, RTYPEDDATA_TYPE, run_finalizer(), and st_delete.
Referenced by finalize_list().
|
static |
Definition at line 2989 of file gc.c.
References args, FIX2INT, i, Qnil, RARRAY_LEN, RARRAY_PTR, rb_ary_new3(), rb_obj_freeze(), rb_protect(), rb_safe_level, rb_set_errinfo(), and run_single_final().
Referenced by rb_objspace_call_finalizer(), and run_final().
Definition at line 2981 of file gc.c.
References args, Qnil, and rb_eval_cmd().
Referenced by run_finalizer().
|
static |
Definition at line 1152 of file gc.c.
References allocate_sorted_heaps(), heaps_inc, heaps_length, and heaps_used.
Referenced by after_gc_sweep(), gc_lazy_sweep(), and ready_to_gc().
Definition at line 3281 of file gc.c.
References hash(), INT2FIX, rb_hash_aset(), and ST_CONTINUE.
Referenced by count_objects().
|
static |
Definition at line 1356 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 2125 of file gc.c.
References add_freelist(), RVALUE::as, RVALUE::basic, BUILTIN_TYPE, deferred_final_list, rb_objspace::do_heap_free, rb_objspace::final_num, FL_FINALIZE, FL_MARK, FL_SINGLETON, FL_TEST, RBasic::flags, RVALUE::free, free(), rb_objspace::free_num, freelist, GET_THREAD, rb_objspace::heap, heaps_slot::limit, obj_free(), p, RBASIC, RDATA, RUBY_VM_SET_FINALIZER_INTERRUPT, heaps_slot::slot, T_ZOMBIE, and unlink_heap_slot().
Referenced by gc_sweep(), and lazy_sweep().
|
static |
Definition at line 1465 of file gc.c.
References GET_THREAD, SET_STACK_END, STACK_LENGTH, and STACK_LEVEL_MAX.
Referenced by ruby_stack_check().
|
static |
Definition at line 1330 of file gc.c.
References malloc(), and rb_memerror().
Referenced by init_mark_stack(), and push_mark_stack_chunk().
Definition at line 2909 of file gc.c.
References finalizer_table, FL_FINALIZE, FL_UNSET, rb_check_frozen, rb_objspace, and st_delete.
Referenced by Init_GC().
|
static |
Definition at line 2074 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 768 of file gc.c.
References malloc_increase, rb_objspace::malloc_params, and size.
Referenced by vm_xcalloc(), and vm_xmalloc().
|
inlinestatic |
Definition at line 748 of file gc.c.
References garbage_collect_with_gvl(), malloc_increase, malloc_limit, negative_size_allocation_error(), ruby_disable_gc_stress, ruby_gc_stress, and size.
Referenced by vm_xcalloc(), and vm_xmalloc().
|
static |
Definition at line 879 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 843 of file gc.c.
References free(), rb_objspace::malloc_params, and size.
Referenced by ruby_xfree(), and vm_xrealloc().
|
static |
Definition at line 791 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 801 of file gc.c.
References garbage_collect_with_gvl(), malloc_increase, rb_objspace::malloc_params, negative_size_allocation_error(), realloc(), ruby_disable_gc_stress, ruby_gc_stress, ruby_memerror(), size, vm_xfree(), and vm_xmalloc().
Referenced by ruby_xrealloc().
|
inlinestatic |
Definition at line 863 of file gc.c.
References len, rb_eArgError, and rb_raise().
Referenced by ruby_xmalloc2(), and vm_xcalloc().
ruby_gc_params_t initial_params |
int ruby_disable_gc_stress = 0 |
Definition at line 541 of file gc.c.
Referenced by rb_newobj(), vm_malloc_prepare(), and vm_xrealloc().
int* ruby_initial_gc_stress_ptr = &ruby_initial_gc_stress |
Definition at line 401 of file gc.c.
Referenced by set_debug_option().
int ruby_stack_grow_direction |
Definition at line 1311 of file gc.c.
Referenced by ruby_get_stack_grow_direction().