summaryrefslogtreecommitdiffstats
path: root/gc.c
Commit message (Collapse)AuthorAgeFilesLines
* * complex.c: an instance method image has been removed andtadf2008-09-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@19439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c, include/ruby/ruby.h: rename rb_register_mark_object()ko12008-09-151-1/+1
| | | | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@19365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/io.h (rb_io_t): rename field: writeconv_stateless toakr2008-09-091-1/+1
| | | | | | | | | | | | writeconv_asciicompat. * io.c: follow the renaming. * gc.c: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h (DBL2NUM): renamed from DOUBLE2NUM.matz2008-09-051-4/+4
| | | | | | | a patch from Tadashi Saito <shiba at mail2.accsnet.ne.jp> in [ruby-dev:36102]. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (gc_profile_record_get): to static function.nari2008-09-041-4/+5
| | | | | | | | | (gc_profile_result): ditto. (gc_profile_report): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h (struct rb_vm_struct): replaced signal staff with trapnobu2008-09-041-1/+0
| | | | | | | | | | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@19119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/io.h (rb_io_t): new fields: encs.ecopts andakr2008-09-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@19109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/signal.h: removed.ko12008-09-031-16/+16
| | | | | | | | | | | | | | | * 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: http://svn.ruby-lang.org/repos/ruby/trunk@19080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c, include/ruby/ruby.h: rename T_DEFERRED to T_ZOMBIE.ko12008-08-291-7/+7
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/io.h (rb_io_t): remove path field and add pathv field.akr2008-08-231-0/+1
| | | | | | | | | | | | | | | | (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: http://svn.ruby-lang.org/repos/ruby/trunk@18782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/io.h (rb_io_t): new fields: writeconv,akr2008-08-181-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@18691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (getrusage_time): should return the value.nobu2008-08-141-0/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c: count only freed object as freelist size.ko12008-08-131-7/+6
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (getrusage_time): Returned effective value on Windows.kouji2008-08-121-0/+21
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (gc_profile_result): use rb_str_catf.nari2008-08-121-17/+14
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (gc_profile_result): use sprintf.nari2008-08-121-17/+20
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (getrusage_time): works only if RUSAGE_SELF is defined rightnobu2008-08-111-26/+27
| | | | | | | | | now. * gc.c (gc_profile_result): C99. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c: added GC::Profiler.nari2008-08-111-0/+339
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (STACK_LEVEL_MAX, ruby_stack_length): returns size_t.nobu2008-08-091-1/+1
| | | | | | | [ruby-core:18207] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (run_final): runs finalizers with the object terminated.nobu2008-08-061-14/+19
| | | | | | | | * gc.c (rb_gc_call_finalizer_at_exit): keeps finalized objects from linking to freelist. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (chain_finalized_object): deletes finalizers to be invoked fromnobu2008-08-061-0/+7
| | | | | | | | | | finalizer_table. * gc.c (rb_gc_call_finalizer_at_exit): warns when could not invoke finalizers. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (rb_gc_call_finalizer_at_exit): self-referencing finalizersnobu2008-08-061-20/+15
| | | | | | | cannot be invoked. [ruby-dev:35681] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (allocate_heaps, assign_heap_slot, rb_newobj_from_heap):mame2008-08-011-2/+8
| | | | | | | reset during_gc before raising NoMemoryError. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (gc_mark_children, obj_free): T_DEFERRED should not be appear.ko12008-07-271-8/+10
| | | | | | | | | * gc.c (gc_sweep, finalize_list): fix to decrement heap_slot#limit after executing finalizer. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h: add a type T_DEFERRED.ko12008-07-271-47/+70
| | | | | | | | | | | | | | * 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: http://svn.ruby-lang.org/repos/ruby/trunk@18231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (gc_sweep, obj_free, run_final): defer finalizers of IO andnobu2008-07-251-10/+27
| | | | | | | Data. [ruby-dev:35578] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c: revert. before lazy sweep.nari2008-07-051-245/+124
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (garbage_collect_force): sweep is completely ended.nari2008-07-041-7/+12
| | | | | | | | * gc.c (os_obj_of): invoke garbage_collect_force() when freelist none. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (Init_eval), gc.c (Init_GC), proc.c (Init_Proc): freezenobu2008-07-021-1/+2
| | | | | | | messages of preallocated special exceptions also. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (rb_during_gc): VALUE cache is irrelevant.nobu2008-07-021-10/+0
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c: add rb_during_gc(). based on a patch from arton <artonx ATsuke2008-07-021-0/+17
| | | | | | | | | yahoo.co.jp> at [ruby-dev:35313]. * include/ruby/intern.h: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* *gc.c (gc_lazy_sweep) : use lazy sweep algorithm for response performance gain.nari2008-07-021-124/+240
| | | | | | | | (garbage_collect_force) : mark and lazysweep invoke, after erasing all mark. (GC_NOT_LAZY_SWEEP) : not lazy sweep flag. for debug. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (rb_newobj): abort GC phase before rb_bug.nobu2008-06-301-7/+11
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (chain_finalized_object): should not delete from finalizernobu2008-06-301-3/+4
| | | | | | | | | | table until run. * gc.c (rb_gc_call_finalizer_at_exit): deferred_final_list may be empty first. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (gc_finalize_deferred): allow object allocation in finalizers.nobu2008-06-301-22/+21
| | | | | | | * gc.c (rb_gc_call_finalizer_at_exit): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (rb_newobj): prohibit call of rb_newobj() during gc whenusa2008-06-301-0/+2
| | | | | | | | USE_VALUE_CACHE is not defined (normal case). git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h (struct RRegexp): new field usecnt. replaceakr2008-06-281-3/+3
| | | | | | | | | | | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@17635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (rb_newobj): prohibit call of rb_newobj() during gc.shyouhei2008-06-181-0/+3
| | | | | | | | a patch from Sylvain Joyeux in [ruby-core:12099]. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h (rb_vm_t), vm.c (rb_vm_mark): moved preallocated specialnobu2008-06-151-2/+8
| | | | | | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@17165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.h (STACK_UPPER): moved from gc.cnobu2008-06-141-84/+6
| | | | | | | | * thread.c, thread_{pthread,win32}.c (ruby_init_stack, ruby_thread_init_stack): moved stack initialization from gc.c. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (ruby_initial_gc_stress): defined.akr2008-06-131-0/+4
| | | | | | | | | | (ruby_initial_gc_stress_ptr): defined. * debug.c (set_debug_option): use ruby_initial_gc_stress_ptr for gc_stress option. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (ruby_gc_stress): moved to rb_objspace_t.nobu2008-06-131-4/+9
| | | | | | | | | * gc.c (gc_stress_get, gc_stress_set): VM local attribute. * signal.c (sigsegv): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (rb_memerror): exit with EXIT_FAILURE instead of magic number.nobu2008-06-131-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (ruby_stack_check): STACK_LENGTH should be less thannobu2008-06-131-3/+2
| | | | | | | STACK_LEVEL_MAX. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/intern.h (Init_stack): make to call ruby_init_stack.nobu2008-06-091-0/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c: add a build option "CALC_EXACT_MALLOC_SIZE".ko12008-06-081-52/+113
| | | | | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@17018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c, bignum.c, cont.c, dir.c, dln.c, encoding.c, enumerator.c,ko12008-06-081-20/+20
| | | | | | | | | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@17017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (count_objects): clear hash after counting objects.akr2008-06-061-4/+5
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (rb_objspace_alloc): this function is needed only whenmame2008-06-051-0/+2
| | | | | | | | | ENABLE_VM_OBJSPACE macro is defined. * vm.c: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (os_obj_of): heaps may be modified in yield.akr2008-06-051-5/+16
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e