82506 Commits

Author SHA1 Message Date
yui-knk
db476cc71c Introduce NODE_SYM to manage symbol literal
`:sym` was managed by `NODE_LIT` with `Symbol` object.
This commit introduces `NODE_SYM` so that

1. Symbol literal is detectable from AST Node
2. Reduce dependency on ruby object
2024-01-09 16:07:19 +09:00
Hiroshi SHIBATA
f82a6172a2
Avoid the duplicated entries of GitHub releases 2024-01-09 14:53:22 +09:00
Nobuyoshi Nakada
4b01983bf8
Simplify empty hahs with DSTAR 2024-01-09 13:05:34 +09:00
Nobuyoshi Nakada
a4406bc89a
Extract repeating NODE references as a local variable 2024-01-09 13:04:26 +09:00
Peter Zhu
37ed86fd3c Fix memory leak in regexp grapheme clusters
[Bug #20161]

The cc->mbuf gets overwritten, so we need to free it to not leak memory.

For example:

    str = "hello world".encode(Encoding::UTF_32LE)

    10.times do
      1_000.times do
        str.grapheme_clusters
      end

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

Before:

    15536
    15760
    15920
    16144
    16304
    16480
    16640
    16784
    17008
    17280

After:

    15584
    15584
    15760
    15824
    15888
    15888
    15888
    15888
    16048
    16112
2024-01-08 19:50:34 -05:00
Takashi Kokubun
0a30fc6211 Remove obsoleted lldb_yjit.py
which clearly seems to be written for Ruby 3.1 YJIT that was not
rewritten in Rust yet. Since it has been left there as is, I don't think
anybody is actively using this script. We could add a new one if we need
it again.
2024-01-08 15:51:15 -08:00
yui-knk
5ecf2d2880 Use strcmp to compare strings 2024-01-09 07:42:44 +09:00
Avdi Grimm
544c87d009 [rubygems/rubygems] Refer to underscores as underscores
https://github.com/rubygems/rubygems/commit/aa3ae5d245
2024-01-08 21:45:25 +00:00
Koichi Sasada
41dd15944f fix rb_thread_wait_for_single_fd on non MN case
`rb_thread_wait_for_single_fd(fd)` waits until `fd` is ready.
Without MN it shouldn't use `thread_io_wait_events()` for the
retry checking (alwasy false if MN is not active).
2024-01-09 05:43:28 +09:00
Matt Valentine-House
47ff4a1658 [PRISM] Blocks should track the found local depth
Rather than rely purely on local depth offset. This is because we can't
assume a specific depth offset for all variable accesses happening
within a block in the same way that we can for rescue/ensure/for or
other nodes that push scopes.

This is because block parameters are defined in the scope level, so we
always need to start from the top most scope and walk backwards.

Fixes ruby/prism@2053
2024-01-08 19:55:26 +00:00
dependabot[bot]
94a98ce632 [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.85 to 0.9.86.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.85...v0.9.86)

---
updated-dependencies:
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

https://github.com/rubygems/rubygems/commit/6ec9f14b61
2024-01-08 19:40:44 +00:00
dependabot[bot]
4c3c5b645f [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.85 to 0.9.86.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.85...v0.9.86)

---
updated-dependencies:
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

https://github.com/rubygems/rubygems/commit/070a6d9398
2024-01-08 19:40:28 +00:00
Matthew Healy
c39c49cb24 [ruby/prism] Add missing comment key
https://github.com/ruby/prism/commit/723480a107
2024-01-08 18:47:18 +00:00
matthew healy
eef74d8367 [ruby/prism] Fix spacing in documentation comment
https://github.com/ruby/prism/commit/8408961e76

Co-authored-by: Kevin Newton <kddnewton@gmail.com>
2024-01-08 18:47:17 +00:00
Matthew Healy
d02455afc1 [ruby/prism] Add comments documenting RangeNode fields
https://github.com/ruby/prism/commit/e6aef6499b
2024-01-08 18:47:17 +00:00
matthew healy
1e7d1da3b0 [ruby/prism] Clarify keys and values in AssocNode must be non-void
https://github.com/ruby/prism/commit/0caca53a2c

Co-authored-by: Kevin Newton <kddnewton@gmail.com>
2024-01-08 18:47:06 +00:00
Matthew Healy
b57c5e560e [ruby/prism] Add comments for AssocSplatNode fields
https://github.com/ruby/prism/commit/a0fd874848
2024-01-08 18:47:06 +00:00
Matthew Healy
04ae8fb3a9 [ruby/prism] Add comments for AssocNode fields
https://github.com/ruby/prism/commit/fb60072a1e
2024-01-08 18:47:06 +00:00
Matthew Healy
7e09dd433b [ruby/prism] Add comments for HashNode fields
https://github.com/ruby/prism/commit/649e209519
2024-01-08 18:47:05 +00:00
Takashi Kokubun
a0eecfb5ba
YJIT: Fallback Integer#<< if a shift amount varies (#9426)
* YJIT: Fallback Integer#<< if a shift amount varies

* YJIT: Do not fallback lshift in the first chain
2024-01-08 17:34:57 +00:00
Peter Zhu
85a7da742a [DOC] Escape File in documentation 2024-01-08 11:30:29 -05:00
Kevin Newton
d1d50a0505 [ruby/prism] Handle parsing a line break in a receiver of a method
https://github.com/ruby/prism/commit/4d5f43ecbc
2024-01-08 14:34:59 +00:00
Peter Zhu
b3d6128049 Fix memory leak in grapheme clusters
[Bug #20150]

String#grapheme_cluters and String#each_grapheme_cluster leaks memory
because if the string is not UTF-8, then the created regex will not
be freed.

For example:

    str = "hello world".encode(Encoding::UTF_32LE)

    10.times do
      1_000.times do
        str.grapheme_clusters
      end

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

Before:

    26000
    42256
    59008
    75792
    92528
    109232
    125936
    142672
    159392
    176160

After:

    9264
    9504
    9808
    10000
    10128
    10224
    10352
    10544
    10704
    10896
2024-01-08 09:14:04 -05:00
Stan Lo
8f4eda5092 [ruby/irb] Make SourceFinder ignore binary sources
(https://github.com/ruby/irb/pull/836)

https://github.com/ruby/irb/commit/73b35bb7f4
2024-01-08 12:42:39 +00:00
yui-knk
41e2d180a3 Do not convert NODE_STR to NODE_LIT when the string is hash key
parse.y converted NODE_STR when the string is hash key like

```
h1 = {"str1" => 1}
m1("str2" => 2)
m2({"str3" => 3})
```

This commit stop the conversion.
`static_literal_node_p` needs to know the node is for hash key or not
for the optimization.
2024-01-08 18:48:24 +09:00
yui-knk
7ffff3e043 Change numeric node value functions argument to NODE *
Change the argument to align with other node value functions
like `rb_node_line_lineno_val`.
2024-01-08 14:02:48 +09:00
Peter Zhu
d9bad91c34 [DOC] Fix docs for GC.compact
GC.compact returns GC.latest_compact_info and not GC.latest_gc_info.
2024-01-07 22:26:12 -05:00
yui-knk
9527093759 Fix numeric node print by -y option
These nodes are not NOTE_LIT, so need to treat separately.
2024-01-08 11:57:30 +09:00
Peter Zhu
11286ac479 Fix memory leak in autoload_data
If the autoload_data has autoload_const and the autoload_data is freed
before the autoload_const, then the autoload_data will leak.

This commit changes it so that when the autoload_data is freed, it will
clear the whole linked list of autoload_const so that the autoload_data
can be safely freed.

    1000.times do |i|
      str = "foo#{i}".freeze

      autoload(:"B#{i}", str)
      autoload(:"C#{i}", str)
    end

Reports leaked memory with the macOS leaks tool:

    12  ruby                                  0x1006398a4 rb_f_autoload + 96  load.c:1524
    11  ruby                                  0x100639710 rb_mod_autoload + 112  load.c:1460
    10  ruby                                  0x10080a914 rb_autoload_str + 224  variable.c:2666
    9   ruby                                  0x1007c3308 rb_mutex_synchronize + 56  thread_sync.c:637
    8   ruby                                  0x1005acb24 rb_ensure + 312  eval.c:1009
    7   ruby                                  0x10080aac8 autoload_synchronized + 204  variable.c:2630
    6   ruby                                  0x10080f8bc autoload_feature_lookup_or_create + 76  variable.c:2578
    5   ruby                                  0x1005c29a4 rb_data_typed_object_zalloc + 232  gc.c:3186
    4   ruby                                  0x1005c2774 ruby_xcalloc + 32  gc.c:14440
    3   ruby                                  0x1005cddf4 ruby_xcalloc_body + 56  gc.c:12878
    2   ruby                                  0x1005cde7c objspace_xcalloc + 124  gc.c:12871
    1   ruby                                  0x1005c1990 calloc1 + 28  gc.c:1906
    0   libsystem_malloc.dylib                0x18b2ebb78 _malloc_zone_calloc_instrumented_or_legacy + 100
2024-01-07 13:48:59 -05:00
Nobuyoshi Nakada
8b86d6f0c1
Suppress unused-but-set-variable warning in ripper
`set_yylval_node` in ripper does not use the argument at all.
2024-01-08 01:23:58 +09:00
git
5b6167c252 * expand tabs. [ci skip]
Please consider using misc/expand_tabs.rb as a pre-commit hook.
2024-01-07 15:50:59 +00:00
Nobuyoshi Nakada
c30b8ae947
Adjust styles and indents [ci skip] 2024-01-08 00:50:41 +09:00
Nobuyoshi Nakada
76c20b06aa Add MakeMakefile["C"] 2024-01-08 00:33:31 +09:00
Peter Zhu
189c8077aa Label memory leak test 2024-01-07 10:05:20 -05:00
Nobuyoshi Nakada
bca1493815
[DOC] Documentation of mkmf.rb 2024-01-07 21:49:47 +09:00
S-H-GAMELINKS
ad7aee35e4 Remove unneeded rb_parser_config_struct struct properties for Universal Parser 2024-01-07 21:16:31 +09:00
Nobuyoshi Nakada
7fcc6f04ac [ruby/rdoc] Visibility should begin from public for each scope
Even for singleton class definition such as `class << self` that
shares the same container with the outer scope, its visibility is
separated and set to `public` by default.

https://github.com/ruby/rdoc/commit/baf26363b9
2024-01-07 11:39:46 +00:00
Nobuyoshi Nakada
2325b72cf3 [ruby/rdoc] Singleton method visibility should be isolated
Each singleton method definition of the form `def recv.method` has
visibility separate from the outer scope and is set to `public` by
default.

https://github.com/ruby/rdoc/commit/810913a7ea
2024-01-07 11:39:45 +00:00
yui-knk
83c98ead4e Do not remove hash duplicated keys in parse.y
When hash keys are duplicated, e.g. `h = {k: 1, l: 2, k: 3}`,
parser changes node structure for correct compilation.
This generates tricky AST. This commit removes AST manipulation
from parser to keep AST structure simple.
2024-01-07 16:18:16 +09:00
yui-knk
9d3dcb86d1 Check hash key duplication for __LINE__ and __FILE__ 2024-01-07 14:32:10 +09:00
S-H-GAMELINKS
e4a9a73931 Skip some RBS test 2024-01-07 09:24:34 +09:00
S-H-GAMELINKS
1b8d01136c Introduce Numeric Node's 2024-01-07 09:24:34 +09:00
BurdetteLamar
76afbda5b5 [ruby/net-http] Tweak to Net::HTTP What's Here
https://github.com/ruby/net-http/commit/3bf641ca63
2024-01-06 18:26:38 +00:00
BurdetteLamar
8cad6fc90a Tweak to Integer What's Here 2024-01-06 13:25:17 -05:00
BurdetteLamar
4a44bf8c34 Tweak to Float What's Here 2024-01-06 13:24:48 -05:00
BurdetteLamar
7b615bfdf3 Tweak to Float What's Here 2024-01-06 13:24:48 -05:00
BurdetteLamar
54e8901f66 Tweak for ENV doc 2024-01-06 13:23:27 -05:00
Stan Lo
4bdfc9070c [ruby/irb] Refactor exit command
(https://github.com/ruby/irb/pull/835)

* Remove unnecessary code from the exit command's implementation

1. The parameters of `IRB.irb_exit` were never used. But there are some
   libraries seem to call it with arguments + it's declared on the top-level
   IRB constant. So I changed the params to anonymous splat instead of removing them.
2. `Context#exit` was completely unnecessary as `IRB.irb_exit` doesn't use
   the `@irb` instance it passes. And since it's (or should be treated as)
   a private method, I simply removed it.
3. The `exit` command doesn't use the status argument it receives at all.
   But to avoid raising errors on usages like `exit 1`, I changed the argument to
   anonymous splat instead removing it.

* Make exit an actual command

* Update readme

https://github.com/ruby/irb/commit/452b543a65
2024-01-06 17:15:16 +00:00
Peter Zhu
d96fe5e4f8 [DOC] Fix indentation in Numeric#step 2024-01-06 11:43:57 -05:00
Nobuyoshi Nakada
e168dbdac5
[DOC] Simply use -- / ++ instead of :stopdoc: / :startdoc: 2024-01-07 00:43:56 +09:00