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

48474 Коммитов

Автор SHA1 Сообщение Дата
nobu 3465fdd44e parse.y: RUBY_SET_YYLLOC
* parse.y (RUBY_SET_YYLLOC): extract setting locations from the
  source line.

* parse.y (yylex): use RUBY_SET_YYLLOC.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-17 12:16:30 +00:00
knu 8d7d8d0c7f Add examples to Set documentation [ci skip]
GitHub PR:    https://github.com/ruby/ruby/pull/1752 [Fix GH-1752]
Submitted by: @Ana06 <anamma06@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-17 09:48:47 +00:00
yui-knk f26cce0bba NODE_CALL is not passed to node_assign_gen
* parse.y (node_assign_gen): NODE_CALL is not passed to
  node_assign_gen. NODE_CALL is not assignable. Assignable
  method call (array set and attr set) is represented by NODE_ATTRASGN.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-17 08:23:06 +00:00
ko1 8a664f0c96 don't use `goto`.
* vm_trace.c (rb_exec_event_hooks): we don't need to use goto statement.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-17 07:47:03 +00:00
yui-knk 114fc2201c Fix location of assignable nodes
* parse.y (node_assign_gen): NODE_ATTRASGN is created
  before rhs is created. It is needed to set location
  after rhs is created to rhs range be included to the
  location of NODE_ATTRASGN.

  e.g. The locations of NODE_ATTRASGN is fixed:

  ```
  a[1] = 2
  ```

  * Before

  ```
  NODE_ATTRASGN (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 4)
  ```

  * After

  ```
  NODE_ATTRASGN (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 8)
  ```

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60821 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-17 07:39:15 +00:00
ko1 d2bb08ecf0 remove a wrong assertion.
* iseq.c (rb_iseq_trace_set): remove a wrong assertion.
  This assertion checked `insn` is `trace_` prefix instruction
  but threaded code `insn` is original code.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-17 07:29:07 +00:00
ko1 c7ae8af92f reuse gvar value.
* vm_core.h (EXEC_EVENT_HOOK_VM_TRACE): added to pass vm_event_flags
  (== ruby_vm_event_flags) as a macro parameter.

* vm_insnhelper.c (vm_trace): use an added macro.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-17 06:59:22 +00:00
svn 1fcdec57da * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-17 06:24:56 +00:00
ko1 1a96057626 remove `trace_` prefix insns lazily.
* vm_trace.c (update_global_event_hook): set only when tracing is added.
  If tracing was off (event flags are decreased), then ignore them.
  Next `trace_` prefix instruction will trace off itself (lazy tracing off).

* vm_insnhelper.c (vm_trace): trace-off for when trace is not needed.

* iseq.c (rb_iseq_trace_set): fix trace-off process (it was never off tracing).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-17 06:24:55 +00:00
yui-knk 80facdd93a Fix location of assignable nodes
* parse.y (node_assign_gen): In some case assignable nodes
  are created before rhs is created. In this case it is
  needed to set location after rhs is shifted to
  rhs range be included to assignable nodes.

  e.g. The locations of NODE_DASGN_CURR is fixed:

  ```
  a = 10
  ```

  * Before

  ```
  NODE_DASGN_CURR (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 1)
  ```

  * After

  ```
  NODE_DASGN_CURR (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 6)
  ```

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-17 04:25:48 +00:00
svn a529ba94e2 * 2017-11-17
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60815 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 23:13:25 +00:00
yui-knk 82fe13d117 Fix location of NODEs generated by new_op_assign_gen
* parse.y (new_op_assign_gen): Use a location of lhs
  when call gettable, bacause gettable creates a variable
  node. Use a location of rhs when call new_list,
  because item of new_list is rhs.

  The locations of NODE_DVAR(nd_vid: :a) and NODE_ARRAY
  are fixed:

  ```
  a -= 1
  ```

  * Before

  ```
  NODE_DVAR (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 6)
  NODE_ARRAY (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 6)
  ```

  * After

  ```
  NODE_DVAR (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 1)
  NODE_ARRAY (line: 1, first_lineno: 1, first_column: 5, last_lineno: 1, last_column: 6)
  ```

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60814 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 23:13:24 +00:00
usa 42fe7ceb50 Old gem file had not been removed
* common.mk (update-gems): `old.delete("gems/#{gem}")` always returns nil
  because when really downloading new gem, the filename is not in `old`.
  the real intention of this condition might be checking `old` is empty or not.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 12:26:04 +00:00
