[Feature #11158]
* symbol.c (rb_sym_immortal_count): added to count immortal symbols.
* symbol.h: ditto.
* test/objspace/test_objspace.rb: add a test for this method.
* NEWS: describe about this method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
[Feature #11420]
This table only manage ID->VALUE table to reduce overhead of st.
Some functions prefixed rb_id_table_* are provided.
* id_table.c: implement rb_id_table_*.
There are several algorithms to implement it.
Now, there are roughly 4 types:
* st
* array
* hash (implemented by Yura Sokolov)
* mix of array and hash
The macro ID_TABLE_IMPL can choose implementation.
You can see detailes about them at the head of id_table.c.
At the default, I choose 34 (mix of list and hash).
This is not final decision.
Please report your suitable parameters or
your data structure.
* symbol.c: introduce rb_id_serial_t and rb_id_to_serial()
to represent ID by serial number.
* internal.h: use id_table for method tables.
* class.c, gc.c, marshal.c, vm.c, vm_method.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51541 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This speeds up the hash function for dynamic symbols.
[ruby-core:70129] [Bug #11396], nearly up to Ruby 2.1 levels
Power-of-two hash sizing [Feature #9425] speeds up cases where we
have a good hash, but this means we can no longer hide behind weak
hashes. Unfortunately, object IDs do not hash well, but we may
use the extra space in the RSymbol struct to memoize the hash value.
Further optimizations should be possible. For now, the st.c APIs
force us to calculate rb_str_hash redundantly at dsym registration.
* symbol.h (struct RSymbol): add hashval field
* symbol.c (dsymbol_alloc): setup hashval field once
* hash.c (rb_any_hash): return RSymbol->hashval directly
* common.mk: hash.o depends on symbol.h
Thanks to Bruno Escherl <bruno@escherl.net> for the bug report
[ruby-core:70129] [Bug #11396]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* symbol.h (is_{local,global,instance,attrset,const,class,junk}_sym):
fix ID type names.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* symbol.c (SYMBOL_PINNED, SYMBOL_PINNED_P, ID_DYNAMIC_SYM_P),
(STATIC_SYM2ID, STATIC_ID2SYM): move from symbol.h as these
macros are used only in symbol.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* symbol.h (RSYMBOL): move macros for Symbol from internal.h.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* symbol.c (op_tbl): remove non-regular symbols.
* symbol.c (global_symbols): start from the next of the preserved
ID.
* symbol.c: (rb_id2str): op_tbl does not exceed tLAST_OP_ID.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* symbol.c, symbol.h: Symbol class implementation and internals,
split from parse.y.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e