Commit graph

91489 commits

Author SHA1 Message Date
Daniel Colson
48a360baa4 Fix C level backtraces for USE_ELF
After upgrading GitHub to Ruby 3.4 we noticed that we stopped getting
useful C level backtrace information in our crash reports. We traced it
back to 7dd2afbe3a.

Passing 0 instead of -1 made sense for the Mach-O version of
`fill_lines`, but there is a separate ELF version of `fill_lines` that
still has special handling for -1: 58e3aa0224/addr2line.c (L2178-L2209)

Without this special handling for the main executable, we don't have the
right `base_addr` when reading debug info, and so we fail to populate
the information for that line: 58e3aa0224/addr2line.c (L1948)
Then we get to 58e3aa0224/addr2line.c (L2649),
and potentially (depending on how things were run) get back `"ruby"` as
`info.dli_fname` instead of the absolute path for the executable. We set
that as the `binary_filename` and then try to open it inside the next
call to `fill_lines`, but that fails (unless you happen to be in the
directory where the ruby executable lives) and break out of filling
lines entirely: 58e3aa0224/addr2line.c (L2673-L2674)

This commit treats offset 0 as the main executable, rather than having
a special meaning for -1 (which gets turned into 0 anyway).

[Bug #21289]
2025-05-01 16:58:06 -07:00
Sam Rawlins
3176cd6993 [ruby/psych] fix error in @dispatch_catch
9df5501fdc
2025-05-01 17:54:18 +00:00
nick evans
136dc52663 Add support for Data objects with ivars
This sets the ivars _before_ calling initialize, which feels wrong.  But
Data doesn't give us any mechanism for setting the members other than 1)
initialize, or 2) drop down into the C API.  Since initialize freezes
the object, we need to set the ivars before that.  I think this is a
reasonable compromise—if users need better handling, they can implement
their own `encode_with` and `init_with`.  But it will lead to unhappy
surprises for some users.

Alternatively, we could use the C API, similarly to Marshal.  Psych _is_
already using the C API for path2class and build_exception.  This would
be the least surprising behavior for users, I think.
2025-05-01 17:52:14 +00:00
nick evans
a397e4d4b0 [ruby/psych] Add support for ruby 3.2 Data objects
788b844c83
2025-05-01 17:52:13 +00:00
Martin Meyerhoff
bd1d6e8cd7 [ruby/psych] Fix loading/parsing regular expressions
This fixes the issue where regular expression would come back slightly
different after going through a YAML load/dump cycle. Because we're used
to having to escape forward slashes in regular expression literals
(because the literal is delimited by slashes), but the deserializer
takes the literal output from `Regexp#inspect` and feeds it as a string
into `Regexp.new`, which expects a string, not a Regexp literal, cycling
did not properly work before this commit.

I've also changed the code to be a bit more readable, I hope this
doesn't affect performance.

f4dd8dadad
2025-05-01 17:50:13 +00:00
Takashi Kokubun
67b91e7807 Drop an ignored attribute
GCC 13.3.0 (Ubuntu 24.04) emits the following warning:

