Commit graph

93335 commits

Author SHA1 Message Date
Luke Gruber
1afc07e815 Allow encodings to be autoloaded through transcoding functions
Make sure VM lock is not held when calling `load_transcoder_entry`, as
that causes deadlock inside ractors. `String#encode` now works inside
ractors, among others.

Atomic load the rb_encoding_list

Without this, wbcheck would sometimes hit a missing write barrier.

Co-authored-by: John Hawthorn <john.hawthorn@shopify.com>

Hold VM lock when iterating over global_enc_table.names

This st_table can be inserted into at runtime when autoloading
encodings.

minor optimization when calling Encoding.list
2025-08-12 15:19:02 -07:00
BurdetteLamar
31e8a9fced [DOC] Tweaks for GC.latest_gc_info 2025-08-12 17:06:15 -04:00
BurdetteLamar
8b530e1282 [DOC] Tweaks for GC.enable 2025-08-12 17:04:25 -04:00
BurdetteLamar
b934f989b9 [DOC] Tweaks for GC.disable 2025-08-12 17:04:06 -04:00
Takashi Kokubun
231407c251
ZJIT: Avoid compiling failed ISEQs repeatedly (#14195) 2025-08-12 13:40:42 -07:00
Jean Boussier
360be94d04 RTypedData: keep direct reference to IMEMO/fields
Similar to f3206cc79b but for TypedData.

It's quite common for TypedData objects to have a mix of reference in
their struct and some ivars.
Since we do happen to have 8B free in the RtypedData struct, we could
use it to keep a direct reference to the IMEMO/fields saving having
to synchronize the VM and lookup the `gen_fields_tbl` on every ivar
access.

For old school Data classes however, we don't have free space, but
this API is soft-deprecated and no longer very common.
2025-08-12 21:57:16 +02:00
Jean Boussier
85c52079aa set.c: Store set_table->bins at the end of set_table->entries
This saves one pointer in `struct set_table`, which would allow
`Set` objects to still fit in 80B TypedData slots even if RTypedData
goes from 32B to 40B large.

The existing set benchmark seem to show this doesn't have a very
significant impact. Smaller sets are a bit faster, larger sets
a bit slower.

It seem consistent over multiple runs, but it's unclear how much
of that is just error margin.

```
compare-ruby: ruby 3.5.0dev (2025-08-12T02:14:57Z master 428937a536) +YJIT +PRISM [arm64-darwin24]
built-ruby: ruby 3.5.0dev (2025-08-12T07:22:26Z set-entries-bounds da30024fdc) +YJIT +PRISM [arm64-darwin24]
warming up........

|                         |compare-ruby|built-ruby|
|:------------------------|-----------:|---------:|
|new_0                    |     15.459M|   15.823M|
|                         |           -|     1.02x|
|new_10                   |      3.484M|    3.574M|
|                         |           -|     1.03x|
|new_100                  |    546.992k|  564.679k|
|                         |           -|     1.03x|
|new_1000                 |     49.391k|   48.169k|
|                         |       1.03x|         -|
|aref_0                   |     18.643M|   19.350M|
|                         |           -|     1.04x|
|aref_10                  |      5.941M|    6.006M|
|                         |           -|     1.01x|
|aref_100                 |    822.197k|  814.219k|
|                         |       1.01x|         -|
|aref_1000                |     83.230k|   79.411k|
|                         |       1.05x|         -|
```
2025-08-12 21:56:57 +02:00
Kazuki Yamaguchi
507b1e4bde [ruby/openssl] pkey: skip tests using invalid keys in the FIPS mode
Some checks failed
parse.y / make (check) (push) Failing after 55s
Windows / Windows 2022/Visual C++ 2022 (check) (push) Waiting to run
Windows / Windows 2025/Visual C++ 2022 (check) (push) Waiting to run
Windows / Windows 2025/Visual C++ 2022 (test-bundled-gems) (push) Waiting to run
Windows / result (push) Blocked by required conditions
Ubuntu on WSL / wsl (push) Waiting to run
Annocheck / test-annocheck (push) Failing after 56s
Check Dependencies / Dependency checks (push) Failing after 59s
Update default gems list / Update default gems list (push) Has been skipped
CodeQL / Analyze (push) Failing after 55s
BASERUBY Check / BASERUBY (push) Failing after 52s
Misc / Miscellaneous checks (push) Failing after 1m1s
bundled_gems / update (push) Failing after 1m52s
Compilations / omnibus compilations, trigger (push) Failing after 52s
Compilations / omnibus compilations, #4 (push) Has been skipped
Compilations / omnibus compilations, #5 (push) Has been skipped
Compilations / omnibus compilations, #6 (push) Has been skipped
Compilations / omnibus compilations, #7 (push) Has been skipped
parse.y / make (test-bundled-gems) (push) Failing after 55s
WebAssembly / make (map[debugflags: name:O2 optflags:-O2 wasmoptflags:-O2]) (push) Failing after 55s
parse.y / make (test-bundler-parallel) (push) Failing after 56s
Compilations / omnibus compilations, #1 (push) Has been skipped
Compilations / omnibus compilations, #2 (push) Has been skipped
Compilations / omnibus compilations, #3 (push) Has been skipped
Compilations / omnibus compilations, #12 (push) Has been skipped
Compilations / omnibus compilations, #8 (push) Has been skipped
Compilations / omnibus compilations, #9 (push) Has been skipped
Compilations / omnibus compilations, #10 (push) Has been skipped
Compilations / omnibus compilations, #11 (push) Has been skipped
Compilations / omnibus compilations, result (push) Successful in 1m7s
In OpenSSL's master branch, importing/loading a key in the FIPS mode
automatically performs a pair-wise consistency check. This breaks tests
for OpenSSL::PKey::EC#check_key and DH#params_ok? as they use
deliberately invalid keys. These methods would not be useful in the
FIPS mode anyway.

Fixes https://github.com/ruby/openssl/issues/926

25ad8f4bdb
2025-08-12 18:08:37 +00:00
John Hawthorn
4cf05ea77a Replace stdatomic ops with explicit mem order
My previous pass missed these atomic operations using operators.
2025-08-12 10:38:00 -07:00
John Hawthorn
cb360b0b4b Implement rbimpl_atomic_value_load
This only adds the rbimpl_ version to include/ruby/atomic.h so that it
is not a new public interface.

We were already using RUBY_ATOMIC_VALUE_LOAD in a few locations. This
will allow us to use other memory orders internally when desired.
2025-08-12 10:38:00 -07:00
John Hawthorn
77d29ef73c Convert ATOMIC_LOAD_RELAXED to use new rbimpl_* 2025-08-12 10:38:00 -07:00
John Hawthorn
1d9f76096e Update rbimpl_atomic_* to all take a memory order 2025-08-12 10:38:00 -07:00
John Hawthorn
2f95eb4e80 Rename rbimpl_atomic.*_set to _store
"store" is the terminology the C11 standard uses, which allows us to use
this as a fallback.

This only changes the private rbimpl_ version of the method,
RUBY_ATOMIC_SET et al. keep the same name.
2025-08-12 10:38:00 -07:00
Peter Zhu
a9230e76ee Make Enumerator::Product write-barrier protected 2025-08-12 13:32:41 -04:00
Peter Zhu
3e1e2bda49 Make Enumerator::Chain write-barrier protected 2025-08-12 13:32:41 -04:00
Max Bernstein
998be6b3a4
ZJIT: Add flag to disable the HIR optimizer (#14181)
Also add a check in the bisect script that can assign blame to the HIR
optimizer.
2025-08-12 13:00:22 -04:00
Takashi Kokubun
e26ab5dbf2
ZJIT: Avoid splitting add_into/sub_into for x86_64 (#14177)
* ZJIT: Avoid splitting add_into/sub_into

* Require add_into/sub_into to take a Reg
2025-08-12 09:54:50 -07:00
Nobuyoshi Nakada
c5c894c6e4
[DOC] Markup example code as ruby 2025-08-12 23:43:46 +09:00
Nobuyoshi Nakada
cefd4a233f
[DOC] Use backticks instead of <tt> except for nested markups 2025-08-12 23:43:45 +09:00
Nobuyoshi Nakada
74b45dc3ee
[DOC] Use backticks instead of + in markdown mode 2025-08-12 23:43:45 +09:00
Nobuyoshi Nakada
e07510d1a3
[DOC] Markup constants as code 2025-08-12 23:43:45 +09:00
Nobuyoshi Nakada
58dbfe5285
[DOC] Fix a typo 2025-08-12 23:43:44 +09:00
Nobuyoshi Nakada
8f6f9e88c7
[DOC] Try the latest RDoc 2025-08-12 23:35:40 +09:00
Nobuyoshi Nakada
37e991b02c
[DOC] Use the specified revision RDoc 2025-08-12 23:33:48 +09:00
Peter Zhu
814eaf336a Use rb_gc_mark_and_move for autoload_data 2025-08-12 10:12:19 -04:00
Peter Zhu
0019e7c702 Use rb_gc_mark_and_move for autoload_const 2025-08-12 10:12:19 -04:00
Jun Aruga
9fa87a6688 CI: ubuntu.yml: Skip user ground id test on ppc64le and s390x
This is a temporary workaround.
2025-08-12 15:24:53 +02:00
Jun Aruga
05b654b43f CI: ubuntu.yml: Set HOME env on ppc64le and s390x
This is a temporary workaround.
2025-08-12 15:24:53 +02:00
Jun Aruga
099df0b40b CI: ubuntu.yml: Add GitHub Actions s390x case
Add the s390x case using GitHub Actions ppc64le/s390x service.
https://github.com/IBM/actionspz

We can run the ppc64le/s390x cases only in the registered upstream repositories.
https://github.com/IBM/actionspz/blob/main/docs/FAQ.md#what-about-forked-repos

The following matrix upstream logic is to skip the ppc64le/s390x in the
downstream (fork) repositories.

```
+        upstream:
+          - ${{ github.repository == 'ruby/ruby' }}
```

Use the "os" list to determine the excluded ppc64le/s390x cases by using the
"exclude" syntax. Because the "exclude" syntax are executed before the
"include" syntax.

Add the ubuntu-24.04-ppc64le as a comment, because the GitHub Actions ppc64le
case has the following test errors and failures.
https://bugs.ruby-lang.org/issues/21534
2025-08-12 15:24:53 +02:00
Nobuyoshi Nakada
e2aeb7d977
Use $(SRC_FILE) and $(OS_DEST_FILE)
NMake combines VPATH and stem with a backslash.  The resulting source
name is embedded verbatim, backslash included, into the generated file
using the `#line` pragma (e.g., "src\gc.rb").  This causes the warning
"C4129: Unrecognized character escape sequence".
2025-08-12 18:54:23 +09:00
Nobuyoshi Nakada
401932c18f
NMake needs caret to escape a hash sign 2025-08-12 18:19:09 +09:00
Nobuyoshi Nakada
6b2d9ed2a5
Handle preperly comments in middle of lines in gems/bundled_gems 2025-08-12 16:04:57 +09:00
Peter Zhu
428937a536 [DOC] Fix docs for GC.config
After commit 61fff8a, GC.config now returns the same hash for getting and
setting.
2025-08-11 22:14:57 -04:00
Burdette Lamar
306df12949
[DOC] New .md file to replace doc/globals.rdoc 2025-08-11 22:02:59 -04:00
Sutou Kouhei
f2c7968a42 [ruby/stringio] Fix test name
(https://github.com/ruby/stringio/pull/139)

0edc8e22da
2025-08-12 01:16:46 +00:00
Alan Wu
8b1afbc6ed CI: Surface Rust warnings on PRs that touch any Rust code
Rust PRs will have a failed CI step if they trigger any warnings.
This helps us stay on top of warnings from new Rust releases and
also ones we accidentally write.

Fix a typo for demo, since this only runs when Rust files are changed.
2025-08-11 20:12:25 -04:00
Alan Wu
0070c26aec ZJIT: CI: Use Rust version built into GitHub Actions image
Saves the work of installing Rust for most jobs. Keep a job on each
platform that tests 1.85.0, the minimum supported version, though.
2025-08-11 18:53:48 -04:00
Stan Lo
4da569b53e [DOC] YJIT: Add YJIT to autolink_excluded_words 2025-08-11 18:37:51 -04:00
Stan Lo
39effad486 [DOC] ZJIT: Add ZJIT to autolink_excluded_words
This tells RDoc to not automatically link to the `ZJIT` module so we
don't need to keep escaping the word ZJIT in the documentation/comments.
2025-08-11 18:37:51 -04:00
Takashi Kokubun
9fb34f4f16
ZJIT: Add --zjit-exec-mem-size (#14175)
* ZJIT: Add --zjit-exec-mem-size

* Add a comment about the limit
2025-08-11 15:36:37 -07:00
Stan Lo
e29d333454
ZJIT: Implement concatstrings insn (#14154)
Co-authored-by: Alexander Momchilov <alexander.momchilov@shopify.com>
2025-08-11 15:07:26 -07:00
Takashi Kokubun
4f34eddbd3
YJIT, ZJIT: Fix JITs compiling prelude (#14171) 2025-08-11 14:35:34 -07:00
Takashi Kokubun
319550527f
ZJIT: Add compile/profile/GC/invalidation time stats (#14158)
Co-authored-by: Stan Lo <stan001212@gmail.com>
2025-08-11 13:21:45 -07:00
Takashi Kokubun
6968668570
ZJIT: Add RubyVM::ZJIT.enabled? (#14159)
Co-authored-by: Max Bernstein <tekknolagi@gmail.com>
2025-08-11 13:18:52 -07:00
Alan Wu
6e3790b17f YJIT: Fix mismatched_lifetime_syntaxes, new in Rust 1.89.0 2025-08-11 15:49:14 -04:00
Alan Wu
5b956fbf60 ZJIT: Fix mismatched_lifetime_syntaxes, new in Rust 1.89.0 2025-08-11 15:49:14 -04:00
Peter Zhu
61fff8a92f Fix return value of setting in GC.config
gc_config_set returned rb_gc_impl_config_get, but gc_config_get also added
the implementation key to the return value. This caused the return value
of GC.config to differ depending on whether the optional hash argument is
provided or not.
2025-08-11 10:20:33 -04:00
S-H-GAMELINKS
4775d1ffa8 Add NODE IN locations
Add locations to struct `RNode_IN`.

memo:

```bash
> ruby -e 'case 1; in 2 then 3; end' --parser=prism --dump=parsetree
@ ProgramNode (location: (1,0)-(1,24))
+-- locals: []
+-- statements:
    @ StatementsNode (location: (1,0)-(1,24))
    +-- body: (length: 1)
        +-- @ CaseMatchNode (location: (1,0)-(1,24))
            +-- predicate:
            |   @ IntegerNode (location: (1,5)-(1,6))
            |   +-- IntegerBaseFlags: decimal
            |   +-- value: 1
            +-- conditions: (length: 1)
            |   +-- @ InNode (location: (1,8)-(1,19))
            |       +-- pattern:
            |       |   @ IntegerNode (location: (1,11)-(1,12))
            |       |   +-- IntegerBaseFlags: decimal
            |       |   +-- value: 2
            |       +-- statements:
            |       |   @ StatementsNode (location: (1,18)-(1,19))
            |       |   +-- body: (length: 1)
            |       |       +-- @ IntegerNode (location: (1,18)-(1,19))
            |       |           +-- IntegerBaseFlags: decimal
            |       |           +-- value: 3
            |       +-- in_loc: (1,8)-(1,10) = "in"
            |       +-- then_loc: (1,13)-(1,17) = "then"
            +-- else_clause: nil
            +-- case_keyword_loc: (1,0)-(1,4) = "case"
            +-- end_keyword_loc: (1,21)-(1,24) = "end"
```
2025-08-11 22:25:47 +09:00
Burdette Lamar
e0b72ad2f1
[DOC] Update JIT options 2025-08-11 09:25:07 -04:00
BurdetteLamar
ad14632095 [DOC] Tweaks for GC.config 2025-08-11 09:24:06 -04:00