summaryrefslogtreecommitdiff
path: root/compile.c
AgeCommit message (Collapse)Author
2020-09-30Unfreeze string-literal-only interpolated string-literalNobuyoshi Nakada
[Feature #17104]
2020-09-15Interpolated strings are no longer frozen with frozen-string-literal: trueBenoit Daloze
* Remove freezestring instruction since this was the only usage for it. * [Feature #17104] Notes: Merged: https://github.com/ruby/ruby/pull/3488
2020-09-03Introduce Ractor mechanism for parallel executionKoichi Sasada
This commit introduces Ractor mechanism to run Ruby program in parallel. See doc/ractor.md for more details about Ractor. See ticket [Feature #17100] to see the implementation details and discussions. [Feature #17100] This commit does not complete the implementation. You can find many bugs on using Ractor. Also the specification will be changed so that this feature is experimental. You will see a warning when you make the first Ractor with `Ractor.new`. I hope this feature can help programmers from thread-safety issues. Notes: Merged: https://github.com/ruby/ruby/pull/3365
2020-08-17procnames-start-lines [ci skip]Nobuyoshi Nakada
2020-08-17Revisit "Refactor to reduce "swap" instruction of pattern matching"Nobuyoshi Nakada
Just moved "case base" after allocating cache space.
2020-08-17Revert "Refactor to reduce "swap" instruction of pattern matching"Kazuhiro NISHIYAMA
This reverts commit 3a4be429b50062122d1616256de38649464d3146. To fix following warning: ``` compiling ../compile.c ../compile.c:6336:20: warning: variable 'line' is uninitialized when used here [-Wuninitialized] ADD_INSN(head, line, putnil); /* allocate stack for cached #deconstruct value */ ^~~~ ../compile.c:220:57: note: expanded from macro 'ADD_INSN' ADD_ELEM((seq), (LINK_ELEMENT *) new_insn_body(iseq, (line), BIN(insn), 0)) ^~~~ ../compile.c:6327:13: note: initialize the variable 'line' to silence this warning int line; ^ = 0 1 warning generated. ```
2020-08-16Refactor to reduce "swap" instruction of pattern matchingwanabe
2020-08-16Adjust sp for `case ... in a: 0 ... end`wanabe
Notes: Merged: https://github.com/ruby/ruby/pull/3403
2020-08-16Adjust sp for `case ... in *, a, * end`wanabe
Notes: Merged: https://github.com/ruby/ruby/pull/3403
2020-08-16Adjust sp for `case ... in *v end`/`case ... in v1, v2 end`wanabe
Notes: Merged: https://github.com/ruby/ruby/pull/3403
2020-08-16Adjust sp for `case ... in v1 ... in v2 end`wanabe
Notes: Merged: https://github.com/ruby/ruby/pull/3403
2020-08-16Adjust sp for `case ... in v1, v2 ... end`wanabe
Notes: Merged: https://github.com/ruby/ruby/pull/3403
2020-08-16Adjust sp for `case ... in pat => var ... end`wanabe
Notes: Merged: https://github.com/ruby/ruby/pull/3403
2020-08-16Adjust sp for `case ... in pat1 | pat2 ... end`wanabe
Notes: Merged: https://github.com/ruby/ruby/pull/3403
2020-08-16Adjust sp for pattern matching implicit/explicit "else"wanabe
Notes: Merged: https://github.com/ruby/ruby/pull/3403
2020-08-16Warn sp overwriting on compile timewanabe
Notes: Merged: https://github.com/ruby/ruby/pull/3401
2020-08-16Show hidden object and TS_BUILTIN for halfbaked insn datawanabe
Notes: Merged: https://github.com/ruby/ruby/pull/3401
2020-07-03Use ID instead of GENTRY for gvars. (#3278)Koichi Sasada
Use ID instead of GENTRY for gvars. Global variables are compiled into GENTRY (a pointer to struct rb_global_entry). This patch replace this GENTRY to ID and make the code simple. We need to search GENTRY from ID every time (st_lookup), so additional overhead will be introduced. However, the performance of accessing global variables is not important now a day and this simplicity helps Ractor development. Notes: Merged-By: ko1 <ko1@atdot.net>
2020-06-29compile_redo: fix wrong condition卜部昌平
Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-06-29ibf_dump_object_object: do not goto into a branch卜部昌平
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-06-29compile_call: do not goto into a branch卜部昌平
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-06-29compile_redo: do not goto into a branch卜部昌平
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-06-29compile_next: do not goto into a branch卜部昌平
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-06-29compile_break: do not goto into a branch卜部昌平
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-06-29compile_branch_condition: do not goto into a branch卜部昌平
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-06-29optimize_checktype: do not goto into a branch卜部昌平
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-06-29iseq_set_exception_table: do not goto into a branch卜部昌平
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-06-27Removed non-ASCII code to suppress warnings by localized compilersNobuyoshi Nakada
2020-06-27Cosmetic changeKazuki Tsujimoto
2020-06-27Add #deconstruct cache to find patternVladimir Dementyev
Notes: Merged: https://github.com/ruby/ruby/pull/3104
2020-06-27Optimize array pattern matching by caching #deconstruct valueVladimir Dementyev
Notes: Merged: https://github.com/ruby/ruby/pull/3104
2020-06-27Removed no longer used flagsNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/3262
2020-06-27Not to rewrite node while compilingNobuyoshi Nakada
Moved this hack mark to an argument to `compile_hash`. > Bad Hack: temporarily mark hash node with flag so > compile_hash can compile call differently. Notes: Merged: https://github.com/ruby/ruby/pull/3262
2020-06-20Introduce Primitive.attr! to annotate 'inline' (#3242)Takashi Kokubun
[Feature #15589] Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2020-06-20compile.c: Improve branch coverage instrumentation [Bug #16967]Yusuke Endoh
Formerly, branch coverage measurement counters are generated for each compilation traverse of the AST. However, ensure clause node is traversed twice; one is for normal-exit case (the resulted bytecode is embedded in its outer scope), and the other is for exceptional case (the resulted bytecode is used in catch table). Two branch coverage counters are generated for the two cases, but it is not desired. This changeset revamps the internal representation of branch coverage measurement. Branch coverage counters are generated only at the first visit of a branch node. Visiting the same node reuses the already-generated counter, so double counting is avoided. Notes: Merged: https://github.com/ruby/ruby/pull/3240
2020-06-20compile.c: pass NODE* instead of a quadruple of code locationYusuke Endoh
Notes: Merged: https://github.com/ruby/ruby/pull/3240
2020-06-20compile.c (branch_coverage_valid_p): Refactored outYusuke Endoh
Notes: Merged: https://github.com/ruby/ruby/pull/3240
2020-06-20compile.c: Use functions for building branch coverage instructionsYusuke Endoh
instead of maros. Just refactoring. Notes: Merged: https://github.com/ruby/ruby/pull/3240
2020-06-19[Feature #16254] Allow `Primitive.func` styleNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/3165
2020-06-19[Feature #16254] Allow `__builtin.func` styleNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/3165
2020-06-18Dup splat array in certain cases where there is a block argumentJeremy Evans
This makes: ```ruby args = [1, 2, -> {}]; foo(*args, &args.pop) ``` call `foo` with 1, 2, and the lambda, in addition to passing the lambda as a block. This is different from the previous behavior, which passed the lambda as a block but not as a regular argument, which goes against the expected left-to-right evaluation order. This is how Ruby already compiled arguments if using leading arguments, trailing arguments, or keywords in the same call. This works by disabling the optimization that skipped duplicating the array during the splat (splatarray instruction argument switches from false to true). In the above example, the splat call duplicates the array. I've tested and cases where a local variable or symbol are used do not duplicate the array, so I don't expect this to decrease the performance of most Ruby programs. However, programs such as: ```ruby foo(*args, &bar) ``` could see a decrease in performance, if `bar` is a method call and not a local variable. This is not a perfect solution, there are ways to get around this: ```ruby args = Struct.new(:a).new([:x, :y]) def args.to_a; a; end def args.to_proc; a.pop; ->{}; end foo(*args, &args) # calls foo with 1 argument (:x) # not 2 arguments (:x and :y) ``` A perfect solution would require completely disabling the optimization. Fixes [Bug #16504] Fixes [Bug #16500] Notes: Merged: https://github.com/ruby/ruby/pull/3157
2020-06-17Replaced accessors of `Struct` with `invokebuiltin`Nobuyoshi Nakada
2020-06-16Revert "Replaced accessors of `Struct` with `invokebuiltin`"Nobuyoshi Nakada
This reverts commit 19cabe8b09d92d033c244f32ff622b8e513375f1, which didn't support tool/lib/iseq_loader_checker.rb.
2020-06-16Replaced accessors of `Struct` with `invokebuiltin`Nobuyoshi Nakada
2020-06-14Introduce find pattern [Feature #16828]Kazuki Tsujimoto
2020-06-08Fix crashes in the peephole optimizer on OpenBSD/sparc64Jeremy Evans
These crashes are due to alignment issues, casting ADJUST to INSN and then accessing after the end of the ADJUST. These patches come from Stefan Sperling <stsp@apache.org>, who reported the issue. Notes: Merged: https://github.com/ruby/ruby/pull/2961
2020-05-31compile.c: Mark cursor in debug listNobuyoshi Nakada
2020-05-31compile.c: Removed wrong conversionNobuyoshi Nakada
2020-05-30Adjusted an indentNobuyoshi Nakada
2020-05-29add indent for debug disasm outputKoichi Sasada