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
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.
* 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
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
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.
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
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.
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>
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]
* 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/699https://github.com/ruby/stringio/commit/d791b63df6