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

1185 Коммитов

Автор SHA1 Сообщение Дата
ngoto 7632a82d57 * gc.c (wmap_final_func): fix memory size shortage when realloc wmap.
Fix SEGV during finilize of WeakRef on Solaris (though the SEGV
  could occur on all OS/platforms). [ruby-dev:48779] [Bug #10646]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-25 08:33:41 +00:00
ko1 5d77730f69 * gc.c: remove unused rb_objspace_t::rgengc::old_objects_at_gc_start.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-24 09:22:42 +00:00
normal 2c2bdb8b51 GC documentation update
* gc.c (GC_HEAP_FREE_SLOTS): move definition to match use order
  (RUBY_GC_HEAP_GROWTH_SLOTS): s/factor/number of slots/

* man/ruby.1: add section for GC environment variables
  [Feature #10197]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-15 22:39:33 +00:00
ko1 85b42fe17b * ext/objspace/objspace.c: ObjectSpace.memsize_of(obj) returns
with sizeof(RVALUE). [Bug #8984]
* gc.c (obj_memsize_of): ditto.
* NEWS: add a NEWS entry.
* test/objspace/test_objspace.rb: catch up this fix.
* test/ruby/test_file_exhaustive.rb: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-15 08:54:07 +00:00
normal 856903850b gc.c (define_final0): avoid duplicate blocks
This prevents excessive memory growth when a WeakRef
is repeatedly created

* gc.c (define_final0): avoid duplicate blocks
  [Bug #10537]
* test/test_weakref.rb (test_repeated_object_leak): new test

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-13 01:28:18 +00:00
ko1 37b6f50ae5 * gc.c (gc_latest_gc_info): return :state field to show current
GC state (none/marking/sweeping).
  [Feature #10590]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-12 04:09:28 +00:00
ko1 1b6aa03eb9 * class.c (class_alloc): Strat from age == 2.
Class and Module objects can be living long life.
* iseq.c: Same for ISeq objects.
* gc.c (RVALUE_AGE_RESET): added.
* gc.c (newobj_of): allow to generate (age != 0) objects.
* gc.c (rb_copy_wb_protected_attribute): reset age for wb unprotected
  objects.
* include/ruby/ruby.h: add RUBY_TYPED_PROMOTED1 as an unrecommended
  flag.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-11 10:15:30 +00:00
nobu e580a631be use 0 for reserved
use 0 for rb_data_type_t::reserved instead of NULL, since its type
may be changed in the future and possibly not a pointer type.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-01 06:38:04 +00:00
ko1 3a26241da3 * gc.c (objspace_malloc_increase): enable lazy sweep on GC by malloc()
(malloc_increase) to make GC incrementally.
  This change can increase memory consumption. Report us if you find
  any problem.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-27 04:20:14 +00:00
nobu 606e855622 rb_id2str over rb_id2name
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-25 18:44:22 +00:00
ko1 43a5972a3e * gc.c (gc_record): add information for debug print.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-18 22:17:54 +00:00
akr 2b9191e557 * internal.h: Gather declarations in non-header files.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-18 15:13:05 +00:00
akr 7cd76ab0c5 * internal.h: Include ruby.h and ruby/encoding.h to be
includable without prior inclusion.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15 11:49:06 +00:00
nobu 7a699d8b0b gc.c: check arguments
* gc.c (default_proc_for_compat_func): check arguments number and
  type, and get rid of reentering this default proc.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-14 07:59:55 +00:00
ko1 a84b2a6afd * gc.c (gc_stat_internal): support comatible layer for
GC.stat(symbol) type acess.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-14 07:35:05 +00:00
ko1 5d5c95f28e * gc.c (gc_stat_internal): add compatible layer.
From Ruby 2.2, keys of GC.stat are changed [Feature #9924].
  To provide compatible layer, GC.stat add a default_proc
  (if default_proc of given Hash object is not set).
  At first use of this compatible layer of interpreter process,
  show a warning message like that:
  program: GC.stat[:total_allocated_object]
  warning message: "warning: GC.stat keys were changed from Ruby
  2.1. In this case,  you refer to obsolete `total_allocated_object'
  (new key is `total_allocated_objects').
  Please check <https://bugs.ruby-lang.org/issues/9924>
  for more information."
  Pleaes correct my English message :)
* hash.c (rb_hash_set_default_proc): export (in internal).
* internal.h: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48423 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-14 07:29:33 +00:00
ko1 4314ded836 * gc.c: guard by #if/#endif with GC_ENABLE_INCREMENTAL_MARK
to hide unused codes.
* gc.c: similar to GC_ENABLE_LAZY_SWEEP.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-14 01:44:57 +00:00
hsbt 30a69a5998 * gc.c: fix build error caused by implicit conversion with clang.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-13 23:12:45 +00:00
ko1 97c2eac2df * gc.c: refactoring.
* gc.c: use GC_ENABLE_INCREMENTAL_MARK instead of USE_RINCGC.
* gc.c (gc_start): check FORCE_MAJOR_GC.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-13 20:31:29 +00:00
ko1 b887f4fb45 * gc.c: Tuning RincGC parameters.
Before this patch, gc_marks_step() marks (white -> grey) fixed
  number objects. However, this strategy does not fit practical
  cases, for example too slow to make progres.
  This patch changes this strategy how many objects the
  gc_marks_step() should handle.
  We can estimate how many times gc_marks_step() is called during
  this major marking (== C) with the free slot number in pooled
  pages. We also can estimate the living object number (== L)
  using last marked_slots value. We can solve this problem (how
  many objects should be process in gc_marks_step()) by L/C.
* gc.c (rb_objspace_t): add rb_objspace_t::rincgc::pooled_sltos and
  step_slots.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-13 20:16:59 +00:00
normal 14fe2b6b4c gc.c (struct heap_page): trivial packing
304 => 296 bytes on x86-64

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-12 18:57:06 +00:00
ko1 a11aa75662 * gc.c (is_incremental_marking): use #if/#else because
rb_objspace_t:🎏:during_incremental_marking is not defined
  when GC_ENABLE_INCREMENTAL_MARK is 0.
* gc.c (will_be_incremental_marking, is_full_marking): similar fix.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-09 04:52:52 +00:00
ko1 90373dadfb * gc.c (obj_info): show T_STRING more details.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-02 17:34:51 +00:00
ko1 3edcd548f7 * gc.c: is_incremental_marking(), will_be_incremental_marking():
use `&&' with GC_ENABLE_INCREMENTAL_MARK intead of using
  #if/#else/#endif.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-27 07:02:03 +00:00
nobu 202b4bbe81 gc.c: fix no lazy sweep mode
* gc.c (gc_sweep_rest): sweep rest pages regardless of whether
  lazy sweep is enabled or not.  based on the patch by Masahiro
  Ide at [ruby-dev:48706].  [Bug #10431]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-27 04:40:13 +00:00
naruse c0766464e9 * gc.c (mark_current_machine_context) [__mc68000__]: Update stack
marking.
  (rb_gc_mark_machine_stack) [__mc68000__]: Also handle it here.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48065 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-21 02:50:23 +00:00
zzak f9deff9759 * gc.c (rb_obj_id): [DOC] Fix typo, clean up sentence, and wrap cols
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-14 19:57:24 +00:00
nobu 0ca714fa1a symbol.h: move struct RSymbol
* symbol.h (struct RSymbol): move from internal.h.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47821 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-06 13:36:45 +00:00
ktsj 90e99bea86 * gc.c (rb_gcdebug_print_obj_condition): use RVALUE_REMEMBERED
because GET_HEAP_REMEMBERSET_BITS is obsoleted.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-28 15:09:40 +00:00
nobu bb10a21346 ruby.h: deprecate plain Data
* include/ruby/ruby.h (rb_data_object_alloc_deprecated): deprecate
  Data_Make_Struct and Data_Wrap_Struct.  [EXPERIMENTAL]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47717 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-27 01:28:47 +00:00
nobu e5a3c25a69 compile.c, gc.c: suppress warnings
* compile.c (iseq_compile_each): suppress implicit conversion
  warning by old apple gcc 4.2.

* gc.c (RVALUE_FLAGS_AGE, heap_page_allocate): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-14 01:56:53 +00:00
ko1 8c6c9c46d8 * vm.c (rb_vm_register_special_exception): make new function to
make and register special exceptions.
* vm.c (rb_vm_mark): do not need to mark special exceptions
  because they are registerd by rb_gc_register_mark_object().
* eval.c (Init_eval): use rb_vm_register_special_exception().
* gc.c (Init_GC): ditto.
* proc.c (Init_Proc): ditto.
* thread.c (Init_Thread): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-11 10:53:48 +00:00
ko1 c653db51b0 * gc.c (rb_gc_mark_values): added.
This function is similar to rb_gc_mark_locations(), but not
  conservertive.
* internal.h: ditto.
* vm.c (env_mark): use rb_gc_mark_values() because env values should
  be Ruby VALUEs.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-11 10:34:09 +00:00
ko1 51101947bb * gc.c (gc_mark_ptr): rename to gc_mark_set.
* gc.c (gc_mark): add gc_mark_ptr() to skip is_markable_object()
  check. gc_mark_maybe() can use gc_mark_ptr() directly because
  passed pointer is checked by is_pointer_to_heap().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-11 10:23:36 +00:00
ko1 970d8cb613 * include/ruby/ruby.h, gc.c: add new internal events
RUBY_INTERNAL_EVENT_GC_ENTER and
  RUBY_INTERNAL_EVENT_GC_EXIT.
  When invoking GC process, GC_ENTER event is called.
  When exiting from GC process, GC_EXIT event is called.
  Incremental GC (incremental marking and lazy sweep) can call
  these events many times.
  For example (minor marking):
  (1) GC_ENTER
  - (2) GC_START (minor GC)
    (minor marking)
  - (3) GC_END_MARK
    (start lazy sweep)
  (4) GC_EXIT
    (ruby process)
  (5) GC_ENTER
    (lazy sweep)
  (6) GC_EXIT
    (ruby process)
    (... repeat (5), (6))
  (7) GC_ENTER
      (finish lazy sweep)
    - (8) GC_END_SWEEP
  (9) GC_EXIT
  2nd example (incremental major marking):
  (1) GC_ENTER
  - (2) GC_START (minor GC)
    (start incremental marking)
  (3) GC_EXIT
    (ruby process)
  (4) GC_ENTER
    (incremental marking)
  (5) GC_EXIT
     (ruby process)
     (... repeat (4), (5))
  (6) GC_ENTER
    (finish incremental marking)
  - (7) GC_END_MARK
    (start lazy sweep)
  (8) GC_EXIT
    (ruby process)
  (9) GC_ENTER
    (lazy sweep)
  (10) GC_EXIT
    (ruby process)
    (... repeat (9), (10))
  (11) GC_ENTER
    (finish lazy marking)
  - (12) GC_STOP_SWEEP
  (13) GC_EXIT
  Thease internal events enable to measure GC pause time completely.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-11 08:46:59 +00:00
ko1 cc3088ea51 * include/ruby/ruby.h: freeze nil/true/false.
* gc.c (should_be_finalizable): check frozen after checkin FL_ABLE.
* object.c (rb_obj_taint): check
  OBJ_TAINTABLE(obj).
* object.c (rb_obj_freeze): remove immediate_frozen_tbl
   because all of immediate values are frozen. YAY!
* object.c (rb_obj_frozen_p): ditto.
* test/ruby/test_eval.rb: skip instance_variable_set for
  frozen objects.
* test/ruby/test_weakmap.rb: check ArgumentError instead of
  RuntimeError.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-11 05:37:32 +00:00
nobu 24974c0ea1 gc.c: preserve encoding
* gc.c (should_be_callable): preserve encoding of class name in
  error messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-10 08:22:03 +00:00
ko1 c1b05c53b7 * gc.c (gc_stat): update rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-10 02:59:46 +00:00
ko1 52c41f1e8f * gc.c (gc_stat_internal): rename:
* malloc_increase -> malloc_increase_bytes
  * malloc_limit -> malloc_increase_bytes_limit
  * oldmalloc_increase -> oldmalloc_increase_bytes
  * oldmalloc_limit -> oldmalloc_increase_bytes_limit
  ref: [Feature #9924]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-10 02:53:11 +00:00
ko1 ed729d3986 * gc.c (gc_stat_internal): rename `heap_used' to `heap_allocated_pages'.
ref: [Feature #9924]
* test/ruby/test_gc.rb: add constraints test for gc stat information.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-10 02:47:05 +00:00
ko1 6b398398b9 * gc.c (gc_stat_internal): rename:
* remembered_shady_object -> remembered_wb_unprotected_objects
  * remembered_shady_object_limit -> remembered_wb_unprotected_objects_limit
  * old_object -> old_objects
  * old_object_limit -> old_objects_limit
  ref: [Feature #9924]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47491 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-10 02:35:17 +00:00
ko1 2d581d6c2a * gc.c (gc_stat_internal): support:
* total_allocated_pages
  * total_freed_pages
  ref: [Feature #9924]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-10 02:13:41 +00:00
ko1 6c6254274f * gc.c (objspace_total_slot): rename objspace_available_slots.
* gc.c (objspace_live_slot, objspace_free_slot): rename
  ..._slot() to ..._slots().
* gc.c (objspace_free_slot): should subtract heap_pages_final_slots.
* gc.c (gc_stat_internal):
  * add `heap_available_slots' field
  * rename heap_live_slot to heap_live_slots
  * rename heap_free_slot to heap_free_slots
  ref: [Feature #9924]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-10 01:42:09 +00:00
ko1 6b4a7aa2a6 * gc.c: refactoring for RGENGC_PROFILE > 0.
* rename rb_objspace_t::profile::..._count
    to rb_objspace_t::profile::total_..._count
  * rename promote_infant_types to promote_types
* gc.c (gc_remember_unprotected): count remembered shady objects here.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-09 22:32:09 +00:00
nagachika 9aacc92bc9 * gc.c (init_mark_stack): MEMZERO() receive type as 2nd argument instead
of size.
  Coverity Scan found this bug.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-09 18:23:11 +00:00
kazu 5623c00f4b s/stressfull/stressful/g
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-09 13:09:14 +00:00
ko1 9b6bc26f87 * gc.c: rename rb_objspace_t::marked_objects to marked_slots.
* gc.c (gc_marks_start): should be clear first.
* gc.c (gc_marks_start): remembered shady objects are also marked.
* gc.c (gc_stat_internal): add heap_marked_slots.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-09 10:55:18 +00:00
ko1 97fef1cdfb * gc.c: rename
* total_allocated_object_num -> total_allocated_objects
  * total_allocated_object_num_at_gc_start -> total_allocated_objects_at_gc_start
  * total_freed_object_num -> total_freed_objects
* gc.c (gc_stat_internal):
  * rename total_allocated_object -> total_allocated_objects
  * rename total_freed_object -> total_freed_objects



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-09 10:01:18 +00:00
ko1 727497607c * gc.c (gc_stat_internal): fix symbol names
* heap_final_slot -> heap_final_slots
  * heap_swept_slot -> heap_swept_slots



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-09 09:53:47 +00:00
ko1 8ee9071cbe * gc.c (rb_objspace_t::heap_pages): rename field names:
* used -> allocated_pages
  * increment -> allocatable_pages
  * length -> sorted_length
  And remove unused `limt' field.
* gc.c: rename macros:
  * heap_pages_used -> heap_allocated_pages
  * heap_pages_length -> heap_pages_sorted_length
  * heap_pages_increment -> heap_allocatable_pages
* gc.c (gc_stat_internal): fix symbol names
  ref: [Feature #9924]
  https://docs.google.com/spreadsheets/d/11Ua4uBr6o0k-nORrZLEIIUkHJ9JRzRR0NyZfrhEEnc8/edit?usp=sharing
  Yellow color fields in this table are changed.
* test/ruby/test_gc.rb: catch up this change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47471 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-09 09:33:52 +00:00