summaryrefslogtreecommitdiff
path: root/include/ruby
AgeCommit message (Collapse)Author
2021-08-27Use C99-defined signbit macroNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4783
2021-08-27Use C99-defined macros to classify a floating-point numberNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4783
2021-08-25[Feature #18045] Remove T_PAYLOADPeter Zhu
This commit removes T_PAYLOAD since the new VWA implementation no longer requires T_PAYLOAD types. Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/4773
2021-08-24Moved rb_deprecate_constant declaration [Feature #18051]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4763
2021-08-24Moved rb_int_positive_pow declaration [Feature #18051]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4763
2021-08-24Moved exported symbols in internal/util.h to ruby/util.hNobuyoshi Nakada
[Feature #18051] Notes: Merged: https://github.com/ruby/ruby/pull/4763
2021-08-23Revert "[Feature #18045] Implement size classes for GC"Peter Zhu
This reverts commits 48ff7a9f3e47bffb3e4d067a12ba9b936261caa0 and b2e2cf2dedd104acad8610721db5e4d341f135ef because it is causing crashes in SPARC solaris and i386 debian. Notes: Merged: https://github.com/ruby/ruby/pull/4764
2021-08-23[Feature #18045] Remove T_PAYLOADPeter Zhu
This commit removes T_PAYLOAD since the new VWA implementation no longer requires T_PAYLOAD types. Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/4680
2021-08-15Show verbose error messages when single pattern match failsKazuki Tsujimoto
[0] => [0, *, a] #=> [0] length mismatch (given 1, expected 2+) (NoMatchingPatternError) Ignore test failures of typeprof caused by this change for now.
2021-08-14A comment for typed data in `rb_check_type` [ci skip]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4741
2021-08-14Rename labels in `Check_Type` more descriptiveNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4741
2021-08-13Mark `rb_unexpected_type` as "cold" [Bug #18062]Nobuyoshi Nakada
So that it will not interfere the fast path in `Check_Type`.
2021-08-13Indicate the slow path of `Check_Type` never return [Bug #18062]Nobuyoshi Nakada
Though this call to `rb_check_type` is just to raise an exception and never return actually, it can return at least formally. That means a caller function looks like it will access `flags` even in the special-const cases, and some optimizers may unify the access with the same access just following the call, and re-order it before the guard.
2021-08-12RBIMPL_ATTR_DEPRECATED: enable for GCC 10.3+卜部昌平
They fixed the bug. Notes: Merged: https://github.com/ruby/ruby/pull/4735
2021-08-09VC warns the same attribute used more than onceNobuyoshi Nakada
2021-08-09Rename rb_iterate to get rid of name clash on Sun CNobuyoshi Nakada
2021-08-09Deprecate rb_iterate in C++Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4720
2021-08-09Suppress deprecated rb_iterate declaration warnings in C++Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4720
2021-08-09Suppress warnings in C++2aNobuyoshi Nakada
* bitwise operation between different enumeration types ('ruby_value_type' and 'ruby_fl_type') is deprecated [-Wdeprecated-enum-enum-conversion] * volatile-qualified parameter type 'volatile int' is deprecated [-Wdeprecated-volatile] Notes: Merged: https://github.com/ruby/ruby/pull/4720
2021-08-01gcc 10.3.0 says "__VA_OPT__ is not available until C++2a"Nobuyoshi Nakada
2021-08-01Define functions using rb_wait_for_single_fd [Bug #18046]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4696 Merged-By: nobu <nobu@ruby-lang.org>
2021-07-16Emit deprecatation warnings for rb_iterate()Benoit Daloze
* It is obsolete since 1.9, see https://github.com/ruby/ruby/blob/master/doc/extension.rdoc#label-Control+Structure and [Misc #18025] Notes: Merged: https://github.com/ruby/ruby/pull/4629
2021-07-15rb_interned_id_p: does not exist卜部昌平
This declaration was added at commit 0ee5a49dd4ffbbb285c25fa6cba88370ce9 without its implementation. Must be a mistake. Note also that we ended up having this exct same functionality implemented under a name of rb_check_id().
2021-07-15rb_enc_casefold: does not exist卜部昌平
This declaration was added at commit 0ee5a49dd4ffbbb285c25fa6cba88370ce9 without its implementation. Must be a mistake.
2021-07-13Get `ruby_nonempty_memcpy` to have C linkagextkoba
Fixes [Bug #17788] Notes: Merged: https://github.com/ruby/ruby/pull/4429
2021-07-13Expose `rb_obj_is_fiber`.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/4646
2021-06-26Disable RBIMPL_ATTR_DEPRECATED for Coverity Scan buildYusuke Endoh
Coverity Scan emulates gcc but seems not to support this attribute correctly.
2021-06-23Revert deprecations for nowNobuyoshi Nakada
2021-06-22Deprecate and rework old (fd) centric functions.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/4592
2021-06-22Direct io for accept, send, sendmsg, recvfrom, and related methods.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/4477
2021-06-18Add a cache for class variableseileencodes
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> Notes: Merged: https://github.com/ruby/ruby/pull/4544
2021-06-17Adjust styles [ci skip]Nobuyoshi Nakada
* --braces-after-func-def-line * --dont-cuddle-else * --procnames-start-lines * --space-after-for * --space-after-if * --space-after-while
2021-06-14Add scheduler hook `Addrinfo.getaddrinfo`. (#4375)Samuel Williams
Co-authored-by: Bruno Sutic <code@brunosutic.com> Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2021-06-03Expose `rb_fiber_transfer` and `rb_fiber_transfer_kw`.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/4549
2021-05-11Revert "Filling cache values on cvar write"Aaron Patterson
This reverts commit 08de37f9fa3469365e6b5c964689ae2bae0eb9f3. This reverts commit e8ae922b62adb00a80d3d4c49f7d7b0e6026eaba.
2021-05-11Add a cache for class variableseileencodes
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> Notes: Merged: https://github.com/ruby/ruby/pull/4340
2021-05-10Removed missing/dup2.cNobuyoshi Nakada
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. Notes: Merged: https://github.com/ruby/ruby/pull/4483
2021-05-10rb_fiber_new_kw: doesn't exist卜部昌平
Not against having such thing but currently we lack one.
2021-05-07Protoized old pre-ANSI K&R style declarations and definitionsNobuyoshi Nakada
2021-05-06Allow newobj_of0 and newobj_slowpath to allocate into multiple heap slotsMatt Valentine-House
Notes: Merged: https://github.com/ruby/ruby/pull/4391
2021-05-04Fix compilation errors for c99Peter Zhu
ENUM_OVER_INT is sometimes not defined. Use #ifdef instead if #if. Notes: Merged: https://github.com/ruby/ruby/pull/4457
2021-05-04Fix -Wundef warnings for RBIMPL_HAS_BUILTINBenoit Daloze
* 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) | ^~~~~~~~~~~~~~~~~~
2021-05-04HAVE_* macros should not be defined with value 0Benoit Daloze
* See [Feature #17752] Notes: Merged: https://github.com/ruby/ruby/pull/4428
2021-05-04Add RBIMPL_RVALUE_EMBED_LEN_MAX neeeded by internal/bignum.hBenoit Daloze
* It evaluated to 0 before, revealed by -Wundef * See [Feature #17752] Co-authored-by: xtkoba (Tee KOBAYASHI) <xtkoba+ruby@gmail.com> Notes: Merged: https://github.com/ruby/ruby/pull/4428
2021-05-04Fix trivial -Wundef warningsBenoit Daloze
* See [Feature #17752] Co-authored-by: xtkoba (Tee KOBAYASHI) <xtkoba+ruby@gmail.com> Notes: Merged: https://github.com/ruby/ruby/pull/4428
2021-04-26Fix some typos by spell checkerRyuta Kamizono
Notes: Merged: https://github.com/ruby/ruby/pull/4414
2021-04-16rb_hash_free(): has never existed.卜部昌平
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.
2021-04-13Inline LONG_LONG conversionsNobuyoshi Nakada
Not only NUM2LL, also LL2NUM, ULL2NUM and NUM2ULL.
2021-04-13workaround MSVC error卜部昌平
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.
2021-04-13dependency updates卜部昌平
Notes: Merged: https://github.com/ruby/ruby/pull/4371