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

713 Коммитов

Автор SHA1 Сообщение Дата
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
suke 8519afcb41 * gc.c: add rb_during_gc(). based on a patch from arton <artonx AT
yahoo.co.jp> at [ruby-dev:35313].   

* include/ruby/intern.h: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-02 15:18:44 +00:00
nari 8bccb5f266 *gc.c (gc_lazy_sweep) : use lazy sweep algorithm for response performance gain.
(garbage_collect_force) : mark and lazysweep invoke, after erasing all mark.
 (GC_NOT_LAZY_SWEEP) : not lazy sweep flag. for debug.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-02 00:49:10 +00:00
nobu 01a025d2d7 * gc.c (rb_newobj): abort GC phase before rb_bug.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-30 15:49:13 +00:00
nobu ac388541c4 * gc.c (chain_finalized_object): should not delete from finalizer
table until run.

* gc.c (rb_gc_call_finalizer_at_exit): deferred_final_list may be
  empty first.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-30 13:12:49 +00:00
nobu d0f211f394 * gc.c (gc_finalize_deferred): allow object allocation in finalizers.
* gc.c (rb_gc_call_finalizer_at_exit): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-30 09:57:07 +00:00
usa eedb3dc3a3 * gc.c (rb_newobj): prohibit call of rb_newobj() during gc when
USE_VALUE_CACHE is not defined (normal case).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-30 05:42:34 +00:00
akr 340cd503a7 * include/ruby/ruby.h (struct RRegexp): new field usecnt. replace
str and len by src.

* gc.c (gc_mark_children): mark src field of regexp.
  (obj_free): don't free str field.

* re.c (REG_BUSY): removed.
  (rb_reg_initialize): prohibit re-initialize regexp.
  (rb_reg_search): use usecnt to prevent freeing regexp currently
  using.  this prevents SEGV by:
    r = /\A((a.)*(a.)*)*b/
    r =~ "ab" + "\xc2\xa1".force_encoding("euc-jp")
    t = Thread.new { r =~ "ab"*8 + "\xc2\xa1".force_encoding("utf-8")}
    sleep 0.2
    r =~ "ab"*8 + "\xc2\xa1".force_encoding("euc-jp")



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-28 12:25:45 +00:00
shyouhei 87d053f000 * gc.c (rb_newobj): prohibit call of rb_newobj() during gc.
a patch from Sylvain Joyeux in [ruby-core:12099].



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-18 14:09:33 +00:00
nobu 9b45b336ee * vm_core.h (rb_vm_t), vm.c (rb_vm_mark): moved preallocated special
exceptions.

* eval.c (Init_eval), gc.c (Init_GC), proc.c (Init_Proc): freeze
  preallocated special exceptions.

* eval.c (rb_longjmp): duplicate the thrown exception to set backtrace
  if it was frozen.

* gc.c (rb_memerror): raise nomem_error without backtrace if failed to
  make backtrace.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-15 09:17:06 +00:00
nobu fc3c60f608 * gc.h (STACK_UPPER): moved from gc.c
* thread.c, thread_{pthread,win32}.c (ruby_init_stack,
  ruby_thread_init_stack): moved stack initialization from gc.c.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-14 02:59:19 +00:00
akr 436b02b332 * gc.c (ruby_initial_gc_stress): defined.
(ruby_initial_gc_stress_ptr): defined.

* debug.c (set_debug_option): use ruby_initial_gc_stress_ptr for
  gc_stress option.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-13 22:57:41 +00:00
nobu 4641b80166 * gc.c (ruby_gc_stress): moved to rb_objspace_t.
* gc.c (gc_stress_get, gc_stress_set): VM local attribute.

* signal.c (sigsegv): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-13 15:09:22 +00:00
nobu 32ef17fe7b * gc.c (rb_memerror): exit with EXIT_FAILURE instead of magic number.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-13 05:24:40 +00:00
nobu 8477860694 * gc.c (ruby_stack_check): STACK_LENGTH should be less than
STACK_LEVEL_MAX.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-13 05:19:01 +00:00
nobu 10bfa5d49f * include/ruby/intern.h (Init_stack): make to call ruby_init_stack.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-09 00:54:23 +00:00
ko1 a99140631c * gc.c: add a build option "CALC_EXACT_MALLOC_SIZE".
This option enables to calculate exact size of current
  allocated size by malloc().  You can access these information
  with GC.malloc_allocated_size and GC.malloc_allocations.
  This option consume additional memory as a header of each memory
  object.  This option also helps to find out xmalloc()/xfree()
  consistency.  If you get trouble with this option, some extension
  using "free()" instead of "xfree()".
  This options is disabled by default.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-08 10:27:06 +00:00
