summaryrefslogtreecommitdiff
path: root/compile.c
AgeCommit message (Collapse)Author
2017-09-23Enable to take branch coverages for safe method invocationsyui-knk
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-18intern instructionnobu
* 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
2017-09-18refinements in string interpolationnobu
* 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
2017-09-17literal symbol by internnobu
* 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
2017-09-17compile.c: optimize unnecessary concatstringsnobu
* 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
2017-09-17suppress warningsnobu
* compile.c: suppress maybe-uninitialized warnings by gcc7. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-14compile.c: iseq_pop_newarraynobu
* compile.c (iseq_pop_newarray): optimize array literal in condition. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-14Introduce NODE_UNLESS for branch coveragemame
`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
2017-09-14Add method coveragemame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-14Add branch coverage for case-when statementmame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-14Add branch coverage for while and until statementsmame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59877 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-14Add branch coverage for if statementmame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-14Add a new instruction `trace2` for hooking with custom datamame
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
2017-09-10compile.c: pop coverage tracenobu
* 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
2017-09-09compile.c: replaced switch by TYPEnobu
* 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
2017-09-07Remove unneeded trace instruction for coveragemame
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
2017-09-03Refactor the internal data format for coverage measurementmame
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
2017-09-01compile.c: fix loading pathobjnobu
* 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
2017-09-01compile.c: ensure after toplevel returnnobu
* compile.c (iseq_compile_each0): toplevel returns should fire ensures. [ruby-core:82492] [Bug #13844] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-28compile.c: compile_ifnobu
* compile.c (compile_if): extract from iseq_compile_each. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59675 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-27compile.c: compile_ensurenobu
* compile.c (compile_ensure): extract from iseq_compile_each. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-27compile.c: compile_resbodynobu
* compile.c (compile_resbody): extract from iseq_compile_each. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-27compile.c: compile_rescuenobu
* compile.c (compile_rescue): extract from iseq_compile_each. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-25compile.c: unreachable chunknobu
* 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
2017-08-25compile.c: useless jump eliminationnobu
* compile.c (iseq_peephole_optimize): eliminate useless if/unless just before jump. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-25compile.c: moved comments [ci skip]nobu
* compile.c (iseq_peephole_optimize): moved comments inside proper blocks. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-24compile.c: show failed instructionsnobu
* compile.c (iseq_set_sequence): show failed instructions at adjuststack mismatch. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-24compile.c: free before adjust errornobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-22insns.inc.tmpl: ensure info sizenobu
* 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
2017-08-15compile.c: compile_retrynobu
* compile.c (compile_retry): extract from iseq_compile_each. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-15compile.c: compile_redonobu
* compile.c (compile_redo): extract from iseq_compile_each. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-15compile.c: compile_nextnobu
* compile.c (compile_next): extract from iseq_compile_each. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-14compile.c: compile_breaknobu
* compile.c (compile_break): extract from iseq_compile_each. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-14compile.c: compile_loopnobu
* compile.c (compile_loop): extract from iseq_compile_each. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-14type is invariant inside this blocknobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59589 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-11separate hash literal and keyword argumentsnobu
* compile.c (compile_array_keyword_arg): separate keyword splat inside hash literal from argument list. * parse.y (rparen): flag hash literal. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-10compile.c: fix KW_SPLAT flag conditionnobu
* 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
2017-08-05splat keyword hashnobu
* compile.c (compile_array_keyword_arg): set keyword splat flag if explicitly splatted. [ruby-core:68124] [Bug #10856] * vm_args.c (setup_parameters_complex): try keyword hash splat if given. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-30compile.c: replace adjuststacknobu
* 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
2017-07-29compile.c: fix flip-flop valuenobu
* 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
2017-07-22compile.c: COMPILE_ERRORnobu
* 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
2017-07-21compile.c: dump iseq at adjust bugnobu
* compile.c (fix_sp_depth): dump instructions at adjust bug too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59387 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-20compile.c: restore stack at returnnobu
* 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
2017-07-10compile.c: simplify defined_expr0nobu
* compile.c (defined_expr0): exapnd defined_expr macro. * compile.c (defined_expr0): reduce duplicate code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-30compile.c: dump iseqnobu
* compile.c (append_compile_error): raise a fatal error when compile_debug is enabled. * compile.c (COMPILE_ERROR): dump the disassembled instruction instruction sequence always. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-29compile.c: disallow next in oncenobu
* 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
2017-06-27fix return in toplevel ensurenobu
* compile.c (iseq_compile_each0): adjust stack after return in toplevel ensure, when the value is used. [ruby-core:81777] [Bug #13682] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-27fix return in toplevel rescue/ensurenobu
* compile.c (iseq_compile_each0): throw TAG_RETURN at return in toplevel rescue/ensure to adjust VM stack properly. [ruby-core:81777] [Bug #13682] * vm_insnhelper.c (vm_throw_start): allow return in toplevel rescue/ensure. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-26compile.c: fix debug printnobu
* compile.c (iseq_compile_each0): debugs/ruby_debug_printf do not support PRIsVALUE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-25compile.c: fix_sp_depthnobu
* compile.c (fix_sp_depth): separate fix-up of sp depth from code generation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e