1532 Commits

Author SHA1 Message Date
Nobuyoshi Nakada
bf5711f498
Check ruby-related includes only [ci skip] 2021-09-11 15:01:22 +09:00
Hiroshi SHIBATA
934feb1dee Removed minitest dir from make task 2021-09-11 08:48:03 +09:00
卜部昌平
a310f896db common.mk: update dependencies 2021-09-10 20:00:06 +09:00
Nobuyoshi Nakada
3562c7ba33
Update the list of replacing objects under missing 2021-08-27 12:43:45 +09:00
Nobuyoshi Nakada
04be8e84db
Use C99-defined macros to classify a floating-point number 2021-08-27 12:41:30 +09:00
Yusuke Endoh
b44741f5dc tool/test-bundled-gems.rb: Use the bundled RBS code to test TypeProf
Formerly, TypeProf was tested with the latest RBS code during
`make test-bundled-gems`. However, when a new version of rbs is
released, and if it is incompatible with TypeProf,
`make test-bundled-gems` starts failing, which was annoying.

By this change, TypeProf is tested with the bundled version of RBS.
2021-08-25 11:13:17 +09:00
Yusuke Endoh
4a6b5f4622 Revert "tool/test-bundled-gems.rb: Use the bundled RBS code to test TypeProf"
This reverts commit 22deda43cb98aa3cee48d0bebbff7c4db1d7652a.

It was incomplete. Sorry!
2021-08-24 18:08:16 +09:00
Yusuke Endoh
22deda43cb tool/test-bundled-gems.rb: Use the bundled RBS code to test TypeProf
Formerly, TypeProf was tested with the latest RBS code during
`make test-bundled-gems`. However, when a new version of rbs is
released, and if it is incompatible with TypeProf,
`make test-bundled-gems` starts failing, which was annoying.

