Commit graph

66515 commits

Author SHA1 Message Date
Yusuke Endoh
ff609eee98 Avoid a duplicated method definition of Object#stub
20210622T063005Z.log.html.gz
```
/home/chkbuild/chkbuild/tmp/build/20210622T063005Z/ruby/test/rubygems/helper.rb:1565: warning: method redefined; discarding old stub
/home/chkbuild/chkbuild/tmp/build/20210622T063005Z/ruby/test/resolv/test_dns.rb:8: warning: previous definition of stub was here
```
2021-06-22 16:36:36 +09:00
aycabta
6a48f62c51 [ruby/readline-ext] Version 0.1.2
8541aaccb5
2021-06-22 11:06:00 +09:00
Nobuyoshi Nakada
4b28fea6ee
Run ifchange with shell explicitly, workaround of noexec mount 2021-06-22 09:46:40 +09:00
git
e2599a358d * 2021-06-22 [ci skip] 2021-06-22 02:40:47 +09:00
Burdette Lamar
c1741df1a1 What's Here for Numeric and Comparable 2021-06-21 10:38:16 -07:00
aycabta
8509532c78 Fix finish_using_lib_reline 2021-06-21 23:13:04 +09:00
aycabta
06d52249de Call super method by teardown of tests of Reline as Readline 2021-06-21 22:29:04 +09:00
aycabta
215fd1bf2c Call Reline-specific method in helper file 2021-06-21 22:26:11 +09:00
aycabta
046fd3ac8c Rescue conversion error of inputrc 2021-06-21 22:12:14 +09:00
aycabta
574c8ee9f1 Call Reline.test_reset in teardown of tests for readline definitely 2021-06-21 22:12:14 +09:00
aycabta
e11800e114 Use test encoding for TestRelineAsReadline and TestRelineAsReadlineHistory 2021-06-21 22:12:14 +09:00
aycabta
1192393b3e Stop using global constant, RELINE_TEST_ENCODING 2021-06-21 22:12:14 +09:00
aycabta
af19f9a6e9 Call Reline.test_reset in teardown definitely 2021-06-21 22:12:14 +09:00
aycabta
9498ea9385 Revert "Use Encoding.default_external for tests of Readline::HISTORY"
This reverts commit 089a26b0a6.
2021-06-21 22:12:14 +09:00
Yusuke Endoh
ed8e265d4b Experimentally expose RubyVM::AST::Node#node_id
Now ISeq#to_a includes the node_id list for each bytecode instruction.
I want a way to retrieve the AST::Node instance corresponding to an
instruction for a research purpose including TypeProf-based LSP server.
2021-06-21 21:15:25 +09:00
aycabta
089a26b0a6 Use Encoding.default_external for tests of Readline::HISTORY 2021-06-21 19:31:14 +09:00
aycabta
30cc07fdc1 Check Ruby version to use Fiddle with variadic args in test-all 2021-06-21 18:44:10 +09:00
Ulysse Buonomo
5cc11845b2 [ruby/irb] Improve stackprof measure
Allow usage of more detailed args when setting stackprof callback.

Signed-off-by: Ulysse Buonomo <buonomo.ulysse@gmail.com>

c9d101f450
2021-06-21 18:03:49 +09:00
aycabta
90df426426 [ruby/reline] Version 0.2.6
5917e3a337
2021-06-21 17:58:49 +09:00
aycabta
00b027a69b [ruby/reline] Fix explamation of #read_io
301ed11bec
2021-06-21 17:58:49 +09:00
aycabta
cf6f686d29 [ruby/reline] Remove an obsolete commented-out test
5354d02e03
2021-06-21 17:58:49 +09:00
aycabta
95a3cdade6 [ruby/reline] Remove FIXME comment in #render
acd8f8efbb
2021-06-21 17:58:49 +09:00
aycabta
b06218ce6f [ruby/reline] Remove TODO comment in #render_partial
bb6ea232c2
2021-06-21 17:58:49 +09:00
aycabta
cf186bfe14 [ruby/reline] Add yamatanooroti test about set and exchange mark
2e6fdca5c6
2021-06-21 17:58:49 +09:00
aycabta
8135f489be [ruby/reline] Add binding C-x C-x to em_exchange_mark on Windows
24a2489b62
2021-06-21 17:58:49 +09:00
aycabta
882c0d5015 [ruby/reline] Reset config for random test
c39615e1dd
2021-06-21 17:58:49 +09:00
aycabta
fa5a258e93 [ruby/reline] Treat C-Space as M-Space on Windows
69beca2863
2021-06-21 17:58:49 +09:00
aycabta
582b5705ab [ruby/reline] Check existance of a constant, Fiddle::VERSION
4b74c3d83a
2021-06-21 17:58:48 +09:00
aycabta
18b79b4c49 [ruby/reline] Add Meta+arrow-keys in extended entries of terminfo
af6f6ed088
2021-06-21 17:58:48 +09:00
aycabta
60d1d6aa89 [ruby/reline] Terminfo.tigetstr should be able to receive tiparm in method chain
4a3e308163
2021-06-21 17:58:48 +09:00
aycabta
5e09da2f7a [ruby/reline] Terminfo.tigetstr and tiparm should return String object
1e287d10cc
2021-06-21 17:58:48 +09:00
aycabta
46c813969b [ruby/reline] Add terminfo support
74a7ffaa2f
2021-06-21 17:58:48 +09:00
aycabta
1b543dc226 [ruby/reline] Handle Errno::ENOTTY correctly
8daa392ba6
2021-06-21 17:58:48 +09:00
Jeremy Evans
242bad9a87 [ruby/reline] Fix Reline::Unicode.calculate_width when input is not a TTY
This fixes an error when output is redirected:

