Граф коммитов

81977 Коммитов

Автор SHA1 Сообщение Дата
Jemma Issroff e71f011713 [PRISM] Fix bugs in compiling optional keyword parameters
This PR fixes two bugs when compiling optional keyword parameters:
- It moves keyword parameter compilation to STEP 5 in the parameters
sequence, where the rest of compilation happens. This is important
because keyword parameter compilation relies on the value of
body->param.keyword->bits_start which gets set in an earlier step
- It compiles array and hash values for keyword parameters, which
it didn't previously
2023-12-14 11:46:54 -05:00
TSUYUSATO Kitsune 3658798dbb [ruby/prism] Make equality operators non-associative
Fix https://github.com/ruby/prism/pull/2073

https://github.com/ruby/prism/commit/0f747d9240
2023-12-14 16:39:05 +00:00
Jemma Issroff 8e1c148fd9 [PRISM] Use frozen flag on StringNode 2023-12-14 11:14:45 -05:00
Jeremy Evans a18819e65f Fix op asgn method calls passing mutable keyword splats
When passing the keyword splat to [], it cannot be mutable, because
mutating the keyword splat inside [] would result in changes to the
keyword splat passed to []=.
2023-12-14 08:13:43 -08:00
Burdette Lamar 247ce712fc
[DOC] RDoc for Complex (#9231) 2023-12-14 11:09:17 -05:00
David Rodríguez a79a1d3028 [rubygems/rubygems] Upgrade vendored libraries
To match the versions that will be included in final ruby release.

https://github.com/rubygems/rubygems/commit/84394919fb
2023-12-14 15:04:22 +00:00
Peter Zhu 912016f626 Call obj_free for T_DATA, T_FILE objects on exit
Previously, T_DATA and T_FILE objects did not have their instance
variables freed on exit which would be reported as a memory leak with
RUBY_FREE_ON_EXIT. This commit changes it to use obj_free which also
frees the generic instance variables.

Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
2023-12-14 08:52:32 -05:00
Hiroshi SHIBATA e3631277c3
Removed duplicated LICENSE files 2023-12-14 20:22:49 +08:00
Vít Ondruch 612616925b
[rubygems/rubygems] Allow "default_user_install" to be overridden.
For Ruby re-distributors, automatic user-install might be the right
default. Therefore printing warning about installing into user directory
is not always desirable. Let the default_user_install method be
customizable.

https://github.com/rubygems/rubygems/commit/2320dba544
2023-12-14 20:22:49 +08:00
David Rodríguez 45b511433d
[rubygems/rubygems] Improve install advice when some gems are not found
This problem is quite specific to our dev environment, but I guess the
fix could be handy for other situations.

After merging a change to treat default gems as regular gems, I get this
when trying to run `rubocop` on our repo:

```
$ bin/rubocop  --only Performance/RegexpMatch
Could not find json-2.6.3 in locally installed gems
Run `bundle install --gemfile /Users/deivid/code/rubygems/rubygems/tool/bundler/lint_gems.rb` to install missing gems.
```

However, when running the suggested command, nothing changes and I still
get the same error:

```
$ bundle install --gemfile /Users/deivid/code/rubygems/rubygems/tool/bundler/lint_gems.rb
Using ast 2.4.2
Using bundler 2.4.10
Using json 2.6.3
Using parallel 1.23.0
Using racc 1.7.1
Using parser 3.2.2.3
Using rainbow 3.1.1
Using regexp_parser 2.8.1
Using rexml 3.2.5
Using rubocop-ast 1.29.0
Using ruby-progressbar 1.13.0
Using unicode-display_width 2.4.2
Using rubocop 1.52.1
Using rubocop-performance 1.14.2
Bundle complete! 2 Gemfile dependencies, 14 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

$ bin/rubocop  --only Performance/RegexpMatch
Could not find json-2.6.3 in locally installed gems
Run `bundle install --gemfile /Users/deivid/code/rubygems/rubygems/tool/bundler/lint_gems.rb` to install missing gems.
```

The problem is that our `bin/rubocop` script uses the development
version of Bundler (which has the change causing the problem), but the
advice recommands the default version of Bundler, which does not yet
have the change.

This commit changes the advice to recommend to use the same version of
Bundler that run into the problem in the first place.

So in the above situation you now get:

```
$ bin/rubocop  --only Performance/RegexpMatch
Could not find json-2.6.3 in locally installed gems
Run `/Users/deivid/code/rubygems/rubygems/bundler/exe/bundle install --gemfile /Users/deivid/code/rubygems/rubygems/tool/bundler/lint_gems.rb` to install missing gems.
```

And running that fixes the problem:

```
$ /Users/deivid//rubygems/rubygems/bundler/exe/bundle install --gemfile /Users/deivid/code/rubygems/rubygems/tool/bundler/lint_gems.rb
Fetching gem metadata from https://rubygems.org/.........
Fetching json 2.6.3
Installing json 2.6.3 with native extensions
Bundle complete! 2 Gemfile dependencies, 14 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
```

https://github.com/rubygems/rubygems/commit/10a9588c6d
2023-12-14 20:22:48 +08:00
David Rodríguez d718654bb1
[rubygems/rubygems] Remove extension building sync stuff no longer present in RubyGems
https://github.com/rubygems/rubygems/commit/59a85388b9
2023-12-14 20:22:48 +08:00
David Rodríguez 41095f4de0
[rubygems/rubygems] RubyGems > 3.2.0.rc.1 is now always provided
https://github.com/rubygems/rubygems/commit/929b521f3a
2023-12-14 20:22:48 +08:00
David Rodríguez 778438d423
[rubygems/rubygems] Gem::Specification always has `default_stubs` now
https://github.com/rubygems/rubygems/commit/30db1eb4a5
2023-12-14 20:22:48 +08:00
David Rodríguez 5cf6f7f885
[rubygems/rubygems] Remove more methods now defined in all RubyGems versions
https://github.com/rubygems/rubygems/commit/e015200ffa
2023-12-14 20:22:48 +08:00
David Rodríguez 7564038864
[rubygems/rubygems] Remove check only necessary for ancient RubyGems
https://github.com/rubygems/rubygems/commit/ffa2f03489
2023-12-14 20:22:48 +08:00
David Rodríguez 04dd2a8aae
[rubygems/rubygems] This patch should be no longer needed
https://github.com/rubygems/rubygems/commit/1139e90931
2023-12-14 20:22:48 +08:00
David Rodríguez b45c1523a8
[rubygems/rubygems] Gem::Specification.find_all_by_name is always defined now
https://github.com/rubygems/rubygems/commit/1d61c7686b
2023-12-14 20:22:48 +08:00
David Rodríguez b300f5a0e1
[rubygems/rubygems] Revert "Improve default gem handling"
This reverts commit https://github.com/rubygems/rubygems/commit/091b4fcf2b99.

https://github.com/rubygems/rubygems/commit/dcade3235f
2023-12-14 20:22:48 +08:00
Matt Valentine-House a10c11a66b [PRISM] Add anon KW args to the block local table 2023-12-14 07:01:19 -05:00
Satoshi Tagomori e51f9e9f75 rb_ext_resolve_symbol: C API to resolve and return externed symbols [Feature #20005]
This is a C API for extensions to resolve and get function symbols of other extensions.
Extensions can check the expected symbol is correctly loaded and accessible, and
use it if it is available.
Otherwise, extensions can raise their own error to guide users to setup their
environments correctly and what's missing.
2023-12-14 17:39:42 +09:00
Satoshi Tagomori 8a37df8c8b dln_symbol: make dln_sym accessible Ruby internally
The symbol resolved by dln_symbol will eventually be passed to
extensions. The error handling of dln_sym is also separated into
dln_sym_func because the new call resolving symbols will not raise
LoadError.
2023-12-14 17:39:42 +09:00
git 35a6b69f6c Update bundled gems list at 1b1d5e757e [ci skip] 2023-12-14 07:39:19 +00:00
Shugo Maeda 1b1d5e757e
Bump up bundled net-ftp gem version to 0.3.2 2023-12-14 16:38:39 +09:00
git 2c5e2ce2cc Update bundled gems list at 26145a27f6 [ci skip] 2023-12-14 06:51:54 +00:00
Shugo Maeda 26145a27f6
Bump up bundled net-ftp gem version to 0.3.1 2023-12-14 15:51:12 +09:00
Kevin Newton b7e89d4b17 [ruby/prism] Fix hash pattern rest
https://github.com/ruby/prism/commit/43c4232cfc
2023-12-14 02:43:32 +00:00
Kazuhiro NISHIYAMA 74b6e70ef4
Fold a long line [ci skip] 2023-12-14 09:54:23 +09:00
Drew Stevenson beefce1444 [rubygems/rubygems] Warn for duplicate meta data links
Match order of METADATA_LINK_KEYS to order used by rubygems.org in Links model.
Add missing download_uri key.

https://github.com/rubygems/rubygems/commit/d2922cd6e9
2023-12-14 00:06:05 +00:00
John Hawthorn d7dad64465 Unlock freelist before assigning
Co-authored-by: Matthew Draper <matthew@trebex.net>
2023-12-13 15:26:52 -08:00
Martin Emde c1f4bfd41f [rubygems/rubygems] Revert "Merge pull request #7167 from nevinera/add-json-output-option-to-bundle-outdated"
This reverts commit https://github.com/rubygems/rubygems/commit/a4ac5116b8ea, reversing
changes made to https://github.com/rubygems/rubygems/commit/8a6b180d0ae5.

https://github.com/rubygems/rubygems/commit/a1efe4015d
2023-12-13 22:50:45 +00:00
Hiroshi SHIBATA 5a0cbc9344 Detect bootsnap from all frames 2023-12-14 07:48:08 +09:00
Hiroshi SHIBATA 8b0c626962 Skip warning feature with Bootsnap
Bootsnap modified full feature path to require. We can't handle it for
  warning correctly.
2023-12-14 07:48:08 +09:00
Akira Matsuda 75c40802cb [Bug #20060] Properly return matched gem name in case of EXACT
this follows up 4e6861d337
2023-12-14 07:47:56 +09:00
Samuel Giddins baf2ec2ca8 [rubygems/rubygems] Use match? when regexp match data is unused
Improved performance / reduced allocations

https://github.com/rubygems/rubygems/commit/b04726c9a7
2023-12-13 22:00:26 +00:00
Takashi Kokubun b266890dab
YJIT: Add --yjit-disable to help and reorder it (#9230) 2023-12-13 13:29:37 -08:00
Martin Emde 7f4b271a61 [rubygems/rubygems] Store Checksum::Store indexed by spec.lock_name
https://github.com/rubygems/rubygems/commit/34d6c6c72f
2023-12-13 20:28:37 +00:00
Takashi Kokubun 14c7895c21 Fix a typo in yjit.md 2023-12-13 11:50:35 -08:00
Ufuk Kayserilioglu 31c0ea20e5 [PRISM] Add a test with a non-static-literal hash key 2023-12-13 14:15:09 -05:00
Samuel Giddins 6aa26af683 [rubygems/rubygems] Add 3.4 as a supported ruby version
Since ruby trunk will be 3.4 very soon

https://github.com/rubygems/rubygems/commit/36dd9a35dc
2023-12-13 19:02:24 +00:00
eileencodes 110dbf62ac [Prism] Fix InterpolatedMatchLastLine Instructions
I looked at this at RubyConf with Kevin, and we noticed that there was a
`putobject` empty string missing from the instructions. I just got back
around to implementing this and pushing a PR and while doing that
noticed that we also have a `getspecial` when we want a `getglobal`.

This change adds the `putobject` instruction and replaces the
`getspecial` with a `getglobal`. If we look at the parsetree for the
following code:

```ruby
$pit = '.oo'; if /"#{$pit}"/mix; end
```

We can see it has a `NODE_GVAR` and the [Ruby
compiler](a4b43e9264/compile.c (L10024-L10030)) shows that should
use `getglobal.

```
 @ NODE_SCOPE (id: 14, line: 1, location: (1,0)-(22,36))
 +- nd_tbl: (empty)
 +- nd_args:
 |   (null node)
 +- nd_body:
     @ NODE_BLOCK (id: 12, line: 22, location: (22,0)-(22,36))
     +- nd_head (1):
     |   @ NODE_GASGN (id: 0, line: 22, location: (22,0)-(22,12))*
     |   +- nd_vid: :$pit
     |   +- nd_value:
     |       @ NODE_STR (id: 1, line: 22, location: (22,7)-(22,12))
     |       +- nd_lit: ".oo"
     +- nd_head (2):
         @ NODE_IF (id: 11, line: 22, location: (22,14)-(22,36))*
         +- nd_cond:
         |   @ NODE_MATCH2 (id: 10, line: 22, location: (22,14)-(22,36))
         |   +- nd_recv:
         |   |   @ NODE_DREGX (id: 2, line: 22, location: (22,17)-(22,31))
         |   |   +- nd_lit: "\""
         |   |   +- nd_next->nd_head:
         |   |   |   @ NODE_EVSTR (id: 4, line: 22, location: (22,19)-(22,26))
         |   |   |   +- nd_body:
         |   |   |       @ NODE_GVAR (id: 3, line: 22, location: (22,21)-(22,25))
         |   |   |       +- nd_vid: :$pit
         |   |   +- nd_next->nd_next:
         |   |       @ NODE_LIST (id: 7, line: 22, location: (22,26)-(22,27))
         |   |       +- as.nd_alen: 1
         |   |       +- nd_head:
         |   |       |   @ NODE_STR (id: 6, line: 22, location: (22,26)-(22,27))
         |   |       |   +- nd_lit: "\""
         |   |       +- nd_next:
         |   |           (null node)
         |   +- nd_value:
         |       @ NODE_GVAR (id: 9, line: 22, location: (22,14)-(22,36))
         |       +- nd_vid: :$_
         +- nd_body:
         |   @ NODE_BEGIN (id: 8, line: 22, location: (22,32)-(22,32))
         |   +- nd_body:
         |       (null node)
         +- nd_else:
             (null node)
```

I'm struggling with writing a failing test, but the before/after
instructions show that `getglobal` is correct here. I compared the
instructions for the  other `InterpolatedMatchLastLine` node tests
and they also used `getglobal`. I've edited the existing
`InterpolatedLastMatchLineNode` test so that it will use that instruction when
copied out of the test. Without the quotes it thinks it's just a
`MatchLastLineNode`.

Incorrect instructions:

```
"********* Ruby *************"
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(22,36)>
0000 putstring                              ".oo"                     (  22)[Li]
0002 setglobal                              :$pit
0004 putobject                              "\""
0006 getglobal                              :$pit
0008 dup
0009 objtostring                            <calldata!mid:to_s, argc:0, FCALL|ARGS_SIMPLE>
0011 anytostring
0012 putobject                              "\""
0014 toregexp                               7, 3
0017 getglobal                              :$_
0019 send                                   <calldata!mid:=~, argc:1, ARGS_SIMPLE>, nil
0022 branchunless                           30
0024 jump                                   26
0026 putnil
0027 jump                                   31
0029 pop
0030 putnil
0031 leave

"********* PRISM *************"
== disasm: #<ISeq:<compiled>@<compiled>:21 (21,0)-(21,36)>
0000 putstring                              ".oo"                     (  21)[Li]
0002 setglobal                              :$pit
0004 putobject                              "\""
0006 getglobal                              :$pit
0008 dup
0009 objtostring                            <calldata!mid:to_s, argc:0, FCALL|ARGS_SIMPLE>
0011 anytostring
0012 putobject                              "\""
0014 toregexp                               7, 3
0017 getspecial                             0, 0
0020 send                                   <calldata!mid:=~, argc:1, ARGS_SIMPLE>, nil
0023 branchunless                           31
0025 jump                                   27
0027 putnil
0028 jump                                   32
0030 pop
0031 putnil
0032 leave
```

Fixed instructions:

```
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(22,36)>
0000 putstring                              ".oo"                     (  22)[Li]
0002 setglobal                              :$pit
0004 putobject                              "\""
0006 getglobal                              :$pit
0008 dup
0009 objtostring                            <calldata!mid:to_s, argc:0, FCALL|ARGS_SIMPLE>
0011 anytostring
0012 putobject                              "\""
0014 toregexp                               7, 3
0017 getglobal                              :$_
0019 send                                   <calldata!mid:=~, argc:1, ARGS_SIMPLE>, nil
0022 branchunless                           30
0024 jump                                   26
0026 putnil
0027 jump                                   31
0029 pop
0030 putnil
0031 leave

"********* PRISM *************"
== disasm: #<ISeq:<compiled>@<compiled>:21 (21,0)-(21,36)>
0000 putstring                              ".oo"                     (  21)[Li]
0002 setglobal                              :$pit
0004 putobject                              "\""
0006 getglobal                              :$pit
0008 dup
0009 objtostring                            <calldata!mid:to_s, argc:0, FCALL|ARGS_SIMPLE>
0011 anytostring
0012 putobject                              "\""
0014 toregexp                               7, 3
0017 getglobal                              :$_
0019 send                                   <calldata!mid:=~, argc:1, ARGS_SIMPLE>, nil
0022 branchunless                           30
0024 jump                                   26
0026 putnil
0027 jump                                   31
0029 pop
0030 putnil
0031 leave
```
2023-12-13 13:42:17 -05:00
Takashi Kokubun ea4a4c302c [PRISM] Fix a -Wformat-zero-length warning
../prism_compile.c: In function ‘pm_compile_node’:
../prism_compile.c:2330:20: warning: zero-length gnu_printf format string [-Wformat-zero-length]
 2330 |             rb_bug("");
      |                    ^~
2023-12-13 10:28:20 -08:00
John Hawthorn 02528f647d [PRISM] Use xcalloc for iseq id table
We use xfree on the other end, so we need to use a form of xmalloc here.

Co-authored-by: Matthew Draper <matthew@trebex.net>
2023-12-13 10:20:11 -08:00
John Hawthorn b55de590f3 [PRISM] Fix st_table memory leak
Co-authored-by: Matthew Draper <matthew@trebex.net>
2023-12-13 10:20:11 -08:00
Alan Wu a3b48ac9ad Fix memory leak in Hash#compare_by_identity
We didn't free the old ST before overwriting it which caused a leak.
Found with RUBY_FREE_ON_EXIT.

Co-authored-by: Peter Zhu <peter@peterzhu.ca>
2023-12-13 09:43:09 -08:00
Takashi Kokubun cc86fa8416 Skip an unstable test on MinGW
This test fails fairly frequently on MinGW:
https://github.com/ruby/ruby/actions/runs/7195712496/job/19598924253#step:11:168
https://github.com/ruby/ruby/actions/runs/7191246799/job/19585627182#step:11:168

and we aren't actively working on stabilizing tests for MinGW.
2023-12-13 09:40:54 -08:00
Takashi Kokubun 0f1c7e3bcb
RJIT: Just skip generating code for aarch64/arm64 (#9221) 2023-12-13 09:36:06 -08:00
tomoya ishida c83a648fc8 [ruby/irb] Remove unused lvar in mesure command test
(https://github.com/ruby/irb/pull/814)

https://github.com/ruby/irb/commit/320178b120
2023-12-13 17:05:35 +00:00
David Rodríguez a4b43e9264 [rubygems/rubygems] Add missing resolv, timeout, and net-protocol licenses
https://github.com/rubygems/rubygems/commit/00694651a3
2023-12-13 15:47:43 +00:00
Peter Zhu f8ddcecbdf [Bug #20061] Clear mark bits when rb_free_on_exit
When compiling with cppflags=-DRGENGC_CHECK_MODE, the following crashes:

```
$ RUBY_FREE_ON_EXIT=1 ./miniruby -e 0
-e: [BUG] obj_free: RVALUE_MARKED(0x0000000103570020 [3LM    ] T_CLASS (anon)) != FALSE
```

This commit clears the mark bits when rb_free_on_exit is enabled.
2023-12-13 10:39:06 -05:00
Jeremy Evans 0d53dba7ce Make String#chomp! raise ArgumentError for 2+ arguments if string is empty
String#chomp! returned nil without checking the number of passed
arguments in this case.
2023-12-13 07:05:21 -08:00