Skip to content

Commit 5b51d0f

Browse files
maximecbjemmaissroffdependabot[bot]BurdetteLamarpeterzhu2118
authored
Rebase yjit_backend_ir branch on ruby/master (#358)
* Change ROBJECT_TRANSIENT_FLAG to use FL_USER2 * [rubygems/rubygems] Bump rb-sys Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.20 to 0.9.26. - [Release notes](https://github.com/oxidize-rb/rb-sys/releases) - [Commits](oxidize-rb/rb-sys@v0.9.20...v0.9.26) --- updated-dependencies: - dependency-name: rb-sys dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> ruby/rubygems@fe76234cf1 * For rdoc, copy doc/rdoc to doc/ (ruby#6181) * Fix sync_default_gems.rb to use absolute path * Sync RDoc * * append newline at EOF. [ci skip] * [ruby/rdoc] Move section Directives into section Blocks (ruby/rdoc#901) ruby/rdoc@e48e07ef53 * Fix `rb_profile_frames` output includes dummy main thread frame The `rb_profile_frames` API did not skip the two dummy frames that each thread has at its beginning. This was unlike `backtrace_each` and `rb_ec_parcial_backtrace_object`, which do skip them. This does not seem to be a problem for non-main thread frames, because both `VM_FRAME_RUBYFRAME_P(cfp)` and `rb_vm_frame_method_entry(cfp)` are NULL for them. BUT, on the main thread `VM_FRAME_RUBYFRAME_P(cfp)` was true and thus the dummy thread was still included in the output of `rb_profile_frames`. I've now made `rb_profile_frames` skip this extra frame (like `backtrace_each` and friends), as well as add a test that asserts the size and contents of `rb_profile_frames`. Fixes [Bug #18907] (<https://bugs.ruby-lang.org/issues/18907>) * 8fa6646 is broken with rubygems/rubygems and flori/json. Revert "Fix sync_default_gems.rb to use absolute path" This reverts commit 8fa6646. * Merge rubygems/bundler HEAD Merge from ruby/rubygems@2af2520 * Cheaply derive code range for String#b return value The result of String#b is a string with an ASCII_8BIT/BINARY encoding. That encoding is ASCII-compatible and has no byte sequences that are invalid for the encoding. If we know the receiver's code range, we can derive the resulting string's code range without needing to perform a full code range scan. * Adjust indent [ci skip] * Try the tag without "v" prefix to checkout upstream repositories * Remove ary_discard ary_discard should not be used as it should be handled by the GC. The only user of ary_discard is rb_ary_product, which doesn't neeed to use ary_discard. * Rename rb_ary_tmp_new to rb_ary_hidden_new rb_ary_tmp_new suggests that the array is temporary in some way, but that's not true, it just creates an array that's hidden and not on the transient heap. This commit renames it to rb_ary_hidden_new. * Use rb_ary_hidden_new for rb_ary_hidden_new_fill * [rubygems/rubygems] Use main as default branch for Bundler specs ruby/rubygems@482077d185 * * 2022-07-27 [ci skip] * Add doc/rdoc directory to .document Adding the doc/rdoc directory to .document will allow files in that directory to be included in the documentation. * Refactored poisoning and unpoisoning freelist to simpler API * * expand tabs. [ci skip] Tabs were expanded because the file did not have any tab indentation in unedited lines. Please update your editor config, and use misc/expand_tabs.rb in the pre-commit hook. * [rubygems/rubygems] Completely drop base parameter from index This parameter was coupling the concept of lockfile with the index. I don't think it's necessary. Also I believe it's causing some flaky test failures, which might leak into realworld issues. They are like this: ```` Invoking `/opt/hostedtoolcache/Ruby/3.0.4/x64/bin/ruby -I/home/runner/work/rubygems/rubygems/bundler/spec -r/home/runner/work/rubygems/rubygems/bundler/spec/support/artifice/fail.rb -r/home/runner/work/rubygems/rubygems/bundler/spec/support/hax.rb /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/bin/bundle lock` failed with output: ---------------------------------------------------------------------- --- ERROR REPORT TEMPLATE ------------------------------------------------------- ``` NoMethodError: undefined method `identifier' for #<Gem::Specification:0x00005639ad0db0a0 @extension_dir=nil, @full_gem_path=nil, @gem_dir=nil, @ignored=nil, @bin_dir=nil, @cache_dir=nil, @cache_file=nil, @doc_dir=nil, @ri_dir=nil, @spec_dir=nil, @spec_file=nil, @gems_dir=nil, @base_dir=nil, @loaded=false, @activated=false, @loaded_from=nil, @original_platform="ruby", @installed_by_version=nil, @autorequire=nil, @Date=2022-07-25 00:00:00 UTC, @description="This is a completely fake gem, for testing purposes.", @email="[email protected]", @homepage="http://example.com", @name="win32-process", @post_install_message=nil, @signing_key=nil, @summary="This is just a fake gem for testing", @Version=#<Gem::Version "0.8.3">, @authors=["no one"], @bindir="bin", @cert_chain=[], @Dependencies=[<Gem::Dependency type=:runtime name="ffi" requirements=">= 1.0.0">], @executables=[], @extensions=[], @extra_rdoc_files=[], @files=[], @licenses=[], @metadata={}, @platform="ruby", @rdoc_options=[], @require_paths=["lib"], @required_ruby_version=#<Gem::Requirement:0x00005639ad0dbc80 @requirements=[[">=", #<Gem::Version "0">]]>, @required_rubygems_version=#<Gem::Requirement:0x00005639ad0dba50 @requirements=[[">=", #<Gem::Version "0">]]>, @requirements=[], @rubygems_version="3.2.33", @specification_version=4, @test_files=[], @new_platform="ruby", @full_name="win32-process-0.8.3", @has_rdoc=true, @license=["MIT"] win32-process-0.8.3> /home/runner/work/rubygems/rubygems/bundler/tmp/rubygems/lib/rubygems/specification.rb:2116:in `method_missing' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/remote_specification.rb:115:in `method_missing' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/lazy_specification.rb:34:in `eql?' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/index.rb:189:in `eql?' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/index.rb:189:in `search_by_dependency' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/index.rb:96:in `local_search' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/index.rb:64:in `unsorted_search' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/index.rb:60:in `search' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/resolver.rb:179:in `results_for' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/resolver.rb:113:in `search_for' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/resolver.rb:216:in `block in sort_dependencies' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/resolver.rb:207:in `each' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/resolver.rb:207:in `sort_by' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/resolver.rb:207:in `sort_dependencies' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb:60:in `block in sort_dependencies' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb:77:in `with_no_such_dependency_error_handling' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb:59:in `sort_dependencies' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb:754:in `push_state_for_requirements' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb:744:in `require_nested_dependencies_for' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb:727:in `activate_new_spec' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb:684:in `attempt_to_activate' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb:254:in `process_topmost_state' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb:182:in `resolve' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb:43:in `resolve' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/resolver.rb:50:in `start' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/resolver.rb:24:in `resolve' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/definition.rb:480:in `reresolve' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/definition.rb:283:in `resolve' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/definition.rb:181:in `resolve_remotely!' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/cli/lock.rb:53:in `run' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/cli.rb:674:in `lock' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/cli.rb:31:in `dispatch' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/cli.rb:25:in `start' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/exe/bundle:48:in `block in <top (required)>' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/friendly_errors.rb:120:in `with_friendly_errors' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/exe/bundle:36:in `<top (required)>' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/bin/bundle:23:in `load' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/bin/bundle:23:in `<main>' ``` ```` I think the issue is that now we eagerly materialize some base specifications before resolving in order to give better errors if user specified an incorrect source in the Gemfile. This means that the key for the index hash will have heterogeneous specification objects (some LazySpecification, some real Specification), and `LazySpecification#eql?` is incompatible with that. By dropping the base parameter from the index, we should no longer have these heterogenous objects as hash keys. ruby/rubygems@dc179d41c3 * [rubygems/rubygems] Don't use Pathname for creating extension dir Not sure why, but I run into the following flaky test failure ```` (...) Invoking `/Users/deivid/.asdf/installs/ruby/3.1.2/bin/ruby -I/Users/deivid/Code/rubygems/rubygems/bundler/spec -r/Users/deivid/Code/rubygems/rubygems/bundler/spec/support/artifice/fail.rb -r/Users/deivid/Code/rubygems/rubygems/bundler/spec/support/hax.rb /Users/deivid/Code/rubygems/rubygems/bundler/tmp/4/gems/system/bin/bundle install` failed with output: ---------------------------------------------------------------------- --- ERROR REPORT TEMPLATE ------------------------------------------------------- ``` NameError: constant Pathname::FileUtils not defined FileUtils.mkpath(@path, mode: mode) ^^^^^^^^^ /Users/deivid/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/pathname.rb:585:in `mkpath' /Users/deivid/Code/rubygems/rubygems/bundler/tmp/4/gems/system/gems/bundler-2.4.0.dev/lib/bundler/shared_helpers.rb:103:in `filesystem_access' /Users/deivid/Code/rubygems/rubygems/bundler/tmp/4/gems/system/gems/bundler-2.4.0.dev/lib/bundler/rubygems_gem_installer.rb:78:in `build_extensions' /Users/deivid/Code/rubygems/rubygems/bundler/tmp/4/gems/system/gems/bundler-2.4.0.dev/lib/bundler/rubygems_gem_installer.rb:28:in `install' /Users/deivid/Code/rubygems/rubygems/bundler/tmp/4/gems/system/gems/bundler-2.4.0.dev/lib/bundler/source/rubygems.rb:207:in `install' /Users/deivid/Code/rubygems/rubygems/bundler/tmp/4/gems/system/gems/bundler-2.4.0.dev/lib/bundler/installer/gem_installer.rb:54:in `install' /Users/deivid/Code/rubygems/rubygems/bundler/tmp/4/gems/system/gems/bundler-2.4.0.dev/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec' /Users/deivid/Code/rubygems/rubygems/bundler/tmp/4/gems/system/gems/bundler-2.4.0.dev/lib/bundler/installer/parallel_installer.rb:186:in `do_install' /Users/deivid/Code/rubygems/rubygems/bundler/tmp/4/gems/system/gems/bundler-2.4.0.dev/lib/bundler/installer/parallel_installer.rb:177:in `block in worker_pool' /Users/deivid/Code/rubygems/rubygems/bundler/tmp/4/gems/system/gems/bundler-2.4.0.dev/lib/bundler/worker.rb:62:in `apply_func' /Users/deivid/Code/rubygems/rubygems/bundler/tmp/4/gems/system/gems/bundler-2.4.0.dev/lib/bundler/worker.rb:57:in `block in process_queue' /Users/deivid/Code/rubygems/rubygems/bundler/tmp/4/gems/system/gems/bundler-2.4.0.dev/lib/bundler/worker.rb:54:in `loop' /Users/deivid/Code/rubygems/rubygems/bundler/tmp/4/gems/system/gems/bundler-2.4.0.dev/lib/bundler/worker.rb:54:in `process_queue' /Users/deivid/Code/rubygems/rubygems/bundler/tmp/4/gems/system/gems/bundler-2.4.0.dev/lib/bundler/worker.rb:91:in `block (2 levels) in create_threads' (...) ``` Whatever it was, this small change should fix it. ruby/rubygems@71d7503ce4 * [ruby/rdoc] [DOC] Clarifications for directives (ruby/rdoc#903) - Former section "Directives in Trailing Comments" is reworked. The important thing about a directive is what it does, not whether it's trailing or stand-alone. Therefore I've worked the directives in the former section into the appropriate sections, based on function. - Each directive is now explicitly marked as trailing or stand-alone. - C-code directives are mentioned only for those directives that actually appear in our ruby/ruby C files, which are :startdoc:, :stopdoc:, :enddoc:, :include:, and :call-seq:. What effect, if any, other directives have in C, I'm not sure about. ruby/rdoc@b00978bfa5 * [rubygems/rubygems] Add ignore_funding_requests config flag ruby/rubygems@ab302f72c9 * Manually sync with ruby/date#64 * Do not load library files from repository only for test What we want to test should be the bundled and to be installed files, but not the upstream. * Make indents and newlines consistent [ci skip] * Append semicolons [ci skip] * Adjust styles [ci skip] * [ruby/pathname] Fix `autoload` of `FileUtils` Should not be `Pathname::FileUtils`. ruby/pathname@d1eb366e73 * [ci-skip]Document how to run an individual bootstrap test * Update to ruby/mspec@290e36a * Update to ruby/spec@cbfaf51 * * 2022-07-28 [ci skip] * Fix documentation for ARGF.inplace_mode{,=} The value affects the name of the backup file created, not the name of the file modified (as the file is modified in place). Fixes [Bug #18920] * [DOC] Cross references for `ARGF` * Suppress use-after-free warning by gcc-12 * Try reproducing the MinGW hang on time command (ruby#6168) to see if it really exits correctly. GitHub Support asked me to confirm the command is exiting correctly. * `RUBY_DEBUG_LOG2` should filter against the given `file` * Also skip the failing test similar with a343952 * test_io_console.rbL399 is also randomly failing same as bfc697f * Fix the missing brackets * Skip randomly failing tests with FreeBSD 12 * Refactor gc_ref_update_array * Make array slices views rather than copies Before this commit, if the slice fits in VWA, it would make a copy rather than a view. This is slower as it requires a memcpy of the contents. * Lock the VM for rb_gc_writebarrier_unprotect When using Ractors, rb_gc_writebarrier_unprotect requries a VM lock since it modifies the bitmaps. * Fix format specifier for `rb_ractor_id()` * Fix conversion of `rb_ractor_id()` * Fix format-pedantic warnings * [ruby/rdoc] [DOC] Add some links in intro; delimit rendered HTML output. (ruby/rdoc#904) ruby/rdoc@c02645364f * YJIT: Teach getblockparamproxy to handle the no-block case without exiting (ruby#6191) Teach getblockparamproxy to handle the no-block case without exiting Co-authored-by: John Hawthorn <[email protected]> Co-authored-by: John Hawthorn <[email protected]> * * 2022-07-29 [ci skip] * [ruby/rdoc] Link from RDoc::Markup to RDoc::MarkupReference (ruby/rdoc#906) Recently new RDoc::MarkupReference replaces Markup Reference in RDoc::Markup (which was always the goal). ruby/rdoc@825be7eaf4 * [ruby/date] [DOC] Enhanced RDoc for <=> (ruby/date#65) ruby/date@0cdbaa92e9 * Revert "Try reproducing the MinGW hang on time command (ruby#6168)" This reverts commit bee5089. Looking at https://github.com/ruby/ruby/runs/7564065637?check_suite_focus=true, we concluded that the ruby process for test-all is stuck before exit when this issue reproduces. However, because of our limited bandwidth to support MinGW, we're not investigating this, and therefore we need to keep skipping tests that hang on this environment. * [ruby/rdoc] Fix formatting blockquote in verbatim Reported at ruby/rdoc#907 (comment) ruby/rdoc@86384ac7f9 * Merge rubygems master from ruby/rubygems@446cc57 * [rubygems/rubygems] Add package/pack aliases to man pages for cache Signed-off-by: Takuya Noguchi <[email protected]> ruby/rubygems@1685e3a9dc * [rubygems/rubygems] Fix dead links to deprecated bundle-package(1) with bundler-cache(1) Signed-off-by: Takuya Noguchi <[email protected]> ruby/rubygems@9c2e80a10f * Merge ruby/fileutils from ruby/fileutils@332025b * [ruby/optparse] Also accept '-' as an optional argument (ruby/optparse#35) ruby/optparse@f2b8318631 * fix typo in Time#xmlschema documentation * [flori/json] Stop including the parser source __LINE__ in exceptions It makes testing for JSON errors very tedious. You either have to use a Regexp or to regularly update all your assertions when JSON is upgraded. ruby/json@de9eb1d28e * [flori/json] test parsing of unicode, mixing literal characters with escaped ruby/json@82fe866da2 * Update parser-text.rb with ruby/racc@4ecc13c * Keep gitignore for libyaml source with psych * [ruby/rdoc] Add block quotes (ruby/rdoc#907) Also adjusts which blocks may be nested. ruby/rdoc@dde1860441 * [rubygems/rubygems] No need to set anything at all unless standalone is given ruby/rubygems@d695c8da3e * [rubygems/rubygems] Make `--standalone` play nice with `--local` I'm not sure if using relative paths in the generated script is best for this case, since it makes the script not movable, but that can be improved later. ruby/rubygems@7f5bdbb842 * * 2022-07-30 [ci skip] * [ruby/date] [DOC] Enhanced RDoc (ruby/date#66) Treats: #=== #to_s #inspect #strftme #asctime #iso3601 #rfc3339 #rfc2822 #httpdate #jisx0301 ruby/date@aed66fedf6 * Add --enable-yjit=stats configure option * Add --enable-yjit=dev_nodebug configure option * [ruby/rdoc] Fix blockquote with word in verbatim ruby/rdoc@75eee668a5 * [ruby/digest] Revert tab-expansion in external files ruby/digest@5ca2b5b91e * * expand tabs. [ci skip] Tabs were expanded because the file did not have any tab indentation in unedited lines. Please update your editor config, and use misc/expand_tabs.rb in the pre-commit hook. * Revert "* expand tabs. [ci skip]" This reverts commit 8a65cf3. * Update .git-blame-ignore-revs [ci skip] * [ruby/io-nonblock] Revert tab expansion * Update .git-blame-ignore-revs [ci skip] * * expand tabs. [ci skip] Tabs were expanded because the file did not have any tab indentation in unedited lines. Please update your editor config, and use misc/expand_tabs.rb in the pre-commit hook. * Revert "* expand tabs. [ci skip]" This reverts commit 0d842fe. * Update .git-blame-ignore-revs [ci skip] * Implement Enumerator::Product and Enumerator.product [Feature #18685] * Mention Enumerator.product/Enumerator::Product in the NEWS.md * [ruby/date] Enhanced RDoc (ruby/date#67) Treats: ::httpdate #to_date #to_time #to_datetime In behalf of ::httpdate, I've introduced section "Argument limit" that can be pointed to by various Date methods (similar to existing section "Argument start"). This will involve 8 already-enhanced methods plus 8 more not yet done. ruby/date@00326ff99c * * 2022-07-31 [ci skip] * [rubygems/rubygems] Update bundle-platform(1) man Signed-off-by: Takuya Noguchi <[email protected]> ruby/rubygems@1c3736f5af * * 2022-08-01 [ci skip] * Initialize node_id In some causes node_id might have been left uninitialized leading to undefined behavior on access. So always set it to -1, so we have *some* valid value in there. * Fix a link [ci skip] * respect current frame of `rb_eval_string` `self` is nearest Ruby method's `self`. If there is no ruby frame, use toplevel `self` (`main`). https://bugs.ruby-lang.org/issues/18780 * [rubygems/rubygems] Fix comment incorrectly copied from another spec ruby/rubygems@9be5eae9cf * [rubygems/rubygems] Fix crash when running `bundle outdated` in debug mode Previously it would crash like this: ```` $ /Users/deivid/.asdf/installs/ruby/3.1.2/bin/ruby -I/Users/deivid/Code/rubygems/rubygems/bundler/spec -r/Users/deivid/Code/rubygems/rubygems/bundler/spec/support/artifice/fail.rb -r/Users/deivid/Code/rubygems/rubygems/bundler/spec/support/hax.rb /Users/deivid/Code/rubygems/rubygems/bundler/tmp/1/gems/system/bin/bundle outdated --patch --strict --filter-patch Running `bundle outdated --filter-patch --patch --strict` with bundler 2.4.0.dev Found changes from the lockfile, re-resolving dependencies because bundler is unlocking Using a local server, bundler won't use the CompactIndex API Fetching source index from file:///Users/deivid/Code/rubygems/rubygems/bundler/tmp/1/gems/remote4/ Resolving dependencies... --- ERROR REPORT TEMPLATE ------------------------------------------------------- ``` RuntimeError: LazySpecification has not been materialized yet (calling :loaded_from []) /Users/deivid/Code/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/lazy_specification.rb:147:in `method_missing' /Users/deivid/Code/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/cli/outdated.rb:214:in `gem_column_for' /Users/deivid/Code/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/cli/outdated.rb:174:in `block in print_gems_table' /Users/deivid/Code/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/cli/outdated.rb:173:in `map' /Users/deivid/Code/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/cli/outdated.rb:173:in `print_gems_table' /Users/deivid/Code/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/cli/outdated.rb:123:in `run' /Users/deivid/Code/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/cli.rb:420:in `outdated' /Users/deivid/Code/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run' /Users/deivid/Code/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command' /Users/deivid/Code/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch' /Users/deivid/Code/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/cli.rb:31:in `dispatch' /Users/deivid/Code/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start' /Users/deivid/Code/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/cli.rb:25:in `start' /Users/deivid/Code/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/exe/bundle:48:in `block in <top (required)>' /Users/deivid/Code/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/friendly_errors.rb:120:in `with_friendly_errors' /Users/deivid/Code/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/exe/bundle:36:in `<top (required)>' /Users/deivid/Code/rubygems/rubygems/bundler/tmp/1/gems/system/bin/bundle:25:in `load' /Users/deivid/Code/rubygems/rubygems/bundler/tmp/1/gems/system/bin/bundle:25:in `<main>' ``` ```` ruby/rubygems@23c46f3b57 * [rubygems/rubygems] Bump rb-sys Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.26 to 0.9.28. - [Release notes](https://github.com/oxidize-rb/rb-sys/releases) - [Commits](oxidize-rb/rb-sys@v0.9.26...v0.9.28) --- updated-dependencies: - dependency-name: rb-sys dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> ruby/rubygems@831a001697 * * 2022-08-02 [ci skip] * [rubygems/rubygems] Bump rb-sys in /test/rubygems/test_gem_ext_cargo_builder/custom_name Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.26 to 0.9.28. - [Release notes](https://github.com/oxidize-rb/rb-sys/releases) - [Commits](oxidize-rb/rb-sys@v0.9.26...v0.9.28) --- updated-dependencies: - dependency-name: rb-sys dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> ruby/rubygems@edea8fbfa0 * [rubygems/rubygems] Move some logic to `LazySpecification#__materialize__` ruby/rubygems@5e100df7c9 * [rubygems/rubygems] Remove unnecessary special case for Bundler ruby/rubygems@2777e79b8e * [rubygems/rubygems] Fix incorrect force_ruby_platform propagation It was just working by chance. (cherry picked from commit ruby/rubygems@16b2d6bfe893) ruby/rubygems@8f922d980f * [rubygems/rubygems] Refactor materialization conditions ruby/rubygems@08e1554fb6 * [rubygems/rubygems] This should go through the standard source search logic ruby/rubygems@087e3e4e3b * [rubygems/rubygems] Only need to filter platforms when materialization is not strict ruby/rubygems@9d878cbda0 * [rubygems/rubygems] Prefer reverse+find to select+last ruby/rubygems@ffb161bb69 * [rubygems/rubygems] Remove unnecessary local variable ruby/rubygems@a997210473 * [rubygems/rubygems] Materializing for resolution already filters platforms ruby/rubygems@9f4ba9ebb0 * [rubygems/rubygems] Don't discard candidates matching ruby metadata Do dependency filtering and materialization in one step. Before, dependency filtering would not consider ruby metadata so it would discard variants that end up not being materializable in the end. ruby/rubygems@0c0d40d417 Co-authored-by: Ian Ker-Seymer <[email protected]> * [rubygems/rubygems] Check for errors in error stream ruby/rubygems@7b0f7804f2 * [rubygems/rubygems] Preserve the previous behavior of raising an error when in frozen mode ruby/rubygems@6e35a6edfe * [Bug #17767] Now `ENV.clone` raises `TypeError` as well as `ENV.dup` One year ago, the former method has been deprecated while the latter has become an error. Then the 3.1 released, it is enough time to make also the former an error. * Implement Queue#pop(timeout: sec) [Feature #18774] As well as `SizedQueue#pop(timeout: sec)` If both `non_block=true` and `timeout:` are supplied, ArgumentError is raised. * [rubygems/rubygems] Fix arguments for bundle-config(1) docs Signed-off-by: Takuya Noguchi <[email protected]> ruby/rubygems@3e62ca776d * [rubygems/rubygems] Array is already uniq, no need to deduplicate it ruby/rubygems@3212ae14b7 * [DOC] Specify ways to run bootstrap tests * Speed up setting the backref match object This patch speeds up setting the backref match object by avoiding some memcopies. Take the following code for example: ```ruby "hello world" =~ /hello/ p $~ ``` When the RE matches the string, we have to set the Match object in the backref global. So we would allocate a match object[^1] and use `rb_reg_region_copy`[^2] to make a deep copy of the stack allocated `re_registers` struct[^3] in to the newly created Ruby object. This could possibly trigger GC[^4], and would allocate new memory. This patch makes a shallow copy of the `re_registers` struct on to the Match object allowing the match object to manage the `re_registers` pointer and also avoiding some calls to `xmalloc` and some manual memcopy. Benchmark looks like this: ```ruby require "benchmark/ips" def test_re thing thing =~ /hello/ end Benchmark.ips do |x| x.report("re hit") do test_re "hello world" end x.report("re miss") do test_re "world" end end ``` Before this patch: ``` $ ruby -v test.rb ruby 3.2.0dev (2022-07-27T22:29:00Z master 4ad6989) [arm64-darwin21] Ignoring bcrypt-3.1.16 because its extensions are not built. Try: gem pristine bcrypt --version 3.1.16 Warming up -------------------------------------- re hit 345.401k i/100ms re miss 673.584k i/100ms Calculating ------------------------------------- re hit 3.452M (± 0.5%) i/s - 17.270M in 5.002535s re miss 6.736M (± 0.4%) i/s - 34.353M in 5.099593s ``` After this patch: ``` $ ./ruby -v test.rb ruby 3.2.0dev (2022-08-01T21:24:12Z less-memcpy 0ff2a56606) [arm64-darwin21] Warming up -------------------------------------- re hit 419.578k i/100ms re miss 673.251k i/100ms Calculating ------------------------------------- re hit 4.201M (± 0.7%) i/s - 21.398M in 5.093593s re miss 6.716M (± 0.4%) i/s - 33.663M in 5.012756s ``` Matches get faster and misses maintain the same speed [^1]: https://github.com/ruby/ruby/blob/24204d54ab730791bfbd0cd66b8e12f0bd62ca5d/re.c#L1737 [^2]: https://github.com/ruby/ruby/blob/24204d54ab730791bfbd0cd66b8e12f0bd62ca5d/re.c#L1738 [^3]: https://github.com/ruby/ruby/blob/24204d54ab730791bfbd0cd66b8e12f0bd62ca5d/re.c#L1686 [^4]: https://github.com/ruby/ruby/blob/24204d54ab730791bfbd0cd66b8e12f0bd62ca5d/re.c#L981 * * 2022-08-03 [ci skip] * [ruby/date] [DOC] Enhanced RDoc for parser methods (ruby/date#68) Treats: ::_httpdate ::_iso8601 ::_jisx0301 ::_parse ::_rfc2822 ::_rfc3339 ::_xmlschema ::httpdate ::iso8601 ::jisx0301 ::parse ::rfc2822 ::rfc3339 ::xmlschema ruby/date@24bdab600a * [ruby/date] Enhanced RDoc (ruby/date#69) Treats: ::_strptime ::strptime Adds 'Related' entry to some methods' doc. ruby/date@a6c2129273 * [rubygems/rubygems] Warn (rather than crash) when setting `nil` specification versions ruby/rubygems@a4ba1a4d97 * [rubygems/rubygems] fix platform matching for index specs ruby/rubygems@f087f1b590 * Updated to use multiple licenses Co-authored-by: Hiroshi SHIBATA <[email protected]> * [ruby/bigdecimal] Updated to use the correct spec for muilti license ruby/bigdecimal@13165b29b8 * Merge rubygems/bundler HEAD Pick from ruby/rubygems@8331e63 * [rubygems/rubygems] Fix conservative updates regardless of `--strict` ruby/rubygems@c9a1d69a8d * [rubygems/rubygems] Fix `bundle outdated --strict` It should be an alias of `--filter-strict`. `--update-strict` is essentially a dummy option with no special behavior associated and should be deprecated. ruby/rubygems@ec1e5d83c8 * Harden Queue#pop timeout tests They occasionaly fail with; ``` FLeaked thread: TestThreadQueue#test_queue_pop_timeout: #<Thread:0x0000000108e38e48 /Users/runner/work/ruby/ruby/src/test/ruby/test_thread_queue.rb:123 sleep> .Finished thread: TestThreadQueue#test_deny_pushers: #<Thread:0x0000000108e38e48 /Users/runner/work/ruby/ruby/src/test/ruby/test_thread_queue.rb:123 dead> ... Retrying... 1) Failure: TestThreadQueue#test_sized_queue_pop_timeout [/Users/runner/work/ruby/ruby/src/test/ruby/test_thread_queue.rb:157]: <#<Thread:0x00000001084bc7e8 /Users/runner/work/ruby/ruby/src/test/ruby/test_thread_queue.rb:156 sleep>> expected but was <nil>. 2) Failure: TestThreadQueue#test_queue_pop_timeout [/Users/runner/work/ruby/ruby/src/test/ruby/test_thread_queue.rb:124]: <#<Thread:0x00000001083ff058 /Users/runner/work/ruby/ruby/src/test/ruby/test_thread_queue.rb:123 sleep>> expected but was <nil>. ``` I'm hoping joining for longer should help avoid this. * [ruby/irb] shortcut colorize_code to speedup pretty_print ruby/irb@8a074a6904 * * 2022-08-04 [ci skip] * [rubygems/rubygems] Extract entry.full_name to a variable ruby/rubygems@3973773005 * [rubygems/rubygems] Warn dangling symlinks ruby/rubygems@425b78637f * Link ext bundles with bundle loader option for newer ld64 ld64 shipped with Xcode 14 emits a warning when using `-undefined dynamic_lookup`. ``` ld: warning: -undefined dynamic_lookup may not work with chained fixups ``` Actually, `-undefined dynamic_lookup` doesn't work when: 1. Link a *shared library* with the option 2. Link it with a program that uses the chained-fixup introduced from macOS 12 and iOS 15 because `-undefined dynamic_lookup` uses lazy-bindings and they won't be bound while dyld fixes-up by traversing chained-fixup info. However, we build exts as *bundles* and they are loaded only through `dlopen`, so it's safe to use `-undefined dynamic_lookup` in theory. So the warning produced by ld64 is false-positive, and it results failure of option checking in configuration. Therefore, it would be an option to ignore the warning during our configuration. On the other hand, `-undefined dynamic_lookup` is already deprecated on all darwin platforms except for macOS, so it's good time to get rid of the option. ld64 also provides `-bundle_loader <executable>` option, which allows to resolve symbols defined in the executable symtab while linking. It behaves almost the same with `-undefined dynamic_lookup`, but it makes the following changes: 1. Require that unresolved symbols among input objects must be defined in the executable. 2. Lazy symbol binding will lookup only the symtab of the bundle loader executable. (`-undefined dynamic_lookup` lookups all symtab as flat namespace) This patch adds `-bundle_loader $(RUBY)` when non-EXTSTATIC configuration by assuming ruby executable can be linked before building exts. See "New Features" subsection under "Linking" section for chained fixup https://developer.apple.com/documentation/xcode-release-notes/xcode-13-release-notes * Quote $(BUILTRUBY) so paths with spaces work * Use $(bindir) for path to executable in mkmf For the macOS -bundle_loader linker option, we need a path to the Ruby exectuable. $(RUBY) is not necessarily a path since it could be a command line invocation. That happens during build with runruby.rb and can happen post installation if the user passes the --ruby option to a extconf.rb. Use $(bindir) to locate the executable instead. Before installation, $(bindir) doesn't exist, so we need to be able to override $(BUILTRUBY) in such situations so test-spec and bundled extensions could build. Use a new mkmf global, $builtruby, to do this; set it in fake.rb and in extmk.rb. Our build system is quite complex... * Resolve abi symbol references from miniruby to avoid circular deps Adding `ruby` to `PREP` causes the following circular dependencies because `PREP` is used as a prerequisite by some targets required to build `ruby` target itself. ``` make: Circular .rbconfig.time <- ruby dependency dropped. make: Circular builtin_binary.inc <- ruby dependency dropped. make: Circular ext/extinit.c <- ruby dependency dropped. make: Circular ruby <- ruby dependency dropped. ``` Adding a new Make variable like `EXTPREP` only for exts may be also reasonable, but it would introduce another complexity into our build system. `-bundle_loader` doesn't care that link-time and run-time loader executables are different as long as bound symbols are provided, so it's ok to resolve from miniruby to simplify our build. * Resolve abi symbols from libruby.dylib when available * Add `-bundle_loader` to mjit compilation args on macOS * thread_sync.c: pass proper argument to queue_sleep in rb_szqueue_push When I removed the SizeQueue#push timeout from my PR, I forgot to update the `queue_sleep` parameters to be a `queue_sleep_arg`. Somehow this worked on most archs, but on Solaris/Sparc it would legitimately crash when trying to access the `timeout` and `end` members of the struct. * [rubygems/rubygems] Fix unused variable warning ``` /Users/deivid/Code/rubygems/rubygems/test/rubygems/test_gem_resolver_installer_set.rb:55: warning: assigned but unused variable - a_1_local ``` ruby/rubygems@9ea4534800 * * 2022-08-05 [ci skip] * YJIT: Add known_* helpers for Type (ruby#6208) * YJIT: Add known_* helpers for Type This adds a few helpers to Type which all return Options representing what is known, from a Ruby perspective, about the type. This includes: * known_class_of: If known, the class represented by this type * known_value_type: If known, the T_ value type * known_exact_value: If known, the exact VALUE represented by this type (currently this is only available for true/false/nil) * known_truthy: If known, whether or not this value evaluates as true (not false or nil) The goal of this is to abstract away the specifics of the mappings between types wherever possible from the codegen. For example previously by introducing Type::CString as a more specific version of Type::TString, uses of Type::TString in codegen needed to be updated to check either case. Now by using known_value_type, at least in theory we can introduce new types with minimal (if any) codegen changes. I think rust's Option type allows us to represent this uncertainty fairly well, and should help avoid mistakes, and the matching using this turned out pretty cleanly. * YJIT: Use known_value_type for checktype * YJIT: Use known_value_type for T_STRING check * YJIT: Use known_class_of in guard_known_klass * YJIT: Use known truthyness in jit_rb_obj_not * YJIT: Rename known_class_of => known_class * YJIT: Allow str-concat arg to be any string subtype, not just rb_cString (ruby#6205) Allow str-concat arg to be any string subtype, not just rb_cString Co-authored-by: Jemma Issroff <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Burdette Lamar <[email protected]> Co-authored-by: Peter Zhu <[email protected]> Co-authored-by: git <[email protected]> Co-authored-by: Ivo Anjo <[email protected]> Co-authored-by: Hiroshi SHIBATA <[email protected]> Co-authored-by: Kevin Menard <[email protected]> Co-authored-by: Nobuyoshi Nakada <[email protected]> Co-authored-by: David Rodríguez <[email protected]> Co-authored-by: moe <[email protected]> Co-authored-by: Matt Valentine-House <[email protected]> Co-authored-by: Benoit Daloze <[email protected]> Co-authored-by: Jeremy Evans <[email protected]> Co-authored-by: Takashi Kokubun <[email protected]> Co-authored-by: Matthew Draper <[email protected]> Co-authored-by: John Hawthorn <[email protected]> Co-authored-by: Takuya Noguchi <[email protected]> Co-authored-by: konsolebox <[email protected]> Co-authored-by: Luka Dornhecker <[email protected]> Co-authored-by: Jean Boussier <[email protected]> Co-authored-by: Ethan <[email protected]> Co-authored-by: Akinori MUSHA <[email protected]> Co-authored-by: Wolf <[email protected]> Co-authored-by: Kazuhiro NISHIYAMA <[email protected]> Co-authored-by: Koichi Sasada <[email protected]> Co-authored-by: Ian Ker-Seymer <[email protected]> Co-authored-by: Aaron Patterson <[email protected]> Co-authored-by: Ilya Dyakonov <[email protected]> Co-authored-by: Thomas Winsnes <[email protected]> Co-authored-by: tompng <[email protected]> Co-authored-by: Yuta Saito <[email protected]> Co-authored-by: Alan Wu <[email protected]> Co-authored-by: Noah Gibbs <[email protected]>
1 parent f700c92 commit 5b51d0f

File tree

281 files changed

+5616
-2707
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

281 files changed

+5616
-2707
lines changed

.document

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pack.rb
2424
ractor.rb
2525
string.rb
2626
timev.rb
27+
thread_sync.rb
2728
trace_point.rb
2829
warning.rb
2930

.git-blame-ignore-revs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,13 @@
88

99
# Enable Style/StringLiterals cop for RubyGems/Bundler
1010
d7ffd3fea402239b16833cc434404a7af82d44f3
11+
12+
# [ruby/digest] Revert tab-expansion in external files
13+
48b09aae7ec5632209229dcc294dd0d75a93a17f
14+
8a65cf3b61c60e4cb886f59a73ff6db44364bfa9
15+
39dc9f9093901d40d2998653948d5da38b18ee2c
16+
17+
# [ruby/io-nonblock] Revert tab expansion
18+
f28287d34c03f472ffe90ea262bdde9affd4b965
19+
0d842fecb4f75ab3b1d4097ebdb8e88f51558041
20+
4ba2c66761d6a293abdfba409241d31063cefd62

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ Note that each entry is kept to a minimum, see links for details.
9696

9797
Note: We're only listing outstanding class updates.
9898
99+
* Enumerator
100+
* Enumerator.product has been added. Enumerator::Product is the implementation. [[Feature #18685]]
101+
99102
* Hash
100103
* Hash#shift now always returns nil if the hash is
101104
empty, instead of returning the default value or
@@ -268,5 +271,6 @@ The following deprecated APIs are removed.
268271
[Feature #18598]: https://bugs.ruby-lang.org/issues/18598
269272
[Bug #18625]: https://bugs.ruby-lang.org/issues/18625
270273
[Bug #18633]: https://bugs.ruby-lang.org/issues/18633
274+
[Feature #18685]: https://bugs.ruby-lang.org/issues/18685
271275
[Bug #18782]: https://bugs.ruby-lang.org/issues/18782
272276
[Feature #18788]: https://bugs.ruby-lang.org/issues/18788

array.c

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -967,20 +967,19 @@ rb_ec_ary_new_from_values(rb_execution_context_t *ec, long n, const VALUE *elts)
967967
}
968968

969969
VALUE
970-
rb_ary_tmp_new(long capa)
970+
rb_ary_hidden_new(long capa)
971971
{
972972
VALUE ary = ary_new(0, capa);
973973
rb_ary_transient_heap_evacuate(ary, TRUE);
974974
return ary;
975975
}
976976

977977
VALUE
978-
rb_ary_tmp_new_fill(long capa)
978+
rb_ary_hidden_new_fill(long capa)
979979
{
980-
VALUE ary = ary_new(0, capa);
980+
VALUE ary = rb_ary_hidden_new(capa);
981981
ary_memfill(ary, 0, capa, Qnil);
982982
ARY_SET_LEN(ary, capa);
983-
rb_ary_transient_heap_evacuate(ary, TRUE);
984983
return ary;
985984
}
986985

@@ -1025,18 +1024,10 @@ rb_ary_memsize(VALUE ary)
10251024
}
10261025
}
10271026

1028-
static inline void
1029-
ary_discard(VALUE ary)
1030-
{
1031-
rb_ary_free(ary);
1032-
RBASIC(ary)->flags |= RARRAY_EMBED_FLAG;
1033-
RBASIC(ary)->flags &= ~(RARRAY_EMBED_LEN_MASK | RARRAY_TRANSIENT_FLAG);
1034-
}
1035-
10361027
static VALUE
10371028
ary_make_shared(VALUE ary)
10381029
{
1039-
assert(!ARY_EMBED_P(ary));
1030+
assert(USE_RVARGC || !ARY_EMBED_P(ary));
10401031
ary_verify(ary);
10411032

10421033
if (ARY_SHARED_P(ary)) {
@@ -1046,21 +1037,38 @@ ary_make_shared(VALUE ary)
10461037
return ary;
10471038
}
10481039
else if (OBJ_FROZEN(ary)) {
1049-
rb_ary_transient_heap_evacuate(ary, TRUE);
1050-
ary_shrink_capa(ary);
1040+
if (!ARY_EMBED_P(ary)) {
1041+
rb_ary_transient_heap_evacuate(ary, TRUE);
1042+
ary_shrink_capa(ary);
1043+
}
10511044
return ary;
10521045
}
10531046
else {
1054-
long capa = ARY_CAPA(ary), len = RARRAY_LEN(ary);
1055-
const VALUE *ptr;
1047+
rb_ary_transient_heap_evacuate(ary, TRUE);
1048+
1049+
long capa = ARY_CAPA(ary);
1050+
long len = RARRAY_LEN(ary);
1051+
1052+
/* Shared roots cannot be embedded because the reference count
1053+
* (refcnt) is stored in as.heap.aux.capa. */
10561054
VALUE shared = ary_alloc_heap(0);
10571055

1058-
rb_ary_transient_heap_evacuate(ary, TRUE);
1059-
ptr = ARY_HEAP_PTR(ary);
1056+
if (ARY_EMBED_P(ary)) {
1057+
/* Cannot use ary_heap_alloc because we don't want to allocate
1058+
* on the transient heap. */
1059+
VALUE *ptr = ALLOC_N(VALUE, capa);
1060+
ARY_SET_PTR(shared, ptr);
1061+
ary_memcpy(shared, 0, len, RARRAY_PTR(ary));
1062+
1063+
FL_UNSET_EMBED(ary);
1064+
ARY_SET_HEAP_LEN(ary, len);
1065+
ARY_SET_PTR(ary, ptr);
1066+
}
1067+
else {
1068+
ARY_SET_PTR(shared, RARRAY_PTR(ary));
1069+
}
10601070

1061-
FL_UNSET_EMBED(shared);
10621071
ARY_SET_LEN(shared, capa);
1063-
ARY_SET_PTR(shared, ptr);
10641072
ary_mem_clear(shared, len, capa - len);
10651073
FL_SET_SHARED_ROOT(shared);
10661074
ARY_SET_SHARED_ROOT_REFCNT(shared, 1);
@@ -1327,7 +1335,9 @@ ary_make_partial(VALUE ary, VALUE klass, long offset, long len)
13271335
assert(len >= 0);
13281336
assert(offset+len <= RARRAY_LEN(ary));
13291337

1330-
if (ary_embeddable_p(len)) {
1338+
const size_t rarray_embed_capa_max = (sizeof(struct RArray) - offsetof(struct RArray, as.ary)) / sizeof(VALUE);
1339+
1340+
if ((size_t)len <= rarray_embed_capa_max && ary_embeddable_p(len)) {
13311341
VALUE result = ary_alloc_embed(klass, len);
13321342
ary_memcpy(result, 0, len, RARRAY_CONST_PTR_TRANSIENT(ary) + offset);
13331343
ARY_SET_EMBED_LEN(result, len);
@@ -5109,7 +5119,7 @@ rb_ary_concat_multi(int argc, VALUE *argv, VALUE ary)
51095119
}
51105120
else if (argc > 1) {
51115121
int i;
5112-
VALUE args = rb_ary_tmp_new(argc);
5122+
VALUE args = rb_ary_hidden_new(argc);
51135123
for (i = 0; i < argc; i++) {
51145124
rb_ary_concat(args, argv[i]);
51155125
}
@@ -6937,9 +6947,6 @@ rb_ary_cycle(int argc, VALUE *argv, VALUE ary)
69376947
return Qnil;
69386948
}
69396949

6940-
#define tmpary(n) rb_ary_tmp_new(n)
6941-
#define tmpary_discard(a) (ary_discard(a), RBASIC_SET_CLASS_RAW(a, rb_cArray))
6942-
69436950
/*
69446951
* Build a ruby array of the corresponding values and yield it to the
69456952
* associated block.
@@ -7634,7 +7641,7 @@ static VALUE
76347641
rb_ary_product(int argc, VALUE *argv, VALUE ary)
76357642
{
76367643
int n = argc+1; /* How many arrays we're operating on */
7637-
volatile VALUE t0 = tmpary(n);
7644+
volatile VALUE t0 = rb_ary_hidden_new(n);
76387645
volatile VALUE t1 = Qundef;
76397646
VALUE *arrays = RARRAY_PTR(t0); /* The arrays we're computing the product of */
76407647
int *counters = ALLOCV_N(int, t1, n); /* The current position in each one */
@@ -7711,8 +7718,8 @@ rb_ary_product(int argc, VALUE *argv, VALUE ary)
77117718
counters[m]++;
77127719
}
77137720
}
7721+
77147722
done:
7715-
tmpary_discard(t0);
77167723
ALLOCV_END(t1);
77177724

77187725
return NIL_P(result) ? ary : result;

bootstraptest/test_io.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/freebsd/ =~ RUBY_PLATFORM or
12
assert_finish 5, %q{
23
r, w = IO.pipe
34
t1 = Thread.new { r.sysread(1) }

bootstraptest/test_yjit.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,6 +1224,19 @@ def foo(&block)
12241224
[foo {1}, foo {2}, foo {42}]
12251225
}
12261226

1227+
# test calling without block param
1228+
assert_equal '[1, false, 2, false]', %q{
1229+
def bar
1230+
block_given? && yield
1231+
end
1232+
1233+
def foo(&block)
1234+
bar(&block)
1235+
end
1236+
1237+
[foo { 1 }, foo, foo { 2 }, foo]
1238+
}
1239+
12271240
# test calling block param failing
12281241
assert_equal '42', %q{
12291242
def foo(&block)

class.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ rb_mod_init_copy(VALUE clone, VALUE orig)
507507
VALUE p = RCLASS_SUPER(orig);
508508
VALUE orig_origin = RCLASS_ORIGIN(orig);
509509
VALUE prev_clone_p = clone;
510-
VALUE origin_stack = rb_ary_tmp_new(2);
510+
VALUE origin_stack = rb_ary_hidden_new(2);
511511
VALUE origin[2];
512512
VALUE clone_p = 0;
513513
long origin_len;
@@ -1250,7 +1250,7 @@ do_include_modules_at(const VALUE klass, VALUE c, VALUE module, int search_super
12501250
RCLASS_SET_INCLUDER(iclass, klass);
12511251
add_subclass = TRUE;
12521252
if (module != RCLASS_ORIGIN(module)) {
1253-
if (!origin_stack) origin_stack = rb_ary_tmp_new(2);
1253+
if (!origin_stack) origin_stack = rb_ary_hidden_new(2);
12541254
VALUE origin[2] = {iclass, RCLASS_ORIGIN(module)};
12551255
rb_ary_cat(origin_stack, origin, 2);
12561256
}
@@ -2310,7 +2310,7 @@ rb_get_kwargs(VALUE keyword_hash, const ID *table, int required, int optional, V
23102310
continue;
23112311
}
23122312
}
2313-
if (NIL_P(missing)) missing = rb_ary_tmp_new(1);
2313+
if (NIL_P(missing)) missing = rb_ary_hidden_new(1);
23142314
rb_ary_push(missing, keyword);
23152315
}
23162316
if (!NIL_P(missing)) {

common.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,7 @@ BUILTIN_RB_SRCS = \
10621062
$(srcdir)/kernel.rb \
10631063
$(srcdir)/ractor.rb \
10641064
$(srcdir)/timev.rb \
1065+
$(srcdir)/thread_sync.rb \
10651066
$(srcdir)/nilclass.rb \
10661067
$(srcdir)/prelude.rb \
10671068
$(srcdir)/gem_prelude.rb \
@@ -9447,6 +9448,7 @@ miniinit.$(OBJEXT): {$(VPATH)}st.h
94479448
miniinit.$(OBJEXT): {$(VPATH)}subst.h
94489449
miniinit.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h
94499450
miniinit.$(OBJEXT): {$(VPATH)}thread_native.h
9451+
miniinit.$(OBJEXT): {$(VPATH)}thread_sync.rb
94509452
miniinit.$(OBJEXT): {$(VPATH)}timev.rb
94519453
miniinit.$(OBJEXT): {$(VPATH)}trace_point.rb
94529454
miniinit.$(OBJEXT): {$(VPATH)}vm_core.h
@@ -15230,6 +15232,7 @@ thread.$(OBJEXT): {$(VPATH)}backward/2/limits.h
1523015232
thread.$(OBJEXT): {$(VPATH)}backward/2/long_long.h
1523115233
thread.$(OBJEXT): {$(VPATH)}backward/2/stdalign.h
1523215234
thread.$(OBJEXT): {$(VPATH)}backward/2/stdarg.h
15235+
thread.$(OBJEXT): {$(VPATH)}builtin.h
1523315236
thread.$(OBJEXT): {$(VPATH)}config.h
1523415237
thread.$(OBJEXT): {$(VPATH)}debug.h
1523515238
thread.$(OBJEXT): {$(VPATH)}debug_counter.h
@@ -15412,6 +15415,8 @@ thread.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).c
1541215415
thread.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h
1541315416
thread.$(OBJEXT): {$(VPATH)}thread_native.h
1541415417
thread.$(OBJEXT): {$(VPATH)}thread_sync.c
15418+
thread.$(OBJEXT): {$(VPATH)}thread_sync.rb
15419+
thread.$(OBJEXT): {$(VPATH)}thread_sync.rbinc
1541515420
thread.$(OBJEXT): {$(VPATH)}timev.h
1541615421
thread.$(OBJEXT): {$(VPATH)}vm_core.h
1541715422
thread.$(OBJEXT): {$(VPATH)}vm_debug.h

compile.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ static void iseq_add_setlocal(rb_iseq_t *iseq, LINK_ANCHOR *const seq, const NOD
313313
LABEL_REF(le); \
314314
LABEL_REF(lc); \
315315
if (NIL_P(ISEQ_COMPILE_DATA(iseq)->catch_table_ary)) \
316-
RB_OBJ_WRITE(iseq, &ISEQ_COMPILE_DATA(iseq)->catch_table_ary, rb_ary_tmp_new(3)); \
316+
RB_OBJ_WRITE(iseq, &ISEQ_COMPILE_DATA(iseq)->catch_table_ary, rb_ary_hidden_new(3)); \
317317
rb_ary_push(ISEQ_COMPILE_DATA(iseq)->catch_table_ary, freeze_hide_obj(_e)); \
318318
} while (0)
319319

@@ -627,7 +627,7 @@ decl_branch_base(rb_iseq_t *iseq, const NODE *node, const char *type)
627627
VALUE branches;
628628

629629
if (NIL_P(branch_base)) {
630-
branch_base = rb_ary_tmp_new(6);
630+
branch_base = rb_ary_hidden_new(6);
631631
rb_hash_aset(structure, key, branch_base);
632632
rb_ary_push(branch_base, ID2SYM(rb_intern(type)));
633633
rb_ary_push(branch_base, INT2FIX(first_lineno));
@@ -675,7 +675,7 @@ add_trace_branch_coverage(rb_iseq_t *iseq, LINK_ANCHOR *const seq, const NODE *n
675675
long counter_idx;
676676

677677
if (NIL_P(branch)) {
678-
branch = rb_ary_tmp_new(6);
678+
branch = rb_ary_hidden_new(6);
679679
rb_hash_aset(branches, key, branch);
680680
rb_ary_push(branch, ID2SYM(rb_intern(type)));
681681
rb_ary_push(branch, INT2FIX(first_lineno));
@@ -1743,7 +1743,7 @@ iseq_set_arguments_keywords(rb_iseq_t *iseq, LINK_ANCHOR *const optargs,
17431743
const NODE *node = args->kw_args;
17441744
struct rb_iseq_constant_body *const body = ISEQ_BODY(iseq);
17451745
struct rb_iseq_param_keyword *keyword;
1746-
const VALUE default_values = rb_ary_tmp_new(1);
1746+
const VALUE default_values = rb_ary_hidden_new(1);
17471747
const VALUE complex_mark = rb_str_tmp_new(0);
17481748
int kw = 0, rkw = 0, di = 0, i;
17491749

@@ -1847,7 +1847,7 @@ iseq_set_arguments(rb_iseq_t *iseq, LINK_ANCHOR *const optargs, const NODE *cons
18471847
if (args->opt_args) {
18481848
const NODE *node = args->opt_args;
18491849
LABEL *label;
1850-
VALUE labels = rb_ary_tmp_new(1);
1850+
VALUE labels = rb_ary_hidden_new(1);
18511851
VALUE *opt_table;
18521852
int i = 0, j;
18531853

@@ -4369,7 +4369,7 @@ compile_array(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, int pop
43694369

43704370
if ((first_chunk && stack_len == 0 && !node_tmp) || count >= min_tmp_ary_len) {
43714371
/* The literal contains only optimizable elements, or the subarray is long enough */
4372-
VALUE ary = rb_ary_tmp_new(count);
4372+
VALUE ary = rb_ary_hidden_new(count);
43734373

43744374
/* Create a hidden array */
43754375
for (; count; count--, node = node->nd_next)
@@ -4420,7 +4420,7 @@ static int
44204420
compile_array_1(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node)
44214421
{
44224422
if (static_literal_node_p(node, iseq)) {
4423-
VALUE ary = rb_ary_tmp_new(1);
4423+
VALUE ary = rb_ary_hidden_new(1);
44244424
rb_ary_push(ary, static_literal_value(node, iseq));
44254425
OBJ_FREEZE(ary);
44264426

@@ -4517,7 +4517,7 @@ compile_hash(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, int meth
45174517

45184518
if ((first_chunk && stack_len == 0 && !node_tmp) || count >= min_tmp_hash_len) {
45194519
/* The literal contains only optimizable elements, or the subsequence is long enough */
4520-
VALUE ary = rb_ary_tmp_new(count);
4520+
VALUE ary = rb_ary_hidden_new(count);
45214521

45224522
/* Create a hidden hash */
45234523
for (; count; count--, node = node->nd_next->nd_next) {
@@ -4837,7 +4837,8 @@ struct masgn_state {
48374837
};
48384838

48394839
static int
4840-
add_masgn_lhs_node(struct masgn_state *state, int lhs_pos, const NODE *line_node, int argc, INSN *before_insn) {
4840+
add_masgn_lhs_node(struct masgn_state *state, int lhs_pos, const NODE *line_node, int argc, INSN *before_insn)
4841+
{
48414842
if (!state) {
48424843
rb_bug("no masgn_state");
48434844
}
@@ -12077,7 +12078,7 @@ ibf_dump_iseq_list_i(st_data_t key, st_data_t val, st_data_t ptr)
1207712078
static void
1207812079
ibf_dump_iseq_list(struct ibf_dump *dump, struct ibf_header *header)
1207912080
{
12080-
VALUE offset_list = rb_ary_tmp_new(dump->iseq_table->num_entries);
12081+
VALUE offset_list = rb_ary_hidden_new(dump->iseq_table->num_entries);
1208112082

1208212083
struct ibf_dump_iseq_list_arg args;
1208312084
args.dump = dump;
@@ -12349,7 +12350,7 @@ ibf_load_object_array(const struct ibf_load *load, const struct ibf_object_heade
1234912350

1235012351
const long len = (long)ibf_load_small_value(load, &reading_pos);
1235112352

12352-
VALUE ary = header->internal ? rb_ary_tmp_new(len) : rb_ary_new_capa(len);
12353+
VALUE ary = header->internal ? rb_ary_hidden_new(len) : rb_ary_new_capa(len);
1235312354
int i;
1235412355

1235512356
for (i=0; i<len; i++) {
@@ -12744,7 +12745,7 @@ static void
1274412745
ibf_dump_object_list(struct ibf_dump *dump, ibf_offset_t *obj_list_offset, unsigned int *obj_list_size)
1274512746
{
1274612747
st_table *obj_table = dump->current_buffer->obj_table;
12747-
VALUE offset_list = rb_ary_tmp_new(obj_table->num_entries);
12748+
VALUE offset_list = rb_ary_hidden_new(obj_table->num_entries);
1274812749

1274912750
struct ibf_dump_object_list_arg args;
1275012751
args.dump = dump;

0 commit comments

Comments
 (0)