75780 Commits

Author SHA1 Message Date
Hiroshi SHIBATA
8a771efec2 [ruby/psych] Bump up 5.0.2
https://github.com/ruby/psych/commit/a170b8eb46
2023-01-18 04:53:12 +00:00
Kazuhiro NISHIYAMA
8ae4e3ddc9
Clean up removed directories in ext/Setup* [ci skip] 2023-01-18 12:02:27 +09:00
Kazuhiro NISHIYAMA
2fa3fda0c4
Remove removed files from ext/.document [ci skip]
- dbm/dbm.c removed at 55cd3e4ebff8fa75854ecadcd77abbf7cf4b5823
- fiber/fiber.c removed at 521ad9a13aef1e1dae4eaff70d3e6b2e358aa095
- gdbm/gdbm.c removed at edcc29dcff1b269b7748ab83adf21b2f3f97ebff
2023-01-18 11:57:00 +09:00
Maxime Chevalier-Boisvert
a9bcc058bb
Update yjit.md 2023-01-17 16:21:13 -05:00
Stan Lo
df6b72b8ff Avoid checking interrupt when loading iseq
The interrupt check will unintentionally release the VM lock when loading an iseq.
And this will cause issues with the `debug` gem's
[`ObjectSpace.each_iseq` method](0fcfc28aca/ext/debug/iseq_collector.c (L61-L67)),
which wraps iseqs with a wrapper and exposes their internal states when they're actually not ready to be used.

And when that happens, errors like this would occur and kill the `debug` gem's thread:

```
 DEBUGGER: ReaderThreadError: uninitialized InstructionSequence
┃ DEBUGGER: Disconnected.
┃ ["/opt/rubies/ruby-3.2.0/lib/ruby/gems/3.2.0/gems/debug-1.7.1/lib/debug/breakpoint.rb:247:in `absolute_path'",
┃  "/opt/rubies/ruby-3.2.0/lib/ruby/gems/3.2.0/gems/debug-1.7.1/lib/debug/breakpoint.rb:247:in `block in iterate_iseq'",
┃  "/opt/rubies/ruby-3.2.0/lib/ruby/gems/3.2.0/gems/debug-1.7.1/lib/debug/breakpoint.rb:246:in `each_iseq'",
...
```

A way to reproduce the issue is to satisfy these conditions at the same time:

1. `debug` gem calling `ObjectSpace.each_iseq` (e.g. [activating a `LineBreakpoint`](0fcfc28aca/lib/debug/breakpoint.rb (L246))).
2. A large amount of iseq being loaded from another thread (possibly through the `bootsnap` gem).
3. 1 and 2 iterating through the same iseq(s) at the same time.

Because this issue requires external dependencies and a rather complicated timing setup to reproduce, I wasn't able to write a test case for it.
But here's some pseudo code to help reproduce it:

```rb
require "debug/session"

Thread.new do
  100.times do
    ObjectSpace.each_iseq do |iseq|
      iseq.absolute_path
    end
  end
end

sleep 0.1

load_a_bunch_of_iseq
possibly_through_bootsnap
```

[Bug #19348]

Co-authored-by: Peter Zhu <peter@peterzhu.ca>
2023-01-17 08:01:19 -05:00
dependabot[bot]
9399352a43 [rubygems/rubygems] Bump rb-sys in /test/rubygems/test_gem_ext_cargo_builder/custom_name
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.54 to 0.9.56.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.54...v0.9.56)

---
updated-dependencies:
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-17 09:57:05 +00:00
Peter Zhu
ed6fbb79e1 Fix crash when defining ivars on special constants
[Bug #19339]
2023-01-17 04:51:15 -05:00
git
f8249eb49a Update default gems list at 492d37fbbd3613b7fb180eec529860 [ci skip] 2023-01-17 08:47:20 +00:00
Hiroshi SHIBATA
492d37fbbd [ruby/psych] Bump up 5.0.2.pre1 for testing
https://github.com/ruby/psych/commit/67ec299c68
2023-01-17 08:46:27 +00:00
Hiroshi SHIBATA
dd510da89a [ruby/psych] configure of libyaml couldn't detect "arm64-apple-darwin22" for build host.
checking whether make sets $(MAKE)... (cached) yes
  checking build system type... arm-apple-darwin21.6.0
  checking host system type... Invalid configuration `arm64-apple-darwin21': machine `arm64-apple' not recognized
  configure: error: /bin/sh /Users/hsbt/Downloads/yaml-0.2.5/config/config.sub arm64-apple-darwin21 failed
  *** extconf.rb failed ***

