81375 Commits

Author SHA1 Message Date
Maxime Chevalier-Boisvert
7f50c70574
YJIT: add top C function call counts to --yjit-stats (#9047)
* YJIT: gather call counts for individual cfuncs

Co-authored by Takashi Kokubun
2023-11-27 22:49:53 +00:00
Peter Zhu
94015e0dce Guard match from GC when scanning string
We need to guard match from GC because otherwise it could end up being
reclaimed or moved in compaction.
2023-11-27 16:49:52 -05:00
Jemma Issroff
1acea50100 [PRISM] Small fixes to parameters ordering and methods 2023-11-27 16:02:38 -05:00
Jemma Issroff
e4dd8f6c9c [PRISM] Renamed some variables, added comments 2023-11-27 15:14:40 -05:00
Jemma Issroff
ba26c6eae0 [PRISM] Compile IndexOperatorWriteNode 2023-11-27 15:14:40 -05:00
Jemma Issroff
ec5eddf695 [PRISM] Compile IndexAndWriteNode 2023-11-27 15:14:40 -05:00
Jemma Issroff
13b7cddc2b [PRISM] Compile IndexOrWriteNode 2023-11-27 15:14:40 -05:00
Peter Zhu
4d71f70fd1 Add assertions to check created red-black tree 2023-11-27 14:05:25 -05:00
Peter Zhu
872922b03d Fix indentation in comment in shape.c 2023-11-27 14:04:56 -05:00
Jemma Issroff
95064bb88d [PRISM] Fix compilation for SplatNodes within ArrayNodes
SplatNodes within ArrayNodes (e.g. [*1..2, 3]) need to be special
cased in the compiler because they use a combination of concatarray
and newarray instructions to treat each sequence of splat or non-splat
elements as independent arrays which get concatenated. This commit
implements those cases.
2023-11-27 12:52:07 -05:00
Jemma Issroff
6d447fa35f [PRISM] Don't pop several args related nodes 2023-11-27 12:51:50 -05:00
Peter Zhu
150ed44d87 Fix compaction during ary_make_partial
The ary_make_shared call may allocate, which can trigger a GC
compaction. This can cause the array to be embedded because it has a
length of 0.
2023-11-27 12:40:26 -05:00
TSUYUSATO Kitsune
3af56e87ca [ruby/prism] Check void expressions for constant paths
Fix https://github.com/ruby/prism/pull/1920

https://github.com/ruby/prism/commit/ee8e03bac7
2023-11-27 17:35:38 +00:00
TSUYUSATO Kitsune
8654859dbd [ruby/prism] Fix and reuse pm_call_node_index_p
Fix https://github.com/ruby/prism/pull/1925
Fix https://github.com/ruby/prism/pull/1927

Previously pm_call_node_index_p does not check about a block argument
correctly and is not used in parse_write to check an index call node.

This commit fixes these problems.

https://github.com/ruby/prism/commit/92bab044ff
2023-11-27 17:33:31 +00:00
Kevin Newton
bd4a992f38 [ruby/prism] Correct template.rb comment
https://github.com/ruby/prism/commit/4d689fe1df
2023-11-27 17:30:54 +00:00
Benoit Daloze
cc05a60c16 Update to ruby/spec@c3206f6 2023-11-27 18:17:52 +01:00
Benoit Daloze
acab060c17 Update to ruby/mspec@9f83eea 2023-11-27 18:17:51 +01:00
Jean Boussier
23a7714343 Refactor and fix the GVL instrumentation API
This entirely changes how it is tested. Rather than to use counters
we now record the timeline of events with associated threads which
makes it much easier to assert that certains events are only preceded
by a specific event, and makes it much easier to debug unexpected
timelines.

Co-Authored-By: Étienne Barrié <etienne.barrie@gmail.com>
Co-Authored-By: JP Camara <jp@jpcamara.com>
Co-Authored-By: John Hawthorn <john@hawthorn.email>
2023-11-27 17:37:57 +01:00
Peter Zhu
e3875dd0f8 Don't incremental mark when GC stressful
Incremental marking prevents the GC from fully executing, so it may fail
to catch certain bugs.
2023-11-27 11:13:47 -05:00
Nobuyoshi Nakada
7973eb7c3f [ruby/rdoc] [DOC] Slightly decorate em and strong
https://github.com/ruby/rdoc/commit/2161157205
2023-11-27 16:07:03 +00:00
KJ Tsanaktsidis
8427a8a655 Fix flaky "Expected 499 to be >= 500" assertion in test_gc_compact.rb
There have been some sproradically flaky tests related to GC compaction,
which fail with:

  1) Failure:
