aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* [rubygems/rubygems] Refactor `set_paths!`David Rodríguez2024-07-231-2/+12
| | | | | | | | | | | | | | | | | | The method has two different concerns not straightforward to distinguish. One is to set a new `install_path`, which is done by setting the `@install_path` instance variable, and invalidating the `local_specs` memoization, so that the next time they are picked from the new location. The other one is to set a new `cache_path` which is done by setting the `@cache_path` instance variable, and invalidating the `git_proxy` memoization, so that the next git proxy uses the new cache location. This commit splits the logic so that this is easier to understand. https://github.com/rubygems/rubygems/commit/55904094e8
* [rubygems/rubygems] Restrict local behaviour of git gems to local overridesDavid Rodríguez2024-07-231-4/+4
| | | | | | | We want local overrides to behave just like "path gems" but per-app caches are different. https://github.com/rubygems/rubygems/commit/797d717a2d
* [rubygems/rubygems] Prefer `install_path` aliasDavid Rodríguez2024-07-231-1/+1
| | | | | | For consistency with the rest of usages in this class. https://github.com/rubygems/rubygems/commit/69f9ab34b1
* [rubygems/rubygems] Move duplicated code to a methodDavid Rodríguez2024-07-231-8/+9
| | | | https://github.com/rubygems/rubygems/commit/fbb4ce168c
* [rubygems/rubygems] Add debugging message to `Bundler::Source::Git#specs`David Rodríguez2024-07-231-0/+1
| | | | | | | | | It's not obvious that the git source actually reinstalls a proper checkout of the repository on usage if necessary. This adds a debugging message to log that, just like it's done when explicitly installing the source. https://github.com/rubygems/rubygems/commit/04e8e42a43
* [rubygems/rubygems] Explicitly encode Gem::Dependency to yamlSamuel Giddins2024-07-232-7/+13
| | | | | | This ensures that instance variable ordering cannot cause non-determinism in serialized gems https://github.com/rubygems/rubygems/commit/0e912704f7
* [rubygems/rubygems] Fix `bundle exec gem uninstall`David Rodríguez2024-07-232-1/+20
| | | | | | | | | | | | | | | | | | | * `bundle exec` assigns `Gem::Specification.all` to the set of specs known to Bundler (a `Bundler::SpecSet`). * `gem uninstall` recently started calling `#delete` on the set of specs stored in `Gem::Specification#all`. This, in RubyGems, is just an array of specs, so has a `#delete` method that receives a single element. * However, at some point I added a `SpecSet#delete` method that takes an array of specs, breaking the "Array-like" contract and making `gem uninstall` break when run in a `bundle exec` context. The fix is to make `Bundler::SpecSet#delete` handle being given a single spec. https://github.com/rubygems/rubygems/commit/e3acb7b01d
* [rubygems/rubygems] Enable checksums on Bundler 3 for fresh lockfilesDavid Rodríguez2024-07-2319-244/+382
| | | | | | And get specs passing. https://github.com/rubygems/rubygems/commit/c23b5f5b84
* [rubygems/rubygems] Extract a `rake_path` helperDavid Rodríguez2024-07-232-5/+4
| | | | https://github.com/rubygems/rubygems/commit/0f2db73619
* [rubygems/rubygems] Normalize a few specs using sourcesDavid Rodríguez2024-07-233-48/+48
| | | | | | Use the standard sources to avoid having to explictly pass ENV with the repo. https://github.com/rubygems/rubygems/commit/95055dba57
* [rubygems/rubygems] Enforce passing a block to `simulate_platform`David Rodríguez2024-07-238-276/+282
| | | | https://github.com/rubygems/rubygems/commit/0658903e25
* Fix running GC in finalizer when RUBY_FREE_AT_EXITPeter Zhu2024-07-231-4/+4
| | | | | | | | | | | | | The following code crashes because the GC ran during finalizers will cause T_ZOMBIE objects to be on the heap, which crashes when we call rb_gc_obj_free on it: raise_proc = proc do |id| GC.start end 1000.times do ObjectSpace.define_finalizer(Object.new, raise_proc) end
* [ruby/prism] Single line method bodies should not be marked as newlineKevin Newton2024-07-2325-67/+67
| | | | https://github.com/ruby/prism/commit/18a8597276
* [DOC] Allow linking to File#path in Tempfile.createPeter Zhu2024-07-231-1/+1
|
* [DOC] Fix code formatting for Tempfile.createPeter Zhu2024-07-231-5/+5
|
* [PRISM] Fix up ensure compilation, match compile.cKevin Newton2024-07-231-26/+31
|
* [DOC] Doc for BasicObject (#11139)Burdette Lamar2024-07-231-41/+38
|
* [ruby/prism] Recurse upward to detect invalid returnsKevin Newton2024-07-231-7/+80
| | | | https://github.com/ruby/prism/commit/3d39b7961f
* Fix memory leak in parser when loading non-ASCII filePeter Zhu2024-07-231-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When loading a non-ASCII compatible file, an error is raised which causes memory leak. For example: require "tempfile" Tempfile.create do |f| f.write("# -*- coding: UTF-16BE -*-") f.flush 10.times do 20_000.times do begin load(f.path) rescue end end puts `ps -o rss= -p #{$$}` end end Before: 33904 49072 64528 79216 94576 109504 124768 139536 154928 170256 After: 19568 21296 21664 21728 22192 22256 22416 22272 22272 22272
* Implement UNLESS NODE keyword locationsyui-knk2024-07-235-15/+53
|
* [Feature #20624] Enhance `RubyVM::AbstractSyntaxTree::Node#locations`yui-knk2024-07-234-0/+206
| | | | | | | | | | | | | | | | This commit introduce `RubyVM::AbstractSyntaxTree::Node#locations` method and `RubyVM::AbstractSyntaxTree::Location` class. Ruby AST node will hold multiple locations information. `RubyVM::AbstractSyntaxTree::Node#locations` provides a way to access these locations information. `RubyVM::AbstractSyntaxTree::Location` is a class which holds these location information: * `#first_lineno` * `#first_column` * `#last_lineno` * `#last_column`
* newobj_of(): Use parameter instead of GET_RACTOR()Alan Wu2024-07-221-3/+3
| | | | No point repeating the work callers to this function already do.
* [ruby/prism] Ignore shebangs in evalsKevin Newton2024-07-221-1/+1
| | | | https://github.com/ruby/prism/commit/4c55409794
* [ruby/prism] Implement mismatched indentation warningKevin Newton2024-07-225-105/+391
| | | | https://github.com/ruby/prism/commit/5d5bf92be8
* [PRISM] Use xcalloc for constants instead of callocPeter Zhu2024-07-221-1/+1
|
* [PRISM] Fix memory leak in constantsPeter Zhu2024-07-221-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For example, the following code leaks: code = 1000.times.map { |i| "var#{i} = 1" }.join("\n") 10.times do 1000.times do RubyVM::InstructionSequence.compile_prism(code) end puts `ps -o rss= -p #{$$}` end Before: 70384 88032 103856 115712 125584 132768 144784 152624 165296 180608 After: 62368 78784 74512 87712 85072 77728 69424 74992 71264 81440
* Document the reasoning behind the fix for [Bug #20641]Jean Boussier2024-07-221-0/+9
|
* Add newline when printing dlopen error messagePeter Zhu2024-07-221-1/+1
|
* bundled_gems.rb: Add a fast pathJean Boussier2024-07-222-0/+44
| | | | | | | | | | | | | | | | | | | [Bug #20641] `Gem::BUNDLED_GEMS.warning?` adds a lot of extra work on top of `require`. When the call end up atually loading code the overhead is somewhat marginal. However it's not uncommon for code to go some late `require` in some paths, so it's expected that calling `require` with something already required is somewhat fast, and `bundled_gems.rb` breaks this assumption. To avoid this, we can have a fast path that in most case allow to short-circuit all the heavy computations. If we extract the feature basename and it doesn't match any of the bundled gems we care about we can return very early. With this change `require 'date'` is now only 1.33x slower on Ruby 3.3.3, than it was on Ruby 3.2.2, whereas before this change it was at least 100x slower.
* Bump github/codeql-action from 3.25.12 to 3.25.13dependabot[bot]2024-07-222-5/+5
| | | | | | | | | | | | | | | Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.25.12 to 3.25.13. - [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/4fa2a7953630fd2f3fb380f21be14ede0169dd4f...2d790406f505036ef40ecba973cc774a50395aac) --- 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>
* [ruby/uri] Restrict constant checks to current namespace to avoid conflicts ↵Randy Stauner2024-07-211-3/+3
| | | | | | with globals https://github.com/ruby/uri/commit/7a64e0245f
* Fix a typo in setup of block-after-blockcall testsNobuyoshi Nakada2024-07-211-1/+1
| | | | | Unparenthesize the argument and make `command_call` when calling with `do`-block.
* Remove unneeded local variableNobuyoshi Nakada2024-07-211-2/+1
| | | | `$5`, `brace_block` is no longer assigned in this action.
* Fix SEGV on method call with empty args and brace block for do block command ↵yui-knk2024-07-212-1/+5
| | | | call
* Do not set Enumerator::Lazy#zip to use packed formatJeremy Evans2024-07-202-1/+4
| | | | | | | Enumerator#zip yields a single array, not multiple arguments, so Enumerator::Lazy#zip should do the same. Fixes [#20623]
* Include `undef` keyword into UNDEF NODE locationyui-knk2024-07-201-0/+1
| | | | | | | | | | | | | | | | | | | | For example: ``` undef a, b ``` Before: ``` @ NODE_UNDEF (id: 1, line: 1, location: (1,6)-(1,10))* ``` After: ``` @ NODE_UNDEF (id: 1, line: 1, location: (1,0)-(1,10))* ```
* Change UNDEF Node structureyui-knk2024-07-206-15/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change UNDEF Node to hold their items to keep the original grammar structure. For example: ``` undef a, b ``` Before: ``` @ NODE_BLOCK (id: 4, line: 1, location: (1,6)-(1,10))* +- nd_head (1): | @ NODE_UNDEF (id: 1, line: 1, location: (1,6)-(1,7)) | +- nd_undef: | @ NODE_SYM (id: 0, line: 1, location: (1,6)-(1,7)) | +- string: :a +- nd_head (2): @ NODE_UNDEF (id: 3, line: 1, location: (1,9)-(1,10)) +- nd_undef: @ NODE_SYM (id: 2, line: 1, location: (1,9)-(1,10)) +- string: :b ``` After: ``` @ NODE_UNDEF (id: 1, line: 1, location: (1,6)-(1,10))* +- nd_undefs: +- length: 2 +- element (0): | @ NODE_SYM (id: 0, line: 1, location: (1,6)-(1,7)) | +- string: :a +- element (1): @ NODE_SYM (id: 2, line: 1, location: (1,9)-(1,10)) +- string: :b ```
* Remove redundant :use_block with yield (#11203)Takashi Kokubun2024-07-191-3/+0
|
* Make rb_check_frozen_inline() static inline againAlan Wu2024-07-192-8/+20
| | | | | | | | | | | Since 730e3b2ce01915c4a98b79bb281b2c38a9ff1131 ("Stop exposing `rb_str_chilled_p`"), we noticed a speed loss on a few benchmarks that are string operations heavy. This is partially due to routines no longer having the options to inline rb_check_frozen_inline() in non-LTO builds. Make it an inlining candidate again to recover speed. Testing this patch on my machine, the fannkuchredux benchmark gets a 1.15 speed-up with YJIT and 1.03 without YJIT.
* Don't call `Kernel#require` in hot loopJean Boussier2024-07-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ref: https://bugs.ruby-lang.org/issues/20641 Even without the reference bug, `require 'date'` isn't cheap. ```ruby require "benchmark/ips" require "yaml" require "date" 100.times do |i| $LOAD_PATH.unshift("/tmp/does/not/exist/#{i}") end payload = 100.times.map { Date.today }.to_yaml Benchmark.ips do |x| x.report("100 dates") { YAML.unsafe_load(payload) } end ``` Before: ``` $ ruby /tmp/bench-yaml.rb ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin22] Warming up -------------------------------------- 100 dates 416.000 i/100ms Calculating ------------------------------------- 100 dates 4.309k (± 1.2%) i/s - 21.632k in 5.021003s ``` After: ``` $ ruby -Ilib /tmp/bench-yaml.rb ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin22] Warming up -------------------------------------- 100 dates 601.000 i/100ms Calculating ------------------------------------- 100 dates 5.993k (± 1.8%) i/s - 30.050k in 5.016079s ```
* [PRISM] Fix compiler warning for min_tmp_array_sizePeter Zhu2024-07-191-1/+1
| | | | | | prism_compile.c:5770:40: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare] 5770 | if (tmp_array_size >= min_tmp_array_size) { | ^~
* [PRISM] Fix compiler warning for min_tmp_hash_lengthPeter Zhu2024-07-191-1/+1
| | | | | | prism_compile.c:1406:27: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare] 1406 | if (count >= min_tmp_hash_length) { | ^~
* [PRISM] Define DATA constant when parsing stdin and __END__Kevin Newton2024-07-191-0/+7
|
* [ruby/prism] Fix parsing parentheses in hash patternsKevin Newton2024-07-191-1/+2
| | | | https://github.com/ruby/prism/commit/22c3b559cd
* Move frozen check out of rb_gc_impl_undefine_finalizerPeter Zhu2024-07-192-1/+5
|
* Make rb_gc_impl_undefine_finalizer return voidPeter Zhu2024-07-193-5/+6
|
* Assert that object is not frozen in rb_gc_impl_define_finalizerPeter Zhu2024-07-191-0/+2
|
* Move return value of rb_define_finalizer outPeter Zhu2024-07-192-6/+8
| | | | | Moves return value logic of rb_define_finalizer out from rb_gc_impl_define_finalizer.
* Make define_final call rb_define_finalizerPeter Zhu2024-07-191-5/+1
|
* Rename a variable nameNaoto Ono2024-07-191-5/+5
|