../symbol.c: In function ‘rb_id_attrset’:
../symbol.c:175:9: warning: ‘nonstring’ attribute ignored on objects of type ‘const char[][8]’ [-Wattributes]
  175 |         RBIMPL_ATTR_NONSTRING() static const char id_types[][8] = {
      |         ^~~~~~~~~~~~~~~~~~~~~
2025-05-01 10:26:20 -07:00
git
17e63f90ca Update default gems list at b63c4d14f2 [ci skip] 2025-05-01 16:35:17 +00:00
Aaron Patterson
b63c4d14f2 [ruby/psych] Bump version for release
bb63f91825
2025-05-01 16:34:09 +00:00
Burdette Lamar
79fe8aa010
[DOC] Tweaks for String.new 2025-05-01 10:51:22 -04:00
Yusuke Endoh
5cee3329df Skip test affected by TracePoint-dependent allocation_class_path
These assertions fail when TracePoint is enabled due to differing
allocation context. Commented out for now until behavior is fixed.

See [Bug #21298]
2025-05-01 17:21:36 +09:00
Jean Boussier
de6e59e5ba Sync ruby/json
Fix: https://github.com/ruby/json/issues/796
2025-05-01 10:06:04 +02:00
Yusuke Endoh
e8ad728209 Omit tests using ISeq#to_binary under coverage measurement
... because ISeq#to_binary does not work
2025-05-01 14:15:55 +09:00
Yusuke Endoh
1c89b1ec60 Reset GC.stress to avoid slow coverage processing during process exit 2025-05-01 14:08:33 +09:00
Hiroshi SHIBATA
994dadfbf4 Removed unused OS_VER variable 2025-05-01 10:46:00 +09:00
Hiroshi SHIBATA
17912cb500 windows-2019 will be EOL at end of June, 2025 2025-05-01 10:46:00 +09:00
Max Bernstein
5411b504a5
ZJIT: Use RefCell to allow path compression in union-find (#13218)
Use RefCell to allow path compression in union-find

When I wrote the original version I didn't understand the interior
mutability pattern, but now I do! With this commit, we should have a
more optimal union-find implementation.
2025-04-30 16:28:22 -07:00
John Hawthorn
7866e124a8 Use rb_current_ec_noinline in assertions
When doing a coroutine transfer from one thread to another, there's a
risk that the compiler will reuse an address from TLS before the
transfer to the new thread.

These VM assertions are all in places we would not otherwise be reading
from TLS, but using the value of `ec` or `cr` passed in. Switching these
to test against rb_current_ec_noinline() instead ensures there isn't an
optimization applied to how we read ruby_current_ec.

Currently it seems we were hitting this on LLVM 18 specifically, but I
don't know of any reason other versions wouldn't have the same issue.
2025-04-30 15:36:58 -07:00
Max Bernstein
73fdd90315
ZJIT: Compile opt_new to slow-path SendWithoutBlock (#13216) 2025-04-30 14:48:12 -07:00
Jean Boussier
c65991978b get_next_shape_internal: Skip VM lock for single child case
If the shape has only one child, we check it lock-free without
compromising thread safety.

I haven't computed hard data as to how often that it the case,
but we can assume that it's not too rare for shapes to have
a single child that is often requested, typically when freezing
and object.
2025-04-30 23:32:33 +02:00
Jean Boussier
f55138c9e7 [ruby/psych] Handle Ruby 3.5 new Set class
Since `Set` no longer is a regular object class holding a Hash
it needs to be specially handled.

c2d185d27c
2025-04-30 18:31:33 +00:00
Matt Valentine-House
46c9e46ef6 [ruby/mmtk] Exclude the test_ractor_parallel test with MMTk
86b0dbeca8
2025-04-30 13:41:21 +00:00
Matt Valentine-House
59a902cd79 [ruby/mmtk] test_finalize is in TestObjectSpace not TestObjSpace
These filenames are passed into test classes, and the tests we're trying
to exclude exist in TestObjectSpace in the Ruby repo, not TestObjSpace

195728dc8c
2025-04-30 13:41:21 +00:00
Nobuyoshi Nakada
b42afa1dbc
Suppress gcc 15 unterminated-string-initialization warnings 2025-04-30 20:04:10 +09:00
Alan Wu
545aafa2a2
ZJIT: Add make zjit-test-lldb [ci skip]
Handy for dropping into LLDB for a Rust test.
2025-04-30 19:49:54 +09:00
Alan Wu
719486a642 Fix C23 (GCC 15) WIN32 compatibility for rb_define_* functions
Fixes [Bug #21286]
2025-04-30 19:44:59 +09:00
Hiroshi SHIBATA
39ba16e5a1 Re-enabled repl_type_completor test with upstream fix
https://github.com/ruby/repl_type_completor/pull/62
2025-04-30 16:59:25 +09:00
Hiroshi SHIBATA
8b4017584b Use EnvUtil.apply_timeout_scale for test_io_wait.rb 2025-04-30 16:59:16 +09:00
git
142998fdaa Update bundled gems list as of 2025-04-30 2025-04-30 07:04:02 +00:00
git
d046c0a471 Update default gems list at 6e7825316e [ci skip] 2025-04-30 06:13:46 +00:00
Jean Boussier
6e7825316e [ruby/json] Remove explicit include of extconf.h
6b059900de

.
2025-04-30 08:12:41 +02:00
Jean Boussier
6ba0dc4d97 [ruby/json] Fix --with-static-linked-ext builds
d7d60cccb0
2025-04-30 08:12:41 +02:00
Jean Boussier
338adad8ba [ruby/json] Fix i686 builds
We should test compilation with `-msse2` because we need to
test with whatever arguments Ruby will be compiled with.

0a871365db
2025-04-30 08:12:41 +02:00
Jean Boussier
b5beed45a2 [ruby/json] SIMD: Match control char and double quote in one pass
`c < 32 || c == 34` is equivalent to `c ^ 2 < 33`.

Found in: https://lemire.me/blog/2025/04/13/detect-control-characters-quotes-and-backslashes-efficiently-using-swar/

The gain seem mostly present on micro-benchmark, and even there aren't
very consistent, but it's never slower.

```
== Encoding long string (124001 bytes)
ruby 3.4.2 (2025-02-15 revision d2930f8e7a) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
               after     5.295k i/100ms
Calculating -------------------------------------
               after     55.796k (± 3.4%) i/s   (17.92 μs/i) -    280.635k in   5.035690s

Comparison:
              before:    49840.7 i/s
               after:    55795.8 i/s - 1.12x  faster
```

034c5debd8
2025-04-30 08:12:41 +02:00
Jean Boussier
b7d1e33f26 Update ext/json/generator/depend 2025-04-30 08:12:41 +02:00
Scott Myron
a3ec53bbb0 [ruby/json] Introduce ARM Neon and SSE2 SIMD.
(https://github.com/ruby/json/pull/743)

See the pull request for the long development history: https://github.com/ruby/json/pull/743

```
== Encoding activitypub.json (52595 bytes)
ruby 3.4.2 (2025-02-15 revision d2930f8e7a) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
               after     2.913k i/100ms
Calculating -------------------------------------
               after     29.377k (± 2.0%) i/s   (34.04 μs/i) -    148.563k in   5.059169s

Comparison:
              before:    23314.1 i/s
               after:    29377.3 i/s - 1.26x  faster

== Encoding citm_catalog.json (500298 bytes)
ruby 3.4.2 (2025-02-15 revision d2930f8e7a) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
               after   152.000 i/100ms
Calculating -------------------------------------
               after      1.569k (± 0.8%) i/s  (637.49 μs/i) -      7.904k in   5.039001s

Comparison:
              before:     1485.6 i/s
               after:     1568.7 i/s - 1.06x  faster

== Encoding twitter.json (466906 bytes)
ruby 3.4.2 (2025-02-15 revision d2930f8e7a) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
               after   309.000 i/100ms
Calculating -------------------------------------
               after      3.115k (± 3.1%) i/s  (321.01 μs/i) -     15.759k in   5.063776s

Comparison:
              before:     2508.3 i/s
               after:     3115.2 i/s - 1.24x  faster
```

49003523da
2025-04-30 08:12:41 +02:00
Jean Boussier
7f0c6d30d3 [ruby/json] Use RB_TYPE_P
b14250f1da
2025-04-30 08:12:41 +02:00
Jean Boussier
5566a7f740 [ruby/json] Handle non-string keys returning immediate values via to_s
We can't directly call `RBASIC_CLASS` as the return value of
`to_s` may be an immediate.

12dc394d11
2025-04-30 08:12:41 +02:00
Jean Boussier
1103611600 [ruby/json] Release 2.11.3
3e025f76d7
2025-04-30 08:12:41 +02:00
Jean Boussier
8fe3fb5d5a [ruby/json] Stop caching the generator state pointer
Fix: https://github.com/ruby/json/issues/790

If we end up calling something that spills the state
on the heap, the pointer we received is outdated and
may be out of sync.

2ffa4ea46b
2025-04-30 08:12:41 +02:00
Jean Boussier
18dac125cb Improve syntax style consistency in shape.c and shape.h
Most of this code use the `type * name` style, while the
overwhemling majority of the rest of ruby use the `type *name`
style.

This is a cosmetic change, but helps with readability.
2025-04-30 08:10:55 +02:00
Matt Valentine-House
5e8b744dbc RUBY_T_{TRUE,FALSE} comments were reversed
[ci skip]
2025-04-30 08:08:54 +02:00
Hiroshi SHIBATA
cbc045a0ea Added GCC 15 build 2025-04-30 13:12:19 +09:00
Takashi Kokubun
6f1caa561c
Update auto_request_review config for YJIT/ZJIT (#13209) 2025-04-29 15:54:25 -07:00
Jean Boussier
87117756b5 st.c: Removed unused set_add_direct_with_hash function 2025-04-29 23:19:51 +02:00
Jean Boussier
b5426826f9 test/ruby/test_set.rb: mmtk doesn't have GC.compact 2025-04-29 22:36:06 +02:00
Aaron Patterson
203614080f opt_new needs to happen after safe navigation
If safe navigation instructions happen first, we get a stack
inconsistency error.
2025-04-29 13:33:23 -07:00
Aaron Patterson
e6974be545 Don't call hash tombstone compaction from GC compaction
Tombstone removal may possibly require allocation, and we're not allowed
to allocate during GC.  This commit also renames `set_compact` to
`set_update_references` to differentiate tombstone removal compaction with GC
object compaction.

Co-Authored-By: Max Bernstein <max.bernstein@shopify.com>
Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2025-04-29 13:33:10 -07:00
Takashi Kokubun
9cdc46587d Explain a missing USE_ZJIT check on rb_vm_max_insn_name_size 2025-04-29 11:10:49 -07:00
Takashi Kokubun
0f3d6ee578
ZJIT: Disable ZJIT instructions when USE_ZJIT is 0 (#13199)
* ZJIT: Disable ZJIT instructions when USE_ZJIT is 0

* Test the order of ZJIT instructions

* Add more jobs that disable JITs

* Show instruction names in the message
2025-04-29 11:03:13 -07:00
Max Bernstein
0c44e5ab5e Make sure to call find() on basic block arguments
This ensures basic block arguments keep instructions alive, etc.
2025-04-29 11:01:33 -07:00