ruby.git
68 min agoRemove dependency on debug_counter.h when BUILDING_MODULAR_GCmaster
Peter Zhu [Wed, 7 May 2025 19:14:04 +0000 (7 15:14 -0400)]
Remove dependency on debug_counter.h when BUILDING_MODULAR_GC

This allows the default GC to not need debug_counter.h when building as a
modular GC.

68 min agoStop checking for USE_DEBUG_COUNTER in default.c
Peter Zhu [Wed, 7 May 2025 19:13:57 +0000 (7 15:13 -0400)]
Stop checking for USE_DEBUG_COUNTER in default.c

We don't need to check for USE_DEBUG_COUNTER because the code is no-op
if USE_DEBUG_COUNTER is not enabled.

73 min ago[DOC] Tweaks for String#-@
Burdette Lamar [Thu, 8 May 2025 14:31:47 +0000 (8 09:31 -0500)]
[DOC] Tweaks for String#-@

3 hours agoZJIT: Temporarily revert path compression
Max Bernstein [Thu, 8 May 2025 12:22:44 +0000 (8 08:22 -0400)]
ZJIT: Temporarily revert path compression

For reasons I don't understand yet, this causes an issue when trying to
boot yjit-bench. Temporarily revert it.

6 hours agoAdd depend files under ext/-test-
Nobuyoshi Nakada [Thu, 8 May 2025 08:31:56 +0000 (8 17:31 +0900)]
Add depend files under ext/-test-

6 hours ago[rubygems/rubygems] Update `TarWriter` test to store mtime in a variable
Ellen Marie Dash [Mon, 5 May 2025 22:03:26 +0000 (5 18:03 -0400)]
[rubygems/rubygems] Update `TarWriter` test to store mtime in a variable

https://github.com/rubygems/rubygems/commit/0e2cec3fa3

6 hours ago[rubygems/rubygems] Add mtime to Gem::Package::TarWriter#add_file argument
Yusuke Nakamura [Sat, 3 May 2025 14:59:41 +0000 (3 23:59 +0900)]
[rubygems/rubygems] Add mtime to Gem::Package::TarWriter#add_file argument

Since 9e21dd9, Gem::Package::TarWriter#add_file adds the file to
the tar with Gem.source_date_epoch for its mtime.
This behavior breaks the code depending on the previous add_file
behavior.
Therefore, add_file accepts mtime as an argument, and uses
Gem.source_date_epoch if not specified.

https://github.com/rubygems/rubygems/commit/7020ea98a0

