summaryrefslogtreecommitdiff
path: root/hash.c
AgeCommit message (Collapse)Author
2013-11-17hash.c: static internal functionsnobu
* hash.c (NOINSERT_UPDATE_CALLBACK): make both of noinsert and insert internal functions static. and put semicolons for etags to find the following functions properly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-15 * cont.c : Introdule ensure rollback mechanism. Please see below.tarui
* internal.h (ruby_register_rollback_func_for_ensure): catch up above change. Add rollback mechanism API. * vm_core.h (typedef struct rb_vm_struct): catch up above change. Introdule ensure-rollback relation table. * vm_core.h (typedef struct rb_thread_struct): catch up above change. Introdule ensure stack. * eval.c (rb_ensure): catch up above change. Introdule ensure stack. * hash.c : New function for rollback ensure, and register it to ensure-rollback relation table. [ruby-dev:47803] [Bug #9105] Ensure Rollback Mechanism: A rollback's function is a function to rollback a state before ensure's function execution. When the jump of callcc is across the scope of rb_ensure, ensure's functions and rollback's functions are executed appropriately for keeping consistency. Current API is unstable, and only internal use. ruby_register_rollback_func_for_ensure(ensure_func,rollback_func) This API create relation ensure's function to rollback's function. By registered rollback's function, it is executed When jumpping into corresponding rb_ensure scope. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-15revert r43675 and r43683 without tests for applying rollback patch.tarui
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-15hash.c: iteration level with reenteringnobu
* hash.c (hash_foreach_iter, hash_foreach_ensure, rb_hash_foreach): deal with iteration level when reentering by callcc. temporary measure until rollback of ensure is introduced. [ruby-dev:47807] [Bug #9105] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-14hash.c: restore iter_levnobu
* hash.c (hash_foreach_ensure): restore iter_lev to the previous value, not just decrement. [ruby-dev:47803] [Bug #9105] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43675 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-14hash.c, st.c: fix for ST_CHECKnobu
* hash.c (foreach_safe_i, hash_foreach_iter): deal with error detected by ST_CHECK. * st.c (st_foreach_check): call with non-error argument in normal case. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-13* hash.c: [DOC] Adds an example for Hash#storezzak
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-11* internal.h: move common string/hash flags to include file.tmm1
* ext/objspace/objspace_dump.c: remove flags shared above. * hash.c: ditto. * string.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-10st.c: revert st_keysnobu
* st.c: revert st_keys() at r43238. VALUE cannot be in st.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-10* st.c (st_keys): define st_keys() for performance improvement ofglass
Hash#keys and Array#uniq. * st.h: ditto. * hash.c (rb_hash_keys): use st_keys(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-08array.c: use rb_hash_valuesnobu
* array.c (rb_ary_uniq): use rb_hash_values(), as well as the case no block is given. * internal.h: define rb_hash_values() as internal API. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-08* array.c (rb_ary_uniq): use rb_hash_keys().glass
* internal.h: define rb_hash_keys() as internal API. * hash.c (rb_hash_keys): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-03* hash.c (env_update): [DOC] fix expected output, should be 0 insteadcharliesome
of 10. Patch by @yakko. [GH-411] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-23* hash.c (env_each_pair): do not call rb_assoc_new() ifglass
it isn't needed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-13hash.c: utility functions from ruby_setenvnobu
* hash.c (invalid_envname, check_envname): extract utility functions from ruby_setenv(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42933 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-18* error.c, file.c, gc.c, hash.c, thread.c, variable.c, vm_eval.c, bin/erb:ktsj
$SAFE=4 is obsolete. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-14* hash.c (rb_hash_aset): [DOC] Document key dup patch by @kachickzzak
[Fixes GH-382] https://github.com/ruby/ruby/pull/382 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-29* hash.c (rb_hash_compare_by_id): add function prototype.glass
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-29* hash.c (rb_hash_compare_by_id): don't call rb_hash_rehash()glass
if self.compare_by_identity? == true. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-29* hash.c (rb_hash_assoc): performance improvement by replacingglass
compare function in RHASH(hash)->ntbl->type temporarily like r42224. it falls back to rb_hash_foreach() if st_lookup() doesn't find the key. * test/ruby/test_hash.rb: add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-29* hash.c (rb_hash_assoc): revert r42224. table->type->compare isglass
called only if hashes are matched. * test/ruby/test_hash.rb: add a test to check using #== to compare. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-29ChangeLog: commit missnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-29* hash.c (rb_hash_assoc): performance improvement by replacingglass
compare function in RHASH(hash)->ntbl->type temporarily. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-20* hash.c (rb_hash_flatten): use NUM2INT to raise TypeError on 32bitnaruse
platform. it's introduced by r42039 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42093 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-18* hash.c (rb_hash_flatten): performance improvement by not usingglass
rb_hash_to_a() to avoid array creation with rb_assoc_new(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-17* hash.c (delete_if_i): use ST_DELETE.glass
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-17* hash.c (rb_hash_replace): performance improvement by usingglass
st_copy(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-17hash.c: key name in error messagenobu
* hash.c (env_fetch): Add key name to message on ENV.fetch KeyError, as well as Hash#fetch. [ruby-core:56062] [Feature #8649] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-15* hash.c (rb_hash_each_pair): performance improvement by usingglass
rb_block_arity(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-12* hash.c (rb_hash_reject_bang): do not call rb_hash_foreach() if RHashglass
has ntbl and it is empty. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-12* hash.c (recursive_hash): use RHASH_SIZE() to check hash size.glass
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-11* hash.c (rb_hash_size): use RHASH_SIZE().glass
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-11* hash.c (rb_hash_values): set array capa to RHASH_SIZE().glass
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-11* hash.c (rb_hash_keys): set array capa to RHASH_SIZE().glass
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-26intern.h: define rb_enumerator_size_funcnobu
* include/ruby/intern.h (rb_enumerator_size_func): define strict function declaration for rb_enumeratorize_with_size(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-24* compile.c (make_name_for_block): use PRIsVALUE in format stringcharliesome
instead of %s and RSTRING_PTR to protect objects from being garbage collected too soon * encoding.c (str_to_encindex): ditto * hash.c (rb_hash_fetch_m): ditto * io.c (rb_io_reopen): ditto * parse.y (reg_fragment_check_gen): ditto * parse.y (reg_compile_gen): ditto * parse.y (ripper_assert_Qundef): ditto * re.c (rb_reg_raise): ditto * ruby.c (set_option_encoding_once): ditto * vm_eval.c (rb_throw_obj): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-22* include/ruby/ruby.h, gc.c: rename macros and functions:ko1
OBJ_WB_GIVEUP() -> OBJ_WB_UNPROTECT(), rb_obj_wb_giveup() -> rb_obj_wb_unprotect(), rb_gc_giveup_promoted_writebarrier() -> rb_gc_writebarrier_unprotect_promoted(), * class.c, eval.c, hash.c: use OBJ_WB_UNPROTECT(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21* include/ruby/ruby.h (OBJ_WRITE): cast to (VALUE *) for secondko1
parameter `slot'. You don't need to write a cast (VALUE *) any more. * class.c, compile.c, hash.c, iseq.c, proc.c, re.c, variable.c, vm.c, vm_method.c: remove cast expressions for OBJ_WRITE(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21hash.c: refine error messagenobu
* hash.c (ruby_setenv): refine error message so include the variable name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-18* hash.c: `st_update()' also has same issue of last fix.ko1
write barriers at callback function are too early. All write barriers are executed after `st_update()' git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-12* safe.c (rb_set_safe_level, safe_setter): raise an ArgumentErrorshugo
when $SAFE is set to 4. $SAFE=4 is now obsolete. [ruby-core:55222] [Feature #8468] * object.c (rb_obj_untrusted, rb_obj_untrust, rb_obj_trust): Kernel#untrusted?, untrust, and trust are now deprecated. Their behavior is same as tainted?, taint, and untaint, respectively. * include/ruby/ruby.h (OBJ_UNTRUSTED, OBJ_UNTRUST): OBJ_UNTRUSTED() and OBJ_UNTRUST() are aliases of OBJ_TAINTED() and OBJ_TAINT(), respectively. * array.c, class.c, debug.c, dir.c, encoding.c, error.c, eval.c, ext/curses/curses.c, ext/dbm/dbm.c, ext/dl/cfunc.c, ext/dl/cptr.c, ext/dl/dl.c, ext/etc/etc.c, ext/fiddle/fiddle.c, ext/fiddle/pointer.c, ext/gdbm/gdbm.c, ext/readline/readline.c, ext/sdbm/init.c, ext/socket/ancdata.c, ext/socket/basicsocket.c, ext/socket/socket.c, ext/socket/udpsocket.c, ext/stringio/stringio.c, ext/syslog/syslog.c, ext/tk/tcltklib.c, ext/win32ole/win32ole.c, file.c, gc.c, hash.c, io.c, iseq.c, load.c, marshal.c, object.c, proc.c, process.c, random.c, re.c, safe.c, string.c, thread.c, transcode.c, variable.c, vm_insnhelper.c, vm_method.c, vm_trace.c: remove code for $SAFE=4. * test/dl/test_dl2.rb, test/erb/test_erb.rb, test/readline/test_readline.rb, test/readline/test_readline_history.rb, test/ruby/test_alias.rb, test/ruby/test_array.rb, test/ruby/test_dir.rb, test/ruby/test_encoding.rb, test/ruby/test_env.rb, test/ruby/test_eval.rb, test/ruby/test_exception.rb, test/ruby/test_file_exhaustive.rb, test/ruby/test_hash.rb, test/ruby/test_io.rb, test/ruby/test_method.rb, test/ruby/test_module.rb, test/ruby/test_object.rb, test/ruby/test_pack.rb, test/ruby/test_rand.rb, test/ruby/test_regexp.rb, test/ruby/test_settracefunc.rb, test/ruby/test_struct.rb, test/ruby/test_thread.rb, test/ruby/test_time.rb: remove tests for $SAFE=4. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-11* bignum.c (validate_integer_pack_format): Don't require a word orderakr
flag if numwords is 1 or less. (absint_numwords_generic): Don't specify a word order for rb_integer_pack. * hash.c (rb_hash): Ditto. * time.c (v2w_bignum): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-10* bignum.c (rb_integer_pack): Returns sign instead of words.akr
(absint_numwords_generic): Follow the above change. (big2str_base_powerof2): Follow the above change. * internal.h: Ditto. * hash.c (rb_hash): Ditto. * pack.c (pack_pack): Ditto. * random.c (int_pair_to_real_inclusive): Ditto. (rand_init): Ditto. (random_load): Ditto. (limited_big_rand): Ditto. * time.c (v2w_bignum): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-09* bignum.c (rb_integer_pack): numwords_allocated argument removed.akr
* internal.h (rb_integer_pack): Follow the above change. * hash.c (rb_hash): Ditto. * time.c (v2w_bignum): Ditto. * pack.c (pack_pack): Ditto. * random.c (int_pair_to_real_inclusive): Ditto. (rand_init): Ditto. (random_load): Ditto. (limited_big_rand): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-08* hash.c (rb_hash): Use rb_integer_pack to obtain least significantakr
long integer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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