https://github.com/ruby/psych/commit/ad1502202c
2023-01-17 08:26:22 +00:00
Hiroshi SHIBATA
01e28afd0a
test-syntax-suggest is now part of make check 2023-01-17 16:56:57 +09:00
Hiroshi SHIBATA
aad1563c1a
Added make exam to help message 2023-01-17 16:50:19 +09:00
Hiroshi SHIBATA
da7818e682
Added test-syntax-suggest to help message 2023-01-17 16:48:44 +09:00
dependabot[bot]
d7af0f6082 [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.54 to 0.9.56.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.54...v0.9.56)

---
updated-dependencies:
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-17 07:19:03 +00:00
Hiroshi SHIBATA
ff3c1d9e13
SimpleCov is hosted under simplecov-ruby org now 2023-01-17 14:31:36 +09:00
Alan Wu
14fe7a081a YJIT: Use ThinLTO for Rust parts in release mode
This reduces the code size of libyjit.a by a lot. On darwin it went from
23 MiB to 12 MiB for me. I chose ThinLTO over fat LTO for the relatively
fast build time; in case we need to debug release-build-only problems
it won't be painful.
2023-01-16 17:32:15 -05:00
Alan Wu
b572595918 addr2line.c: Silence GCC 11 false -Wmaybe-uninitialized warning
No warnings from GCC 12.
2023-01-16 15:45:51 -05:00
Alan Wu
e22a1fbe18
addr2line.c: Don't special-case DWARF 5 parsing with GCC
While trying to fix YJIT's symbol hygiene issue over at GH-7115, I found
that addr2line.c's DWARF 5 parsing is half-disabled when building with
GCC. Rust's output contains some DW_AT_rnglists_base records, which the
disabled code reads. Without DW_AT_rnglists_base, it crashes when
generating a backtrace.

In common Ruby build configurations, GCC opts to only use
DW_FORM_sec_offset for the range lists, and so it doesn't generate
DW_AT_rnglists_base records, so consuming GCC's DWARF 5 while building
with GCC was not a problem.

