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

48459 Коммитов

Автор SHA1 Сообщение Дата
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
nobu 25d56ea7b7 tmpdir.rb: merged make_tmpname to create
* lib/tmpdir.rb (Dir::Tmpname#create): try conversion of prefix
  and suffix just once before loop.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-15 08:02:09 +00:00
normal 0cc57ea018 dir.c: revert r60772, r60770, and r60769
Using readdir(3) without any locking causes thread-safety
problems if directory streams get shared between threads.  On
ancient platforms, readdir(3) may have thread-safety problems
even on different directory streams.

Using readdir_r(3) is not viable, either, as it's deprecated
due to name overflow problems.

So for now, rely on GVL as in previous Rubies and perhaps
consider per-"struct dir_data" mutexes for modern platforms
which allow concurrent calls to readdir(3) on different
directory streams.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-15 07:24:26 +00:00
nobu e5b968f571 thread.c: use ec
* thread.c (call_without_gvl): use execution context for
  RUBY_VM_CHECK_INTS_BLOCKING.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-15 05:50:10 +00:00
usa e9614f9a37 Cannot call rb_thread_call_without_gvl before running VM
* dir.c (readdir_without_gvl): check the VM is already initialized before
  calling rb_thread_call_without_gvl().
  [Bug #14108]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-15 05:18:37 +00:00
ko1 1d7247e694 fix uninitialized memory reference.
* compile.c (iseq_set_sequence): clear kwargs (in ci_entries) memory area.
  kwargs ci entries are initialized by compiler. However, sometimes these
  initializations are skipped because corresponding calls are eliminated
  by some optimizations (for example, `if true` syntax elimnates else code).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-15 04:52:39 +00:00
usa 5570dba96f nogvl readdir make SEGV on Windows
* dir.c (readdir_without_gvl): workaround for Windows.  [Bug #14108]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-15 03:44:58 +00:00
normal ea3211720d dir.c: release GVL around remaining readdir calls
Release GVL around all remaining readdir calls from the Dir
class to prevent pathological stalls on slow filesystems in
multi-threaded applications.

opendir, rewinddir, closedir calls are not affected yet, but
will be changed in future commits.

In the future, further work may be done consolidate multiple GVL
releasing calls to reduce overhead, similar to how changes to
Dir.empty? were made in r60111

* dir.c (nogvl_readdir): new function
  (readdir_without_gvl): ditto
  (dir_read): s/READDIR/readdir_without_gvl/
  (dir_each_entry): ditto
  (glob_helper): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-14 23:20:31 +00:00
nobu c00265bbcc compile.c: fixup TRACE
* compile.c (remove_unreachable_chunk): ignore TRACE elements.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-14 17:07:47 +00:00
svn 0965709f1e * 2017-11-15
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-14 15:37:49 +00:00
nobu 50702d16ab parse.y: zero codepoints
* parse.y (parser_tokadd_utf8): relax restriction to allow zero or
  more codepoints.  fixup r59417.

  https://github.com/ruby/ruby/commit/7e8b910#commitcomment-25602670

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-14 15:37:48 +00:00
ko1 19ae98d5ce rewrite only if changed.
* vm_trace.c (update_global_event_hook): rewrite ISeqs only when
  effective events are changed.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-14 13:25:11 +00:00
ko1 b000b1d930 fix prefix.
* compile.c: the following functions accept LINK_ELEMENT so
  rename to `ELEM_` prefix names:
  * INSERT_ELEM_NEXT -> ELEM_INSERT_NEXT
  * INSERT_ELEM_PREV -> ELEM_INSERT_PREV
  * REPLACE_ELEM     -> ELEM_REPLACE
  * REMOVE_ELEM      -> ELEM_REMOVE


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-14 13:18:44 +00:00
ko1 665ba24b44 remove `trace` instruction. [Feature #14104]
* tool/instruction.rb: create `trace_` prefix instructions.

* compile.c (ADD_TRACE): do not add `trace` instructions but add
  TRACE link elements. TRACE elements will be unified with a next
  instruction as instruction information.

* vm_trace.c (update_global_event_hook): modify all ISeqs when
  hooks are enabled.

* iseq.c (rb_iseq_trace_set): added to toggle `trace_` instructions.

* vm_insnhelper.c (vm_trace): added.
  This function is a body of `trace_` prefix instructions.

* vm_insnhelper.h (JUMP): save PC to a control frame.

* insns.def (trace): removed.

* vm_exec.h (INSN_ENTRY_SIG): add debug output (disabled).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-14 12:58:36 +00:00
nobu fe3decb201 process.c: removed preserving_errno
* process.c (try_with_sh, handle_fork_error): added argument for
  errno.

* process.c (proc_exec_cmd, proc_exec_sh, exec_async_signal_safe):
  now return errno instead of -1.

* process.c (rb_fork_ruby): merged retry_fork_ruby() and unified
  clean-up after fork regardless failure.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-14 04:42:38 +00:00
nobu 73e41247b9 string.c: prefer rb_syserr_fail
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-14 03:02:58 +00:00