6 hours ago[ruby/strscan] jruby: Check if len++ walked off the end
Charles Oliver Nutter [Sat, 3 May 2025 04:26:05 +0000 (2 23:26 -0500)]
[ruby/strscan] jruby: Check if len++ walked off the end
(https://github.com/ruby/strscan/pull/153)

Fix https://github.com/ruby/strscan/pull/152

CRuby can walk off the end because there's always a null byte. In JRuby,
the byte array is often (usually?) the exact size of the string. So we
need to check if len++ walked off the end.

This code was ported from a version by @byroot in
https://github.com/ruby/strscan/pull/127 but I missed adding this check
due to a lack of tests. A test is included for both "-" and "+" parsing.

https://github.com/ruby/strscan/commit/1abe4ca556

6 hours ago[ruby/strscan] jruby: Pass end index to byteListToInum
Charles Oliver Nutter [Sat, 3 May 2025 00:26:53 +0000 (2 19:26 -0500)]
[ruby/strscan] jruby: Pass end index to byteListToInum
(https://github.com/ruby/strscan/pull/150)

These parse methods take begin and end indices, not begin and length. A
test is included.

Fixes https://github.com/jruby/jruby/issues/8823

https://github.com/ruby/strscan/commit/9690e39e73

6 hours ago[ruby/json] Constify static data in fpconv.c
Nobuyoshi Nakada [Tue, 6 May 2025 09:22:18 +0000 (6 18:22 +0900)]
[ruby/json] Constify static data in fpconv.c

https://github.com/ruby/json/commit/3b605d9b1e

6 hours ago[ruby/psych] Refine Ruby 3.5 Set support.
Jean Boussier [Sat, 3 May 2025 10:57:39 +0000 (3 12:57 +0200)]
[ruby/psych] Refine Ruby 3.5 Set support.

Use feature testing to detect native Set,
and don't rely on `Set#to_h` which wasn't intended
as a public method.

https://github.com/ruby/psych/commit/d58cff11af

7 hours agoMake test/ruby/test_env.rb#test_delete_if_in_ractor easier to debug
Jean Boussier [Thu, 8 May 2025 07:11:09 +0000 (8 09:11 +0200)]
Make test/ruby/test_env.rb#test_delete_if_in_ractor easier to debug

7 hours agovariable.c: Fix compilation warnings
Jean Boussier [Thu, 8 May 2025 07:05:28 +0000 (8 09:05 +0200)]
variable.c: Fix compilation warnings

```
variable.c: In function ‘iterate_over_shapes_with_callback’:
variable.c:2188:1: warning: control reaches end of non-void function [-Wreturn-type]
 2188 | }
      | ^
variable.c: In function ‘rb_field_get’:
variable.c:1322:43: warning: ‘fields_tbl’ may be used uninitialized [-Wmaybe-uninitialized]
 1322 |         return fields_tbl->as.shape.fields[attr_index];
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
variable.c:1319:32: note: ‘fields_tbl’ was declared here
 1319 |         struct gen_fields_tbl *fields_tbl;
      |
```

9 hours agoRefactor `id_to_obj_tbl` compaction
Jean Boussier [Wed, 7 May 2025 16:17:16 +0000 (7 18:17 +0200)]
Refactor `id_to_obj_tbl` compaction

Use `st_foreach_with_replace` rather than to call `st_insert`
from inside `st_foreach`, this saves from having to disable GC.

Co-Authored-By: Peter Zhu <[email protected]>
9 hours agoGet rid of RB_GC_VM_ID_TO_OBJ_TABLE_KEYS
Jean Boussier [Wed, 7 May 2025 15:56:13 +0000 (7 17:56 +0200)]
Get rid of RB_GC_VM_ID_TO_OBJ_TABLE_KEYS

9 hours agoMove `object_id` in object fields.
Jean Boussier [Mon, 21 Apr 2025 07:16:07 +0000 (21 16:16 +0900)]
Move `object_id` in object fields.

And get rid of the `obj_to_id_tbl`

It's no longer needed, the `object_id` is now stored inline
in the object alongside instance variables.

We still need the inverse table in case `_id2ref` is invoked, but
we lazily build it by walking the heap if that happens.

The `object_id` concern is also no longer a GC implementation
concern, but a generic implementation.

Co-Authored-By: Matt Valentine-House <[email protected]>
9 hours agoshape.c: refactor frozen shape to no longer be final
Jean Boussier [Mon, 21 Apr 2025 03:01:01 +0000 (21 12:01 +0900)]
shape.c: refactor frozen shape to no longer be final

This opens the door to store more informations in shapes, such
as the `object_id` or object address in case it has been observed
and the object has to be moved.

9 hours agoRefactor OBJ_TOO_COMPLEX_SHAPE_ID to not be referenced outside shape.h
Jean Boussier [Mon, 5 May 2025 09:10:08 +0000 (5 11:10 +0200)]
Refactor OBJ_TOO_COMPLEX_SHAPE_ID to not be referenced outside shape.h

Also refactor checks for `->type == SHAPE_OBJ_TOO_COMPLEX`.

9 hours agoRename `ivptr` -> `fields`, `next_iv_index` -> `next_field_index`
Jean Boussier [Wed, 30 Apr 2025 07:42:57 +0000 (30 09:42 +0200)]
Rename `ivptr` -> `fields`,  `next_iv_index` -> `next_field_index`

Ivars will longer be the only thing stored inline
via shapes, so keeping the `iv_index` and `ivptr` names
would be confusing.

Instance variables won't be the only thing stored inline
via shapes, so keeping the `ivptr` name would be confusing.

`field` encompass anything that can be stored in a VALUE array.

Similarly, `gen_ivtbl` becomes `gen_fields_tbl`.

12 hours agoAdded depend file for test/-ext-/econv/test_append.rb
Hiroshi SHIBATA [Thu, 8 May 2025 02:53:39 +0000 (8 11:53 +0900)]
Added depend file for test/-ext-/econv/test_append.rb

https://github.com/ruby/ruby/commit/ce51ef30df5bf07ec3881a377f0011b8f20ec507 broke
ext/-test-/econv/append.o. We should rebuild that object file when dependencies are updated.

23 hours agoRemove dependence on internal/hash.h for default GC
Peter Zhu [Tue, 6 May 2025 20:46:06 +0000 (6 16:46 -0400)]
Remove dependence on internal/hash.h for default GC

41 hours agoEnabled debug mode for CodeQL
Hiroshi SHIBATA [Fri, 2 May 2025 09:17:52 +0000 (2 18:17 +0900)]
Enabled debug mode for CodeQL

46 hours agoImprove correctness contention for allocated object counts
Étienne Barrié [Mon, 28 Apr 2025 09:53:49 +0000 (28 11:53 +0200)]
Improve correctness contention for allocated object counts

Currently the count of allocated object for a heap is incremented
without regards to parallelism which leads to incorrect counts.

By maintaining a local counter in the ractor newobj cache, and only
syncing atomically with some granularity, we can improve the correctness
without increasing contention.

The allocated object count is also synced when the ractor is freed.

Co-authored-by: Jean Boussier <[email protected]>
2 days agoParse topn, opt_length, opt_size into HIR
Max Bernstein [Fri, 2 May 2025 21:11:52 +0000 (2 17:11 -0400)]
Parse topn, opt_length, opt_size into HIR

2 days agoYJIT: End the block after OPTIMIZE_METHOD_TYPE_CALL (#13245)
Takashi Kokubun [Mon, 5 May 2025 20:35:28 +0000 (5 13:35 -0700)]
YJIT: End the block after OPTIMIZE_METHOD_TYPE_CALL (#13245)

2 days agoZJIT: Use 2024 edition for rustc-only release builds
Alan Wu [Mon, 5 May 2025 15:30:29 +0000 (6 00:30 +0900)]
ZJIT: Use 2024 edition for rustc-only release builds

3 days agovm_dump.c: avoid `USE_MN_THREADS` is not defined warning
Jean Boussier [Mon, 5 May 2025 13:55:42 +0000 (5 15:55 +0200)]
vm_dump.c: avoid `USE_MN_THREADS` is not defined warning

3 days agoFix `USE_MN_THREADS=0` builds on macOS
Jean Boussier [Mon, 5 May 2025 13:00:02 +0000 (5 15:00 +0200)]
Fix `USE_MN_THREADS=0` builds on macOS

This was recently broken.

3 days agoMake rb_shape.capacity an `attr_index_t`
Jean Boussier [Mon, 5 May 2025 11:54:34 +0000 (5 13:54 +0200)]
Make rb_shape.capacity an `attr_index_t`

3 days agovariable.c: Fix too_complex shape initialization
Jean Boussier [Mon, 5 May 2025 11:47:08 +0000 (5 13:47 +0200)]
variable.c: Fix too_complex shape initialization

`SHAPE_OBJ_TOO_COMPLEX` is a `shape_type` not a `shape_id_t`.

3 days agoImprove style consistency of `rb_shape_t *`
Jean Boussier [Mon, 5 May 2025 11:45:29 +0000 (5 13:45 +0200)]
Improve style consistency of `rb_shape_t *`

3 days ago[ruby/digest] stringop-overread warning is since GCC 11
Nobuyoshi Nakada [Mon, 5 May 2025 08:44:53 +0000 (5 17:44 +0900)]
[ruby/digest] stringop-overread warning is since GCC 11

https://github.com/ruby/digest/commit/d16853fe8c

3 days agoAdd `RBIMPL_ATTR_NONSTRING_ARRAY()` macro for GCC 15
Nobuyoshi Nakada [Mon, 5 May 2025 07:16:26 +0000 (5 16:16 +0900)]
Add `RBIMPL_ATTR_NONSTRING_ARRAY()` macro for GCC 15

3 days agoSave one VALUE per embedded RTypedData
Jeremy Evans [Mon, 28 Apr 2025 00:23:04 +0000 (27 17:23 -0700)]
Save one VALUE per embedded RTypedData

This halves the amount of memory used for embedded RTypedData if they
are one VALUE (8 bytes on 64-bit platforms) over the slot size limit.

For Set, on 64-bit it uses an embedded 56-byte struct.  With the
previous implementation, the embedded structs starts at offset 32,
resulting in a total size of 88.  Since that is over the 80 byte
limit, it goes to the next highest bucket, 160 bytes, wasting 72
bytes.  This allows it to fit in a 80 byte bucket, which reduces
the total size for small sets of from 224 bytes (160 bytes
embedded, 64 bytes malloc, 72 bytes wasted in embedding) to 144
bytes (80 bytes embedded, 64 bytes malloc, 0 bytes wasted in
embedding).

Any other embedded RTypedData will see similar advantages if they
are currently one VALUE over the limit.

To implement this, remove the typed_flag from struct RTypedData.
Embed the typed_flag information in the type member, which is
now a tagged pointer using VALUE type, using the bottom low 2 bits
as flags (1 bit for typed flag, the other for the embedded flag).
To get the actual pointer, RTYPEDDATA_TYPE masks out
the low 2 bits and then casts.  That moves the RTypedData data
pointer from offset 32 to offset 24 (on 64-bit).

Vast amount of code in the internals (and probably external C
extensions) expects the following code to work for both RData and
non-embedded RTypedData:

```c
DATA_PTR(obj) = some_pointer;
```

Allow this to work by moving the data pointer in RData between
the dmark and dfree pointers, so it is at the same offset (24
on 64-bit).

Other than these changes to the include files, the only changes
needed were to gc.c, to account for the new struct layouts,
handle setting the low bits in the type member, and to use
RTYPEDDATA_TYPE(obj) instead of RTYPEDDATA(obj)->type.

3 days ago[DOC] Tweaks for String#+
BurdetteLamar [Sat, 3 May 2025 17:39:06 +0000 (3 12:39 -0500)]
[DOC] Tweaks for String#+

3 days ago[DOC] Tweaks for String#*
BurdetteLamar [Sat, 3 May 2025 17:24:54 +0000 (3 12:24 -0500)]
[DOC] Tweaks for String#*

3 days ago[DOC] Tweaks for String#%
BurdetteLamar [Fri, 2 May 2025 23:02:47 +0000 (2 18:02 -0500)]
[DOC] Tweaks for String#%

4 days ago[Bug #21304] Reload length and pointer after `#hash` method
Nobuyoshi Nakada [Sun, 4 May 2025 12:40:33 +0000 (4 21:40 +0900)]
[Bug #21304] Reload length and pointer after `#hash` method

The receiver can be modified during the method calls.

4 days agoHandle mutating of array passed to Set.new during iteration
Jeremy Evans [Sat, 3 May 2025 18:20:23 +0000 (3 11:20 -0700)]
Handle mutating of array passed to Set.new during iteration

This avoids a heap-use-after-free.

Fixes [Bug #21306]

4 days agoHandle mutation of array being merged into set
Jeremy Evans [Sat, 3 May 2025 18:07:22 +0000 (3 11:07 -0700)]
Handle mutation of array being merged into set

Check length of array during every iteration, as a #hash method
could truncate the array, resulting in heap-use-after-free.

Fixes [Bug #21305]

4 days agoFix an ASAN error in Array#difference
Yusuke Endoh [Sat, 3 May 2025 16:47:03 +0000 (4 01:47 +0900)]
Fix an ASAN error in Array#difference

[Bug #21303]

5 days agoFix `heap-use-after-free` in `free_fast_fallback_getaddrinfo_entry` (#13231)
Misaki Shioi [Sat, 3 May 2025 12:39:57 +0000 (3 21:39 +0900)]
Fix `heap-use-after-free` in `free_fast_fallback_getaddrinfo_entry` (#13231)

This change addresses the following ASAN error:

```
==36597==ERROR: AddressSanitizer: heap-use-after-free on address 0x512000396ba8 at pc 0x7fcad5cbad9f bp 0x7fff19739af0 sp 0x7fff19739ae8
  WRITE of size 8 at 0x512000396ba8 thread T0
  [643/756] 36600=optparse/test_summary
      #0 0x7fcad5cbad9e in free_fast_fallback_getaddrinfo_entry /home/runner/work/ruby-dev-builder/ruby-dev-builder/ext/socket/raddrinfo.c:3046:22
      #1 0x7fcad5c9fb48 in fast_fallback_inetsock_cleanup /home/runner/work/ruby-dev-builder/ruby-dev-builder/ext/socket/ipsocket.c:1179:17
      #2 0x7fcadf3b611a in rb_ensure /home/runner/work/ruby-dev-builder/ruby-dev-builder/eval.c:1081:5
      #3 0x7fcad5c9b44b in rsock_init_inetsock /home/runner/work/ruby-dev-builder/ruby-dev-builder/ext/socket/ipsocket.c:1289:20
      #4 0x7fcad5ca22b8 in tcp_init /home/runner/work/ruby-dev-builder/ruby-dev-builder/ext/socket/tcpsocket.c:76:12
      #5 0x7fcadf83ba70 in vm_call0_cfunc_with_frame /home/runner/work/ruby-dev-builder/ruby-dev-builder/./vm_eval.c:164:15
...
```

A `struct fast_fallback_getaddrinfo_shared` is shared between the main thread and two child threads.
This struct contains an array of `fast_fallback_getaddrinfo_entry`.

`fast_fallback_getaddrinfo_entry` and `fast_fallback_getaddrinfo_shared` were freed separately, and if `fast_fallback_getaddrinfo_shared` was freed first and then an attempt was made to free a `fast_fallback_getaddrinfo_entry`, a `heap-use-after-free` could occur.

This change avoids that possibility by separating the deallocation of the addrinfo memory held by `fast_fallback_getaddrinfo_entry` from the access and lifecycle of the `fast_fallback_getaddrinfo_entry` itself.

5 days agoAlso prefer FL_TEST_RAW in gc.c
John Hawthorn [Fri, 11 Apr 2025 23:02:23 +0000 (11 16:02 -0700)]
Also prefer FL_TEST_RAW in gc.c

Similar to 4a040eeb0d880b67a5005cce382122fd5b629b99, I noticed the test
for FL_FINALIZE checking FL_ABLE in a profile, and we shouldn't need to
do that here.

5 days agoZJIT: Parse opt_newarray_send into HIR (#13242)
Max Bernstein [Fri, 2 May 2025 20:01:22 +0000 (2 16:01 -0400)]
ZJIT: Parse opt_newarray_send into HIR (#13242)

5 days agowasm: increase the default Asyncify buffer size
Yuta Saito [Fri, 2 May 2025 16:47:29 +0000 (2 16:47 +0000)]
wasm: increase the default Asyncify buffer size

We will need more Asyncify space for the upcoming namespace changes
as it will introduce more local variables and conditional jumps in
asyncify'd functions.

6 days agoYJIT: ZJIT: Share identical glue functions
Alan Wu [Thu, 1 May 2025 08:05:23 +0000 (1 17:05 +0900)]
YJIT: ZJIT: Share identical glue functions

Working towards having YJIT and ZJIT in the same build, we need to
deduplicate some glue code that would otherwise cause name collision.
Add jit.c for this and build it for YJIT and ZJIT builds. Update bindgen
to look at jit.c; some shuffling of functions in the output, but the set
of functions shouldn't have changed.

6 days agoAdd an include guard for insns_info.inc
Alan Wu [Thu, 1 May 2025 08:33:27 +0000 (1 17:33 +0900)]
Add an include guard for insns_info.inc

The JIT bindgens need this.

6 days agoDelete always true assert [ci skip]
Alan Wu [Fri, 2 May 2025 12:06:11 +0000 (2 21:06 +0900)]
Delete always true assert [ci skip]

6 days ago[ruby/digest] Suppress false stringop-overread warning
Nobuyoshi Nakada [Fri, 2 May 2025 09:38:05 +0000 (2 18:38 +0900)]
[ruby/digest] Suppress false stringop-overread warning

https://github.com/ruby/digest/commit/0df846e8c1

6 days ago[ruby/digest] Move macros for warnings to defs.h
Nobuyoshi Nakada [Fri, 2 May 2025 08:16:54 +0000 (2 17:16 +0900)]
[ruby/digest] Move macros for warnings to defs.h

https://github.com/ruby/digest/commit/70a805b872

6 days ago[ruby/digest] Fix `--without-common-digest` option
Nobuyoshi Nakada [Thu, 7 Nov 2024 02:00:25 +0000 (7 11:00 +0900)]
[ruby/digest] Fix `--without-common-digest` option

In `digest_conf`, "no implicit conversion of false into String"
TypeError is raised.

https://github.com/ruby/digest/commit/89e5e5fe3a

6 days ago[ruby/psych] Ensure to remove the test constants
Nobuyoshi Nakada [Fri, 2 May 2025 06:05:20 +0000 (2 15:05 +0900)]
[ruby/psych] Ensure to remove the test constants

https://github.com/ruby/psych/commit/dd3685aa67

6 days agoUpdate default gems list at 0f066269150375982712bd4a918438 [ci skip]
git [Fri, 2 May 2025 01:40:59 +0000 (2 01:40 +0000)]
Update default gems list at 0f066269150375982712bd4a918438 [ci skip]

6 days agoBump up strscan version to 3.1.5.dev
Hiroshi SHIBATA [Fri, 2 May 2025 01:11:09 +0000 (2 10:11 +0900)]
Bump up strscan version to 3.1.5.dev

6 days ago[ruby/strscan] named_captures: fix incompatibility with
Sutou Kouhei [Mon, 28 Apr 2025 22:17:47 +0000 (29 07:17 +0900)]
[ruby/strscan] named_captures: fix incompatibility with
MatchData#named_captures
(https://github.com/ruby/strscan/pull/146)

Fix https://github.com/ruby/strscan/pull/145

`MatchData#named_captures` use the last matched value for each name.

Reported by Linus Sellberg. Thanks!!!

https://github.com/ruby/strscan/commit/a6086ea322

6 days ago[ruby/psych] Use `rb_struct_initialize` to initialize Data
nick evans [Fri, 8 Nov 2024 15:00:46 +0000 (8 10:00 -0500)]
[ruby/psych] Use `rb_struct_initialize` to initialize Data

https://github.com/ruby/psych/commit/3573fb356e

6 days ago[rubygems/rubygems] Smoother authentication experience
Mike Perham [Mon, 28 Apr 2025 15:05:05 +0000 (28 08:05 -0700)]
[rubygems/rubygems] Smoother authentication experience

Copying the URL is painful here because the URL is embedded within a paragraph of text. I presume we don't want to automatically open the browser.

Instead, move the URL to its own line so that "triple click" will automatically select the whole thing.

https://github.com/rubygems/rubygems/commit/21532a69ae

6 days agoSet is migrated to Core class
Hiroshi SHIBATA [Thu, 1 May 2025 23:02:26 +0000 (2 08:02 +0900)]
Set is migrated to Core class

6 days agoFix C level backtraces for USE_ELF
Daniel Colson [Mon, 28 Apr 2025 16:54:25 +0000 (28 12:54 -0400)]
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 https://github.com/github/ruby/commit/7dd2afbe3a14d021e5554288517709f5778c3d58.

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: https://github.com/ruby/ruby/blob/58e3aa02240a9ec1b5fe6ce60d63828c2cf0c73a/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: https://github.com/ruby/ruby/blob/58e3aa02240a9ec1b5fe6ce60d63828c2cf0c73a/addr2line.c#L1948
Then we get to https://github.com/ruby/ruby/blob/58e3aa02240a9ec1b5fe6ce60d63828c2cf0c73a/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: https://github.com/ruby/ruby/blob/58e3aa02240a9ec1b5fe6ce60d63828c2cf0c73a/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]

6 days ago[ruby/psych] fix error in @dispatch_catch
Sam Rawlins [Tue, 1 Apr 2014 21:20:13 +0000 (1 14:20 -0700)]
[ruby/psych] fix error in @dispatch_catch

https://github.com/ruby/psych/commit/9df5501fdc

6 days agoAdd support for Data objects with ivars
nick evans [Mon, 28 Oct 2024 19:41:26 +0000 (28 15:41 -0400)]
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.

6 days ago[ruby/psych] Add support for ruby 3.2 Data objects
nick evans [Mon, 28 Oct 2024 19:41:01 +0000 (28 15:41 -0400)]
[ruby/psych] Add support for ruby 3.2 Data objects

https://github.com/ruby/psych/commit/788b844c83

6 days ago[ruby/psych] Fix loading/parsing regular expressions
Martin Meyerhoff [Tue, 4 Feb 2025 17:00:44 +0000 (4 18:00 +0100)]
[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.

https://github.com/ruby/psych/commit/f4dd8dadad

6 days agoDrop an ignored attribute
Takashi Kokubun [Thu, 1 May 2025 17:25:02 +0000 (1 10:25 -0700)]
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] = {
      |         ^~~~~~~~~~~~~~~~~~~~~

6 days agoUpdate default gems list at b63c4d14f2a9f5455268b6ac6fb1b4 [ci skip]
git [Thu, 1 May 2025 16:35:17 +0000 (1 16:35 +0000)]
Update default gems list at b63c4d14f2a9f5455268b6ac6fb1b4 [ci skip]

6 days ago[ruby/psych] Bump version for release
Aaron Patterson [Thu, 1 May 2025 16:33:36 +0000 (1 09:33 -0700)]
[ruby/psych] Bump version for release

https://github.com/ruby/psych/commit/bb63f91825

7 days ago[DOC] Tweaks for String.new
Burdette Lamar [Thu, 1 May 2025 14:51:22 +0000 (1 09:51 -0500)]
[DOC] Tweaks for String.new

7 days agoSkip test affected by TracePoint-dependent allocation_class_path
Yusuke Endoh [Thu, 1 May 2025 07:50:46 +0000 (1 16:50 +0900)]
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]

7 days agoSync ruby/json
Jean Boussier [Thu, 1 May 2025 07:34:35 +0000 (1 09:34 +0200)]
Sync ruby/json

Fix: https://github.com/ruby/json/issues/796

7 days agoOmit tests using ISeq#to_binary under coverage measurement
Yusuke Endoh [Thu, 1 May 2025 04:37:28 +0000 (1 13:37 +0900)]
Omit tests using ISeq#to_binary under coverage measurement

... because ISeq#to_binary does not work

7 days agoReset `GC.stress` to avoid slow coverage processing during process exit
Yusuke Endoh [Thu, 1 May 2025 04:36:24 +0000 (1 13:36 +0900)]
Reset `GC.stress` to avoid slow coverage processing during process exit

7 days agoRemoved unused OS_VER variable
Hiroshi SHIBATA [Thu, 1 May 2025 00:46:11 +0000 (1 09:46 +0900)]
Removed unused OS_VER variable

7 days agowindows-2019 will be EOL at end of June, 2025
Hiroshi SHIBATA [Thu, 1 May 2025 00:35:47 +0000 (1 09:35 +0900)]
windows-2019 will be EOL at end of June, 2025

7 days agoZJIT: Use RefCell to allow path compression in union-find (#13218)
Max Bernstein [Wed, 30 Apr 2025 23:28:22 +0000 (30 19:28 -0400)]
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.

7 days agoUse rb_current_ec_noinline in assertions
John Hawthorn [Wed, 30 Apr 2025 21:17:48 +0000 (30 14:17 -0700)]
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.

7 days agoZJIT: Compile opt_new to slow-path SendWithoutBlock (#13216)
Max Bernstein [Wed, 30 Apr 2025 21:48:12 +0000 (30 17:48 -0400)]
ZJIT: Compile opt_new to slow-path SendWithoutBlock (#13216)

7 days agoget_next_shape_internal: Skip VM lock for single child case
Jean Boussier [Mon, 28 Apr 2025 08:37:54 +0000 (28 10:37 +0200)]
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.

7 days ago[ruby/psych] Handle Ruby 3.5 new Set class
Jean Boussier [Wed, 30 Apr 2025 07:13:29 +0000 (30 09:13 +0200)]
[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.

https://github.com/ruby/psych/commit/c2d185d27c

8 days ago[ruby/mmtk] Exclude the test_ractor_parallel test with MMTk
Matt Valentine-House [Wed, 30 Apr 2025 12:54:16 +0000 (30 13:54 +0100)]
[ruby/mmtk] Exclude the test_ractor_parallel test with MMTk

https://github.com/ruby/mmtk/commit/86b0dbeca8

8 days ago[ruby/mmtk] test_finalize is in TestObjectSpace not TestObjSpace
Matt Valentine-House [Wed, 30 Apr 2025 10:48:59 +0000 (30 11:48 +0100)]
[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

https://github.com/ruby/mmtk/commit/195728dc8c

8 days agoSuppress gcc 15 unterminated-string-initialization warnings
Nobuyoshi Nakada [Wed, 30 Apr 2025 09:35:25 +0000 (30 18:35 +0900)]
Suppress gcc 15 unterminated-string-initialization warnings

8 days agoZJIT: Add `make zjit-test-lldb` [ci skip]
Alan Wu [Wed, 30 Apr 2025 10:49:54 +0000 (30 19:49 +0900)]
ZJIT: Add `make zjit-test-lldb` [ci skip]

Handy for dropping into LLDB for a Rust test.

8 days agoFix C23 (GCC 15) WIN32 compatibility for rb_define_* functions
Alan Wu [Tue, 29 Apr 2025 12:13:17 +0000 (29 21:13 +0900)]
Fix C23 (GCC 15) WIN32 compatibility for rb_define_* functions

Fixes [Bug #21286]

8 days agoRe-enabled repl_type_completor test with upstream fix
Hiroshi SHIBATA [Wed, 30 Apr 2025 06:13:51 +0000 (30 15:13 +0900)]
Re-enabled repl_type_completor test with upstream fix

https://github.com/ruby/repl_type_completor/pull/62

8 days agoUse EnvUtil.apply_timeout_scale for test_io_wait.rb
Hiroshi SHIBATA [Wed, 30 Apr 2025 06:26:35 +0000 (30 15:26 +0900)]
Use EnvUtil.apply_timeout_scale for test_io_wait.rb

8 days agoUpdate bundled gems list as of 2025-04-30
git [Wed, 30 Apr 2025 07:04:02 +0000 (30 07:04 +0000)]
Update bundled gems list as of 2025-04-30

8 days agoUpdate default gems list at 6e7825316ed572e56f6e1baabe63ef [ci skip]
git [Wed, 30 Apr 2025 06:13:46 +0000 (30 06:13 +0000)]
Update default gems list at 6e7825316ed572e56f6e1baabe63ef [ci skip]

8 days ago[ruby/json] Remove explicit include of extconf.h
Jean Boussier [Mon, 28 Apr 2025 16:50:24 +0000 (28 18:50 +0200)]
[ruby/json] Remove explicit include of extconf.h

https://github.com/ruby/json/commit/6b059900de

.

8 days ago[ruby/json] Fix --with-static-linked-ext builds
Jean Boussier [Mon, 28 Apr 2025 16:01:18 +0000 (28 18:01 +0200)]
[ruby/json] Fix --with-static-linked-ext builds

https://github.com/ruby/json/commit/d7d60cccb0

8 days ago[ruby/json] Fix i686 builds
Jean Boussier [Mon, 28 Apr 2025 14:15:36 +0000 (28 16:15 +0200)]
[ruby/json] Fix i686 builds

We should test compilation with `-msse2` because we need to
test with whatever arguments Ruby will be compiled with.

https://github.com/ruby/json/commit/0a871365db

8 days ago[ruby/json] SIMD: Match control char and double quote in one pass
Jean Boussier [Mon, 28 Apr 2025 13:23:48 +0000 (28 15:23 +0200)]
[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 https://github.com/ruby/json/commit/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
```

https://github.com/ruby/json/commit/034c5debd8

8 days agoUpdate ext/json/generator/depend
Jean Boussier [Mon, 28 Apr 2025 13:08:05 +0000 (28 15:08 +0200)]
Update ext/json/generator/depend

8 days ago[ruby/json] Introduce ARM Neon and SSE2 SIMD.
Scott Myron [Mon, 28 Apr 2025 12:57:10 +0000 (28 07:57 -0500)]
[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 https://github.com/ruby/json/commit/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 https://github.com/ruby/json/commit/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 https://github.com/ruby/json/commit/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
```

https://github.com/ruby/json/commit/49003523da

8 days ago[ruby/json] Use RB_TYPE_P
Jean Boussier [Sun, 27 Apr 2025 10:35:01 +0000 (27 12:35 +0200)]
[ruby/json] Use RB_TYPE_P

https://github.com/ruby/json/commit/b14250f1da

8 days ago[ruby/json] Handle non-string keys returning immediate values via `to_s`
Jean Boussier [Sun, 27 Apr 2025 09:10:00 +0000 (27 11:10 +0200)]
[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.

https://github.com/ruby/json/commit/12dc394d11

8 days ago[ruby/json] Release 2.11.3
Jean Boussier [Fri, 25 Apr 2025 06:02:43 +0000 (25 08:02 +0200)]
[ruby/json] Release 2.11.3

https://github.com/ruby/json/commit/3e025f76d7

8 days ago[ruby/json] Stop caching the generator state pointer
Jean Boussier [Fri, 25 Apr 2025 05:35:05 +0000 (25 07:35 +0200)]
[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.

https://github.com/ruby/json/commit/2ffa4ea46b

8 days agoImprove syntax style consistency in shape.c and shape.h
Jean Boussier [Tue, 29 Apr 2025 07:50:47 +0000 (29 09:50 +0200)]
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.

8 days agoRUBY_T_{TRUE,FALSE} comments were reversed
Matt Valentine-House [Tue, 29 Apr 2025 19:00:30 +0000 (29 20:00 +0100)]
RUBY_T_{TRUE,FALSE} comments were reversed

[ci skip]

8 days agoAdded GCC 15 build
Hiroshi SHIBATA [Wed, 30 Apr 2025 00:33:34 +0000 (30 09:33 +0900)]
Added GCC 15 build