diff options
author | Alan Wu <[email protected]> | 2023-10-16 18:35:26 -0400 |
---|---|---|
committer | Alan Wu <[email protected]> | 2023-11-07 17:43:43 -0500 |
commit | a1c61f0ae5f5ecaa7d8289942b78e6b0c77118fe (patch) | |
tree | 34ce4467e77196c9e6fc842f39b7bae0d8cd62c5 /yjit/src/yjit.rs | |
parent | aa6642de630cfc10063154d84e45a7bff30e9103 (diff) |
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 `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).
Diffstat (limited to 'yjit/src/yjit.rs')
-rw-r--r-- | yjit/src/yjit.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/yjit/src/yjit.rs b/yjit/src/yjit.rs index 8431168763..d2ec5f0568 100644 --- a/yjit/src/yjit.rs +++ b/yjit/src/yjit.rs @@ -145,7 +145,7 @@ pub extern "C" fn rb_yjit_iseq_gen_entry_point(iseq: IseqPtr, ec: EcPtr, jit_exc let maybe_code_ptr = with_compile_time(|| { gen_entry_point(iseq, ec, jit_exception) }); match maybe_code_ptr { - Some(ptr) => ptr.raw_ptr(), + Some(ptr) => ptr, None => std::ptr::null(), } } |