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

713 Коммитов

Автор SHA1 Сообщение Дата
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
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
ko1 08db452620 * gc.c (after_gc_sweep, slot_sweep): finalizers should be invoked
as soon as possible.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-04 11:15:36 +00:00
ko1 f6b2490fdb * gc.c, vm.c, vm_core.h: remove USE_VALUE_CACHE option.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29675 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-03 01:01:12 +00:00
ko1 7b0d48c1fa * gc.c (finalizer_table, objspace->final.table):
Create finalizer_table at Init_heap().
  Remove all null checks of finalizer_table.
* gc.c (mark_tbl): skip if no table entries.
* gc.c (slot_swee): remove useless need_call_final check.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-31 15:41:14 +00:00
nobu 5eced07cd7 * gc.c (rb_objspace_free): finalizers should be called separately
from freeing objspace.  [ruby-dev:42479]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-31 13:32:13 +00:00
ko1 87c0b99446 * gc.c (before_gc_sweep, run_final): fix decrement timing of final_num.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-28 14:34:06 +00:00
ko1 492d120877 * gc.c (GC.stat): added. [ruby-dev:38607]
* test/ruby/test_gc.rb: add a test for above.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-27 19:02:24 +00:00
mame a115768161 * class.c, constant.h, gc.c, method.h, object.c, variable.c,
vm_insnhelper.c: use struct rb_constant_entry_t as entry of
  RCLASS_CONST_TBL.  RCLASS_CONST_TBL has contained VALUE of constant
  directly.  Now instead rb_const_entry_t is contained in
  RCLASS_CONST_TBL,  rb_const_entry_t is managed by malloc, and
  have not only the value itself but also visibility flag.
  This is another preparation for private constant (see
  [ruby-dev:39685][ruby-core:32698]).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-26 17:27:32 +00:00
mame 2285a8d813 * class.c, gc.c, object.c, variable.c, vm_insnhelper.c,
include/ruby/ruby.h: separate RCLASS_CONST_TBL from RCLASS_IV_TBL.
  RCLASS_IV_TBL has contained not only instance variable table but
  also constant table.  Now the two table are separated to
  RCLASS_CONST_TBL and RCLASS_IV_TBL.  This is a preparation for
  private constant (see [ruby-dev:39685][ruby-core:32698]).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-26 17:27:21 +00:00
nobu 23e8deaf0d * array.c, gc.c, hash.c, object.c, string.c, struct.c,
transcode.c, variable.c, vm.c, vm_insnhelper.c, vm_method.c:
  replace calls to rb_error_frozen() with rb_check_frozen().  a
  patch from Run Paint Run Run at [ruby-core:32014]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-24 08:14:05 +00:00