However, even when building with GCC, we might need to parse DWARF 5
generated by other compilers at runtime. They could come from C
extensions built by Clang, or come from Rust extensions. This
can happen even when building without YJIT.
2023-01-16 14:25:39 -05:00
Burdette Lamar
30bd2a32fa
[DOC] Correction to RDoc for Regexp.new (#7130)
Correction to RDoc for Regexp.new
2023-01-16 11:02:23 -06:00
Nobuyoshi Nakada
a2748c500d
[DOC] Update String#encode special case
This behavior has been slightly extended with the addition of
`String#scrub`.
2023-01-16 19:44:40 +09:00
Martin Dürst
11f28f3268 [DOC] Explain that transcoding to the same encoding just copies.
This is a reenstatement of the explanation in commit
463633e4a934a00f869086a6ffbf84c6cb8ad630 to partially
address Bug #19342.
2023-01-16 16:30:15 +09:00
Nobuyoshi Nakada
468ce1488d [DOC] Use RDoc inclusions in transcode.c 2023-01-16 13:38:58 +09:00
Rick Hull
4617b40f8b fix typo in comments / autodoc
replace _socktype_ with _type_ in the comments
2023-01-16 08:00:03 +09:00
Nobuyoshi Nakada
6698b580dd Clear gem paths for each test
So that rubygems can find the bundled rake.
2023-01-15 23:57:43 +09:00
Nobuyoshi Nakada
088132fb33 Do not depend on REVISION_H
Disable for now, since this seems causing infinite rebuilding.
2023-01-15 17:21:59 +09:00
Nobuyoshi Nakada
71ce7e1825
[Bug #19335] Integer#remainder should respect #coerce (#7120)
Also `Numeric#remainder` should.
2023-01-15 13:03:27 +09:00
Nobuyoshi Nakada
1ddeb7473d
Move the dependency of makefiles on revision header [ci skip]
Since `REVISION_H` is defined in common.mk which is appended or
included after Makefile.in, it was undefined yet at the point of the
dependency.
2023-01-14 20:30:19 +09:00
HASUMI Hitoshi
5b26f76ad9 [ruby/reline] Correspond to refactored RubyLex
(https://github.com/ruby/reline/pull/498)

* Correspond to refactored RubyLex

ref: https://github.com/ruby/irb/pull/503

* Fix test_yamatanooroti
2023-01-14 09:19:41 +00:00
Stan Lo
cb9b885e78 [ruby/irb] Store context in RubyLex
Some background for this refactor:

1. Through a RubyLex instance's lifetime, the context passed to its methods
   should be the same.
   Given that `Context` is only initialised in `Irb#initialize`,
   this should be true.

2. When `RubyLex` is initialised, the context object should be accessible.
   This is also true in all 3 of `RubyLex.new`'s invocations.

With the above observations, we should be able to store the context in `RubyLex`
as an instance variable. And doing so will make `RubyLex`'s instance methods
easier to use and maintain.

https://github.com/ruby/irb/commit/5c8d3df2df
2023-01-14 09:19:09 +00:00
Charles Oliver Nutter
2082ba7c69 [ruby/psych] Remove deleted file from gemspec
https://github.com/ruby/psych/commit/77861ff281
2023-01-14 01:24:39 +00:00
Alan Wu
b4cdde468b YJIT: Use SIZEOF_VALUE_I32 instead of ... as i32
Shorter, and easier to parse without parentheses.
2023-01-13 15:32:28 -05:00
Alan Wu
84b1f48891 YJIT: Factor out VALUE_BITS = (8 * SIZE_OF_VALUE as u8)
Using a constant shows intention better and is less noisy. It always
took me a second to parse the long expression.
2023-01-13 15:32:28 -05:00
Matt Valentine-House
8a93e5d01b Use str_enc_copy_direct to improve performance
str_enc_copy_direct copies the string encoding over without checking the
frozen status of the string. Because we know that we're safe here (we
only use this function when interpolating strings on the stack via a
concatstrings instruction) we can safely skip this check
2023-01-13 10:31:35 -05:00
Matt Valentine-House
2605615fe6 Benchmark String interpolation across size pools 2023-01-13 10:31:35 -05:00
Matt Valentine-House
bb5fddd070 Remove MIN_PRE_ALLOC_SIZE from Strings.
This optimisation is no longer helpful now that we use VWA to allocate
strings in larger size pools where they can be embedded.
2023-01-13 10:31:35 -05:00
Nobuyoshi Nakada
fc7f852033
[DOC] Add gem lists to NEWS.md automatically 2023-01-13 20:34:45 +09:00
Nobuyoshi Nakada
447f8f7a3c
[DOC] Changed gem list style in NEWS.md 2023-01-13 20:34:45 +09:00
Nobuyoshi Nakada
3ecffae8e8
[DOC] Extract tool/update-NEWS-gemlist.rb 2023-01-13 20:34:08 +09:00
Yusuke Endoh
94d6d6d93f [ruby/error_highlight] Identify which node in Foo::Bar::Baz causes a NameError
In Ruby 3.2 or later, a nested constant access like `Foo::Bar::Baz` is
compiled to one instruction by the optimization https://github.com/ruby/ruby/pull/6187

We try to spot which sub-node caues a NameError in question based on the
constant name. We will give up if the same constant name is accessed in
a nested access (`Foo::Foo`).

Fixes https://github.com/ruby/error_highlight/pull/31

https://github.com/ruby/error_highlight/commit/0a4db7da0a
2023-01-13 08:25:09 +00:00
Nobuyoshi Nakada
5b36fefc4e
Skip time-related assertions on /dev/null 2023-01-13 12:26:16 +09:00
Koichi Sasada
7e8802fa5b fix unused variables warning
Now `ccs` is not needed there.
2023-01-13 10:28:00 +09:00
Aaron Patterson
eab7f4623f Return 0 if there is no CFP on the EC yet
StackProf uses a signal handler to call `rb_profile_frames`.  Signals
are delivered to threads randomly, and can be delivered after the thread
has been created but before the CFP has been established on the EC.

This commit returns early if there is no CFP to use.

Here is some info from the core files we are seeing.  Here you can see
the CFP on the current EC is 0x0:

```
(gdb) p ruby_current_ec
$20 = (struct rb_execution_context_struct *) 0x7f3481301b50
(gdb) p ruby_current_ec->cfp
$21 = (rb_control_frame_t *) 0x0
```

Here is where VM_FRAME_CFRAME_P gets a 0x0 CFP:

```
6  VM_FRAME_CFRAME_P (cfp=0x0) at vm_core.h:1350
7  VM_FRAME_RUBYFRAME_P (cfp=<optimized out>) at vm_core.h:1350
8  rb_profile_frames (start=0, limit=2048, buff=0x7f3493809590, lines=0x7f349380d590) at vm_backtrace.c:1587
```

Down the stack we can see this is happening after thread creation:

```
19 0x00007f3495bf9420 in <signal handler called> () at /lib/x86_64-linux-gnu/libpthread.so.0
20 0x000055d531574e55 in thread_start_func_2 (th=<optimized out>, stack_start=<optimized out>) at thread.c:676
21 0x000055d531575b31 in thread_start_func_1 (th_ptr=<optimized out>) at thread_pthread.c:1170
22 0x00007f3495bed609 in start_thread (arg=<optimized out>) at pthread_create.c:477
23 0x00007f3495b12133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
```
2023-01-12 17:11:40 -08:00
Kazuhiro NISHIYAMA
391d431073
[DOC] Fix markup [ci skip] 2023-01-13 09:46:15 +09:00
Koichi Sasada
2e7bceb34e Do not use VM stack for splat arg on cfunc
On the cfunc methods, if a splat argument is given, all array elements
are expanded on the VM stack and it can cause SystemStackError.
The idea to avoid it is making a hidden array to contain all parameters
and use this array as an argv.

This patch is reviesed version of https://github.com/ruby/ruby/pull/6816
The main change is all changes are closed around calling cfunc logic.

Fixes [Bug #4040]

Co-authored-by: Jeremy Evans <code@jeremyevans.net>
2023-01-13 09:30:29 +09:00
Alan Wu
537183cd2a Fix write barrier order for klass to cme edge
Previously, the following crashes with
`CFLAGS=-DRGENGC_CHECK_MODE=2 -DRUBY_DEBUG=1 -fno-inline`:

    $ ./miniruby -e 'GC.stress = true; Marshal.dump({})'

It crashes with a write barrier (WB) miss assertion on an edge from the
`Hash` class object to a newly allocated negative method entry.

This is due to usages of vm_ccs_create() running the WB too early,
before the method entry is inserted into the cc table, so before the
reference edge is established. The insertion can trigger GC and promote
the class object, so running the WB after the insertion is necessary.
Move the insertion into vm_ccs_create() and run the WB after the
insertion.

Discovered on CI:
http://ci.rvm.jp/results/trunk-asserts@ruby-sp2-docker/4391770
2023-01-12 15:18:18 -05:00
Takashi Kokubun
da7e5c7b77
YJIT: Do not refer to an undefined constant (#7112) 2023-01-12 15:09:32 -05:00
Ian Ker-Seymer
8d3ff66389
Enable clippy checks for yjit in CI (#7093)
* Add job to check clippy lints in CI

* Address all remaining clippy lints

* Check lints on arm64 as well

* Apply latest clippy lints

* Do not exit 0 on clippy warnings
2023-01-12 10:14:17 -05:00
Peter Zhu
bfc887f391 Add str_enc_copy_direct
This commit adds str_enc_copy_direct, which is like str_enc_copy but
does not check the frozen status of str1 and does not check the validity
of the encoding of str2. This makes certain string operations ~5% faster.

```ruby
puts(Benchmark.measure do
  100_000_000.times do
    "a".downcase
  end
end)
```

Before this patch:

```
  7.587598   0.040858   7.628456 (  7.669022)
```

After this patch:

```
  7.133128   0.039809   7.172937 (  7.183124)
```
2023-01-12 09:06:15 -05:00
Stan Lo
207f8d0027 [ruby/irb] Avoid calling private methods on the main object
(https://github.com/ruby/irb/pull/498)

When the main object is frozen, `IRB` wraps a `SimpleDelegator` around it.
But because `SimpleDelegator` doesn't delegate private methods, methods like
`require_relative` or `const_get` would cause error, which are needed for
lazily loading commands.

This commit works around this limitation by avoiding those private method calls
when setting up command execution.
2023-01-12 11:49:16 +00:00
git
3faecaaa60 Update bundled gems list at b7598b535e49d316110aa96542a746 [ci skip] 2023-01-12 10:34:00 +00:00