* parse.y: Update the locations of NODE_FCALL
when nd_args is determined.
e.g. The locations of NODE_FCALL is fixed:
```
a 1
```
* Before
```
NODE_FCALL (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 1)
```
* After
```
NODE_FCALL (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 3)
```
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
mkfifo(3) is subject to the same problems as open(2) on slow
filesystems. Release the GVL and let the rest of the VM run
while we call mkfifo.
* file.c (nogvl_mkfifo): new function
(rb_file_s_mkfifo): release GVL
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* win32/win32.c (vm_exit_handler): separate exit handler for
resources which must be released at exit of Ruby VM.
* win32/win32.c (socklist_insert, constat_handle): install the VM
exit handler.
* gc.c (ENABLE_VM_OBJSPACE): no longer needs process global object
space on Windows too.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (block_append_gen): Update the last
location of NODE_BLOCK when a tail is appended.
e.g. The locations of NODE_BLOCK is fixed:
```
a; b; c
```
* Before
```
NODE_BLOCK (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 4)
```
* After
```
NODE_BLOCK (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@60855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add Thread.report_on_exception=true to catch problems early.
* Increase the number of Thread.pass to let the autoload start.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* When the file does not exist or the constant is not set.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
mode_t is the correct type for mkfifo(3). This fixes an
oversight from r60592 which made the same change to several
other functions.
* file.c (rb_file_s_mkfifo): use mode_t instead of int
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* file.c (nogvl_truncate): cast int to VALUE before "void *"
(rb_file_s_truncate): cast "void *" to VALUE before int
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
The `readlink' can stall on slow filesystems like `open' and
`read' syscalls. Release the GVL and let the rest of the VM
function while `readlink' runs.
* file.c (nogvl_readlink): new function
(readlink_without_gvl): ditto
(rb_readlink): use readlink_without_gvl
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Like IO#write and IO.open, these file operations have
unpredictable performance on slow file systems. Allow other
threads of the VM to proceed while they are taking place.
* file.c (nogvl_truncate): extract from rb_file_s_truncate
(rb_file_s_truncate): release GVL
(nogvl_ftruncate): extract from rb_file_truncate
(rb_file_truncate): release GVL
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
SHF_COMPRESSED was not defined until glibc 2.22, and there are
older distros (e.g. Debian 8.x jessie) which do not have this
defined.
Perhaps it is safe to define SHF_COMPRESSED to (1 << 11) ourselves,
too, since ELF should be a standardized format.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
To identify the line of backtrace with ease, show the offset address of library.
You can just find the source filename and the line with
`addr2line -e libruby.so.2.5.0 0xXXXX`
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: Update the locations of NODE_ITER
when nd_iter is determined.
e.g. The locations of NODE_ITER is fixed:
```
a {b}
```
* Before
```
NODE_ITER (line: 1, first_lineno: 1, first_column: 2, last_lineno: 1, last_column: 5)
```
* After
```
NODE_ITER (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 5)
```
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h (rb_iseq_t::aux): add `trace_events` which represents
which events are enabled on this iseq. With this information,
we can skip useless trace-on changes for ISeqs.
* vm_trace.c (RUBY_EVENTS_TRACE_BY_ISEQ): moved to iseq.h and rename it
with ISEQ_TRACE_EVENTS.
* iseq.h: introduce ISEQ_USE_COMPILE_DATA iseq (imemo) flag to represent
COMPILE_DATA is available. In other words, iseq->aux.trace_events is not
available when this flag is set.
* ISEQ_COMPILE_DATA() is changed from a macro.
* ISEQ_COMPILE_DATA_ALLOC() is added.
* ISEQ_COMPILE_DATA_CLEAR() is added.
* iseq.c: use them.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* dir.c (opendir_without_gvl, with_gvl_gc_for_fd, opendir_at): check the VM is
already initialized before calling rb_thread_call_with{out,}_gvl().
[Bug #14115]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rb_iseq_constant_body::line_info_size and line_info_table have
been renamed to insns_info_size, insns_info.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
openat(2) also performs a path lookup, so it is also subject
to pathological slowdowns like opendir(3) and open(2) syscalls.
* dir.c (struct opendir_at_arg): new struct for callback
(with_gvl_gc_for_fd): new callback for rb_thread_call_with_gvl
(gc_for_fd_with_gvl): moved up
(nogvl_opendir_at): extracted from do_opendir
(opendir_at): new wrapper to release GVL for opendir_at
(do_opendir): use new wrappers to release GVL
(nogvl_dir_empty_p): adjust for gc_for_fd_with_gvl
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
opendir(3) is subject to the same pathological slowdowns on
slow or unreliable filesystems as open(2), so release the GVL
to avoid stalling the entire VM like we do with IO#open
* dir.c (nogvl_opendir): new function
(opendir_without_gvl): new function
(dir_initialize): s/opendir/&_without_gvl/
(do_opendir): ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (list_append_gen, list_concat): Update
the last location of NODE_ARRAY when an item is
appended or concatenated with another NODE_ARRAY.
e.g. The locations of NODE_ARRAY is fixed:
```
a(1,2,3)
```
* Before
```
NODE_ARRAY (line: 1, first_lineno: 1, first_column: 2, last_lineno: 1, last_column: 3)
```
* After
```
NODE_ARRAY (line: 1, first_lineno: 1, first_column: 2, last_lineno: 1, last_column: 7)
```
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 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
* 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
* 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
* 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
* 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
* 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
* 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