Граф коммитов

1123 Коммитов

Автор SHA1 Сообщение Дата
ktsj 6bce41b3b7 * gc.c (obj_memsize_of): don't calculate memsize of T_NODE
when called from check_gen_consistency. It fixes segmentation
  fault on RGENGC_CHECK_MODE >= 1 introduced by r47188.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-17 10:51:33 +00:00
nobu a669514e63 node.h: extract NODE functions from gc.c
* node.h (rb_gc_free_node, rb_node_memsize, rb_gc_mark_node):
  extract functions for NODE from obj_free(), obj_memsize_of(),
  gc_mark_children() in gc.c.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-16 01:53:10 +00:00
nobu 85691b9578 gc.c: memsize of T_NODE
* gc.c (obj_memsize_of): fix size of T_NODE and comments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-15 03:00:31 +00:00
ko1 2cb8ee942c * gc.c: remove unused macros.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-30 06:24:05 +00:00
normal 48a2b96d2b introduce ZALLOC{,_N} to replace ALLOC{,_N}+MEMZERO use
Using calloc where possible reduces code and binary sizes.

* include/ruby/ruby.h (ZALLOC, ZALLOC_N): implement
  (Data_Make_Struct, TypedData_Make_Struct):
  ZALLOC replaces ALLOC+memset
* compile.c (iseq_seq_sequence): ZALLOC_N replaces ALLOC_N+MEMZERO
* cont.c (fiber_t_alloc): ZALLOC replaces ALLOC+MEMZERO
* io.c (rb_io_reopen): ditto
* iseq.c (prepare_iseq_build): ditto
* parse.y (new_args_tail_gen, parser_new, ripper_s_allocate): ditto
* re.c (match_alloc): ditto
* variable.c (rb_const_set): ditto
* ext/socket/raddrinfo.c (get_addrinfo): ditto
* ext/strscan/strscan.c (strscan_s_allocate): ditto
* gc.c (rb_objspace_alloc): calloc replaces malloc+MEMZERO

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-25 21:34:35 +00:00
ko1 41929aa6b6 * gc.c: change objspace::rgengc::parent_object_is_old (boolean)
to objspace::rgengc::parent_object (VALUE).
  Use Qfalse or RVALUE pointer instead of FALSE and TRUE.
* gc.c (gc_marks_body): should clear parent_object just before
  gc_mark_roots() because there are no parents objects
  for root objects.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-25 05:12:06 +00:00
ko1 61a2893457 * gc.c (rb_gc_writebarrier_remember_promoted): should remember only
OLD objects on RGENGC_AGE2_PROMOTION.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-25 04:47:48 +00:00
ko1 009bf7be44 * gc.c (gc_mark_stacked_objects): fix error message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-25 04:43:09 +00:00
ko1 c90cd20cc4 * gc.c: fix major GC flags.
* add GPR_FLAG_MAJOR_BY_FORCE, which indicates
    major GC by METHOD, CAPI and so on (see GC_BY).
  * remove GPR_FLAG_MAJOR_BY_RESCAN because not used.
  * remove GPR_FLAG_MAJOR_BY_STRESS, use FORCE instead.
* test/ruby/test_gc.rb: catch up.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-24 11:13:19 +00:00
ko1 88722e6a5d * gc.c (gc_mark_roots): call rb_vm_mark directly.
* vm.c: remove mark function for RubyVM object because
  RubyVM object marked manually.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-16 09:06:52 +00:00
nobu ef3ff64933 gc.c: fix typo
* gc.c (global_list): fix typo, capital 'L'.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-10 03:24:17 +00:00
ko1 96815f1ebe * symbol.c: remove rb_gc_mark_symbols().
fstrings refered by static symbols and pinned dynamic symbols
  are registerd by rb_gc_register_mark_object().
  frstring refered by dynamic symbols (not pinned symbols)
  are refered from global_symbols.dsymbol_fstr_hash (Hash object).
  Note that fstrings refered from dynamic symbols must live loger
  than symbol objects themselves because rb_gc_free_dsymbol() uses
  fstring to remove from symbol tables.
  This is why we can not mark fstrings from dynamic symbols.
  This technique reduces root objects for GC marking.
