| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
| |
Coverity Scan emulates gcc but seems not to support this attribute
correctly.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
* --braces-after-func-def-line
* --dont-cuddle-else
* --procnames-start-lines
* --space-after-for
* --space-after-if
* --space-after-while
|
|
|
| |
Co-authored-by: Bruno Sutic <code@brunosutic.com>
|
| |
|
|
|
|
|
| |
This reverts commit 08de37f9fa3469365e6b5c964689ae2bae0eb9f3.
This reverts commit e8ae922b62adb00a80d3d4c49f7d7b0e6026eaba.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
This function should be always available, as POSIX-compliant or
Windows platform are required since 1.9. Also the code in this
file is MT-unsafe.
|
|
|
|
| |
Not against having such thing but currently we lack one.
|
| |
|
| |
|
|
|
|
| |
ENUM_OVER_INT is sometimes not defined. Use #ifdef instead if #if.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* See [Feature #17752]
* Defining explicitly to 0 seems the best solution, see https://github.com/ruby/ruby/pull/4428
* For example:
./include/ruby/internal/has/builtin.h:49:33: error: "RBIMPL_HAS_BUILTIN___builtin_assume" is not defined, evaluates to 0 [-Werror=undef]
49 | # define RBIMPL_HAS_BUILTIN(_) (RBIMPL_HAS_BUILTIN_ ## _)
| ^~~~~~~~~~~~~~~~~~~
./include/ruby/internal/assume.h:75:7: note: in expansion of macro ‘RBIMPL_HAS_BUILTIN’
75 | #elif RBIMPL_HAS_BUILTIN(__builtin_assume)
| ^~~~~~~~~~~~~~~~~~
|
|
|
|
| |
* See [Feature #17752]
|
|
|
|
|
|
|
| |
* It evaluated to 0 before, revealed by -Wundef
* See [Feature #17752]
Co-authored-by: xtkoba (Tee KOBAYASHI) <xtkoba+ruby@gmail.com>
|
|
|
|
|
|
| |
* See [Feature #17752]
Co-authored-by: xtkoba (Tee KOBAYASHI) <xtkoba+ruby@gmail.com>
|
| |
|
|
|
|
|
|
| |
This is just a hoax. Nobody have ever implemented a function named as
such. Also the functionality implied by the name must not be a public
API if any.
|
|
|
|
| |
Not only NUM2LL, also LL2NUM, ULL2NUM and NUM2ULL.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previous code failed to compile on MSVC. Log:
https://github.com/ruby/ruby/pull/4371/checks?check_run_id=2304484466
This is possibly due to the fact that:
1. `Data_Wrap_Struct(...)` appears in a source code
2. which expands to `rb_data_object_wrap(...)`
3. which expands to `RUBY_MACRO_SELECT(rb_data_object_wrap_, RUBY_UNTYPED_DATA_WARNING)`
4. which expands to `rb_data_object_wrap_0`
5. which expands to `rb_data_object_wrap`, so far so good, but
6. this is a recursive macro expansion (see step 2). Everybody stops expanding...
- in step 4 for MSVC, and
- in step 5 for GCC etc.
I have no idea why but this proposed changeset prevents MSVC from
stopping at step 4.
|
| |
|
|
|
|
|
| |
Use of TOKEN_PASTE was a bad idea at the first place. Just use ##
everywhere. Nobody practically lacks token pasting.
|
| |
|
| |
|
|
|
|
|
| |
# Conflicts:
# scheduler.c
|
| |
|
|
|
| |
a.out format is considered extinct nowadays.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
Deleted decades ago in commit 6e0fed271c1d2e6f2b13b99d89d43e7d00e81472
Note also that we eventually ended up reinventing this exact same
functionality. It is called rb_check_id() now.
|
|
|
|
|
|
| |
It existed since f3d022543ef2afde3d53e7f6b3028eafe39d0ef4 until
96760236079b15674a6322a2ca41b1528b51afbd. No official releases included
the actual function. The declaration shall be deleted.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If the use of the ruby namespace isn't prepended by `::` to make it
explicit that the global ruby namespace is referenced here, it can
clash with other non-global namespace named ruby, e.g.
```
// declaration
namespace myproject {
namespace ruby {
// my ruby classes
}
}
// implementation
using namespace myproject;
[...]
rb_define_method(...);
[...]
```
leads to the following error:
```
../ruby/choice.cc: In function 'void {anonymous}::do_register_choice()':
../ruby/choice.cc:342:9: error: reference to 'ruby' is ambiguous
342 | rb_define_method(c_choices, "each", RUBY_FUNC_CAST(&choices_each), 0);
| ^~~~~~~~~~~~~~~~
In file included from ../ruby/choice.cc:20:
../ruby/paludis_ruby.hh:53:15: note: candidates are: 'namespace paludis::ruby { }'
53 | namespace ruby
| ^~~~
In file included from /usr/x86_64-pc-linux-gnu/include/ruby-3.0/ruby/backward/2/stdalign.h:23,
from /usr/x86_64-pc-linux-gnu/include/ruby-3.0/ruby/defines.h:77,
from /usr/x86_64-pc-linux-gnu/include/ruby-3.0/ruby/ruby.h:23,
from /usr/x86_64-pc-linux-gnu/include/ruby-3.0/ruby.h:38,
from ../ruby/paludis_ruby.hh:44,
from ../ruby/choice.cc:20:
/usr/x86_64-pc-linux-gnu/include/ruby-3.0/ruby/internal/stdalign.h:92:11: note: 'namespace ruby { }'
92 | namespace ruby {
| ^~~~
In file included from /usr/x86_64-pc-linux-gnu/include/ruby-3.0/ruby/internal/anyargs.h:83,
from /usr/x86_64-pc-linux-gnu/include/ruby-3.0/ruby/ruby.h:24,
from /usr/x86_64-pc-linux-gnu/include/ruby-3.0/ruby.h:38,
from ../ruby/paludis_ruby.hh:44,
from ../ruby/choice.cc:20:
../ruby/choice.cc:342:9: error: '::define' has not been declared
342 | rb_define_method(c_choices, "each", RUBY_FUNC_CAST(&choices_each), 0);
| ^~~~~~~~~~~~~~~~
../ruby/choice.cc:344:9: error: reference to 'ruby' is ambiguous
344 | rb_define_method(c_choices, "find_by_name_with_prefix", RUBY_FUNC_CAST(&choices_find_by_name_with_prefix), 1);
| ^~~~~~~~~~~~~~~~
```
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
| |
It is questionable whether we can change a public API but this function
does not exist today. No way.
|
|
|
|
|
| |
https://github.com/ruby/ruby/pull/4100#pullrequestreview-576059827
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
|
|
| |
cf: https://github.com/ruby/ruby/pull/4100#pullrequestreview-575952836
|
|
|
|
|
|
|
|
| |
They are no longer how Object#clone/Object#dup are defined. In fact
DUPSETUP is not used from anywhere. CLONESETUP has only one usage.
Let's not expose them to extension libraries.
cf https://github.com/ruby/ruby/pull/4100#discussion_r563481718
|
|
|
|
|
|
|
|
|
| |
See also https://gcc.gnu.org/gcc-6/changes.html
Clang has this feature when __has_extension(enumerator_attributes) is
set.
MSVC has #pragma deprecated instead.
|
|
|
|
|
|
|
|
| |
matz said in [ruby-core:94979]:
> 3.0:
> * taint/trust/untaint/untrust non-verbose warning when called
This is it, for C extensions.
|
|
|
|
|
|
|
|
|
| |
Now that RUBY_FL_TAINT is recycled to become new RUBY_FL_SHAREABLE.
Setting/clearing this flag from extension libraries break Ractor.
Especially problematic one is OBJ_INFECT, which would make non-shareable
objects travel across Ractor boundaries.
Such operations should just be prohibited.
|
|
|
|
|
| |
It seems I broke them in commit 9e6e39c3512f7a962c44dc3729c98a0f8be90341
Sorry!
|
| |
|
|
|
|
|
|
|
| |
iff means if and only if, but readers without that knowledge might
assume this to be a spelling mistake. To me, this seems like
exclusionary language that is unnecessary. Simply using "if and only if"
instead should suffice.
|