mame ec3a906bb6 Refactoring out the direct accesses of NODE's u1, u2, and u3
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 11:03:37 +00:00
k0kubun 22c8cc44a2 thread_win32.c: stop returning unused value
to unify signature with pthread's one

I'm planning to use functions for rb_nativethread_cond_t and
rb_nativethread_mutex_t in the future JIT introduction.

In that case, I want them to have the same signature. To prevent the case
that its return value is used in somewhere and it becomes harder to unify
signature, I want to drop unused return value.

[close GH-1751]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 10:02:03 +00:00
ko1 ea4b535579 remove an unused function.
* eval.c (rb_iterator_p): removed because nobody use it
  and not exposed by headers.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 09:24:48 +00:00
ko1 a52603a8ea make a func static.
* vm_backtrace.c (rb_ec_backtrace_location_ary): make it static and
  remove `rb_` prefix.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 09:00:15 +00:00
ko1 b453fc2cb9 make a func static.
* vm_method.c (rb_resolve_refined_method_callable): make it static.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 08:53:49 +00:00
ko1 f4cb93adca make funcs static.
* thread.c (rb_threadptr_trap_interrupt): make it static
  and remove `rb_` prefix.

* thread.c (rb_threadptr_pending_interrupt_active_p): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 08:48:59 +00:00
ko1 8798822564 make funcs static.
* node.c: make them static:
  * rb_node_buffer_new
  * rb_node_buffer_free


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 08:19:46 +00:00
ko1 0de6da0ee5 make a func static.
* addr2line.c (main_exe_path): make it static.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 08:01:26 +00:00
ko1 16ec72e56c remove unused func.
* gc.c (rb_garbage_collect): removed.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 07:56:56 +00:00
ko1 2c7e974e4f make a func static.
* vm_eval.c (rb_f_block_given_p): make it static.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 07:49:43 +00:00
ko1 1a7af9d0cd make a func static.
* vm_eval.c (rb_f_public_send): make it static.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60802 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 07:47:33 +00:00
ko1 8184cb2bc7 remove unused function.
* vm_method.c (rb_method_entry_with_refinements): removed.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 07:46:05 +00:00
ko1 d4a69bb48e make a func static.
* vm.c (rb_proc_create_from_captured): make this func static and renmae
  with vm_ prefix.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 07:43:27 +00:00
ko1 aaa43037c2 export rb_tracearg_callee_id().
* include/ruby/debug.h (rb_tracearg_callee_id): export.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 07:41:33 +00:00
ko1 3936aaa59b make a func static.
* vm_eval.c (rb_raise_method_missing): make this func static and renmae with
  vm_ prefix.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 07:38:41 +00:00
ko1 686e54f705 make it static.
* vm.c (rb_thread_mark): now file local.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 07:28:16 +00:00
ko1 003fd99ab3 provide rb_vm_make_proc/lambda().
* vm.c (rb_vm_make_proc): removed.

* vm_core.h: provide utility inline functions
  * rb_vm_make_proc()
  * rb_vm_make_lambda()
  to call rb_vm_make_proc_lambda().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 07:25:30 +00:00
ko1 4d6e899a27 remove unused function.
* vm_insnhelper.c (rb_vm_env_write): remove unused function.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 07:14:45 +00:00
ko1 2fb4c36c44 accepts `ec` as first parameter.
* vm_insnhelper.c (vm_check_match): accepts `ec` as first parameter.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 06:10:31 +00:00
ko1 1ae69a2064 fix r60792.
* error.c (warning_string): `file` is already cstr.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 05:56:21 +00:00
ko1 360b78e4dc `rb_source_loc` -> `rb_source_location_cstr`
* vm.c (rb_source_loc): rename to rb_source_location_cstr()
  to make behavior clear compare with rb_source_location().

* error.c (warning_string): use rb_source_location_cstr() directly.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 05:52:19 +00:00
ko1 15abb96177 fix r60789.
* vm.c (rb_source_loc): fix condition.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 05:45:44 +00:00
nobu 8c15f40acf parse.y: no return in class
* parse.y (k_return): prohibit return in class/module body except
  for singleton class.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 05:36:42 +00:00
ko1 7a666c6766 rb_source_location() may return nil.
* vm.c (rb_source_location): return nil if path is not found.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 05:35:58 +00:00
ko1 b3cab0dc74 remove an unused function.
* vm.c (rb_sourcefilename): removed because nobody use it.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 05:18:29 +00:00
ko1 ea665dcd8c add `ec` as first parameter.
* vm.c (vm_svar_get): accepts `ec` as first parameter.

