<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/yjit/src/asm/x86_64/mod.rs, branch v4.0.3</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>YJIT: x86: Fix panic writing 32-bit number with top bit set</title>
<updated>2025-06-11T10:49:49+00:00</updated>
<author>
<name>Alan Wu</name>
<email>XrXr@users.noreply.github.com</email>
</author>
<published>2025-06-10T11:52:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=e5c7f1695e8cf774d073e7b103c1d9289cad56ee'/>
<id>e5c7f1695e8cf774d073e7b103c1d9289cad56ee</id>
<content type='text'>
Previously, `asm.mov(m32, imm32)` panicked when `imm32 &gt; 0x80000000`. It
attempted to split imm32 into a register before doing the store, but
then the register size didn't match the destination size.

Instead of splitting, use the `MOV r/m32, imm32` form which works for
all 32-bit values. Adjust asserts that assumed that all forms undergo
sign extension, which is not true for this case.

See: 54edc930f9f0a658da45cfcef46648d1b6f82467
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, `asm.mov(m32, imm32)` panicked when `imm32 &gt; 0x80000000`. It
attempted to split imm32 into a register before doing the store, but
then the register size didn't match the destination size.

Instead of splitting, use the `MOV r/m32, imm32` form which works for
all 32-bit values. Adjust asserts that assumed that all forms undergo
sign extension, which is not true for this case.

See: 54edc930f9f0a658da45cfcef46648d1b6f82467
</pre>
</div>
</content>
</entry>
<entry>
<title>YJIT: Assert lea source operand type</title>
<updated>2024-01-25T21:17:03+00:00</updated>
<author>
<name>Alan Wu</name>
<email>XrXr@users.noreply.github.com</email>
</author>
<published>2024-01-25T20:29:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f0224adf2f6ec5c1a9c77001bfbfdae9eb93f5fc'/>
<id>f0224adf2f6ec5c1a9c77001bfbfdae9eb93f5fc</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>YJIT: Use u32 for CodePtr to save 4 bytes each</title>
<updated>2023-11-07T22:43:43+00:00</updated>
<author>
<name>Alan Wu</name>
<email>XrXr@users.noreply.github.com</email>
</author>
<published>2023-10-16T22:35:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=a1c61f0ae5f5ecaa7d8289942b78e6b0c77118fe'/>
<id>a1c61f0ae5f5ecaa7d8289942b78e6b0c77118fe</id>
<content type='text'>
We've long had a size restriction on the code memory region such that a
u32 could refer to everything. This commit capitalizes on this
restriction by shrinking the size of `CodePtr` to be 4 bytes from 8.

To derive a full raw pointer from a `CodePtr`, one needs a base pointer.
Both `CodeBlock` and `VirtualMemory` can be used for this purpose. The
base pointer is readily available everywhere, except for in the case of
the `jit_return` "branch". Generalize lea_label() to lea_jump_target()
in the IR to delay deriving the `jit_return` address until `compile()`,
when the base pointer is available.

On railsbench, this yields roughly a 1% reduction to `yjit_alloc_size`
(58,397,765 to 57,742,248).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We've long had a size restriction on the code memory region such that a
u32 could refer to everything. This commit capitalizes on this
restriction by shrinking the size of `CodePtr` to be 4 bytes from 8.

To derive a full raw pointer from a `CodePtr`, one needs a base pointer.
Both `CodeBlock` and `VirtualMemory` can be used for this purpose. The
base pointer is readily available everywhere, except for in the case of
the `jit_return` "branch". Generalize lea_label() to lea_jump_target()
in the IR to delay deriving the `jit_return` address until `compile()`,
when the base pointer is available.

