Commit graph

64552 commits

Author SHA1 Message Date
Hiroshi SHIBATA
2f24818319
Promote open-uri to default gems 2020-09-11 20:38:18 +09:00
Soutaro Matsumoto
f0ddbd502c
Let String#slice! return nil (#3533)
Returns `nil` instead of an empty string when non-integer number is given (to make it 2.7 compatible).
2020-09-11 14:34:10 +09:00
Nobuyoshi Nakada
0d78390bfb
rbinstall.rb: OpenStruct has not been needed for years
Since 6f3e8df133 in 2014.
2020-09-11 13:26:20 +09:00
Kazuhiro NISHIYAMA
406559a268
Add missing break
pointed out by Coverity Scan
2020-09-11 11:02:24 +09:00
Hiroshi SHIBATA
d55c914f0f Removed DRb.default_safe_level and DRb#safe_level 2020-09-11 10:52:52 +09:00
Hiroshi SHIBATA
e691e671ca Removed Thread#safe_level 2020-09-11 10:52:52 +09:00
git
440ab313d0 * 2020-09-11 [ci skip] 2020-09-11 00:49:18 +09:00
Matt Valentine-House
ef22af4db0 If the GC runs before the Mutex's are initialised then we get a crash in pthread_mutex_lock.
It is possible for GC to run during initialisation due to objects being allocated
2020-09-10 08:48:51 -07:00
Hiroshi SHIBATA
867204c4a5
Promote syslog to default gems 2020-09-10 20:42:53 +09:00
Hiroshi SHIBATA
cf76a4a5c2
Promote base64 to default gems 2020-09-10 18:56:17 +09:00
Hiroshi SHIBATA
cf681038d6
Promote shellwords to default gems 2020-09-10 18:56:17 +09:00
Hiroshi SHIBATA
cee8e95761
Promote abbrev to default gems 2020-09-10 18:56:16 +09:00
Koichi Sasada
ea78960ee5 sync callable_method_entry()
callable_method_entry() read/write method table structures so that
this function should be synchronized between Ractors.
2020-09-10 18:44:02 +09:00
Aaron Patterson
475c8701d7 Make SecureRandom support Ractor
SecureRandom lazily defines `get_random`.  Accessing the mutex to define
the `get_random` method is not supported inside a Ractor.  This commit
defines `gen_random` when `securerandom` is required and makes it
suppore Ractor (as well as thread safe).

Here is a test program:

```ruby
require "securerandom"

r = Ractor.new do
  loop do
    Ractor.yield SecureRandom.hex
  end
end

p r.take
```

Before this commit:

```
$ make runruby
./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems ./test.rb
<internal:ractor>:38: warning: Ractor is experimental, and the behavior may change in future versions of Ruby! Also there are many implementation issues.
/Users/aaron/git/ruby/lib/securerandom.rb:94:in `gen_random': can not access instance variables of classes/modules from non-main Ractors (RuntimeError)
<internal:ractor>:124:in `take': thrown by remote Ractor. (Ractor::RemoteError)
	from ./test.rb:9:in `<main>'
/Users/aaron/git/ruby/lib/securerandom.rb:94:in `gen_random': can not access instance variables of classes/modules from non-main Ractors (RuntimeError)
	from /Users/aaron/git/ruby/lib/securerandom.rb:155:in `random_bytes'
	from /Users/aaron/git/ruby/lib/securerandom.rb:176:in `hex'
	from ./test.rb:5:in `block (2 levels) in <main>'
	from ./test.rb:4:in `loop'
	from ./test.rb:4:in `block in <main>'
make: *** [runruby] Error
```

After this commit:

```
$ make runruby
./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems ./test.rb
<internal:ractor>:38: warning: Ractor is experimental, and the behavior may change in future versions of Ruby! Also there are many implementation issues.
"3fc8885157e3911bab4b5d7619bb0308"
```
2020-09-09 12:45:43 -07:00
Jean Boussier
5001cc4716 Optimize ObjectSpace.dump_all
The two main optimization are:
  - buffer writes for improved performance
  - avoid formatting functions when possible

```

|                   |compare-ruby|built-ruby|
|:------------------|-----------:|---------:|
|dump_all_string    |       1.038|   195.925|
|                   |           -|   188.77x|
|dump_all_file      |      33.453|   139.645|
|                   |           -|     4.17x|
|dump_all_dev_null  |      44.030|   278.552|
|                   |           -|     6.33x|
```
2020-09-09 11:11:36 -07:00
git
76c7146ab4 * 2020-09-10 [ci skip] 2020-09-10 00:05:36 +09:00
Jean Boussier
b49a870414 Add a :since option to dump_all
This is useful to see what a block of code allocated, e.g.

```
GC.start
GC.disable
ObjectSpace.trace_object_allocations do
  # run some code