ko1 72ba13aa8e * array.c, bignum.c, cont.c, dir.c, dln.c, encoding.c, enumerator.c,
enumerator.c (enumerator_allocate), eval_jump.c, file.c, hash.c,
  io.c, load.c, pack.c, proc.c, random.c, re.c, ruby.c, st.c,
  string.c, thread.c, thread_pthread.c, time.c, util.c, variable.c,
  vm.c, gc.c:
  allocated memory objects by xmalloc (ruby_xmalloc) should be
  freed by xfree (ruby_xfree).
* ext/curses/curses.c, ext/dbm/dbm.c, ext/digest/digest.c,
  ext/gdbm/gdbm.c, ext/json/ext/parser/parser.c,
  ext/json/ext/parser/unicode.c, ext/openssl/ossl_cipher.c,
  ext/openssl/ossl_hmac.c, ext/openssl/ossl_pkey_ec.c,
  ext/sdbm/init.c, ext/strscan/strscan.c, ext/zlib/zlib.c:
  ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-08 10:01:40 +00:00
akr f6ec71fc4c * gc.c (count_objects): clear hash after counting objects.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-06 06:05:44 +00:00
mame 5e9b9ff9cb * gc.c (rb_objspace_alloc): this function is needed only when
ENABLE_VM_OBJSPACE macro is defined.

* vm.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-05 14:41:41 +00:00
akr 18d4c1f044 * gc.c (os_obj_of): heaps may be modified in yield.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-05 13:52:02 +00:00
akr fa58f951cf * gc.c (count_objects): clear given hash.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-31 14:03:23 +00:00
nobu 0343750b62 * include/ruby/ruby.h (PRI[diouxX]VALUE): printf format for VALUE.
* gc.c (assign_heap_slot): suppress a warning.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-20 02:36:09 +00:00
ko1 385f0e8af6 * vm.c, insns.def, eval.c, vm_insnhelper.c: fix CREF handling.
VM value stack frame of block contains cref information.
  (dfp[-1] points CREF)
* compile.c, eval_intern.h, eval_method.c, load.c, proc.c,
  vm_dump.h, vm_core.h: ditto.
* include/ruby/ruby.h, gc.c: remove T_VALUES because of above
  changes.
* bootstraptest/test_eval.rb, test_knownbug.rb: move solved test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-19 03:08:50 +00:00
akr 430cabfad8 * gc.c (ruby_vm_xmalloc): increase malloc_increase only if malloc
succeeds.  failed malloc size can be huge.  it may increase
  malloc_limit too big which cause less GC and memory full.
  (ruby_vm_xrealloc): ditto.
  (rb_objspace): make params.limit and params.increase size_t.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16388 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-12 06:28:43 +00:00
akr 2c012e01db * gc.c (assign_heap_slot): fix condition for number of objects in
a heap.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-12 03:30:34 +00:00
yugui 7c104f88eb * gc.c (assign_heap_slot): put the binary-search routine in order.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-12 02:15:55 +00:00
akr e389ce0676 * include/ruby/ruby.h (SIZET2NUM): new macro.
(NUM2SIZET): new macro.

* gc.c (struct rb_objspace): use size_t for increment, length and
  used for 64bit.
  (allocate_heaps): ditto.
  (assign_heap_slot): ditto.
  (set_heaps_increment): ditto.
  (gc_mark_all): ditto.
  (is_pointer_to_heap): ditto.
  (free_unused_heaps): ditto.
  (gc_sweep): ditto.
  (os_obj_of): ditto.
  (rb_gc_call_finalizer_at_exit): ditto.
  (count_objects): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-11 05:44:36 +00:00
yugui e45b87f282 * gc.c (gc_count): rdoc corrected.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-10 23:02:30 +00:00
akr 3e8e963837 * gc.c (set_heaps_increment): fix memory allocation strategy by
determining heaps_inc from heaps_used, not objects_delta.
  (struct rb_objspace): delta removed.  change increment, length and
  used to long for LP64.
  (objects_delta): removed.
  (allocate_heaps): add next_heaps_length argument.
  (init_heap): renamed from add_heap.
  (garbage_collect): use heaps_increment in dont_gc.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-04 17:25:38 +00:00
