summaryrefslogtreecommitdiff
path: root/hash.c
AgeCommit message (Collapse)Author
2013-06-02fill rdocsnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-29* hash.c: fix WB bug.ko1
(1) Hash's key also needs WB. (2) callback parameter *key and *value of st_update() is not a storage of st_table itself (only local variable). So that OBJ_WRITE() is not suitable, especially for `!exsinting'. OBJ_WRITTEN() is used instead of OBJ_WRITE(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-26* hash.c (rb_hash_tbl_raw), internal.h: added.ko1
Returns st_table without shading hash. * array.c: use rb_hash_tbl_raw() for read-only purpose. * compile.c (iseq_compile_each): ditto. * gc.c (count_objects): ditto. * insns.def: ditto. * process.c: ditto. * thread.c (clear_coverage): ditto. * vm_insnhelper.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-26* hash.c, include/ruby/ruby.h: support WB protected hash.ko1
* constify RHash::ifnone and make new macro RHASH_SET_IFNONE(). * insert write barrier for st_update(). * include/ruby/intern.h: declare rb_hash_set_ifnone(hash, ifnone). * marshal.c (r_object0): use RHASH_SET_IFNONE(). * ext/openssl/ossl_x509name.c (Init_ossl_x509name): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40933 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13* include/ruby/ruby.h: constify RBasic::klass and addko1
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
2013-05-13* *.c, parse.y, insns.def: use RARRAY_AREF/ASET macroko1
instead of using RARRAY_PTR(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13* hash.c: Hash[] and {} are not equivalent by @eam [Fixes GH-301]zzak
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-25* benchmark/bm_hash_shift.rb: add benchmark for Hash#shiftcharliesome
* hash.c (rb_hash_shift): use st_shift if hash is not being iterated to delete element without iterating the whole hash. * hash.c (shift_i): remove function * include/ruby/st.h (st_shift): add st_shift function * st.c (st_shift): ditto [Bug #8312] [ruby-core:54524] Patch by funny-falcon git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-16fix ENV.to_a rdoc example by @benolee [fix GH-288]hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-23* array.c: Fix rdoc for flatten!marcandre
* hash.c: Correct rdoc for reject! git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-06* hash.c (env_reject_bang): hide keys array from ObjectSpacecharliesome
* hash.c (env_select_bang): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-26* hash.c (rb_env_size): Restored documentation for ENV.sizedrbrain
* lib/drb/drb.rb: Documented DRb::DRb#run. * lib/erb.rb (class ERB): Improved documentation of ERb. * transcode.c: Documented Encoding::Converter constants. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38948 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-01* hash.c (rb_hash_update): Revert documentation from r38672zzak
See: https://github.com/ruby/ruby/pull/228#issuecomment-11791013 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-01* hash.c (rb_hash_update): Documentation for Hash#merge and shallowzzak
copies Patch by Yorick Peterse [Fixes Github #228] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-29adjust stylenobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-28* configure.in: check for the whether crt_externs.h is present when compilingcharliesome
for darwin (this header is missing in the iOS SDK) * eval_intern.h: check HAVE_CRT_EXTERNS_H before including crt_externs.h, if not defined, include missing/crt_externs.h instead * hash.c: ditto * missing/setproctitle.c: ditto * missing/crt_externs.h: declare _NSGetEnviron() function and define environ for iOS git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-01adjust style.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38128 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-11hash.c: warn for wrong elementsnobu
* hash.c (rb_hash_s_create): just warn for wrong elements now. [ruby-dev:46440] [Bug #7300] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-11hash.c: refine error messagesnobu
* hash.c (rb_hash_s_create): refine error messages. * error.c (rb_builtin_class_name): share for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06* hash.c: Support for enumerators created by ENV:marcandre
each, each_value, ... [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37512 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06* hash.c: Support for enumerators created by Hash:marcandre
delete_if, reject!, ... [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-05Index $LOADED_FEATURES so that require isn't so slowshirosaki
* load.c (rb_feature_p, rb_provide_feature): index $LOADED_FEATURES so that require isn't so slow. * load.c (rb_provide_feature, get_loaded_features_index): ensure that $LOADED_FEATURES entries are frozen strings. The user must mutate $LOADED_FEATURES itself rather than its individual entries. * load.c (reset_loaded_features_snapshot): add a new function to reset vm->loaded_features_snapshot. * load.c (get_loaded_features_index_raw): add a new function to get the loaded-features index. * load.c (features_index_add_single): add a new function to add to the loaded-features index a single feature. * load.c (features_index_add): add a new function to add to the loaded-features index all the required entries for `feature`. * vm_core.h (rb_vm_struct): add fields. * vm.c (rb_vm_mark): mark new fields. * include/ruby/intern.h (rb_hash_clear): declare function. * hash.c (rb_hash_clear): make function non-static. Patch by Greg Price. [ruby-core:47970] [Bug #7158] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-03* hash.c (rb_hash_delete): Correct grammarzzak
Patch by Glenn Oppegard [Fixes #208 Github] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37435 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-19* hash.c (initialize_copy): unset the default proc if there isn't onetenderlove
for the target hash, call to_hash, check frozen status. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-18* hash.c (initialize_copy): duping should rehash the hash.tenderlove
* test/ruby/test_hash.rb: added a test to ensure rehash. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-16* hash.c (initialize_copy): copy the underlying st_table on dup,tenderlove
rather than copying the hash key by key. [ruby-core:48009] * test/ruby/test_hash.rb: relevant tests for initialize_copy git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-14hash.c: raise on invalid inputnobu
* hash.c (rb_hash_s_create): raise an exception, when input elements are not one or two elements arrays. [ruby-core:39945] [Bug #5406] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-23use RB_TYPE_P() instead of comparison of TYPE()nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-24* hash.c, object.c, struct.c, lib/ostruct.rb: add to_h methods.nobu
[Feature #6276] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-18Revert r35339-35343 because of no tests.naruse
* hash.c: Alias ENV.to_h to ENV.to_hash [ref #6276] * lib/ostruct.rb: Add OpenStruct#to_h [Feature #6276] * struct.c: Add Struct#to_h [Feature #6276] * object.c: Add NilClass#to_h [Feature #6276] * hash.c: Add Hash#to_h [Feature #6276] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-16* hash.c: Alias ENV.to_h to ENV.to_hash [ref #6276]marcandre
[rubyspec:6587eead7cd1] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-16* hash.c: Add Hash#to_h [Feature #6276]marcandre
[rubyspec:84b7fe3f24d2] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-13* hash.c (no_new_key): moved test to raise outside.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-13* hash.c (inspect_i): keep string's coderange.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-13* hash.c (rb_hash_aset, rb_hash_update, rb_hash_update_by): usenobu
st_update() to reduce evaluation of hash values. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-12* hash.c: use RHASH_ITER_LEV(), not iter_leve directly.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-09* hash.c (rb_hash_set_default_proc): Accept nil, patch by Run Paintmarcandre
[Feature #4234] * test/ruby/test_hash.rb: test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-31* hash.c (hash_default_value): extract from rb_hash_aref(), to benobu
shared with rb_hash_shift(), so that overriding Hash#default will be respected. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-31* hash.c: do not allocate st_table when it is not necessary.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-31* hash.c: remove unnecessary checks for Qundef in hash iterations.nobu
since hash use st_foreach_check for iterations, such checks are needless. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-30* st.c (st_foreach_check): remove the entry by replacing with nevernobu
when ST_DELETE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-30* hash.c (st_foreach_safe): since table is not for VALUE, Qundef isnobu
not special value, so use 0 instead. therefore this function can be applied to only st_table which 0 is invalid as keys, e.g., IDs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-30* hash.c: Qundef cannot be passed from st_foreach_check().nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-30* hash.c, marshal.c, object.c, variable.c: fix callback argument typesnobu
of iterators. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-15* hash.c (env_str_new, rb_f_getenv, env_fetch): use rb_str_conv_enc()usa
instead of rb_str_encode() to simplify the code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35031 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-15* win32/win32.c, include/ruby/win32.h (rb_w32_ugetenv): new API tousa
accept and to return UTF-8 strings. * win32/win32.c (rb_w32_getenv): follow above change. * win32/win32.c (rb_w32_get_environ): returns UTF-8 environment area. * hash.c (env_str_new, rb_f_getenv, env_fetch): follow above changes. [Bug #5570] [ruby-core:40737] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-14* include/ruby/intern.h: Add rb_check_arity, rb_error_arity [#6085]marcandre
* array.c: Use rb_check_arity / rb_error_arity * class.c: ditto * enumerator.c: ditto * eval.c: ditto * file.c: ditto * hash.c: ditto * numeric.c: ditto * proc.c: ditto * process.c: ditto * random.c: ditto * re.c: ditto * signal.c: ditto * string.c: ditto * struct.c: ditto * transcode.c: ditto * vm_eval.c: ditto * vm_insnhelper.c: ditto & implementation of rb_error_arity * test/ruby/test_arity.rb: tests for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-10* st.c: add st_foreach_check for fixing iteration over packed tablenobu
and st_delete_safe. patched by Sokolov Yura at https://github.com/ruby/ruby/pull/84 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e