Age | Commit message (Collapse) | Author |
|
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">.
|
|
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)">.
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
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
|
|
(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
|
|
|
|
|
|
When error on finalizer, the exception will be ignored.
To restart the code, we need to restore the stack pointer.
fix [Bug #20042]
|
|
https://github.com/ruby/psych/commit/0dc25a9d6a
|
|
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.
|
|
As suggested by Mame, we should try to help users fix the issues
without having to lookup the meaning of the warning.
|
|
|
|
|
|
We should bundle released version of Prism for Ruby 3.3.0
|
|
|
|
|
|
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
|
|
https://github.com/ruby/prism/commit/7f812389f8
|
|
|
|
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]
|
|
At the method definition, the local scope that saves the context of
the numbered parameters needs to be pushed before saving.
|
|
`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
|
|
https://github.com/ruby/prism/commit/89bf7a4948
|
|
https://github.com/ruby/prism/commit/3a67b37a56
|
|
Fix https://github.com/ruby/prism/pull/2026
https://github.com/ruby/prism/commit/c4b41cd477
|
|
|
|
proposed at https://bugs.ruby-lang.org/issues/20050#note-5
|
|
|
|
This commit implements safe navigation for CallNodes,
CallAndWriteNodes and CallOperatorWriteNodes
|
|
* 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).
|
|
|
|
https://github.com/ruby/prism/commit/ee6fc9ee87
|
|
This commit adjusts the local table size to be consistent regardless
of the number of anonymous locals.
|
|
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
|
|
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
|
|
Fix https://github.com/ruby/prism/pull/2073
https://github.com/ruby/prism/commit/0f747d9240
|
|
|
|
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 []=.
|
|
|
|
#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.
|
|
https://github.com/ruby/prism/commit/43c4232cfc
|
|
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
|
|
Improved performance / reduced allocations
https://github.com/rubygems/rubygems/commit/b04726c9a7
|
|
|
|
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
```
|