summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2023-12-23Fix String#sub for GC compactionPeter Zhu
The test fails when RGENGC_CHECK_MODE is turned on: TestString#test_sub_gc_compact_stress = 9.42 s 1) Failure: TestString#test_sub_gc_compact_stress [test/ruby/test_string.rb:2089]: <"aaa [amp] yyy"> expected but was <"aaa [] yyy">.
2023-12-23Fix Regexp#to_s for GC compactionPeter Zhu
The test fails when RGENGC_CHECK_MODE is turned on: TestRegexp#test_to_s_under_gc_compact_stress = 13.46 s 1) Failure: TestRegexp#test_to_s_under_gc_compact_stress [test/ruby/test_regexp.rb:81]: <"(?-mix:abcd\u3042)"> expected but was <"(?-mix:\u5C78\u3030\u5C78\u3030\u5C78\u3030\u5C78\u3030\u5C78\u3030)">.
2023-12-23Adjust indent [ci skip]Nobuyoshi Nakada
2023-12-23Merge RubyGems-3.5.3 and Bundler-2.5.3Hiroshi SHIBATA
2023-12-23ensure to restart antoher threadKoichi Sasada
2023-12-22[Bug #19977] Fix (nil..nil) === x not to raise TypeErrorKouhei Yanagita
2023-12-21RJIT: Convert opt_case_dispatch keys with #to_valueTakashi Kokubun
comptime_key is a Ruby object and the value is not valid in machine code. This PR also implements `CMP r/m64, imm32 (Mod 01: [reg]+disp8)` that is now needed for running mail.gem benchmark.
2023-12-22Merge RubyGems-3.5.2 and Bundler-2.5.2Hiroshi SHIBATA
2023-12-21Fix ary_make_partial_step for compactionPeter Zhu
ary could change embeddedness due to compaction, so we should only get the pointer after allocations. The included test was crashing with: TestArray#test_slice_gc_compact_stress ruby/lib/pp.rb:192: [BUG] Segmentation fault at 0x0000000000000038
2023-12-20[ruby/irb] Warn users about errors in loading RC filesStan Lo
(https://github.com/ruby/irb/pull/817) 1. Because `IRB.rc_file` always generates an rc file name, even if the file doesn't exist, we should check the file exists before trying to load it. 2. If any type of errors occur while loading the rc file, we should warn the user about it. https://github.com/ruby/irb/commit/37ffdc6b19
2023-12-20Correct free_on_exit env var to free_at_exitHParker
2023-12-19YJIT: Add stats option to RubyVM::YJIT.enable (#9297)Takashi Kokubun
2023-12-19restore the stack pointer on finalizerKoichi Sasada
When error on finalizer, the exception will be ignored. To restart the code, we need to restore the stack pointer. fix [Bug #20042]
2023-12-19[ruby/psych] Use `assert_same` in tests where applicableAlexander Momchilov
https://github.com/ruby/psych/commit/0dc25a9d6a
2023-12-18Fix flaky test test_stat_heapPeter Zhu
The test sometimes fails with: 1) Failure: TestGc#test_stat_heap [/tmp/ruby/src/trunk-repeat50/test/ruby/test_gc.rb:169]: Expected 33434403 to be <= 33434354.
2023-12-18Make the SHAPE_TOO_COMPLEX performance warning more actionableJean Boussier
As suggested by Mame, we should try to help users fix the issues without having to lookup the meaning of the warning.
2023-12-17Stir the hash value more with encoding indexNobuyoshi Nakada
2023-12-16[Bug #20068] Encoding does not matter to empty stringsNobuyoshi Nakada
2023-12-16Revert all of commits after Prism 0.19.0 releaseHiroshi SHIBATA
We should bundle released version of Prism for Ruby 3.3.0
2023-12-15[PRISM] Compile CallTargetNodeMatt Valentine-House
2023-12-15[PRISM] Compile IndexTargetNodeMatt Valentine-House
2023-12-15[ruby/prism] String literal hash keys should be frozeneileencodes
String literal hash keys can't be mutated by the user so we should mark them as frozen. We were seeing instructions for hashes with string literal keys using two `putstring` instructions when it should be a `putobject` and `putstring`. Code example: ```ruby { "a" => "b" } ``` Instructions before: ``` "********* Ruby *************" == disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(2,14)> 0000 putobject "a" ( 2)[Li] 0002 putstring "b" 0004 newhash 2 0006 leave "********* PRISM *************" == disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(1,14)> 0000 putstring "a" ( 1)[Li] 0002 putstring "b" 0004 newhash 2 0006 leave ``` Instructions after: ``` "********* Ruby *************" == disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(2,14)> 0000 putobject "a" ( 2)[Li] 0002 putstring "b" 0004 newhash 2 0006 leave "********* PRISM *************" == disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(1,14)> 0000 putobject "a" ( 1)[Li] 0002 putstring "b" 0004 newhash 2 0006 leave ``` https://github.com/ruby/prism/commit/b14ae55385
2023-12-15[ruby/prism] Finish keyword hash node flag refactor by renaming flagUfuk Kayserilioglu
https://github.com/ruby/prism/commit/7f812389f8
2023-12-15Update error message in test_rubyoptionsKevin Newton
2023-12-15Introduce --parser runtime flagHParker
Introduce runtime flag for specifying the parser, ``` ruby --parser=prism ``` also update the description: ``` $ ruby --parser=prism --version ruby 3.3.0dev (2023-12-08T04:47:14Z add-parser-runtime.. 0616384c9f) +PRISM [x86_64-darwin23] ``` [Bug #20044]
2023-12-16[Bug #20062] Fixed numbered parameter syntax errorNobuyoshi Nakada
At the method definition, the local scope that saves the context of the numbered parameters needs to be pushed before saving.
2023-12-15[PRISM] Fix `compile_prism` when src is a fileeileencodes
`compile_prism` can take a source and file (and other arguments) or a file as the source. `compile` checks if the source is a file and if it is converts it. `compile_prism` is now doing the same thing. On the Ruby side `compile` handles a file [here](https://github.com/ruby/ruby/blob/master/iseq.c#L1159-L1162). Before: ``` "********* Ruby *************" == disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(26,21)> local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1]) [ 1] name@0 0000 putstring "Prism" ( 25)[Li] 0002 setlocal name@0, 0 0005 putself ( 26)[Li] 0006 putobject "hello, " 0008 getlocal name@0, 0 0011 dup 0012 objtostring <calldata!mid:to_s, argc:0, FCALL|ARGS_SIMPLE> 0014 anytostring 0015 concatstrings 2 0017 send <calldata!mid:puts, argc:1, FCALL|ARGS_SIMPLE>, nil 0020 leave hello, Prism "********* PRISM *************" ./test.rb:13:in `compile_prism': wrong argument type File (expected String) (TypeError) from ./test.rb:13:in `<main>' make: *** [run] Error 1 ``` After: ``` "********* Ruby *************" == disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(26,21)> local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1]) [ 1] name@0 0000 putstring "Prism" ( 25)[Li] 0002 setlocal name@0, 0 0005 putself ( 26)[Li] 0006 putobject "hello, " 0008 getlocal name@0, 0 0011 dup 0012 objtostring <calldata!mid:to_s, argc:0, FCALL|ARGS_SIMPLE> 0014 anytostring 0015 concatstrings 2 0017 send <calldata!mid:puts, argc:1, FCALL|ARGS_SIMPLE>, nil 0020 leave "********* PRISM *************" == disasm: #<ISeq:<compiled>@test_code.rb:24 (24,0)-(25,21)> local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1]) [ 1] name@0 0000 putstring "Prism" ( 24)[Li] 0002 setlocal name@0, 0 0005 putself ( 25)[Li] 0006 putobject "hello, " 0008 getlocal name@0, 0 0011 dup 0012 objtostring <calldata!mid:to_s, argc:0, FCALL|ARGS_SIMPLE> 0014 anytostring 0015 concatstrings 2 0017 send <calldata!mid:puts, argc:1, FCALL|ARGS_SIMPLE>, nil 0020 leave ( 24) ``` Fixes ruby/prism#1609
2023-12-15[ruby/prism] Fix eval parsing depthKevin Newton
https://github.com/ruby/prism/commit/89bf7a4948
2023-12-15[ruby/prism] Invalid pinned locals in pattern matchingKevin Newton
https://github.com/ruby/prism/commit/3a67b37a56
2023-12-15[ruby/prism] Add an error for `in` keyword in argumentsTSUYUSATO Kitsune
Fix https://github.com/ruby/prism/pull/2026 https://github.com/ruby/prism/commit/c4b41cd477
2023-12-15loading/testing in different processes for multiple runsSatoshi Tagomori
2023-12-15add a testKoichi Sasada
proposed at https://bugs.ruby-lang.org/issues/20050#note-5
2023-12-14Remove unused variables in test_call_op_asgn_keywords_mutableJeremy Evans
2023-12-14[PRISM] Implement safe navigation in CallNodesJemma Issroff
This commit implements safe navigation for CallNodes, CallAndWriteNodes and CallOperatorWriteNodes
2023-12-14[PRISM] Fix keyword hash handling in method callsUfuk Kayserilioglu
* Start using the renamed `PM_KEYWORD_HASH_NODE_FLAGS_SYMBOL_KEYS` flag to check if all keys of the keyword hash node are symbols. * For arguments passed as a hash, start marking them as `KW_SPLAT_MUT` only if the number of entries in the hash is greater than 1 (which is what the old compiler used to do).
2023-12-14Pattern matchingKevin Newton
2023-12-14[ruby/prism] Fix parse result for nesting pattern matchingKevin Newton
https://github.com/ruby/prism/commit/ee6fc9ee87
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-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[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-14[ruby/prism] Fix hash pattern restKevin Newton
https://github.com/ruby/prism/commit/43c4232cfc
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-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-13[PRISM] Add a test with a non-static-literal hash keyUfuk Kayserilioglu
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 ```