86825 Commits

Author SHA1 Message Date
Hiroshi SHIBATA
16e1565dec [rubygems/rubygems] Removed unused gzip code
https://github.com/rubygems/rubygems/commit/ee45ebb5c3
2024-07-04 03:33:07 +00:00
Hiroshi SHIBATA
6a2c799761 [rubygems/rubygems] Rewrite WEBrick server with TCPServer and Proxy
https://github.com/rubygems/rubygems/commit/3ae4358024
2024-07-04 03:33:06 +00:00
Hiroshi SHIBATA
0cb82a810d [rubygems/rubygems] Rewrite WEBrick server with TCPServer and OpenSSL::SSL::SSLServer
https://github.com/rubygems/rubygems/commit/21319eccac
2024-07-04 03:33:06 +00:00
Hiroshi SHIBATA
b3e53495bb [rubygems/rubygems] Cleanup needless code from HTTP/HTTPS tests
https://github.com/rubygems/rubygems/commit/69bd962b56
2024-07-04 03:33:05 +00:00
Hiroshi SHIBATA
7e12b5e2ac [rubygems/rubygems] Split HTTP tests and HTTPS tests
https://github.com/rubygems/rubygems/commit/43f98b787b
2024-07-04 03:33:05 +00:00
Hiroshi SHIBATA
f6aa774a14 [rubygems/rubygems] Extract tests with local HTTP/HTTPS server from TestGemRemoteFetcher
https://github.com/rubygems/rubygems/commit/52db9fd501
2024-07-04 03:33:04 +00:00
Hiroshi SHIBATA
127221d873 [rubygems/rubygems] Extract tests with S3 resources from TestGemRemoteFetcher
https://github.com/rubygems/rubygems/commit/d3ee8d2d3b
2024-07-04 03:33:04 +00:00
Nobuyoshi Nakada
0fe024d048 Fix the return value of Integer#downto called with a block
As the document states, it should return `self`, not `nil`.
Fix up of f4b313f7338f5fbe37f73aae29f70aeb474f7f5b.
2024-07-04 12:11:12 +09:00
dependabot[bot]
70be2f4731 Bump ruby/setup-ruby from 1.183.0 to 1.184.0
Bumps [ruby/setup-ruby](https://github.com/ruby/setup-ruby) from 1.183.0 to 1.184.0.
- [Release notes](https://github.com/ruby/setup-ruby/releases)
- [Changelog](https://github.com/ruby/setup-ruby/blob/master/release.rb)
- [Commits](1d0e911f61...97e35c5302)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-03 19:55:27 -07:00
Vít Ondruch
d9398ac430
Use __CET__ macro to enable IBT support. (#11081)
According to the GCC documentation [1], the macro `__CET__` is dfined
when `-fcf-protection` compiler option is used. Therefore use this macro
to enable IBT support instead of special casing for `__OpenBSD__`.

[1]: https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html#index-fcf-protection
2024-07-04 08:37:41 +09:00
Alan Wu
b160a78d6b YJIT: Remove done TODO, fix indent
Type check now done in rb_iseqw_to_iseq().
2024-07-03 19:10:57 -04:00
Burdette Lamar
f5dfadf38b
[DOC] Doc for Integer#floor (#11077) 2024-07-03 16:00:00 -04:00
Aaron Patterson
b974c84606 Move Array#map to Ruby
Improves activerecord by about 1% on the interpreter:

```
before: ruby 3.4.0dev (2024-07-03T18:40:10Z master f88841b8f3) [arm64-darwin23]
after: ruby 3.4.0dev (2024-07-03T18:41:14Z ruby-map 6c0df4eb32) [arm64-darwin23]

------------  -----------  ----------  ----------  ----------  -------------  ------------
bench         before (ms)  stddev (%)  after (ms)  stddev (%)  after 1st itr  before/after
activerecord  235.2        0.8         233.6       0.7         1.01           1.01
------------  -----------  ----------  ----------  ----------  -------------  ------------
Legend:
- after 1st itr: ratio of before/after time for the first benchmarking iteration.
- before/after: ratio of before/after time. Higher is better for after. Above 1 represents a speedup.
```

Improves YJIT by about 4%:

```
before: ruby 3.4.0dev (2024-07-03T18:40:10Z master f88841b8f3) +YJIT [arm64-darwin23]
after: ruby 3.4.0dev (2024-07-03T18:41:14Z ruby-map 6c0df4eb32) +YJIT [arm64-darwin23]

------------  -----------  ----------  ----------  ----------  -------------  ------------
bench         before (ms)  stddev (%)  after (ms)  stddev (%)  after 1st itr  before/after
activerecord  142.1        1.2         137.0       0.6         1.00           1.04
------------  -----------  ----------  ----------  ----------  -------------  ------------
Legend:
- after 1st itr: ratio of before/after time for the first benchmarking iteration.
- before/after: ratio of before/after time. Higher is better for after. Above 1 represents a speedup.
```
2024-07-03 12:32:53 -07:00
Peter Zhu
6ac05ddb8a Remove unused gc_raw_obj_info_basic 2024-07-03 14:45:01 -04:00
Peter Zhu
05f840d641 Remove unused obj_info_basic 2024-07-03 14:44:31 -04:00
Peter Zhu
f88841b8f3 Fix ASAN builds 2024-07-03 14:40:10 -04:00
Aaron Patterson
4c9134d2b2 Move Array#select to Ruby
This speeds up the mail benchmark by about 7% on the interpreter:

```
before: ruby 3.4.0dev (2024-07-03T17:01:41Z master f4b313f733) [arm64-darwin23]
after: ruby 3.4.0dev (2024-07-03T17:45:50Z ruby-select de282cacd5) [arm64-darwin23]

-----  -----------  ----------  ----------  ----------  -------------  ------------
bench  before (ms)  stddev (%)  after (ms)  stddev (%)  after 1st itr  before/after
mail   72.9         0.8         68.2        1.0         1.02           1.07
-----  -----------  ----------  ----------  ----------  -------------  ------------
Legend:
- after 1st itr: ratio of before/after time for the first benchmarking iteration.
- before/after: ratio of before/after time. Higher is better for after. Above 1 represents a speedup.
```

YJIT is about 13% faster:

```
before: ruby 3.4.0dev (2024-07-03T17:01:41Z master f4b313f733) +YJIT [arm64-darwin23]
after: ruby 3.4.0dev (2024-07-03T17:45:50Z ruby-select de282cacd5) +YJIT [arm64-darwin23]

-----  -----------  ----------  ----------  ----------  -------------  ------------
bench  before (ms)  stddev (%)  after (ms)  stddev (%)  after 1st itr  before/after
mail   51.0         0.8         45.2        0.6         1.00           1.13
-----  -----------  ----------  ----------  ----------  -------------  ------------
Legend:
- after 1st itr: ratio of before/after time for the first benchmarking iteration.
- before/after: ratio of before/after time. Higher is better for after. Above 1 represents a speedup.
```
2024-07-03 11:32:40 -07:00
Stan Lo
7fe5f0a1d0 [ruby/irb] Introduce cd command
(https://github.com/ruby/irb/pull/971)

It's essentially a combination of pushws and popws commands that are
easier to use.

Help message:

```
Usage: cd ([target]|..)

IRB uses a stack of workspaces to keep track of context(s), with `pushws` and `popws` commands to manipulate the stack.
The `cd` command is an attempt to simplify the operation and will be subject to change.

When given:
- an object, cd will use that object as the new context by pushing it onto the workspace stack.
- "..", cd will leave the current context by popping the top workspace off the stack.
- no arguments, cd will move to the top workspace on the stack by popping off all workspaces.

Examples:

  cd Foo
  cd Foo.new
  cd @ivar
  cd ..
  cd
```

https://github.com/ruby/irb/commit/4a0e0e89b7
2024-07-03 17:17:42 +00:00
Aaron Patterson
f4b313f733 move Integer#downto to Ruby
Speeds up ChunkyPNG.

The interpreter is about 70% faster:

```
before: ruby 3.4.0dev (2024-07-03T15:16:17Z master 786cf9db48) [arm64-darwin23]
after: ruby 3.4.0dev (2024-07-03T15:32:25Z ruby-downto 0b8b744ce2) [arm64-darwin23]

----------  -----------  ----------  ----------  ----------  -------------  ------------
bench       before (ms)  stddev (%)  after (ms)  stddev (%)  after 1st itr  before/after
chunky-png  892.2        0.1         526.3       1.0         1.65           1.70
----------  -----------  ----------  ----------  ----------  -------------  ------------
Legend:
- after 1st itr: ratio of before/after time for the first benchmarking iteration.
- before/after: ratio of before/after time. Higher is better for after. Above 1 represents a speedup.
```

YJIT is 2.5x faster:

```
before: ruby 3.4.0dev (2024-07-03T15:16:17Z master 786cf9db48) +YJIT [arm64-darwin23]
after: ruby 3.4.0dev (2024-07-03T15:32:25Z ruby-downto 0b8b744ce2) +YJIT [arm64-darwin23]

----------  -----------  ----------  ----------  ----------  -------------  ------------
bench       before (ms)  stddev (%)  after (ms)  stddev (%)  after 1st itr  before/after
chunky-png  709.4        0.1         278.8       0.3         2.35           2.54
----------  -----------  ----------  ----------  ----------  -------------  ------------
Legend:
- after 1st itr: ratio of before/after time for the first benchmarking iteration.
- before/after: ratio of before/after time. Higher is better for after. Above 1 represents a speedup.
```
2024-07-03 10:01:41 -07:00
Peter Zhu
cbc40aca3a Fix compilation with RGENGC_CHECK_MODE=2 2024-07-03 11:48:12 -04:00
Jean Boussier
786cf9db48 array.c: Remove outdated assertions
Following [Feature #20589] it can happen that we change the
capacity of a frozen array, so these assertions no longer make
sense.

Normally we don't hit them because `Array#freeze` shrinks the
array, but if somehow the Array was frozen using `Object#freeze`
then we may shrink it after it was frozen.
2024-07-03 17:16:17 +02:00
Peter Zhu
5f20957b85 Move ruby_load_external_gc_from_argv to gc.h 2024-07-03 09:03:40 -04:00
Peter Zhu
9d7c9df471 [Feature #20470] Add shared GC workflow to compilers 2024-07-03 09:03:40 -04:00
Peter Zhu
9d3a58f364 [Feature #20470] Update dependencies 2024-07-03 09:03:40 -04:00
Peter Zhu
ae8ef06580 [Feature #20470] Implement support for USE_SHARED_GC
This commit implements support to load Ruby's current GC as a DSO.
2024-07-03 09:03:40 -04:00
Peter Zhu
51bd816517 [Feature #20470] Split GC into gc_impl.c
This commit splits gc.c into two files:

- gc.c now only contains code not specific to Ruby GC. This includes
  code to mark objects (which the GC implementation may choose not to
  use) and wrappers for internal APIs that the implementation may need
  to use (e.g. locking the VM).

- gc_impl.c now contains the implementation of Ruby's GC. This includes
  marking, sweeping, compaction, and statistics. Most importantly,
  gc_impl.c only uses public APIs in Ruby and a limited set of functions
  exposed in gc.c. This allows us to build gc_impl.c independently of
  Ruby and plug Ruby's GC into itself.
2024-07-03 09:03:40 -04:00
Nobuyoshi Nakada
9aa62bda46 [ruby/shellwords] [DOC] Beautify links and formats
https://github.com/ruby/shellwords/commit/53e6ef2e71
2024-07-03 10:15:26 +00:00
Nobuyoshi Nakada
777fcd18a7 [ruby/shellwords] Satisfy rdoc -C
https://github.com/ruby/shellwords/commit/fa50d40a33
2024-07-03 10:15:23 +00:00
Nobuyoshi Nakada
7a43147407 [ruby/shellwords] Exclude unnecessary files from the packages
https://github.com/ruby/shellwords/commit/08c87a964e
2024-07-03 10:15:22 +00:00
Ivo Anjo
64fef3b870 Add explicit compiler fence when pushing frames to ensure safe profiling
**What does this PR do?**

This PR tweaks the `vm_push_frame` function to add an explicit compiler
fence (`atomic_signal_fence`) to ensure profilers that use signals
to interrupt applications (stackprof, vernier, pf2, Datadog profiler)
can safely sample from the signal handler.

**Motivation:**

The `vm_push_frame` was specifically tweaked in
https://github.com/ruby/ruby/pull/3296 to initialize the a frame
before updating the `cfp` pointer.

But since there's nothing stopping the compiler from reordering
the initialization of a frame (`*cfp =`) with the update of the cfp
pointer (`ec->cfp = cfp`) we've been hesitant to rely on this on
the Datadog profiler.

In practice, after some experimentation + talking to folks, this
reordering does not seem to happen.

But since modern compilers have a way for us to exactly tell them
not to do the reordering (`atomic_signal_fence`), this seems even
better.

I've actually extracted `vm_push_frame` into the "Compiler Explorer"
website, which you can use to see the assembly output of this function
across many compilers and architectures: https://godbolt.org/z/3oxd1446K

On that link you can observe two things across many compilers:
1. The compilers are not reordering the writes
2. The barrier does not change the generated assembly output
   (== has no cost in practice)

**Additional Notes:**

The checks added in `configure.ac` define two new macros:
* `HAVE_STDATOMIC_H`
* `HAVE_DECL_ATOMIC_SIGNAL_FENCE`

Since Ruby generates an arch-specific `config.h` header with
these macros upon installation, this can be used by profilers
and other libraries to test if Ruby was compiled with the fence enabled.

**How to test the change?**

As I mentioned above, you can check https://godbolt.org/z/3oxd1446K
to confirm the compiled output of `vm_push_frame` does not change
in most compilers (at least all that I've checked on that site).
2024-07-03 18:08:57 +09:00
Grant Gardner
4d4ac00123 [ruby/openssl] Add SSLSocket#readbyte
Companion to getbyte but raise EOFError
Similar to https://github.com/ruby/openssl/pull/438

https://github.com/ruby/openssl/commit/c40f70711a
2024-07-03 08:54:18 +00:00
Aaron Patterson
93b19d56de Add regression test for mutating pack's format string
It doesn't look like there was a test added for this bug, so I'm adding
it.

Code is from here:

  https://web.archive.org/web/20160908192307/http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-dev/24445
2024-07-02 17:59:48 -07:00
Aaron Patterson
d9487dd011
Speed up chunkypng benchmark (#11087)
* Speed up chunkypng benchmark

Since d037c5196a14c03e72746ccdf0437b5dd4f80a69 we're seeing a slowdown
in ChunkyPNG benchmarks in YJIT bench. This patch addresses the
slowdown. Making the thread volatile speeds up the benchmark by 2 or 3%
on my machine.

```
before: ruby 3.4.0dev (2024-07-02T18:48:43Z master b2b8306b46) [x86_64-linux]
after: ruby 3.4.0dev (2024-07-02T20:07:44Z speed-chunkypng 418334dba9) [x86_64-linux]

----------  -----------  ----------  ----------  ----------  -------------  ------------
bench       before (ms)  stddev (%)  after (ms)  stddev (%)  after 1st itr  before/after
chunky-png  1000.2       0.1         980.6       0.1         1.02           1.02
----------  -----------  ----------  ----------  ----------  -------------  ------------
Legend:
- after 1st itr: ratio of before/after time for the first benchmarking iteration.
- before/after: ratio of before/after time. Higher is better for after. Above 1 represents a speedup.

Output:
./data/output_015.csv
```

* Update thread.c

Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>

---------

Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com>
Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
2024-07-02 22:20:01 +00:00
Kevin Menard
3407565d2f
YJIT: Use a special breakpoint address if one isn't explicitly supplied in order to support natural line stepping. (#11083)
Use a special breakpoint address if one isn't explicitly supplied in order to support natural line stepping.

ARM64 will not increment the program counter (PC) upon hitting a breakpoint instruction. Consequently, stepping through code with a debugger ends up looping back to the breakpoint instruction. LLDB has a special breakpoint address of 0xf000 that will increment the PC and allow the debugger to work as expected. This change makes it possible to debug YJIT generated code on ARM64.

More details at: https://discourse.llvm.org/t/stepping-over-a-brk-instruction-on-arm64/69766/8

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2024-07-02 15:55:17 -04:00
Jerome Dalbert
2830a6ae38 [rubygems/rubygems] Only allow valid values for --test, --ci, and --linter options
https://github.com/rubygems/rubygems/commit/d4360c9032
2024-07-02 19:54:23 +00:00
David Rodríguez
cd57c1294d [rubygems/rubygems] Only remove current platform when added right before resolution
If it has been explicitly added by `bundle lock --add-platform`, we
don't want to remove it.

https://github.com/rubygems/rubygems/commit/09cf921dd6
2024-07-02 19:53:54 +00:00
David Rodríguez
c36eb10d8b [rubygems/rubygems] Normalize dummy test server name
https://github.com/rubygems/rubygems/commit/18b38ca6b4
2024-07-02 19:53:54 +00:00
David Rodríguez
7fc04276ac [rubygems/rubygems] Refactor previous fix a bit
https://github.com/rubygems/rubygems/commit/1c80c6072f
2024-07-02 19:53:53 +00:00
Jerome Dalbert
d5500e621c [rubygems/rubygems] Feature add_dependency more prominently
https://github.com/rubygems/rubygems/commit/0236cb6191
2024-07-02 19:53:29 +00:00
eileencodes
b2b8306b46 Fix forwarding for optimized send
Always treat forwarding as a complex call.
2024-07-02 11:48:43 -07:00
eileencodes
cc8c4a60b7 Calling into a C func shouldn't fast path when forwarding
When we forward calls to C functions if the callsite is a forwarding
site it might not always be a splat, so we can't use the fast path.

Fixes:

[ruby-core:118418]
2024-07-02 11:48:43 -07:00
Gabriel Lacroix
4d94d28a4a
YJIT: Inline simple ISEQs with unused keyword parameters
This commit expands inlining for simple ISeqs to accept
callees that have unused keyword parameters and callers
that specify unused keywords. The following shows 2 new
callsites that will be inlined:

```ruby
def let(a, checked: true) = a

let(1)
let(1, checked: false)
```

Co-authored-by: Kaan Ozkan <kaan.ozkan@shopify.com>
2024-07-02 18:34:48 +00:00
eileencodes
d25b74b32c Resize arrays in rb_ary_freeze and use it for freezing arrays
While working on a separate issue we found that in some cases
`ary_heap_realloc` was being called on frozen arrays. To fix this, this
change does the following:

1) Updates `rb_ary_freeze` to assert the type is an array, return if
already frozen, and shrink the capacity if it is not embedded, shared
or a shared root.
2) Replaces `rb_obj_freeze` with `rb_ary_freeze` when the object is
always an array.
3) In `ary_heap_realloc`, ensure the new capa is set with
`ARY_SET_CAPA`. Previously the change in capa was not set.
4) Adds an assertion to `ary_heap_realloc` that the array is not frozen.

Some of this work was originally done in
https://github.com/ruby/ruby/pull/2640, referencing this issue
https://bugs.ruby-lang.org/issues/16291. There didn't appear to be any
objections to this PR, it appears to have simply lost traction.

The original PR made changes to arrays and strings at the same time,
this PR only does arrays. Also it was old enough that rather than revive
that branch I've made a new one. I added Lourens as co-author in addtion
to Aaron who helped me with this patch.

The original PR made this change for performance reasons, and while
that's still true for this PR, the goal of this PR is to avoid
calling `ary_heap_realloc` on frozen arrays. The capacity should be
shrunk _before_ the array is frozen, not after.

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
Co-Authored-By: methodmissing <lourens@methodmissing.com>
2024-07-02 10:34:23 -07:00
Andrew Konchin
cee62c6738 Update to ruby/spec@f8987ac 2024-07-02 13:33:48 +02:00
Stan Lo
d7af8afe1b [ruby/rdoc] Group code object files into the same directory
(https://github.com/ruby/rdoc/pull/1114)

It's hard to distinguish code object classes by their file names alone.
And given that we have 18 such classes, it'd make the codebase a lot
easier to understand if we grouped them into a single directory.

Given that these classes are all autoloaded in `lib/rdoc.rb` instead
of required individually, this change should have minimum impact on
projects using RDoc as they generally just require `rdoc`, not individual
files. An example is Rails' `sdoc`:
https://github.com/rails/sdoc/blob/main/lib/sdoc/rdoc_monkey_patches.rb

https://github.com/ruby/rdoc/commit/4211292ffe
2024-07-02 10:15:00 +00:00
Hiroshi SHIBATA
1ab31eb429 [ruby/fiddle] Pick ruby/ruby changes for
`test/fiddle/test_function.rb`
(https://github.com/ruby/fiddle/pull/141)

https://github.com/ruby/ruby/pull/11048#issuecomment-2185630854

---------

https://github.com/ruby/fiddle/commit/a245f19763

Co-authored-by: Yusuke Endoh <mame@ruby-lang.org>
2024-07-02 18:33:39 +09:00
Nobuyoshi Nakada
4688b92a86
[win32] Fallback release date when revision.h is not present 2024-07-02 12:39:11 +09:00
Kevin Newton
0ac9c6dc10 [ruby/prism] Fix up find and array patterns with multiple rests
https://github.com/ruby/prism/commit/035890a839
2024-07-01 15:22:40 +00:00
Kevin Newton
8fb2227205 [ruby/prism] Properly support parsing regexp in extended mode
https://github.com/ruby/prism/commit/bedc4585ed
2024-07-01 14:42:10 +00:00
Koichi Sasada
30a8dbc861 maximum showing line number on btest failure
Some tests in btest uses long src for btest and it is harmful to
check the results. This patch introducing the limitation how many
lines of code is shown on failure.
2024-07-01 12:11:28 +09:00