summaryrefslogtreecommitdiff
path: root/gc.c
AgeCommit message (Collapse)Author
2017-09-10move th->machine to ec->machine.ko1
* vm_core.h: move rb_thread_t::machine to rb_execution_context_t::machine. * vm_core.h, gc.c (rb_gc_mark_machine_stack): accept ec instead of th. it enables to call this func from rb_execution_context_mark() in vm.c. * cont.c (fiber_setcontext): catch up this fix. fiber_restore_thread() restores machine stack information too. * gc.c: catch up structure layout changes. * thread.c: ditto. * thread_pthread.c: ditto. * thread_win32.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-04gc.c: fix typo: nubmer -> numberkazu
Signed-off-by: Antonio Terceiro <terceiro@softwarelivre.org> [Bug #13862] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-28Increase STACKFRAME_FOR_CALL_CFUNCnaruse
On below env, miniruby requires 568 and ruby requires 838 to pass. * ruby -v: ruby 2.5.0dev (2017-08-28 trunk 59670) [x86_64-freebsd10.3] * gcc8 (FreeBSD Ports Collection) 8.0.0 20170828 (experimental) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-23gc.c: restore cfp at finalizernobu
* gc.c (run_finalizer): restore cfp for the case an exception raised in a finalizer. [ruby-core:82432] [Bug #13832] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-23gc.c: run all finalizersnobu
* gc.c (run_finalizer): revert r59155 partially. finalizing loop should continue even after an exception is rescued. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-21prevent stack overflownobu
* gc.c: enable PREVENT_STACK_OVERFLOW. * vm.c (invoke_iseq_block_from_c): prevent stack overflow. * vm_eval.c (stack_check): raise preallocated exception instance. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59630 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-12disable r59314 on mswinnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-12gc.c: restrict RGENGC_DEBUGnobu
* gc.c (RGENGC_DEBUG_ENABLED): restrict runtime ruby_rgengc_debug level up to -RGENGC_DEBUG, to reduce runtime branches in inner loops. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-28move fields to ec.ko1
* 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
2017-06-23use "enum ruby_tag_type" and TAG_NONE.ko1
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
2017-06-22* remove trailing spaces.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-22introduce heap_allocatable_pages_set().ko1
* 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
2017-06-22introduce GC_ASSERT().ko1
* 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
2017-06-22gc.c: expand sorted pagesnobu
* 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
2017-06-21gc.c: FL_CHECK2nobu
* 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
2017-06-21RUBY_DEVEL flagnobu
* 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
2017-06-20gc.c: add newline to report [ci skip]nobu
* 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
2017-06-19debug.c: rgengc debug optionnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-12gc.c: duplicate rb_iseq_path by RSTRING_PTRnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-01rename absolute_path to realpath internally and introduce pathobj.ko1
* 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
2017-05-24Add debug counters.ko1
* 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
2017-05-12gc.c: checks of sizesnobu
* 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
2017-05-12gc.c: objspace_malloc_fixupnobu
* 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
2017-05-11gc.c: skip unnecessary checknobu
* 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
2017-05-11gc.c: use the argument objspacenobu
* 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
2017-05-10gc.c: check of size in ruby_sized_xreallocnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-09rb_execution_context_t: move stack, stack_size and cfp from rb_thread_tnormal
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
2017-04-24Get rid of unnecessary GCC extensionnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-17eval.c: copy special exceptions before raisenobu
* 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
2017-04-17gc.c: rb_threadptr_stack_checknobu
* 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
2017-04-17gc.c: PREVENT_STACK_OVERFLOWnobu
* 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
2017-04-12thread.c: during GC for threadnobu
* 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
2016-12-26get rid of strcpynobu
* 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
2016-11-05* vm_trace.c (tracepoint_attr_callee_id, rb_tracearg_callee_id):ktsj
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
2016-11-04* gc.c (heap_page_resurrect): do not return tomb_pages whenko1
page->freelist == NULL. [Bug #12670] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-07gc.c: fix GC_PROFILE_DETAIL_MEMORYnobu
* 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
2016-09-24fid typos [ci skip]nobu
* 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
2016-09-22gc.c: fix rdoc of garbage_collect [ci skip]kazu
* 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
2016-09-20gc.c: fix rdoc of garbage_collect [ci skip]nobu
* 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
2016-09-20gc.c: rb_gc_adjust_memory_usagenobu
* 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
2016-09-13Use PRIuSIZE format specifier for size_t valuesrhe
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
2016-09-08replace fixnum by integer in documents.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-24* gc.c (gc_reset_malloc_info): Remove too much ";".kou
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-28* vm.c, internal.h: remove RubyVM::Env class and all of env objectsko1
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
2016-07-28* vm_core.h: revisit the structure of frame, block and env.ko1
[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
2016-07-26gc.c: running finalizer statenobu
* 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
2016-07-26* gc.c (rb_raw_obj_info): support to show Proc obj.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-26* gc.c (gc_mark): add `inline' explicitly.ko1
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
2016-07-21gc.c: reduce EXEC_TAGnobu
* 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
2016-07-21gc.c: set finalizingnobu
* 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