Commit graph

63490 commits

Author SHA1 Message Date
Hiroshi SHIBATA
c5960d51d1
Revert "[ruby/webrick] Fix shutdown_pipe test issue"
This reverts commit b8fdd38b2e.
2020-09-25 07:33:25 +09:00
Burdette Lamar
38385d28df
Enhanced RDoc for String (#3574)
Methods:

    =~
    match
2020-09-24 13:23:26 -05:00
Burdette Lamar
6fe2a9fcda
Enhanced RDoc for String (#3569)
Makes some methods doc compliant with https://github.com/ruby/ruby/blob/master/doc/method_documentation.rdoc. Also, other minor revisions to make more consistent.
Methods:

    ==
    ===
    eql?
    <=>
    casecmp
    casecmp?
    index
    rindex
2020-09-24 10:55:43 -05:00
git
b30af31c37 * 2020-09-25 [ci skip] 2020-09-25 00:26:03 +09:00
Koichi Sasada
7ad3aff48d Ractor#close_outgoping cancel Ractor.yield
Ractor#close_outgoing should cancel waiting Ractor.yield. However,
yield a value by the Ractor's block should not cancel (to recognize
terminating Ractor, introduce rb_ractor_t::yield_atexit flag).
2020-09-25 00:25:38 +09:00
Hiroshi SHIBATA
757e185cee
Revert "[ruby/webrick] Allow empty POST and PUT requests without content length"
This reverts commit ed12019ce6.

  1160423667 (step):14:752
2020-09-24 22:20:02 +09:00
Hiroshi SHIBATA
588ac990ff
[ruby/webrick] Manually pick commit from upstream repo
Fix test when run with US-ASCII encoding

  f402aafb36
2020-09-24 21:41:11 +09:00
John W Higgins
f64bea6d66 [ruby/webrick] Allow shutdown_pipe to be passed in via @config
30152b4bf9
2020-09-24 21:37:06 +09:00
Jeremy Evans
c12c7fea70 [ruby/webrick] Only run test_big_bodies test on Ruby 2.5+
It was added after Ruby 2.5, and it looks like it never ran correctly
on Ruby <2.5.

65fb03cb6a
2020-09-24 21:34:41 +09:00
Jeremy Evans
ed12019ce6 [ruby/webrick] Allow empty POST and PUT requests without content length
RFC 7230 section 3.3.3 allows for this.

Fixes #30

069e9b1908
2020-09-24 21:34:07 +09:00
Jeremy Evans
0fe6461148 [ruby/webrick] Allow EPROTOTYPE error when writing junk to a socket
MacOS seems to raise this error in some cases.

0f0c9f1e61
2020-09-24 21:33:16 +09:00
John W Higgins
b8fdd38b2e [ruby/webrick] Fix shutdown_pipe test issue
9676704c60
2020-09-24 21:32:14 +09:00
John W Higgins
4715a24dd2 [ruby/webrick] Ensure server port numbers are numeric and ensure they are stored as integers
86ed621e11
2020-09-24 21:31:55 +09:00
John W Higgins
c06eab1329 [ruby/webrick] Add test for shutdown_pipe
1daacc1849
2020-09-24 21:31:35 +09:00
Jeremy Evans
d969cf6059 [ruby/webrick] Do not use ensure in a block without begin
This syntax is not supported until Ruby 2.5, and Webrick still
targets Ruby 2.3+.

fbe85b885f
2020-09-24 21:30:34 +09:00
John W Higgins
96da24f279 [ruby/webrick] Make readpartial limit chunk to appropriate size
e693f501bd
2020-09-24 21:22:20 +09:00
Charles Oliver Nutter
46ba416a1f [ruby/webrick] Skip env-locale-sensitive CGI test on the "java" platform
JRuby's environment variables are provided by the Java Development
Kit's (JDK's) classes, which present them as a map from string to
string. In order to do this, those environment variable names and
values must be decoded into characters, which breaks any variables
that are intended to be "raw" bytes not necessarily decodable with
the default system encoding.