ko1 3de80833a2 * gc.c (gc_count): add a GC.count method. This method returns
a GC invoking count.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-27 06:28:08 +00:00
nobu 09007ccbaa * vm_core.h (rb_vm_t), gc.c (rb_objspace, rb_newobj), vm.c
(Init_BareVM): per-VM object space support, which is disabled now.

* gc.c (rb_objspace_alloc), vm.c (Init_BareVM): should not use ruby
  malloc here.

* gc.c (garbage_collect, etc): performance improvement by passing the
  reference instead of refering the global variable in each functions.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-27 03:20:35 +00:00
nobu c7451eb725 * error.c (builtin_types), gc.c (count_objects): added Complex and
Rational.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-26 08:42:34 +00:00
ko1 9d0a5d8e96 * include/ruby/ruby.h, gc.c: remove T_BLOCK.
* include/ruby/ruby.h: re-number T_xxx.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-26 08:32:23 +00:00
matz 4d93af26df * gc.c (free_unused_heaps): preserve last used heap segment to
reduce malloc() call.

* gc.c (HEAP_SIZE): use smaller heap segment (2K) for more chance
  to be freed.  based on patch from authorNari <authornari at gmail.com>.

* gc.c (rb_newobj_from_heap): eventually allocate heap segments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-25 09:03:32 +00:00
usa fd8734a64d * gc.c (ruby_xmalloc): use size_t for malloc argument instead of long.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-20 23:55:09 +00:00
nobu 6b5e24a61a * gc.c (rb_gc_mark_locations): get rid of underflow.
* gc.c (mark_current_machine_context): check if the main thread stack
  position may shink under the intialized position.  [ruby-core:16436]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-18 08:37:50 +00:00
nobu b2dde8243b * gc.c (Init_stack): use ruby_init_stack. [ruby-dev:34350]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-14 03:52:27 +00:00
nobu 01f468d138 * gc.c (rb_objspace_t): packed globals. [ruby-dev:34348]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-14 03:47:04 +00:00
nobu a39883b74a * gc.c (finalizers): removed. [ruby-dev:34349]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-14 03:44:15 +00:00
nobu 7b4a171158 * eval.c (ruby_exec_node, ruby_run_node), ruby.c (process_options):
use iseq instead of NODE.

* gc.c (source_filenames): removed.

* include/ruby/intern.h, parse.y (yycompile, parser_mark, parser_free,
  ripper_initialize): rb_source_filename() is no longer used.

* compile.c, compile.h (ERROR_ARGS), parse.y (node_newnode, fixpos,
  parser_warn, e_option_supplied, warn_unless_e_option, range_op,
  cond0): nd_file is no longer used.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-12 03:41:51 +00:00
nobu b39676f6a9 * configure.in (RUBY_SETJMP, RUBY_LONGJMP, RUBY_JMP_BUF): prefers
__builtin_setjmp, _setjmp over setjmp and sigsetjmp.
  [ruby-core:16023], [ruby-core:16086]

* configure.in (--with-setjmp-type): new option to override the
  default rule in the above.

* eval_intern.h (ruby_setjmp, ruby_longjmp), gc.c (rb_setjmp),
  vm_core.h (rb_jmpbuf_t): use RUBY_SETJMP, RUBY_LONGJMP and
  RUBY_JMP_BUF.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-31 17:58:41 +00:00
tadf 6125552c27 both complex and rational are now builtin classes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-16 00:23:43 +00:00
nobu 96240c6d2d * eval_intern.h (rb_thread_raised_set): use generic flags.
* eval.c (rb_longjmp): clear all raised flags.

* eval.c (stack_check): leave clearing flag to rb_longjmp.

* gc.c (rb_memerror): use thread raised flag instead of static flag.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-12 05:47:10 +00:00
nobu 8c36abe23a * gc.c: fixed indent.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-12 03:52:52 +00:00
nobu 434b820f51 * gc.c: removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-12 03:49:55 +00:00
matz 39787ea14d * numeric.c (fix_to_s): avoid rb_scan_args() when no argument
given. 
* bignum.c (rb_big_to_s): ditto.
* enum.c (enum_first): ditto.
* eval_jump.c (rb_f_catch): ditto.
* io.c (rb_obj_display): ditto.
* class.c (rb_obj_singleton_methods): ditto.
* object.c (rb_class_initialize): ditto.
* random.c (rb_f_srand): ditto.
* range.c (range_step): ditto.
* re.c (rb_reg_s_last_match): ditto.
* string.c (rb_str_to_i): ditto.
* string.c (rb_str_each_line): ditto.
* string.c (rb_str_chomp_bang): ditto.
* string.c (rb_str_sum): ditto.

