86825 Commits

Author SHA1 Message Date
David Rodríguez
f7acfeb4ce [rubygems/rubygems] Fix credentials being readded when re-resolving without a full unlock
https://github.com/rubygems/rubygems/commit/a8670e43f8
2024-06-20 07:15:06 +00:00
David Rodríguez
bf6b8dd6a8 [rubygems/rubygems] Fix bundle update <gem_name> edge case
When locked only to RUBY, and some locked spec does not meet locked
dependencies, Bundler would remove the only locked platform and end up
creating a lockfile with empty sections.

We can't rely on our criteria to remove invalid platforms if locked
specs are not valid in the first place.

https://github.com/rubygems/rubygems/commit/1dba05cf53
2024-06-20 07:14:47 +00:00
David Rodríguez
f445d54f91 [rubygems/rubygems] Move constant to the proper place
https://github.com/rubygems/rubygems/commit/9f08241d01
2024-06-20 15:22:52 +09:00
David Rodríguez
ae7d609456 [rubygems/rubygems] Don't expire git specs unnecessarily when remote! or cached! are used
https://github.com/rubygems/rubygems/commit/04b26731cb
2024-06-20 15:22:20 +09:00
David Rodríguez
0610302a8f [rubygems/rubygems] Don't validate local gemspec twice
Calling `remote!` or `cached!` on the source was expiring local specs
for now reason. It's unnecessary to override these methods for path
sources since they only deal with local specifications.

https://github.com/rubygems/rubygems/commit/aa93b196a2
2024-06-20 15:22:13 +09:00
David Rodríguez
758e01d39d [rubygems/rubygems] Make sure to not re-resolve when a not fully specific local platform is locked
https://github.com/rubygems/rubygems/commit/36a02c6128
2024-06-20 15:21:08 +09:00
David Rodríguez
c6a28b02c9 [rubygems/rubygems] Always resolve against the local platform
If RUBY is the only platform in the lockfile, we were skipping adding
the local platform to the list of resolution platforms. This generally
works anyways, because we had some code to still add it if the RUBY
platform is not valid for the set of locked gems.

However, sometimes it can happen that "RUBY" is valid for the current
set of locked gems, but when adding a new dependency, it becomes
invalid. For example, when adding sorbet to a Gemfile, that will
introduce `sorbet-static` as an indirect dependency which does not have
a generic "RUBY" variant. This will cause resolution to take a long time
continuously backtracking trying to find solutions that don't introduce
`sorbet-static` as a dependency and will eventually fail.

Instead, we can always add the local platform to the set of resolution
platforms before resolving, and remove it as necessary after resolution
so that we lock the correct set of platforms.

https://github.com/rubygems/rubygems/commit/6ed1fe6050
2024-06-20 15:20:57 +09:00
David Rodríguez
9e713f0e8c [rubygems/rubygems] Remove no longer needed condition
The `force-ruby-platform` settings is properly respected when
materializing since https://github.com/rubygems/rubygems/commit/e17d7e9efb91.

https://github.com/rubygems/rubygems/commit/c4ba54eb96
2024-06-20 15:20:47 +09:00
Martin Emde
af304ad952 [rubygems/rubygems] Revert to splitting parser due to performance regression
* The string search parser was more memory efficient but
  in some cases, much slower. Reverting until a better
  solution is found.
* Handle the situation where the line might be blank (Artifactory bug)

https://github.com/rubygems/rubygems/commit/222d38737d
2024-06-20 15:18:56 +09:00
Aaron Patterson
0e1182f93c [ruby/fiddle] Remove Vim commands
(https://github.com/ruby/fiddle/pull/140)

Some of these commands just don't work (for example `sws` is not a Vim
setting). I think we should just remove these.