This issue is detailed in jruby/jruby#6248. The only solution on
the JRuby side will be to bypass the JDK environment variable API
and go directly to the native getenv/setenv system calls. This is
not likely to happen in the near future, due to the complexity of
such a change and the rarity of undecodable environment values.

The exclude here was added due to the Windows platform also having
a similar sensitivity to character encodings when working with
environment variables. It seems appropriate to expand this skip
to the "java" platform, as the root issue is largely the same.

dc453e5c3c
2020-09-24 21:21:38 +09:00
Yusuke Endoh
0c611d7f4f test/net/http/test_https.rb: The test logic was buggy
The expected certs must be `[CA_CERT, SERVER_CERT]` before 1.1.1g and
`[SERVER_CERT]` after 1.1.1h.
2020-09-24 19:39:51 +09:00
Yusuke Endoh
1917afa34b test/net/http/test_https.rb: the order of verify_callback seems to vary
... depending upon the environment.
2020-09-24 19:34:16 +09:00
Yusuke Endoh
4405423c87 test/ostruct/test_ostruct.rb: Prevent "method redefined; discarding old foo" 2020-09-24 19:30:22 +09:00
Yusuke Endoh
416bb11a5e test/fiber/scheduler.rb: Prevent "instance variable @urgent not initialized" 2020-09-24 19:29:54 +09:00
Yusuke Endoh
07786edd66 test/net/http/test_https.rb: Stop the error due to openssl 1.1.1h
On some environments that uses OpenSSL 1.1.1h, the two tests now fail.

20200924T062352Z.fail.html.gz
1159288773

```
  1) Failure:
TestNetHTTPS#test_get [/data/data/com.termux/files/home/cb/tmp/build/20200924T062352Z/ruby/test/net/http/test_https.rb:47]:
<"0\x82\x03\xED0\x82\x02\xD5\xA0\x03..."> expected but was
<"0\x82\x03\xE30\x82\x02\xCB\xA0\x03...">.
```

Not sure why, but verify_callback now seems to receive only SERVER_CERT
but not CA_CERT.
It would be good to investigate the issue furthermore, but tentatively,
I want to stop the failures.
2020-09-24 19:20:17 +09:00
Koichi Sasada
29ed16ff4a add GC_GUARD
We observed mark miss on this point so we add RB_GC_GUARD() to
avoid wrong free.
2020-09-24 17:09:12 +09:00
Koichi Sasada
4a588e70b8 sync rb_gc_register_mark_object()
rb_vm_t::mark_object_ary is global resource so we need to
synchronize to access it.
2020-09-24 17:09:12 +09:00
Michael Lindley
e06f4a3b1f Remove test for putiseq insn
putiseq was removed from instruction set in 2b5bb8a0
2020-09-24 09:56:12 +09:00
Jeremy Evans
fae135c5b3 Document difference between Thread::Backtrace::Location#{,absolute_}path
They are usually the same, except for locations in the main script.
2020-09-23 15:55:58 -07:00
git
502c3ff02a * 2020-09-24 [ci skip] 2020-09-24 03:52:57 +09:00
eileencodes
637d1cc0c0 Improve the performance of super
This PR improves the performance of `super` calls. While working on some
Rails optimizations jhawthorn discovered that `super` calls were slower
than expected.

The changes here do the following:

1) Adds a check for whether the call frame is not equal to the method
entry iseq. This avoids the `rb_obj_is_kind_of` check on the next line
which is quite slow. If the current call frame is equal to the method
entry we know we can't have an instance eval, etc.
2) Changes `FL_TEST` to `FL_TEST_RAW`. This is safe because we've
already done the check for `T_ICLASS` above.
3) Adds a benchmark for `T_ICLASS` super calls.
4) Note: makes a chage for `method_entry_cref` to use `const`.