By this change, TypeProf is tested with the bundled version of RBS.
2021-08-24 17:43:11 +09:00
Nobuyoshi Nakada
c38c2d8ee2 Moved exported symbols in internal/util.h to ruby/util.h
[Feature #18051]
2021-08-24 10:37:41 +09:00
Benoit Daloze
e57a1cc20c ruby/spec no longer needs webrick to run 2021-08-13 18:15:02 +02:00
Nobuyoshi Nakada
6e60fc2945
Group commands on GitHub Actions 2021-08-07 18:32:24 +09:00
Martin Dürst
01e98d8785 Change Unicode Emoji Version from 13.0 to 13.1 2021-07-27 17:10:49 +09:00
Nobuyoshi Nakada
fa239e0479
Remove unneeded quotes [ci skip] 2021-07-19 17:18:51 +09:00
Samuel Williams
6073a8bdc0 Add debug assertion in rb_funcall* that the current thread has the gvl. 2021-07-16 17:32:02 +12:00
Martin Dürst
b6113a3fd8 Update common.mk to deal with Unicode version 13.0.0
- Change Unicode version to 13.0.0
- Change Emoji version to 13.0
- Adjust to moved locations of emoji-data.txt and emoji-variation-sequences.txt
  by splitting these files from $(UNICODE_EMOJI_FILES) and putting them into
  a new group $(UNICODE_UCD_EMOJI_FILES)
2021-07-08 14:45:03 +09:00
Nobuyoshi Nakada
cca2f7ab14
programs will be made from exts
`programs` after `exts` overwrites programs built with extension
libraries when static-linked-ext.
2021-07-05 11:17:42 +09:00
Nobuyoshi Nakada
ac6924e10e
goruby.c: include golf_prelude.c to get rid of overwriting EXTOBJS 2021-07-03 22:39:14 +09:00
Nobuyoshi Nakada
0feec79846
"nodoc" needs to exclude "doc" [ci skip] 2021-06-30 19:56:37 +09:00
eileencodes
b91b3bc771 Add a cache for class variables
Redo of 34a2acdac788602c14bf05fb616215187badd504 and
931138b00696419945dc03e10f033b1f53cd50f3 which were reverted.

GitHub PR #4340.

This change implements a cache for class variables. Previously there was
no cache for cvars. Cvar access is slow due to needing to travel all the
way up th ancestor tree before returning the cvar value. The deeper the
ancestor tree the slower cvar access will be.

The benefits of the cache are more visible with a higher number of
included modules due to the way Ruby looks up class variables. The
benchmark here includes 26 modules and shows with the cache, this branch
is 6.5x faster when accessing class variables.

```
compare-ruby: ruby 3.1.0dev (2021-03-15T06:22:34Z master 9e5105c) [x86_64-darwin19]
built-ruby: ruby 3.1.0dev (2021-03-15T12:12:44Z add-cache-for-clas.. c6be009) [x86_64-darwin19]

|         |compare-ruby|built-ruby|
|:--------|-----------:|---------:|
|vm_cvar  |      5.681M|   36.980M|
|         |           -|     6.51x|
```

Benchmark.ips calling `ActiveRecord::Base.logger` from within a Rails
application. ActiveRecord::Base.logger has 71 ancestors. The more
ancestors a tree has, the more clear the speed increase. IE if Base had
only one ancestor we'd see no improvement. This benchmark is run on a
vanilla Rails application.

Benchmark code:

```ruby
require "benchmark/ips"
require_relative "config/environment"

Benchmark.ips do |x|
  x.report "logger" do
    ActiveRecord::Base.logger
  end
end
```

Ruby 3.0 master / Rails 6.1:

```
Warming up --------------------------------------
              logger   155.251k i/100ms
Calculating -------------------------------------
```

Ruby 3.0 with cvar cache /  Rails 6.1:

```
Warming up --------------------------------------
              logger     1.546M i/100ms
Calculating -------------------------------------
              logger     14.857M (± 4.8%) i/s -     74.198M in   5.006202s
```

Lastly we ran a benchmark to demonstate the difference between master
and our cache when the number of modules increases. This benchmark
measures 1 ancestor, 30 ancestors, and 100 ancestors.

Ruby 3.0 master:

```
Warming up --------------------------------------
            1 module     1.231M i/100ms
          30 modules   432.020k i/100ms
         100 modules   145.399k i/100ms
Calculating -------------------------------------
            1 module     12.210M (± 2.1%) i/s -     61.553M in   5.043400s
          30 modules      4.354M (± 2.7%) i/s -     22.033M in   5.063839s
         100 modules      1.434M (± 2.9%) i/s -      7.270M in   5.072531s

Comparison:
            1 module: 12209958.3 i/s
          30 modules:  4354217.8 i/s - 2.80x  (± 0.00) slower
         100 modules:  1434447.3 i/s - 8.51x  (± 0.00) slower
```

Ruby 3.0 with cvar cache:

```
Warming up --------------------------------------
            1 module     1.641M i/100ms
          30 modules     1.655M i/100ms
         100 modules     1.620M i/100ms
Calculating -------------------------------------
            1 module     16.279M (± 3.8%) i/s -     82.038M in   5.046923s
          30 modules     15.891M (± 3.9%) i/s -     79.459M in   5.007958s
         100 modules     16.087M (± 3.6%) i/s -     81.005M in   5.041931s

Comparison:
            1 module: 16279458.0 i/s
         100 modules: 16087484.6 i/s - same-ish: difference falls within error
          30 modules: 15891406.2 i/s - same-ish: difference falls within error
```

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-06-18 10:02:44 -07:00
Nobuyoshi Nakada
43ed1e68a1
Make ext directory before extinit.c when out-of-place build 2021-06-16 00:08:28 +09:00
Takashi Kokubun
d281fc525d
Add missing dependencies
https://github.com/ruby/ruby/runs/2791163586?check_suite_focus=true
2021-06-10 00:53:28 -07:00
Takashi Kokubun
c5e8a49bde
Avoid enqueueing the same ISeq twice
by a race condition by multiple Ractors.

Atmically incrementing body->total_calls may have its own cost, so for
now we intentionally leave the unreliable total_calls. So we allow an
ISeq to be never pushed when you use multiple Ractors. However, if you
enqueue a single ccan node twice, get_from_list loops infinitely. Thus
this patch takes care of such a situation.
2021-06-10 00:32:24 -07:00
S.H
28b481938b
Implemented some NilClass method in Ruby code is faster [Feature #17054] (#3366) 2021-06-02 20:04:56 -07:00
Takashi Kokubun
1aac0e8819
Mark inlined ISeqs during MJIT compilation (#4539)
[Bug #17584]
2021-05-30 21:42:02 -07:00
卜部昌平
2bc293e899 cdhash_cmp: can take rational literals
Rational literals are those integers suffixed with `r`.  They tend to
be a part of more complex expressions like `123/456r`, but in theory
they can live alone.  When such "bare" rational literals are passed to
case-when branch, we have to take care of them.  Fixes [Bug #17854]
2021-05-12 10:30:46 +09:00
Aaron Patterson
07f055bb13
Revert "Filling cache values on cvar write"
This reverts commit 08de37f9fa3469365e6b5c964689ae2bae0eb9f3.
This reverts commit e8ae922b62adb00a80d3d4c49f7d7b0e6026eaba.
2021-05-11 13:31:00 -07:00
eileencodes
e8ae922b62 Add a cache for class variables
This change implements a cache for class variables. Previously there was
no cache for cvars. Cvar access is slow due to needing to travel all the
way up th ancestor tree before returning the cvar value. The deeper the
ancestor tree the slower cvar access will be.

The benefits of the cache are more visible with a higher number of
included modules due to the way Ruby looks up class variables. The
benchmark here includes 26 modules and shows with the cache, this branch
is 6.5x faster when accessing class variables.

```
compare-ruby: ruby 3.1.0dev (2021-03-15T06:22:34Z master 9e5105ca45) [x86_64-darwin19]
built-ruby: ruby 3.1.0dev (2021-03-15T12:12:44Z add-cache-for-clas.. c6be0093ae) [x86_64-darwin19]

|         |compare-ruby|built-ruby|
|:--------|-----------:|---------:|
|vm_cvar  |      5.681M|   36.980M|
|         |           -|     6.51x|
```

Benchmark.ips calling `ActiveRecord::Base.logger` from within a Rails
application. ActiveRecord::Base.logger has 71 ancestors. The more
ancestors a tree has, the more clear the speed increase. IE if Base had
only one ancestor we'd see no improvement. This benchmark is run on a
vanilla Rails application.

Benchmark code:

```ruby
require "benchmark/ips"
require_relative "config/environment"

Benchmark.ips do |x|
  x.report "logger" do
    ActiveRecord::Base.logger
  end
end
```

Ruby 3.0 master / Rails 6.1:

```
Warming up --------------------------------------
              logger   155.251k i/100ms
Calculating -------------------------------------
```

Ruby 3.0 with cvar cache /  Rails 6.1:

```
Warming up --------------------------------------
              logger     1.546M i/100ms
Calculating -------------------------------------
              logger     14.857M (± 4.8%) i/s -     74.198M in   5.006202s
```

Lastly we ran a benchmark to demonstate the difference between master
and our cache when the number of modules increases. This benchmark
measures 1 ancestor, 30 ancestors, and 100 ancestors.

Ruby 3.0 master:

```
Warming up --------------------------------------
            1 module     1.231M i/100ms
          30 modules   432.020k i/100ms
         100 modules   145.399k i/100ms
Calculating -------------------------------------
            1 module     12.210M (± 2.1%) i/s -     61.553M in   5.043400s
          30 modules      4.354M (± 2.7%) i/s -     22.033M in   5.063839s
         100 modules      1.434M (± 2.9%) i/s -      7.270M in   5.072531s

Comparison:
            1 module: 12209958.3 i/s
          30 modules:  4354217.8 i/s - 2.80x  (± 0.00) slower
         100 modules:  1434447.3 i/s - 8.51x  (± 0.00) slower
```

Ruby 3.0 with cvar cache:

```
Warming up --------------------------------------
            1 module     1.641M i/100ms
          30 modules     1.655M i/100ms
         100 modules     1.620M i/100ms
Calculating -------------------------------------
            1 module     16.279M (± 3.8%) i/s -     82.038M in   5.046923s
          30 modules     15.891M (± 3.9%) i/s -     79.459M in   5.007958s
         100 modules     16.087M (± 3.6%) i/s -     81.005M in   5.041931s

Comparison:
            1 module: 16279458.0 i/s
         100 modules: 16087484.6 i/s - same-ish: difference falls within error
          30 modules: 15891406.2 i/s - same-ish: difference falls within error
```

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-05-11 12:04:27 -07:00
Nobuyoshi Nakada
6943ffc3d5
Split revision.h rule
GNU-make specific rule is defined in defs/gmake.mk.
2021-04-18 13:47:43 +09:00
卜部昌平
6413dc27dc dependency updates 2021-04-13 14:30:21 +09:00
Nobuyoshi Nakada
12f7ba5ed4
Make String#crypt ractor-safe 2021-04-13 12:05:31 +09:00
Nobuyoshi Nakada
68a6f6c4ab
mac: ignore SDKROOT at installation 2021-04-10 11:57:45 +09:00
Nobuyoshi Nakada
041a4f9a5e
Stop downloading Unicode files twice
These files should have been downloaded in update-remote.
2021-03-26 00:38:35 +09:00
Kazuhiro NISHIYAMA
f45bed0a6e
Use XRUBY to expand path instead of platform dependent 2021-03-25 18:06:06 +09:00
Nobuyoshi Nakada
e7dc6f2a3c
Generate encoding header before enc.mk
As some encodings need the corresponding header.
2021-03-25 17:10:53 +09:00
Nobuyoshi Nakada
cda60ee6d5
Keep unicode_normalize/tables.rb as-is
Define no dependency unless ALWAYS_UPDATE_UNICODE is set to yes,
so that `make prog` works in a just-checkedout working directory.
2021-03-25 15:45:20 +09:00
Kazuhiro NISHIYAMA
12812c2bdf
Fix test-bundler-parallel errors when out-of-place build 2021-03-25 14:59:15 +09:00
Nobuyoshi Nakada
b1149bf305
Make the commit of updated bundled_gems file 2021-02-16 19:54:16 +09:00
Nobuyoshi Nakada
4f47d655e3 Added Thread::Backtrace.limit [Feature #17479] 2021-02-15 18:29:35 +09:00
Takashi Kokubun
27382eb9fc
Add a benchmark-driver runner for Ractor (#4172)
* Add a benchmark-driver runner for Ractor

* Process.clock_gettime(Process:CLOCK_MONOTONIC) could be slow

in Ruby 3.0 Ractor

* Fetching Time could also be slow

* Fix a comment

* Assert overriding a private method
2021-02-10 21:24:25 -08:00
Samuel Williams
5f69a7f604
Expose scheduler as public interface & bug fixes. (#3945)
* Rename `rb_scheduler` to `rb_fiber_scheduler`.

* Use public interface if available.

* Use `rb_check_funcall` where possible.

* Don't use `unblock` unless the fiber was non-blocking.
2021-02-09 19:39:56 +13:00
Nobuyoshi Nakada
0dd38902b9
Ignore warnings when transforming preprocessed header
For already preprocessed header, -Werror=misleading-indentation
doesn't make sense.
2021-02-01 18:16:39 +09:00
Nobuyoshi Nakada
ed6dc066b6
CFLAGS includes ARCH_FLAG 2021-01-26 22:19:00 +09:00
Nobuyoshi Nakada
4de228b6bc
Sort autogenerated dependencies [ci skip] 2021-01-23 20:56:15 +09:00
Nobuyoshi Nakada
899b950647
Remove common output directory 2021-01-22 18:37:31 +09:00
Takashi Kokubun
5cf6229ee9
Skip updating exts in also test-spec to reduce the turnaround time (#4089)
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>

Partially reversing a4f3e1762aa195969ace000ac0dc8d300dda85cb like 21df4dce5308bb0e04e09dc654cdc92af000caf6.
We usually run them through make check which has the dependency, and test-all and test-spec without the dependency are useful for running only individual tests.
2021-01-18 07:14:02 -08:00
Nobuyoshi Nakada
2adbf01ae1
dtoa.c: make thread-safe by using atomic CAS 2021-01-10 18:19:53 +09:00
Koichi Sasada
e91160f757 set RUBY_ON_BUG on runruby rule.
set RUBY_ON_BUG='gdb -x $(srcdir)/.gdbinit -p' to catch SEGV
on `make runruby` rule.
2021-01-05 16:50:00 +09:00
Nobuyoshi Nakada
3adf84a079
Commented out the sh-specific code, in cmd.exe 2021-01-05 11:53:41 +09:00
Takashi Kokubun
cf4a6b5e7b
Add a missing dependency 2021-01-03 22:48:13 -08:00
Takashi Kokubun
4182035e27
Add -v to make benchmark
I simply can't tell which of compare-ruby and built-ruby is what.
2021-01-01 18:41:22 -08:00