* vm.c (vm_svar_set): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 05:14:18 +00:00
ko1 c761514c76 fix up r60782 and r60783.
* cont.c (cont_restore_thread): re-check a condition (pointed by nobu).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 04:37:02 +00:00
yui-knk 7fbab01f77 Add a last location to branch coverage
* compile.c (DECL_BRANCH_BASE, ADD_TRACE_BRANCH_COVERAGE): Add
  a last location to arguments.

* compile.c (compile_if, compile_case, compile_case2, compile_loop, iseq_compile_each0):
  Pass a last location to macros.

* ext/coverage/coverage.c (branch_coverage): Add a last location to
  a return value.

* test/coverage/test_coverage.rb: Follow-up these changes.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 03:36:20 +00:00
kazu 210f2cc7e8 Regexp#===: Use `\A` and `\z` instead of `^` and `$`
[ci skip]
ref https://github.com/rurema/doctree/pull/812

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 03:32:23 +00:00
ko1 e8ccf9f758 avoid duplicated-cond compile error.
* cont.c (cont_restore_thread): fix duplicated-cond compile error.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 02:53:17 +00:00
ko1 23e452b17b cleanup hook cleanup code.
* vm_trace.c: before this patch, deleted hooks are remvoed at
  *the beggining* of hooks (exec_hooks_precheck).
  This patch cleanup deleted hooks at
  (1) just after hook is deleted (TracePoint#disable and so on)
  (2) just after executing hooks (exec_hooks_postcheck)
  Most of time (1) is enough, but if some threads running hooks,
  we need to wait cleaning up deleted hooks until threads finish
  running the hooks. This is why (2) is introduced (and this is
  why current impl cleanup deleted hooks at the beggining of hooks).

* test/lib/tracepointchecker.rb: check also the number of delete
  waiting hooks.

* cont.c (cont_restore_thread): fix VM->trace_running count.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 02:47:58 +00:00
yui-knk 575993d743 parse.y: Fix location of asgn node
* parse.y (new_op_assign_gen): Fix location of asgn node.
  Assignable node (e.g. NODE_LASGN) is generated before rhs
  is generated, so we reset the location when nd_value of
  asgn is fixed.

  e.g. :

  ```
  a -= 10
  ```

  * Before

  ```
  NODE_DASGN_CURR (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 1)
  ```

  * After

  ```
  NODE_DASGN_CURR (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 7)
  ```

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 01:56:54 +00:00
yui-knk b465633fcc parse.y: Preserve previous line and restore it when read '\n'
* parse.y (parser_params): Add prevline to store previous line.
* parse.y (yycompile0): Initialize prevline with 0.
* parse.y (parser_nextline): Store previous line on prevline.
* parse.y (parser_nextc): Check parser is on EOF or has nextline.
  Now parser_yylex does not always set lex_p as lex_pend, we should check
  EOF flag and nextline is set.
* parse.y (parser_yylex): Restore previous line, set lex_p and tokp
  on '\n'. Before this commit, tokp is on the head of next line of '\n'
  and lex_p is on the tail of next line when next token is '\n'.
  By this behavior, in some case the last column of NODE_CALL (or NODE_QCALL) is
  set to the last column of next line. NODE_CALL can be generated
  via `primary_value call_op operation2 {} opt_paren_args` and opt_paren_args
  can be none. If none is generated with next token '\n', the last column of
  none is set to the last column of next line.

  e.g. :

  ```
  a.b
  cd.ef
  ```

  The location of NODE_CALL of first line is set to,

  * Before

  ```
  NODE_CALL (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 6)
  ```

  * After

  ```
  NODE_CALL (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 3)
  ```

* parse.y (parser_mark): GC mark prevline.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 01:06:10 +00:00
svn f7c60f8d65 * 2017-11-16
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-15 17:07:55 +00:00
hsbt ea5361b8bc Bump rake-12.3.0 on bundled gems.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-15 17:07:54 +00:00
kazu 06ba86c933 Remove redundant last newline [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-15 13:53:15 +00:00
ko1 a3071ea4e3 remove rb_thread_t::event_hooks.
* vm_core.h (rb_thread_t): remove rb_thread_t::event_hooks.

* vm_trace.c: all hooks are connected to vm->event_hooks and
  add rb_event_hook_t::filter::th to filter invoke thread.
  It will simplify invoking hooks code.

* thread.c (thread_start_func_2): clear thread specific trace_func.

* test/ruby/test_settracefunc.rb: add a test for Thread#add_trace_func.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-15 13:21:24 +00:00