diff options
39 files changed, 249 insertions, 221 deletions
diff --git a/.github/actions/compilers/entrypoint.sh b/.github/actions/compilers/entrypoint.sh index 16c3f9f21d..1de7fce1d3 100755 --- a/.github/actions/compilers/entrypoint.sh +++ b/.github/actions/compilers/entrypoint.sh @@ -75,6 +75,18 @@ tests='' spec_opts='' # Launchable +launchable_record_session() { + launchable record session \ + --build "${build_name}" \ + --flavor test_task=$1 \ + --flavor workflow=Compilations \ + --flavor with-gcc="${INPUT_WITH_GCC}" \ + --flavor CFLAGS="${INPUT_CFLAGS}" \ + --flavor CXXFLAGS="${INPUT_CXXFLAGS}" \ + --flavor optflags="${INPUT_OPTFLAGS}" \ + --flavor cppflags="${INPUT_CPPFLAGS}" \ + --test-suite ${2-$1} +} setup_launchable() { pushd ${srcdir} # To prevent a slowdown in CI, disable request retries when the Launchable server is unstable. @@ -86,52 +98,22 @@ setup_launchable() { local github_ref="${GITHUB_REF//\//_}" local build_name="${github_ref}"_"${GITHUB_PR_HEAD_SHA}" launchable record build --name "${build_name}" || true - launchable record session \ - --build "${build_name}" \ - --flavor test_task=test \ - --flavor workflow=Compilations \ - --flavor with-gcc="${INPUT_WITH_GCC}" \ - --flavor CFLAGS="${INPUT_CFLAGS}" \ - --flavor CXXFLAGS="${INPUT_CXXFLAGS}" \ - --flavor optflags="${INPUT_OPTFLAGS}" \ - --flavor cppflags="${INPUT_CPPFLAGS}" \ - --test-suite btest \ - > "${builddir}"/${btest_session_file} \ + btest_session=$(launchable_record_session test btest) \ && btests+=--launchable-test-reports="${btest_report_path}" || : if [ "$INPUT_CHECK" = "true" ]; then - launchable record session \ - --build "${build_name}" \ - --flavor test_task=test-all \ - --flavor workflow=Compilations \ - --flavor with-gcc="${INPUT_WITH_GCC}" \ - --flavor CFLAGS="${INPUT_CFLAGS}" \ - --flavor CXXFLAGS="${INPUT_CXXFLAGS}" \ - --flavor optflags="${INPUT_OPTFLAGS}" \ - --flavor cppflags="${INPUT_CPPFLAGS}" \ - --test-suite test-all \ - > "${builddir}"/${test_all_session_file} \ + test_all_session=$(launchable_record_session test-all) \ && tests+=--launchable-test-reports="${test_report_path}" || : mkdir "${builddir}"/"${test_spec_report_path}" - launchable record session \ - --build "${build_name}" \ - --flavor test_task=test-spec \ - --flavor workflow=Compilations \ - --flavor with-gcc="${INPUT_WITH_GCC}" \ - --flavor CFLAGS="${INPUT_CFLAGS}" \ - --flavor CXXFLAGS="${INPUT_CXXFLAGS}" \ - --flavor optflags="${INPUT_OPTFLAGS}" \ - --flavor cppflags="${INPUT_CPPFLAGS}" \ - --test-suite test-spec \ - > "${builddir}"/${test_spec_session_file} \ + test_spec_session=$(launchable_record_session test-spec) \ && spec_opts+=--launchable-test-reports="${test_spec_report_path}" || : fi } launchable_record_test() { pushd "${builddir}" - grouped launchable record tests --session "$(cat "${btest_session_file}")" raw "${btest_report_path}" || true + grouped launchable record tests --session "${btest_session}" raw "${btest_report_path}" || true if [ "$INPUT_CHECK" = "true" ]; then - grouped launchable record tests --session "$(cat "${test_all_session_file}")" raw "${test_report_path}" || true - grouped launchable record tests --session "$(cat "${test_spec_session_file}")" raw "${test_spec_report_path}"/* || true + grouped launchable record tests --session "${test_all_session}" raw "${test_report_path}" || true + grouped launchable record tests --session "${test_spec_session}" raw "${test_spec_report_path}"/* || true fi } if [ "$LAUNCHABLE_ENABLED" = "true" ]; then @@ -139,9 +121,6 @@ if [ "$LAUNCHABLE_ENABLED" = "true" ]; then btest_report_path='launchable_bootstraptest.json' test_report_path='launchable_test_all.json' test_spec_report_path='launchable_test_spec_report' - test_all_session_file='launchable_test_all_session.txt' - btest_session_file='launchable_btest_session.txt' - test_spec_session_file='launchable_test_spec_session.txt' setup_pid=$$ (sleep 180; echo "setup_launchable timed out; killing"; kill -INT "-$setup_pid" 2> /dev/null) & sleep_pid=$! launchable_failed=false diff --git a/.github/actions/launchable/setup/action.yml b/.github/actions/launchable/setup/action.yml index 07990a885b..1cd28bf2d7 100644 --- a/.github/actions/launchable/setup/action.yml +++ b/.github/actions/launchable/setup/action.yml @@ -111,9 +111,6 @@ runs: echo test_all_enabled="${test_all_enabled}" >> $GITHUB_OUTPUT echo btest_enabled="${btest_enabled}" >> $GITHUB_OUTPUT echo test_spec_enabled="${test_spec_enabled}" >> $GITHUB_OUTPUT - echo test_all_session_file='launchable_test_all_session.txt' >> $GITHUB_OUTPUT - echo btest_session_file='launchable_btest_session.txt' >> $GITHUB_OUTPUT - echo test_spec_session_file='launchable_test_spec_session.txt' >> $GITHUB_OUTPUT echo test_all_report_file='launchable_test_all_report.json' >> $GITHUB_OUTPUT echo btest_report_file='launchable_btest_report.json' >> $GITHUB_OUTPUT echo test_spec_report_dir='launchable_test_spec_report' >> $GITHUB_OUTPUT @@ -169,88 +166,48 @@ runs: btest_test_suite="yjit-${btest_test_suite}" test_spec_test_suite="yjit-${test_spec_test_suite}" fi - launchable record build --name "${build_name}" - if [ "${test_all_enabled}" = "true" ]; then - launchable record session \ + # launchable_setup target var -- refers ${target} prefixed variables + launchable_setup() { + local target=$1 session + eval [ "\${${target}_enabled}" = "true" ] || return + eval local suite=\${${target}_test_suite} + session=$(launchable record session \ --build "${build_name}" \ --observation \ --flavor os="${{ inputs.os }}" \ --flavor test_task="${{ inputs.test-task }}" \ --flavor test_opts="${test_opts}" \ --flavor workflow="${{ github.workflow }}" \ - --test-suite ${test_all_test_suite} \ - > "${test_all_session_file}" + --test-suite ${suite} \ + ) launchable subset \ --get-tests-from-previous-sessions \ --non-blocking \ --target 90% \ - --session "$(cat "${test_all_session_file}")" \ + --session "${session}" \ raw > /dev/null - echo "TESTS=${TESTS} --launchable-test-reports=${test_all_report_file}" >> $GITHUB_ENV + echo "${target}_session=${session}" >> $GITHUB_OUTPUT + } + + launchable record build --name "${build_name}" + if launchable_setup test_all; then + echo "TESTS=${TESTS:+$TESTS }--launchable-test-reports=${test_all_report_file}" >> $GITHUB_ENV fi - if [ "${btest_enabled}" = "true" ]; then - launchable record session \ - --build "${build_name}" \ - --observation \ - --flavor os="${{ inputs.os }}" \ - --flavor test_task="${{ inputs.test-task }}" \ - --flavor test_opts="${test_opts}" \ - --flavor workflow="${{ github.workflow }}" \ - --test-suite ${btest_test_suite} \ - > "${btest_session_file}" - launchable subset \ - --get-tests-from-previous-sessions \ - --non-blocking \ - --target 90% \ - --session "$(cat "${btest_session_file}")" \ - raw > /dev/null - echo "BTESTS=${BTESTS} --launchable-test-reports=${btest_report_file}" >> $GITHUB_ENV + if launchable_setup btest; then + echo "BTESTS=${BTESTS:+$BTESTS }--launchable-test-reports=${btest_report_file}" >> $GITHUB_ENV fi - if [ "${test_spec_enabled}" = "true" ]; then - launchable record session \ - --build "${build_name}" \ - --observation \ - --flavor os="${{ inputs.os }}" \ - --flavor test_task="${{ inputs.test-task }}" \ - --flavor test_opts="${test_opts}" \ - --flavor workflow="${{ github.workflow }}" \ - --test-suite ${test_spec_test_suite} \ - > "${test_spec_session_file}" - launchable subset \ - --get-tests-from-previous-sessions \ - --non-blocking \ - --target 90% \ - --session "$(cat "${test_spec_session_file}")" \ - raw > /dev/null - echo "SPECOPTS=${SPECOPTS} --launchable-test-reports=${test_spec_report_dir}" >> $GITHUB_ENV + if launchable_setup test_spec; then + echo "SPECOPTS=${SPECOPTS:$SPECOPTS }--launchable-test-reports=${test_spec_report_dir}" >> $GITHUB_ENV fi if: steps.enable-launchable.outputs.enable-launchable env: test_all_enabled: ${{ steps.global.outputs.test_all_enabled }} btest_enabled: ${{ steps.global.outputs.btest_enabled }} test_spec_enabled: ${{ steps.global.outputs.test_spec_enabled }} - test_all_session_file: ${{ steps.global.outputs.test_all_session_file }} - btest_session_file: ${{ steps.global.outputs.btest_session_file }} - test_spec_session_file: ${{ steps.global.outputs.test_spec_session_file }} test_all_report_file: ${{ steps.global.outputs.test_all_report_file }} btest_report_file: ${{ steps.global.outputs.btest_report_file }} test_spec_report_dir: ${{ steps.global.outputs.test_spec_report_dir }} - - name: Clean up session files in Launchable - uses: gacts/run-and-post-run@674528335da98a7afc80915ff2b4b860a0b3553a # v1.4.0 - with: - shell: bash - working-directory: ${{ inputs.srcdir }} - post: | - rm -f "${test_all_session_file}" - rm -f "${btest_session_file}" - rm -f "${test_spec_session_file}" - if: always() && steps.setup-launchable.outcome == 'success' - env: - test_all_session_file: ${{ steps.global.outputs.test_all_session_file }} - btest_session_file: ${{ steps.global.outputs.btest_session_file }} - test_spec_session_file: ${{ steps.global.outputs.test_spec_session_file }} - - name: Clean up test results in Launchable uses: gacts/run-and-post-run@674528335da98a7afc80915ff2b4b860a0b3553a # v1.4.0 with: @@ -317,31 +274,31 @@ runs: post: | if [[ "${test_all_enabled}" = "true" ]]; then \ launchable record attachment \ - --session "$(cat "${test_all_session_file}")" \ + --session "${test_all_session}" \ "${stdout_report_path}" \ "${stderr_report_path}"; \ launchable record tests \ - --session "$(cat "${test_all_session_file}")" \ + --session "${test_all_session}" \ raw "${test_report_path}" || true; \ fi if [[ "${btest_enabled}" = "true" ]]; then \ launchable record attachment \ - --session "$(cat "${btest_session_file}")" \ + --session "${btest_session}" \ "${stdout_report_path}" \ "${stderr_report_path}"; \ launchable record tests \ - --session "$(cat "${btest_session_file}")" \ + --session "${btest_session}" \ raw "${btest_report_path}" || true; \ fi if [[ "${test_spec_enabled}" = "true" ]]; then \ launchable record attachment \ - --session "$(cat "${test_spec_session_file}")" \ + --session "${test_spec_session}" \ "${stdout_report_path}" \ "${stderr_report_path}"; \ launchable record tests \ - --session "$(cat "${test_spec_session_file}")" \ + --session "${test_spec_session}" \ raw ${test_spec_report_path}/* || true; \ fi if: ${{ always() && steps.enable-launchable.outputs.enable-launchable }} @@ -352,8 +309,8 @@ runs: test_all_enabled: ${{ steps.global.outputs.test_all_enabled }} btest_enabled: ${{ steps.global.outputs.btest_enabled }} test_spec_enabled: ${{ steps.global.outputs.test_spec_enabled }} - test_all_session_file: ${{ steps.global.outputs.test_all_session_file }} - btest_session_file: ${{ steps.global.outputs.btest_session_file }} - test_spec_session_file: ${{ steps.global.outputs.test_spec_session_file }} + test_all_session: ${{ steps.setup-launchable.outputs.test_all_session }} + btest_session: ${{ steps.setup-launchable.outputs.btest_session }} + test_spec_session: ${{ steps.setup-launchable.outputs.test_spec_session }} stdout_report_path: ${{ steps.variables.outputs.stdout_report_path }} stderr_report_path: ${{ steps.variables.outputs.stderr_report_path }} @@ -19,20 +19,22 @@ Note: We're only listing outstanding class updates. * `Kernel#inspect` now checks for the existence of a `#instance_variables_to_inspect` method, allowing control over which instance variables are displayed in the `#inspect` string: - ```ruby - class DatabaseConfig - def initialize(host, user, password) - @host = host - @user = user - @password = password + ```ruby + class DatabaseConfig + def initialize(host, user, password) + @host = host + @user = user + @password = password + end + + private def instance_variables_to_inspect = [:@host, :@user] end - private def instance_variables_to_inspect = [:@host, :@user] - end + conf = DatabaseConfig.new("localhost", "root", "hunter2") + conf.inspect #=> #<DatabaseConfig:0x0000000104def350 @host="localhost", @user="root"> + ``` - conf = DatabaseConfig.new("localhost", "root", "hunter2") - conf.inspect #=> #<DatabaseConfig:0x0000000104def350 @host="localhost", @user="root"> - ``` + [[Feature #21219]] * Binding @@ -141,6 +143,7 @@ The following default gems are updated. * stringio 3.1.8.dev * strscan 3.1.6.dev * uri 1.0.3 +* weakref 0.1.4 The following bundled gems are added. @@ -219,6 +222,7 @@ The following bundled gems are updated. [Bug #21049]: https://bugs.ruby-lang.org/issues/21049 [Feature #21166]: https://bugs.ruby-lang.org/issues/21166 [Feature #21216]: https://bugs.ruby-lang.org/issues/21216 +[Feature #21219]: https://bugs.ruby-lang.org/issues/21219 [Feature #21258]: https://bugs.ruby-lang.org/issues/21258 [Feature #21262]: https://bugs.ruby-lang.org/issues/21262 [Feature #21287]: https://bugs.ruby-lang.org/issues/21287 @@ -13307,7 +13307,7 @@ ibf_load_catch_table(const struct ibf_load *load, ibf_offset_t catch_table_offse table->entries[i].sp = (unsigned int)ibf_load_small_value(load, &reading_pos); rb_iseq_t *catch_iseq = (rb_iseq_t *)ibf_load_iseq(load, (const rb_iseq_t *)(VALUE)iseq_index); - RB_OBJ_WRITE(parent_iseq, &table->entries[i].iseq, catch_iseq); + RB_OBJ_WRITE(parent_iseq, UNALIGNED_MEMBER_PTR(&table->entries[i], iseq), catch_iseq); } return table; } diff --git a/doc/maintainers.md b/doc/maintainers.md index 7c939a96c8..7d217a1665 100644 --- a/doc/maintainers.md +++ b/doc/maintainers.md @@ -107,11 +107,9 @@ have commit right, others don't. * https://github.com/rubygems/rubygems * https://rubygems.org/gems/bundler -#### lib/cgi.rb, lib/cgi/* +#### lib/cgi/escape.rb * *unmaintained* -* https://github.com/ruby/cgi -* https://rubygems.org/gems/cgi #### lib/English.rb @@ -312,8 +310,6 @@ have commit right, others don't. #### ext/cgi * Nobuyoshi Nakada ([nobu]) -* https://github.com/ruby/cgi -* https://rubygems.org/gems/cgi #### ext/date diff --git a/doc/standard_library.md b/doc/standard_library.md index 594667b4e2..97f46bc987 100644 --- a/doc/standard_library.md +++ b/doc/standard_library.md @@ -34,7 +34,6 @@ of each. ## Libraries - Bundler ([GitHub][bundler]): Manage your Ruby application's gem dependencies -- CGI ([GitHub][cgi]): Support for the Common Gateway Interface protocol - Delegator ([GitHub][delegate]): Provides three abilities to delegate method calls to an object - DidYouMean ([GitHub][did_you_mean]): "Did you mean?" experience in Ruby - English ([GitHub][English]): Provides references to special global variables with less cryptic names @@ -137,7 +136,6 @@ of each. [benchmark]: https://github.com/ruby/benchmark [bigdecimal]: https://github.com/ruby/bigdecimal [bundler]: https://github.com/rubygems/rubygems -[cgi]: https://github.com/ruby/cgi [csv]: https://github.com/ruby/csv [date]: https://github.com/ruby/date [debug]: https://github.com/ruby/debug diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index c0c7d9f899..198c9e2846 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -512,7 +512,7 @@ module Bundler end end - unless Bundler.feature_flag.bundler_3_mode? + unless Bundler.feature_flag.bundler_4_mode? desc "viz [OPTIONS]", "Generates a visual dependency graph", hide: true long_desc <<-D Viz generates a PNG file of the current Gemfile as a dependency graph. diff --git a/lib/bundler/cli/config.rb b/lib/bundler/cli/config.rb index e979b42a8c..d963679085 100644 --- a/lib/bundler/cli/config.rb +++ b/lib/bundler/cli/config.rb @@ -27,7 +27,7 @@ module Bundler message = "Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle #{new_args.join(" ")}` instead." removed_message = "Using the `config` command without a subcommand [list, get, set, unset] has been removed. Use `bundle #{new_args.join(" ")}` instead." - SharedHelpers.major_deprecation 3, message, removed_message: removed_message + SharedHelpers.major_deprecation 4, message, removed_message: removed_message Base.new(options, name, value, self).run end diff --git a/lib/bundler/cli/update.rb b/lib/bundler/cli/update.rb index ab31d00879..ba3f1ec056 100644 --- a/lib/bundler/cli/update.rb +++ b/lib/bundler/cli/update.rb @@ -26,7 +26,7 @@ module Bundler if Bundler.feature_flag.update_requires_all_flag? raise InvalidOption, "To update everything, pass the `--all` flag." end - SharedHelpers.major_deprecation 3, "Pass --all to `bundle update` to update everything" + SharedHelpers.major_deprecation 4, "Pass --all to `bundle update` to update everything" elsif !full_update && options[:all] raise InvalidOption, "Cannot specify --all along with specific options." end diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index 8ebc3d0020..4f9fbc55b1 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -521,7 +521,7 @@ module Bundler end def multiple_global_source_warning - if Bundler.feature_flag.bundler_3_mode? + if Bundler.feature_flag.bundler_4_mode? msg = "This Gemfile contains multiple global sources. " \ "Each source after the first must include a block to indicate which gems " \ "should come from that source" diff --git a/lib/bundler/environment_preserver.rb b/lib/bundler/environment_preserver.rb index 5e9a44ab5d..ffffceb487 100644 --- a/lib/bundler/environment_preserver.rb +++ b/lib/bundler/environment_preserver.rb @@ -6,7 +6,7 @@ module Bundler BUNDLER_KEYS = %w[ BUNDLE_BIN_PATH BUNDLE_GEMFILE - BUNDLER_3_MODE + BUNDLER_4_MODE BUNDLER_VERSION BUNDLER_SETUP GEM_HOME diff --git a/lib/bundler/feature_flag.rb b/lib/bundler/feature_flag.rb index b19cf42cc3..38498b245f 100644 --- a/lib/bundler/feature_flag.rb +++ b/lib/bundler/feature_flag.rb @@ -27,20 +27,20 @@ module Bundler (1..10).each {|v| define_method("bundler_#{v}_mode?") { @major_version >= v } } - settings_flag(:allow_offline_install) { bundler_3_mode? } - settings_flag(:auto_clean_without_path) { bundler_3_mode? } - settings_flag(:cache_all) { bundler_3_mode? } - settings_flag(:default_install_uses_path) { bundler_3_mode? } - settings_flag(:forget_cli_options) { bundler_3_mode? } - settings_flag(:global_gem_cache) { bundler_3_mode? } - settings_flag(:lockfile_checksums) { bundler_3_mode? } - settings_flag(:path_relative_to_cwd) { bundler_3_mode? } + settings_flag(:allow_offline_install) { bundler_4_mode? } + settings_flag(:auto_clean_without_path) { bundler_4_mode? } + settings_flag(:cache_all) { bundler_4_mode? } + settings_flag(:default_install_uses_path) { bundler_4_mode? } + settings_flag(:forget_cli_options) { bundler_4_mode? } + settings_flag(:global_gem_cache) { bundler_4_mode? } + settings_flag(:lockfile_checksums) { bundler_4_mode? } + settings_flag(:path_relative_to_cwd) { bundler_4_mode? } settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") } - settings_flag(:print_only_version_number) { bundler_3_mode? } - settings_flag(:setup_makes_kernel_gem_public) { !bundler_3_mode? } - settings_flag(:update_requires_all_flag) { bundler_4_mode? } + settings_flag(:print_only_version_number) { bundler_4_mode? } + settings_flag(:setup_makes_kernel_gem_public) { !bundler_4_mode? } + settings_flag(:update_requires_all_flag) { bundler_5_mode? } - settings_option(:default_cli_command) { bundler_3_mode? ? :cli_help : :install } + settings_option(:default_cli_command) { bundler_4_mode? ? :cli_help : :install } def initialize(bundler_version) @bundler_version = Gem::Version.create(bundler_version) diff --git a/lib/bundler/self_manager.rb b/lib/bundler/self_manager.rb index 0ee111f23e..ab16061dc7 100644 --- a/lib/bundler/self_manager.rb +++ b/lib/bundler/self_manager.rb @@ -105,7 +105,7 @@ module Bundler def autoswitching_applies? ENV["BUNDLER_VERSION"].nil? && - ENV["BUNDLER_3_MODE"].nil? && + ENV["BUNDLER_4_MODE"].nil? && ruby_can_restart_with_same_arguments? && lockfile_version end diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb index 1a7a0959c9..f613377cb2 100644 --- a/lib/bundler/source/git/git_proxy.rb +++ b/lib/bundler/source/git/git_proxy.rb @@ -408,7 +408,7 @@ module Bundler def capture3_args_for(cmd, dir) return ["git", *cmd] unless dir - if Bundler.feature_flag.bundler_3_mode? || supports_minus_c? + if Bundler.feature_flag.bundler_4_mode? || supports_minus_c? ["git", "-C", dir.to_s, *cmd] else ["git", *cmd, { chdir: dir.to_s }] diff --git a/lib/bundler/source_map.rb b/lib/bundler/source_map.rb index ca73e01f9d..a8e12d08c3 100644 --- a/lib/bundler/source_map.rb +++ b/lib/bundler/source_map.rb @@ -23,7 +23,7 @@ module Bundler if previous_source.nil? requirements[indirect_dependency_name] = source else - no_ambiguous_sources = Bundler.feature_flag.bundler_3_mode? + no_ambiguous_sources = Bundler.feature_flag.bundler_4_mode? msg = ["The gem '#{indirect_dependency_name}' was found in multiple relevant sources."] msg.concat [previous_source, source].map {|s| " * #{s}" }.sort diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb index 8ac9588fb7..a995f4f281 100644 --- a/lib/bundler/version.rb +++ b/lib/bundler/version.rb @@ -1,7 +1,7 @@ # frozen_string_literal: false module Bundler - VERSION = (ENV["BUNDLER_3_MODE"] == "true" ? "3.0.0" : "2.7.0.dev").freeze + VERSION = (ENV["BUNDLER_4_MODE"] == "true" ? "4.0.0" : "2.7.0.dev").freeze def self.bundler_major_version @bundler_major_version ||= VERSION.split(".").first.to_i diff --git a/lib/weakref.rb b/lib/weakref.rb index f0a7e7b318..0a09f7f993 100644 --- a/lib/weakref.rb +++ b/lib/weakref.rb @@ -17,7 +17,7 @@ require "delegate" # class WeakRef < Delegator - VERSION = "0.1.3" + VERSION = "0.1.4" ## # RefError is raised when a referenced object has been recycled by the diff --git a/misc/lldb_cruby.py b/misc/lldb_cruby.py index f263ca5732..b3d4fb509a 100755..100644 --- a/misc/lldb_cruby.py +++ b/misc/lldb_cruby.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python #coding: utf-8 # # Usage: run `command script import -r misc/lldb_cruby.py` on LLDB diff --git a/spec/bundler/bundler/cli_spec.rb b/spec/bundler/bundler/cli_spec.rb index bb2cc0abf7..63803600aa 100644 --- a/spec/bundler/bundler/cli_spec.rb +++ b/spec/bundler/bundler/cli_spec.rb @@ -87,7 +87,7 @@ RSpec.describe "bundle executable" do end context "with no arguments" do - it "prints a concise help message", bundler: "3" do + it "prints a concise help message", bundler: "4" do bundle "" expect(err).to be_empty expect(out).to include("Bundler version #{Bundler::VERSION}"). @@ -255,7 +255,7 @@ RSpec.describe "bundler executable" do expect(out).to eq("Bundler version #{Bundler::VERSION}") end - it "shows the bundler version just as the `bundle` executable does", bundler: "3" do + it "shows the bundler version just as the `bundle` executable does", bundler: "4" do bundler "--version" expect(out).to eq(Bundler::VERSION) end diff --git a/spec/bundler/bundler/current_ruby_spec.rb b/spec/bundler/bundler/current_ruby_spec.rb index 4a0cf87dff..9d6cb518cd 100644 --- a/spec/bundler/bundler/current_ruby_spec.rb +++ b/spec/bundler/bundler/current_ruby_spec.rb @@ -151,6 +151,6 @@ RSpec.describe Bundler::CurrentRuby do Bundler.current_ruby.maglev_31? end - pending "is removed and shows a helpful error message about it", bundler: "3" + pending "is removed and shows a helpful error message about it", bundler: "4" end end diff --git a/spec/bundler/cache/path_spec.rb b/spec/bundler/cache/path_spec.rb index a98c3f20ba..0d77ee85e6 100644 --- a/spec/bundler/cache/path_spec.rb +++ b/spec/bundler/cache/path_spec.rb @@ -110,7 +110,7 @@ RSpec.describe "bundle cache with path" do expect(bundled_app("vendor/cache/foo-1.0")).not_to exist end - it "caches path gems by default", bundler: "3" do + it "caches path gems by default", bundler: "4" do build_lib "foo" install_gemfile <<-G diff --git a/spec/bundler/commands/cache_spec.rb b/spec/bundler/commands/cache_spec.rb index c162ea1e93..50289ca65a 100644 --- a/spec/bundler/commands/cache_spec.rb +++ b/spec/bundler/commands/cache_spec.rb @@ -232,7 +232,7 @@ RSpec.describe "bundle cache" do expect(bundled_app("vendor/cache/myrack-1.0.0.gem")).to exist end - it "prints an error when using legacy windows rubies", bundler: "3" do + it "prints an error when using legacy windows rubies", bundler: "4" do gemfile <<-D source "https://gem.repo1" gem 'myrack', :platforms => [:ruby_20, :x64_mingw_20] diff --git a/spec/bundler/commands/clean_spec.rb b/spec/bundler/commands/clean_spec.rb index cffd4741f5..176a125a48 100644 --- a/spec/bundler/commands/clean_spec.rb +++ b/spec/bundler/commands/clean_spec.rb @@ -427,7 +427,7 @@ RSpec.describe "bundle clean" do should_not_have_gems "foo-1.0" end - it "automatically cleans when path has not been set", bundler: "3" do + it "automatically cleans when path has not been set", bundler: "4" do build_repo2 install_gemfile <<-G diff --git a/spec/bundler/commands/inject_spec.rb b/spec/bundler/commands/inject_spec.rb index 37defa8961..2630b8993b 100644 --- a/spec/bundler/commands/inject_spec.rb +++ b/spec/bundler/commands/inject_spec.rb @@ -79,7 +79,7 @@ Usage: "bundle inject GEM VERSION" context "when frozen" do before do bundle "install" - if Bundler.feature_flag.bundler_3_mode? + if Bundler.feature_flag.bundler_4_mode? bundle "config set --local deployment true" else bundle "config set --local frozen true" diff --git a/spec/bundler/commands/show_spec.rb b/spec/bundler/commands/show_spec.rb index 2693194e63..33ba0a2c04 100644 --- a/spec/bundler/commands/show_spec.rb +++ b/spec/bundler/commands/show_spec.rb @@ -219,6 +219,6 @@ RSpec.describe "bundle show", bundler: "2" do end end -RSpec.describe "bundle show", bundler: "3" do +RSpec.describe "bundle show", bundler: "4" do pending "shows a friendly error about the command removal" end diff --git a/spec/bundler/commands/update_spec.rb b/spec/bundler/commands/update_spec.rb index 0bcef7308d..b9c3cd46f9 100644 --- a/spec/bundler/commands/update_spec.rb +++ b/spec/bundler/commands/update_spec.rb @@ -1558,7 +1558,7 @@ RSpec.describe "bundle update --bundler" do G lockfile lockfile.sub(/(^\s*)#{Bundler::VERSION}($)/, "2.99.9") - bundle :update, bundler: true, verbose: true, preserve_ruby_flags: true, env: { "BUNDLER_3_MODE" => nil } + bundle :update, bundler: true, verbose: true, preserve_ruby_flags: true, env: { "BUNDLER_4_MODE" => nil } expect(out).to include("Updating bundler to 999.0.0") expect(out).to include("Running `bundle update --bundler \"> 0.a\" --verbose` with bundler 999.0.0") diff --git a/spec/bundler/commands/version_spec.rb b/spec/bundler/commands/version_spec.rb index 1dabd34ba1..e62c0baf8b 100644 --- a/spec/bundler/commands/version_spec.rb +++ b/spec/bundler/commands/version_spec.rb @@ -15,7 +15,7 @@ RSpec.describe "bundle version" do expect(out).to eq("Bundler version #{Bundler::VERSION}") end - it "outputs the version", bundler: "3" do + it "outputs the version", bundler: "4" do bundle "-v" expect(out).to eq(Bundler::VERSION) end @@ -27,7 +27,7 @@ RSpec.describe "bundle version" do expect(out).to eq("Bundler version #{Bundler::VERSION}") end - it "outputs the version", bundler: "3" do + it "outputs the version", bundler: "4" do bundle "--version" expect(out).to eq(Bundler::VERSION) end @@ -39,7 +39,7 @@ RSpec.describe "bundle version" do expect(out).to match(/\ABundler version #{Regexp.escape(Bundler::VERSION)} \(\d{4}-\d{2}-\d{2} commit #{COMMIT_HASH}\)\z/) end - it "outputs the version with build metadata", bundler: "3" do + it "outputs the version with build metadata", bundler: "4" do bundle "version" expect(out).to match(/\A#{Regexp.escape(Bundler::VERSION)} \(\d{4}-\d{2}-\d{2} commit #{COMMIT_HASH}\)\z/) end diff --git a/spec/bundler/install/gemfile/sources_spec.rb b/spec/bundler/install/gemfile/sources_spec.rb index 4d271f2a63..e705a835d6 100644 --- a/spec/bundler/install/gemfile/sources_spec.rb +++ b/spec/bundler/install/gemfile/sources_spec.rb @@ -88,7 +88,7 @@ RSpec.describe "bundle install with gems on multiple sources" do expect(out).not_to include("https://gem.repo3/quick/Marshal.4.8/") end - it "fails", bundler: "3" do + it "fails", bundler: "4" do bundle :install, artifice: "compact_index", raise_on_error: false expect(err).to include("Each source after the first must include a block") expect(exitstatus).to eq(4) @@ -115,7 +115,7 @@ RSpec.describe "bundle install with gems on multiple sources" do expect(the_bundle).to include_gems("myrack-obama 1.0.0", "myrack 1.0.0", source: "remote1") end - it "fails", bundler: "3" do + it "fails", bundler: "4" do bundle :install, artifice: "compact_index", raise_on_error: false expect(err).to include("Each source after the first must include a block") expect(exitstatus).to eq(4) @@ -450,7 +450,7 @@ RSpec.describe "bundle install with gems on multiple sources" do expect(lockfile).to eq(previous_lockfile) end - it "fails", bundler: "3" do + it "fails", bundler: "4" do bundle :install, artifice: "compact_index", raise_on_error: false expect(err).to include("Each source after the first must include a block") expect(exitstatus).to eq(4) @@ -490,7 +490,7 @@ RSpec.describe "bundle install with gems on multiple sources" do expect(the_bundle).to include_gems("depends_on_myrack 1.0.1", "myrack 1.0.0") end - it "fails", bundler: "3" do + it "fails", bundler: "4" do bundle :install, artifice: "compact_index", raise_on_error: false expect(err).to include("Each source after the first must include a block") expect(exitstatus).to eq(4) @@ -914,7 +914,7 @@ RSpec.describe "bundle install with gems on multiple sources" do expect(lockfile).to eq(initial_lockfile) end - it "fails when running bundle install in frozen mode", bundler: "3" do + it "fails when running bundle install in frozen mode", bundler: "4" do initial_lockfile = lockfile bundle "config set --local frozen true" @@ -1302,7 +1302,7 @@ RSpec.describe "bundle install with gems on multiple sources" do E end - it "refuses to install the existing lockfile and prints an error", bundler: "3" do + it "refuses to install the existing lockfile and prints an error", bundler: "4" do bundle "config set --local deployment true" bundle "install", artifice: "compact_index", raise_on_error: false @@ -1614,7 +1614,7 @@ RSpec.describe "bundle install with gems on multiple sources" do end end - context "when an indirect dependency is available from multiple ambiguous sources", bundler: "3" do + context "when an indirect dependency is available from multiple ambiguous sources", bundler: "4" do it "raises, suggesting a source block" do build_repo4 do build_gem "depends_on_myrack" do |s| diff --git a/spec/bundler/lock/lockfile_spec.rb b/spec/bundler/lock/lockfile_spec.rb index a23784ce5e..8e9ee7dc31 100644 --- a/spec/bundler/lock/lockfile_spec.rb +++ b/spec/bundler/lock/lockfile_spec.rb @@ -109,7 +109,7 @@ RSpec.describe "the lockfile format" do #{version} L - install_gemfile <<-G, verbose: true, preserve_ruby_flags: true, env: { "BUNDLER_3_MODE" => nil } + install_gemfile <<-G, verbose: true, preserve_ruby_flags: true, env: { "BUNDLER_4_MODE" => nil } source "https://gem.repo4" gem "myrack" diff --git a/spec/bundler/other/major_deprecation_spec.rb b/spec/bundler/other/major_deprecation_spec.rb index 501b87c03e..1d8c7bad80 100644 --- a/spec/bundler/other/major_deprecation_spec.rb +++ b/spec/bundler/other/major_deprecation_spec.rb @@ -24,7 +24,7 @@ RSpec.describe "major deprecations" do "(called at -e:1)" end - pending "is removed and shows a helpful error message about it", bundler: "3" + pending "is removed and shows a helpful error message about it", bundler: "4" end describe ".with_clean_env" do @@ -41,7 +41,7 @@ RSpec.describe "major deprecations" do ) end - pending "is removed and shows a helpful error message about it", bundler: "3" + pending "is removed and shows a helpful error message about it", bundler: "4" end describe ".clean_system" do @@ -58,7 +58,7 @@ RSpec.describe "major deprecations" do ) end - pending "is removed and shows a helpful error message about it", bundler: "3" + pending "is removed and shows a helpful error message about it", bundler: "4" end describe ".clean_exec" do @@ -75,7 +75,7 @@ RSpec.describe "major deprecations" do ) end - pending "is removed and shows a helpful error message about it", bundler: "3" + pending "is removed and shows a helpful error message about it", bundler: "4" end describe ".environment" do @@ -88,7 +88,7 @@ RSpec.describe "major deprecations" do expect(deprecations).to include "Bundler.environment has been removed in favor of Bundler.load (called at -e:1)" end - pending "is removed and shows a helpful error message about it", bundler: "3" + pending "is removed and shows a helpful error message about it", bundler: "4" end end @@ -101,7 +101,7 @@ RSpec.describe "major deprecations" do expect(deprecations).to include "The `--no-keep-file-descriptors` has been deprecated. `bundle exec` no longer mess with your file descriptors. Close them in the exec'd script if you need to" end - pending "is removed and shows a helpful error message about it", bundler: "3" + pending "is removed and shows a helpful error message about it", bundler: "4" end describe "bundle update --quiet" do @@ -130,7 +130,7 @@ RSpec.describe "major deprecations" do ) end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end context "bundle check --path=" do @@ -152,7 +152,7 @@ RSpec.describe "major deprecations" do ) end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end context "bundle cache --all" do @@ -174,7 +174,7 @@ RSpec.describe "major deprecations" do ) end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end context "bundle cache --path" do @@ -196,7 +196,7 @@ RSpec.describe "major deprecations" do ) end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end describe "bundle config" do @@ -205,11 +205,11 @@ RSpec.describe "major deprecations" do bundle "config" end - it "warns", bundler: "3" do + it "warns", bundler: "4" do expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config list` instead.") end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end describe "old get interface" do @@ -217,11 +217,11 @@ RSpec.describe "major deprecations" do bundle "config waka" end - it "warns", bundler: "3" do + it "warns", bundler: "4" do expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config get waka` instead.") end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end describe "old set interface" do @@ -229,11 +229,11 @@ RSpec.describe "major deprecations" do bundle "config waka wakapun" end - it "warns", bundler: "3" do + it "warns", bundler: "4" do expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config set waka wakapun` instead.") end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end describe "old set interface with --local" do @@ -241,11 +241,11 @@ RSpec.describe "major deprecations" do bundle "config --local waka wakapun" end - it "warns", bundler: "3" do + it "warns", bundler: "4" do expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config set --local waka wakapun` instead.") end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end describe "old set interface with --global" do @@ -253,11 +253,11 @@ RSpec.describe "major deprecations" do bundle "config --global waka wakapun" end - it "warns", bundler: "3" do + it "warns", bundler: "4" do expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config set --global waka wakapun` instead.") end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end describe "old unset interface" do @@ -265,11 +265,11 @@ RSpec.describe "major deprecations" do bundle "config --delete waka" end - it "warns", bundler: "3" do + it "warns", bundler: "4" do expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config unset waka` instead.") end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end describe "old unset interface with --local" do @@ -277,11 +277,11 @@ RSpec.describe "major deprecations" do bundle "config --delete --local waka" end - it "warns", bundler: "3" do + it "warns", bundler: "4" do expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config unset --local waka` instead.") end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end describe "old unset interface with --global" do @@ -289,11 +289,11 @@ RSpec.describe "major deprecations" do bundle "config --delete --global waka" end - it "warns", bundler: "3" do + it "warns", bundler: "4" do expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config unset --global waka` instead.") end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end end @@ -305,12 +305,12 @@ RSpec.describe "major deprecations" do G end - it "warns when no options are given", bundler: "3" do + it "warns when no options are given", bundler: "4" do bundle "update" expect(deprecations).to include("Pass --all to `bundle update` to update everything") end - pending "fails with a helpful error when no options are given", bundler: "3" + pending "fails with a helpful error when no options are given", bundler: "4" it "does not warn when --all is passed" do bundle "update --all" @@ -330,7 +330,7 @@ RSpec.describe "major deprecations" do expect(deprecations).to include("The --binstubs option will be removed in favor of `bundle binstubs --all`") end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end context "bundle install with both gems.rb and Gemfile present" do @@ -399,7 +399,7 @@ RSpec.describe "major deprecations" do ) end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end end end @@ -449,7 +449,7 @@ RSpec.describe "major deprecations" do ) end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end context "bundle install in frozen mode with a lockfile with a single rubygems section with multiple remotes" do @@ -491,7 +491,7 @@ RSpec.describe "major deprecations" do expect(deprecations).to include("Your lockfile contains a single rubygems source section with multiple remotes, which is insecure. Make sure you run `bundle install` in non frozen mode and commit the result to make your lockfile secure.") end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end context "when Bundler.setup is run in a ruby script" do @@ -531,7 +531,7 @@ RSpec.describe "major deprecations" do "capistrano-bundler gem. Use it instead.") end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end context "bundle show" do @@ -551,7 +551,7 @@ RSpec.describe "major deprecations" do expect(deprecations).to include("the `--outdated` flag to `bundle show` was undocumented and will be removed without replacement") end - pending "fails with a helpful message", bundler: "3" + pending "fails with a helpful message", bundler: "4" end end @@ -570,7 +570,7 @@ RSpec.describe "major deprecations" do expect(err).to include "[DEPRECATED] The `--install` flag has been deprecated. `bundle install` is triggered by default." end - pending "fails with a helpful message", bundler: "3" + pending "fails with a helpful message", bundler: "4" end end @@ -585,7 +585,7 @@ RSpec.describe "major deprecations" do expect(deprecations).to include "The `viz` command has been renamed to `graph` and moved to a plugin. See https://github.com/rubygems/bundler-graph" end - pending "fails with a helpful message", bundler: "3" + pending "fails with a helpful message", bundler: "4" end context "bundle plugin install --local_git" do @@ -602,7 +602,7 @@ RSpec.describe "major deprecations" do expect(deprecations).to include "--local_git is deprecated, use --git" end - pending "fails with a helpful message", bundler: "3" + pending "fails with a helpful message", bundler: "4" end describe "deprecating rubocop" do diff --git a/spec/bundler/realworld/slow_perf_spec.rb b/spec/bundler/realworld/slow_perf_spec.rb index 32e266ff1b..d9d1aef81c 100644 --- a/spec/bundler/realworld/slow_perf_spec.rb +++ b/spec/bundler/realworld/slow_perf_spec.rb @@ -131,7 +131,7 @@ RSpec.describe "bundle install with complex dependencies", realworld: true do end G - if Bundler.feature_flag.bundler_3_mode? + if Bundler.feature_flag.bundler_4_mode? bundle "lock", env: { "DEBUG_RESOLVER" => "1" }, raise_on_error: false expect(out).to include("backtracking").exactly(26).times diff --git a/spec/bundler/runtime/self_management_spec.rb b/spec/bundler/runtime/self_management_spec.rb index bebaf4e781..4b2ac2afc3 100644 --- a/spec/bundler/runtime/self_management_spec.rb +++ b/spec/bundler/runtime/self_management_spec.rb @@ -27,7 +27,7 @@ RSpec.describe "Self management" do pristine_system_gems "bundler-#{current_version}" - with_env_vars("BUNDLER_3_MODE" => nil, &example) + with_env_vars("BUNDLER_4_MODE" => nil, &example) end it "installs locked version when using system path and uses it" do diff --git a/spec/bundler/runtime/setup_spec.rb b/spec/bundler/runtime/setup_spec.rb index 26131e7438..cbb31f7350 100644 --- a/spec/bundler/runtime/setup_spec.rb +++ b/spec/bundler/runtime/setup_spec.rb @@ -1539,7 +1539,7 @@ end expect(out).to eq("myrack-1.0.0") end - it "keeps Kernel#gem private", bundler: "3" do + it "keeps Kernel#gem private", bundler: "4" do install_gemfile <<-G source "https://gem.repo1" gem "myrack" diff --git a/spec/bundler/support/checksums.rb b/spec/bundler/support/checksums.rb index f3aa13ca9f..8e0dea4a71 100644 --- a/spec/bundler/support/checksums.rb +++ b/spec/bundler/support/checksums.rb @@ -58,7 +58,7 @@ module Spec begin enabled = (target_lockfile || lockfile).match?(/^CHECKSUMS$/) rescue Errno::ENOENT - enabled = Bundler.feature_flag.bundler_3_mode? + enabled = Bundler.feature_flag.bundler_4_mode? end checksums_section(enabled, &block) end diff --git a/test/-ext-/gvl/test_last_thread.rb b/test/-ext-/gvl/test_last_thread.rb index f1bebafeea..f63d98aab1 100644 --- a/test/-ext-/gvl/test_last_thread.rb +++ b/test/-ext-/gvl/test_last_thread.rb @@ -15,8 +15,7 @@ class TestLastThread < Test::Unit::TestCase t1 = Time.now t = t1 - t0 - assert_in_delta(1.0, t, 0.16) + assert_in_delta(1.0, t, 0.18) end; end end - diff --git a/test/ruby/test_zjit.rb b/test/ruby/test_zjit.rb index e10e9a8742..6e0f274c30 100644 --- a/test/ruby/test_zjit.rb +++ b/test/ruby/test_zjit.rb @@ -714,6 +714,16 @@ class TestZJIT < Test::Unit::TestCase end end + def test_dupn + assert_compiles '[[1], [1, 1], :rhs, [nil, :rhs]]', <<~RUBY, insns: [:dupn] + def test(array) = (array[1, 2] ||= :rhs) + + one = [1, 1] + start_empty = [] + [test(one), one, test(start_empty), start_empty] + RUBY + end + def test_send_backtrace backtrace = [ "-e:2:in 'Object#jit_frame1'", diff --git a/tool/lib/envutil.rb b/tool/lib/envutil.rb index 573fd5122c..101ea350c6 100644 --- a/tool/lib/envutil.rb +++ b/tool/lib/envutil.rb @@ -98,7 +98,7 @@ module EnvUtil def start(pid, *args) end def dump(pid, timeout: 60, reprieve: timeout&.div(4)) - dpid = start(pid, *command_file(File.join(__dir__, "dump.#{name}"))) + dpid = start(pid, *command_file(File.join(__dir__, "dump.#{name}")), out: :err) rescue Errno::ENOENT return else @@ -121,8 +121,8 @@ module EnvUtil register("gdb") do class << self def usable?; system(*%w[gdb --batch --quiet --nx -ex exit]); end - def start(pid, *args) - spawn(*%w[gdb --batch --quiet --pid #{pid}], *args) + def start(pid, *args, **opts) + spawn(*%W[gdb --batch --quiet --pid #{pid}], *args, **opts) end def command_file(file) "--command=#{file}"; end end @@ -131,8 +131,8 @@ module EnvUtil register("lldb") do class << self def usable?; system(*%w[lldb -Q --no-lldbinit -o exit]); end - def start(pid, *args) - spawn(*%w[lldb --batch -Q --attach-pid #{pid}]) + def start(pid, *args, **opts) + spawn(*%W[lldb --batch -Q --attach-pid #{pid}], *args, **opts) end def command_file(file) ["--source", file]; end end diff --git a/variable.c b/variable.c index e535aefe27..a2012823cd 100644 --- a/variable.c +++ b/variable.c @@ -4726,7 +4726,12 @@ class_fields_ivar_set(VALUE klass, VALUE fields_obj, ID id, VALUE val, bool conc // so that we're embedded as long as possible. fields_obj = rb_imemo_fields_new(rb_singleton_class(klass), next_capacity); if (original_fields_obj) { - MEMCPY(rb_imemo_fields_ptr(fields_obj), rb_imemo_fields_ptr(original_fields_obj), VALUE, RSHAPE_LEN(current_shape_id)); + VALUE *fields = rb_imemo_fields_ptr(fields_obj); + attr_index_t fields_count = RSHAPE_LEN(current_shape_id); + MEMCPY(fields, rb_imemo_fields_ptr(original_fields_obj), VALUE, fields_count); + for (attr_index_t i = 0; i < fields_count; i++) { + RB_OBJ_WRITTEN(fields_obj, Qundef, fields[i]); + } } } diff --git a/zjit/src/hir.rs b/zjit/src/hir.rs index 276e14a639..2be6031805 100644 --- a/zjit/src/hir.rs +++ b/zjit/src/hir.rs @@ -2405,6 +2405,14 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result<Function, ParseError> { } YARVINSN_pop => { state.stack_pop()?; } YARVINSN_dup => { state.stack_push(state.stack_top()?); } + YARVINSN_dupn => { + // Duplicate the top N element of the stack. As we push, n-1 naturally + // points higher in the original stack. + let n = get_arg(pc, 0).as_usize(); + for _ in 0..n { + state.stack_push(state.stack_topn(n-1)?); + } + } YARVINSN_swap => { let right = state.stack_pop()?; let left = state.stack_pop()?; @@ -2622,6 +2630,16 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result<Function, ParseError> { let val = state.stack_pop()?; fun.push_insn(block, Insn::SetIvar { self_val: self_param, id, val, state: exit_id }); } + YARVINSN_opt_reverse => { + // Reverse the order of the top N stack items. + let n = get_arg(pc, 0).as_usize(); + for i in 0..n/2 { + let bottom = state.stack_topn(n - 1 - i)?; + let top = state.stack_topn(i)?; + state.stack_setn(i, bottom); + state.stack_setn(n - 1 - i, top); + } + } YARVINSN_newrange => { let flag = RangeType::from(get_arg(pc, 0).as_u32()); let high = state.stack_pop()?; @@ -4210,6 +4228,47 @@ mod tests { } #[test] + fn opt_reverse() { + eval(" + def reverse_odd + a, b, c = @a, @b, @c + [a, b, c] + end + + def reverse_even + a, b, c, d = @a, @b, @c, @d + [a, b, c, d] + end + "); + assert_method_hir_with_opcode("reverse_odd", YARVINSN_opt_reverse, expect![[r#" + fn reverse_odd: + bb0(v0:BasicObject): + v1:NilClassExact = Const Value(nil) + v2:NilClassExact = Const Value(nil) + v3:NilClassExact = Const Value(nil) + v6:BasicObject = GetIvar v0, :@a + v8:BasicObject = GetIvar v0, :@b + v10:BasicObject = GetIvar v0, :@c + v12:ArrayExact = NewArray v6, v8, v10 + Return v12 + "#]]); + assert_method_hir_with_opcode("reverse_even", YARVINSN_opt_reverse, expect![[r#" + fn reverse_even: + bb0(v0:BasicObject): + v1:NilClassExact = Const Value(nil) + v2:NilClassExact = Const Value(nil) + v3:NilClassExact = Const Value(nil) + v4:NilClassExact = Const Value(nil) + v7:BasicObject = GetIvar v0, :@a + v9:BasicObject = GetIvar v0, :@b + v11:BasicObject = GetIvar v0, :@c + v13:BasicObject = GetIvar v0, :@d + v15:ArrayExact = NewArray v7, v9, v11, v13 + Return v15 + "#]]); + } + + #[test] fn test_branchnil() { eval(" def test(x) = x&.itself @@ -4263,6 +4322,28 @@ mod tests { Return v8 "#]]); } + + #[test] + fn dupn() { + eval(" + def test(x) = (x[0, 1] ||= 2) + "); + assert_method_hir_with_opcode("test", YARVINSN_dupn, expect![[r#" + fn test: + bb0(v0:BasicObject, v1:BasicObject): + v3:NilClassExact = Const Value(nil) + v4:Fixnum[0] = Const Value(0) + v5:Fixnum[1] = Const Value(1) + v7:BasicObject = SendWithoutBlock v1, :[], v4, v5 + v8:CBool = Test v7 + IfTrue v8, bb1(v0, v1, v3, v1, v4, v5, v7) + v10:Fixnum[2] = Const Value(2) + v12:BasicObject = SendWithoutBlock v1, :[]=, v4, v5, v10 + Return v10 + bb1(v14:BasicObject, v15:BasicObject, v16:NilClassExact, v17:BasicObject, v18:Fixnum[0], v19:Fixnum[1], v20:BasicObject): + Return v20 + "#]]); + } } #[cfg(test)] |