On railsbench, this yields roughly a 1% reduction to `yjit_alloc_size`
(58,397,765 to 57,742,248).
</pre>
</div>
</content>
</entry>
<entry>
<title>YJIT: x64: Split mem-to-mem Insn::Store like Insn::Mov</title>
<updated>2023-08-22T22:43:56+00:00</updated>
<author>
<name>Alan Wu</name>
<email>XrXr@users.noreply.github.com</email>
</author>
<published>2023-08-22T22:43:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=ff552389137c2d0af16c63e82bfc7e123be30198'/>
<id>ff552389137c2d0af16c63e82bfc7e123be30198</id>
<content type='text'>
The ARM backend allows for this so let's make x64 consistent.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The ARM backend allows for this so let's make x64 consistent.</pre>
</div>
</content>
</entry>
<entry>
<title>YJIT: implement codegen for rb_int_lshift (#8201)</title>
<updated>2023-08-11T15:01:16+00:00</updated>
<author>
<name>Maxime Chevalier-Boisvert</name>
<email>maxime.chevalierboisvert@shopify.com</email>
</author>
<published>2023-08-11T15:01:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=a8cd18f08d3ee7475340dfea5eebe2f6b164b5ec'/>
<id>a8cd18f08d3ee7475340dfea5eebe2f6b164b5ec</id>
<content type='text'>
* YJIT: implement codegen for rb_int_lshift

* Update yjit/src/asm/x86_64/mod.rs

Co-authored-by: Takashi Kokubun &lt;takashikkbn@gmail.com&gt;

---------

Co-authored-by: Takashi Kokubun &lt;takashikkbn@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* YJIT: implement codegen for rb_int_lshift

* Update yjit/src/asm/x86_64/mod.rs

Co-authored-by: Takashi Kokubun &lt;takashikkbn@gmail.com&gt;

---------

Co-authored-by: Takashi Kokubun &lt;takashikkbn@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>YJIT: implement imul instruction encoding in x86 assembler (#8191)</title>
<updated>2023-08-09T17:12:21+00:00</updated>
<author>
<name>Maxime Chevalier-Boisvert</name>
<email>maxime.chevalierboisvert@shopify.com</email>
</author>
<published>2023-08-09T17:12:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=c9b30f9d76ec7c726a703a7f8aad95b5998e7d6c'/>
<id>c9b30f9d76ec7c726a703a7f8aad95b5998e7d6c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>YJIT: expand bitwise shift support in x86 assembler (#8174)</title>
<updated>2023-08-04T18:57:56+00:00</updated>
<author>
<name>Maxime Chevalier-Boisvert</name>
<email>maxime.chevalierboisvert@shopify.com</email>
</author>
<published>2023-08-04T18:57:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=8d7861e3daf64e0bd30b2f9fe56f94eadfde5d3f'/>
<id>8d7861e3daf64e0bd30b2f9fe56f94eadfde5d3f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>YJIT: add counters for polymorphic send and send with known class (#7288)</title>
<updated>2023-02-10T21:05:16+00:00</updated>
<author>
<name>Maxime Chevalier-Boisvert</name>
<email>maxime.chevalierboisvert@shopify.com</email>
</author>
<published>2023-02-10T21:05:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=a7e8eabeed54392588c7f01afe8be2e72d3c526d'/>
<id>a7e8eabeed54392588c7f01afe8be2e72d3c526d</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Add stats so we can keep track of x86 rel32 vs register calls (#7142)</title>
<updated>2023-01-18T16:08:55+00:00</updated>
<author>
<name>Maxime Chevalier-Boisvert</name>
<email>maxime.chevalierboisvert@shopify.com</email>
</author>
<published>2023-01-18T16:08:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=cd97976328204263c464cf6846e9bafe6424da15'/>
<id>cd97976328204263c464cf6846e9bafe6424da15</id>
<content type='text'>
* Add stats so we can keep track of x86 rel32 vs register calls

To know if we get that "prime real estate" as Alan put it.

* Fix bug pointed by Alan</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Add stats so we can keep track of x86 rel32 vs register calls

To know if we get that "prime real estate" as Alan put it.

* Fix bug pointed by Alan</pre>
</div>
</content>
</entry>
<entry>
<title>Fix YJIT backend to account for unsigned int immediates (#6789)</title>
<updated>2022-11-23T15:48:17+00:00</updated>
<author>
<name>Jemma Issroff</name>
<email>jemmaissroff@gmail.com</email>
</author>
<published>2022-11-23T15:48:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=e82b15b6603ddc6754f4cfa7a189c0acb0ccce71'/>
<id>e82b15b6603ddc6754f4cfa7a189c0acb0ccce71</id>
<content type='text'>
YJIT: x86_64: Fix cmp with number where sign bit is set

Before this commit, we were unconditionally treating unsigned ints as
signed ints when counting the number of bits required for representing
the immediate in machine code. When the size of the immediate matches
the size of the other operand, no sign extension happens, so this was
incorrect. `asm.cmp(opnd64, 0x8000_0000)` panicked even though it's
encodable as `CMP r/m32, imm32`. Large shape ids were impacted by this
issue.

Co-Authored-By: Aaron Patterson &lt;tenderlove@ruby-lang.org&gt;
Co-Authored-By: Alan Wu &lt;alanwu@ruby-lang.org&gt;

Co-authored-by: Aaron Patterson &lt;tenderlove@ruby-lang.org&gt;
Co-authored-by: Alan Wu &lt;alanwu@ruby-lang.org&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
YJIT: x86_64: Fix cmp with number where sign bit is set

Before this commit, we were unconditionally treating unsigned ints as
signed ints when counting the number of bits required for representing
the immediate in machine code. When the size of the immediate matches
the size of the other operand, no sign extension happens, so this was
incorrect. `asm.cmp(opnd64, 0x8000_0000)` panicked even though it's
encodable as `CMP r/m32, imm32`. Large shape ids were impacted by this
issue.

Co-Authored-By: Aaron Patterson &lt;tenderlove@ruby-lang.org&gt;
Co-Authored-By: Alan Wu &lt;alanwu@ruby-lang.org&gt;

Co-authored-by: Aaron Patterson &lt;tenderlove@ruby-lang.org&gt;
Co-authored-by: Alan Wu &lt;alanwu@ruby-lang.org&gt;</pre>
</div>
</content>
</entry>
</feed>
