Skip to content

Commit

Permalink
Rebase yjit_backend_ir branch on ruby/master (#358)
Browse files Browse the repository at this point in the history
* 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] <support@github.com>

rubygems/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 rubygems/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

rubygems/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="foo@bar.baz", @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.

rubygems/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.

rubygems/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

rubygems/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 <john@hawthorn.email>

Co-authored-by: John Hawthorn <john@hawthorn.email>

* * 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 rubygems/rubygems@446cc57

* [rubygems/rubygems] Add package/pack aliases to man pages for cache

Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>

rubygems/rubygems@1685e3a9dc

* [rubygems/rubygems] Fix dead links to deprecated bundle-package(1) with bundler-cache(1)

Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>

rubygems/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

rubygems/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.

rubygems/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 <takninnovationresearch@gmail.com>

rubygems/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

rubygems/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>'
```
````

rubygems/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] <support@github.com>

rubygems/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] <support@github.com>

rubygems/rubygems@edea8fbfa0

* [rubygems/rubygems] Move some logic to `LazySpecification#__materialize__`

rubygems/rubygems@5e100df7c9

* [rubygems/rubygems] Remove unnecessary special case for Bundler

rubygems/rubygems@2777e79b8e

* [rubygems/rubygems] Fix incorrect force_ruby_platform propagation

It was just working by chance.

(cherry picked from commit rubygems/rubygems@16b2d6bfe893)

rubygems/rubygems@8f922d980f

* [rubygems/rubygems] Refactor materialization conditions

rubygems/rubygems@08e1554fb6

* [rubygems/rubygems] This should go through the standard source search logic

rubygems/rubygems@087e3e4e3b

* [rubygems/rubygems] Only need to filter platforms when materialization is not strict

rubygems/rubygems@9d878cbda0

* [rubygems/rubygems] Prefer reverse+find to select+last

rubygems/rubygems@ffb161bb69

* [rubygems/rubygems] Remove unnecessary local variable

rubygems/rubygems@a997210473

* [rubygems/rubygems] Materializing for resolution already filters platforms

rubygems/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.

rubygems/rubygems@0c0d40d417

Co-authored-by: Ian Ker-Seymer <ian.kerseymer@shopify.com>

* [rubygems/rubygems] Check for errors in error stream

rubygems/rubygems@7b0f7804f2

* [rubygems/rubygems] Preserve the previous behavior of raising an error when in frozen mode

rubygems/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 <takninnovationresearch@gmail.com>

rubygems/rubygems@3e62ca776d

* [rubygems/rubygems] Array is already uniq, no need to deduplicate it

rubygems/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

rubygems/rubygems@a4ba1a4d97

* [rubygems/rubygems] fix platform matching for index specs

rubygems/rubygems@f087f1b590

* Updated to use multiple licenses

Co-authored-by: Hiroshi SHIBATA <hsbt@ruby-lang.org>

* [ruby/bigdecimal] Updated to use the correct spec for muilti license

ruby/bigdecimal@13165b29b8

* Merge rubygems/bundler HEAD

  Pick from rubygems/rubygems@8331e63

* [rubygems/rubygems] Fix conservative updates regardless of `--strict`

rubygems/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.

rubygems/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

rubygems/rubygems@3973773005

* [rubygems/rubygems] Warn dangling symlinks

