aboutsummaryrefslogtreecommitdiffstats
path: root/gc.c
Commit message (Collapse)AuthorAgeFilesLines
* move fields to ec.ko12017-06-281-1/+1
| | | | | | | | | | * vm_core.h (rb_thread.h): move errinfo and trace_arg to rb_execution_context_t. * cont.c (fiber_switch, rb_cont_call): do not restore "trace_arg" here. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* use "enum ruby_tag_type" and TAG_NONE.ko12017-06-231-8/+9
| | | | | | | | | | | | | | | Return value of EXEC_TAG() is saved by "int state". Instead of "int", use "enum ruby_tag_type". First EXEC_TAG() value should be 0, so that define TAG_NONE (= 0) and use it. Some code used "status" instead of "state". To make them clear, rename them to state. We can change variable name from "state" to "tag_state", but this ticket doesn't contain it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * remove trailing spaces.svn2017-06-221-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* introduce heap_allocatable_pages_set().ko12017-06-221-11/+40
| | | | | | | | * gc.c (heap_allocatable_pages_set): added. This function set heap_allocatable_pages and sorted_list atomically. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* introduce GC_ASSERT().ko12017-06-221-66/+57
| | | | | | | | * gc.c (GC_ASSERT()): added. GC_ASSERT() is similar to VM_ASSERT in vm_core.h but turn on by RGENGC_CHECK_MODE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c: expand sorted pagesnobu2017-06-221-19/+31
| | | | | | | * gc.c (heap_page_allocate): expand sorted pages before inserting allocated new page. [Bug #12670] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c: FL_CHECK2nobu2017-06-211-3/+6
| | | | | | | * gc.c (FL_TEST2, FL_SET2, FL_UNSET2): make error messages consitent. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59135 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* RUBY_DEVEL flagnobu2017-06-211-0/+4
| | | | | | | | | | | * configure.in: define RUBY_DEVEL only in the trunk. * gc.c: enable runtime rgengc debug if RUBY_DEVEL * ruby.c (debug_option): enable RUBY_DEBUG in --debug option only if RUBY_DEVEL. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c: add newline to report [ci skip]nobu2017-06-201-1/+1
| | | | | | | * gc.c (gc_sweep_finish): gc_report format should end with a newline, as gc_report_body does not append it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* debug.c: rgengc debug optionnobu2017-06-191-0/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c: duplicate rb_iseq_path by RSTRING_PTRnobu2017-06-121-1/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rename absolute_path to realpath internally and introduce pathobj.ko12017-06-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * vm_core.h: rename absolute_path to realpath because it is expected name. external APIs (#absolute_path methods) are remained. * vm_core.h: remove rb_iseq_location_struct::path and rb_iseq_location_struct::absolute_path and introduce pathobj. if given path equals to given absolute_path (and most of case it is true), pathobj is simply given path String. If it is not same, pathobj is Array and pathobj[0] is path and pathobj[1] is realpath. This size optimization reduce 8 bytes and sizeof(struct rb_iseq_constant_body) is 200 bytes -> 192 bytes on 64bit CPU. To support this change, the following functions are introduced: * pathobj_path() (defined in vm_core.h) * pathobj_realpath() (ditto) * rb_iseq_path() (decl. in vm_core.h) * rb_iseq_realpath() (ditto) * rb_iseq_pathobj_new() (ditto) * rb_iseq_pathobj_set() (ditto) * vm_core.h (rb_binding_t): use pathobj instead of path. If binding is given at eval methods, realpath (absolute_path) was caller's realpath. However, they should use binding's realpath. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add debug counters.ko12017-05-241-0/+7
| | | | | | | | | | | | | | | | | * debug_counter.h: add the following counters to measure object types. obj_free: freed count obj_str_ptr: freed count of Strings they have extra buff. obj_str_embed: freed count of Strings they don't have extra buff. obj_str_shared: freed count of Strings they have shared extra buff. obj_str_nofree: freed count of Strings they are marked as nofree. obj_str_fstr: freed count of Strings they are marked as fstr. obj_ary_ptr: freed count of Arrays they have extra buff. obj_ary_embed: freed count of Arrays they don't have extra buff. obj_obj_ptr: freed count of Objects (T_OBJECT) they have extra buff. obj_obj_embed: freed count of Objects they don't have extra buff. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c: checks of sizesnobu2017-05-121-24/+9
| | | | | | | | * gc.c (ruby_xmalloc, ruby_xmalloc2, ruby_xcalloc): move checks of sizes from objspace_xmalloc, objspace_xmalloc2, objspace_xcalloc, respectively. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c: objspace_malloc_fixupnobu2017-05-121-4/+3
| | | | | | | * gc.c (objspace_malloc_fixup): include allocated size managements. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c: skip unnecessary checknobu2017-05-111-1/+1
| | | | | | | * gc.c (wmap_aset): skip unnecessary size check. `2*sizeof(VALUE)` is static and should never overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c: use the argument objspacenobu2017-05-111-1/+1
| | | | | | | * gc.c (objspace_xrealloc): use the argument objspace, instead of the default object space. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c: check of size in ruby_sized_xreallocnobu2017-05-101-1/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rb_execution_context_t: move stack, stack_size and cfp from rb_thread_tnormal2017-05-091-1/+1
| | | | | | | | | | The goal is to reduce rb_context_t and rb_fiber_t size by removing the need to store the entire rb_thread_t in there. [ruby-core:81045] Work-in-progress: soon, we will move more fields here. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Get rid of unnecessary GCC extensionnobu2017-04-241-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval.c: copy special exceptions before raisenobu2017-04-171-5/+9
| | | | | | | | | | | | * eval.c (setup_exception): consider if the exception is frozen, but not one of special exception objects. * gc.c (rb_memerror): copy minimum objects. * thread.c (rb_threadptr_execute_interrupts): prepare special exception queued by another thread to be raised. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c: rb_threadptr_stack_checknobu2017-04-171-0/+6
| | | | | | | | | | * gc.c (rb_threadptr_stack_check): check probability of stack overflow for the given thread, not the current thread. * vm_eval.c (stack_check): check the given thread, not the current thread. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c: PREVENT_STACK_OVERFLOWnobu2017-04-171-7/+11
| | | | | | | | | * gc.c (PREVENT_STACK_OVERFLOW): define TRUE to try preventing stack overflow before actually happens. * gc.c (stack_check): parameterize thread pointer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* thread.c: during GC for threadnobu2017-04-121-0/+7
| | | | | | | * thread.c (ruby_thread_stack_overflow): check if the given thread is during GC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* get rid of strcpynobu2016-12-261-2/+1
| | | | | | | | | | | | | * addr2line.c (follow_debuglink): insert global_debug_dir by using memmove instead of copying to temporary buffer. * dln.c (dln_load): use memcpy with the known length instead of strcpy. * gc.c (rb_gc_unprotect_logging): use strdup instead of malloc and strcpy. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_trace.c (tracepoint_attr_callee_id, rb_tracearg_callee_id):ktsj2016-11-051-1/+1
| | | | | | | | | | | add TracePoint#callee_id. [ruby-core:77241] [Feature #12747] * cont.c, eval.c, gc.c, include/ruby/intern.h, insns.def, thread.c, vm.c, vm_backtrace.c, vm_core.h, vm_eval.c, vm_insnhelper.c, vm_trace.c: ditto. * test/ruby/test_settracefunc.rb: tests for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (heap_page_resurrect): do not return tomb_pages whenko12016-11-041-4/+8
| | | | | | | | page->freelist == NULL. [Bug #12670] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c: fix GC_PROFILE_DETAIL_MEMORYnobu2016-10-071-6/+4
| | | | | | | | * gc.c (gc_prof_setup_new_record): fix the condition to get rusage. * gc.c (gc_profile_dump_major_reason): remove undefined flags. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fid typos [ci skip]nobu2016-09-241-1/+1
| | | | | | * fix typos, "a" before "Integer" to "an". [Fix GH-1438] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c: fix rdoc of garbage_collect [ci skip]kazu2016-09-221-1/+2
| | | | | | | * gc.c (gc_start_internal): [DOC] methods without arguments like r56194. [Bug #12777] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c: fix rdoc of garbage_collect [ci skip]nobu2016-09-201-1/+2
| | | | | | | * gc.c (gc_start_internal): [DOC] add ObjectSpace.garbage_collect and fix GC#garbage_collect. [Bug #12777] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c: rb_gc_adjust_memory_usagenobu2016-09-201-0/+12
| | | | | | | * gc.c (rb_gc_adjust_memory_usage): notify memory usage to the GC engine by extension libraries, to trigger GC. [Feature #12690] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Use PRIuSIZE format specifier for size_t valuesrhe2016-09-131-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | Use PRIuSIZE instead of PRIdSIZE. This fixes the exception message shown on too large xmalloc2. This commit also fixes other incorrect use of PRIdSIZE in other functions; though most of them are debug print. * gc.c (heap_extend_pages, get_envparam_size, ruby_malloc_size_overflow, gc_profile_dump_on): Use PRIuSIZE instead of PRIdSIZE as the passed value is size_t, not ssize_t. * iseq.c (get_line_info, rb_iseq_disasm_insn): Ditto. * sprintf.c (rb_str_format): Ditto. * thread_win32.c (native_thread_create): Ditto. * vm.c (get_param): Ditto. * ext/objspace/objspace_dump.c (dump_append_string_content, dump_object): Ditto. * ext/socket/raddrinfo.c (host_str, port_str): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* replace fixnum by integer in documents.akr2016-09-081-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (gc_reset_malloc_info): Remove too much ";".kou2016-08-241-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm.c, internal.h: remove RubyVM::Env class and all of env objectsko12016-07-281-50/+75
| | | | | | | | | | | | | | | | | | | | are imemo objects (imemo_env). * NEWS: describe this change. I believe nobody touch these objects because there are no method defined. * vm_core.h: remove the following definitions. * rb_cEnv decl. * GetEnvPtr() because Env is no longer T_DATA object. * vm_core.h (rb_env_t): fix layout for imemo values. * vm_core.h (vm_assert_env): added. * vm_core.h (vm_env_new): added. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: revisit the structure of frame, block and env.ko12016-07-281-13/+0
| | | | | | | | | | | | | | | | | | | | | | [Bug #12628] This patch introduce many changes. * Introduce concept of "Block Handler (BH)" to represent passed blocks. * move rb_control_frame_t::flag to ep[0] (as a special local variable). This flags represents not only frame type, but also env flags such as escaped. * rename `rb_block_t` to `struct rb_block`. * Make Proc, Binding and RubyVM::Env objects wb-protected. Check [Bug #12628] for more details. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c: running finalizer statenobu2016-07-261-12/+20
| | | | | | | * gc.c (run_finalizer): make saved running finalizer state volatile to ensure not to be clobbered by longjmp. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (rb_raw_obj_info): support to show Proc obj.ko12016-07-261-10/+34
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (gc_mark): add `inline' explicitly.ko12016-07-261-2/+2
| | | | | | | | | I expected to inline this function implicitly at the loop (ex: marking T_ARRAY objects) but sometimes it remains as normal call. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c: reduce EXEC_TAGnobu2016-07-211-17/+22
| | | | | | | * gc.c (run_finalizer): push and exec tag just once, instead of protecting for each finalizer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c: set finalizingnobu2016-07-211-2/+2
| | | | | | | * gc.c (gc_start_internal, rb_gc_start): set finalizing flag whenever calling deferred finalizers not to recurse. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (gc_mark_roots): should mark the VM object itself to markko12016-07-131-1/+1
| | | | | | | | | | | | singleton class of the VM object. Before this patch, we only set mark bit for the VM object and invoke mark function separately. [Bug #12583] * test/ruby/test_gc.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* include/ruby/defines.h (GCC_VERSION_SINCE): moved from internal.hnaruse2016-05-121-2/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (rb_gc_unprotect_logging): throw rb_memerror when it cannotnaruse2016-05-081-1/+5
| | | | | | | | | | | | allocate memory. This is pointed out by Facebook's Infer. * gc.c (gc_prof_setup_new_record): ditto. * regparse.c (parse_regexp): ditto. * util.c (MALLOC): use xmalloc and xfree like above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * configure.in: check function attirbute const and pure,naruse2016-05-081-0/+2
| | | | | | | | | | | | and define CONSTFUNC and PUREFUNC if available. Note that I don't add those options as default because it still shows many false-positive (it seems not to consider longjmp). * vm_eval.c (stack_check): get rb_thread_t* as an argument to avoid duplicate call of GET_THREAD(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* use TH_JUMP_TAGnobu2016-05-051-1/+1
| | | | | | | | * vm_eval.c (rb_eval_cmd, rb_catch_obj): use TH_JUMP_TAG with the same rb_thread_t used for TH_PUSH_TAG, instead of JUMP_TAG with the current thread global variable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h (rb_mul_size_overflow): added to handlenaruse2016-04-221-1/+10
| | | | | | | | | | | mul overflow efficiently. * include/ruby/ruby.h (rb_alloc_tmp_buffer2): use rb_mul_size_overflow and avoid division where it can define DSIZE_T. * gc.c (xmalloc2_size): moved from ruby.h and use rb_mul_size_overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * variable.c: use uint32_t instead of long to avoid confusion aboutnaruse2016-04-221-1/+1
| | | | | | the type of ivtbl->numiv. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (rb_alloc_tmp_buffer_with_count): added like xmalloc2 tonaruse2016-04-211-7/+20
| | | | | | | | | | | avoid duplicated check of size. * gc.c (ruby_xmalloc2): added to keep separate layers. * include/ruby/ruby.h (rb_alloc_tmp_buffer2): added to check the size more statically. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e