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

69844 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada ac152b3cac
Update dependencies 2021-11-21 16:21:18 +09:00
Nobuyoshi Nakada cbfd5249d4
Stop including node.h from vm_debug.h only for `NODE` 2021-11-21 16:21:18 +09:00
Nobuyoshi Nakada d2cb4cc073
Adjust format 2021-11-21 16:16:03 +09:00
ima1zumi f5829e2935 [ruby/reline] Correct padding space calculation
fix https://github.com/ruby/irb/issues/308

This bug occurred when `dialog.width - calculate_width(s, true)` was negative.

When `dialog.width` is shorter than `old_dialog.width`, it calculates how much padding it has to do. However, there are cases where `s` is longer than `dialog.width`, as in the issue. In that case, `padding_space_with_escape_sequences` will crash.

Here, `old_dialog.width` is longer than `dialog.width`, so I changed the padding width to `old_dialog.width - dialog.width`.

https://github.com/ruby/reline/commit/c581c31e0f
2021-11-21 13:56:26 +09:00
Yusuke Endoh feda058531 Refactor hacky ID tables to struct rb_ast_id_table_t
The implementation of a local variable tables was represented as `ID*`,
but it was very hacky: the first element is not an ID but the size of
the table, and, the last element is (sometimes) a link to the next local
table only when the id tables are a linked list.