* gc.c (gc_mark_roots): ditto.
* internal.h: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-09 16:19:13 +00:00
ko1 2e225e2c8b * gc.c: revert miss-commit.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-07 03:46:15 +00:00
ko1 2c551e4715 * parse.y: need to use updated (re-created) symbols.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-07 03:42:42 +00:00
ko1 2006bfe2f4 * gc.c: rename is_dying_object() to is_garbage_object().
* gc.h: rb_objspace_garbage_object_p() as an exported function.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-06 15:42:14 +00:00
ko1 094949cb0a * gc.c (is_dying_object): fix missed condition.
* gc.c (is_live_object): move frequent path first.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46717 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-06 12:33:12 +00:00
ko1 38943e80d6 * gc.c: rename is_dead_object() to is_dying_object().
This function is not opposite against is_live_object()
  because is_dying_object() does *not* check object type.
* gc.c (is_dying_object): change condition.
* gc.c (is_live_object): use T_NONE instead of 0.
* gc.c (rb_objspace_dying_object_p): added.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-06 12:02:57 +00:00
ko1 a617afc643 * gc.c (rb_gc_register_mark_object): change data structure.
From single array, to array of arrays. Each array only has 1024
  entries.
* vm.c (Init_vm_objects): change default capa from 1 to 128.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-06 04:42:35 +00:00
nobu 876bfc6b4e Init functions don't need ID caches
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-03 03:38:10 +00:00
ko1 41fe524857 * gc.c (gc_heap_lazy_sweep): simplify logic.
* gc.c (gc_page_sweep): return TRUE if empty slots are available.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-02 06:47:10 +00:00
nobu 1d0fbdb92e gc.c: freeze GC::OPTS
* gc.c (Init_GC): freeze GC::OPTS.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-30 14:59:46 +00:00
ko1 51ae29a3cb * gc.c (gc_stat_internal): return size_t value instead of VALUE
and remove `out' parameter.
* gc.c: add braces for `if' statements.
* gc.c (gc_stat_internal): fix comment.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-30 07:46:57 +00:00
ko1 4369806ff0 * gc.c: support `USE_RGENGC == 0'.
* test/ruby/test_gc.rb: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-30 06:14:37 +00:00
nobu e99ee55abc constify parameters
* include/ruby/intern.h: constify `argv` parameters.

* include/ruby/ruby.h: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-18 06:16:39 +00:00
ko1 b905ac81a0 * gc.c (obj_memsize_of): memsize_of(T_ZOMBIE) returns 0, not a rb_bug.
ObjectSpace.count_objects_size() uses memsize_of(T_ZOMBIE).
  This bug introduced at r46348.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-17 03:27:26 +00:00
ko1 c8c9952066 * gc.c: invoke GC before memory allocation (xmalloc/xrealloc)
when GC.stress = true.
  [Bug #9859]
* test/ruby/test_gc.rb: add a test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-10 16:55:32 +00:00
ko1 5b2a745810 * gc.c: change full GC timing to keep lower memory usage.
Extend heap only at
  (1) after major GC
  or
  (2) after several (two times, at current) minor GC
  Details in https://bugs.ruby-lang.org/issues/9607#note-9
  [Bug #9607]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46387 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-09 11:43:23 +00:00
nobu 029fd365df gc.c: fix typo
* gc.c (gcdebug_sentinel): fix typo, "sentinel" not "sential".
  [fix GH-634]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46386 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-09 07:01:44 +00:00
ko1 72a77c25e5 * gc.c (gc_page_sweep): refactoring.
* gc.c (gc_page_sweep): should not set, but add final_slots into
  sweep_page->final_slots.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-05 07:14:53 +00:00
ko1 0e3debf15b * gc.c (obj_free): check also FL_PROMOTED bit by RVALUE_OLD_P().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-05 01:05:07 +00:00
ko1 2f73dbd084 * gc.c: introduce RZombie to manage zombie objects.
Rewrite finalizing logics with this type.
* gc.c (gc_verify_internal_consistency): verify zombie (finalizing)
  objects count.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-04 13:33:20 +00:00
ko1 7ad125d7d2 * gc.c (rb_objspace_free): should not rest_sweep() here.
Some data structures are already freed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-03 10:17:18 +00:00
ko1 29bee7e8ea revert r46332 because RVALUE_OLD_P() returns int by r46334
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46338 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-03 09:13:39 +00:00
ko1 75604b077e * gc.c (rb_gc_call_finalizer_at_exit): add
gc_verify_internal_consistency() when RGENGC_CHECK_MODE >= 2.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-03 09:02:21 +00:00
ko1 2e437f8b45 * gc.c: change the counting method for young objects.
clear counter at the beggining of every GC and
  count promoted (infant->young) objects.
  Some promotions (infant->young) are transition of promoting to old
  objects. We should not count such promotions.
  With this technique, we don't need to check young objects
  at obj_free().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-03 09:00:53 +00:00
ko1 9d71a0ae33 * gc.c: add verifying counters code in gc_verify_internal_consistency().
gc_verify_internal_consistency() counts all
  - live objects
  - young objects (if age2 promotion)
  - old objects
  in all pages and compares with objspace managing counters.
* gc.c (gc_after_sweep): do gc_verify_internal_consistency()
  when RGENGC_CHECK_MODE >= 2.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-03 07:50:23 +00:00
nobu b259791072 gc.c: int for simple predicates
* gc.c: use int for simple predicate functions instead of VALUE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46334 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-03 07:44:19 +00:00
ko1 3d42f2295d * gc.c (rb_gc_force_recycle): we only need to know the result (0/1)
of RVALUE_OLD_P(). clang fails to compile it because is_old is
  `int' but RVALUE_OLD_P() returns VALUE.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-03 07:37:44 +00:00