On master the benchmarks showed that `super` is 1.76x slower. Our
changes improved the performance so that it is now only 1.36x slower.

Benchmark IPS:

```
Warming up --------------------------------------
               super   244.918k i/100ms
         method call   383.007k i/100ms
Calculating -------------------------------------
               super      2.280M (± 6.7%) i/s -     11.511M in   5.071758s
         method call      3.834M (± 4.9%) i/s -     19.150M in   5.008444s

Comparison:
         method call:  3833648.3 i/s
               super:  2279837.9 i/s - 1.68x  (± 0.00) slower
```

With changes:

```
Warming up --------------------------------------
               super   308.777k i/100ms
         method call   375.051k i/100ms
Calculating -------------------------------------
               super      2.951M (± 5.4%) i/s -     14.821M in   5.039592s
         method call      3.551M (± 4.9%) i/s -     18.002M in   5.081695s

Comparison:
         method call:  3551372.7 i/s
               super:  2950557.9 i/s - 1.20x  (± 0.00) slower
```

Ruby VM benchmarks also showed an improvement:

Existing `vm_super` benchmark`.

```
$ make benchmark ITEM=vm_super

|          |compare-ruby|built-ruby|
|:---------|-----------:|---------:|
|vm_super  |     21.555M|   37.819M|
|          |           -|     1.75x|
```

New `vm_iclass_super` benchmark:

```
$ make benchmark ITEM=vm_iclass_super

|                 |compare-ruby|built-ruby|
|:----------------|-----------:|---------:|
|vm_iclass_super  |      1.669M|    3.683M|
|                 |           -|     2.21x|
```

This is the benchmark script used for the benchmark-ips benchmarks:

```ruby
require "benchmark/ips"

class Foo
  def zuper; end
  def top; end

  last_method = "top"

  ("A".."M").each do |module_name|
    eval <<-EOM
    module #{module_name}
      def zuper; super; end
      def #{module_name.downcase}
        #{last_method}
      end
    end
    prepend #{module_name}
    EOM
    last_method = module_name.downcase
  end
end

foo = Foo.new

Benchmark.ips do |x|
  x.report "super" do
    foo.zuper
  end

  x.report "method call" do
    foo.m
  end

  x.compare!
