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

1090 Коммитов

Автор SHA1 Сообщение Дата
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
ko1 8d81c976aa * gc.c (heap_extend_pages): calculate next growing heap size.
* gc.c (heap_set_increment): accept addition pages instead of
  minimum pages.
* gc.c (gc_after_sweep): use heap_etend_pages().
* gc.c (gc_heap_prepare_minimum_pages): add only 1 page.
* gc.c (heap_ready_to_gc): add only 1 page.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-15 09:54:49 +00:00
ko1 28a180ed2f * gc.c: introduce macros to remove magic number.
GC_HEAP_FREE_SLOTS_MIN_RATIO = 0.3: guarantee minimum empty slots
                                      ratio after sweep.
  GC_HEAP_FREE_SLOTS_MAX_RATIO = 0.8: allow to free pages 0.2 (= 1-0.8)
                                      of current existing slots.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45948 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-15 09:43:18 +00:00
ko1 1b03f51f82 * gc.c: enable RGENGC_AGE2_PROMOTION.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-14 09:04:27 +00:00
ko1 b4d9f9ca1d * gc.c (rgengc_rememberset_mark): promote remembered object earlier.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45942 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-14 09:03:17 +00:00
ko1 8be5c76f06 * gc.c: count young object correctly and show it in GC.stat
on RGENGC_AGE2_PROMOTION.
* gc.c (RVALUE_PROMOTE_YOUNG): decrement young object count on
  YOUNG->OLD.
* gc.c (obj_free): decrement young object count when young object
  freed.
* gc.c (gc_marks): should not clear young object count.
* gc.c (gc_stat_internal): GC.stat :young_object information.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-12 10:57:11 +00:00
nobu d4d045850b gc.c: fix argument types for st_foreach
* gc.c ({free,mark}_{method,const}_entry_i): fix argument types as
  st_data_t for st_foreach().

* gc.c (rgengc_unprotect_logging_exit_func_i): add third argument.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-07 15:43:37 +00:00
nari ca319081ce * gc.c (gc_after_sweep): suppress unnecessary expanding heap.
Tomb heap pages are freed pages here, so expanding heap is
  not required.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-30 10:58:45 +00:00
nari ec0cfc3a31 * gc.c: This argument must be a pointer.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-28 08:46:36 +00:00
nari 6ee891d6a7 * gc.c: Fix typos. These are undefined variables.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-28 08:46:33 +00:00
ko1 d32ad2efca * gc.c (objspace_malloc_increase): don't cause GC by malloc_increase
when memop type is MEMOP_TYPE_REALLOC.
  GC at realloc is not well maintained.
  We need a time to make it safe.
  [ruby-dev:48117]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-21 23:37:18 +00:00