ko1 e7d8c473c1 * gc.c (objspace_live_slot): live slot count should not include final
slot (contains T_ZOMBIE) count.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-03 04:19:21 +00:00
ko1 a0bbf948b5 * gc.c (obj_free): fix spacing.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-03 04:03:55 +00:00
ko1 58390617ef * gc.c (check_gen_consistency): fix error message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-03 04:00:18 +00:00
ko1 baff4dfef9 * gc.c: count old/young objects more correctly.
* gc.c (RVALUE_DEMOTE_FROM_OLD): decrement old object count.
* gc.c (RVALUE_DEMOTE_FROM_YOUNG): decrement young object count.
* gc.c (rb_gc_resurrect): increment old object count.
* gc.c (gc_marks_body): should not add old object count.
  This code is completely my misunderstanding.
* gc.c (rb_gc_force_recycle): decrement young or old object count
  correctly.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-03 03:55:04 +00:00
normal fae18c95be remove empty rb_gc_mark_parser function
* parse.y (rb_gc_mark_parser): remove, empty since r8758
* internal.h: ditto, not usable from extensions since 2.0.0
* gc.c (gc_mark_roots): remove checkpoint for parser

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-29 19:49:22 +00:00
nobu e434a3f280 gc.c: fix typo
* gc.c (objspace_malloc_increase): fix typo.
  "increase" not "incraese".

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-24 06:20:34 +00:00
normal 688b4cb74c gc.c (rb_free_m_tbl): mark function as static
* gc.c (rb_free_m_tbl): mark function as static
* method.h (rb_free_m_tbl): remove prototype

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46055 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-22 20:17:48 +00:00
naruse 3d6ecd45c7 fix type
struct RVALUE.file is const char*.
struct RVALUE.line is int.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-18 11:02:43 +00:00
ko1 a86d454538 * gc.c (gc_marks, gc_marks_body): increase the counter of young objects
at the major GC because AGE2Promotion changes all old objects into
  young objects at major GC.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-16 08:41:06 +00:00
ko1 be5ed87c2f * gc.c (gc_before_sweep): heap_pages_swept_slots should contains
heap_pages_increment.
  For example, GC by exceeding malloc_limit can remain
  heap_pages_increment.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-16 08:38:04 +00:00
nobu 27082c9dfa * gc.c (heap_extend_pages): fix indent.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-15 10:53:40 +00:00
ko1 bceb547077 * gc.c (garbage_collect_body): move gc_heap_prepare_minimum_pages()
from gc_sweep().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-15 09:58:21 +00:00