rubygems/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
```

rubygems/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 <jemmaissroff@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Burdette Lamar <BurdetteLamar@Yahoo.com>
Co-authored-by: Peter Zhu <peter@peterzhu.ca>
Co-authored-by: git <svn-admin@ruby-lang.org>
Co-authored-by: Ivo Anjo <ivo.anjo@datadoghq.com>
Co-authored-by: Hiroshi SHIBATA <hsbt@ruby-lang.org>
Co-authored-by: Kevin Menard <kevin@nirvdrum.com>
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
Co-authored-by: moe <moe@busyloop.net>
Co-authored-by: Matt Valentine-House <matt@eightbitraptor.com>
Co-authored-by: Benoit Daloze <eregontp@gmail.com>
Co-authored-by: Jeremy Evans <code@jeremyevans.net>
Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
Co-authored-by: Matthew Draper <matthew@trebex.net>
Co-authored-by: John Hawthorn <john@hawthorn.email>
Co-authored-by: Takuya Noguchi <takninnovationresearch@gmail.com>
Co-authored-by: konsolebox <konsolebox@gmail.com>
Co-authored-by: Luka Dornhecker <luka.dornhecker@hey.com>
Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
Co-authored-by: Ethan <ethan@unth.net>
Co-authored-by: Akinori MUSHA <knu@idaemons.org>
Co-authored-by: Wolf <wolf@wolfsden.cz>
Co-authored-by: Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
Co-authored-by: Koichi Sasada <ko1@atdot.net>
Co-authored-by: Ian Ker-Seymer <ian.kerseymer@shopify.com>
Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
Co-authored-by: Ilya Dyakonov <ilushkadyakonov@gmail.com>
Co-authored-by: Thomas Winsnes <TWinsnes@users.noreply.github.com>
Co-authored-by: tompng <tomoyapenguin@gmail.com>
Co-authored-by: Yuta Saito <kateinoigakukun@gmail.com>
Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
Co-authored-by: Noah Gibbs <noah.gibbs@shopify.com>
  • Loading branch information
Show file tree
Hide file tree
Showing 281 changed files with 5,616 additions and 2,707 deletions.
1 change: 1 addition & 0 deletions .document
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pack.rb
ractor.rb
string.rb
timev.rb
thread_sync.rb
trace_point.rb
warning.rb

Expand Down
10 changes: 10 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,13 @@

# Enable Style/StringLiterals cop for RubyGems/Bundler
d7ffd3fea402239b16833cc434404a7af82d44f3

# [ruby/digest] Revert tab-expansion in external files
48b09aae7ec5632209229dcc294dd0d75a93a17f
8a65cf3b61c60e4cb886f59a73ff6db44364bfa9
39dc9f9093901d40d2998653948d5da38b18ee2c

# [ruby/io-nonblock] Revert tab expansion
f28287d34c03f472ffe90ea262bdde9affd4b965
0d842fecb4f75ab3b1d4097ebdb8e88f51558041
4ba2c66761d6a293abdfba409241d31063cefd62
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ Note that each entry is kept to a minimum, see links for details.

Note: We're only listing outstanding class updates.
* Enumerator
* Enumerator.product has been added. Enumerator::Product is the implementation. [[Feature #18685]]
* Hash
* Hash#shift now always returns nil if the hash is
empty, instead of returning the default value or
Expand Down Expand Up @@ -268,5 +271,6 @@ The following deprecated APIs are removed.
[Feature #18598]: https://bugs.ruby-lang.org/issues/18598
[Bug #18625]: https://bugs.ruby-lang.org/issues/18625
[Bug #18633]: https://bugs.ruby-lang.org/issues/18633
[Feature #18685]: https://bugs.ruby-lang.org/issues/18685
[Bug #18782]: https://bugs.ruby-lang.org/issues/18782
[Feature #18788]: https://bugs.ruby-lang.org/issues/18788
63 changes: 35 additions & 28 deletions array.c
Original file line number Diff line number Diff line change
Expand Up @@ -967,20 +967,19 @@ rb_ec_ary_new_from_values(rb_execution_context_t *ec, long n, const VALUE *elts)
}

VALUE
rb_ary_tmp_new(long capa)
rb_ary_hidden_new(long capa)
{
VALUE ary = ary_new(0, capa);
rb_ary_transient_heap_evacuate(ary, TRUE);
return ary;
}

VALUE
rb_ary_tmp_new_fill(long capa)
rb_ary_hidden_new_fill(long capa)
{
VALUE ary = ary_new(0, capa);
VALUE ary = rb_ary_hidden_new(capa);
ary_memfill(ary, 0, capa, Qnil);
ARY_SET_LEN(ary, capa);
rb_ary_transient_heap_evacuate(ary, TRUE);
return ary;
}

Expand Down Expand Up @@ -1025,18 +1024,10 @@ rb_ary_memsize(VALUE ary)
}
}

static inline void
ary_discard(VALUE ary)
{
rb_ary_free(ary);
RBASIC(ary)->flags |= RARRAY_EMBED_FLAG;
RBASIC(ary)->flags &= ~(RARRAY_EMBED_LEN_MASK | RARRAY_TRANSIENT_FLAG);
}

static VALUE
ary_make_shared(VALUE ary)
{
assert(!ARY_EMBED_P(ary));
assert(USE_RVARGC || !ARY_EMBED_P(ary));
ary_verify(ary);

if (ARY_SHARED_P(ary)) {
Expand All @@ -1046,21 +1037,38 @@ ary_make_shared(VALUE ary)
return ary;
}
else if (OBJ_FROZEN(ary)) {
rb_ary_transient_heap_evacuate(ary, TRUE);
ary_shrink_capa(ary);
if (!ARY_EMBED_P(ary)) {
rb_ary_transient_heap_evacuate(ary, TRUE);
ary_shrink_capa(ary);
}
return ary;
}
else {
long capa = ARY_CAPA(ary), len = RARRAY_LEN(ary);
const VALUE *ptr;
rb_ary_transient_heap_evacuate(ary, TRUE);

long capa = ARY_CAPA(ary);
long len = RARRAY_LEN(ary);

/* Shared roots cannot be embedded because the reference count
* (refcnt) is stored in as.heap.aux.capa. */
VALUE shared = ary_alloc_heap(0);

rb_ary_transient_heap_evacuate(ary, TRUE);
ptr = ARY_HEAP_PTR(ary);
if (ARY_EMBED_P(ary)) {
/* Cannot use ary_heap_alloc because we don't want to allocate
* on the transient heap. */
VALUE *ptr = ALLOC_N(VALUE, capa);
ARY_SET_PTR(shared, ptr);
ary_memcpy(shared, 0, len, RARRAY_PTR(ary));

FL_UNSET_EMBED(ary);
ARY_SET_HEAP_LEN(ary, len);
ARY_SET_PTR(ary, ptr);
}
else {
ARY_SET_PTR(shared, RARRAY_PTR(ary));
}

FL_UNSET_EMBED(shared);
ARY_SET_LEN(shared, capa);
ARY_SET_PTR(shared, ptr);
ary_mem_clear(shared, len, capa - len);
FL_SET_SHARED_ROOT(shared);
ARY_SET_SHARED_ROOT_REFCNT(shared, 1);
Expand Down Expand Up @@ -1327,7 +1335,9 @@ ary_make_partial(VALUE ary, VALUE klass, long offset, long len)
assert(len >= 0);
assert(offset+len <= RARRAY_LEN(ary));

if (ary_embeddable_p(len)) {
const size_t rarray_embed_capa_max = (sizeof(struct RArray) - offsetof(struct RArray, as.ary)) / sizeof(VALUE);

if ((size_t)len <= rarray_embed_capa_max && ary_embeddable_p(len)) {
VALUE result = ary_alloc_embed(klass, len);
ary_memcpy(result, 0, len, RARRAY_CONST_PTR_TRANSIENT(ary) + offset);
ARY_SET_EMBED_LEN(result, len);
Expand Down Expand Up @@ -5109,7 +5119,7 @@ rb_ary_concat_multi(int argc, VALUE *argv, VALUE ary)
}
else if (argc > 1) {
int i;
VALUE args = rb_ary_tmp_new(argc);
VALUE args = rb_ary_hidden_new(argc);
for (i = 0; i < argc; i++) {
rb_ary_concat(args, argv[i]);
}
Expand Down Expand Up @@ -6937,9 +6947,6 @@ rb_ary_cycle(int argc, VALUE *argv, VALUE ary)
return Qnil;
}

#define tmpary(n) rb_ary_tmp_new(n)
#define tmpary_discard(a) (ary_discard(a), RBASIC_SET_CLASS_RAW(a, rb_cArray))

/*
* Build a ruby array of the corresponding values and yield it to the
* associated block.
Expand Down Expand Up @@ -7634,7 +7641,7 @@ static VALUE
rb_ary_product(int argc, VALUE *argv, VALUE ary)
{
int n = argc+1; /* How many arrays we're operating on */
volatile VALUE t0 = tmpary(n);
volatile VALUE t0 = rb_ary_hidden_new(n);
volatile VALUE t1 = Qundef;
VALUE *arrays = RARRAY_PTR(t0); /* The arrays we're computing the product of */
int *counters = ALLOCV_N(int, t1, n); /* The current position in each one */
Expand Down Expand Up @@ -7711,8 +7718,8 @@ rb_ary_product(int argc, VALUE *argv, VALUE ary)
counters[m]++;
}
}

done:
tmpary_discard(t0);
ALLOCV_END(t1);

return NIL_P(result) ? ary : result;
Expand Down
1 change: 1 addition & 0 deletions bootstraptest/test_io.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/freebsd/ =~ RUBY_PLATFORM or
assert_finish 5, %q{
r, w = IO.pipe
t1 = Thread.new { r.sysread(1) }
Expand Down
13 changes: 13 additions & 0 deletions bootstraptest/test_yjit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,19 @@ def foo(&block)
[foo {1}, foo {2}, foo {42}]
}

# test calling without block param
assert_equal '[1, false, 2, false]', %q{
def bar
block_given? && yield
end
def foo(&block)
bar(&block)
end
[foo { 1 }, foo, foo { 2 }, foo]
}

# test calling block param failing
assert_equal '42', %q{
def foo(&block)
Expand Down
6 changes: 3 additions & 3 deletions class.c
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ rb_mod_init_copy(VALUE clone, VALUE orig)
VALUE p = RCLASS_SUPER(orig);
VALUE orig_origin = RCLASS_ORIGIN(orig);
VALUE prev_clone_p = clone;
VALUE origin_stack = rb_ary_tmp_new(2);
VALUE origin_stack = rb_ary_hidden_new(2);
VALUE origin[2];
VALUE clone_p = 0;
long origin_len;
Expand Down Expand Up @@ -1250,7 +1250,7 @@ do_include_modules_at(const VALUE klass, VALUE c, VALUE module, int search_super
RCLASS_SET_INCLUDER(iclass, klass);
add_subclass = TRUE;
if (module != RCLASS_ORIGIN(module)) {
if (!origin_stack) origin_stack = rb_ary_tmp_new(2);
if (!origin_stack) origin_stack = rb_ary_hidden_new(2);
VALUE origin[2] = {iclass, RCLASS_ORIGIN(module)};
rb_ary_cat(origin_stack, origin, 2);
}
Expand Down Expand Up @@ -2310,7 +2310,7 @@ rb_get_kwargs(VALUE keyword_hash, const ID *table, int required, int optional, V
continue;
}
}
if (NIL_P(missing)) missing = rb_ary_tmp_new(1);
if (NIL_P(missing)) missing = rb_ary_hidden_new(1);
rb_ary_push(missing, keyword);
}
if (!NIL_P(missing)) {
Expand Down
5 changes: 5 additions & 0 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -1062,6 +1062,7 @@ BUILTIN_RB_SRCS = \
$(srcdir)/kernel.rb \
$(srcdir)/ractor.rb \
$(srcdir)/timev.rb \
$(srcdir)/thread_sync.rb \
$(srcdir)/nilclass.rb \
$(srcdir)/prelude.rb \
$(srcdir)/gem_prelude.rb \
Expand Down Expand Up @@ -9447,6 +9448,7 @@ miniinit.$(OBJEXT): {$(VPATH)}st.h
miniinit.$(OBJEXT): {$(VPATH)}subst.h
miniinit.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h
miniinit.$(OBJEXT): {$(VPATH)}thread_native.h
miniinit.$(OBJEXT): {$(VPATH)}thread_sync.rb
miniinit.$(OBJEXT): {$(VPATH)}timev.rb
miniinit.$(OBJEXT): {$(VPATH)}trace_point.rb
miniinit.$(OBJEXT): {$(VPATH)}vm_core.h
Expand Down Expand Up @@ -15230,6 +15232,7 @@ thread.$(OBJEXT): {$(VPATH)}backward/2/limits.h
thread.$(OBJEXT): {$(VPATH)}backward/2/long_long.h
thread.$(OBJEXT): {$(VPATH)}backward/2/stdalign.h
thread.$(OBJEXT): {$(VPATH)}backward/2/stdarg.h
thread.$(OBJEXT): {$(VPATH)}builtin.h
thread.$(OBJEXT): {$(VPATH)}config.h
thread.$(OBJEXT): {$(VPATH)}debug.h
thread.$(OBJEXT): {$(VPATH)}debug_counter.h
Expand Down Expand Up @@ -15412,6 +15415,8 @@ thread.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).c
thread.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h
thread.$(OBJEXT): {$(VPATH)}thread_native.h
thread.$(OBJEXT): {$(VPATH)}thread_sync.c
thread.$(OBJEXT): {$(VPATH)}thread_sync.rb
thread.$(OBJEXT): {$(VPATH)}thread_sync.rbinc
thread.$(OBJEXT): {$(VPATH)}timev.h
thread.$(OBJEXT): {$(VPATH)}vm_core.h
thread.$(OBJEXT): {$(VPATH)}vm_debug.h
Expand Down
25 changes: 13 additions & 12 deletions compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ static void iseq_add_setlocal(rb_iseq_t *iseq, LINK_ANCHOR *const seq, const NOD
LABEL_REF(le); \
LABEL_REF(lc); \
if (NIL_P(ISEQ_COMPILE_DATA(iseq)->catch_table_ary)) \
RB_OBJ_WRITE(iseq, &ISEQ_COMPILE_DATA(iseq)->catch_table_ary, rb_ary_tmp_new(3)); \
RB_OBJ_WRITE(iseq, &ISEQ_COMPILE_DATA(iseq)->catch_table_ary, rb_ary_hidden_new(3)); \
rb_ary_push(ISEQ_COMPILE_DATA(iseq)->catch_table_ary, freeze_hide_obj(_e)); \
} while (0)

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

if (NIL_P(branch_base)) {
branch_base = rb_ary_tmp_new(6);
branch_base = rb_ary_hidden_new(6);
rb_hash_aset(structure, key, branch_base);
rb_ary_push(branch_base, ID2SYM(rb_intern(type)));
rb_ary_push(branch_base, INT2FIX(first_lineno));
Expand Down Expand Up @@ -675,7 +675,7 @@ add_trace_branch_coverage(rb_iseq_t *iseq, LINK_ANCHOR *const seq, const NODE *n
long counter_idx;

if (NIL_P(branch)) {
branch = rb_ary_tmp_new(6);
branch = rb_ary_hidden_new(6);
rb_hash_aset(branches, key, branch);
rb_ary_push(branch, ID2SYM(rb_intern(type)));
rb_ary_push(branch, INT2FIX(first_lineno));
Expand Down Expand Up @@ -1743,7 +1743,7 @@ iseq_set_arguments_keywords(rb_iseq_t *iseq, LINK_ANCHOR *const optargs,
const NODE *node = args->kw_args;
struct rb_iseq_constant_body *const body = ISEQ_BODY(iseq);
struct rb_iseq_param_keyword *keyword;
const VALUE default_values = rb_ary_tmp_new(1);
const VALUE default_values = rb_ary_hidden_new(1);
const VALUE complex_mark = rb_str_tmp_new(0);
int kw = 0, rkw = 0, di = 0, i;

Expand Down Expand Up @@ -1847,7 +1847,7 @@ iseq_set_arguments(rb_iseq_t *iseq, LINK_ANCHOR *const optargs, const NODE *cons
if (args->opt_args) {
const NODE *node = args->opt_args;
LABEL *label;
VALUE labels = rb_ary_tmp_new(1);
VALUE labels = rb_ary_hidden_new(1);
VALUE *opt_table;
int i = 0, j;

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

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

/* Create a hidden array */
for (; count; count--, node = node->nd_next)
Expand Down Expand Up @@ -4420,7 +4420,7 @@ static int
compile_array_1(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node)
{
if (static_literal_node_p(node, iseq)) {
VALUE ary = rb_ary_tmp_new(1);
VALUE ary = rb_ary_hidden_new(1);
rb_ary_push(ary, static_literal_value(node, iseq));
OBJ_FREEZE(ary);

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

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

/* Create a hidden hash */
for (; count; count--, node = node->nd_next->nd_next) {
Expand Down Expand Up @@ -4837,7 +4837,8 @@ struct masgn_state {
};

static int
add_masgn_lhs_node(struct masgn_state *state, int lhs_pos, const NODE *line_node, int argc, INSN *before_insn) {
add_masgn_lhs_node(struct masgn_state *state, int lhs_pos, const NODE *line_node, int argc, INSN *before_insn)
{
if (!state) {
rb_bug("no masgn_state");
}
Expand Down Expand Up @@ -12077,7 +12078,7 @@ ibf_dump_iseq_list_i(st_data_t key, st_data_t val, st_data_t ptr)
static void
ibf_dump_iseq_list(struct ibf_dump *dump, struct ibf_header *header)
{
VALUE offset_list = rb_ary_tmp_new(dump->iseq_table->num_entries);
VALUE offset_list = rb_ary_hidden_new(dump->iseq_table->num_entries);

struct ibf_dump_iseq_list_arg args;
args.dump = dump;
Expand Down Expand Up @@ -12349,7 +12350,7 @@ ibf_load_object_array(const struct ibf_load *load, const struct ibf_object_heade

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

VALUE ary = header->internal ? rb_ary_tmp_new(len) : rb_ary_new_capa(len);
VALUE ary = header->internal ? rb_ary_hidden_new(len) : rb_ary_new_capa(len);
int i;

for (i=0; i<len; i++) {
Expand Down Expand Up @@ -12744,7 +12745,7 @@ static void
ibf_dump_object_list(struct ibf_dump *dump, ibf_offset_t *obj_list_offset, unsigned int *obj_list_size)
{
st_table *obj_table = dump->current_buffer->obj_table;
VALUE offset_list = rb_ary_tmp_new(obj_table->num_entries);
VALUE offset_list = rb_ary_hidden_new(obj_table->num_entries);

struct ibf_dump_object_list_arg args;
args.dump = dump;
Expand Down
Loading

0 comments on commit 5b51d0f

Please sign in to comment.