WASI does not support concept to provide termios, so it is not possible
to build io/console extension on WASI at the moment.
However, `io/console` is used by many gems, and removing the dependency
from them *conditionally* is impossible. So, this commit adds a
check to skip building `io/console` extension on WASI just to pass `gem
install` for the platform.
https://github.com/ruby/io-console/commit/ba9bf00184
Namely, when a gem has not previously been installed, and Bundler is
using the compact index API, fund metadata was not getting printed
because the proper delegation was not implemented in the specification
class used by the compact index.
https://github.com/rubygems/rubygems/commit/9ef5139f60
The implementation of assert_equal inside bootstraptest/runner.rb wraps
a print around all the test code specified in the string, making returns
useless.
This change fixes this test for platforms that don't implement
GC.compact
Co-Authored-By: Peter Zhu <peter@peterzhu.ca>
Previously, on common platforms, this code made a pointer to a union of
8 byte alignment out of a char pointer that is not guaranteed to satisfy
the alignment requirement. That is undefined behavior according
to [C99 6.3.2.3p7](https://port70.net/~nsz/c/c99/n1256.html#6.3.2.3p7).
Use memcpy() to do the unaligned read instead.
Previously, RBIMPL_ASSERT_TYPE() used Check_Type() only in RUBY_DEBUG
builds. It raised TypeError, but only in debug builds. For people testing
type mismatch using debug builds looking for a Ruby exception, this can
be misleading -- the code could be missing a type check in non-debug builds
if it is relying on for example RSTRING_LEN() to raise.
Also, Check_Type() can obscure the true cause of error in debug mode.
When type check fails because the object is corrupt, instead of crashing
with a clear type assertion message, it can crash while trying to
construct an exception object to raise. You can see this for example in
<https://github.com/ruby/ruby/actions/runs/9489999591/job/26152506434?pr=10985>,
where RB_ENCODING_GET() is used on a corrupt object, but the crash
happens later and says "Assertion Failed:
../src/vm_method.c:1477:callable_method_entry_or_negative".
RBIMPL_ASSERT_TYPE() should assert right away.
RBIMPL_ASSERT_OR_ASSUME() asserts when RUBY_DEBUG and assumes in release
builds, as desired.
This should help investigate flaky CI failures that show up as TypeError
from `Kernel#require`, e.g.
"'Kernel#require': wrong argument type false (expected String) (TypeError)".
Same CI failure examples:
- https://github.com/ruby/ruby/actions/runs/9034787861/job/24828147431
- https://github.com/ruby/ruby/actions/runs/9418303667/job/25945492440
- https://github.com/ruby/ruby/actions/runs/9505650952/job/26201031314
The failure occurs with and without use of YJIT.
When an implicit array is used in a write, is causes the whole
expression to become a statement. For example:
```ruby
a = *b
a = 1, 2, 3
```
Even though these expressions are exactly equivalent to their
explicit array counterparts:
```ruby
a = [*b]
a = [1, 2, 3]
```
As such, these expressions cannot be joined with other expressions
by operators or modifiers except if, unless, while, until, or
rescue.
https://github.com/ruby/prism/commit/7cd2407272
Calls to defer_compilation() leave behind a stub and a `struct Block`
that we retain. If the block is empty, it only exits to hold the
`struct Branch` that the stub needs.
This patch transplants the branch out of the empty block into the newly
generated block when the defer_compilation() stub is hit, and deletes
the empty block to save memory.
To assist the transplantation, `Block::outgoing` is now a
`MutableBranchList`, and `Branch::Block` now in a `Cell`. These types
don't incur a size cost.
On the `lobsters` benchmark, `yjit_alloc_size` is roughly 98% of what
it was before the change.
Co-authored-by: Kevin Menard <kevin.menard@shopify.com>
Co-authored-by: Randy Stauner <randy@r4s6.net>
Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>
When running on newer Intel processors supporting the feature,
OpenBSD enforces indirect branch tracking. Without this endbr64
instruction, jumps to the coroutine_transfer function result
in SIGILL on OpenBSD/amd64 when using such processors.
The OpenBSD Ruby ports have been using a patch similar to this
for the past two months.
From some research, cet.h has been supported by GCC for about
6 years and LLVM for about 4 years.
`check_rvalue_consistency` uses bitmap and `RVALUE_WB_UNPROTECTED`
etc calls `check_rvalue_consistency` again.
also `rb_raw_obj_info_common()` is called from `check_rvalue_consistency`
so it should not use call `check_rvalue_consistency`.
Dynamic symbols point to a fstring. When we free the symbol, we hash the
fstring to remove it from the table. However, the fstring could have
already been freed, which can cause a crash.
This commit changes it to remove the reference to the fstring before
freeing the symbol so we can avoid this crash.
* YJIT: add context cache hits stat
This stat should make more sense when it comes to interpreting
the effectiveness of the cache on large deployed apps.
Now that we're using the inline predicate functions everywhere, the only
remaining use of the RVALUE_?_BITMAP macros is inside their respective
inline function, so we can remove them.