summaryrefslogtreecommitdiff
path: root/parse.y
AgeCommit message (Collapse)Author
2014-04-01* parse.y (rb_str_dynamic_intern): set mark bit if dynamic symbolktsj
is before sweeping. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-30* parse.y (rb_str_dynamic_intern): [DOC] move rdoc from rb_str_intern.ktsj
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-28parse.y: rb_id_attrgetnobu
* 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
2014-03-27parse.y: type-punning castnobu
* 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
2014-03-26parse.y: set encodingnobu
* 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
2014-03-26parse.y: fix rb_str_symname_type callnobu
* 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
2014-03-26* parse.y (rb_str_dynamic_intern): fix commit miss.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26parse.y: guard dup stringnobu
* 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
2014-03-26parse.y: dup iff needednobu
* 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
2014-03-26parse.y: no dup US-ASCII stringnobu
* 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
2014-03-26* parse.y: inline must be static (for mswin).usa
fixed build error introduced at r45426. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26* internal.h (USE_SYMBOL_GC): enable Symbol GC by default (USE_SYMBOL_GC == 1).nari
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26cast to int to silence clang compile errornari
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26* parse.y: support Symbol GC. [ruby-trunk Feature #9634]nari
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
2014-03-25parse.y: required kwarg without parenthesesnobu
* 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
2014-03-25parse.y: required kwarg without parenthesesnobu
* 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
2014-03-25parse.y: removing paddingnobu
* parse.y (parser_params): shrink struct size by removing padding on 64-bit platforms. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45404 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-24parse.y: freeze filenamenobu
* 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
2014-03-07* parse.y (ENC_SINGLE): Unused macro removed.nari
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-05parse.y: optional arguments in rhsnobu
* parse.y (f_arg_asgn): define optional arguments as argument variables in the rhs default expressions. [ruby-core:61299] [Bug #9593] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-26parse.y: refine error messagenobu
* 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
2014-02-13parse.y: attrset from junk IDnobu
* parse.y (IDSET_ATTRSET_FOR_INTERN): fix off-by-one bug. * parse.y (rb_enc_symname_type): junk ID succeeded by '=' is also attrset ID. [ruby-core:60668] [Bug #8756] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-05pack.c: hide associated objectsnobu
* 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
2014-02-05parse.y: symbol names must be ascii-compatiblenobu
* 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
2013-12-27parse.y: save cmdarg_stack in local scopenobu
* 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
2013-12-25compile.c: unnamed keyword rest checknobu
* 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
2013-12-08hash.c: revert r43870 and add alternative parser patch for literal keystmm1
* hash.c (hash_aset_str): revert r43870 due to performance issue [Bug #9188] [ruby-core:58730] * parse.y (assoc): convert literal string hash keys to fstrings * test/ruby/test_hash.rb (class TestHash): expand test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-08parse.y: use rb_fstring() for strings stored in the symbol tabletmm1
* 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
2013-11-20* parse.y (rb_gc_mark_symbols): set global_symbols.minor_marked onlyko1
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
2013-11-10parse.y: remove "f" suffix [ruby-core:57966] [Feature #9042]nobu
revert r42847 "test_string.rb: add test string encoding" revert r42846 "parse.y: freeze in advance to reduce objects" revert r42843 "parse.y: deduplicate frozen string literals" revert r42780 "test_string.rb: yet another test" revert r42779 "parse.y: valid suffix word only" revert r42778 "test_string.rb: remove duplicated code" revert r42775 "parse.y: force_encoding" This reverts commit 93ea04ecec7639ca8d0e58948e78461434782ecc. revert r42773 "Add frozen string literals" git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-29* add RUBY_TYPED_FREE_IMMEDIATELY to data types which only useko1
safe functions during garbage collection such as xfree(). On default, T_DATA objects are freed at same points as fianlizers. This approach protects issues such as reported by [ruby-dev:35578]. However, freeing T_DATA objects immediately helps heap usage. Most of T_DATA (in other words, most of dfree functions) are safe. However, we turned off RUBY_TYPED_FREE_IMMEDIATELY by default for safety. * cont.c: ditto. * dir.c: ditto. * encoding.c: ditto. * enumerator.c: ditto. * error.c: ditto. * file.c: ditto. * gc.c: ditto. * io.c: ditto. * iseq.c: ditto. * marshal.c: ditto. * parse.y: ditto. * proc.c: ditto. * process.c: ditto. * random.c: ditto. * thread.c: ditto. * time.c: ditto. * transcode.c: ditto. * variable.c: ditto. * vm.c: ditto. * vm_backtrace.c: ditto. * vm_trace.c: ditto. * ext/bigdecimal/bigdecimal.c: ditto. * ext/objspace/objspace.c: ditto. * ext/stringio/stringio.c: ditto. * ext/strscan/strscan.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-24* parse.y: Remove +(binary) and -(binary) special cases [Feature #9048]marcandre
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-11* internal.h, parse.y: use `full_mark' instead of `full_marking'.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-11* gc.c, parse.y: support generational Symbol relatetd marking.ko1
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
2013-09-29parse.y: allow junk attrsetnobu
* parse.y (rb_id_attrset, intern_str): allow junk attrset ID for Struct. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-29parse.y: fix inconsistency with literalsnobu
* 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
2013-09-20parse.y: junk sigil only namesnobu
* 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
2013-09-19parse.y: adjust position of lambdanobu
* 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
2013-09-19parse.y: duplicate codenobu
* parse.y (f_larglist): remove duplicate code in ripper. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-05string.c: reduce objects in rb_fstringnobu
* string.c (rb_fstring, rb_str_free): use st_data_t instead of VALUE. * string.c (rb_fstring): get rid of duplicating already frozen object. * parse.y (str_suffix_gen): freeze in advance to reduce objects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-05* include/ruby/ruby.h: add RSTRING_FSTR flagcharliesome
* internal.h: add rb_fstring() prototype * parse.y (str_suffix_gen): deduplicate frozen string literals * string.c (rb_fstring): deduplicate frozen string literals * string.c (rb_str_free): delete fstrings from frozen_strings table when they are GC'd * string.c (Init_String): initialize frozen_strings table * test/ruby/test_string.rb: test frozen strings are deduplicated git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-02parse.y: valid suffix word onlynobu
* 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
2013-09-02parse.y: force_encodingnobu
* parse.y (str_suffix_gen): String#b creates new string object, use force_encoding instead. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-02* NEWS: Add note about frozen string literalscharliesome
* compile.c (case_when_optimizable_literal): optimize NODE_LIT strings in when clauses of case statements * ext/ripper/eventids2.c: add tSTRING_SUFFIX * parse.y: add 'f' suffix on string literals for frozen strings * test/ripper/test_scanner_events.rb: add scanner tests * test/ruby/test_string.rb: add frozen string tests [Feature #8579] [ruby-core:55699] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-26fix typo of r42691eregon
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-26parse.y: warn CRnobu
* parse.y (parser_nextc): warn carriage return in middle of line. [ruby-core:56240] [Feature #8699] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-16fix typoskazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-15parse.y: simplifynobu
* 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
2013-08-12parse.y: CR in middlenobu
* 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
2013-08-11parse.y: non-local/const attrsetnobu
* parse.y (rb_enc_symname_type): allow ID_ATTRSET for ID_INSTANCE, ID_GLOBAL, ID_CLASS, ID_JUNK too. [Bug #8756] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e