Commit graph

64552 commits

Author SHA1 Message Date
eileencodes
8dd9a23693 Make minor improvements to super
The changes here include:

* Using `FL_TEST_RAW` instead of `FL_TEST` in the first check in
`vm_search_super_method`. While the profile showed us spending a fair
amount of time here, the subsequent benchmarks didn't show much
improvement when adding this. Regardless, we know this does less work
than `FL_TEST` and we know that `FL_TEST_RAW` is safe due to the
previous check so it's a small but accurate optimization.
* Set `mid` only once. Both `vm_ci_new_runtime` and `vm_ci_mid` were
getting the `original_id` for the method entry. We can do this once
and pass the variable to the 2 callers that need it. This also doesn't
have a huge performance improvement but cleans up the code a bit.

Benchmark:

```
|                 |compare-ruby|built-ruby|
|:----------------|-----------:|---------:|
|vm_iclass_super  |      3.540M|    3.940M|
|                 |           -|     1.11x|
```

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2020-10-01 10:11:02 -07:00
git
d959987891 * 2020-10-02 [ci skip] 2020-10-02 00:43:14 +09:00
Aaron Patterson
9fb60672d5 Fix a use-after-free bug reported by ASAN
If a fiber and thread are collected at the same time, the thread might
get collected first and the pointer on the fiber will go bad.  I don't
think we need to check whether or not this is the main fiber in order to
release its stack
2020-10-01 08:42:52 -07:00
Samuel Williams
2db081b5ff Don't use th->scheduler directly because it's not always valid to do so. 2020-10-01 21:38:36 +13:00
Nobuyoshi Nakada
1d3024da26
Refined assertions for better failure messages 2020-10-01 13:48:15 +09:00
Nobuyoshi Nakada
eef12cdc06
strip trailing spaces [ci skip] 2020-10-01 13:47:57 +09:00
Nobuyoshi Nakada
257007af9a
Added a fallback return 2020-10-01 13:46:13 +09:00
Nobuyoshi Nakada
0d37ed5fdc
rb_thread_scheduler is no longer used 2020-10-01 13:45:20 +09:00
Nobuyoshi Nakada
0e98a9c854
break around function definition [ci skip] 2020-10-01 13:44:29 +09:00
Yusuke Endoh
ab99a2ac44 spec/ruby/core/process/spawn_spec.rb: skip a test on Android
On Android, STDERR seems to be open even its invoker closes it.

20201001T014315Z.fail.html.gz

```
1)
Process.spawn closes STDERR in the child if :err => :close FAILED
Expected (59840): "out\nrescued\n"
         but got: "out\n"
```
2020-10-01 13:27:32 +09:00
Kazuhiro NISHIYAMA
c893aa0539
Add links to the tickets [ci skip] 2020-10-01 13:27:00 +09:00
Samuel Williams
a88fe61a3e Rework rb_ec_scheduler_finalize to ensure exceptions are printed. 2020-10-01 16:56:05 +13:00
Samuel Williams
dd2e95fb26 Remove Thread.scheduler from public interface.
It's implementation is equivalent to:

Thread.current.scheduler unless Thread.current.blocking?
2020-10-01 16:56:05 +13:00
Samuel Williams
7f29020590 Raise an exception if the scheduler was already closed. 2020-10-01 16:02:03 +13:00
Samuel Williams
13660105e2 Don't call Scheduler#close if it doesn't exist. 2020-10-01 16:02:03 +13:00
Koichi Sasada
bc23216e5a stop Ractor test in test-all
Ractor changes the interpreter's running mode so now it should
not use in test-all process which running with many other tests.