* string.c (str_modifiable): declare inline.
* string.c (str_independent): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-05 05:22:17 +00:00
akr 8e1d6b214a * gc.c (add_heap): fix previous change. [ruby-dev:33988]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-04 04:42:31 +00:00
nobu fd847f79a0 * gc.c (add_heap): use binary search to find the place to insert the
new heap slot.  [ruby-dev:33983]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-04 01:21:06 +00:00
matz 384e8e6680 * gc.c (add_heap): sort heaps array in ascending order to use
binary search.

* gc.c (is_pointer_to_heap): use binary search to identify object
  in heaps.  works better when number of heap segments grow big.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-03 08:27:43 +00:00
akr b58e36da4a * include/ruby/ruby.h (ROBJECT_NUMIV): renamed from ROBJECT_LEN.
(ROBJECT_IVPTR): renamed from ROBJECT_PTR.

* variable.c: follow the above renaming.

* object.c: ditto.

* gc.c: ditto.

* marshal.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-25 16:18:18 +00:00
akr fec2c12c29 * gc.c (STACK_LENGTH) [SPARC] : 0x80 offset removed. [ruby-dev:33857]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-19 09:37:10 +00:00
akr 71c5e48598 * include/ruby/re.h (struct rmatch_offset): new struct for character
offsets.
  (struct rmatch): new struct.
  (struct RMatch): reference struct rmatch.
  (RMATCH_REGS): new macro.

* re.c (match_alloc): initialize struct rmatch.
  (pair_byte_cmp): new function.
  (update_char_offset): update character offsets.
  (match_init_copy): copy regexp and character offsets.
  (match_sublen): removed.
  (match_offset): use update_char_offset.
  (match_begin): ditto.
  (match_end): ditto.
  (rb_reg_search): make character offset updated flag false.
  (match_size): use RMATCH_REGS.
  (match_backref_number): ditto.
  (rb_reg_nth_defined): ditto.
  (rb_reg_nth_match): ditto.
  (rb_reg_match_pre): ditto.
  (rb_reg_match_post): ditto.
  (rb_reg_match_last): ditto.
  (match_array): ditto.
  (match_aref): ditto.
  (match_values_at): ditto.
  (match_inspect): ditto.

* string.c (rb_str_subpat_set): use RMATCH_REGS.
  (rb_str_sub_bang): ditto.
  (str_gsub): ditto.
  (rb_str_split_m): ditto.
  (scan_once): ditto.

* gc.c (obj_free): free character offsets.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-16 20:08:35 +00:00
nobu 91625011c2 * eval.c, gc.c (setjmp): sigsetjmp is a macro on cygwin.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-21 03:50:14 +00:00
nobu df28713ee3 * configure.in (sigsetjmp): check if available.
* eval.c, gc.c (setjmp): do not use _setjmp if sigsetjmp is available.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-19 02:21:55 +00:00
akr 6cdef2dc7e * $Date$ keyword removed to avoid inclusion of locale dependent
string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-06 15:49:38 +00:00
nobu 0d7405b69f * gc.c (os_obj_of): returns an enumerator if no block given. based on
a patch from Yugui <yugui AT yugui.sakura.ne.jp>.  [ruby-dev:32828]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-28 04:07:33 +00:00
akr 0972cbc284 * gc.c (rb_garbage_collect): new function for debugging.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14406 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 06:16:56 +00:00
akr 4f13113945 * vm_core.h (rb_thread_t): new member machine_stack_maxsize and
machine_register_stack_maxsize.

* gc.c (rb_gc_stack_maxsize): new global variable for the thread size
  of the main thread.
  (STACK_LEVEL_MAX): use machine_stack_maxsize of current thread.
  (ruby_stack_check): check IA64 register stack.
  (ruby_set_stack_size): set rb_gc_stack_maxsize.
  (Init_stack): set rb_gc_stack_maxsize.

* thread_pthread.ci (native_thread_create): initialize
  th->machine_stack_maxsize and th->machine_register_stack_maxsize.

