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

63566 Коммитов

Автор SHA1 Сообщение Дата
Koichi Sasada f6661f5085 sync RClass::ext::iv_index_tbl
iv_index_tbl manages instance variable indexes (ID -> index).
This data structure should be synchronized with other ractors
so introduce some VM locks.

This patch also introduced atomic ivar cache used by
set/getinlinecache instructions. To make updating ivar cache (IVC),
we changed iv_index_tbl data structure to manage (ID -> entry)
and an entry points serial and index. IVC points to this entry so
that cache update becomes atomically.
2020-10-17 08:18:04 +09:00
Koichi Sasada 91ec5f9e39 remove rb_obj_iv_index_tbl
(1) nobody uses it (gem-codesearch)
(2) the data strucuture will be changed.
2020-10-17 08:18:04 +09:00
Aaron Patterson ff9dc10966
keep proc on the stack so it does not move 2020-10-16 11:28:52 -07:00
git 26e8db6b93 * 2020-10-17 [ci skip] 2020-10-17 00:08:33 +09:00
Yusuke Endoh ac803ab55d test/rinda/test_rinda.rb: Add more debugging code
in addition to de5e8d0e3b
2020-10-17 00:07:35 +09:00
Alan Wu 0d17cdd0ac Abort on system stack overflow during GC
Buggy native extensions could have mark functions that cause stack
overflow. When a stack overflow happens during GC, Ruby used to recover
by raising an exception, which runs the interpreter. It's not safe to
run the interpreter during GC since the GC is in an inconsistent state.
This could cause object allocation during GC, for example.

