summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-12-14[Prism] Fix cvar or assignment instructionseileencodes
The instructions for `PM_CLASS_VARIABLE_OR_WRITE_NODE` were incorrect as they were missing a `putnil`, a `defined`, and a `branchunless`. I verified this is fixed via the instructions and running the following: `RUBY_ISEQ_DUMP_DEBUG=prism make test/csv/interface/test_read_write.rb`. These new instructions can't go in the defined function because `defined?(@@fop ||= 1)` should return "assignment" not "class variable". Instructions before: ``` "********* Ruby *************" == disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(30,11)> 0000 putnil ( 30)[Li] 0001 defined class variable, :@@foo, true 0005 branchunless 14 0007 getclassvariable :@@foo, <is:0> 0010 dup 0011 branchif 20 0013 pop 0014 putobject 1 0016 dup 0017 setclassvariable :@@foo, <is:0> 0020 leave "********* PRISM *************" == disasm: #<ISeq:<compiled>@<compiled>:29 (29,0)-(29,11)> 0000 getclassvariable :@@foo, <is:0> ( 29)[Li] 0003 dup 0004 branchif 13 0006 pop 0007 putobject 1 0009 dup 0010 setclassvariable :@@foo, <is:0> 0013 leave ``` Instructions after: ``` "********* Ruby *************" == disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(30,11)> 0000 putnil ( 30)[Li] 0001 defined class variable, :@@foo, true 0005 branchunless 14 0007 getclassvariable :@@foo, <is:0> 0010 dup 0011 branchif 20 0013 pop 0014 putobject 1 0016 dup 0017 setclassvariable :@@foo, <is:0> 0020 leave "********* PRISM *************" == disasm: #<ISeq:<compiled>@<compiled>:29 (29,0)-(29,11)> 0000 putnil ( 29)[Li] 0001 defined class variable, :@@foo, true 0005 branchunless 14 0007 getclassvariable :@@foo, <is:0> 0010 dup 0011 branchif 20 0013 pop 0014 putobject 1 0016 dup 0017 setclassvariable :@@foo, <is:0> 0020 leave ``` Fixes ruby/prism#2064
2023-12-14[PRISM] Account for multiple anonymous localsJemma Issroff
This commit adjusts the local table size to be consistent regardless of the number of anonymous locals.
2023-12-14[ruby/prism] Fix the implementation of the flag on keyword hash nodesUfuk Kayserilioglu
The previous implementation was incorrect since it was just checking for all keys in assoc nodes to be static literals but the actual check is that all keys in assoc nodes must be symbol nodes. This commit fixes that implementation, and, also, aliases the flag to `PM_KEYWORD_HASH_NODE_FLAGS_SYMBOL_KEYS` so that ruby/ruby can start using the new flag name. I intend to later change the real flag name to `PM_KEYWORD_HASH_NODE_FLAGS_SYMBOL_KEYS` and remove the alias. https://github.com/ruby/prism/commit/f5099c79ce
2023-12-14Implement Write Barriers on IO::BufferPeter Zhu
Benchmark: ``` require "benchmark" puts(Benchmark.measure do ary = 1_000_000.times.map { IO::Buffer.for("") } 10.times { GC.start(full_mark: false) } end) ``` Before: ``` 14.330119 0.051497 14.381616 ( 14.445106) ``` After: ``` 7.481152 0.040166 7.521318 ( 7.535209) ```
2023-12-14[PRISM] Check for static literal, excluding array, hash, rangeJemma Issroff
2023-12-14[PRISM] Fix bugs in compiling optional keyword parametersJemma Issroff
This PR fixes two bugs when compiling optional keyword parameters: - It moves keyword parameter compilation to STEP 5 in the parameters sequence, where the rest of compilation happens. This is important because keyword parameter compilation relies on the value of body->param.keyword->bits_start which gets set in an earlier step - It compiles array and hash values for keyword parameters, which it didn't previously
2023-12-14[ruby/prism] Make equality operators non-associativeTSUYUSATO Kitsune
Fix https://github.com/ruby/prism/pull/2073 https://github.com/ruby/prism/commit/0f747d9240
2023-12-14[PRISM] Use frozen flag on StringNodeJemma Issroff
2023-12-14Fix op asgn method calls passing mutable keyword splatsJeremy Evans
When passing the keyword splat to [], it cannot be mutable, because mutating the keyword splat inside [] would result in changes to the keyword splat passed to []=.
2023-12-14[DOC] RDoc for Complex (#9231)Burdette Lamar
2023-12-14[rubygems/rubygems] Upgrade vendored librariesDavid Rodríguez
To match the versions that will be included in final ruby release. https://github.com/rubygems/rubygems/commit/84394919fb
2023-12-14Call obj_free for T_DATA, T_FILE objects on exitPeter Zhu
Previously, T_DATA and T_FILE objects did not have their instance variables freed on exit which would be reported as a memory leak with RUBY_FREE_ON_EXIT. This commit changes it to use obj_free which also frees the generic instance variables. Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
2023-12-14Removed duplicated LICENSE filesHiroshi SHIBATA
2023-12-14[rubygems/rubygems] Allow "default_user_install" to be overridden.Vít Ondruch
For Ruby re-distributors, automatic user-install might be the right default. Therefore printing warning about installing into user directory is not always desirable. Let the default_user_install method be customizable. https://github.com/rubygems/rubygems/commit/2320dba544
2023-12-14[rubygems/rubygems] Improve install advice when some gems are not foundDavid Rodríguez
This problem is quite specific to our dev environment, but I guess the fix could be handy for other situations. After merging a change to treat default gems as regular gems, I get this when trying to run `rubocop` on our repo: ``` $ bin/rubocop --only Performance/RegexpMatch Could not find json-2.6.3 in locally installed gems Run `bundle install --gemfile /Users/deivid/code/rubygems/rubygems/tool/bundler/lint_gems.rb` to install missing gems. ``` However, when running the suggested command, nothing changes and I still get the same error: ``` $ bundle install --gemfile /Users/deivid/code/rubygems/rubygems/tool/bundler/lint_gems.rb Using ast 2.4.2 Using bundler 2.4.10 Using json 2.6.3 Using parallel 1.23.0 Using racc 1.7.1 Using parser 3.2.2.3 Using rainbow 3.1.1 Using regexp_parser 2.8.1 Using rexml 3.2.5 Using rubocop-ast 1.29.0 Using ruby-progressbar 1.13.0 Using unicode-display_width 2.4.2 Using rubocop 1.52.1 Using rubocop-performance 1.14.2 Bundle complete! 2 Gemfile dependencies, 14 gems now installed. Use `bundle info [gemname]` to see where a bundled gem is installed. $ bin/rubocop --only Performance/RegexpMatch Could not find json-2.6.3 in locally installed gems Run `bundle install --gemfile /Users/deivid/code/rubygems/rubygems/tool/bundler/lint_gems.rb` to install missing gems. ``` The problem is that our `bin/rubocop` script uses the development version of Bundler (which has the change causing the problem), but the advice recommands the default version of Bundler, which does not yet have the change. This commit changes the advice to recommend to use the same version of Bundler that run into the problem in the first place. So in the above situation you now get: ``` $ bin/rubocop --only Performance/RegexpMatch Could not find json-2.6.3 in locally installed gems Run `/Users/deivid/code/rubygems/rubygems/bundler/exe/bundle install --gemfile /Users/deivid/code/rubygems/rubygems/tool/bundler/lint_gems.rb` to install missing gems. ``` And running that fixes the problem: ``` $ /Users/deivid//rubygems/rubygems/bundler/exe/bundle install --gemfile /Users/deivid/code/rubygems/rubygems/tool/bundler/lint_gems.rb Fetching gem metadata from https://rubygems.org/......... Fetching json 2.6.3 Installing json 2.6.3 with native extensions Bundle complete! 2 Gemfile dependencies, 14 gems now installed. Use `bundle info [gemname]` to see where a bundled gem is installed. ``` https://github.com/rubygems/rubygems/commit/10a9588c6d
2023-12-14[rubygems/rubygems] Remove extension building sync stuff no longer present ↵David Rodríguez
in RubyGems https://github.com/rubygems/rubygems/commit/59a85388b9
2023-12-14[rubygems/rubygems] RubyGems > 3.2.0.rc.1 is now always providedDavid Rodríguez
https://github.com/rubygems/rubygems/commit/929b521f3a
2023-12-14[rubygems/rubygems] Gem::Specification always has `default_stubs` nowDavid Rodríguez
https://github.com/rubygems/rubygems/commit/30db1eb4a5
2023-12-14[rubygems/rubygems] Remove more methods now defined in all RubyGems versionsDavid Rodríguez
https://github.com/rubygems/rubygems/commit/e015200ffa
2023-12-14[rubygems/rubygems] Remove check only necessary for ancient RubyGemsDavid Rodríguez
https://github.com/rubygems/rubygems/commit/ffa2f03489
2023-12-14[rubygems/rubygems] This patch should be no longer neededDavid Rodríguez
https://github.com/rubygems/rubygems/commit/1139e90931
2023-12-14[rubygems/rubygems] Gem::Specification.find_all_by_name is always defined nowDavid Rodríguez
https://github.com/rubygems/rubygems/commit/1d61c7686b
2023-12-14[rubygems/rubygems] Revert "Improve default gem handling"David Rodríguez
This reverts commit https://github.com/rubygems/rubygems/commit/091b4fcf2b99. https://github.com/rubygems/rubygems/commit/dcade3235f
2023-12-14[PRISM] Add anon KW args to the block local tableMatt Valentine-House
2023-12-14rb_ext_resolve_symbol: C API to resolve and return externed symbols [Feature ↵Satoshi Tagomori
#20005] This is a C API for extensions to resolve and get function symbols of other extensions. Extensions can check the expected symbol is correctly loaded and accessible, and use it if it is available. Otherwise, extensions can raise their own error to guide users to setup their environments correctly and what's missing.
2023-12-14dln_symbol: make dln_sym accessible Ruby internallySatoshi Tagomori
The symbol resolved by dln_symbol will eventually be passed to extensions. The error handling of dln_sym is also separated into dln_sym_func because the new call resolving symbols will not raise LoadError.
2023-12-14Update bundled gems list at 1b1d5e757e81ec243062a8919ddc76 [ci skip]git
2023-12-14Bump up bundled net-ftp gem version to 0.3.2Shugo Maeda
2023-12-14Update bundled gems list at 26145a27f6b960bd607cdd2f9680eb [ci skip]git
2023-12-14Bump up bundled net-ftp gem version to 0.3.1Shugo Maeda
2023-12-14[ruby/prism] Fix hash pattern restKevin Newton
https://github.com/ruby/prism/commit/43c4232cfc
2023-12-14Fold a long line [ci skip]Kazuhiro NISHIYAMA
2023-12-14[rubygems/rubygems] Warn for duplicate meta data linksDrew Stevenson
Match order of METADATA_LINK_KEYS to order used by rubygems.org in Links model. Add missing download_uri key. https://github.com/rubygems/rubygems/commit/d2922cd6e9
2023-12-13Unlock freelist before assigningJohn Hawthorn
Co-authored-by: Matthew Draper <matthew@trebex.net>
2023-12-13[rubygems/rubygems] Revert "Merge pull request #7167 from ↵Martin Emde
nevinera/add-json-output-option-to-bundle-outdated" This reverts commit https://github.com/rubygems/rubygems/commit/a4ac5116b8ea, reversing changes made to https://github.com/rubygems/rubygems/commit/8a6b180d0ae5. https://github.com/rubygems/rubygems/commit/a1efe4015d
2023-12-14Detect bootsnap from all framesHiroshi SHIBATA
2023-12-14Skip warning feature with BootsnapHiroshi SHIBATA
Bootsnap modified full feature path to require. We can't handle it for warning correctly.
2023-12-14[Bug #20060] Properly return matched gem name in case of EXACTAkira Matsuda
this follows up 4e6861d3376eb7857d2b0a947c97b6fec8e5bf37
2023-12-13[rubygems/rubygems] Use match? when regexp match data is unusedSamuel Giddins
Improved performance / reduced allocations https://github.com/rubygems/rubygems/commit/b04726c9a7
2023-12-13YJIT: Add --yjit-disable to help and reorder it (#9230)Takashi Kokubun
2023-12-13[rubygems/rubygems] Store Checksum::Store indexed by spec.lock_nameMartin Emde
https://github.com/rubygems/rubygems/commit/34d6c6c72f
2023-12-13Fix a typo in yjit.mdTakashi Kokubun
2023-12-13[PRISM] Add a test with a non-static-literal hash keyUfuk Kayserilioglu
2023-12-13[rubygems/rubygems] Add 3.4 as a supported ruby versionSamuel Giddins
Since ruby trunk will be 3.4 very soon https://github.com/rubygems/rubygems/commit/36dd9a35dc
2023-12-13[Prism] Fix InterpolatedMatchLastLine Instructionseileencodes
I looked at this at RubyConf with Kevin, and we noticed that there was a `putobject` empty string missing from the instructions. I just got back around to implementing this and pushing a PR and while doing that noticed that we also have a `getspecial` when we want a `getglobal`. This change adds the `putobject` instruction and replaces the `getspecial` with a `getglobal`. If we look at the parsetree for the following code: ```ruby $pit = '.oo'; if /"#{$pit}"/mix; end ``` We can see it has a `NODE_GVAR` and the [Ruby compiler](https://github.com/ruby/ruby/blob/a4b43e92645e46ee5a8c9af42d3de57cd052e87c/compile.c#L10024-L10030) shows that should use `getglobal. ``` @ NODE_SCOPE (id: 14, line: 1, location: (1,0)-(22,36)) +- nd_tbl: (empty) +- nd_args: | (null node) +- nd_body: @ NODE_BLOCK (id: 12, line: 22, location: (22,0)-(22,36)) +- nd_head (1): | @ NODE_GASGN (id: 0, line: 22, location: (22,0)-(22,12))* | +- nd_vid: :$pit | +- nd_value: | @ NODE_STR (id: 1, line: 22, location: (22,7)-(22,12)) | +- nd_lit: ".oo" +- nd_head (2): @ NODE_IF (id: 11, line: 22, location: (22,14)-(22,36))* +- nd_cond: | @ NODE_MATCH2 (id: 10, line: 22, location: (22,14)-(22,36)) | +- nd_recv: | | @ NODE_DREGX (id: 2, line: 22, location: (22,17)-(22,31)) | | +- nd_lit: "\"" | | +- nd_next->nd_head: | | | @ NODE_EVSTR (id: 4, line: 22, location: (22,19)-(22,26)) | | | +- nd_body: | | | @ NODE_GVAR (id: 3, line: 22, location: (22,21)-(22,25)) | | | +- nd_vid: :$pit | | +- nd_next->nd_next: | | @ NODE_LIST (id: 7, line: 22, location: (22,26)-(22,27)) | | +- as.nd_alen: 1 | | +- nd_head: | | | @ NODE_STR (id: 6, line: 22, location: (22,26)-(22,27)) | | | +- nd_lit: "\"" | | +- nd_next: | | (null node) | +- nd_value: | @ NODE_GVAR (id: 9, line: 22, location: (22,14)-(22,36)) | +- nd_vid: :$_ +- nd_body: | @ NODE_BEGIN (id: 8, line: 22, location: (22,32)-(22,32)) | +- nd_body: | (null node) +- nd_else: (null node) ``` I'm struggling with writing a failing test, but the before/after instructions show that `getglobal` is correct here. I compared the instructions for the other `InterpolatedMatchLastLine` node tests and they also used `getglobal`. I've edited the existing `InterpolatedLastMatchLineNode` test so that it will use that instruction when copied out of the test. Without the quotes it thinks it's just a `MatchLastLineNode`. Incorrect instructions: ``` "********* Ruby *************" == disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(22,36)> 0000 putstring ".oo" ( 22)[Li] 0002 setglobal :$pit 0004 putobject "\"" 0006 getglobal :$pit 0008 dup 0009 objtostring <calldata!mid:to_s, argc:0, FCALL|ARGS_SIMPLE> 0011 anytostring 0012 putobject "\"" 0014 toregexp 7, 3 0017 getglobal :$_ 0019 send <calldata!mid:=~, argc:1, ARGS_SIMPLE>, nil 0022 branchunless 30 0024 jump 26 0026 putnil 0027 jump 31 0029 pop 0030 putnil 0031 leave "********* PRISM *************" == disasm: #<ISeq:<compiled>@<compiled>:21 (21,0)-(21,36)> 0000 putstring ".oo" ( 21)[Li] 0002 setglobal :$pit 0004 putobject "\"" 0006 getglobal :$pit 0008 dup 0009 objtostring <calldata!mid:to_s, argc:0, FCALL|ARGS_SIMPLE> 0011 anytostring 0012 putobject "\"" 0014 toregexp 7, 3 0017 getspecial 0, 0 0020 send <calldata!mid:=~, argc:1, ARGS_SIMPLE>, nil 0023 branchunless 31 0025 jump 27 0027 putnil 0028 jump 32 0030 pop 0031 putnil 0032 leave ``` Fixed instructions: ``` == disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(22,36)> 0000 putstring ".oo" ( 22)[Li] 0002 setglobal :$pit 0004 putobject "\"" 0006 getglobal :$pit 0008 dup 0009 objtostring <calldata!mid:to_s, argc:0, FCALL|ARGS_SIMPLE> 0011 anytostring 0012 putobject "\"" 0014 toregexp 7, 3 0017 getglobal :$_ 0019 send <calldata!mid:=~, argc:1, ARGS_SIMPLE>, nil 0022 branchunless 30 0024 jump 26 0026 putnil 0027 jump 31 0029 pop 0030 putnil 0031 leave "********* PRISM *************" == disasm: #<ISeq:<compiled>@<compiled>:21 (21,0)-(21,36)> 0000 putstring ".oo" ( 21)[Li] 0002 setglobal :$pit 0004 putobject "\"" 0006 getglobal :$pit 0008 dup 0009 objtostring <calldata!mid:to_s, argc:0, FCALL|ARGS_SIMPLE> 0011 anytostring 0012 putobject "\"" 0014 toregexp 7, 3 0017 getglobal :$_ 0019 send <calldata!mid:=~, argc:1, ARGS_SIMPLE>, nil 0022 branchunless 30 0024 jump 26 0026 putnil 0027 jump 31 0029 pop 0030 putnil 0031 leave ```
2023-12-13[PRISM] Fix a -Wformat-zero-length warningTakashi Kokubun
../prism_compile.c: In function ‘pm_compile_node’: ../prism_compile.c:2330:20: warning: zero-length gnu_printf format string [-Wformat-zero-length] 2330 | rb_bug(""); | ^~
2023-12-13[PRISM] Use xcalloc for iseq id tableJohn Hawthorn
We use xfree on the other end, so we need to use a form of xmalloc here. Co-authored-by: Matthew Draper <matthew@trebex.net>
2023-12-13[PRISM] Fix st_table memory leakJohn Hawthorn
Co-authored-by: Matthew Draper <matthew@trebex.net>
2023-12-13Fix memory leak in Hash#compare_by_identityAlan Wu
We didn't free the old ST before overwriting it which caused a leak. Found with RUBY_FREE_ON_EXIT. Co-authored-by: Peter Zhu <peter@peterzhu.ca>
2023-12-13Skip an unstable test on MinGWTakashi Kokubun
This test fails fairly frequently on MinGW: https://github.com/ruby/ruby/actions/runs/7195712496/job/19598924253#step:11:168 https://github.com/ruby/ruby/actions/runs/7191246799/job/19585627182#step:11:168 and we aren't actively working on stabilizing tests for MinGW.