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

63393 Коммитов

Автор SHA1 Сообщение Дата
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
Benoit Daloze bfc1c7205d Add Ractor#receive and Ractor.receive and use it in all places
* Keep Ractor#recv/Ractor.recv as an alias for now.
2020-10-10 12:48:09 +02:00
Soutaro Matsumoto 9eccf0711f
Update RBS to 0.13.1 (#3645) 2020-10-10 19:14:40 +09:00
S.H 5e120a2389
Improve doc in rb_class_real doc (#3637) 2020-10-10 04:52:21 -04:00
Ikko Ashimine df25007046 Fixed typo in comment
alway -> always
2020-10-10 02:32:21 -04:00
git 5ea2ea74cc * 2020-10-10 [ci skip] 2020-10-10 05:27:30 +09:00
Koichi Sasada a770b9c87e remove debug code 2020-10-10 04:46:09 +09:00
Soutaro Matsumoto 02e17d473a
Let bundled_gems specify commits to test (#3641) 2020-10-09 18:41:20 +09:00
Nobuyoshi Nakada 8d1b188864
Refactored lex_context management
Save and restore `lex_context` as-is wholely, and save in
`k_class` and `k_module` to workaround look-ahead reading.
2020-10-09 13:44:48 +09:00
Nobuyoshi Nakada 9ee99fbd8a
rb_const_set sets the class path now 2020-10-09 12:03:52 +09:00
Nobuyoshi Nakada 6944b927bd
rb_class_real never returns Qnil 2020-10-09 11:49:13 +09:00
Aaron Patterson bca8952fc7
Fix lldb disassembler so it works with core files
This fixes the lldb disassembler script so that it doesn't need a live
process when disassembling rb_iseq_t.  I also added the PC to the output
so you can tell what the VM is executing when it crashed.

For example:

```
(lldb) rbdisasm ec->cfp->iseq
PC             IDX  insn_name(operands)
0x56039f0a1720 0000 nop
0x56039f0a1728 0001 getlocal_WC_1( 5 )
0x56039f0a1738 0003 branchunless( 7 )
0x56039f0a1748 0005 getlocal_WC_0( 3 )
0x56039f0a1758 0007 putstring( (VALUE)0x56039f0c7eb8 )
0x56039f0a1768 0009 opt_send_without_block( (struct rb_call_data *)0x56039f09f140 )
0x56039f0a1778 0011 pop
0x56039f0a1780 0012 getglobal( ID: 0x7fd7 )
0x56039f0a1790 0014 branchunless( 7 )
0x56039f0a17a0 0016 getlocal_WC_0( 3 )
0x56039f0a17b0 0018 putstring( (VALUE)0x56039f0c7e90 )
0x56039f0a17c0 0020 opt_send_without_block( (struct rb_call_data *)0x56039f09f150 )
0x56039f0a17d0 0022 pop
0x56039f0a17d8 0023 getlocal_WC_0( 3 )
0x56039f0a17e8 0025 putobject( (VALUE)0x56039f0c7e68 )
0x56039f0a17f8 0027 getlocal_WC_1( 6 )
0x56039f0a1808 0029 dup
0x56039f0a1810 0030 checktype( 5 )
0x56039f0a1820 0032 branchif( 4 )
0x56039f0a1830 0034 dup
0x56039f0a1838 0035 opt_send_without_block( (struct rb_call_data *)0x56039f09f160 )
0x56039f0a1848 0037 tostring
0x56039f0a1850 0038 putobject( (VALUE)0x56039f0c7e40 )
0x56039f0a1860 0040 concatstrings( 3 )
0x56039f0a1870 0042 opt_send_without_block( (struct rb_call_data *)0x56039f09f170 )
0x56039f0a1880 0044 nop
0x56039f0a1888 0045 leave
(lldb) p ec->cfp->pc
(const VALUE *) $146 = 0x000056039f0a1848
```

Here we can see the VM is currently executing `opt_send_without_block`
(because the PC is one ahead of the current instruction)
2020-10-08 16:43:11 -07:00
git c857d0d471 * 2020-10-09 [ci skip] 2020-10-09 05:35:37 +09:00
Burdette Lamar 33776598f7
Enhanced RDoc for String#insert (#3643)
* Enhanced RDoc for String#insert
2020-10-08 15:35:13 -05:00
Hiroshi SHIBATA 533bca57e0
Expose assert, assert_respond_to and assert_not_respond_to for default gems. 2020-10-08 16:40:46 +09:00
Hiroshi SHIBATA 0f9edf2f48
Promote prettyprint to default gems 2020-10-08 16:40:46 +09:00
Hiroshi SHIBATA 2711e3bab9
Promote pp to default gems 2020-10-08 16:40:46 +09:00
git 0807d05d6e * 2020-10-08 [ci skip] 2020-10-08 09:01:36 +09:00
Aaron Patterson d528254095
Add missing WB for iseq
The write barrier wasn't being called for this object, so add the
missing WB.  Automatic compaction moved the reference because it didn't
know about the relationship (that's how I found the missing WB).
2020-10-07 17:01:14 -07:00
Nobuyoshi Nakada 62abdbadf2
Revert "Don't export rb_callable_receiver"
This reverts commit c839168b11.
`rb_callable_receiver` does not need to be exposed under include.
2020-10-07 11:27:30 +09:00
Aaron Patterson cdc4084b0a Prevent objects from moving while iterating the heap
This iterator uses an st_table, but if objects move the references in
the st table won't be updated.  This patch just changes the st table to
an identity hash.
2020-10-06 16:22:01 -07:00
Chris Seaton c839168b11 Don't export rb_callable_receiver 2020-10-06 15:41:47 -07:00
Chris Seaton fef52122b0 Use proc_binding rather than rb_funcall
FIX
2020-10-06 15:41:47 -07:00
Aaron Patterson ee7cc6ac35
Make `marshal_load` public
Ruby specs expected this method to be public
2020-10-06 15:13:49 -07:00