* vm.c (Init_BareVM): initialize th->machine_stack_maxsize and
  th->machine_register_stack_maxsize.

* thread_win32.ci (native_thread_create): initialize
  th->machine_stack_maxsize.  not tested.  just a guess at all.

[ruby-dev:32604]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-15 04:09:24 +00:00
matz 9d8075b99c * parse.y (expr): redefinable not (!) operator.
* parse.y (arg): ditto.

* object.c (rb_obj_not): new method "!".

* object.c (rb_obj_not_equal): new method "!=".

* object.c (rb_obj_not_match): new method "!~".

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-09 16:39:49 +00:00
akr 60d0ddc942 * gc.c (gc_mark_children): obj->as.file.fptr may be 0 for T_FILE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-20 07:25:07 +00:00
akr 0d8ac93f58 * include/ruby/io.h (rb_io_t): add tied_io_for_writing member.
* io.c: use tied_io_for_writing for duplex popen.

* gc.c: mark tied_io_for_writing.

* common.mk: gc.o depends io.h.

  [ruby-dev:32205]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-20 03:16:53 +00:00
akr 4cdcfbe2ba * gc.c (count_objects): count TOTAL.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-03 23:13:57 +00:00
akr 16c8ac3921 * gc.c (count_objects): ObjectSpace.count_objects implemented.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-03 15:09:10 +00:00
nobu 9c24fed339 * encoding.c (rb_cEncoding): new Encoding class.
* encoding.c (rb_to_encoding, rb_to_encoding_index): helper functions.

* encoding.c (rb_obj_encoding): return Encoding object now.

* gc.c (garbage_collect): mark Encoding objects.

* string.c (rb_str_force_encoding): accept Encoding object as well as
  encoding name.

* include/ruby/encoding.h (rb_to_encoding_index, rb_to_encoding):
  prototypes.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-13 16:32:40 +00:00
nobu 36585f17fb * gc.c (id2ref): skip ICLASS.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-01 06:57:56 +00:00
nobu 7d0787116d * gc.c (id2ref): T_VALUES is less than T_BLOCK. [ruby-dev:31911]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-01 06:17:50 +00:00
akr 5c0e68c39c * include/ruby/intern.h: export rb_ivar_foreach.
* include/ruby/ruby.h: modify struct RObject and RClass for optimizing
  T_OBJECT space.  [ruby-dev:31853]
  (ROBJECT_LEN, ROBJECT_PTR)
  (RCLASS_IV_TBL, RCLASS_M_TBL, RCLASS_SUPER, RCLASS_IV_INDEX_TBL)
  (RMODULE_IV_TBL, RMODULE_M_TBL, RMODULE_SUPER): abstract accessor
  defined.

* variable.c: support the modified RObject and RClass.

* object.c: ditto.

* class.c: ditto.

* gc.c: ditto.

* marshal.c: ditto.

* eval_method.ci: use the abstract accessor.

* insns.def: ditto.

* proc.c: ditto.

* struct.c: ditto.

* eval.c: ditto.

* error.c: ditto.

* vm.c: ditto.

* insnhelper.ci: ditto.

* ext/digest/digest.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-28 06:21:46 +00:00
nobu b416cc6f3f * gc.c (rb_mark_set): new function to mark keys.
* marshal.c (struct dump_arg, struct load_arg): added wrappers to mark
  data and compat_tbl entries.  [ruby-dev:31870]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-26 19:40:49 +00:00
nobu c9faac88af * gc.c (os_obj_of, os_each_obj): hide objects to be finalized.
[ruby-dev:31810]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-23 00:05:07 +00:00
nobu 80eba73d6a * gc.c (gc_mark_rest): copy just used part.
* gc.c (gc_mark_children): mark u1 and u2 of NODE_ARGSCAT.

* gc.c (os_obj_of): hide T_VALUES too.  [ruby-dev:31804]

* gc.c (run_final): freeze temporary argument array.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-21 05:51:43 +00:00
akr 2c8e7a50c1 * include/ruby/ruby.h (struct RBignum): embed digits in RBignum for
small bignums.

* bignum.c: RBignum embeded digits implemented.

* include/ruby/intern.h: declare rb_big_resize.

* gc.c: don't free embedded digits.

* numeric.c: replace direct bignum field accessor by abstract field
  accessor such as RBIGNUM(val)->sign to RBIGNUM_SIGN(val).