end
gc_gen = GC.count
allocations = ObjectSpace.dump_all(output: :file, since: gc_gen)
GC.enable
GC.start
retentions = ObjectSpace.dump_all(output: :file, since: gc_gen)
```
2020-09-09 08:05:14 -07:00
Hiroshi SHIBATA
01828a955a
Promote tsort to default gems 2020-09-09 21:53:09 +09:00
Hiroshi SHIBATA
b194973dcd
Revert the related commits about Tempfile.open change.
Start with fa21985a7a
  to d7492a0be8
2020-09-09 21:10:48 +09:00
Jeremy Evans
6997109fca [ruby/tempfile] Revert Tempfile.open unlinking the file
Document difference in behavior between Tempfile.open and
Tempfile.create.

426d6f887f
2020-09-09 20:15:41 +09:00
git
96f2b2e086 * 2020-09-09 [ci skip] 2020-09-09 01:23:52 +09:00
Takashi Kokubun
65ab2385e3
Use size_t for MJIT's max_ivar_index
iseq_inline_iv_cache_entry's index is also size_t.
%"PRIuSIZE" seems to print warnings against st_index_t in some environments.
2020-09-08 09:22:34 -07:00
Hiroshi SHIBATA
b7d86e330c
Workaroud for macOS Big Sur(11.0) 2020-09-08 20:39:23 +09:00
Hiroshi SHIBATA
cdef17096c
libSystem.dylib is also symlink. Use libSystem.B.dylib 2020-09-08 20:38:01 +09:00
Hiroshi SHIBATA
0168094da2
Use libSystem.dylib instead of libm.dylib and libc.dylib
Because macOS 11.0(Big Sur) was removed libc and libm from `/usr/lib`.
2020-09-08 19:35:15 +09:00
git
4530bea88c * 2020-09-08 [ci skip] 2020-09-08 10:31:51 +09:00
Kazuhiro NISHIYAMA
5be75aad37
Add FALLTHROUGH
Pointed out by Coverity Scan

```
** CID 1466646: Control flow issues (MISSING_BREAK)
/ext/-test-/random/loop.c: 63 in loop_get_bytes()
```
2020-09-08 10:30:07 +09:00
Nobuyoshi Nakada
2b07b24bdf Added rb_random_base_init
To enclose the initialization of Random::Base part.
2020-09-07 20:08:01 +09:00
Nobuyoshi Nakada
4924011262 Added WITH_REAL macros
Added `WITH_REAL` versions to `RB_RANDOM_INTERFACE` macros.  Also
these macros including "without real" versions no longer contain
the terminator (semicolon and comma).
2020-09-07 20:08:01 +09:00
Nobuyoshi Nakada
d6ec0ef59b Added get_real interface 2020-09-07 20:08:01 +09:00
Nobuyoshi Nakada
c449b9b02f Added rb_int_pair_to_real 2020-09-07 20:08:01 +09:00
Nobuyoshi Nakada
af5e87ab21 separate rb_random_t
* random.c: separate abstract rb_random_t and rb_random_mt_t for
  Mersenne Twister implementation.

* include/ruby/random.h: the interface for extensions of Random
  class.

* DLL imported symbol reference is not constant on Windows.

* check if properly initialized.
2020-09-07 20:08:01 +09:00
Nobuyoshi Nakada
f4d5273989 Random::Base
* random.c (InitVM_Random): introduce abstract super class
  Random::Base.
2020-09-07 20:08:01 +09:00
卜部昌平
19917d45a3 .github: try GitHub Container Registry
It is natural for a CI running on GitHub to use GitHub's facility.

See also https://github.blog/2020-09-01-introducing-github-container-registry/
2020-09-07 19:02:45 +09:00
git
17a27060a7 * 2020-09-07 [ci skip] 2020-09-07 13:29:42 +09:00
Nobuyoshi Nakada
0dbf6e46fb
[Feature #17157] removed -T command line option 2020-09-07 00:59:53 +09:00
Samuel Williams
b22b3f03f4 Increase timeout for GitHub Actions. 2020-09-06 22:11:49 +12:00
Kazuhiro NISHIYAMA
c19f8f6263
Add *.md to doc/.document [ci skip] 2020-09-06 19:05:30 +09:00
Yusuke Endoh
369cfabd59 Make it possible to dump and load an exception object
A backtrace object in an exception had never supported marshalling
correctly: `Marshal.load(Marshal.dump(exc)).backtrace_locations` dumped
core.

An Exception object has two hidden instance varibles for backtrace data:
one is "bt", which has an Array of Strings, and the other is
"bt_locations", which has an Array of Thread::Backtrace::Locations.
However, Exception's dump outputs data so that the two variables are the
same Array of Strings. Thus, "bt_locations" had a wrong-type object.

For the compatibility, it is difficult to change the dump format.  This
changeset fixes the issue by ignoring data for "bt_locations" at the
loading phase if "bt_locations" refers to the same object as "bt".

Future work: Exception's dump should output "bt_locations"
appropriately.

https://bugs.ruby-lang.org/issues/17150
2020-09-06 13:57:41 +09:00
Samuel Williams
c12b2703bc Add RB_ prefix for size_t to number conversion. 2020-09-06 15:37:54 +12:00
Ashwin Elangovan
40c06e6fe1
Fixed some typos in ractor.md (#3522) 2020-09-05 15:58:31 -04:00
git
dfefe0e0d0 * 2020-09-06 [ci skip] 2020-09-06 01:59:20 +09:00
Kazuhiro NISHIYAMA
776b3df490
Fix typos [ci skip] 2020-09-06 01:58:44 +09:00
Nobuyoshi Nakada
170c7528e6
common.mk: UNALIGNED_MEMBER_ACCESS needs internal/warnings.h on some platforms 2020-09-05 23:16:26 +09:00
Nobuyoshi Nakada
dd83d0c599
update-deps: ruby-runner is not a target 2020-09-05 23:16:23 +09:00
Nobuyoshi Nakada
5c49bb5486
Removed useless casts 2020-09-05 17:34:12 +09:00
andrewmelis
72757fb596 Fix typo in ractor.md 2020-09-05 17:21:43 +09:00
Tom Schady
de30450d91 Fix typos in Ractor README. 2020-09-04 12:41:35 -04:00
git
1c8fe90760 * 2020-09-05 [ci skip] 2020-09-05 00:42:35 +09:00
Nobuyoshi Nakada
f943566d1c
break around function definition [ci skip] 2020-09-05 00:34:58 +09:00