summaryrefslogtreecommitdiff
path: root/compile.c
AgeCommit message (Collapse)Author
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
2017-06-25compile.c: toplevel return in argumentnobu
* compile.c (iseq_compile_each0): adjust the stack before return in an evstr/argument (reported by Balazs <balazs@kutilovi.cz>) to fix stack consistency error. [ruby-core:81761] [Bug #13678] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-23parse.y: should not warn op method callnobu
* parse.y (void_expr_gen): should warn operator expression style calls only, but not method style calls. [Fix GH-1660] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-23use NULL instead of 0.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-14compile.c: dump and error before allocationnobu
* compile.c (iseq_set_sequence): separate instruction dump and error, before allocation of sequence. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-14simply call xfree().ko1
* compile.c (BADINSN_ERROR): mixing (void) and (int) will fail solaris compiler. [ruby-core:81668], [Bug #13658] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-13* compile.c (dump_disasm_list_with_cursor): replace withnobu
dump_disasm_list_with_cursor_dest. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-13fix to free unallocated memory.ko1
* compile.c (iseq_set_sequence): initialize with NULL for line_info_table and generated_iseq and check NULL at BADINSN_ERROR. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-13compile.c: refine error messagenobu
* compile.c (insn_set_sc_state): dump the whole instructions and mark the destination when label state mismatch. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-13compile.c: refine error messagesnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-11expand ruby_sourcefilenobu
* compile.c: expand ruby_sourcefile not to evaluate twice in RSTRING_PTR. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-08check break target correctly.ko1
* compile.c (iseq_compile_each0): save target child_iseq in the catch-table for break. This iseq is not for continuation, but for search key at vm_throw_start(). * vm_insnhelper.c (vm_throw_start): check saved iseq first. * iseq.h: add comment for it. * test/ruby/test_iterator.rb (test_ljump): add a test for the issue: def call b; b.call; end call(Proc.new{break}){} #=> (1) should raise LocalJumpError call(Proc.new{break}) #=> (2) shoudd raies LocalJumpError, too. but (1) doesn't raise LocalJumpError. This issue is reported by Matz. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-08use NULL instead of 0.ko1
* compile.c: use NULL instead of 0 for ADD_CATCH_ENTRY() to specify don't pass iseq. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59042 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-01rename absolute_path to realpath internally and introduce pathobj.ko1
* vm_core.h: rename absolute_path to realpath because it is expected name. external APIs (#absolute_path methods) are remained. * vm_core.h: remove rb_iseq_location_struct::path and rb_iseq_location_struct::absolute_path and introduce pathobj. if given path equals to given absolute_path (and most of case it is true), pathobj is simply given path String. If it is not same, pathobj is Array and pathobj[0] is path and pathobj[1] is realpath. This size optimization reduce 8 bytes and sizeof(struct rb_iseq_constant_body) is 200 bytes -> 192 bytes on 64bit CPU. To support this change, the following functions are introduced: * pathobj_path() (defined in vm_core.h) * pathobj_realpath() (ditto) * rb_iseq_path() (decl. in vm_core.h) * rb_iseq_realpath() (ditto) * rb_iseq_pathobj_new() (ditto) * rb_iseq_pathobj_set() (ditto) * vm_core.h (rb_binding_t): use pathobj instead of path. If binding is given at eval methods, realpath (absolute_path) was caller's realpath. However, they should use binding's realpath. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e