TestGCCompact#test_moving_hashes_down_size_pools [/test/ruby/test_gc_compact.rb:442]:
Expected 499 to be >= 500.

What's happening here, is that, _sometimes_, depending on very unlucky
combinations of machine things, one of the expected-to-be-moved hashes
might be found on the machine stack during GC, and thus pinned.

One factor which seems to make this _more_ likely is that GCC 11 on
Ubuntu 22.04 seems to want to allocate 440 bytes of stack space for
`gc_start`, which is much more than it actually uses on the common code
path. The result is that there are some 50-odd VALUE-sized cells "live"
on the stack which may well contain valid heap pointers from previous
function calls, and will need to be pinned.

This is, of course, totally normal and expected; Ruby's GC is
conservative and if there is the possibility that a VALUE might be live
on the machine stack, it can't be moved. However, it does make these
tests flaky.

This commit "fixes" the tests by performing the work in a fiber; the
fiber goes out of scope and should be collected by the call to
verify_compaction_references, so there should be no references to the
to-be-moved objects floating around on the machine stack.

Fixes [#20021]
2023-11-27 11:02:11 -05:00
Nobuyoshi Nakada
196c4aeb76 [ruby/rdoc] Place a space between certain character class letters only
https://github.com/ruby/rdoc/commit/1f568e049d
2023-11-27 15:58:31 +00:00
Peter Zhu
7835ebce97 Set compaction after major GC has been determined
do_full_mark can change in gc_start, so we want to set auto-compaction
only after do_full_mark has been properly set.
2023-11-27 10:23:43 -05:00
Nobuyoshi Nakada
ca4755b59a
[Bug #20023] Resurrect fake string feature name before raising 2023-11-28 00:13:05 +09:00
Peter Zhu
2e4a0a4d90 Implement Write Barriers on Enumerator::Producer 2023-11-27 08:29:35 -05:00
Peter Zhu
2dadd17c78 Implement Write Barriers on Enumerator::Generator 2023-11-27 08:29:35 -05:00
Peter Zhu
d7165d88ec Implement Write Barriers on Enumerator::Yielder 2023-11-27 08:29:35 -05:00
Benoit Daloze
1c3088117a [ruby/stringio] Do not compile the C extension on TruffleRuby
* Before this it was compiled but not used, because TruffleRuby has
  a stringio.rb in stdlib and .rb has precedence over .so.
  In fact that extension never worked on TruffleRuby,
  because rb_io_extract_modeenc() has never been defined on TruffleRuby.
* So this just skip compiling the extension since compilation of it now fails:
  https://github.com/ruby/openssl/issues/699

https://github.com/ruby/stringio/commit/d791b63df6
2023-11-27 12:21:24 +00:00
Stan Lo
a07d84b63c [ruby/irb] Hide debugger hint after the input is submitted
(https://github.com/ruby/irb/pull/789)

If `output_modifier_proc`'s `complete` arg is true, it means the input is
submitted. In that case, debugger hint doesn't provide value to users
and adds noise to the output. So we hide it in such case.

https://github.com/ruby/irb/commit/f86d9dbe2f
2023-11-27 10:34:40 +00:00
Josef Šimánek
71a8daecd9 Opaque Etags for compact index requests
This changes the CompactIndexClient to store etags received from the
compact index in separate files rather than relying on the MD5 checksum
of the file as the etag.

Smoothes the upgrade from md5 etags to opaque by generating them when no
etag file exists. This should reduce the initial impact of changing the
caching behavior by reducing cache misses when the MD5 etag is the same.

Eventually, the MD5 behavior should be retired and the etag should be
considered completely opaque with no assumption that MD5 would match.
2023-11-27 15:04:40 +09:00
David Rodríguez
794c879d19 [rubygems/rubygems] Don't remember --jobs flag
https://github.com/rubygems/rubygems/commit/9ab1136036
2023-11-27 15:04:40 +09:00
David Rodríguez
56ac1b0e14 [rubygems/rubygems] Fix advice in bundle install --system deprecation
https://github.com/rubygems/rubygems/commit/59a66e3560
2023-11-27 15:04:40 +09:00
David Rodríguez
e00d7b6182 [rubygems/rubygems] Keep a single copy of the remembered flag deprecation message
https://github.com/rubygems/rubygems/commit/cb4e26eabc
2023-11-27 15:04:40 +09:00
David Rodríguez
fe57be5a2e [rubygems/rubygems] Avoid some unnecessary quotes in remember flag deprecation message
https://github.com/rubygems/rubygems/commit/3fd627e486
2023-11-27 15:04:40 +09:00
David Rodríguez
bd4bd61650 [rubygems/rubygems] Simplify remembered flags deprecation message
Configuration is now local by default.

https://github.com/rubygems/rubygems/commit/6bc7709aa8
2023-11-27 15:04:40 +09:00
David Rodríguez
60803e192e [rubygems/rubygems] Remove no longer necessary workaround for old RubyGems
https://github.com/rubygems/rubygems/commit/ed4eaefac0
2023-11-27 15:04:40 +09:00
Mau Magnaguagno
67ee91a305 [ruby/psych] Prefer each_char in Psych::Visitors::Visitor::ToRuby#deserialize
Use safe navigation operator with each_char to remove empty strings and improve readability.

https://github.com/ruby/psych/commit/5fe714b216
2023-11-27 01:35:08 +00:00
Olle Jonsson
52c7e43b87 [rubygems/rubygems] Add missing --prefer-local to Synopsis in bundle-install.1.ronn
https://github.com/rubygems/rubygems/commit/e956c5bbe4
2023-11-26 22:08:27 +00:00
Samuel Giddins
08308fe3e8 [rubygems/rubygems] Reduce allocations when installing gems with bundler
```
==> memprof.after.txt <==
Total allocated: 1.13 MB (2352 objects)
Total retained:  10.08 kB (78 objects)

==> memprof.before.txt <==
Total allocated: 46.27 MB (38439 objects)
Total retained:  9.94 kB (75 objects)
```

Yes, we were allocating 45MB of arrays in `dependencies_installed?`,
it was accidentally cubic.

https://github.com/rubygems/rubygems/commit/13ab874388
2023-11-26 22:07:39 +00:00
Stan Lo
cc5d1bf026 [ruby/irb] Display aliases in help message
(https://github.com/ruby/irb/pull/788)

Similar to Pry, it displays user-defined aliases in the help message with
a dedicated section. With the current default aliases, it looks like:

```
...other sections...

Aliases
  $              Alias for `show_source`
  @              Alias for `whereami`
```

https://github.com/ruby/irb/commit/2a0eacc891
2023-11-26 17:07:45 +00:00
Nobuyoshi Nakada
688faa93f0
[DOC] Fix markup in declarative marking API document
- RDoc is not markdown, use `+` and `_` for code and variables
  respectively, instead of backquotes.

- Remove useless backslashes.
2023-11-26 21:49:18 +09:00
Stan Lo
9cd086ba4b [ruby/irb] Support disabling pager
(https://github.com/ruby/irb/pull/783)

With either `IRB.conf[:USE_PAGER] = false` or `--no-pager` commnad line flag.

I decided use `--no-pager` instead of `--use-pager` because it matches with
Pry and git's command line flags.

https://github.com/ruby/irb/commit/df1c3b9042
2023-11-26 11:07:50 +00:00
Nobuyoshi Nakada
0bced53a8a
[DOC] Remove extra + which is not a part of keyword argument name 2023-11-26 19:37:56 +09:00
Nobuyoshi Nakada
087a919ea4
[DOC] Fix markup
RDoc is not markdown.
2023-11-26 19:18:57 +09:00
Nobuyoshi Nakada
e81c380c0f
Constify RUBY_REFERENCES_START tables 2023-11-26 16:04:23 +09:00
Nobuyoshi Nakada
7fe7b7bc5a
Fix portability of bignum in ISeq Binary Format
- Unless `sizeof(BDIGIT) == 4`, (8-byte integer not available), the
  size to be loaded was wrong.
- Since `BDIGIT`s are dumped as raw binary, the loaded byte order was
  inverted unless little-endian.
2023-11-26 11:42:02 +09:00
Nobuyoshi Nakada
003f06bde4 [ruby/resolv] Close leaked FD
https://github.com/ruby/resolv/commit/49aefa3bba
2023-11-26 01:07:21 +00:00
Jeremy Evans
87c3deacf4 [ruby/resolv] Support a :use_ipv6 option to Resolv#initialize
When set, supports returning IPv6 results even if there is no
public IPv6 address for the system.

Implements Ruby Feature #14922

https://github.com/ruby/resolv/commit/09d141de38
2023-11-25 11:40:08 -08:00
Nobuyoshi Nakada
1b7376423d
Omit test_session_reuse_but_expire if OpenSSL 3.2.0 2023-11-26 01:18:48 +09:00
Peter Zhu
b93a1bb40b Verify correctness of shape cache
This commit adds assertions to verify that the shape cache is correct
compared to the shape tree.
2023-11-25 09:32:36 -05:00