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

881 Коммитов

Автор SHA1 Сообщение Дата
tarui 3a0a69fec4 * gc.c: Fixup around GC by MALLOC.
Add allocate size to malloc_increase before GC 
	  for updating limit in after_gc_sweep.
	  Reset malloc_increase into garbage_collect() 
	  for preventing GC again soon.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-15 20:53:01 +00:00
tarui 994ed8dbd5 * gc.c : add some colums to more detail profile.
new colums: Allocated size, Prepare Time, Removing Objects, Empty Objects


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-15 20:18:11 +00:00
tarui 6477616c3b * gc.c (gc_prof_timer_stop): Merge function codes of GC_PROFILE_MORE_DETAIL and !GC_PROFILE_MORE_DETAIL.
* gc.c (gc_prof_mark_timer_start): Ditto. 
	* gc.c (gc_prof_mark_timer_stop): Ditto.
	* gc.c (gc_prof_sweep_slot_timer_start): Ditto.
	* gc.c (gc_prof_sweep_slot_timer_stop): Ditto.
	* gc.c (gc_prof_set_malloc_info): Ditto.
	* gc.c (gc_prof_set_heap_info): Ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-15 17:06:15 +00:00
shugo 1f828497d1 * safe.c (rb_set_safe_level, safe_setter): raise an ArgumentError
when $SAFE is set to 4.  $SAFE=4 is now obsolete.
  [ruby-core:55222] [Feature #8468]

* object.c (rb_obj_untrusted, rb_obj_untrust, rb_obj_trust):
  Kernel#untrusted?, untrust, and trust are now deprecated.
  Their behavior is same as tainted?, taint, and untaint,
  respectively.

* include/ruby/ruby.h (OBJ_UNTRUSTED, OBJ_UNTRUST): OBJ_UNTRUSTED()
  and OBJ_UNTRUST() are aliases of OBJ_TAINTED() and OBJ_TAINT(),
  respectively.

* array.c, class.c, debug.c, dir.c, encoding.c, error.c, eval.c,
  ext/curses/curses.c, ext/dbm/dbm.c, ext/dl/cfunc.c,
  ext/dl/cptr.c, ext/dl/dl.c, ext/etc/etc.c, ext/fiddle/fiddle.c,
  ext/fiddle/pointer.c, ext/gdbm/gdbm.c, ext/readline/readline.c,
  ext/sdbm/init.c, ext/socket/ancdata.c, ext/socket/basicsocket.c,
  ext/socket/socket.c, ext/socket/udpsocket.c,
  ext/stringio/stringio.c, ext/syslog/syslog.c, ext/tk/tcltklib.c,
  ext/win32ole/win32ole.c, file.c, gc.c, hash.c, io.c, iseq.c,
  load.c, marshal.c, object.c, proc.c, process.c, random.c, re.c,
  safe.c, string.c, thread.c, transcode.c, variable.c,
  vm_insnhelper.c, vm_method.c, vm_trace.c: remove code for
  $SAFE=4.

* test/dl/test_dl2.rb, test/erb/test_erb.rb,
  test/readline/test_readline.rb,
  test/readline/test_readline_history.rb, test/ruby/test_alias.rb,
  test/ruby/test_array.rb, test/ruby/test_dir.rb,
  test/ruby/test_encoding.rb, test/ruby/test_env.rb,
  test/ruby/test_eval.rb, test/ruby/test_exception.rb,
  test/ruby/test_file_exhaustive.rb, test/ruby/test_hash.rb,
  test/ruby/test_io.rb, test/ruby/test_method.rb,
  test/ruby/test_module.rb, test/ruby/test_object.rb,
  test/ruby/test_pack.rb, test/ruby/test_rand.rb,
  test/ruby/test_regexp.rb, test/ruby/test_settracefunc.rb,
  test/ruby/test_struct.rb, test/ruby/test_thread.rb,
  test/ruby/test_time.rb: remove tests for $SAFE=4.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-12 14:20:51 +00:00
ko1 a8aaf13392 * gc.c (rgengc_remember): permit promoted object.
(rb_gc_writebarrier -> remember)



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-10 08:21:08 +00:00
ko1 a03ac78b2c * gc.c (RVALUE_PROMOTE): fix parameter name (`x' to `obj')
and make it inline function (like RVALUE_PROMOTE).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41211 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-10 08:15:31 +00:00
ko1 dd96561f76 * gc.c (wmap_mark): check allocation of `w->obj2wmap'.
(no-allocation `w->obj2wmap' will be NULL pointer reference)



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-10 07:12:14 +00:00
akr bd15d4ca78 * internal.h (numberof): Gathered from various files.
* array.c, math.c, thread_pthread.c, iseq.c, enum.c, string.c, io.c,
  load.c, compile.c, struct.c, eval.c, gc.c, parse.y, process.c,
  error.c, ruby.c: Remove the definitions of numberof.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-07 10:01:19 +00:00
naruse b309a3698d * gc.c (before_gc_sweep): noinline can also avoid the segv instead of
-O0 of r41084. this way is expected less slow.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-07 04:25:20 +00:00
nobu 83db393e48 adjust style
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-07 02:52:42 +00:00
nobu 0b87f8d4cf * gc.c (gc_clear_slot_bits): used only if no RGenGC.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-07 02:49:53 +00:00
nobu 432321d780 * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-07 02:36:07 +00:00
tarui f37d0629af * gc.c: use oldgen bitmap as initial mark bitmap when mijor gc.
so can skip oldgen bitmap check around mark & sweep.
	* gc.c (slot_sweep_body): change scan algorithm for performance:
	  from object's pointer base to bitmap one.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-07 02:32:57 +00:00
tarui 1f23dca967 * gc.c: introduce oldgen bitmap for preparing performance tuning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-07 02:28:03 +00:00
tarui 5a06ae3bf9 * gc.c (MARKED_IN_BITMAP, MARK_IN_BITMAP, CLEAR_IN_BITMAP): bring
bitmap macros in one place, and introduce BITMAP_BIT.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-07 02:25:19 +00:00
ko1 e7dfa869c0 * gc.c: remove "Sunny" terminology.
"Sunny" doesn't mean antonym of "Shady" (questionable, doubtful, etc).
  Instead of "Suuny", use "non-shady" or "normal".



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-07 01:17:19 +00:00
tarui 3a17a592da * gc.c (gc_mark): get rid of pushing useless objests.
* gc.c (rgengc_rememberset_mark): bypass gc_mark() in order to push
	  sunny old object at minor gc.
	* gc.c (gc_mark_children): move sunny old check to gc_mark().
	* gc.c (rgengc_check_shady): remove DEMOTE that already unnecessary.
	* gc.c (rb_gc_writebarrier): ditto.
	  
	  change sunny old check point in order to save mark stack and
	  remove unnatural rest_sweep & demote.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-05 16:15:26 +00:00
nobu 2b78c32561 * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-05 16:01:05 +00:00
tarui 5d10f35142 * gc.c (rgengc_rememberset_mark): change scan algorithm for performance:
from object's pointer base to bitmap one.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-05 15:57:12 +00:00
nobu 3fb267e501 * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-05 06:36:06 +00:00
naruse c0089b4d10 use attribute is more simple way for r41083
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-05 06:31:43 +00:00
naruse 77857bfc87 * gc.c (before_gc_sweep): don't optimize it to avoid segv on Ubuntu
10.04 gcc 4.4.
  http://u32.rubyci.org/~chkbuild/ruby-trunk/log/20130527T190301Z.diff.html.gz

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-05 06:27:43 +00:00
ko1 6e19585ac7 * gc.c (gc_profile_enable): rest_sweep() to finish last GC.
Profiling record is allocated at first of marking phase.
  Enable at lazy sweeping may cause an error (SEGV).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-29 15:10:28 +00:00
ko1 b01c4ddfce * gc.c (gc_stat): remove wrong rest_sweep().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-27 17:57:08 +00:00
ko1 8a81b54a2b * gc.c (garbage_collect_body): fix GC_ENABLE_LAZY_SWEEP condition.
* gc.c (GC_NOTIFY): move debug print location and use stderr instead
  of stdout.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-27 17:46:20 +00:00
ko1 e4c58251b7 * include/ruby/ruby.h, gc.c: add new internal event
RUBY_INTERNAL_EVENT_GC_END. This event invokes at the end of
  after_sweep().
  Time chart with lazy sweep is here:
  (1) Kick RUBY_INTERNAL_EVENT_GC_START
  (2) [gc_marks()]
  (3) [lazy_sweep()]
  (4) [... run Ruby program (mutator) with lazy_sweep() ...]
  (5) [after_sweep()]
  (6) Kick RUBY_INTERNAL_EVENT_GC_END
  (7) [... run Ruby program (mutator), and go to (1) ...]
* ext/-test-/tracepoint/tracepoint.c,
  test/-ext-/tracepoint/test_tracepoint.rb: modify a test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-27 15:40:27 +00:00
ko1 f0b6cb6fc7 * include/ruby/ruby.h: rename RUBY_INTERNAL_EVENT_FREE to
RUBY_INTERNAL_EVENT_FREEOBJ.
* ext/-test-/tracepoint/tracepoint.c,
  ext/objspace/object_tracing.c,
  gc.c, vm_trace.c: catch up this change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-27 10:28:25 +00:00
ko1 050dd10d6f * ext/objspace/objspace.c: support ObjectSpace.trace_object_allocations.
Read the following test to know HOWTO.
  This feature is a sample of RUBY_INTERNAL_EVENT.
* test/objspace/test_objspace.rb: add a test.
* ext/objspace/object_tracing.c: ditto.
* gc.c (rb_gc_count): add. THis function returns GC count.
* internal.h: add decl. of rb_gc_count(). Same as `GC.count'.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-27 10:01:45 +00:00
ko1 680f0b5ba4 * include/ruby/ruby.h, gc.c, vm_trace.c: add internal events.
* RUBY_INTERNAL_EVENT_NEWOBJ: object created.
* RUBY_INTERNAL_EVENT_FREE: object freeed.
* RUBY_INTERNAL_EVENT_GC_START: GC started.
  And rename `RUBY_EVENT_SWITCH' to `RUBY_INTERNAL_EVENT_SWITCH'.
  Internal events can not invoke any Ruby program because the tracing
  timing may be critical (under huge restriction).
  These events can be hooked only by C-extensions.
  We recommend to use rb_potponed_job_register() API to call Ruby
  program safely.
  This change is mostly written by Aman Gupta (tmm1).
  https://bugs.ruby-lang.org/issues/8107#note-12
  [Feature #8107]
* include/ruby/debug.h, vm_trace.c: added two new APIs.
* rb_tracearg_event_flag() returns rb_event_flag_t of this event.
* rb_tracearg_object() returns created/freeed object.
* ext/-test-/tracepoint/extconf.rb,
  ext/-test-/tracepoint/tracepoint.c,
  test/-ext-/tracepoint/test_tracepoint.rb: add a test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40946 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-27 00:21:02 +00:00
ko1 e2793a908e * include/ruby/debug.h, vm_trace.c: add rb_postponed_job API.
Postponed jobs are registered with this API. Registered jobs
  are invoked at `ruby-running-safe-point' as soon as possible.
  This timing is completely same as finalizer timing.
  There are two APIs:
* rb_postponed_job_register(flags, func, data): register a
  postponed job with data. flags are reserved.
* rb_postponed_job_register_one(flags, func, data): same as
  `rb_postponed_job_register', but only one `func' job is
  registered (skip if `func' is already registered).
  This change is mostly written by Aman Gupta (tmm1).
  https://bugs.ruby-lang.org/issues/8107#note-15
  [Feature #8107]
* gc.c: use postponed job API for finalizer.
* common.mk: add dependency from vm_trace.c to debug.h.
* ext/-test-/postponed_job/extconf.rb, postponed_job.c,
  test/-ext-/postponed_job/test_postponed_job.rb: add a test.
* thread.c: implement postponed API.
* vm_core.h: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-26 21:30:44 +00:00
ko1 767debf92e * gc.c (gc_stat): collect promote_operation_count and
types (RGENGC_PROFILE >= 2).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-26 17:27:42 +00:00
ko1 ca2ca7d32b * gc.c (gc_stat): collect shade_operation_count,
remembered_sunny_object_count and remembered_shady_object_count
  for each types when RGENGC_PROFILE >= 2.
  They are informative for optimization.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-26 16:43:21 +00:00
ko1 c4c821a7d7 * hash.c (rb_hash_tbl_raw), internal.h: added.
Returns st_table without shading hash.
* array.c: use rb_hash_tbl_raw() for read-only purpose.
* compile.c (iseq_compile_each): ditto.
* gc.c (count_objects): ditto.
* insns.def: ditto.
* process.c: ditto.
* thread.c (clear_coverage): ditto.
* vm_insnhelper.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-26 16:19:04 +00:00
ko1 7b5a42f0fa * gc.c (after_gc_sweep): reduce full GC timing.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-25 08:11:04 +00:00
ko1 f38a063090 * gc.c: do major/full GC when:
* number of oldgen object is biggger than twice of
  number of oldgen object at last full GC.
* number of remembered shady object is bigger than twice of
  number of remembered shady object at last full GC.
* number of oldgen object and remembered shady object is bigger
  than half of total object space.
  (please fix my English!)



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-24 10:21:04 +00:00
ko1 b84f7fda07 * gc.c (after_gc_sweep, garbage_collect_body): do major GC (full GC)
before extending heaps.
  TODO: do major GC when there are many old (promoted) objects.
* gc.c (after_gc_sweep): remove TODO comments.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-24 06:52:38 +00:00
nobu 699e06a884 gc.c: revert r40898
* gc.c (gc_profile_dump_on): revert r40898.  ok to show the record
  accumulating while lazy_sweep().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-23 08:22:05 +00:00
nobu 95170c704c * gc.c: do not dump the last record
* gc.c (gc_profile_dump_on): do not dump the last record, for some
  reason.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-23 07:58:06 +00:00
nobu 11650a6ab9 gc.c: use size_t and no header if next_index == 0
* gc.c (gc_profile_dump_on): use size_t to get rid of overflow and
  show the header when next_index > 0, instead of next_index != 1.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-22 07:50:20 +00:00
ko1 5aece50163 * gc.c (gc_prepare_free_objects, rest_sweep, lazy_sweep): fix position
of `during_gc' setting.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-22 05:21:06 +00:00
ko1 9e64703ec8 * gc.c (garbage_collect): all GC is start from garbage_collect()
(or garbage_collect_body()). `garbage_collect()' accept additional
  two parameters `full_mark' and `immediate_sweep'.
  If `full_mark' is TRUE, then force it full gc (major gc), otherwise,
  it depends on status of object space. Now, it will be minor gc.
  If `immediate_sweep' is TRUE, then disable lazy sweep.
  To allocate free memory, `full_mark' and `immediate_sweep' should be
  TRUE. Otherwise, they should be FALSE.
* gc.c (gc_prepare_free_objects): use `garbage_collect_body()'.
* gc.c (slot_sweep, before_gc_sweep, after_gc_sweep): add logging code.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-21 23:09:22 +00:00
ko1 51d586c64e * gc.c: remove gc_profile_record::is_marked. always true.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-21 08:21:59 +00:00
ko1 9578bb7831 * gc.c: fix to collect additional information for GC::Profiler.
* major/minor GC
* trigger reason of GC
* gc.c (gc_profile_dump_on): change reporting format with
  added information.
* gc.c (gc_profile_record_get): return added information by
  :GC_FLAGS => array.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40877 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-21 08:19:07 +00:00
ko1 2e011442e5 * gc.c: GC::Profiler's sweeping time is accumulated all slot
sweeping time. At lazy GC, GC::Profiler makes new record entry
  for each lazy_sweep(). In this change, accumulating all
  slot_sweep() time.
  And change indentation.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-21 07:52:03 +00:00
ko1 3f2cb86ef3 * gc.c (gc_profile_dump_on): `count' should be (int) because it
can be negative number.
  And use pointer for `record' (don't copy).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-21 07:27:32 +00:00
nobu baa65ad108 gc.c: rb_gc_guarded_ptr
* gc.c (rb_gc_guarded_ptr): unoptimize on other compilers than gcc and
  msvc.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-17 08:35:26 +00:00
ko1 e213a7228f * gc.c (rb_node_newnode): use newobj_of() instead of rb_newobj().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-15 18:07:12 +00:00
ko1 f1ccdf98ca * gc.c (newobj): rename to `newobj_of' and accept additional
three parameters v1, v2, v3. newobj_of() do OBJSETUP() and
  fill values with v1, v2, v3.
* gc.c (rb_data_object_alloc, rb_data_typed_object_alloc):
  use newobj_of().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-15 10:26:22 +00:00
ko1 4a9ec30601 * gc.c: add an additional RGENGC_PROFILE mode (2).
Profiling result can be check by GC.stat.
* gc.c (type_name): separate from obj_type_name().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-15 08:07:30 +00:00
nobu bb5212d395 * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-14 01:54:48 +00:00
ko1 4f401816ff * gc.c: support RGENGC. [ruby-trunk - Feature #8339]
See this ticet about RGENGC.
* gc.c: Add several flags:
* RGENGC_DEBUG: if >0, then prints debug information.
* RGENGC_CHECK_MODE: if >0, add assertions.
* RGENGC_PROFILE: if >0, add profiling features.
  check GC.stat and GC::Profiler.
* include/ruby/ruby.h: disable RGENGC by default (USE_RGENGC == 0).
* array.c: add write barriers for T_ARRAY and generate sunny objects.
* include/ruby/ruby.h (RARRAY_PTR_USE): added. Use this macro if
  you want to access raw pointers. If you modify the contents which
  pointer pointed, then you need to care write barrier.
* bignum.c, marshal.c, random.c: generate T_BIGNUM sunny objects.
* complex.c, include/ruby/ruby.h: add write barriers for T_COMPLEX
  and generate sunny objects.
* rational.c (nurat_s_new_internal), include/ruby/ruby.h: add write
  barriers for T_RATIONAL and generate sunny objects.
* internal.h: add write barriers for RBasic::klass.
* numeric.c (rb_float_new_in_heap): generate sunny T_FLOAT objects.
* object.c (rb_class_allocate_instance), range.c:
  generate sunny T_OBJECT objects.
* string.c: add write barriers for T_STRING and generate sunny objects.
* variable.c: add write barriers for ivars.
* vm_insnhelper.c (vm_setivar): ditto.
* include/ruby/ruby.h, debug.c: use two flags
  FL_WB_PROTECTED and FL_OLDGEN.
* node.h (NODE_FL_CREF_PUSHED_BY_EVAL, NODE_FL_CREF_OMOD_SHARED):
  move flag bits.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 18:07:47 +00:00
ko1 7958c71ee5 * gc.c: remove rb_objspace_t::marked_num.
We can use `objspace_live_num()' instead of removed `marked_num'
  if it is after `after_gc_sweep()' function call.
* gc.c (after_gc_sweep): use objspace_live_num() instead of removed
  rb_objspace_t::marked_num.
* gc.c (gc_mark_ptr, gc_marks): remove rb_objspace_t::marked_num code.
* gc.c (gc_prepare_free_objects): do not call set_heaps_increment()
  with checking objspace->heap.marked_num. At this point, we only
  need to check availability of free-cell.
* gc.c (gc_prepare_free_objects):
* gc.c (lazy_sweep): call after_gc_sweep() if there are no sweep_able entry.
* gc.c (rest_sweep, gc_prepare_free_objects): remove after_gc_sweep() call.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 17:02:50 +00:00
ko1 b597df707e * gc.c: disable GC_PROFILE_MORE_DETAIL (fix last commit).
* gc.c (gc_prof_set_malloc_info): fix "objspace->heap.live_num" to
  "objspace_live_num(objspace)". There is no such member variable.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 16:52:49 +00:00
ko1 7d0a90e9b4 * gc.c: refactoring GC::Profiler.
* gc.c (gc_prof_sweep_timer_start/stop): removed because
  they doesn't support lazy sweep.
* gc.c (gc_prof_sweep_slot_timer_start/stop): added.
  redefine `sweeping time' to accumulated time of all of
  slot_sweep().
* gc.c (rb_objspace_t::profile::count): renamed to
  rb_objspace_t::profile::next_index. `counter' seems ambiguous.
  increment it when next record is acquired.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 16:34:25 +00:00
ko1 83aba04862 * include/ruby/ruby.h: constify RBasic::klass and add
RBASIC_CLASS(obj) macro which returns a class of `obj'.
  This change is a part of RGENGC branch [ruby-trunk - Feature #8339].
* object.c: add new function rb_obj_reveal().
  This function reveal interal (hidden) object by rb_obj_hide().
  Note that do not change class before and after hiding.
  Only permitted example is:
  klass = RBASIC_CLASS(obj);
  rb_obj_hide(obj);
  ....
  rb_obj_reveal(obj, klass);
  TODO: API design. rb_obj_reveal() should be replaced with others.
  TODO: modify constified variables using cast may be harmful for
  compiler's analysis and optimizaton.
  Any idea to prohibt inserting RBasic::klass directly?
  If rename RBasic::klass and force to use RBASIC_CLASS(obj),
  then all codes such as `RBASIC(obj)->klass' will be
  compilation error. Is it acceptable? (We have similar
  experience at Ruby 1.9,
  for example "RARRAY(ary)->ptr" to "RARRAY_PTR(ary)".
* internal.h: add some macros.
* RBASIC_CLEAR_CLASS(obj) clear RBasic::klass to make it internal
  object.
* RBASIC_SET_CLASS(obj, cls) set RBasic::klass.
* RBASIC_SET_CLASS_RAW(obj, cls) same as RBASIC_SET_CLASS
  without write barrier (planned).
* RCLASS_SET_SUPER(a, b) set super class of a.
* array.c, class.c, compile.c, encoding.c, enum.c, error.c, eval.c,
  file.c, gc.c, hash.c, io.c, iseq.c, marshal.c, object.c,
  parse.y, proc.c, process.c, random.c, ruby.c, sprintf.c,
  string.c, thread.c, transcode.c, vm.c, vm_eval.c, win32/file.c:
  Use above macros and functions to access RBasic::klass.
* ext/coverage/coverage.c, ext/readline/readline.c,
  ext/socket/ancdata.c, ext/socket/init.c,
* ext/zlib/zlib.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 10:49:11 +00:00
ko1 aacd771046 * *.c, parse.y, insns.def: use RARRAY_AREF/ASET macro
instead of using RARRAY_PTR().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 09:56:22 +00:00
ko1 8ac05ae500 * gc.c (rb_data_object_alloc): check klass only if klass is not 0.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 06:25:33 +00:00
ko1 925c936bb1 * gc.c (rb_data_object_alloc, rb_data_typed_object_alloc):
use NEWOBJ_OF() instead of NEWOBJ().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 06:03:00 +00:00
nobu ae422dda78 gc.c: _aligned_malloc
* gc.c (aligned_malloc): declare _aligned_malloc() prototype for old VC.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-30 21:08:30 +00:00
nobu b4a2e268ea gc.c: fix compile error
* gc.c (gc_prepare_free_objects): fix compile error.  there should be
  free objects when new slot is added.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39902 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-24 05:13:54 +00:00
nari e54daddac4 * gc.c (GC_ENABLE_LAZY_SWEEP): new macro to switch lazy sweeping
for debugging. [Feature #8024] [ruby-dev:47135]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39901 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-24 04:53:44 +00:00
nari 3ad60679e3 * gc.c: We have no chance to expand the heap when lazy sweeping is
restricted. So collecting is often invoked if there is not
  enough free space in the heap. Try to expand heap when this is
  the case.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39900 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-24 04:20:32 +00:00
nari 80329d3a66 * gc.c: Improve accuracy of objspace_live_num() and
allocated/freed counters. patched by tmm1(Aman Gupta).
  [Bug #8092] [ruby-core:53392]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-18 15:30:02 +00:00
nari 1bc93a1591 * gc.c: Avoid unnecessary heap growth. patched by tmm1(Aman Gupta).
[Bug #8093] [ruby-core:53393]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-18 12:44:55 +00:00
nari 03c7f0ca43 * gc.c: Fix unlimited memory growth with large values of
RUBY_FREE_MIN. patched by tmm1(Aman Gupta).
  [Bug #8095] [ruby-core:53405]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-18 09:03:07 +00:00
nari 2f7ca893a3 * gc.c: allow to tune growth of heap by environment variable
RUBY_HEAP_SLOTS_GROWTH_FACTOR. patched by tmm1(Aman Gupta).
  [Feature #8015] [ruby-core:53131]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-13 14:52:00 +00:00
zzak a14f02f0e0 * vm.c: Typo in ObjectSpace::WeakMap overview
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-23 07:06:10 +00:00
kosaki 03f7f9ea40 * gc.c (vm_xrealloc): add a few comment why we avoid realloc(ptr,0).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-04 20:05:42 +00:00
nobu be7bf5aa0c adjust style
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-29 12:22:04 +00:00
shirosaki ca2fce0cf2 * gc.c (obj_id_to_ref): add a macro to treat Bignum object id.
This follows the change r38493.

* gc.c (id2ref): fix for working fine with Bignum object id on x64
  Windows.
* gc.c (wmap_finalize): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-22 04:25:18 +00:00
usa 94f42d6d79 * gc.c (nonspecial_obj_id): VALUE is not compatible with Fixnum on
LLP64 platform, such as 64bit Windows.
  reporeted by Heesob Park at [ruby-core:50255] [Bug #7454], and the
  fix is suggested by akr.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-20 07:43:54 +00:00
kosaki aff9dff46d * signal.c (rb_sigaltstack_size): new. calculate stack size for
sigsegv handler. enlarge value when x86 or x86_64 on Linux.
  Linux has very small MINSIGSTKSZ size (2048 bytes) and
  our sigsegv routine need 5KiB at least. [Bug #7141]
* internal.h: add declaration of rb_sigaltstack_size().
* vm_core.h: remove ALT_STACK_SIZE definition.

* signal.c (rb_register_sigaltstack): replace ALT_STACK_SIZE with
  rb_sigaltstack_size();
* gc.c (Init_heap): ditto.
* vm.c (th_init): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-15 14:20:12 +00:00
shugo 60d6038dda * revised r37993 to avoid SEGV/ILL in tests. In r37993, a method
entry with VM_METHOD_TYPE_REFINED holds only the original method
  definition, so ci->me is set to a method entry allocated in the
  stack, and it causes SEGV/ILL.  In this commit, a method entry
  with VM_METHOD_TYPE_REFINED holds the whole original method entry.
  Furthermore, rb_thread_mark() is changed to mark cfp->klass to
  avoid GC for iclasses created by copy_refinement_iclass().

* vm_method.c (rb_method_entry_make): add a method entry with
  VM_METHOD_TYPE_REFINED to the class refined by the refinement if
  the target module is a refinement.  When a method entry with
  VM_METHOD_TYPE_UNDEF is invoked by vm_call_method(), a method with
  the same name is searched in refinements.  If such a method is
  found, the method is invoked.  Otherwise, the original method in
  the refined class (rb_method_definition_t::body.orig_me) is
  invoked.  This change is made to simplify the normal method lookup
  and to improve the performance of normal method calls.

* vm_method.c (EXPR1, search_method, rb_method_entry),
  vm_eval.c (rb_call0, rb_search_method_entry): do not use
  refinements for method lookup.

* vm_insnhelper.c (vm_call_method): search methods in refinements if
  ci->me is VM_METHOD_TYPE_REFINED.  If the method is called by
  super (i.e., ci->call == vm_call_super_method), skip the same
  method entry as the current method to avoid infinite call of the
  same method.

* class.c (include_modules_at): add a refined method entry for each
  method defined in a module included in a refinement.

* class.c (rb_prepend_module): set an empty table to
  RCLASS_M_TBL(klass) to add refined method entries, because
  refinements should have priority over prepended modules.

* proc.c (mnew): use rb_method_entry_with_refinements() to get
  a refined method.

* vm.c (rb_thread_mark): mark cfp->klass for iclasses created by
  copy_refinement_iclass().

* vm.c (Init_VM), cont.c (fiber_init): initialize th->cfp->klass.

* test/ruby/test_refinement.rb (test_inline_method_cache): do not skip
  the test because it should pass successfully.

* test/ruby/test_refinement.rb (test_redefine_refined_method): new
  test for the case a refined method is redefined.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-06 13:08:41 +00:00
nari ab012bda4a * gc.c (getrusage_time): uses clock_gettime() with
CLOCK_PROCESS_CPUTIME_ID when available, which provides a 1ns
  precision on linux. [ruby-core:50495] [Bug #7500]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-05 14:53:16 +00:00
zzak 5c4e025f6f * gc.c (WeakMap): Add doc for internal reference, use lib/weakref.rb
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-02 07:45:17 +00:00
nobu 018d8261ce gc.c: suppress warnings
* gc.c (add_slot_local_freelist, slot_sweep, mark_locations_array):
  suppress unused-value warnings, even with valgrind enabled.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-01 09:30:24 +00:00
shugo 9e44974874 * revert r37993 to avoid SEGV in tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-30 02:11:59 +00:00
nari a22bb18e3e * gc.c : remove a unused function.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38012 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29 23:10:36 +00:00
nari 59770bf960 * gc.c (rb_objspace_call_finalizer): finalize_deferred may free up
a object which is reachable from a part after this function,
  e.g. ruby_vm_destruct(). [ruby-dev:46647] [Bug #7452]

* test/ruby/test_gc.rb (test_finalizing_main_thread): add a test
  for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29 22:56:02 +00:00
shugo 421314cf4e * vm_method.c (rb_method_entry_make): add a method entry with
VM_METHOD_TYPE_REFINED to the class refined by the refinement if
  the target module is a refinement.  When a method entry with
  VM_METHOD_TYPE_UNDEF is invoked by vm_call_method(), a method with
  the same name is searched in refinements.  If such a method is
  found, the method is invoked.  Otherwise, the original method in
  the refined class (rb_method_definition_t::body.orig_def) is
  invoked.  This change is made to simplify the normal method lookup
  and to improve the performance of normal method calls.

* vm_method.c (EXPR1, search_method, rb_method_entry),
  vm_eval.c (rb_call0, rb_search_method_entry): do not use
  refinements for method lookup.

* vm_insnhelper.c (vm_call_method): search methods in refinements if
  ci->me is VM_METHOD_TYPE_REFINED.  If the method is called by
  super (i.e., ci->call == vm_call_super_method), skip the same
  method entry as the current method to avoid infinite call of the
  same method.

* class.c (include_modules_at): add a refined method entry for each
  method defined in a module included in a refinement.

* class.c (rb_prepend_module): set an empty table to
  RCLASS_M_TBL(klass) to add refined method entries, because
  refinements should have priority over prepended modules.

* proc.c (mnew): use rb_method_entry_with_refinements() to get
  a refined method.

* test/ruby/test_refinement.rb (test_inline_method_cache): do not skip
  the test because it should pass successfully.

* test/ruby/test_refinement.rb (test_redefine_refined_method): new
  test for the case a refined method is redefined.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29 12:50:10 +00:00
zzak 8baab38ad2 * gc.c: Documentation for GC, GC::Profiler, ObjectSpace, and
ObjectSpace::WeakMap [ruby-core:50245] [Bug #7449]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29 08:15:53 +00:00
ko1 502ab126ac * gc.c (gc_stat): prepre Symbol objects at first time
to make it fast.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29 05:29:22 +00:00
ko1 c512d6acf9 * gc.c (gc_stat): GC.stat supports new information
* total_allocated_object: total allocated object number.
* total_freed_object: total freed object number.
  Above two numbers are only accumulated and they will
  overflow (return to 0). Please use them as a hint.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29 05:05:19 +00:00
shirosaki 56132b1346 array.c: refactoring of rb_ary_delete_same()
* array.c (ary_resize_smaller): new function to resize array.

* array.c (rb_ary_delete): refactoring to extract a function.

* array.c (rb_ary_delete_same): refactoring.
  It renames function, reduces duplicated code and removes unused
  code.

* gc.c (wmap_final_func): follow the above change.

* internal.h (rb_ary_delete_same): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-25 13:39:26 +00:00
shirosaki 7b298723b0 gc.c: refactoring to rename variables
* gc.c (wmap_final_func): rename variables to clarify the meaning.
  In wmap2obj the key is WeakRef and the value is referenced object.
  In obj2wmap the key is referenced object and the value is an array
  of WeakRef.

* gc.c (wmap_finalize): ditto.
  [ruby-core:49044] [Bug #7304]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-24 12:26:57 +00:00
shirosaki 1cdeab5cdd Fix WeakRef finalize
* array.c (rb_ary_delete_same_obj): new function for WeakRef.
  This deletes same objects as item argument in the array.

* internal.h (rb_ary_delete_same_obj): add a declaration.

* gc.c (wmap_final_func): remove WeakRef object reference from the
  array. rb_ary_delete() is not usable because it uses rb_equal() to
  compare object references.

* gc.c (wmap_finalize): remove recycled object references from weak
  map hash properly. How to get object reference from object id was
  wrong. st_delete() doesn't work properly if key and value arguments
  are same. The key of obj2wmap is referenced object and the value of
  obj2wmap is WeakRef array.

* gc.c (wmap_aset): obj2wmap should contain WeakRef array in the
  definition.

* test/test_weakref.rb
  (TestWeakRef#test_not_reference_different_object,
   TestWeakRef#test_weakref_finalize): add tests for above.
  [ruby-core:49044] [Bug #7304]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-24 12:26:54 +00:00
naruse 757413f6bb Rvert r37827 and r37828
Revert "Fix finalize of WeakRef"
This causes segv on rubyspec.
http://u64.rubyci.org/~chkbuild/ruby-trunk/log/20121124T050101Z.log.html.gz

you can reproduce by
 make test-rubyspec MSPECOPT='-V library/weakref'

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-24 07:43:13 +00:00
shirosaki 3fac4abc7b wmap_finalize: refactoring to rename variables
* gc.c (wmap_final_func): rename variables to clarify the meaning.
  In wmap2obj the key is WeakRef and the value is referenced object.
  In obj2wmap the key is referenced object and the value is an array
  of WeakRef.

* gc.c (wmap_finalize): ditto.
  [ruby-core:49044] [Bug #7304]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-24 04:01:37 +00:00
shirosaki 82cac33ecb Fix finalize of WeakRef
* gc.c (wmap_final_func): remove WeakRef object reference from the
  array.

* gc.c (wmap_finalize): remove recycled object references from weak
  map hash properly. How to get object reference from object id was
  wrong. st_delete() doesn't work properly if key and value arguments
  are same. The key of obj2wmap is referenced object and the value of
  obj2wmap is WeakRef array.

* gc.c (wmap_aset): obj2wmap should contain WeakRef array in the
  definition.

* test/test_weakref.rb
  (TestWeakRef#test_not_reference_different_object): add a test for
  above.
  [ruby-core:49044] [Bug #7304]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-24 04:01:33 +00:00
nari 66db637a9f * gc.c (is_swept_object): extract from is_dead_object().
* gc.c (rb_gcdebug_print_obj_condition): add the function for debug.
  This function shows some conditions of given object (e.g.,
  marked, in heap, swept).

* gc.c (rb_gcdebug_sentinel): add the function for debug.
  This function allow check to inadvertently free up an object.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-22 15:03:46 +00:00
nari 7d0cabb8f8 * gc.c (garbage_collect): remove a duplicative probe.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-21 13:31:06 +00:00
nari fe9fc6df01 * gc.c (gc_profile_clear): realloc profile records if its size is
higher than the threshold, GC_PROFILE_RECORD_DEFAULT_SIZE * 2.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-21 13:15:10 +00:00
tenderlove 4c740bae97 * probes.d: add DTrace probe declarations. [ruby-core:27448]
* array.c (empty_ary_alloc, ary_new): added array create DTrace probe.

* compile.c (rb_insns_name): allowing DTrace probes to access
  instruction sequence name.

* Makefile.in: translate probes.d file to appropriate header file.

* common.mk: declare dependencies on the DTrace header.

* configure.in: add a test for existence of DTrace.

* eval.c (setup_exception): add a probe for when an exception is
  raised.

* gc.c: Add DTrace probes for mark begin and end, and sweep begin and
  end.

* hash.c (empty_hash_alloc): Add a probe for hash allocation.

* insns.def: Add probes for function entry and return.

* internal.h: function declaration for compile.c change.

* load.c (rb_f_load): add probes for `load` entry and exit, require
  entry and exit, and wrapping search_required for load path search.

* object.c (rb_obj_alloc): added a probe for general object creation.

* parse.y (yycompile0): added a probe around parse and compile phase.

* string.c (empty_str_alloc, str_new): DTrace probes for string
  allocation.

* test/dtrace/*: tests for DTrace probes.

* vm.c (vm_invoke_proc): add probes for function return on exception
  raise, hash create, and instruction sequence execution.

* vm_core.h: add probe declarations for function entry and exit.

* vm_dump.c: add probes header file.

* vm_eval.c (vm_call0_cfunc, vm_call0_cfunc_with_frame): add probe on
  function entry and return.

* vm_exec.c: expose instruction number to instruction name function.

* vm_insnshelper.c: add function entry and exit probes for cfunc
  methods.

* vm_insnhelper.h: vm usage information is always collected, so
  uncomment the functions.

12 19:14:50 2012  Akinori MUSHA  <knu@iDaemons.org>

* configure.in (isinf, isnan): isinf() and isnan() are macros on
  DragonFly which cannot be found by AC_REPLACE_FUNCS().  This
  workaround enforces the fact that they exist on DragonFly.

12 15:59:38 2012  Shugo Maeda  <shugo@ruby-lang.org>

* vm_core.h (rb_call_info_t::refinements), compile.c (new_callinfo),
  vm_insnhelper.c (vm_search_method): revert r37616 because it's too
  slow.  [ruby-dev:46477]

* test/ruby/test_refinement.rb (test_inline_method_cache): skip
  the test until the bug is fixed efficiently.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-12 21:52:12 +00:00
nari 8a9097e83c * gc.c: move immutable fields from struct heaps_slot and struct
sorted_heaps_slot into struct heaps_header.
  Based on a patch from Sokolov Yura [Feature #6199][ruby-core:43592]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-10 15:04:27 +00:00
ngoto 05a05cc62b * ruby_atomic.h: renamed from atomic.h to avoid header file name conflict
on Solaris 10. [ruby-dev:46414] [Bug #7287]
* gc.c, signal.c, vm_core.h, common.mk: reflect the rename from atomic.h
  to ruby_atomic.h.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-09 16:05:07 +00:00
knu 1c0323adbc Fix build when gcc is used and the platform's libc lacks alloca().
* include/ruby/ruby.h (alloca), eval_intern.h (alloca), gc.c
  (alloca): Make alloca() globally available by moving the
  ultimate ifdef's to ruby/ruby.h.  Gcc hides its builtin alloca()
  when compiling with -ansi, and linking thus fails on platforms
  that lack their own alloca() implementation in libc, which
  include OpenBSD and some ports of NetBSD.  We use alloca()
  everywhere including from within third party C extentions, so
  alloca() must be made globally available. [Bug #7307]

* addr2line.c (alloca): Replace the alloca() part with the
  ultimate ifdef's. [Bug #7307]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-09 03:34:08 +00:00
nari 25a973e84b * gc.c (gc_profile_record): don't define unused variables when
GC_PROFILE_MORE_DETAIL is 0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-31 09:22:37 +00:00
nari 9fd08911c0 * gc.c (gc_prof_mark_timer_stop): count is not initialized.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-31 09:22:35 +00:00
nobu 78625e5852 gc.c: PRIuSIZE
* gc.c (gc_profile_dump_on): use PRIuSIZE instead of 'zu'.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-29 03:19:38 +00:00
eregon 1fe5783104 * gc.c (gc_profile_result, gc_profile_report): use internal structures
to avoid allocations and progressively print the output for #report.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-27 14:36:22 +00:00
nari a4ba41a29d rename it to a more fitting name
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37313 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-24 04:29:53 +00:00
nari bda726223f fix the function name which is not grammatically correct.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-24 04:14:22 +00:00
nari f0a435c187 * gc.c (free_object_aquire): rename to match the behavior of this
function.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-24 03:55:46 +00:00
ko1 aab12ec054 * gc.c (garbage_collect, gc_marks): move the location of
clear and restore rb_objspace_t::mark_func_data
  from garbage_collect() to gc_marks().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-24 01:39:45 +00:00
ko1 6c6dece7f1 * ext/objspace/objspace.c (ObjectSpace.reachable_objects_from):
internal object support.
  If given object `obj' has references to internal objects
  (such as T_NODE objects), then this method returns instances of
  `ObjectSpace::InternalObjectWrapper' instead of that internal objects.
  This instance contains a refereance to an internal object and you can
  check the type of internal object using
  `ObjectSpace::InternalObjectWrapper#type' method.
  Rdoc of `InternalObjectWrapper' is not prepared yet.
* gc.c (rb_objspace_reachable_objects_from), gc.h: change
  an interface of 'rb_objspace_reachable_objects_from()'
* gc.c, gc.h: add two APIs
  - rb_objspace_markable_object_p(obj): check markable or not.
  - rb_objspace_internal_object_p(obj): check internal or not.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-24 00:04:56 +00:00
eregon 0ef8222e63 * gc.c: fix typos in documentation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-20 11:36:46 +00:00
nari c3a46d6aca * include/ruby/ruby.h: add C APIs.
VALUE rb_newobj_of(VALUE klass, VALUE flags)
  #define NEWOBJ_OF(obj,type,klass,flags)
  These allow to change a allocation strategy depending on klass
  or flags.

* gc.c: ditto

* array.c: use new C API.
* bignum.c: ditto
* class.c: ditto
* complex.c: ditto
* ext/socket/ancdata.c: ditto
* ext/socket/option.c: ditto
* hash.c: ditto
* io.c: ditto
* marshal.c: ditto
* numeric.c: ditto
* object.c: ditto
* random.c: ditto
* range.c: ditto
* rational.c: ditto
* re.c: ditto
* string.c: ditto
* struct.c: ditto
  [Feature #7177][Feature #7047]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-20 06:57:51 +00:00
shugo e028d3d905 * eval.c, gc.c, iseq.c, node.h, vm_insnhelper.c, vm_insnhelper.h,
vm_method.c: rename omod and overlaid modules to refinements.

* eval.c (hidden_identity_hash_new): renamed from identity_hash_new.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-08 14:02:46 +00:00
nobu b1058ef46c gc.c: use markable_object_p
* gc.c (gc_mark_children): use markable_object_p() and reduce
  duplicated code.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-06 00:50:12 +00:00
nari 3376ea81f9 fix comments
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-05 09:21:41 +00:00
nari 4c0f022f45 revert r37091
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-05 09:19:49 +00:00
ko1 e03d6d9eb8 * ext/objspace/objspace.c: add ObjectSpace#reachable_objects_from.
This method returns an array of objects referenced by given object.
  If given object is special objects such as true/false/nil/Fixnum etc
  then it returns nil. See rdoc for details.
  [ruby-core:39772]
* test/objspace/test_objspace.rb: add a test for this method.
* gc.c: add rb_objspace_reachable_objects_from().
  To make this function, add several member `mark_func_data'
  to rb_objspace_t.  If mark_func_data is not null, then
  gc_mark() calls mark_func_data::mark_func.
* gc.h: export rb_objspace_reachable_objects_from().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-05 08:14:09 +00:00
nari 271f069c7f * gc.c (chain_finalized_object): remove to check a mark flag and
marking since all objects are certainly unmarked with rest_sweep.

* gc.c (rb_objspace_call_finalizer): remove to mark finalizable
  objects. The sweeping doesn't push T_ZOMBIE objects to the
  freelist.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-05 07:20:49 +00:00
nari ec62e30196 * gc.c (init_heap): call init_mark_stack before to allocate
altstack. This change avoid the stack overflow at the signal
  handler on 32bit, but I don't understand reason... [Feature #7095]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37088 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-04 14:48:02 +00:00
nari 2f9f17ac98 * gc.c (rb_objspace_call_finalizer): call gc_mark_stacked_objects
at suitable point.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-04 08:34:20 +00:00
nobu 6aa2aabd8b gc.c: self-referencing finalizers
* gc.c (rb_objspace_call_finalizer): mark self-referencing finalizers
  before run finalizers, to fix SEGV from btest on 32bit.
* gc.c (gc_mark_stacked_objects): extract from gc_marks().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-04 07:31:31 +00:00
nobu 6fa2980e53 * gc.c: use enum for debugging.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-04 07:23:41 +00:00
nobu 4336caf204 gc.c: unused function
* gc.c (free_stack_chunks): it is used only when per-VM object space
  is enabled.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-03 13:23:30 +00:00
nari 8d53a08ed8 * gc.c: Use the non-recursive marking instead of recursion. The
recursion marking of CRuby needs checking stack overflow and the
  fail-safe system, but these systems not good at partial points,
  for example, marking deep tree structures. [ruby-dev:46184]
  [Feature #7095]

* configure.in (GC_MARK_STACKFRAME_WORD): removed. It's used by
  checking stack overflow of marking.

* win32/Makefile.sub (GC_MARK_STACKFRAME_WORD): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-03 12:30:21 +00:00
ko1 e3990633cb * insns.def (opt_checkenv): remove unused instruction `opt_checkenv'.
* compile.c (iseq_compile_each): ditto.
* node.h: remove unused node `NODE_OPTBLOCK'.
* ext/objspace/objspace.c, gc.c (gc_mark_children): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-28 06:44:24 +00:00
ko1 b3b5e626ad * include/ruby/ruby.h: introduce flonum technique for
64bit CPU environment (sizeof(double) == sizeof(VALUE)).
  flonum technique enables to avoid double object creation
  if the double value d is in range about between
  1.72723e-77 < |d| <= 1.15792e+77 or 0.0.
  flonum Float value is immediate and their lowest two bits
  are b10.
  If flonum is activated, then USE_FLONUM macro is 1.
  I'll write detailed in this technique on
  https://bugs.ruby-lang.org/projects/ruby-trunk/wiki/Flonum_tech
* benchmark/bmx_temp.rb: add an benchmark for simple
  Float calculation.
* gc.c (id2ref, rb_obj_id): add flonum Float support.
* include/ruby/intern.h: move decl of rb_float_new(double)
  to include/ruby/ruby.h.
* insns.def, vm.c, vm_insnhelper.c: add flonum optimization
  and simplify source code.
* vm_insnhelper.h (FLONUM_2_P): added.
* marshal.c: support flonum output.
* numeric.c (rb_float_new_in_heap): added.
* parse.y: support flonum.
* random.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-23 07:22:40 +00:00
drbrain 33a63355a7 * gc.c (gc_malloc_allocated_size): RDoc does not process macros, so
mention this method is only available when ruby is built with
	  CALC_EXACT_MALLOC_SIZE
	* gc.c (gc_malloc_allocations):  ditto


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-09 23:42:01 +00:00
nari 8f1c81c610 * gc.c : if ENABLE_VM_OBJSPACE is 1, rest_sweep is not defined.
remove unused declarations.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-05 12:12:45 +00:00
nari dd124a0f84 * gc.c: just move functions and so on. I don't touch any internal
implementation.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-05 10:39:37 +00:00
nari de0c788bb4 * gc.c: use inline functions instead of macros, and close up
related codes for the profiler.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-04 14:12:12 +00:00
nari d7a3331682 * gc.c (gc_mark_children): use gc_mark_ptr instead of marking
a object directly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-04 11:40:59 +00:00
shugo 19ddfc2483 * eval.c (rb_mod_using): new method Module#using. [experimental]
* eval.c (rb_mod_refine): new method Module#refine. [experimental]

* eval.c (f_using): new method Kernel#using. [experimental]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-02 11:34:19 +00:00
nari b79bf14ff2 * gc.c: return true or false. Patch by Dirkjan Bussink. [Bug #6821]
* test/ruby/test_gc.rb: add test-case for this bug.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-02 02:47:12 +00:00
nari 631b6d5aad * gc.c: remove unused initialization.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-28 15:34:44 +00:00
nobu c51a826764 rb_thread_call_without_gvl
* include/ruby/thread.h: new header file for thread stuff.
* thread.c (rb_thread_call_without_gvl): export.  [Feature#4328]
  returns void* instead of VALUE.  [Feature #5543]
* thread.c (rb_thread_blocking_region): deprecate.  [ruby-core:46295]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-10 13:57:11 +00:00
ngoto 87c25d897b * gc.c, atomic.h (ATOMIC_SIZE_*): moved from gc.c to atomic.h [ruby-dev:45909]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-04 13:02:03 +00:00
usa 38ca5cca00 * gc.c (ATOMIC_SIZE_*): 64bit Windows support.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-04 02:53:20 +00:00
ngoto 1e972da39c * gc.c (ATOMIC_SIZE_EXCHANGE): fix function name on Solaris [Bug #6689]
[ruby-dev:45904]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-03 14:25:32 +00:00
nobu a7c6f0afae gc.c: atomic operations for malloc_params
* gc.c (vm_malloc_fixup, vm_xrealloc, vm_xfree, after_gc_sweep): use
  atomic operations to update malloc_params.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36284 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-03 07:07:57 +00:00
nobu c7c397f917 fix allocated_size
* gc.c (vm_xrealloc): fix allocated_size update, should not ignore old
  size.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-03 05:37:29 +00:00
nobu 82cd48d7ee gc.c: simplified
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-02 21:34:14 +00:00
nobu 960660353f adjust indent
* gc.c (os_obj_of_i): adjust indent.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-31 14:59:03 +00:00
nari e2f4f34467 * gc.c (obj_free): doesn't free a method table if it doesn't
exits. [ruby-dev:44436]
* test/ruby/test_gc.rb (class TestGc): added the test case for
  this issue.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-28 03:12:33 +00:00
yugui 76bc2d1ed7 Imports Ruby's port to NativeClient (a.k.a NaCl).
Patch by Google Inc. [ruby-core:45073].

* configure.in (RUBY_NACL): New M4 func to configure variables for
  NaCl.
  (RUBY_NACL_CHECK_PEPPER_TYPES): New M4 func to check the old names
  of Pepper interface types.
  (BTESTRUBY): New variable to specify which ruby should be run on
  "make btest". NaCl can run the built binary by sel_ldr, but it need
  rbconfig.rb. So this variable is distinguished from $MINIRUBY.
  
* thread_pthread.c: Disabled some features on NaCl.

* io.c: ditto.

* process.c: ditto.

* signal.c: ditto.

* file.c: ditto.

* missing/flock.c: ditto.

* nacl/pepper_main.c: An example implementation of Pepper application
  that embeds Ruby.

* nacl/example.html: An example of web page that uses the Pepper
  application.

* nacl/nacl-config.rb: Detects variants of NaCl SDK.

* nacl/GNUmakefile.in: Makefile template for NaCl specific build
  process.

* nacl/package.rb: script for packaging a NaCl-Ruby embedding
  application. 

* nacl/reate_nmf.rb: Wrapper script of create_nmf.py

* dln.c (dln_load): Added a hack to call on NaCl.

* util.c (ruby_getcwd): Path to the current directort is not available
  on NaCl.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-17 02:48:59 +00:00
nobu bb8446205f * gc.c (obj_free): show entire flags too.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35313 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-13 02:51:40 +00:00
nobu 871cd27c8d * gc.c (GET_HEAP_HEADER, NUM_IN_SLOT): parenthesise macro parameters.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-12 06:10:33 +00:00
nobu 28cc4f7543 * st.c (st_update): pass pointer to key to the callback function.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-29 14:50:20 +00:00
nobu 30cea65767 * st.c (st_update): add existing parameter to the callback function.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-29 07:36:12 +00:00
nobu e30dbb3671 fix condition for free
* gc.c (aligned_free): fix condition for free.  memalign() and
  posix_memalign() are not defined together normally.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-18 14:21:31 +00:00
yugui 1d006f353d * gc.c (aligned_malloc, aligned_free): added fallback implementations
for platforms like OSX Leopard.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-18 11:15:50 +00:00
nobu 2555f3f5bf * gc.c (free_method_entry_i): method entry may be in
unlinked_method_entry_list.  [ruby-core:43383][Bug #6171]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-18 08:17:39 +00:00
nobu df058ea0e3 Bug #5350
* gc.c: add ObjectSpace::WeakMap.  [ruby-dev:44565][Bug #5350]
* lib/weakref.rb: use WeakMap instead of _id2ref.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-13 03:37:06 +00:00
nari 0d44bf83da * gc.c : remove gc_clear_mark_on_sweep_slots() and use
rest_sweep() instead of it, because some dead objects might be
  marked in next the mark phase by false pointers.
  [ruby-core:42672]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-21 09:35:07 +00:00
nari 87a15a6981 revert r34691 and r34689
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-19 10:18:16 +00:00
nari f0e9fa3cb1 * gc.c (gc_clear_mark_on_sweep_slots): remove a unused variable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-19 04:11:19 +00:00
nari 55e6e9e384 * gc.c (gc_clear_mark_on_sweep_slots): uses slot_sweep() for
unsweeped slots, because some dead objects might be marked in
  next the mark phase by false pointers.  [ruby-core:42672]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-19 03:07:59 +00:00
nagachika 2910f6736e * cont.c (rb_fiber_reset_root_local_storage): add a new function to
restore rb_thread_t::local_storage.

* cont.c (rb_obj_is_fiber): add a new function to tell finalizer to
  prevent fibers from destroy.

* gc.c (rb_objspace_call_finalizer): don't sweep fibers at finalizing
  objspace.

* internal.h (rb_fiber_reset_root_local_storage, rb_obj_is_fiber):
  add prototypes.

* vm.c (ruby_vm_destruct): reset main thread's local_storage before
  free main thread. rb_thread_t::local_storage is replaced by fiber's
  local storage when forked from fiber, and it should be already freed
  when the fiber was destroyed.

* test/ruby/test_fiber.rb (test_fork_from_fiber): add test for fork
  from fiber.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-15 14:00:11 +00:00
nari 8b4b4032f7 * gc.c (HEAP_BITMAP_LIMIT): HEAP_BITMAP_LIMIT is computed on the
basis of HEAP_SIZE because it must covers a whole heap block.
  [ruby-trunk - Bug #6006]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-15 02:09:44 +00:00
nari 0da31416f1 * gc.c (CEILDIV): rename to a appropriate name.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-14 11:26:24 +00:00
nari 64e7aedcee * gc.c (assign_heap_slot): SEGV happens cause on 64-bit platform
sometime there should be `objs-=2` instead of `objs--`.
  patched by Sokolov Yura. https://github.com/ruby/ruby/pull/92

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-14 09:11:24 +00:00
nari 261400e7a9 * gc.c (HEAP_OBJ_LIMIT, HEAP_BITMAP_LIMIT): HEAP_OBJ_LIMIT used
`sizeof(struct heaps_slot)` while heap is currently allocated
  with `struct heaps_header`.
  HEAP_BITMAP_LIMIT were calculated from
  `HEAP_OBJ_LIMIT/sizeof(uintptr_t)` - one Byte for each object,
  not one Bit. [Bug #6006]
  patched by Sokolov Yura. https://github.com/ruby/ruby/pull/92

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-13 12:57:16 +00:00
nari a42cc41ba1 * configure.in (HEAP_ALIGN_LOG): HEAP_ALIGN_LOG should be page
size in OpenBSD. [ruby-core:42158][Bug #5901]

* gc.c : avoid to redefine.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34404 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-31 12:36:50 +00:00
nobu a92dd46dd5 * gc.c (HEAP_ALIGN, HEAP_ALIGN_MASK): DRY, let compiler calculate
from HEAP_ALIGN_LOG.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-27 07:31:50 +00:00
nobu e87c0e6574 * gc.c (aligned_malloc, aligned_free): covered missing defined
operators and fixes for cygwin.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-17 03:32:50 +00:00
nagachika 28d28e844e * gc.c (ruby_mimmalloc): don't set allocated size to header.
ruby_mimmalloc() doesn't increment allocated_size/allocations and
  decrement them in ruby_xfree() cause inconsistency.

* gc.c (ruby_xfree): don't decrement allocated_size/allocations if
  allocated size record is 0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-11 14:09:10 +00:00
nobu a54832714d * gc.c (HEAP_OBJ_LIMIT): suppress narrowing down warning from gcc 4.2.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-10 06:52:24 +00:00
naruse 931459d974 * gc.c: in fact, i686-linux doesn't need to define _XOPEN_SOURCE 600.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-10 03:50:23 +00:00
naruse 56dc6f5acc * gc.c (ruby_mimmalloc): defined for objects need not rb_objspace,
but should return pointer suitable for ruby_xfree;
  main vm and main thread.
  patched by Sokolov Yura. https://github.com/ruby/ruby/pull/79

* internal.h: ditto.

* vm.c (Init_BareVM): use ruby_mimmalloc.

* ext/dl/cfunc.c: #include <ruby/util.h>.

* ext/syslog/syslog.c: use xfree because it is allocated by
  ruby_strdup.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34257 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-10 03:49:10 +00:00
nagachika fcb05d8683 * gc.c (run_finalizer): clear rb_thread_t::errinfo when ignore
an exception under rb_protect(). [ruby-dev:45113]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-09 15:35:06 +00:00
nari b78bddee35 * gc.c : don't embed struct heaps_slot to a heap block because it
can causes copy-on-write of memory page on heap block when its
  free_next is rewirted.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-09 11:58:12 +00:00
nari 2cf2416ea0 * gc.c: free_slots is changed Singly linked list. clear
free_slots before sweep.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-09 06:02:01 +00:00
naruse 471394f647 * gc.c: i686-linux needs to define _XOPEN_SOURCE 600 for posix_memalign.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-08 22:50:59 +00:00
naruse 88b16cebc8 * gc.c (rb_objspace_free): global_List is allocated with xmalloc.
patched by Sokolov Yura.  https://github.com/ruby/ruby/pull/78

* dln_find.c: remove useless replacement of free.

* ext/readline/readline.c (readline_attempted_completion_function):
  strings for readline must allocated with malloc.

* process.c (run_exec_dup2): use free; see also r20950.

* re.c (onig_new_with_source): use malloc for oniguruma.

* vm.c (ruby_vm_destruct): use free for VMs.

* vm.c (thread_free): use free for threads.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-08 21:02:08 +00:00
nari 5393622dad * gc.c : consider header bytes which are used by malloc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-08 11:55:04 +00:00
nari cd73f29465 * gc.c (aligned_free): support MinGW. Patch by Hiroshi Shirosaki.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-08 02:59:04 +00:00
nari 94fd32b80a * gc.c (slot_sweep): add a assertion instead of a debug print.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-08 02:46:19 +00:00
kosaki e3b0732050 * gc.c: get rid of implicit narrowing conversion.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-07 15:47:45 +00:00
naruse 411fa36c73 * configure.in: check posix_memalign(3) and menalign(3).
* gc.c (aligned_malloc): use configure's result instead of
  _POSIX_C_SOURCE and _XOPEN_SOURCE because they can't be used
  to check availability at least on FreeBSD.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34226 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-07 15:13:37 +00:00
nari 50675fdba1 * gc.c: use Bitmap Marking algorithm to avoid copy-on-write of
memory pages. See [ruby-dev:45085] [Feature #5839]
  [ruby-core:41916].

* include/ruby/ruby.h : FL_MARK rename to FL_RESERVED1.

* node.h : ditto.

* debug.c : ditto.

* object.c (rb_obj_clone): FL_MARK move to a bitmap.

* class.c (rb_singleton_class_clone): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-07 14:02:23 +00:00
mame 1ab3974b0e * node.h, node.c, parse.y: implement a parser part for keyword arguments. This is a preparation for keyword argument (see [ruby-core:40290]).
* gc.c (gc_mark_children): bookkeeping.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34135 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-26 14:20:03 +00:00
mame afb10c62c2 * node.h, parse.y (new_args_gen), compile.c (iseq_set_arguments): use struct rb_args_info instead of NODEs. This is a preparation for keyword argument (see [ruby-core:40290]).
* node.c (dump_node), gc.c (gc_mark_children, obj_free): bookkeeping.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-26 14:19:58 +00:00
nobu b526738c3b * bignum.c (big_rshift), compile.c (validate_label,
iseq_build_from_ary_exception), cont.c (cont_capture), dir.c
  (dir_open_dir), gc.c (objspace_each_objects), io.c (pipe_open)
  (rb_io_advise), parse.y (parser_compile_string)
  (rb_parser_compile_file), proc.c (binding_free), process.c
  (rb_proc_exec_n, rb_seteuid_core, proc_setegid, rb_setegid_core)
  (p_uid_exchange, p_gid_exchange), regparse.c (strdup_with_null),
  signal.c (sig_dfl), vm.c (rb_iseq_eval, rb_iseq_eval_main),
  vm_insnhelper.c (vm_expandarray): suppress
  unused-but-set-variable warnings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-05 09:57:00 +00:00
usa 2d0c17d4fb * gc.c (initial_params): static. it seems to be forgetten at r33501.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-28 03:38:52 +00:00
nobu cb2a69d883 * gc.c (initial_params): pack in a struct.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-21 13:02:19 +00:00
nobu fd807aa2ea * gc.c (rb_gc_set_params): set parameters always.
[ruby-dev:44648] [Bug #5467]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-21 13:01:37 +00:00
nobu c180eabf8f * gc.c (rb_gc_finalize_deferred, rb_objspace_call_finalizer):
should use ATOMIC_EXCHANGE() to check the previous value.
  [ruby-dev:44596] [Bug #5439]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-13 09:04:29 +00:00
nobu 92a05ea2cf * class.c (class_alloc): allocate extra memory after containing
object setup to get rid of rare-but-potential memory leak.
* gc.c (gc_mark_children): skip marking extended members if ptr is
  NULL.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-04 12:10:09 +00:00
naruse 356c7cbfb6 * gc.c (rb_gc_set_params): ruby_verbose can be Qnil, so use RTEST.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-04 02:44:55 +00:00
nagachika 3973e70d92 * gc.c (rb_gc_set_params): output GC parameter change messages only
if -w/-v options are specified. these messages are output to stderr,
  not to stdout. [ruby-core:39795] [Bug #5380]

* test/ruby/test_gc.rb (test_gc_parameter): add test for it.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33379 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-03 15:02:58 +00:00
nagachika 3d2451d996 * gc.c (add_heap_slots, init_heap): reset heaps_inc zero when
heap slots are expanded by environment variable RUBY_HEAP_MIN_SLOTS.
  [ruby-core:39777] [Bug #5380]

* test/ruby/test_gc.rb (test_gc_parameter): add test for it.

* test/ruby/envutil.rb (assert_normal_exit): add :child_env option to
  enable pass environemnt variables to child process.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-01 01:00:40 +00:00
nobu a73b88ae43 * gc.c (slot_sweep, rb_gc_finalize_deferred)
(rb_objspace_call_finalizer, rb_gc): run finalizers
  sequencially.  [ruby-dev:44562]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-29 16:54:14 +00:00
nobu 71d1102525 * gc.c (is_id_value, is_live_object): extract from id2ref().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-29 11:10:46 +00:00
nobu b2658a7604 * gc.c (run_finalizer): use object instead of object id.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-29 11:09:48 +00:00
nobu 8e6e8e6288 * use RB_TYPE_P which is optimized for constant types, instead of
comparison with TYPE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-29 11:07:45 +00:00
nobu 62dfc45bb2 suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-25 07:42:38 +00:00
nobu 89e490f1de * gc.c (mark_entry, mark_key, mark_keyvalue): adjust callback
argument types.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-15 02:39:49 +00:00
ko1 49042ae821 * gc.c (GC_PROFILE_MORE_DETAIL, CALC_EXACT_MALLOC_SIZE):
define macros only if they are not defined.
  fixes: [Ruby 1.9 - Feature #5291]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-09 23:34:05 +00:00
nari 599071b700 * gc.c (Init_GC): defined GC::Profiler.raw_data. based on the
patch by Eric Hodel. [ruby-core:37857] [Bug #4991]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-08 03:57:41 +00:00
nobu ac6ad66d0b * gc.c (id2ref): objects which are unmarked but not in sweep_slots
are not dead.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-08 00:02:55 +00:00
nobu 4fe51cb330 * gc.c (id2ref): unmarked object is already dead while lazy
sweeping, and to it cannot come back since other objects
  referred from it might have been freed already.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33219 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-07 22:33:14 +00:00
nobu bc2a1f2a98 * variable.c (rb_const_set): show the previous definition
location.  [EXPERIMENTAL]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-03 15:11:53 +00:00
nari e26cead1e9 * gc.c (gc_lazy_sweep): if sweep target slots are not found, we
try heap_increment() because it might be able to expand the
  heap. [Bug #5127] [ruby-dev:44285]

* gc.c (gc_clear_mark_on_sweep_slots): if a sweeping was
  interrupted, we expand the heap if at all possible.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-09 04:26:15 +00:00
naruse ae1bccf7a4 Refix r32815.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32821 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-02 15:39:10 +00:00
naruse 027a15e958 * gc.c (init_heap): allocate sigaltstack after heaps are allocated.
[ruby-dev:44315] [Bug #5139]

* vm.c (thread_free): use free because objspace is not ready.

* vm.c (th_init): use malloc because objspace is not ready.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32815 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-02 13:08:45 +00:00
mame 9a27239558 * proc.c (struct METHOD), gc.c (gc_marks), vm_method.c
(rb_gc_mark_unlinked_live_method_entries): fix SEGV bug.
  rb_method_entry_t was free'd even when the method is still on the
  stack if it is BMETHOD (i.e., Method#call).  This is because
  rb_method_entry_t is embedded in struct METHOD.  This commit
  separates them and marks the live method entries.
  See [ruby-core:38449] in detail.  fix [Bug #5047] [ruby-core:38171]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-25 14:29:28 +00:00