https://github.com/ruby/fiddle/commit/c3dbf7ba9a
2024-06-20 15:16:57 +09:00
Nobuyoshi Nakada
c2fd3dfb98
[ruby/date] Update zonetab.h at 2024-06-19
https://github.com/ruby/date/commit/8e5efd4f59
2024-06-20 15:16:48 +09:00
Yusuke Endoh
fbe56b1c17 Set RUBY_TEST_TIMEOUT_SCALE=3 for --repeat-count=2 test
With --repeat-count=2, timing-related test seems to fail frequently.
I'm not sure of the cause, but I want to reduce the errors by setting
RUBY_TEST_TIMEOUT_SCALE.
2024-06-20 12:52:09 +09:00
dependabot[bot]
e01e6ce9c8 Bump gacts/run-and-post-run in /.github/actions/setup/directories
Bumps [gacts/run-and-post-run](https://github.com/gacts/run-and-post-run) from 1.4.0 to 1.4.1.
- [Release notes](https://github.com/gacts/run-and-post-run/releases)
- [Commits](7aec950f3b...4683764dd7)

---
updated-dependencies:
- dependency-name: gacts/run-and-post-run
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-19 20:35:49 -07:00
dependabot[bot]
97c91860bb Bump gacts/run-and-post-run from 1.4.0 to 1.4.1
Bumps [gacts/run-and-post-run](https://github.com/gacts/run-and-post-run) from 1.4.0 to 1.4.1.
- [Release notes](https://github.com/gacts/run-and-post-run/releases)
- [Commits](7aec950f3b...4683764dd7)

---
updated-dependencies:
- dependency-name: gacts/run-and-post-run
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-19 19:48:48 -07:00
Yuri Kanivetsky
84c9f2a240 [rubygems/rubygems] Make "bundler? update --bundler" behave identically
https://github.com/rubygems/rubygems/commit/30dce3f87d
2024-06-20 00:12:31 +00:00
Jean Boussier
83f57ca3d2 String.new(capacity:) don't substract termlen
[Bug #20585]

This was changed in 36a06efdd9f0604093dccbaf96d4e2cb17874dc8 because
`String.new(1024)` would end up allocating `1025` bytes, but the problem
with this change is that the caller may be trying to right size a String.

So instead, we should just better document the behavior of `capacity:`.
2024-06-19 15:11:07 +02:00
Nobuyoshi Nakada
321ed86e93 [rubygems/rubygems] Do not set previously unset value
https://github.com/rubygems/rubygems/commit/0148cce153
2024-06-19 11:42:35 +00:00
Nobuyoshi Nakada
57e15074fe [rubygems/rubygems] Workaround for TruffleRuby that set nil to LIBRUBY_RELATIVE
https://github.com/rubygems/rubygems/commit/06fd399973
2024-06-19 11:42:35 +00:00
Nobuyoshi Nakada
378e65af9a [rubygems/rubygems] Dump RbConfig elements to escape special characters
Naively embed strings do not work if special characters (newline,
backslahes and so on) are contained.

https://github.com/rubygems/rubygems/commit/ac2c4c4af1
2024-06-19 11:42:34 +00:00
Hiroshi SHIBATA
2ccd5f8cef [rubygems/rubygems] Use get_byte_ranges instead of byte_ranges
https://github.com/rubygems/rubygems/commit/5c2ad44c18
2024-06-19 10:56:58 +00:00
git
662fbaaacd Update bundled gems list as of 2024-06-19 2024-06-19 06:59:21 +00:00
Tanaka Akira
ed2f8ea62e [DOC] IO#close on closed IO is not an error. 2024-06-19 13:42:40 +09:00
Kevin Newton
dfb67a4433 [ruby/prism] (parser) Print when token tests are now passing
https://github.com/ruby/prism/commit/9e4fb665ee
2024-06-18 21:18:39 -04:00
Kevin Newton
24f48382bc [ruby/prism] (parser) Fix up tokens for empty symbol
https://github.com/ruby/prism/commit/5985ab7687
2024-06-18 21:18:39 -04:00
Kevin Newton
c93b70cfdd [ruby/prism] Make sure Init_prism is visible for extension
https://github.com/ruby/prism/commit/4601d3adfd
2024-06-19 00:06:01 +00:00
Peter Zhu
eb215c8dc6 Fix flaky TestWeakMap#test_inspect_garbage
If a GC is ran before the assert_match, then the WeakMap would be empty
and would not have any objects, so the regular expression match would
fail. This changes the regular expression to work even if the WeakMap
is empty.
2024-06-18 14:21:37 -04:00
Earlopain
b8a592fe6e [rubygems/rubygems] Fix bundle fund when the gemfile contains optional groups
`current_dependencies` doesn't return gems in optional groups, while `specs` would

Closes https://github.com/rubygems/rubygems/pull/7757

https://github.com/rubygems/rubygems/commit/c797e95636
2024-06-18 17:53:59 +00:00
Aaron Patterson
4b04da1ee8 Deconstruct ci in one place
Putting these calls next to each other lets the compiler combine "packed
ci" checks
2024-06-18 09:28:25 -07:00
Aaron Patterson
e5160a9c60 Mark the class on orphan call caches
"super" CC's are "orphans", meaning there is no class CC table that
points at them.  Since they are orphans, we should mark the class
reference so that if the cache happens to be used, the class will still
be alive
2024-06-18 09:28:25 -07:00
Aaron Patterson
a661c82972 Refactor so we don't have _cd
This should make the diff more clean
2024-06-18 09:28:25 -07:00
Aaron Patterson
cc97a27008 Add two new instructions for forwarding calls
This commit adds `sendforward` and `invokesuperforward` for forwarding
parameters to calls

Co-authored-by: Matt Valentine-House <matt@eightbitraptor.com>
2024-06-18 09:28:25 -07:00
Aaron Patterson
a25dd5b12c Set a fast path for forwardable iseqs 2024-06-18 09:28:25 -07:00
Aaron Patterson
cfc5646cdc fix allocation assertions 2024-06-18 09:28:25 -07:00
Aaron Patterson
bd7a87e5bb Add a CC fastpath for forwardable methods 2024-06-18 09:28:25 -07:00
Aaron Patterson
cdf33ed5f3 Optimized forwarding callers and callees
This patch optimizes forwarding callers and callees. It only optimizes methods that only take `...` as their parameter, and then pass `...` to other calls.

Calls it optimizes look like this:

```ruby
def bar(a) = a
def foo(...) = bar(...) # optimized
foo(123)
```

```ruby
def bar(a) = a
def foo(...) = bar(1, 2, ...) # optimized
foo(123)
```

```ruby
def bar(*a) = a

def foo(...)
  list = [1, 2]
  bar(*list, ...) # optimized
end
foo(123)
```

All variants of the above but using `super` are also optimized, including a bare super like this:

```ruby
def foo(...)
  super
end
```

This patch eliminates intermediate allocations made when calling methods that accept `...`.
We can observe allocation elimination like this:

```ruby
def m
  x = GC.stat(:total_allocated_objects)
  yield
  GC.stat(:total_allocated_objects) - x
end

def bar(a) = a
def foo(...) = bar(...)

def test
  m { foo(123) }
end

test
p test # allocates 1 object on master, but 0 objects with this patch
```

```ruby
def bar(a, b:) = a + b
def foo(...) = bar(...)

def test
  m { foo(1, b: 2) }
end

test
p test # allocates 2 objects on master, but 0 objects with this patch
```

How does it work?
-----------------

This patch works by using a dynamic stack size when passing forwarded parameters to callees.
The caller's info object (known as the "CI") contains the stack size of the
parameters, so we pass the CI object itself as a parameter to the callee.
When forwarding parameters, the forwarding ISeq uses the caller's CI to determine how much stack to copy, then copies the caller's stack before calling the callee.
The CI at the forwarded call site is adjusted using information from the caller's CI.

I think this description is kind of confusing, so let's walk through an example with code.

```ruby
def delegatee(a, b) = a + b

def delegator(...)
  delegatee(...)  # CI2 (FORWARDING)
end

def caller
  delegator(1, 2) # CI1 (argc: 2)
end
```

Before we call the delegator method, the stack looks like this:

```
Executing Line | Code                                  | Stack
---------------+---------------------------------------+--------
              1| def delegatee(a, b) = a + b           | self
              2|                                       | 1
              3| def delegator(...)                    | 2
              4|   #                                   |
              5|   delegatee(...)  # CI2 (FORWARDING)  |
              6| end                                   |
              7|                                       |
              8| def caller                            |
          ->  9|   delegator(1, 2) # CI1 (argc: 2)     |
             10| end                                   |
```

The ISeq for `delegator` is tagged as "forwardable", so when `caller` calls in
to `delegator`, it writes `CI1` on to the stack as a local variable for the
`delegator` method.  The `delegator` method has a special local called `...`
that holds the caller's CI object.

Here is the ISeq disasm fo `delegator`:

```
== disasm: #<ISeq:delegator@-e:1 (1,0)-(1,39)>
local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 1] "..."@0
0000 putself                                                          (   1)[LiCa]
0001 getlocal_WC_0                          "..."@0
0003 send                                   <calldata!mid:delegatee, argc:0, FCALL|FORWARDING>, nil
0006 leave                                  [Re]
```

The local called `...` will contain the caller's CI: CI1.

Here is the stack when we enter `delegator`:

```
Executing Line | Code                                  | Stack
---------------+---------------------------------------+--------
              1| def delegatee(a, b) = a + b           | self
              2|                                       | 1
              3| def delegator(...)                    | 2
           -> 4|   #                                   | CI1 (argc: 2)
              5|   delegatee(...)  # CI2 (FORWARDING)  | cref_or_me
              6| end                                   | specval
              7|                                       | type
              8| def caller                            |
              9|   delegator(1, 2) # CI1 (argc: 2)     |
             10| end                                   |
```

The CI at `delegatee` on line 5 is tagged as "FORWARDING", so it knows to
memcopy the caller's stack before calling `delegatee`.  In this case, it will
memcopy self, 1, and 2 to the stack before calling `delegatee`.  It knows how much
memory to copy from the caller because `CI1` contains stack size information
(argc: 2).

Before executing the `send` instruction, we push `...` on the stack.  The
`send` instruction pops `...`, and because it is tagged with `FORWARDING`, it
knows to memcopy (using the information in the CI it just popped):

```
== disasm: #<ISeq:delegator@-e:1 (1,0)-(1,39)>
local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 1] "..."@0
0000 putself                                                          (   1)[LiCa]
0001 getlocal_WC_0                          "..."@0
0003 send                                   <calldata!mid:delegatee, argc:0, FCALL|FORWARDING>, nil
0006 leave                                  [Re]
```

Instruction 001 puts the caller's CI on the stack.  `send` is tagged with
FORWARDING, so it reads the CI and _copies_ the callers stack to this stack:

```
Executing Line | Code                                  | Stack
---------------+---------------------------------------+--------
              1| def delegatee(a, b) = a + b           | self
              2|                                       | 1
              3| def delegator(...)                    | 2
              4|   #                                   | CI1 (argc: 2)
           -> 5|   delegatee(...)  # CI2 (FORWARDING)  | cref_or_me
              6| end                                   | specval
              7|                                       | type
              8| def caller                            | self
              9|   delegator(1, 2) # CI1 (argc: 2)     | 1
             10| end                                   | 2
```

The "FORWARDING" call site combines information from CI1 with CI2 in order
to support passing other values in addition to the `...` value, as well as
perfectly forward splat args, kwargs, etc.

Since we're able to copy the stack from `caller` in to `delegator`'s stack, we
can avoid allocating objects.

I want to do this to eliminate object allocations for delegate methods.
My long term goal is to implement `Class#new` in Ruby and it uses `...`.

I was able to implement `Class#new` in Ruby
[here](https://github.com/ruby/ruby/pull/9289).
If we adopt the technique in this patch, then we can optimize allocating
objects that take keyword parameters for `initialize`.

For example, this code will allocate 2 objects: one for `SomeObject`, and one
for the kwargs:

```ruby
SomeObject.new(foo: 1)
```

If we combine this technique, plus implement `Class#new` in Ruby, then we can
reduce allocations for this common operation.

Co-Authored-By: John Hawthorn <john@hawthorn.email>
Co-Authored-By: Alan Wu <XrXr@users.noreply.github.com>
2024-06-18 09:28:25 -07:00
Stan Lo
921f22e563 [ruby/irb] Improve how command calls' return value is handled
(https://github.com/ruby/irb/pull/972)

In #934, we changed command calls to return nil only. This PR improves
the behaviour even further by:

- Not echoing the `nil` returned by command calls
- Not overriding previous return value stored in `_` with the
  `nil` from commands

https://github.com/ruby/irb/commit/c844176842
2024-06-18 15:15:23 +00:00
tomoya ishida
c2e2c5975d [ruby/reline] Fix vi_yank or vi_delete_meta copies nil bug
(https://github.com/ruby/reline/pull/726)

https://github.com/ruby/reline/commit/46b30b07c9
2024-06-18 14:57:19 +00:00
git
b499356307 Update bundled gems list as of 2024-06-16 2024-06-18 13:01:28 +00:00
Hiroshi SHIBATA
dd704eb4c3 net-ftp-0.3.6 always return response with put/puttextfile.
* https://github.com/ruby/net-ftp/pull/34
* https://github.com/ruby/net-ftp/issues/36
2024-06-18 21:48:25 +09:00
Hiroshi SHIBATA
1997f43a54 Bump up net-ftp to 0.3.6 2024-06-18 21:48:25 +09:00
dependabot[bot]
cd65bd02cb Bump ruby/setup-ruby from 1.180.0 to 1.180.1
Bumps [ruby/setup-ruby](https://github.com/ruby/setup-ruby) from 1.180.0 to 1.180.1.
- [Release notes](https://github.com/ruby/setup-ruby/releases)
- [Commits](ff740bc00a...3783f195e2)

---
updated-dependencies:
- dependency-name: ruby/setup-ruby
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-17 19:56:09 -07:00
Yuta Saito
7cbe54714c extmk.rb: define Gem.target_rbconfig not to break Gem::Platform.local 2024-06-18 11:12:52 +09:00
Alexey Schepin
a3930db275 [rubygems/rubygems] Delete extra spaces left after rubocop autofix
https://github.com/rubygems/rubygems/commit/a552732bed
2024-06-18 01:52:04 +00:00
Yuta Saito
d914192012 [rubygems/rubygems] Use symbol for option key in Bundler::CLI::Install
https://github.com/rubygems/rubygems/commit/07a5faeb89
2024-06-18 00:59:37 +00:00
Yuta Saito
97a23db5ac [rubygems/rubygems] Disable install_extension_in_lib when cross-compiling
https://github.com/rubygems/rubygems/commit/643e154f32
2024-06-18 00:59:36 +00:00
Yuta Saito
3e4b694565 [rubygems/rubygems] Bundler integration for --target-rbconfig option
https://github.com/rubygems/rubygems/commit/f9fb413a19
2024-06-18 00:59:36 +00:00
Yuta Saito
273d41b9e3 [rubygems/rubygems] Add --target-rbconfig option to gem install and gem update commands
This patch adds `--target-rbconfig` option to specify the rbconfig.rb file
for the deployment target platform. This is useful when cross-compiling
gems. At the moment, this option is only available for `extconf.rb`-based
extensions.

https://github.com/rubygems/rubygems/commit/cf2843f7a2
2024-06-18 00:59:35 +00:00
Kevin Menard
91bbb78313 YJIT: Fix an unused field warning in DumpDisasm. 2024-06-17 17:14:29 -04:00
Alan Wu
657c8db8de YJIT: --yjit-dump-disasm=dir: Hold descriptor for dump file
This mainly aims to make `--yjit-dump-disasm=<relative_path>` more
usable. Previously, it crashed if the program did chdir(2), since it
opened the dump file every time when appending.

Tested with:

    ./miniruby --yjit-dump-disasm=. --yjit-call-threshold=1 -e 'Dir.chdir("/") {}'

And the `lobsters` benchmark.
2024-06-17 15:09:32 -04:00
Kevin Menard
a119b5f879 Add a fast path implementation for appending single byte values to US-ASCII strings. 2024-06-17 09:44:48 -07:00