summaryrefslogtreecommitdiff
path: root/st.c
AgeCommit message (Collapse)Author
2015-01-23hash.c: move Hash specific functionsnobu
* hash.c (rb_ident_hash): move compare_by_identity specific function from st.c. * hash.c (rb_ident_hash_new): ditto from thread.c. * st.c (st_numhash): remove ruby's Hash specific implementation. * thread.c (recursive_list_access): use rb_ident_hash_new(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49386 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-22fix flonum hashing regression from r45384normal
* st.c (st_numhash): mix float value for flonum * hash.c (rb_any_hash): ditto * benchmark/bm_hash_aref_flo.rb: new benchmark * benchmark/bm_hash_ident_flo.rb: ditto [Bug #10761] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15* internal.h: Include ruby.h and ruby/encoding.h to beakr
includable without prior inclusion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-13internal.h: STATIC_ASSERTnobu
* st.c: include "internal.h" for STATIC_ASSERT. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-04st.c: update st_reverse_foreachnobu
* st.c (st_reverse_foreach): update as st_foreach(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-02st.c (new_size): use next_pow2 functionnormal
Reduces object size slightly on x86-64: text data bss dec hex filename 2782359 22400 71880 2876639 2be4df ruby.orig 2781831 22400 71880 2876111 2be2cf ruby.pow2 And on 32-bit x86: text data bss dec hex filename 2814751 12100 30552 2857403 2b99bb ruby.orig 2814051 12100 30552 2856703 2b96ff ruby.pow2 This is not a performance-critical function, but the smaller icache footprint seems worth it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-21* st.c (do_hash_bin): unused macro.nari
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47675 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-21* st.c (numberof): unused. internal.h has same macro.nari
* node.c (F_CUSTOM2): unused. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-23UNALIGNED_WORD_ACCESS on ppc64nobu
* include/ruby/defines.h, siphash.c, st.c (UNALIGNED_WORD_ACCESS): add PowerPC64 too, which is capable to access unaligned words. patched by Gustavo Frederico Temple Pedrosa in [ruby-core:63937]. [Feature #10081] * regint.h (PLATFORM_UNALIGNED_WORD_ACCESS): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-06st.c: fix uninitialized variablenobu
* st.c (st_update): old_key is uninitialized by jump to the label unpacked. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-06st.c: remove equality checksnobu
* st.c (st_update): remove equality checks, callers should ensure the equality, otherwise the behavior is undefined. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-06st.c: re-calc hash_val before addingnobu
* st.c (st_update): re-calculate hash_val before adding if key was changed, otherwise cannot access the newly added element if it has different hash value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-06st.c: update the key too if changednobu
* st.c (st_update): fix a bug that the key was not updated even if it was changed by the callback function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-05configure.in, missing.h: jemalloc manglingnobu
* configure.in (with-jemalloc): also check for header, for ABIs which JEMALLOC_MANGLE is needed, i.e., Mach-O and PE-COFF platforms. [ruby-core:62939] [Feature #9113] * include/ruby/missing.h: include alternative malloc header to replace memory management functions. * dln.c, io.c, parse.y, st.c: undef malloc family before re-definition to suppress warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-20 * st.c (st_foreach_check): chnage start point of search at checktarui
from top to current. [ruby-dev:48047] [Bug #9646] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45642 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-31st.c (st_init_table_with_size): update commentnormal
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-22st.c: use power-of-two sizes to avoid slow modulo opsnormal
* st.c (hash_pos): use bitwise AND to avoid slow modulo op (new_size): power-of-two sizes for hash_pos change (st_numhash): adjust for common keys due to lack of prime modulo [Feature #9425] * hash.c (rb_any_hash): right shift for symbols * benchmark/bm_hash_aref_miss.rb: added to show improvement * benchmark/bm_hash_aref_sym_long.rb: ditto * benchmark/bm_hash_aref_str.rb: ditto * benchmark/bm_hash_aref_sym.rb: ditto * benchmark/bm_hash_ident_num.rb: added to prevent regression * benchmark/bm_hash_ident_obj.rb: ditto * benchmark/bm_hash_ident_str.rb: ditto * benchmark/bm_hash_ident_sym.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45384 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-14* st.c (st_update): remove unnecessary assignmentnormal
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-04 * st.c (st_foreach): fix type of hash. not st_data_t but st_index_t.tarui
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-18st.c: hash_posnobu
* st.c (hash_pos): extract mapping hash values to hash bins index. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-05st.c: tweaked commentduerst
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-28* st.c: add st_values() and st_values_check().glass
* 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
2013-11-28* st.c (st_keys): fix not to use Qundef in st.c.glass
* 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
2013-11-27* st.c (st_keys): define st_keys(). it writes each key to buffer.glass
* 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
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-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-07-16* st.c (st_locale_insensitive_strcasecmp): Renamed from st_strcasecmp.akr
(st_locale_insensitive_strncasecmp): Renamed from st_strncasecmp. * include/ruby/st.h: Follow above changes. * include/ruby/ruby.h: Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42012 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-16* configure.in: revert r42008. strcasecmp() uses the current locale.glass
* include/ruby/ruby.h: ditto. * st.c (st_strcasecmp): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-16* configure.in: check strcasecmp().glass
* include/ruby/ruby.h: use strcasecmp() as st_strcasecmp() if it exists. * st.c (st_strcasecmp): define the function only if strcasecmp() doesn't exist. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-25* st.c (st_shift): remove unused variable.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40459 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-19Fixed comment typo, found by @ThePablickzzak
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-10* regint.h: fix typo: _M_AMD86 -> _M_AMD64.naruse
* siphash.c: ditto. * st.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-17st_update passes the key in st_tableshirosaki
* st.c (st_update): pass the key in st_table so that we can free memory of the key in st_table when deleting. [ruby-core:49220] [Bug #7330] * test/-ext-/st/test_update.rb (Bug::StTable#test_pass_objects_in_st_table): add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-31* st.c (st_foreach_check, st_foreach): remove ancient check. Thisnobu
check are from initial ordered hash commit when first entry were created with entry->fore = entry->back = entry. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-31* st.c (st_delete): use real_entries in st_delete for packed tablesnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35188 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-29* st.c (st_update): pass pointer to key to the callback function.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-29* st.c (st_update): add existing parameter to the callback function.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-10* st.c: pack tables also generic keys. patched by Sokolov Yura atnobu
https://github.com/ruby/ruby/pull/84 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34964 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
2012-03-10* st.c: fix packed num_entries on delete_safe. patched by Sokolovnobu
Yura at https://github.com/ruby/ruby/pull/84 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-05* st.c (unpack_entries): chain entries directly. based on a patchnobu
by Sokolov Yura <funny.falcon AT gmail.com>. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-05* st.c (unpack_entries): use union instead of casted pointer.nobu
patched by Sokolov Yura <funny.falcon AT gmail.com>. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34902 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-05* st.c: use PACKED_ENT and FIND_ENTRY. patched by Sokolovnobu
Yura <funny.falcon AT gmail.com>. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34901 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-05* st.c (unpack_entries): reallocate bins if packed array sizenobu
is not same as initial bins size. based on a patch by Sokolov Yura <funny.falcon AT gmail.com>. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34900 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-07* st.c: refactor packed entries using structs.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34461 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-07* st.c (st_update): table can be unpacked in the callback.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-07* st.c (st_foreach): should not yield same pair when checkingnobu
after unpacking. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e