nobu 5890cb9d2d gc.c: full mark after malloc/realloc
* gc.c (objspace_malloc_increase): run full mark if 0x04 bit is
  set in ruby_gc_stress.  [ruby-core:62103] [Feature #9761]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-21 21:54:17 +00:00
nobu a633ed2812 gc.c: GC.stress after realloc
* gc.c (objspace_malloc_increase): run GC after realloc not only
  malloc and calloc by GC.stress.  [ruby-core:62103] [Feature #9761]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-21 21:53:48 +00:00
nobu 6f3bd427e7 gc.c: fixnum GC stress
* gc.c (garbage_collect_body): name magic numbers.

* gc.c (gc_stress_set): GC.stress accepts not only boolean but
  also Fixnum.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-21 00:39:43 +00:00
normal 1d2d053bda gc.c: drop special case for big hash/array
* gc.c (rb_gc_writebarrier): drop special case for big hash/array
  [Bug #9518]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-19 21:24:45 +00:00
nobu be116626dd gc.c: suppress a warning
* gc.c (get_envparam_size): suppress a warning by char-subscripts.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-17 08:24:10 +00:00
nobu 4b86cf6e98 gc.c: no newline to rb_bug
* gc.c: no newline in messages for rb_bug, it outputs a newline
  after the message.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-11 01:31:06 +00:00
ko1 be51200785 * gc.c (gc_verify_internal_consistency): move lines and enable
allrefs_dump() on RGENGC_CHECK_MODE >= 4.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-10 10:01:16 +00:00
ko1 ddffb9bb9b * gc.c (rb_gc_writebarrier_unprotect_promoted): disable to dump debug
message when RGENGC_CHECK_MODE == 0.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-10 05:41:41 +00:00
nobu 4a0e3ccf28 gc.c: check rgengc_report argument
* gc.c (rgengc_report): use __VA_ARGS__ if possible.

* gc.c (rgengc_report_body): check argument.

* gc.c (heap_page_allocate): fix missing argument.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-10 03:40:34 +00:00
nobu 04de1d7dfe gc.c: do nothing unless USE_RGENGC
* gc.c (gc_verify_internal_consistency): always do nothing unless
  USE_RGENGC is set, no local variable needed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-10 03:40:32 +00:00
nobu 1a00d07619 gc.c: adjust indent
* gc.c (RVALUE_DEMOTE_FROM_YOUNG, RVALUE_DEMOTE_FROM_OLD): adjust
  indent.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-10 03:40:30 +00:00
akr 3f05ee0f42 Add comment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-09 14:32:01 +00:00
akr 8a8221e69d * gc.c (mark_current_machine_context): Call SET_STACK_END.
This reverts a hunk of r40703 by ko1.
  This fixes [ruby-dev:48098] [Bug #9717].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-09 14:30:46 +00:00
ko1 bdf4eb0615 * gc.c: rename `RGENGC_THREEGEN' to `RGENGC_AGE2_PROMOTION'.
* gc.c (rgengc_rememberset_mark): don't promote, but remain in
  remember set for infant objects.
* gc.c (RVALUE_PROMOTE_INFANT, RVALUE_PROMOTE_YOUNG): count numbers
  in these functions.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-08 13:36:02 +00:00
ko1 37067ed905 * gc.c, gc.h (rb_objspace_each_objects_without_setup):
Add a new (hidden) C-API to iterate objspace snapshot.
  This API is not safe to call any C-APIs in a given callback
  function. Be careful to use this C-API.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-02 11:59:50 +00:00
nobu a92374677c gc.c: avoid inadvertent pin-down
* gc.c (gc_info_decode): get rid of inadvertent dynamic symbol
  pin-down, and preserve encoding in error messages.  also should
  not use RSTRING_PTR macro on function calls.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-30 21:55:59 +00:00
ko1 835186a322 * gc.c (gc_before_sweep): cap `malloc_limit' to
gc_params.malloc_limit_max.  It can grow and grow with such case:
    `loop{"a" * (1024 ** 2)}'
  [Bug #9687]
  This issue is pointed by Tim Robertson.
  http://www.omniref.com/blog/blog/2014/03/27/ruby-garbage-collection-still-not-ready-for-production/



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-29 04:37:06 +00:00
nari 90b7073842 * parse.y: support Symbol GC. [ruby-trunk Feature #9634]
See this ticket about Symbol GC.

* include/ruby/ruby.h:
  Declare few functions.
  * rb_sym2id: almost same as old SYM2ID but support dynamic symbols.
  * rb_id2sym: almost same as old ID2SYM but support dynamic symbols.
  * rb_sym2str: almost same as `rb_id2str(SYM2ID(sym))` but not
    pin down a dynamic symbol.
  Declare a new struct.
  * struct RSymbol: represents a dynamic symbol as object in
    Ruby's heaps.
  Add few macros.
  * STATIC_SYM_P: check a static symbol.
  * DYNAMIC_SYM_P: check a dynamic symbol.
  * RSYMBOL: cast to RSymbol

* gc.c: declare RSymbol. support T_SYMBOL.

* internal.h: Declare few functions.
  * rb_gc_free_dsymbol: free up a dynamic symbol. GC call this
    function at a sweep phase.
  * rb_str_dynamic_intern: convert a string to a dynamic symbol.
  * rb_check_id_without_pindown: not pinning function.
  * rb_sym2id_without_pindown: ditto.
  * rb_check_id_cstr_without_pindown: ditto.

* string.c (Init_String): String#intern and String#to_sym use
  rb_str_dynamic_intern.

* template/id.h.tmpl: use LSB of ID as a flag for determining a
  static symbol, so we shift left other ruby_id_types.

* string.c: use rb_sym2str instead `rb_id2str(SYM2ID(sym))` to
  avoid pinning.

* load.c: use xx_without_pindown function at creating temporary ID
  to avoid pinning.

* object.c: ditto.

* sprintf.c: ditto.

* struct.c: ditto.

* thread.c: ditto.

* variable.c: ditto.

* vm_method.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26 04:57:47 +00:00
hsbt 23d790e46f gc.c: Fix up default GC params by @csfrancis [fix GH-556]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-24 05:28:03 +00:00
zzak 27b9d591a5 * gc.c: [DOC] Fix call-seq for GC.start by @jasonrclark [Fixes GH-572]
https://github.com/ruby/ruby/pull/572 [ci skip]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-21 07:33:03 +00:00
ko1 3e20c50d50 * gc.c (objspace_malloc_increase): should not invoke
garbage_collect_with_gvl() here on non-ruby threads.
  Should just ignore the malloc_increase.
  This issue is pointed by Eric Wong [ruby-core:61519].



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-20 08:05:35 +00:00
normal f5c2e89cd4 gc.c (objspace_xcalloc): fix GC accounting
This hopefully works on all platforms with malloc_usable_size.
This may also trigger bugs in places which did not expect GC, too;
so maybe some existing code will need RB_GC_GUARD.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-15 23:06:32 +00:00
nobu 1b9ff04f65 object.c: [DOC] merge rdoc
* gc.c (rb_obj_id): remove unused rdoc.

* object.c (rb_obj_hash): [DOC] merge unused rdoc from rb_obj_id()
  in gc.c.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45338 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-15 00:08:24 +00:00