79876 Commits

Author SHA1 Message Date
Nobuyoshi Nakada
03ef85bee7 Extract class/module context checks 2023-09-25 23:04:09 +09:00
Nobuyoshi Nakada
56604c7a3b Split the build of RESBODY nodes 2023-09-25 23:04:09 +09:00
Nobuyoshi Nakada
4449dcac15 Reduce stack usage in string_content 2023-09-25 23:04:09 +09:00
Nobuyoshi Nakada
dd292640bf Remove escape_Qundef
Ripper dispatcher methods always escape `Qundef` by `get_value`.
2023-09-25 23:04:09 +09:00
Nobuyoshi Nakada
963d12722e Name midrules in complex rules 2023-09-25 23:04:09 +09:00
Nobuyoshi Nakada
fbe4db5182 ripper: Support named references in the DSL 2023-09-25 23:04:09 +09:00
Nobuyoshi Nakada
bab01d284c [Feature #19790] Rename BUGREPORT_PATH as CRASH_REPORT 2023-09-25 22:57:28 +09:00
Nobuyoshi Nakada
f714448be7 Honor the same option given later 2023-09-25 22:57:28 +09:00
Nobuyoshi Nakada
70e8a08295 Add --bugreport-path option
It has precedence over the environment variable `RUBY_BUGREPORT_PATH`.
2023-09-25 22:57:28 +09:00
Nobuyoshi Nakada
696f08238b Add "piping bug reports to a program" to the manual page 2023-09-25 22:57:28 +09:00
Nobuyoshi Nakada
7c48a70c47 Test bug_report 2023-09-25 22:57:28 +09:00
Nobuyoshi Nakada
7e2775b057 Invoke the command when RUBY_BUGREPORT_PATH starts with | 2023-09-25 22:57:28 +09:00
Nobuyoshi Nakada
0f64290704 Add rb_w32_uspawn_process 2023-09-25 22:57:28 +09:00
Nobuyoshi Nakada
6bb4c9de09 Add RUBY_BUGREPORT_PATH to the manual page 2023-09-25 22:57:28 +09:00
Nobuyoshi Nakada
530b5ef6b6 Test bug_report 2023-09-25 22:57:28 +09:00
Nobuyoshi Nakada
be40eacc9d Extract expand_report_argument 2023-09-25 22:57:28 +09:00
Nobuyoshi Nakada
89b3c111ff Redirect to RUBY_BUGREPORT_PATH file 2023-09-25 22:57:28 +09:00
Nobuyoshi Nakada
85984a53e8 Abort dumping when output failed 2023-09-25 22:57:28 +09:00
Nobuyoshi Nakada
ac244938e8 Dump backtraces to an arbitrary stream 2023-09-25 22:57:28 +09:00
Haldun Bayhantopcu
acd44902b9 [ruby/yarp] Fix crashes in parsing block arguments
https://github.com/ruby/yarp/commit/e1f2fde775
2023-09-25 13:53:34 +00:00
David Rodriguez
0e808183ee [rubygems/rubygems] Allow standalone mode to work on a Windows edge case
If a gem is located in a different drive than the Gemfile, standalone
mode will fail to generate the `bundler/setup` script, failing with an
error like

```
ArgumentError: different prefix: "C:/" and "D:/a/rubygems/rubygems/bundler/tmp/2/bundled_app/bundle/bundler"
  C:/hostedtoolcache/windows/Ruby/3.0.5/x64/lib/ruby/3.0.0/pathname.rb:528:in `relative_path_from'
  D:/a/rubygems/rubygems/bundler/tmp/2/gems/system/gems/bundler-2.4.20/lib/bundler/installer/standalone.rb:58:in `gem_path'
  D:/a/rubygems/rubygems/bundler/tmp/2/gems/system/gems/bundler-2.4.20/lib/bundler/installer/standalone.rb:33:in `block (2 levels) in paths'
  D:/a/rubygems/rubygems/bundler/tmp/2/gems/system/gems/bundler-2.4.20/lib/bundler/installer/standalone.rb:32:in `map'
  D:/a/rubygems/rubygems/bundler/tmp/2/gems/system/gems/bundler-2.4.20/lib/bundler/installer/standalone.rb:32:in `block in paths'
```

I'm fixing this by falling back to using a full path in this case.

This was caught by a failing spec, so I'm not adding new specs.

https://github.com/rubygems/rubygems/commit/3cb9b9ab7a
2023-09-25 07:13:21 +00:00
dependabot[bot]
7816307b30 Bump actions/checkout from 4.0.0 to 4.1.0
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.0.0 to 4.1.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](3df4ab11eb...8ade135a41)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-25 12:42:39 +09:00
Burdette Lamar
36cd2b2a52
[DOC] Correction for doc guide + TOC fix in File (#8505) 2023-09-24 17:57:21 -04:00
Peter Zhu
f43dac0df2 Add rb_hash_free for the GC to use 2023-09-24 09:07:52 -04:00
Peter Zhu
36cdf163df Add hash_st_free 2023-09-24 09:07:34 -04:00
yui-knk
34d802f32f Refactor to use ripper_new_yylval2 2023-09-24 12:58:01 +09:00
Nobuyoshi Nakada
94d7c70801
Fix test thread leakage 2023-09-24 09:50:01 +09:00
yui-knk
f38f8d4f4a The first arg of NEW_OPT_ARG is always 0 2023-09-24 09:08:39 +09:00
Adam Hess
c42261059d [Bug #19901]
fix leak in module clone

Co-authored-by: Peter Zhu <peter@peterzhu.ca>
2023-09-23 23:10:46 +02:00
Peter Zhu
61a2e9450c Fix memory leak in Hash#rehash for ST hashes
We need to free the old ST table in Hash#rehash.

Co-authored-by: Adam Hess <adamhess1991@gmail.com>
2023-09-23 11:24:41 -04:00
Nobuyoshi Nakada
d80002c902
Improve VCS::GIT#format_changelog addessing [ci skip] 2023-09-23 16:34:20 +09:00
Takashi Kokubun
1da97292f8 Ignore rbs test failures
For some reason, it's been failing only on YJIT, but apparently it's
reproducible on the interpreter as well. So it's not related to YJIT.

rbs marked rbs tests on Ruby master as allow_failures
https://github.com/ruby/rbs/pull/1536, so it's known to not work on Ruby
master.

We should revert this once we fix the flaky test failure on Ruby master.
2023-09-23 00:05:47 -07:00
Hartley McGuire
e581b78ed2 Improve performance of include? by 5-10x
Rails uses IPAddr#include? to evaluate what it should use as the
client's remote ip by filtering potential ips against a trusted list
of internal ips. In a _very_ minimal app, #include? was showing up in
a profile as ~1% of request time.

The issue is that #include? was converting itself and the other value
passed in to ranges of IPAddr. This mean as a worst case (where other is
a non-IPAddr, like a String) then there would be 5 IPAddr instances
created (other -> IPAddr, and two each for the conversions to ranges).
However, wrapping the begin and end values as IPAddr is not needed
because they are necessarily fixed addresses already.

This patch extracts the logic for getting the begin_addr and end_addr
from the #to_range method so that they can be used in #include? without
having to instantiate so many IPAddr.

Benchmark:

```ruby
net1 = IPAddr.new("192.168.2.0/24")
net2 = IPAddr.new("192.168.2.100")
net3 = IPAddr.new("192.168.3.0")
net4 = IPAddr.new("192.168.2.0/16")

Benchmark.ips do |x|
  x.report("/24 includes address") { net1.include? net2 }
  x.report("/24 not includes address") { net1.include? net3 }
  x.report("/16 includes /24") { net4.include? net1 }
  x.report("/24 not includes /16") { net1.include? net4 }
  x.compare!
end
```

Before:

```
Comparison:
    /24 not includes /16:   175041.3 i/s
/24 not includes address:   164933.2 i/s - 1.06x  (± 0.00) slower
        /16 includes /24:   163881.9 i/s - 1.07x  (± 0.00) slower
    /24 includes address:   163558.4 i/s - 1.07x  (± 0.00) slower
```

After:

```
Comparison:
    /24 not includes /16:  2588364.9 i/s
/24 not includes address:  1474650.7 i/s - 1.76x  (± 0.00) slower
        /16 includes /24:  1461351.0 i/s - 1.77x  (± 0.00) slower
    /24 includes address:  1425463.5 i/s - 1.82x  (± 0.00) slower
```
2023-09-23 02:22:25 +00:00
Peter Zhu
2ceb5363f9 Try to fix compilation on m68k
Compilation is failing on m68k-linux with:

```
./include/ruby/internal/static_assert.h:51:46: error: static assertion failed: "sizeof_method_def: offsetof(rb_method_definition_t, body)==8"
   51 | # define RBIMPL_STATIC_ASSERT0 __extension__ _Static_assert
      |                                              ^~~~~~~~~~~~~~
./include/ruby/internal/static_assert.h:70:5: note: in expansion of macro 'RBIMPL_STATIC_ASSERT0'
   70 |     RBIMPL_STATIC_ASSERT0(expr, # name ": " # expr)
      |     ^~~~~~~~~~~~~~~~~~~~~
./internal/static_assert.h:13:24: note: in expansion of macro 'RBIMPL_STATIC_ASSERT'
   13 | # define STATIC_ASSERT RBIMPL_STATIC_ASSERT
      |                        ^~~~~~~~~~~~~~~~~~~~
./method.h:203:1: note: in expansion of macro 'STATIC_ASSERT'
  203 | STATIC_ASSERT(sizeof_method_def, offsetof(rb_method_definition_t, body)==8);
      | ^~~~~~~~~~~~~
```
2023-09-22 16:14:09 -04:00
Kevin Newton
d285899879
[YARP] Use the integer base flag (#8476)
Use the integer base flag
2023-09-22 14:53:55 -04:00
Haldun Bayhantopcu
6de1a9238b [ruby/yarp] Check class name to be a constant path node or a constant read node
https://github.com/ruby/yarp/commit/fd7c44f13f
2023-09-22 17:08:04 +00:00
Jemma Issroff
9abaf392b1
Resync yarp (#8498)
* [YARP] Reject numbered parameters in block parameters

* [YARP] Do not allow BEGIN except the toplevel

---------

Co-authored-by: Haldun Bayhantopcu <haldun@github.com>
2023-09-22 12:05:47 -04:00
Haldun Bayhantopcu
c54e225f34 [ruby/yarp] Introduce YP_TOKEN_METHOD_NAME
https://github.com/ruby/yarp/commit/e855bf415c
2023-09-22 15:47:56 +00:00
Jemma Issroff
7424143730
[YARP] Remove minor instances of rb_intern (#8497) 2023-09-22 11:43:00 -04:00
Nobuyoshi Nakada
ea5f8e123c
Magical wait to get rid of deadlock on macOS 2023-09-22 23:45:54 +09:00
Nathan Froyd
416a8202bc [ruby/yarp] use yp_statements_node_body_length a little bit more
https://github.com/ruby/yarp/commit/65d8816178
2023-09-22 14:19:29 +00:00
Burdette Lamar
02022cef53 [ruby/stringio] [DOC] Fix link
(https://github.com/ruby/stringio/pull/65)

https://github.com/ruby/stringio/commit/e3ea087d04
2023-09-22 14:17:07 +00:00
Kevin Newton
a5ae5f71fd [ruby/yarp] Fix listener leave event order
https://github.com/ruby/yarp/commit/1e6e264836
2023-09-22 14:07:48 +00:00
BurdetteLamar
170e622aad [ruby/prettyprint] [DOC] Link fixes
https://github.com/ruby/prettyprint/commit/f1f583c827
2023-09-22 13:58:45 +00:00
Adam Hess
8b236e0c66 [Bug #19896]
fix memory leak in vm_method

This introduces a unified reference_count to clarify who is referencing a method.
This also allows us to treat the refinement method as the def owner since it counts itself as a reference

Co-authored-by: Peter Zhu <peter@peterzhu.ca>
2023-09-22 09:44:58 -04:00
Stan Lo
f59b488b5a [ruby/irb] Page show_source's output
(https://github.com/ruby/irb/pull/719)

https://github.com/ruby/irb/commit/3cedc5cb62
2023-09-22 13:00:32 +00:00
Haldun Bayhantopcu
c0d27af114 [ruby/yarp] Create arguments when necessary
https://github.com/ruby/yarp/commit/123332f255
2023-09-22 12:40:56 +00:00
Nobuyoshi Nakada
c8c35ded74
[YARP] Suppress constant redefinition warning
```
<compiled>:1: warning: already initialized constant Bar
test/yarp/compiler_test.rb:139: warning: previous definition of Bar was here
```
2023-09-22 19:41:52 +09:00
Benoit Daloze
50e3b27db7 [ruby/zlib] Add truffleruby-head in CI
* The latest release does not have this fix:
  c77f8bb35d

https://github.com/ruby/zlib/commit/8abc80b994
2023-09-22 07:29:22 +00:00
yui-knk
fb7a2ddb4b Directly free structure managed by imemo tmpbuf
NODE_ARGS, NODE_ARYPTN, NODE_FNDPTN manage memory of their
structure by imemo tmpbuf Object.
However rb_ast_struct has reference to NODE. Then these
memory can be freed directly when rb_ast_struct is freed.

This commit reduces parser's dependency on CRuby functions.
2023-09-22 11:25:53 +09:00