* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
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
* 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
* 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
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
* 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
* 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