* iseq.h: use RUBY_API_VERSION_MAJOR for ISEQ_MAJOR_VERSION and
RUBY_API_VERSION_MINOR for ISEQ_MINOR_VERSION.
We need to keep compatibility for ISeq during same major/minor versions.
If we need to change compatibility between teeny versions, we should use
(RUBY_API_VERSION_MINOR * 10 + iseq revs) for ISEQ_MINOR_VERSION.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (iseq_peephole_optimize): skip next `freezestring`
instruction after `concatstrings` instruction when frozen string
literal is enabled.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* regexec.c (match_at): invalidate end position not yet matched
when new start position is pushed, to dispose previously stored
position. [ruby-core:83743] [Bug #14101]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/lib/envutil.rb (invoke_ruby): preserve RUBYLIB which is
set by runruby.rb and necessary to load standard libraries.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (node_newnode): Initialize last column of nodes
with -1 and lineno with 0 to make it easy to detect nodes
which we forget to set a column number or lineno.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.c (rb_node_init): Initialize last location with 0.
* node.h (struct rb_code_range_struct): Define a structure
which contains first location and last location of a node.
* node.h (struct RNode): Use rb_code_range_t to store last
location of a node.
* node.h (nd_column, nd_set_column, nd_lineno, nd_set_lineno):
Follow-up the change of struct RNode.
* node.h (nd_last_column, nd_set_last_column, nd_last_lineno, nd_set_last_lineno):
Define getter/setter macros for last location of RNode.
* parse.y : Set last location of tokens.
Thanks to Yusuke Endoh (mame) for design of data structures.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Use ALLOCV to allocate struct crypt_data for slightly cleaner and less
error-prone code. It is currently possible it leaks when an invalid
argument is passed to String#crypt or rb_str_new_cstr() fails to
allocate memory.
SIZEOF_CRYPT_DATA macro in missing/crypt.h is removed since it is not
used any longer.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This was generated with in-place build on MinGW and not ignored.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c (rb_get_expanded_load_path): save cwd cache in OS path
encoding, to get rid of unnecessary conversion and infinite
loading when it needs encoding conversion.
[ruby-dev:50221] [Bug #13863]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Unlike Ruby source file encoding (script encoding) whose default is
changed to UTF-8 in Ruby 2.0 (Feature #6679), template's file encoding
given to erb(1) has been ASCII-8BIT since ERB supports m17n at r21170.
Like Ruby source file encoding, erb template file encoding should be
UTF-8 in Ruby 2.
[Bug #14095] [ruby-core:83708]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This fixes the mistake of r60722.
I used `rb_gc_writebarrier_remember` to notify to GC that the references
is changed. But the function just adds the object to the remember set
blindly. Ko1 told me that `RB_OBJ_WRITE` is suitable in this case.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Container-based Trusty environment (sudo: false) does not support IPv6.
https://github.com/travis-ci/travis-ci/issues/3302
And the image has "::1 localhost ip6-localhost ip6-loopback" entry in
addition to "127.0.0.1 localhost" in /etc/hosts.
Thus when it can resolve localhost to ::1 and CI fails.
To resolve this, at least we need to modify /etc/hosts for now but we
can't modify /etc/hosts without sudo.
So I enabled sudo. As Sudo-enabled VM didn't have "::1 localhost" entry,
this change fixed the cause without touching /etc/hosts.
Since boot of `sudo: required` is slower than `sudo: false`, please revert
this commit anytime when Container-based Trusty environment is updated and
::1 issue has gone.
https://docs.travis-ci.com/user/reference/overview/
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* iseq.c (rb_iseq_disasm): do not dump repeatedly same iseq which
has been dumped by catch tables.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* iseq.c (find_line_no): renamed to rb_iseq_line_no().
* vm_backtrace.c (calc_lineno): add a comment why we need to use "pos-1".
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* iseq.c (rb_insn_operand_intern): show local variable operand
name in unified instructions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* iseq.h (iseq_line_info_entry): rename to iseq_insn_info_entry.
* vm_core.h (rb_iseq_constant_body): rename field name line_info_table
to insns_info and also from line_info_size to insns_info_size.
* compile.c (INSN): add struct insn_info to contain per insn information.
* compile.c (add_insn_info): added to add new insn_info entry.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_backtrace.c (rb_backtrace_use_iseq_first_lineno_for_last_location):
added. It modifies last location's line as corresponding iseq's first line
number.
* vm_args.c (raise_argument_error): use added function.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (iseq_peephole_optimize): do not need to put `pop`
instruction.
* test/ruby/test_optimization.rb (test_peephole_optimization_without_trace):
This code "def foo; 1.times{|(a), &b| nil && a}; end" fails to compile
by stack underflow because of above bug (fixed by this patch).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
The field has a flag to represent if it is a keyword argument (that has
no braces, e.g., `foo(k:1)`) or hash literal (that has braces, e.g.,
`foo({k:1})`).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
`rb_ast_dispose` calls `rb_gc_writebarrier_remember`. Unless we call
it, the marked objects may not be GC'ed until `rb_ast_t` is GC'ed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This version fixes some setup commands.
01e797f6aa/History.txt (L3)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (rb_strterm_heredoc_t): should not define sourceline as
union, to fix wrong read on big-endian platforms.
as rb_imemo_new stores all members as VALUEs, should read it as
VALUE too.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (parser_params): removed in_single, which is referenced
with in_def always.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.h (NEW_CASE2): Omit first argument of NEW_CASE2,
bacause the first argument of NEW_CASE2 is always 0.
* parse.y: Ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: [DOC] clarify description for Hash#slice and remove
a sentence that might suggest that the receiver is modified;
improve example to also include a case where a hash with
several elements is returned.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e