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

81496 Коммитов

Автор SHA1 Сообщение Дата
Alan Wu cd4207869f Fix cache incoherency for ME resolved through VM_METHOD_TYPE_REFINED
Previously, we didn't invalidate the method entry wrapped by
VM_METHOD_TYPE_REFINED method entries which could cause calls to
land in the wrong method like it did in the included test.

Do the invalidation, and adjust rb_method_entry_clone() to accommodate
this new invalidation vector.

Fix: cfd7729ce7
See-also: e201b81f79
2023-11-28 13:03:04 -05:00
Kevin Newton 0704f40787
Add in missing error 2023-11-28 12:35:11 -05:00
Alan Wu 7b05721167 [PRISM] Run test setting global constant separately
This impacted other tests. Please mind the commons.

      /home/runner/work/ruby/ruby/src/test/ruby/test_compile_prism.rb:394: warning: already initialized constant Bar
      /tmp/test_reline_config_60145/bazbarbob.rb:6: warning: previous definition of Bar was here

        1) Failure:
      TestModule#test_const_get_evaled [/home/runner/work/ruby/ruby/src/test/ruby/test_module.rb:1239]:
      NameError expected but nothing was raised.
2023-11-28 12:30:30 -05:00
TSUYUSATO Kitsune 55f34d4745 [ruby/prism] Fix tests
https://github.com/ruby/prism/commit/1e6ecbaf04
2023-11-28 17:27:11 +00:00
TSUYUSATO Kitsune c11dd34753 [ruby/prism] Reset `current_param_name` around closed scopes
It is for supporting `def foo(bar = (def baz(bar) = bar; 1)) = 2` case.

https://github.com/ruby/prism/commit/c789a833c5
2023-11-28 17:27:10 +00:00
TSUYUSATO Kitsune f6fbb9fec5 [ruby/prism] Use `0` for the default valie of `current_param_name`
https://github.com/ruby/prism/commit/896915de24
2023-11-28 17:27:10 +00:00
TSUYUSATO Kitsune b5796d7b11 [ruby/prism] Check circular references in default values of params
Fix https://github.com/ruby/prism/pull/1637

https://github.com/ruby/prism/commit/0172d69cba
2023-11-28 17:27:09 +00:00
Peter Zhu fadd28c7ba [ruby/irb] Change show_source tests into integration tests
* Remove trailing spaces

* Migrate show_source tests to integration tests

Because show_source tests often need to define class and/or methods,
they can easily leak state to other tests. Changing them to integration
tests will ensure that they are run in a clean environment.

* Fix NoMethodError caused by SourceFinder#method_target

3c39f13397
2023-11-28 12:22:46 -05:00
Takashi Kokubun 476a231e7e
YJIT: Assert no patch overlap on pos_marker (#9048) 2023-11-28 10:41:14 -05:00
paulreece 891ce4614a [ruby/irb] This enhancement allows a user to add the -s flag if they
want to access a methods origin definition.  It allows for chaining
of multiple esses to further go up the classes as needed.
(https://github.com/ruby/irb/pull/770)

https://github.com/ruby/irb/commit/eec1329d5a
2023-11-28 14:56:51 +00:00
Kasumi Hanazuki 5fc71feb6c [ruby/irb] Rescue errors from main.to_s/inspect when formatting
prompt
(https://github.com/ruby/irb/pull/791)

Currently, IRB just terminates if `main.to_s` raises while IRB
constructs the prompt string. This can easily happen if the user wants
to start an IRB session in the instance scope of an uninitialized
object, for example:

```
class C
  def initialize
    binding.irb
    @values = []
  end

  def to_s = @values.join(',')  # raises if uninitialized
end

C.new
```

This patch makes IRB rescue from such an exception and displays the
class name of the exception instead of `main.to_s` to indicate some
error has occurred.

We may display more detailed information about the exception, but this
patch chooses not to do so because 1) the prompt has limited space,
2) users can evaluate `to_s` in IRB to examine the error if they want,
and 3) obtaining the details can also raise, which requires nested
exception handling and can be complicated.

https://github.com/ruby/irb/commit/412ab26067
2023-11-28 14:05:31 +00:00
TSUYUSATO Kitsune 9365b78d49 [ruby/prism] Fix to parse `*` as forwarding in `foo[*]` case
Fix https://github.com/ruby/prism/pull/1924

https://github.com/ruby/prism/commit/7cde900065
2023-11-28 13:25:59 +00:00
Kevin Newton c798943a4a [ruby/prism] Move DATA parsing into its own parse result field
https://github.com/ruby/prism/commit/42b60b6e95
2023-11-28 13:25:48 +00:00
Peter Zhu 43dc8e9012 Fix indentation in ivar_set [ci skip] 2023-11-28 08:12:35 -05:00
Kouhei Yanagita 458d079166 [DOC] Add a mention of [Feature #18551] to NEWS.md 2023-11-28 21:50:04 +09:00
Yusuke Endoh 62c816410f Retry pthread_create a few times
According to https://bugs.openjdk.org/browse/JDK-8268605, pthread_create
may fail spuriously. This change implements a simple retry as a modest
measure, which is also used by JDK.
2023-11-28 20:49:12 +09:00
Kouhei Yanagita 1a16b6ffc2 Make Range#reverse_each raise TypeError if endless 2023-11-28 15:10:42 +09:00
Kevin Newton 0164da68c1 [ruby/prism] Use un-capitalized error messages
I don't prefer this style, but it appears that a plurality of syntax
error messages between with un-capitalized messages in CRuby, so
we'll go with that for consistency, for now.

https://github.com/ruby/prism/commit/b02df68954
2023-11-28 02:53:44 +00:00
Haldun Bayhantopcu 32b5f5be7c [ruby/prism] Introduce char_is_identifier_utf8
https://github.com/ruby/prism/commit/5f43e57b0f
2023-11-28 02:53:31 +00:00
git 031e81c8f3 Update default gems list at def416899d [ci skip] 2023-11-28 01:39:40 +00:00
Sutou Kouhei def416899d [ruby/stringio] Development of 3.1.1 started.
https://github.com/ruby/stringio/commit/75da93d48f
2023-11-28 01:38:41 +00:00
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