David Rodríguez
07fa9e3a8f
[rubygems/rubygems] Remove unnecessary verification
...
`DSL#to_definition` already verifies this.
c596f0af83
2024-09-10 02:50:47 +00:00
David Rodríguez
d6baa6258c
[rubygems/rubygems] Avoid having to redefine Definition#lock
in inline mode
...
0b7be7bb77
Co-authored-by: Jonathan Hefner <jonathan@hefner.pro>
2024-09-10 02:50:46 +00:00
Peter Zhu
88723dd5a5
[DOC] Fix missing colons in String
2024-09-09 15:28:05 -04:00
Burdette Lamar
bd7bc9e2ba
[DOC] Rationalize aliases in "What's Here" ( #11517 )
2024-09-09 15:26:00 -04:00
Burdette Lamar
2b1147f1de
[DOC] Rationalize aliases in "What's Here" ( #11516 )
2024-09-09 15:24:33 -04:00
Koichi ITO
7a65334528
[ruby/prism] Fix a token incompatibility for Prism::Translation::Parser::Lexer
...
This PR fixes a token incompatibility between Parser gem and `Prism::Translation::Parser` for double splat argument.
## Parser gem (Expected)
Returns `tDSTAR` token:
```console
$ bundle exec ruby -Ilib -rparser/ruby33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "def f(**foo) end"; p Parser::Ruby33.new.tokenize(buf)[2]'
ruby 3.4.0dev (2024-09-01T11:00:13Z master eb144ef91e
) [x86_64-darwin23]
[[:kDEF, ["def", #<Parser::Source::Range example.rb 0...3>]], [:tIDENTIFIER, ["f", #<Parser::Source::Range example.rb 4...5>]],
[:tLPAREN2, ["(", #<Parser::Source::Range example.rb 5...6>]], [:tDSTAR, ["**", #<Parser::Source::Range example.rb 6...8>]],
[:tIDENTIFIER, ["foo", #<Parser::Source::Range example.rb 8...11>]], [:tRPAREN, [")", #<Parser::Source::Range example.rb 11...12>]],
[:kEND, ["end", #<Parser::Source::Range example.rb 13...16>]]]
```
## `Prism::Translation::Parser` (Actual)
Previously, the parser returned `tPOW` token when parsing the following:
```console
$ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "def f(**foo) end"; p Prism::Translation::Parser33.new.tokenize(buf)[2]'
ruby 3.4.0dev (2024-09-01T11:00:13Z master eb144ef91e
) [x86_64-darwin23]
[[:kDEF, ["def", #<Parser::Source::Range example.rb 0...3>]], [:tIDENTIFIER, ["f", #<Parser::Source::Range example.rb 4...5>]],
[:tLPAREN2, ["(", #<Parser::Source::Range example.rb 5...6>]], [:tPOW, ["**", #<Parser::Source::Range example.rb 6...8>]],
[:tIDENTIFIER, ["foo", #<Parser::Source::Range example.rb 8...11>]], [:tRPAREN, [")", #<Parser::Source::Range example.rb 11...12>]],
[:kEND, ["end", #<Parser::Source::Range example.rb 13...16>]]]
```
After the update, the parser now returns `tDSTAR` token for the same input:
```console
$ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "def f(**foo) end"; p Prism::Translation::Parser33.new.tokenize(buf)[2]'
ruby 3.4.0dev (2024-09-01T11:00:13Z master eb144ef91e
) [x86_64-darwin23]
[[:kDEF, ["def", #<Parser::Source::Range example.rb 0...3>]], [:tIDENTIFIER, ["f", #<Parser::Source::Range example.rb 4...5>]],
[:tLPAREN2, ["(", #<Parser::Source::Range example.rb 5...6>]], [:tDSTAR, ["**", #<Parser::Source::Range example.rb 6...8>]],
[:tIDENTIFIER, ["foo", #<Parser::Source::Range example.rb 8...11>]], [:tRPAREN, [")", #<Parser::Source::Range example.rb 11...12>]],
[:kEND, ["end", #<Parser::Source::Range example.rb 13...16>]]]
```
With this change, the following code could be removed from test/prism/ruby/parser_test.rb:
```diff
- when :tPOW
- actual_token[0] = expected_token[0] if expected_token[0] == :tDSTAR
```
`tPOW` is the token type for the behavior of `a ** b`, and its behavior remains unchanged:
```console
$ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "a ** b"; p Prism::Translation::Parser33.new.tokenize(buf)[2]'
ruby 3.4.0dev (2024-09-01T11:00:13Z master eb144ef91e
) [x86_64-darwin23]
[[:tIDENTIFIER, ["a", #<Parser::Source::Range example.rb 0...1>]], [:tPOW, ["**", #<Parser::Source::Range example.rb 2...4>]],
[:tIDENTIFIER, ["b", #<Parser::Source::Range example.rb 5...6>]]]
```
66bde35a44
2024-09-09 19:01:30 +00:00
Peter Zhu
1205f17125
ASAN unlock freelist in size_pool_add_page
2024-09-09 10:55:18 -04:00
Peter Zhu
f2057277ea
ASAN unlock freelist in gc_sweep_step
2024-09-09 10:23:25 -04:00
Peter Zhu
5a502c1873
Add keys to GC.stat and fix tests
...
This adds keys heap_empty_pages and heap_allocatable_slots to GC.stat.
2024-09-09 10:15:21 -04:00
Peter Zhu
079ef92b5e
Implement global allocatable slots and empty pages
...
[Bug #20710 ]
This commit introduces moves allocatable slots and empty pages from per
size pool to global. This allows size pools to grow globally and allows
empty pages to move between size pools.
For the benchmark in [Bug #20710 ], this signficantly improves performance:
Before:
new_env 2.563 (± 0.0%) i/s - 26.000 in 10.226703s
new_rails_env 0.293 (± 0.0%) i/s - 3.000 in 10.318960s
After:
new_env 3.781 (±26.4%) i/s - 37.000 in 10.302374s
new_rails_env 0.911 (± 0.0%) i/s - 9.000 in 10.049337s
In the headline benchmarks on yjit-bench, we see the performance is
basically on-par with before, with ruby-lsp being signficantly faster
and activerecord and erubi-rails being slightly slower:
-------------- ----------- ---------- ----------- ---------- -------------- -------------
bench master (ms) stddev (%) branch (ms) stddev (%) branch 1st itr master/branch
activerecord 452.2 0.3 479.4 0.4 0.96 0.94
chunky-png 1157.0 0.4 1172.8 0.1 0.99 0.99
erubi-rails 905.4 0.3 967.2 0.4 0.94 0.94
hexapdf 3566.6 0.6 3553.2 0.3 1.03 1.00
liquid-c 88.9 0.9 89.0 1.3 0.98 1.00
liquid-compile 93.4 0.9 89.9 3.5 1.01 1.04
liquid-render 224.1 0.7 227.1 0.5 1.00 0.99
lobsters 1052.0 3.5 1067.4 2.1 0.99 0.99
mail 197.1 0.4 196.5 0.5 0.98 1.00
psych-load 2960.3 0.1 2988.4 0.8 1.00 0.99
railsbench 2252.6 0.4 2255.9 0.5 0.99 1.00
rubocop 262.7 1.4 270.1 1.8 1.02 0.97
ruby-lsp 275.4 0.5 242.0 0.3 0.97 1.14
sequel 98.4 0.7 98.3 0.6 1.01 1.00
-------------- ----------- ---------- ----------- ---------- -------------- -------------
2024-09-09 10:15:21 -04:00
Peter Zhu
de7ac11a09
Replace heap_allocated_pages with rb_darray_size
2024-09-09 10:15:21 -04:00
Peter Zhu
b66d6e48c8
Switch sorted list of pages in the GC to a darray
2024-09-09 10:15:21 -04:00
Jean Boussier
16f241f0aa
Implement String#append_as_bytes(String | Integer, ...)
...
[Feature #20594 ]
A handy method to construct a string out of multiple chunks.
Contrary to `String#concat`, it doesn't do any encoding negociation,
and simply append the content as bytes regardless of whether this
result in a broken string or not.
It's the caller responsibility to check for `String#valid_encoding?`
in cases where it's needed.
When passed integers, only the lower byte is considered, like in
`String#setbyte`.
2024-09-09 15:04:51 +02:00
Daniel Colson
966901b39d
[rubygems/rubygems] Don't include hook templates in cached git source
...
With a default git setup, each cloned repo in the cache will end up with
~60K of sample git hooks. These files all end in `.sample`, and they are
disabled by default. Deleting them should be a no-op, and makes the
cache a bit smaller.
d2149999cd
2024-09-09 11:59:52 +00:00
Nobuyoshi Nakada
3aae0873f7
Update clang for LTO
2024-09-09 19:22:45 +09:00
Nobuyoshi Nakada
391bb55a8e
Run just bignum related tests when gmp enabled
2024-09-09 19:12:41 +09:00
zverok
d7b0f26963
Return back legacy Range#step behavior for symbol ranges
2024-09-09 17:46:13 +09:00
David Rodríguez
155989415b
[rubygems/rubygems] Avoid now unnecessary reset
...
511c7b211b
2024-09-09 08:46:02 +00:00
David Rodríguez
72e80c8f29
[rubygems/rubygems] Make gem exec
use the standard GEM_HOME
...
032b3c518a
2024-09-09 08:46:01 +00:00
David Rodríguez
a304fe00f3
[rubygems/rubygems] Fix gem fetch
always exiting with zero status code
...
5887e6dfa1
2024-09-09 08:44:27 +00:00
Nobuyoshi Nakada
a2ae7450d7
Suppress discards qualifiers warning with ASN
2024-09-09 16:25:43 +09:00
git
330b2ffb51
Update default gems list at 2d4fdafa64
[ci skip]
2024-09-09 06:47:55 +00:00
Hiroshi SHIBATA
2d4fdafa64
[ruby/psych] Bump up 5.2.0.beta1
...
a8b73bb80e
2024-09-09 06:46:51 +00:00
Juanjo Bazán
74872109be
[ruby/psych] Unlimited line_width with -1
...
3b63a93dfc
2024-09-09 06:44:40 +00:00
Hiroshi SHIBATA
dbfabafe96
[ruby/psych] Make to load stringio lazily
...
9f5392d180
2024-09-09 06:43:35 +00:00
Gareth Jones
aed8e46118
[ruby/psych] docs: specify correct default fallback
value
...
ce7946981d
2024-09-09 06:40:59 +00:00
ydah
d52e599538
Implement WHEN NODE locations
2024-09-09 10:34:02 +09:00
JP Camara
b5f1291015
The Timeout::Error example no longer works consistently
...
* This PR from the timeout gem (https://github.com/ruby/timeout/pull/30 ) made it so you have to handle_interrupt on Timeout::ExitException instead of Timeout::Error
* Efficiency changes to the gem (one shared thread) mean you can't consistently handle timeout errors using handle_timeout: https://github.com/ruby/timeout/issues/41
2024-09-09 09:10:06 +09:00
Earlopain
19c1f0233e
[ruby/benchmark] Set required_ruby_version = ">= 2.1.0"
...
`Process.clock_gettime` only works since 2.1
94cfe56291
2024-09-08 16:43:50 +00:00
Nobuyoshi Nakada
ac960b08ee
Clean up dummped IBF files
2024-09-09 00:51:41 +09:00
Nobuyoshi Nakada
6e544f2fed
Initialize goruby only when executing
2024-09-08 23:40:18 +09:00
Nobuyoshi Nakada
ecb58a8d08
Fix prelude to use IBF
...
Since universal-parser and prism support, prelude code used functions
inaccessible from outside libruby shared library.
```
linking goruby
/usr/bin/ld: goruby.o: in function `prelude_eval':
/home/runner/work/ruby/ruby/build/golf_prelude.c:221: undefined reference to `rb_ruby_prism_ptr'
/usr/bin/ld: goruby.o: in function `pm_prelude_load':
/home/runner/work/ruby/ruby/build/golf_prelude.c:192: undefined reference to `pm_options_line_set'
/usr/bin/ld: /home/runner/work/ruby/ruby/build/golf_prelude.c:193: undefined reference to `pm_parse_string'
/usr/bin/ld: goruby.o: in function `prelude_eval':
/home/runner/work/ruby/ruby/build/golf_prelude.c:224: undefined reference to `pm_iseq_new_with_opt'
/usr/bin/ld: /home/runner/work/ruby/ruby/build/golf_prelude.c:226: undefined reference to `pm_parse_result_free'
/usr/bin/ld: goruby.o: in function `prelude_ast_value':
/home/runner/work/ruby/ruby/build/golf_prelude.c:181: undefined reference to `rb_ruby_ast_data_get'
/usr/bin/ld: goruby.o: in function `prelude_eval':
/home/runner/work/ruby/ruby/build/golf_prelude.c:231: undefined reference to `rb_ruby_ast_data_get'
/usr/bin/ld: goruby.o: in function `pm_prelude_load':
/home/runner/work/ruby/ruby/build/golf_prelude.c:196: undefined reference to `pm_parse_result_free'
collect2: error: ld returned 1 exit status
```
2024-09-08 23:40:17 +09:00
Nobuyoshi Nakada
70871fa6e3
Extract rb_builtin_find
...
Refactor out the same code from `rb_builtin_ast_value` and
`pm_builtin_ast_value.
2024-09-08 23:16:46 +09:00
Nobuyoshi Nakada
be84abffba
Gather code for builtin loading to miniinit.c
2024-09-08 23:16:46 +09:00
Nobuyoshi Nakada
d2179eeaac
Try to run goruby
2024-09-08 23:16:46 +09:00
otegami
903f3790ad
[ruby/open-uri] Update error message for request_specific_fields
option validation
...
Added `inspect` to the `request_specific_fields` value to provide
better visibility for users in the exception message.
f89ce5112d
2024-09-08 14:13:00 +00:00
otegami
76475bf5c0
[ruby/open-uri] Add documentation for request_specific_fields
option
...
2e7734c061
2024-09-08 14:13:00 +00:00
otegami
0ac16215da
[ruby/open-uri] Add test about request_specific_fields
option
...
060886f312
2024-09-08 14:12:59 +00:00
otegami
6ea2b6f65f
[ruby/open-uri] Add request_specific_fields
option for customizing headers
...
This commit introduces the `request_specific_fields` option in OpenURI.
It provides two methods for customizing headers as follows.
1. Specify headers only for the initial request
Use a Hash to apply headers only to the first request.
These headers are automatically removed during redirects.
2. Specify headers dynamically for each request
Use a Proc to dynamically generate headers for each request,
including during redirects, based on the request URL.
This feature allows users to control headers flexibly,
ensuring that sensitive headers like "Authorization" are not unintentionally
transferred during redirects unless explicitly specified.
460f858e3c
2024-09-08 14:12:59 +00:00
Mads Ohm Larsen
ec5d5422ca
[ruby/rdoc] Use pointer cursor for navigation toggle
...
(https://github.com/ruby/rdoc/pull/1175 )
964a1982c8
2024-09-08 12:17:36 +00:00
Koichi ITO
4774284124
[ruby/prism] Fix a token incompatibility for Prism::Translation::Parser::Lexer
...
This PR fixes a token incompatibility between Parser gem and `Prism::Translation::Parser` for left parenthesis.
## Parser gem (Expected)
Returns `tLPAREN2` token:
```console
$ bundle exec ruby -Ilib -rparser/ruby33 \
-ve 'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "foo(:bar)"; p Parser::Ruby33.new.tokenize(buf)[2]'
ruby 3.4.0dev (2024-09-01T11:00:13Z master eb144ef91e
) [x86_64-darwin23]
[[:tIDENTIFIER, ["foo", #<Parser::Source::Range example.rb 0...3>]], [:tLPAREN2, ["(", #<Parser::Source::Range example.rb 3...4>]],
[:tSYMBOL, ["bar", #<Parser::Source::Range example.rb 4...8>]], [:tRPAREN, [")", #<Parser::Source::Range example.rb 8...9>]]]
```
## `Prism::Translation::Parser` (Actual)
Previously, the parser returned `tLPAREN` token when parsing the following:
```console
$ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "foo(:bar)"; p Prism::Translation::Parser33.new.tokenize(buf)[2]'
ruby 3.4.0dev (2024-09-01T11:00:13Z master eb144ef91e
) [x86_64-darwin23]
[[:tIDENTIFIER, ["foo", #<Parser::Source::Range example.rb 0...3>]], [:tLPAREN, ["(", #<Parser::Source::Range example.rb 3...4>]],
[:tSYMBOL, ["bar", #<Parser::Source::Range example.rb 4...8>]], [:tRPAREN, [")", #<Parser::Source::Range example.rb 8...9>]]]
```
After the update, the parser now returns `tLPAREN2` token for the same input:
```console
$ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "foo(:bar)"; p Prism::Translation::Parser33.new.tokenize(buf)[2]'
ruby 3.4.0dev (2024-09-01T11:00:13Z master eb144ef91e
) [x86_64-darwin23]
[[:tIDENTIFIER, ["foo", #<Parser::Source::Range example.rb 0...3>]], [:tLPAREN2, ["(", #<Parser::Source::Range example.rb 3...4>]],
[:tSYMBOL, ["bar", #<Parser::Source::Range example.rb 4...8>]], [:tRPAREN, [")", #<Parser::Source::Range example.rb 8...9>]]]
```
The `PARENTHESIS_LEFT` token in Prism is classified as either `tLPAREN` or `tLPAREN2` in the Parser gem.
The tokens that were previously all classified as `tLPAREN` are now also classified to `tLPAREN2`.
With this change, the following code could be removed from `test/prism/ruby/parser_test.rb`:
```diff
- when :tLPAREN
- actual_token[0] = expected_token[0] if expected_token[0] == :tLPAREN2
```
04d6f3478d
2024-09-07 22:36:38 +00:00
Nobuyoshi Nakada
f97332a3a3
Preserve encoding in exception message of Float
2024-09-07 16:34:28 +09:00
Nobuyoshi Nakada
c1862cbb89
[Bug #20719 ] Float
argument must be ASCII compatible
2024-09-07 16:06:14 +09:00
Jonathan Calvert
c1a510a8df
[Bug #20718 ] Free non-RTypedData
objects
...
Allow objects that are not of type `RTypedData` to use the default
free function, as `RTYPEDDATA_EMBEDDED_P` can return a false positive
when casting non-`RTypedData` objects.
2024-09-07 12:19:47 +09:00
Mads Ohm Larsen
6dc9384694
[ruby/rdoc] Add more space after magnifying glass
...
(https://github.com/ruby/rdoc/pull/1173 )
6a9cad4c54
2024-09-06 21:26:17 +00:00
KJ Tsanaktsidis
731805ddde
Add an explicit check for broken libunwind builds
...
Libunwind as packaged in MacOS cannot actually unwind code which has
pointer authentication on, because _LIBUNWIND_IS_NATIVE_ONLY is not
defined. Add a check for this, and prefer building with working
unwinding over pointer authentication if we must make a choice.
2024-09-06 16:51:19 -04:00
Peter Zhu
2865148a5a
Revert "Check for both aarch64 and arm64 arch's for pac-ret"
...
This reverts commit 6a746e1bc9
.
This patch breaks the C level backtrace on macOS ARM machines.
2024-09-06 16:51:19 -04:00
David Rodríguez
b0adae7fb2
[rubygems/rubygems] Remove unnecessary "./" when appending string to uri
...
732679306d
2024-09-06 18:44:38 +00:00
David Rodríguez
fe1bace43c
[rubygems/rubygems] Fix gem install does-not-exist
being super slow
...
Every time a gem is not found in the Compact Index API, RubyGems will
fallback to the full index, which is very slow. This is unnecessary
because both indexes should be providing the same gems, so if a gem
can't be found in the Compact Index API, it won't be found in the full
index.
We _do_ want a fallback to the full index, whenever the Compact Index
API is not implemented. To detect that, we check that the API responds
to the "/versions" endpoint, just like Bundler does.
Before:
```
$ time gem install fooasdsfafs
ERROR: Could not find a valid gem 'fooasdsfafs' (>= 0) in any repository
gem 20,77s user 0,59s system 96% cpu 22,017 total
```
After:
```
$ time gem install fooasdsfafs
ERROR: Could not find a valid gem 'fooasdsfafs' (>= 0) in any repository
gem 5,02s user 0,09s system 91% cpu 5,568 total
```
c0d6b9eea7
2024-09-06 18:44:37 +00:00
David Rodríguez
2a17b4f022
[rubygems/rubygems] Deprecate constant that has been unused for a long time
...
282dbb3d62
2024-09-06 18:44:37 +00:00