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

25 Коммитов

Автор SHA1 Сообщение Дата
normal 8717a9ec86 symbol.c: fix memory leak from global fstr hash
* symbol.c (rb_gc_free_dsymbol): delete from global fstr hash
* test/ruby/test_symbol.rb (test_symbol_fstr_leak): test for bug
  [ruby-core:67268] [Bug #10686]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-01 02:18:40 +00:00
ko1 9c6eaad723 * hash.c (rb_hash_delete): return Qnil if there are no corresponding
entry. [Bug #10623]
* hash.c (rb_hash_delete_entry): try delete and return Qundef if there
  are no corresponding entry.
* internal.h: add rb_hash_delete_entry()'s declaration.
* symbol.c: use rb_hash_delete_entry().
* thread.c: use rb_hash_delete_entry().
* ext/-test-/hash/delete.c: use rb_hash_delete_entry().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-24 02:53:37 +00:00
nobu 4e48b64280 symbol.c: symbol type predicate functions
* 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
2014-11-17 18:20:22 +00:00
akr 7cd76ab0c5 * internal.h: Include ruby.h and ruby/encoding.h to be
includable without prior inclusion.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15 11:49:06 +00:00
nobu d8e1bf2760 id.h.tmpl: ANDOP and OROP
* template/id.h.tmpl (token_op_ids): define && and || for ripper.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-27 06:25:59 +00:00
nobu 5a277b4070 parse.y: optimize IDs in ripper
* parse.y: optimize ripper_intern calls, ::, **, -@, +@, <=>, >=,
  <=, ==, ===, !=, =~, !~, <<, >>, and call.

* parse.y: use initialized IDs, warn and warning.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-27 06:23:09 +00:00
nobu fc9fffca1d symbol.h: optimize ID2SYM
* 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
2014-10-27 06:16:16 +00:00
nobu 0f67a3bb31 symbol.c (register_sym): debug code
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-17 08:00:42 +00:00
nobu 65075dfe3a symbol.c: ids array
* symbol.c (global_symbols): make ids two-dimensional array of
  strings and symbols, for write-barrier.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-14 07:23:14 +00:00
nobu 3e69b074c5 symbol.c: immortal IDs
* 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
2014-10-14 07:23:08 +00:00
nobu 5617e31771 symbol.c: rename rb_str_dynamic_intern
* iseq.c, marshal.c, string.c: use rb_str_intern instead of
  rb_str_dynamic_intern.
* symbol.c (rb_str_intern): rename rb_str_dynamic_intern.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-14 07:23:01 +00:00
nobu 986a893d7a symbol.c: junk-base attrset
* symbol.c (rb_enc_symname_type): allow junk-base attrset ID
  unless the stem is not an attrset name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-06 03:08:48 +00:00
nobu ac3c851bde symbol.c: fix dynamic attrset ID
* symbol.c (rb_str_dynamic_intern): check if the stem ID of
  attrset ID is already registered as a static ID.
  [ruby-dev:48559] [Bug #10259]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-19 11:06:04 +00:00
normal ec177aa590 symbol.c (rb_intern_cstr_without_pindown): check dsymbol on return
This is not a complete fix for bug 10206, but seems to reduce
that crash and also looks correct.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-08 20:51:57 +00:00
nobu b6c425aadd internal.h: WARN_UNUSED_RESULT
* internal.h (WARN_UNUSED_RESULT): warn unused result by gcc 3.4
  or later.

* symbol.c: declare some functions with WARN_UNUSED_RESULT.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-30 13:29:45 +00:00
normal 765e4e2ea6 symbol.c (rb_sym2id): do not return garbage object
The dynamic sym passed to rb_sym2id may be a garbage object
(as accounted for by dsymbol_check).  This fixes an occasional
segfault in "make test-all" for me.

No need to backport, this is from the new symbol GC feature.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-30 10:30:00 +00:00
nobu 3636e08858 string.c: rb_setup_fake_str
* string.c (rb_setup_fake_str): setup fake string from C pointer,
  length, and encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47198 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-16 03:36:47 +00:00
ko1 6f7366c206 * string.c (setup_fake_str): fake strings should not set class by
RBASIC_SET_CLASS() because it insert write barriers to fake
  (non-RVALUE) structure.
  It can cause unexpected behaviour.
  Ruby 2.1 also have a same problem (setup_fake_str() in parse.y).
* symbol.c (setup_fake_str): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-15 10:37:42 +00:00
nobu 0ee5c55e51 symbol.c: move macros
* 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
2014-08-04 01:05:09 +00:00
nobu 42425c89a4 symbol.c: wrap global_symbols tables
* symbol.c (register_symid_direct, unregister_sym): extract to
  wrap global_symbols tables.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-27 01:46:56 +00:00
nobu b2aee6f45b symbol.c: return the results directly
* symbol.c (lookup_str_id, lookup_str_sym, lookup_id_str): return
  the result ID, Symbol, and string directly instead of returning
  via a pointer.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-27 01:46:50 +00:00
normal 098c9a327f symbol.c (dsymbol_check): remove unneeded semi-colon
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-25 20:57:02 +00:00
nobu 47adf5709a symbol.c: remove dependency on parse.h
* 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
2014-07-11 14:10:50 +00:00
ko1 96815f1ebe * symbol.c: remove rb_gc_mark_symbols().
fstrings refered by static symbols and pinned dynamic symbols
  are registerd by rb_gc_register_mark_object().
  frstring refered by dynamic symbols (not pinned symbols)
  are refered from global_symbols.dsymbol_fstr_hash (Hash object).
  Note that fstrings refered from dynamic symbols must live loger
  than symbol objects themselves because rb_gc_free_dsymbol() uses
  fstring to remove from symbol tables.
  This is why we can not mark fstrings from dynamic symbols.
  This technique reduces root objects for GC marking.
* gc.c (gc_mark_roots): ditto.
* internal.h: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-09 16:19:13 +00:00
nobu 94ce481263 symbol.c, symbol.h: split from parse.y
* 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
2014-07-09 08:07:32 +00:00