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

1076 Коммитов

Автор SHA1 Сообщение Дата
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
nobu fc23374f06 [DOC] add links to `Object#hash`
add links to `Object#hash` to each #`hash` methods rdocs.
[Fixes GH-567]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-14 01:27:43 +00:00
normal 44f58afa75 gc.c: simplify condition
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-01 10:08:10 +00:00
normal 8b5fddab28 gc.c: fix build for testing w/o RGenGC
* gc.c (ruby_gc_set_params): fix building without RGenGC

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-01 07:15:07 +00:00
nobu cc216f9aae adjust indent and style
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-27 07:10:14 +00:00
ko1 8467d86f8a * gc.c (heap_pages_free_unused_pages): check tomb page availability
at first.
  And return immediately if we don't touch sorted list any more.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-26 09:46:45 +00:00
nobu c0ea69d544 gc.c: suppress warnings
* gc.c (gc_marks): cast explicitly to suppress warnings by VC.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-22 02:56:55 +00:00
normal 08252d18a3 gc.c: RB_GC_GUARD should be robust enough for any compiler
* include/ruby/ruby.h (RB_GC_GUARD):
  use rb_gc_guarded_ptr_val on non-GCC/MSC
* gc.c (rb_gc_guarded_ptr_val): rename and adjust argument.
  RB_GC_GUARD should be robust enough for any compiler.
  [ruby-core:60816] [Bug #7805]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-20 23:45:55 +00:00
ko1 1aebaf7355 * gc.c (get_envparam_double): fix a warning message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-17 03:33:03 +00:00
ko1 3ee0444955 * gc.c: introduce new environment variable
"RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR" to control major/minor GC
  frequency.
  Do full GC when the number of old objects is more than R * N
  where R is this factor and
                N is the number of old objects just after last full GC.
* test/ruby/test_gc.rb: add a test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-17 03:27:13 +00:00
akr 3c99764bcd * internal.h: Rename macro names: RBIGNUM_FOO to BIGNUM_FOO.
(BIGNUM_EMBED_LEN_NUMBITS): Renamed from RBIGNUM_EMBED_LEN_NUMBITS.
  (BIGNUM_EMBED_LEN_MAX): Renamed from RBIGNUM_EMBED_LEN_MAX.
  (BIGNUM_SIGN_BIT): Renamed from RBIGNUM_SIGN_BIT.
  (BIGNUM_SIGN): Renamed from RBIGNUM_SIGN.
  (BIGNUM_SET_SIGN): Renamed from RBIGNUM_SET_SIGN.
  (BIGNUM_POSITIVE_P): Renamed from RBIGNUM_POSITIVE_P.
  (BIGNUM_NEGATIVE_P): Renamed from RBIGNUM_NEGATIVE_P.
  (BIGNUM_EMBED_FLAG): Renamed from RBIGNUM_EMBED_FLAG.
  (BIGNUM_EMBED_LEN_MASK): Renamed from RBIGNUM_EMBED_LEN_MASK.
  (BIGNUM_EMBED_LEN_SHIFT): Renamed from RBIGNUM_EMBED_LEN_SHIFT.
  (BIGNUM_LEN): Renamed from RBIGNUM_LEN.
  (RBIGNUM_DIGITS): Renamed from RBIGNUM_DIGITS.
  (BIGNUM_LENINT): Renamed from RBIGNUM_LENINT.

* bignum.c: Follow the above change.

* gc.c: Ditto.

* marshal.c: Ditto.

* math.c: Ditto.

* numeric.c: Ditto.

* random.c: Ditto.

* rational.c: Ditto.

* sprintf.c: Ditto.

* ext/-test-/bignum/bigzero.c: Ditto.

* ext/-test-/bignum/intpack.c: Ditto.

* ext/bigdecimal/bigdecimal.c: Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-15 21:17:34 +00:00
akr 6f8b0e9bb0 * include/ruby/intern.h,
include/ruby/io.h,
  include/ruby/ruby.h,
  include/ruby/win32.h,
  include/ruby/backward/rubysig.h,
  bignum.c,
  gc.c,
  io.c,
  process.c,
  safe.c,
  struct.c,
  thread.c,
  ext/socket/rubysocket.h,
  ext/-test-/old_thread_select: Remove deprecated definitions
  [ruby-core:60581] [Feature #9502]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-14 15:16:31 +00:00
nobu aff08cfcd7 gc.c: unit suffix
* gc.c (get_envparam_size): accept unit suffix 'k', 'm', and 'g'.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44936 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-14 05:04:07 +00:00
ko1 c6f2c9383f * gc.c, gc.h (rb_objspace_marked_object_p): added.
This function *ONLY* works just after marking phase,
  before any sweeping.
  This function is highly depending current GC implementation
  and can be removed future version.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-08 07:03:43 +00:00
nobu 5fe0030d02 gc.c: ignore empty strings
* gc.c (get_envparam_size, get_envparam_double): silently ignore empty
  strings, without any warnings regardless $VERBOSE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-07 02:02:58 +00:00