summaryrefslogtreecommitdiff
path: root/gc.c
AgeCommit message (Collapse)Author
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
2016-07-13* gc.c (gc_mark_roots): should mark the VM object itself to markko1
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
2016-05-12include/ruby/defines.h (GCC_VERSION_SINCE): moved from internal.hnaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-08* gc.c (rb_gc_unprotect_logging): throw rb_memerror when it cannotnaruse
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
2016-05-08* configure.in: check function attirbute const and pure,naruse
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
2016-05-05use TH_JUMP_TAGnobu
* 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
2016-04-22* include/ruby/ruby.h (rb_mul_size_overflow): added to handlenaruse
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
2016-04-22* variable.c: use uint32_t instead of long to avoid confusion aboutnaruse
the type of ivtbl->numiv. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-21* gc.c (rb_alloc_tmp_buffer_with_count): added like xmalloc2 tonaruse
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
2016-04-21* gc.c (objspace_malloc_prepare): remove size check because it isnaruse
used by objspace_xmalloc and objspace_xcalloc. objspace_xmalloc introduces its own check in this commit. objspace_xcalloc checks with xmalloc2_size (ruby_xmalloc2_size). * gc.c (objspace_xmalloc0): common xmalloc function. * gc.c (objspace_xmalloc): introduce its own size check. * gc.c (objspace_xmalloc2): separated from ruby_xmalloc2 to clarify the layer who has the responsibility to check the size. * gc.c (objspace_xrealloc): remove duplicated size check. * gc.c (ruby_xmalloc2): use objspace_xmalloc2. * include/ruby/ruby.h (ruby_xmalloc2_size): follow the size limit as SSIZE_MAX. Note that ISO C says size_t is unsigned integer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-04* gc.c: change deafult value ofko1
RUBY_GC_HEAP_FREE_SLOTS_MIN_RATIO 0.3 -> 0.2 RUBY_GC_HEAP_FREE_SLOTS_MAX_RATIO 0.8 -> 0.65 These values are same as Ruby 2.0.0. This change cause GC counts. However, generational GC reduced each (minor) GC time and increase memory locality. So that not so big impact on my benchmarking results. (surprizingly, this fix speed up programs on some cases) You can change these values by environment variables if you feel wrong. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-04* gc.c (get_envparam_double): take an upper_bound.ko1
And also take an accept_zero flag which allow to accept zero even if lower_bound is set. * gc.c (ruby_gc_set_params): fix parameters. RUBY_GC_HEAP_FREE_SLOTS_MAX_RATIO set 0.9 as *lower_bound*, so that it should be upper_bound. Set RUBY_GC_HEAP_FREE_SLOTS_MIN_RATIO as lower bound. Also set lower/upper bound of RUBY_GC_HEAP_FREE_SLOTS_GOAL_RATIO to RUBY_GC_HEAP_FREE_SLOTS_MIN/MAX_RATIO. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-31gc.c: use PRIdSIZEnobu
* gc.c (heap_extend_pages): fix format specifiers for size_t. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-31* gc.c: need to set initial value of GC_HEAP_FREE_SLOTS_GOAL_RATIO.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54454 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-31* gc.c: change additional allocation policy.ko1
Introduce new environement variable GC_HEAP_FREE_SLOTS_GOAL_RATIO (goal_ratio) to calculate the ratio of additional memory. Before this change, we add pages with the following formula (when free_slots < total_pages * RUBY_GC_HEAP_FREE_SLOTS_MIN_RATIO): next_pages = total_pages * RUBY_GC_HEAP_GROWTH_FACTOR This addition can allocate too much. With this change, we increase pages to satisfy the following formula: next_free_slots = next_total_slots * goal_ratio where next_free_slots = free_slots + adding_slots next_total_slots = total_slots + adding_slots. If you want to prepare many free slots, increase this ratio. If this variable is 0, then simply multiply RUBY_GC_HEAP_GROWTH_FACTOR. * gc.c (get_envparam_double): enable to accept 0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-31* gc.c (gc_marks_finish): fix syntax error.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-31* gc.c: simplify allocate/free detecting logic at the end of marking.ko1
Before this change, heap_pages_min_slots are calculated at the beggining sweeping phase. And this value is used at the end of *next* marking phase. To simplify it, we use this value at the end of this marking phase. It means that we don't need to store this value as global state. Also heap_pages_max_slots is calculated at the begging of sweeping phase and used at the end of sweeping phase. To simplify this logic, we introduced new global value heap_pages_freeable_pages it means extra pages count we can free. gc_sweep_step() checks this value and moves empty pages to tomb_heap not more than this value. Because of this fix, heap_pages_swept_slots is no longer needed. * gc.c (rb_objspace_t::heap_pages): restruct the objspace global status. remove the following fileds * swept_slots (and heap_pages_swept_slots) * min_free_slots (and heap_pages_min_free_slots) * max_free_slots (and heap_pages_max_free_slots) And add the following filed. * freeable_pages (and heap_pages_freeable_pages) * gc.c (heap_pages_free_unused_pages): unlink tomb heap pages because tomb heap should have only freeable pages. * gc.c (heap_extend_pages): add parameters for future extension. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54451 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-31* gc.c: add GC parameters to configure the following values:ko1
* RUBY_GC_HEAP_FREE_SLOTS_MIN_RATIO: allocate additional pages when free slots is lower than the value (total_slots * (this ratio)). * RUBY_GC_HEAP_FREE_SLOTS_MAX_RATIO: allow to free pages when free slots is greater thatn the value (total_slots * (this ratio)). Before this change, these values are hard coded. * gc.c (ruby_gc_params_t): ditto. * gc.c (ruby_gc_set_params): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-31* remove trailing spaces.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-31* gc.c (gc_verify_heap_page): check the number of zombies.ko1
* gc.c (gc_verify_heap_pages): check also tomb heap. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-31* gc.c (gc_page_sweep): return free slots count.ko1
* gc.c (gc_sweep_step): use returned free slots count. * gc.c (gc_sweep_step): change variable name `next' to `next_sweep_page'. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-18gc.c: fix r54115nobu
* gc.c (gc_page_sweep): use the argument objspace. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-18gc.c: fix commit miss r54145nobu
* gc.c (tick): fix missing close parenthesis. [Fix GH-1291] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17gc.c: tick for POWER archnobu
* gc.c (tick): Use __builtin_ppc_get_timebase for POWER arch. [Fix GH-1291] This gives a little performance improvement user system total real Before: 20.870000 0.000000 20.870000 ( 20.893959) After: 20.720000 0.000000 20.720000 ( 20.733970) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-15gc.c: mark_stack_locationsnobu
* gc.c (mark_stack_locations): extract the common part from mark_current_machine_context and rb_gc_mark_machine_stack. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-15gc.c: rb_objspace_ofnobu
* gc.c (rb_objspace_of): macro to get the objspace from a thread. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-15gc.c: expand a local macronobu
* gc.c (mark_current_machine_context, rb_gc_mark_machine_stack): expand rb_gc_mark_locations local macro. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54114 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-04* gc.c: use 2 bits with unsigned int for rb_objspace::flags::modeko1
because it always returns 0 to 2 (non-negative value). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-04* gc.c: rename "enum gc_stat" to "enum gc_mode"ko1
because there is a same name (no related) function gc_stat(). Also gc_stat_* are renamed to gc_mode_*, gc_stat_transition() to gc_mode_transition(), rb_objspace::flags::stat is renamed to rb_objspace::flags::mode. Change rb_objspace::flags::mode from 2 bits to 3 bits because VC++ returns negative enum value with 2 bits. * gc.c (gc_mode): add a macro to access rb_objspace::flags::mode with verification code (verification is enabled only on RGENGC_CHECK_MODE > 0). * gc.c (gc_mode_set): same macro for setter. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-02* re.c: Introduce RREGEXP_PTR.naruse
patch by dbussink. partially merge https://github.com/ruby/ruby/pull/497 * include/ruby/ruby.h: ditto. * gc.c: ditto. * ext/strscan/strscan.c: ditto. * parse.y: ditto. * string.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-25Macro typonobu
* gc.c (RVALUE_PAGE_WB_UNPROTECTED): fix a typo of argument name. [Fix GH-1221] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-22RUBY_ASSERTnobu
* error.c (rb_assert_failure): assertion with stack dump. * ruby_assert.h (RUBY_ASSERT): new header for the assertion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-08* gc.c: rename PAGE_* to HEAP_PAGE_* because PAGE_SIZE is usedko1
in Mac OS X. * test/ruby/test_gc.rb: catch up this fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53471 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-08* gc.c: PAGE_BITMAP_PLANES (the number of bitmap) is 4, not 3.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-08* gc.c: rename constant names HEAP_* to PAGE_*.ko1
Keys of GC::INTERNAL_CONSTANTS are also renamed. * test/ruby/test_gc.rb: catch up this fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-08* gc.c: remove heap_page::body. Instead of this field,ko1
heap_page::start field works well. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-08* gc.c: rename rb_heap_t::page_length to rb_heap_t::total_pages.ko1
`page_length' is not clear (we may understand with length of a page). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-08* gc.c: remove heap_page::heap. This field is only used to recognizeko1
whether a page is in a tomb or not. Instead of this field, heap_page::flags::in_tomb (1 bit field) is added. Also type of heap_page::(total|free|final)_slots are changed from int to short. 2B is enough for them. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53461 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-29use id_table for constant tablesnormal
valgrind 3.9.0 on x86-64 reports a minor reduction in memory usage when loading only RubyGems and RDoc by running: ruby -rrdoc -eexit before: HEAP SUMMARY: in use at exit: 2,913,448 bytes in 27,394 blocks total heap usage: 48,362 allocs, 20,968 frees, 9,034,621 bytes alloc after: HEAP SUMMARY: in use at exit: 2,880,056 bytes in 26,712 blocks total heap usage: 47,791 allocs, 21,079 frees, 9,046,507 bytes alloc * class.c (struct clone_const_arg): adjust for id_table (clone_const): ditto (clone_const_i): ditto (rb_mod_init_copy): ditto (rb_singleton_class_clone_and_attach): ditto (rb_include_class_new): ditto (include_modules_at): ditto * constant.h (rb_free_const_table): ditto * gc.c (free_const_entry_i): ditto (rb_free_const_table): ditto (obj_memsize_of): ditto (mark_const_entry_i): ditto (mark_const_tbl): ditto * internal.h (struct rb_classext_struct): ditto * object.c (rb_mod_const_set): resolve class name on assignment * variable.c (const_update): replace with const_tbl_update (const_tbl_update): new function (fc_i): adjust for id_table (find_class_path): ditto (autoload_const_set): st_update => const_tbl_update (rb_const_remove): adjust for id_table (sv_i): ditto (rb_local_constants_i): ditto (rb_local_constants): ditto (rb_mod_const_at): ditto (rb_mod_const_set): ditto (rb_const_lookup): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-22gc.c: do not expose internal singleton classnobu
* gc.c (internal_object_p): should not expose singleton classes without a metaclass. based on patches by ko1 and shugo. [Bug #11740] * class.c (rb_singleton_class_object_p): added. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-21revert r53228 because this patch breaks rubyspecko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-21* gc.c (internal_object_p): should not expose singleton classesko1
without a metaclass. [Bug #11740] * class.c (rb_singleton_class_has_metaclass_p): added. * test/ruby/test_class.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-15* gc.c: Delete excess semicolon after RUBY_ALIAS_FUNCTION().ngoto
Suppress "syntax error: empty declaration" warnings by Oracle Solaris Studio 12.x on Solaris. [Bug #11821] * hash.c: ditto, after NOINSERT_UPDATE_CALLBACK(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e