* sprintf.c: ditto.

* compar.c: ditto.

* marshal.c: ditto.

* random.c: ditto.

* .gdbinit: support embedded small bignums.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-01 12:02:36 +00:00
akr 2a4c4f7b0c * include/ruby/intern.h: declare rb_hash_tbl.
* include/ruby/ruby.h (RHash): delay st_table allocation.
  rename tbl field to ntbl to detect direct reference to the st_table
  as a compile error.
  (RHASH_TBL): abstract accessor defined.
  (RHASH_ITER_LEV): ditto.
  (RHASH_IFNONE): ditto.
  (RHASH_SIZE): ditto.
  (RHASH_EMPTY_P): ditto.

* hash.c: delay st_table allocation.

* gc.c: replace tbl by ntbl.

* array.c: replace direct field accessor by abstract field accessor
  such as RHASH(hash)->tbl to RHASH_TBL(hash).

* marshal.c: ditto.

* insns.def: ditto.

* ext/iconv/iconv.c: ditto.

* ext/json/ext/generator/generator.c: ditto.

* ext/json/ext/parser/parser.c: ditto.

* ext/syck/rubyext.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-29 23:12:21 +00:00
matz a25fbe3b3e * encoding.c: provide basic features for M17N.
* parse.y: encoding aware parsing.

* parse.y (pragma_encoding): encoding specification pragma.

* parse.y (rb_intern3): encoding specified symbols.

* string.c (rb_str_length): length based on characters.  
  for older behavior, bytesize method added.

* string.c (rb_str_index_m): index based on characters.  rindex as
  well.

* string.c (succ_char): encoding aware succeeding string.

* string.c (rb_str_reverse): reverse based on characters.

* string.c (rb_str_inspect): encoding aware string description.

* string.c (rb_str_upcase_bang): encoding aware case conversion.
  downcase, capitalize, swapcase as well.

* string.c (rb_str_tr_bang): tr based on characters.  delete,
  squeeze, tr_s, count as well.

* string.c (rb_str_split_m): split based on characters.

* string.c (rb_str_each_line): encoding aware each_line.

* string.c (rb_str_each_char): added.  iteration based on
  characters.

* string.c (rb_str_strip_bang): encoding aware whitespace
  stripping.  lstrip, rstrip as well.

* string.c (rb_str_justify): encoding aware justifying (ljust,
  rjust, center).

* string.c (str_encoding): get encoding attribute from a string. 

* re.c (rb_reg_initialize): encoding aware regular expression

* sprintf.c (rb_str_format): formatting (i.e. length count) based
  on characters.

* io.c (rb_io_getc): getc to return one-character string.
  for older behavior, getbyte method added.

* ext/stringio/stringio.c (strio_getc): ditto.

* io.c (rb_io_ungetc): allow pushing arbitrary string at the
  current reading point.

* ext/stringio/stringio.c (strio_ungetc): ditto.

* ext/strscan/strscan.c: encoding support.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-25 03:29:39 +00:00
akr 1d23c250f0 * gc.c: use VALGRIND_MAKE_MEM_UNDEFINED to detect use of collected
objects if valgrind is available.  It cannot detect first 2 words 
  because they are used as the free list.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-19 04:34:44 +00:00
ko1 f13e9b734c * gc.c (os_live_obj): fix to skip T_VALUES.
* sample/test.rb: add an ObjectSpace test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-15 09:58:59 +00:00
nobu 39c56c3349 * compile.c, compile.h (DECL_ANCHOR, INIT_ANCHOR): split not to
initialize aggregations with dynamic values.  [ruby-talk:259306]

* eval.c (rb_protect): not to initialize aggregations with dynamic
  values.  [ruby-talk:259306]

* gc.c (mark_current_machine_context): ditto.

* thread.c (thgroup_list, call_trace_func): ditto.

* vm.c (vm_init_redefined_flag): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-20 07:11:35 +00:00
akr bb44ba9b72 rename mark_current_thread to mark_current_machine_context.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-14 09:47:05 +00:00
akr 4608b08d1f make mark_current_thread static.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-14 07:48:54 +00:00
akr 0886a4d8a0 * configure.in: add --enable-valgrind.
* gc.h (SET_MACHINE_STACK_END): new macro to replace
  rb_gc_set_stack_end.  it find out accurate stack boundary by
  asm using gcc on x86.

