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

82210 Коммитов

Автор SHA1 Сообщение Дата
Takashi Kokubun c28177cd57 RJIT: Print an error message first
Creating a backtrace can crash if RJIT is triggered by branch_stub_hit.
In that case, it's useful to at least print the error message.
2023-12-20 09:17:46 -08:00
git fac7d2c1ab Update default gems list at 31959f1f13 [ci skip] 2023-12-20 10:36:35 +00:00
Stan Lo 31959f1f13 [ruby/irb] Bump version to v1.11.0
(https://github.com/ruby/irb/pull/818)

https://github.com/ruby/irb/commit/7421359b92
2023-12-20 19:11:02 +09:00
Burdette Lamar 4ad1007fd2 [ruby/irb] [DOC] Change indexes.rdoc to indexes.md
(https://github.com/ruby/irb/pull/812)

* Change indexes.rdoc to indexes.md

* Change indexes.rdoc to indexes.md

* Change indexes.rdoc to indexes.md

https://github.com/ruby/irb/commit/b1cd53cbf7
2023-12-20 19:11:02 +09:00
Stan Lo 2793a30b69 [ruby/irb] Warn users about errors in loading RC files
(https://github.com/ruby/irb/pull/817)

1. Because `IRB.rc_file` always generates an rc file name, even if the
   file doesn't exist, we should check the file exists before trying to
   load it.
2. If any type of errors occur while loading the rc file, we should
   warn the user about it.

https://github.com/ruby/irb/commit/37ffdc6b19
2023-12-20 19:11:01 +09:00
Jean Boussier 7c2d819862 Fix a grammar issue in the shape performance warning message 2023-12-20 09:28:45 +01:00
Koichi Sasada 4927f25148 skip `MAP_STACK` on FreeBSD 2023-12-20 17:00:55 +09:00
JP Camara 256f34ab6b Hand thread into `thread_sched_wait_events_timeval`
* When we have the thread already, it saves a lookup

* `event_wait`, not `kq`

Clean up the `thread_sched_wait_events_timeval` calls

* By handling the PTHREAD check inside the function, all the other code can become much simpler and just call the function directly without additional checks
2023-12-20 16:23:38 +09:00
JP Camara 8782e02138 KQueue support for M:N threads
* Allows macOS users to use M:N threads (and technically FreeBSD, though it has not been verified on FreeBSD)

* Include sys/event.h header check for macros, and include sys/event.h when present

* Rename epoll_fd to more generic kq_fd (Kernel event Queue) for use by both epoll and kqueue

* MAP_STACK is not available on macOS so conditionall apply it to mmap flags

* Set fd to close on exec

* Log debug messages specific to kqueue and epoll on creation

* close_invalidate raises an error for the kqueue fd on child process fork. It's unclear rn if that's a bug, or if it's kqueue specific behavior

Use kq with rb_thread_wait_for_single_fd

* Only platforms with `USE_POLL` (linux) had changes applied to take advantage of kernel event queues. It needed to be applied to the `select` so that kqueue could be properly applied

* Clean up kqueue specific code and make sure only flags that were actually set are removed (or an error is raised)

* Also handle kevent specific errnos, since most don't apply from epoll to kqueue

* Use the more platform standard close-on-exec approach of `fcntl` and `FD_CLOEXEC`. The io-event gem uses `ioctl`, but fcntl seems to be the recommended choice. It is also what Go, Bun, and Libuv use

* We're making changes in this file anyways - may as well fix a couple spelling mistakes while here

Make sure FD_CLOEXEC carries over in dup

* Otherwise the kqueue descriptor should have FD_CLOEXEC, but doesn't and fails in assert_close_on_exec
2023-12-20 16:23:38 +09:00
HParker 7ef90b3978 Correct free_on_exit env var to free_at_exit 2023-12-20 14:36:32 +09:00
Jeremy Evans 7dca6b53a9
Add tool/missing-baseruby.bat, used when BASERUBY not available
Previously, the embedded semicolon in BASERUBY if BASERUBY is
not available breaks tarball builds without BASERUBY when using
OpenBSD make, due to the inability to escape MFLAGS correctly.
This moves the same BASERUBY code into a separate file, avoiding
the MFLAGS quoting issue.

BASERUBY must be passed to build-ext because it is required
by ripper since the introduction of lrama.

Fixes [Bug #19683]

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2023-12-19 21:30:47 -08:00
Mikhail Doronin ae2c4d0720 Revert "[Bug #19831] Remove duplicate library options"
This reverts commit 5bb9462285.

Fixes https://bugs.ruby-lang.org/issues/20072
2023-12-20 13:46:39 +09:00
Peter Zhu 32ecda354f Support `GC.auto_compact = :empty` on debug builds
This commit adds `GC.auto_compact = :empty` which will run
auto-compaction sorting pages by empty slots so the most amount of
objects will be moved. This will make it easier to write tests for
auto-compaction.
2023-12-19 18:29:36 -05:00
Matt Valentine-House 3d984366ca [PRISM] Correct the jump target for redo in FOR_NODE 2023-12-19 22:50:59 +00:00
Matt Valentine-House 371ff80840 [PRISM] Fix parameter numbering in For Node 2023-12-19 22:50:59 +00:00
BurdetteLamar f0b86f8c60 RDoc for Complex 2023-12-19 17:29:09 -05:00
Koichi Sasada 054f56fd3e moved object should not have a shape ID
fix [Bug #19917]
2023-12-20 07:04:32 +09:00
Koichi Sasada 7a0dfdea8c use `rb_thread_io_blocking_call()` more
use `rb_thread_io_blocking_call()` instead of
`rb_thread_io_blocking_region()` more.

See https://github.com/ruby/ruby/pull/9178#issuecomment-1858711533
2023-12-20 07:00:41 +09:00
Koichi Sasada ec51a3c818 declare `rb_thread_io_blocking_call` 2023-12-20 07:00:41 +09:00
Koichi Sasada 2fe5fc176b setup `waiting_fd` for `thread_sched_wait_events()`
`thread_sched_wait_events()` suspend the thread until the target
fd is ready. Howver, other threads can close the target fd and
suspended thread should be awake. To support it, setup `waiting_fd`
before `thread_sched_wait_events()`.

`rb_thread_io_wake_pending_closer()` should be called before
`RUBY_VM_CHECK_INTS_BLOCKING()` because it can return this function.

This patch introduces additional overhead (setup/cleanup `waiting_fd`)
and maybe we can reduce the overhead.
2023-12-20 07:00:41 +09:00
Peter Zhu 28a6e4ea9d Set m_tbl right after allocation
We should set the m_tbl right after allocation before anything that can
trigger GC to avoid clone_p from becoming old and needing to fire write
barriers.

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2023-12-19 13:09:36 -08:00
Peter Zhu 50d39219a9 Use RICLASS_OWNS_M_TBL_P
It's more consistent with gc_mark_children.
2023-12-19 15:21:28 -05:00
Takashi Kokubun bd91c5127f
YJIT: Add stats option to RubyVM::YJIT.enable (#9297) 2023-12-19 11:47:27 -08:00
BurdetteLamar 084b44e79d RDoc for Complex 2023-12-19 14:30:33 -05:00
Aaron Patterson df0bfde2b2 We need to load builtins so that they work
Before this commit no methods defined in Ruby were being loaded. For
example `class` or `tap` methods would not exist.

[ruby-core:115793] [Bug #20073]
2023-12-19 08:53:52 -08:00
Peter Zhu 8e6f63df47 Implement IO::Buffer on VWA 2023-12-19 09:13:20 -05:00
Doug Orleans 1822acdf33 [DOC] remove reference to pre-3.0 splat operator behavior 2023-12-19 22:11:11 +09:00
Koichi Sasada f9a48548cf restore the stack pointer on finalizer
When error on finalizer, the exception will be ignored.
To restart the code, we need to restore the stack pointer.

fix [Bug #20042]
2023-12-19 17:59:49 +09:00
Takashi Kokubun 96e4f42b3d RJIT: Correct the macro that defines rb_vm_insns_count 2023-12-19 00:06:21 -08:00
Takashi Kokubun 8d5af353b2 RJIT: Avoid retaining comments unless --rjit-dump-disasm
This significantly reduces retained objects on RJIT.
2023-12-19 00:05:19 -08:00
Takashi Kokubun 8671cd59f7 RJIT: Correct the type of rb_vm_insns_count 2023-12-19 00:02:38 -08:00
Takashi Kokubun edd6581eec RJIT: Declare rb_vm_insns_count 2023-12-19 00:00:18 -08:00
Takashi Kokubun eb872d1752 RJIT: Share rb_vm_insns_count for vm_insns_count 2023-12-18 23:55:40 -08:00
Nobuyoshi Nakada dee45ac231
[DOC] State MatchData#[] when multiple captures with the same name 2023-12-19 13:48:51 +09:00
Yuta Saito b5f33ba76f signal.c: Fix undefined `reset_sigmask` use on Emscripten
3c47114991 added a call to `reset_sigmask`
but the guard condition didn't match with the condition used to define
`reset_sigmask`.
2023-12-19 12:40:43 +09:00
Burdette Lamar f907a7111c
[DOC] RDoc for Complex (#9260) 2023-12-18 21:40:58 -05:00
Yuta Saito 36b389c206 [wasm] dln.c: Guard `dladdr` use in symbol incompatibility check
wasi-libc recently added a family of `dl*` functions[^1], but it still
doesn't have `dladdr` unlike other platforms. Guard the use of `dladdr`
with `HAVE_DLADDR` to avoid build failure with the head version of
wasi-libc.
The library name is used only for diagnostic purpose if it's not NULL,
so it's safe to skip it.

[^1]: b85d65528d
2023-12-19 11:13:38 +09:00
git acfd2e9d64 Update default gems list at 5ea862f26e [ci skip] 2023-12-19 02:13:02 +00:00
Hiroshi SHIBATA 5ea862f26e [ruby/psych] Bump up 5.1.2
https://github.com/ruby/psych/commit/a9ab74d132
2023-12-19 11:07:47 +09:00
Alexander Momchilov b3598f95fa [ruby/psych] Use `assert_same` in tests where applicable
https://github.com/ruby/psych/commit/0dc25a9d6a
2023-12-19 11:07:46 +09:00
Alexander Momchilov e6fa1d62fa [ruby/psych] Use `compare_by_identity` instead of `object_id`
Object IDs became more expensive in Ruby 2.7. Using `Hash#compare_by_identity` let's us get the same effect, without needing to force all these objects to have object_ids assigned to them.

https://github.com/ruby/psych/commit/df69e4a12e
2023-12-19 11:07:45 +09:00
Nobuyoshi Nakada 46085ef970 [DOC] No ducuments for internal library 2023-12-19 10:20:40 +09:00
Peter Zhu ce436ff3e3 Fix flaky test test_stat_heap
The test sometimes fails with:

    1) Failure:
    TestGc#test_stat_heap [/tmp/ruby/src/trunk-repeat50/test/ruby/test_gc.rb:169]:
    Expected 33434403 to be <= 33434354.
2023-12-18 19:25:37 -05:00
Alan Wu 3c47114991 Unmask signal before re-raising fatal signal
On Linux, while the signal handler runs, that signal is masked, so in
the rb_bug_for_fatal_signal() code path we didn't get the default signal
action as intended. See signal(7). It worked fine on macOS, though.

Before:

    $ ./miniruby -e 'Process.kill :SIGSEGV, Process.pid'
    <snip>
    Aborted (core dumped)

After:

    $ ./miniruby -e 'Process.kill :SIGSEGV, Process.pid'
    <snip>
    Segmentation fault (core dumped)

Follow-up for 1ac0afab4d "rb_bug_for_fatal_signal: exit with the right
signal".
2023-12-18 18:19:53 -05:00
Alexander Momchilov 11fa76b1b5 compare_by_identity: remove alloc for non-empty Hash
If a Hash is non-empty, there's no point calling `ar_force_convert_table`. We'll be immediately discarding that new st table, and replacing it with the new `identtable` st table that we're stealing out of `tmp`.
2023-12-18 14:51:16 -05:00
Alexander Momchilov b5c6c0122f compare_by_identity: remove alloc for empty Hash
For non-empty Hashes, this function needs to rehash all the stored values (using the new `compare` and `hash` functions from `identhash`). It does so by writing into a newly allocated `tmp` Hash, and then transferring ownership of its st table into `self`.

For empty Hashes, we can skip allocating this `tmp`, because there's nothing to re-hash. We can just modify our new st table's `type` in-place.
2023-12-18 14:51:16 -05:00
Matt Valentine-House 893fe30ef2 [PRISM] Fix crash when --parser=prism called with stdin
[Bug #20071]

Currently Ruby crashes when the --parser=prism flag is used either with
no input, or with input that is being redirected from stdin. So all of
the following will crash

ruby --parser=prism
ruby --parser=prism < test_code.rb
cat test_code.rb | ruby --parser=prism

This commit checks whether the input is assumed to be from stdin, and
then processes that as a file.

This will fix the second and third case above, but will cause a slight
behavioural changes for the first case - Ruby will treat stdin as an
empty file in this case and exit, rather than waiting for data to be
piped into stdin.
2023-12-18 19:44:44 +00:00
Takashi Kokubun 4b125b70d8 [DOC] Copy Prism release notes to NEWS 2023-12-18 11:36:55 -08:00
Takashi Kokubun 71b7a24c24 [DOC] Clarify what is 3.2 2023-12-18 11:11:50 -08:00
Takashi Kokubun 495a237ef3 [DOC] Note about yjit_alloc_size in NEWS
It's a pretty useful feature in 3.3.
2023-12-18 10:50:14 -08:00