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

63205 Коммитов

Автор SHA1 Сообщение Дата
Charles Oliver Nutter 33641e00cd
Remove private_iv_get
The only remaining use of this function was to get the internal
message object from an exception's hidden `mesg` instance
variable to allow it to be dumped wiithout converting to a string.

As discussed in #103, this exposes internal implementation details
of CRuby, and ultimately does not provide any real utility to the
user since they can't directly inspect this hidden variable. The
test change here is to reflect CRuby behavior that denies equality
if the internal message objects do not match, as is the case after
the exception has been loaded and now has a simple String value.

The impact to users is that exceptions with special hidden message
objects will convert those objects to String during marshaling
through YAML. I believe this only affects NameError and its
descendants, since users can't set this field directly on their
own exception types.

Fixes #103.
2020-09-25 13:11:32 +09:00
Koichi Sasada 6081ba4a87 refactoring a test code.
make a test more clear.
2020-09-25 13:07:07 +09:00
Koichi Sasada d247dedade Ractor.yield should raise if out-port is closed
Ractor.yield should raise Ractor::ClosedError if current Ractor's
outgoing-port is closed.
2020-09-25 12:53:58 +09:00
Koichi Sasada 5286526346 frozen T_OBJECT can be shareable.
If an T_OBJECT object is frozen and all ivars are shareable,
the object should be shareable.
2020-09-25 12:52:53 +09:00
Koichi Sasada fde136152e should not check taint flag on rubyspec.
Now taint flag is obsolete and it is used fro shareaable flag.
So we should not check this flag.
2020-09-25 12:52:53 +09:00
卜部昌平 c6c241e49c enrich comment
Added description and URL about nested flexible array member.
2020-09-25 11:38:33 +09:00
卜部昌平 4cc501bcfd ext/-test-/RUBY_ALIGNOF: skip C++ when no compiler
C++ compilers are optional.  Skip C++ tests when they are absent.
2020-09-25 11:38:33 +09:00
卜部昌平 e75aed7abb RBIMPL_ALIGNOF: do not use constexpr
Was definitely a bad idea to use constexpr.  It is not ubiquitous.
2020-09-25 11:38:33 +09:00
卜部昌平 0b77a86d1e ext/-test-/RUBY_ALIGNOF: add minimalistic test
Check if RUBY_ALIGNOF(double) is the alignment to store a double inside
of a struct.
2020-09-25 11:38:33 +09:00
卜部昌平 873fb1aa4c ALLOCA_N: do not use RUBY_ALIGNOF
Now that RUBY_ALIGNOF behaves like C11's _Alignof.  This is not
necessarily the best stack arrangement.  We can just give up using
__builtin_alloca_with_align(), and let alloca choose what is optimal.
2020-09-25 11:38:33 +09:00
卜部昌平 e9fb2bc873 RBIMPL_ALIGNOF: do not use __alignof__
It is reported that on a system of i386 System V ABI, GCC returns 8 for
__alignof__(double).  OTOH the ABI defines alignments of double to be 4,
and ISO/IEC 9899:2011 reads that _Alignof(double) shall return 4 on such
machine.  What we want in ruby is 4 instead of 8 there.  We cannot use
__alignof__.

Additionally, both old GCC / old clang return 8 for _Alignof(double) on
such platforms.  They are their bugs, and already fixed in recent
versions.  But we have to support older compilers for a while.  Shall
check sanity of _Alignof.
2020-09-25 11:38:33 +09:00
卜部昌平 fe875be01a rb_cv_have_alignas: not used any longer
Availability of `alignas` is checked in include/ruby/internal/stdalign.h
now.  That does not need this configure check.  Also as commented in the
header, we see `_Alignas` being inadequate for our purpose.
2020-09-25 11:38:33 +09:00
Nobuyoshi Nakada 996af2ce08 Disable deprecation warning by the default [Feature #16345]
And `-w` option turns it on.
2020-09-25 09:50:33 +09:00
Burdette Lamar 83ff0f74bf
Enhanced RDoc for String#match? (#3576)
* Enhanced RDoc for String#match?
2020-09-24 18:38:11 -05:00
Hiroshi SHIBATA 53acf6686a
Revert "[ruby/webrick] Add test for shutdown_pipe"
This reverts commit c06eab1329.
2020-09-25 07:54:01 +09:00
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.

  https://github.com/ruby/ruby/runs/1160423667?check_suite_focus=true#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
https://github.com/ruby/webrick/commit/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.

https://github.com/ruby/webrick/commit/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

https://github.com/ruby/webrick/commit/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.

https://github.com/ruby/webrick/commit/0f0c9f1e61
2020-09-24 21:33:16 +09:00
John W Higgins b8fdd38b2e [ruby/webrick] Fix shutdown_pipe test issue
https://github.com/ruby/webrick/commit/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
https://github.com/ruby/webrick/commit/86ed621e11
2020-09-24 21:31:55 +09:00
John W Higgins c06eab1329 [ruby/webrick] Add test for shutdown_pipe
https://github.com/ruby/webrick/commit/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+.

https://github.com/ruby/webrick/commit/fbe85b885f
2020-09-24 21:30:34 +09:00
John W Higgins 96da24f279 [ruby/webrick] Make readpartial limit chunk to appropriate size
https://github.com/ruby/webrick/commit/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.

https://github.com/ruby/webrick/commit/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.

http://rubyci.s3.amazonaws.com/android29-x86_64/ruby-master/log/20200924T062352Z.fail.html.gz
https://github.com/ruby/ruby/runs/1159288773?check_suite_focus=true

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