Граф коммитов

116 Коммитов

Автор SHA1 Сообщение Дата
akr 8795574510 * st.c (st_locale_insensitive_strcasecmp): Renamed from st_strcasecmp.
(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 23:15:41 +00:00
glass 13a1fd6d82 * configure.in: revert r42008. strcasecmp() uses the current locale.
* 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 12:49:01 +00:00
glass a0d9bd4445 * configure.in: check strcasecmp().
* 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-07-16 12:13:19 +00:00
nobu 5a3fab5918 * st.c (st_shift): remove unused variable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-25 05:25:53 +00:00
charliesome 5d7b5481ca * benchmark/bm_hash_shift.rb: add benchmark for Hash#shift
* 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-25 05:03:30 +00:00
zzak ff6eb8fe9a Fixed comment typo, found by @ThePablick
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-19 14:32:29 +00:00
naruse 29f347af11 * regint.h: fix typo: _M_AMD86 -> _M_AMD64.
* siphash.c: ditto.

* st.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-10 21:16:44 +00:00
shirosaki 262cb379d6 st_update passes the key in st_table
* 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-11-17 02:46:13 +00:00
nobu 94d0221df4 * st.c (st_foreach_check, st_foreach): remove ancient check. This
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 01:13:26 +00:00
nobu 44e6f5a1bb * st.c (st_delete): use real_entries in st_delete for packed tables
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-31 01:01:41 +00:00
nobu 197627354e * st.c (st_foreach_check): remove the entry by replacing with never
when ST_DELETE.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-30 22:53:26 +00:00
nobu 28cc4f7543 * st.c (st_update): pass pointer to key to the callback function.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-29 14:50:20 +00:00
nobu 30cea65767 * st.c (st_update): add existing parameter to the callback function.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-29 07:36:12 +00:00
nobu 3007acfbc6 * st.c: pack tables also generic keys. patched by Sokolov Yura at
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 14:52:30 +00:00
nobu a73d958c33 * st.c: add st_foreach_check for fixing iteration over packed table
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 14:52:19 +00:00
nobu efae619458 * st.c: fix packed num_entries on 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@34962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-10 14:52:06 +00:00
nobu 4a6e738a46 * st.c (unpack_entries): chain entries directly. based on a patch
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 03:44:14 +00:00
nobu 4a8c531a26 * st.c (unpack_entries): use union instead of casted pointer.
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 03:44:05 +00:00
nobu 5bd91964b2 * st.c: use PACKED_ENT and FIND_ENTRY. patched by Sokolov
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 03:43:55 +00:00
nobu e5ac15998d * st.c (unpack_entries): reallocate bins if packed array size
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-03-05 03:43:45 +00:00
nobu 4a43f9203b * st.c: refactor packed entries using structs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34461 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-07 10:37:40 +00:00
nobu cf1a22fdf9 * st.c (st_update): table can be unpacked in the callback.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-07 05:52:15 +00:00
nobu 97c3c98762 * st.c (st_foreach): should not yield same pair when checking
after unpacking.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-07 05:29:20 +00:00
nobu e8590143a0 * st.c (add_packed_direct): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-17 02:40:42 +00:00
nobu 270ac46a7c * st.c (do_hash): it's the time to remove cast to unsigned int.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-17 01:54:50 +00:00
naruse 84f204046b * st.c (unpack_entries): Fix r34310: on unpacking, the position of
a hash must be do_hash-ed value.

* st.c (add_packed_direct): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34319 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-16 22:38:05 +00:00
shyouhei d3f8488b1c st optimize st_insert
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-15 15:46:44 +00:00
shyouhei 9ed8c1f15e st refactor add_packed_direct a bit
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34313 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-15 15:46:41 +00:00
shyouhei 638f696b6e st macroses for allocation
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-15 15:46:37 +00:00
shyouhei cada5343a6 st macroses for packed table
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-15 15:46:34 +00:00
shyouhei 978a4ef154 st use function instead of macro
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-15 15:46:30 +00:00
nobu 2f6d8bdc94 * st.c (st_update): new function to lookup the given key and
update the value.  [ruby-dev:44998]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-27 13:04:30 +00:00
nobu 12c497dcf6 * hash.c (identhash): share with type_numhash.
* st.c (st_hashtype_num): rename from type_numhash.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-18 14:28:58 +00:00
nobu e8ab94ede0 * regint.h (PLATFORM_UNALIGNED_WORD_ACCESS): Power PC does not
allow unaligned word access.
* st.c (UNALIGNED_WORD_ACCESS): x86_64 allows unaligned word
  access as well as i386.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-14 16:51:29 +00:00
nobu 4a42b101a9 * st.c (st_foreach): check if unpacked.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-27 14:30:00 +00:00
akr 095c2deca0 * st.c: parenthesize macro arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30436 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-31 01:28:41 +00:00
nobu 537d7ff140 * st.c (MurmurMagic): get rid of literal overflow.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12 15:18:22 +00:00
akr 8fd5bf0758 * st.c (st_foreach): don't access ptr->hash after func call.
It may access freed area.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-15 13:45:52 +00:00
nobu 255578c7b5 * include/ruby/st.h (SIZEOF_ST_INDEX_T): moved from st.c for
Init_RandomSeed().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-04 07:06:13 +00:00
nobu 9d93bc2b0b * st.c (unpack_entries): fixed type.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-31 01:17:27 +00:00
wanabe 3e946fe301 * st.c (unpack_entries): save table->bins and never change the table
during unpacking. Because st_insert() may cause GC and refer the
  table, i.e. st_foreach().  [Bug #2196]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-16 15:12:31 +00:00
nobu f2103ee4a9 * st.c: moved murmur hash from string.c. [ruby-dev:39376]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-26 14:29:13 +00:00
nobu 25f43f4ab1 * st.c (COLLISION): improved collision log feature.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-26 08:53:15 +00:00
nobu fe92b9a75b * st.c (st_table_entry, st_get_key): use st_index_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-22 07:34:35 +00:00
nobu 78ab4258ff * st.c (st_free_table): constified.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-09 04:10:42 +00:00
nobu e6dd856d73 * st.c (st_init_*table_with_size): use st_index_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-08 13:18:13 +00:00
nobu 31b7ae00c0 * include/ruby/st.h (st_hash_func): use st_index_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-08 13:10:04 +00:00
nobu 355e0f4efd * st.c (st_delete_safe): deals with packed entries.
[ruby-core:25080]

* st.c (st_cleanup_safe): ditto.  [ruby-core:25081]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24637 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-24 07:36:02 +00:00
ko1 af0429b54e * st.c, include/ruby/st.h (st_memsize): added. This function returns
the memory usage of st_talbe.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23712 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-16 22:03:12 +00:00
matz 844a6890c6 * st.c (st_insert2): new function with processing new key,
e.g. copy.

* hash.c (rb_hash_aset): use st_insert2() to reduce redundant
  st_lookup calls.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-27 15:56:14 +00:00