summaryrefslogtreecommitdiff
path: root/gc.c
AgeCommit message (Collapse)Author
2012-11-25array.c: refactoring of rb_ary_delete_same()shirosaki
* array.c (ary_resize_smaller): new function to resize array. * array.c (rb_ary_delete): refactoring to extract a function. * array.c (rb_ary_delete_same): refactoring. It renames function, reduces duplicated code and removes unused code. * gc.c (wmap_final_func): follow the above change. * internal.h (rb_ary_delete_same): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-24gc.c: refactoring to rename variablesshirosaki
* gc.c (wmap_final_func): rename variables to clarify the meaning. In wmap2obj the key is WeakRef and the value is referenced object. In obj2wmap the key is referenced object and the value is an array of WeakRef. * gc.c (wmap_finalize): ditto. [ruby-core:49044] [Bug #7304] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-24Fix WeakRef finalizeshirosaki
* array.c (rb_ary_delete_same_obj): new function for WeakRef. This deletes same objects as item argument in the array. * internal.h (rb_ary_delete_same_obj): add a declaration. * gc.c (wmap_final_func): remove WeakRef object reference from the array. rb_ary_delete() is not usable because it uses rb_equal() to compare object references. * gc.c (wmap_finalize): remove recycled object references from weak map hash properly. How to get object reference from object id was wrong. st_delete() doesn't work properly if key and value arguments are same. The key of obj2wmap is referenced object and the value of obj2wmap is WeakRef array. * gc.c (wmap_aset): obj2wmap should contain WeakRef array in the definition. * test/test_weakref.rb (TestWeakRef#test_not_reference_different_object, TestWeakRef#test_weakref_finalize): add tests for above. [ruby-core:49044] [Bug #7304] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-24Rvert r37827 and r37828naruse
Revert "Fix finalize of WeakRef" This causes segv on rubyspec. http://u64.rubyci.org/~chkbuild/ruby-trunk/log/20121124T050101Z.log.html.gz you can reproduce by make test-rubyspec MSPECOPT='-V library/weakref' git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-24wmap_finalize: refactoring to rename variablesshirosaki
* gc.c (wmap_final_func): rename variables to clarify the meaning. In wmap2obj the key is WeakRef and the value is referenced object. In obj2wmap the key is referenced object and the value is an array of WeakRef. * gc.c (wmap_finalize): ditto. [ruby-core:49044] [Bug #7304] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-24Fix finalize of WeakRefshirosaki
* gc.c (wmap_final_func): remove WeakRef object reference from the array. * gc.c (wmap_finalize): remove recycled object references from weak map hash properly. How to get object reference from object id was wrong. st_delete() doesn't work properly if key and value arguments are same. The key of obj2wmap is referenced object and the value of obj2wmap is WeakRef array. * gc.c (wmap_aset): obj2wmap should contain WeakRef array in the definition. * test/test_weakref.rb (TestWeakRef#test_not_reference_different_object): add a test for above. [ruby-core:49044] [Bug #7304] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-22* gc.c (is_swept_object): extract from is_dead_object().nari
* gc.c (rb_gcdebug_print_obj_condition): add the function for debug. This function shows some conditions of given object (e.g., marked, in heap, swept). * gc.c (rb_gcdebug_sentinel): add the function for debug. This function allow check to inadvertently free up an object. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-21* gc.c (garbage_collect): remove a duplicative probe.nari
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-21* gc.c (gc_profile_clear): realloc profile records if its size isnari
higher than the threshold, GC_PROFILE_RECORD_DEFAULT_SIZE * 2. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-12* probes.d: add DTrace probe declarations. [ruby-core:27448]tenderlove
* array.c (empty_ary_alloc, ary_new): added array create DTrace probe. * compile.c (rb_insns_name): allowing DTrace probes to access instruction sequence name. * Makefile.in: translate probes.d file to appropriate header file. * common.mk: declare dependencies on the DTrace header. * configure.in: add a test for existence of DTrace. * eval.c (setup_exception): add a probe for when an exception is raised. * gc.c: Add DTrace probes for mark begin and end, and sweep begin and end. * hash.c (empty_hash_alloc): Add a probe for hash allocation. * insns.def: Add probes for function entry and return. * internal.h: function declaration for compile.c change. * load.c (rb_f_load): add probes for `load` entry and exit, require entry and exit, and wrapping search_required for load path search. * object.c (rb_obj_alloc): added a probe for general object creation. * parse.y (yycompile0): added a probe around parse and compile phase. * string.c (empty_str_alloc, str_new): DTrace probes for string allocation. * test/dtrace/*: tests for DTrace probes. * vm.c (vm_invoke_proc): add probes for function return on exception raise, hash create, and instruction sequence execution. * vm_core.h: add probe declarations for function entry and exit. * vm_dump.c: add probes header file. * vm_eval.c (vm_call0_cfunc, vm_call0_cfunc_with_frame): add probe on function entry and return. * vm_exec.c: expose instruction number to instruction name function. * vm_insnshelper.c: add function entry and exit probes for cfunc methods. * vm_insnhelper.h: vm usage information is always collected, so uncomment the functions. 12 19:14:50 2012 Akinori MUSHA <knu@iDaemons.org> * configure.in (isinf, isnan): isinf() and isnan() are macros on DragonFly which cannot be found by AC_REPLACE_FUNCS(). This workaround enforces the fact that they exist on DragonFly. 12 15:59:38 2012 Shugo Maeda <shugo@ruby-lang.org> * vm_core.h (rb_call_info_t::refinements), compile.c (new_callinfo), vm_insnhelper.c (vm_search_method): revert r37616 because it's too slow. [ruby-dev:46477] * test/ruby/test_refinement.rb (test_inline_method_cache): skip the test until the bug is fixed efficiently. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-10* gc.c: move immutable fields from struct heaps_slot and structnari
sorted_heaps_slot into struct heaps_header. Based on a patch from Sokolov Yura [Feature #6199][ruby-core:43592] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-09* ruby_atomic.h: renamed from atomic.h to avoid header file name conflictngoto
on Solaris 10. [ruby-dev:46414] [Bug #7287] * gc.c, signal.c, vm_core.h, common.mk: reflect the rename from atomic.h to ruby_atomic.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-09Fix build when gcc is used and the platform's libc lacks alloca().knu
* include/ruby/ruby.h (alloca), eval_intern.h (alloca), gc.c (alloca): Make alloca() globally available by moving the ultimate ifdef's to ruby/ruby.h. Gcc hides its builtin alloca() when compiling with -ansi, and linking thus fails on platforms that lack their own alloca() implementation in libc, which include OpenBSD and some ports of NetBSD. We use alloca() everywhere including from within third party C extentions, so alloca() must be made globally available. [Bug #7307] * addr2line.c (alloca): Replace the alloca() part with the ultimate ifdef's. [Bug #7307] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-31* gc.c (gc_profile_record): don't define unused variables whennari
GC_PROFILE_MORE_DETAIL is 0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-31* gc.c (gc_prof_mark_timer_stop): count is not initialized.nari
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-29gc.c: PRIuSIZEnobu
* gc.c (gc_profile_dump_on): use PRIuSIZE instead of 'zu'. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-27* gc.c (gc_profile_result, gc_profile_report): use internal structureseregon
to avoid allocations and progressively print the output for #report. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-24rename it to a more fitting namenari
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37313 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-24fix the function name which is not grammatically correct.nari
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-24* gc.c (free_object_aquire): rename to match the behavior of thisnari
function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-24* gc.c (garbage_collect, gc_marks): move the location ofko1
clear and restore rb_objspace_t::mark_func_data from garbage_collect() to gc_marks(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-24* ext/objspace/objspace.c (ObjectSpace.reachable_objects_from):ko1
internal object support. If given object `obj' has references to internal objects (such as T_NODE objects), then this method returns instances of `ObjectSpace::InternalObjectWrapper' instead of that internal objects. This instance contains a refereance to an internal object and you can check the type of internal object using `ObjectSpace::InternalObjectWrapper#type' method. Rdoc of `InternalObjectWrapper' is not prepared yet. * gc.c (rb_objspace_reachable_objects_from), gc.h: change an interface of 'rb_objspace_reachable_objects_from()' * gc.c, gc.h: add two APIs - rb_objspace_markable_object_p(obj): check markable or not. - rb_objspace_internal_object_p(obj): check internal or not. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-20* gc.c: fix typos in documentation.eregon
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-20* include/ruby/ruby.h: add C APIs.nari
VALUE rb_newobj_of(VALUE klass, VALUE flags) #define NEWOBJ_OF(obj,type,klass,flags) These allow to change a allocation strategy depending on klass or flags. * gc.c: ditto * array.c: use new C API. * bignum.c: ditto * class.c: ditto * complex.c: ditto * ext/socket/ancdata.c: ditto * ext/socket/option.c: ditto * hash.c: ditto * io.c: ditto * marshal.c: ditto * numeric.c: ditto * object.c: ditto * random.c: ditto * range.c: ditto * rational.c: ditto * re.c: ditto * string.c: ditto * struct.c: ditto [Feature #7177][Feature #7047] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-08* eval.c, gc.c, iseq.c, node.h, vm_insnhelper.c, vm_insnhelper.h,shugo
vm_method.c: rename omod and overlaid modules to refinements. * eval.c (hidden_identity_hash_new): renamed from identity_hash_new. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-06gc.c: use markable_object_pnobu
* gc.c (gc_mark_children): use markable_object_p() and reduce duplicated code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-05fix commentsnari
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-05revert r37091nari
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-05* ext/objspace/objspace.c: add ObjectSpace#reachable_objects_from.ko1
This method returns an array of objects referenced by given object. If given object is special objects such as true/false/nil/Fixnum etc then it returns nil. See rdoc for details. [ruby-core:39772] * test/objspace/test_objspace.rb: add a test for this method. * gc.c: add rb_objspace_reachable_objects_from(). To make this function, add several member `mark_func_data' to rb_objspace_t. If mark_func_data is not null, then gc_mark() calls mark_func_data::mark_func. * gc.h: export rb_objspace_reachable_objects_from(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-05* gc.c (chain_finalized_object): remove to check a mark flag andnari
marking since all objects are certainly unmarked with rest_sweep. * gc.c (rb_objspace_call_finalizer): remove to mark finalizable objects. The sweeping doesn't push T_ZOMBIE objects to the freelist. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-04* gc.c (init_heap): call init_mark_stack before to allocatenari
altstack. This change avoid the stack overflow at the signal handler on 32bit, but I don't understand reason... [Feature #7095] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37088 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-04* gc.c (rb_objspace_call_finalizer): call gc_mark_stacked_objectsnari
at suitable point. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-04gc.c: self-referencing finalizersnobu
* gc.c (rb_objspace_call_finalizer): mark self-referencing finalizers before run finalizers, to fix SEGV from btest on 32bit. * gc.c (gc_mark_stacked_objects): extract from gc_marks(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-04* gc.c: use enum for debugging.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-03gc.c: unused functionnobu
* gc.c (free_stack_chunks): it is used only when per-VM object space is enabled. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-03* gc.c: Use the non-recursive marking instead of recursion. Thenari
recursion marking of CRuby needs checking stack overflow and the fail-safe system, but these systems not good at partial points, for example, marking deep tree structures. [ruby-dev:46184] [Feature #7095] * configure.in (GC_MARK_STACKFRAME_WORD): removed. It's used by checking stack overflow of marking. * win32/Makefile.sub (GC_MARK_STACKFRAME_WORD): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-28* insns.def (opt_checkenv): remove unused instruction `opt_checkenv'.ko1
* compile.c (iseq_compile_each): ditto. * node.h: remove unused node `NODE_OPTBLOCK'. * ext/objspace/objspace.c, gc.c (gc_mark_children): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-23* include/ruby/ruby.h: introduce flonum technique forko1
64bit CPU environment (sizeof(double) == sizeof(VALUE)). flonum technique enables to avoid double object creation if the double value d is in range about between 1.72723e-77 < |d| <= 1.15792e+77 or 0.0. flonum Float value is immediate and their lowest two bits are b10. If flonum is activated, then USE_FLONUM macro is 1. I'll write detailed in this technique on https://bugs.ruby-lang.org/projects/ruby-trunk/wiki/Flonum_tech * benchmark/bmx_temp.rb: add an benchmark for simple Float calculation. * gc.c (id2ref, rb_obj_id): add flonum Float support. * include/ruby/intern.h: move decl of rb_float_new(double) to include/ruby/ruby.h. * insns.def, vm.c, vm_insnhelper.c: add flonum optimization and simplify source code. * vm_insnhelper.h (FLONUM_2_P): added. * marshal.c: support flonum output. * numeric.c (rb_float_new_in_heap): added. * parse.y: support flonum. * random.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-09 * gc.c (gc_malloc_allocated_size): RDoc does not process macros, sodrbrain
mention this method is only available when ruby is built with CALC_EXACT_MALLOC_SIZE * gc.c (gc_malloc_allocations): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-05* gc.c : if ENABLE_VM_OBJSPACE is 1, rest_sweep is not defined.nari
remove unused declarations. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-05* gc.c: just move functions and so on. I don't touch any internalnari
implementation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-04* gc.c: use inline functions instead of macros, and close upnari
related codes for the profiler. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-04* gc.c (gc_mark_children): use gc_mark_ptr instead of markingnari
a object directly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-02* eval.c (rb_mod_using): new method Module#using. [experimental]shugo
* eval.c (rb_mod_refine): new method Module#refine. [experimental] * eval.c (f_using): new method Kernel#using. [experimental] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-02* gc.c: return true or false. Patch by Dirkjan Bussink. [Bug #6821]nari
* test/ruby/test_gc.rb: add test-case for this bug. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-28* gc.c: remove unused initialization.nari
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-10rb_thread_call_without_gvlnobu
* include/ruby/thread.h: new header file for thread stuff. * thread.c (rb_thread_call_without_gvl): export. [Feature#4328] returns void* instead of VALUE. [Feature #5543] * thread.c (rb_thread_blocking_region): deprecate. [ruby-core:46295] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-04* gc.c, atomic.h (ATOMIC_SIZE_*): moved from gc.c to atomic.h [ruby-dev:45909]ngoto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-04* gc.c (ATOMIC_SIZE_*): 64bit Windows support.usa
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-03* gc.c (ATOMIC_SIZE_EXCHANGE): fix function name on Solaris [Bug #6689]ngoto
[ruby-dev:45904] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e