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

1090 Коммитов

Автор SHA1 Сообщение Дата
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
nobu 9ba0b76fb3 gc.c: revert return
* gc.c (get_envparam_size): revert `return` statement removed by
  accident.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-07 01:59:16 +00:00
nobu 38b57c2915 gc.c: use size_t
* gc.c (ruby_gc_params_t, get_envparam_size): use size_t for
  integer environment parameters for sizes.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-07 01:54:26 +00:00
nobu d4bbc2d776 gc.c: check numeric string
* gc.c (get_envparam_int, get_envparam_double): check invalid string
  as numeric.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-06 11:49:14 +00:00
ko1 b31c66f7af * gc.c (get_envparam_int): correct warning messsages.
* gc.c (get_envparam_double): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-06 06:28:40 +00:00
ko1 cb410ff932 * gc.c (get_envparam_int): don't accept a value equals to lowerbound
(changed by last commit) because "" or "foo" (not a number) strings
  are parsed as 0. They should be rejected.
* gc.c (get_envparam_double): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-06 06:26:01 +00:00
ko1 f167bc403d * gc.c (ruby_gc_set_params): if RUBY_GC_OLDMALLOC_LIMIT is provided,
then set objspace->rgengc.oldmalloc_increase_limit.
  Without this fix, the env variable RUBY_GC_OLDMALLOC_LIMIT
  does not work.
* gc.c (get_envparam_int): accept a value equals to lowerbounds.
* gc.c (get_envparam_double): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-06 00:04:14 +00:00
ko1 906e88e376 * gc.c (gc_mark_children): STR_ASSOC is no longer available.
Reported by @nagachika.
  http://d.hatena.ne.jp/nagachika/20140204



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-05 02:49:41 +00:00
nobu 628f75b752 vm_core.h: rb_thread_struct::machine
* vm_core.h (rb_thread_struct): aggregate cpu stuff into a struct,
  so that a debugger can show its content at once.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-28 06:09:58 +00:00
