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

553 Коммитов

Автор SHA1 Сообщение Дата
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
drbrain 50b64ee7de * gc.c: Improve documentation
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-08 00:18:39 +00:00
nari 17bb77fd77 * gc.c: change water_mark value value that may call
gc_mark(lev <= GC_LEVEL_MAX) in gc_mark().
  In ruby_stack_check(), water_mark is a value that may call some
  C function. Fixes Bug #3781

* configure.in: define GC_MARK_STACKFRAME_WORD that approximate
  size of gc_mark() and gc_mark_children() stackframes.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-07 14:59:09 +00:00
akr e7996eb3cc * internal.h: declare internal functions here.
* node.h: declare NODE dependent internal functions here.

* iseq.h: declare rb_iseq_t dependent internal functions here.

* vm_core.h: declare rb_thread_t dependent internal functions here.

* bignum.c, class.c, compile.c, complex.c, cont.c, dir.c, encoding.c,
  enumerator.c, error.c, eval.c, file.c, gc.c, hash.c, inits.c, io.c,
  iseq.c, load.c, marshal.c, math.c, numeric.c, object.c, parse.y,
  proc.c, process.c, range.c, rational.c, re.c, ruby.c, string.c,
  thread.c, time.c, transcode.c, variable.c, vm.c,
  tool/compile_prelude.rb: don't declare internal functions declared
  in above headers.  include above headers if required.

  Note that rb_thread_mark() was declared as
  void rb_thread_mark(rb_thread_t *th) in cont.c but defined as
  void rb_thread_mark(void *ptr) in vm.c.  Now it is declared as
  the later in internal.h.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-17 22:43:38 +00:00
kosaki 3c23284734 * thread.c (rb_thread_schedule_rec): fix {UN,}LIKELY macro misuse.
* gc.c (rb_newobj): ditto.
* vm_insnhelper.c (vm_method_search): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-16 14:42:02 +00:00
kosaki 8923ba1ec9 * gc.c: fix a regression by r31690 on AIX because AIX malloc
return NULL if it's passed 0. But some caller don't expect it.
  patch by Yutaka Kanemoto.
(vm_malloc_prepare): return calculated size.
(vm_xmalloc): use above result.
(vm_xcalloc): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-15 14:35:46 +00:00
nari b6135f1cd7 * gc.c (rb_gc_set_params): call initial_expand_heap if
initial_heap_min_slots is set.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-14 02:13:52 +00:00
nari 8c79b8b6b8 * gc.c: use size_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-14 02:13:51 +00:00
nobu df3e3768e9 * atomic.h (ATOMIC_OR): _InterlockedOr is not available on migw.
* gc.c (rb_gc_set_params): VM_OBJSPACE is disabled on mignw.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-12 00:32:32 +00:00
nari 11c43f7ae9 * gc.c: expand heap if initial_heap_min_slots is bigger than
HEAP_MIN_SLOTS.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-11 10:51:51 +00:00
nagachika 5aee85cef1 * gc.c: remove an unused declaration.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-09 15:31:02 +00:00
nagachika 1fdbe0f437 * gc.c (rb_objspace_call_finalizer): use rb_typeddata_is_kind_of() for
type check to get rid of a double free when main Thread has singleton
  class. [ruby-core:36741] [Bug #4828]
* thread.c (rb_obj_is_mutex): add a new utility function.
* vm.c (rb_obj_is_thread): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-09 14:45:56 +00:00
nobu 70b4b6dc8b * gc.c (vm_xcalloc): use calloc provided by platforms.
fixes #4754

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-22 09:26:46 +00:00
iwamatsu e6a51e8f8c * gc.c: Fix build on m68k by 'error: too few arguments to
function 'mark_locations_array''.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-20 06:05:54 +00:00
nobu 52f5f410e4 * internal.h: add for internal use only.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-18 13:41:54 +00:00
naruse 436d5dc6eb * gc.c (rb_objspace): an initializer must be a constant.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-07 16:17:27 +00:00
matz eb807d42ec * gc.c (rb_gc_set_params): allow GC parameter configuration by
environment variables.  based on a patch from funny-falcon at
  https://gist.github.com/856296, but honors safe level.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-07 08:39:39 +00:00
akr fd2f238560 * vm.c (thread_free): reset ruby_current_thread if it points the
thread to free.
* gc.c (slot_sweep): don't call RUBY_VM_SET_FINALIZER_INTERRUPT if
  there is no current thread.
  [ruby-dev:43000]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-12 10:35:36 +00:00
matz 049cdff0eb * gc.c (Init_GC): move back object_id to Kernel. [ruby-dev:42840]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30291 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-22 05:38:41 +00:00
matz 591ae37a59 * gc.c (Init_GC): move #__id__ and #object_id to BasicObject.
[ruby-dev:42778]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30240 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-17 13:25:19 +00:00
akr 8c757a3268 * gc.c: parenthesize macro arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-14 11:32:59 +00:00
shyouhei 9d3ba342c9 * gc.c (rb_objspace_free): With our "lazy-sweep" GC engine, it is
possible for an object to survive until its surrounding object
  space is about to be freed.  Those objects, if any, remains not
  leaked for the rest of a process life.  This is problematic
  because for instance a T_DATA object may have its own destructor
  to terminate something.

* vm.c (ruby_vm_destruct): ruby_current_vm termination should be
  somewhere after rb_objspace_free for above reason.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30065 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-03 03:53:21 +00:00
mame 4c17014bf3 * gc.c (assign_heap_slot): fix fear of memory leak and memory
violation.  Coverity Scan found this bug.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-15 15:09:40 +00:00
nobu 6f4bfdc115 * gc.c (after_gc_sweep): remove unused variable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-09 12:57:51 +00:00
ko1 71603f3f01 * gc.c (rb_newobj): force garbage_collect() if GC.stress == true.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-04 12:06:08 +00:00
ko1 ad3427002c * gc.c (run_final): do not need argument obj.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-04 11:48:01 +00:00
ko1 e95b72a1f1 * gc.c (run_final): do not need argument obj.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-04 11:46:26 +00:00
ko1 ba0143b591 * gc.c (before_gc_sweep): fix commit miss.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-04 11:27:09 +00:00
ko1 3ff23bf926 * gc.c (after_gc_sweep, before_gc_sweep):
invoke rb_sweep_method_entry() as soon as possilbe.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-04 11:21:44 +00:00