Test with a separating process is one idea, but I'm not sure
the ruby/ostruct can use this trick.
2020-10-01 08:55:08 +09:00
Marc-Andre Lafortune
bb2ba72c3b [ruby/ostruct] Tweak doc 2020-09-30 18:11:24 -04:00
Marc-Andre Lafortune
152ba86b6b [ruby/ostruct] Remove unused condition 2020-09-30 18:11:24 -04:00
Marc-Andre Lafortune
b36a45c05c [ruby/ostruct] Improved YAML serialization.
Patch adapted from Pietro Monteiro [Fixes bug#8382]
2020-09-30 18:11:24 -04:00
Marc-Andre Lafortune
0e93118c44 [ruby/ostruct] Update NEWS 2020-09-30 18:11:24 -04:00
Marc-Andre Lafortune
0977040133 [ruby/ostruct] Add test that frozen OpenStructs are Ractor-shareable 2020-09-30 18:11:24 -04:00
Marc-Andre Lafortune
083fa6e5d2 [ruby/ostruct] Protect subclass' methods and our bang methods.
Internally, use only bang methods
2020-09-30 18:11:24 -04:00
Marc-Andre Lafortune
df4d08c44a [ruby/ostruct] Avoid calling initialize 2020-09-30 18:11:24 -04:00
Marc-Andre Lafortune
fb16c3dce2 Remove trailing whitespace [doc] 2020-09-30 18:11:24 -04:00
git
f4733b2c31 * 2020-10-01 [ci skip] 2020-10-01 04:58:36 +09:00
Burdette Lamar
4bc6190a34
Enhanced RDoc for String#[] (#3607)
* Enhanced RDoc for String#[]
2020-09-30 14:58:12 -05:00
Nobuyoshi Nakada
7b2bea42a2
Unfreeze string-literal-only interpolated string-literal
[Feature #17104]
2020-09-30 22:15:28 +09:00
Benoit Daloze
65e8a29389 Update to ruby/spec@bfd843a 2020-09-30 13:43:19 +02:00
Benoit Daloze
bbecf1eb6b Update to ruby/mspec@e154fa1 2020-09-30 13:43:17 +02:00
Nobuyoshi Nakada
9501b34dfc
strip trailing spaces [ci skip] 2020-09-30 19:40:30 +09:00
Benoit Daloze
8dab56ea86 Update to ruby/spec@681e8cf 2020-09-30 12:39:20 +02:00
Benoit Daloze
31636bbddc Update to ruby/mspec@4120a62 2020-09-30 12:39:18 +02:00
Benoit Daloze
201d501640 Update to ruby/spec@9277d27 2020-09-30 12:21:48 +02:00
Kazuhiro NISHIYAMA
ce986b41ca
Remove unneeded begin and end 2020-09-30 15:55:07 +09:00
Kazuhiro NISHIYAMA
30bb040ea4
Fix Leaked tempfiles
20200930T033004Z.diff.html.gz
```
 [n/n] JSONCommonInterfaceTest#test_load = <elapsed> s
 [n/n] JSONCommonInterfaceTest#test_load_file = <elapsed> s
+Leaked tempfile: JSONCommonInterfaceTest#test_load_file: #<Tempfile:<build-dir>/tmp/20200930-7601-ptnv6i (closed)>
 [n/n] JSONCommonInterfaceTest#test_load_file! = <elapsed> s
+Leaked tempfile: JSONCommonInterfaceTest#test_load_file!: #<Tempfile:<build-dir>/tmp/20200930-7601-1la6m9 (closed)>
 [n/n] JSONCommonInterfaceTest#test_load_file_with_option = <elapsed> s
+Leaked tempfile: JSONCommonInterfaceTest#test_load_file_with_option: #<Tempfile:<build-dir>/tmp/20200930-7601-blf9hz (closed)>
 [n/n] JSONCommonInterfaceTest#test_load_file_with_option! = <elapsed> s
+Leaked tempfile: JSONCommonInterfaceTest#test_load_file_with_option!: #<Tempfile:<build-dir>/tmp/20200930-7601-b5gsdb (closed)>
```
2020-09-30 15:41:14 +09:00
Kazuhiro NISHIYAMA
1484b786ae
Suppress warnings
```
compiling ../mjit.c
In file included from ../mjit.c:28:
../mjit_worker.c:1270:33: warning: incompatible pointer to integer conversion passing 'const struct rb_callcache *' to parameter of type 'VALUE' (aka 'unsigned long') [-Wint-conversion]
            assert(BUILTIN_TYPE(cc) != T_MOVED);
                                ^~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/assert.h:93:25: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                        ^
../include/ruby/internal/value_type.h:153:23: note: passing argument to parameter 'obj' here
RB_BUILTIN_TYPE(VALUE obj)
                      ^
In file included from ../mjit.c:28:
../mjit_worker.c:1271:33: warning: incompatible pointer to integer conversion passing 'const struct rb_callable_method_entry_struct *' to parameter of type 'VALUE' (aka 'unsigned long') [-Wint-conversion]
            assert(BUILTIN_TYPE(vm_cc_cme(cc)) != T_MOVED);
                                ^~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/assert.h:93:25: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                        ^
../include/ruby/internal/value_type.h:153:23: note: passing argument to parameter 'obj' here
RB_BUILTIN_TYPE(VALUE obj)
                      ^
In file included from ../mjit.c:28:
../mjit_worker.c:1272:50: warning: incompatible pointer to integer conversion passing 'const struct rb_callcache *' to parameter of type 'VALUE' (aka 'unsigned long') [-Wint-conversion]
            assert(!rb_objspace_garbage_object_p(cc));
                                                 ^~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/assert.h:93:25: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                        ^
../gc.h:128:40: note: passing argument to parameter 'obj' here
int rb_objspace_garbage_object_p(VALUE obj);
                                       ^
In file included from ../mjit.c:28:
../mjit_worker.c:1273:50: warning: incompatible pointer to integer conversion passing 'const struct rb_callable_method_entry_struct *' to parameter of type 'VALUE' (aka 'unsigned long') [-Wint-conversion]
            assert(!rb_objspace_garbage_object_p(vm_cc_cme(cc)));
                                                 ^~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/assert.h:93:25: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                        ^
../gc.h:128:40: note: passing argument to parameter 'obj' here
int rb_objspace_garbage_object_p(VALUE obj);
                                       ^
4 warnings generated.
```
2020-09-30 13:37:07 +09:00
Samuel Williams
388281c5c9 Fix order of operations during rb_ec_finalize. 2020-09-30 16:34:38 +13:00
Burdette Lamar
48b94b7919
Enhanced RDoc for String#upto (#3603)
* Enhanced RDoc for String#upto
2020-09-29 19:15:39 -05:00
Maciej Mensfeld
0fb1a67bda Reference process PID using the Process#pid
This change will allow formatter to run from Ractors other than main.
2020-09-29 11:50:46 -07:00
git
c38605de6b * 2020-09-30 [ci skip] 2020-09-30 00:32:22 +09:00
Peter Zhu
f7bd9f0750 Fix unsigned int overflow in error message for chr
The error message has an integer overflow because it treats an unsigned int as a signed int.

Before:
```
> 3_000_000_000.chr
-1294967296 out of char range (RangeError)
```

After:
```
> 3_000_000_000.chr
3000000000 out of char range (RangeError)
```

Redmine ticket: https://bugs.ruby-lang.org/issues/17186
2020-09-30 00:31:59 +09:00
Kazuhiro NISHIYAMA
cece71b467
Add call-seq of [Feature #16274] 2020-09-29 22:49:44 +09:00
Yusuke Endoh
d23d2f3f6f
[ruby/webrick] Make it more strict to interpret some headers
Some regexps were too tolerant.

8946bb38b4
2020-09-29 16:40:33 +09:00
Nobuyoshi Nakada
dcb705ace7
doc/syntax/literals.rdoc: explain #@@foo too [ci skip] 2020-09-29 15:28:09 +09:00
Yusuke Endoh
2e947bc181 doc/syntax/literals.rdoc: explain #@foo and #$foo 2020-09-29 14:39:52 +09:00
Nobuyoshi Nakada
a9ff390870
Fixed installation failure [Bug #17191]
Try update and extract bundled gems only when baseruby is
available.  It should be done only when installing from
developemental build and not from the tarball, but it is not
obvious to differentiate them.
2020-09-29 13:41:59 +09:00
Nobuyoshi Nakada
b971f141b2
Fix up dependencies on internal/sanitizers.h 2020-09-29 13:14:54 +09:00
Yusuke Endoh
40a499db65 test/racc/test_racc_command.rb: prevent a warning
20200929T003003Z.log.html.gz
```
warning: ambiguous first argument; put parentheses or a space even after `/' operator
```
2020-09-29 11:58:04 +09:00
卜部昌平
06099e4ee1 fix typo [ci skip]
Reported by Mau Magnaguagno See: https://github.com/ruby/ruby/pull/3570#discussion_r495465903
2020-09-29 09:57:47 +09:00
Aaron Patterson
0a3099ae40
bit table information when printing an object 2020-09-28 16:45:19 -07:00