-*- coding: utf-8 -*-

commit e51014f9c05aa65cbf203442d37fef7c12390015
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-03-30 20:06:29 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-03-30 20:06:29 +0900

    v3.2.2p53

commit 936b705d7839f78d88a1dde5ba4ca309848dd792
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-03-30 19:55:41 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-03-30 20:05:11 +0900

    v3.2.1p53

commit 34d5d10517825a51bea6bcb13ead1484c7182b42
  Author:     Hiroshi SHIBATA <hsbt@ruby-lang.org>
  AuthorDate: 2023-03-30 19:54:12 +0900
  Commit:     GitHub <noreply@github.com>
  CommitDate: 2023-03-30 19:54:12 +0900

    Merge Time-0.2.2 (#7623)

commit 250ff4ff45f1257b395260fe42d914cbb0720a41
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-03-29 00:47:10 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-03-29 00:48:11 +0900

    gem related automation must run only on master

commit 00041131e25699136179a7de06794527eaaabfd6
  Author:     Nobuyoshi Nakada <nobu@ruby-lang.org>
  AuthorDate: 2023-02-22 22:14:26 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-03-28 22:47:23 +0900

    Skip failing test on MSWin

commit 18d3223563cc74b07e53e79c44d45dc50a6004c7
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-03-28 21:01:44 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-03-28 21:04:02 +0900

    Use merge_group

commit c3c461c4ff1b998ac49ed1a3ad411d2f0a9123b8
  Author:     Hiroshi SHIBATA <hsbt@ruby-lang.org>
  AuthorDate: 2023-03-28 20:36:47 +0900
  Commit:     GitHub <noreply@github.com>
  CommitDate: 2023-03-28 20:36:47 +0900

    Merge RubyGems-3.4.10 and Bundler-2.4.10 (#7479)

    * Merge RubyGems-3.4.7 and Bundler-2.4.7

    * Merge RubyGems-3.4.8 and Bundler-2.4.8

    * Skip failing test on MSWin

    * Merge RubyGems-3.4.9 and Bundler-2.4.9

    * Merge RubyGems-3.4.10 and Bundler-2.4.10

    ---------

    Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>

commit f8c775cb413724a45bb5641de94f4f9210044116
  Author:     Hiroshi SHIBATA <hsbt@ruby-lang.org>
  AuthorDate: 2023-03-28 20:36:36 +0900
  Commit:     GitHub <noreply@github.com>
  CommitDate: 2023-03-28 20:36:36 +0900

    Use URI-0.12.1 for Ruby 3.2 (#7603)

    * Merge URI-0.12.1

    * Use URI-0.12.1

    * Update core_assertions for using assert_linear_performance

commit 582aadb3905eac131591f4c7884f441c036c49fb
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-03-28 17:02:53 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-03-28 17:02:53 +0900

    merge revision(s) 2f916812a9b818b432ee7c299e021ec62d4727fb,ac458f6bc3c520c9f23364c85bfb033acda907a6:

            Skip test_europe_lisbon on macOS

            until we figure out why it's failing.
            ---
             test/ruby/test_time_tz.rb | 1 +
             1 file changed, 1 insertion(+)

            Historical timezones of Lisbon in tzdata are unstable

            ---
             test/ruby/test_time_tz.rb | 3 +--
             1 file changed, 1 insertion(+), 2 deletions(-)

commit fb4ffce0dd8cae3b7d0141d3b1ea3f0ab710a45a
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-03-28 14:25:13 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-03-28 14:25:13 +0900

    merge revision(s) 680bd9027f8cb7977bbc216609db2f4e3cf199a8: [Backport #19471]

            [Bug #19471] `Regexp.compile` should handle keyword arguments

            As well as `Regexp.new`, it should pass keyword arguments to the
            `Regexp#initialize` method.
            ---
             re.c                     | 2 +-
             test/ruby/test_regexp.rb | 5 +++++
             2 files changed, 6 insertions(+), 1 deletion(-)

commit b93e2223300bc54dfa387ffb9fa3d48ecbe670f0
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-03-23 12:04:46 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-03-23 12:04:46 +0900

    merge revision(s) e7342e76dfd26237c604e42f9a59a1eaa578c94e: [Backport #19485]

            [Bug #19485] [DOC] Mention tabs in indentation of heredoc identifier

            Co-Authored-By: sawa (Tsuyoshi Sawada) <sawadatsuyoshi@gmail.com>
            ---
             doc/syntax/literals.rdoc | 6 ++++++
             1 file changed, 6 insertions(+)

commit 400ccb16eefe4e21c4e3eacab4fd0f208fc5e151
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-03-23 08:11:23 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-03-23 08:11:23 +0900

    merge revision(s) cb22d78354e201ca74eba68a8b4edefb593e6754: [Backport #19536]

            Fix frozen status loss when moving objects

            [Bug #19536]

            When objects are moved between size pools, their frozen status is lost
            in the shape. This will cause the frozen check to be bypassed when there
            is an inline cache. For example, the following script should raise a
            FrozenError, but doesn't on Ruby 3.2 and master.

                class A
                  def add_ivars
                    @a = @b = @c = @d = 1
                  end

                  def set_a
                    @a = 10
                  end
                end

                a = A.new
                a.add_ivars
                a.freeze

                b = A.new
                b.add_ivars
                b.set_a # Set the inline cache in set_a

                GC.verify_compaction_references(expand_heap: true, toward: :empty)

                a.set_a
            ---
             shape.c                      |  2 +-
             test/ruby/test_gc_compact.rb | 28 ++++++++++++++++++++++++++++
             2 files changed, 29 insertions(+), 1 deletion(-)

commit ad6fe84dfa6935bd6e2c3ef3ee36bed4e8627d0b
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-03-22 10:34:12 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-03-22 10:34:12 +0900

    merge revision(s) dddc542e9b61b292d80a96d0d0efbbf58719e3be: [Backport #19476]

            [Bug #19476]: correct cache index computation for repetition (#7457)

            ---
             regexec.c                | 4 ++--
             test/ruby/test_regexp.rb | 5 +++++
             2 files changed, 7 insertions(+), 2 deletions(-)

commit 4b4087dce318570f9f9c05e14900325b499fb632
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-03-20 15:06:34 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-03-20 15:06:34 +0900

    merge revision(s) e22c4e8877677ff90805e4a4dcbdef80f4220136: [Backport #19467]

            [Bug #19467] correct cache points and counting failure on
             `OP_ANYCHAR_STAR_PEEK_NEXT` (#7454)

            ---
             regexec.c                | 20 ++++++++++++++++----
             test/ruby/test_regexp.rb | 10 ++++++++++
             2 files changed, 26 insertions(+), 4 deletions(-)

commit 0555303464f3595223ec8093146041f96595865d
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-03-18 15:02:04 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-03-18 15:02:04 +0900

    merge revision(s) 96d1acfdf6c6b42f2029f44d5b5920961d6efa92: [Backport #19161]

            [Bug #19161] Check for TLS usability

            On all platforms using GCC, even other than darwin.
            ---
             configure.ac | 13 +++++++------
             1 file changed, 7 insertions(+), 6 deletions(-)

commit f3abe5ba645839fb2a686aee18d3466b59256af0
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-03-17 13:40:04 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-03-17 13:40:04 +0900

    merge revision(s) 0700d0fd1c77b4fddf803dea3c10be654df600ff,62c2082f1f726cb90d8c332fbedbecf41d5d82ec: [Backport #19469]

            Fix indentation in vm_setivar_default

            ---
             vm_insnhelper.c | 6 +++---
             1 file changed, 3 insertions(+), 3 deletions(-)

            [Bug #19469] Fix crash when resizing generic iv list

            The following script can sometimes trigger a crash:

            ```ruby
            GC.stress = true

            class Array
              def foo(bool)
                if bool
                  @a = 1
                  @b = 2
                  @c = 1
                else
                  @c = 1
                end
              end
            end

            obj = []
            obj.foo(true)

            obj2 = []
            obj2.foo(false)

            obj3 = []
            obj3.foo(true)
            ```

            This is because vm_setivar_default calls rb_ensure_generic_iv_list_size
            to resize the iv list. However, the call to gen_ivtbl_resize reallocs
            the iv list, and then inserts into the generic iv table. If the
            st_insert triggers a GC then the old iv list will be read during
            marking, causing a use-after-free bug.

            Co-Authored-By: Jemma Issroff <jemmaissroff@gmail.com>
            ---
             internal/variable.h |  2 +-
             variable.c          | 23 ++++++++++++++++++-----
             vm_insnhelper.c     |  4 ++--
             3 files changed, 21 insertions(+), 8 deletions(-)

commit b309c246ee70926d593d3857e1625202e2d0f67b
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-03-17 10:56:18 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-03-17 10:56:18 +0900

    merge revision(s) d78ae78fd76e556e281a743c75bea4c0bb81ed8c: [Backport #19468]

            rb_str_modify_expand: clear the string coderange

            [Bug #19468]

            b0b9f7201acab05c2a3ad92c3043a1f01df3e17f errornously stopped
            clearing the coderange.

            Since `rb_str_modify` clears it, `rb_str_modify_expand`
            should too.
            ---
             string.c | 1 +
             1 file changed, 1 insertion(+)

commit b73a07359758a9034996752e981e09ddaffe8d87
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-03-15 16:36:32 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-03-15 16:36:32 +0900

    merge revision(s) 0eb634ae73cb327ede833b72492f912792a4a9d5: [Backport #19464]

            YJIT: Detect and reject `send(:alias_for_send, :foo)`

            Previously, YJIT failed to put the stack into the correct shape when
            `BasicObject#send` calls an alias method for the send method itself.
            This can manifest as strange `NoMethodError`s in the final non-send
            receiver, as [seen][1] with the kt-paperclip gem. I also found a case
            where it makes YJIT fail the stack size assertion while compiling
            `leave`.

            YJIT's `BasicObject#__send__` implementation already rejects sends to
            `send`, but didn't detect sends to aliases of `send`. Adjust the
            detection and reject these cases.

            Fixes [Bug #19464]

            [1]: https://github.com/Shopify/yjit/issues/306
            ---
             test/ruby/test_yjit.rb | 20 ++++++++++++++++++++
             yjit/src/codegen.rs    | 25 ++++++++++---------------
             2 files changed, 30 insertions(+), 15 deletions(-)

commit db28f7003f7d49cfa13871c38d10c1967282ca6b
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-03-09 09:35:39 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-03-09 09:35:39 +0900

    merge revision(s) 3b567eb491e460e00a66fdea8054eeb083b5dafd: [Backport #19459]

            [Bug #19459] Remove unnecessary always-true checks (#7362)

            `length` is a required argument for `IO::Buffer#read` and
            `IO::Buffer#write` methods, and `argc` is already checked with
            `rb_check_arity`.  Also fix the call-seq of `IO::Buffer#read`.
            ---
             io_buffer.c | 24 +++++++-----------------
             1 file changed, 7 insertions(+), 17 deletions(-)

commit 4e4a4e42b284d9309a7e51c97058093539e7a843
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-03-08 14:46:30 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-03-08 14:46:30 +0900

    merge revision(s) d2520b7b76759118071a16e6bca22726a5de9fb4: [Backport #19439]

            Marshal.load: restore instance variables on Regexp

            [Bug #19439]

            The instance variables were restore on the Regexp source,
            not the regexp itself.

            Unfortunately we have a bit of a chicken and egg problem.

            The source holds the encoding, and the encoding need to be set on
            the source to be able to instantiate the Regexp.

            So the instance variables have to be read on the `source`.
            To correct this we transfert the instance variables after
            instantiating the Regexp.

            The only way to avoid this would be to read the instance variable
            twice and rewind.
            ---
             marshal.c                             | 20 ++++++++++++++++++--
             spec/ruby/core/marshal/shared/load.rb | 11 +++++++++++
             2 files changed, 29 insertions(+), 2 deletions(-)

commit 59eb18037ff92839be48fb6c46ff0acc179b4f4c
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-03-08 12:02:22 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-03-08 12:02:22 +0900

    merge revision(s) dd28c55a7cd6780dad637b4d6a20507fbfc6af4a: [Backport #19445]

            [Bug#19445] Fix keyword splat in enumerator

            Extracted arguments do not have keyword hash to splat.
            ---
             numeric.c                 | 2 +-
             test/ruby/test_numeric.rb | 3 +++
             2 files changed, 4 insertions(+), 1 deletion(-)

commit 4d75035e1762a23d38c5192b30bb47f40b752bee
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-03-07 19:48:32 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-03-07 19:48:32 +0900

    merge revision(s) c178926fbe879045fa711444a1fd9e906af23e3b,a4b7ec12298c78392797e5ba7704076550e4f100: [Backport #19444]

            YJIT: jit_prepare_routine_call() for String#+@ missing

            We saw SEGVs due to this when running with StackProf, which needs a
            correct PC for RUBY_INTERNAL_EVENT_NEWOBJ, the same event used for
            ObjectSpace allocation tracing.

            [Bug #19444]
            ---
             test/ruby/test_yjit.rb | 27 +++++++++++++++++++++++++++
             yjit/src/codegen.rs    |  5 ++++-
             2 files changed, 31 insertions(+), 1 deletion(-)

            YJIT: Fix false assumption that String#+@ => ::String

            Could return a subclass.

            [Bug #19444]
            ---
             test/ruby/test_yjit.rb | 17 +++++++++++++++++
             yjit/src/codegen.rs    | 10 +++++++---
             2 files changed, 24 insertions(+), 3 deletions(-)

commit f1cde05d99898f491c8e302ae74029468fdb6eb9
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-03-07 10:11:43 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-03-07 10:11:43 +0900

    merge revision(s) 86de48e9f69b665ba9ffb5bdc5a181a3adb1a7b8: [Backport #19419]

            Remove ibf_dumper's WB_PROTECTED status

            It doesn't have the right write barriers in place. For example, there is

                rb_mark_set(dump->global_buffer.obj_table);

            in the mark function, but there is no corresponding write barrier when
            adding to the table in the
            `ibf_dump_object() -> ibf_table_find_or_insert() -> st_insert()` code path.

            To insert write barrier correctly, we need to store the T_STRUCT VALUE
            inside `struct ibf_dump`. Instead of doing that, let's just demote it
            to WB unproected for correctness. These dumper object are ephemeral so
            there is not a huge benefit for having them WB protected.

            Users of the bootsnap gem ran into crashes due to this issue:
            https://github.com/Shopify/bootsnap/issues/436

            Fixes [Bug #19419]
            ---
             compile.c | 2 +-
             1 file changed, 1 insertion(+), 1 deletion(-)

commit f93c7b9f58966fd04496bfeb2538fb1ff41f788e
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-03-04 15:39:47 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-03-04 15:39:47 +0900

    merge revision(s) b78f871d838c168789648738e5c67b071beb8a19,ecd0cdaf820af789f355f1a18c31d6adfe8aad94: [Backport #19400]

            YJIT: Use the system page size when the code page size is too small
             (#7267)

            Previously on ARM64 Linux systems that use 64 KiB pages
            (`CONFIG_ARM64_64K_PAGES=y`), YJIT was panicking on boot due to a failed
            assertion.

            The assertion was making sure that code GC can free the last code page
            that YJIT manages without freeing unrelated memory. YJIT prefers picking
            16 KiB as the granularity at which to free code memory, but when the
            system can only free at 64 KiB granularity, that is not possible.

            The fix is to use the system page size as the code page size when the
            system page size is 64 KiB. Continue to use 16 KiB as the code page size
            on common systems that use 16/4 KiB pages.

            Add asserts to code_gc() and free_page() about code GC's assumptions.

            Fixes [Bug #19400]
            ---
             yjit/src/asm/mod.rs    | 78 ++++++++++++++++++++++++++++++++------------------
             yjit/src/codegen.rs    |  2 --
             yjit/src/virtualmem.rs | 13 +++++++++
             3 files changed, 63 insertions(+), 30 deletions(-)

            YJIT: Fix assertion for partially mapped last pages (#7337)

            Follows up [Bug #19400]
            ---
             test/ruby/test_yjit.rb | 19 +++++++++++++++++++
             yjit/src/asm/mod.rs    |  2 +-
             yjit/src/virtualmem.rs | 18 +++++++++++++-----
             3 files changed, 33 insertions(+), 6 deletions(-)

commit 53f6173cfc085a7422b4a76c85e6c35969209327
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-03-02 09:28:58 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-03-02 09:29:38 +0900

    merge revision(s) 8ce2fb9bbbaea14737c84385b1573f743a30f773,3a0f6ce1d31eefd8af01b50f3632a64d64e8f8c1: [Backport #19415]

            Only emit circular dependency warning for owned thread shields [Bug
             #19415]

            If multiple threads attemps to load the same file concurrently
            it's not a circular dependency issue.

            So we check that the existing ThreadShield is owner by the current
            fiber before warning about circular dependencies.
            ---
             internal/thread.h                                     |  1 +
             load.c                                                |  3 ++-
             spec/ruby/core/kernel/shared/require.rb               | 11 +++++++++++
             spec/ruby/fixtures/code/concurrent_require_fixture.rb |  4 ++++
             test/ruby/test_require.rb                             |  3 ---
             thread.c                                              | 11 +++++++++++
             6 files changed, 29 insertions(+), 4 deletions(-)
             create mode 100644 spec/ruby/fixtures/code/concurrent_require_fixture.rb

            Use Thread.pass until thread.stop? to wait for thread to block

            [Bug #19415]

            It should be more reliable
            ---
             spec/ruby/fixtures/code/concurrent_require_fixture.rb | 2 +-
             1 file changed, 1 insertion(+), 1 deletion(-)

commit 65ab2c1ef23bd4a02120a27c371dce12ea9024d4
  Author:     Hiroshi SHIBATA <hsbt@ruby-lang.org>
  AuthorDate: 2023-02-22 19:00:00 +0900
  Commit:     GitHub <noreply@github.com>
  CommitDate: 2023-02-22 19:00:00 +0900

    Backport [Bug #19158] for Ruby 3.2 (#7356)

    Backport https://github.com/ruby/ruby/pull/7321

commit 31819e82c88c6f8ecfaeb162519bfa26a14b21fd
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-02-08 13:02:20 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-02-08 13:02:20 +0900

    v3.2.1

commit 88e0862267cec6764ab9888f7522a40f2996e2c7
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-02-08 01:31:22 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-02-08 01:31:22 +0900

    Remove wrong file

commit 3decf7df6f678ff6386c5c1888642d76f49dc147
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-02-07 15:15:17 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-02-07 15:15:17 +0900

    merge revision(s) 3a7367ccc319499127ead147e5a08f769e44208e: [Backport #19403]

            mkconfig: Map `includedir` only for system ruby

            Only when installing to the system path on macOS, prepend '$(SDKROOT)'
            and remap `includedir`.
            Fix https://github.com/rbenv/ruby-build/discussions/2123
            ---
             test/mkmf/test_config.rb | 4 ++--
             test/test_rbconfig.rb    | 9 ---------
             tool/mkconfig.rb         | 4 +++-
             3 files changed, 5 insertions(+), 12 deletions(-)

commit 7246cd0081ec845e1407484fca10439e7868880b
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-02-07 13:46:36 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-02-07 13:46:36 +0900

    merge revision(s) fad48fefe19cc282a5b209944244a3713359b47f: [Backport #19399]

            [Bug #19399] Parsing invalid heredoc inside block parameter

            Although this is of course invalid as Ruby code, allow to just parse
            and tokenize.
            ---
             ext/ripper/lib/ripper/lexer.rb |  2 +-
             test/ripper/test_lexer.rb      | 12 ++++++++++++
             2 files changed, 13 insertions(+), 1 deletion(-)

commit 3426ebd0489654f951a8b92efaf5e72b9f43efab
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-02-06 16:41:23 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-02-06 16:41:23 +0900

    merge revision(s) c6f84e918943a0bf8db6fee556fc53180d257510: [Backport #19398]

            [Bug #19398] Memory leak in WeakMap

            There's a memory leak in ObjectSpace::WeakMap due to not freeing
            the `struct weakmap`. It can be seen in the following script:

            ```
            100.times do
              10000.times do
                ObjectSpace::WeakMap.new
              end

              # Output the Resident Set Size (memory usage, in KB) of the current Ruby process
              puts `ps -o rss= -p #{$$}`
            end
            ```
            ---
             gc.c                      | 1 +
             test/ruby/test_weakmap.rb | 9 +++++++++
             2 files changed, 10 insertions(+)

commit 3a88589399f7f1059be245f766809c49790ad939
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-02-06 14:00:47 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-02-06 14:00:47 +0900

    merge revision(s) 3b83b265f11965582d4b9b439eff8a501792ab68: [Backport #19404]

            YJIT: Crash with rb_bug() when panicking

            Helps with getting good bug reports in the wild. Intended to be
            backported to the 3.2.x series.
            ---
             yjit/bindgen/src/main.rs       |  3 +++
             yjit/src/cruby_bindings.inc.rs |  1 +
             yjit/src/yjit.rs               | 29 +++++++++++++++++++++++++++--
             3 files changed, 31 insertions(+), 2 deletions(-)

commit 535d863f34e6c36a2378683e7c2d3b7369e3d076
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-02-03 14:13:02 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-02-03 14:13:09 +0900

    merge revision(s) 188688a53e7708d25ab80e14d05e70ffcf792e13: [Backport #19385]

            [PATCH 1/4] YJIT: Move CodegenGlobals::freed_pages into an Rc

            This allows for supplying a freed_pages vec in Rust tests. We need it so we
            can test scenarios that occur after code GC.
            ---
             yjit/src/asm/mod.rs | 48 +++++++++++++++++++++++++++++++++------------
             yjit/src/codegen.rs | 16 ++++-----------
             2 files changed, 39 insertions(+), 25 deletions(-)

            Subject: [PATCH 2/4] YJIT: other_cb is None in tests

            Since the other cb is in CodegenGlobals, and we want Rust tests to be
            self-contained.
            ---
             yjit/src/asm/mod.rs | 1 +
             1 file changed, 1 insertion(+)

            Subject: [PATCH 3/4] YJIT: ARM64: Move functions out of arm64_emit()

            ---
             yjit/src/backend/arm64/mod.rs | 180 +++++++++++++++++-----------------
             1 file changed, 90 insertions(+), 90 deletions(-)

            Subject: [PATCH 4/4] YJIT: ARM64: Fix long jumps to labels

            Previously, with Code GC, YJIT panicked while trying to emit a B.cond
            instruction with an offset that is not encodable in 19 bits. This only
            happens when the code in an assembler instance straddles two pages.

            To fix this, when we detect that a jump to a label can land on a
            different page, we switch to a fresh new page and regenerate all the
            code in the assembler there. We still assume that no one assembler has
            so much code that it wouldn't fit inside a fresh new page.

            [Bug #19385]
            ---
             yjit/src/backend/arm64/mod.rs | 65 ++++++++++++++++++++++++++++++++---
             1 file changed, 60 insertions(+), 5 deletions(-)

commit f4e6e78410136100ef5f285136a66df8d6004a61
  Author:     Hiroshi SHIBATA <hsbt@ruby-lang.org>
  AuthorDate: 2023-02-01 12:05:19 +0900
  Commit:     GitHub <noreply@github.com>
  CommitDate: 2023-02-01 12:05:19 +0900

    Merge RubyGems 3.4.6 and Bundler 2.4.6 (#7214)

    Merge RubyGems-3.4.6 and Bundler-2.4.6

commit 40e0b1e123503805c16a2a9aafae0a5c302c20d1
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-01-31 23:46:50 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-01-31 23:46:50 +0900

    merge revision(s) 9726736006b3f74635fd8af05814fe0908e2cf84: [Backport #19327]

            Set STR_SHARED_ROOT flag on root of string

            ---
             string.c | 1 +
             1 file changed, 1 insertion(+)

commit 22bfad0ec9968be4c99c8c68f2c809b833069ea7
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-01-31 18:27:44 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-01-31 18:27:44 +0900

    Remove "Miscellaneous checks" from CI

    It is expected to use on master branch

commit ca75332f46c39804e06cd37c2608cbdef0aebf05
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-01-31 15:28:01 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-01-31 15:28:01 +0900

    merge revision(s) eccfc978fd6f65332eb70c9a46fbb4d5110bbe0a: [Backport #19379]

            Fix parsing of regexps that toggle extended mode on/off inside regexp

            This was broken in ec3542229b29ec93062e9d90e877ea29d3c19472. That commit
            didn't handle cases where extended mode was turned on/off inside the
            regexp.  There are two ways to turn extended mode on/off:

            ```
            /(?-x:#y)#z
            /x =~ '#y'

            /(?-x)#y(?x)#z
            /x =~ '#y'
            ```

            These can be nested inside the same regexp:

            ```
            /(?-x:(?x)#x
            (?-x)#y)#z
            /x =~ '#y'
            ```

            As you can probably imagine, this makes handling these regexps
            somewhat complex. Due to the nesting inside portions of regexps,
            the unassign_nonascii function needs to be recursive.  In
            recursive mode, it needs to track both opening and closing
            parentheses, similar to how it already tracked opening and
            closing brackets for character classes.

            When scanning the regexp and coming to `(?` not followed by `#`,
            scan for options, and use `x` and `i` to determine whether to
            turn on or off extended mode.  For `:`, indicting only the
            current regexp section should have the extended mode
            switched, recurse with the extended mode set or unset. For `)`,
            indicating the remainder of the regexp (or current regexp portion
            if already recursing) should turn extended mode on or off, just
            change the extended mode flag and keep scanning.

            While testing this, I noticed that `a`, `d`, and `u` are accepted
            as options, in addition to `i`, `m`, and `x`, but I can't see
            where those options are documented.  I'm not sure whether or not
            handling  `a`, `d`, and `u` as options is a bug.

            Fixes [Bug #19379]
            ---
             re.c                     | 153 +++++++++++++++++++++++++++++++++++++----------
             test/ruby/test_regexp.rb |  56 +++++++++++++++++
             2 files changed, 176 insertions(+), 33 deletions(-)

commit 5a2b28909ece2e1310250180f097bfcb7b0203dc
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-01-31 13:39:13 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-01-31 13:39:13 +0900

    merge revision(s) 3f54d09a5b8b6e4fd734abc8911e170d5967b5b0: [Backport #19390]

            bignum.c: rb_int_parse_cstr handle `0` strings

            [Bug #19390]

            We shouldn't check the string length when skipping zeros, as the
            string might only contains zero characters, resulting in an empty string.
            ---
             bignum.c               | 1 -
             test/ruby/test_time.rb | 4 ++++
             2 files changed, 4 insertions(+), 1 deletion(-)

commit 1689d8bb4843f92c1805e4a4bdd94049569198f4
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-01-31 11:08:50 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-01-31 11:08:50 +0900

    merge revision(s) 21dced8b01823a991829b66ffdc8ffc635965c76: [Backport #19389]

            [ruby/stringio] [Bug #19389] Fix chomping with longer separator

            https://github.com/ruby/stringio/commit/eb322a9716
            ---
             ext/stringio/stringio.c        | 5 +++--
             test/stringio/test_stringio.rb | 2 ++
             2 files changed, 5 insertions(+), 2 deletions(-)

commit a22eca82314ae36668d8c1a591ffbbfa8f93147c
  Author:     Hiroshi SHIBATA <hsbt@ruby-lang.org>
  AuthorDate: 2023-01-25 23:32:01 +0900
  Commit:     GitHub <noreply@github.com>
  CommitDate: 2023-01-25 23:32:01 +0900

    Merge the latest stable versions of RubyGems and Bundler to Ruby 3.2.x (#7061)

    [Bug #19350]

    * Merge RubyGems-3.4.2 and Bundler-2.4.2

    * Merge RubyGems-3.4.3 and Bundler-2.4.3

    * Generate parser-text.rb of racc when sync it

    * Ignore LICENSE files of libraries vendored in rubygems [ci skip]

    * Adjust spec of bundler like as `sync_default_gems` [ci skip]

    * Fixed a typo

    * Removed vendored LICENSE file.

    * Update LEGAL sections for pub_grub

    * Merge RubyGems-3.4.4 and Bundler-2.4.4

    * Merge RubyGems-3.4.5 and Bundler-2.4.5

    Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>

commit fee5b8f263211faef10ed9f3e43c1e8b34548bbd
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-01-25 16:34:24 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-01-25 16:34:24 +0900

    merge revision(s) 2c93c554019ebdc394d3c51c6d925620d3005f84,f5ea43a2e61789357e9c4b374b4bc6756abeae17: [Backport #19360]

            Ensure main file has default coverage if required. (#7169)

            * Extract common code for coverage setup.
            ---
             iseq.c | 13 +++++++++++--
             1 file changed, 11 insertions(+), 2 deletions(-)

            More coverage tests & specs. (#7171)

            * Add spec for eval and line coverage.

            * Add test for main file coverage.
            ---
             spec/ruby/library/coverage/start_spec.rb | 8 +++++++-
             test/coverage/autostart.rb               | 2 ++
             test/coverage/main.rb                    | 1 +
             test/coverage/test_coverage.rb           | 7 +++++++
             4 files changed, 17 insertions(+), 1 deletion(-)
             create mode 100644 test/coverage/autostart.rb
             create mode 100644 test/coverage/main.rb

commit 4110137fcfd805de03a8f5569c3d6926959b9363
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-01-25 13:26:25 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-01-25 13:26:25 +0900

    merge revision(s) 6f3aff3961a4c5ce87e05096a1a9dcf1055b7647: [Backport #19289]

            [Bug #19289] Retain `ruby_abi_version` function

            A few extension libraries, to hide all symbols except for necessary to
            load, hardcode the symbols to be exported in symbol list files for
            linker without even checking by `have_func`.  As a workaround for such
            libraries, retain `ruby_abi_version` symbol always even in released
            versions for now.
            ---
             include/ruby/internal/abi.h | 7 +++++--
             1 file changed, 5 insertions(+), 2 deletions(-)

commit 0090cb82b0bf477c29a659e34cf4427a3b1ceb27
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-01-25 10:23:38 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-01-25 10:23:38 +0900

    merge revision(s) df6b72b8ff7af16a56fa48f3b4abb1d8850f4d1c: [Backport #19348]

            Avoid checking interrupt when loading iseq
            MIME-Version: 1.0
            Content-Type: text/plain; charset=UTF-8
            Content-Transfer-Encoding: 8bit

            The interrupt check will unintentionally release the VM lock when loading an iseq.
            And this will cause issues with the `debug` gem's
            [`ObjectSpace.each_iseq` method](https://github.com/ruby/debug/blob/0fcfc28acae33ec1c08068fb7c33703cfa681fa7/ext/debug/iseq_collector.c#L61-L67),
            which wraps iseqs with a wrapper and exposes their internal states when they're actually not ready to be used.

            And when that happens, errors like this would occur and kill the `debug` gem's thread:

            ```
             DEBUGGER: ReaderThreadError: uninitialized InstructionSequence
            ┃ DEBUGGER: Disconnected.
            ┃ ["/opt/rubies/ruby-3.2.0/lib/ruby/gems/3.2.0/gems/debug-1.7.1/lib/debug/breakpoint.rb:247:in `absolute_path'",
            ┃  "/opt/rubies/ruby-3.2.0/lib/ruby/gems/3.2.0/gems/debug-1.7.1/lib/debug/breakpoint.rb:247:in `block in iterate_iseq'",
            ┃  "/opt/rubies/ruby-3.2.0/lib/ruby/gems/3.2.0/gems/debug-1.7.1/lib/debug/breakpoint.rb:246:in `each_iseq'",
            ...
            ```

            A way to reproduce the issue is to satisfy these conditions at the same time:

            1. `debug` gem calling `ObjectSpace.each_iseq` (e.g. [activating a `LineBreakpoint`](https://github.com/ruby/debug/blob/0fcfc28acae33ec1c08068fb7c33703cfa681fa7/lib/debug/breakpoint.rb#L246)).
            2. A large amount of iseq being loaded from another thread (possibly through the `bootsnap` gem).
            3. 1 and 2 iterating through the same iseq(s) at the same time.

            Because this issue requires external dependencies and a rather complicated timing setup to reproduce, I wasn't able to write a test case for it.
            But here's some pseudo code to help reproduce it:

            ```rb
            require "debug/session"

            Thread.new do
              100.times do
                ObjectSpace.each_iseq do |iseq|
                  iseq.absolute_path
                end
              end
            end

            sleep 0.1

            load_a_bunch_of_iseq
            possibly_through_bootsnap
            ```

            [Bug #19348]

            Co-authored-by: Peter Zhu <peter@peterzhu.ca>
            ---
             compile.c       |  2 +-
             vm_core.h       |  1 +
             vm_insnhelper.c | 11 +++++++++++
             3 files changed, 13 insertions(+), 1 deletion(-)

commit a20061cb1aa34b73bdbdfa7cba6cfc575a05ca38
  Author:     NARUSE, Yui <naruse@airemix.jp>
  AuthorDate: 2023-01-24 17:41:17 +0900
  Commit:     NARUSE, Yui <naruse@airemix.jp>
  CommitDate: 2023-01-24 17:41:35 +0900

    merge revision(s) 72eb33066fa9e7dacb7470cd140b219abe37667e: [Backport #19320]

            Fix off-by-one error in rb_vm_each_stack_value

            Applying the following patch to test/erb/test_erb.rb and running that
            file will cause Ruby to crash on my machine (macOS 13.1 on M1 Pro):

            ```
            --- a/test/erb/test_erb.rb
            +++ b/test/erb/test_erb.rb
            @@ -7,6 +7,12 @@
             class TestERB < Test::Unit::TestCase
               class MyError < RuntimeError ; end

            +  def setup
            +    GC.auto_compact = true
            +    GC.stress = true
            +    GC.verify_compaction_references(expand_heap: true, toward: :empty)
            +  end
            +
            ```

            It crashes with the following log:

            ```
            /Users/peter/src/ruby/lib/erb/compiler.rb:276: [BUG] Segmentation fault at 0x00000001083a8690
            ...
            -- C level backtrace information -------------------------------------------
            ...
            /Users/peter/src/ruby/build/ruby(rb_vm_each_stack_value+0xa8) [0x104cc3a44] ../vm.c:2737
            /Users/peter/src/ruby/build/ruby(rb_vm_each_stack_value+0xa8) [0x104cc3a44] ../vm.c:2737
            /Users/peter/src/ruby/build/ruby(check_stack_for_moved+0x2c) [0x104b272a4] ../gc.c:5512
            /Users/peter/src/ruby/build/ruby(gc_compact_finish) ../gc.c:5534