```
$ run_ruby -rreline -e '$stderr.puts Reline::Unicode.calculate_width("\u221a").inspect' </dev/null >/dev/null
/home/jeremy/tmp/ruby/lib/reline/ansi.rb:189:in `raw': Operation not supported by device (Errno::ENODEV)
```

The @@encoding -> defined?(@@encoding) changes is necessary because
without that part of the commit, the following error would be raised
by the above command:

```
/home/jeremy/tmp/reline/lib/reline/general_io.rb:10:in `encoding': uninitialized class variable @@encoding in Reline::GeneralIO (NameError)
```

Problem reported and initial patch for Windows provided by
Richard Sharman.

I tested this only on OpenBSD, but hopefully it works for other
operating systems.

Fixes [Bug #17493]

c001971bb3
2021-06-21 17:58:48 +09:00
aycabta
26f31f880c [ruby/reline] Treat return key correctly on Windows
To fix Reline::TestRendering#test_binding_for_vi_movement_mode.

0df3d2a1dc
2021-06-21 17:58:48 +09:00
aycabta
754bfc66f8 [ruby/reline] Add a test for pasting Cyrillic chars into command prompt on cp 850
This closes https://github.com/ruby/reline/issues/103.

213e0523d5
2021-06-21 17:58:48 +09:00
aycabta
b0cc46b484 [ruby/reline] The config file must accept any character encoding
In Japan, so many programmers used EUC-JP to write text files that contain
Japanese. Many .inputrc files which contain EUC-JP are still being copied and
used. This commit supports the whole encoding of what user set including UTF-8.

ref. https://github.com/ruby/reline/pull/280

0b45022e16
2021-06-21 17:58:48 +09:00
aycabta
c59bbd86a6 [ruby/reline] Use ReadConsoleInputW() instead of getwch()
This needs https://github.com/aycabta/yamatanooroti/pull/19, which is released
by yamatanooroti gem 0.0.7, to test with yamatanooroti.

06c1f45da1
2021-06-21 17:58:48 +09:00
Mark Delk
a049dfd10a [ruby/reline] ensure reline's encoding is used when reading inputrc character values
This change ensures we use `Reline::IOGate`'s `encoding` when converting
characters from their integer values.

This fixes an issue that may occur if you have UTF characters in your
`.inputrc`, but your default encoding isn't set.

For example:

```
> 127864.ord.chr
RangeError: 127864 out of char range
from (pry):1:in `chr'
> Reline::IOGate.encoding
=> #<Encoding:UTF-8>
> 127864.ord.chr(Reline::IOGate.encoding)
=> "🍸"
```

cf372fc0fc
2021-06-21 17:58:48 +09:00
aycabta
c2f30aaade [ruby/irb] Version 1.3.6
75aa8d159b
2021-06-21 17:35:46 +09:00
Nobuyoshi Nakada
60eee3c3cb
Fix syntax error in generated code 2021-06-21 11:20:31 +09:00
git
86b5c15e70 * 2021-06-21 [ci skip] 2021-06-21 11:08:33 +09:00
Nobuyoshi Nakada
28933c1071
Adjust indents 2021-06-21 11:08:02 +09:00
Jeremy Evans
72a4e1d3bb Tweak description of TracePoint :line event
"code" here is too ambiguous. TracePoint events only occur if there
is a new statement or expression on that line, not if the line
is a continuation of a previous statement or expression and there
is no new statement or expression on the line.

For example:

```
[
 foo,   # start of expression, line event
 bar    # continuation of expression, no line event
]

[
 foo,   # start of expression, line event
 (bar)  # new expression, line event
]

foo(    # start of expression, line event
  bar   # continuation of expression, no line event
)

foo(    # start of expression, line event
  (bar) # new expression, line event
)
```

Fixes [Bug #15634]
2021-06-19 13:55:28 +12:00
git
53a094ea45 * 2021-06-19 [ci skip] 2021-06-19 02:03:03 +09:00
eileencodes
b91b3bc771 Add a cache for class variables
Redo of 34a2acdac7 and
931138b006 which were reverted.

GitHub PR #4340.

This change implements a cache for class variables. Previously there was
no cache for cvars. Cvar access is slow due to needing to travel all the
way up th ancestor tree before returning the cvar value. The deeper the
ancestor tree the slower cvar access will be.

The benefits of the cache are more visible with a higher number of
included modules due to the way Ruby looks up class variables. The
benchmark here includes 26 modules and shows with the cache, this branch
is 6.5x faster when accessing class variables.

```
compare-ruby: ruby 3.1.0dev (2021-03-15T06:22:34Z master 9e5105c) [x86_64-darwin19]
built-ruby: ruby 3.1.0dev (2021-03-15T12:12:44Z add-cache-for-clas.. c6be009) [x86_64-darwin19]

|         |compare-ruby|built-ruby|
|:--------|-----------:|---------:|
|vm_cvar  |      5.681M|   36.980M|
|         |           -|     6.51x|
```

Benchmark.ips calling `ActiveRecord::Base.logger` from within a Rails
application. ActiveRecord::Base.logger has 71 ancestors. The more
ancestors a tree has, the more clear the speed increase. IE if Base had
only one ancestor we'd see no improvement. This benchmark is run on a
vanilla Rails application.

Benchmark code:

```ruby
require "benchmark/ips"
require_relative "config/environment"

Benchmark.ips do |x|
  x.report "logger" do
    ActiveRecord::Base.logger
  end
end
```

Ruby 3.0 master / Rails 6.1:

```
Warming up --------------------------------------
              logger   155.251k i/100ms
Calculating -------------------------------------
```

Ruby 3.0 with cvar cache /  Rails 6.1:

```
Warming up --------------------------------------
              logger     1.546M i/100ms
Calculating -------------------------------------
              logger     14.857M (± 4.8%) i/s -     74.198M in   5.006202s
```

Lastly we ran a benchmark to demonstate the difference between master
and our cache when the number of modules increases. This benchmark
measures 1 ancestor, 30 ancestors, and 100 ancestors.

Ruby 3.0 master:

```
Warming up --------------------------------------
            1 module     1.231M i/100ms
          30 modules   432.020k i/100ms
         100 modules   145.399k i/100ms
Calculating -------------------------------------
            1 module     12.210M (± 2.1%) i/s -     61.553M in   5.043400s
          30 modules      4.354M (± 2.7%) i/s -     22.033M in   5.063839s
         100 modules      1.434M (± 2.9%) i/s -      7.270M in   5.072531s

Comparison:
            1 module: 12209958.3 i/s
          30 modules:  4354217.8 i/s - 2.80x  (± 0.00) slower
         100 modules:  1434447.3 i/s - 8.51x  (± 0.00) slower
```

Ruby 3.0 with cvar cache:

```
Warming up --------------------------------------
            1 module     1.641M i/100ms
          30 modules     1.655M i/100ms
         100 modules     1.620M i/100ms
Calculating -------------------------------------
            1 module     16.279M (± 3.8%) i/s -     82.038M in   5.046923s
          30 modules     15.891M (± 3.9%) i/s -     79.459M in   5.007958s
         100 modules     16.087M (± 3.6%) i/s -     81.005M in   5.041931s

Comparison:
            1 module: 16279458.0 i/s
         100 modules: 16087484.6 i/s - same-ish: difference falls within error
          30 modules: 15891406.2 i/s - same-ish: difference falls within error
```

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-06-18 10:02:44 -07:00
Hiroshi SHIBATA
9d96837dbd
Bump matrix version to 0.4.2 2021-06-18 19:13:36 +09:00
Nobuyoshi Nakada
bdeaa60e7b
Make frozen Time Ractor-shareable 2021-06-18 11:58:15 +09:00
Jeremy Evans
1de063a10b Add section on build requirements to the README
I'm not sure that this is section is complete (may be missing
requirements), or accurate (minimum automake or bison versions
may not be correct).  However, I think it's useful, and we can
adjust it in the future to add requirements or adjust
requirement versions.

Fixes [Bug #14409]
2021-06-18 10:58:27 +09:00
Yusuke Endoh
0a36cab1b5 Enable USE_ISEQ_NODE_ID by default
... which is formally called EXPERIMENTAL_ISEQ_NODE_ID.

See also ff69ef27b0.

https://bugs.ruby-lang.org/issues/17930
2021-06-18 03:35:38 +09:00