* parse.y (rb_id_attrget): new function to convert setter ID to
getter ID.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (rb_gc_free_dsymbol): use intermediate st_data_t and get
rid of type-punning cast.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (rb_str_dynamic_intern): associate proper encoding with
the result symbol.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (rb_str_dynamic_intern): fix the second argument to
rb_str_symname_type, which is a bit mask but not a boolean.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45434 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (rb_str_dynamic_intern): prevent a string which may be
duplicated, from GC.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (rb_str_dynamic_intern): dup the given string only if
needed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (rb_str_dynamic_intern): no needs to associate encoding
if it is US-ASCII.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
See this ticket about Symbol GC.
* include/ruby/ruby.h:
Declare few functions.
* rb_sym2id: almost same as old SYM2ID but support dynamic symbols.
* rb_id2sym: almost same as old ID2SYM but support dynamic symbols.
* rb_sym2str: almost same as `rb_id2str(SYM2ID(sym))` but not
pin down a dynamic symbol.
Declare a new struct.
* struct RSymbol: represents a dynamic symbol as object in
Ruby's heaps.
Add few macros.
* STATIC_SYM_P: check a static symbol.
* DYNAMIC_SYM_P: check a dynamic symbol.
* RSYMBOL: cast to RSymbol
* gc.c: declare RSymbol. support T_SYMBOL.
* internal.h: Declare few functions.
* rb_gc_free_dsymbol: free up a dynamic symbol. GC call this
function at a sweep phase.
* rb_str_dynamic_intern: convert a string to a dynamic symbol.
* rb_check_id_without_pindown: not pinning function.
* rb_sym2id_without_pindown: ditto.
* rb_check_id_cstr_without_pindown: ditto.
* string.c (Init_String): String#intern and String#to_sym use
rb_str_dynamic_intern.
* template/id.h.tmpl: use LSB of ID as a flag for determining a
static symbol, so we shift left other ruby_id_types.
* string.c: use rb_sym2str instead `rb_id2str(SYM2ID(sym))` to
avoid pinning.
* load.c: use xx_without_pindown function at creating temporary ID
to avoid pinning.
* object.c: ditto.
* sprintf.c: ditto.
* struct.c: ditto.
* thread.c: ditto.
* variable.c: ditto.
* vm_method.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (parser_yylex): only a newline after label should be
significant. [ruby-core:61658] [Bug #9669]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (lex_state_e, parser_params, f_arglist, parser_yylex):
separate EXPR_LABELARG from EXPR_BEG and let newline significant,
so that required keyword argument can place at the end of
argument list without parentheses. [ruby-core:61658] [Bug #9669]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (ripper_initialize): filename can not be modified.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (rb_check_id): refine error message, expected a symbol
or a string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* marshal.c (to_be_skipped_id): ignore anonymous attributes.
* pack.c (Init_pack): use anonymous ID so that associated objects
do not appear in the packed result.
* parse.y (rb_make_internal_id): return an anonymous ID for
internal use.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (rb_enc_symname_type): encoding of symbol names must be
ascii-compatible, reject ascii-incompatible encodings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (local_push_gen, local_pop_gen): save cmdarg_stack to
isolate command argument state from outer scope.
[ruby-core:59342] [Bug #9308]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (iseq_set_arguments): set arg_keyword_check from
nd_cflag, which is set by parser. internal ID is used for
unnamed keyword rest argument, which should be separated from no
keyword check.
* iseq.c (rb_iseq_parameters): if no keyword check, keyword rest is
present.
* parse.y (new_args_tail_gen): set keywords check to nd_cflag, which
equals to that keyword rest is not present.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (register_symid_str): use fstrings in symbol table
[Bug #9171] [ruby-core:58656]
* parse.y (rb_id2str): ditto
* string.c (rb_fstring): create frozen_strings on first usage. this
allows rb_fstring() calls from the parser (before cString is created)
* string.c (fstring_set_class_i): set klass on fstrings generated
before cString was defined
* string.c (Init_String): convert frozen_strings table to String
objects after boot
* ext/-test-/symbol/type.c (bug_sym_id2str): expose rb_id2str()
* test/-ext-/symbol/test_type.rb (module Test_Symbol): verify symbol
table entries are fstrings
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
when full_mark is 0.
rb_gc_mark_symbols() (with full_mark == 1) can be called by other
than GC (such as rb_objspace_reachable_objects_from_root()).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Each symbols has String objects respectively to represent
Symbols.
These objects are marked only when:
* full marking
* new symbols are added
This hack reduce symbols (related strings) marking time.
For example, on my Linux environment, the following code
"20_000_000.times{''}"
with 40k symbols (similar symbol number on Rails 3.2.14 app,
@jugyo tells me) boosts, from 7.3sec to 4.2sec.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (rb_id_attrset): fix inconsistency with literals, allow
ID_ATTRSET and return it itself, but ID_JUNK cannot make ID_ATTRSET.
and raise a NameError instead of rb_bug() for invalid argument.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (intern_str): sigil only names are junk, at least one
identifier character is needed. [ruby-dev:47723] [Bug #8928]
* parse.y (rb_enc_symname_type): fix out of bound access.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (lambda): adjust position to the beginning of the block.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (parser_str_options): use valid suffix word only, as well as
numeric literal, for the backward comatibility.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (f_label): extract from f_kw and f_block_kw.
* parse.y (f_opt, f_block_opt): use f_norm_arg to simlify actions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (parser_whole_match_p): treat CR in middle of a line as a
mere whitespace.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (rb_id_attrset): check if the argument is valid type as an
attribute.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e