aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_literal.rb
Commit message (Collapse)AuthorAgeFilesLines
* literal symbol by internnobu2017-09-171-0/+15
| | | | | | | | | | * compile.c (iseq_compile_each0): literal symbol should not be affected by redefinition of String#intern method. * vm_insnhelper.c (rb_vm_str_intern): intern a string into a symbol directly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59946 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* refactor newhash (revision 58463 another try) [fix GH-1600]shyouhei2017-04-271-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * st.c (rb_hash_bulk_insert): new API to bulk insert entries into a hash. Given arguments are first inserted into the table at once, then reindexed. This is faster than inserting things using rb_hash_aset() one by one. This arrangement (rb_ prefixed function placed in st.c) is unavoidable because it both touches table internal and write barrier at once. * internal.h: delcare the new function. * hash.c (rb_hash_s_create): use the new function. * vm.c (core_hash_merge): ditto. * insns.def (newhash): ditto. * test/ruby/test_hash.rb: more coverage on hash creation. * test/ruby/test_literal.rb: ditto. ----------------------------------------------------------- benchmark results: minimum results in each 7 measurements. Execution time (sec) name before after loop_whileloop2 0.136 0.137 vm2_bighash* 1.249 0.623 Speedup ratio: compare with the result of `before' (greater is better) name after loop_whileloop2 0.996 vm2_bighash* 2.004 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Revert r56856nobu2016-11-211-0/+3
| | | | | | * parse.y: tCHAR can be concatenated. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* util.c: do not underflownobu2016-07-151-0/+1
| | | | | | | | * util.c (ruby_strtod): do not underflow only by preceeding zeros, which may be canceled out by the exponent. http://twitter.com/kazuho/status/753829998767714305 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Use Integer instead of Fixnum and Bignum.akr2016-05-171-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | * object.c, numeric.c, enum.c, ext/-test-/bignum/mul.c, lib/rexml/quickpath.rb, lib/rexml/text.rb, lib/rexml/xpath_parser.rb, lib/rubygems/specification.rb, lib/uri/generic.rb, bootstraptest/test_eval.rb, basictest/test.rb, test/-ext-/bignum/test_big2str.rb, test/-ext-/bignum/test_div.rb, test/-ext-/bignum/test_mul.rb, test/-ext-/bignum/test_str2big.rb, test/csv/test_data_converters.rb, test/date/test_date.rb, test/json/test_json_generate.rb, test/minitest/test_minitest_mock.rb, test/openssl/test_cipher.rb, test/rexml/test_jaxen.rb, test/ruby/test_array.rb, test/ruby/test_basicinstructions.rb, test/ruby/test_bignum.rb, test/ruby/test_case.rb, test/ruby/test_class.rb, test/ruby/test_complex.rb, test/ruby/test_enum.rb, test/ruby/test_eval.rb, test/ruby/test_iseq.rb, test/ruby/test_literal.rb, test/ruby/test_math.rb, test/ruby/test_module.rb, test/ruby/test_numeric.rb, test/ruby/test_range.rb, test/ruby/test_rational.rb, test/ruby/test_refinement.rb, test/ruby/test_rubyvm.rb, test/ruby/test_struct.rb, test/ruby/test_variable.rb, test/rubygems/test_gem_specification.rb, test/thread/test_queue.rb: Use Integer instead of Fixnum and Bignum. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add frozen_string_literal: false for all filesnaruse2015-12-161-0/+1
| | | | | | When you change this to true, you may need to add more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: magic comment w/o indicatorsnobu2015-10-211-2/+26
| | | | | | | * parse.y (parser_magic_comment): allow a sole magic comment without indicators, neither other non-space comments. [Feature #8976] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fronzen-string-literal pragmanobu2015-09-271-0/+13
| | | | | | | | | | | | | * compile.c (iseq_compile_each): override compile option by option given by pragma. * iseq.c (rb_iseq_make_compile_option): extract a function to overwrite rb_compile_option_t. * parse.y (parser_set_compile_option_flag): introduce pragma to override compile options. * parse.y (magic_comments): new pragma "fronzen-string-literal". [Feature #8976] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: keep literal encodingnobu2015-09-101-0/+9
| | | | | | | | * parse.y (literal_concat_gen, evstr2dstr_gen): keep literal encoding beginning with an interpolation same as the source file encoding. [ruby-core:70703] [Bug #11519] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm.c: fix mark with rewinding cfpnobu2015-07-161-0/+15
| | | | | | | | | * vm.c (m_core_hash_merge_ptr): copy the arguments to the machine stack before rewinding the control frame pointer and leaving the arguments outside valid region of the value stack. [ruby-core:69969] [Bug #11352] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: fix literal symbol list node typenobu2014-11-181-0/+10
| | | | | | | * parse.y (symbol_list): fix the node type of literal symbol list with no interpolation. [ruby-core:66343] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48484 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/lib/envutil.rb: Moved from test/ruby/.akr2014-11-131-1/+0
| | | | | | | | | | | | | | * test/lib/find_executable.rb: Ditto. * test/lib/memory_status.rb: Ditto. * test/lib/test/unit.rb: require envutil. * test/: Don't require envutil in test files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compile.c (compile_array_): refix r37991 remove assertion:naruse2012-11-291-0/+136
| | | | | | | | | | | it is true only if type == COMPILE_ARRAY_TYPE_HASH. [ruby-dev:46658] [Bug #7466] * vm.c (m_core_hash_from_ary): add assertion instead of above. * vm.c (m_core_hash_merge_ary): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Revert r37991 "compile.c: hash must be paired"naruse2012-11-291-136/+0
| | | | | | DO BUILD BEFORE COMMIT ! git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c: hash must be pairednobu2012-11-291-0/+136
| | | | | | | | * compile.c (compile_array_): hash elements must be paired even for literal elements. [ruby-dev:46658] [Bug #7466] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* revert r37326 "remove string literal concatenation"nobu2012-10-251-3/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* remove string literal concatenationnobu2012-10-251-0/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Disable GC for slow this test.naruse2012-04-181-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compile.c (compile_array, compile_array_):ko12012-04-121-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | Divide big array (or hash) literals into several blocks and concatetene them. There was a problem that a big array (hash) literal causes SystemStackError exception (stack overflow) because VM push all contents of the literal onto VM stack to make an array (or hash). To solve this issue, we make several arrays (hashes) and concatenate them to make a big array (hash) object. ?? * compile.c (iseq_compile_each, setup_args): use modified compile_array. * vm.c (m_core_hash_from_ary, m_core_hash_merge_ary, m_core_hash_merge_ptr): added for above change. * id.c (Init_id), parse.y: add core method ids. * bootstraptest/test_literal.rb: add simple tests. * bootstraptest/test_eval.rb: remove rescue clause to catch SystemStackError exception. * test/ruby/test_literal.rb: add tests to check no stack overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (parser_tokadd_string): insert a backslash only ifnobu2012-02-241-3/+9
| | | | | | | quoted by single quotes. [ruby-dev:45281] [Bug #6069] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_literal.rb (TestRubyLiteral#test_special_const): test for ↵shyouhei2012-02-241-0/+1
| | | | | | https://bugs.php.net/bug.php?id=61095 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (parser_tokadd_string, parser_yylex): insert a backslashnobu2012-02-231-3/+4
| | | | | | if the next character is non-ascii. [ruby-dev:45278] [Bug #6069] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (parser_tokadd_string, parser_yylex): ignore a backslashnobu2011-09-021-2/+20
| | | | | | | | which prefixes an non-ascii character, which has no escape syntax. [ruby-core:39222] [Ruby 1.9 - Bug #5262] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (regexp): dregexp has literal string only at the headnobu2010-10-041-0/+2
| | | | | | and successors are array. [ruby-core:32682] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (parser_read_escape, parser_tokadd_escape): allow a hex ormame2010-05-161-1/+4
| | | | | | | | octal encoded character after \c. This seemed to be prohibited at r13836, but its ChangeLog mentions nothing about this prohibition. So I assume this prohibition is not intended. [ruby-core:27229] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (parser_read_escape): deny extra character escapes.nobu2010-04-271-0/+7
| | | | | | [ruby-core:27228] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* supress warnings.akr2010-01-251-5/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (parser_yylex): suppress an extra error message afternobu2009-11-301-0/+10
| | | | | | | | numeric literal without digits. based on a patch from ujihisa . in [ruby-dev:39811]. [ruby-dev:39798] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compile.c (compile_dstr_fragments): reduced needless literal.nobu2009-07-201-0/+4
| | | | | | | | | * parse.y (xstring, regexp, dsym, literal_concat, evstr2dstr): literal at the top of dstr is no longer needed if it is empty, since concatstrings and toregexp always create new strings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* add tests.akr2008-03-011-0/+54
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* add a test.akr2008-03-011-0/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_literal.rb: new test.aamine2007-02-231-0/+184
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e