hsbt 689755a1ad * gc.c: fix typo by @windwiny [fix GH-506]
*  proc.c: ditto
*  variable.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-19 05:43:28 +00:00
tmm1 9bfaeffd53 gc.c: fix doc typo
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-10 04:13:04 +00:00
marcandre e5839862e4 * gc.c: Oups, symbols are immediates too
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-09 17:49:31 +00:00
marcandre 705f9a7e80 * gc.c: Supplement object_id's rdoc for immediate and frozen string litterals
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-09 17:34:39 +00:00
marcandre cc366241ce * gc.c: Fix and remove outdated rdoc for object_id
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-09 17:34:27 +00:00
ko1 94e870b000 * gc.c (ruby_gc_set_params): don't show obsolete warnings for
RUBY_FREE_MIN/RUBY_HEAP_MIN_SLOTS if
  RUBY_GC_HEAP_FREE_SLOTS/RUBY_GC_HEAP_INIT_SLOTS are given.
  [Bug #9276]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-21 19:11:12 +00:00
ko1 0a8c1142b0 * gc.c (heap_get_freeobj): improve hot path performance.
* gc.c (heap_get_freeobj_from_next_freepage): replace with
  heap_get_freepage(). It returns freeobj instead of freepage.
  This is not on hot path.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-19 05:04:55 +00:00
ko1 9797647e25 * gc.c (newobj_of): don't need to RBASIC_SET_CLASS() which includes WB
here because created obj is always YOUNG/INFANT.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44284 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-19 01:51:16 +00:00
tmm1 3f8deb966c gc.c: remove redundant freelist assignment
* gc.c (heap_get_freeobj): remove redundant assignment. heap->freelist
  is set after the while() loop already.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-18 18:11:54 +00:00
ko1 d767adf990 * gc.c (garbage_collect_body): lazy_sweep setting should work
without USE_RGENGC.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-18 15:27:41 +00:00
ko1 a0a1d0f268 * gc.c (gc_profile_dump_major_reason): fix this function because major_reason
can be OR of multiple reasons.
* gc.c (gc_profile_dump_on): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-18 14:34:23 +00:00
ko1 661cf78bef * gc.c (gc_profile_record_get): should return an empty array
when profiling is active.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-18 08:04:08 +00:00
ko1 7bdb9fe17f * gc.c (gc_profile_clear, gc_profile_enable): remove rest_sweep().
* gc.c: check objspace->profile.current_record before inserting
  profiling record by new macro gc_prof_enabled().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-18 07:58:04 +00:00
nobu 5ea9849fd0 gc.c: prototype
* gc.c (gc_finalize_deferred_register): define in prototype style,
  instead of old K&R style.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44256 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-17 05:29:14 +00:00
ko1 9ae9f7c9d3 * gc.c (rb_objspace_markable_object_p): should check special_const_p
first (by is_markable_object()).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-16 10:22:03 +00:00
ko1 8d254db25b * gc.c (gc_verify_internal_consistency): should not use
rb_objspace_each_objects() because it call rest_sweep().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-16 09:19:24 +00:00
ko1 1a209e496d * gc.c (rb_objspace_markable_object_p): fix last commit (build error).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-16 09:07:52 +00:00
ko1 1779f77fbb * gc.c (rb_objspace_markable_object_p): it should be live objects.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-16 09:05:57 +00:00
ko1 60b7bd2ea3 * gc.c (rb_objspace_each_objects): should not clear dont_lazy_sweep
flag in nested case.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-16 09:01:49 +00:00
ko1 c979a67bb4 * gc.c: use gc_verify_internal_consistency() instead of
gc_check_before_marks_i() for check consistency
  on RGENGC_CHECK_MODE >= 2.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-16 05:18:21 +00:00
ko1 dfa892af43 * gc.c: introduce GC.verify_internal_consistency method to verify GC
internal data structure.
  Now this method only checks geneartion (old/young) consistency.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-16 04:12:48 +00:00
tmm1 99df7a1b5b gc.c: fix build with RGENGC_ESTIMATE_OLDMALLOC=0
* gc.c (gc_info_decode): Fix build errors wheb compiled with
	  RGENGC_ESTIMATE_OLDMALLOC=0
	* gc.c (objspace_malloc_increase): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-16 02:50:45 +00:00
tarui 71286e3770 * gc.c (wmap_final_func): Bugfix. Should update *value to new pointer.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-13 16:19:49 +00:00
tmm1 3ba2006aa4 gc.c: GC.latest_gc_info reports most interesting major_by flag
* gc.c (gc_info_decode): Use :major_by=>:nofree as fallback reason
	  when other trigger conditions are present.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-13 07:30:33 +00:00
ko1 c700511888 * gc.c (garbage_collect_body): use rb_bug() and explicit error message
instead of using assert().
  [Bug #9222]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-13 03:02:03 +00:00
ko1 55a77f29c1 * gc.c: rename *shady* func/macros.
* RVALUE_RAW_SHADY()   -> RVALUE_WB_PROTECTED_RAW()
  * RVALUE_SHADY()       -> RVALUE_RAW_SHADY()
  * rgengc_check_shady() -> rgengc_check_relation().
  And fix some messages using "shady" to "non-WB-protected".



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-13 02:38:05 +00:00
nobu 89b8502257 gc.c: no deletion in wmap_mark
* gc.c (wmap_mark): disable deletion of dead objects by default,
  so that WeakMap can be non-shady.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44149 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-12 07:43:36 +00:00
tmm1 3282b8d10e gc.c: fix typo (RVALUE_OLDEGN_BITMAP -> RVALUE_OLDGEN_BITMAP)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-12 04:43:14 +00:00
nobu 86e2038c27 gc.c: live keys only
* gc.c (wmap_keys): return keys for live objects only, like as
  wmap_values.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-12 02:01:18 +00:00
nobu cdc2eeda6a gc.c: simple array for wmap
* gc.c (wmap_finalize, wmap_aset_update): use simple malloced array
  instead of T_ARRAY, to reduce GC pressure.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-10 08:21:33 +00:00
nobu 27947a449f gc.c: use st_update
* gc.c (wmap_aset): use st_update instead of st_lookup and
  st_insert.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-10 07:16:08 +00:00
nobu bcdad3299b gc.c: ruby_sized_xrealloc2
* gc.c (ruby_sized_xrealloc2): reallocate from old size.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-10 07:16:06 +00:00
tmm1 40d7c9c18b gc.c: speed up RGENGC_CHECK_MODE by removing unncessary check
* gc.c (reflist_add): revert changes from r44109. it is unnecessary
  after r44113
* gc.c (allrefs_i): fix whitespace
* gc.c (allrefs_roots_i): fix whitespace

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44114 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-10 06:58:48 +00:00
ko1 1b29c00f00 * gc.c (allrefs_add): push obj only if allrefs table doesn't have
obj.
* gc.c (allrefs_roots_i): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-10 06:47:15 +00:00
ko1 14979f2161 * gc.c (RGENGC_CHECK_MODE): separate checkers to different modes.
* 2: enable generational bits check (for debugging)
  * 3: enable livness check
  * 4: show all references



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-10 06:44:35 +00:00
nobu 13dee2481b * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-10 06:26:05 +00:00
ko1 8d4253f7e1 * gc.c (gc_marks_check): disable GC during checking and
restore malloc_increase info.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-10 06:21:52 +00:00
tmm1 3705007e7a gc.c: build complete object graph for RGENGC_CHECK_MODE
* gc.c (reflist_add): return 0 if reference already exists
	* gc.c (allrefs_add): return 1 on newly added references
	* gc.c (allrefs_i): follow references to construct complete object
	  graph. before this patch, RGENGC_CHECK could fail to verify some WB
	  miss issues. [Bug #9226] [ruby-core:58959]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-10 05:46:48 +00:00
nobu 0326725b24 gc.c: check arguments first
* gc.c (wmap_aset): check if both arguments are able to finalize
  before setting finalizers.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-10 05:17:19 +00:00
nobu 9bd802f556 gc.c: fix WeakMap#inspect
* gc.c (wmap_inspect_i): fix key/value order.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-10 05:02:17 +00:00
tmm1 332decb490 gc.c: fix typo in function name
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-10 03:25:28 +00:00
tmm1 7170baa878 objspace_dump.c: include object's gc flags in dump
* ext/objspace/objspace_dump.c (dump_object): include fstring flag on
  strings. include gc flags (old, remembered, wb_protected) on all objects.
* ext/objspace/objspace_dump.c (Init_objspace_dump): initialize lazy
  IDs before first use.
* gc.c (rb_obj_gc_flags): new function to retrieve object flags
* internal.h (RB_OBJ_GC_FLAGS_MAX): maximum flags allowed for one obj
* test/objspace/test_objspace.rb (test_dump_flags): test for above
* test/objspace/test_objspace.rb (test_trace_object_allocations):
  resolve name before dump (for rb_class_path_cached)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-10 02:26:09 +00:00
nobu d2cc188ad5 gc.c: ObjectSpace::WeakMap#size
* gc.c (wmap_size): add ObjectSpace::WeakMap#size and #length.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44093 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-09 07:13:40 +00:00
tmm1 8f77cfb308 gc.c: promote long-lived NODE_CREF objects to oldgen
* include/ruby/ruby.h: add RGENGC_WB_PROTECTED_NODE_CREF setting
  In a large app, this reduces the size of
  remembered_shady_object_count by 80%. [Bug #9225] [ruby-core:58947]
* gc.c (rb_node_newnode): add FL_WB_PROTECTED flag to NODE_CREF
* class.c (rewrite_cref_stack): insert OBJ_WRITE for NODE_CREF
* iseq.c (set_relation): ditto
* iseq.c (rb_iseq_clone): ditto
* vm_eval.c (rb_yield_refine_block): ditto
* vm_insnhelper.c (vm_cref_push): ditto
* vm_insnhelper.h (COPY_CREF): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-08 02:28:04 +00:00
charliesome 0aada28159 * gc.c (gc_mark_children): use nd_clss and nd_next for code clarity
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-07 13:01:17 +00:00
ko1 b91e889c34 * gc.c: change oldmalloc meaning.
Increase oldmalloc_increase with malloc_increase
  instead of using obj_memsize_of().
  This change will avoid the danger of memory full without major GC.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-06 10:27:02 +00:00
ko1 f09058b877 * gc.c (atomic_sub_nounderflow): not 0 but val itself.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-06 10:09:38 +00:00
ko1 e4720e1118 * gc.c (rb_objspace_alloc, Init_heap): initialize
oldmalloc_increase_limit at Init_heap.
  rb_objspace_alloc() is not called on some platforms.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-06 09:38:22 +00:00
ko1 2c616737e5 * gc.c (garbage_collect_body): bug fix.
initialize after recording.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-06 09:34:26 +00:00
ko1 cb62399d90 * gc.c (atomic_sub_nounderflow): added to simplify atomic sub with
care about underflow.
* gc.c (objspace_malloc_increase): use it.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-06 08:53:47 +00:00
nobu b9cafaf524 vm_insnhelper.c: rb_get_kwargs
* vm_insnhelper.c (rb_get_kwargs): get keyword argument values from an
  option hash, not only checking keys.
* dir.c (dir_initialize): use rb_get_kwargs.
* gc.c (gc_start_internal): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-06 08:10:47 +00:00
nobu 761e9c518f gc.c: indent
* gc.c (gc_start_internal): adjust indent.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44032 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-06 07:47:29 +00:00
ko1 0e20c2afa8 * gc.c (gc_start_internal): do not use rb_gc_start() and rb_gc().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44031 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-06 07:22:25 +00:00
ko1 73d6dc252d * gc.c (gc_start_internal, rb_gc): do not need
heap_pages_free_unused_pages() here.
  It was done in after_sweep().
* gc.c (rb_gc): The reason is now GPR_FLAG_CAPI.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-06 06:26:02 +00:00
tmm1 e6237c8243 gc.c: add note about experimental nature of new GC.start flags
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-06 05:32:11 +00:00
tmm1 470c9d844b gc.c: add minor marking and lazy sweeping options to GC.start
* gc.c (gc_start_internal): GC.start() now accepts two optional
  keyword arguments. These can be used to disable full_mark (minor
  mark only) or disable immediate_sweep (use lazy sweep). These new
  options are useful for benchmarking GC behavior, or performing minor
  GC out-of-band.
* test/ruby/test_gc.rb (class TestGc): tests for new options.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-06 05:11:51 +00:00
nobu 928c99944b * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-05 12:49:07 +00:00
tmm1 941e36d3db gc.c: [DOC] minor typo
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-05 12:34:39 +00:00
ko1 b9cf1033aa * gc.c (gc_info_decode): fix to avoid syntax error on VS2012.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44012 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-05 12:06:59 +00:00
tmm1 4876dd3fb1 gc.c: add GC.latest_gc_info()
* gc.c (struct rb_objspace): rename internal last_collection_flags to
  latest_gc_info
* gc.c (gc_latest_collection_info): add GC.latest_gc_info() with similar
  behavior to GC.stat()
* gc.c (rb_gc_latest_gc_info): new c-api for above
* gc.c (gc_stat_internal): remove :last_collection_flags from GC.stat
* gc.c (gc_profile_decode_flags): remove GC::Profiler.decode_flags
* include/ruby/intern.h (rb_gc_latest_gc_info): export new c-api
* test/ruby/test_gc.rb (class TestGc): test for new behavior
* NEWS: note about new api

* gc.c (gc_stat_internal): raise TypeError on wrong type
* gc.c (gc_stat): fix error message

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-05 10:30:38 +00:00
ko1 53035271a8 * gc.c: change function names vm_ prefix to objspace_ prefix.
They are objspace_ functionality.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-05 08:52:30 +00:00
tmm1 241c1a5459 gc.c: expose GC.stat() to C-api via rb_gc_stat()
* include/ruby/intern.h: add rb_gc_stat() for access to GC.stat
  variables from c-api
* gc.c (rb_gc_stat): new c-api method. accepts either VALUE hash like
  GC.stat, or VALUE symbol key and returns size_t directly. the second
  form is useful to avoid allocations, i.e. for usage inside
  INTERNAL_EVENT_GC tracepoints.
* gc.c (gc_stat): add GC.stat(:key) to return single value instead of hash
* gc.c (gc_stat_internal): helper method to retrieve single or all stat values
* test/ruby/test_gc.rb (class TestGc): test for new behavior
* NEWS: note about this new api

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44005 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-05 07:45:13 +00:00
ko1 cda7250de0 * gc.c (vm_malloc_size): added.
return malloc_usable_size() if possible.
* gc.c (MALLOC_ALLOCATED_SIZE): add new setting macro to enable
  GC.allocated_size.
  If platform supports `malloc_usable_size()' (or similar one),
  GC.allocated_size can be implemented with this function.
  Default is 0.
* gc.c (vm_xmalloc, vm_xrealloc, vm_xfree): use vm_malloc_size()
  to detect collect allocated size.
* gc.c (vm_malloc_increase): refactoring.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-05 04:54:20 +00:00
tmm1 393b9e65e9 gc.c: split GC_END event into GC_END_MARK and GC_END_SWEEP
* include/ruby/ruby.h: remove INTERNAL_EVENT_GC_END and replace with
  two new events: GC_END_MARK and GC_END_SWEEP
* gc.c (gc_after_sweep): emit GC_END_SWEEP after lazy sweep is done
* gc.c (gc_marks_body): emit GC_END_MARK at end of minor/major mark
* ext/-test-/tracepoint/tracepoint.c (struct tracepoint_track): tests
  for new events.
* test/-ext-/tracepoint/test_tracepoint.rb (class TestTracepointObj):
  ditto.
* NEWS: remove ObjectSpace.after_gc_*_hook. These are only a sample,
  and will be removed before ruby 2.1.
* ext/objspace/gc_hook.c: remove ObjectSpace.after_gc_end_hook=

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-05 04:26:04 +00:00
nobu c06f12031e gc.c: flush all deferred finalizers
* gc.c (finalize_deferred): flush all deferred finalizers while other
  finalizers can get ready to run newly by lazy sweep.
  [ruby-core:58833] [Bug #9205]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-05 01:47:12 +00:00
nobu 3e36402e7f gc.c: rb_gc_set_params
* gc.c (rb_gc_set_params): define as separate function.
  RUBY_ALIAS_FUNCTION is for simple alias only, the third parameter
  will be ignored on gcc.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-05 01:16:20 +00:00
tmm1 53e0d4666c gc.c: Load GC tuning settings earlier during boot.
* gc.c (ruby_gc_set_params): Accept safe_level argument so GC tuning
  settings can be applied before rb_safe_level() is available.
* internal.h (rb_gc_set_params): ditto.
* ruby.c (process_options): Apply GC tuning early during boot process
  so boot-time allocations can benefit. This also benefits any code
  loaded in via `ruby -r`.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-05 00:19:13 +00:00
nobu b7c6db94ae gc.c: use malloc_size
* configure.in: check malloc_size() available on BSD.
* gc.c: use malloc_size() with malloc/malloc.h on BSD.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-03 14:48:20 +00:00
tmm1 084b602d9a * include/ruby/ruby.h (struct RClass): Add wrapper struct around
RClass->m_tbl with serial. This prevents double marking method
  tables, since many classes/modules can share the same method table.
  This improves minor mark time in a large application by 30%.
* internal.h (struct method_table_wrapper): Define new
  wrapper struct with additional serial.
* internal.h (RCLASS_M_TBL_INIT): New macro for initializing method
  table wrapper and st_table.
* method.h (void rb_sweep_method_entry): Rename rb_free_m_table to
  rb_free_m_tbl for consistentcy
* .gdbinit (define rb_method_entry): Update rb_method_entry gdb helper
  for new method table structure.
* class.c: Use RCLASS_M_TBL_WRAPPER and
  RCLASS_M_TBL_INIT macros.
* class.c (rb_include_class_new): Share WRAPPER between module and
  iclass, so serial can prevent double marking.
* eval.c (rb_prepend_module): ditto.
* eval.c (rb_using_refinement): ditto.
* gc.c: Mark and free new wrapper struct.
* gc.c (obj_memsize_of): Count size of additional wrapper struct.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-03 08:11:07 +00:00
tmm1 d7009f76ef * gc.c: Expose details about last garbage collection via GC.stat.
* gc.c (gc_stat): Add :last_collection_flags for reason/trigger/type of
  last GC run.
* gc.c (gc_prof_sweep_timer_stop): Record HAVE_FINALIZE GPR even
  without GC_PROFILE_MORE_DETAIL.
* gc.c (gc_profile_flags): Add GC::Profiler.decode_flags to make sense
  of GC.stat[:last_collection_flags]
* test/ruby/test_gc.rb (class TestGc): Test for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-28 07:40:35 +00:00
ko1 9e733b9091 * gc.c (gc_mark_stacked_objects): check only when check_mode > 0.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43879 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-27 08:56:48 +00:00
tmm1 0094b7bb68 * gc.c (Init_GC): Add new GC::INTERNAL_CONSTANTS for information about
GC heap/page/slot sizing.
* test/ruby/test_gc.rb (class TestGc): test for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43877 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-27 06:57:14 +00:00
tmm1 23178d1044 * gc.c (gc_page_sweep): Fix compile warning from last commit.
* hash.c (hash_aset_str): Re-use existing variable to avoid
  unnecessary pointer dereferencing.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-27 06:24:37 +00:00
ko1 da65a3d906 * gc.c (gc_page_sweep): disable debug print.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-27 06:13:19 +00:00
ko1 5993c141f1 * gc.c (gc_stat): add new information heap_eden_page_length and
heap_tomb_page_length.
* test/ruby/test_gc.rb: fix to use GC.stat[:heap_eden_page_length]
  instead of GC.stat[:heap_length].
  This test expects `heap_eden_page_length' (used pages size).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-27 06:09:55 +00:00
tmm1 5080a75621 * gc.c: Rename rb_heap_t members:
used -> page_length
    limit -> total_slots

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-27 01:42:25 +00:00
ko1 2bfd722d80 * internal.h: do not use ruby_sized_xrealloc() and ruby_sized_xfree()
if HAVE_MALLOC_USABLE_SIZE (or _WIN32) is defined.
  We don't need these function if malloc_usable_size() is available.
* gc.c: catch up this change.
* gc.c: define HAVE_MALLOC_USABLE_SIZE on _WIN32.
* array.c (ary_resize_capa): do not use ruby_sized_xfree() with
  local variable to avoid "unused local variable" warning.
  This change only has few impact.
* string.c (rb_str_resize): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-25 01:13:31 +00:00
ko1 30e88ca8a7 * gc.c: continue to change OLDSPACE -> OLDMALLOC.
RGENGC_ESTIMATE_OLDSPACE -> RGENGC_ESTIMATE_OLDMALLOC.
* gc.c: add a new major GC reason GPR_FLAG_MAJOR_BY_OLDMALLOC.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-24 19:49:02 +00:00