end
```

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
Co-authored-by: John Hawthorn <john@hawthorn.email>
2020-09-23 11:52:36 -07:00
Hiroshi SHIBATA
b717f73402
Revert "Manually merged from https://github.com/rubygems/rubygems/pull/2636"
31a6eaabc1 is obsoleted with
  https://github.com/rubygems/rubygems/pull/3820
2020-09-23 22:01:44 +09:00
Hiroshi SHIBATA
a46841612c
bump Bundler's version to 2.2.0.rc.1 2020-09-23 21:06:29 +09:00
Hiroshi SHIBATA
31a6eaabc1
Manually merged from https://github.com/rubygems/rubygems/pull/2636
Enable Style/EmptyLinesAroundClassBody rubocop cop.
2020-09-23 21:02:56 +09:00
Hiroshi SHIBATA
f56fc720ee
bundle-package.* was removed at upstream repo 2020-09-23 20:28:38 +09:00
Nobuyoshi Nakada
b57c54679b
strip trailing spaces [ci skip] 2020-09-23 17:47:30 +09:00
Hiroshi SHIBATA
5cc728816d
Update the version number of rubygems and bundler at NEWS.md 2020-09-23 17:38:52 +09:00
Kazuhiro NISHIYAMA
9a8f5f0a9a
Fix call-seq [ci skip]
`encoding` can be not only an encoding name, but also an Encoding object.

```
s = String.new('foo', encoding: Encoding::US_ASCII)
s.encoding # => #<Encoding:US-ASCII>
```
2020-09-23 11:44:06 +09:00
Hiroshi SHIBATA
ba889100d8
Bundle rbs gem as bundled gems (#3496)
* Added rbs as bundled gems
* Added the missing dependencies for rbs gem
2020-09-23 10:59:49 +09:00
Hiroshi SHIBATA
e380f78851 Removed rb_find_file_ext_safe and rb_find_file_safe 2020-09-23 09:09:36 +09:00
Jeremy Evans
ed27c2514c Update UnixSocket#recv_io tests to handle receiving a UnixSocket
Receiving UnixSocket works fine if you don't provide a mode, and
I think it is reasonable to expect that you should not provide
a mode if klass.for_fd would not accept a mode.

Fixes [Bug #11778]
2020-09-22 15:44:34 -07:00
Burdette Lamar
b904b72960
Enhanced RDoc for String (#3565)
Makes some methods doc compliant with https://github.com/ruby/ruby/blob/master/doc/method_documentation.rdoc. Also, other minor revisions to make more consistent.
Methods:

    try_convert
    +string
    -string
    concat
    <<
    prepend
    hash
2020-09-22 16:32:17 -05:00
Aaron Patterson
3d474e19fd Rudimentary support for disassembling rb_iseq_t
I need to disassemble instruction sequences while debugging, so I wrote
this.

Usage is like this:

```
(lldb) p iseq
(rb_iseq_t *) $147 = 0x0000000101068400
(lldb) rbdisasm iseq
0000 putspecialobject( 3 )
0002 putnil
0003 defineclass( ID: 0x560b, (rb_iseq_t *)0x1010681d0, 2 )
0007 pop
0008 putspecialobject( 3 )
0010 putnil
0011 defineclass( ID: 0x56eb, (rb_iseq_t *)0x101063b58, 2 )
0015 leave
```

Also thanks a ton to @kivikakk helping me figure out how to navigate LLDB's Python 😆
2020-09-22 13:40:57 -07:00
Jeremy Evans
179384a668 Revert "Prevent SystemStackError when calling super in module with activated refinement"
This reverts commit eeef16e190.

This also reverts the spec change.

Preventing the SystemStackError would be nice, but there is valid
code that the fix breaks, and it is probably more common than cases
that cause the SystemStackError.

Fixes [Bug #17182]
2020-09-22 12:04:48 -07:00
Aaron Patterson
f3dddd77a9
Add a comment about why we're checking the finalizer table 2020-09-22 09:20:04 -07:00
git
3c80889802 * 2020-09-23 [ci skip] 2020-09-23 01:01:25 +09:00
Aaron Patterson
8b41e9b6e7
Revert "Pin values in the finalizer table"
If an object has a finalizer flag set on it, prevent it from moving.

This partially reverts commit 1a9dd31910.
2020-09-22 08:57:48 -07:00
Jeremy Evans
df14c758fc Make hash returned by Hash#transform_values not have a default
This sets an explicit default of nil.  There is probably a better
approach of removing the default.

Fixes [Bug #17181]
2020-09-21 19:35:08 -07:00
git
7ee166ed4e * 2020-09-22 [ci skip] 2020-09-22 01:28:15 +09:00
Burdette Lamar
c6c5d4b3fa
Comply with guide for method doc: string.c (#3528)
Methods:

    ::new
    #length
    #bytesize
    #empty?
    #+
    #*
    #%
2020-09-21 11:27:54 -05:00
Benoit Daloze
82998918ef Make Thread#join always convert its argument, as before 70f08f1eed 2020-09-21 16:22:04 +02:00
Benoit Daloze
2b73e6ba71 Simplify the implementation of Scheduler#block
* This shows block() with a timeout is similar to #kernel_sleep and also
  does not need to change `@blocking`.
2020-09-21 16:04:20 +02:00
Benoit Daloze
0fa1c82bfc Make it clear the first field of join_arg is the waiting thread
* And not some list of sort.
2020-09-21 15:58:08 +02:00