comparison by hash for concerned methods. [ruby-core:51266]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38974 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
* array.c (rb_ary_aref): fix Segmentation fault at TestArray#test_aref
on x64 mingw. Variable argument of rb_scan_args() should be a pointer
(VALUE *), but 0 of variable argument seems not equal to null pointer
on x64 mingw.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37828 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* array.c (rb_ary_shared_with_p): fix cache validity check.
If #pop or #shift has been called against $: or $", the array will
be still shared with the snapshot. We check array length for cache
validity.
[ruby-core:49518] [Bug #7383]
* test/ruby/test_require.rb
(TestRequire#test_require_with_array_pop,
TestRequire#test_require_with_array_shift): add tests for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
condition, missed break in switch/case, and workaround for GCC
optimization. See [ruby-core:49364] in detail. A great patch from
Heesob Park. [Bug #7352] [Feature #4766]
* array.c (rb_ary_bsearch): fix similar bug (missed break).
* test/ruby/test_range.rb: add two test cases for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
[ruby-core:36390] [Feature #4766]
* test/ruby/test_array.rb: add a test for above.
* range.c (range_bsearch): add Range#bsearch for binary search.
[ruby-core:36390] [Feature #4766]
* test/ruby/test_range.rb: add a test for above
* NEWS: added the two new methods.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37655 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
* array.c: speedup Array#unshift by using space in shared array.
[Feature #6638]
- when array owns its shared array (ARY_SHARED_NUM == 1), and there
is enough space then try unshift values directly into shared
array.
- when resulting array is big (~>64 items) then make it shared with
enough room for future #unshifts, and then insert into shared
array.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* array.c (rb_ary_splice): use shared array in rb_ary_slice.
[Feature #6638]
- use ary_ensure_room_for_push when rb_ary_slice used to add at the
end of array, cause rb_ary_concat use rb_ary_slice.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* array.c (ary_ensure_room_for_push): make array really suitable for
queue. [Feature #6638]
when array is shared (which happens after Array#shift), and
ARY_SHARED_NUM == 1 (which is very often when array used as queue),
then make rb_ary_push push directly into shared array.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* array.c (rb_ary_modify): steal shared array's container when
ARY_SHARED_NUM == 1. [Feature #6638]
- Do not allocate new memory in rb_ary_modify when ARY_SHARED_NUM == 1
and length almost same.
- Store ARY_CAPA instead of RARRAY_LEN in ary_make_shared, to make
it useful.
- Fix rb_ary_sort_bang accordantly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
are resized to same size and the current index become out of
range.
* test/ruby/test_array.rb: add a test for the above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
self and other are resized to same size in #== of their elements.
[ruby-dev:46373] [Feature #6177]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* array.c (rb_ary_sample): use rb_random_ulong_limited, since
precision of long may be larger than double.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Enhance documentation for array uniqueness
Based on a patch by Robin Dupret
[Bug #6872] [ruby-core:47209]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Update documentation for Array#select
* enum.c (enum_find_all, enum_reject):
Update documentation for Enumerable#find_all and Enumerable#reject
Based on a patch by Jeff Saracco
[Bug #6908] [ruby-core:47285] [Fixes#166 on github]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
We talked about this and it is like following:
* maybe ary.join(nil) should always use empty string as a separator,
but it disables to specify $, as a seprator through variables.
* if nil means '', the conversion is to_s. to_s is not accepted.
* nil is a special value, so special behavior is allowed.
* use of $ variables is not recommended, so it is not worth to change
current behavior.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* array.c (rb_get_values_at): fill with nil out of range.
[ruby-core:43678] [Bug #6203]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* array.c (rb_ary_join): should not infected by separator if it is not
used. [ruby-core:42161][Bug #5902]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e