9827 Commits

Author SHA1 Message Date
Yusuke Endoh
cb99e54486 Update common.mk dependencies 2025-05-11 23:32:50 +09:00
Satoshi Tagomori
382645d440 namespace on read 2025-05-11 23:32:50 +09:00
Aaron Patterson
58c008e68f [ruby/psych] Bump version for release
https://github.com/ruby/psych/commit/dbf9e36583
2025-05-09 22:12:47 +00:00
OrenGitHub
ae299cc9cd [ruby/psych] add first test for safe load stream
https://github.com/ruby/psych/commit/336553b412
2025-05-09 17:53:17 +00:00
OrenGitHub
f0e2a41d4b [ruby/psych] fixed bugs from testing
https://github.com/ruby/psych/commit/e954f96639
2025-05-09 17:53:17 +00:00
OrenGitHub
d69319304f [ruby/psych] Add safe version for load_stream
https://github.com/ruby/psych/commit/30a2a5ee94
2025-05-09 17:53:17 +00:00
Jean Boussier
ea77250847 Rename RB_OBJ_SHAPE -> rb_obj_shape
As well as `RB_OBJ_SHAPE_ID` -> `rb_obj_shape_id`
and `RSHAPE` is now a simple alias for `rb_shape_lookup`.

I tried to turn all these into `static inline` but I'm having
trouble with `RUBY_EXTERN rb_shape_tree_t *rb_shape_tree_ptr;`
not being exposed as I'd expect.
2025-05-09 10:22:51 +02:00
Jean Boussier
5782561fc1 Rename rb_shape_get_shape_id -> RB_OBJ_SHAPE_ID
And `rb_shape_get_shape` -> `RB_OBJ_SHAPE`.
2025-05-09 10:22:51 +02:00
Jean Boussier
3f7c0af051 Rename rb_shape_obj_too_complex -> rb_shape_obj_too_complex_p 2025-05-09 10:22:51 +02:00
Jean Boussier
e4f97ce387 Refactor rb_shape_depth to take an ID rather than a pointer.
As well as `rb_shape_edges_count` and `rb_shape_memsize`.
2025-05-09 10:22:51 +02:00
Hiroshi SHIBATA
8a1d45144b Support require 'cgi/escape' with extracting CGI::Escape from CGI::Util 2025-05-09 14:27:28 +09:00
Nobuyoshi Nakada
f3006c26de Add depend files under ext/-test- 2025-05-08 18:20:51 +09:00
Nobuyoshi Nakada
61b6f226e8
[ruby/json] Constify static data in fpconv.c
https://github.com/ruby/json/commit/3b605d9b1e
2025-05-08 18:03:04 +09:00
Jean Boussier
1f2a9dc2a9
[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
2025-05-08 18:03:04 +09:00
Jean Boussier
f48e45d1e9 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 <matt@eightbitraptor.com>
2025-05-08 07:58:05 +02:00
Jean Boussier
0ea210d1ea 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`.
2025-05-08 07:58:05 +02:00
Hiroshi SHIBATA
4e30b77b90 Added depend file for test/-ext-/econv/test_append.rb
ce51ef30df broke
ext/-test-/econv/append.o. We should rebuild that object file when dependencies are updated.
2025-05-08 12:34:22 +09:00
Nobuyoshi Nakada
5b1a61e29c [ruby/digest] stringop-overread warning is since GCC 11
https://github.com/ruby/digest/commit/d16853fe8c
2025-05-05 10:20:31 +00:00
Misaki Shioi
2be117a97d
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.
2025-05-03 21:39:57 +09:00
Nobuyoshi Nakada
85198262a3 [ruby/digest] Suppress false stringop-overread warning
https://github.com/ruby/digest/commit/0df846e8c1
2025-05-02 09:46:51 +00:00
Nobuyoshi Nakada
277bcb717b [ruby/digest] Move macros for warnings to defs.h
https://github.com/ruby/digest/commit/70a805b872
2025-05-02 09:46:51 +00:00
Nobuyoshi Nakada
ba6a36e653 [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
2025-05-02 09:20:47 +00:00
Hiroshi SHIBATA
0f06626915
Bump up strscan version to 3.1.5.dev 2025-05-02 10:11:09 +09:00
Sutou Kouhei
af6d6b64ea [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
2025-05-02 09:52:38 +09:00
nick evans
a1e627b7e3
[ruby/psych] Use rb_struct_initialize to initialize Data
https://github.com/ruby/psych/commit/3573fb356e
2025-05-02 09:49:15 +09:00
Sam Rawlins
3176cd6993 [ruby/psych] fix error in @dispatch_catch
https://github.com/ruby/psych/commit/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
https://github.com/ruby/psych/commit/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.

https://github.com/ruby/psych/commit/f4dd8dadad
2025-05-01 17:50:13 +00:00
Aaron Patterson
b63c4d14f2 [ruby/psych] Bump version for release
https://github.com/ruby/psych/commit/bb63f91825
2025-05-01 16:34:09 +00:00
Jean Boussier
de6e59e5ba Sync ruby/json
Fix: https://github.com/ruby/json/issues/796
2025-05-01 10:06:04 +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.

https://github.com/ruby/psych/commit/c2d185d27c
2025-04-30 18:31:33 +00:00
Jean Boussier
6e7825316e [ruby/json] Remove explicit include of extconf.h
https://github.com/ruby/json/commit/6b059900de

.
2025-04-30 08:12:41 +02:00
Jean Boussier
6ba0dc4d97 [ruby/json] Fix --with-static-linked-ext builds
https://github.com/ruby/json/commit/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.

https://github.com/ruby/json/commit/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 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
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 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
2025-04-30 08:12:41 +02:00
Jean Boussier
7f0c6d30d3 [ruby/json] Use RB_TYPE_P
https://github.com/ruby/json/commit/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.

https://github.com/ruby/json/commit/12dc394d11
2025-04-30 08:12:41 +02:00
Jean Boussier
1103611600 [ruby/json] Release 2.11.3
https://github.com/ruby/json/commit/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.

https://github.com/ruby/json/commit/2ffa4ea46b
2025-04-30 08:12:41 +02:00
Jean Boussier
3ec7bfff2e Use a set_table for rb_vm_struct.unused_block_warning_table
Now that we have a hash-set implementation we can use that
instead of a hash-table with a static value.
2025-04-27 11:59:28 +02:00
Jean Boussier
db66038285 [ruby/json] Release 2.11.2
https://github.com/ruby/json/commit/c985e8c6ea
2025-04-25 11:11:22 +09:00
Jean Boussier
05f949ebbf [ruby/json] Bring back JSON::PRETTY_STATE_PROTOTYPE with a deprecation
Fix: https://github.com/ruby/json/issues/788

`multi_json` rely on it, even though it was never documented as
public API.

Bringing it back as a method so it can emit a deprecation warning.

https://github.com/ruby/json/commit/123121bba2
2025-04-25 11:11:21 +09:00
Jean Boussier
1d65d5ce47 [ruby/json] Release 2.11.1
https://github.com/ruby/json/commit/84443e881d
2025-04-25 11:11:20 +09:00
Jean Boussier
2b5e1db2db [ruby/json] Bring back the numerous deprecated alias
This time with explicit deprecation warnings.

https://github.com/ruby/json/commit/0dee9bdad9
2025-04-25 11:11:19 +09:00
Jean Boussier
169b33d1d5 [ruby/json] Release 2.11.0
https://github.com/ruby/json/commit/a6949f8656
2025-04-25 11:11:18 +09:00
Hiroshi SHIBATA
4634a0042e
Mark development version for unreleased gems 2025-04-22 11:27:24 +09:00
Sutou Kouhei
067fc410fc
[ruby/strscan] Bump version
https://github.com/ruby/strscan/commit/8ff80150c4
2025-04-22 11:27:24 +09:00