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

835 Коммитов

Автор SHA1 Сообщение Дата
nobu 4190cdddbb * gc.c (vm_xrealloc): use TRY_WITH_GC().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-26 07:22:43 +00:00
naruse 165ebcb467 Fix compilation on gcc 4.6
if __has_feature is not defined, it can't compile

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43048 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-26 06:06:19 +00:00
nobu 2bf5be1db5 gc.c: disable AddressSanitizer
* gc.c (mark_locations_array): disable AddressSanitizer.  based on a
  patch by halfie (Ruby Guy) at [ruby-core:57372].
  [ruby-core:56155] [Bug #8680]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-26 05:46:52 +00:00
nobu 89919f4e08 gc.c: atomical add
* gc.c (gc_before_sweep, gc_after_sweep): add to increase2 atomically.

* gc.c (gc_marks): adjust indent.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-26 02:31:26 +00:00
ko1 dc626dbab3 * include/ruby/ruby.h: rename RARRAY_RAWPTR() to RARRAY_CONST_PTR().
RARRAY_RAWPTR(ary) returns (const VALUE *) type pointer and
  usecase of this macro is not acquire raw pointer, but acquire
  read-only pointer. So we rename to better name.
  RSTRUCT_RAWPTR() is also renamed to RSTRUCT_CONST_PTR()
  (I expect that nobody use it).
* array.c, compile.c, cont.c, enumerator.c, gc.c, proc.c, random.c,
  string.c, struct.c, thread.c, vm_eval.c, vm_insnhelper.c:
  catch up this change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-25 08:24:34 +00:00
charliesome 4cf9b6694f * gc.c (free_method_cache_entry_i): unused function
* gc.c (rb_free_mc_table): ditto

* internal.h (method_cache_entry_t): unused struct

* vm_method.c (verify_method_cache): remove unused variable

* vm_method.c (rb_method_entry): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-24 05:09:57 +00:00
charliesome f088828106 * class.c (class_alloc): remove mc_tbl
* gc.c (obj_free): ditto

* internal.h (struct rb_classext_struct): ditto

* method.h (rb_method_entry): remove ent param

* vm_method.c: restore the global method cache. Per class cache tables
  turned out to be far too slow.

  [ruby-core:57289] [Bug #8930]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-24 05:02:13 +00:00
nobu eeb39e0152 vm.c: prototype
* vm.c (rb_next_class_sequence): use ANSI style definition and
  prorotype declaration, instead of old-K&R style.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-04 07:18:24 +00:00
charliesome 2f522b9cc6 * class.c, compile.c, eval.c, gc.h, insns.def, internal.h, method.h,
variable.c, vm.c, vm_core.c, vm_insnhelper.c, vm_insnhelper.h,
  vm_method.c: Implement class hierarchy method cache invalidation.

  [ruby-core:55053] [Feature #8426] [GH-387]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-04 05:25:06 +00:00
ko1 c4fe526011 * gc.c (gc_profile_clear): do rest_sweep() before clearing
profile.current_record.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-27 02:49:08 +00:00
akr 873dd9bc45 * gc.c (getrusage_time): Fallback clock_gettime to getrusage when
clock_gettime fails.
  Reported by Eric Saxby.  [ruby-core:56762] [Bug #8805]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-21 08:34:48 +00:00
ko1 326bf140b4 * gc.c (rb_gcdebug_print_obj_condition): add printing information.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-20 17:32:18 +00:00
ko1 21ecf88ce0 * gc.c: fix around GC_DEBUG.
* gc.c (RVALUE::line): should be VALUE. On some environment
  (such as mswin64), `int' introduces alignment mismatch.
* gc.c (newobj_of): add an assertion to check VALUE alignment.
* gc.c (aligned_malloc): `&' is low priority than `=='.
* gc.c: define GC_DEBUG everytime and use it as value 0 or 1.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-19 12:00:51 +00:00
ktsj 04f0de74dd * error.c, file.c, gc.c, hash.c, thread.c, variable.c, vm_eval.c, bin/erb:
$SAFE=4 is obsolete.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-18 10:36:51 +00:00
ko1 5cd2fb2ebb * gc.c (gc_lazy_sweep): remove heap_increment() here because heap_inc
may be 0.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-15 08:46:53 +00:00
tarui da3d79d203 * gc.c (gc_marks_test): inhibit gc for st's operation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-12 14:09:34 +00:00
akr 25336fa7c1 * bignum.c (rb_big_realloc): Use VALGRIND_MAKE_MEM_UNDEFINED to
declare undefined memory area.
  (bignew_1): Ditto.

* internal.h (VALGRIND_MAKE_MEM_DEFINED): Moved from gc.c
  (VALGRIND_MAKE_MEM_UNDEFINED): Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-06 03:26:34 +00:00
ko1 33ebcb0538 * array.c, gc.c: move ary_unprotect_logging() into
rb_gc_unprotect_logging() which is general version
* include/ruby/ruby.h: add USE_RGENGC_LOGGING_WB_UNPROTECT
  to enable.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-24 09:42:43 +00:00
ko1 3742192919 * gc.c (gc_before_sweep): fix spacing.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42132 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-23 07:15:34 +00:00
ko1 511e155e24 * gc.c (heap_get_freeobj): clear slot->freelist here.
This means that this slot doesn't have any free objects.
  And store this slot with objspace->heap.using_slot.
* gc.c (gc_before_sweep): restore objspace->freelist
  into objspace->heap.using_slot->freelist.
  This means that using_slot has free objects which are
  pointed from objspace->freelist.
* gc.c (gc_slot_sweep): do not need to clear slot->freelist.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-23 07:02:44 +00:00
ko1 4132ac3762 * gc.c (gc_slot_sweep): need to add empty RVALUE as freeobj.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-22 01:10:46 +00:00
nobu db16068ce0 gc.c: suppress warning
* gc.c (heap_assign_slot): suppress implicit conversion warning.
  delta is not greater than sizeof(RVALUE).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-19 13:31:03 +00:00
ko1 79d557ffcd * gc.c: declare type_name() at the beggining of file.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-19 13:00:23 +00:00
ko1 344835a754 * gc.c, internal.h (rb_gc_writebarrier_remember_promoted): add a new
function to remember an specified object. This api is only
  experimental (strongly depend on WB/rgengc strategy).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-19 06:11:09 +00:00
ko1 5c088cf703 * gc.c: rename gc related functions with prefix "gc_".
* before_gc_sweep() -> gc_before_sweep().
* after_gc_sweep()  -> gc_after_sweep().
* lazy_sweep()      -> gc_lazy_sweep().
* rest_sweep()      -> gc_rest_sweep().
* slot_sweep()      -> gc_slot_sweep().
* gc.c: rename a heap management function with prefix "heap_".
* get_freeobj() -> heap_get_freeobj().
* gc.c: rename markable_object_p() to is_markable_object().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-17 23:19:38 +00:00
ko1 a3b6aeba68 * gc.c: rename heap management functions with prefix "heap_".
* allocate_sorted_array() -> heap_allocate_sorted_array().
* slot_add_freeobj()      -> heap_slot_add_freeobj().
* assign_heap_slot()      -> heap_assign_slot().
* add_heap_slots()        -> heap_add_slots().
* init_heap()             -> heap_init().
* set_heap_increment()    -> heap_set_increment().
* gc.c (initial_expand_heap): inlined in rb_gc_set_params().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-17 08:25:11 +00:00
ko1 caa14925cc * gc.c: catch up last changes for debugging/checking mode.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-17 07:01:19 +00:00
ko1 9860c846d0 * gc.c (rb_objspace_free): free slot itself.
* gc.c (objspace_each_objects): fix condition.
  Use slot->body instead of slot.
* gc.c (count_objects): use "slot" variable.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-17 06:52:13 +00:00
ko1 fa014681d5 * gc.c (unlink_heap_slot): fix memory leak.
free slot itself at free_heap_slot().
  Reproduce-able code is here:
  N1 = 100_000; N2 = 1_000_000
  N1.times{ary = []; N2.times{ary << ''}}
  Maybe this problem is remaining in Ruby 2.0.0.
* gc.c (unlink_heap_slot): remove not working code.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-17 06:24:22 +00:00
ko1 79d9c8ac72 * gc.c: re-design the heap structure.
(1) The heap is consists of a set of slots.
  (2) Each "slot" has a "slot_body".
  slot::start and slot::limit specify RVALUE beginning address
  and number of RVALUE in a "slot_body".
  (3) "slot_body" contains a pointer to slot (slot_body::header::slot)
  and an array of RVALUE.
  (4) heap::sorted is an array of "slots", sorted by an address of
  slot::body.
  See https://bugs.ruby-lang.org/projects/ruby-trunk/wiki/GC_design
  for more details (figure).
* gc.c: Avoid "heaps" terminology. It is ambiguous.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-17 05:55:39 +00:00
ko1 fd92050515 * gc.c: fix heaps_header and heaps_slot to reduce memory consumption.
(1) move heaps_header::start and limit to  heaps_slot.
  (2) remove heaps_header::end which can be calculated by start+limit.
* gc.c: catch up above change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-17 04:34:57 +00:00
ko1 a97c3b7585 * gc.c: slim a path of newobj_of().
* gc.c (objspace): add a new field objspace::freelist, which contains
  available RVALUEs.
* gc.c (newobj_of): simply call new function `get_freeobj()'.
  get_freeobj() returns objspace::freelist. If  objspace::freelist
  is not available, refill objspace::freelist with a slot pointed by
  objspace::heap::free_slots.
* gc.c (before_gc_sweep): clear objspace::freelist.
* gc.c (slot_sweep): clear slot::freelist.
* gc.c (heaps_prepare_freeslot): renamed to heaps_prepare_freeslot.
* gc.c (unlink_free_heap_slot): remove unused function.
* gc.c (rb_free_const_table): remove unused function.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42005 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-16 10:29:31 +00:00
ko1 ed621c001e * gc.c (link_free_heap_slot): removed.
* gc.c (slot_sweep): use `heaps_add_freeslot' instead of
  `link_free_heap_slot'.
* gc.c (assign_heap_slot): use local variable `slot' instead of
  `heaps'.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-16 08:46:15 +00:00
ko1 73ee1676b0 * gc.c (assign_heap_slot): refactoring variable names.
* gc.c (slot_add_freeobj): added.
* gc.c (heaps_add_freeslot): added.
* gc.c (finalize_list, rb_gc_force_recycle, slot_sweep): use
  `slot_add_freeobj' instead of modifying linked list directly.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-16 08:32:32 +00:00
ko1 e8ee0a24dc * gc.c (lazy_sweep): refactoring.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-16 07:33:48 +00:00
ko1 53bdcbed86 revert last commit because it fails test-all.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-16 06:10:56 +00:00
ko1 3cd6fe3254 * gc.c (after_gc_sweep): refactoring code.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-16 06:00:55 +00:00
kou 7b52f3a722 * gc.c (is_before_sweep): Add a missing space before a parenthesis.
* gc.c (rb_gc_force_recycle): Add a missing space around a parenthesis.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41660 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-26 14:13:20 +00:00
tarui b0993c733f * gc.c (is_before_sweep): Add new helper function that check the object
is before sweep?
	* gc.c (rb_gc_force_recycle): Have to clear mark bit if object's slot
	  already ready to mainor sweep.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41633 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-25 16:20:39 +00:00
ko1 ab0a003183 * gc.c: fix oldgen/remembered_shady counting algorithm.
* gc.c (rgengc_check_shady): increment
  `objspace->rgengc.remembered_shady_object_count' here.
* gc.c (rgengc_remember): return FALSE if obj is already remembered.
* gc.c (rgengc_rememberset_mark): make it void.
* gc.c (gc_mark_children): fix to double counting oldgen_object_count
  at minor GC.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-25 03:24:07 +00:00
nobu 5ac5740733 * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-24 16:01:06 +00:00
tarui 606d2d354d * gc.c (typedef struct rb_objspace): Change members for monitor objects.
* gc.c (gc_marks_test): Check all WriteBarrier Errors and track them in obj-tree.
	* gc.c (rgengc_check_shady): Ditto.
	* gc.c (gc_marks): Move 2 funtion calls to gc_marks_test for test initialize.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-24 15:57:16 +00:00
nobu 5332d81283 * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-23 23:01:06 +00:00
tarui 9694416c06 * gc.c (after_gc_sweep): Have to record malloc info before reset.
* gc.c (gc_prof_timer_start): Pick out part of new record creation as gc_prof_setup_new_record.
	* gc.c (gc_prof_set_malloc_info): Move point of recording allocation size to front of mark.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-23 22:58:01 +00:00
ko1 982fee4fcc * include/ruby/ruby.h, gc.c: rename macros and functions:
OBJ_WB_GIVEUP() -> OBJ_WB_UNPROTECT(),
  rb_obj_wb_giveup() -> rb_obj_wb_unprotect(),
  rb_gc_giveup_promoted_writebarrier() ->
  rb_gc_writebarrier_unprotect_promoted(),
* class.c, eval.c, hash.c: use OBJ_WB_UNPROTECT().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-22 21:54:10 +00:00
ko1 d73b9320cc * gc.c (rgengc_check_shady): add new WB miss checking
on RGENGC_CHECK_MODE >= 2.

    (1) Save bitmaps before marking
    (2) Run full marking
    (3) On each traceable object,
      (a) object        was not oldgen (== newly or shady object) &&
      (b) parent object was     oldgen &&
      (c) parent object was not remembered &&
      (d) object        was not rememberd
      then, it should be WB miss.

  This idea of this checker is by Masaya Tarui <tarui@ruby-lang.org>.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-22 06:43:30 +00:00
ko1 a59e629868 * gc.c (gc_prof_set_heap_info, after_gc_sweep): call
gc_prof_set_heap_info() just after sweeping to calculate
  live object number correctly.
  (live object number = total generated number (before marking) -
                        total freed number (after sweeping))
* gc.c (gc_marks): record `oldgen_object_count' into current profile`
  record directly.
* gc.c (rgengc_rememberset_mark): same for remembered_normal_objects
  and remembered_shady_objects.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21 22:29:09 +00:00
ko1 dbd8f3ac03 * gc.c (rb_objspace::profile): rename rb_objspace::profile::record to
records (because it points a set of records) and add a field
  rb_objspace::profile::current_record to point a current profiling
  record.
* gc.c: use above fields.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21 21:51:41 +00:00
ko1 b4f907ea29 * gc.c (rb_gc_giveup_promoted_writebarrier): remove `rest_sweep()'
because all of remembered objects are called for gc_mark_children().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21 21:08:38 +00:00
ko1 7396fbb0b5 * gc.c (rgengc_rememberset_mark): call gc_mark_children() for
remembered objects directly instead of pushing on the mark stack.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21 20:10:03 +00:00