summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
66 min.Implement chilled stringsHEADmasterÉtienne Barrié
[Feature #20205] As a path toward enabling frozen string literals by default in the future, this commit introduce "chilled strings". From a user perspective chilled strings pretend to be frozen, but on the first attempt to mutate them, they lose their frozen status and emit a warning rather than to raise a `FrozenError`. Implementation wise, `rb_compile_option_struct.frozen_string_literal` is no longer a boolean but a tri-state of `enabled/disabled/unset`. When code is compiled with frozen string literals neither explictly enabled or disabled, string literals are compiled with a new `putchilledstring` instruction. This instruction is identical to `putstring` except it marks the String with the `STR_CHILLED (FL_USER3)` and `FL_FREEZE` flags. Chilled strings have the `FL_FREEZE` flag as to minimize the need to check for chilled strings across the codebase, and to improve compatibility with C extensions. Notes: - `String#freeze`: clears the chilled flag. - `String#-@`: acts as if the string was mutable. - `String#+@`: acts as if the string was mutable. - `String#clone`: copies the chilled flag. Co-authored-by: Jean Boussier <byroot@ruby-lang.org>
4 hoursBump github/codeql-action from 3.24.7 to 3.24.8dependabot[bot]
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.24.7 to 3.24.8. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/3ab4101902695724f9365a384f86c1074d94e18c...05963f47d870e2cb19a537396c1f668a348c7d8f) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
7 hoursBump actions/checkout from 4.1.1 to 4.1.2dependabot[bot]
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.1 to 4.1.2. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/b4ffde65f46336ab88eb53be808477a3936bae11...9bb56186c3b09b4f86b1c65136769dd318469633) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
7 hoursUpdate default gems list at 0985e587901a9039ee0f523d285ed3 [ci skip]git
7 hours[ruby/resolv] Bump up 0.4.0Hiroshi SHIBATA
https://github.com/ruby/resolv/commit/44ae1e8531
8 hoursDon't replace doc url for vendored filesHiroshi SHIBATA
8 hours[ruby/prism] [Compatibility] Improve printf formatHASUMI Hitoshi
For better compatibility, this patch suggests using __MINGW_PRINTF_FORMAT that GCC provides for MINGW environment. https://github.com/ruby/prism/commit/a3a792b64f
8 hours[ruby/did_you_mean] Do not use #inspect to avoid unexpected performance ↵Yuki Nishijima
degradation closes https://github.com/ruby/did_you_mean/pull/100 https://github.com/ruby/did_you_mean/commit/bd11eefd6c
13 hoursRemove duplicated function prototype rb_gc_disable_no_restPeter Zhu
15 hours[PRISM] Remove unnecessary dependencies in common.mkKevin Newton
17 hours[ruby/prism] Warn on frozen_string_literal after tokensKevin Newton
https://github.com/ruby/prism/commit/edece87801
17 hours[ruby/prism] CRuby error message for lonely elseKevin Newton
https://github.com/ruby/prism/commit/1219a709e4
17 hours[ruby/prism] Use `require_relative` in the Prism codebaseKoichi ITO
If there are many searches in the `$LOAD_PATH` in the user environment, require will perform unnecessary searches that are not needed. In contrast, `require_relative` is efficient because it uses a relative path. https://github.com/ruby/prism/commit/438ccc67bd
18 hoursYJIT: Support arity=-2 cfuncs (#10268)Alan Wu
This type of cfuncs shows up as consume a lot of cycles in profiles of the lobsters benchmark, even though in the stats they don't happen that frequently. Might be a bug in the profiling, but these calls are not too bad to support, so might as well do it. Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>
18 hours[PRISM] Process encoding on CLI for -KKevin Newton
18 hours[PRISM] Fix up frozen checks for arefKevin Newton
19 hoursHighlight messages in fetch-bundled_gemsNobuyoshi Nakada
19 hoursAdd more abstract decorations for messagingNobuyoshi Nakada
19 hoursRemove rb_raw_obj_info_basicPeter Zhu
It's not used outside of gc.c.
20 hours[PRISM] ResyncKevin Newton
22 hours[rubygems/rubygems] Deprecate `bundle plugin install --local-git=`Cody Cutrer
It's the exact same implementation as --git https://github.com/rubygems/rubygems/commit/18eb2418c6
26 hoursUpdate set_backtrace documentationJean Boussier
Followup: https://github.com/ruby/ruby/pull/10017 [Feature #13557]
26 hoursLaunchable: Remove unused codesNaoto Ono
29 hoursFaster Integer.sqrt for large bignumtompng
Integer.sqrt uses Newton's method. This pull request reduces the precision which was unnecessarily high in each calculation step.
30 hoursUpdate unmerged RBS to debug `EBADF` error (#10275)Soutaro Matsumoto
Update bundled_gems
31 hours[ruby/irb] docs(help): Add latest options to ja help messageOKURA Masafumi
(https://github.com/ruby/irb/pull/903) https://github.com/ruby/irb/commit/3c6d452495
35 hours[rubygems/rubygems] Ignore commented out keys in config fileDavid Rodriguez
https://github.com/rubygems/rubygems/commit/c4a8d2a930
47 hoursRefactor encdb and transdb templatesNobuyoshi Nakada
- Simplify globbed file names. - Prefer `File.open` over `Kernel#open`. - Swallow initializer blocks instead of line by line with flip-flop. - Re-structure converter list.
48 hoursRemove no longer needed matchingNobuyoshi Nakada
2 daysRevert "Remove flip-flop usages from build scripts"Nobuyoshi Nakada
This reverts commit 301fa452f7a9cdea922103e9c50d85a2d5652d0d.
2 daysPrefer `enum ruby_tag_type` over `int`Nobuyoshi Nakada
2 daysValidate tag type to jumpNobuyoshi Nakada
2 days[DOC] Mention about disallowed arguments in indexNobuyoshi Nakada
[Bug #19918] [Bug #20218]
2 days[Bug #20218] Reject keyword arguments in indexNobuyoshi Nakada
2 days[Bug #19918] Reject block passing in indexNobuyoshi Nakada
3 days[ruby/prism] Fix token incompatibility for `Prism::Translation::Parser::Lexer`Koichi ITO
This PR fixes token incompatibility for `Prism::Translation::Parser::Lexer` when using backquoted heredoc indetiner: ```ruby <<-` FOO` a b FOO ``` ## Parser gem (Expected) Returns `tXSTRING_BEG` as the first token: ```console $ bundle exec ruby -Ilib -rparser/ruby33 -ve \ 'buf = Parser::Source::Buffer.new("example.rb"); buf.source = File.read("example.rb"); p Parser::Ruby33.new.tokenize(buf)' ruby 3.3.0 (2023-12-25 revision https://github.com/ruby/prism/commit/5124f9ac75) [x86_64-darwin22] [s(:xstr, s(:str, "a\n"), s(:str, "b\n")), [], [[:tXSTRING_BEG, ["<<`", #<Parser::Source::Range example.rb 0...10>]], [:tSTRING_CONTENT, ["a\n", #<Parser::Source::Range example.rb 11...13>]], [:tSTRING_CONTENT, ["b\n", #<Parser::Source::Range example.rb 13...15>]], [:tSTRING_END, [" FOO", #<Parser::Source::Range example.rb 15...23>]], [:tNL, [nil, #<Parser::Source::Range example.rb 10...11>]]]] ``` ## `Prism::Translation::Parser` (Actual) Previously, the tokens returned by the Parser gem were different. The escaped backslash does not match in the `tSTRING_BEG` token and value of `tSTRING_END` token. ```console $ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve \ 'buf = Parser::Source::Buffer.new("example.rb"); buf.source = File.read("example.rb"); p Prism::Translation::Parser33.new.tokenize(buf)' ruby 3.3.0 (2023-12-25 revision https://github.com/ruby/prism/commit/5124f9ac75) [x86_64-darwin22] [s(:xstr, s(:str, "a\n"), s(:str, "b\n")), [], [[:tSTRING_BEG, ["<<\"", #<Parser::Source::Range example.rb 0...10>]], [:tSTRING_CONTENT, ["a\n", #<Parser::Source::Range example.rb 11...13>]], [:tSTRING_CONTENT, ["b\n", #<Parser::Source::Range example.rb 13...15>]], [:tSTRING_END, ["` FOO`", #<Parser::Source::Range example.rb 15...23>]], [:tNL, [nil, #<Parser::Source::Range example.rb 10...11>]]]] ``` After this correction, the AST and tokens returned by the Parser gem are the same: ```console $ bunlde exec ruby -Ilib -rprism -rprism/translation/parser33 -ve \ 'buf = Parser::Source::Buffer.new("example.rb"); buf.source = File.read("example.rb"); p Prism::Translation::Parser33.new.tokenize(buf)' ruby 3.3.0 (2023-12-25 revision https://github.com/ruby/prism/commit/5124f9ac75) [x86_64-darwin22] [s(:xstr, s(:str, "a\n"), s(:str, "b\n")), [], [[:tXSTRING_BEG, ["<<`", #<Parser::Source::Range example.rb 0...10>]], [:tSTRING_CONTENT, ["a\n", #<Parser::Source::Range example.rb 11...13>]], [:tSTRING_CONTENT, ["b\n", #<Parser::Source::Range example.rb 13...15>]], [:tSTRING_END, [" FOO", #<Parser::Source::Range example.rb 15...23>]], [:tNL, [nil, #<Parser::Source::Range example.rb 10...11>]]]] ``` https://github.com/ruby/prism/commit/308f8d85a1
3 daysAvoid caller-side hash allocation for f(*a, kw: 1) and f(*a, kw: 1, &block)Jeremy Evans
Previously, this used: ``` splatarray false duphash getlocal/getblockparamproxy # in the block passing case send ARGS_SPLAT|KW_SPLAT|KW_SPLAT_MUT ``` This changes the duphash to putobject, with putobject using a frozen version of the hash, and removing the keyword mutability: ``` splatarray false putobject getlocal/getblockparamproxy # in the block passing case send ARGS_SPLAT|KW_SPLAT ```
3 days[ruby/irb] Fix irb_history saved to current directorytomoya ishida
(https://github.com/ruby/irb/pull/901) * Always save irb_history in HOME or XDG_CONFIG_HOME Also split irbrc search logic from irb_history search logic as a refactor * Remove IRB.conf[:RC_NAME_GENERATOR] because it's not configurable This conf is used to specify which irbrc to load. Need to configure before irbrc is loaded, so it's actually not configurable. This conf is also used for history file search, but it is configurable by conf[:HISTORY_FILE]. * remove rc_file_test because it is tested with rc_files, remove useless test setup * Make internal irbrc searching method private https://github.com/ruby/irb/commit/11d03a6ff7
3 daysPrefer the simple read/write `File` singleton methodsNobuyoshi Nakada
3 daysPrefer the simple read/write `File` singleton methodsNobuyoshi Nakada
3 days[ruby/irb] Use markdown format for docsStan Lo
(https://github.com/ruby/irb/pull/890) * Convert irb.rb's document into markdown format * Hide should-be-private top-level methods from docs * Skip xmp.rb's docs * Declare lib/irb.rb's markup do it works in ruby/ruby too * Ignore docs folder https://github.com/ruby/irb/commit/e9a175e06b
3 days[ruby/did_you_mean] Avoid division for small length2Mau Magnaguagno
https://github.com/ruby/did_you_mean/commit/cb518e251a
3 days[ruby/did_you_mean] Remove Integer floor and prefix index from Jaro distanceMau Magnaguagno
The variable ``length2`` is an Integer, call to floor returns self. The variables ``i`` and ``prefix_bonus`` are equally incremented, no need to keep the ``i`` variable. https://github.com/ruby/did_you_mean/commit/4408802289
3 daysInitialize VM stack if VM_CHECK_MODEAlan Wu
Lately there has been a few flaky YJIT CI failures where a new Ruby thread is finding the canary on the VM stack. For example: https://github.com/ruby/ruby/actions/runs/8287357784/job/22679508482#step:14:109 After checking a local rr recording, it's clear that the canary was written there when YJIT was using a temporary malloc region, and then later handed to the new Ruby thread. Previously, the VM stack was uninitialized, so it can have stale values in it, like the canary. Though unlikely, this can happen without YJIT too. Initialize the stack if we're spawning canaries.
4 daysRemove unused macro TFPeter Zhu
4 days[ruby/prism] Fix token incompatibility for `Prism::Translation::Parser::Lexer`Koichi ITO
This PR fixes token incompatibility for `Prism::Translation::Parser::Lexer` when using escaped backslash in string literal: ```ruby "\\ foo \\ bar" ``` ## Parser gem (Expected) ```console $ bundle exec ruby -Ilib -rparser/ruby33 -ve \ 'buf = Parser::Source::Buffer.new("example.rb"); buf.source = File.read("example.rb"); p Parser::Ruby33.new.tokenize(buf)' ruby 3.3.0 (2023-12-25 revision https://github.com/ruby/prism/commit/5124f9ac75) [x86_64-darwin22] [s(:str, "\\ foo \\ bar"), [], [[:tSTRING, ["\\ foo \\ bar", #<Parser::Source::Range example.rb 0...15>]], [:tNL, [nil, #<Parser::Source::Range example.rb 15...16>]]]] ``` ## `Prism::Translation::Parser` (Actual) Previously, the tokens returned by the Parser gem were different. The escaped backslash does not match in the `tSTRING` token: ```console $ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve \ 'buf = Parser::Source::Buffer.new("example.rb"); buf.source = File.read("example.rb"); p Prism::Translation::Parser33.new.tokenize(buf)' ruby 3.3.0 (2023-12-25 revision https://github.com/ruby/prism/commit/5124f9ac75) [x86_64-darwin22] [s(:str, "\\ foo \\ bar"), [], [[:tSTRING, ["\\\\ foo \\\\ bar", #<Parser::Source::Range example.rb 0...15>]], [:tNL, [nil, #<Parser::Source::Range example.rb 15...16>]]]] ``` After this correction, the AST and tokens returned by the Parser gem are the same: ```console $ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve \ 'buf = Parser::Source::Buffer.new("example.rb"); buf.source = File.read("example.rb"); p Prism::Translation::Parser33.new.tokenize(buf)' ruby 3.3.0 (2023-12-25 revision https://github.com/ruby/prism/commit/5124f9ac75) [x86_64-darwin22] [s(:str, "\\ foo \\ bar"), [], [[:tSTRING, ["\\ foo \\ bar", #<Parser::Source::Range example.rb 0...15>]], [:tNL, [nil, #<Parser::Source::Range example.rb 15...16>]]]] ``` The reproduction test is based on the following strings.txt and exists: https://github.com/ruby/prism/blob/v0.24.0/test/prism/fixtures/strings.txt#L79 But, the restoration has not yet been performed due to remaining other issues in strings.txt. https://github.com/ruby/prism/commit/2c44e7e307
4 days[ruby/prism] Fix a token incompatibility for `Prism::Translation::Parser::Lexer`Koichi ITO
This PR fixes a token incompatibility between Parser gem and `Prism::Translation::Parser` for the heredocs_leading_whitespace.txt test. https://github.com/ruby/prism/commit/7d45fb1eed
4 daysAvoid a hash allocation when calling def f(kw: 1) with keyword splatJeremy Evans
c20e819e8b04e84a4103ca9a036022543459c213 made calling a method that accepts specific keywords but not a keyword splat with a keyword splat allocating a hash when it previously did not. Instead of duplicating the hash and removing hash entries, lookup in the provided hash without duplicating the hash, and track to make sure all hash entries in the hash were looked up (extra hash entries would be errors).
4 daysSkip warnings for duplicate keysNobuyoshi Nakada
4 daysRefactor frozen_string_literal check during compilationJean Boussier
In preparation for https://bugs.ruby-lang.org/issues/20205. The `frozen_string_literal` compilation option will no longer be a boolean but a tri-state: `on/off/default`.