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

78643 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada 85ee4a65a2
Allow to override environment variables for debug 2023-08-02 19:55:31 +09:00
Nobuyoshi Nakada ffe0f9eb6c
`EnvUtil.invoke_ruby` also passes ASAN options 2023-08-02 19:55:30 +09:00
Hiroshi SHIBATA 28c2136722 [rubygems/rubygems] Replaced remained local to lockfile
https://github.com/rubygems/rubygems/commit/6ed69223d4
2023-08-02 09:56:13 +00:00
Jean byroot Boussier fd8dd71996
Implement StringIO#pread (#56)
Both for being closer to real IOs and also because it's a convenient API
in multithreaded scenarios.

Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2023-08-02 18:18:17 +09:00
Stan Lo 201fd57518 [ruby/irb] Drop src_encoding.rb
(https://github.com/ruby/irb/pull/634)

Its method `IRB.default_src_encoding` was only used in `magic-file.rb`,
which has been removed.

https://github.com/ruby/irb/commit/ed98983b1f
2023-08-02 18:17:27 +09:00
Sutou Kouhei fe25527781 [ruby/fiddle] Include stdbool.h explicitly
https://github.com/ruby/fiddle/commit/c313a74632
2023-08-02 18:17:20 +09:00
Sutou Kouhei 673f4493b0 [ruby/fiddle] Include stdbool.h explicitly
https://github.com/ruby/fiddle/commit/69ff680bf6
2023-08-02 18:17:19 +09:00
Sutou Kouhei 15e8cf7ad9 [ruby/fiddle] Add support for bool
GitHub: fix https://github.com/ruby/fiddle/pull/130

Reported by Benoit Daloze. Thanks!!!

https://github.com/ruby/fiddle/commit/bc6c66bbb9
2023-08-02 18:17:18 +09:00
Sutou Kouhei 10588fa121 [ruby/fiddle] Use ifdef
https://github.com/ruby/fiddle/commit/6cdf53726d
2023-08-02 18:17:16 +09:00
Hiroshi SHIBATA fd782dcd1e
Revert "YJIT: implement `expandarray_rhs_too_small` case (#8153)"
This reverts commit 3b88a0bee8.

  This commit break aarch64 platform and Apple Silicon
2023-08-02 14:25:16 +09:00
Nobuyoshi Nakada c5abe0d08f
Tests to move between size pools are flaky on Windows too [ci skip]
Needs more investigations.
2023-08-02 14:19:44 +09:00
Nobuyoshi Nakada e4fcac42d2
Find paths of tools [ci skip]
Recent GitHub Actions Windows containers seem having Strawberry tools.
2023-08-02 13:48:43 +09:00
Nobuyoshi Nakada 15b2e91230 Remove `kprintf` in addr2line.c
According to @naruse, this `kprintf` was to avoid some segfaults, but
turned out it seemed another issue after all.
2023-08-02 13:21:20 +09:00
Nobuyoshi Nakada 31d1226763 Avoid aborting inside addr2line.c 2023-08-02 13:21:20 +09:00
Takashi Kokubun df6071c49f Do not auto-cancel builds on pull requests
For some reason, there was a pull request that contains a YJIT change
but did not run Cirrus CI, which ended up failing Cirrus CI on master.

This `auto_cancellation` config seems suspicious. Now that we have
`only_if`, I don't think we need an extra guard besides that.
2023-08-01 15:36:27 -07:00
Takashi Kokubun 5ff1c00e17
YJIT: Let local yjit-bindgen exit successfully (#8156) 2023-08-01 14:46:14 -07:00
Maxime Chevalier-Boisvert 3b88a0bee8
YJIT: implement `expandarray_rhs_too_small` case (#8153)
* YJIT: handle expandarray_rhs_too_small case

* YJIT: fix csel bug in x86 backend, add test

* Remove commented out lines
2023-08-01 15:58:00 -04:00
Takashi Kokubun 16b91a346f
YJIT: Fallback setivar if the next shape is too complex (#8152) 2023-08-01 11:43:32 -07:00
Nobuyoshi Nakada 1642e0c392
Remove unnecessarily copied document [ci skip] 2023-08-01 22:49:37 +09:00
Koichi Sasada d68c01fd31 support `rescue` event for TracePoint
fix [Feature #19572]
2023-08-01 22:46:17 +09:00
Stan Lo f11ac06337 [ruby/irb] Add workspace category
(https://github.com/ruby/irb/pull/661)

* Create a new Workspace command category

* Update readme

https://github.com/ruby/irb/commit/310650c213
2023-08-01 12:51:30 +00:00
Nobuyoshi Nakada 382678d411 [Bug #19788] Use the result of `tCOLON2` event 2023-08-01 19:00:31 +09:00
Koichi Sasada 6a5c548218 remove strange line event
```ruby
  def helper_cant_rescue
    begin
      raise SyntaxError
    rescue
      cant_rescue # here
    end
  end
```

on this case, a line event is reported on `cant_rescue` line
because of node structure. it should not be reported.
2023-08-01 18:06:25 +09:00
Nobuyoshi Nakada 0622c78869
[DOC] Update warning categories
- Fix indentations of labeled lists.
- Mention performance category.
2023-08-01 14:54:16 +09:00
Burdette Lamar 533dcb8e52
RDoc for module Process (#8141) 2023-07-31 21:44:56 -04:00
Shugo Maeda 0b8045c9c9
Supress warnings by Refinement#refined_class in test code 2023-08-01 09:48:47 +09:00
Hiroshi SHIBATA de91ce980a [rubygems/rubygems] Use Kernel.singleton_class
https://github.com/rubygems/rubygems/commit/9be984f281
2023-08-01 00:31:22 +00:00
Kazuhiro NISHIYAMA 3f010d48fc
[DOC] Fix a link [ci skip] 2023-08-01 09:27:25 +09:00
Peter Zhu ec0e6809f9 Skip flaky test on Solaris
This test is flaky on "SPARC Solaris 10 (gcc)" CI with this message:

TestGCCompact#test_moving_objects_between_size_pools [test/ruby/test_gc_compact.rb:378]:
Expected 499 to be >= 500.
2023-07-31 20:02:32 -04:00
Kevin Newton 04f4e0aeb2 [ruby/yarp] Document building, more macro changes
https://github.com/ruby/yarp/commit/4214f262d2
2023-07-31 20:10:23 +00:00
Stan Lo 5d78ec8a94 [ruby/irb] Decouple `edit` and `show_source` commands
(https://github.com/ruby/irb/pull/658)

* Decouple `edit` command from `show_source`

2 commands should not depend on each other. If `edit` command also needs
to find a source, the source finding logic should be extracted into a
separate class.

* Return nil if is not an actual file path

* Refactor SourceFinder

https://github.com/ruby/irb/commit/9790517a0c
2023-07-31 19:57:36 +00:00
Peter Zhu c01b17f7fc Fix default value of global_init_slots
Not setting a value to global_init_slots causes get_envparam_size to
output a broken default value.
2023-07-31 15:12:20 -04:00
Yuta Saito 954b7ac81e
addr2line.c: fix `DW_FORM_ref_addr` parsing for DWARF 2 (#8146)
addr2line.c: fix DW_FORM_ref_addr parsing for DWARF 2

This fixes a crash when retrieving backtrace info with YJIT enabled on
macOS with Rust 1.71.0. Since Rust 1.71.0, the DWARF info generated by
the Rust compiler uses DW_FORM_ref_addr instead of DW_FORM_ref4 for
pointers to other DIEs.
DW_FORM_ref_addr representation in DWARF 2 is different from DWARF 3+,
so we need to handle it separately.
This patch fixes the parsing of DW_FORM_ref_addr for DWARF 2, which is
the default DWARF version Rustc uses on macOS.

See the DWARF 2.0.0 spec, section 7.5.4 Attribute Encodings
https://dwarfstd.org/doc/dwarf-2.0.0.pdf

https://bugs.ruby-lang.org/issues/19789
2023-07-31 14:56:53 -04:00
Peter Zhu 36d669b73d Fix test_gc_parameter_init_slots
If the stack is not cleared (e.g. compiling with -O0), then `ary` could
remain on the stack, which would be marked. Clear the array first to
make sure all the objects can be GC'd.
2023-07-31 14:52:25 -04:00
Nobuyoshi Nakada 8b390a456c
[DOC] Update description of `Process.daemon` arguments
These arguments can only be `true` or `false` now.  Also add markups.
2023-08-01 01:47:19 +09:00
Peter Zhu 547d2378ac Assert that at least one element has been embedded
It's not guaranteed that the first element will always be embedded.
2023-07-31 11:46:53 -04:00
Peter Zhu b98838b65c Store initial slots per size pool
This commit stores the initial slots per size pool, configured with
the environment variables `RUBY_GC_HEAP_INIT_SIZE_%d_SLOTS`. This
ensures that the configured initial slots remains a low bound for the
number of slots in the heap, which can prevent heaps from thrashing in
size.
2023-07-31 11:46:53 -04:00
Nobuyoshi Nakada 1bda22f5fe
`Refinement#refined_class` is now deprecated 2023-07-31 23:23:30 +09:00
Peter Zhu d42b9ffb20 Reuse Regexp ptr when recompiling
When matching an incompatible encoding, the Regexp needs to recompile.
If `usecnt == 0`, then we can reuse the `ptr` because nothing else is
using it. This avoids allocating another `regex_t`.

This speeds up matches that switch to incompatible encodings by 15%.

Branch:

```
Regex#match? with different encoding
                          1.431M (± 1.3%) i/s -      7.264M in   5.076153s
Regex#match? with same encoding
                         16.858M (± 1.1%) i/s -     85.347M in   5.063279s
```

Base:

```
Regex#match? with different encoding
                          1.248M (± 2.0%) i/s -      6.342M in   5.083151s
Regex#match? with same encoding
                         16.377M (± 1.1%) i/s -     82.519M in   5.039504s
```

Script:

```
regex = /foo/
str1 = "日本語"
str2 = "English".force_encoding("ASCII-8BIT")

Benchmark.ips do |x|
  x.report("Regex#match? with different encoding") do |times|
    i = 0
    while i < times
      regex.match?(str1)
      regex.match?(str2)
      i += 1
    end
  end

  x.report("Regex#match? with same encoding") do |times|
    i = 0
    while i < times
      regex.match?(str1)
      i += 1
    end
  end
end
```
2023-07-31 09:17:18 -04:00
Shugo Maeda a542512b7c Add Refinement#target and deprecate Refinement#refined_class
[Feature #19714]
2023-07-31 17:23:17 +09:00
Koichi Sasada cfd7729ce7 use inline cache for refinements
From Ruby 3.0, refined method invocations are slow because
resolved methods are not cached by inline cache because of
conservertive strategy. However, `using` clears all caches
so that it seems safe to cache resolved method entries.

This patch caches resolved method entries in inline cache
and clear all of inline method caches when `using` is called.

fix [Bug #18572]

```ruby
 # without refinements

class C
  def foo = :C
end

N = 1_000_000

obj = C.new
require 'benchmark'
Benchmark.bm{|x|
  x.report{N.times{
    obj.foo; obj.foo; obj.foo; obj.foo; obj.foo;
    obj.foo; obj.foo; obj.foo; obj.foo; obj.foo;
    obj.foo; obj.foo; obj.foo; obj.foo; obj.foo;
    obj.foo; obj.foo; obj.foo; obj.foo; obj.foo;
  }}
}

_END__
              user     system      total        real
master    0.362859   0.002544   0.365403 (  0.365424)
modified  0.357251   0.000000   0.357251 (  0.357258)
```

```ruby
 # with refinment but without using

class C
  def foo = :C
end

module R
  refine C do
    def foo = :R
  end
end

N = 1_000_000

obj = C.new
require 'benchmark'
Benchmark.bm{|x|
  x.report{N.times{
    obj.foo; obj.foo; obj.foo; obj.foo; obj.foo;
    obj.foo; obj.foo; obj.foo; obj.foo; obj.foo;
    obj.foo; obj.foo; obj.foo; obj.foo; obj.foo;
    obj.foo; obj.foo; obj.foo; obj.foo; obj.foo;
  }}
}
__END__
               user     system      total        real
master     0.957182   0.000000   0.957182 (  0.957212)
modified   0.359228   0.000000   0.359228 (  0.359238)
```

```ruby
 # with using

class C
  def foo = :C
end

module R
  refine C do
    def foo = :R
  end
end

N = 1_000_000

using R

obj = C.new
require 'benchmark'
Benchmark.bm{|x|
  x.report{N.times{
    obj.foo; obj.foo; obj.foo; obj.foo; obj.foo;
    obj.foo; obj.foo; obj.foo; obj.foo; obj.foo;
    obj.foo; obj.foo; obj.foo; obj.foo; obj.foo;
    obj.foo; obj.foo; obj.foo; obj.foo; obj.foo;
  }}
}
2023-07-31 17:13:43 +09:00
Koichi Sasada 280419d0e0 `calling->cd` instead of `calling->ci`
`struct rb_calling_info::cd` is introduced and `rb_calling_info::ci`
is replaced with it to manipulate the inline cache of iseq while
method invocation process. So that `ci` can be acessed with
`calling->cd->ci`. It adds one indirection but it can be justified
by the following points:

1) `vm_search_method_fastpath()` doesn't need `ci` and also
`vm_call_iseq_setup_normal()` doesn't need `ci`. It means
reducing `cd->ci` access in `vm_sendish()` can make it faster.

2) most of method types need to access `ci` once in theory
so that 1 additional indirection doesn't matter.
2023-07-31 17:13:43 +09:00
git e40f8bbd20 Update bundled gems list at 2023-07-31 2023-07-31 06:59:54 +00:00
Mat Sadler a3c0e9d90d [rubygems/rubygems] update Magnus library in Rust extension gem template
https://github.com/rubygems/rubygems/commit/19a92a3367
2023-07-31 06:25:21 +00:00
Koichi Sasada 36023d5cb7 mark `cc->cme_` if it is for `super`
`vm_search_super_method()` makes orphan CCs (they are not connected
from ccs) and `cc->cme_` can be collected before without marking.
2023-07-31 14:04:31 +09:00
BurdetteLamar 60ac719acc [ruby/optparse] [DOC] Corrections to tutorial
https://github.com/ruby/optparse/commit/2940dbb65a
2023-07-31 03:26:47 +00:00
Nobuyoshi Nakada 52722ea37b
Extract common variables 2023-07-30 19:38:18 +09:00
Nobuyoshi Nakada b5c74d5488
Ease the `Encoding::CompatibilityError` test failure
At the time this test first started using `assert_raise_with_message`,
it did not touch `Encoding.default_internal`.
2023-07-30 15:13:58 +09:00
Nobuyoshi Nakada dfad14d83f [ruby/optparse] [DOC] Mark up constant and method names as code
https://github.com/ruby/optparse/commit/e8bee0be8f
2023-07-30 02:35:22 +00:00
Nobuyoshi Nakada 67be453d9d [rubygems/rubygems] Set thread configurations inside block in the thread local manner
https://github.com/rubygems/rubygems/commit/965e54b8f1
2023-07-30 01:37:43 +00:00