* thread.c (rb_gc_set_stack_end): don't define if asm-version
  SET_MACHINE_STACK_END is available.

* gc.c (mark_current_thread): extracted from garbage_collect.
  it use SET_MACHINE_STACK_END to not scan out of stack area.
  it notify conservative GC information to valgrind if
  --enable-valgrind.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-14 07:19:59 +00:00
ko1 6b6bf4dd48 * blockinlining.c: remove "yarv" prefix.
* array.c, numeric.c: ditto.
* insnhelper.ci, insns.def, vm_evalbody.ci: ditto.
* yarvcore.c: removed.
* yarvcore.h: renamed to core.h.
* cont.c, debug.c, error.c, process.c, signal.c : ditto.
* ext/probeprofiler/probeprofiler.c: ditto.
* id.c, id.h: added.
* inits.c: ditto.
* compile.c: rename internal functions.
* compile.h: fix debug flag.
* eval.c, object.c, vm.c: remove ruby_top_self.
  use rb_vm_top_self() instead.
* eval_intern.h, eval_load: ditto.
* gc.c: rename yarv_machine_stack_mark() to
  rb_gc_mark_machine_stack().
* insnhelper.h: remove unused macros.
* iseq.c: add iseq_compile() to create iseq object
  from source string.
* proc.c: rename a internal function.
* template/insns.inc.tmpl: remove YARV prefix.
* thread.c:
* vm.c (rb_iseq_eval): added.
* vm.c: move some functions from yarvcore.c.
* vm_dump.c: fix to remove compiler warning.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-12 04:25:46 +00:00
nobu 46603a78af * include/ruby/{intern,ruby}.h, compile.[ch], error.c, eval.c,
eval_load.c, gc.c, iseq.c, main.c, parse.y, re.c, ruby.c,
  yarvcore.[ch] (ruby_eval_tree, ruby_sourcefile, ruby_sourceline,
  ruby_nerrs): purge global variables.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-05 08:12:18 +00:00
nobu eae8a9143f * debug.c (ruby_set_debug_option): separated from main.c.
* gc.c (ruby_gc_stress), signal.c (ruby_enable_coredump): prefixed.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-29 07:57:24 +00:00
usa 14010ce4a3 * gc.c (rb_obj_id): use SIGNED_VALUE instead of long.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-28 02:32:25 +00:00
ko1 fd78c2193e * include/ruby/node.h, parse.y, gc.c, iseq.c: remove NODE_CREF.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-27 16:23:49 +00:00
usa 588e79f768 * gc.c (RVALUE): in RVALUE and RBasic, flags must be the same type.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-25 11:20:45 +00:00
akr 6792979e98 fix indent.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-25 11:19:11 +00:00
ko1 4bdb5ced9a * gc.h: add RUBY_ prefix to debug macros.
* cont.c, proc.c, yarvcore.c,
* gc.c: define ruby_gc_debug_indent variable to debug mark/free.
* vm.c, insnhelper.ci: rename some functions to vm_* or rb_vm_*.
  move some functions, definitions, declarations to suitable files.
* eval.c, yarvcore.h, eval_error.ci, insnhelper.ci: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-25 02:44:20 +00:00
ko1 f58eb1e276 * eval.c: remove ruby_current_node and change eval() prototype.
fix to use rb_sourcefile/line() instead of ruby_sourcefile/line.
* error.c, eval_error.ci, eval_load.c, eval_safe.ci, gc.c,
  include/ruby/intern.h, parse.y, process.c, ruby.c: ditto.
* vm.c: fix spaces.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-24 20:33:04 +00:00
akr ccbdd90865 * gc.c (garbage_collect): re-introduce ruby_current_node marking code.
[ruby-dev:31005]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-16 13:45:30 +00:00
akr c4d2965fb6 * gc.c (gc_sweep): re-introduce heap extension strategy change.
[ruby-dev:31005]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-16 12:39:35 +00:00
akr 3cd5af52e9 * eval_load.c (Init_load): delay allocating an array for rb_load_path
to avoid GC problem in very early stage.
  (RUBY_GC_STRESS causes GC in such stage.)

* variable.c (rb_gc_mark_global_tbl): rb_global_tbl may be 0 in
  very early stage.

* thread.c (thread_cleanup_func) [IA64]: clear register stack position.
  (thread_start_func_2) [IA64]: record the beginning of register
  stack using extra argument.
  (rb_gc_save_machine_context) [IA64]: record the end of register
  stack.