ko1 e923b67707 * gc.c (gc_lazy_sweep): Variable declarations should be at
the head of block.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-21 15:03:56 +00:00
nobu e5db83ec65 * gc.c (objspace_each_objects, rb_objspace_each_objects): use
struct.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-21 14:56:55 +00:00
nobu 48b4512f76 * gc.c (objspace_each_objects): fix return with no value.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-21 14:52:02 +00:00
nari a29dc56764 * gc.c (rb_objspace_each_objects): don't lazy sweep in
rb_objspace_each_objects. [Bug #3940] [ruby-dev:42369]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-21 04:18:09 +00:00
nobu 671b498070 Commit miss.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-19 03:25:29 +00:00
nobu 12cbb58819 * test/ruby/test_sprintf.rb: fix ML ref. [ruby-core:32848]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-19 03:22:03 +00:00
nobu 7735e63593 * array.c (rb_ary_and, rb_ary_or), class.c (rb_mod_init_copy),
gc.c (undefine_final), time.c (time_mload): get rid of
  type-punning casts.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-13 22:22:18 +00:00
nobu d410639a6d * compile.c (iseq_build_body), error.c (set_syserr, get_syserr),
(syserr_initialize), gc.c (define_final, rb_gc_copy_finalizer),
  (run_final), hash.c (rb_hash_aref, rb_hash_lookup2),
  (rb_hash_fetch_m, rb_hash_clear, rb_hash_aset, eql_i),
  iseq.c (iseq_load, iseq_data_to_ary), marshal.c (r_symlink),
  thread.c (rb_thread_local_aref),
  variable.c (generic_ivar_remove, ivar_get, rb_const_get_0),
  (rb_cvar_get), vm.c (rb_vm_check_redefinition_opt_method),
  vm_insnhelper.c (vm_get_ev_const), vm_method.c (remove_method),
  ext/iconv/iconv.c (map_charset): use st_data_t.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12 14:47:23 +00:00
nobu 3c24bea4b5 * gc.c (obj_free, rb_objspace_call_finalizer): fix truncating
cast.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12 14:09:27 +00:00
nobu 0172f3181f * gc.c (mark_current_machine_context): suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12 14:03:24 +00:00
nari 66c25e4ca1 * gc.c (gc_profile_result): Index begins with 1.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-16 11:31:58 +00:00
nari a5207399bd * gc.c (gc_profile_result): use size_t. based on patches from
Tomoaki NISHIYAMA <tomoakin@kenroku.kanazawa-u.ac.jp> at
[ruby-dev:42042].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29012 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-16 11:31:54 +00:00
nobu f214490d90 * thread.c (rb_gc_mark_threads): deprecated.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-14 12:04:31 +00:00
nari e573186407 * test/objspace/test_objspace.rb: added test for objspace.
* ext/objspace/objspace.c: considers T_ZOMBIE by lazy sweep GC.

* gc.c: considers that dsize was 0. [ruby-dev:42022]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-14 09:01:12 +00:00
nari 81cc3b2655 * gc.c: don't call after_gc_sweep() after when garbage_collect()
was called, because rb_sweep_method_entry() free live unlinked
  method entries. [ruby-core:31169]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-20 06:14:40 +00:00
nobu 25b9eb5e57 * include/ruby/ruby.h (rb_data_type_t): restructured. [ruby-dev:41862]
add parent member.

* error.c (rb_typeddata_inherited_p): new function.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-18 07:31:54 +00:00
nobu ad654fe58e * gc.c (rb_objspace_each_objects): adjust indent.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28675 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-18 03:23:10 +00:00
nari 12b76ec890 * gc.c (unlink_heap_slot, slot_sweep): unlink heaps_slot of
heaps_slot linked list if heaps_slot is empty at slot_sweep.
  fixed [ruby-dev:41543], [ruby-core:24894].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-29 03:11:05 +00:00
naruse da3cdd2ddf * gc.c (gc_lazy_sweep): clean a warning.
"suggest parentheses around assignment used as truth value"

* transcode_data.h (getGB4bt1): clean a warning.
  "suggest parentheses around arithmetic in operand of |"

* transcode_data.h (getGB4bt3): ditto.

* vm.c (thread_free): clean a warning. "format 'p' expects type
  'void *', but argument 3 has type 'struct rb_mutex_struct *'"

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-18 01:44:52 +00:00
nobu 550532d902 * gc.c (rb_obj_id): trivial optimization.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-07 18:30:42 +00:00
nari 28754d0aa9 * gc.c: set_heaps_increment is not
called before gc_makrs of lazy sweeping because live_num not
  contain finalize objects. So call set_heaps_increment after lazy
  sweeping if free_num are not enough. And move free_min to struct
  rb_objspace for above.  [ruby-dev:41499]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-06 04:12:20 +00:00
usa 408f0a92ef * gc.c (gc_sweep): suppress a warning on VC, again.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-04 00:37:36 +00:00
nari a8cd15c96c * gc.c (gc_mark_all_clear): don't call obj_free() in
gc_mark_all_clear(), because obj_free() may make T_ZOMBIE
  objects.

* gc.c (gc_clear_mark_on_sweep_slots): renamed.

* gc.c (rb_objspace_call_finalizer): call
  gc_clear_mark_on_sweep_slots() before calling mark_tbl().
  [ruby-dev:41459]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-30 06:42:12 +00:00
tarui 12a99794b4 * thread.c (RB_GC_SAVE_MACHINE_CONTEXT), gc.c (ruby_gc_stress_start):
revert r28078.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-29 17:26:01 +00:00
tarui d0914b3552 * thread.c (RB_GC_SAVE_MACHINE_CONTEXT): start GC
by switching the thread if gc_stress == true 

* gc.c (ruby_gc_stress_start): dotto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-29 16:32:59 +00:00
mame 264f490012 * gc.c (force_chain_object, rb_objspace_call_finalizer): delete
finalizer entry after corresponding finalizer is executed.
  This caused SEGV when test/cgi is executed with GC.stress = true.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-29 15:10:01 +00:00
nobu 790abc5991 * gc.c (GC_PROF_TIMER_STOP): regularize `marked' to suppress
warnings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28061 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-29 01:12:38 +00:00
nobu 21fbc8f6d3 * gc.c (allocate_sorted_heaps, before_gc_sweep, gc_sweep): removed
unused variables.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-28 23:46:44 +00:00
nari ca64478089 * gc.c : use simple lazy sweep algorithm for response performance
gain. See [ruby-dev:41067].

* object.c: FL_MARK of some objects by lazy sweep is copied when
  RVALUE is cloned. These objects are not marked in the mark phase.
  So delete FL_MARK.

* class.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-28 11:13:42 +00:00
usa ccba83feff * gc.c (gc_sweep): suppres a warning on VC.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-24 00:21:33 +00:00
nobu 87af442f94 * suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-21 09:10:23 +00:00
marcandre 7729de4d91 * array.c: Documentation: change => in call-seq to ->.
Harmonize "#=>" in examples. [ruby-core:30206]

* bignum.c: ditto

* class.c: ditto

* compar.c: ditto

* cont.c: ditto

* dir.c: ditto

* encoding.c: ditto

* enum.c: ditto

* enumerator.c: ditto

* error.c: ditto

* eval.c: ditto

* file.c: ditto

* gc.c: ditto

* io.c: ditto

* load.c: ditto

* marshal.c: ditto

* math.c: ditto

* numeric.c: ditto

* object.c: ditto

* pack.c: ditto

* proc.c: ditto

* process.c: ditto

* random.c: ditto

* range.c: ditto

* re.c: ditto

* ruby.c: ditto

* signal.c: ditto

* sprintf.c: ditto

* string.c: ditto

* struct.c: ditto

* thread.c: ditto

* time.c: ditto

* transcode.c: ditto

* variable.c: ditto

* vm_eval.c: ditto

* vm_method.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 21:07:33 +00:00
marcandre 4afa9ed041 * array.c: Harmonize documentation, in particular regarding:
- methods returning enumerators
    - array methods and argument naming (array -> ary, an_array -> new_ary)
    - minor improvements, typo fixed and styling issues

  Other documentation errors fixed:
    - return value was self instead of a new array (or vice-versa) for
      Array#{pop,shift,permutation,repeated_permutation,keep_if}
    - Array#rindex was missing the form with a block.

* dir.c: ditto.

* enum.c: ditto. Modified Enumerable#reverse_each' documentation to clarify
  that #each will be finish before any element is yielded.

* error.c: ditto.

* gc.c: ditto.

* hash.c: ditto.

* io.c: ditto. IO#{codepoints,each_codepoint} fixed as per [ruby-core:23948]

* numeric.c: ditto.

* range.c: ditto.

* string.c: ditto.

* struct.c: ditto.

* vm_eval.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-13 05:49:55 +00:00
ko1 833cade2dc * vm_method.c (rb_unlink_method_entry, rb_sweep_method_entry):
added.  Unlinked method entries are collected to
  vm->unlinked_method_entry_list.  On the GC timing, mark all method
  entries which are on all living threads.  Only non-marked method
  entries are collected.  This hack prevents releasing living method
  entry.
  [Performance Consideration] Since this Method Entry GC (MEGC)
  doesn't occuer frequently, MEGC will not be a performance bottleneck.
  However, to traverse living method entries, every control frame push
  needs to clear cfp->me field.  This will be a performance issue
  (because pushing control frame is occurred frequently).
  Bug #2777 [ruby-dev:40457]
* cont.c (fiber_init): init cfp->me.
* gc.c (garbage_collect): kick rb_sweep_method_entry().
* method.h (rb_method_entry_t): add a mark field.
* vm.c (invoke_block_from_c): set passed me.
* vm.c (rb_thread_mark): mark cfp->me.
* vm_core.h (rb_thread_t): add a field passed_me.
* vm_core.h (rb_vm_t): add a field unlinked_method_entry_list.
* vm_insnhelper.c (vm_push_frame): clear cfp->me at all times.
* vm_insnhelper.c (vm_call_bmethod): pass me.
* bootstraptest/test_method.rb: add a test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-05 17:51:21 +00:00
nobu 62d7a30a76 * gc.c (rb_mark_method_entry): renamed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-04 22:27:18 +00:00
nobu 95c52c8e6c * gc.c (GET_STACK_BOUNDS): fixed macro argument names. a patch from
Satoshi Shiba <shiba AT rvm.jp> at [ruby-dev:40973].

* gc.h (ruby_get_stack_grow_direction): fixed prototype.

* thread_pthread.c (get_stack, ruby_stack_overflowed_p): both side
  should be same type.  [Bug #3145]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27338 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-14 07:29:04 +00:00
wanabe c46f71399a * proc.c (rb_method_location): return attr's location if it is setup.
[Feature #2084]

* NEWS: follow above.

* vm_method.c (rb_add_method): save attr's location.

* gc.c (mark_method_entry): mark attr's location.

* method.h (rb_method_definition_t): add member to save attr's location.

* vm_eval.c (vm_call0): follow above.

* vm_insnhelper.c (vm_call_method): ditto.

* vm_method.c (rb_method_definition_eq): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27016 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-22 11:44:01 +00:00
wanabe 4d8d6d9d63 * gc.c (gc_profile_total_time): add GC::Profiler.total_time.
* NEWS: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26814 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-04 04:51:43 +00:00
matz 7e5f20c842 * gc.c (gc_mark_children): lost comment added.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-24 14:28:18 +00:00
mame a9f6a95530 * gc.c (chain_finalized_object): fix precedence.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-16 13:10:39 +00:00
mame 2236f6a682 * gc.c (rb_objspace_call_finalizer): always run finalizer at exit,
before object is free'd.  [ruby-dev:40382]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-16 12:34:09 +00:00
wanabe bcbfa7a97b * gc.c (obj_free): free rb_classext_t of eigenclass. [Bug #1392]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26515 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-31 04:33:33 +00:00
yugui 295bc2fe25 removes the dtrace support. reverts r26239, r26238 and r26235.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-05 05:59:23 +00:00
yugui b80814c339 * gc.c: added UNLIKELY to probes for optimization.
* vm.c: ditto.

* thread.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-04 12:36:46 +00:00
yugui 72b199940d * trace.h: new file. wraps tracing mechanisms.
* defs/dtrace.d: new file. defined a dtrace provider "ruby".

* include/ruby/ruby.h (LIKELY): moved from vm.c.
  (UNLIKELY): ditto.
  (OBJSETUP): probe "object-create".
  (RUBY_EVENT_RESCUE): new event.

* vm_exec.c (DEBUG_ENTER_INSN): embeded a probe insn-entry into it.
  (DEBUG_END_INSN): insn-return.

* vm.c (LIKELY): moved into ruby.h.
  (UNLIKELY): ditto.
  (Init_BareVM): embeded a probe "raise" into it.

* variable.c (rb_class2name_without_alloc): new utility function.

* tool/rbinstall.rb (install?(:ext, :arch, :'ext-arch')): installs 
  dtrace.d if necessary.

* thread_pthread.c (add_signal_thread_list): probe "raise".
  (rb_thread_create_timer_thread): ditto.

* thread.c (rb_thread_schedule_rec): probes "thread-enter" and
  "thread-leave",
  (thread_start_func_2): ditto.
  (thread_cleanup_func): probe "thread-term"

* lib/mkmf.rb: supports dtrace postprocessor on making an extension.

* iseq.c (rb_vm_insn_name): new utility function.
  (rb_vm_insn_len): ditto.

* insns.def (hook): probes "method-etnry", "method-return", "line",
  and "rescue".

* compile.c (iseq_compile_each): adds a trace op for "rescue" probe.

* gc.c (garbage_collect): probes "gc-begin" and "gc-end".
  (obj_free): probe "object-free"
  (garbage_collect_with_gvl): probe "raise"
  (negative_size_allocation_error): ditto.
  (rb_memerror): ditto.

* eval.c (rb_rescue2): probe "rescue"
  (rb_longjmp): probe "raise"

* ext/probe/probe.c: new extension for application defined probes.

* ext/probe/extconf.rb: ditto.

* configure.in (--with-tracing-model): new option to choose a tracing
  mechanism.
  (DTRACE): new substitution. name of dtrace(1).
  (RUBY_TRACING_MODEL): new substitution.
  (DTRACE_OBJ): ditto.
  (MINIDTRACE_OBJ): ditto.
  (GOLFDTRACE_OBJ): ditto.
  (LIBRUBY_DTRACE_OBJ): ditto.
  (RUBY_DTRACE_POSTPROCESS): new macro. checks whether the dtrace on 
  the system needs postprocessing.
  (RUBY_DTRACE_BSD_BROKEN): new macro. checks whether the dtrace
  supports USDT.

* Makefile.in: 
  (DTRACE): new variable. name of dtrace(1).
  (TRACING_MODEL): new variable. name of the chosen tracing mechanism.
  (DTRACE_OBJ): same as the one in configure.in.
  (MINIDTRACE_OBJ): ditto.
  (GOLFDTRACE_OBJ): ditto.
  (LIBRUBY_DTRACE_OBJ): ditto.
  (CPPOUTFILE): new substitution. necessary for generating dtrace.d
  (trace_none.h): new target for TRACING_MODEL=none
  (RUBY_H_INCLUDES): appended a header for tracing.
  (distclean-local): also removes preprocessed version of dtrace.d
  ($(LIBRUBY_A)): needs $(LIBRUBY_DTRACE_OBJ) if dtrace needs 
  postprocessing.
  ($(PROGRAM)): ditto.
  (golf): ditto.
  (miniruby): ditto.
  ($(arch_hdrdir)/ruby/dtrace.d): new target. preprocessed verson 
  of defs/dtrace.d. generated if necessary.
  ($(arch_hdrdir)/ruby/trace_dtrace.h): new target.
  definition of probes.
  ($(LIBRUBY_DTRACE_OBJ)): new target. generated if dtrace needs 
  postprocessing.
  ($(DTRACE_OBJ)): ditto.
  ($(MINIDTRACE_OBJ)): ditto.
  ($(GOLFDTRACE_OBJ)): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-03 15:36:17 +00:00
nobu 4d786d21e3 * removed spaces just before tabs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-26 05:25:08 +00:00
mame 4a761c3209 * class.c (rb_mod_init_copy): fix memory leak of Class#dup.
[ruby-dev:39687]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-14 12:56:16 +00:00
nobu 29f982738e * gc.c (vm_xrealloc): use the given object space.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-13 02:09:33 +00:00
akr b9e0294eda fix typos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-03 17:46:28 +00:00
nobu 0243c024f8 * gc.c (GET_STACK_BOUNDS): refactored common code. based on a
patch from Suraj N. Kurapati <sunaku AT gmail.com> in
  [ruby-core:26443].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-31 23:17:52 +00:00
matz 33c5abbefa * gc.c (garbage_collect_with_gvl): do not garbage_collect when
dont_gc flag turned on.  [ruby-core:26327]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-26 23:06:39 +00:00
nobu 2e5e8fd895 * configure.in (warnflags): use -Wextra instead of -Wall.
* gc.c (mark_current_machine_context): get rid of warning.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-22 22:28:52 +00:00
nobu fe1ce93f52 * compile.c, cont.c, gc.c, insns.def, iseq.c, iseq.h, process.c,
thread.c, vm.c, vm_core.h, vm_dump.c, vm_eval.c,
  vm_insnhelper.c, vm_method.c, template/insns_info.inc.tmpl,
  tool/instruction.rb: fixed types.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-21 20:58:26 +00:00
nobu d36c76dc71 * common.mk (eval.o): needs vm.h.
* eval.c (ruby_cleanup): destruct current VM before exit.

* gc.c (rb_objspace_free): free object space.

* vm.c (ruby_vm_destruct): destruct and free VM struct.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-18 07:29:17 +00:00
nobu 0cb17717fe * gc.c (vm_xrealloc): free as like standard free if size is zero.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-17 09:34:20 +00:00
ko1 a4b94c4443 * gc.c (obj_free): fix to free method table (fix memory leak).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-02 02:37:46 +00:00
nobu fcf88c1b8d * method.h (rb_method_definition_t): split from rb_method_entry_t
to deal aliases.  [ruby-dev:39165]

* proc.c (struct METHOD): contains rb_method_entry_t copy.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-28 02:45:41 +00:00
nobu 0c86e8b70b * method.c (rb_method_entry_t): body.proc should be marked.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-26 06:26:08 +00:00
nari de5f15bbe4 * gc.c: reject unused longlife gc.
* debug.c: ditto.

* include/ruby/intern.h: ditto.

* include/ruby/ruby.h: ditto.

* iseq.c: ditto.

* node.h: ditto.

* vm_insnhelper.c: ditto.

* vm_insnhelper.h: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-10 02:40:34 +00:00
nobu 9009b471da * gc.c (rb_gc_enable, rb_gc_disable): should return Qtrue/Qfalse.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-21 03:45:37 +00:00
nobu e07cb859cc * suppressed shorten-64-to-32 warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-18 08:05:32 +00:00
ko1 c330876d7c * method.h, vm_core.h: add rb_method_entry_t. Remove nodes around
method management.  This change affect some VM control stack structure.
* vm.c, vm_insnhelper.c, vm_method.c, vm_eval.c: ditto.  and make some
  refactoring.
* insns.def, class.c, eval.c, proc.c, vm_dump.c : ditto.
* vm_core.h, compile.c (iseq_specialized_instruction): remove
  VM_CALL_SEND_BIT.  use another optimization tech for Kernel#send.
* node.h: remove unused node types.
* ext/objspace/objspace.c (count_nodes): ditto.
* gc.c: add mark/free functions for method entry.
* include/ruby/intern.h: remove decl of
  rb_define_notimplement_method_id().  nobody can use it
  because noex is not opend.
* iseq.c (iseq_mark): fix to check ic_method is available.
* iseq.c (rb_iseq_disasm): fix to use rb_method_get_iseq().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-15 14:59:41 +00:00
ko1 9e60743008 * include/ruby/ruby.h:
rename
  "...TypeStruct" and "typed_struct" to
  "TypedData..." and "typeddata", respectively.
  rename
  rb_data_type_t#name to
  rb_data_type_t#wrap_struct_name.
* error.c, gc.c, iseq.c, vm.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-07 20:28:27 +00:00
nobu 649237de8f * gc.c (rb_gc_call_finalizer_at_exit): deal with typed struct like
as obj_free().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-07 08:00:44 +00:00
nobu 450f784216 * gc.c (GC_PROF_SET_MALLOC_INFO, GC_PROF_SET_HEAP_INFO): simplified.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-07 02:56:57 +00:00
mame 5be8596447 * gc.c: remove the definition of GC_DEBUG (debugging macro).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-23 11:34:03 +00:00
ko1 dfb0fa0ca6 fix indent.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23711 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-16 21:40:42 +00:00
ko1 a74d12dc28 * include/ruby/ruby.h: New structure RTypedData, added.
This structure incldues more explicit type information for
  T_DATA objects.  If RData(obj)->dfree is immediate value `1' on
  T_DATA object obj, obj is needed to be accessed with RTYPEDDATA(obj)
  instead of RDATA(obj).  A RTypedData structure points the structure
  rb_typed_data_t.  rb_typed_data_t includes information such as the
  type name of this data, mark and free function what RData includes,
  and memsize function show how data consuming the memory size.
  Note that you do not need any change existing T_DATA objects.
  If you use RDataType instead of RData on T_DATA object,
  you can specify explicit type information.
* gc.c (rb_data_typed_object_alloc, rb_objspace_data_type_memsize,
  rb_objspace_data_type_name): added.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-16 21:36:50 +00:00
ko1 a0e0fafa0c * gc.c: fix indent.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-16 21:15:15 +00:00
ko1 06f833e6d5 * gc.c (rb_objspace_each_objects): New C API, added.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-16 21:07:26 +00:00
matz 50e7cb3b38 * gc.c (os_obj_of): invoke garbage collection before iteration, to
avoid accessing half recycled object references.  [ruby-dev:38613]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-15 09:06:16 +00:00
nobu 3898e7b8ee * gc.c: fixed types.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-26 05:24:19 +00:00
nari 57b83a5191 * gc.c: add longlife garbage collection. [ruby-dev:38423]
(NORMAL_HEAPS_USED): new macro.
  (LONGLIFE_ALLOCATE_HEAPS_MIN): ditto.
  (add_longlife_heaps_slot): new function.
  (rb_newobj_from_longlife_heap): ditto.
  (rb_newobj_longlife): ditto.
  (rb_node_newnode_longlife): ditto.
  (rb_gc_write_barrier): ditto.
  (remembered_set_recycle): ditto.
  (rb_gc_mark_remembered_set): ditto.
  (clear_mark_longlife_heaps): ditto.
  (gc_sweep_for_longlife): ditto.
  (assign_heap_slot): new argumnent to longlife heaps slot.
  (add_freelist): ditto.
  (gc_sweep): avoid lonlife heap slot. set longlife_collection
   flag at add heap.
  (rb_gc_force_recycle): avoid mark object and remembered_set
   object.
  (garbage_collect): add longlife collection.
  (rb_gc_start): invoke longlife collection.
  (gc_profile_record_get): for longlife collction profile.
  (gc_profile_result): ditto.

* include/ruby/intern.h (rb_gc_write_barrier): declared.

* include/ruby/ruby.h (FL_REMEMBERED_SET): renamed from FL_RESERVED.

* debug.c (FL_REMEMBERED_SET): ditto.

* insns.def (setinlinecache): insert write barrier.

* vm_insnhelper.c (vm_method_search): ditto.

* set_relation (set_relation): use longlife object.

* vm.c (vm_define_method): ditto.

* vm_core.h (NEW_INLINE_CACHE_ENTRY): ditto.

* vm_method.c (rb_add_method): ditto.

* class.c (rb_add_method): ditto.

* node.h (NEW_NODE_LONGLIFE): new macro.
  (rb_node_newnode_longlife): declared.
					    


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-13 14:08:26 +00:00
nobu c7853b4344 * eval.c (ruby_cleanup): the order of local variables on stack is
undefined.  should use outermost VALUE for ruby_init_stack.

* gc.c (ruby_get_stack_grow_direction, Init_stack): allows volatile
  pointer.

* thread_*.c (ruby_init_stack): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-19 05:43:20 +00:00
nari 5cb55eca6f * gc.c (init_heap): set default to heap slots length
if HEAP_OBJ_LIMIT is larger than HEAP_MIN_SLOTS. [Bug #1310]
  (set_heaps_increment): increment next_heaps_length if
  next_heaps_length and heaps_used are same.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-23 05:58:15 +00:00
nobu e9b98f413e * configure.in (AC_HEADER_DIRENT): added.
* include/ruby/ruby.h (NUM2INT, rb_special_const_p): returns true
  and false instead of Qtrue and Qfalse for platforms where VALUE
  is bigger than int.

* gc.c (gc_stress_set), ext/openssl/ossl_asn1.c (decode_bool): got
  rid of variables named `bool'.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-13 01:42:21 +00:00
nobu d1abc53721 * array.c, bignum.c, dln.c, error.c, gc.c, io.c, marshal.c,
numeric.c, pack.c, strftime.c, string.c, thread.c, transcode.c,
  transcode_data.h, util.c, variable.c, vm_dump.c,
  include/ruby/encoding.h, missing/crypt.c, missing/vsnprintf.c:
  suppress VC type warnings.  [ruby-core:22726]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-12 09:16:15 +00:00
nobu 2e54fe9d4d * array.c, bignum.c, gc.c, numeric.c, string.c, util.c, insns.def,
missing/crypt.c, missing/vsnprintf.c, : suppress warnings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-10 05:43:14 +00:00
nobu be7679308b * gc.c (ruby_get_stack_grow_direction): no needs to use thread
here, and not initialized yet.  [ruby-core:22439]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-27 09:01:21 +00:00
nobu 12d2c8ba41 stripped trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 14:23:33 +00:00
mame e722ad99d5 * string.c (rb_hash_uint32, rb_hash_uint, rb_hash_start, rb_hash_end),
include/ruby/intern.h: add Murmurhash API.  [ruby-dev:37784]

* complex.c (nucomp_hash), array.c (rb_ary_hash), time.c (time_hash),
  string.c (rb_str_hsah), object.c (rb_obj_hash), range.c
  (range_hash), struct.c (rb_struct_hash), hash.c (rb_any_hash),
  rational.c (nurat_hash): use Murmurhash.  [ruby-dev:37784]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-14 19:55:34 +00:00
nobu 643b8cb4b4 * gc.c (vm_xmalloc, vm_xrealloc): comparisons had no meanings on
platforms where size_t is unsigned.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-12 14:28:58 +00:00
usa e3c5fbba91 * gc.c (define_final, undefine_final): shouldn't add/remove finalizer
of forzen objects.

	* gc.c (undefine_final): should remove FL_FINALIZE flag.
	  [ruby-dev:37964] (also see [ruby-dev:37959])



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22240 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-11 09:11:48 +00:00
nobu 55bde4fbbd * gc.c (define_final): cannot define finalizer for immediate
values.  [ruby-core:21500]

* gc.c (define_final): freezes or hides internal values.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-22 03:18:16 +00:00
ko1 7d431933b6 * gc.c (garbage_collect_with_gvl): suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-19 01:44:39 +00:00
ko1 b5cd33a4ad * gc.c (gc_with_gvl): suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-15 15:21:43 +00:00
akr 3d829c8697 * gc.c (negative_size_allocation_error_with_gvl): abolish a warning.
(negative_size_allocation_error): ditto.

* ext/openssl/ossl.c (ossl_raise): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-14 13:39:17 +00:00
ko1 29a6650d86 * gc.c (ruby_xmalloc, ruby_xrealloc, ruby_xfree):
enable to use them without GVL.
  if GC is invoked, acquire GVL during GC.
  if NoMemoryError is raised, acquire GVL and raise it.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-12 03:41:20 +00:00
nobu 541915b239 * compile.c (iseq_compile_each), gc.c (assign_heap_slot),
(gc_mark_children), parse.y (vtable_alloc, vtable_free, vtable_add),
  proc.c (proc_to_s), thread.c (terminate_i, rb_thread_terminate_all),
  (thread_start_func_2, blocking_region_begin, blocking_region_end),
  (rb_thread_kill), thread_pthread.c (native_thread_create),
  (ubf_pthread_cond_signal), vm.c (check_env, thread_free), vm_dump.c
  (vm_env_dump_raw, vm_stack_dump_each, vm_thread_dump_state),
  (vm_call0): use void pointer for %p.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-09 04:33:55 +00:00
matz ce5063c283 * gc.c (gc_mark): still needs to check stack depth during GC.
* gc.c (stack_check): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-27 14:55:45 +00:00
nobu 7348aa6113 * gc.c (ruby_stack_check): no check if using sigaltstack.
* signal.c (register_sigaltstack): minimum size is insufficient for
  method calls.

* signal.c (sigsegv): handles stack overflow if possible.

* thread.c (ruby_thread_stack_overflow): helper function to raise
  sysstack_error.

* thread_pthread.c (ruby_stack_overflowed_p): checks for stack
  overflow.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-27 06:05:07 +00:00
nobu 551dfe9d8b * include/ruby/io.h (rb_io_t): added write_lock to serialize.
[ruby-core:19668]

* gc.c (gc_mark_children): mark write_lock.

* gc.c (rb_gc_call_finalizer_at_exit): Mutex also needs to be
  deferred.

* io.c (io_fflush, io_binwrite, fptr_finalize): serializes writing.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-07 20:47:02 +00:00
nari ee1e8e1a9b * gc.c (gc_profile_result): bug fix. The millisecond is 1/1000.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-25 11:10:39 +00:00
yugui c86ce094e2 * include/ruby/ruby.h: embeds the elements of an array into its
struct RArray for # of elements <= 3.

	* array.c: ditto.

	* gc.c (gc_mark_children): following the change of struct RArray.

	* ext/tk/tcltklib.c (ip_ruby_cmp): ditto.

	* parse.y (coverage): ditto.

	* proc.c (curry): ditto.

	* .gdbinit: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-09 05:47:04 +00:00
nobu 73a2f67164 * gc.c (gc_mark_children): ignores T_ZOMBIE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-06 06:22:11 +00:00
yugui ae7ea3332b * dln.c: Ruby no longer supports MS-DOS.
* ext/sdbm/_sdbm.c: ditto.

* ext/sdbm/sdbm.h: ditto.

* gc.c: ditto.

* hash.c: ditto.

* include/ruby/defines.h: ditto.

* include/ruby/util.h: ditto.

* io.c: ditto.

* process.c: ditto.

* ruby.c: ditto.

* strftime.c: ditto.

* util.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-04 13:33:22 +00:00
yugui 8dd118c0db * djgpp/GNUmakefile.in: removed. Ruby no longer supports djgpp.
* djgpp/README.djgpp: ditto.

* djgpp/config.hin: ditto.

* djgpp/config.sed: ditto.

* djgpp/configure.bat: ditto.

* djgpp/mkver.sed: ditto.

* ext/Setup.dj: ditto.

* dln.c: removed djgpp supports.

* file.c: ditto.

* gc.c: ditto.

* io.c: ditto.

* process.c: ditto.

* ruby.c: ditto.

* signal.c: ditto.

* util.c: ditto.

* vm_core.h: ditto.

* lib/fileutils.rb: ditto.

* lib/mkmf.rb: ditto.

* ext/socket/socket.c: ditto.

* test/fileutils/test_fileutils.rb: ditto.

* test/ruby/test_env.rb: ditto.

* test/ruby/test_path.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-04 13:25:12 +00:00
yugui bbbd9c0b7b * x68/_dtos18.c: removed. Ruby no longer supports human68k.
* x68/_round.c: ditto.

* x68/fconvert.c: ditto.

* x68/select.c: ditto.

* ext/Setup.x68: ditto.

* missing/x68.c: ditto.

* dln.c (dln_find_exe_r): removed human68k supports.
  (dln_find_1): ditto.

* lib/mkmf.rb: ditto.

* ext/extmk.rb (Init_ext): ditto.

* ext/socket/socket.c (init_sock): ditto.

* gc.c (GC_MALLOC_LIMIT): ditto.
  (rb_setjmp, rb_jmpbuf): ditto.
  (mark_current_machine_context): ditto.

* include/ruby/defines.h (PATH_ENV): ditto.

* io.c: ditto.

* process.c: ditto.

* ruby.c: ditto.

* test/ruby/test_env.rb: ditto.

* test/ruby/test_path.rb: ditto.

* LEGAL


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-04 13:12:13 +00:00
nobu 952385b712 * gc.c (rb_gc_call_finalizer_at_exit): finalize deferred IO and Data.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-01 12:36:38 +00:00
nobu 837d3aa882 * gc.c (rb_gc_call_finalizer_at_exit): deffers IO finalization.
[ruby-dev:36646]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-01 10:13:57 +00:00
ko1 2e311f6bd5 * include/ruby/node.h, node.h: move node.h from include path.
This change stop to install node.h beacuase of saving ABI
  (node.h will be changed. Extensions should not depends on
  this file).
* blockinlining.c, class.c, compile.c, debug.h, enum.c,
  gc.c, iseq.c, parse.y, ruby.c, signal.c, variable.c,
  vm.c, vm_core.h, vm_dump.c: ditto.
* ext/ripper/depend: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 19:52:31 +00:00
tadf 9467d7a024 * complex.c: an instance method image has been removed and
uses "imag" instead of "image".

	* complex.c: two instance method re and im are removed.

	* rational.c: follows the above changes.

	* include/ruby/ruby.h: ditto.

	* gc.c: ditto.

	* lib/cmath.rb: ditto.

	* lib/mathn.rb: ditto.

	* lib/complex.rb: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-20 22:49:56 +00:00
ko1 69029b90fe * gc.c, include/ruby/ruby.h: rename rb_register_mark_object()
to rb_gc_register_mark_object().
* eval.c, vm.c: initialize vm->mark_object_ary at
  Init_top_self().
* bignum.c, complex.c, encoding.c, ext/win32ole/win32ole.c,
  io.c, load.c, marshal.c, rational.c, ruby.c, vm.c:
  use rb_gc_register_mark_object() instead of
  rb_global_variable() or rb_gc_register_address().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-15 14:59:14 +00:00
akr baac56be36 * include/ruby/io.h (rb_io_t): rename field: writeconv_stateless to
writeconv_asciicompat.

* io.c: follow the renaming.

* gc.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-09 15:02:42 +00:00
matz 31b6ea65bb * include/ruby/ruby.h (DBL2NUM): renamed from DOUBLE2NUM.
a patch from Tadashi Saito <shiba at mail2.accsnet.ne.jp>
  in [ruby-dev:36102].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-05 18:24:21 +00:00
nari c56ef25cf9 * gc.c (gc_profile_record_get): to static function.
(gc_profile_result): ditto.
  (gc_profile_report): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-04 10:47:39 +00:00
nobu c5bf9ceef6 * vm_core.h (struct rb_vm_struct): replaced signal staff with trap
staff.

* signal.c (signal_buff): per process resouce now.

* signal.c (trap_list): moved to VM.

* signal.c (rb_get_next_signal): reverted.

* signal.c (rb_trap_exit): trap_pending_list was no longer used.

* thread.c (timer_thread_function): delivers buffered per-process
  signals to each VMs.

* vm.c (rb_vm_mark): marks trap_list.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-04 04:22:04 +00:00
akr 58964e3249 * include/ruby/io.h (rb_io_t): new fields: encs.ecopts and
writeconv_pre_ecopts.
  (MakeOpenFile): initialize them.

* include/ruby/encoding.h (rb_str_transcode): take ecopts argument.
  (rb_econv_flags): removed.
  (rb_econv_prepare_opts): declared.
  (rb_econv_open_opts): declared.

* io.c (make_writeconv): use rb_econv_open_opts.
  (make_readconv): ditto.
  (io_fwrite): follow rb_str_transcode change.
  (rb_io_extract_modeenc): use rb_econv_prepare_opts.
  (rb_file_open_generic): initialize encs.ecopts.
  (rb_file_open_internal): ditto.
  (rb_io_reopen): ditto.
  (argf_ecopts): defined.
  (argf_next_argv): set encs.ecopts.
  (io_encoding_set): use rb_econv_prepare_opts.
  (argf_set_encoding): set argf_ecopts.

* gc.c (gc_mark_children): mark encs.ecopts and writeconv_pre_ecopts
  in T_FILE.

* transcode.c (transcode_loop): take ecopts argument. use
  rb_econv_open_opts.
  (rb_econv_flags): removed.
  (rb_econv_prepare_opts): defined.
  (rb_econv_open_opts): defined.
  (str_transcode0): take ecopts.
  (str_transcode): use rb_econv_prepare_opts.
  (rb_str_transcode): take ecopts.
  (econv_init): accept hash argument.
  (econv_insert_output): follow rb_str_transcode change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-03 18:18:10 +00:00
ko1 204929af9d * include/ruby/signal.h: removed.
* common.mk, class.c, eval.c, eval_intern.h, file.c, gc.c, hash.c,
  io.c, process.c, signal.c: vm_core.h: ditto.
  Some unused external global variables are also removed.
  (rb_prohibit_interrupt, rb_trap_immediate, rb_trap_pending,
  rb_thread_critical)
* ext/openssl/ossl_ssl.c, ext/openssl/ossl_x509store.c,
  ext/readline/readline.c, ext/socket/depend,
  ext/socket/socket.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-03 08:00:05 +00:00
ko1 fa4c17e712 * gc.c, include/ruby/ruby.h: rename T_DEFERRED to T_ZOMBIE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-29 11:22:42 +00:00
akr 895fd7ec5e * include/ruby/io.h (rb_io_t): remove path field and add pathv field.
(MakeOpenFile): initialize pathv as Qnil.

* gc.c: mark pathv field in T_FILE.

* io.c: follow the rb_io_t field change.

* file.c: ditto.

* ext/socket/socket.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-23 00:47:54 +00:00
akr 035d4816c3 * include/ruby/io.h (rb_io_t): new fields: writeconv,
writeconv_stateless and writeconv_initialized.
  (MakeOpenFile): initialize them.

* include/ruby/encoding.h (rb_econv_stateless_encoding): declared.
  (rb_econv_string): declared.

* io.c (make_writeconv): new function.
  (io_fwrite): use econv.
  (make_readconv): fix error message.
  (finish_writeconv): new function.
  (fptr_finalize): call finish_writeconv.
  (clear_writeconv): new function.
  (clear_codeconv): new function to call both clear_readconv and
  clear_writeconv.
  (rb_io_fptr_finalize): call clear_codeconv instead of
  clear_readconv.
  (mode_enc): ditto.
  (io_set_encoding): ditto.
  (argf_next_argv): ditto.
  (io_encoding_set): ditto.

* gc.c (gc_mark_children): mark writeconv_stateless in T_FILE.

* transcode.c (stateless_encoding_i): new function.
  (rb_econv_stateless_encoding): ditto.
  (rb_econv_string): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-18 12:06:42 +00:00
nobu 2c20dd1473 * gc.c (getrusage_time): should return the value.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-14 05:57:58 +00:00
ko1 96af71a288 * gc.c: count only freed object as freelist size.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-13 10:42:57 +00:00
kouji 741cc67800 * gc.c (getrusage_time): Returned effective value on Windows.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-12 09:55:06 +00:00
nari 5b3278b74a * gc.c (gc_profile_result): use rb_str_catf.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-12 07:24:30 +00:00
nari fccc094568 * gc.c (gc_profile_result): use sprintf.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-12 07:02:04 +00:00
nobu 35b6abbca2 * gc.c (getrusage_time): works only if RUSAGE_SELF is defined right
now.

* gc.c (gc_profile_result): C99.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-11 11:11:27 +00:00
nari 130e720253 * gc.c: added GC::Profiler.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-11 09:36:57 +00:00
nobu bdcb8fd07e * gc.c (STACK_LEVEL_MAX, ruby_stack_length): returns size_t.
[ruby-core:18207]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-09 23:56:17 +00:00
nobu d8353d6b6e * gc.c (run_final): runs finalizers with the object terminated.
* gc.c (rb_gc_call_finalizer_at_exit): keeps finalized objects from
  linking to freelist.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-06 20:06:05 +00:00
nobu 7d072e2ba4 * gc.c (chain_finalized_object): deletes finalizers to be invoked from
finalizer_table.

* gc.c (rb_gc_call_finalizer_at_exit): warns when could not invoke
  finalizers.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-06 12:25:47 +00:00
nobu faf2541c2b * gc.c (rb_gc_call_finalizer_at_exit): self-referencing finalizers
cannot be invoked.  [ruby-dev:35681]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-06 11:48:30 +00:00
mame 57b9e18d71 * gc.c (allocate_heaps, assign_heap_slot, rb_newobj_from_heap):
reset during_gc before raising NoMemoryError.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-01 12:36:39 +00:00
ko1 845e5766dc * gc.c (gc_mark_children, obj_free): T_DEFERRED should not be appear.
* gc.c (gc_sweep, finalize_list): fix to decrement heap_slot#limit
  after executing finalizer.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-27 13:08:02 +00:00
ko1 60be3dc560 * include/ruby/ruby.h: add a type T_DEFERRED.
* gc.c: fix deferred finalizer system.  finalize processes of
  T_DATA and T_FILE are executed after gc process.
  And fix to use BUILTIN_TYPE() instead of seeing flag.
* thread.c, vm_core.h: add RUBY_VM_SET_FINALIZER_INTERRUPT()
  and check intterupt_flag at rb_thread_execute_interrupts().
* thread.c (mutex_mark): fix to mark next_mutex.
* vm.c (rb_thread_mark): fix to mark keeping_mutexes.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-27 05:59:32 +00:00
nobu f421f68484 * gc.c (gc_sweep, obj_free, run_final): defer finalizers of IO and
Data.  [ruby-dev:35578]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-25 14:48:12 +00:00
nari 52f780c07f * gc.c: revert. before lazy sweep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-05 07:15:41 +00:00
nari 5b72919469 * gc.c (garbage_collect_force): sweep is completely ended.
* gc.c (os_obj_of): invoke garbage_collect_force() when freelist none.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-04 02:18:17 +00:00
nobu bb350b04e5 * eval.c (Init_eval), gc.c (Init_GC), proc.c (Init_Proc): freeze
messages of preallocated special exceptions also.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-02 22:02:58 +00:00
nobu 7f637ab96f * gc.c (rb_during_gc): VALUE cache is irrelevant.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-02 19:39:33 +00:00