This change converts the hacky implementation to a normal struct.
2021-11-21 08:59:24 +09:00
Burdette Lamar 86ad878e6a
Enhanced RDoc for Float (#5150)
Treated (or previously treated):

    #quo
    #%
    #divmod
    #**`
    #eql?
    #<=>
    #==
    #hash
2021-11-20 17:21:30 -06:00
git 8afd35b950 * 2021-11-21 [ci skip] 2021-11-21 01:35:42 +09:00
Nobuyoshi Nakada 8f3432cd44
Fix setting struct member by public_send 2021-11-21 00:31:51 +09:00
Nobuyoshi Nakada c5ec05d047
`struct_pos_num` is no longer used 2021-11-20 21:32:57 +09:00
Adam Hess 73388aff5e
Add YJIT codegen for objtostring (#5149)
This is the minimal correct objtostring implementation in YJIT.
For correctness, it is important that to_string not get called on strings or subclasses of string.
There is a new test for this behavior.

A follow up should implement an optimized version for other types as performed in `vm_objtostring`.

Co-authored-by: John Hawthorn <jhawthorn@github.com>

Co-authored-by: John Hawthorn <jhawthorn@github.com>
2021-11-19 16:57:09 -05:00
Jeremy Evans 3c92516519 Fix test_super_with_anonymous_block test to use anonymous block 2021-11-19 11:05:09 -08:00
git e9735ec206 * 2021-11-20 [ci skip] 2021-11-20 03:16:34 +09:00
Burdette Lamar e0c38742a2
Enhanced RDoc for Float (#5144)
Treats:

    #to_s
    #coerce
    #+
    #-
    #*
    #/
2021-11-19 12:16:16 -06:00
Nobuyoshi Nakada aa591af296
Do not document vendored files [ci skip]
Just duplications.
2021-11-19 21:55:27 +09:00
David Rodríguez 39c4673e3c [rubygems/rubygems] Previous logic can mostly go now
https://github.com/rubygems/rubygems/commit/3241b34055
2021-11-19 10:12:11 +09:00
David Rodríguez 80f39d78df [rubygems/rubygems] Allow `bundle update` to downgrade gems by changing the Gemfile
https://github.com/rubygems/rubygems/commit/6a19cca7e5
2021-11-19 10:12:10 +09:00
David Rodríguez 55f574136c [rubygems/rubygems] Extract a converge_specs method for later reusing it
https://github.com/rubygems/rubygems/commit/e896e63ac3
2021-11-19 10:12:09 +09:00
David Rodríguez 2730e45f45 [rubygems/rubygems] Avoid unnecessary loop
https://github.com/rubygems/rubygems/commit/afaf868b68
2021-11-19 10:12:09 +09:00
Yusuke Endoh 4b1dd75e6c gc.c: Fix a compile error on some crossbuilds
http://rubyci.s3.amazonaws.com/crossruby/crossruby-master-wasm32_emscripten/log/20211118T233311Z.log.html.gz#make
```
compiling gc.c
gc.c:10629:47: error: implicit conversion loses integer precision: 'unsigned long long' to 'size_t' (aka 'unsigned long') [-Werror,-Wshorten-64-to-32]
    SET(time, objspace->profile.total_time_ns / (1000 * 1000) /* ns -> ms */);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gc.c:10624:9: note: expanded from macro 'SET'
        return attr; \
        ~~~~~~ ^~~~
gc.c:10629:47: error: implicit conversion loses integer precision: 'unsigned long long' to 'unsigned long' [-Werror,-Wshorten-64-to-32]
    SET(time, objspace->profile.total_time_ns / (1000 * 1000) /* ns -> ms */);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gc.c:10626:68: note: expanded from macro 'SET'
        rb_hash_aset(hash, gc_stat_symbols[gc_stat_sym_##name], SIZET2NUM(attr));
                                                                ~~~~~~~~~ ^~~~
2 errors generated.
```
2021-11-19 10:09:51 +09:00
Koichi Sasada 82ea287018 optimize `Struct` getter/setter
Introduce new optimized method type
`OPTIMIZED_METHOD_TYPE_STRUCT_AREF/ASET` with index information.
2021-11-19 08:32:39 +09:00
Koichi Sasada be71c95b88 `rb_method_optimized_t` for further extension
Now `rb_method_optimized_t optimized` field is added to represent
optimized method type.
2021-11-19 08:32:39 +09:00
Koichi Sasada 6c64013978 use ULL2NUM directly.
@nobu pointed out that ULL (unsigned long long) should have at
least 64 bits so ULL2NUM(uint64_t) is not problem.
2021-11-19 08:32:07 +09:00
Koichi Sasada c347038d4e GC measurement feature
* `GC.measure_total_time = true` enables total time measurement (default: true)
* `GC.measure_total_time` returns current flag.
* `GC.total_time` returns measured total time in nano seconds.
* `GC.stat(:time)` (and Hash) returns measured total time in milli seconds.
2021-11-19 08:32:07 +09:00
Koichi Sasada 349a179782 support `GC.stat(:time)` take 2 2021-11-19 08:32:07 +09:00
Jeremy Evans b08dacfea3
Optimize dynamic string interpolation for symbol/true/false/nil/0-9
This provides a significant speedup for symbol, true, false,
nil, and 0-9, class/module, and a small speedup in most other cases.

Speedups (using included benchmarks):
:symbol        :: 60%
0-9            :: 50%
Class/Module   :: 50%
nil/true/false :: 20%
integer        :: 10%
[]             :: 10%
""             :: 3%

One reason this approach is faster is it reduces the number of
VM instructions for each interpolated value.

Initial idea, approach, and benchmarks from Eric Wong. I applied
the same approach against the master branch, updating it to handle
the significant internal changes since this was first proposed 4
years ago (such as CALL_INFO/CALL_CACHE -> CALL_DATA). I also
expanded it to optimize true/false/nil/0-9/class/module, and added
handling of missing methods, refined methods, and RUBY_DEBUG.

This renames the tostring insn to anytostring, and adds an
objtostring insn that implements the optimization. This requires
making a few functions non-static, and adding some non-static
functions.

This disables 4 YJIT tests.  Those tests should be reenabled after
YJIT optimizes the new objtostring insn.

Implements [Feature #13715]

Co-authored-by: Eric Wong <e@80x24.org>
Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
Co-authored-by: Yusuke Endoh <mame@ruby-lang.org>
Co-authored-by: Koichi Sasada <ko1@atdot.net>
2021-11-18 15:10:20 -08:00
Jeremy Evans 4adb012926 Anonymous block forwarding allows a method to forward a passed
block to another method without having to provide a name for the
block parameter.

Implements [Feature #11256]

Co-authored-by: Yusuke Endoh mame@ruby-lang.org
Co-authored-by: Nobuyoshi Nakada nobu@ruby-lang.org
2021-11-18 14:17:57 -08:00
Eileen M. Uchitelle ea02b93bb9
Refactor setclassvariable (#5143)
We only need the cref when we have a cache miss so don't look it up until we
need it. This likely speeds up class variable writes in the interpreter but
also simplifies the jit code.

Before

```
Warming up --------------------------------------
        write a cvar   192.280k i/100ms
Calculating -------------------------------------
        write a cvar      1.915M (± 3.5%) i/s -      9.614M in   5.026694s
```

After

```
Warming up --------------------------------------
        write a cvar   216.308k i/100ms
Calculating -------------------------------------
        write a cvar      2.140M (± 3.1%) i/s -     10.815M in   5.058079s
```

Followup to ruby/ruby#5137
2021-11-18 16:17:40 -05:00
Jeremy Evans ab737b1919 Update documentation for Module#{private,public,protected,module_function}
Also, update NEWS for this change and the Kernel#load change.
2021-11-18 10:51:14 -08:00
Jeremy Evans 75ecbda438 Make Module#{public,private,protected,module_function} return arguments
Previously, each of these methods returned self, but it is
more useful to return arguments, to allow for simpler method
decorators, such as:

```ruby
cached private def foo; some_long_calculation; end
```

Where cached sets up caching for the method.

For each of these methods, the following behavior is used:

1) No arguments returns nil
2) Single argument is returned
3) Multiple arguments are returned as an array

The single argument case is really the case we are trying to
optimize for, for the same reason that def was changed to return
a symbol for the method.

Idea and initial patch from Herwin Quarantainenet.

Implements [Feature #12495]
2021-11-18 09:47:40 -08:00
Eileen M. Uchitelle ec574ab345
Refactor getclassvariable (#5137)
* Refactor getclassvariable

We only need the cref when we have a cache miss so don't look it up until we
need it. This speeds up class variable reads in the interpreter but
also simplifies the jit code.

Benchmarks for master vs this branch (without yjit):

Before:

```
Warming up --------------------------------------
         read a cvar     1.276M i/100ms
Calculating -------------------------------------
         read a cvar     12.596M (± 1.7%) i/s -     63.781M in   5.064902s
```

After:

```
Warming up --------------------------------------
         read a cvar     1.336M i/100ms
Calculating -------------------------------------
         read a cvar     13.114M (± 3.6%) i/s -     65.488M in   5.000584s
```

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>

* Clean up function signatures / remove dead code

rb_vm_getclassvariable signature has changed and we don't need
rb_vm_get_cref.

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-11-18 12:11:53 -05:00
git d48f5082e5 * 2021-11-19 [ci skip] 2021-11-19 00:44:50 +09:00
Maxime Chevalier-Boisvert cdebf57ec6
Add --yjit-no-type-prop so we can test YJIT without type propagation (#5135)
* Add --yjit-no-type-prop so we can test YJIT without type propagation

* Fix typo in command line option

* Leave just two test workflows enable for YJIT
2021-11-18 10:44:31 -05:00
Burdette Lamar f3dcb4bbf7
Enhanced RDoc for Integer (#5139)
Treats:

    #<<
    #>>
    #to_s
2021-11-18 08:28:04 -06:00
Nobuyoshi Nakada e2b78440ba
Throttle GitHub Actions [ci skip]
As GitHub Actions are choking a lot lately, throttle the checks
down to the latest commit only per branches.
2021-11-18 22:54:57 +09:00
Nobuyoshi Nakada 89b440bf72
Expect bool as `sort:` option at glob [Feature #18287] 2021-11-18 21:47:18 +09:00
Kazuhiro NISHIYAMA 6896324465
Update bundled_gems 2021-11-18 20:52:03 +09:00
Hiroshi SHIBATA 39655aceb2 [ruby/date] Bump version to 3.2.2
https://github.com/ruby/date/commit/21d91c5f4f
2021-11-18 19:39:57 +09:00
Jean Boussier 3ce27552df [ruby/date] Expose Date::VERSION
An almost universal convention for gems is to expose `Namespace::VERSION`
which makes it mcuh easier when debugging etc.

Many gems extracted from ruby don't do this, even though it would be even more
useful because they ship with ruby, so it's less clear which version it is.

https://github.com/ruby/date/commit/fef7ec18d8
2021-11-18 19:39:55 +09:00
Nobuyoshi Nakada 2efbb35a8f
Remove macOS CIs [ci skip] 2021-11-18 17:39:28 +09:00
Jeremy Evans b35b7a1ef2 Allow Kernel#load to load code into a specified module
Instead of always using a new anonymous module for Kernel#load if
the wrap argument is not false/nil, use the given module if a module
is provided.

Implements [Feature #6210]
2021-11-17 22:43:40 -08:00
S.H 05a3dc1a65
Improve performance Kernel#Float with using Primitive.mandatory_only? method [Feature #18344] (#5133) 2021-11-17 20:26:40 -08:00
Burdette Lamar cb69c19e8a
Enhanced RDoc for Integer (#5138)
Treats:

    #times
    #round
    #floor
    #ceil
    #truncate
    ::sqrt
2021-11-17 16:00:50 -06:00
David Rodríguez 8bdb56fcaf [rubygems/rubygems] Protect specs access at a finer level
https://github.com/rubygems/rubygems/commit/c8cc053bde
2021-11-18 04:37:28 +09:00
David Rodríguez 4bc69a25f3 [rubygems/rubygems] Stop using a constant for something not constant
https://github.com/rubygems/rubygems/commit/5cb0b9d9b8
2021-11-18 04:37:27 +09:00
David Rodríguez a5cd4a0568 [rubygems/rubygems] Extract a helper method to reset specs
https://github.com/rubygems/rubygems/commit/662de0c990
2021-11-18 04:37:27 +09:00
David Rodríguez f542ab2e6d [rubygems/rubygems] Make clearing loaded spec cache really private
https://github.com/rubygems/rubygems/commit/19f117652b
2021-11-18 04:37:26 +09:00
David Rodríguez d8dde444e9 [rubygems/rubygems] `Gem::Specification.reset` already clears loaded spec cache
Plus, that method is supposed to be private.

https://github.com/rubygems/rubygems/commit/f8a01ddb9f
2021-11-18 04:37:26 +09:00
David Rodríguez 81eba77fc0 [rubygems/rubygems] We can now use standard memoization
https://github.com/rubygems/rubygems/commit/231be44d38
2021-11-18 04:37:25 +09:00
David Rodríguez 61f023f03b [rubygems/rubygems] Easier preservation of activated specs
https://github.com/rubygems/rubygems/commit/54e923ffc2
2021-11-18 04:37:25 +09:00
David Rodríguez fdd3eed037 [rubygems/rubygems] Set `@@all` variable at class definition time
To spare the `defined?` check.

https://github.com/rubygems/rubygems/commit/64d27bba01
2021-11-18 04:37:24 +09:00