* compile.c (iseq_compile_each0): fix stack consitency error on
attr-assign with safe navigation operator when the receiver is
nil, should pop it too. [ruby-core:83078] [Bug #13964]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* insns.def (intern): new instruction to turn string into symbol.
opt_call_c_function can not dump.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (iseq_compile_each0): insert to_s method call, so that
refinements activated at the caller should take place.
[Feature #13812]
* insns.def (tostring): fix up converted object to a string,
infect and fallback.
* insns.def (branchiftype): new instruction for conversion.
branches if TOS is an instance of the given type.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 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
* compile.c (iseq_peephole_optimize): optimize away unnecessary
concatenation of single string, following tostring which always
puts a String instance.
https://github.com/ruby/ruby/pull/1626#discussion_r139285653
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
`unless` statement was a syntactic sugar for `if` statement,
which made the result of branch coverage hard to understand.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This is needed for passing to the hook function the measuring target
type (line/branch/method) and the site of coverage event fired.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (iseq_compile_each0): pop trace for coverage only and
clear its corresponding line. [ruby-core:82726] [Bug #13886]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59828 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (int_param): prefer FIXNUM_P and NIL_P to switch by
TYPE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
When no instruction is emitted in `iseq_compile_each0`
(i.e., when the line has no significant code), trace
instruction for `RUBY_EVENT_LINE` has been optimized out.
But trace for `RUBY_EVENT_COVERAGE` has not been removed.
Now, it is also removed.
`TestISeq#test_to_a_lines` has failed a long time under
coverage measurement (`make test-all COVERAGE=true`).
This change makes it pass.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
To prepare new measuring targets: branch and method coverages.
So far, iseq->coverage was an array of counts executed for line coverage.
Now, it is a three-element array for each measuring target,
whose first element is an array for line coverage.
The second element is planned for branch coverage, and the third will be
for method coverage.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (ibf_load_iseq_each): location.pathobj may not be a
mere string now.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (iseq_peephole_optimize): remove unreachable chunk
which appeared by useless jump elimination.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* template/insns.inc.tmpl (ASSERT_VM_INSTRUCTION_SIZE): static
assertion for VM instruction info tables.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (compile_array_keyword_arg): fix the condition of
KW_SPLAT flag. splat is value node only without key node,
simple assoc argument is not. [ruby-core:82291] [Bug #13793]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (iseq_set_sequence): replace adjuststack with pop, or
remove if possible instead of two nops.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (iseq_compile_each0): as compile_flip_flop always ends
with a jump instruction, successive instruction is never reached,
but caused stack consistency error without peephole optimization.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c: raise COMPILE_ERROR instead of compile_bug which is
very rarely (or never, actually) useful to debug instruction
sequence. COMPILE_ERROR is usually SyntaxError, or fatal error
if compile_debug is enabled,
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59388 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (iseq_compile_each0): restore the stack depth after
return to the previous depth, to fix the stack depth at
returning from rescue iseq. [ruby-core:82108] [Bug #13755]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (iseq_compile_each0): turned dregx context in "once"
into "guarded" type from "block" type, to disallow `next`,
`break`, `redo` as well as outside "once".
[ruby-core:81805] [Bug #13690]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e