summaryrefslogtreecommitdiff
path: root/compile.c
AgeCommit message (Collapse)Author
2017-03-06optimize FIXABLE macroshyouhei
Looking at the source code, FIXABLE tends to be just before LOING2FIX to check applicability of that operation. Why not try computing first then check for overflow, which should be optimial. I also tried the same thing for unsigned types but resulted in slower execution. It seems RB_POSFIXABLE() is fast enough on modern CPUs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-05compile.c: variable typenobu
* compile.c (iseq_compile_each): fix variable type, use VALUE for Symbol. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?revision=57772&view=revision git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-04compile.c: operand size checknobu
* compile.c (ibf_load_code): raise an exception on invalid operand size. should not use assert() to validate incoming data. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-04compile.c: memory leaknobu
* compile.c (iseq_set_sequence): fix potential memory leaks on an invalid instruction sequence. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-04compile.c: fix invalid label messagenobu
* compile.c (validate_label): fix invalid label message. registered labels are Symbols, not IDs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-01deduplicate strings sooner at load and compilenormal
We can use rb_fstring_cstr in some places to prevent an intermediate object from being created before deduplication via rb_fstring. * compile.c (iseq_compile_each): use rb_fstring_cstr (rb_insns_name_array): ditto * load.c (rb_load_internal0): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-27kwrest arg namenobu
* compile.c (iseq_set_arguments_keywords): make keyword rest argument name nd_vid consistently, regardless of whether other keyword arguments are present. [Fix GH-1529] * parse.y (new_args_tail_gen): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-20compile.c: Fix a typoyui-knk
* compile.c (compile_branch_condition): NODE_LIT is always true. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-13compile.c: suppress a warningnobu
* compile.c (iseq_build_kw): suppress an alloc-size-larger-than warning by gcc 7. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-02compile.c: restore catch entry spnobu
* compile.c (iseq_build_from_ary_exception): restore stack depth of catch entries. accurate stack depths cannot be calculated from dumped array. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-02compile.c: restore misc paramsnobu
* compile.c (rb_iseq_build_from_ary): restore misc params. accurate stack depths cannot be calculated from dumped array. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-02compile.c: keyword table for required kwargnobu
* compile.c (iseq_build_kw): keyword table is necessary also when required keyword argumetns only. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-20compile.c: optimization of defined? in conditionnobu
* compile.c (compile_branch_condition): trivial optimization of defined? expression in a branch condition, where a string is not needed, but just a boolean. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-19compile.c: check err_infonobu
* compile.c (iseq_setup): bail out if any errors found. [ruby-core:76531] [Bug #12613] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-12immediate message mode of compile errornobu
* compile.c (append_compile_error): set Qtrue for erred state with showing the message immediately. * iseq.c (prepare_iseq_build): make immediate message mode if main or top level context, not to show the failed path twice in the first line. * iseq.c (cleanup_iseq_build): raise default message exception if immediate message mode. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57313 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-12compile.c: invalid yield in mainnobu
* compile.c (iseq_compile_each): yield cannot be in the main context as well as a top context. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-10compile.c: check compilenobu
* compile.c (iseq_compile_each): check if sub nodes succeeded. [ruby-core:76531] [Bug #12613] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-03compile.c: fallback nilnobu
* compile.c (iseq_compile_each): push fallback nil only when defined guard is added. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-03compile.c: omit unnecessary defined guardnobu
* compile.c (defined_expr): omit unnecessary defined guard when method call has no receiver and no arguments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-24compile.c: constifynobu
* compile.c (method_for_self): constify an argument of build function for VC6. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-21compile.c: toplevel returnnobu
* compile.c (iseq_compile_each): stop execution of the current source by toplevel return. [ruby-core:36785] [Feature #4840] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57132 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-17compile.c: do not emit numeric literal range in void contextrhe
A fix-up for r56316. Fix stack consistency error on '1..3; nil'. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-09remove core#hash_merge_arynobu
* compile.c (compile_array_): remove m_core_hash_merge_ary which seems unreachable, and wrong number of arguments. * vm.c (m_core_hash_merge_ary): removed because it is never used. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-08compile.c: static_literal_valuenobu
* compile.c (static_literal_value): separate getter from predicate function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-08compile.c: optimize literal nodesnobu
* compile.c (static_literal_node_p): optimize literal nodes for true, false, and nil, which are static literals in specific nodes but not in NODE_LIT. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-07compile.c: remove dead codenobu
* compile.c (DECL_ANCHOR, INIT_ANCHOR): make anchor name an array and unassignable. * compile.c (iseq_compile_each): ret is never 0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-06Fix typoskazu
Patch by: Koichi ITO <koic.ito@gmail.com> [Fix GH-1498] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-28compile.c: splatarray peephole optnobu
* compile.c (iseq_peephole_optimize): remove splatarray following always-array insn. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05* compile.c (tailcallable_p): disable tail call optimization forshugo
toplevel, eval, and load to avoid SEGV when interrupted by SIGINT. [ruby-core:76327] [Bug #12576] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-29compile.c: not flip-flopnobu
* compile.c (iseq_compile_each): turn flip-flop in a not-operator into a boolean value. fix up r56315 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-22compile.c: order with splattingnobu
* compile.c (setup_args): duplicate splatting array if more arguments present to obey left-to-right execution order. [ruby-core:77701] [Bug# 12860] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-01compile.c: literal rangenobu
* compile.c (iseq_compile_each): move numeric literal range optimization from fixup_nodes() in parse.y. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-01compile.c: optimize flip-flopnobu
* compile.c (compile_flip_flop): simplify generated code. * compile.c (compile_branch_condition): flip-flop can appear only in coditional expressions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-23compile.c: tailcall in conditinal blocknobu
* compile.c (iseq_peephole_optimize): enable tail call optimization inside a conditional block. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-28* vm_core.h: revisit the structure of frame, block and env.ko1
[Bug #12628] This patch introduce many changes. * Introduce concept of "Block Handler (BH)" to represent passed blocks. * move rb_control_frame_t::flag to ep[0] (as a special local variable). This flags represents not only frame type, but also env flags such as escaped. * rename `rb_block_t` to `struct rb_block`. * Make Proc, Binding and RubyVM::Env objects wb-protected. Check [Bug #12628] for more details. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-26Coverage on non-positive linesnobu
* compile.c (ADD_TRACE): ignore trace instruction on non-positive line. * parse.y (coverage): get rid of ArgumentError when the starting line number is not positive. [ruby-core:76141] [Bug #12517] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-14* iseq.h (struct iseq_compile_data): use struct rb_id_tablenaruse
instead of st_table. * iseq.c (prepare_iseq_build): don't allocate ivar_cache_table until it has at least one element. * iseq.c (compile_data_free): free ivar_cache_table only if it is allocated. * compile.c (get_ivar_ic_value): allocate if the table is not allocated yet. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-11 * compile.c (iseq_compile_each): share InlineCache during sametarui
instance variable accesses. Reducing memory consumption, rasing cache hit rate and rasing branch prediction hit rate are expected. A part of [Bug #12274]. * iseq.h (struct iseq_compile_data): introduce instance variable IC table for sharing. * iseq.c (prepare_iseq_build, compile_data_free): construct/destruct above table. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-26compile.c: true conditionsnobu
* compile.c (compile_branch_condition): add more always-true conditions to optimize away unreachable branch. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-23compile.c: remove redundant trace insnnobu
* compile.c (iseq_peephole_optimize): remove successive line trace instructions except for the last. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-23compile.c: instruction ID predicatenobu
* compile.c (IS_INSN_ID): add instruction ID predicate macro. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-23compile.c: ISeq element type predicatesnobu
* compile.c (IS_INSN, IS_LABEL, IS_ADJUST): add ISeq element type predicate macros. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-20compile.c: make SyntaxError after formattingnobu
* compile.c (append_compile_error): make SyntaxError instance by rb_syntax_error_append on demand after formatting the message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-20refactor syntax errornobu
* compile.c (append_compile_error): use rb_syntax_error_append. * error.c (rb_syntax_error_append): append messages into a SyntaxError exception instance. * parse.y (yycompile0): make new SyntaxError instance in main mode, otherwize error_buffer should be a SyntaxError if error has occurred. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-19appending compile error without rb_errinfonobu
* compile.c (append_compile_error, compile_bug): pass iseq and get error info and file from it, not by the thread error info. * error.c (rb_report_bug_valist): take va_list instead of variadic arguments, and just report the bug but not abort. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-18compile.c: fix dangling linknobu
* compile.c (iseq_peephole_optimize): should not replace the current target INSN, not to follow the replaced dangling link in the caller. [ruby-core:74993] [Bug #11816] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-12compile.c: initialize LABEL fieldsnobu
* compile.c (new_label_body): initialize bit fields, since compile_data_alloc does not clear the memory. [Bug #12082] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-11compile.c: disable tco with rescuenobu
* compile.c (iseq_optimize): disable tail call optimization in rescued, rescue, and ensure blocks. [ruby-core:73871] [Bug #12082] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-28remove rb_thread_t::parse_in_evalnobu
* parse.y (struct parser_params): move parse_in_eval flag from rb_thread_t. * parse.y (rb_parser_set_context): set parsing context, not only mild error flag. * iseq.c (rb_iseq_compile_with_option): the parser now refers no thread local states to be restored. * vm_eval.c (eval_string_with_cref): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-26compile.c: explicit addressnobu
* compile.c (prepare_compile_error): add & to explicit address of functions to suppress warnings by old VC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e