* gc.c [IA64] (SET_STACK_END): record the end of register stack.
  (garbage_collect) [IA64]: use recorded register stack area for
  GC marking.
  (yarv_machine_stack_mark) [IA64]: GC mark from the register stack
  area.

* yarvcore.c [IA64] (rb_gc_register_stack_start): defined.
  (Init_VM): store th->self on stack to fix GC problem.
  (Init_yarv) [IA64]: initialize the beginning of register stack.

* yarvcore.h (struct rb_thread_struct) [IA64]: new members for
  register stack area.

* thread_pthread.ci (thread_start_func_1) [IA64]: call
  thread_start_func_2 with the end of register stack.

* cont.c (struct rb_context_struct) [IA64]: new members for register
  stack area.
  (cont_mark) [IA64]: GC mark from register stack area.
  (cont_free) [IA64]: free saved register stack.
  (cont_save_machine_stack) [IA64]: record the position and contents
  of the register stack.
  (cont_capture): store cont->self on stack to fix GC problem.
  (cont_restore_1) [IA64]: restore the register stack.
  [IA64] (register_stack_extend): new function.
  (cont_restore_0) [IA64]: call register_stack_extend instead of
  cont_restore_1.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-14 08:35:20 +00:00
matz 68c6bb997d * gc.c (garbage_collect): update IA64 register stack code.
[ruby-dev:30971]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-13 13:42:02 +00:00
nobu 2b592580bf * include/ruby: moved public headers.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-10 03:06:15 +00:00
nobu fd9aee1ca3 * gc.c (rb_source_filename, obj_free): supress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-29 15:49:30 +00:00
nobu a196c4ff5c * gc.c (garbage_collect, yarv_machine_stack_mark): fixed typo.
http://bugs.debian.org/426267


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12404 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-29 15:46:01 +00:00
ko1 7d200b94f9 * gc.c, yarvcore.c: fix to mark VM structure on startup.
* yarvcore.h: disable USE_CACHED_VALUE.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-24 02:47:22 +00:00
nobu 5b10c170e5 * file.c, gc.c, io.c, ruby.h, rubyio.h, win32/win32.h (rb_io_t):
renamed from OpenFile.

* ext/dl/cptr.c, ext/io/wait/wait.c, ext/openssl/ossl.h,
  ext/openssl/ossl_bio.c, ext/openssl/ossl_ssl.c, ext/pty/pty.c,
  ext/readline/readline.c, ext/socket/socket.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-24 10:30:50 +00:00
ko1 0fe72040e4 * parse.y, node.h, compile.c: change node tree structure. a purpose
of this change is to unify argument structure of method and block.
  this change prohibits duplicate block parameter name.
  new argument infromation:
  NODE_ARGS     [m: int, o: NODE_OPT_ARG, ->]
  NODE_ARGS_AUX [r: ID, b: ID, ->]
  NODE_ARGS_AUX [Pst: id, Plen: int, init: NODE*]
  optarg information:
  NODE_OPT_ARGS [idx, expr, ->]
* vm_macro.def: ditto.
* gc.c: ditto.
* iseq.c: ditto.
* compile.h: fix debug function name.
* test/ripper/test_scanner_events.rb: |_,_,foo| -> |_1,_2,foo|
* test/ruby/test_lambda.rb: disalbe test temporarily.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-24 02:07:05 +00:00
matz b83ed6d1bd * parse.y, compile.c, gc.c, insns.def, intern.h, iseq.c, node.h,
object.c, string.c, variable.c, vm_macro.def: revert private
  instance variable feature, which is postponed until next major
  release.

* marshal.c: TYPE_SYMBOL2 removed; MARSHAL_MINOR reverted back to
  8th version.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-23 02:49:41 +00:00
ko1 9c574383a4 * blockinlining.c, error.c, eval.c, eval_error.h, eval_intern.h,
eval_jump.h, eval_load.c, eval_safe.h, gc.c, proc.c, signal.c,
  thread.c, thread_pthread.ci, thread_win32.ci, vm.c, vm.h,
  vm_dump.c, vm_evalbody.ci, yarvcore.c, yarvcore.h:
  fix typo (rb_thead_t -> rb_thread_t).

* eval_intern.h: remove unused definitions.

* common.mk: fix around vm_opts.h path
  and remove harmful argument passed to insns2vm.rb.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-08 06:37:46 +00:00