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).
YJIT: Use u32 for CodePtr to save 4 bytes each
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
CodePtrto be 4 bytes from 8.To derive a full raw pointer from a
CodePtr, one needs a base pointer.Both
CodeBlockandVirtualMemorycan be used for this purpose. Thebase 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_returnaddress untilcompile(),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).