Граф коммитов

944 Коммитов

Автор SHA1 Сообщение Дата
git d4929f5185 * expand tabs. 2019-06-16 23:01:46 +09:00
Yusuke Endoh 1ff26dc4c7 Revert "Make constant assignments more conforming to JIS X 3017:2013 11.4.2.2.3"
This reverts commit 44caca11cf.

The change caused a build failure.
http://ci.rvm.jp/results/trunk-vm-asserts@silicon-docker/2102153
2019-06-16 23:00:05 +09:00
git 11f8c89171 * expand tabs. 2019-06-16 22:48:23 +09:00
Yuki Yugui Sonoda 44caca11cf Make constant assignments more conforming to JIS X 3017:2013 11.4.2.2.3
compile.c (NODE_CDECL): Evaluate the module before the value
test/ruby/test_const.rb (test_evaluation_order): added a test case
2019-06-16 22:43:03 +09:00
Kazuki Tsujimoto be6b462489
Use checktype for performance 2019-06-11 00:20:10 +09:00
Yusuke Endoh a6a26e42b1 compile.c: Partially revert r63870 which caused wrong optimization
[Bug #15906]
2019-06-07 14:46:59 +09:00
Martin Dürst f258137083 Fix grammar of macro name: ECCESSED -> ECCESSIVE
Fix the name of the macro variable introduced in 0872ea5330
from NODE_SPECIAL_EXCESSED_COMMA to NODE_SPECIAL_EXCESSIVE_COMMA.
2019-06-05 14:03:50 +09:00
git b31e1b4a7c * expand tabs. 2019-06-04 23:17:38 +09:00
Yusuke Endoh 0b0c6cb7e4 compile.c: Remove the magical `(const NODE*) -1`
It is used to represent "no default expression" for keyword argument:
`def foo(key:)`.  This change uses NODE_SPECIAL_REQUIRED_KEYWORD.
2019-06-04 23:17:19 +09:00
Yusuke Endoh 0872ea5330 node.h: Avoid a magic number to represent excessed comma
`(ID)1` was assigned to NODE_ARGS#rest_arg for `{|x,| }`.
This change removes the magic number by introducing an explicit macro
variable for it: NODE_SPECIAL_EXCESSED_COMMA.
2019-06-04 23:17:18 +09:00
Nobuyoshi Nakada b1aecef873
Use UNALIGNED_MEMBER_PTR
* internal.h (UNALIGNED_MEMBER_ACCESS, UNALIGNED_MEMBER_PTR):
  moved from eval_intern.h.

* compile.c iseq.c, vm.c: use UNALIGNED_MEMBER_PTR for `entries`
  in `struct iseq_catch_table`.

* vm_eval.c, vm_insnhelper.c: use UNALIGNED_MEMBER_PTR for `body`
  in `rb_method_definition_t`.
2019-05-31 16:04:16 +09:00
git f1b52d3a88 * expand tabs. 2019-05-05 11:13:54 +09:00
Nobuyoshi Nakada ff21e75d32
parse.y: duplicated when clause warning
* parse.y (case_args): moved "duplicated when clause" warning from
  compile phase, so that `ruby -wc` shows them.
2019-05-05 00:29:12 +09:00
Lourens Naudé 99084f5401 Lazy allocate the compile data catch table array
Closes: https://github.com/ruby/ruby/pull/2119
2019-04-25 12:37:29 +09:00
ktsj eeee4f404b Remove unnecessary condition
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-21 02:18:28 +00:00
ktsj 243842f68a Avoid usage of the dummy empty BEGIN node
Use NODE_SPECIAL_NO_NAME_REST instead.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-20 03:37:22 +00:00
ktsj 9738f96fcf Introduce pattern matching [EXPERIMENTAL]
[ruby-core:87945] [Feature #14912]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-17 06:48:03 +00:00
nobu 025343654d Get rid of a magic number
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67512 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-11 10:36:37 +00:00
nobu 47c82df27f Share the exception local ID table
[Fix GH-2115]

From: Lourens Naudé <lourens@bearmetal.eu>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-11 10:36:36 +00:00
nobu 54b93ef1ac compile.c: name a hidden local variable as a predefined ID
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-10 12:43:34 +00:00
kazu 25c1fd3b90 Reverting all commits from r67479 to r67496 because of CI failures
Because hard to specify commits related to r67479 only.
So please commit again.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-10 09:15:21 +00:00
nobu 91db3b6c6b compile.c: name a hidden local variable as a predefined ID
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-10 07:18:25 +00:00
nobu 9e448d2fd7 compile.c: cast iseqs to suppress warnings
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-10 01:18:01 +00:00
tenderlove d099eabbb7 Set a write barrier between iseq and mark objects
ISeq pins references in the mark array during compile, so it manually
marks references in the mark_ary.  This was causing write barrier
misses, so we need to add a write barrier when pushing on the mark
array.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67489 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-09 23:48:17 +00:00
svn 4b53f84326 * expand tabs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-05 08:15:21 +00:00
ko1 2b5bb8a087 add definemethod/definesmethod insn.
* insns.def: add definemethod and definesmethod (singleton method)
  instructions. Old YARV contains these instructions, but it is moved
  to methods of FrozenCore class because remove number of instructions
  can improve performance for some techniques (static stack caching
  and so on). However, we don't employ these technique and it is hard
  to optimize/analysis definition sequence. So I decide to introduce
  them (and remove definition methods). `putiseq` insn is also removed.

* vm_method.c (rb_scope_visibility_get): renamed to
  `vm_scope_visibility_get()` and make it accept `ec`.
  Same for `vm_scope_module_func_check()`.
  These fixes are result of refactoring `vm_define_method`.

* vm_insnhelper.c (rb_vm_get_cref): renamed to `vm_get_cref`
  because of consistency with other functions.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-05 08:15:11 +00:00
svn d4f7fac6b8 * expand tabs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67267 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-15 05:19:58 +00:00
mame c36a6f97f2 node.h: introduce nd_brace to determine if a hash literal is a keyword
NODE_HASH#nd_brace is a flag that is 1 for `foo({ k: 1 })` and 0 for
`foo(k: 1)`.
nd_alen had been abused for the flag (and the implementation is
completely the same), but an explicit name is better to read.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-15 05:19:54 +00:00
mame 3db2041f87 compile.c: fix the corner case of rest and keyword arguments
See https://bugs.ruby-lang.org/issues/10856#note-20 . [Bug #10856]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67256 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-14 09:04:57 +00:00
mame 146bb252a0 compile.c (setup_args): process arguments forward
For unknown reason, setup_args processed the arguments from the last to
the first.  This is not only difficult to read, but also inefficient in
some cases.  For example, the arguments of `foo(*a1, *a2, *a3)` was
compiled like `a1.dup << (a2.dup << a3)`.  The second dup (`a2.dup`) is
not needed.

This change refactors the function so that it processes the arguments
forward: `foo(*a1, *a2, *a3)` is compiled as `a1.dup << a2 << a3`, and
in my opinion, the source code is now much more readable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-14 08:43:51 +00:00
svn 277af37b42 * expand tabs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-14 06:43:54 +00:00
mame 4c41dc8945 compile.c: factor out "compile_args" from "compile_array"
compile_array function had three usages: array literal, hash literal,
and method arguments. I think the third is completely different than the
first and second.  For example, method arguments and popped are
meaningless; keywords_ptr and flag parameter for array/hash literal is
also unused.

This change refactors them: a function "compile_args" is created for the
third, and removes no longer used parameters of "compile_array".

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-14 06:43:50 +00:00
svn 6703277024 * expand tabs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67114 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-21 20:59:12 +00:00
ko1 4e15be8bad refactoring compile.c.
* compile.c: refacetoring:
  * initialize `branches` with Qfalse intead of 0.
  * make compile_call* functions from `iseq_compile_each0()`
    to make modifying them easy.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-21 20:59:08 +00:00
nobu df2b8c05ba Show proper location for warning [Feature #15575]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-04 08:13:37 +00:00
ko1 0fc597f29c check and show a warning for incorrect yield.
* compile.c (check_yield_place): this function check the yield location.
  * show a warning if yield in `class` syntax. [Feature #15575]

  * do strict check for toplevel `yield`. Without this patch,
    `1.times{ yield }` in toplevel is valid-syntax (raise LocalJumpError
    at runtime) although toplevel simple `yield` is not valid syntax.
    This patch make them syntax error.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-04 07:10:05 +00:00
svn 8555c53e74 * expand tabs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66978 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-01 05:11:14 +00:00
nobu 1bc6c3f407 Revert r63383, r63248 "compile.c: copy a short insn with leave"
When copying `leave` insn, TRACE also should be copied if it is
present, but this optimization is trivial and not worth the
complexity.  [ruby-core:91366] [Bug #15578]

4cae5353c0
5afd479de6

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-01 05:11:08 +00:00
nobu 78d6e33702 Fix styles [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-09 13:58:49 +00:00
nobu b6b4c7cbb4 compile.c: initialize to suppress false warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-05 14:31:12 +00:00
nobu 4783493236 parse.y: hoisted out qcall_branch_start and qcall_branch_end
* compile.c (qcall_branch_start, qcall_branch_end): hoisted out
  branch coverage traces generation for qcall.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-05 12:13:39 +00:00
svn f77d381159 * expand tabs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-01 03:03:20 +00:00
mame 9613af6f34 compile.c (iseq_set_sequence): fix branch coverage table
Not only TRACE_ELEMENT but also INSN_ELEMENT may have events.
The old pc2branchindex was created using only events of TRACE_ELEMENTs.
This change uses events of INSN_ELEMENTs too for pc2branchindex table.

[Bug #15476]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-01 03:03:17 +00:00
svn 99d3631847 * expand tabs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66675 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-01 01:51:01 +00:00
mame d58bada6cc compile.c: support branch coverage for `a&.foo = 1`
[Bug #15475]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-01 01:50:57 +00:00
svn 7e035dcda7 * expand tabs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-01 01:47:17 +00:00
mame 4130969ea1 Revert r66670 because of wrong ticket number
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-01 01:47:14 +00:00
svn 04dec2df73 * expand tabs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-01 01:41:26 +00:00
mame 67a257cac0 compile.c: support branch coverage for `a&.foo = 1`
[Bug #15476]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-01 01:41:23 +00:00
nobu 67c5747369 Method reference operator
Introduce the new operator for method reference, `.:`.
[Feature #12125] [Feature #13581]
[EXPERIMENTAL]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-31 15:00:37 +00:00