Skip to content

Commit

Permalink
Merge branch 'master-as-of-9aa62bd' into mmtk
Browse files Browse the repository at this point in the history
  • Loading branch information
eileencodes committed Jul 11, 2024
1 parent c9ff790 commit aafacc2
Show file tree
Hide file tree
Showing 336 changed files with 7,491 additions and 5,695 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/annocheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
builddir: build
makeup: true

- uses: ruby/setup-ruby@3783f195e29b74ae398d7caca108814bbafde90e # v1.180.1
- uses: ruby/setup-ruby@1d0e911f615a112e322369596f10ee0b95b010ae # v1.183.0
with:
ruby-version: '3.0'
bundler: none
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/baseruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- ruby-3.3

steps:
- uses: ruby/setup-ruby@3783f195e29b74ae398d7caca108814bbafde90e # v1.180.1
- uses: ruby/setup-ruby@1d0e911f615a112e322369596f10ee0b95b010ae # v1.183.0
with:
ruby-version: ${{ matrix.ruby }}
bundler: none
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check_dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:

- uses: ./.github/actions/setup/directories

- uses: ruby/setup-ruby@3783f195e29b74ae398d7caca108814bbafde90e # v1.180.1
- uses: ruby/setup-ruby@1d0e911f615a112e322369596f10ee0b95b010ae # v1.183.0
with:
ruby-version: '3.0'
bundler: none
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ jobs:
run: sudo rm /usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb

- name: Initialize CodeQL
uses: github/codeql-action/init@23acc5c183826b7a8a97bce3cecc52db901f8251 # v3.25.10
uses: github/codeql-action/init@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11
with:
languages: ${{ matrix.language }}

- name: Autobuild
uses: github/codeql-action/autobuild@23acc5c183826b7a8a97bce3cecc52db901f8251 # v3.25.10
uses: github/codeql-action/autobuild@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@23acc5c183826b7a8a97bce3cecc52db901f8251 # v3.25.10
uses: github/codeql-action/analyze@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11
with:
category: '/language:${{ matrix.language }}'
upload: False
Expand Down Expand Up @@ -118,7 +118,7 @@ jobs:
continue-on-error: true

- name: Upload SARIF
uses: github/codeql-action/upload-sarif@23acc5c183826b7a8a97bce3cecc52db901f8251 # v3.25.10
uses: github/codeql-action/upload-sarif@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11
with:
sarif_file: sarif-results/${{ matrix.language }}.sarif
continue-on-error: true
6 changes: 3 additions & 3 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
env:
GITPULLOPTIONS: --no-tags origin ${{ github.ref }}

runs-on: ${{ matrix.os || (github.repository == 'ruby/ruby' && 'macos-arm-oss' || 'macos-14')}}
runs-on: ${{ matrix.os || (github.repository == 'ruby/ruby' && 'macos-arm-oss' || 'macos-14') }}

