aboutsummaryrefslogtreecommitdiffstats
path: root/symbol.h
Commit message (Collapse)AuthorAgeFilesLines
* include/ruby/backward/2/r_cast.h: deprecate卜部昌平2020-08-271-1/+1
| | | | | Remove all usages of RCAST() so that the header file can be excluded from ruby/ruby.h's dependency.
* add #include guard hack卜部昌平2020-04-131-3/+2
| | | | | | | | | | | | | | | | | | | | | | According to MSVC manual (*1), cl.exe can skip including a header file when that: - contains #pragma once, or - starts with #ifndef, or - starts with #if ! defined. GCC has a similar trick (*2), but it acts more stricter (e. g. there must be _no tokens_ outside of #ifndef...#endif). Sun C lacked #pragma once for a looong time. Oracle Developer Studio 12.5 finally implemented it, but we cannot assume such recent version. This changeset modifies header files so that each of them include strictly one #ifndef...#endif. I believe this is the most portable way to trigger compiler optimizations. [Bug #16770] *1: https://docs.microsoft.com/en-us/cpp/preprocessor/once *2: https://gcc.gnu.org/onlinedocs/cppinternals/Guard-Macros.html
* decouple internal.h headers卜部昌平2019-12-261-0/+1
| | | | | | | | | | | | | | | | | | Saves comitters' daily life by avoid #include-ing everything from internal.h to make each file do so instead. This would significantly speed up incremental builds. We take the following inclusion order in this changeset: 1. "ruby/config.h", where _GNU_SOURCE is defined (must be the very first thing among everything). 2. RUBY_EXTCONF_H if any. 3. Standard C headers, sorted alphabetically. 4. Other system headers, maybe guarded by #ifdef 5. Everything else, sorted alphabetically. Exceptions are those win32-related headers, which tend not be self- containing (headers have inclusion order dependencies).
* Add RB_ID_SERIAL_MAXNobuyoshi Nakada2019-04-251-0/+4
|
* Add `GC.compact` again.tenderlove2019-04-201-0/+7
| | | | | | 🙏 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Reverting compaction for nowtenderlove2019-04-171-7/+0
| | | | | | For some reason symbols (or classes) are being overridden in trunk git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Adding `GC.compact` and compacting GC support.tenderlove2019-04-171-0/+7
| | | | | | | | | | | This commit adds the new method `GC.compact` and compacting GC support. Please see this issue for caveats: https://bugs.ruby-lang.org/issues/15626 [Feature #15626] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Reverting all commits from r67479 to r67496 because of CI failureskazu2019-04-101-7/+0
| | | | | | | | Because hard to specify commits related to r67479 only. So please commit again. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Adding `GC.compact` and compacting GC support.tenderlove2019-04-091-0/+7
| | | | | | | | | | | This commit adds the new method `GC.compact` and compacting GC support. Please see this issue for caveats: https://bugs.ruby-lang.org/issues/15626 [Feature #15626] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: ignore constant name capturesnobu2018-12-201-0/+2
| | | | | | | | * parse.y (reg_named_capture_assign_iter): ignore non-local name captures, including non-ASCII constant names. [ruby-dev:50719] [Bug #15437] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* symbol.h: remove stale symbol deleted at r47913nobu2018-04-061-2/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Use HAVE_BUILTIN___BUILTIN_CONSTANT_Pngoto2016-05-201-3/+3
| | | | | | | * symbol.h (rb_id2sym): Use HAVE_BUILTIN___BUILTIN_CONSTANT_P git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* symbol.h: unexpected safe callnobu2016-01-091-1/+1
| | | | | | | * symbol.h (is_attrset_id): ASET is an attrset ID. fix unexpected safe call instead of an ordinary ASET. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/objspace/objspace.c: add a new method ObjectSpace.count_symbols.ko12015-08-211-0/+5
| | | | | | | | | | | | [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
* * id_table.h: introduce ID key table.ko12015-08-121-9/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | [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
* symbol.h: memoize hashval for RSymbolnormal2015-07-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | 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.c: symbol type predicate functionsnobu2014-11-171-7/+7
| | | | | | | * 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.h: optimize ID2SYMnobu2014-10-271-0/+9
| | | | | | * symbol.h (rb_id2sym): optimize for predefined IDs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* symbol.c: immortal IDsnobu2014-10-141-8/+26
| | | | | | | * symbol.c (global_symbols): make IDs immortal always, instead of treating dynamic symbols as IDs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* symbol.h: move struct RSymbolnobu2014-10-061-0/+6
| | | | | | * symbol.h (struct RSymbol): move from internal.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47821 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* symbol.c: move macrosnobu2014-08-041-6/+0
| | | | | | | | * 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: move macrosnobu2014-07-311-0/+4
| | | | | | * 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: remove dependency on parse.hnobu2014-07-111-1/+1
| | | | | | | | | | | * 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: split from parse.ynobu2014-07-091-0/+56
* 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