so can skip oldgen bitmap check around mark & sweep.
* gc.c (slot_sweep_body): change scan algorithm for performance:
from object's pointer base to bitmap one.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
"Sunny" doesn't mean antonym of "Shady" (questionable, doubtful, etc).
Instead of "Suuny", use "non-shady" or "normal".
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c (rgengc_rememberset_mark): bypass gc_mark() in order to push
sunny old object at minor gc.
* gc.c (gc_mark_children): move sunny old check to gc_mark().
* gc.c (rgengc_check_shady): remove DEMOTE that already unnecessary.
* gc.c (rb_gc_writebarrier): ditto.
change sunny old check point in order to save mark stack and
remove unnatural rest_sweep & demote.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Profiling record is allocated at first of marking phase.
Enable at lazy sweeping may cause an error (SEGV).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
RUBY_INTERNAL_EVENT_GC_END. This event invokes at the end of
after_sweep().
Time chart with lazy sweep is here:
(1) Kick RUBY_INTERNAL_EVENT_GC_START
(2) [gc_marks()]
(3) [lazy_sweep()]
(4) [... run Ruby program (mutator) with lazy_sweep() ...]
(5) [after_sweep()]
(6) Kick RUBY_INTERNAL_EVENT_GC_END
(7) [... run Ruby program (mutator), and go to (1) ...]
* ext/-test-/tracepoint/tracepoint.c,
test/-ext-/tracepoint/test_tracepoint.rb: modify a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Read the following test to know HOWTO.
This feature is a sample of RUBY_INTERNAL_EVENT.
* test/objspace/test_objspace.rb: add a test.
* ext/objspace/object_tracing.c: ditto.
* gc.c (rb_gc_count): add. THis function returns GC count.
* internal.h: add decl. of rb_gc_count(). Same as `GC.count'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* RUBY_INTERNAL_EVENT_NEWOBJ: object created.
* RUBY_INTERNAL_EVENT_FREE: object freeed.
* RUBY_INTERNAL_EVENT_GC_START: GC started.
And rename `RUBY_EVENT_SWITCH' to `RUBY_INTERNAL_EVENT_SWITCH'.
Internal events can not invoke any Ruby program because the tracing
timing may be critical (under huge restriction).
These events can be hooked only by C-extensions.
We recommend to use rb_potponed_job_register() API to call Ruby
program safely.
This change is mostly written by Aman Gupta (tmm1).
https://bugs.ruby-lang.org/issues/8107#note-12
[Feature #8107]
* include/ruby/debug.h, vm_trace.c: added two new APIs.
* rb_tracearg_event_flag() returns rb_event_flag_t of this event.
* rb_tracearg_object() returns created/freeed object.
* ext/-test-/tracepoint/extconf.rb,
ext/-test-/tracepoint/tracepoint.c,
test/-ext-/tracepoint/test_tracepoint.rb: add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40946 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Postponed jobs are registered with this API. Registered jobs
are invoked at `ruby-running-safe-point' as soon as possible.
This timing is completely same as finalizer timing.
There are two APIs:
* rb_postponed_job_register(flags, func, data): register a
postponed job with data. flags are reserved.
* rb_postponed_job_register_one(flags, func, data): same as
`rb_postponed_job_register', but only one `func' job is
registered (skip if `func' is already registered).
This change is mostly written by Aman Gupta (tmm1).
https://bugs.ruby-lang.org/issues/8107#note-15
[Feature #8107]
* gc.c: use postponed job API for finalizer.
* common.mk: add dependency from vm_trace.c to debug.h.
* ext/-test-/postponed_job/extconf.rb, postponed_job.c,
test/-ext-/postponed_job/test_postponed_job.rb: add a test.
* thread.c: implement postponed API.
* vm_core.h: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
remembered_sunny_object_count and remembered_shady_object_count
for each types when RGENGC_PROFILE >= 2.
They are informative for optimization.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* number of oldgen object is biggger than twice of
number of oldgen object at last full GC.
* number of remembered shady object is bigger than twice of
number of remembered shady object at last full GC.
* number of oldgen object and remembered shady object is bigger
than half of total object space.
(please fix my English!)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
before extending heaps.
TODO: do major GC when there are many old (promoted) objects.
* gc.c (after_gc_sweep): remove TODO comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c (gc_profile_dump_on): revert r40898. ok to show the record
accumulating while lazy_sweep().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c (gc_profile_dump_on): do not dump the last record, for some
reason.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c (gc_profile_dump_on): use size_t to get rid of overflow and
show the header when next_index > 0, instead of next_index != 1.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(or garbage_collect_body()). `garbage_collect()' accept additional
two parameters `full_mark' and `immediate_sweep'.
If `full_mark' is TRUE, then force it full gc (major gc), otherwise,
it depends on status of object space. Now, it will be minor gc.
If `immediate_sweep' is TRUE, then disable lazy sweep.
To allocate free memory, `full_mark' and `immediate_sweep' should be
TRUE. Otherwise, they should be FALSE.
* gc.c (gc_prepare_free_objects): use `garbage_collect_body()'.
* gc.c (slot_sweep, before_gc_sweep, after_gc_sweep): add logging code.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
sweeping time. At lazy GC, GC::Profiler makes new record entry
for each lazy_sweep(). In this change, accumulating all
slot_sweep() time.
And change indentation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
can be negative number.
And use pointer for `record' (don't copy).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c (rb_gc_guarded_ptr): unoptimize on other compilers than gcc and
msvc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
three parameters v1, v2, v3. newobj_of() do OBJSETUP() and
fill values with v1, v2, v3.
* gc.c (rb_data_object_alloc, rb_data_typed_object_alloc):
use newobj_of().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Profiling result can be check by GC.stat.
* gc.c (type_name): separate from obj_type_name().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
See this ticet about RGENGC.
* gc.c: Add several flags:
* RGENGC_DEBUG: if >0, then prints debug information.
* RGENGC_CHECK_MODE: if >0, add assertions.
* RGENGC_PROFILE: if >0, add profiling features.
check GC.stat and GC::Profiler.
* include/ruby/ruby.h: disable RGENGC by default (USE_RGENGC == 0).
* array.c: add write barriers for T_ARRAY and generate sunny objects.
* include/ruby/ruby.h (RARRAY_PTR_USE): added. Use this macro if
you want to access raw pointers. If you modify the contents which
pointer pointed, then you need to care write barrier.
* bignum.c, marshal.c, random.c: generate T_BIGNUM sunny objects.
* complex.c, include/ruby/ruby.h: add write barriers for T_COMPLEX
and generate sunny objects.
* rational.c (nurat_s_new_internal), include/ruby/ruby.h: add write
barriers for T_RATIONAL and generate sunny objects.
* internal.h: add write barriers for RBasic::klass.
* numeric.c (rb_float_new_in_heap): generate sunny T_FLOAT objects.
* object.c (rb_class_allocate_instance), range.c:
generate sunny T_OBJECT objects.
* string.c: add write barriers for T_STRING and generate sunny objects.
* variable.c: add write barriers for ivars.
* vm_insnhelper.c (vm_setivar): ditto.
* include/ruby/ruby.h, debug.c: use two flags
FL_WB_PROTECTED and FL_OLDGEN.
* node.h (NODE_FL_CREF_PUSHED_BY_EVAL, NODE_FL_CREF_OMOD_SHARED):
move flag bits.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
We can use `objspace_live_num()' instead of removed `marked_num'
if it is after `after_gc_sweep()' function call.
* gc.c (after_gc_sweep): use objspace_live_num() instead of removed
rb_objspace_t::marked_num.
* gc.c (gc_mark_ptr, gc_marks): remove rb_objspace_t::marked_num code.
* gc.c (gc_prepare_free_objects): do not call set_heaps_increment()
with checking objspace->heap.marked_num. At this point, we only
need to check availability of free-cell.
* gc.c (gc_prepare_free_objects):
* gc.c (lazy_sweep): call after_gc_sweep() if there are no sweep_able entry.
* gc.c (rest_sweep, gc_prepare_free_objects): remove after_gc_sweep() call.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c (gc_prof_set_malloc_info): fix "objspace->heap.live_num" to
"objspace_live_num(objspace)". There is no such member variable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c (gc_prof_sweep_timer_start/stop): removed because
they doesn't support lazy sweep.
* gc.c (gc_prof_sweep_slot_timer_start/stop): added.
redefine `sweeping time' to accumulated time of all of
slot_sweep().
* gc.c (rb_objspace_t::profile::count): renamed to
rb_objspace_t::profile::next_index. `counter' seems ambiguous.
increment it when next record is acquired.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
RBASIC_CLASS(obj) macro which returns a class of `obj'.
This change is a part of RGENGC branch [ruby-trunk - Feature #8339].
* object.c: add new function rb_obj_reveal().
This function reveal interal (hidden) object by rb_obj_hide().
Note that do not change class before and after hiding.
Only permitted example is:
klass = RBASIC_CLASS(obj);
rb_obj_hide(obj);
....
rb_obj_reveal(obj, klass);
TODO: API design. rb_obj_reveal() should be replaced with others.
TODO: modify constified variables using cast may be harmful for
compiler's analysis and optimizaton.
Any idea to prohibt inserting RBasic::klass directly?
If rename RBasic::klass and force to use RBASIC_CLASS(obj),
then all codes such as `RBASIC(obj)->klass' will be
compilation error. Is it acceptable? (We have similar
experience at Ruby 1.9,
for example "RARRAY(ary)->ptr" to "RARRAY_PTR(ary)".
* internal.h: add some macros.
* RBASIC_CLEAR_CLASS(obj) clear RBasic::klass to make it internal
object.
* RBASIC_SET_CLASS(obj, cls) set RBasic::klass.
* RBASIC_SET_CLASS_RAW(obj, cls) same as RBASIC_SET_CLASS
without write barrier (planned).
* RCLASS_SET_SUPER(a, b) set super class of a.
* array.c, class.c, compile.c, encoding.c, enum.c, error.c, eval.c,
file.c, gc.c, hash.c, io.c, iseq.c, marshal.c, object.c,
parse.y, proc.c, process.c, random.c, ruby.c, sprintf.c,
string.c, thread.c, transcode.c, vm.c, vm_eval.c, win32/file.c:
Use above macros and functions to access RBasic::klass.
* ext/coverage/coverage.c, ext/readline/readline.c,
ext/socket/ancdata.c, ext/socket/init.c,
* ext/zlib/zlib.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c (gc_prepare_free_objects): fix compile error. there should be
free objects when new slot is added.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39902 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
restricted. So collecting is often invoked if there is not
enough free space in the heap. Try to expand heap when this is
the case.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39900 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This follows the change r38493.
* gc.c (id2ref): fix for working fine with Bignum object id on x64
Windows.
* gc.c (wmap_finalize): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
LLP64 platform, such as 64bit Windows.
reporeted by Heesob Park at [ruby-core:50255] [Bug #7454], and the
fix is suggested by akr.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
sigsegv handler. enlarge value when x86 or x86_64 on Linux.
Linux has very small MINSIGSTKSZ size (2048 bytes) and
our sigsegv routine need 5KiB at least. [Bug #7141]
* internal.h: add declaration of rb_sigaltstack_size().
* vm_core.h: remove ALT_STACK_SIZE definition.
* signal.c (rb_register_sigaltstack): replace ALT_STACK_SIZE with
rb_sigaltstack_size();
* gc.c (Init_heap): ditto.
* vm.c (th_init): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
entry with VM_METHOD_TYPE_REFINED holds only the original method
definition, so ci->me is set to a method entry allocated in the
stack, and it causes SEGV/ILL. In this commit, a method entry
with VM_METHOD_TYPE_REFINED holds the whole original method entry.
Furthermore, rb_thread_mark() is changed to mark cfp->klass to
avoid GC for iclasses created by copy_refinement_iclass().
* vm_method.c (rb_method_entry_make): add a method entry with
VM_METHOD_TYPE_REFINED to the class refined by the refinement if
the target module is a refinement. When a method entry with
VM_METHOD_TYPE_UNDEF is invoked by vm_call_method(), a method with
the same name is searched in refinements. If such a method is
found, the method is invoked. Otherwise, the original method in
the refined class (rb_method_definition_t::body.orig_me) is
invoked. This change is made to simplify the normal method lookup
and to improve the performance of normal method calls.
* vm_method.c (EXPR1, search_method, rb_method_entry),
vm_eval.c (rb_call0, rb_search_method_entry): do not use
refinements for method lookup.
* vm_insnhelper.c (vm_call_method): search methods in refinements if
ci->me is VM_METHOD_TYPE_REFINED. If the method is called by
super (i.e., ci->call == vm_call_super_method), skip the same
method entry as the current method to avoid infinite call of the
same method.
* class.c (include_modules_at): add a refined method entry for each
method defined in a module included in a refinement.
* class.c (rb_prepend_module): set an empty table to
RCLASS_M_TBL(klass) to add refined method entries, because
refinements should have priority over prepended modules.
* proc.c (mnew): use rb_method_entry_with_refinements() to get
a refined method.
* vm.c (rb_thread_mark): mark cfp->klass for iclasses created by
copy_refinement_iclass().
* vm.c (Init_VM), cont.c (fiber_init): initialize th->cfp->klass.
* test/ruby/test_refinement.rb (test_inline_method_cache): do not skip
the test because it should pass successfully.
* test/ruby/test_refinement.rb (test_redefine_refined_method): new
test for the case a refined method is redefined.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
CLOCK_PROCESS_CPUTIME_ID when available, which provides a 1ns
precision on linux. [ruby-core:50495] [Bug #7500]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
a object which is reachable from a part after this function,
e.g. ruby_vm_destruct(). [ruby-dev:46647] [Bug #7452]
* test/ruby/test_gc.rb (test_finalizing_main_thread): add a test
for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
VM_METHOD_TYPE_REFINED to the class refined by the refinement if
the target module is a refinement. When a method entry with
VM_METHOD_TYPE_UNDEF is invoked by vm_call_method(), a method with
the same name is searched in refinements. If such a method is
found, the method is invoked. Otherwise, the original method in
the refined class (rb_method_definition_t::body.orig_def) is
invoked. This change is made to simplify the normal method lookup
and to improve the performance of normal method calls.
* vm_method.c (EXPR1, search_method, rb_method_entry),
vm_eval.c (rb_call0, rb_search_method_entry): do not use
refinements for method lookup.
* vm_insnhelper.c (vm_call_method): search methods in refinements if
ci->me is VM_METHOD_TYPE_REFINED. If the method is called by
super (i.e., ci->call == vm_call_super_method), skip the same
method entry as the current method to avoid infinite call of the
same method.
* class.c (include_modules_at): add a refined method entry for each
method defined in a module included in a refinement.
* class.c (rb_prepend_module): set an empty table to
RCLASS_M_TBL(klass) to add refined method entries, because
refinements should have priority over prepended modules.
* proc.c (mnew): use rb_method_entry_with_refinements() to get
a refined method.
* test/ruby/test_refinement.rb (test_inline_method_cache): do not skip
the test because it should pass successfully.
* test/ruby/test_refinement.rb (test_redefine_refined_method): new
test for the case a refined method is redefined.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* total_allocated_object: total allocated object number.
* total_freed_object: total freed object number.
Above two numbers are only accumulated and they will
overflow (return to 0). Please use them as a hint.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 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
* 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
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
* 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
* 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
* 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
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
* 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
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
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
* 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
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
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
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
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
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
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
* 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
* 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
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
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
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
* gc.c (vm_xrealloc): fix allocated_size update, should not ignore old
size.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
exits. [ruby-dev:44436]
* test/ruby/test_gc.rb (class TestGc): added the test case for
this issue.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Patch by Google Inc. [ruby-core:45073].
* configure.in (RUBY_NACL): New M4 func to configure variables for
NaCl.
(RUBY_NACL_CHECK_PEPPER_TYPES): New M4 func to check the old names
of Pepper interface types.
(BTESTRUBY): New variable to specify which ruby should be run on
"make btest". NaCl can run the built binary by sel_ldr, but it need
rbconfig.rb. So this variable is distinguished from $MINIRUBY.
* thread_pthread.c: Disabled some features on NaCl.
* io.c: ditto.
* process.c: ditto.
* signal.c: ditto.
* file.c: ditto.
* missing/flock.c: ditto.
* nacl/pepper_main.c: An example implementation of Pepper application
that embeds Ruby.
* nacl/example.html: An example of web page that uses the Pepper
application.
* nacl/nacl-config.rb: Detects variants of NaCl SDK.
* nacl/GNUmakefile.in: Makefile template for NaCl specific build
process.
* nacl/package.rb: script for packaging a NaCl-Ruby embedding
application.
* nacl/reate_nmf.rb: Wrapper script of create_nmf.py
* dln.c (dln_load): Added a hack to call on NaCl.
* util.c (ruby_getcwd): Path to the current directort is not available
on NaCl.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c (aligned_free): fix condition for free. memalign() and
posix_memalign() are not defined together normally.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rest_sweep() instead of it, because some dead objects might be
marked in next the mark phase by false pointers.
[ruby-core:42672]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
unsweeped slots, because some dead objects might be marked in
next the mark phase by false pointers. [ruby-core:42672]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
restore rb_thread_t::local_storage.
* cont.c (rb_obj_is_fiber): add a new function to tell finalizer to
prevent fibers from destroy.
* gc.c (rb_objspace_call_finalizer): don't sweep fibers at finalizing
objspace.
* internal.h (rb_fiber_reset_root_local_storage, rb_obj_is_fiber):
add prototypes.
* vm.c (ruby_vm_destruct): reset main thread's local_storage before
free main thread. rb_thread_t::local_storage is replaced by fiber's
local storage when forked from fiber, and it should be already freed
when the fiber was destroyed.
* test/ruby/test_fiber.rb (test_fork_from_fiber): add test for fork
from fiber.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
basis of HEAP_SIZE because it must covers a whole heap block.
[ruby-trunk - Bug #6006]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
sometime there should be `objs-=2` instead of `objs--`.
patched by Sokolov Yura. https://github.com/ruby/ruby/pull/92
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
`sizeof(struct heaps_slot)` while heap is currently allocated
with `struct heaps_header`.
HEAP_BITMAP_LIMIT were calculated from
`HEAP_OBJ_LIMIT/sizeof(uintptr_t)` - one Byte for each object,
not one Bit. [Bug #6006]
patched by Sokolov Yura. https://github.com/ruby/ruby/pull/92
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
ruby_mimmalloc() doesn't increment allocated_size/allocations and
decrement them in ruby_xfree() cause inconsistency.
* gc.c (ruby_xfree): don't decrement allocated_size/allocations if
allocated size record is 0.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
but should return pointer suitable for ruby_xfree;
main vm and main thread.
patched by Sokolov Yura. https://github.com/ruby/ruby/pull/79
* internal.h: ditto.
* vm.c (Init_BareVM): use ruby_mimmalloc.
* ext/dl/cfunc.c: #include <ruby/util.h>.
* ext/syslog/syslog.c: use xfree because it is allocated by
ruby_strdup.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34257 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
can causes copy-on-write of memory page on heap block when its
free_next is rewirted.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
patched by Sokolov Yura. https://github.com/ruby/ruby/pull/78
* dln_find.c: remove useless replacement of free.
* ext/readline/readline.c (readline_attempted_completion_function):
strings for readline must allocated with malloc.
* process.c (run_exec_dup2): use free; see also r20950.
* re.c (onig_new_with_source): use malloc for oniguruma.
* vm.c (ruby_vm_destruct): use free for VMs.
* vm.c (thread_free): use free for threads.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c (aligned_malloc): use configure's result instead of
_POSIX_C_SOURCE and _XOPEN_SOURCE because they can't be used
to check availability at least on FreeBSD.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34226 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
should use ATOMIC_EXCHANGE() to check the previous value.
[ruby-dev:44596] [Bug #5439]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
object setup to get rid of rare-but-potential memory leak.
* gc.c (gc_mark_children): skip marking extended members if ptr is
NULL.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
if -w/-v options are specified. these messages are output to stderr,
not to stdout. [ruby-core:39795] [Bug #5380]
* test/ruby/test_gc.rb (test_gc_parameter): add test for it.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33379 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
heap slots are expanded by environment variable RUBY_HEAP_MIN_SLOTS.
[ruby-core:39777] [Bug #5380]
* test/ruby/test_gc.rb (test_gc_parameter): add test for it.
* test/ruby/envutil.rb (assert_normal_exit): add :child_env option to
enable pass environemnt variables to child process.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
define macros only if they are not defined.
fixes: [Ruby 1.9 - Feature #5291]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
sweeping, and to it cannot come back since other objects
referred from it might have been freed already.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33219 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
try heap_increment() because it might be able to expand the
heap. [Bug #5127] [ruby-dev:44285]
* gc.c (gc_clear_mark_on_sweep_slots): if a sweeping was
interrupted, we expand the heap if at all possible.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
[ruby-dev:44315] [Bug #5139]
* vm.c (thread_free): use free because objspace is not ready.
* vm.c (th_init): use malloc because objspace is not ready.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32815 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(rb_gc_mark_unlinked_live_method_entries): fix SEGV bug.
rb_method_entry_t was free'd even when the method is still on the
stack if it is BMETHOD (i.e., Method#call). This is because
rb_method_entry_t is embedded in struct METHOD. This commit
separates them and marks the live method entries.
See [ruby-core:38449] in detail. fix [Bug #5047] [ruby-core:38171]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
gc_mark(lev <= GC_LEVEL_MAX) in gc_mark().
In ruby_stack_check(), water_mark is a value that may call some
C function. Fixes Bug #3781
* configure.in: define GC_MARK_STACKFRAME_WORD that approximate
size of gc_mark() and gc_mark_children() stackframes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
return NULL if it's passed 0. But some caller don't expect it.
patch by Yutaka Kanemoto.
(vm_malloc_prepare): return calculated size.
(vm_xmalloc): use above result.
(vm_xcalloc): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
type check to get rid of a double free when main Thread has singleton
class. [ruby-core:36741] [Bug #4828]
* thread.c (rb_obj_is_mutex): add a new utility function.
* vm.c (rb_obj_is_thread): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
environment variables. based on a patch from funny-falcon at
https://gist.github.com/856296, but honors safe level.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
thread to free.
* gc.c (slot_sweep): don't call RUBY_VM_SET_FINALIZER_INTERRUPT if
there is no current thread.
[ruby-dev:43000]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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
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
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
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
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
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
"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
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
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
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
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
- 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
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
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
* 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
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
* 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
* 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
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
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