if: >-
${{!(false
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
- name: Set up Launchable
uses: ./.github/actions/launchable/setup
with:
os: ${{ matrix.os || (github.repository == 'ruby/ruby' && 'macos-arm-oss' || 'macos-14')}}
os: ${{ matrix.os || (github.repository == 'ruby/ruby' && 'macos-arm-oss' || 'macos-14') }}
test-opts: ${{ matrix.test_opts }}
launchable-token: ${{ secrets.LAUNCHABLE_TOKEN }}
builddir: build
Expand Down Expand Up @@ -129,7 +129,7 @@ jobs:

- uses: ./.github/actions/slack
with:
label: ${{ matrix.os }} / ${{ matrix.test_task }}
label: ${{ matrix.os || (github.repository == 'ruby/ruby' && 'macos-arm-oss' || 'macos-14') }} / ${{ matrix.test_task }}
SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
if: ${{ failure() }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mingw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
steps:
- name: Set up Ruby & MSYS2
uses: ruby/setup-ruby@3783f195e29b74ae398d7caca108814bbafde90e # v1.180.1
uses: ruby/setup-ruby@1d0e911f615a112e322369596f10ee0b95b010ae # v1.183.0
with:
ruby-version: ${{ matrix.baseruby }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rjit-bindgen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
steps:
- name: Set up Ruby
uses: ruby/setup-ruby@3783f195e29b74ae398d7caca108814bbafde90e # v1.180.1
uses: ruby/setup-ruby@1d0e911f615a112e322369596f10ee0b95b010ae # v1.183.0
with:
ruby-version: '3.1'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ jobs:

# Upload the results to GitHub's code scanning dashboard.
- name: 'Upload to code-scanning'
uses: github/codeql-action/upload-sarif@23acc5c183826b7a8a97bce3cecc52db901f8251 # v2.1.27
uses: github/codeql-action/upload-sarif@b611370bb5703a7efb587f9d136a52ea24c5c38c # v2.1.27
with:
sarif_file: results.sarif
2 changes: 1 addition & 1 deletion .github/workflows/spec_guards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- uses: ruby/setup-ruby@3783f195e29b74ae398d7caca108814bbafde90e # v1.180.1
- uses: ruby/setup-ruby@1d0e911f615a112e322369596f10ee0b95b010ae # v1.183.0
with:
ruby-version: ${{ matrix.ruby }}
bundler: none
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
with:
arch: ${{ matrix.arch }}

- uses: ruby/setup-ruby@3783f195e29b74ae398d7caca108814bbafde90e # v1.180.1
- uses: ruby/setup-ruby@1d0e911f615a112e322369596f10ee0b95b010ae # v1.183.0
with:
ruby-version: '3.0'
bundler: none
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:
run: |
echo "WASI_SDK_PATH=/opt/wasi-sdk" >> $GITHUB_ENV
- uses: ruby/setup-ruby@3783f195e29b74ae398d7caca108814bbafde90e # v1.180.1
- uses: ruby/setup-ruby@1d0e911f615a112e322369596f10ee0b95b010ae # v1.183.0
with:
ruby-version: '3.0'
bundler: none
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
${{ steps.find-tools.outputs.needs }}
if: ${{ steps.find-tools.outputs.needs != '' }}

- uses: ruby/setup-ruby@3783f195e29b74ae398d7caca108814bbafde90e # v1.180.1
- uses: ruby/setup-ruby@1d0e911f615a112e322369596f10ee0b95b010ae # v1.183.0
with:
ruby-version: '3.0'
bundler: none
Expand Down Expand Up @@ -148,11 +148,6 @@ jobs:
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"

- name: link libraries
run: |
for %%I in (..\src\vcpkg_installed\x64-windows\bin\*.dll) do (
if not %%~nI == readline mklink %%~nxI %%I
)
# We use OpenSSL instealled by vcpkg instead
- name: disable system OpenSSL
run: |
Expand All @@ -168,6 +163,8 @@ jobs:
../src/win32/configure.bat --disable-install-doc
--with-opt-dir=D:/a/ruby/ruby/src/vcpkg_installed/x64-windows
- run: nmake prepare-vcpkg

- run: nmake incs

- run: nmake extract-extlibs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/yjit-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ jobs:

- uses: ./.github/actions/setup/ubuntu

- uses: ruby/setup-ruby@3783f195e29b74ae398d7caca108814bbafde90e # v1.180.1
- uses: ruby/setup-ruby@1d0e911f615a112e322369596f10ee0b95b010ae # v1.183.0
with:
ruby-version: '3.0'
bundler: none
Expand Down
7 changes: 4 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ The following default gems are updated.

The following bundled gems are updated.

* minitest 5.24.0
* minitest 5.24.1
* rake 13.2.1
* test-unit 3.6.2
* rexml 3.3.0
* net-ftp 0.3.6
* rexml 3.3.1
* net-ftp 0.3.7
* net-imap 0.4.14
* net-smtp 0.5.0
* rbs 3.5.1
Expand Down Expand Up @@ -152,3 +152,4 @@ See GitHub releases like [GitHub Releases of Logger](https://github.com/ruby/log
[Bug #20218]: https://bugs.ruby-lang.org/issues/20218
[Feature #20265]: https://bugs.ruby-lang.org/issues/20265
[Feature #20429]: https://bugs.ruby-lang.org/issues/20429
[Feature #20497]: https://bugs.ruby-lang.org/issues/20497
19 changes: 16 additions & 3 deletions array.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ ary_heap_realloc(VALUE ary, size_t new_capa)
#if USE_MMTK
if (!rb_mmtk_enabled_p()) {
#endif
RUBY_ASSERT(!OBJ_FROZEN(ary));
SIZED_REALLOC_N(RARRAY(ary)->as.heap.ptr, VALUE, new_capa, ARY_HEAP_CAPA(ary));
#if USE_MMTK
} else {
Expand Down Expand Up @@ -575,7 +576,10 @@ ary_shrink_capa(VALUE ary)
long old_capa = ARY_HEAP_CAPA(ary);
RUBY_ASSERT(!ARY_SHARED_P(ary));
RUBY_ASSERT(old_capa >= capacity);
if (old_capa > capacity) ary_heap_realloc(ary, capacity);
if (old_capa > capacity) {
size_t new_capa = ary_heap_realloc(ary, capacity);
ARY_SET_CAPA(ary, new_capa);
}

ary_verify(ary);
}
Expand Down Expand Up @@ -794,6 +798,14 @@ ary_ensure_room_for_push(VALUE ary, long add_len)
VALUE
rb_ary_freeze(VALUE ary)
{
RUBY_ASSERT(RB_TYPE_P(ary, T_ARRAY));

if (OBJ_FROZEN(ary)) return ary;

if (!ARY_EMBED_P(ary) && !ARY_SHARED_P(ary) && !ARY_SHARED_ROOT_P(ary)) {
ary_shrink_capa(ary);
}

return rb_obj_freeze(ary);
}

Expand Down Expand Up @@ -1113,7 +1125,7 @@ rb_setup_fake_ary(struct RArray *fake_ary, const VALUE *list, long len, bool fre
ARY_SET_PTR(ary, list);
ARY_SET_HEAP_LEN(ary, len);
ARY_SET_CAPA(ary, len);
if (freeze) OBJ_FREEZE(ary);
if (freeze) rb_ary_freeze(ary);
return ary;
}

Expand Down Expand Up @@ -6785,7 +6797,7 @@ rb_ary_flatten_bang(int argc, VALUE *argv, VALUE ary)
if (result == ary) {
return Qnil;
}
if (!(mod = ARY_EMBED_P(result))) rb_obj_freeze(result);
if (!(mod = ARY_EMBED_P(result))) rb_ary_freeze(result);
rb_ary_replace(ary, result);
if (mod) ARY_SET_EMBED_LEN(result, 0);

Expand Down Expand Up @@ -9081,6 +9093,7 @@ Init_Array(void)
rb_define_method(rb_cArray, "one?", rb_ary_one_p, -1);
rb_define_method(rb_cArray, "dig", rb_ary_dig, -1);
rb_define_method(rb_cArray, "sum", rb_ary_sum, -1);
rb_define_method(rb_cArray, "freeze", rb_ary_freeze, 0);

rb_define_method(rb_cArray, "deconstruct", rb_ary_deconstruct, 0);
}
Expand Down
2 changes: 1 addition & 1 deletion ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ ast_node_all_tokens(rb_execution_context_t *ec, VALUE self)
token = rb_ary_new_from_args(4, INT2FIX(parser_token->id), ID2SYM(rb_intern(parser_token->type_name)), str, loc);
rb_ary_push(all_tokens, token);
}
rb_obj_freeze(all_tokens);
rb_ary_freeze(all_tokens);

return all_tokens;
}
Expand Down
2 changes: 2 additions & 0 deletions bootstraptest/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,8 @@ def show_limit(testsrc, opt = '', **argh)

def pretty(src, desc, result)
src = src.sub(/\A\s*\n/, '')
lines = src.lines
src = lines[0..20].join + "(...snip)\n" if lines.size > 20
(/\n/ =~ src ? "\n#{adjust_indent(src)}" : src) + " #=> #{desc}"
end

Expand Down
30 changes: 30 additions & 0 deletions bootstraptest/test_method.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1344,3 +1344,33 @@ def foo(...) = xyzzy(...)
C.new.foo
}

assert_equal 'ok', %q{
class C
def initialize(a)
end
end
def foo(...)
C.new(...)
:ok
end
foo(*["bar"])
foo("baz")
}

assert_equal 'ok', %q{
class C
def foo(b:)
b
end
end
def foo(...)
C.new.send(...)
end
foo(:foo, b: :ok)
foo(*["foo"], b: :ok)
}
Loading

0 comments on commit aafacc2

Please sign in to comment.