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

82740 Коммитов

Автор SHA1 Сообщение Дата
Alan Wu 03645d1eef
YJIT: Support empty splat and some block_arg calls to ivar getters (#9567)
These seem odd at first glance, but they're used with `...` calls with
`Module#delegate` from Active Support. These account for ~3% of fallback
reasons in the `lobsters` benchmark.
2024-01-17 10:52:15 -05:00
Kevin Newton 3f23cb1a43 [ruby/prism] Remove flag gating for 3.3.0 bug fixes
https://github.com/ruby/prism/commit/64baf94271
2024-01-17 15:51:36 +00:00
Maxime Chevalier-Boisvert afba09d30f
YJIT: specialized codegen for integer right shift (#9564)
* YJIT: specialized codegen for integer right shift

Used in optcarrot. May also be used to write pure-Ruby gems.
No overflow check or fixnum untagging required.

* Update yjit/src/codegen.rs

Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>

---------

Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
2024-01-17 10:35:48 -05:00
eileencodes 63ff29cdb4 [Prism] Fix return test
This test didn't work as is because it causes a SyntaxError. Instead we
need to put the `defined?(return)` into a method and call that. I double
checked that on the `master` branch this returns an Unsupported node
error.
2024-01-17 10:17:59 -05:00
eileencodes dcf9d77b45 [Prism] Implement defined? for PM_BEGIN_NODE
Ruby code:

```ruby
defined?(begin; 1; end)
```

Instructions:

```
"********* Ruby *************"
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(59,23)>
0000 putobject                              "expression"              (  59)[Li]
0002 leave
"********* PRISM *************"
== disasm: #<ISeq:<compiled>@<compiled>:58 (58,0)-(58,23)>
0000 putobject                              "expression"              (  58)[Li]
0002 leave
```

Related: ruby/prism#2188
2024-01-17 10:17:59 -05:00
eileencodes 338aa465c0 [Prism] Implement defined? for PM_RETRY_NODE
Ruby code:

```ruby
defined?(retry)
```

Instructions:

```
"********* Ruby *************"
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(59,15)>
0000 putobject                              "expression"              (  59)[Li]
0002 leave
"********* PRISM *************"
== disasm: #<ISeq:<compiled>@<compiled>:58 (58,0)-(58,15)>
0000 putobject                              "expression"              (  58)[Li]
0002 leave
```

Related: ruby/prism#2188
2024-01-17 10:17:59 -05:00
eileencodes 8774abad55 [Prism] Implement defined? for PM_RETURN_NODE
Ruby code:

```ruby
defined?(return)
```

Instructions:

```
"********* Ruby *************"
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(59,16)>
0000 putobject                              "expression"              (  59)[Li]
0002 leave
"********* PRISM *************"
== disasm: #<ISeq:<compiled>@<compiled>:58 (58,0)-(58,16)>
0000 putobject                              "expression"              (  58)[Li]
0002 leave
```

Related: ruby/prism#2188
2024-01-17 10:17:59 -05:00
eileencodes d0a7c33f05 [Prism] Implement defined? for PM_REDO_NODE
Ruby code:

```ruby
defined?(redo)
```

Instructions:

```
"********* Ruby *************"
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(59,14)>
0000 putobject                              "expression"              (  59)[Li]
0002 leave
"********* PRISM *************"
== disasm: #<ISeq:<compiled>@<compiled>:58 (58,0)-(58,14)>
0000 putobject                              "expression"              (  58)[Li]
0002 leave
```

Related: ruby/prism#2188
2024-01-17 10:17:59 -05:00
eileencodes 2697acf7ff [Prism] Implement defined? for PM_INTERPOLATED_X_STRING_NODE
Ruby code:

```ruby
defined?(`echo #{1}`)
```

Instructions:

```
"********* Ruby *************"
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(59,21)>
0000 putobject                              "expression"              (  59)[Li]
0002 leave
"********* PRISM *************"
== disasm: #<ISeq:<compiled>@<compiled>:58 (58,0)-(58,21)>
0000 putobject                              "expression"              (  58)[Li]
0002 leave
```

Related: ruby/prism#2188
2024-01-17 10:17:59 -05:00
eileencodes e0c90199c9 [Prism] Implement defined? for PM_INTERPOLATED_SYMBOL_NODE
Ruby code:

```ruby
defined?(:"1 #{1 + 2} 1")
```

Instructions:

```
"********* Ruby *************"
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(59,25)>
0000 putobject                              "expression"              (  59)[Li]
0002 leave
"********* PRISM *************"
== disasm: #<ISeq:<compiled>@<compiled>:58 (58,0)-(58,25)>
0000 putobject                              "expression"              (  58)[Li]
0002 leave
```

Related: ruby/prism#2188
2024-01-17 10:17:59 -05:00
eileencodes 25f1a8e447 [Prism] Implement defined? for PM_DEFINED_NODE
Ruby code:

```ruby
defined?(defined?(a))
```

Instructions:

```
"********* Ruby *************"
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(59,21)>
0000 putobject                              "expression"              (  59)[Li]
0002 leave
"********* PRISM *************"
== disasm: #<ISeq:<compiled>@<compiled>:58 (58,0)-(58,21)>
0000 putobject                              "expression"              (  58)[Li]
0002 leave
```

Related: ruby/prism#2188
2024-01-17 10:17:59 -05:00
eileencodes 82ed90950e [Prism] Implement defined? for PM_BREAK_NODE
Ruby code:

```ruby
defined?(break)
```

Instructions:

```
"********* Ruby *************"
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(59,15)>
0000 putobject                              "expression"              (  59)[Li]
0002 leave
"********* PRISM *************"
== disasm: #<ISeq:<compiled>@<compiled>:58 (58,0)-(58,15)>
0000 putobject                              "expression"              (  58)[Li]
0002 leave
```

Related: ruby/prism#2188
2024-01-17 10:17:59 -05:00
eileencodes 0c814092ee [Prism] Implement defined for PM_NEXT_NODE
Ruby code:

```ruby
defined?(next)
```

Instructions

```
"********* Ruby *************"
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(59,15)>
0000 putobject                              "expression"              (  59)[Li]
0002 leave
"********* PRISM *************"
== disasm: #<ISeq:<compiled>@<compiled>:58 (58,0)-(58,15)>
0000 putobject                              "expression"              (  58)[Li]
0002 leave
```

Related: ruby/prism#2188
2024-01-17 10:17:59 -05:00
Peter Zhu 3a7ad808b1 [PRISM] Fix test_compile_prism_with_file
The test should be testing RubyVM::InstructionSequence.compile_prism
with a file but it is instead passing the file path (which is a string)
which raises a SyntaxError because it is not Ruby syntax.
2024-01-17 10:15:02 -05:00
Matt Valentine-House ef4a08eb65 [PRISM] Fix stack inconsistency in MultiWriteNode 2024-01-17 14:48:46 +00:00
Peter Zhu e17c83e02c Fix memory leak in String#tr and String#tr_s
rb_enc_codepoint_len could raise, which would cause the memory in buf
to leak.

For example:

    str1 = "\xE0\xA0\xA1#{" " * 100}".force_encoding("EUC-JP")
    str2 = ""
    str3 = "a".force_encoding("Windows-31J")

    10.times do
      1_000_000.times do
        str1.tr_s(str2, str3)
      rescue
      end

      puts `ps -o rss= -p #{$$}`
    end

Before:

    17536
    22752
    28032
    33312
    38688
    43968
    49200
    54432
    59744
    64992

After:

    12176
    12352
    12352
    12448
    12448
    12448
    12448
    12448
    12448
    12448
2024-01-17 08:54:25 -05:00
git 67a545b3d2 * expand tabs. [ci skip]
Please consider using misc/expand_tabs.rb as a pre-commit hook.
2024-01-17 13:26:15 +00:00
Adam Hess 13879fea69 [ruby/prism] Fix prism brace association for constant-like method/local calls
https://github.com/ruby/prism/commit/8ca24f263e
2024-01-17 13:26:05 +00:00
Nobuyoshi Nakada c68ce6f7f5
Skip checking for symbol leaks in libruby.so linking extensions
The libruby.so linking extension libraries contain symbols exported
from extension libraries, and is not subject of test-leaked-globals.
2024-01-17 19:37:56 +09:00
Nobuyoshi Nakada 6215b5ba98 Fix off-by-one error of argc
Fix ruby/ruby#9562
2024-01-17 18:26:39 +09:00
dependabot[bot] 4216880261 Bump actions/cache from 3.3.3 to 4.0.0
Bumps [actions/cache](https://github.com/actions/cache) from 3.3.3 to 4.0.0.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](e12d46a63a...13aacd865c)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-17 13:13:43 +09:00
dependabot[bot] 6b11cfe0bc Bump actions/cache in /.github/actions/setup/directories
Bumps [actions/cache](https://github.com/actions/cache) from 3.3.3 to 4.0.0.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](e12d46a63a...13aacd865c)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-17 12:49:55 +09:00
Nobuyoshi Nakada bf254b4de1
Omit low-memory test on old platforms 2024-01-17 12:39:23 +09:00
dependabot[bot] 2c3876be94 Bump ruby/setup-ruby from 1.165.1 to 1.167.0
Bumps [ruby/setup-ruby](https://github.com/ruby/setup-ruby) from 1.165.1 to 1.167.0.
- [Release notes](https://github.com/ruby/setup-ruby/releases)
- [Commits](360dc864d5...b203567269)

---
updated-dependencies:
- dependency-name: ruby/setup-ruby
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-16 18:57:01 -08:00
Takashi Kokubun 8642a573e6 Rename BUILTIN_ATTR_SINGLE_NOARG_INLINE
to BUILTIN_ATTR_SINGLE_NOARG_LEAF

The attribute was created when the other attribute was called BUILTIN_ATTR_INLINE.
Now that the original attribute is renamed to BUILTIN_ATTR_LEAF, it's
only confusing that we call it "_INLINE".
2024-01-16 17:31:27 -08:00
Takashi Kokubun e37a37e696 Drop obsoleted BUILTIN_ATTR_NO_GC attribute
The thing that has used this in the past was very buggy, and we've never
revisied it. Let's remove it until we need it again.
2024-01-16 17:27:53 -08:00
Mark Young 1addb3955c [ruby/psych] Provide a 'Changelog' link on rubygems.org/gems/psych
By providing a 'changelog_uri' in the metadata of the gemspec
a 'Changelog' link will be shown on https://rubygems.org/gems/psych
which makes it quick and easy for someone to check on the changes
introduced with a new version.

Details of this functionality can be found on https://guides.rubygems.org/specification-reference/

https://github.com/ruby/psych/commit/28ef10edcf
2024-01-17 00:48:52 +00:00
Colin Kelley 77593495f7 [ruby/psych] issue #443: drop special tests for y, Y, n, N since they covered in the more general test
https://github.com/ruby/psych/commit/6750b35402
2024-01-17 00:45:06 +00:00
Colin Kelley 8ae24e6b08 [ruby/psych] issue #443: quote Y and N when dumping
https://github.com/ruby/psych/commit/93c8fb443a
2024-01-17 00:45:06 +00:00
Hiroshi SHIBATA cf8fb94295
CHECK_LEAKS is always enabled with 01459f1 2024-01-17 09:02:04 +09:00
Takashi Kokubun b4ed5b7dfe
Bump the required BASERUBY version to 2.7 (#9566)
[[Misc #16671]](https://bugs.ruby-lang.org/issues/16671)
2024-01-16 15:54:17 -08:00
git 88bb09b3be Update bundled gems list at 6c016a4197 [ci skip] 2024-01-16 23:29:01 +00:00
Hiroshi SHIBATA 6c016a4197 Inject base64 for basic auth examples of bundler 2024-01-17 08:28:31 +09:00
Hiroshi SHIBATA 42aa24a24c No longer needed to sync base64 2024-01-17 08:28:31 +09:00
Hiroshi SHIBATA afb30eb265 spec/mspec/tool/wrap_with_guard.rb 'ruby_version_is ""..."3.4"' spec/ruby/library/base64/**/*_spec.rb 2024-01-17 08:28:31 +09:00
Hiroshi SHIBATA 05e798269f Document about base64 at Ruby 3.4 2024-01-17 08:28:31 +09:00
Hiroshi SHIBATA 4e2eca3be0 Extract base64 as bundled gems 2024-01-17 08:28:31 +09:00
Alan Wu 2bf9970101 YJIT: Finer breakdown for block_arg counters
For example, on `lobsters` the block_arg reason was at ~10%. With this
change it shows that 6% of that is `send_cfunc_block_arg`.
2024-01-16 16:54:34 -05:00
Peter Zhu 5471f99eea [PRISM] Fix memory leak when compiling file
There is a memory leak when passing a file to
RubyVM::InstructionSequence.compile_prism because it does not free the
mapped file.

For example:

    require "tempfile"

    Tempfile.create(%w"test_iseq .rb") do |f|
      f.puts "name = 'Prism'; puts 'hello'"
      f.close

      10.times do
        1_000.times do
          RubyVM::InstructionSequence.compile_prism(f)
        end

        puts `ps -o rss= -p #{$$}`
      end
    end

Before:

    27968
    44848
    61408
    77872
    94144
    110432
    126640
    142816
    159200
    175584

After:

    11504
    12144
    12592
    13072
    13488
    13664
    14064
    14368
    14704
    15168
2024-01-16 16:19:43 -05:00
Kevin Newton 7b6731b1bb [ruby/prism] Provide abstract methods in Prism::Node
To make typechecking easier.

https://github.com/ruby/prism/commit/8f96877d7a
2024-01-16 20:25:50 +00:00
Cameron Dutro 8cbba87ca8 [ruby/prism] Add parse options to JavaScript's parsePrism function
https://github.com/ruby/prism/commit/d7fe7c7ae7
2024-01-16 19:19:30 +00:00
Kevin Newton d124124c16 [ruby/prism] Fix up gemspec
https://github.com/ruby/prism/commit/82e3126762
2024-01-16 19:01:36 +00:00
Jemma Issroff 8bf12d7b2f [ruby/prism] First pass at documenting information about the CRuby compiler
https://github.com/ruby/prism/commit/b575914b2f
2024-01-16 18:47:48 +00:00
Peter Zhu 07b9b53459 [PRISM] Fix crash with empty ensure blocks
Fixes ruby/prism#2179.
2024-01-16 12:55:57 -05:00
Matt Valentine-House 7bd7030a96 [PRISM] Replace local lookup recursion with loop 2024-01-16 12:43:53 -05:00
Peter Zhu 70a8ed0775 [PRISM] Don't allocate labels when not needed
The labels lstart, lend, lcont are only needed when there is a rescue
clause. They are not needed when there is only an ensure clause or
neither.
2024-01-16 12:43:14 -05:00
Peter Zhu 1caa881a56 [PRISM] Fix splat assignment
Fixes ruby/prism#2177
2024-01-16 11:12:06 -05:00
TSUYUSATO Kitsune c5e43da426 [ruby/prism] Correct the "ambiguous first argument" condition
Fix https://github.com/ruby/prism/pull/2182

This change reflects this line:
6283ae8d36/parse.y (L11124).

https://github.com/ruby/prism/commit/a52588ff37
2024-01-16 15:51:09 +00:00
Nobuyoshi Nakada 6283ae8d36 [ruby/stringio] Update the coderange after overwrite
Fix https://bugs.ruby-lang.org/issues/20185

https://github.com/ruby/stringio/commit/8230552a46
2024-01-16 15:06:22 +00:00
Matt Valentine-House fef8ccff11 Rename pm_lookup_local_index_any_scope
Now it's the only local lookup function we can just call it
pm_lookup_local_index
2024-01-16 14:58:55 +00:00