aboutsummaryrefslogtreecommitdiffstats
path: root/hash.c
Commit message (Collapse)AuthorAgeFilesLines
...
* hash.c: reject should return a plain hashnobu2013-12-111-15/+20
| | | | | | | | | * hash.c (rb_hash_reject): return a plain hash, without copying the class, default value, instance variables, and taintedness. they had been copied just by accident. [ruby-core:59045] [Bug #9223] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* array.c, hash.c: add saltnobu2013-12-101-5/+9
| | | | | | | | * array.c (rb_ary_hash): add salt to differentiate false and empty array. [ruby-core:58993] [Bug #9231] * hash.c (rb_any_hash, rb_hash_hash): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: fix segv in Hash#replacetmm12013-12-091-1/+1
| | | | | | | | * hash.c (rb_hash_replace): fix segv on `{}.replace({})` introduced in r44060 [Bug #9230] [ruby-core:58991] * test/ruby/test_hash.rb: regression test for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: reject shoult infectnobu2013-12-081-0/+1
| | | | | | | * hash.c (rb_hash_reject): result should be infected by the receiver. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: fix WB miss issue in Hash#replacetmm12013-12-081-16/+3
| | | | | | | * hash.c (rb_hash_replace): add a write barrier to fix GC mark miss on hashes using Hash#replace [Bug #9226] [ruby-core:58948] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: revert r43870 and add alternative parser patch for literal keystmm12013-12-081-3/+1
| | | | | | | | | * hash.c (hash_aset_str): revert r43870 due to performance issue [Bug #9188] [ruby-core:58730] * parse.y (assoc): convert literal string hash keys to fstrings * test/ruby/test_hash.rb (class TestHash): expand test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: rb_hash_reject without dupnobu2013-12-071-1/+17
| | | | | | | | * hash.c (rb_hash_reject): copy unrejected elements only to new hash, so that the change on the original receiver can affect. [ruby-core:58914] [Bug #9223] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: bail out to the outermost framenobu2013-12-051-71/+3
| | | | | | | * hash.c (rb_hash): revert r43981 and bail out to the outermost frame when recursion is detected. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: same hash value for similar constructsnobu2013-12-031-2/+67
| | | | | | | | | * hash.c (rb_hash_recursive): make similar (recursive) constructs return same hash value. execute recursively, and rewind to the topmost frame with an object which .eql? to the recursive object, if recursion is detected. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: detect recursion for allnobu2013-12-031-17/+11
| | | | | | | * hash.c (rb_hash): detect recursion for all `hash' methods. each `hash' methods no longer need to use rb_exec_recursive(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_hash_rehash): use hash_alloc() instead of rb_hash_new().glass2013-12-031-1/+1
| | | | | | [Bug #9187] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (w32_getenv): should be static.nobu2013-12-031-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (getenv): fixed test failures introduced by r43950.usa2013-12-021-1/+2
| | | | | | | [ruby-core:58774] [Bug #9195] reported by phasis68 (Heesob Park). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (rb_hash_rehash): make temporary st_table under the controlglass2013-12-021-27/+12
| | | | | | | | of GC. [Bug #9187] * test/ruby/test_hash.rb: add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (getenv): use ANSI codepage version of getenv() for minirubyusa2013-12-011-1/+11
| | | | | | | | on Windows. [ruby-core:58732] [Bug #9189] reported by phasis68 (Heesob Park). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (rb_hash_to_a): specify array capa.glass2013-12-011-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (rb_hash_rehash): fix to free new st_table when exceptionglass2013-12-011-7/+32
| | | | | | is raised in do_hash(). [Bug #9187] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43942 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * st.c: add st_values() and st_values_check().glass2013-11-281-4/+18
| | | | | | | | | * include/ruby/st.h: add prototypes for above. * hash.c (rb_hash_values): use st_values_check() for performance improvement if VALUE and st_data_t are compatible. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43895 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * st.c (st_keys): fix not to use Qundef in st.c.glass2013-11-281-1/+1
| | | | | | | | * include/ruby/st.h: define modified prototype. * hash.c (rb_hash_keys): use modified st_keys(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * st.c (st_keys): fix to use st_index_t for size of hash.glass2013-11-271-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * st.c (st_keys): define st_keys(). it writes each key to buffer.glass2013-11-271-4/+18
| | | | | | | | | | | | | * hash.c (rb_hash_keys): use st_keys() for performance improvement if st_data_t and VALUE are compatible. * st.h: define macro ST_DATA_COMPATIBLE_P() to predicate whether st_data_t and passed type are compatible. * configure.in: check existence of builtin function to use in ST_DATA_COMPATIBLE_P(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (gc_page_sweep): Fix compile warning from last commit.tmm12013-11-271-1/+1
| | | | | | | * hash.c (hash_aset_str): Re-use existing variable to avoid unnecessary pointer dereferencing. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (hash_aset_str): Use rb_fstring() to de-duplicate hash stringtmm12013-11-271-1/+3
| | | | | | | keys. Patch by Eric Wong. [Bug #8998] [ruby-core:57727] * test/ruby/test_hash.rb (class TestHash): test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* should not ignore the rest of recursive constructsnobu2013-11-261-1/+1
| | | | | | | | | | | | | * array.c (rb_ary_hash): should not ignore the rest of recursive constructs. * hash.c (rb_hash_hash): ditto. * range.c (range_hash): ditto. * struct.c (rb_struct_hash): ditto. * test/-ext-/test_recursion.rb (TestRecursion): separate from test/ruby/test_thread.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: cut off if recursionnobu2013-11-261-1/+8
| | | | | | | * hash.c (rb_hash): cut off if recursion detected to get rid of stack overflow. [ruby-core:58567] [Bug #9151] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: static internal functionsnobu2013-11-171-7/+7
| | | | | | | | * 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
* * cont.c : Introdule ensure rollback mechanism. Please see below.tarui2013-11-151-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* revert r43675 and r43683 without tests for applying rollback patch.tarui2013-11-151-15/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: iteration level with reenteringnobu2013-11-151-3/+11
| | | | | | | | | * 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
* hash.c: restore iter_levnobu2013-11-141-4/+8
| | | | | | | * 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
* hash.c, st.c: fix for ST_CHECKnobu2013-11-141-2/+5
| | | | | | | | * 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
* * hash.c: [DOC] Adds an example for Hash#storezzak2013-11-131-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: move common string/hash flags to include file.tmm12013-11-111-3/+0
| | | | | | | | * 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
* st.c: revert st_keysnobu2013-10-101-3/+12
| | | | | | * 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
* * st.c (st_keys): define st_keys() for performance improvement ofglass2013-10-101-12/+3
| | | | | | | | | | 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
* array.c: use rb_hash_valuesnobu2013-10-081-1/+1
| | | | | | | | * 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
* * array.c (rb_ary_uniq): use rb_hash_keys().glass2013-10-081-1/+1
| | | | | | | | * 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
* * hash.c (env_update): [DOC] fix expected output, should be 0 insteadcharliesome2013-10-031-1/+1
| | | | | | of 10. Patch by @yakko. [GH-411] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (env_each_pair): do not call rb_assoc_new() ifglass2013-09-231-2/+9
| | | | | | it isn't needed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: utility functions from ruby_setenvnobu2013-09-131-12/+28
| | | | | | | * 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
* * error.c, file.c, gc.c, hash.c, thread.c, variable.c, vm_eval.c, bin/erb:ktsj2013-08-181-4/+0
| | | | | | $SAFE=4 is obsolete. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (rb_hash_aset): [DOC] Document key dup patch by @kachickzzak2013-08-141-5/+12
| | | | | | | [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
* * hash.c (rb_hash_compare_by_id): add function prototype.glass2013-07-291-0/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (rb_hash_compare_by_id): don't call rb_hash_rehash()glass2013-07-291-0/+1
| | | | | | if self.compare_by_identity? == true. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (rb_hash_assoc): performance improvement by replacingglass2013-07-291-2/+50
| | | | | | | | | 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
* * hash.c (rb_hash_assoc): revert r42224. table->type->compare isglass2013-07-291-44/+14
| | | | | | | | 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
* ChangeLog: commit missnobu2013-07-291-6/+13
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (rb_hash_assoc): performance improvement by replacingglass2013-07-291-14/+45
| | | | | | 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
* * hash.c (rb_hash_flatten): use NUM2INT to raise TypeError on 32bitnaruse2013-07-201-1/+1
| | | | | | platform. it's introduced by r42039 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42093 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (rb_hash_flatten): performance improvement by not usingglass2013-07-181-7/+21
| | | | | | 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