<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/prism_compile.c, branch v3_3_11</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>merge revision(s) 0d6263bd416338a339651fb97fe4d62701704c4b: [Backport #21220]</title>
<updated>2025-05-17T06:21:08+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2025-05-17T06:21:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=b1b6752fbeb2d23dbea639bd4b331c9e8b56f49c'/>
<id>b1b6752fbeb2d23dbea639bd4b331c9e8b56f49c</id>
<content type='text'>
	Fix coverage measurement for negative line numbers

	Fixes [Bug #21220]

	Co-Authored-By: Mike Bourgeous &lt;mike@mikebourgeous.com&gt;
	Co-Authored-By: Jean Boussier &lt;jean.boussier@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	Fix coverage measurement for negative line numbers

	Fixes [Bug #21220]

	Co-Authored-By: Mike Bourgeous &lt;mike@mikebourgeous.com&gt;
	Co-Authored-By: Jean Boussier &lt;jean.boussier@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[PRISM] Correct the jump target for redo in FOR_NODE</title>
<updated>2023-12-19T22:50:59+00:00</updated>
<author>
<name>Matt Valentine-House</name>
<email>matt@eightbitraptor.com</email>
</author>
<published>2023-12-19T22:06:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=3d984366ca809fdcc9320e776705ecd96efa49a0'/>
<id>3d984366ca809fdcc9320e776705ecd96efa49a0</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[PRISM] Fix parameter numbering in For Node</title>
<updated>2023-12-19T22:50:59+00:00</updated>
<author>
<name>Matt Valentine-House</name>
<email>matt@eightbitraptor.com</email>
</author>
<published>2023-12-18T21:32:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=371ff808400b079b373e87de9b3deeb6c16f6a23'/>
<id>371ff808400b079b373e87de9b3deeb6c16f6a23</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[PRISM] Fix incorrect instructions for `default_proc=`</title>
<updated>2023-12-15T21:23:06+00:00</updated>
<author>
<name>eileencodes</name>
<email>eileencodes@gmail.com</email>
</author>
<published>2023-12-15T16:32:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=b8074c2f043d99f6f30ab75ad21cc2c998f49dcf'/>
<id>b8074c2f043d99f6f30ab75ad21cc2c998f49dcf</id>
<content type='text'>
This is kind of specific and was found via debugging ruby/prism#2061 but
does not actually fix that issue.

The change here checks for `!popped` for the additional instructions
that are normally added for nodes with the `attribute_write` flag.

I also removed the extra catch table by deleting the
`ISEQ_COMPILE_DATA(iseq)-&gt;catch_except_p = true;` line. I'm...not
entirely sure why it was added but it doesn't match the upstream
compiler
[code](https://github.com/ruby/ruby/blob/92b10f5be7453aceb5863e46ac775a4ddbf83b97/compile.c#L887-L892).

The changes here unfortunately don't improve the test failures mentioned in
the linked issue so we still have other issues with instructions for
hashes.

Instructions before:

```
"********* Ruby *************"
== disasm: #&lt;ISeq:&lt;compiled&gt;@&lt;compiled&gt;:1 (1,0)-(34,8)&gt;
local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 1] h@0
0000 putnil                                                           (  32)[Li]
0001 putobject                              true
0003 getconstant                            :Hash
0005 send                                   &lt;calldata!mid:new, argc:0, ARGS_SIMPLE&gt;, nil
0008 setlocal                               h@0, 0
0011 getlocal                               h@0, 0                    (  33)[Li]
0014 putspecialobject                       1
0016 send                                   &lt;calldata!mid:lambda, argc:0, FCALL&gt;, block in &lt;compiled&gt;
0019 send                                   &lt;calldata!mid:default_proc=, argc:1, ARGS_SIMPLE&gt;, nil
0022 pop
0023 getlocal                               h@0, 0                    (  34)[Li]
0026 putobject                              :nope
0028 send                                   &lt;calldata!mid:[], argc:1, ARGS_SIMPLE&gt;, nil
0031 leave

== disasm: #&lt;ISeq:block in &lt;compiled&gt;@&lt;compiled&gt;:33 (33,19)-(33,32)&gt;
local table (size: 2, argc: 2 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 2] _@0&lt;Arg&gt;   [ 1] _@1&lt;Arg&gt;
0000 putobject                              true                      (  33)[LiBc]
0002 leave                                  [Br]
true
"********* PRISM *************"
== disasm: #&lt;ISeq:&lt;compiled&gt;@&lt;compiled&gt;:31 (31,0)-(33,8)&gt;
local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 1] h@0
0000 putnil                                                           (  31)[Li]
0001 putobject                              true
0003 getconstant                            :Hash
0005 send                                   &lt;calldata!mid:new, argc:0, ARGS_SIMPLE&gt;, nil
0008 setlocal                               h@0, 0
0011 putnil                                                           (  32)[Li]
0012 getlocal                               h@0, 0
0015 putspecialobject                       1
0017 send                                   &lt;calldata!mid:lambda, argc:0, FCALL&gt;, block in &lt;compiled&gt;
0020 setn                                   2
0022 send                                   &lt;calldata!mid:default_proc=, argc:1, ARGS_SIMPLE&gt;, nil
0025 pop
0026 pop
0027 getlocal                               h@0, 0                    (  33)[Li]
0030 putobject                              :nope
0032 send                                   &lt;calldata!mid:[], argc:1, ARGS_SIMPLE&gt;, nil
0035 leave                                                            (  31)

== disasm: #&lt;ISeq:block in &lt;compiled&gt;@&lt;compiled&gt;:32 (32,17)-(32,32)&gt;
== catch table
| catch type: redo   st: 0000 ed: 0002 sp: 0000 cont: 0000
| catch type: next   st: 0000 ed: 0002 sp: 0000 cont: 0002
|------------------------------------------------------------------------
local table (size: 2, argc: 2 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 2] _@0&lt;Arg&gt;   [ 1] _@1&lt;Arg&gt;
0000 putobject                              true                      (  32)[LiBc]
0002 leave                                  [Br]
```

Instructions after:

```
"********* Ruby *************"
== disasm: #&lt;ISeq:&lt;compiled&gt;@&lt;compiled&gt;:1 (1,0)-(34,8)&gt;
local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 1] h@0
0000 putnil                                                           (  32)[Li]
0001 putobject                              true
0003 getconstant                            :Hash
0005 send                                   &lt;calldata!mid:new, argc:0, ARGS_SIMPLE&gt;, nil
0008 setlocal                               h@0, 0
0011 getlocal                               h@0, 0                    (  33)[Li]
0014 putspecialobject                       1
0016 send                                   &lt;calldata!mid:lambda, argc:0, FCALL&gt;, block in &lt;compiled&gt;
0019 send                                   &lt;calldata!mid:default_proc=, argc:1, ARGS_SIMPLE&gt;, nil
0022 pop
0023 getlocal                               h@0, 0                    (  34)[Li]
0026 putobject                              :nope
0028 send                                   &lt;calldata!mid:[], argc:1, ARGS_SIMPLE&gt;, nil
0031 leave

== disasm: #&lt;ISeq:block in &lt;compiled&gt;@&lt;compiled&gt;:33 (33,19)-(33,32)&gt;
local table (size: 2, argc: 2 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 2] _@0&lt;Arg&gt;   [ 1] _@1&lt;Arg&gt;
0000 putobject                              true                      (  33)[LiBc]
0002 leave                                  [Br]

"********* PRISM *************"
== disasm: #&lt;ISeq:&lt;compiled&gt;@&lt;compiled&gt;:31 (31,0)-(33,8)&gt;
local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 1] h@0
0000 putnil                                                           (  31)[Li]
0001 putobject                              true
0003 getconstant                            :Hash
0005 send                                   &lt;calldata!mid:new, argc:0, ARGS_SIMPLE&gt;, nil
0008 setlocal                               h@0, 0
0011 getlocal                               h@0, 0                    (  32)[Li]
0014 putspecialobject                       1
0016 send                                   &lt;calldata!mid:lambda, argc:0, FCALL&gt;, block in &lt;compiled&gt;
0019 send                                   &lt;calldata!mid:default_proc=, argc:1, ARGS_SIMPLE&gt;, nil
0022 pop
0023 getlocal                               h@0, 0                    (  33)[Li]
0026 putobject                              :nope
0028 send                                   &lt;calldata!mid:[], argc:1, ARGS_SIMPLE&gt;, nil
0031 leave                                                            (  31)

== disasm: #&lt;ISeq:block in &lt;compiled&gt;@&lt;compiled&gt;:32 (32,17)-(32,32)&gt;
local table (size: 2, argc: 2 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 2] _@0&lt;Arg&gt;   [ 1] _@1&lt;Arg&gt;
0000 putobject                              true                      (  32)[LiBc]
0002 leave                                  [Br]
```
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is kind of specific and was found via debugging ruby/prism#2061 but
does not actually fix that issue.

The change here checks for `!popped` for the additional instructions
that are normally added for nodes with the `attribute_write` flag.

I also removed the extra catch table by deleting the
`ISEQ_COMPILE_DATA(iseq)-&gt;catch_except_p = true;` line. I'm...not
entirely sure why it was added but it doesn't match the upstream
compiler
[code](https://github.com/ruby/ruby/blob/92b10f5be7453aceb5863e46ac775a4ddbf83b97/compile.c#L887-L892).

The changes here unfortunately don't improve the test failures mentioned in
the linked issue so we still have other issues with instructions for
hashes.

Instructions before:

```
"********* Ruby *************"
== disasm: #&lt;ISeq:&lt;compiled&gt;@&lt;compiled&gt;:1 (1,0)-(34,8)&gt;
local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 1] h@0
0000 putnil                                                           (  32)[Li]
0001 putobject                              true
0003 getconstant                            :Hash
0005 send                                   &lt;calldata!mid:new, argc:0, ARGS_SIMPLE&gt;, nil
0008 setlocal                               h@0, 0
0011 getlocal                               h@0, 0                    (  33)[Li]
0014 putspecialobject                       1
0016 send                                   &lt;calldata!mid:lambda, argc:0, FCALL&gt;, block in &lt;compiled&gt;
0019 send                                   &lt;calldata!mid:default_proc=, argc:1, ARGS_SIMPLE&gt;, nil
0022 pop
0023 getlocal                               h@0, 0                    (  34)[Li]
0026 putobject                              :nope
0028 send                                   &lt;calldata!mid:[], argc:1, ARGS_SIMPLE&gt;, nil
0031 leave

== disasm: #&lt;ISeq:block in &lt;compiled&gt;@&lt;compiled&gt;:33 (33,19)-(33,32)&gt;
local table (size: 2, argc: 2 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 2] _@0&lt;Arg&gt;   [ 1] _@1&lt;Arg&gt;
0000 putobject                              true                      (  33)[LiBc]
0002 leave                                  [Br]
true
"********* PRISM *************"
== disasm: #&lt;ISeq:&lt;compiled&gt;@&lt;compiled&gt;:31 (31,0)-(33,8)&gt;
local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 1] h@0
0000 putnil                                                           (  31)[Li]
0001 putobject                              true
0003 getconstant                            :Hash
0005 send                                   &lt;calldata!mid:new, argc:0, ARGS_SIMPLE&gt;, nil
0008 setlocal                               h@0, 0
0011 putnil                                                           (  32)[Li]
0012 getlocal                               h@0, 0
0015 putspecialobject                       1
0017 send                                   &lt;calldata!mid:lambda, argc:0, FCALL&gt;, block in &lt;compiled&gt;
0020 setn                                   2
0022 send                                   &lt;calldata!mid:default_proc=, argc:1, ARGS_SIMPLE&gt;, nil
0025 pop
0026 pop
0027 getlocal                               h@0, 0                    (  33)[Li]
0030 putobject                              :nope
0032 send                                   &lt;calldata!mid:[], argc:1, ARGS_SIMPLE&gt;, nil
0035 leave                                                            (  31)

== disasm: #&lt;ISeq:block in &lt;compiled&gt;@&lt;compiled&gt;:32 (32,17)-(32,32)&gt;
== catch table
| catch type: redo   st: 0000 ed: 0002 sp: 0000 cont: 0000
| catch type: next   st: 0000 ed: 0002 sp: 0000 cont: 0002
|------------------------------------------------------------------------
local table (size: 2, argc: 2 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 2] _@0&lt;Arg&gt;   [ 1] _@1&lt;Arg&gt;
0000 putobject                              true                      (  32)[LiBc]
0002 leave                                  [Br]
```

Instructions after:

```
"********* Ruby *************"
== disasm: #&lt;ISeq:&lt;compiled&gt;@&lt;compiled&gt;:1 (1,0)-(34,8)&gt;
local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 1] h@0
0000 putnil                                                           (  32)[Li]
0001 putobject                              true
0003 getconstant                            :Hash
0005 send                                   &lt;calldata!mid:new, argc:0, ARGS_SIMPLE&gt;, nil
0008 setlocal                               h@0, 0
0011 getlocal                               h@0, 0                    (  33)[Li]
0014 putspecialobject                       1
0016 send                                   &lt;calldata!mid:lambda, argc:0, FCALL&gt;, block in &lt;compiled&gt;
0019 send                                   &lt;calldata!mid:default_proc=, argc:1, ARGS_SIMPLE&gt;, nil
0022 pop
0023 getlocal                               h@0, 0                    (  34)[Li]
0026 putobject                              :nope
0028 send                                   &lt;calldata!mid:[], argc:1, ARGS_SIMPLE&gt;, nil
0031 leave

== disasm: #&lt;ISeq:block in &lt;compiled&gt;@&lt;compiled&gt;:33 (33,19)-(33,32)&gt;
local table (size: 2, argc: 2 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 2] _@0&lt;Arg&gt;   [ 1] _@1&lt;Arg&gt;
0000 putobject                              true                      (  33)[LiBc]
0002 leave                                  [Br]

"********* PRISM *************"
== disasm: #&lt;ISeq:&lt;compiled&gt;@&lt;compiled&gt;:31 (31,0)-(33,8)&gt;
local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 1] h@0
0000 putnil                                                           (  31)[Li]
0001 putobject                              true
0003 getconstant                            :Hash
0005 send                                   &lt;calldata!mid:new, argc:0, ARGS_SIMPLE&gt;, nil
0008 setlocal                               h@0, 0
0011 getlocal                               h@0, 0                    (  32)[Li]
0014 putspecialobject                       1
0016 send                                   &lt;calldata!mid:lambda, argc:0, FCALL&gt;, block in &lt;compiled&gt;
0019 send                                   &lt;calldata!mid:default_proc=, argc:1, ARGS_SIMPLE&gt;, nil
0022 pop
0023 getlocal                               h@0, 0                    (  33)[Li]
0026 putobject                              :nope
0028 send                                   &lt;calldata!mid:[], argc:1, ARGS_SIMPLE&gt;, nil
0031 leave                                                            (  31)

== disasm: #&lt;ISeq:block in &lt;compiled&gt;@&lt;compiled&gt;:32 (32,17)-(32,32)&gt;
local table (size: 2, argc: 2 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 2] _@0&lt;Arg&gt;   [ 1] _@1&lt;Arg&gt;
0000 putobject                              true                      (  32)[LiBc]
0002 leave                                  [Br]
```
</pre>
</div>
</content>
</entry>
<entry>
<title>[PRISM] Compile CallTargetNode</title>
<updated>2023-12-15T21:15:10+00:00</updated>
<author>
<name>Matt Valentine-House</name>
<email>matt@eightbitraptor.com</email>
</author>
<published>2023-12-15T20:07:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=161787f9beef96c9fa1057b6378fe7e048ac2ecd'/>
<id>161787f9beef96c9fa1057b6378fe7e048ac2ecd</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[PRISM] Compile IndexTargetNode</title>
<updated>2023-12-15T21:15:10+00:00</updated>
<author>
<name>Matt Valentine-House</name>
<email>matt@eightbitraptor.com</email>
</author>
<published>2023-12-13T21:09:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=5b6a4d8c1253fd1ab77c0539d33276fe1856cf24'/>
<id>5b6a4d8c1253fd1ab77c0539d33276fe1856cf24</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[PRISM] Implement safe navigation in CallNodes</title>
<updated>2023-12-14T22:11:54+00:00</updated>
<author>
<name>Jemma Issroff</name>
<email>jemmaissroff@gmail.com</email>
</author>
<published>2023-12-14T21:44:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=5587bd4b37cc01227ce5546b3350033bb1ef9775'/>
<id>5587bd4b37cc01227ce5546b3350033bb1ef9775</id>
<content type='text'>
This commit implements safe navigation for CallNodes,
CallAndWriteNodes and CallOperatorWriteNodes
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit implements safe navigation for CallNodes,
CallAndWriteNodes and CallOperatorWriteNodes
</pre>
</div>
</content>
</entry>
<entry>
<title>[prism] Fix build with no asserts</title>
<updated>2023-12-14T20:26:01+00:00</updated>
<author>
<name>Kevin Newton</name>
<email>kddnewton@gmail.com</email>
</author>
<published>2023-12-14T20:25:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=d3deb1b8232a303dd40909e32f939bad3b24a8af'/>
<id>d3deb1b8232a303dd40909e32f939bad3b24a8af</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[PRISM] Fix keyword hash handling in method calls</title>
<updated>2023-12-14T19:08:37+00:00</updated>
<author>
<name>Ufuk Kayserilioglu</name>
<email>ufuk.kayserilioglu@shopify.com</email>
</author>
<published>2023-12-14T18:15:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=d07fdc5edee219bbbd6262f909d636a509793cca'/>
<id>d07fdc5edee219bbbd6262f909d636a509793cca</id>
<content type='text'>
* 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).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* 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).
</pre>
</div>
</content>
</entry>
<entry>
<title>Pattern matching</title>
<updated>2023-12-14T19:06:26+00:00</updated>
<author>
<name>Kevin Newton</name>
<email>kddnewton@gmail.com</email>
</author>
<published>2023-12-13T16:34:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=295d97ab4dc826a4c2b812d254a6607c87534ed7'/>
<id>295d97ab4dc826a4c2b812d254a6607c87534ed7</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