Instead of running the interpreter and potentially causing a crash down
the line, fail fast and abort.
2020-10-16 10:24:12 -04:00
Yusuke Endoh de5e8d0e3b test/rinda/test_rinda.rb: try debugging TestRingServer#test_do_reply
https://rubyci.org/logs/rubyci.s3.amazonaws.com/rhel8/ruby-master/log/20201016T063003Z.fail.html.gz
```
  1) Error:
Rinda::TestRingServer#test_do_reply:
Timeout::Error: timeout
    /home/chkbuild/chkbuild/tmp/build/20201016T063003Z/ruby/test/rinda/test_rinda.rb:837:in `sleep'
    /home/chkbuild/chkbuild/tmp/build/20201016T063003Z/ruby/test/rinda/test_rinda.rb:837:in `wait_for'
    /home/chkbuild/chkbuild/tmp/build/20201016T063003Z/ruby/test/rinda/test_rinda.rb:659:in `_test_do_reply'
    /home/chkbuild/chkbuild/tmp/build/20201016T063003Z/ruby/test/rinda/test_rinda.rb:643:in `block in test_do_reply'
    /home/chkbuild/chkbuild/tmp/build/20201016T063003Z/ruby/test/rinda/test_rinda.rb:807:in `with_timeout'
    /home/chkbuild/chkbuild/tmp/build/20201016T063003Z/ruby/test/rinda/test_rinda.rb:643:in `test_do_reply'
```
2020-10-16 16:51:33 +09:00
Yusuke Endoh 1cbb1f1720 test/ruby/test_syntax.rb: avoid "warning: assigned but unused variable" 2020-10-16 11:10:58 +09:00
git c34539d049 * 2020-10-16 [ci skip] 2020-10-16 08:37:33 +09:00
wanabe 65ae7f347a Adjust sp for `if true or ...`/`if false and ...` 2020-10-16 08:37:04 +09:00
wanabe ce7a053475 Adjust sp for `x = false; y = (return until x unless x)` [Bug #16695] 2020-10-16 08:37:04 +09:00
Hiroshi SHIBATA b68c22b3c6 Partly reverted test failing with https://github.com/rubygems/rubygems/pull/3921 2020-10-15 17:19:02 +09:00
Hiroshi SHIBATA d386a58f6f Merge bundler-2.2.0.rc.2 2020-10-15 17:19:02 +09:00
Nobuyoshi Nakada 7ffd14a18c
Check encoding name to replicate
https://hackerone.com/reports/954433
2020-10-15 16:48:25 +09:00
Hiroshi SHIBATA ab6c4f8be3 Merge rubygems-3.2.0.rc.2 2020-10-15 14:12:02 +09:00
git f0c7a05b4c * 2020-10-15 [ci skip] 2020-10-15 08:44:33 +09:00
Aaron Patterson 8a06af5f88
Mostly recover a Ruby stack trace from a core file
Update the lldb script so it can mostly recover a Ruby stack trace from
a core file.  It's still missing line numbers and dealing with CFUNCs,
but you use it like this:

```
(lldb) rbbt ec
rb_control_frame_t TYPE
0x7f6fd6555fa0     EVAL   ./bootstraptest/runner.rb error!!
0x7f6fd6555f68     METHOD ./bootstraptest/runner.rb main
0x7f6fd6555f30     METHOD ./bootstraptest/runner.rb in_temporary_working_directory
0x7f6fd6555ef8     METHOD /home/aaron/git/ruby/lib/tmpdir.rb mktmpdir
0x7f6fd6555ec0     BLOCK  ./bootstraptest/runner.rb block in in_temporary_working_directory
0x7f6fd6555e88     CFUNC
0x7f6fd6555e50     BLOCK  ./bootstraptest/runner.rb block (2 levels) in in_temporary_working_directory
0x7f6fd6555e18     BLOCK  ./bootstraptest/runner.rb block in main
0x7f6fd6555de0     METHOD ./bootstraptest/runner.rb exec_test
0x7f6fd6555da8     CFUNC
0x7f6fd6555d70     BLOCK  ./bootstraptest/runner.rb block in exec_test
0x7f6fd6555d38     CFUNC
0x7f6fd6555d00     TOP    /home/aaron/git/ruby/bootstraptest/test_insns.rb error!!
0x7f6fd6555cc8     CFUNC
0x7f6fd6555c90     BLOCK  /home/aaron/git/ruby/bootstraptest/test_insns.rb block in <top (required)>
0x7f6fd6555c58     METHOD ./bootstraptest/runner.rb assert_equal
0x7f6fd6555c20     METHOD ./bootstraptest/runner.rb assert_check
0x7f6fd6555be8     METHOD ./bootstraptest/runner.rb show_progress
0x7f6fd6555bb0     METHOD ./bootstraptest/runner.rb with_stderr
0x7f6fd6555b78     BLOCK  ./bootstraptest/runner.rb block in show_progress
0x7f6fd6555b40     BLOCK  ./bootstraptest/runner.rb block in assert_check
0x7f6fd6555b08     METHOD ./bootstraptest/runner.rb get_result_string
0x7f6fd6555ad0     METHOD ./bootstraptest/runner.rb make_srcfile
0x7f6fd6555a98     CFUNC
0x7f6fd6555a60     BLOCK  ./bootstraptest/runner.rb block in make_srcfile
```

Getting the main execution context is difficult (it is stored in a
thread local) so for now you must supply an ec and this will make a
backtrace
2020-10-14 16:43:53 -07:00
Koichi Sasada 2e8b5968e1 remove uneffective test
RubyVM.stat[:global_method_state] is no longer available so
this test doesn't check any more.
2020-10-14 23:15:21 +09:00
Koichi Sasada 278450de80 ruby_vm_global_method_state is no longer needed.
Now ruby_vm_global_method_state is not used so let's remove it.
2020-10-14 23:15:21 +09:00
Koichi Sasada fad97f1f96 sync generic_ivtbl
generic_ivtbl is a process global table to maintain instance variables
for non T_OBJECT/T_CLASS/... objects. So we need to protect them
for multi-Ractor exection.

Hint: we can make them Ractor local for unshareable objects, but
      now it is premature optimization.
2020-10-14 16:36:55 +09:00
Koichi Sasada ae693fff74 fix releasing timing.
(1) recorded_lock_rec > current_lock_rec should not be occurred
    on rb_ec_vm_lock_rec_release().
(2) should be release VM lock at EXEC_TAG(), not POP_TAG().
(3) some refactoring.
2020-10-14 16:36:55 +09:00
Kazuhiro NISHIYAMA 0714cb760c
Remove duplicated line [ci skip]
ref bf3b2a4374
2020-10-14 15:16:36 +09:00
Hiroshi SHIBATA 9aab916990
Promote pathname to default gems 2020-10-14 14:42:53 +09:00
Hiroshi SHIBATA 1e316edf60
Promote drb to the default gems 2020-10-14 14:42:53 +09:00
Koichi Sasada 102c2ba65f freeze Encoding objects
Encoding objects can be accessed in multi-ractors and there is no
state to mutate. So we can mark it as frozen and shareable.
[Bug #17188]
2020-10-14 14:02:06 +09:00
Koichi Sasada 11c2f0f36c sync enc_table and rb_encoding_list
enc_table which manages Encoding information. rb_encoding_list
also manages Encoding objects. Both are accessed/modified by ractors
simultaneously so that they should be synchronized.

For enc_table, this patch introduced GLOBAL_ENC_TABLE_ENTER/LEAVE/EVAL
to access this table with VM lock. To make shortcut, three new global
variables global_enc_ascii, global_enc_utf_8, global_enc_us_ascii are
also introduced.

For rb_encoding_list, we split it to rb_default_encoding_list (256 entries)
and rb_additional_encoding_list. rb_default_encoding_list is fixed sized Array
so we don't need to synchronized (and most of apps only needs it). To manage
257 or more encoding objects, they are stored into rb_additional_encoding_list.
To access rb_additional_encoding_list., VM lock is needed.
2020-10-14 14:02:06 +09:00
Koichi Sasada c3ba3fa8d0 support exception when lock_rec > 0
If a ractor getting a VM lock (monitor) raises an exception,
unlock can be skipped. To release VM lock correctly on exception
(or other jumps with JUMP_TAG), EC_POP_TAG() releases VM lock.
2020-10-14 14:02:06 +09:00
git d7de342e41 * 2020-10-14 [ci skip] 2020-10-14 03:18:18 +09:00
Koichi Sasada fc8b68a52a remove useless semicolons 2020-10-14 02:36:58 +09:00
Nobuyoshi Nakada a75ab110df
Use %VCVARS% 2020-10-13 14:16:29 +09:00
git 10e09ccaff * 2020-10-13 [ci skip] 2020-10-13 13:41:22 +09:00
Yusuke Endoh 76e09815ae test/ruby/test_fiber.rb: Suppress "assigned but unused variable" warnings 2020-10-13 13:40:44 +09:00
Yusuke Endoh 0b1b0f134e spec/ruby/library/socket/socket/listen_spec.rb: Allow both EACCES and EOPNOSUPP
on Android
2020-10-12 23:36:52 +09:00
Koichi Sasada bf3b2a4374 relax Fiber#transfer's restriction
Using Fiber#transfer with Fiber#resume for a same Fiber is
limited (once Fiber#transfer is called for a fiber, the fiber
can not be resumed more). This restriction was introduced to
protect the resume/yield chain, but we realized that it is too much
to protect the chain. Instead of the current restriction, we
introduce some other protections.

(1) can not transfer to the resuming fiber.
(2) can not transfer to the yielding fiber.
(3) can not resume transferred fiber.
(4) can not yield from not-resumed fiber.

[Bug #17221]

Also at the end of a transferred fiber, it had continued on root fiber.
However, if the root fiber resumed a fiber (and that fiber can resumed
another fiber), this behavior also breaks the resume/yield chain.
So at the end of a transferred fiber, switch to the edge of resume
chain from root fiber.
For example, root fiber resumed f1 and f1 resumed f2, transferred to
f3 and f3 terminated, then continue from the fiber f2 (it was continued
from root fiber without this patch).
2020-10-12 22:58:41 +09:00
Yusuke Endoh 2fd71112fb Make the test suite pass on real Android/Termux environment
Attempting to create a hard link raises EACCES
2020-10-12 21:26:05 +09:00
Cristian Greco 6527411f05 [ci skip] Minor documentation fix.
Add missing period.
2020-10-12 15:16:24 +09:00
tompng e8d03c9a2a change rb_ractor_queue to ring buffer 2020-10-12 14:20:58 +09:00
MSP-Greg c6652f223c ractor.rb - indent comment code [ci skip] 2020-10-12 13:56:11 +09:00
Yusuke Endoh eb21e8add3 bignum.c (bary_sparse_p): do not comsume Random::DEFAULT
It uses random to determine if the bignum is sparse or not.
It is arguable if three-digit samples are enough or not to determine it,
but anyway, consuming Random source implicitly is not good.

I introduced the random sampling mechanism, and I don't know any
significant reason to do so.  So, let's remove it.
This change makes the sampling points fixed: 40th, 50th, and 60th
percentiles.
2020-10-12 13:45:32 +09:00
Yusuke Endoh 8a39e6d653 bignum.c (rb_int_powm): Integer#pow(0, 1) should return 0
... instead of 1 because it requires "modulo 1".  [Bug #17257]
2020-10-12 13:42:48 +09:00
Victor Goff 1336698294 Respectively, instead of respentively 2020-10-12 13:08:13 +09:00
git 20d78fddb1 * 2020-10-12 [ci skip] 2020-10-12 01:53:56 +09:00
Nobuyoshi Nakada 4ed0c33d13
Prohibit setter method names in all kinds of endless methods
Also unwrap NODE_RIPPER to check the method name.
2020-10-12 00:40:55 +09:00
Nobuyoshi Nakada 27b48089e2
Adjusted indents [ci skip] 2020-10-11 14:22:43 +09:00
Nobuyoshi Nakada fddffa4c7a
Respect the original styles [ci skip] 2020-10-11 11:57:32 +09:00
Nobuyoshi Nakada 71428ac264 [ruby/io-console] Refined getch warnings
https://github.com/ruby/io-console/commit/f84e6abcce
2020-10-11 02:00:28 +09:00
Nobuyoshi Nakada 37259e878f [ruby/io-console] Relaxed min: option warning
When `min: 0` is given to `IO#getch` with `time:` option, it is
expected to return nil if timed out, and needed for source code
the compatibility with unixen platforms.

https://github.com/ruby/io-console/commit/a2afbe72bd
2020-10-11 02:00:26 +09:00
Nobuyoshi Nakada a79966743c [ruby/io-console] Fix timeout type error (#18)
Fixed TypeError when IO#getch timed out

`rb_io_wait` returns a bit-flags Integer representing available
events, or Qfalse if timed out.  Also the result of `NUM2INT` is
not a `VALUE`.

```
$ ./bin/ruby -v -rio/console -e "p IO.console.getch(intr: true, time: 0.1)"
ruby 3.0.0dev (2020-10-09T20:27:30Z master 5ea2ea74cc) [x64-mingw32]
-e:1:in `getch': no implicit conversion of false into Integer (TypeError)
        from -e:1:in `<main>'
```

https://github.com/ruby/io-console/commit/3bdfaf62df
2020-10-11 02:00:24 +09:00
git e10d4dce16 * 2020-10-11 [ci skip] 2020-10-11 01:28:01 +09:00
Nobuyoshi Nakada b59640e155
[ruby/io-console] Fixed "Rework console to use `rb_io_wait`."
* Fixed backward compatibility.
* Added missing `rb_scheduler_timeout` declaration.

https://github.com/ruby/io-console/commit/813806079f
2020-10-11 01:27:15 +09:00